@infrab4a/connect 1.0.0-beta.29 → 1.0.0-beta.3

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 (928) hide show
  1. package/bundles/infrab4a-connect.umd.js +278 -2234
  2. package/bundles/infrab4a-connect.umd.js.map +1 -1
  3. package/esm2015/infrab4a-connect.js +2 -2
  4. package/esm2015/lib/domain/catalog/index.js +3 -0
  5. package/esm2015/lib/domain/catalog/models/category.js +7 -0
  6. package/esm2015/lib/domain/catalog/models/enums/index.js +2 -0
  7. package/esm2015/lib/domain/catalog/models/enums/shops.enum.js +6 -0
  8. package/esm2015/lib/domain/catalog/models/index.js +6 -0
  9. package/esm2015/lib/domain/catalog/models/product.js +11 -0
  10. package/esm2015/lib/domain/catalog/models/types/category-condition.type.js +2 -0
  11. package/esm2015/lib/domain/catalog/models/types/category-filter.type.js +2 -0
  12. package/esm2015/lib/domain/catalog/models/types/index.js +8 -0
  13. package/esm2015/lib/domain/catalog/models/types/product-review.type.js +2 -0
  14. package/esm2015/lib/domain/catalog/models/types/shops-description.type.js +2 -0
  15. package/esm2015/lib/domain/catalog/models/types/shops-price.type.js +2 -0
  16. package/esm2015/lib/domain/catalog/models/types/stock.type.js +2 -0
  17. package/esm2015/lib/domain/catalog/models/types/variant-grade.type.js +2 -0
  18. package/esm2015/lib/domain/catalog/models/variant.js +7 -0
  19. package/esm2015/lib/domain/catalog/repositories/category.repository.js +2 -0
  20. package/esm2015/lib/domain/catalog/repositories/index.js +5 -0
  21. package/esm2015/lib/domain/catalog/repositories/product.repository.js +2 -0
  22. package/esm2015/lib/domain/catalog/repositories/subscription-product.repository.js +2 -0
  23. package/esm2015/lib/domain/catalog/repositories/variant.repository.js +2 -0
  24. package/esm2015/lib/domain/general/index.js +3 -0
  25. package/esm2015/lib/domain/general/model/base-model-with-identifier-fields.js +2 -0
  26. package/esm2015/lib/domain/general/model/base.model.js +13 -0
  27. package/esm2015/lib/domain/general/model/identifier-fields.js +2 -0
  28. package/esm2015/lib/domain/general/model/index.js +5 -0
  29. package/esm2015/lib/domain/general/model/types/base-model-builder.type.js +2 -0
  30. package/esm2015/lib/domain/general/model/types/index.js +4 -0
  31. package/esm2015/lib/domain/general/model/types/non-function-properties.type.js +2 -0
  32. package/esm2015/lib/domain/general/model/types/non-function-property-name.type.js +2 -0
  33. package/esm2015/lib/domain/general/repository/create.repository.js +2 -0
  34. package/esm2015/lib/domain/general/repository/crud.repository.js +2 -0
  35. package/esm2015/lib/domain/general/repository/delete.repository.js +2 -0
  36. package/esm2015/lib/domain/general/repository/enums/index.js +3 -0
  37. package/esm2015/lib/domain/general/repository/enums/update-option-actions.enum.js +9 -0
  38. package/esm2015/lib/domain/general/repository/enums/where.enum.js +12 -0
  39. package/esm2015/lib/domain/general/repository/find.repository.js +2 -0
  40. package/esm2015/lib/domain/general/repository/get.repository.js +2 -0
  41. package/esm2015/lib/domain/general/repository/index.js +10 -0
  42. package/esm2015/lib/domain/general/repository/read.repository.js +2 -0
  43. package/esm2015/lib/domain/general/repository/types/index.js +6 -0
  44. package/esm2015/lib/domain/general/repository/types/repository-find-filters.type.js +2 -0
  45. package/esm2015/lib/domain/general/repository/types/repository-find-result.type.js +2 -0
  46. package/esm2015/lib/domain/general/repository/types/repository-limit-options.type.js +2 -0
  47. package/esm2015/lib/domain/general/repository/types/repository-order-by-list.type.js +2 -0
  48. package/esm2015/lib/domain/general/repository/types/repository-update-params.type.js +2 -0
  49. package/esm2015/lib/domain/general/repository/update.repository.js +2 -0
  50. package/esm2015/lib/domain/index.js +7 -0
  51. package/esm2015/lib/domain/location/index.js +2 -0
  52. package/esm2015/lib/domain/location/models/address.js +4 -0
  53. package/esm2015/lib/domain/location/models/index.js +3 -0
  54. package/esm2015/lib/domain/location/models/types/index.js +4 -0
  55. package/esm2015/lib/domain/location/models/types/location-bound.type.js +2 -0
  56. package/esm2015/lib/domain/location/models/types/location-geometry.type.js +2 -0
  57. package/esm2015/lib/domain/location/models/types/location-lat-lng.type.js +2 -0
  58. package/esm2015/lib/domain/shop-settings/enums/filter-type.enum.js +21 -0
  59. package/esm2015/lib/domain/shop-settings/enums/index.js +3 -0
  60. package/esm2015/lib/domain/shop-settings/enums/questions-filters.enum.js +21 -0
  61. package/esm2015/lib/domain/shop-settings/helpers/beauty-questions.helper.js +46 -0
  62. package/esm2015/lib/domain/shop-settings/helpers/index.js +2 -0
  63. package/esm2015/lib/domain/shop-settings/index.js +5 -0
  64. package/esm2015/lib/domain/shop-settings/models/home.js +7 -0
  65. package/esm2015/lib/domain/shop-settings/models/index.js +4 -0
  66. package/esm2015/lib/domain/shop-settings/models/shop-menu.js +7 -0
  67. package/esm2015/lib/domain/shop-settings/models/types/banner.type.js +2 -0
  68. package/esm2015/lib/domain/shop-settings/models/types/benefit.type.js +2 -0
  69. package/esm2015/lib/domain/shop-settings/models/types/index.js +5 -0
  70. package/esm2015/lib/domain/shop-settings/models/types/menu-nav.type.js +2 -0
  71. package/esm2015/lib/domain/shop-settings/models/types/sub-menu.type.js +2 -0
  72. package/esm2015/lib/domain/shop-settings/repositories/home.repository.js +2 -0
  73. package/esm2015/lib/domain/shop-settings/repositories/index.js +3 -0
  74. package/esm2015/lib/domain/shop-settings/repositories/shop-menu.repository.js +2 -0
  75. package/esm2015/lib/domain/shopping/index.js +3 -0
  76. package/esm2015/lib/domain/shopping/models/buy-2-win.js +14 -0
  77. package/esm2015/lib/domain/shopping/models/checkout.js +46 -0
  78. package/esm2015/lib/domain/shopping/models/coupons/club-coupon.js +18 -0
  79. package/esm2015/lib/domain/shopping/models/coupons/coupon.js +31 -0
  80. package/esm2015/lib/domain/shopping/models/coupons/enums/discount-type.enum.js +7 -0
  81. package/esm2015/lib/domain/shopping/models/coupons/enums/exclusivities.enum.js +7 -0
  82. package/esm2015/lib/domain/shopping/models/coupons/enums/index.js +3 -0
  83. package/esm2015/lib/domain/shopping/models/coupons/index.js +5 -0
  84. package/esm2015/lib/domain/shopping/models/coupons/store-coupon.js +23 -0
  85. package/esm2015/lib/domain/shopping/models/enums/checkout-types.enum.js +6 -0
  86. package/esm2015/lib/domain/shopping/models/enums/index.js +3 -0
  87. package/esm2015/lib/domain/shopping/models/enums/order-status.enum.js +12 -0
  88. package/esm2015/lib/domain/shopping/models/index.js +12 -0
  89. package/esm2015/lib/domain/shopping/models/line-item.js +4 -0
  90. package/esm2015/lib/domain/shopping/models/order.js +11 -0
  91. package/esm2015/lib/domain/shopping/models/payment.js +169 -0
  92. package/esm2015/lib/domain/shopping/models/shipping-method.js +7 -0
  93. package/esm2015/lib/domain/shopping/models/subscription/checkout.js +28 -0
  94. package/esm2015/lib/domain/shopping/models/subscription/index.js +3 -0
  95. package/esm2015/lib/domain/shopping/models/subscription/plan.js +7 -0
  96. package/esm2015/lib/domain/shopping/models/types/index.js +8 -0
  97. package/esm2015/lib/domain/shopping/models/types/payment-address.type.js +2 -0
  98. package/esm2015/lib/domain/shopping/models/types/payment-billing.type.js +2 -0
  99. package/esm2015/lib/domain/shopping/models/types/payment-card.type.js +2 -0
  100. package/esm2015/lib/domain/shopping/models/types/payment-customer.type.js +2 -0
  101. package/esm2015/lib/domain/shopping/models/types/payment-document.type.js +2 -0
  102. package/esm2015/lib/domain/shopping/models/types/payment-item.type.js +2 -0
  103. package/esm2015/lib/domain/shopping/models/types/payment-shipping.type.js +2 -0
  104. package/esm2015/lib/domain/shopping/repositories/buy-2-win.repository.js +2 -0
  105. package/esm2015/lib/domain/shopping/repositories/checkout.repository.js +2 -0
  106. package/esm2015/lib/domain/shopping/repositories/coupon.repository.js +2 -0
  107. package/esm2015/lib/domain/shopping/repositories/index.js +8 -0
  108. package/esm2015/lib/domain/shopping/repositories/legacy-order.repository.js +2 -0
  109. package/esm2015/lib/domain/shopping/repositories/order.repository.js +2 -0
  110. package/esm2015/lib/domain/shopping/repositories/payment.repository.js +2 -0
  111. package/esm2015/lib/domain/shopping/repositories/subscription/checkout.repository.js +2 -0
  112. package/esm2015/lib/domain/shopping/repositories/subscription/index.js +3 -0
  113. package/esm2015/lib/domain/shopping/repositories/subscription/plan.repository.js +2 -0
  114. package/esm2015/lib/domain/users/errors/index.js +4 -0
  115. package/esm2015/lib/domain/users/errors/unauthorized.error.js +7 -0
  116. package/esm2015/lib/domain/users/errors/user-already-registered.error.js +7 -0
  117. package/esm2015/lib/domain/users/errors/weak-password.error.js +7 -0
  118. package/esm2015/lib/domain/users/index.js +6 -0
  119. package/esm2015/lib/domain/users/models/beauty-profile.js +12 -0
  120. package/esm2015/lib/domain/users/models/enums/accessory-importances.enum.js +7 -0
  121. package/esm2015/lib/domain/users/models/enums/area.enum.js +13 -0
  122. package/esm2015/lib/domain/users/models/enums/beard-problems.enum.js +11 -0
  123. package/esm2015/lib/domain/users/models/enums/beard-sizes.enum.js +9 -0
  124. package/esm2015/lib/domain/users/models/enums/beauty-product-importances.enum.js +8 -0
  125. package/esm2015/lib/domain/users/models/enums/body-problems.enum.js +13 -0
  126. package/esm2015/lib/domain/users/models/enums/body-shapes.enum.js +9 -0
  127. package/esm2015/lib/domain/users/models/enums/body-tattoos.enum.js +7 -0
  128. package/esm2015/lib/domain/users/models/enums/face-skin-oilinesses.enum.js +9 -0
  129. package/esm2015/lib/domain/users/models/enums/face-skin-problems.enum.js +12 -0
  130. package/esm2015/lib/domain/users/models/enums/face-skin-tones.enum.js +10 -0
  131. package/esm2015/lib/domain/users/models/enums/family-incomes.enum.js +10 -0
  132. package/esm2015/lib/domain/users/models/enums/fragrance-importances.enum.js +7 -0
  133. package/esm2015/lib/domain/users/models/enums/hair-colors.enum.js +12 -0
  134. package/esm2015/lib/domain/users/models/enums/hair-problems.enum.js +12 -0
  135. package/esm2015/lib/domain/users/models/enums/hair-strands.enum.js +10 -0
  136. package/esm2015/lib/domain/users/models/enums/hair-types.enum.js +9 -0
  137. package/esm2015/lib/domain/users/models/enums/index.js +21 -0
  138. package/esm2015/lib/domain/users/models/enums/office-position.enum.js +8 -0
  139. package/esm2015/lib/domain/users/models/enums/product-spents.enum.js +10 -0
  140. package/esm2015/lib/domain/users/models/enums/user-type.enum.js +10 -0
  141. package/esm2015/lib/domain/users/models/index.js +8 -0
  142. package/esm2015/lib/domain/users/models/lead.js +7 -0
  143. package/esm2015/lib/domain/users/models/subscription/edition.js +7 -0
  144. package/esm2015/lib/domain/users/models/subscription/enums/billing-status.enum.js +5 -0
  145. package/esm2015/lib/domain/users/models/subscription/enums/edition-status.enum.js +6 -0
  146. package/esm2015/lib/domain/users/models/subscription/enums/index.js +5 -0
  147. package/esm2015/lib/domain/users/models/subscription/enums/payment-type.enum.js +7 -0
  148. package/esm2015/lib/domain/users/models/subscription/enums/status.enum.js +6 -0
  149. package/esm2015/lib/domain/users/models/subscription/index.js +5 -0
  150. package/esm2015/lib/domain/users/models/subscription/payment.js +14 -0
  151. package/esm2015/lib/domain/users/models/subscription/subscription.js +43 -0
  152. package/esm2015/lib/domain/users/models/user-address.js +7 -0
  153. package/esm2015/lib/domain/users/models/user-payment-method.js +7 -0
  154. package/esm2015/lib/domain/users/models/user.js +26 -0
  155. package/esm2015/lib/domain/users/repositories/beauty-profile.repository.js +2 -0
  156. package/esm2015/lib/domain/users/repositories/edition.repository.js +2 -0
  157. package/esm2015/lib/domain/users/repositories/index.js +9 -0
  158. package/esm2015/lib/domain/users/repositories/lead.repository.js +2 -0
  159. package/esm2015/lib/domain/users/repositories/subscription-payment.repository.js +2 -0
  160. package/esm2015/lib/domain/users/repositories/subscription.repository.js +2 -0
  161. package/esm2015/lib/domain/users/repositories/user-address.repository.js +2 -0
  162. package/esm2015/lib/domain/users/repositories/user-payment-method.repository.js +2 -0
  163. package/esm2015/lib/domain/users/repositories/user.repository.js +2 -0
  164. package/esm2015/lib/domain/users/services/authentication.service.js +2 -0
  165. package/esm2015/lib/domain/users/services/index.js +4 -0
  166. package/esm2015/lib/domain/users/services/register.service.js +2 -0
  167. package/esm2015/lib/domain/users/services/types/basic-user-data.type.js +2 -0
  168. package/esm2015/lib/domain/users/services/types/index.js +2 -0
  169. package/esm2015/lib/domain/users/use-cases/authentication.js +40 -0
  170. package/esm2015/lib/domain/users/use-cases/index.js +4 -0
  171. package/esm2015/lib/domain/users/use-cases/register.js +34 -0
  172. package/esm2015/lib/domain/users/use-cases/signout.js +12 -0
  173. package/esm2015/lib/errors/duplicated-results.error.js +7 -0
  174. package/esm2015/lib/errors/index.js +5 -0
  175. package/esm2015/lib/errors/invalid-argument.error.js +7 -0
  176. package/esm2015/lib/errors/not-found.error.js +7 -0
  177. package/esm2015/lib/errors/required-argument.error.js +8 -0
  178. package/esm2015/lib/index.js +5 -0
  179. package/esm2015/lib/infra/firebase/auth/authentication-firebase-auth.service.js +47 -0
  180. package/esm2015/lib/infra/firebase/auth/index.js +3 -0
  181. package/esm2015/lib/infra/firebase/auth/register-firebase-auth.service.js +26 -0
  182. package/esm2015/lib/infra/firebase/auth/types/firebase-user-with-id.type.js +2 -0
  183. package/esm2015/lib/infra/firebase/firestore/index.js +4 -0
  184. package/esm2015/lib/infra/firebase/firestore/mixins/index.js +10 -0
  185. package/esm2015/lib/infra/firebase/firestore/mixins/with-create-firestore.mixin.js +31 -0
  186. package/esm2015/lib/infra/firebase/firestore/mixins/with-crud-firestore.mixin.js +10 -0
  187. package/esm2015/lib/infra/firebase/firestore/mixins/with-delete-firestore.mixin.js +18 -0
  188. package/esm2015/lib/infra/firebase/firestore/mixins/with-find-firestore.mixin.js +76 -0
  189. package/esm2015/lib/infra/firebase/firestore/mixins/with-firestore.mixin.js +26 -0
  190. package/esm2015/lib/infra/firebase/firestore/mixins/with-get-firestore.mixin.js +24 -0
  191. package/esm2015/lib/infra/firebase/firestore/mixins/with-helpers.mixin.js +17 -0
  192. package/esm2015/lib/infra/firebase/firestore/mixins/with-sub-collection.mixin.js +11 -0
  193. package/esm2015/lib/infra/firebase/firestore/mixins/with-update-firestore.mixin.js +45 -0
  194. package/esm2015/lib/infra/firebase/firestore/models/user-search.js +7 -0
  195. package/esm2015/lib/infra/firebase/firestore/repositories/catalog/category-firestore.repository.js +78 -0
  196. package/esm2015/lib/infra/firebase/firestore/repositories/catalog/index.js +5 -0
  197. package/esm2015/lib/infra/firebase/firestore/repositories/catalog/product-firestore.repository.js +23 -0
  198. package/esm2015/lib/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.js +14 -0
  199. package/esm2015/lib/infra/firebase/firestore/repositories/catalog/subscription-product-firestore.repository.js +12 -0
  200. package/esm2015/lib/infra/firebase/firestore/repositories/index.js +5 -0
  201. package/esm2015/lib/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.js +12 -0
  202. package/esm2015/lib/infra/firebase/firestore/repositories/shop-settings/index.js +3 -0
  203. package/esm2015/lib/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.js +12 -0
  204. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.js +12 -0
  205. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.js +12 -0
  206. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.js +12 -0
  207. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.js +39 -0
  208. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/index.js +9 -0
  209. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/legacy-order-firestore.repository.js +9 -0
  210. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/order-firestore.repository.js +12 -0
  211. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.js +12 -0
  212. package/esm2015/lib/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.js +12 -0
  213. package/esm2015/lib/infra/firebase/firestore/repositories/users/index.js +10 -0
  214. package/esm2015/lib/infra/firebase/firestore/repositories/users/lead-firestore.repository.js +12 -0
  215. package/esm2015/lib/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.js +14 -0
  216. package/esm2015/lib/infra/firebase/firestore/repositories/users/subscription-firestore.repository.js +12 -0
  217. package/esm2015/lib/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.js +14 -0
  218. package/esm2015/lib/infra/firebase/firestore/repositories/users/user-address-firestore.repository.js +14 -0
  219. package/esm2015/lib/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.js +14 -0
  220. package/esm2015/lib/infra/firebase/firestore/repositories/users/user-firestore.repository.js +70 -0
  221. package/esm2015/lib/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.js +14 -0
  222. package/esm2015/lib/infra/firebase/firestore/repositories/users/user-search-firestore.repository.js +12 -0
  223. package/esm2015/lib/infra/firebase/firestore/types/firestore-sub.repository.type.js +2 -0
  224. package/esm2015/lib/infra/firebase/firestore/types/firestore.helpers.type.js +2 -0
  225. package/esm2015/lib/infra/firebase/firestore/types/firestore.repository.type.js +2 -0
  226. package/esm2015/lib/infra/firebase/firestore/types/index.js +4 -0
  227. package/esm2015/lib/infra/firebase/index.js +3 -0
  228. package/esm2015/lib/infra/index.js +2 -0
  229. package/esm2015/lib/utils/index.js +5 -0
  230. package/esm2015/lib/utils/mixins/base.mixin.js +6 -0
  231. package/esm2015/lib/utils/mixins/index.js +3 -0
  232. package/esm2015/lib/utils/mixins/mixin-ctor.type.js +2 -0
  233. package/esm2015/lib/utils/types/index.js +2 -0
  234. package/esm2015/lib/utils/types/prop.type.js +2 -0
  235. package/esm2015/public-api.js +3 -0
  236. package/fesm2015/infrab4a-connect.js +173 -1466
  237. package/fesm2015/infrab4a-connect.js.map +1 -1
  238. package/infrab4a-connect.d.ts +1 -1
  239. package/lib/domain/catalog/models/category.d.ts +22 -0
  240. package/lib/domain/catalog/models/enums/shops.enum.d.ts +4 -0
  241. package/lib/domain/catalog/models/index.d.ts +5 -0
  242. package/lib/domain/catalog/models/product.d.ts +33 -0
  243. package/lib/domain/catalog/models/types/product-review.type.d.ts +14 -0
  244. package/lib/domain/catalog/models/variant.d.ts +14 -0
  245. package/lib/domain/catalog/repositories/category.repository.d.ts +12 -0
  246. package/lib/domain/catalog/repositories/product.repository.d.ts +5 -0
  247. package/lib/domain/catalog/repositories/subscription-product.repository.d.ts +4 -0
  248. package/lib/domain/catalog/repositories/variant.repository.d.ts +4 -0
  249. package/lib/domain/general/model/base-model-with-identifier-fields.d.ts +3 -0
  250. package/lib/domain/general/model/base.model.d.ts +6 -0
  251. package/lib/domain/general/model/index.d.ts +4 -0
  252. package/lib/domain/general/model/types/base-model-builder.type.d.ts +5 -0
  253. package/lib/domain/general/model/types/index.d.ts +3 -0
  254. package/lib/domain/general/model/types/non-function-properties.type.d.ts +2 -0
  255. package/lib/domain/general/model/types/non-function-property-name.type.d.ts +3 -0
  256. package/lib/domain/general/repository/create.repository.d.ts +5 -0
  257. package/lib/domain/general/repository/crud.repository.d.ts +7 -0
  258. package/lib/domain/general/repository/delete.repository.d.ts +5 -0
  259. package/lib/domain/general/repository/enums/where.enum.d.ts +10 -0
  260. package/lib/domain/general/repository/find.repository.d.ts +5 -0
  261. package/lib/domain/general/repository/get.repository.d.ts +5 -0
  262. package/lib/domain/general/repository/read.repository.d.ts +5 -0
  263. package/lib/domain/general/repository/types/index.d.ts +5 -0
  264. package/lib/domain/general/repository/types/repository-find-filters.type.d.ts +14 -0
  265. package/lib/domain/general/repository/types/repository-update-params.type.d.ts +11 -0
  266. package/lib/domain/general/repository/update.repository.d.ts +5 -0
  267. package/lib/domain/index.d.ts +6 -0
  268. package/lib/domain/location/models/address.d.ts +21 -0
  269. package/lib/domain/shop-settings/models/home.d.ts +17 -0
  270. package/lib/domain/shop-settings/models/shop-menu.d.ts +7 -0
  271. package/lib/domain/shop-settings/models/types/index.d.ts +4 -0
  272. package/lib/domain/shop-settings/repositories/home.repository.d.ts +4 -0
  273. package/lib/domain/shop-settings/repositories/shop-menu.repository.d.ts +4 -0
  274. package/lib/domain/shopping/models/buy-2-win.d.ts +18 -0
  275. package/lib/domain/shopping/models/checkout.d.ts +28 -0
  276. package/lib/domain/shopping/models/coupons/club-coupon.d.ts +7 -0
  277. package/lib/domain/shopping/models/coupons/coupon.d.ts +28 -0
  278. package/lib/domain/shopping/models/coupons/enums/discount-type.enum.d.ts +5 -0
  279. package/lib/domain/shopping/models/coupons/enums/index.d.ts +2 -0
  280. package/lib/domain/shopping/models/coupons/index.d.ts +4 -0
  281. package/lib/domain/shopping/models/coupons/store-coupon.d.ts +8 -0
  282. package/lib/domain/shopping/models/payment.d.ts +69 -0
  283. package/lib/domain/shopping/models/shipping-method.d.ts +18 -0
  284. package/lib/domain/shopping/models/subscription/checkout.d.ts +23 -0
  285. package/lib/domain/shopping/models/subscription/plan.d.ts +12 -0
  286. package/lib/domain/shopping/repositories/buy-2-win.repository.d.ts +4 -0
  287. package/lib/domain/shopping/repositories/checkout.repository.d.ts +4 -0
  288. package/lib/domain/shopping/repositories/coupon.repository.d.ts +4 -0
  289. package/lib/domain/shopping/repositories/order.repository.d.ts +4 -0
  290. package/lib/domain/shopping/repositories/payment.repository.d.ts +4 -0
  291. package/lib/domain/shopping/repositories/subscription/checkout.repository.d.ts +4 -0
  292. package/lib/domain/shopping/repositories/subscription/plan.repository.d.ts +4 -0
  293. package/lib/domain/users/errors/unauthorized.error.d.ts +4 -0
  294. package/lib/domain/users/errors/user-already-registered.error.d.ts +4 -0
  295. package/lib/domain/users/errors/weak-password.error.d.ts +4 -0
  296. package/lib/domain/users/models/beauty-profile.d.ts +12 -0
  297. package/lib/domain/users/models/lead.d.ts +9 -0
  298. package/lib/domain/users/models/subscription/edition.d.ts +15 -0
  299. package/lib/domain/users/models/subscription/payment.d.ts +14 -0
  300. package/lib/domain/users/models/subscription/subscription.d.ts +30 -0
  301. package/lib/domain/users/models/user-address.d.ts +7 -0
  302. package/lib/domain/users/models/user-payment-method.d.ts +13 -0
  303. package/lib/domain/users/models/user.d.ts +24 -0
  304. package/lib/domain/users/repositories/beauty-profile.repository.d.ts +4 -0
  305. package/lib/domain/users/repositories/edition.repository.d.ts +4 -0
  306. package/lib/domain/users/repositories/lead.repository.d.ts +4 -0
  307. package/lib/domain/users/repositories/subscription-payment.repository.d.ts +4 -0
  308. package/lib/domain/users/repositories/subscription.repository.d.ts +4 -0
  309. package/lib/domain/users/repositories/user-address.repository.d.ts +4 -0
  310. package/lib/domain/users/repositories/user-payment-method.repository.d.ts +4 -0
  311. package/lib/domain/users/repositories/user.repository.d.ts +6 -0
  312. package/lib/domain/users/services/authentication.service.d.ts +11 -0
  313. package/lib/domain/users/use-cases/index.d.ts +3 -0
  314. package/lib/errors/duplicated-results.error.d.ts +4 -0
  315. package/lib/errors/invalid-argument.error.d.ts +4 -0
  316. package/lib/errors/not-found.error.d.ts +4 -0
  317. package/lib/errors/required-argument.error.d.ts +5 -0
  318. package/lib/index.d.ts +4 -0
  319. package/lib/infra/firebase/auth/authentication-firebase-auth.service.d.ts +11 -0
  320. package/lib/infra/firebase/auth/register-firebase-auth.service.d.ts +8 -0
  321. package/lib/infra/firebase/firestore/mixins/with-create-firestore.mixin.d.ts +17 -0
  322. package/lib/infra/firebase/firestore/mixins/with-crud-firestore.mixin.d.ts +29 -0
  323. package/lib/infra/firebase/firestore/mixins/with-delete-firestore.mixin.d.ts +15 -0
  324. package/lib/infra/firebase/firestore/mixins/with-find-firestore.mixin.d.ts +20 -0
  325. package/lib/infra/firebase/firestore/mixins/with-firestore.mixin.d.ts +15 -0
  326. package/lib/infra/firebase/firestore/mixins/with-get-firestore.mixin.d.ts +15 -0
  327. package/lib/infra/firebase/firestore/mixins/with-helpers.mixin.d.ts +10 -0
  328. package/lib/infra/firebase/firestore/mixins/with-sub-collection.mixin.d.ts +14 -0
  329. package/lib/infra/firebase/firestore/mixins/with-update-firestore.mixin.d.ts +16 -0
  330. package/lib/infra/firebase/firestore/models/user-search.d.ts +9 -0
  331. package/lib/infra/firebase/firestore/repositories/catalog/category-firestore.repository.d.ts +55 -0
  332. package/lib/infra/firebase/firestore/repositories/catalog/product-firestore.repository.d.ts +50 -0
  333. package/lib/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.d.ts +60 -0
  334. package/lib/infra/firebase/firestore/repositories/catalog/subscription-product-firestore.repository.d.ts +49 -0
  335. package/lib/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.d.ts +49 -0
  336. package/lib/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.d.ts +49 -0
  337. package/lib/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.d.ts +49 -0
  338. package/lib/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.d.ts +49 -0
  339. package/lib/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.d.ts +49 -0
  340. package/lib/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.d.ts +53 -0
  341. package/lib/infra/firebase/firestore/repositories/shopping/order-firestore.repository.d.ts +49 -0
  342. package/lib/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.d.ts +49 -0
  343. package/lib/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.d.ts +49 -0
  344. package/lib/infra/firebase/firestore/repositories/users/lead-firestore.repository.d.ts +49 -0
  345. package/lib/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.d.ts +60 -0
  346. package/lib/infra/firebase/firestore/repositories/users/subscription-firestore.repository.d.ts +49 -0
  347. package/lib/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.d.ts +60 -0
  348. package/lib/infra/firebase/firestore/repositories/users/user-address-firestore.repository.d.ts +60 -0
  349. package/lib/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.d.ts +60 -0
  350. package/lib/infra/firebase/firestore/repositories/users/user-firestore.repository.d.ts +60 -0
  351. package/lib/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.d.ts +60 -0
  352. package/lib/infra/firebase/firestore/repositories/users/user-search-firestore.repository.d.ts +50 -0
  353. package/lib/infra/firebase/firestore/types/firestore-sub.repository.type.d.ts +6 -0
  354. package/lib/infra/firebase/firestore/types/firestore.helpers.type.d.ts +8 -0
  355. package/lib/infra/firebase/firestore/types/firestore.repository.type.d.ts +8 -0
  356. package/lib/infra/index.d.ts +1 -0
  357. package/lib/utils/index.d.ts +4 -0
  358. package/lib/utils/mixins/index.d.ts +2 -0
  359. package/lib/utils/mixins/mixin-ctor.type.d.ts +1 -0
  360. package/lib/utils/types/index.d.ts +1 -0
  361. package/package.json +3 -7
  362. package/public-api.d.ts +2 -0
  363. package/domain/catalog/models/category.d.ts +0 -23
  364. package/domain/catalog/models/enums/shops.enum.d.ts +0 -5
  365. package/domain/catalog/models/index.d.ts +0 -6
  366. package/domain/catalog/models/kit-product.d.ts +0 -12
  367. package/domain/catalog/models/product.d.ts +0 -39
  368. package/domain/catalog/models/types/product-review.type.d.ts +0 -17
  369. package/domain/catalog/models/variant.d.ts +0 -18
  370. package/domain/catalog/repositories/category.repository.d.ts +0 -15
  371. package/domain/catalog/repositories/product.repository.d.ts +0 -12
  372. package/domain/catalog/repositories/subscription-product.repository.d.ts +0 -4
  373. package/domain/catalog/repositories/variant.repository.d.ts +0 -4
  374. package/domain/generic/model/base.model.d.ts +0 -10
  375. package/domain/generic/model/index.d.ts +0 -3
  376. package/domain/generic/model/types/base-model-builder.type.d.ts +0 -15
  377. package/domain/generic/model/types/identifier-model.type.d.ts +0 -7
  378. package/domain/generic/model/types/index.d.ts +0 -5
  379. package/domain/generic/model/types/model-base-structure.type.d.ts +0 -6
  380. package/domain/generic/model/types/non-function-properties.type.d.ts +0 -12
  381. package/domain/generic/model/types/non-function-property-name.type.d.ts +0 -4
  382. package/domain/generic/repository/create.repository.d.ts +0 -8
  383. package/domain/generic/repository/crud.repository.d.ts +0 -19
  384. package/domain/generic/repository/delete.repository.d.ts +0 -7
  385. package/domain/generic/repository/enums/where.enum.d.ts +0 -13
  386. package/domain/generic/repository/find.repository.d.ts +0 -11
  387. package/domain/generic/repository/get.repository.d.ts +0 -5
  388. package/domain/generic/repository/read.repository.d.ts +0 -14
  389. package/domain/generic/repository/types/index.d.ts +0 -6
  390. package/domain/generic/repository/types/repository-find-filters.type.d.ts +0 -13
  391. package/domain/generic/repository/types/repository-update-params.type.d.ts +0 -11
  392. package/domain/generic/repository/types/where-options.type.d.ts +0 -2
  393. package/domain/generic/repository/update.repository.d.ts +0 -6
  394. package/domain/index.d.ts +0 -6
  395. package/domain/location/models/address.d.ts +0 -22
  396. package/domain/shop-settings/models/home.d.ts +0 -17
  397. package/domain/shop-settings/models/shop-menu.d.ts +0 -7
  398. package/domain/shop-settings/models/types/home-data.type.d.ts +0 -15
  399. package/domain/shop-settings/models/types/index.d.ts +0 -5
  400. package/domain/shop-settings/repositories/home.repository.d.ts +0 -4
  401. package/domain/shop-settings/repositories/shop-menu.repository.d.ts +0 -4
  402. package/domain/shopping/models/buy-2-win.d.ts +0 -16
  403. package/domain/shopping/models/checkout.d.ts +0 -27
  404. package/domain/shopping/models/coupons/coupon.d.ts +0 -26
  405. package/domain/shopping/models/coupons/enums/coupon-subtypes.enum.d.ts +0 -4
  406. package/domain/shopping/models/coupons/enums/coupon-types.enum.d.ts +0 -6
  407. package/domain/shopping/models/coupons/enums/index.d.ts +0 -3
  408. package/domain/shopping/models/coupons/financial-coupon.d.ts +0 -9
  409. package/domain/shopping/models/coupons/index.d.ts +0 -3
  410. package/domain/shopping/models/payment.d.ts +0 -67
  411. package/domain/shopping/models/shipping-method.d.ts +0 -16
  412. package/domain/shopping/models/subscription/checkout.d.ts +0 -21
  413. package/domain/shopping/models/subscription/plan.d.ts +0 -10
  414. package/domain/shopping/repositories/buy-2-win.repository.d.ts +0 -4
  415. package/domain/shopping/repositories/checkout.repository.d.ts +0 -4
  416. package/domain/shopping/repositories/coupon.repository.d.ts +0 -4
  417. package/domain/shopping/repositories/order.repository.d.ts +0 -4
  418. package/domain/shopping/repositories/payment.repository.d.ts +0 -4
  419. package/domain/shopping/repositories/subscription/checkout.repository.d.ts +0 -4
  420. package/domain/shopping/repositories/subscription/plan.repository.d.ts +0 -4
  421. package/domain/users/errors/unauthorized.error.d.ts +0 -5
  422. package/domain/users/errors/user-already-registered.error.d.ts +0 -5
  423. package/domain/users/errors/weak-password.error.d.ts +0 -5
  424. package/domain/users/models/beauty-profile.d.ts +0 -11
  425. package/domain/users/models/lead.d.ts +0 -7
  426. package/domain/users/models/subscription/edition.d.ts +0 -16
  427. package/domain/users/models/subscription/payment.d.ts +0 -13
  428. package/domain/users/models/subscription/subscription.d.ts +0 -28
  429. package/domain/users/models/user-address.d.ts +0 -7
  430. package/domain/users/models/user-payment-method.d.ts +0 -14
  431. package/domain/users/models/user.d.ts +0 -26
  432. package/domain/users/repositories/beauty-profile.repository.d.ts +0 -4
  433. package/domain/users/repositories/edition.repository.d.ts +0 -4
  434. package/domain/users/repositories/lead.repository.d.ts +0 -4
  435. package/domain/users/repositories/subscription-payment.repository.d.ts +0 -4
  436. package/domain/users/repositories/subscription.repository.d.ts +0 -4
  437. package/domain/users/repositories/user-address.repository.d.ts +0 -4
  438. package/domain/users/repositories/user-payment-method.repository.d.ts +0 -4
  439. package/domain/users/repositories/user.repository.d.ts +0 -6
  440. package/domain/users/services/authentication.service.d.ts +0 -12
  441. package/domain/users/use-cases/index.d.ts +0 -4
  442. package/domain/users/use-cases/recovery-password.d.ts +0 -6
  443. package/errors/duplicated-results.error.d.ts +0 -5
  444. package/errors/invalid-argument.error.d.ts +0 -5
  445. package/errors/not-found.error.d.ts +0 -5
  446. package/errors/required-argument.error.d.ts +0 -6
  447. package/esm2015/domain/catalog/index.js +0 -3
  448. package/esm2015/domain/catalog/models/category.js +0 -10
  449. package/esm2015/domain/catalog/models/enums/index.js +0 -2
  450. package/esm2015/domain/catalog/models/enums/shops.enum.js +0 -7
  451. package/esm2015/domain/catalog/models/index.js +0 -7
  452. package/esm2015/domain/catalog/models/kit-product.js +0 -18
  453. package/esm2015/domain/catalog/models/product.js +0 -21
  454. package/esm2015/domain/catalog/models/types/category-condition.type.js +0 -2
  455. package/esm2015/domain/catalog/models/types/category-filter.type.js +0 -2
  456. package/esm2015/domain/catalog/models/types/index.js +0 -8
  457. package/esm2015/domain/catalog/models/types/product-review.type.js +0 -2
  458. package/esm2015/domain/catalog/models/types/shops-description.type.js +0 -2
  459. package/esm2015/domain/catalog/models/types/shops-price.type.js +0 -2
  460. package/esm2015/domain/catalog/models/types/stock.type.js +0 -2
  461. package/esm2015/domain/catalog/models/types/variant-grade.type.js +0 -2
  462. package/esm2015/domain/catalog/models/variant.js +0 -10
  463. package/esm2015/domain/catalog/repositories/category.repository.js +0 -2
  464. package/esm2015/domain/catalog/repositories/index.js +0 -5
  465. package/esm2015/domain/catalog/repositories/product.repository.js +0 -2
  466. package/esm2015/domain/catalog/repositories/subscription-product.repository.js +0 -2
  467. package/esm2015/domain/catalog/repositories/variant.repository.js +0 -2
  468. package/esm2015/domain/generic/index.js +0 -3
  469. package/esm2015/domain/generic/model/base.model.js +0 -23
  470. package/esm2015/domain/generic/model/identifier-fields.js +0 -2
  471. package/esm2015/domain/generic/model/index.js +0 -4
  472. package/esm2015/domain/generic/model/types/base-model-builder.type.js +0 -2
  473. package/esm2015/domain/generic/model/types/identifier-model.type.js +0 -2
  474. package/esm2015/domain/generic/model/types/index.js +0 -6
  475. package/esm2015/domain/generic/model/types/model-base-structure.type.js +0 -2
  476. package/esm2015/domain/generic/model/types/non-function-properties.type.js +0 -2
  477. package/esm2015/domain/generic/model/types/non-function-property-name.type.js +0 -2
  478. package/esm2015/domain/generic/repository/create.repository.js +0 -2
  479. package/esm2015/domain/generic/repository/crud.repository.js +0 -2
  480. package/esm2015/domain/generic/repository/delete.repository.js +0 -2
  481. package/esm2015/domain/generic/repository/enums/index.js +0 -3
  482. package/esm2015/domain/generic/repository/enums/update-option-actions.enum.js +0 -9
  483. package/esm2015/domain/generic/repository/enums/where.enum.js +0 -15
  484. package/esm2015/domain/generic/repository/find.repository.js +0 -2
  485. package/esm2015/domain/generic/repository/get.repository.js +0 -2
  486. package/esm2015/domain/generic/repository/index.js +0 -10
  487. package/esm2015/domain/generic/repository/read.repository.js +0 -2
  488. package/esm2015/domain/generic/repository/types/index.js +0 -7
  489. package/esm2015/domain/generic/repository/types/repository-find-filters.type.js +0 -2
  490. package/esm2015/domain/generic/repository/types/repository-find-result.type.js +0 -2
  491. package/esm2015/domain/generic/repository/types/repository-limit-options.type.js +0 -2
  492. package/esm2015/domain/generic/repository/types/repository-order-by-list.type.js +0 -2
  493. package/esm2015/domain/generic/repository/types/repository-update-params.type.js +0 -2
  494. package/esm2015/domain/generic/repository/types/where-options.type.js +0 -2
  495. package/esm2015/domain/generic/repository/update.repository.js +0 -2
  496. package/esm2015/domain/index.js +0 -7
  497. package/esm2015/domain/location/index.js +0 -2
  498. package/esm2015/domain/location/models/address.js +0 -7
  499. package/esm2015/domain/location/models/index.js +0 -3
  500. package/esm2015/domain/location/models/types/index.js +0 -4
  501. package/esm2015/domain/location/models/types/location-bound.type.js +0 -2
  502. package/esm2015/domain/location/models/types/location-geometry.type.js +0 -2
  503. package/esm2015/domain/location/models/types/location-lat-lng.type.js +0 -2
  504. package/esm2015/domain/shop-settings/enums/filter-type.enum.js +0 -21
  505. package/esm2015/domain/shop-settings/enums/index.js +0 -3
  506. package/esm2015/domain/shop-settings/enums/questions-filters.enum.js +0 -21
  507. package/esm2015/domain/shop-settings/helpers/beauty-questions.helper.js +0 -46
  508. package/esm2015/domain/shop-settings/helpers/index.js +0 -2
  509. package/esm2015/domain/shop-settings/index.js +0 -5
  510. package/esm2015/domain/shop-settings/models/home.js +0 -7
  511. package/esm2015/domain/shop-settings/models/index.js +0 -4
  512. package/esm2015/domain/shop-settings/models/shop-menu.js +0 -7
  513. package/esm2015/domain/shop-settings/models/types/banner.type.js +0 -2
  514. package/esm2015/domain/shop-settings/models/types/benefit.type.js +0 -2
  515. package/esm2015/domain/shop-settings/models/types/home-data.type.js +0 -2
  516. package/esm2015/domain/shop-settings/models/types/index.js +0 -6
  517. package/esm2015/domain/shop-settings/models/types/menu-nav.type.js +0 -2
  518. package/esm2015/domain/shop-settings/models/types/sub-menu.type.js +0 -2
  519. package/esm2015/domain/shop-settings/repositories/home.repository.js +0 -2
  520. package/esm2015/domain/shop-settings/repositories/index.js +0 -3
  521. package/esm2015/domain/shop-settings/repositories/shop-menu.repository.js +0 -2
  522. package/esm2015/domain/shopping/index.js +0 -3
  523. package/esm2015/domain/shopping/models/buy-2-win.js +0 -14
  524. package/esm2015/domain/shopping/models/checkout.js +0 -38
  525. package/esm2015/domain/shopping/models/coupons/coupon.js +0 -23
  526. package/esm2015/domain/shopping/models/coupons/enums/coupon-subtypes.enum.js +0 -6
  527. package/esm2015/domain/shopping/models/coupons/enums/coupon-types.enum.js +0 -8
  528. package/esm2015/domain/shopping/models/coupons/enums/exclusivities.enum.js +0 -7
  529. package/esm2015/domain/shopping/models/coupons/enums/index.js +0 -4
  530. package/esm2015/domain/shopping/models/coupons/financial-coupon.js +0 -28
  531. package/esm2015/domain/shopping/models/coupons/index.js +0 -4
  532. package/esm2015/domain/shopping/models/enums/checkout-types.enum.js +0 -6
  533. package/esm2015/domain/shopping/models/enums/index.js +0 -3
  534. package/esm2015/domain/shopping/models/enums/order-status.enum.js +0 -12
  535. package/esm2015/domain/shopping/models/index.js +0 -12
  536. package/esm2015/domain/shopping/models/line-item.js +0 -4
  537. package/esm2015/domain/shopping/models/order.js +0 -11
  538. package/esm2015/domain/shopping/models/payment.js +0 -169
  539. package/esm2015/domain/shopping/models/shipping-method.js +0 -7
  540. package/esm2015/domain/shopping/models/subscription/checkout.js +0 -28
  541. package/esm2015/domain/shopping/models/subscription/index.js +0 -3
  542. package/esm2015/domain/shopping/models/subscription/plan.js +0 -7
  543. package/esm2015/domain/shopping/models/types/index.js +0 -8
  544. package/esm2015/domain/shopping/models/types/payment-address.type.js +0 -2
  545. package/esm2015/domain/shopping/models/types/payment-billing.type.js +0 -2
  546. package/esm2015/domain/shopping/models/types/payment-card.type.js +0 -2
  547. package/esm2015/domain/shopping/models/types/payment-customer.type.js +0 -2
  548. package/esm2015/domain/shopping/models/types/payment-document.type.js +0 -2
  549. package/esm2015/domain/shopping/models/types/payment-item.type.js +0 -2
  550. package/esm2015/domain/shopping/models/types/payment-shipping.type.js +0 -2
  551. package/esm2015/domain/shopping/repositories/buy-2-win.repository.js +0 -2
  552. package/esm2015/domain/shopping/repositories/checkout.repository.js +0 -2
  553. package/esm2015/domain/shopping/repositories/coupon.repository.js +0 -2
  554. package/esm2015/domain/shopping/repositories/index.js +0 -8
  555. package/esm2015/domain/shopping/repositories/legacy-order.repository.js +0 -2
  556. package/esm2015/domain/shopping/repositories/order.repository.js +0 -2
  557. package/esm2015/domain/shopping/repositories/payment.repository.js +0 -2
  558. package/esm2015/domain/shopping/repositories/subscription/checkout.repository.js +0 -2
  559. package/esm2015/domain/shopping/repositories/subscription/index.js +0 -3
  560. package/esm2015/domain/shopping/repositories/subscription/plan.repository.js +0 -2
  561. package/esm2015/domain/users/errors/index.js +0 -4
  562. package/esm2015/domain/users/errors/unauthorized.error.js +0 -8
  563. package/esm2015/domain/users/errors/user-already-registered.error.js +0 -8
  564. package/esm2015/domain/users/errors/weak-password.error.js +0 -8
  565. package/esm2015/domain/users/index.js +0 -6
  566. package/esm2015/domain/users/models/beauty-profile.js +0 -12
  567. package/esm2015/domain/users/models/enums/accessory-importances.enum.js +0 -7
  568. package/esm2015/domain/users/models/enums/area.enum.js +0 -13
  569. package/esm2015/domain/users/models/enums/beard-problems.enum.js +0 -11
  570. package/esm2015/domain/users/models/enums/beard-sizes.enum.js +0 -9
  571. package/esm2015/domain/users/models/enums/beauty-product-importances.enum.js +0 -8
  572. package/esm2015/domain/users/models/enums/body-problems.enum.js +0 -13
  573. package/esm2015/domain/users/models/enums/body-shapes.enum.js +0 -9
  574. package/esm2015/domain/users/models/enums/body-tattoos.enum.js +0 -7
  575. package/esm2015/domain/users/models/enums/face-skin-oilinesses.enum.js +0 -9
  576. package/esm2015/domain/users/models/enums/face-skin-problems.enum.js +0 -12
  577. package/esm2015/domain/users/models/enums/face-skin-tones.enum.js +0 -10
  578. package/esm2015/domain/users/models/enums/family-incomes.enum.js +0 -10
  579. package/esm2015/domain/users/models/enums/fragrance-importances.enum.js +0 -7
  580. package/esm2015/domain/users/models/enums/hair-colors.enum.js +0 -12
  581. package/esm2015/domain/users/models/enums/hair-problems.enum.js +0 -12
  582. package/esm2015/domain/users/models/enums/hair-strands.enum.js +0 -10
  583. package/esm2015/domain/users/models/enums/hair-types.enum.js +0 -9
  584. package/esm2015/domain/users/models/enums/index.js +0 -21
  585. package/esm2015/domain/users/models/enums/office-position.enum.js +0 -8
  586. package/esm2015/domain/users/models/enums/product-spents.enum.js +0 -10
  587. package/esm2015/domain/users/models/enums/user-type.enum.js +0 -10
  588. package/esm2015/domain/users/models/index.js +0 -8
  589. package/esm2015/domain/users/models/lead.js +0 -7
  590. package/esm2015/domain/users/models/subscription/edition.js +0 -7
  591. package/esm2015/domain/users/models/subscription/enums/billing-status.enum.js +0 -5
  592. package/esm2015/domain/users/models/subscription/enums/edition-status.enum.js +0 -6
  593. package/esm2015/domain/users/models/subscription/enums/index.js +0 -5
  594. package/esm2015/domain/users/models/subscription/enums/payment-type.enum.js +0 -7
  595. package/esm2015/domain/users/models/subscription/enums/status.enum.js +0 -6
  596. package/esm2015/domain/users/models/subscription/index.js +0 -5
  597. package/esm2015/domain/users/models/subscription/payment.js +0 -14
  598. package/esm2015/domain/users/models/subscription/subscription.js +0 -43
  599. package/esm2015/domain/users/models/user-address.js +0 -7
  600. package/esm2015/domain/users/models/user-payment-method.js +0 -7
  601. package/esm2015/domain/users/models/user.js +0 -26
  602. package/esm2015/domain/users/repositories/beauty-profile.repository.js +0 -2
  603. package/esm2015/domain/users/repositories/edition.repository.js +0 -2
  604. package/esm2015/domain/users/repositories/index.js +0 -9
  605. package/esm2015/domain/users/repositories/lead.repository.js +0 -2
  606. package/esm2015/domain/users/repositories/subscription-payment.repository.js +0 -2
  607. package/esm2015/domain/users/repositories/subscription.repository.js +0 -2
  608. package/esm2015/domain/users/repositories/user-address.repository.js +0 -2
  609. package/esm2015/domain/users/repositories/user-payment-method.repository.js +0 -2
  610. package/esm2015/domain/users/repositories/user.repository.js +0 -2
  611. package/esm2015/domain/users/services/authentication.service.js +0 -2
  612. package/esm2015/domain/users/services/index.js +0 -4
  613. package/esm2015/domain/users/services/register.service.js +0 -2
  614. package/esm2015/domain/users/services/types/basic-user-data.type.js +0 -2
  615. package/esm2015/domain/users/services/types/index.js +0 -2
  616. package/esm2015/domain/users/use-cases/authentication.js +0 -40
  617. package/esm2015/domain/users/use-cases/index.js +0 -5
  618. package/esm2015/domain/users/use-cases/recovery-password.js +0 -12
  619. package/esm2015/domain/users/use-cases/register.js +0 -34
  620. package/esm2015/domain/users/use-cases/signout.js +0 -12
  621. package/esm2015/errors/duplicated-results.error.js +0 -8
  622. package/esm2015/errors/index.js +0 -5
  623. package/esm2015/errors/invalid-argument.error.js +0 -8
  624. package/esm2015/errors/not-found.error.js +0 -8
  625. package/esm2015/errors/required-argument.error.js +0 -9
  626. package/esm2015/index.js +0 -6
  627. package/esm2015/infra/elasticsearch/adapters/axios.adapter.js +0 -22
  628. package/esm2015/infra/elasticsearch/adapters/elastic-search.adapter.js +0 -2
  629. package/esm2015/infra/elasticsearch/adapters/index.js +0 -3
  630. package/esm2015/infra/elasticsearch/index.js +0 -4
  631. package/esm2015/infra/elasticsearch/indexes/index.js +0 -2
  632. package/esm2015/infra/elasticsearch/indexes/products-index.js +0 -59
  633. package/esm2015/infra/elasticsearch/types/elastic-search-result.js +0 -2
  634. package/esm2015/infra/elasticsearch/types/index.js +0 -2
  635. package/esm2015/infra/firebase/auth/authentication-firebase-auth.service.js +0 -52
  636. package/esm2015/infra/firebase/auth/index.js +0 -3
  637. package/esm2015/infra/firebase/auth/register-firebase-auth.service.js +0 -26
  638. package/esm2015/infra/firebase/auth/types/firebase-user-with-id.type.js +0 -2
  639. package/esm2015/infra/firebase/firestore/index.js +0 -4
  640. package/esm2015/infra/firebase/firestore/mixins/index.js +0 -10
  641. package/esm2015/infra/firebase/firestore/mixins/with-create-firestore.mixin.js +0 -31
  642. package/esm2015/infra/firebase/firestore/mixins/with-crud-firestore.mixin.js +0 -10
  643. package/esm2015/infra/firebase/firestore/mixins/with-delete-firestore.mixin.js +0 -18
  644. package/esm2015/infra/firebase/firestore/mixins/with-find-firestore.mixin.js +0 -86
  645. package/esm2015/infra/firebase/firestore/mixins/with-firestore.mixin.js +0 -22
  646. package/esm2015/infra/firebase/firestore/mixins/with-get-firestore.mixin.js +0 -24
  647. package/esm2015/infra/firebase/firestore/mixins/with-helpers.mixin.js +0 -17
  648. package/esm2015/infra/firebase/firestore/mixins/with-sub-collection.mixin.js +0 -11
  649. package/esm2015/infra/firebase/firestore/mixins/with-update-firestore.mixin.js +0 -45
  650. package/esm2015/infra/firebase/firestore/models/user-search.js +0 -7
  651. package/esm2015/infra/firebase/firestore/repositories/catalog/category-firestore.repository.js +0 -72
  652. package/esm2015/infra/firebase/firestore/repositories/catalog/index.js +0 -5
  653. package/esm2015/infra/firebase/firestore/repositories/catalog/product-firestore.repository.js +0 -53
  654. package/esm2015/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.js +0 -14
  655. package/esm2015/infra/firebase/firestore/repositories/catalog/subscription-product-firestore.repository.js +0 -12
  656. package/esm2015/infra/firebase/firestore/repositories/index.js +0 -5
  657. package/esm2015/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.js +0 -56
  658. package/esm2015/infra/firebase/firestore/repositories/shop-settings/index.js +0 -3
  659. package/esm2015/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.js +0 -12
  660. package/esm2015/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.js +0 -12
  661. package/esm2015/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.js +0 -12
  662. package/esm2015/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.js +0 -12
  663. package/esm2015/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.js +0 -29
  664. package/esm2015/infra/firebase/firestore/repositories/shopping/index.js +0 -9
  665. package/esm2015/infra/firebase/firestore/repositories/shopping/legacy-order-firestore.repository.js +0 -9
  666. package/esm2015/infra/firebase/firestore/repositories/shopping/order-firestore.repository.js +0 -12
  667. package/esm2015/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.js +0 -12
  668. package/esm2015/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.js +0 -12
  669. package/esm2015/infra/firebase/firestore/repositories/users/index.js +0 -10
  670. package/esm2015/infra/firebase/firestore/repositories/users/lead-firestore.repository.js +0 -12
  671. package/esm2015/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.js +0 -14
  672. package/esm2015/infra/firebase/firestore/repositories/users/subscription-firestore.repository.js +0 -12
  673. package/esm2015/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.js +0 -14
  674. package/esm2015/infra/firebase/firestore/repositories/users/user-address-firestore.repository.js +0 -14
  675. package/esm2015/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.js +0 -14
  676. package/esm2015/infra/firebase/firestore/repositories/users/user-firestore.repository.js +0 -70
  677. package/esm2015/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.js +0 -14
  678. package/esm2015/infra/firebase/firestore/repositories/users/user-search-firestore.repository.js +0 -12
  679. package/esm2015/infra/firebase/firestore/types/firestore-sub.repository.type.js +0 -2
  680. package/esm2015/infra/firebase/firestore/types/firestore.helpers.type.js +0 -2
  681. package/esm2015/infra/firebase/firestore/types/firestore.repository.type.js +0 -2
  682. package/esm2015/infra/firebase/firestore/types/index.js +0 -4
  683. package/esm2015/infra/firebase/index.js +0 -3
  684. package/esm2015/infra/hasura-graphql/enums/hasura-graphql-column-type.enum.js +0 -13
  685. package/esm2015/infra/hasura-graphql/enums/hasura-graphql-where.enum.js +0 -15
  686. package/esm2015/infra/hasura-graphql/enums/index.js +0 -3
  687. package/esm2015/infra/hasura-graphql/index.js +0 -5
  688. package/esm2015/infra/hasura-graphql/mixins/helpers/attribute-option.helper.js +0 -31
  689. package/esm2015/infra/hasura-graphql/mixins/helpers/filter-option.helper.js +0 -18
  690. package/esm2015/infra/hasura-graphql/mixins/helpers/graphql-field.helper.js +0 -70
  691. package/esm2015/infra/hasura-graphql/mixins/helpers/index.js +0 -4
  692. package/esm2015/infra/hasura-graphql/mixins/index.js +0 -8
  693. package/esm2015/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.js +0 -45
  694. package/esm2015/infra/hasura-graphql/mixins/with-crud-hasura-graphql.mixin.js +0 -10
  695. package/esm2015/infra/hasura-graphql/mixins/with-delete-hasura-graphql.mixin.js +0 -29
  696. package/esm2015/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.js +0 -93
  697. package/esm2015/infra/hasura-graphql/mixins/with-get-hasura-graphql.mixin.js +0 -35
  698. package/esm2015/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.js +0 -95
  699. package/esm2015/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.js +0 -56
  700. package/esm2015/infra/hasura-graphql/models/category-hasura-graphql.js +0 -4
  701. package/esm2015/infra/hasura-graphql/models/index.js +0 -5
  702. package/esm2015/infra/hasura-graphql/models/kit-product-hasura-graphql.js +0 -15
  703. package/esm2015/infra/hasura-graphql/models/product-hasura-graphql.js +0 -11
  704. package/esm2015/infra/hasura-graphql/models/variant-hasura-graphql.js +0 -9
  705. package/esm2015/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.js +0 -135
  706. package/esm2015/infra/hasura-graphql/repositories/catalog/index.js +0 -4
  707. package/esm2015/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.js +0 -367
  708. package/esm2015/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.js +0 -100
  709. package/esm2015/infra/hasura-graphql/repositories/index.js +0 -2
  710. package/esm2015/infra/hasura-graphql/types/fields.type.js +0 -2
  711. package/esm2015/infra/hasura-graphql/types/graphql.repository.type.js +0 -2
  712. package/esm2015/infra/hasura-graphql/types/hasura-graphql-auth-options.type.js +0 -2
  713. package/esm2015/infra/hasura-graphql/types/hasura-graphql-fields.type.js +0 -2
  714. package/esm2015/infra/hasura-graphql/types/hasura-graphql-headers.type.js +0 -2
  715. package/esm2015/infra/hasura-graphql/types/index.js +0 -9
  716. package/esm2015/infra/hasura-graphql/types/nested-field.type.js +0 -2
  717. package/esm2015/infra/hasura-graphql/types/query-builder-options.type.js +0 -2
  718. package/esm2015/infra/hasura-graphql/types/variable-options.type.js +0 -2
  719. package/esm2015/infra/index.js +0 -4
  720. package/esm2015/utils/index.js +0 -8
  721. package/esm2015/utils/is-uuid.js +0 -3
  722. package/esm2015/utils/mixins/base.mixin.js +0 -6
  723. package/esm2015/utils/mixins/index.js +0 -4
  724. package/esm2015/utils/mixins/merge-constructor-params.type.js +0 -2
  725. package/esm2015/utils/mixins/mixin-ctor.type.js +0 -2
  726. package/esm2015/utils/parse-datetime.js +0 -14
  727. package/esm2015/utils/types/array-element.type.js +0 -2
  728. package/esm2015/utils/types/index.js +0 -3
  729. package/esm2015/utils/types/prop.type.js +0 -2
  730. package/index.d.ts +0 -5
  731. package/infra/elasticsearch/adapters/axios.adapter.d.ts +0 -11
  732. package/infra/elasticsearch/adapters/elastic-search.adapter.d.ts +0 -4
  733. package/infra/elasticsearch/adapters/index.d.ts +0 -2
  734. package/infra/elasticsearch/index.d.ts +0 -3
  735. package/infra/elasticsearch/indexes/index.d.ts +0 -1
  736. package/infra/elasticsearch/indexes/products-index.d.ts +0 -11
  737. package/infra/elasticsearch/types/elastic-search-result.d.ts +0 -7
  738. package/infra/elasticsearch/types/index.d.ts +0 -1
  739. package/infra/firebase/auth/authentication-firebase-auth.service.d.ts +0 -12
  740. package/infra/firebase/auth/register-firebase-auth.service.d.ts +0 -8
  741. package/infra/firebase/firestore/mixins/with-create-firestore.mixin.d.ts +0 -4
  742. package/infra/firebase/firestore/mixins/with-crud-firestore.mixin.d.ts +0 -4
  743. package/infra/firebase/firestore/mixins/with-delete-firestore.mixin.d.ts +0 -4
  744. package/infra/firebase/firestore/mixins/with-find-firestore.mixin.d.ts +0 -4
  745. package/infra/firebase/firestore/mixins/with-firestore.mixin.d.ts +0 -4
  746. package/infra/firebase/firestore/mixins/with-get-firestore.mixin.d.ts +0 -4
  747. package/infra/firebase/firestore/mixins/with-helpers.mixin.d.ts +0 -11
  748. package/infra/firebase/firestore/mixins/with-sub-collection.mixin.d.ts +0 -7
  749. package/infra/firebase/firestore/mixins/with-update-firestore.mixin.d.ts +0 -7
  750. package/infra/firebase/firestore/models/user-search.d.ts +0 -9
  751. package/infra/firebase/firestore/repositories/catalog/category-firestore.repository.d.ts +0 -17
  752. package/infra/firebase/firestore/repositories/catalog/product-firestore.repository.d.ts +0 -11
  753. package/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.d.ts +0 -13
  754. package/infra/firebase/firestore/repositories/catalog/subscription-product-firestore.repository.d.ts +0 -8
  755. package/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.d.ts +0 -16
  756. package/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.d.ts +0 -8
  757. package/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.d.ts +0 -8
  758. package/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.d.ts +0 -8
  759. package/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.d.ts +0 -8
  760. package/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.d.ts +0 -12
  761. package/infra/firebase/firestore/repositories/shopping/order-firestore.repository.d.ts +0 -8
  762. package/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.d.ts +0 -8
  763. package/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.d.ts +0 -8
  764. package/infra/firebase/firestore/repositories/users/lead-firestore.repository.d.ts +0 -8
  765. package/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.d.ts +0 -13
  766. package/infra/firebase/firestore/repositories/users/subscription-firestore.repository.d.ts +0 -8
  767. package/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.d.ts +0 -13
  768. package/infra/firebase/firestore/repositories/users/user-address-firestore.repository.d.ts +0 -13
  769. package/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.d.ts +0 -13
  770. package/infra/firebase/firestore/repositories/users/user-firestore.repository.d.ts +0 -19
  771. package/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.d.ts +0 -13
  772. package/infra/firebase/firestore/repositories/users/user-search-firestore.repository.d.ts +0 -9
  773. package/infra/firebase/firestore/types/firestore-sub.repository.type.d.ts +0 -6
  774. package/infra/firebase/firestore/types/firestore.helpers.type.d.ts +0 -8
  775. package/infra/firebase/firestore/types/firestore.repository.type.d.ts +0 -12
  776. package/infra/hasura-graphql/enums/hasura-graphql-column-type.enum.d.ts +0 -11
  777. package/infra/hasura-graphql/enums/hasura-graphql-where.enum.d.ts +0 -13
  778. package/infra/hasura-graphql/enums/index.d.ts +0 -2
  779. package/infra/hasura-graphql/index.d.ts +0 -4
  780. package/infra/hasura-graphql/mixins/helpers/attribute-option.helper.d.ts +0 -13
  781. package/infra/hasura-graphql/mixins/helpers/filter-option.helper.d.ts +0 -6
  782. package/infra/hasura-graphql/mixins/helpers/graphql-field.helper.d.ts +0 -8
  783. package/infra/hasura-graphql/mixins/helpers/index.d.ts +0 -3
  784. package/infra/hasura-graphql/mixins/index.d.ts +0 -7
  785. package/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.d.ts +0 -8
  786. package/infra/hasura-graphql/mixins/with-crud-hasura-graphql.mixin.d.ts +0 -11
  787. package/infra/hasura-graphql/mixins/with-delete-hasura-graphql.mixin.d.ts +0 -7
  788. package/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.d.ts +0 -31
  789. package/infra/hasura-graphql/mixins/with-get-hasura-graphql.mixin.d.ts +0 -24
  790. package/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.d.ts +0 -11
  791. package/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.d.ts +0 -14
  792. package/infra/hasura-graphql/models/category-hasura-graphql.d.ts +0 -6
  793. package/infra/hasura-graphql/models/index.d.ts +0 -4
  794. package/infra/hasura-graphql/models/kit-product-hasura-graphql.d.ts +0 -6
  795. package/infra/hasura-graphql/models/product-hasura-graphql.d.ts +0 -9
  796. package/infra/hasura-graphql/models/variant-hasura-graphql.d.ts +0 -9
  797. package/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.d.ts +0 -22
  798. package/infra/hasura-graphql/repositories/catalog/index.d.ts +0 -3
  799. package/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts +0 -26
  800. package/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.d.ts +0 -13
  801. package/infra/hasura-graphql/repositories/index.d.ts +0 -1
  802. package/infra/hasura-graphql/types/fields.type.d.ts +0 -2
  803. package/infra/hasura-graphql/types/graphql.repository.type.d.ts +0 -21
  804. package/infra/hasura-graphql/types/hasura-graphql-auth-options.type.d.ts +0 -8
  805. package/infra/hasura-graphql/types/hasura-graphql-fields.type.d.ts +0 -36
  806. package/infra/hasura-graphql/types/hasura-graphql-headers.type.d.ts +0 -7
  807. package/infra/hasura-graphql/types/index.d.ts +0 -8
  808. package/infra/hasura-graphql/types/nested-field.type.d.ts +0 -7
  809. package/infra/hasura-graphql/types/query-builder-options.type.d.ts +0 -7
  810. package/infra/hasura-graphql/types/variable-options.type.d.ts +0 -9
  811. package/infra/index.d.ts +0 -3
  812. package/utils/index.d.ts +0 -7
  813. package/utils/is-uuid.d.ts +0 -1
  814. package/utils/mixins/index.d.ts +0 -3
  815. package/utils/mixins/merge-constructor-params.type.d.ts +0 -3
  816. package/utils/mixins/mixin-ctor.type.d.ts +0 -1
  817. package/utils/parse-datetime.d.ts +0 -1
  818. package/utils/types/array-element.type.d.ts +0 -1
  819. package/utils/types/index.d.ts +0 -2
  820. /package/{domain → lib/domain}/catalog/index.d.ts +0 -0
  821. /package/{domain → lib/domain}/catalog/models/enums/index.d.ts +0 -0
  822. /package/{domain → lib/domain}/catalog/models/types/category-condition.type.d.ts +0 -0
  823. /package/{domain → lib/domain}/catalog/models/types/category-filter.type.d.ts +0 -0
  824. /package/{domain → lib/domain}/catalog/models/types/index.d.ts +0 -0
  825. /package/{domain → lib/domain}/catalog/models/types/shops-description.type.d.ts +0 -0
  826. /package/{domain → lib/domain}/catalog/models/types/shops-price.type.d.ts +0 -0
  827. /package/{domain → lib/domain}/catalog/models/types/stock.type.d.ts +0 -0
  828. /package/{domain → lib/domain}/catalog/models/types/variant-grade.type.d.ts +0 -0
  829. /package/{domain → lib/domain}/catalog/repositories/index.d.ts +0 -0
  830. /package/{domain/generic → lib/domain/general}/index.d.ts +0 -0
  831. /package/{domain/generic → lib/domain/general}/model/identifier-fields.d.ts +0 -0
  832. /package/{domain/generic → lib/domain/general}/repository/enums/index.d.ts +0 -0
  833. /package/{domain/generic → lib/domain/general}/repository/enums/update-option-actions.enum.d.ts +0 -0
  834. /package/{domain/generic → lib/domain/general}/repository/index.d.ts +0 -0
  835. /package/{domain/generic → lib/domain/general}/repository/types/repository-find-result.type.d.ts +0 -0
  836. /package/{domain/generic → lib/domain/general}/repository/types/repository-limit-options.type.d.ts +0 -0
  837. /package/{domain/generic → lib/domain/general}/repository/types/repository-order-by-list.type.d.ts +0 -0
  838. /package/{domain → lib/domain}/location/index.d.ts +0 -0
  839. /package/{domain → lib/domain}/location/models/index.d.ts +0 -0
  840. /package/{domain → lib/domain}/location/models/types/index.d.ts +0 -0
  841. /package/{domain → lib/domain}/location/models/types/location-bound.type.d.ts +0 -0
  842. /package/{domain → lib/domain}/location/models/types/location-geometry.type.d.ts +0 -0
  843. /package/{domain → lib/domain}/location/models/types/location-lat-lng.type.d.ts +0 -0
  844. /package/{domain → lib/domain}/shop-settings/enums/filter-type.enum.d.ts +0 -0
  845. /package/{domain → lib/domain}/shop-settings/enums/index.d.ts +0 -0
  846. /package/{domain → lib/domain}/shop-settings/enums/questions-filters.enum.d.ts +0 -0
  847. /package/{domain → lib/domain}/shop-settings/helpers/beauty-questions.helper.d.ts +0 -0
  848. /package/{domain → lib/domain}/shop-settings/helpers/index.d.ts +0 -0
  849. /package/{domain → lib/domain}/shop-settings/index.d.ts +0 -0
  850. /package/{domain → lib/domain}/shop-settings/models/index.d.ts +0 -0
  851. /package/{domain → lib/domain}/shop-settings/models/types/banner.type.d.ts +0 -0
  852. /package/{domain → lib/domain}/shop-settings/models/types/benefit.type.d.ts +0 -0
  853. /package/{domain → lib/domain}/shop-settings/models/types/menu-nav.type.d.ts +0 -0
  854. /package/{domain → lib/domain}/shop-settings/models/types/sub-menu.type.d.ts +0 -0
  855. /package/{domain → lib/domain}/shop-settings/repositories/index.d.ts +0 -0
  856. /package/{domain → lib/domain}/shopping/index.d.ts +0 -0
  857. /package/{domain → lib/domain}/shopping/models/coupons/enums/exclusivities.enum.d.ts +0 -0
  858. /package/{domain → lib/domain}/shopping/models/enums/checkout-types.enum.d.ts +0 -0
  859. /package/{domain → lib/domain}/shopping/models/enums/index.d.ts +0 -0
  860. /package/{domain → lib/domain}/shopping/models/enums/order-status.enum.d.ts +0 -0
  861. /package/{domain → lib/domain}/shopping/models/index.d.ts +0 -0
  862. /package/{domain → lib/domain}/shopping/models/line-item.d.ts +0 -0
  863. /package/{domain → lib/domain}/shopping/models/order.d.ts +0 -0
  864. /package/{domain → lib/domain}/shopping/models/subscription/index.d.ts +0 -0
  865. /package/{domain → lib/domain}/shopping/models/types/index.d.ts +0 -0
  866. /package/{domain → lib/domain}/shopping/models/types/payment-address.type.d.ts +0 -0
  867. /package/{domain → lib/domain}/shopping/models/types/payment-billing.type.d.ts +0 -0
  868. /package/{domain → lib/domain}/shopping/models/types/payment-card.type.d.ts +0 -0
  869. /package/{domain → lib/domain}/shopping/models/types/payment-customer.type.d.ts +0 -0
  870. /package/{domain → lib/domain}/shopping/models/types/payment-document.type.d.ts +0 -0
  871. /package/{domain → lib/domain}/shopping/models/types/payment-item.type.d.ts +0 -0
  872. /package/{domain → lib/domain}/shopping/models/types/payment-shipping.type.d.ts +0 -0
  873. /package/{domain → lib/domain}/shopping/repositories/index.d.ts +0 -0
  874. /package/{domain → lib/domain}/shopping/repositories/legacy-order.repository.d.ts +0 -0
  875. /package/{domain → lib/domain}/shopping/repositories/subscription/index.d.ts +0 -0
  876. /package/{domain → lib/domain}/users/errors/index.d.ts +0 -0
  877. /package/{domain → lib/domain}/users/index.d.ts +0 -0
  878. /package/{domain → lib/domain}/users/models/enums/accessory-importances.enum.d.ts +0 -0
  879. /package/{domain → lib/domain}/users/models/enums/area.enum.d.ts +0 -0
  880. /package/{domain → lib/domain}/users/models/enums/beard-problems.enum.d.ts +0 -0
  881. /package/{domain → lib/domain}/users/models/enums/beard-sizes.enum.d.ts +0 -0
  882. /package/{domain → lib/domain}/users/models/enums/beauty-product-importances.enum.d.ts +0 -0
  883. /package/{domain → lib/domain}/users/models/enums/body-problems.enum.d.ts +0 -0
  884. /package/{domain → lib/domain}/users/models/enums/body-shapes.enum.d.ts +0 -0
  885. /package/{domain → lib/domain}/users/models/enums/body-tattoos.enum.d.ts +0 -0
  886. /package/{domain → lib/domain}/users/models/enums/face-skin-oilinesses.enum.d.ts +0 -0
  887. /package/{domain → lib/domain}/users/models/enums/face-skin-problems.enum.d.ts +0 -0
  888. /package/{domain → lib/domain}/users/models/enums/face-skin-tones.enum.d.ts +0 -0
  889. /package/{domain → lib/domain}/users/models/enums/family-incomes.enum.d.ts +0 -0
  890. /package/{domain → lib/domain}/users/models/enums/fragrance-importances.enum.d.ts +0 -0
  891. /package/{domain → lib/domain}/users/models/enums/hair-colors.enum.d.ts +0 -0
  892. /package/{domain → lib/domain}/users/models/enums/hair-problems.enum.d.ts +0 -0
  893. /package/{domain → lib/domain}/users/models/enums/hair-strands.enum.d.ts +0 -0
  894. /package/{domain → lib/domain}/users/models/enums/hair-types.enum.d.ts +0 -0
  895. /package/{domain → lib/domain}/users/models/enums/index.d.ts +0 -0
  896. /package/{domain → lib/domain}/users/models/enums/office-position.enum.d.ts +0 -0
  897. /package/{domain → lib/domain}/users/models/enums/product-spents.enum.d.ts +0 -0
  898. /package/{domain → lib/domain}/users/models/enums/user-type.enum.d.ts +0 -0
  899. /package/{domain → lib/domain}/users/models/index.d.ts +0 -0
  900. /package/{domain → lib/domain}/users/models/subscription/enums/billing-status.enum.d.ts +0 -0
  901. /package/{domain → lib/domain}/users/models/subscription/enums/edition-status.enum.d.ts +0 -0
  902. /package/{domain → lib/domain}/users/models/subscription/enums/index.d.ts +0 -0
  903. /package/{domain → lib/domain}/users/models/subscription/enums/payment-type.enum.d.ts +0 -0
  904. /package/{domain → lib/domain}/users/models/subscription/enums/status.enum.d.ts +0 -0
  905. /package/{domain → lib/domain}/users/models/subscription/index.d.ts +0 -0
  906. /package/{domain → lib/domain}/users/repositories/index.d.ts +0 -0
  907. /package/{domain → lib/domain}/users/services/index.d.ts +0 -0
  908. /package/{domain → lib/domain}/users/services/register.service.d.ts +0 -0
  909. /package/{domain → lib/domain}/users/services/types/basic-user-data.type.d.ts +0 -0
  910. /package/{domain → lib/domain}/users/services/types/index.d.ts +0 -0
  911. /package/{domain → lib/domain}/users/use-cases/authentication.d.ts +0 -0
  912. /package/{domain → lib/domain}/users/use-cases/register.d.ts +0 -0
  913. /package/{domain → lib/domain}/users/use-cases/signout.d.ts +0 -0
  914. /package/{errors → lib/errors}/index.d.ts +0 -0
  915. /package/{infra → lib/infra}/firebase/auth/index.d.ts +0 -0
  916. /package/{infra → lib/infra}/firebase/auth/types/firebase-user-with-id.type.d.ts +0 -0
  917. /package/{infra → lib/infra}/firebase/firestore/index.d.ts +0 -0
  918. /package/{infra → lib/infra}/firebase/firestore/mixins/index.d.ts +0 -0
  919. /package/{infra → lib/infra}/firebase/firestore/repositories/catalog/index.d.ts +0 -0
  920. /package/{infra → lib/infra}/firebase/firestore/repositories/index.d.ts +0 -0
  921. /package/{infra → lib/infra}/firebase/firestore/repositories/shop-settings/index.d.ts +0 -0
  922. /package/{infra → lib/infra}/firebase/firestore/repositories/shopping/index.d.ts +0 -0
  923. /package/{infra → lib/infra}/firebase/firestore/repositories/shopping/legacy-order-firestore.repository.d.ts +0 -0
  924. /package/{infra → lib/infra}/firebase/firestore/repositories/users/index.d.ts +0 -0
  925. /package/{infra → lib/infra}/firebase/firestore/types/index.d.ts +0 -0
  926. /package/{infra → lib/infra}/firebase/index.d.ts +0 -0
  927. /package/{utils → lib/utils}/mixins/base.mixin.d.ts +0 -0
  928. /package/{utils → lib/utils}/types/prop.type.d.ts +0 -0
@@ -1,46 +1,23 @@
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-custom-error'), require('ts-md5'), require('axios'), require('firebase'), require('gql-query-builder'), require('node-fetch')) :
3
- typeof define === 'function' && define.amd ? define('@infrab4a/connect', ['exports', 'reflect-metadata', 'class-transformer', 'date-fns', 'lodash', 'ts-custom-error', 'ts-md5', 'axios', 'firebase', 'gql-query-builder', 'node-fetch'], 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["ts-custom-error"], global["ts-md5"], global.axios, global.firebase, global["gql-query-builder"], global["node-fetch"]));
5
- })(this, (function (exports, reflectMetadata, classTransformer, dateFns, lodash, tsCustomError, tsMd5, axios, firebase, gqlQueryBuilder, fetch) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('reflect-metadata'), require('class-transformer'), require('lodash'), require('firebase'), require('firebase/app')) :
3
+ typeof define === 'function' && define.amd ? define('@infrab4a/connect', ['exports', 'reflect-metadata', 'class-transformer', 'lodash', 'firebase', 'firebase/app'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.infrab4a = global.infrab4a || {}, global.infrab4a.connect = {}), null, global["class-transformer"], global.lodash, global.firebase, global.firebase$1));
5
+ })(this, (function (exports, reflectMetadata, classTransformer, lodash, 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 axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
10
9
  var firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase);
11
- var fetch__default = /*#__PURE__*/_interopDefaultLegacy(fetch);
10
+ var firebase__default$1 = /*#__PURE__*/_interopDefaultLegacy(firebase$1);
12
11
 
13
12
  var BaseModel = /** @class */ (function () {
14
13
  function BaseModel(args) {
15
14
  Object.assign(this, args);
16
15
  }
17
- Object.defineProperty(BaseModel.prototype, "identifier", {
18
- get: function () {
19
- var _this = this;
20
- var fields = this.constructor.identifiersFields.filter(function (field) { return field !== 'identifier'; });
21
- return fields.reduce(function (object, field) {
22
- var _a;
23
- return (Object.assign(Object.assign({}, object), (_a = {}, _a[field] = _this[field], _a)));
24
- }, {});
25
- },
26
- enumerable: false,
27
- configurable: true
28
- });
29
- Object.defineProperty(BaseModel.prototype, "identifiersFields", {
30
- get: function () {
31
- return this.constructor.identifiersFields;
32
- },
33
- enumerable: false,
34
- configurable: true
35
- });
36
16
  BaseModel.toInstance = function (data) {
37
- return classTransformer.plainToInstance(this, data || {});
38
- };
39
- BaseModel.isModel = function (value) {
40
- return value instanceof this;
17
+ return classTransformer.plainToClass(this, data);
41
18
  };
42
19
  BaseModel.prototype.toPlain = function () {
43
- return classTransformer.instanceToPlain(this);
20
+ return classTransformer.classToPlain(this, { exposeUnsetFields: false });
44
21
  };
45
22
  return BaseModel;
46
23
  }());
@@ -48,16 +25,13 @@
48
25
  exports.Where = void 0;
49
26
  (function (Where) {
50
27
  Where["EQUALS"] = "==";
28
+ Where["NOTEQUALS"] = "!=";
51
29
  Where["GT"] = ">";
52
30
  Where["GTE"] = ">=";
53
31
  Where["IN"] = "in";
54
- Where["NOTIN"] = "not in";
55
32
  Where["LT"] = "<";
56
33
  Where["LTE"] = "<=";
57
34
  Where["LIKE"] = "like";
58
- Where["NOTLIKE"] = "not like";
59
- Where["ISNULL"] = "is null";
60
- Where["ISNOTNULL"] = "is not null";
61
35
  })(exports.Where || (exports.Where = {}));
62
36
 
63
37
  exports.UpdateOptionActions = void 0;
@@ -612,13 +586,9 @@
612
586
  function Edition() {
613
587
  return _super !== null && _super.apply(this, arguments) || this;
614
588
  }
615
- Object.defineProperty(Edition, "identifiersFields", {
616
- get: function () {
617
- return ['id', 'subscriptionId'];
618
- },
619
- enumerable: false,
620
- configurable: true
621
- });
589
+ Edition.prototype.identifierFields = function () {
590
+ return ['id'];
591
+ };
622
592
  return Edition;
623
593
  }(BaseModel));
624
594
 
@@ -627,13 +597,9 @@
627
597
  function Payment() {
628
598
  return _super !== null && _super.apply(this, arguments) || this;
629
599
  }
630
- Object.defineProperty(Payment, "identifiersFields", {
631
- get: function () {
632
- return ['id'];
633
- },
634
- enumerable: false,
635
- configurable: true
636
- });
600
+ Payment.prototype.identifierFields = function () {
601
+ return ['id'];
602
+ };
637
603
  return Payment;
638
604
  }(BaseModel));
639
605
  __decorate([
@@ -802,13 +768,9 @@
802
768
  function SubscriptionPayment() {
803
769
  return _super !== null && _super.apply(this, arguments) || this;
804
770
  }
805
- Object.defineProperty(SubscriptionPayment, "identifiersFields", {
806
- get: function () {
807
- return ['id', 'subscriptionId'];
808
- },
809
- enumerable: false,
810
- configurable: true
811
- });
771
+ SubscriptionPayment.prototype.identifierFields = function () {
772
+ return ['id'];
773
+ };
812
774
  return SubscriptionPayment;
813
775
  }(BaseModel));
814
776
  __decorate([
@@ -821,13 +783,6 @@
821
783
  function Address() {
822
784
  return _super !== null && _super.apply(this, arguments) || this;
823
785
  }
824
- Object.defineProperty(Address, "identifiersFields", {
825
- get: function () {
826
- return ['id'];
827
- },
828
- enumerable: false,
829
- configurable: true
830
- });
831
786
  return Address;
832
787
  }(BaseModel));
833
788
 
@@ -842,19 +797,19 @@
842
797
  return Base;
843
798
  }());
844
799
 
845
- var isUUID = function (value) { return lodash.isString(value) && /[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}/.test(value); };
800
+ exports.DiscountType = void 0;
801
+ (function (DiscountType) {
802
+ DiscountType[DiscountType["ABSOLUTE"] = 1] = "ABSOLUTE";
803
+ DiscountType[DiscountType["PERCENTAGE"] = 2] = "PERCENTAGE";
804
+ DiscountType[DiscountType["FREE_SHIPPING"] = 3] = "FREE_SHIPPING";
805
+ })(exports.DiscountType || (exports.DiscountType = {}));
846
806
 
847
- var parseDateTime = function (value) {
848
- if (!lodash.isString(value))
849
- return value;
850
- if (!/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.test(value) &&
851
- !/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T\d{2}:\d{2}:\d{2}/.test(value))
852
- return value;
853
- var date = dateFns.parseISO(value);
854
- if (isNaN(date.getTime()))
855
- return value;
856
- return date;
857
- };
807
+ exports.Exclusivities = void 0;
808
+ (function (Exclusivities) {
809
+ Exclusivities[Exclusivities["ALL_USERS"] = 1] = "ALL_USERS";
810
+ Exclusivities[Exclusivities["SPECIFIC_USER"] = 2] = "SPECIFIC_USER";
811
+ Exclusivities[Exclusivities["COLLABORATORS"] = 3] = "COLLABORATORS";
812
+ })(exports.Exclusivities || (exports.Exclusivities = {}));
858
813
 
859
814
  var Coupon = /** @class */ (function (_super) {
860
815
  __extends(Coupon, _super);
@@ -868,13 +823,17 @@
868
823
  enumerable: false,
869
824
  configurable: true
870
825
  });
871
- Object.defineProperty(Coupon, "identifiersFields", {
872
- get: function () {
873
- return ['id'];
874
- },
875
- enumerable: false,
876
- configurable: true
877
- });
826
+ Coupon.prototype.identifierFields = function () {
827
+ return ['id'];
828
+ };
829
+ Coupon.prototype.calculeDiscount = function (amount) {
830
+ switch (this.discountType) {
831
+ case exports.DiscountType.ABSOLUTE:
832
+ return this.discount < amount ? this.discount : amount;
833
+ case exports.DiscountType.PERCENTAGE:
834
+ return this.discount * 0.01 * amount;
835
+ }
836
+ };
878
837
  return Coupon;
879
838
  }(BaseModel));
880
839
  __decorate([
@@ -891,13 +850,9 @@
891
850
  function SubscriptionPlan() {
892
851
  return _super !== null && _super.apply(this, arguments) || this;
893
852
  }
894
- Object.defineProperty(SubscriptionPlan, "identifiersFields", {
895
- get: function () {
896
- return ['id'];
897
- },
898
- enumerable: false,
899
- configurable: true
900
- });
853
+ SubscriptionPlan.prototype.identifierFields = function () {
854
+ return ['id'];
855
+ };
901
856
  return SubscriptionPlan;
902
857
  }(BaseModel));
903
858
 
@@ -911,13 +866,9 @@
911
866
  delete plain.id;
912
867
  return plain;
913
868
  };
914
- Object.defineProperty(BeautyProfile, "identifiersFields", {
915
- get: function () {
916
- return ['id', 'userId'];
917
- },
918
- enumerable: false,
919
- configurable: true
920
- });
869
+ BeautyProfile.prototype.identifierFields = function () {
870
+ return ['id'];
871
+ };
921
872
  return BeautyProfile;
922
873
  }(BaseModel));
923
874
 
@@ -932,18 +883,14 @@
932
883
  instance.displayName = "" + data.firstName + (!lodash.isNil(data.lastName) ? " " + data.lastName : '');
933
884
  return instance;
934
885
  };
886
+ User.prototype.identifierFields = function () {
887
+ return ['id'];
888
+ };
935
889
  User.prototype.toPlain = function () {
936
890
  var plain = _super.prototype.toPlain.call(this);
937
891
  delete plain.beautyProfile;
938
892
  return plain;
939
893
  };
940
- Object.defineProperty(User, "identifiersFields", {
941
- get: function () {
942
- return ['id'];
943
- },
944
- enumerable: false,
945
- configurable: true
946
- });
947
894
  return User;
948
895
  }(BaseModel));
949
896
  __decorate([
@@ -956,13 +903,9 @@
956
903
  function Subscription() {
957
904
  return _super !== null && _super.apply(this, arguments) || this;
958
905
  }
959
- Object.defineProperty(Subscription, "identifiersFields", {
960
- get: function () {
961
- return ['id'];
962
- },
963
- enumerable: false,
964
- configurable: true
965
- });
906
+ Subscription.prototype.identifierFields = function () {
907
+ return ['id'];
908
+ };
966
909
  return Subscription;
967
910
  }(BaseModel));
968
911
  __decorate([
@@ -999,13 +942,9 @@
999
942
  function UserAddress() {
1000
943
  return _super !== null && _super.apply(this, arguments) || this;
1001
944
  }
1002
- Object.defineProperty(UserAddress, "identifiersFields", {
1003
- get: function () {
1004
- return ['id', 'userId'];
1005
- },
1006
- enumerable: false,
1007
- configurable: true
1008
- });
945
+ UserAddress.prototype.identifierFields = function () {
946
+ return ['id'];
947
+ };
1009
948
  return UserAddress;
1010
949
  }(Address));
1011
950
 
@@ -1014,13 +953,9 @@
1014
953
  function UserPaymentMethod() {
1015
954
  return _super !== null && _super.apply(this, arguments) || this;
1016
955
  }
1017
- Object.defineProperty(UserPaymentMethod, "identifiersFields", {
1018
- get: function () {
1019
- return ['id', 'userId'];
1020
- },
1021
- enumerable: false,
1022
- configurable: true
1023
- });
956
+ UserPaymentMethod.prototype.identifierFields = function () {
957
+ return ['id'];
958
+ };
1024
959
  return UserPaymentMethod;
1025
960
  }(BaseModel));
1026
961
 
@@ -1029,13 +964,9 @@
1029
964
  function Lead() {
1030
965
  return _super !== null && _super.apply(this, arguments) || this;
1031
966
  }
1032
- Object.defineProperty(Lead, "identifiersFields", {
1033
- get: function () {
1034
- return ['id'];
1035
- },
1036
- enumerable: false,
1037
- configurable: true
1038
- });
967
+ Lead.prototype.identifierFields = function () {
968
+ return ['id'];
969
+ };
1039
970
  return Lead;
1040
971
  }(BaseModel));
1041
972
 
@@ -1047,7 +978,7 @@
1047
978
  return _this;
1048
979
  }
1049
980
  return UnauthorizedError;
1050
- }(tsCustomError.CustomError));
981
+ }(Error));
1051
982
 
1052
983
  exports.SignInMethods = void 0;
1053
984
  (function (SignInMethods) {
@@ -1106,7 +1037,7 @@
1106
1037
  return _this;
1107
1038
  }
1108
1039
  return UserAlreadyRegisteredError;
1109
- }(tsCustomError.CustomError));
1040
+ }(Error));
1110
1041
 
1111
1042
  var WeakPasswordError = /** @class */ (function (_super) {
1112
1043
  __extends(WeakPasswordError, _super);
@@ -1117,7 +1048,7 @@
1117
1048
  return _this;
1118
1049
  }
1119
1050
  return WeakPasswordError;
1120
- }(tsCustomError.CustomError));
1051
+ }(Error));
1121
1052
 
1122
1053
  var Register = /** @class */ (function () {
1123
1054
  function Register(registerService, userRepository) {
@@ -1135,11 +1066,11 @@
1135
1066
  return [4 /*yield*/, this.userRepository.checkIfExistsByField('cpf', params.cpf)];
1136
1067
  case 1:
1137
1068
  if (_a.sent())
1138
- throw new UserAlreadyRegisteredError("Usu\u00E1rio com CPF " + params.cpf + " j\u00E1 registrado.");
1069
+ throw new UserAlreadyRegisteredError("User with CPF " + params.cpf + " already registered");
1139
1070
  return [4 /*yield*/, this.userRepository.checkIfExistsByField('email', params.email)];
1140
1071
  case 2:
1141
1072
  if (_a.sent())
1142
- throw new UserAlreadyRegisteredError("Usu\u00E1rio com e-mail " + params.email + " j\u00E1 registrado.");
1073
+ throw new UserAlreadyRegisteredError("User with E-mail " + params.email + " already registered");
1143
1074
  return [4 /*yield*/, this.registerService.register({
1144
1075
  birthday: params.birthday,
1145
1076
  email: email,
@@ -1184,24 +1115,11 @@
1184
1115
  return SignOut;
1185
1116
  }());
1186
1117
 
1187
- var RecoveryPassword = /** @class */ (function () {
1188
- function RecoveryPassword(authService) {
1189
- this.authService = authService;
1190
- }
1191
- RecoveryPassword.prototype.sendEmail = function (email) {
1192
- return __awaiter(this, void 0, void 0, function () {
1193
- return __generator(this, function (_a) {
1194
- switch (_a.label) {
1195
- case 0: return [4 /*yield*/, this.authService.sendPasswordResetEmail(email)];
1196
- case 1:
1197
- _a.sent();
1198
- return [2 /*return*/];
1199
- }
1200
- });
1201
- });
1202
- };
1203
- return RecoveryPassword;
1204
- }());
1118
+ exports.Shops = void 0;
1119
+ (function (Shops) {
1120
+ Shops["MENSMARKET"] = "mensmarket";
1121
+ Shops["GLAMSHOP"] = "Glamshop";
1122
+ })(exports.Shops || (exports.Shops = {}));
1205
1123
 
1206
1124
  var Category = /** @class */ (function (_super) {
1207
1125
  __extends(Category, _super);
@@ -1211,23 +1129,9 @@
1211
1129
  Category.prototype.identifierFields = function () {
1212
1130
  return ['id'];
1213
1131
  };
1214
- Object.defineProperty(Category, "identifiersFields", {
1215
- get: function () {
1216
- return ['id'];
1217
- },
1218
- enumerable: false,
1219
- configurable: true
1220
- });
1221
1132
  return Category;
1222
1133
  }(BaseModel));
1223
1134
 
1224
- exports.Shops = void 0;
1225
- (function (Shops) {
1226
- Shops["MENSMARKET"] = "mensmarket";
1227
- Shops["GLAMSHOP"] = "Glamshop";
1228
- Shops["GLAMPOINTS"] = "Glampoints";
1229
- })(exports.Shops || (exports.Shops = {}));
1230
-
1231
1135
  var Product = /** @class */ (function (_super) {
1232
1136
  __extends(Product, _super);
1233
1137
  function Product() {
@@ -1240,42 +1144,8 @@
1240
1144
  var _a, _b, _c, _d, _e, _f;
1241
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]) || {}));
1242
1146
  };
1243
- Object.defineProperty(Product, "identifiersFields", {
1244
- get: function () {
1245
- return ['id'];
1246
- },
1247
- enumerable: false,
1248
- configurable: true
1249
- });
1250
1147
  return Product;
1251
1148
  }(BaseModel));
1252
- __decorate([
1253
- classTransformer.Type(function () { return KitProduct; }),
1254
- __metadata("design:type", Array)
1255
- ], Product.prototype, "kitProducts", void 0);
1256
-
1257
- var KitProduct = /** @class */ (function (_super) {
1258
- __extends(KitProduct, _super);
1259
- function KitProduct() {
1260
- return _super !== null && _super.apply(this, arguments) || this;
1261
- }
1262
- Object.defineProperty(KitProduct, "identifiersFields", {
1263
- get: function () {
1264
- return ['productId', 'kitProducId'];
1265
- },
1266
- enumerable: false,
1267
- configurable: true
1268
- });
1269
- return KitProduct;
1270
- }(BaseModel));
1271
- __decorate([
1272
- classTransformer.Type(function () { return Product; }),
1273
- __metadata("design:type", Product)
1274
- ], KitProduct.prototype, "kit", void 0);
1275
- __decorate([
1276
- classTransformer.Type(function () { return Product; }),
1277
- __metadata("design:type", Product)
1278
- ], KitProduct.prototype, "product", void 0);
1279
1149
 
1280
1150
  var Variant = /** @class */ (function (_super) {
1281
1151
  __extends(Variant, _super);
@@ -1285,69 +1155,52 @@
1285
1155
  Variant.prototype.identifierFields = function () {
1286
1156
  return ['id'];
1287
1157
  };
1288
- Object.defineProperty(Variant, "identifiersFields", {
1289
- get: function () {
1290
- return ['id', 'productId'];
1291
- },
1292
- enumerable: false,
1293
- configurable: true
1294
- });
1295
1158
  return Variant;
1296
1159
  }(BaseModel));
1297
1160
 
1298
- exports.CouponTypes = void 0;
1299
- (function (CouponTypes) {
1300
- CouponTypes[CouponTypes["FINANCIAL"] = 1] = "FINANCIAL";
1301
- CouponTypes[CouponTypes["PRODUCT"] = 2] = "PRODUCT";
1302
- CouponTypes[CouponTypes["GIFTCARD"] = 3] = "GIFTCARD";
1303
- CouponTypes[CouponTypes["VOUCHER"] = 4] = "VOUCHER";
1304
- })(exports.CouponTypes || (exports.CouponTypes = {}));
1305
-
1306
- exports.CouponSubtypes = void 0;
1307
- (function (CouponSubtypes) {
1308
- CouponSubtypes[CouponSubtypes["ABSOLUTE"] = 1] = "ABSOLUTE";
1309
- CouponSubtypes[CouponSubtypes["PERCENTAGE"] = 2] = "PERCENTAGE";
1310
- })(exports.CouponSubtypes || (exports.CouponSubtypes = {}));
1311
-
1312
- exports.Exclusivities = void 0;
1313
- (function (Exclusivities) {
1314
- Exclusivities[Exclusivities["ALL_USERS"] = 1] = "ALL_USERS";
1315
- Exclusivities[Exclusivities["SPECIFIC_USER"] = 2] = "SPECIFIC_USER";
1316
- Exclusivities[Exclusivities["COLLABORATORS"] = 3] = "COLLABORATORS";
1317
- })(exports.Exclusivities || (exports.Exclusivities = {}));
1318
-
1319
1161
  exports.CheckoutTypes = void 0;
1320
1162
  (function (CheckoutTypes) {
1321
1163
  CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
1322
1164
  CheckoutTypes[CheckoutTypes["SUBSCRIPTION"] = 2] = "SUBSCRIPTION";
1323
1165
  })(exports.CheckoutTypes || (exports.CheckoutTypes = {}));
1324
1166
 
1325
- var COUPON_EXPIRATION = 60 * 60 * 24 * 30;
1326
- var FinancialCoupon = /** @class */ (function (_super) {
1327
- __extends(FinancialCoupon, _super);
1328
- function FinancialCoupon() {
1167
+ var ClubCoupon = /** @class */ (function (_super) {
1168
+ __extends(ClubCoupon, _super);
1169
+ function ClubCoupon() {
1329
1170
  var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
1330
- _this.type = exports.CouponTypes.FINANCIAL;
1171
+ _this.checkoutType = exports.CheckoutTypes.SUBSCRIPTION;
1331
1172
  return _this;
1332
1173
  }
1333
- FinancialCoupon.isFinancialCoupon = function (coupon) {
1334
- return coupon.type === exports.CouponTypes.FINANCIAL && !!coupon.subtype;
1174
+ ClubCoupon.isClubCoupon = function (coupon) {
1175
+ return coupon instanceof ClubCoupon;
1335
1176
  };
1336
- FinancialCoupon.createCoupon = function (userId) {
1337
- return this.toInstance({
1338
- name: tsMd5.Md5.hashStr(userId + "_" + Date.now).toString(),
1339
- nickname: "" + Date.now(),
1340
- type: exports.CouponTypes.FINANCIAL,
1341
- subtype: exports.CouponSubtypes.PERCENTAGE,
1342
- checkoutType: exports.CheckoutTypes.ECOMMERCE,
1343
- discount: 30,
1344
- user: userId,
1345
- createdAt: new Date(Date.now()),
1346
- expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
1347
- });
1177
+ return ClubCoupon;
1178
+ }(Coupon));
1179
+ __decorate([
1180
+ classTransformer.Expose({ name: 'checkout_type' }),
1181
+ __metadata("design:type", Object)
1182
+ ], ClubCoupon.prototype, "checkoutType", void 0);
1183
+
1184
+ var StoreCoupon = /** @class */ (function (_super) {
1185
+ __extends(StoreCoupon, _super);
1186
+ function StoreCoupon() {
1187
+ var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
1188
+ _this.checkoutType = exports.CheckoutTypes.ECOMMERCE;
1189
+ return _this;
1190
+ }
1191
+ StoreCoupon.isStoreCoupon = function (coupon) {
1192
+ return coupon instanceof StoreCoupon;
1348
1193
  };
1349
- return FinancialCoupon;
1194
+ return StoreCoupon;
1350
1195
  }(Coupon));
1196
+ __decorate([
1197
+ classTransformer.Expose({ name: 'checkout_type' }),
1198
+ __metadata("design:type", Object)
1199
+ ], StoreCoupon.prototype, "checkoutType", void 0);
1200
+ __decorate([
1201
+ classTransformer.Type(function () { return Category; }),
1202
+ __metadata("design:type", Array)
1203
+ ], StoreCoupon.prototype, "categories", void 0);
1351
1204
 
1352
1205
  exports.OrderStatus = void 0;
1353
1206
  (function (OrderStatus) {
@@ -1374,13 +1227,9 @@
1374
1227
  function ShippingMethod() {
1375
1228
  return _super !== null && _super.apply(this, arguments) || this;
1376
1229
  }
1377
- Object.defineProperty(ShippingMethod, "identifiersFields", {
1378
- get: function () {
1379
- return ['id'];
1380
- },
1381
- enumerable: false,
1382
- configurable: true
1383
- });
1230
+ ShippingMethod.prototype.identifierFields = function () {
1231
+ return ['id'];
1232
+ };
1384
1233
  return ShippingMethod;
1385
1234
  }(BaseModel));
1386
1235
 
@@ -1389,13 +1238,25 @@
1389
1238
  function Checkout() {
1390
1239
  return _super !== null && _super.apply(this, arguments) || this;
1391
1240
  }
1392
- Object.defineProperty(Checkout, "identifiersFields", {
1241
+ Object.defineProperty(Checkout.prototype, "subTotalPrice", {
1242
+ get: function () {
1243
+ return this.lineItems.reduce(function (total, item) {
1244
+ return total + item.pricePaid;
1245
+ }, 0);
1246
+ },
1247
+ enumerable: false,
1248
+ configurable: true
1249
+ });
1250
+ Object.defineProperty(Checkout.prototype, "totalPrice", {
1393
1251
  get: function () {
1394
- return ['id'];
1252
+ return this.totalPrice - this.discount;
1395
1253
  },
1396
1254
  enumerable: false,
1397
1255
  configurable: true
1398
1256
  });
1257
+ Checkout.prototype.identifierFields = function () {
1258
+ return ['id'];
1259
+ };
1399
1260
  return Checkout;
1400
1261
  }(BaseModel));
1401
1262
  __decorate([
@@ -1419,8 +1280,8 @@
1419
1280
  __metadata("design:type", ShippingMethod)
1420
1281
  ], Checkout.prototype, "shipping", void 0);
1421
1282
  __decorate([
1422
- classTransformer.Type(function () { return Coupon; }),
1423
- __metadata("design:type", Coupon)
1283
+ classTransformer.Type(function () { return StoreCoupon; }),
1284
+ __metadata("design:type", StoreCoupon)
1424
1285
  ], Checkout.prototype, "coupon", void 0);
1425
1286
 
1426
1287
  var Order = /** @class */ (function (_super) {
@@ -1440,13 +1301,9 @@
1440
1301
  function CheckoutSubscription() {
1441
1302
  return _super !== null && _super.apply(this, arguments) || this;
1442
1303
  }
1443
- Object.defineProperty(CheckoutSubscription, "identifiersFields", {
1444
- get: function () {
1445
- return ['id'];
1446
- },
1447
- enumerable: false,
1448
- configurable: true
1449
- });
1304
+ CheckoutSubscription.prototype.identifierFields = function () {
1305
+ return ['id'];
1306
+ };
1450
1307
  return CheckoutSubscription;
1451
1308
  }(BaseModel));
1452
1309
  __decorate([
@@ -1471,13 +1328,9 @@
1471
1328
  function Buy2Win() {
1472
1329
  return _super !== null && _super.apply(this, arguments) || this;
1473
1330
  }
1474
- Object.defineProperty(Buy2Win, "identifiersFields", {
1475
- get: function () {
1476
- return ['id'];
1477
- },
1478
- enumerable: false,
1479
- configurable: true
1480
- });
1331
+ Buy2Win.prototype.identifierFields = function () {
1332
+ return ['id'];
1333
+ };
1481
1334
  return Buy2Win;
1482
1335
  }(BaseModel));
1483
1336
  __decorate([
@@ -1579,13 +1432,9 @@
1579
1432
  function Home() {
1580
1433
  return _super !== null && _super.apply(this, arguments) || this;
1581
1434
  }
1582
- Object.defineProperty(Home, "identifiersFields", {
1583
- get: function () {
1584
- return ['id'];
1585
- },
1586
- enumerable: false,
1587
- configurable: true
1588
- });
1435
+ Home.prototype.identifierFields = function () {
1436
+ return ['id'];
1437
+ };
1589
1438
  return Home;
1590
1439
  }(BaseModel));
1591
1440
 
@@ -1594,13 +1443,9 @@
1594
1443
  function ShopMenu() {
1595
1444
  return _super !== null && _super.apply(this, arguments) || this;
1596
1445
  }
1597
- Object.defineProperty(ShopMenu, "identifiersFields", {
1598
- get: function () {
1599
- return ['id'];
1600
- },
1601
- enumerable: false,
1602
- configurable: true
1603
- });
1446
+ ShopMenu.prototype.identifierFields = function () {
1447
+ return ['id'];
1448
+ };
1604
1449
  return ShopMenu;
1605
1450
  }(BaseModel));
1606
1451
 
@@ -1612,7 +1457,7 @@
1612
1457
  return _this;
1613
1458
  }
1614
1459
  return InvalidArgumentError;
1615
- }(tsCustomError.CustomError));
1460
+ }(Error));
1616
1461
 
1617
1462
  var RequiredArgumentError = /** @class */ (function (_super) {
1618
1463
  __extends(RequiredArgumentError, _super);
@@ -1623,7 +1468,7 @@
1623
1468
  return _this;
1624
1469
  }
1625
1470
  return RequiredArgumentError;
1626
- }(tsCustomError.CustomError));
1471
+ }(Error));
1627
1472
 
1628
1473
  var NotFoundError = /** @class */ (function (_super) {
1629
1474
  __extends(NotFoundError, _super);
@@ -1633,7 +1478,7 @@
1633
1478
  return _this;
1634
1479
  }
1635
1480
  return NotFoundError;
1636
- }(tsCustomError.CustomError));
1481
+ }(Error));
1637
1482
 
1638
1483
  var DuplicatedResultsError = /** @class */ (function (_super) {
1639
1484
  __extends(DuplicatedResultsError, _super);
@@ -1643,111 +1488,21 @@
1643
1488
  return _this;
1644
1489
  }
1645
1490
  return DuplicatedResultsError;
1646
- }(tsCustomError.CustomError));
1647
-
1648
- var AxiosAdapter = /** @class */ (function () {
1649
- function AxiosAdapter(config) {
1650
- this.config = config;
1651
- }
1652
- AxiosAdapter.prototype.query = function (index, query) {
1653
- return __awaiter(this, void 0, void 0, function () {
1654
- var data;
1655
- return __generator(this, function (_a) {
1656
- switch (_a.label) {
1657
- case 0: return [4 /*yield*/, axios__default["default"]({
1658
- url: this.config.url + "/" + index,
1659
- method: 'POST',
1660
- headers: { Authorization: "Basic " + this.config.credential },
1661
- data: query,
1662
- })];
1663
- case 1:
1664
- data = (_a.sent()).data;
1665
- return [2 /*return*/, {
1666
- total: data.hits.total.value,
1667
- hits: data.hits.hits,
1668
- }];
1669
- }
1670
- });
1671
- });
1672
- };
1673
- return AxiosAdapter;
1674
- }());
1675
-
1676
- var ProductsIndex = /** @class */ (function () {
1677
- function ProductsIndex(adapter) {
1678
- this.adapter = adapter;
1679
- }
1680
- ProductsIndex.prototype.findById = function (ids, options) {
1681
- return __awaiter(this, void 0, void 0, function () {
1682
- var publishedField, fields, hits;
1683
- var _a;
1684
- return __generator(this, function (_b) {
1685
- switch (_b.label) {
1686
- case 0:
1687
- publishedField = options.shop === exports.Shops.GLAMSHOP ? 'publishedGlam' : 'published';
1688
- fields = [
1689
- 'brand',
1690
- 'id',
1691
- 'images',
1692
- 'miniatures',
1693
- 'name',
1694
- 'price',
1695
- 'sku',
1696
- 'stock',
1697
- 'slug',
1698
- 'reviews',
1699
- 'pricePaid',
1700
- 'isGift',
1701
- 'stock',
1702
- 'weight',
1703
- 'tags',
1704
- 'hasVariants',
1705
- ];
1706
- return [4 /*yield*/, this.adapter.query('products/_search', Object.assign({ _source: fields, query: {
1707
- bool: {
1708
- filter: __spreadArray([
1709
- {
1710
- terms: {
1711
- _id: ids,
1712
- },
1713
- },
1714
- {
1715
- term: (_a = {},
1716
- _a[publishedField] = true,
1717
- _a),
1718
- }
1719
- ], __read((options.hasStock
1720
- ? [
1721
- {
1722
- range: {
1723
- 'stock.quantity': {
1724
- gt: 0,
1725
- },
1726
- },
1727
- },
1728
- ]
1729
- : []))),
1730
- },
1731
- } }, (options.size ? { size: options.size } : {})))];
1732
- case 1:
1733
- hits = (_b.sent()).hits;
1734
- return [2 /*return*/, hits.map(function (hit) { return Product.toInstance(hit._source); })];
1735
- }
1736
- });
1737
- });
1738
- };
1739
- return ProductsIndex;
1740
- }());
1491
+ }(Error));
1741
1492
 
1742
1493
  var withFirestore = function (MixinBase) {
1743
1494
  return /** @class */ (function (_super) {
1744
1495
  __extends(class_1, _super);
1745
1496
  function class_1() {
1746
- return _super !== null && _super.apply(this, arguments) || this;
1747
- }
1748
- class_1.prototype.collection = function (path) {
1749
- return this.firestore.collection(path || this.collectionName).withConverter(this.buildModelInstance());
1750
- };
1497
+ var args = [];
1498
+ for (var _i = 0; _i < arguments.length; _i++) {
1499
+ args[_i] = arguments[_i];
1500
+ }
1501
+ return _super.call(this, args) || this;
1502
+ }
1503
+ class_1.prototype.collection = function (path) {
1504
+ return this.firestore.collection(path || this.collectionName).withConverter(this.buildModelInstance());
1505
+ };
1751
1506
  class_1.prototype.buildModelInstance = function () {
1752
1507
  var _this = this;
1753
1508
  return {
@@ -1755,11 +1510,11 @@
1755
1510
  fromFirestore: function (snap) {
1756
1511
  var data = snap.data();
1757
1512
  Object.keys(data).forEach(function (key) {
1758
- if (data[key] && typeof data[key] === 'object' && '_seconds' in data[key]) {
1513
+ if (data[key] instanceof firebase__default["default"].firestore.Timestamp) {
1759
1514
  data[key] = data[key].toDate();
1760
1515
  }
1761
1516
  });
1762
- return _this.model.toInstance(Object.assign(Object.assign({}, data), { id: snap.id }));
1517
+ return _this.model.toInstance(Object.assign({ id: snap.id }, data));
1763
1518
  },
1764
1519
  };
1765
1520
  };
@@ -1826,9 +1581,6 @@
1826
1581
  var getValueFromFilter = function (filter) {
1827
1582
  return checkIfIsFilterOption(filter) ? filter.value : filter;
1828
1583
  };
1829
- var getFinalValueFrom = function (value) { return lodash.isNumber(value) || lodash.isString(value) || lodash.isDate(value) || Array.isArray(value)
1830
- ? value
1831
- : Object.values(getFinalValueFrom); };
1832
1584
  return /** @class */ (function (_super) {
1833
1585
  __extends(FindFirestore, _super);
1834
1586
  function FindFirestore() {
@@ -1837,45 +1589,37 @@
1837
1589
  _this.buildWhereSentence = function (queryReference, fieldName, options) {
1838
1590
  if (_this.isSubCollection(_this) && fieldName === _this.parentIdField)
1839
1591
  return queryReference;
1840
- var value = (options === null || options === void 0 ? void 0 : options.value) || options;
1841
- var object = {};
1842
- lodash.set(object, fieldName, value);
1843
- var plainInstance = new _this.model(object).toPlain();
1844
- var firestoreFieldName = fieldName.toString().indexOf('.') > -1
1845
- ? fieldName.toString()
1846
- : Object.keys(plainInstance).find(function (key) { return plainInstance[key]; });
1847
1592
  if ((options === null || options === void 0 ? void 0 : options.operator) === exports.Where.LIKE) {
1848
1593
  if (Array.isArray(options === null || options === void 0 ? void 0 : options.value))
1849
- return queryReference.where(firestoreFieldName, 'array-contains-any', options.value);
1850
- queryReference = queryReference.where(firestoreFieldName, '>=', options.value);
1851
- queryReference = queryReference.where(firestoreFieldName, '<=', options.value + "~");
1594
+ return queryReference.where(fieldName.toString(), 'array-contains-any', options.value);
1595
+ queryReference = queryReference.where(fieldName.toString(), '>=', options.value);
1596
+ queryReference = queryReference.where(fieldName.toString(), '<=', options.value + "~");
1852
1597
  return queryReference;
1853
1598
  }
1854
1599
  if ((options === null || options === void 0 ? void 0 : options.operator) === exports.Where.IN && Array.isArray(options === null || options === void 0 ? void 0 : options.value))
1855
- return queryReference.where(firestoreFieldName, 'array-contains', options.value);
1856
- 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)) {
1857
- return Object.keys(options).reduce(function (queryReferenceWithWhere, key) { return _this.buildWhereSentence(queryReferenceWithWhere, fieldName.toString() + "." + key, options[key]); }, queryReference);
1858
- }
1859
- return queryReference.where(firestoreFieldName, (options === null || options === void 0 ? void 0 : options.operator) || '==', (options === null || options === void 0 ? void 0 : options.value) || options);
1600
+ return queryReference.where(fieldName.toString(), 'array-contains', options.value);
1601
+ 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))
1602
+ return Object.keys(options).reduce(function (queryReferenceWithWhere, key) { return _this.buildWhereSentence(queryReferenceWithWhere, fieldName + "." + key, options[key]); }, queryReference);
1603
+ return queryReference.where(fieldName.toString(), (options === null || options === void 0 ? void 0 : options.operator) || '==', (options === null || options === void 0 ? void 0 : options.value) || options);
1860
1604
  };
1861
1605
  return _this;
1862
1606
  }
1863
- FindFirestore.prototype.find = function (_a) {
1864
- var _b = _a === void 0 ? {} : _a, filters = _b.filters, limits = _b.limits, orderBy = _b.orderBy;
1607
+ FindFirestore.prototype.find = function (filters, limits, orderBy) {
1865
1608
  return __awaiter(this, void 0, void 0, function () {
1866
1609
  var query, docs, data;
1867
- return __generator(this, function (_a) {
1868
- switch (_a.label) {
1610
+ var _this = this;
1611
+ return __generator(this, function (_b) {
1612
+ switch (_b.label) {
1869
1613
  case 0:
1870
- query = this.collection(this.buildCollectionPathForFind(filters || {}));
1871
- query = this.makeFirestoreWhere(query, filters || {});
1872
- Object.keys(orderBy || {}).forEach(function (fieldName) { return (query = query.orderBy(fieldName, orderBy[fieldName])); });
1614
+ query = this.collection(this.buildCollectionPathForFind(filters));
1615
+ filters === null || filters === void 0 ? void 0 : filters.forEach(function (filterer) { return (query = _this.makeFirestoreWhere(query, filterer)); });
1616
+ 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])); }); });
1873
1617
  return [4 /*yield*/, this.defineLimits(query, filters, limits)];
1874
1618
  case 1:
1875
- query = _a.sent();
1619
+ query = _b.sent();
1876
1620
  return [4 /*yield*/, query.get()];
1877
1621
  case 2:
1878
- docs = _a.sent();
1622
+ docs = _b.sent();
1879
1623
  data = docs.docs.map(function (doc) { return doc.data(); });
1880
1624
  return [2 /*return*/, {
1881
1625
  data: data,
@@ -1886,31 +1630,32 @@
1886
1630
  });
1887
1631
  };
1888
1632
  FindFirestore.prototype.buildCollectionPathForFind = function (filters) {
1633
+ var _a;
1889
1634
  if (!this.isSubCollection(this))
1890
1635
  return this.collectionName;
1891
1636
  var parentIdField = this.parentIdField;
1892
- var parentId = getValueFromFilter(filters === null || filters === void 0 ? void 0 : filters[parentIdField]);
1637
+ var parentId = getValueFromFilter((_a = filters.find(function (groupFilter) { return Boolean(getValueFromFilter(groupFilter[parentIdField])); })) === null || _a === void 0 ? void 0 : _a[parentIdField]);
1893
1638
  return this.parentRepository.collectionName + "/" + parentId + "/" + this.collectionName;
1894
1639
  };
1895
1640
  FindFirestore.prototype.defineLimits = function (query, filters, limits) {
1896
1641
  return __awaiter(this, void 0, void 0, function () {
1897
- var _a, _b;
1898
- return __generator(this, function (_c) {
1899
- switch (_c.label) {
1642
+ var _b, _c;
1643
+ return __generator(this, function (_d) {
1644
+ switch (_d.label) {
1900
1645
  case 0:
1901
1646
  if (!(limits === null || limits === void 0 ? void 0 : limits.offset)) return [3 /*break*/, 3];
1902
- if (!this.model.isModel(limits.offset)) return [3 /*break*/, 2];
1903
- _b = (_a = query).startAfter;
1647
+ if (!(limits.offset instanceof this.model)) return [3 /*break*/, 2];
1648
+ _c = (_b = query).startAfter;
1904
1649
  return [4 /*yield*/, this.collection(this.buildCollectionPathForFind(filters))
1905
- .doc(limits.offset[limits.offset.identifiersFields.shift()])
1650
+ .doc(limits.offset[limits.offset.identifierFields().shift()])
1906
1651
  .get()];
1907
1652
  case 1:
1908
- query = _b.apply(_a, [_c.sent()]);
1653
+ query = _c.apply(_b, [_d.sent()]);
1909
1654
  return [3 /*break*/, 3];
1910
1655
  case 2:
1911
1656
  if (lodash.isNumber(limits.offset) || lodash.isString(limits.offset))
1912
1657
  query = query.startAt(limits.offset);
1913
- _c.label = 3;
1658
+ _d.label = 3;
1914
1659
  case 3:
1915
1660
  if (limits === null || limits === void 0 ? void 0 : limits.limit)
1916
1661
  query = query.limit(limits.limit);
@@ -1959,7 +1704,7 @@
1959
1704
  return __generator(this, function (_b) {
1960
1705
  switch (_b.label) {
1961
1706
  case 0:
1962
- id = (_a = data[data.identifiersFields.shift()]) === null || _a === void 0 ? void 0 : _a.toString();
1707
+ id = (_a = data[data.identifierFields().shift()]) === null || _a === void 0 ? void 0 : _a.toString();
1963
1708
  collectionPath = this.buildCollectionPathForAdd(data);
1964
1709
  if (lodash.isEmpty(id))
1965
1710
  return [2 /*return*/, this.collection(collectionPath).add(data)];
@@ -2009,7 +1754,7 @@
2009
1754
  switch (_b.label) {
2010
1755
  case 0:
2011
1756
  model = new this.model();
2012
- keyField = model.identifiersFields.shift();
1757
+ keyField = model.identifierFields().shift();
2013
1758
  docRef = this.collection(this.buildCollectionPathForUpdate(data)).doc(getValueFromParams(data, keyField).toString());
2014
1759
  return [4 /*yield*/, docRef.set(this.paramsToPlain(data), { merge: true })];
2015
1760
  case 1:
@@ -2029,8 +1774,8 @@
2029
1774
  };
2030
1775
  UpdateFirestore.prototype.paramsToPlain = function (params) {
2031
1776
  var model = this.model;
2032
- if (model.isModel(params))
2033
- return params.toPlain();
1777
+ if (params instanceof model)
1778
+ return params;
2034
1779
  return Object.keys(params).reduce(function (data, currentKey) {
2035
1780
  var _b;
2036
1781
  return (Object.assign(Object.assign({}, data), (_b = {}, _b[currentKey] = getValueByAction(params[currentKey]), _b)));
@@ -2113,13 +1858,9 @@
2113
1858
  function UserSearch() {
2114
1859
  return _super !== null && _super.apply(this, arguments) || this;
2115
1860
  }
2116
- Object.defineProperty(UserSearch, "identifiersFields", {
2117
- get: function () {
2118
- return ['id'];
2119
- },
2120
- enumerable: false,
2121
- configurable: true
2122
- });
1861
+ UserSearch.prototype.identifierFields = function () {
1862
+ return ['id'];
1863
+ };
2123
1864
  return UserSearch;
2124
1865
  }(BaseModel));
2125
1866
 
@@ -2176,7 +1917,7 @@
2176
1917
  var _a;
2177
1918
  return __generator(this, function (_b) {
2178
1919
  switch (_b.label) {
2179
- case 0: return [4 /*yield*/, this.userSearchFirestoreRepository.find((_a = {}, _a[field] = { operator: exports.Where.EQUALS, value: value }, _a))];
1920
+ case 0: return [4 /*yield*/, this.userSearchFirestoreRepository.find([(_a = {}, _a[field] = { operator: exports.Where.EQUALS, value: value }, _a)])];
2180
1921
  case 1:
2181
1922
  result = _b.sent();
2182
1923
  return [2 /*return*/, result.count > 0];
@@ -2348,81 +2089,43 @@
2348
2089
  CategoryFirestoreRepository.prototype.getCategoriesForHome = function (categoryIds, limit) {
2349
2090
  if (limit === void 0) { limit = 4; }
2350
2091
  return __awaiter(this, void 0, void 0, function () {
2351
- var categorySnap, categories, homeSections;
2352
- var _this = this;
2353
- return __generator(this, function (_a) {
2354
- switch (_a.label) {
2092
+ var categorySnap, categories, homeSections, categories_1, categories_1_1, category, publishedField, productSnap, products, e_1_1;
2093
+ var e_1, _a;
2094
+ return __generator(this, function (_b) {
2095
+ switch (_b.label) {
2355
2096
  case 0: return [4 /*yield*/, this.collection(this.collectionName)
2356
- .where('id', 'in', categoryIds.filter(Boolean))
2097
+ .where('id', 'in', categoryIds)
2357
2098
  .where('published', '==', true)
2358
2099
  .get()];
2359
2100
  case 1:
2360
- categorySnap = _a.sent();
2101
+ categorySnap = _b.sent();
2361
2102
  if (categorySnap.empty)
2362
2103
  throw new NotFoundError('Categories not found');
2363
2104
  categories = categorySnap.docs.map(function (doc) { return doc.data(); });
2364
- return [4 /*yield*/, Promise.all(categories.map(function (category) { return __awaiter(_this, void 0, void 0, function () {
2365
- var _a;
2366
- return __generator(this, function (_b) {
2367
- switch (_b.label) {
2368
- case 0:
2369
- _a = {
2370
- category: category
2371
- };
2372
- return [4 /*yield*/, this.mountCategory(category, { limit: limit, hasStock: true })];
2373
- case 1: return [2 /*return*/, (_a.products = _b.sent(),
2374
- _a)];
2375
- }
2376
- });
2377
- }); }))];
2378
- case 2:
2379
- homeSections = _a.sent();
2380
- return [2 /*return*/, homeSections];
2381
- }
2382
- });
2383
- });
2384
- };
2385
- CategoryFirestoreRepository.prototype.mountCategory = function (category, options) {
2386
- return __awaiter(this, void 0, void 0, function () {
2387
- var chunks, products, publishedField, chunks_1, chunks_1_1, productIds, query, productSnap, e_1_1;
2388
- var e_1, _a;
2389
- return __generator(this, function (_b) {
2390
- switch (_b.label) {
2391
- case 0:
2392
- if (!category.products)
2393
- throw new RequiredArgumentError(['Category products is empty']);
2394
- chunks = lodash.chunk(category.products, 10);
2395
- products = [];
2396
- publishedField = category.shop === exports.Shops.GLAMSHOP ? 'publishedGlam' : 'published';
2397
- _b.label = 1;
2398
- case 1:
2399
- _b.trys.push([1, 7, 8, 9]);
2400
- chunks_1 = __values(chunks), chunks_1_1 = chunks_1.next();
2105
+ homeSections = [];
2401
2106
  _b.label = 2;
2402
2107
  case 2:
2403
- if (!!chunks_1_1.done) return [3 /*break*/, 6];
2404
- productIds = chunks_1_1.value;
2405
- if ((options === null || options === void 0 ? void 0 : options.limit) && products.length >= (options === null || options === void 0 ? void 0 : options.limit))
2406
- return [3 /*break*/, 6];
2407
- return [4 /*yield*/, this.collection('productsErpVitrine')
2408
- .where(publishedField, '==', true)
2409
- .where('id', 'in', productIds)];
2108
+ _b.trys.push([2, 7, 8, 9]);
2109
+ categories_1 = __values(categories), categories_1_1 = categories_1.next();
2110
+ _b.label = 3;
2410
2111
  case 3:
2411
- query = _b.sent();
2412
- if (options === null || options === void 0 ? void 0 : options.hasStock)
2413
- query = query.where('stock.quantity', '>', 0);
2414
- if (options === null || options === void 0 ? void 0 : options.limit)
2415
- query = query.limit(options === null || options === void 0 ? void 0 : options.limit);
2416
- return [4 /*yield*/, query.get()];
2112
+ if (!!categories_1_1.done) return [3 /*break*/, 6];
2113
+ category = categories_1_1.value;
2114
+ publishedField = category.shop === exports.Shops.GLAMSHOP ? 'publishedGlam' : 'published';
2115
+ return [4 /*yield*/, this.collection('products')
2116
+ .where('categories', 'array-contains', category.id)
2117
+ .where(publishedField, '==', true)
2118
+ .where('stock.quantity', '>', 1)
2119
+ .limit(limit)
2120
+ .get()];
2417
2121
  case 4:
2418
2122
  productSnap = _b.sent();
2419
- if (productSnap.empty)
2420
- return [3 /*break*/, 5];
2421
- products.push.apply(products, __spreadArray([], __read(productSnap.docs.map(function (doc) { return doc.data(); }))));
2123
+ products = productSnap.docs.map(function (doc) { return doc.data(); });
2124
+ homeSections.push({ category: category, products: products });
2422
2125
  _b.label = 5;
2423
2126
  case 5:
2424
- chunks_1_1 = chunks_1.next();
2425
- return [3 /*break*/, 2];
2127
+ categories_1_1 = categories_1.next();
2128
+ return [3 /*break*/, 3];
2426
2129
  case 6: return [3 /*break*/, 9];
2427
2130
  case 7:
2428
2131
  e_1_1 = _b.sent();
@@ -2430,11 +2133,53 @@
2430
2133
  return [3 /*break*/, 9];
2431
2134
  case 8:
2432
2135
  try {
2433
- if (chunks_1_1 && !chunks_1_1.done && (_a = chunks_1.return)) _a.call(chunks_1);
2136
+ if (categories_1_1 && !categories_1_1.done && (_a = categories_1.return)) _a.call(categories_1);
2434
2137
  }
2435
2138
  finally { if (e_1) throw e_1.error; }
2436
2139
  return [7 /*endfinally*/];
2437
- case 9: return [2 /*return*/, products];
2140
+ case 9: return [2 /*return*/, homeSections];
2141
+ }
2142
+ });
2143
+ });
2144
+ };
2145
+ CategoryFirestoreRepository.prototype.mountCategory = function (category) {
2146
+ return __awaiter(this, void 0, void 0, function () {
2147
+ var chunks, products, publishedField;
2148
+ var _this = this;
2149
+ return __generator(this, function (_a) {
2150
+ switch (_a.label) {
2151
+ case 0:
2152
+ if (!category.products)
2153
+ throw new RequiredArgumentError(['Category products is empty']);
2154
+ chunks = category.products.reduce(function (resultArray, item, index) {
2155
+ var chunkIndex = Math.floor(index / 10);
2156
+ if (!resultArray[chunkIndex])
2157
+ resultArray[chunkIndex] = [];
2158
+ resultArray[chunkIndex].push(item);
2159
+ return resultArray;
2160
+ }, []);
2161
+ products = [];
2162
+ publishedField = category.shop === exports.Shops.GLAMSHOP ? 'publishedGlam' : 'published';
2163
+ return [4 /*yield*/, Promise.all(chunks.map(function (productIds) { return __awaiter(_this, void 0, void 0, function () {
2164
+ var productSnap;
2165
+ return __generator(this, function (_a) {
2166
+ switch (_a.label) {
2167
+ case 0: return [4 /*yield*/, this.collection('products')
2168
+ .where(publishedField, '==', true)
2169
+ .where('id', 'in', productIds)
2170
+ .get()];
2171
+ case 1:
2172
+ productSnap = _a.sent();
2173
+ if (productSnap.empty)
2174
+ return [2 /*return*/];
2175
+ products.push.apply(products, __spreadArray([], __read(productSnap.docs.map(function (doc) { return doc.data(); }))));
2176
+ return [2 /*return*/];
2177
+ }
2178
+ });
2179
+ }); }))];
2180
+ case 1:
2181
+ _a.sent();
2182
+ return [2 /*return*/, products];
2438
2183
  }
2439
2184
  });
2440
2185
  });
@@ -2447,8 +2192,7 @@
2447
2192
  function ProductFirestoreRepository(firestore) {
2448
2193
  var _this = _super.call(this) || this;
2449
2194
  _this.firestore = firestore;
2450
- _this.reviews = {};
2451
- _this.collectionName = 'productsErpVitrine';
2195
+ _this.collectionName = 'products';
2452
2196
  _this.model = Product;
2453
2197
  return _this;
2454
2198
  }
@@ -2458,12 +2202,10 @@
2458
2202
  var result;
2459
2203
  return __generator(this, function (_b) {
2460
2204
  switch (_b.label) {
2461
- case 0: return [4 /*yield*/, this.find({
2462
- filters: {
2463
- slug: { operator: exports.Where.EQUALS, value: slug },
2464
- shopAvailability: { operator: exports.Where.IN, value: [shop] },
2465
- },
2466
- })];
2205
+ case 0: return [4 /*yield*/, this.find([
2206
+ { slug: { operator: exports.Where.EQUALS, value: slug } },
2207
+ { shopAvailability: { operator: exports.Where.IN, value: [shop] } },
2208
+ ])];
2467
2209
  case 1:
2468
2210
  result = _b.sent();
2469
2211
  return [2 /*return*/, (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.shift()];
@@ -2471,41 +2213,6 @@
2471
2213
  });
2472
2214
  });
2473
2215
  };
2474
- ProductFirestoreRepository.prototype.fetchReviews = function (status) {
2475
- return __awaiter(this, void 0, void 0, function () {
2476
- var products;
2477
- var _this = this;
2478
- return __generator(this, function (_b) {
2479
- switch (_b.label) {
2480
- case 0: return [4 /*yield*/, this.find()];
2481
- case 1:
2482
- products = (_b.sent()).data;
2483
- products.forEach(function (product) {
2484
- var _a;
2485
- if ([undefined, 0].includes((_a = product.reviews) === null || _a === void 0 ? void 0 : _a.length))
2486
- return;
2487
- var productInfo = {
2488
- productId: product.id,
2489
- productName: product.name,
2490
- productSku: product.sku,
2491
- };
2492
- _this.reviews.pending = [];
2493
- _this.reviews.approved = [];
2494
- _this.reviews.rejected = [];
2495
- product.reviews.forEach(function (review) {
2496
- if ([null, undefined].includes(review.status))
2497
- return _this.reviews.pending.push(Object.assign(Object.assign({}, review), productInfo));
2498
- if (review.status === false)
2499
- return _this.reviews.rejected.push(Object.assign(Object.assign({}, review), productInfo));
2500
- if (!!review.status)
2501
- return _this.reviews.approved.push(Object.assign(Object.assign({}, review), productInfo));
2502
- });
2503
- });
2504
- return [2 /*return*/, this.reviews[status]];
2505
- }
2506
- });
2507
- });
2508
- };
2509
2216
  return ProductFirestoreRepository;
2510
2217
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
2511
2218
 
@@ -2557,19 +2264,29 @@
2557
2264
  return _this;
2558
2265
  }
2559
2266
  CouponFirestoreRepository.prototype.buildModelInstance = function () {
2560
- var _a = _super.prototype.buildModelInstance.call(this), fromFirestore = _a.fromFirestore, toFirestore = _a.toFirestore;
2267
+ var _this = this;
2561
2268
  return {
2562
2269
  toFirestore: function (data) {
2563
- var plain = toFirestore(data);
2564
- if (!!data.expiresIn)
2565
- plain.expiresIn = data.expiresIn.getTime();
2270
+ var _a;
2271
+ var plain = (data === null || data === void 0 ? void 0 : data.toPlain) ? data.toPlain() : data;
2272
+ if (!!plain.categories)
2273
+ plain.categories = (_a = plain === null || plain === void 0 ? void 0 : plain.categories) === null || _a === void 0 ? void 0 : _a.map(function (category) { return category.id; });
2566
2274
  return plain;
2567
2275
  },
2568
2276
  fromFirestore: function (snap) {
2569
- var instance = fromFirestore(snap);
2570
- if (!lodash.isNil(instance.expiresIn))
2571
- instance.expiresIn = new Date(snap.data().expiresIn);
2572
- return instance;
2277
+ var _a;
2278
+ var data = snap.data();
2279
+ Object.keys(data).forEach(function (key) {
2280
+ if (data[key] instanceof firebase__default["default"].firestore.Timestamp) {
2281
+ data[key] = data[key].toDate();
2282
+ }
2283
+ });
2284
+ data.categories = (_a = data === null || data === void 0 ? void 0 : data.categories) === null || _a === void 0 ? void 0 : _a.map(function (category) { return ({ id: category }); });
2285
+ if (data.checkout_type === exports.CheckoutTypes.SUBSCRIPTION)
2286
+ return ClubCoupon.toInstance(Object.assign({ id: snap.id }, data));
2287
+ if (data.checkout_type === exports.CheckoutTypes.ECOMMERCE)
2288
+ return StoreCoupon.toInstance(Object.assign({ id: snap.id }, data));
2289
+ return _this.model.toInstance(Object.assign({ id: snap.id }, data));
2573
2290
  },
2574
2291
  };
2575
2292
  };
@@ -2652,54 +2369,10 @@
2652
2369
  function HomeFirestoreRepository(firestore) {
2653
2370
  var _this = _super.call(this) || this;
2654
2371
  _this.firestore = firestore;
2655
- _this.homeToFirestore = function (home) {
2656
- var _a;
2657
- if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
2658
- home.data.data.discoverProducts = home.data.data.discoverProducts.map(_this.homeCategoryGroupToPlain);
2659
- home.data.data.featuredProducts = home.data.data.featuredProducts.map(_this.homeCategoryGroupToPlain);
2660
- home.data.data.verticalProducts = home.data.data.verticalProducts.map(_this.homeCategoryGroupToPlain);
2661
- }
2662
- return home;
2663
- };
2664
- _this.homeCategoryGroupToPlain = function (homeCategoryGroup) { return ({
2665
- category: homeCategoryGroup.category.toPlain(),
2666
- products: homeCategoryGroup.products.map(function (product) { return product.toPlain(); }),
2667
- }); };
2668
- _this.homeFromFirestore = function (home) {
2669
- var _a;
2670
- if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
2671
- home.data.data.discoverProducts = home.data.data.discoverProducts.map(_this.plainToHomeCategoryGroup);
2672
- home.data.data.featuredProducts = home.data.data.featuredProducts.map(_this.plainToHomeCategoryGroup);
2673
- home.data.data.verticalProducts = home.data.data.verticalProducts.map(_this.plainToHomeCategoryGroup);
2674
- home.data.createdAt =
2675
- home.data.createdAt instanceof firebase__default["default"].firestore.Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
2676
- home.data.expiresAt =
2677
- home.data.expiresAt instanceof firebase__default["default"].firestore.Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
2678
- }
2679
- return home;
2680
- };
2681
- _this.plainToHomeCategoryGroup = function (homeCategoryGroup) { return ({
2682
- category: Category.toInstance(homeCategoryGroup.category),
2683
- products: homeCategoryGroup.products.map(function (product) { return Product.toInstance(product); }),
2684
- }); };
2685
2372
  _this.collectionName = 'dms';
2686
2373
  _this.model = Home;
2687
2374
  return _this;
2688
2375
  }
2689
- HomeFirestoreRepository.prototype.buildModelInstance = function () {
2690
- var _this = this;
2691
- var _b = _super.prototype.buildModelInstance.call(this), fromFirestore = _b.fromFirestore, toFirestore = _b.toFirestore;
2692
- return {
2693
- toFirestore: function (data) {
2694
- var modifiedData = _this.homeToFirestore(data);
2695
- return toFirestore(modifiedData);
2696
- },
2697
- fromFirestore: function (snap) {
2698
- var instance = fromFirestore(snap);
2699
- return _this.homeFromFirestore(instance);
2700
- },
2701
- };
2702
- };
2703
2376
  return HomeFirestoreRepository;
2704
2377
  }(withCrudFirestore(withHelpers(withFirestore(Base)))));
2705
2378
 
@@ -2744,7 +2417,7 @@
2744
2417
  var credentials, user;
2745
2418
  return __generator(this, function (_a) {
2746
2419
  switch (_a.label) {
2747
- case 0: return [4 /*yield*/, this.firebaseAuth.signInWithPopup(new firebase__default["default"].auth.GoogleAuthProvider())];
2420
+ case 0: return [4 /*yield*/, this.firebaseAuth.signInWithPopup(new firebase__default$1["default"].auth.GoogleAuthProvider())];
2748
2421
  case 1:
2749
2422
  credentials = _a.sent();
2750
2423
  user = credentials.user;
@@ -2782,13 +2455,6 @@
2782
2455
  });
2783
2456
  });
2784
2457
  };
2785
- AuthenticationFirebaseAuthService.prototype.sendPasswordResetEmail = function (email) {
2786
- return __awaiter(this, void 0, void 0, function () {
2787
- return __generator(this, function (_a) {
2788
- return [2 /*return*/, this.firebaseAuth.sendPasswordResetEmail(email)];
2789
- });
2790
- });
2791
- };
2792
2458
  return AuthenticationFirebaseAuthService;
2793
2459
  }());
2794
2460
 
@@ -2825,1609 +2491,18 @@
2825
2491
  return RegisterFirebaseAuthService;
2826
2492
  }());
2827
2493
 
2828
- var AttributeOptionHelper = /** @class */ (function () {
2829
- function AttributeOptionHelper() {
2830
- }
2831
- return AttributeOptionHelper;
2832
- }());
2833
- AttributeOptionHelper.FindByAttribute = function (attributeName, fields) {
2834
- if (fields.includes(attributeName))
2835
- return { columnName: attributeName.toString(), attributeName: attributeName };
2836
- var field = fields.find(function (columnOption) { return lodash.isObject(columnOption) && Object.keys(columnOption).includes(attributeName.toString()); });
2837
- var fieldOption = field === null || field === void 0 ? void 0 : field[attributeName.toString()];
2838
- if (lodash.isNil(fieldOption))
2839
- return { columnName: attributeName.toString(), attributeName: attributeName };
2840
- if (Array.isArray(fieldOption))
2841
- return { columnName: attributeName.toString(), attributeName: attributeName, fields: fieldOption };
2842
- return Object.assign({ attributeName: attributeName, columnName: attributeName.toString() }, fieldOption);
2843
- };
2844
- AttributeOptionHelper.CheckIsColumnOption = function (fieldValue) { return !!fieldValue.columnName; };
2845
- AttributeOptionHelper.FindColumnOptionFromList = function (columnName, fields) {
2846
- if (fields.includes(columnName))
2847
- return { columnName: columnName, attributeName: columnName };
2848
- var field = fields.find(function (columnOption) {
2849
- var _a;
2850
- return lodash.isObject(columnOption) &&
2851
- ((_a = Object.values(columnOption).find(function (option) { return AttributeOptionHelper.CheckIsColumnOption(option) && option.columnName === columnName; })) === null || _a === void 0 ? void 0 : _a.columnName) === columnName;
2852
- }) || {};
2853
- var attributeName = Object.keys(field).find(function (fieldOptionFromList) { return AttributeOptionHelper.CheckIsColumnOption(field[fieldOptionFromList]) ||
2854
- Array.isArray(field[fieldOptionFromList]); });
2855
- var fieldOption = field === null || field === void 0 ? void 0 : field[attributeName];
2856
- if (Array.isArray(fieldOption))
2857
- return { attributeName: attributeName, fields: fieldOption };
2858
- return Object.assign({ attributeName: attributeName || columnName, columnName: columnName }, fieldOption);
2859
- };
2860
-
2861
- var GraphQLFieldHelper = /** @class */ (function () {
2862
- function GraphQLFieldHelper() {
2863
- }
2864
- return GraphQLFieldHelper;
2865
- }());
2866
- GraphQLFieldHelper.CheckIsGraphQLParams = function (params) { return !lodash.isString(params) && Array.isArray(params) && params.length >= 0 && !!params[0].operation; };
2867
- GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields = function (fields) {
2868
- return fields === null || fields === void 0 ? void 0 : fields.map(function (field) {
2869
- var _b, _c;
2870
- if (lodash.isString(field))
2871
- return field.toString();
2872
- var fieldName = Object.keys(field).shift();
2873
- var fieldValue = field[fieldName];
2874
- if (Array.isArray(fieldValue))
2875
- return _b = {}, _b[fieldName] = GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue), _b;
2876
- if (!AttributeOptionHelper.CheckIsColumnOption(fieldValue))
2877
- return;
2878
- if (fieldValue.fields)
2879
- return _c = {},
2880
- _c[fieldValue.columnName || fieldName] = GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue.fields),
2881
- _c;
2882
- return fieldValue.columnName;
2883
- }).filter(function (field) { return !!field; });
2884
- };
2885
- GraphQLFieldHelper.ConvertFieldValueFrom = function (data, fields) { return Object.keys(data).reduce(function (result, columnName) {
2886
- var _b, _c, _d, _e;
2887
- var _f = AttributeOptionHelper.FindColumnOptionFromList(columnName, fields), attributeName = _f.attributeName, attributeFields = _f.fields, from = _f.from;
2888
- if (!!attributeFields && Array.isArray(attributeFields)) {
2889
- if (Array.isArray(data[columnName]))
2890
- return Object.assign(Object.assign({}, result), (_b = {}, _b[attributeName] = from
2891
- ? from(data[columnName], data)
2892
- : data[columnName].map(function (value) { return GraphQLFieldHelper.ConvertFieldValueFrom(value, attributeFields); }), _b));
2893
- if (lodash.isObject(data[columnName]))
2894
- return Object.assign(Object.assign({}, result), (_c = {}, _c[attributeName] = GraphQLFieldHelper.ConvertFieldValueFrom(data[columnName], attributeFields), _c));
2895
- }
2896
- if (!!from)
2897
- return Object.assign(Object.assign({}, result), (_d = {}, _d[attributeName] = from(data[columnName], data), _d));
2898
- return Object.assign(Object.assign({}, result), (_e = {}, _e[attributeName] = parseDateTime(data[columnName]), _e));
2899
- }, {}); };
2900
- GraphQLFieldHelper.ConvertFieldValueTo = function (instance, fields, update) {
2901
- if (update === void 0) { update = false; }
2902
- var _a;
2903
- var data = ((_a = instance.toPlain) === null || _a === void 0 ? void 0 : _a.call(instance)) || instance;
2904
- return Object.keys(data).reduce(function (result, attributeName) {
2905
- var _b, _c, _d;
2906
- var _e = AttributeOptionHelper.FindByAttribute(attributeName, fields), columnName = _e.columnName, attributeFields = _e.fields, foreignKeyColumn = _e.foreignKeyColumn, to = _e.to, bindPersistData = _e.bindPersistData;
2907
- if (bindPersistData)
2908
- return Object.assign(Object.assign({}, result), bindPersistData(data[attributeName], instance));
2909
- if (lodash.isNil(columnName))
2910
- return result;
2911
- if (!!foreignKeyColumn &&
2912
- !lodash.isEmpty(foreignKeyColumn) &&
2913
- !Object.keys(foreignKeyColumn).filter(function (key) { var _a; return !((_a = data[attributeName]) === null || _a === void 0 ? void 0 : _a[key]); }).length)
2914
- return Object.keys(foreignKeyColumn).reduce(function (object, current) {
2915
- var _b;
2916
- var _a;
2917
- return (Object.assign(Object.assign({}, object), (_b = {}, _b[foreignKeyColumn[current]] = (_a = data[attributeName]) === null || _a === void 0 ? void 0 : _a[current], _b)));
2918
- }, Object.assign({}, result));
2919
- if (update && lodash.isObject(data[attributeName]) && !lodash.isNil(attributeFields) && !lodash.isDate(data[attributeName]))
2920
- return result;
2921
- if (!!columnName && Array.isArray(attributeFields) && lodash.isObject(data[attributeName])) {
2922
- var converted = !lodash.isNil(columnName) && to ? to(instance[attributeName], instance) : data[attributeName];
2923
- return Object.assign(Object.assign({}, result), (converted !== undefined
2924
- ? (_b = {},
2925
- _b[columnName] = {
2926
- data: instance[attributeName] instanceof BaseModel
2927
- ? GraphQLFieldHelper.ConvertFieldValueTo(data[attributeName], attributeFields)
2928
- : converted,
2929
- },
2930
- _b) : {}));
2931
- }
2932
- if (!!to)
2933
- return Object.assign(Object.assign({}, result), (_c = {}, _c[columnName] = to(instance[attributeName], instance), _c));
2934
- return Object.assign(Object.assign({}, result), (_d = {}, _d[columnName] = data[attributeName], _d));
2935
- }, {});
2936
- };
2937
-
2938
- var FilterOptionHelper = /** @class */ (function () {
2939
- function FilterOptionHelper() {
2940
- }
2941
- return FilterOptionHelper;
2942
- }());
2943
- FilterOptionHelper.CheckIfIsFilterOption = function (filter) { return !lodash.isNil(filter === null || filter === void 0 ? void 0 : filter.operator); };
2944
- FilterOptionHelper.GetValueFromFilter = function (filter, fieldOption) {
2945
- if (!FilterOptionHelper.CheckIfIsFilterOption(filter))
2946
- return filter;
2947
- if (filter.operator === exports.Where.ISNULL)
2948
- return true;
2949
- if (filter.operator === exports.Where.ISNOTNULL)
2950
- return false;
2951
- var converter = fieldOption.to ? fieldOption.to : function (value) { return value; };
2952
- return Array.isArray(filter.value) && !fieldOption.fields && [exports.Where.IN, exports.Where.NOTIN].includes(filter.operator)
2953
- ? filter.value.map(function (fieldValue) { return converter(fieldValue); })
2954
- : converter(filter.value);
2955
- };
2956
-
2957
- var withCreateHasuraGraphQL = function (MixinBase) {
2958
- return /** @class */ (function (_super) {
2959
- __extends(CreateHasuraGraphQLMixin, _super);
2960
- function CreateHasuraGraphQLMixin() {
2961
- var params = [];
2962
- for (var _i = 0; _i < arguments.length; _i++) {
2963
- params[_i] = arguments[_i];
2964
- }
2965
- var _this = this;
2966
- var options = params === null || params === void 0 ? void 0 : params[0];
2967
- _this = _super.apply(this, __spreadArray([], __read(params))) || this;
2968
- _this.insertGraphQLOperation = (options === null || options === void 0 ? void 0 : options.insertGraphQLOperation) || "insert_" + _this.tableName + "_one";
2969
- _this.insertGraphQLObjectType = (options === null || options === void 0 ? void 0 : options.insertGraphQLObjectType) || _this.tableName + "_insert_input";
2970
- return _this;
2971
- }
2972
- CreateHasuraGraphQLMixin.prototype.create = function (data) {
2973
- return __awaiter(this, void 0, void 0, function () {
2974
- var newData;
2975
- return __generator(this, function (_b) {
2976
- switch (_b.label) {
2977
- case 0: return [4 /*yield*/, this.save(this.model.toInstance(data))];
2978
- case 1:
2979
- newData = _b.sent();
2980
- return [2 /*return*/, this.model.toInstance(newData)];
2981
- }
2982
- });
2983
- });
2984
- };
2985
- CreateHasuraGraphQLMixin.prototype.save = function (data) {
2986
- return __awaiter(this, void 0, void 0, function () {
2987
- var primaryKeyColumns, foreignKeyColumns, result;
2988
- var _this = this;
2989
- return __generator(this, function (_b) {
2990
- switch (_b.label) {
2991
- case 0:
2992
- primaryKeyColumns = this.model.identifiersFields.map(function (field) { return AttributeOptionHelper.FindByAttribute(field, _this.fields).columnName; });
2993
- foreignKeyColumns = this.fields
2994
- .map(function (field) {
2995
- var _b;
2996
- var columnOptions = Object.values(field).shift();
2997
- return (AttributeOptionHelper.CheckIsColumnOption(columnOptions) &&
2998
- columnOptions.foreignKeyColumn && __spreadArray(__spreadArray([], __read(Object.values(columnOptions.foreignKeyColumn))), [
2999
- (_b = {},
3000
- _b[columnOptions.columnName] = Object.keys(columnOptions.foreignKeyColumn).map(function (foreignKeyField) {
3001
- var _a;
3002
- return ((_a = AttributeOptionHelper.FindByAttribute(foreignKeyField, columnOptions === null || columnOptions === void 0 ? void 0 : columnOptions.fields)) === null || _a === void 0 ? void 0 : _a.columnName) ||
3003
- foreignKeyField;
3004
- }),
3005
- _b),
3006
- ]));
3007
- })
3008
- .filter(Boolean)
3009
- .reduce(function (keys, current) { return __spreadArray(__spreadArray([], __read(keys)), __read(current)); }, []);
3010
- return [4 /*yield*/, this.mutation(this.insertGraphQLOperation, __spreadArray(__spreadArray([], __read(primaryKeyColumns)), __read(foreignKeyColumns)), {
3011
- object: { type: this.insertGraphQLObjectType, required: true, value: this.convertDataToHasura(data) },
3012
- })];
3013
- case 1:
3014
- result = _b.sent();
3015
- return [2 /*return*/, Object.assign(Object.assign({}, data.toPlain()), this.convertDataFromHasura(result[this.insertGraphQLOperation]).toPlain())];
3016
- }
3017
- });
3018
- });
3019
- };
3020
- return CreateHasuraGraphQLMixin;
3021
- }(MixinBase));
3022
- };
3023
-
3024
- var withDeleteHasuraGraphQL = function (MixinBase) {
3025
- return /** @class */ (function (_super) {
3026
- __extends(DeleteHasuraGraphQLMixin, _super);
3027
- function DeleteHasuraGraphQLMixin() {
3028
- var params = [];
3029
- for (var _i = 0; _i < arguments.length; _i++) {
3030
- params[_i] = arguments[_i];
3031
- }
3032
- var _this = this;
3033
- var options = params === null || params === void 0 ? void 0 : params[0];
3034
- _this = _super.apply(this, __spreadArray([], __read(params))) || this;
3035
- _this.deleteGraphQLOperation = (options === null || options === void 0 ? void 0 : options.deleteGraphQLOperation) || "delete_" + _this.tableName + "_by_pk";
3036
- return _this;
3037
- }
3038
- DeleteHasuraGraphQLMixin.prototype.delete = function (identifiers) {
3039
- return __awaiter(this, void 0, void 0, function () {
3040
- var instance;
3041
- var _this = this;
3042
- return __generator(this, function (_a) {
3043
- switch (_a.label) {
3044
- case 0:
3045
- instance = this.model.toInstance(identifiers);
3046
- return [4 /*yield*/, this.mutation(this.deleteGraphQLOperation, this.model.identifiersFields.map(function (field) { return AttributeOptionHelper.FindByAttribute(field, _this.fields).columnName; }), this.model.identifiersFields.reduce(function (ids, identifier) {
3047
- var _a;
3048
- if (lodash.isNil(instance[identifier]))
3049
- return ids;
3050
- var columnOption = AttributeOptionHelper.FindByAttribute(identifier, _this.fields);
3051
- var value = columnOption.to(identifiers[identifier.toString()], instance);
3052
- return Object.assign(Object.assign({}, ids), (_a = {}, _a[columnOption.columnName] = {
3053
- type: _this.getAttributeGraphQLTypeOf(columnOption.type || value),
3054
- value: value,
3055
- required: true,
3056
- }, _a));
3057
- }, {}))];
3058
- case 1:
3059
- _a.sent();
3060
- return [2 /*return*/];
3061
- }
3062
- });
3063
- });
3064
- };
3065
- return DeleteHasuraGraphQLMixin;
3066
- }(MixinBase));
3067
- };
3068
-
3069
- var withHasuraGraphQL = function (MixinBase) {
3070
- return /** @class */ (function (_super) {
3071
- __extends(HasuraGraphQLMixin, _super);
3072
- function HasuraGraphQLMixin() {
3073
- var params = [];
3074
- for (var _i = 0; _i < arguments.length; _i++) {
3075
- params[_i] = arguments[_i];
3076
- }
3077
- var _this = this;
3078
- var options = params[0];
3079
- _this = _super.apply(this, __spreadArray([], __read(params))) || this;
3080
- _this.tableName = options.tableName;
3081
- _this.endpoint = options.endpoint;
3082
- _this.authOptions = options.authOptions;
3083
- _this.model = options.model;
3084
- _this.fields = options.fields || _this.model.identifiersFields;
3085
- return _this;
3086
- }
3087
- Object.defineProperty(HasuraGraphQLMixin.prototype, "headers", {
3088
- get: function () {
3089
- return Object.assign(Object.assign(Object.assign({ 'Content-Type': 'application/json' }, (lodash.isNil(this.authOptions.authToken) ? {} : { Authorization: this.authOptions.authToken })), (lodash.isNil(this.authOptions.adminSecret) ? {} : { 'X-Hasura-Admin-Secret': this.authOptions.adminSecret })), (lodash.isNil(this.authOptions.authRole)
3090
- ? {}
3091
- : { 'X-Hasura-Role': this.authOptions.authRole.role, 'X-Hasura-User-Id': this.authOptions.authRole.userId }));
3092
- },
3093
- enumerable: false,
3094
- configurable: true
3095
- });
3096
- HasuraGraphQLMixin.prototype.mutation = function (operation, fields, variables) {
3097
- return __awaiter(this, void 0, void 0, function () {
3098
- var resultQuery;
3099
- return __generator(this, function (_a) {
3100
- resultQuery = gqlQueryBuilder.mutation({
3101
- operation: operation,
3102
- variables: variables,
3103
- fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fields),
3104
- });
3105
- return [2 /*return*/, this.fetch(resultQuery)];
3106
- });
3107
- });
3108
- };
3109
- HasuraGraphQLMixin.prototype.query = function (operation, fields, variables) {
3110
- return __awaiter(this, void 0, void 0, function () {
3111
- var resultQuery;
3112
- return __generator(this, function (_a) {
3113
- resultQuery = GraphQLFieldHelper.CheckIsGraphQLParams(operation)
3114
- ? gqlQueryBuilder.query(operation.map(function (option) { return ({
3115
- operation: option.operation,
3116
- variables: option.variables,
3117
- fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(option.fields),
3118
- }); }))
3119
- : gqlQueryBuilder.query({
3120
- operation: operation,
3121
- variables: variables,
3122
- fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fields),
3123
- });
3124
- JSON.stringify(resultQuery);
3125
- return [2 /*return*/, this.fetch(resultQuery)];
3126
- });
3127
- });
3128
- };
3129
- HasuraGraphQLMixin.prototype.fetch = function (params) {
3130
- return __awaiter(this, void 0, void 0, function () {
3131
- var headers, response, result;
3132
- return __generator(this, function (_a) {
3133
- switch (_a.label) {
3134
- case 0:
3135
- headers = this.headers;
3136
- return [4 /*yield*/, fetch__default["default"]("" + this.endpoint, {
3137
- method: 'POST',
3138
- body: JSON.stringify(params),
3139
- headers: headers,
3140
- })];
3141
- case 1:
3142
- response = _a.sent();
3143
- return [4 /*yield*/, response.json()];
3144
- case 2:
3145
- result = _a.sent();
3146
- if (!lodash.isNil(result.errors))
3147
- throw new Error(JSON.stringify(result.errors));
3148
- return [2 /*return*/, result.data];
3149
- }
3150
- });
3151
- });
3152
- };
3153
- HasuraGraphQLMixin.prototype.getAttributeGraphQLTypeOf = function (value) {
3154
- if (isUUID(value))
3155
- return 'uuid';
3156
- if (lodash.isString(value))
3157
- return 'String';
3158
- if (lodash.isBoolean(value))
3159
- return 'Boolean';
3160
- if (value instanceof Date)
3161
- return 'timestamptz';
3162
- if (lodash.isInteger(value))
3163
- return 'Int';
3164
- if (lodash.isNumber(value))
3165
- return 'numeric';
3166
- throw new Error('Type not implemented yet');
3167
- };
3168
- HasuraGraphQLMixin.prototype.checkIfIsDateTimeAndParse = function (value) {
3169
- if (!/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.test(value))
3170
- return value;
3171
- var date = dateFns.parseISO(value);
3172
- if (lodash.isNaN(date.getTime()))
3173
- return value;
3174
- return date;
3175
- };
3176
- HasuraGraphQLMixin.prototype.convertDataFromHasura = function (data) {
3177
- var plain = GraphQLFieldHelper.ConvertFieldValueFrom(data, this.fields);
3178
- return this.model.toInstance(plain);
3179
- };
3180
- HasuraGraphQLMixin.prototype.convertDataToHasura = function (instance, update) {
3181
- if (update === void 0) { update = false; }
3182
- return GraphQLFieldHelper.ConvertFieldValueTo(instance, this.fields, update);
3183
- };
3184
- return HasuraGraphQLMixin;
3185
- }(MixinBase));
3186
- };
3187
-
3188
- var withUpdateHasuraGraphQL = function (MixinBase) {
3189
- var getValueByAction = function (options) {
3190
- if (options instanceof BaseModel)
3191
- return options.toPlain();
3192
- if (lodash.isNil(options === null || options === void 0 ? void 0 : options.action))
3193
- return options;
3194
- if ([exports.UpdateOptionActions.REMOVE_FIELD.toString(), exports.UpdateOptionActions.NULL.toString()].includes(options.action))
3195
- return null;
3196
- return options.value;
3197
- };
3198
- return /** @class */ (function (_super) {
3199
- __extends(UpdateHasuraGraphQLMixin, _super);
3200
- function UpdateHasuraGraphQLMixin() {
3201
- var params = [];
3202
- for (var _i = 0; _i < arguments.length; _i++) {
3203
- params[_i] = arguments[_i];
3204
- }
3205
- var _this = this;
3206
- var options = params === null || params === void 0 ? void 0 : params[0];
3207
- _this = _super.apply(this, __spreadArray([], __read(params))) || this;
3208
- _this.updateGraphQLOperation = (options === null || options === void 0 ? void 0 : options.updateGraphQLOperation) || "update_" + _this.tableName + "_by_pk";
3209
- _this.updateGraphQLObjectType = (options === null || options === void 0 ? void 0 : options.updateGraphQLObjectType) || _this.tableName + "_set_input";
3210
- _this.updateGraphQLPKType = (options === null || options === void 0 ? void 0 : options.updateGraphQLPKType) || _this.tableName + "_pk_columns_input";
3211
- return _this;
3212
- }
3213
- UpdateHasuraGraphQLMixin.prototype.update = function (data) {
3214
- return __awaiter(this, void 0, void 0, function () {
3215
- var plainData;
3216
- var _this = this;
3217
- return __generator(this, function (_b) {
3218
- switch (_b.label) {
3219
- case 0:
3220
- plainData = this.paramsToPlain(data);
3221
- return [4 /*yield*/, this.mutation(this.updateGraphQLOperation, this.model.identifiersFields.map(function (field) { return AttributeOptionHelper.FindByAttribute(field, _this.fields).columnName; }), {
3222
- _set: {
3223
- type: this.updateGraphQLObjectType,
3224
- value: this.convertDataToHasura(this.model.toInstance(plainData), true),
3225
- required: true,
3226
- },
3227
- pk_columns: { type: this.updateGraphQLPKType, value: this.getUpdateModelKeys(plainData), required: true },
3228
- })];
3229
- case 1:
3230
- _b.sent();
3231
- return [2 /*return*/, this.model.toInstance(plainData)];
3232
- }
3233
- });
3234
- });
3235
- };
3236
- UpdateHasuraGraphQLMixin.prototype.paramsToPlain = function (params) {
3237
- var model = this.model;
3238
- if (model.isModel(params))
3239
- return params.toPlain();
3240
- return Object.keys(params).reduce(function (data, currentKey) {
3241
- var _b;
3242
- return (Object.assign(Object.assign({}, data), (params[currentKey] !== undefined && (_b = {}, _b[currentKey] = getValueByAction(params[currentKey]), _b))));
3243
- }, {});
3244
- };
3245
- UpdateHasuraGraphQLMixin.prototype.getUpdateModelKeys = function (data) {
3246
- var _this = this;
3247
- var instance = this.model.toInstance(data);
3248
- return this.model.identifiersFields.reduce(function (ids, identifier) {
3249
- var _b;
3250
- var _a;
3251
- if (lodash.isNil(instance[identifier]))
3252
- return ids;
3253
- var columnOption = AttributeOptionHelper.FindByAttribute(identifier, _this.fields);
3254
- var value = ((_a = columnOption === null || columnOption === void 0 ? void 0 : columnOption.to) === null || _a === void 0 ? void 0 : _a.call(columnOption, data[identifier.toString()], instance)) || data[columnOption.attributeName];
3255
- return Object.assign(Object.assign({}, ids), (_b = {}, _b[columnOption.columnName] = value, _b));
3256
- }, {});
3257
- };
3258
- return UpdateHasuraGraphQLMixin;
3259
- }(MixinBase));
3260
- };
2494
+ /**
2495
+ * Generated bundle index. Do not edit.
2496
+ */
3261
2497
 
3262
- var withGetHasuraGraphQL = function (MixinBase) {
3263
- return /** @class */ (function (_super) {
3264
- __extends(GetHasuraGraphQLMixin, _super);
3265
- function GetHasuraGraphQLMixin() {
3266
- var params = [];
3267
- for (var _i = 0; _i < arguments.length; _i++) {
3268
- params[_i] = arguments[_i];
3269
- }
3270
- var _this = this;
3271
- var options = params === null || params === void 0 ? void 0 : params[0];
3272
- _this = _super.apply(this, __spreadArray([], __read(params))) || this;
3273
- _this.getGraphQLOperation = (options === null || options === void 0 ? void 0 : options.getGraphQLOperation) || _this.tableName + "_by_pk";
3274
- return _this;
3275
- }
3276
- GetHasuraGraphQLMixin.prototype.get = function (identifiers) {
3277
- return __awaiter(this, void 0, void 0, function () {
3278
- var instance, result, data;
3279
- var _this = this;
3280
- return __generator(this, function (_b) {
3281
- switch (_b.label) {
3282
- case 0:
3283
- instance = this.model.toInstance(identifiers);
3284
- return [4 /*yield*/, this.query(this.getGraphQLOperation, this.fields, this.model.identifiersFields.reduce(function (ids, identifier) {
3285
- var _b;
3286
- var _a;
3287
- if (lodash.isNil(instance[identifier]))
3288
- return ids;
3289
- var columnOption = AttributeOptionHelper.FindByAttribute(identifier, _this.fields);
3290
- var value = ((_a = columnOption === null || columnOption === void 0 ? void 0 : columnOption.to) === null || _a === void 0 ? void 0 : _a.call(columnOption, identifiers[identifier.toString()], instance)) || identifiers[identifier.toString()];
3291
- return Object.assign(Object.assign({}, ids), (_b = {}, _b[columnOption.columnName] = {
3292
- type: _this.getAttributeGraphQLTypeOf(columnOption.type || value),
3293
- value: value,
3294
- required: true,
3295
- }, _b));
3296
- }, {}))];
3297
- case 1:
3298
- result = _b.sent();
3299
- data = result[this.getGraphQLOperation];
3300
- if (lodash.isNil(data))
3301
- throw new NotFoundError(instance.constructor.name + " not found");
3302
- return [2 /*return*/, this.convertDataFromHasura(result[this.getGraphQLOperation])];
3303
- }
3304
- });
3305
- });
3306
- };
3307
- return GetHasuraGraphQLMixin;
3308
- }(MixinBase));
3309
- };
3310
-
3311
- var HasuraGraphQLWhere;
3312
- (function (HasuraGraphQLWhere) {
3313
- HasuraGraphQLWhere["EQUALS"] = "_eq";
3314
- HasuraGraphQLWhere["GT"] = "_gt";
3315
- HasuraGraphQLWhere["GTE"] = "_gte";
3316
- HasuraGraphQLWhere["IN"] = "_in";
3317
- HasuraGraphQLWhere["NOTIN"] = "_nin";
3318
- HasuraGraphQLWhere["LT"] = "_lt";
3319
- HasuraGraphQLWhere["LTE"] = "_lte";
3320
- HasuraGraphQLWhere["LIKE"] = "_like";
3321
- HasuraGraphQLWhere["NOTLIKE"] = "_nlike";
3322
- HasuraGraphQLWhere["ISNULL"] = "_is_null";
3323
- HasuraGraphQLWhere["ISNOTNULL"] = "_is_null";
3324
- })(HasuraGraphQLWhere || (HasuraGraphQLWhere = {}));
3325
-
3326
- var HasuraGraphQLColumnType;
3327
- (function (HasuraGraphQLColumnType) {
3328
- HasuraGraphQLColumnType["Int"] = "Int";
3329
- HasuraGraphQLColumnType["Float"] = "Float";
3330
- HasuraGraphQLColumnType["Boolean"] = "Boolean";
3331
- HasuraGraphQLColumnType["String"] = "String";
3332
- HasuraGraphQLColumnType["DateTime"] = "timestampz";
3333
- HasuraGraphQLColumnType["Json"] = "json";
3334
- HasuraGraphQLColumnType["Jsonb"] = "jsonb";
3335
- HasuraGraphQLColumnType["Enum"] = "enum";
3336
- HasuraGraphQLColumnType["Uuid"] = "uuid";
3337
- })(HasuraGraphQLColumnType || (HasuraGraphQLColumnType = {}));
3338
-
3339
- var withFindHasuraGraphQL = function (MixinBase) {
3340
- return /** @class */ (function (_super) {
3341
- __extends(FindHasuraGraphQLMixin, _super);
3342
- function FindHasuraGraphQLMixin() {
3343
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
3344
- _this.makeGraphQLWhere = function (filter, fields) { return Object.keys(filter).reduce(function (variables, fieldName) {
3345
- var _b;
3346
- var columnOption = AttributeOptionHelper.FindByAttribute(fieldName, fields);
3347
- if (!columnOption.bindFindFilter)
3348
- return Object.assign(Object.assign({}, variables), (_b = {}, _b[columnOption.columnName] = _this.buildWhereSentence(fieldName, filter[fieldName], fields), _b));
3349
- var builtFilter = columnOption.bindFindFilter(filter[fieldName]);
3350
- return Object.assign(Object.assign({}, variables), Object.keys(builtFilter).reduce(function (variablesList, columnName) {
3351
- var _b;
3352
- return (Object.assign(Object.assign({}, variablesList), (_b = {}, _b[columnName] = _this.buildWhereSentence(fieldName, builtFilter[columnName], fields), _b)));
3353
- }, {}));
3354
- }, {}); };
3355
- _this.buildWhereSentence = function (field, options, fields) {
3356
- var _b;
3357
- var fieldSentenceOptions = AttributeOptionHelper.FindByAttribute(field, fields);
3358
- if (!Array.isArray(options) &&
3359
- lodash.isObject(options) &&
3360
- lodash.isNil(options === null || options === void 0 ? void 0 : options.operator) &&
3361
- lodash.isNil(options === null || options === void 0 ? void 0 : options.value) &&
3362
- lodash.isNil(fieldSentenceOptions === null || fieldSentenceOptions === void 0 ? void 0 : fieldSentenceOptions.to))
3363
- return Object.keys(options).reduce(function (variables, key) {
3364
- var _b;
3365
- var fieldOptions = AttributeOptionHelper.FindByAttribute(key, (fieldSentenceOptions === null || fieldSentenceOptions === void 0 ? void 0 : fieldSentenceOptions.fields) || fields);
3366
- var columnName = fieldOptions.columnName;
3367
- var columnFields = fieldOptions.fields;
3368
- return Object.assign(Object.assign({}, variables), (_b = {}, _b[columnName] = _this.buildWhereSentence(key, options[key], columnFields || []), _b));
3369
- }, {});
3370
- if (!Array.isArray(options) && !lodash.isNil(fieldSentenceOptions.fields))
3371
- return _b = {},
3372
- _b[fieldSentenceOptions.fields[0]] = _this.buildOperatorSentence(options, fieldSentenceOptions),
3373
- _b;
3374
- if (lodash.isObject(options) && !FilterOptionHelper.CheckIfIsFilterOption(options))
3375
- options = Object.values(options)[0];
3376
- return Array.isArray(options)
3377
- ? options.reduce(function (whereSentence, option) { return (Object.assign(Object.assign({}, whereSentence), _this.buildOperatorSentence(option, fieldSentenceOptions))); }, {})
3378
- : _this.buildOperatorSentence(options, fieldSentenceOptions);
3379
- };
3380
- _this.buildOperatorSentence = function (options, fieldOption) {
3381
- var _b;
3382
- return (_b = {},
3383
- _b[_this.getHasuraOperator(options, fieldOption)] = FilterOptionHelper.GetValueFromFilter(options, fieldOption),
3384
- _b);
3385
- };
3386
- _this.getHasuraOperator = function (options, fieldOption) { return FilterOptionHelper.CheckIfIsFilterOption(options)
3387
- ? fieldOption.type === HasuraGraphQLColumnType.Jsonb
3388
- ? _this.getHasuraJsonbOperator(options)
3389
- : HasuraGraphQLWhere[Object.keys(HasuraGraphQLWhere).find(function (graphQLOperator) { return graphQLOperator === Object.keys(exports.Where).find(function (operator) { return exports.Where[operator] === (options === null || options === void 0 ? void 0 : options.operator); }); })]
3390
- : HasuraGraphQLWhere.EQUALS; };
3391
- _this.getHasuraJsonbOperator = function (options) { return options.operator === exports.Where.IN
3392
- ? '_contains'
3393
- : options.operator === exports.Where.LIKE
3394
- ? '_has_keys_any'
3395
- : HasuraGraphQLWhere[Object.keys(HasuraGraphQLWhere).find(function (graphQLOperator) { return graphQLOperator === Object.keys(exports.Where).find(function (operator) { return exports.Where[operator] === (options === null || options === void 0 ? void 0 : options.operator); }); })]; };
3396
- return _this;
3397
- }
3398
- FindHasuraGraphQLMixin.prototype.find = function (options) {
3399
- return __awaiter(this, void 0, void 0, function () {
3400
- var _b, filters, limits, orderBy, variablesCount, variables, result, data, count;
3401
- var _this = this;
3402
- return __generator(this, function (_c) {
3403
- switch (_c.label) {
3404
- case 0:
3405
- _b = options || {}, filters = _b.filters, limits = _b.limits, orderBy = _b.orderBy;
3406
- variablesCount = Object.assign(Object.assign({}, (lodash.isNil(orderBy) ? {} : { order_by: { type: this.tableName + "_order_by!", list: true, value: orderBy } })), (lodash.isNil(filters)
3407
- ? {}
3408
- : {
3409
- where: {
3410
- value: this.makeGraphQLWhere(filters, this.fields),
3411
- type: this.tableName + "_bool_exp",
3412
- required: true,
3413
- },
3414
- }));
3415
- variables = Object.assign(Object.assign({}, (lodash.isNil(limits) ? {} : limits)), variablesCount);
3416
- return [4 /*yield*/, this.query([
3417
- {
3418
- operation: this.tableName,
3419
- fields: options.fields
3420
- ? options.fields
3421
- .map(function (fieldName) {
3422
- var _a;
3423
- return (_a = _this.fields.find(function (fieldOption) { return fieldOption === fieldName; })) !== null && _a !== void 0 ? _a : _this.fields.find(function (fieldOption) { return Object.keys(fieldOption).shift() === fieldName; });
3424
- })
3425
- .filter(Boolean)
3426
- : this.fields,
3427
- variables: variables,
3428
- },
3429
- {
3430
- operation: this.tableName + "_aggregate",
3431
- fields: [{ aggregate: ['count'] }],
3432
- variables: variablesCount,
3433
- },
3434
- ])];
3435
- case 1:
3436
- result = _c.sent();
3437
- data = result[this.tableName].map(function (row) { return _this.convertDataFromHasura(row); });
3438
- count = result[this.tableName + "_aggregate"].aggregate.count;
3439
- return [2 /*return*/, { count: count, data: data }];
3440
- }
3441
- });
3442
- });
3443
- };
3444
- return FindHasuraGraphQLMixin;
3445
- }(MixinBase));
3446
- };
3447
-
3448
- var withCrudHasuraGraphQL = function (MixinBase) {
3449
- return /** @class */ (function (_super) {
3450
- __extends(CrudHasuraGraphQLMixin, _super);
3451
- function CrudHasuraGraphQLMixin() {
3452
- return _super !== null && _super.apply(this, arguments) || this;
3453
- }
3454
- return CrudHasuraGraphQLMixin;
3455
- }(withUpdateHasuraGraphQL(withGetHasuraGraphQL(withFindHasuraGraphQL(withDeleteHasuraGraphQL(withCreateHasuraGraphQL(MixinBase)))))));
3456
- };
3457
-
3458
- var CategoryHasuraGraphQL = /** @class */ (function (_super) {
3459
- __extends(CategoryHasuraGraphQL, _super);
3460
- function CategoryHasuraGraphQL() {
3461
- return _super !== null && _super.apply(this, arguments) || this;
3462
- }
3463
- return CategoryHasuraGraphQL;
3464
- }(Category));
3465
-
3466
- var ProductHasuraGraphQL = /** @class */ (function (_super) {
3467
- __extends(ProductHasuraGraphQL, _super);
3468
- function ProductHasuraGraphQL() {
3469
- return _super !== null && _super.apply(this, arguments) || this;
3470
- }
3471
- return ProductHasuraGraphQL;
3472
- }(Product));
3473
- __decorate([
3474
- classTransformer.Type(function () { return KitProductHasuraGraphQL; }),
3475
- __metadata("design:type", Array)
3476
- ], ProductHasuraGraphQL.prototype, "kitProducts", void 0);
3477
-
3478
- var KitProductHasuraGraphQL = /** @class */ (function (_super) {
3479
- __extends(KitProductHasuraGraphQL, _super);
3480
- function KitProductHasuraGraphQL() {
3481
- return _super !== null && _super.apply(this, arguments) || this;
3482
- }
3483
- return KitProductHasuraGraphQL;
3484
- }(KitProduct));
3485
- __decorate([
3486
- classTransformer.Type(function () { return ProductHasuraGraphQL; }),
3487
- __metadata("design:type", ProductHasuraGraphQL)
3488
- ], KitProductHasuraGraphQL.prototype, "kit", void 0);
3489
- __decorate([
3490
- classTransformer.Type(function () { return ProductHasuraGraphQL; }),
3491
- __metadata("design:type", ProductHasuraGraphQL)
3492
- ], KitProductHasuraGraphQL.prototype, "product", void 0);
3493
-
3494
- var VariantHasuraGraphQL = /** @class */ (function (_super) {
3495
- __extends(VariantHasuraGraphQL, _super);
3496
- function VariantHasuraGraphQL() {
3497
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
3498
- _this.name = '';
3499
- _this.hasVariants = false;
3500
- return _this;
3501
- }
3502
- return VariantHasuraGraphQL;
3503
- }(Variant));
3504
-
3505
- var CategoryHasuraGraphQLRepository = /** @class */ (function (_super_1) {
3506
- __extends(CategoryHasuraGraphQLRepository, _super_1);
3507
- function CategoryHasuraGraphQLRepository(endpoint, authOptions, productRepository) {
3508
- var _this = _super_1.call(this, {
3509
- tableName: 'category',
3510
- model: Category,
3511
- endpoint: endpoint,
3512
- authOptions: authOptions,
3513
- fields: [
3514
- { id: { columnName: 'id', to: function (value) { return +value; }, from: function (value) { return value.toString(); } } },
3515
- { firestoreId: { columnName: 'firestore_id' } },
3516
- 'name',
3517
- 'description',
3518
- 'image',
3519
- 'published',
3520
- 'shop',
3521
- 'slug',
3522
- { brandCategory: { columnName: 'brand_category' } },
3523
- { brandCategoryBanner: { columnName: 'brand_banner' } },
3524
- { brandCategoryBannerMobile: { columnName: 'brand_banner_mobile' } },
3525
- { brandLogo: { columnName: 'brand_logo' } },
3526
- { brandCondition: { columnName: 'brand_condition' } },
3527
- {
3528
- conditions: {
3529
- columnName: 'tag_condition',
3530
- type: HasuraGraphQLColumnType.Jsonb,
3531
- from: function (tags, row) { return ({ brand: row.brand_condition, tags: Array.isArray(tags) ? tags : [] }); },
3532
- bindPersistData: function (value) {
3533
- var _a, _b;
3534
- return {
3535
- brand_condition: value.brand,
3536
- tag_condition: "{\"" + (((_b = (_a = value === null || value === void 0 ? void 0 : value.tags) === null || _a === void 0 ? void 0 : _a.join) === null || _b === void 0 ? void 0 : _b.call(_a, '","')) || '') + "\"}",
3537
- };
3538
- },
3539
- bindFindFilter: function (sentence) {
3540
- return Object.assign(Object.assign({}, (sentence.brand ? { brand_condition: sentence.brand } : {})), (sentence.tags ? { tag_condition: sentence.tags } : {}));
3541
- },
3542
- },
3543
- },
3544
- 'filters',
3545
- { createdAt: { columnName: 'created_at' } },
3546
- { updatedAt: { columnName: 'updated_at' } },
3547
- {
3548
- products: {
3549
- columnName: 'products',
3550
- fields: ['product_id'],
3551
- from: function (value) { return value.map(function (product) { return product.product_id.toString(); }); },
3552
- to: function (productIds) { return productIds.map(function (productId) { return ({
3553
- product_id: +productId,
3554
- }); }); },
3555
- },
3556
- },
3557
- ],
3558
- }) || this;
3559
- _this.productRepository = productRepository;
3560
- return _this;
3561
- }
3562
- CategoryHasuraGraphQLRepository.prototype.get = function (identifiers) {
3563
- var _super = Object.create(null, {
3564
- get: { get: function () { return _super_1.prototype.get; } }
3565
- });
3566
- var _a;
3567
- return __awaiter(this, void 0, void 0, function () {
3568
- var _c;
3569
- return __generator(this, function (_d) {
3570
- switch (_d.label) {
3571
- case 0:
3572
- if (!Number.isNaN(+identifiers.id)) return [3 /*break*/, 2];
3573
- return [4 /*yield*/, this.find({ filters: { firestoreId: identifiers.id } })];
3574
- case 1:
3575
- _c = (_a = (_d.sent()).data) === null || _a === void 0 ? void 0 : _a[0];
3576
- return [3 /*break*/, 3];
3577
- case 2:
3578
- _c = _super.get.call(this, identifiers);
3579
- _d.label = 3;
3580
- case 3: return [2 /*return*/, _c];
3581
- }
3582
- });
3583
- });
3584
- };
3585
- CategoryHasuraGraphQLRepository.prototype.getCategoryBySlug = function (slug, shop) {
3586
- return __awaiter(this, void 0, void 0, function () {
3587
- var _c, data, count;
3588
- return __generator(this, function (_d) {
3589
- switch (_d.label) {
3590
- case 0:
3591
- if (!slug)
3592
- return [2 /*return*/];
3593
- return [4 /*yield*/, this.find({ filters: { slug: slug, shop: shop, published: true } })];
3594
- case 1:
3595
- _c = _d.sent(), data = _c.data, count = _c.count;
3596
- if (count > 1)
3597
- throw new DuplicatedResultsError('Query returned duplicated values');
3598
- if (!count)
3599
- throw new NotFoundError("Category with slug " + slug + " not found");
3600
- return [2 /*return*/, data.shift()];
3601
- }
3602
- });
3603
- });
3604
- };
3605
- CategoryHasuraGraphQLRepository.prototype.getCategoriesForHome = function (categoryIds, limit) {
3606
- if (limit === void 0) { limit = 4; }
3607
- return __awaiter(this, void 0, void 0, function () {
3608
- var _c, categories, count, homeSections;
3609
- var _this = this;
3610
- return __generator(this, function (_d) {
3611
- switch (_d.label) {
3612
- case 0: return [4 /*yield*/, this.find({
3613
- filters: { firestoreId: { operator: exports.Where.IN, value: categoryIds.filter(Boolean) }, published: true },
3614
- })];
3615
- case 1:
3616
- _c = _d.sent(), categories = _c.data, count = _c.count;
3617
- if (!count)
3618
- throw new NotFoundError('Categories not found');
3619
- return [4 /*yield*/, Promise.all(categories.map(function (category) { return __awaiter(_this, void 0, void 0, function () {
3620
- var _c;
3621
- return __generator(this, function (_d) {
3622
- switch (_d.label) {
3623
- case 0:
3624
- _c = {
3625
- category: category
3626
- };
3627
- return [4 /*yield*/, this.mountCategory(category, { limit: limit, hasStock: true })];
3628
- case 1: return [2 /*return*/, (_c.products = _d.sent(),
3629
- _c)];
3630
- }
3631
- });
3632
- }); }))];
3633
- case 2:
3634
- homeSections = _d.sent();
3635
- return [2 /*return*/, homeSections];
3636
- }
3637
- });
3638
- });
3639
- };
3640
- CategoryHasuraGraphQLRepository.prototype.mountCategory = function (category, options) {
3641
- return __awaiter(this, void 0, void 0, function () {
3642
- var products, publishedField, productsData;
3643
- var _c;
3644
- return __generator(this, function (_d) {
3645
- switch (_d.label) {
3646
- case 0:
3647
- if (!category.products)
3648
- throw new RequiredArgumentError(['Category products is empty']);
3649
- products = [];
3650
- publishedField = category.shop === exports.Shops.GLAMSHOP ? 'publishedGlam' : 'published';
3651
- return [4 /*yield*/, this.productRepository.find(Object.assign({ filters: Object.assign((_c = { id: { operator: exports.Where.IN, value: category.products } }, _c[publishedField] = true, _c), ((options === null || options === void 0 ? void 0 : options.hasStock) ? { stock: { quantity: { operator: exports.Where.GT, value: 0 } } } : {})), fields: [
3652
- 'id',
3653
- 'name',
3654
- 'slug',
3655
- 'images',
3656
- 'miniatures',
3657
- 'price',
3658
- 'fullPrice',
3659
- 'subscriberDiscountPercentage',
3660
- 'subscriberPrice',
3661
- 'stock',
3662
- 'published',
3663
- 'publishedGlam',
3664
- 'CEST',
3665
- 'EAN',
3666
- 'NCM',
3667
- 'brand',
3668
- 'costPrice',
3669
- 'hasVariants',
3670
- 'isKit',
3671
- 'shopAvailability',
3672
- 'sku',
3673
- ] }, ((options === null || options === void 0 ? void 0 : options.limit) ? { limits: { limit: options === null || options === void 0 ? void 0 : options.limit } } : {})))];
3674
- case 1:
3675
- productsData = (_d.sent()).data;
3676
- products.push.apply(products, __spreadArray([], __read(productsData)));
3677
- return [2 /*return*/, products];
3678
- }
3679
- });
3680
- });
3681
- };
3682
- return CategoryHasuraGraphQLRepository;
3683
- }(withCrudHasuraGraphQL(withHasuraGraphQL(Base))));
3684
-
3685
- var ProductHasuraGraphQLRepository = /** @class */ (function (_super_1) {
3686
- __extends(ProductHasuraGraphQLRepository, _super_1);
3687
- function ProductHasuraGraphQLRepository(endpoint, authOptions) {
3688
- var _this = _super_1.call(this, {
3689
- tableName: 'product',
3690
- model: ProductHasuraGraphQL,
3691
- endpoint: endpoint,
3692
- authOptions: authOptions,
3693
- fields: [],
3694
- }) || this;
3695
- _this.bindReviewToModel = function (plain) { return (Object.assign(Object.assign({}, lodash.omit(plain, ['product_id', 'created_at', 'updated_at', 'person_id', 'order_id'])), { createdAt: typeof plain.created_at === 'string' ? new Date(plain.created_at) : plain.created_at, updatedAt: typeof plain.updated_at === 'string' ? new Date(plain.updated_at) : plain.updated_at, personId: plain.person_id, orderId: plain.order_id })); };
3696
- _this.bindReviewToHasura = function (review) { return (Object.assign(Object.assign({}, lodash.omit(review, ['productId', 'createdAt', 'updatedAt', 'personId', 'orderId'])), { person_id: review.personId, order_id: review.orderId })); };
3697
- var commonFields = [
3698
- { id: { columnName: 'id', to: function (value) { return +value; }, from: function (value) { return value.toString(); } } },
3699
- { firestoreId: { columnName: 'firestore_id' } },
3700
- { CEST: { columnName: 'cest' } },
3701
- { EAN: { columnName: 'ean' } },
3702
- { NCM: { columnName: 'ncm' } },
3703
- 'brand',
3704
- { costPrice: { columnName: 'cost_price' } },
3705
- {
3706
- description: {
3707
- columnName: 'description',
3708
- from: function (description) { return Object.values(exports.Shops).reduce(function (shops, shop) {
3709
- var _c;
3710
- return (Object.assign(Object.assign({}, shops), (_c = {}, _c[shop] = { description: description }, _c)));
3711
- }, {}); },
3712
- to: function (value) { return Object.values(value).shift().description; },
3713
- },
3714
- },
3715
- { hasVariants: { columnName: 'has_variants' } },
3716
- { images: { columnName: 'images', to: function (value) { var _a; return "{\"" + (((_a = value === null || value === void 0 ? void 0 : value.join) === null || _a === void 0 ? void 0 : _a.call(value, "\",\"")) || '') + "\"}"; } } },
3717
- { miniatures: { columnName: 'miniatures', to: function (value) { var _a; return "{\"" + (((_a = value === null || value === void 0 ? void 0 : value.join) === null || _a === void 0 ? void 0 : _a.call(value, "\",\"")) || '') + "\"}"; } } },
3718
- 'name',
3719
- {
3720
- price: {
3721
- columnName: 'price',
3722
- from: function (price, data) { return Object.values(exports.Shops).reduce(function (prices, shop) {
3723
- var _c;
3724
- return (Object.assign(Object.assign({}, prices), (_c = {}, _c[shop] = {
3725
- price: price,
3726
- fullPrice: data.full_price,
3727
- subscriberDiscountPercentage: data.subscriber_discount_percentage,
3728
- subscriberPrice: data.subscriber_price,
3729
- }, _c)));
3730
- }, {}); },
3731
- bindFindFilter: function (sentence) {
3732
- var filters = Object.values(sentence).shift();
3733
- return Object.assign(Object.assign(Object.assign(Object.assign({}, (((filters === null || filters === void 0 ? void 0 : filters.price) || (filters === null || filters === void 0 ? void 0 : filters.price) === 0) && { price: filters.price })), ((filters.fullPrice || filters.fullPrice === 0) && { full_price: filters.fullPrice })), ((filters.subscriberDiscountPercentage || filters.subscriberDiscountPercentage === 0) && {
3734
- subscriber_discount_percentage: filters.subscriberDiscountPercentage,
3735
- })), ((filters.subscriberPrice || filters.subscriberPrice === 0) && {
3736
- subscriber_price: filters.subscriberPrice,
3737
- }));
3738
- },
3739
- bindPersistData: function (value) {
3740
- var priceData = Object.values(value).shift();
3741
- return Object.assign(Object.assign(Object.assign(Object.assign({}, ((priceData === null || priceData === void 0 ? void 0 : priceData.price) >= 0 && { price: priceData.price })), (priceData.fullPrice >= 0 && { full_price: priceData.fullPrice })), (priceData.subscriberDiscountPercentage >= 0 && {
3742
- subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
3743
- })), (priceData.subscriberPrice >= 0 && { subscriber_price: priceData.subscriberPrice }));
3744
- },
3745
- },
3746
- },
3747
- { fullPrice: { columnName: 'full_price' } },
3748
- { subscriberDiscountPercentage: { columnName: 'subscriber_discount_percentage' } },
3749
- { subscriberPrice: { columnName: 'subscriber_price' } },
3750
- 'published',
3751
- { publishedGlam: { columnName: 'published_glam' } },
3752
- 'sku',
3753
- {
3754
- stock: {
3755
- columnName: 'stock',
3756
- from: function (quantity) { return ({ quantity: quantity }); },
3757
- to: function (value) { return (lodash.isNil(value === null || value === void 0 ? void 0 : value.quantity) ? value : value === null || value === void 0 ? void 0 : value.quantity); },
3758
- },
3759
- },
3760
- 'slug',
3761
- 'type',
3762
- 'video',
3763
- 'weight',
3764
- {
3765
- shopAvailability: {
3766
- columnName: 'shop_availabilities',
3767
- fields: ['shop'],
3768
- from: function (shop) { return (Array.isArray(shop) ? shop.map(function (row) { return row.shop; }) : []); },
3769
- to: function (shops) { return shops.map(function (shop) { return ({ shop: shop }); }); },
3770
- },
3771
- },
3772
- { tags: { columnName: 'tags', type: HasuraGraphQLColumnType.Jsonb } },
3773
- { isKit: { columnName: 'is_kit' } },
3774
- { createdAt: { columnName: 'created_at' } },
3775
- { updatedAt: { columnName: 'updated_at' } },
3776
- ];
3777
- _this.fields = __spreadArray(__spreadArray([], __read(commonFields)), [
3778
- {
3779
- categories: {
3780
- columnName: 'categories',
3781
- fields: ['category_id'],
3782
- bindPersistData: function (value) { return ({
3783
- categories: { data: value.map(function (category) { return ({ category_id: +category }); }) },
3784
- }); },
3785
- to: function (categories) { return categories.map(function (categoryId) { return +categoryId; }); },
3786
- from: function (categories) { return (categories === null || categories === void 0 ? void 0 : categories.map(function (category) { var _a; return (_a = category === null || category === void 0 ? void 0 : category.category_id) === null || _a === void 0 ? void 0 : _a.toString(); })) || []; },
3787
- },
3788
- },
3789
- {
3790
- kitProducts: {
3791
- columnName: 'kit_products',
3792
- foreignKeyColumn: { productId: 'id' },
3793
- fields: [
3794
- { productId: { columnName: 'product_id' } },
3795
- { kitProductId: { columnName: 'kit_product_id' } },
3796
- 'quantity',
3797
- { product: { columnName: 'product', foreignKeyColumn: { id: 'product_id' }, fields: commonFields } },
3798
- ],
3799
- },
3800
- },
3801
- ]);
3802
- return _this;
3803
- }
3804
- Object.defineProperty(ProductHasuraGraphQLRepository.prototype, "reviewsFields", {
3805
- get: function () {
3806
- return [
3807
- 'id',
3808
- 'shop',
3809
- 'rate',
3810
- 'author',
3811
- 'email',
3812
- 'location',
3813
- 'review',
3814
- 'status',
3815
- 'title',
3816
- 'person_id',
3817
- 'points',
3818
- 'order_id',
3819
- 'created_at',
3820
- 'updated_at',
3821
- ];
3822
- },
3823
- enumerable: false,
3824
- configurable: true
3825
- });
3826
- ProductHasuraGraphQLRepository.prototype.create = function (data) {
3827
- var _super = Object.create(null, {
3828
- create: { get: function () { return _super_1.prototype.create; } }
3829
- });
3830
- return __awaiter(this, void 0, void 0, function () {
3831
- var product, _c, error_1;
3832
- return __generator(this, function (_d) {
3833
- switch (_d.label) {
3834
- case 0: return [4 /*yield*/, _super.create.call(this, lodash.omit(data, ['reviews']))];
3835
- case 1:
3836
- product = _d.sent();
3837
- _d.label = 2;
3838
- case 2:
3839
- _d.trys.push([2, 4, , 6]);
3840
- _c = product;
3841
- return [4 /*yield*/, this.updateReviews(+product.id, data)];
3842
- case 3:
3843
- _c.reviews = _d.sent();
3844
- return [3 /*break*/, 6];
3845
- case 4:
3846
- error_1 = _d.sent();
3847
- return [4 /*yield*/, this.delete({ id: product.id })];
3848
- case 5:
3849
- _d.sent();
3850
- throw error_1;
3851
- case 6: return [2 /*return*/, product];
3852
- }
3853
- });
3854
- });
3855
- };
3856
- ProductHasuraGraphQLRepository.prototype.get = function (identifiers) {
3857
- var _super = Object.create(null, {
3858
- get: { get: function () { return _super_1.prototype.get; } }
3859
- });
3860
- var _a;
3861
- return __awaiter(this, void 0, void 0, function () {
3862
- var product, _c, _d;
3863
- return __generator(this, function (_e) {
3864
- switch (_e.label) {
3865
- case 0:
3866
- if (!Number.isNaN(+identifiers.id)) return [3 /*break*/, 2];
3867
- return [4 /*yield*/, this.find({ filters: { firestoreId: identifiers.id } })];
3868
- case 1:
3869
- _c = (_a = (_e.sent()).data) === null || _a === void 0 ? void 0 : _a[0];
3870
- return [3 /*break*/, 4];
3871
- case 2: return [4 /*yield*/, _super.get.call(this, identifiers)];
3872
- case 3:
3873
- _c = _e.sent();
3874
- _e.label = 4;
3875
- case 4:
3876
- product = _c;
3877
- _d = product;
3878
- return [4 /*yield*/, this.findReviewsByProduct(+product.id)];
3879
- case 5:
3880
- _d.reviews = _e.sent();
3881
- return [2 /*return*/, product];
3882
- }
3883
- });
3884
- });
3885
- };
3886
- ProductHasuraGraphQLRepository.prototype.getBySlug = function (slug, shop) {
3887
- var _a;
3888
- return __awaiter(this, void 0, void 0, function () {
3889
- var result;
3890
- return __generator(this, function (_c) {
3891
- switch (_c.label) {
3892
- case 0: return [4 /*yield*/, this.find({
3893
- filters: {
3894
- slug: { operator: exports.Where.EQUALS, value: slug },
3895
- shopAvailability: { operator: exports.Where.IN, value: [shop] },
3896
- },
3897
- })];
3898
- case 1:
3899
- result = _c.sent();
3900
- return [2 /*return*/, (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.shift()];
3901
- }
3902
- });
3903
- });
3904
- };
3905
- ProductHasuraGraphQLRepository.prototype.update = function (params) {
3906
- var _super = Object.create(null, {
3907
- update: { get: function () { return _super_1.prototype.update; } }
3908
- });
3909
- return __awaiter(this, void 0, void 0, function () {
3910
- var categories, kitProducts, reviews, checkId, data, plainData, id, product, _c, _d, _e, _f, _g, _h;
3911
- return __generator(this, function (_j) {
3912
- switch (_j.label) {
3913
- case 0:
3914
- categories = params.categories, kitProducts = params.kitProducts, reviews = params.reviews, checkId = params.id, data = __rest(params, ["categories", "kitProducts", "reviews", "id"]);
3915
- plainData = this.paramsToPlain({ id: checkId });
3916
- return [4 /*yield*/, this.getId(plainData.id)];
3917
- case 1:
3918
- id = _j.sent();
3919
- return [4 /*yield*/, _super.update.call(this, Object.assign({ id: id }, data))];
3920
- case 2:
3921
- product = _j.sent();
3922
- _c = product;
3923
- _d = categories;
3924
- if (!_d) return [3 /*break*/, 4];
3925
- return [4 /*yield*/, this.updateCategories(+id, { categories: categories })];
3926
- case 3:
3927
- _d = (_j.sent());
3928
- _j.label = 4;
3929
- case 4:
3930
- _c.categories = _d;
3931
- _e = product;
3932
- _f = kitProducts;
3933
- if (!_f) return [3 /*break*/, 6];
3934
- return [4 /*yield*/, this.updateKitProducts(+id, { kitProducts: kitProducts })];
3935
- case 5:
3936
- _f = (_j.sent());
3937
- _j.label = 6;
3938
- case 6:
3939
- _e.kitProducts = _f;
3940
- _g = product;
3941
- _h = reviews;
3942
- if (!_h) return [3 /*break*/, 8];
3943
- return [4 /*yield*/, this.updateReviews(+id, { reviews: reviews })];
3944
- case 7:
3945
- _h = (_j.sent());
3946
- _j.label = 8;
3947
- case 8:
3948
- _g.reviews = _h;
3949
- return [2 /*return*/, product];
3950
- }
3951
- });
3952
- });
3953
- };
3954
- ProductHasuraGraphQLRepository.prototype.fetchReviews = function (status) {
3955
- return __awaiter(this, void 0, void 0, function () {
3956
- var reviews, data;
3957
- var _c, _d;
3958
- var _this = this;
3959
- return __generator(this, function (_e) {
3960
- switch (_e.label) {
3961
- case 0:
3962
- reviews = {
3963
- status: status === 'pending'
3964
- ? (_c = {}, _c[HasuraGraphQLWhere.ISNULL] = true, _c) : (_d = {}, _d[HasuraGraphQLWhere.EQUALS] = status === 'approved', _d),
3965
- };
3966
- return [4 /*yield*/, this.query('product', ['id', 'name', 'sku', { reviews: { columnName: 'reviews', fields: this.reviewsFields } }], {
3967
- where: { value: { reviews: reviews }, type: 'product_bool_exp', required: true },
3968
- })];
3969
- case 1:
3970
- data = (_e.sent()).product;
3971
- return [2 /*return*/, data.reduce(function (reviews, product) { return __spreadArray(__spreadArray([], __read(reviews)), __read(product.reviews
3972
- .filter(function (review) { return (status === 'pending' && [undefined, null].includes(review.status)) ||
3973
- (status === 'approved' && review.status === true) ||
3974
- (status === 'rejected' && review.status === false); })
3975
- .map(function (review) { return (Object.assign(Object.assign({}, _this.bindReviewToModel(review)), { productId: product.id, productName: product.name, productSku: product.sku })); }))); }, [])];
3976
- }
3977
- });
3978
- });
3979
- };
3980
- ProductHasuraGraphQLRepository.prototype.updateCategories = function (productId, _c) {
3981
- var categories = _c.categories;
3982
- return __awaiter(this, void 0, void 0, function () {
3983
- var plainData;
3984
- return __generator(this, function (_c) {
3985
- switch (_c.label) {
3986
- case 0:
3987
- plainData = this.paramsToPlain({ categories: categories });
3988
- return [4 /*yield*/, this.mutation('delete_category_product', ['affected_rows'], {
3989
- where: {
3990
- type: 'category_product_bool_exp',
3991
- required: true,
3992
- value: { product_id: { _eq: productId } },
3993
- },
3994
- })];
3995
- case 1:
3996
- _c.sent();
3997
- return [4 /*yield*/, this.mutation('insert_category_product', ['affected_rows'], {
3998
- objects: {
3999
- type: '[category_product_insert_input!]',
4000
- required: true,
4001
- value: plainData.categories.map(function (categoryId) { return ({ category_id: categoryId, product_id: productId }); }),
4002
- },
4003
- })];
4004
- case 2:
4005
- _c.sent();
4006
- return [2 /*return*/, plainData.categories];
4007
- }
4008
- });
4009
- });
4010
- };
4011
- ProductHasuraGraphQLRepository.prototype.updateKitProducts = function (productId, _c) {
4012
- var kitProducts = _c.kitProducts;
4013
- return __awaiter(this, void 0, void 0, function () {
4014
- var plainData;
4015
- return __generator(this, function (_c) {
4016
- switch (_c.label) {
4017
- case 0:
4018
- plainData = this.paramsToPlain({ kitProducts: kitProducts });
4019
- return [4 /*yield*/, this.mutation('delete_product_kit', ['affected_rows'], {
4020
- where: {
4021
- type: 'product_kit_bool_exp',
4022
- required: true,
4023
- value: { product_id: { _eq: productId } },
4024
- },
4025
- })];
4026
- case 1:
4027
- _c.sent();
4028
- return [4 /*yield*/, this.mutation('insert_product_kit', ['affected_rows'], {
4029
- objects: {
4030
- type: '[product_kit_insert_input!]',
4031
- required: true,
4032
- value: plainData.kitProducts.map(function (kitProduct) { return ({
4033
- kit_product_id: kitProduct.productId || kitProduct.product.id,
4034
- product_id: productId,
4035
- quantity: kitProduct.quantity,
4036
- }); }),
4037
- },
4038
- })];
4039
- case 2:
4040
- _c.sent();
4041
- return [2 /*return*/, plainData.kitProducts];
4042
- }
4043
- });
4044
- });
4045
- };
4046
- ProductHasuraGraphQLRepository.prototype.updateReviews = function (productId, _c) {
4047
- var reviews = _c.reviews;
4048
- return __awaiter(this, void 0, void 0, function () {
4049
- var reviewIds_1, plainData;
4050
- var _this = this;
4051
- return __generator(this, function (_c) {
4052
- switch (_c.label) {
4053
- case 0:
4054
- if (!reviews)
4055
- return [2 /*return*/, []];
4056
- if (!('action' in reviews && reviews.action === 'remove')) return [3 /*break*/, 3];
4057
- return [4 /*yield*/, Promise.all(reviews.value.map(function (reviewData) { return __awaiter(_this, void 0, void 0, function () {
4058
- var review;
4059
- return __generator(this, function (_c) {
4060
- switch (_c.label) {
4061
- case 0: return [4 /*yield*/, this.findReview(reviewData, productId)];
4062
- case 1:
4063
- review = _c.sent();
4064
- return [2 /*return*/, review === null || review === void 0 ? void 0 : review.id];
4065
- }
4066
- });
4067
- }); }))];
4068
- case 1:
4069
- reviewIds_1 = _c.sent();
4070
- return [4 /*yield*/, this.mutation('delete_product_review', ['affected_rows'], {
4071
- where: { value: { id: { _in: reviewIds_1.filter(Boolean) } }, type: 'product_review_bool_exp', required: true },
4072
- })];
4073
- case 2:
4074
- _c.sent();
4075
- return [2 /*return*/, reviews.value.map(function (review, index) { return !reviewIds_1[index] && review; }).filter(Boolean)];
4076
- case 3:
4077
- plainData = this.paramsToPlain({ reviews: reviews });
4078
- return [2 /*return*/, Promise.all(plainData.reviews.map(function (reviewData) { return __awaiter(_this, void 0, void 0, function () {
4079
- var review, _c, _d;
4080
- return __generator(this, function (_e) {
4081
- switch (_e.label) {
4082
- case 0: return [4 /*yield*/, this.findReview(reviewData, productId)];
4083
- case 1:
4084
- review = _e.sent();
4085
- if (!review) return [3 /*break*/, 3];
4086
- _c = this.bindReviewToModel;
4087
- return [4 /*yield*/, this.mutation('update_product_review_by_pk', this.reviewsFields, {
4088
- pk_columns: {
4089
- value: { id: review.id },
4090
- type: 'product_review_pk_columns_input',
4091
- required: true,
4092
- },
4093
- _set: {
4094
- value: lodash.omit(this.bindReviewToHasura(reviewData), ['id', 'product_id']),
4095
- type: 'product_review_set_input',
4096
- required: true,
4097
- },
4098
- })];
4099
- case 2: return [2 /*return*/, _c.apply(this, [(_e.sent()).update_product_review_by_pk])];
4100
- case 3:
4101
- _d = this.bindReviewToModel;
4102
- return [4 /*yield*/, this.mutation('insert_product_review_one', this.reviewsFields, {
4103
- object: {
4104
- value: lodash.omit(Object.assign(Object.assign({}, this.bindReviewToHasura(reviewData)), { product_id: productId }), ['id']),
4105
- type: 'product_review_insert_input',
4106
- required: true,
4107
- },
4108
- })];
4109
- case 4: return [2 /*return*/, _d.apply(this, [(_e.sent()).insert_product_review_one])];
4110
- }
4111
- });
4112
- }); }))];
4113
- }
4114
- });
4115
- });
4116
- };
4117
- ProductHasuraGraphQLRepository.prototype.getId = function (id) {
4118
- var _a, _b;
4119
- return __awaiter(this, void 0, void 0, function () {
4120
- var data;
4121
- return __generator(this, function (_c) {
4122
- switch (_c.label) {
4123
- case 0:
4124
- if (!Number.isNaN(+id))
4125
- return [2 /*return*/, id];
4126
- return [4 /*yield*/, this.find({ filters: { firestoreId: id } })];
4127
- case 1:
4128
- data = (_c.sent()).data;
4129
- if ((_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.id)
4130
- return [2 /*return*/, (_b = data === null || data === void 0 ? void 0 : data[0]) === null || _b === void 0 ? void 0 : _b.id];
4131
- throw new NotFoundError("Product with id " + id + " not found");
4132
- }
4133
- });
4134
- });
4135
- };
4136
- ProductHasuraGraphQLRepository.prototype.findReviewsByProduct = function (productId) {
4137
- return __awaiter(this, void 0, void 0, function () {
4138
- var data;
4139
- var _this = this;
4140
- return __generator(this, function (_c) {
4141
- switch (_c.label) {
4142
- case 0: return [4 /*yield*/, this.query('product_review', this.reviewsFields, {
4143
- where: {
4144
- value: {
4145
- product_id: { _eq: productId },
4146
- },
4147
- type: 'product_review_bool_exp',
4148
- required: true,
4149
- },
4150
- })];
4151
- case 1:
4152
- data = (_c.sent()).product_review;
4153
- return [2 /*return*/, data && data.map(function (review) { return _this.bindReviewToModel(review); })];
4154
- }
4155
- });
4156
- });
4157
- };
4158
- ProductHasuraGraphQLRepository.prototype.findReview = function (review, productId) {
4159
- return __awaiter(this, void 0, void 0, function () {
4160
- var loadedReview;
4161
- return __generator(this, function (_c) {
4162
- switch (_c.label) {
4163
- case 0:
4164
- if (review.id)
4165
- return [2 /*return*/, review];
4166
- if (!review.personId) return [3 /*break*/, 2];
4167
- return [4 /*yield*/, this.getReviewByPersonId(review.personId, productId)];
4168
- case 1:
4169
- loadedReview = _c.sent();
4170
- _c.label = 2;
4171
- case 2:
4172
- if (!(!loadedReview && review.author && review.email)) return [3 /*break*/, 4];
4173
- return [4 /*yield*/, this.getReviewByAuthorAndEmail(review.author, review.email, productId)];
4174
- case 3:
4175
- loadedReview = _c.sent();
4176
- _c.label = 4;
4177
- case 4: return [2 /*return*/, loadedReview || review];
4178
- }
4179
- });
4180
- });
4181
- };
4182
- ProductHasuraGraphQLRepository.prototype.getReviewByPersonId = function (personId, productId) {
4183
- return __awaiter(this, void 0, void 0, function () {
4184
- var data;
4185
- return __generator(this, function (_c) {
4186
- switch (_c.label) {
4187
- case 0: return [4 /*yield*/, this.query('product_review', this.reviewsFields, {
4188
- where: {
4189
- value: {
4190
- product_id: { _eq: productId },
4191
- person_id: { _eq: personId },
4192
- },
4193
- type: "product_review_bool_exp",
4194
- required: true,
4195
- },
4196
- })];
4197
- case 1:
4198
- data = (_c.sent()).product_review;
4199
- return [2 /*return*/, data && data[0] && this.bindReviewToModel(data[0])];
4200
- }
4201
- });
4202
- });
4203
- };
4204
- ProductHasuraGraphQLRepository.prototype.getReviewByAuthorAndEmail = function (author, email, productId) {
4205
- return __awaiter(this, void 0, void 0, function () {
4206
- var data;
4207
- return __generator(this, function (_c) {
4208
- switch (_c.label) {
4209
- case 0: return [4 /*yield*/, this.query('product_review', this.reviewsFields, {
4210
- where: {
4211
- value: {
4212
- product_id: { _eq: productId },
4213
- author: { _eq: author },
4214
- email: { _eq: email },
4215
- },
4216
- type: "product_review_bool_exp",
4217
- required: true,
4218
- },
4219
- })];
4220
- case 1:
4221
- data = (_c.sent()).product_review;
4222
- return [2 /*return*/, data && data[0] && this.bindReviewToModel(data[0])];
4223
- }
4224
- });
4225
- });
4226
- };
4227
- return ProductHasuraGraphQLRepository;
4228
- }(withCrudHasuraGraphQL(withHasuraGraphQL(Base))));
4229
-
4230
- var VariantHasuraGraphQLRepository = /** @class */ (function (_super_1) {
4231
- __extends(VariantHasuraGraphQLRepository, _super_1);
4232
- function VariantHasuraGraphQLRepository(endpoint, authOptions) {
4233
- return _super_1.call(this, {
4234
- tableName: 'product',
4235
- model: VariantHasuraGraphQL,
4236
- endpoint: endpoint,
4237
- authOptions: authOptions,
4238
- fields: [
4239
- { id: { columnName: 'id', to: function (value) { return +value; }, from: function (value) { return value.toString(); } } },
4240
- { firestoreId: { columnName: 'firestore_id' } },
4241
- { productId: { columnName: 'main_product_id', to: function (value) { return +value; }, from: function (value) { return value === null || value === void 0 ? void 0 : value.toString(); } } },
4242
- { EAN: { columnName: 'ean' } },
4243
- { costPrice: { columnName: 'cost_price' } },
4244
- {
4245
- price: {
4246
- columnName: 'price',
4247
- from: function (price, data) { return Object.values(exports.Shops).reduce(function (prices, shop) {
4248
- var _c;
4249
- return (Object.assign(Object.assign({}, prices), (_c = {}, _c[shop] = {
4250
- price: price,
4251
- fullPrice: data.full_price,
4252
- subscriberDiscountPercentage: data.subscriber_discount_percentage,
4253
- subscriberPrice: data.subscriber_price,
4254
- }, _c)));
4255
- }, {}); },
4256
- bindFindFilter: function (sentence) {
4257
- var filters = Object.values(sentence).shift();
4258
- return Object.assign(Object.assign(Object.assign(Object.assign({}, (((filters === null || filters === void 0 ? void 0 : filters.price) || (filters === null || filters === void 0 ? void 0 : filters.price) === 0) && { price: filters.price })), ((filters.fullPrice || filters.fullPrice === 0) && { full_price: filters.fullPrice })), ((filters.subscriberDiscountPercentage || filters.subscriberDiscountPercentage === 0) && {
4259
- subscriber_discount_percentage: filters.subscriberDiscountPercentage,
4260
- })), ((filters.subscriberPrice || filters.subscriberPrice === 0) && {
4261
- subscriber_price: filters.subscriberPrice,
4262
- }));
4263
- },
4264
- bindPersistData: function (value) {
4265
- var priceData = Object.values(value).shift();
4266
- return Object.assign(Object.assign(Object.assign(Object.assign({}, ((priceData === null || priceData === void 0 ? void 0 : priceData.price) >= 0 && { price: priceData.price })), (priceData.fullPrice >= 0 && { full_price: priceData.fullPrice })), (priceData.subscriberDiscountPercentage >= 0 && {
4267
- subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
4268
- })), (priceData.subscriberPrice >= 0 && { subscriber_price: priceData.subscriberPrice }));
4269
- },
4270
- },
4271
- },
4272
- { fullPrice: { columnName: 'full_price' } },
4273
- { subscriberDiscountPercentage: { columnName: 'subscriber_discount_percentage' } },
4274
- { subscriberPrice: { columnName: 'subscriber_price' } },
4275
- 'sku',
4276
- {
4277
- stock: {
4278
- columnName: 'stock',
4279
- from: function (quantity) { return ({ quantity: quantity }); },
4280
- to: function (value) { return (lodash.isNil(value === null || value === void 0 ? void 0 : value.quantity) ? value : value === null || value === void 0 ? void 0 : value.quantity); },
4281
- },
4282
- },
4283
- 'weight',
4284
- { name: { to: function () { return ''; }, from: function () { return undefined; } } },
4285
- { hasVariants: { columnName: 'has_variants', to: function () { return false; }, from: function () { return undefined; } } },
4286
- { createdAt: { columnName: 'created_at' } },
4287
- { updatedAt: { columnName: 'updated_at' } },
4288
- ],
4289
- }) || this;
4290
- }
4291
- VariantHasuraGraphQLRepository.prototype.get = function (identifiers) {
4292
- var _super = Object.create(null, {
4293
- get: { get: function () { return _super_1.prototype.get; } }
4294
- });
4295
- var _a;
4296
- return __awaiter(this, void 0, void 0, function () {
4297
- var _c;
4298
- return __generator(this, function (_d) {
4299
- switch (_d.label) {
4300
- case 0:
4301
- if (!Number.isNaN(+identifiers.id)) return [3 /*break*/, 2];
4302
- return [4 /*yield*/, this.find({ filters: { firestoreId: identifiers.id } })];
4303
- case 1:
4304
- _c = (_a = (_d.sent()).data) === null || _a === void 0 ? void 0 : _a[0];
4305
- return [3 /*break*/, 3];
4306
- case 2:
4307
- _c = _super.get.call(this, identifiers);
4308
- _d.label = 3;
4309
- case 3: return [2 /*return*/, _c];
4310
- }
4311
- });
4312
- });
4313
- };
4314
- VariantHasuraGraphQLRepository.prototype.update = function (params) {
4315
- var _super = Object.create(null, {
4316
- update: { get: function () { return _super_1.prototype.update; } }
4317
- });
4318
- return __awaiter(this, void 0, void 0, function () {
4319
- var productId, checkId, data, dataWithProductId, id, product;
4320
- return __generator(this, function (_c) {
4321
- switch (_c.label) {
4322
- case 0:
4323
- productId = params.productId, checkId = params.id, data = __rest(params, ["productId", "id"]);
4324
- dataWithProductId = this.paramsToPlain({ id: checkId, productId: productId });
4325
- return [4 /*yield*/, this.getId(dataWithProductId.id)];
4326
- case 1:
4327
- id = _c.sent();
4328
- return [4 /*yield*/, _super.update.call(this, Object.assign({ id: id }, data))];
4329
- case 2:
4330
- product = _c.sent();
4331
- product.productId = dataWithProductId.productId;
4332
- return [2 /*return*/, product];
4333
- }
4334
- });
4335
- });
4336
- };
4337
- VariantHasuraGraphQLRepository.prototype.getId = function (id) {
4338
- var _a, _b;
4339
- return __awaiter(this, void 0, void 0, function () {
4340
- var data;
4341
- return __generator(this, function (_c) {
4342
- switch (_c.label) {
4343
- case 0:
4344
- if (!Number.isNaN(+id))
4345
- return [2 /*return*/, id];
4346
- return [4 /*yield*/, this.find({ filters: { firestoreId: id } })];
4347
- case 1:
4348
- data = (_c.sent()).data;
4349
- if ((_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.id)
4350
- return [2 /*return*/, (_b = data === null || data === void 0 ? void 0 : data[0]) === null || _b === void 0 ? void 0 : _b.id];
4351
- throw new NotFoundError("Product with id " + id + " not found");
4352
- }
4353
- });
4354
- });
4355
- };
4356
- return VariantHasuraGraphQLRepository;
4357
- }(withCrudHasuraGraphQL(withHasuraGraphQL(Base))));
4358
-
4359
- /**
4360
- * Generated bundle index. Do not edit.
4361
- */
4362
-
4363
- Object.defineProperty(exports, 'add', {
4364
- enumerable: true,
4365
- get: function () { return dateFns.add; }
4366
- });
4367
- Object.defineProperty(exports, 'addBusinessDays', {
4368
- enumerable: true,
4369
- get: function () { return dateFns.addBusinessDays; }
4370
- });
4371
- Object.defineProperty(exports, 'addDays', {
4372
- enumerable: true,
4373
- get: function () { return dateFns.addDays; }
4374
- });
4375
- Object.defineProperty(exports, 'addMonths', {
4376
- enumerable: true,
4377
- get: function () { return dateFns.addMonths; }
4378
- });
4379
- Object.defineProperty(exports, 'addYears', {
4380
- enumerable: true,
4381
- get: function () { return dateFns.addYears; }
4382
- });
4383
- Object.defineProperty(exports, 'endOfDay', {
4384
- enumerable: true,
4385
- get: function () { return dateFns.endOfDay; }
4386
- });
4387
- Object.defineProperty(exports, 'format', {
4388
- enumerable: true,
4389
- get: function () { return dateFns.format; }
4390
- });
4391
- Object.defineProperty(exports, 'formatISO9075', {
4392
- enumerable: true,
4393
- get: function () { return dateFns.formatISO9075; }
4394
- });
4395
- Object.defineProperty(exports, 'parseISO', {
4396
- enumerable: true,
4397
- get: function () { return dateFns.parseISO; }
4398
- });
4399
- Object.defineProperty(exports, 'startOfDay', {
4400
- enumerable: true,
4401
- get: function () { return dateFns.startOfDay; }
4402
- });
4403
- Object.defineProperty(exports, 'sub', {
4404
- enumerable: true,
4405
- get: function () { return dateFns.sub; }
4406
- });
4407
2498
  Object.defineProperty(exports, 'chunk', {
4408
2499
  enumerable: true,
4409
2500
  get: function () { return lodash.chunk; }
4410
2501
  });
4411
- Object.defineProperty(exports, 'isBoolean', {
4412
- enumerable: true,
4413
- get: function () { return lodash.isBoolean; }
4414
- });
4415
- Object.defineProperty(exports, 'isDate', {
4416
- enumerable: true,
4417
- get: function () { return lodash.isDate; }
4418
- });
4419
2502
  Object.defineProperty(exports, 'isEmpty', {
4420
2503
  enumerable: true,
4421
2504
  get: function () { return lodash.isEmpty; }
4422
2505
  });
4423
- Object.defineProperty(exports, 'isInteger', {
4424
- enumerable: true,
4425
- get: function () { return lodash.isInteger; }
4426
- });
4427
- Object.defineProperty(exports, 'isNaN', {
4428
- enumerable: true,
4429
- get: function () { return lodash.isNaN; }
4430
- });
4431
2506
  Object.defineProperty(exports, 'isNil', {
4432
2507
  enumerable: true,
4433
2508
  get: function () { return lodash.isNil; }
@@ -4444,26 +2519,13 @@
4444
2519
  enumerable: true,
4445
2520
  get: function () { return lodash.isString; }
4446
2521
  });
4447
- Object.defineProperty(exports, 'now', {
4448
- enumerable: true,
4449
- get: function () { return lodash.now; }
4450
- });
4451
- Object.defineProperty(exports, 'omit', {
4452
- enumerable: true,
4453
- get: function () { return lodash.omit; }
4454
- });
4455
2522
  Object.defineProperty(exports, 'pick', {
4456
2523
  enumerable: true,
4457
2524
  get: function () { return lodash.pick; }
4458
2525
  });
4459
- Object.defineProperty(exports, 'set', {
4460
- enumerable: true,
4461
- get: function () { return lodash.set; }
4462
- });
4463
2526
  exports.Address = Address;
4464
2527
  exports.Authentication = Authentication;
4465
2528
  exports.AuthenticationFirebaseAuthService = AuthenticationFirebaseAuthService;
4466
- exports.AxiosAdapter = AxiosAdapter;
4467
2529
  exports.Base = Base;
4468
2530
  exports.BaseModel = BaseModel;
4469
2531
  exports.BeautyProfile = BeautyProfile;
@@ -4472,22 +2534,18 @@
4472
2534
  exports.Buy2WinFirestoreRepository = Buy2WinFirestoreRepository;
4473
2535
  exports.Category = Category;
4474
2536
  exports.CategoryFirestoreRepository = CategoryFirestoreRepository;
4475
- exports.CategoryHasuraGraphQL = CategoryHasuraGraphQL;
4476
- exports.CategoryHasuraGraphQLRepository = CategoryHasuraGraphQLRepository;
4477
2537
  exports.Checkout = Checkout;
4478
2538
  exports.CheckoutFirestoreRepository = CheckoutFirestoreRepository;
4479
2539
  exports.CheckoutSubscription = CheckoutSubscription;
4480
2540
  exports.CheckoutSubscriptionFirestoreRepository = CheckoutSubscriptionFirestoreRepository;
2541
+ exports.ClubCoupon = ClubCoupon;
4481
2542
  exports.Coupon = Coupon;
4482
2543
  exports.CouponFirestoreRepository = CouponFirestoreRepository;
4483
2544
  exports.DuplicatedResultsError = DuplicatedResultsError;
4484
2545
  exports.Edition = Edition;
4485
- exports.FinancialCoupon = FinancialCoupon;
4486
2546
  exports.Home = Home;
4487
2547
  exports.HomeFirestoreRepository = HomeFirestoreRepository;
4488
2548
  exports.InvalidArgumentError = InvalidArgumentError;
4489
- exports.KitProduct = KitProduct;
4490
- exports.KitProductHasuraGraphQL = KitProductHasuraGraphQL;
4491
2549
  exports.Lead = Lead;
4492
2550
  exports.LeadFirestoreRepository = LeadFirestoreRepository;
4493
2551
  exports.LegacyOrderFirestoreRepository = LegacyOrderFirestoreRepository;
@@ -4499,11 +2557,7 @@
4499
2557
  exports.PaymentFirestoreRepository = PaymentFirestoreRepository;
4500
2558
  exports.Product = Product;
4501
2559
  exports.ProductFirestoreRepository = ProductFirestoreRepository;
4502
- exports.ProductHasuraGraphQL = ProductHasuraGraphQL;
4503
- exports.ProductHasuraGraphQLRepository = ProductHasuraGraphQLRepository;
4504
2560
  exports.ProductVariantFirestoreRepository = ProductVariantFirestoreRepository;
4505
- exports.ProductsIndex = ProductsIndex;
4506
- exports.RecoveryPassword = RecoveryPassword;
4507
2561
  exports.Register = Register;
4508
2562
  exports.RegisterFirebaseAuthService = RegisterFirebaseAuthService;
4509
2563
  exports.RequiredArgumentError = RequiredArgumentError;
@@ -4511,6 +2565,7 @@
4511
2565
  exports.ShopMenu = ShopMenu;
4512
2566
  exports.ShopMenuFirestoreRepository = ShopMenuFirestoreRepository;
4513
2567
  exports.SignOut = SignOut;
2568
+ exports.StoreCoupon = StoreCoupon;
4514
2569
  exports.Subscription = Subscription;
4515
2570
  exports.SubscriptionEditionFirestoreRepository = SubscriptionEditionFirestoreRepository;
4516
2571
  exports.SubscriptionFirestoreRepository = SubscriptionFirestoreRepository;
@@ -4530,27 +2585,16 @@
4530
2585
  exports.UserPaymentMethodFirestoreRepository = UserPaymentMethodFirestoreRepository;
4531
2586
  exports.UserSearchFirestoreRepository = UserSearchFirestoreRepository;
4532
2587
  exports.Variant = Variant;
4533
- exports.VariantHasuraGraphQL = VariantHasuraGraphQL;
4534
- exports.VariantHasuraGraphQLRepository = VariantHasuraGraphQLRepository;
4535
2588
  exports.WeakPasswordError = WeakPasswordError;
4536
- exports.isUUID = isUUID;
4537
- exports.parseDateTime = parseDateTime;
4538
2589
  exports.withCreateFirestore = withCreateFirestore;
4539
- exports.withCreateHasuraGraphQL = withCreateHasuraGraphQL;
4540
2590
  exports.withCrudFirestore = withCrudFirestore;
4541
- exports.withCrudHasuraGraphQL = withCrudHasuraGraphQL;
4542
2591
  exports.withDeleteFirestore = withDeleteFirestore;
4543
- exports.withDeleteHasuraGraphQL = withDeleteHasuraGraphQL;
4544
2592
  exports.withFindFirestore = withFindFirestore;
4545
- exports.withFindHasuraGraphQL = withFindHasuraGraphQL;
4546
2593
  exports.withFirestore = withFirestore;
4547
2594
  exports.withGetFirestore = withGetFirestore;
4548
- exports.withGetHasuraGraphQL = withGetHasuraGraphQL;
4549
- exports.withHasuraGraphQL = withHasuraGraphQL;
4550
2595
  exports.withHelpers = withHelpers;
4551
2596
  exports.withSubCollection = withSubCollection;
4552
2597
  exports.withUpdateFirestore = withUpdateFirestore;
4553
- exports.withUpdateHasuraGraphQL = withUpdateHasuraGraphQL;
4554
2598
 
4555
2599
  Object.defineProperty(exports, '__esModule', { value: true });
4556
2600