@infrab4a/connect 1.0.0-beta.28 → 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 -2233
  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 -1465
  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 -94
  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,1608 +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
- return [2 /*return*/, this.fetch(resultQuery)];
3125
- });
3126
- });
3127
- };
3128
- HasuraGraphQLMixin.prototype.fetch = function (params) {
3129
- return __awaiter(this, void 0, void 0, function () {
3130
- var headers, response, result;
3131
- return __generator(this, function (_a) {
3132
- switch (_a.label) {
3133
- case 0:
3134
- headers = this.headers;
3135
- return [4 /*yield*/, fetch__default["default"]("" + this.endpoint, {
3136
- method: 'POST',
3137
- body: JSON.stringify(params),
3138
- headers: headers,
3139
- })];
3140
- case 1:
3141
- response = _a.sent();
3142
- return [4 /*yield*/, response.json()];
3143
- case 2:
3144
- result = _a.sent();
3145
- if (!lodash.isNil(result.errors))
3146
- throw new Error(JSON.stringify(result.errors));
3147
- return [2 /*return*/, result.data];
3148
- }
3149
- });
3150
- });
3151
- };
3152
- HasuraGraphQLMixin.prototype.getAttributeGraphQLTypeOf = function (value) {
3153
- if (isUUID(value))
3154
- return 'uuid';
3155
- if (lodash.isString(value))
3156
- return 'String';
3157
- if (lodash.isBoolean(value))
3158
- return 'Boolean';
3159
- if (value instanceof Date)
3160
- return 'timestamptz';
3161
- if (lodash.isInteger(value))
3162
- return 'Int';
3163
- if (lodash.isNumber(value))
3164
- return 'numeric';
3165
- throw new Error('Type not implemented yet');
3166
- };
3167
- HasuraGraphQLMixin.prototype.checkIfIsDateTimeAndParse = function (value) {
3168
- if (!/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.test(value))
3169
- return value;
3170
- var date = dateFns.parseISO(value);
3171
- if (lodash.isNaN(date.getTime()))
3172
- return value;
3173
- return date;
3174
- };
3175
- HasuraGraphQLMixin.prototype.convertDataFromHasura = function (data) {
3176
- var plain = GraphQLFieldHelper.ConvertFieldValueFrom(data, this.fields);
3177
- return this.model.toInstance(plain);
3178
- };
3179
- HasuraGraphQLMixin.prototype.convertDataToHasura = function (instance, update) {
3180
- if (update === void 0) { update = false; }
3181
- return GraphQLFieldHelper.ConvertFieldValueTo(instance, this.fields, update);
3182
- };
3183
- return HasuraGraphQLMixin;
3184
- }(MixinBase));
3185
- };
3186
-
3187
- var withUpdateHasuraGraphQL = function (MixinBase) {
3188
- var getValueByAction = function (options) {
3189
- if (options instanceof BaseModel)
3190
- return options.toPlain();
3191
- if (lodash.isNil(options === null || options === void 0 ? void 0 : options.action))
3192
- return options;
3193
- if ([exports.UpdateOptionActions.REMOVE_FIELD.toString(), exports.UpdateOptionActions.NULL.toString()].includes(options.action))
3194
- return null;
3195
- return options.value;
3196
- };
3197
- return /** @class */ (function (_super) {
3198
- __extends(UpdateHasuraGraphQLMixin, _super);
3199
- function UpdateHasuraGraphQLMixin() {
3200
- var params = [];
3201
- for (var _i = 0; _i < arguments.length; _i++) {
3202
- params[_i] = arguments[_i];
3203
- }
3204
- var _this = this;
3205
- var options = params === null || params === void 0 ? void 0 : params[0];
3206
- _this = _super.apply(this, __spreadArray([], __read(params))) || this;
3207
- _this.updateGraphQLOperation = (options === null || options === void 0 ? void 0 : options.updateGraphQLOperation) || "update_" + _this.tableName + "_by_pk";
3208
- _this.updateGraphQLObjectType = (options === null || options === void 0 ? void 0 : options.updateGraphQLObjectType) || _this.tableName + "_set_input";
3209
- _this.updateGraphQLPKType = (options === null || options === void 0 ? void 0 : options.updateGraphQLPKType) || _this.tableName + "_pk_columns_input";
3210
- return _this;
3211
- }
3212
- UpdateHasuraGraphQLMixin.prototype.update = function (data) {
3213
- return __awaiter(this, void 0, void 0, function () {
3214
- var plainData;
3215
- var _this = this;
3216
- return __generator(this, function (_b) {
3217
- switch (_b.label) {
3218
- case 0:
3219
- plainData = this.paramsToPlain(data);
3220
- return [4 /*yield*/, this.mutation(this.updateGraphQLOperation, this.model.identifiersFields.map(function (field) { return AttributeOptionHelper.FindByAttribute(field, _this.fields).columnName; }), {
3221
- _set: {
3222
- type: this.updateGraphQLObjectType,
3223
- value: this.convertDataToHasura(this.model.toInstance(plainData), true),
3224
- required: true,
3225
- },
3226
- pk_columns: { type: this.updateGraphQLPKType, value: this.getUpdateModelKeys(plainData), required: true },
3227
- })];
3228
- case 1:
3229
- _b.sent();
3230
- return [2 /*return*/, this.model.toInstance(plainData)];
3231
- }
3232
- });
3233
- });
3234
- };
3235
- UpdateHasuraGraphQLMixin.prototype.paramsToPlain = function (params) {
3236
- var model = this.model;
3237
- if (model.isModel(params))
3238
- return params.toPlain();
3239
- return Object.keys(params).reduce(function (data, currentKey) {
3240
- var _b;
3241
- return (Object.assign(Object.assign({}, data), (params[currentKey] !== undefined && (_b = {}, _b[currentKey] = getValueByAction(params[currentKey]), _b))));
3242
- }, {});
3243
- };
3244
- UpdateHasuraGraphQLMixin.prototype.getUpdateModelKeys = function (data) {
3245
- var _this = this;
3246
- var instance = this.model.toInstance(data);
3247
- return this.model.identifiersFields.reduce(function (ids, identifier) {
3248
- var _b;
3249
- var _a;
3250
- if (lodash.isNil(instance[identifier]))
3251
- return ids;
3252
- var columnOption = AttributeOptionHelper.FindByAttribute(identifier, _this.fields);
3253
- 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];
3254
- return Object.assign(Object.assign({}, ids), (_b = {}, _b[columnOption.columnName] = value, _b));
3255
- }, {});
3256
- };
3257
- return UpdateHasuraGraphQLMixin;
3258
- }(MixinBase));
3259
- };
2494
+ /**
2495
+ * Generated bundle index. Do not edit.
2496
+ */
3260
2497
 
3261
- var withGetHasuraGraphQL = function (MixinBase) {
3262
- return /** @class */ (function (_super) {
3263
- __extends(GetHasuraGraphQLMixin, _super);
3264
- function GetHasuraGraphQLMixin() {
3265
- var params = [];
3266
- for (var _i = 0; _i < arguments.length; _i++) {
3267
- params[_i] = arguments[_i];
3268
- }
3269
- var _this = this;
3270
- var options = params === null || params === void 0 ? void 0 : params[0];
3271
- _this = _super.apply(this, __spreadArray([], __read(params))) || this;
3272
- _this.getGraphQLOperation = (options === null || options === void 0 ? void 0 : options.getGraphQLOperation) || _this.tableName + "_by_pk";
3273
- return _this;
3274
- }
3275
- GetHasuraGraphQLMixin.prototype.get = function (identifiers) {
3276
- return __awaiter(this, void 0, void 0, function () {
3277
- var instance, result, data;
3278
- var _this = this;
3279
- return __generator(this, function (_b) {
3280
- switch (_b.label) {
3281
- case 0:
3282
- instance = this.model.toInstance(identifiers);
3283
- return [4 /*yield*/, this.query(this.getGraphQLOperation, this.fields, this.model.identifiersFields.reduce(function (ids, identifier) {
3284
- var _b;
3285
- var _a;
3286
- if (lodash.isNil(instance[identifier]))
3287
- return ids;
3288
- var columnOption = AttributeOptionHelper.FindByAttribute(identifier, _this.fields);
3289
- 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()];
3290
- return Object.assign(Object.assign({}, ids), (_b = {}, _b[columnOption.columnName] = {
3291
- type: _this.getAttributeGraphQLTypeOf(columnOption.type || value),
3292
- value: value,
3293
- required: true,
3294
- }, _b));
3295
- }, {}))];
3296
- case 1:
3297
- result = _b.sent();
3298
- data = result[this.getGraphQLOperation];
3299
- if (lodash.isNil(data))
3300
- throw new NotFoundError(instance.constructor.name + " not found");
3301
- return [2 /*return*/, this.convertDataFromHasura(result[this.getGraphQLOperation])];
3302
- }
3303
- });
3304
- });
3305
- };
3306
- return GetHasuraGraphQLMixin;
3307
- }(MixinBase));
3308
- };
3309
-
3310
- var HasuraGraphQLWhere;
3311
- (function (HasuraGraphQLWhere) {
3312
- HasuraGraphQLWhere["EQUALS"] = "_eq";
3313
- HasuraGraphQLWhere["GT"] = "_gt";
3314
- HasuraGraphQLWhere["GTE"] = "_gte";
3315
- HasuraGraphQLWhere["IN"] = "_in";
3316
- HasuraGraphQLWhere["NOTIN"] = "_nin";
3317
- HasuraGraphQLWhere["LT"] = "_lt";
3318
- HasuraGraphQLWhere["LTE"] = "_lte";
3319
- HasuraGraphQLWhere["LIKE"] = "_like";
3320
- HasuraGraphQLWhere["NOTLIKE"] = "_nlike";
3321
- HasuraGraphQLWhere["ISNULL"] = "_is_null";
3322
- HasuraGraphQLWhere["ISNOTNULL"] = "_is_null";
3323
- })(HasuraGraphQLWhere || (HasuraGraphQLWhere = {}));
3324
-
3325
- var HasuraGraphQLColumnType;
3326
- (function (HasuraGraphQLColumnType) {
3327
- HasuraGraphQLColumnType["Int"] = "Int";
3328
- HasuraGraphQLColumnType["Float"] = "Float";
3329
- HasuraGraphQLColumnType["Boolean"] = "Boolean";
3330
- HasuraGraphQLColumnType["String"] = "String";
3331
- HasuraGraphQLColumnType["DateTime"] = "timestampz";
3332
- HasuraGraphQLColumnType["Json"] = "json";
3333
- HasuraGraphQLColumnType["Jsonb"] = "jsonb";
3334
- HasuraGraphQLColumnType["Enum"] = "enum";
3335
- HasuraGraphQLColumnType["Uuid"] = "uuid";
3336
- })(HasuraGraphQLColumnType || (HasuraGraphQLColumnType = {}));
3337
-
3338
- var withFindHasuraGraphQL = function (MixinBase) {
3339
- return /** @class */ (function (_super) {
3340
- __extends(FindHasuraGraphQLMixin, _super);
3341
- function FindHasuraGraphQLMixin() {
3342
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
3343
- _this.makeGraphQLWhere = function (filter, fields) { return Object.keys(filter).reduce(function (variables, fieldName) {
3344
- var _b;
3345
- var columnOption = AttributeOptionHelper.FindByAttribute(fieldName, fields);
3346
- if (!columnOption.bindFindFilter)
3347
- return Object.assign(Object.assign({}, variables), (_b = {}, _b[columnOption.columnName] = _this.buildWhereSentence(fieldName, filter[fieldName], fields), _b));
3348
- var builtFilter = columnOption.bindFindFilter(filter[fieldName]);
3349
- return Object.assign(Object.assign({}, variables), Object.keys(builtFilter).reduce(function (variablesList, columnName) {
3350
- var _b;
3351
- return (Object.assign(Object.assign({}, variablesList), (_b = {}, _b[columnName] = _this.buildWhereSentence(fieldName, builtFilter[columnName], fields), _b)));
3352
- }, {}));
3353
- }, {}); };
3354
- _this.buildWhereSentence = function (field, options, fields) {
3355
- var _b;
3356
- var fieldSentenceOptions = AttributeOptionHelper.FindByAttribute(field, fields);
3357
- if (!Array.isArray(options) &&
3358
- lodash.isObject(options) &&
3359
- lodash.isNil(options === null || options === void 0 ? void 0 : options.operator) &&
3360
- lodash.isNil(options === null || options === void 0 ? void 0 : options.value) &&
3361
- lodash.isNil(fieldSentenceOptions === null || fieldSentenceOptions === void 0 ? void 0 : fieldSentenceOptions.to))
3362
- return Object.keys(options).reduce(function (variables, key) {
3363
- var _b;
3364
- var fieldOptions = AttributeOptionHelper.FindByAttribute(key, (fieldSentenceOptions === null || fieldSentenceOptions === void 0 ? void 0 : fieldSentenceOptions.fields) || fields);
3365
- var columnName = fieldOptions.columnName;
3366
- var columnFields = fieldOptions.fields;
3367
- return Object.assign(Object.assign({}, variables), (_b = {}, _b[columnName] = _this.buildWhereSentence(key, options[key], columnFields || []), _b));
3368
- }, {});
3369
- if (!Array.isArray(options) && !lodash.isNil(fieldSentenceOptions.fields))
3370
- return _b = {},
3371
- _b[fieldSentenceOptions.fields[0]] = _this.buildOperatorSentence(options, fieldSentenceOptions),
3372
- _b;
3373
- if (lodash.isObject(options) && !FilterOptionHelper.CheckIfIsFilterOption(options))
3374
- options = Object.values(options)[0];
3375
- return Array.isArray(options)
3376
- ? options.reduce(function (whereSentence, option) { return (Object.assign(Object.assign({}, whereSentence), _this.buildOperatorSentence(option, fieldSentenceOptions))); }, {})
3377
- : _this.buildOperatorSentence(options, fieldSentenceOptions);
3378
- };
3379
- _this.buildOperatorSentence = function (options, fieldOption) {
3380
- var _b;
3381
- return (_b = {},
3382
- _b[_this.getHasuraOperator(options, fieldOption)] = FilterOptionHelper.GetValueFromFilter(options, fieldOption),
3383
- _b);
3384
- };
3385
- _this.getHasuraOperator = function (options, fieldOption) { return FilterOptionHelper.CheckIfIsFilterOption(options)
3386
- ? fieldOption.type === HasuraGraphQLColumnType.Jsonb
3387
- ? _this.getHasuraJsonbOperator(options)
3388
- : 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); }); })]
3389
- : HasuraGraphQLWhere.EQUALS; };
3390
- _this.getHasuraJsonbOperator = function (options) { return options.operator === exports.Where.IN
3391
- ? '_contains'
3392
- : options.operator === exports.Where.LIKE
3393
- ? '_has_keys_any'
3394
- : 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); }); })]; };
3395
- return _this;
3396
- }
3397
- FindHasuraGraphQLMixin.prototype.find = function (options) {
3398
- return __awaiter(this, void 0, void 0, function () {
3399
- var _b, filters, limits, orderBy, variablesCount, variables, result, data, count;
3400
- var _this = this;
3401
- return __generator(this, function (_c) {
3402
- switch (_c.label) {
3403
- case 0:
3404
- _b = options || {}, filters = _b.filters, limits = _b.limits, orderBy = _b.orderBy;
3405
- variablesCount = Object.assign(Object.assign({}, (lodash.isNil(orderBy) ? {} : { order_by: { type: this.tableName + "_order_by!", list: true, value: orderBy } })), (lodash.isNil(filters)
3406
- ? {}
3407
- : {
3408
- where: {
3409
- value: this.makeGraphQLWhere(filters, this.fields),
3410
- type: this.tableName + "_bool_exp",
3411
- required: true,
3412
- },
3413
- }));
3414
- variables = Object.assign(Object.assign({}, (lodash.isNil(limits) ? {} : limits)), variablesCount);
3415
- return [4 /*yield*/, this.query([
3416
- {
3417
- operation: this.tableName,
3418
- fields: options.fields
3419
- ? options.fields
3420
- .map(function (fieldName) {
3421
- var _a;
3422
- 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; });
3423
- })
3424
- .filter(Boolean)
3425
- : this.fields,
3426
- variables: variables,
3427
- },
3428
- {
3429
- operation: this.tableName + "_aggregate",
3430
- fields: [{ aggregate: ['count'] }],
3431
- variables: variablesCount,
3432
- },
3433
- ])];
3434
- case 1:
3435
- result = _c.sent();
3436
- data = result[this.tableName].map(function (row) { return _this.convertDataFromHasura(row); });
3437
- count = result[this.tableName + "_aggregate"].aggregate.count;
3438
- return [2 /*return*/, { count: count, data: data }];
3439
- }
3440
- });
3441
- });
3442
- };
3443
- return FindHasuraGraphQLMixin;
3444
- }(MixinBase));
3445
- };
3446
-
3447
- var withCrudHasuraGraphQL = function (MixinBase) {
3448
- return /** @class */ (function (_super) {
3449
- __extends(CrudHasuraGraphQLMixin, _super);
3450
- function CrudHasuraGraphQLMixin() {
3451
- return _super !== null && _super.apply(this, arguments) || this;
3452
- }
3453
- return CrudHasuraGraphQLMixin;
3454
- }(withUpdateHasuraGraphQL(withGetHasuraGraphQL(withFindHasuraGraphQL(withDeleteHasuraGraphQL(withCreateHasuraGraphQL(MixinBase)))))));
3455
- };
3456
-
3457
- var CategoryHasuraGraphQL = /** @class */ (function (_super) {
3458
- __extends(CategoryHasuraGraphQL, _super);
3459
- function CategoryHasuraGraphQL() {
3460
- return _super !== null && _super.apply(this, arguments) || this;
3461
- }
3462
- return CategoryHasuraGraphQL;
3463
- }(Category));
3464
-
3465
- var ProductHasuraGraphQL = /** @class */ (function (_super) {
3466
- __extends(ProductHasuraGraphQL, _super);
3467
- function ProductHasuraGraphQL() {
3468
- return _super !== null && _super.apply(this, arguments) || this;
3469
- }
3470
- return ProductHasuraGraphQL;
3471
- }(Product));
3472
- __decorate([
3473
- classTransformer.Type(function () { return KitProductHasuraGraphQL; }),
3474
- __metadata("design:type", Array)
3475
- ], ProductHasuraGraphQL.prototype, "kitProducts", void 0);
3476
-
3477
- var KitProductHasuraGraphQL = /** @class */ (function (_super) {
3478
- __extends(KitProductHasuraGraphQL, _super);
3479
- function KitProductHasuraGraphQL() {
3480
- return _super !== null && _super.apply(this, arguments) || this;
3481
- }
3482
- return KitProductHasuraGraphQL;
3483
- }(KitProduct));
3484
- __decorate([
3485
- classTransformer.Type(function () { return ProductHasuraGraphQL; }),
3486
- __metadata("design:type", ProductHasuraGraphQL)
3487
- ], KitProductHasuraGraphQL.prototype, "kit", void 0);
3488
- __decorate([
3489
- classTransformer.Type(function () { return ProductHasuraGraphQL; }),
3490
- __metadata("design:type", ProductHasuraGraphQL)
3491
- ], KitProductHasuraGraphQL.prototype, "product", void 0);
3492
-
3493
- var VariantHasuraGraphQL = /** @class */ (function (_super) {
3494
- __extends(VariantHasuraGraphQL, _super);
3495
- function VariantHasuraGraphQL() {
3496
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
3497
- _this.name = '';
3498
- _this.hasVariants = false;
3499
- return _this;
3500
- }
3501
- return VariantHasuraGraphQL;
3502
- }(Variant));
3503
-
3504
- var CategoryHasuraGraphQLRepository = /** @class */ (function (_super_1) {
3505
- __extends(CategoryHasuraGraphQLRepository, _super_1);
3506
- function CategoryHasuraGraphQLRepository(endpoint, authOptions, productRepository) {
3507
- var _this = _super_1.call(this, {
3508
- tableName: 'category',
3509
- model: Category,
3510
- endpoint: endpoint,
3511
- authOptions: authOptions,
3512
- fields: [
3513
- { id: { columnName: 'id', to: function (value) { return +value; }, from: function (value) { return value.toString(); } } },
3514
- { firestoreId: { columnName: 'firestore_id' } },
3515
- 'name',
3516
- 'description',
3517
- 'image',
3518
- 'published',
3519
- 'shop',
3520
- 'slug',
3521
- { brandCategory: { columnName: 'brand_category' } },
3522
- { brandCategoryBanner: { columnName: 'brand_banner' } },
3523
- { brandCategoryBannerMobile: { columnName: 'brand_banner_mobile' } },
3524
- { brandLogo: { columnName: 'brand_logo' } },
3525
- { brandCondition: { columnName: 'brand_condition' } },
3526
- {
3527
- conditions: {
3528
- columnName: 'tag_condition',
3529
- type: HasuraGraphQLColumnType.Jsonb,
3530
- from: function (tags, row) { return ({ brand: row.brand_condition, tags: Array.isArray(tags) ? tags : [] }); },
3531
- bindPersistData: function (value) {
3532
- var _a, _b;
3533
- return {
3534
- brand_condition: value.brand,
3535
- 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, '","')) || '') + "\"}",
3536
- };
3537
- },
3538
- bindFindFilter: function (sentence) {
3539
- return Object.assign(Object.assign({}, (sentence.brand ? { brand_condition: sentence.brand } : {})), (sentence.tags ? { tag_condition: sentence.tags } : {}));
3540
- },
3541
- },
3542
- },
3543
- 'filters',
3544
- { createdAt: { columnName: 'created_at' } },
3545
- { updatedAt: { columnName: 'updated_at' } },
3546
- {
3547
- products: {
3548
- columnName: 'products',
3549
- fields: ['product_id'],
3550
- from: function (value) { return value.map(function (product) { return product.product_id.toString(); }); },
3551
- to: function (productIds) { return productIds.map(function (productId) { return ({
3552
- product_id: +productId,
3553
- }); }); },
3554
- },
3555
- },
3556
- ],
3557
- }) || this;
3558
- _this.productRepository = productRepository;
3559
- return _this;
3560
- }
3561
- CategoryHasuraGraphQLRepository.prototype.get = function (identifiers) {
3562
- var _super = Object.create(null, {
3563
- get: { get: function () { return _super_1.prototype.get; } }
3564
- });
3565
- var _a;
3566
- return __awaiter(this, void 0, void 0, function () {
3567
- var _c;
3568
- return __generator(this, function (_d) {
3569
- switch (_d.label) {
3570
- case 0:
3571
- if (!Number.isNaN(+identifiers.id)) return [3 /*break*/, 2];
3572
- return [4 /*yield*/, this.find({ filters: { firestoreId: identifiers.id } })];
3573
- case 1:
3574
- _c = (_a = (_d.sent()).data) === null || _a === void 0 ? void 0 : _a[0];
3575
- return [3 /*break*/, 3];
3576
- case 2:
3577
- _c = _super.get.call(this, identifiers);
3578
- _d.label = 3;
3579
- case 3: return [2 /*return*/, _c];
3580
- }
3581
- });
3582
- });
3583
- };
3584
- CategoryHasuraGraphQLRepository.prototype.getCategoryBySlug = function (slug, shop) {
3585
- return __awaiter(this, void 0, void 0, function () {
3586
- var _c, data, count;
3587
- return __generator(this, function (_d) {
3588
- switch (_d.label) {
3589
- case 0:
3590
- if (!slug)
3591
- return [2 /*return*/];
3592
- return [4 /*yield*/, this.find({ filters: { slug: slug, shop: shop, published: true } })];
3593
- case 1:
3594
- _c = _d.sent(), data = _c.data, count = _c.count;
3595
- if (count > 1)
3596
- throw new DuplicatedResultsError('Query returned duplicated values');
3597
- if (!count)
3598
- throw new NotFoundError("Category with slug " + slug + " not found");
3599
- return [2 /*return*/, data.shift()];
3600
- }
3601
- });
3602
- });
3603
- };
3604
- CategoryHasuraGraphQLRepository.prototype.getCategoriesForHome = function (categoryIds, limit) {
3605
- if (limit === void 0) { limit = 4; }
3606
- return __awaiter(this, void 0, void 0, function () {
3607
- var _c, categories, count, homeSections;
3608
- var _this = this;
3609
- return __generator(this, function (_d) {
3610
- switch (_d.label) {
3611
- case 0: return [4 /*yield*/, this.find({
3612
- filters: { firestoreId: { operator: exports.Where.IN, value: categoryIds.filter(Boolean) }, published: true },
3613
- })];
3614
- case 1:
3615
- _c = _d.sent(), categories = _c.data, count = _c.count;
3616
- if (!count)
3617
- throw new NotFoundError('Categories not found');
3618
- return [4 /*yield*/, Promise.all(categories.map(function (category) { return __awaiter(_this, void 0, void 0, function () {
3619
- var _c;
3620
- return __generator(this, function (_d) {
3621
- switch (_d.label) {
3622
- case 0:
3623
- _c = {
3624
- category: category
3625
- };
3626
- return [4 /*yield*/, this.mountCategory(category, { limit: limit, hasStock: true })];
3627
- case 1: return [2 /*return*/, (_c.products = _d.sent(),
3628
- _c)];
3629
- }
3630
- });
3631
- }); }))];
3632
- case 2:
3633
- homeSections = _d.sent();
3634
- return [2 /*return*/, homeSections];
3635
- }
3636
- });
3637
- });
3638
- };
3639
- CategoryHasuraGraphQLRepository.prototype.mountCategory = function (category, options) {
3640
- return __awaiter(this, void 0, void 0, function () {
3641
- var products, publishedField, productsData;
3642
- var _c;
3643
- return __generator(this, function (_d) {
3644
- switch (_d.label) {
3645
- case 0:
3646
- if (!category.products)
3647
- throw new RequiredArgumentError(['Category products is empty']);
3648
- products = [];
3649
- publishedField = category.shop === exports.Shops.GLAMSHOP ? 'publishedGlam' : 'published';
3650
- 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: [
3651
- 'id',
3652
- 'name',
3653
- 'slug',
3654
- 'images',
3655
- 'miniatures',
3656
- 'price',
3657
- 'fullPrice',
3658
- 'subscriberDiscountPercentage',
3659
- 'subscriberPrice',
3660
- 'stock',
3661
- 'published',
3662
- 'publishedGlam',
3663
- 'CEST',
3664
- 'EAN',
3665
- 'NCM',
3666
- 'brand',
3667
- 'costPrice',
3668
- 'hasVariants',
3669
- 'isKit',
3670
- 'shopAvailability',
3671
- 'sku',
3672
- ] }, ((options === null || options === void 0 ? void 0 : options.limit) ? { limits: { limit: options === null || options === void 0 ? void 0 : options.limit } } : {})))];
3673
- case 1:
3674
- productsData = (_d.sent()).data;
3675
- products.push.apply(products, __spreadArray([], __read(productsData)));
3676
- return [2 /*return*/, products];
3677
- }
3678
- });
3679
- });
3680
- };
3681
- return CategoryHasuraGraphQLRepository;
3682
- }(withCrudHasuraGraphQL(withHasuraGraphQL(Base))));
3683
-
3684
- var ProductHasuraGraphQLRepository = /** @class */ (function (_super_1) {
3685
- __extends(ProductHasuraGraphQLRepository, _super_1);
3686
- function ProductHasuraGraphQLRepository(endpoint, authOptions) {
3687
- var _this = _super_1.call(this, {
3688
- tableName: 'product',
3689
- model: ProductHasuraGraphQL,
3690
- endpoint: endpoint,
3691
- authOptions: authOptions,
3692
- fields: [],
3693
- }) || this;
3694
- _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 })); };
3695
- _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 })); };
3696
- var commonFields = [
3697
- { id: { columnName: 'id', to: function (value) { return +value; }, from: function (value) { return value.toString(); } } },
3698
- { firestoreId: { columnName: 'firestore_id' } },
3699
- { CEST: { columnName: 'cest' } },
3700
- { EAN: { columnName: 'ean' } },
3701
- { NCM: { columnName: 'ncm' } },
3702
- 'brand',
3703
- { costPrice: { columnName: 'cost_price' } },
3704
- {
3705
- description: {
3706
- columnName: 'description',
3707
- from: function (description) { return Object.values(exports.Shops).reduce(function (shops, shop) {
3708
- var _c;
3709
- return (Object.assign(Object.assign({}, shops), (_c = {}, _c[shop] = { description: description }, _c)));
3710
- }, {}); },
3711
- to: function (value) { return Object.values(value).shift().description; },
3712
- },
3713
- },
3714
- { hasVariants: { columnName: 'has_variants' } },
3715
- { 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, "\",\"")) || '') + "\"}"; } } },
3716
- { 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, "\",\"")) || '') + "\"}"; } } },
3717
- 'name',
3718
- {
3719
- price: {
3720
- columnName: 'price',
3721
- from: function (price, data) { return Object.values(exports.Shops).reduce(function (prices, shop) {
3722
- var _c;
3723
- return (Object.assign(Object.assign({}, prices), (_c = {}, _c[shop] = {
3724
- price: price,
3725
- fullPrice: data.full_price,
3726
- subscriberDiscountPercentage: data.subscriber_discount_percentage,
3727
- subscriberPrice: data.subscriber_price,
3728
- }, _c)));
3729
- }, {}); },
3730
- bindFindFilter: function (sentence) {
3731
- var filters = Object.values(sentence).shift();
3732
- 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) && {
3733
- subscriber_discount_percentage: filters.subscriberDiscountPercentage,
3734
- })), ((filters.subscriberPrice || filters.subscriberPrice === 0) && {
3735
- subscriber_price: filters.subscriberPrice,
3736
- }));
3737
- },
3738
- bindPersistData: function (value) {
3739
- var priceData = Object.values(value).shift();
3740
- 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 && {
3741
- subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
3742
- })), (priceData.subscriberPrice >= 0 && { subscriber_price: priceData.subscriberPrice }));
3743
- },
3744
- },
3745
- },
3746
- { fullPrice: { columnName: 'full_price' } },
3747
- { subscriberDiscountPercentage: { columnName: 'subscriber_discount_percentage' } },
3748
- { subscriberPrice: { columnName: 'subscriber_price' } },
3749
- 'published',
3750
- { publishedGlam: { columnName: 'published_glam' } },
3751
- 'sku',
3752
- {
3753
- stock: {
3754
- columnName: 'stock',
3755
- from: function (quantity) { return ({ quantity: quantity }); },
3756
- 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); },
3757
- },
3758
- },
3759
- 'slug',
3760
- 'type',
3761
- 'video',
3762
- 'weight',
3763
- {
3764
- shopAvailability: {
3765
- columnName: 'shop_availabilities',
3766
- fields: ['shop'],
3767
- from: function (shop) { return (Array.isArray(shop) ? shop.map(function (row) { return row.shop; }) : []); },
3768
- to: function (shops) { return shops.map(function (shop) { return ({ shop: shop }); }); },
3769
- },
3770
- },
3771
- { tags: { columnName: 'tags', type: HasuraGraphQLColumnType.Jsonb } },
3772
- { isKit: { columnName: 'is_kit' } },
3773
- { createdAt: { columnName: 'created_at' } },
3774
- { updatedAt: { columnName: 'updated_at' } },
3775
- ];
3776
- _this.fields = __spreadArray(__spreadArray([], __read(commonFields)), [
3777
- {
3778
- categories: {
3779
- columnName: 'categories',
3780
- fields: ['category_id'],
3781
- bindPersistData: function (value) { return ({
3782
- categories: { data: value.map(function (category) { return ({ category_id: +category }); }) },
3783
- }); },
3784
- to: function (categories) { return categories.map(function (categoryId) { return +categoryId; }); },
3785
- 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(); })) || []; },
3786
- },
3787
- },
3788
- {
3789
- kitProducts: {
3790
- columnName: 'kit_products',
3791
- foreignKeyColumn: { productId: 'id' },
3792
- fields: [
3793
- { productId: { columnName: 'product_id' } },
3794
- { kitProductId: { columnName: 'kit_product_id' } },
3795
- 'quantity',
3796
- { product: { columnName: 'product', foreignKeyColumn: { id: 'product_id' }, fields: commonFields } },
3797
- ],
3798
- },
3799
- },
3800
- ]);
3801
- return _this;
3802
- }
3803
- Object.defineProperty(ProductHasuraGraphQLRepository.prototype, "reviewsFields", {
3804
- get: function () {
3805
- return [
3806
- 'id',
3807
- 'shop',
3808
- 'rate',
3809
- 'author',
3810
- 'email',
3811
- 'location',
3812
- 'review',
3813
- 'status',
3814
- 'title',
3815
- 'person_id',
3816
- 'points',
3817
- 'order_id',
3818
- 'created_at',
3819
- 'updated_at',
3820
- ];
3821
- },
3822
- enumerable: false,
3823
- configurable: true
3824
- });
3825
- ProductHasuraGraphQLRepository.prototype.create = function (data) {
3826
- var _super = Object.create(null, {
3827
- create: { get: function () { return _super_1.prototype.create; } }
3828
- });
3829
- return __awaiter(this, void 0, void 0, function () {
3830
- var product, _c, error_1;
3831
- return __generator(this, function (_d) {
3832
- switch (_d.label) {
3833
- case 0: return [4 /*yield*/, _super.create.call(this, lodash.omit(data, ['reviews']))];
3834
- case 1:
3835
- product = _d.sent();
3836
- _d.label = 2;
3837
- case 2:
3838
- _d.trys.push([2, 4, , 6]);
3839
- _c = product;
3840
- return [4 /*yield*/, this.updateReviews(+product.id, data)];
3841
- case 3:
3842
- _c.reviews = _d.sent();
3843
- return [3 /*break*/, 6];
3844
- case 4:
3845
- error_1 = _d.sent();
3846
- return [4 /*yield*/, this.delete({ id: product.id })];
3847
- case 5:
3848
- _d.sent();
3849
- throw error_1;
3850
- case 6: return [2 /*return*/, product];
3851
- }
3852
- });
3853
- });
3854
- };
3855
- ProductHasuraGraphQLRepository.prototype.get = function (identifiers) {
3856
- var _super = Object.create(null, {
3857
- get: { get: function () { return _super_1.prototype.get; } }
3858
- });
3859
- var _a;
3860
- return __awaiter(this, void 0, void 0, function () {
3861
- var product, _c, _d;
3862
- return __generator(this, function (_e) {
3863
- switch (_e.label) {
3864
- case 0:
3865
- if (!Number.isNaN(+identifiers.id)) return [3 /*break*/, 2];
3866
- return [4 /*yield*/, this.find({ filters: { firestoreId: identifiers.id } })];
3867
- case 1:
3868
- _c = (_a = (_e.sent()).data) === null || _a === void 0 ? void 0 : _a[0];
3869
- return [3 /*break*/, 4];
3870
- case 2: return [4 /*yield*/, _super.get.call(this, identifiers)];
3871
- case 3:
3872
- _c = _e.sent();
3873
- _e.label = 4;
3874
- case 4:
3875
- product = _c;
3876
- _d = product;
3877
- return [4 /*yield*/, this.findReviewsByProduct(+product.id)];
3878
- case 5:
3879
- _d.reviews = _e.sent();
3880
- return [2 /*return*/, product];
3881
- }
3882
- });
3883
- });
3884
- };
3885
- ProductHasuraGraphQLRepository.prototype.getBySlug = function (slug, shop) {
3886
- var _a;
3887
- return __awaiter(this, void 0, void 0, function () {
3888
- var result;
3889
- return __generator(this, function (_c) {
3890
- switch (_c.label) {
3891
- case 0: return [4 /*yield*/, this.find({
3892
- filters: {
3893
- slug: { operator: exports.Where.EQUALS, value: slug },
3894
- shopAvailability: { operator: exports.Where.IN, value: [shop] },
3895
- },
3896
- })];
3897
- case 1:
3898
- result = _c.sent();
3899
- return [2 /*return*/, (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.shift()];
3900
- }
3901
- });
3902
- });
3903
- };
3904
- ProductHasuraGraphQLRepository.prototype.update = function (params) {
3905
- var _super = Object.create(null, {
3906
- update: { get: function () { return _super_1.prototype.update; } }
3907
- });
3908
- return __awaiter(this, void 0, void 0, function () {
3909
- var categories, kitProducts, reviews, checkId, data, plainData, id, product, _c, _d, _e, _f, _g, _h;
3910
- return __generator(this, function (_j) {
3911
- switch (_j.label) {
3912
- case 0:
3913
- categories = params.categories, kitProducts = params.kitProducts, reviews = params.reviews, checkId = params.id, data = __rest(params, ["categories", "kitProducts", "reviews", "id"]);
3914
- plainData = this.paramsToPlain({ id: checkId });
3915
- return [4 /*yield*/, this.getId(plainData.id)];
3916
- case 1:
3917
- id = _j.sent();
3918
- return [4 /*yield*/, _super.update.call(this, Object.assign({ id: id }, data))];
3919
- case 2:
3920
- product = _j.sent();
3921
- _c = product;
3922
- _d = categories;
3923
- if (!_d) return [3 /*break*/, 4];
3924
- return [4 /*yield*/, this.updateCategories(+id, { categories: categories })];
3925
- case 3:
3926
- _d = (_j.sent());
3927
- _j.label = 4;
3928
- case 4:
3929
- _c.categories = _d;
3930
- _e = product;
3931
- _f = kitProducts;
3932
- if (!_f) return [3 /*break*/, 6];
3933
- return [4 /*yield*/, this.updateKitProducts(+id, { kitProducts: kitProducts })];
3934
- case 5:
3935
- _f = (_j.sent());
3936
- _j.label = 6;
3937
- case 6:
3938
- _e.kitProducts = _f;
3939
- _g = product;
3940
- _h = reviews;
3941
- if (!_h) return [3 /*break*/, 8];
3942
- return [4 /*yield*/, this.updateReviews(+id, { reviews: reviews })];
3943
- case 7:
3944
- _h = (_j.sent());
3945
- _j.label = 8;
3946
- case 8:
3947
- _g.reviews = _h;
3948
- return [2 /*return*/, product];
3949
- }
3950
- });
3951
- });
3952
- };
3953
- ProductHasuraGraphQLRepository.prototype.fetchReviews = function (status) {
3954
- return __awaiter(this, void 0, void 0, function () {
3955
- var reviews, data;
3956
- var _c, _d;
3957
- var _this = this;
3958
- return __generator(this, function (_e) {
3959
- switch (_e.label) {
3960
- case 0:
3961
- reviews = {
3962
- status: status === 'pending'
3963
- ? (_c = {}, _c[HasuraGraphQLWhere.ISNULL] = true, _c) : (_d = {}, _d[HasuraGraphQLWhere.EQUALS] = status === 'approved', _d),
3964
- };
3965
- return [4 /*yield*/, this.query('product', ['id', 'name', 'sku', { reviews: { columnName: 'reviews', fields: this.reviewsFields } }], {
3966
- where: { value: { reviews: reviews }, type: 'product_bool_exp', required: true },
3967
- })];
3968
- case 1:
3969
- data = (_e.sent()).product;
3970
- return [2 /*return*/, data.reduce(function (reviews, product) { return __spreadArray(__spreadArray([], __read(reviews)), __read(product.reviews
3971
- .filter(function (review) { return (status === 'pending' && [undefined, null].includes(review.status)) ||
3972
- (status === 'approved' && review.status === true) ||
3973
- (status === 'rejected' && review.status === false); })
3974
- .map(function (review) { return (Object.assign(Object.assign({}, _this.bindReviewToModel(review)), { productId: product.id, productName: product.name, productSku: product.sku })); }))); }, [])];
3975
- }
3976
- });
3977
- });
3978
- };
3979
- ProductHasuraGraphQLRepository.prototype.updateCategories = function (productId, _c) {
3980
- var categories = _c.categories;
3981
- return __awaiter(this, void 0, void 0, function () {
3982
- var plainData;
3983
- return __generator(this, function (_c) {
3984
- switch (_c.label) {
3985
- case 0:
3986
- plainData = this.paramsToPlain({ categories: categories });
3987
- return [4 /*yield*/, this.mutation('delete_category_product', ['affected_rows'], {
3988
- where: {
3989
- type: 'category_product_bool_exp',
3990
- required: true,
3991
- value: { product_id: { _eq: productId } },
3992
- },
3993
- })];
3994
- case 1:
3995
- _c.sent();
3996
- return [4 /*yield*/, this.mutation('insert_category_product', ['affected_rows'], {
3997
- objects: {
3998
- type: '[category_product_insert_input!]',
3999
- required: true,
4000
- value: plainData.categories.map(function (categoryId) { return ({ category_id: categoryId, product_id: productId }); }),
4001
- },
4002
- })];
4003
- case 2:
4004
- _c.sent();
4005
- return [2 /*return*/, plainData.categories];
4006
- }
4007
- });
4008
- });
4009
- };
4010
- ProductHasuraGraphQLRepository.prototype.updateKitProducts = function (productId, _c) {
4011
- var kitProducts = _c.kitProducts;
4012
- return __awaiter(this, void 0, void 0, function () {
4013
- var plainData;
4014
- return __generator(this, function (_c) {
4015
- switch (_c.label) {
4016
- case 0:
4017
- plainData = this.paramsToPlain({ kitProducts: kitProducts });
4018
- return [4 /*yield*/, this.mutation('delete_product_kit', ['affected_rows'], {
4019
- where: {
4020
- type: 'product_kit_bool_exp',
4021
- required: true,
4022
- value: { product_id: { _eq: productId } },
4023
- },
4024
- })];
4025
- case 1:
4026
- _c.sent();
4027
- return [4 /*yield*/, this.mutation('insert_product_kit', ['affected_rows'], {
4028
- objects: {
4029
- type: '[product_kit_insert_input!]',
4030
- required: true,
4031
- value: plainData.kitProducts.map(function (kitProduct) { return ({
4032
- kit_product_id: kitProduct.productId || kitProduct.product.id,
4033
- product_id: productId,
4034
- quantity: kitProduct.quantity,
4035
- }); }),
4036
- },
4037
- })];
4038
- case 2:
4039
- _c.sent();
4040
- return [2 /*return*/, plainData.kitProducts];
4041
- }
4042
- });
4043
- });
4044
- };
4045
- ProductHasuraGraphQLRepository.prototype.updateReviews = function (productId, _c) {
4046
- var reviews = _c.reviews;
4047
- return __awaiter(this, void 0, void 0, function () {
4048
- var reviewIds_1, plainData;
4049
- var _this = this;
4050
- return __generator(this, function (_c) {
4051
- switch (_c.label) {
4052
- case 0:
4053
- if (!reviews)
4054
- return [2 /*return*/, []];
4055
- if (!('action' in reviews && reviews.action === 'remove')) return [3 /*break*/, 3];
4056
- return [4 /*yield*/, Promise.all(reviews.value.map(function (reviewData) { return __awaiter(_this, void 0, void 0, function () {
4057
- var review;
4058
- return __generator(this, function (_c) {
4059
- switch (_c.label) {
4060
- case 0: return [4 /*yield*/, this.findReview(reviewData, productId)];
4061
- case 1:
4062
- review = _c.sent();
4063
- return [2 /*return*/, review === null || review === void 0 ? void 0 : review.id];
4064
- }
4065
- });
4066
- }); }))];
4067
- case 1:
4068
- reviewIds_1 = _c.sent();
4069
- return [4 /*yield*/, this.mutation('delete_product_review', ['affected_rows'], {
4070
- where: { value: { id: { _in: reviewIds_1.filter(Boolean) } }, type: 'product_review_bool_exp', required: true },
4071
- })];
4072
- case 2:
4073
- _c.sent();
4074
- return [2 /*return*/, reviews.value.map(function (review, index) { return !reviewIds_1[index] && review; }).filter(Boolean)];
4075
- case 3:
4076
- plainData = this.paramsToPlain({ reviews: reviews });
4077
- return [2 /*return*/, Promise.all(plainData.reviews.map(function (reviewData) { return __awaiter(_this, void 0, void 0, function () {
4078
- var review, _c, _d;
4079
- return __generator(this, function (_e) {
4080
- switch (_e.label) {
4081
- case 0: return [4 /*yield*/, this.findReview(reviewData, productId)];
4082
- case 1:
4083
- review = _e.sent();
4084
- if (!review) return [3 /*break*/, 3];
4085
- _c = this.bindReviewToModel;
4086
- return [4 /*yield*/, this.mutation('update_product_review_by_pk', this.reviewsFields, {
4087
- pk_columns: {
4088
- value: { id: review.id },
4089
- type: 'product_review_pk_columns_input',
4090
- required: true,
4091
- },
4092
- _set: {
4093
- value: lodash.omit(this.bindReviewToHasura(reviewData), ['id', 'product_id']),
4094
- type: 'product_review_set_input',
4095
- required: true,
4096
- },
4097
- })];
4098
- case 2: return [2 /*return*/, _c.apply(this, [(_e.sent()).update_product_review_by_pk])];
4099
- case 3:
4100
- _d = this.bindReviewToModel;
4101
- return [4 /*yield*/, this.mutation('insert_product_review_one', this.reviewsFields, {
4102
- object: {
4103
- value: lodash.omit(Object.assign(Object.assign({}, this.bindReviewToHasura(reviewData)), { product_id: productId }), ['id']),
4104
- type: 'product_review_insert_input',
4105
- required: true,
4106
- },
4107
- })];
4108
- case 4: return [2 /*return*/, _d.apply(this, [(_e.sent()).insert_product_review_one])];
4109
- }
4110
- });
4111
- }); }))];
4112
- }
4113
- });
4114
- });
4115
- };
4116
- ProductHasuraGraphQLRepository.prototype.getId = function (id) {
4117
- var _a, _b;
4118
- return __awaiter(this, void 0, void 0, function () {
4119
- var data;
4120
- return __generator(this, function (_c) {
4121
- switch (_c.label) {
4122
- case 0:
4123
- if (!Number.isNaN(+id))
4124
- return [2 /*return*/, id];
4125
- return [4 /*yield*/, this.find({ filters: { firestoreId: id } })];
4126
- case 1:
4127
- data = (_c.sent()).data;
4128
- if ((_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.id)
4129
- return [2 /*return*/, (_b = data === null || data === void 0 ? void 0 : data[0]) === null || _b === void 0 ? void 0 : _b.id];
4130
- throw new NotFoundError("Product with id " + id + " not found");
4131
- }
4132
- });
4133
- });
4134
- };
4135
- ProductHasuraGraphQLRepository.prototype.findReviewsByProduct = function (productId) {
4136
- return __awaiter(this, void 0, void 0, function () {
4137
- var data;
4138
- var _this = this;
4139
- return __generator(this, function (_c) {
4140
- switch (_c.label) {
4141
- case 0: return [4 /*yield*/, this.query('product_review', this.reviewsFields, {
4142
- where: {
4143
- value: {
4144
- product_id: { _eq: productId },
4145
- },
4146
- type: 'product_review_bool_exp',
4147
- required: true,
4148
- },
4149
- })];
4150
- case 1:
4151
- data = (_c.sent()).product_review;
4152
- return [2 /*return*/, data && data.map(function (review) { return _this.bindReviewToModel(review); })];
4153
- }
4154
- });
4155
- });
4156
- };
4157
- ProductHasuraGraphQLRepository.prototype.findReview = function (review, productId) {
4158
- return __awaiter(this, void 0, void 0, function () {
4159
- var loadedReview;
4160
- return __generator(this, function (_c) {
4161
- switch (_c.label) {
4162
- case 0:
4163
- if (review.id)
4164
- return [2 /*return*/, review];
4165
- if (!review.personId) return [3 /*break*/, 2];
4166
- return [4 /*yield*/, this.getReviewByPersonId(review.personId, productId)];
4167
- case 1:
4168
- loadedReview = _c.sent();
4169
- _c.label = 2;
4170
- case 2:
4171
- if (!(!loadedReview && review.author && review.email)) return [3 /*break*/, 4];
4172
- return [4 /*yield*/, this.getReviewByAuthorAndEmail(review.author, review.email, productId)];
4173
- case 3:
4174
- loadedReview = _c.sent();
4175
- _c.label = 4;
4176
- case 4: return [2 /*return*/, loadedReview || review];
4177
- }
4178
- });
4179
- });
4180
- };
4181
- ProductHasuraGraphQLRepository.prototype.getReviewByPersonId = function (personId, productId) {
4182
- return __awaiter(this, void 0, void 0, function () {
4183
- var data;
4184
- return __generator(this, function (_c) {
4185
- switch (_c.label) {
4186
- case 0: return [4 /*yield*/, this.query('product_review', this.reviewsFields, {
4187
- where: {
4188
- value: {
4189
- product_id: { _eq: productId },
4190
- person_id: { _eq: personId },
4191
- },
4192
- type: "product_review_bool_exp",
4193
- required: true,
4194
- },
4195
- })];
4196
- case 1:
4197
- data = (_c.sent()).product_review;
4198
- return [2 /*return*/, data && data[0] && this.bindReviewToModel(data[0])];
4199
- }
4200
- });
4201
- });
4202
- };
4203
- ProductHasuraGraphQLRepository.prototype.getReviewByAuthorAndEmail = function (author, email, productId) {
4204
- return __awaiter(this, void 0, void 0, function () {
4205
- var data;
4206
- return __generator(this, function (_c) {
4207
- switch (_c.label) {
4208
- case 0: return [4 /*yield*/, this.query('product_review', this.reviewsFields, {
4209
- where: {
4210
- value: {
4211
- product_id: { _eq: productId },
4212
- author: { _eq: author },
4213
- email: { _eq: email },
4214
- },
4215
- type: "product_review_bool_exp",
4216
- required: true,
4217
- },
4218
- })];
4219
- case 1:
4220
- data = (_c.sent()).product_review;
4221
- return [2 /*return*/, data && data[0] && this.bindReviewToModel(data[0])];
4222
- }
4223
- });
4224
- });
4225
- };
4226
- return ProductHasuraGraphQLRepository;
4227
- }(withCrudHasuraGraphQL(withHasuraGraphQL(Base))));
4228
-
4229
- var VariantHasuraGraphQLRepository = /** @class */ (function (_super_1) {
4230
- __extends(VariantHasuraGraphQLRepository, _super_1);
4231
- function VariantHasuraGraphQLRepository(endpoint, authOptions) {
4232
- return _super_1.call(this, {
4233
- tableName: 'product',
4234
- model: VariantHasuraGraphQL,
4235
- endpoint: endpoint,
4236
- authOptions: authOptions,
4237
- fields: [
4238
- { id: { columnName: 'id', to: function (value) { return +value; }, from: function (value) { return value.toString(); } } },
4239
- { firestoreId: { columnName: 'firestore_id' } },
4240
- { productId: { columnName: 'main_product_id', to: function (value) { return +value; }, from: function (value) { return value === null || value === void 0 ? void 0 : value.toString(); } } },
4241
- { EAN: { columnName: 'ean' } },
4242
- { costPrice: { columnName: 'cost_price' } },
4243
- {
4244
- price: {
4245
- columnName: 'price',
4246
- from: function (price, data) { return Object.values(exports.Shops).reduce(function (prices, shop) {
4247
- var _c;
4248
- return (Object.assign(Object.assign({}, prices), (_c = {}, _c[shop] = {
4249
- price: price,
4250
- fullPrice: data.full_price,
4251
- subscriberDiscountPercentage: data.subscriber_discount_percentage,
4252
- subscriberPrice: data.subscriber_price,
4253
- }, _c)));
4254
- }, {}); },
4255
- bindFindFilter: function (sentence) {
4256
- var filters = Object.values(sentence).shift();
4257
- 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) && {
4258
- subscriber_discount_percentage: filters.subscriberDiscountPercentage,
4259
- })), ((filters.subscriberPrice || filters.subscriberPrice === 0) && {
4260
- subscriber_price: filters.subscriberPrice,
4261
- }));
4262
- },
4263
- bindPersistData: function (value) {
4264
- var priceData = Object.values(value).shift();
4265
- 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 && {
4266
- subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
4267
- })), (priceData.subscriberPrice >= 0 && { subscriber_price: priceData.subscriberPrice }));
4268
- },
4269
- },
4270
- },
4271
- { fullPrice: { columnName: 'full_price' } },
4272
- { subscriberDiscountPercentage: { columnName: 'subscriber_discount_percentage' } },
4273
- { subscriberPrice: { columnName: 'subscriber_price' } },
4274
- 'sku',
4275
- {
4276
- stock: {
4277
- columnName: 'stock',
4278
- from: function (quantity) { return ({ quantity: quantity }); },
4279
- 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); },
4280
- },
4281
- },
4282
- 'weight',
4283
- { name: { to: function () { return ''; }, from: function () { return undefined; } } },
4284
- { hasVariants: { columnName: 'has_variants', to: function () { return false; }, from: function () { return undefined; } } },
4285
- { createdAt: { columnName: 'created_at' } },
4286
- { updatedAt: { columnName: 'updated_at' } },
4287
- ],
4288
- }) || this;
4289
- }
4290
- VariantHasuraGraphQLRepository.prototype.get = function (identifiers) {
4291
- var _super = Object.create(null, {
4292
- get: { get: function () { return _super_1.prototype.get; } }
4293
- });
4294
- var _a;
4295
- return __awaiter(this, void 0, void 0, function () {
4296
- var _c;
4297
- return __generator(this, function (_d) {
4298
- switch (_d.label) {
4299
- case 0:
4300
- if (!Number.isNaN(+identifiers.id)) return [3 /*break*/, 2];
4301
- return [4 /*yield*/, this.find({ filters: { firestoreId: identifiers.id } })];
4302
- case 1:
4303
- _c = (_a = (_d.sent()).data) === null || _a === void 0 ? void 0 : _a[0];
4304
- return [3 /*break*/, 3];
4305
- case 2:
4306
- _c = _super.get.call(this, identifiers);
4307
- _d.label = 3;
4308
- case 3: return [2 /*return*/, _c];
4309
- }
4310
- });
4311
- });
4312
- };
4313
- VariantHasuraGraphQLRepository.prototype.update = function (params) {
4314
- var _super = Object.create(null, {
4315
- update: { get: function () { return _super_1.prototype.update; } }
4316
- });
4317
- return __awaiter(this, void 0, void 0, function () {
4318
- var productId, checkId, data, dataWithProductId, id, product;
4319
- return __generator(this, function (_c) {
4320
- switch (_c.label) {
4321
- case 0:
4322
- productId = params.productId, checkId = params.id, data = __rest(params, ["productId", "id"]);
4323
- dataWithProductId = this.paramsToPlain({ id: checkId, productId: productId });
4324
- return [4 /*yield*/, this.getId(dataWithProductId.id)];
4325
- case 1:
4326
- id = _c.sent();
4327
- return [4 /*yield*/, _super.update.call(this, Object.assign({ id: id }, data))];
4328
- case 2:
4329
- product = _c.sent();
4330
- product.productId = dataWithProductId.productId;
4331
- return [2 /*return*/, product];
4332
- }
4333
- });
4334
- });
4335
- };
4336
- VariantHasuraGraphQLRepository.prototype.getId = function (id) {
4337
- var _a, _b;
4338
- return __awaiter(this, void 0, void 0, function () {
4339
- var data;
4340
- return __generator(this, function (_c) {
4341
- switch (_c.label) {
4342
- case 0:
4343
- if (!Number.isNaN(+id))
4344
- return [2 /*return*/, id];
4345
- return [4 /*yield*/, this.find({ filters: { firestoreId: id } })];
4346
- case 1:
4347
- data = (_c.sent()).data;
4348
- if ((_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.id)
4349
- return [2 /*return*/, (_b = data === null || data === void 0 ? void 0 : data[0]) === null || _b === void 0 ? void 0 : _b.id];
4350
- throw new NotFoundError("Product with id " + id + " not found");
4351
- }
4352
- });
4353
- });
4354
- };
4355
- return VariantHasuraGraphQLRepository;
4356
- }(withCrudHasuraGraphQL(withHasuraGraphQL(Base))));
4357
-
4358
- /**
4359
- * Generated bundle index. Do not edit.
4360
- */
4361
-
4362
- Object.defineProperty(exports, 'add', {
4363
- enumerable: true,
4364
- get: function () { return dateFns.add; }
4365
- });
4366
- Object.defineProperty(exports, 'addBusinessDays', {
4367
- enumerable: true,
4368
- get: function () { return dateFns.addBusinessDays; }
4369
- });
4370
- Object.defineProperty(exports, 'addDays', {
4371
- enumerable: true,
4372
- get: function () { return dateFns.addDays; }
4373
- });
4374
- Object.defineProperty(exports, 'addMonths', {
4375
- enumerable: true,
4376
- get: function () { return dateFns.addMonths; }
4377
- });
4378
- Object.defineProperty(exports, 'addYears', {
4379
- enumerable: true,
4380
- get: function () { return dateFns.addYears; }
4381
- });
4382
- Object.defineProperty(exports, 'endOfDay', {
4383
- enumerable: true,
4384
- get: function () { return dateFns.endOfDay; }
4385
- });
4386
- Object.defineProperty(exports, 'format', {
4387
- enumerable: true,
4388
- get: function () { return dateFns.format; }
4389
- });
4390
- Object.defineProperty(exports, 'formatISO9075', {
4391
- enumerable: true,
4392
- get: function () { return dateFns.formatISO9075; }
4393
- });
4394
- Object.defineProperty(exports, 'parseISO', {
4395
- enumerable: true,
4396
- get: function () { return dateFns.parseISO; }
4397
- });
4398
- Object.defineProperty(exports, 'startOfDay', {
4399
- enumerable: true,
4400
- get: function () { return dateFns.startOfDay; }
4401
- });
4402
- Object.defineProperty(exports, 'sub', {
4403
- enumerable: true,
4404
- get: function () { return dateFns.sub; }
4405
- });
4406
2498
  Object.defineProperty(exports, 'chunk', {
4407
2499
  enumerable: true,
4408
2500
  get: function () { return lodash.chunk; }
4409
2501
  });
4410
- Object.defineProperty(exports, 'isBoolean', {
4411
- enumerable: true,
4412
- get: function () { return lodash.isBoolean; }
4413
- });
4414
- Object.defineProperty(exports, 'isDate', {
4415
- enumerable: true,
4416
- get: function () { return lodash.isDate; }
4417
- });
4418
2502
  Object.defineProperty(exports, 'isEmpty', {
4419
2503
  enumerable: true,
4420
2504
  get: function () { return lodash.isEmpty; }
4421
2505
  });
4422
- Object.defineProperty(exports, 'isInteger', {
4423
- enumerable: true,
4424
- get: function () { return lodash.isInteger; }
4425
- });
4426
- Object.defineProperty(exports, 'isNaN', {
4427
- enumerable: true,
4428
- get: function () { return lodash.isNaN; }
4429
- });
4430
2506
  Object.defineProperty(exports, 'isNil', {
4431
2507
  enumerable: true,
4432
2508
  get: function () { return lodash.isNil; }
@@ -4443,26 +2519,13 @@
4443
2519
  enumerable: true,
4444
2520
  get: function () { return lodash.isString; }
4445
2521
  });
4446
- Object.defineProperty(exports, 'now', {
4447
- enumerable: true,
4448
- get: function () { return lodash.now; }
4449
- });
4450
- Object.defineProperty(exports, 'omit', {
4451
- enumerable: true,
4452
- get: function () { return lodash.omit; }
4453
- });
4454
2522
  Object.defineProperty(exports, 'pick', {
4455
2523
  enumerable: true,
4456
2524
  get: function () { return lodash.pick; }
4457
2525
  });
4458
- Object.defineProperty(exports, 'set', {
4459
- enumerable: true,
4460
- get: function () { return lodash.set; }
4461
- });
4462
2526
  exports.Address = Address;
4463
2527
  exports.Authentication = Authentication;
4464
2528
  exports.AuthenticationFirebaseAuthService = AuthenticationFirebaseAuthService;
4465
- exports.AxiosAdapter = AxiosAdapter;
4466
2529
  exports.Base = Base;
4467
2530
  exports.BaseModel = BaseModel;
4468
2531
  exports.BeautyProfile = BeautyProfile;
@@ -4471,22 +2534,18 @@
4471
2534
  exports.Buy2WinFirestoreRepository = Buy2WinFirestoreRepository;
4472
2535
  exports.Category = Category;
4473
2536
  exports.CategoryFirestoreRepository = CategoryFirestoreRepository;
4474
- exports.CategoryHasuraGraphQL = CategoryHasuraGraphQL;
4475
- exports.CategoryHasuraGraphQLRepository = CategoryHasuraGraphQLRepository;
4476
2537
  exports.Checkout = Checkout;
4477
2538
  exports.CheckoutFirestoreRepository = CheckoutFirestoreRepository;
4478
2539
  exports.CheckoutSubscription = CheckoutSubscription;
4479
2540
  exports.CheckoutSubscriptionFirestoreRepository = CheckoutSubscriptionFirestoreRepository;
2541
+ exports.ClubCoupon = ClubCoupon;
4480
2542
  exports.Coupon = Coupon;
4481
2543
  exports.CouponFirestoreRepository = CouponFirestoreRepository;
4482
2544
  exports.DuplicatedResultsError = DuplicatedResultsError;
4483
2545
  exports.Edition = Edition;
4484
- exports.FinancialCoupon = FinancialCoupon;
4485
2546
  exports.Home = Home;
4486
2547
  exports.HomeFirestoreRepository = HomeFirestoreRepository;
4487
2548
  exports.InvalidArgumentError = InvalidArgumentError;
4488
- exports.KitProduct = KitProduct;
4489
- exports.KitProductHasuraGraphQL = KitProductHasuraGraphQL;
4490
2549
  exports.Lead = Lead;
4491
2550
  exports.LeadFirestoreRepository = LeadFirestoreRepository;
4492
2551
  exports.LegacyOrderFirestoreRepository = LegacyOrderFirestoreRepository;
@@ -4498,11 +2557,7 @@
4498
2557
  exports.PaymentFirestoreRepository = PaymentFirestoreRepository;
4499
2558
  exports.Product = Product;
4500
2559
  exports.ProductFirestoreRepository = ProductFirestoreRepository;
4501
- exports.ProductHasuraGraphQL = ProductHasuraGraphQL;
4502
- exports.ProductHasuraGraphQLRepository = ProductHasuraGraphQLRepository;
4503
2560
  exports.ProductVariantFirestoreRepository = ProductVariantFirestoreRepository;
4504
- exports.ProductsIndex = ProductsIndex;
4505
- exports.RecoveryPassword = RecoveryPassword;
4506
2561
  exports.Register = Register;
4507
2562
  exports.RegisterFirebaseAuthService = RegisterFirebaseAuthService;
4508
2563
  exports.RequiredArgumentError = RequiredArgumentError;
@@ -4510,6 +2565,7 @@
4510
2565
  exports.ShopMenu = ShopMenu;
4511
2566
  exports.ShopMenuFirestoreRepository = ShopMenuFirestoreRepository;
4512
2567
  exports.SignOut = SignOut;
2568
+ exports.StoreCoupon = StoreCoupon;
4513
2569
  exports.Subscription = Subscription;
4514
2570
  exports.SubscriptionEditionFirestoreRepository = SubscriptionEditionFirestoreRepository;
4515
2571
  exports.SubscriptionFirestoreRepository = SubscriptionFirestoreRepository;
@@ -4529,27 +2585,16 @@
4529
2585
  exports.UserPaymentMethodFirestoreRepository = UserPaymentMethodFirestoreRepository;
4530
2586
  exports.UserSearchFirestoreRepository = UserSearchFirestoreRepository;
4531
2587
  exports.Variant = Variant;
4532
- exports.VariantHasuraGraphQL = VariantHasuraGraphQL;
4533
- exports.VariantHasuraGraphQLRepository = VariantHasuraGraphQLRepository;
4534
2588
  exports.WeakPasswordError = WeakPasswordError;
4535
- exports.isUUID = isUUID;
4536
- exports.parseDateTime = parseDateTime;
4537
2589
  exports.withCreateFirestore = withCreateFirestore;
4538
- exports.withCreateHasuraGraphQL = withCreateHasuraGraphQL;
4539
2590
  exports.withCrudFirestore = withCrudFirestore;
4540
- exports.withCrudHasuraGraphQL = withCrudHasuraGraphQL;
4541
2591
  exports.withDeleteFirestore = withDeleteFirestore;
4542
- exports.withDeleteHasuraGraphQL = withDeleteHasuraGraphQL;
4543
2592
  exports.withFindFirestore = withFindFirestore;
4544
- exports.withFindHasuraGraphQL = withFindHasuraGraphQL;
4545
2593
  exports.withFirestore = withFirestore;
4546
2594
  exports.withGetFirestore = withGetFirestore;
4547
- exports.withGetHasuraGraphQL = withGetHasuraGraphQL;
4548
- exports.withHasuraGraphQL = withHasuraGraphQL;
4549
2595
  exports.withHelpers = withHelpers;
4550
2596
  exports.withSubCollection = withSubCollection;
4551
2597
  exports.withUpdateFirestore = withUpdateFirestore;
4552
- exports.withUpdateHasuraGraphQL = withUpdateHasuraGraphQL;
4553
2598
 
4554
2599
  Object.defineProperty(exports, '__esModule', { value: true });
4555
2600