@infrab4a/connect 3.3.0-beta.0 → 3.3.0-beta.2

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 (674) hide show
  1. package/README.md +24 -24
  2. package/domain/catalog/index.d.ts +2 -2
  3. package/domain/catalog/models/category.d.ts +24 -24
  4. package/domain/catalog/models/enums/index.d.ts +2 -2
  5. package/domain/catalog/models/enums/product-genders.enum.d.ts +5 -5
  6. package/domain/catalog/models/enums/shops.enum.d.ts +6 -6
  7. package/domain/catalog/models/index.d.ts +6 -6
  8. package/domain/catalog/models/kit-product.d.ts +12 -12
  9. package/domain/catalog/models/product.d.ts +39 -39
  10. package/domain/catalog/models/types/category-condition.type.d.ts +4 -4
  11. package/domain/catalog/models/types/category-filter.type.d.ts +4 -4
  12. package/domain/catalog/models/types/category-metadata.type.d.ts +4 -4
  13. package/domain/catalog/models/types/index.d.ts +10 -10
  14. package/domain/catalog/models/types/product-gender.type.d.ts +1 -1
  15. package/domain/catalog/models/types/product-metadata.type.d.ts +4 -4
  16. package/domain/catalog/models/types/product-review.type.d.ts +17 -17
  17. package/domain/catalog/models/types/shop-description.type.d.ts +7 -7
  18. package/domain/catalog/models/types/shop-price.type.d.ts +6 -6
  19. package/domain/catalog/models/types/stock.type.d.ts +3 -3
  20. package/domain/catalog/models/types/variant-grade.type.d.ts +4 -4
  21. package/domain/catalog/models/variant.d.ts +18 -18
  22. package/domain/catalog/repositories/category.repository.d.ts +15 -15
  23. package/domain/catalog/repositories/index.d.ts +4 -4
  24. package/domain/catalog/repositories/product.repository.d.ts +12 -12
  25. package/domain/catalog/repositories/subscription-product.repository.d.ts +4 -4
  26. package/domain/catalog/repositories/variant.repository.d.ts +4 -4
  27. package/domain/generic/index.d.ts +2 -2
  28. package/domain/generic/model/base.model.d.ts +10 -10
  29. package/domain/generic/model/identifier-fields.d.ts +4 -4
  30. package/domain/generic/model/index.d.ts +3 -3
  31. package/domain/generic/model/types/base-model-builder.type.d.ts +15 -15
  32. package/domain/generic/model/types/identifier-model.type.d.ts +7 -7
  33. package/domain/generic/model/types/index.d.ts +5 -5
  34. package/domain/generic/model/types/model-base-structure.type.d.ts +6 -6
  35. package/domain/generic/model/types/non-function-properties.type.d.ts +12 -12
  36. package/domain/generic/model/types/non-function-property-name.type.d.ts +4 -4
  37. package/domain/generic/repository/create.repository.d.ts +8 -8
  38. package/domain/generic/repository/crud.repository.d.ts +19 -19
  39. package/domain/generic/repository/delete.repository.d.ts +7 -7
  40. package/domain/generic/repository/enums/index.d.ts +2 -2
  41. package/domain/generic/repository/enums/update-option-actions.enum.d.ts +7 -7
  42. package/domain/generic/repository/enums/where.enum.d.ts +14 -14
  43. package/domain/generic/repository/find.repository.d.ts +11 -11
  44. package/domain/generic/repository/get.repository.d.ts +5 -5
  45. package/domain/generic/repository/index.d.ts +9 -9
  46. package/domain/generic/repository/read.repository.d.ts +14 -14
  47. package/domain/generic/repository/types/index.d.ts +6 -6
  48. package/domain/generic/repository/types/repository-find-filters.type.d.ts +13 -13
  49. package/domain/generic/repository/types/repository-find-result.type.d.ts +4 -4
  50. package/domain/generic/repository/types/repository-limit-options.type.d.ts +4 -4
  51. package/domain/generic/repository/types/repository-order-by-list.type.d.ts +5 -5
  52. package/domain/generic/repository/types/repository-update-params.type.d.ts +11 -11
  53. package/domain/generic/repository/types/where-options.type.d.ts +2 -2
  54. package/domain/generic/repository/update.repository.d.ts +6 -6
  55. package/domain/index.d.ts +6 -6
  56. package/domain/location/index.d.ts +1 -1
  57. package/domain/location/models/address.d.ts +22 -22
  58. package/domain/location/models/index.d.ts +2 -2
  59. package/domain/location/models/types/index.d.ts +3 -3
  60. package/domain/location/models/types/location-bound.type.d.ts +6 -6
  61. package/domain/location/models/types/location-geometry.type.d.ts +7 -7
  62. package/domain/location/models/types/location-lat-lng.type.d.ts +4 -4
  63. package/domain/shop-settings/enums/filter-type.enum.d.ts +19 -19
  64. package/domain/shop-settings/enums/index.d.ts +2 -2
  65. package/domain/shop-settings/enums/questions-filters.enum.d.ts +19 -19
  66. package/domain/shop-settings/helpers/beauty-questions.helper.d.ts +9 -9
  67. package/domain/shop-settings/helpers/index.d.ts +1 -1
  68. package/domain/shop-settings/index.d.ts +4 -4
  69. package/domain/shop-settings/models/home.d.ts +18 -18
  70. package/domain/shop-settings/models/index.d.ts +3 -4
  71. package/domain/shop-settings/models/shop-menu.d.ts +7 -7
  72. package/domain/shop-settings/models/types/banner.type.d.ts +6 -6
  73. package/domain/shop-settings/models/types/benefit.type.d.ts +5 -5
  74. package/domain/shop-settings/models/types/home-data.type.d.ts +15 -15
  75. package/domain/shop-settings/models/types/index.d.ts +5 -10
  76. package/domain/shop-settings/models/types/menu-nav.type.d.ts +8 -8
  77. package/domain/shop-settings/models/types/sub-menu.type.d.ts +8 -8
  78. package/domain/shop-settings/repositories/home.repository.d.ts +4 -4
  79. package/domain/shop-settings/repositories/index.d.ts +2 -3
  80. package/domain/shop-settings/repositories/shop-menu.repository.d.ts +4 -4
  81. package/domain/shopping/index.d.ts +2 -2
  82. package/domain/shopping/models/buy-2-win.d.ts +16 -16
  83. package/domain/shopping/models/checkout.d.ts +27 -27
  84. package/domain/shopping/models/coupons/coupon.d.ts +32 -32
  85. package/domain/shopping/models/coupons/enums/coupon-club-mens.enum.d.ts +5 -5
  86. package/domain/shopping/models/coupons/enums/coupon-subtypes.enum.d.ts +4 -4
  87. package/domain/shopping/models/coupons/enums/coupon-types.enum.d.ts +4 -4
  88. package/domain/shopping/models/coupons/enums/exclusivities.enum.d.ts +8 -8
  89. package/domain/shopping/models/coupons/enums/index.d.ts +3 -3
  90. package/domain/shopping/models/coupons/index.d.ts +2 -2
  91. package/domain/shopping/models/enums/checkout-types.enum.d.ts +5 -5
  92. package/domain/shopping/models/enums/index.d.ts +2 -2
  93. package/domain/shopping/models/enums/order-status.enum.d.ts +10 -10
  94. package/domain/shopping/models/index.d.ts +11 -11
  95. package/domain/shopping/models/line-item.d.ts +8 -8
  96. package/domain/shopping/models/order.d.ts +9 -9
  97. package/domain/shopping/models/payment.d.ts +67 -67
  98. package/domain/shopping/models/shipping-method.d.ts +16 -16
  99. package/domain/shopping/models/subscription/checkout.d.ts +21 -21
  100. package/domain/shopping/models/subscription/index.d.ts +2 -2
  101. package/domain/shopping/models/subscription/plan.d.ts +10 -10
  102. package/domain/shopping/models/types/index.d.ts +7 -7
  103. package/domain/shopping/models/types/payment-address.type.d.ts +12 -12
  104. package/domain/shopping/models/types/payment-billing.type.d.ts +7 -7
  105. package/domain/shopping/models/types/payment-card.type.d.ts +14 -14
  106. package/domain/shopping/models/types/payment-customer.type.d.ts +18 -18
  107. package/domain/shopping/models/types/payment-document.type.d.ts +6 -6
  108. package/domain/shopping/models/types/payment-item.type.d.ts +11 -11
  109. package/domain/shopping/models/types/payment-shipping.type.d.ts +10 -10
  110. package/domain/shopping/repositories/buy-2-win.repository.d.ts +4 -4
  111. package/domain/shopping/repositories/checkout.repository.d.ts +4 -4
  112. package/domain/shopping/repositories/coupon.repository.d.ts +4 -4
  113. package/domain/shopping/repositories/index.d.ts +7 -7
  114. package/domain/shopping/repositories/legacy-order.repository.d.ts +3 -3
  115. package/domain/shopping/repositories/order.repository.d.ts +4 -4
  116. package/domain/shopping/repositories/payment.repository.d.ts +4 -4
  117. package/domain/shopping/repositories/subscription/checkout.repository.d.ts +4 -4
  118. package/domain/shopping/repositories/subscription/index.d.ts +2 -2
  119. package/domain/shopping/repositories/subscription/plan.repository.d.ts +4 -4
  120. package/domain/users/errors/index.d.ts +3 -3
  121. package/domain/users/errors/unauthorized.error.d.ts +5 -5
  122. package/domain/users/errors/user-already-registered.error.d.ts +5 -5
  123. package/domain/users/errors/weak-password.error.d.ts +5 -5
  124. package/domain/users/index.d.ts +5 -5
  125. package/domain/users/models/beauty-profile.d.ts +11 -11
  126. package/domain/users/models/enums/accessory-importances.enum.d.ts +5 -5
  127. package/domain/users/models/enums/area.enum.d.ts +11 -11
  128. package/domain/users/models/enums/beard-problems.enum.d.ts +9 -9
  129. package/domain/users/models/enums/beard-sizes.enum.d.ts +7 -7
  130. package/domain/users/models/enums/beauty-product-importances.enum.d.ts +6 -6
  131. package/domain/users/models/enums/body-problems.enum.d.ts +11 -11
  132. package/domain/users/models/enums/body-shapes.enum.d.ts +7 -7
  133. package/domain/users/models/enums/body-tattoos.enum.d.ts +5 -5
  134. package/domain/users/models/enums/face-skin-oilinesses.enum.d.ts +7 -7
  135. package/domain/users/models/enums/face-skin-problems.enum.d.ts +10 -10
  136. package/domain/users/models/enums/face-skin-tones.enum.d.ts +8 -8
  137. package/domain/users/models/enums/family-incomes.enum.d.ts +8 -8
  138. package/domain/users/models/enums/fragrance-importances.enum.d.ts +5 -5
  139. package/domain/users/models/enums/hair-colors.enum.d.ts +10 -10
  140. package/domain/users/models/enums/hair-problems.enum.d.ts +10 -10
  141. package/domain/users/models/enums/hair-strands.enum.d.ts +8 -8
  142. package/domain/users/models/enums/hair-types.enum.d.ts +7 -7
  143. package/domain/users/models/enums/index.d.ts +20 -20
  144. package/domain/users/models/enums/office-position.enum.d.ts +6 -6
  145. package/domain/users/models/enums/product-spents.enum.d.ts +8 -8
  146. package/domain/users/models/enums/user-type.enum.d.ts +8 -8
  147. package/domain/users/models/index.d.ts +7 -7
  148. package/domain/users/models/lead.d.ts +7 -7
  149. package/domain/users/models/subscription/edition.d.ts +16 -16
  150. package/domain/users/models/subscription/enums/billing-status.enum.d.ts +3 -3
  151. package/domain/users/models/subscription/enums/edition-status.enum.d.ts +4 -4
  152. package/domain/users/models/subscription/enums/index.d.ts +4 -4
  153. package/domain/users/models/subscription/enums/payment-type.enum.d.ts +5 -5
  154. package/domain/users/models/subscription/enums/status.enum.d.ts +4 -4
  155. package/domain/users/models/subscription/index.d.ts +4 -4
  156. package/domain/users/models/subscription/payment.d.ts +13 -13
  157. package/domain/users/models/subscription/subscription.d.ts +28 -28
  158. package/domain/users/models/user-address.d.ts +7 -7
  159. package/domain/users/models/user-payment-method.d.ts +14 -14
  160. package/domain/users/models/user.d.ts +28 -28
  161. package/domain/users/repositories/beauty-profile.repository.d.ts +4 -4
  162. package/domain/users/repositories/edition.repository.d.ts +4 -4
  163. package/domain/users/repositories/index.d.ts +8 -8
  164. package/domain/users/repositories/lead.repository.d.ts +4 -4
  165. package/domain/users/repositories/subscription-payment.repository.d.ts +4 -4
  166. package/domain/users/repositories/subscription.repository.d.ts +4 -4
  167. package/domain/users/repositories/user-address.repository.d.ts +4 -4
  168. package/domain/users/repositories/user-payment-method.repository.d.ts +4 -4
  169. package/domain/users/repositories/user.repository.d.ts +6 -6
  170. package/domain/users/services/authentication.service.d.ts +12 -12
  171. package/domain/users/services/index.d.ts +3 -3
  172. package/domain/users/services/register.service.d.ts +7 -7
  173. package/domain/users/services/types/basic-user-data.type.d.ts +4 -4
  174. package/domain/users/services/types/index.d.ts +1 -1
  175. package/domain/users/use-cases/authentication.d.ts +21 -21
  176. package/domain/users/use-cases/index.d.ts +4 -4
  177. package/domain/users/use-cases/recovery-password.d.ts +6 -6
  178. package/domain/users/use-cases/register.d.ts +13 -13
  179. package/domain/users/use-cases/signout.d.ts +6 -6
  180. package/errors/duplicated-results.error.d.ts +5 -5
  181. package/errors/index.d.ts +4 -4
  182. package/errors/invalid-argument.error.d.ts +5 -5
  183. package/errors/not-found.error.d.ts +5 -5
  184. package/errors/required-argument.error.d.ts +6 -6
  185. package/{esm2015/domain/catalog/index.js → esm2020/domain/catalog/index.mjs} +3 -3
  186. package/esm2020/domain/catalog/models/category.mjs +10 -0
  187. package/{esm2015/domain/catalog/models/enums/index.js → esm2020/domain/catalog/models/enums/index.mjs} +3 -3
  188. package/{esm2015/domain/catalog/models/enums/product-genders.enum.js → esm2020/domain/catalog/models/enums/product-genders.enum.mjs} +7 -7
  189. package/{esm2015/domain/catalog/models/enums/shops.enum.js → esm2020/domain/catalog/models/enums/shops.enum.mjs} +8 -8
  190. package/{esm2015/domain/catalog/models/index.js → esm2020/domain/catalog/models/index.mjs} +7 -7
  191. package/{esm2015/domain/catalog/models/kit-product.js → esm2020/domain/catalog/models/kit-product.mjs} +18 -18
  192. package/esm2020/domain/catalog/models/product.mjs +17 -0
  193. package/{esm2015/domain/catalog/models/types/category-condition.type.js → esm2020/domain/catalog/models/types/category-condition.type.mjs} +2 -2
  194. package/{esm2015/domain/catalog/models/types/category-filter.type.js → esm2020/domain/catalog/models/types/category-filter.type.mjs} +2 -2
  195. package/{esm2015/domain/catalog/models/types/category-metadata.type.js → esm2020/domain/catalog/models/types/category-metadata.type.mjs} +2 -2
  196. package/{esm2015/domain/catalog/models/types/index.js → esm2020/domain/catalog/models/types/index.mjs} +11 -11
  197. package/{esm2015/domain/catalog/models/types/product-gender.type.js → esm2020/domain/catalog/models/types/product-gender.type.mjs} +2 -2
  198. package/{esm2015/domain/catalog/models/types/product-metadata.type.js → esm2020/domain/catalog/models/types/product-metadata.type.mjs} +2 -2
  199. package/esm2020/domain/catalog/models/types/product-review.type.mjs +2 -0
  200. package/{esm2015/domain/catalog/models/types/shop-description.type.js → esm2020/domain/catalog/models/types/shop-description.type.mjs} +2 -2
  201. package/{esm2015/domain/catalog/models/types/shop-price.type.js → esm2020/domain/catalog/models/types/shop-price.type.mjs} +2 -2
  202. package/{esm2015/domain/catalog/models/types/stock.type.js → esm2020/domain/catalog/models/types/stock.type.mjs} +2 -2
  203. package/{esm2015/domain/catalog/models/types/variant-grade.type.js → esm2020/domain/catalog/models/types/variant-grade.type.mjs} +2 -2
  204. package/esm2020/domain/catalog/models/variant.mjs +10 -0
  205. package/esm2020/domain/catalog/repositories/category.repository.mjs +2 -0
  206. package/{esm2015/domain/catalog/repositories/index.js → esm2020/domain/catalog/repositories/index.mjs} +5 -5
  207. package/esm2020/domain/catalog/repositories/product.repository.mjs +2 -0
  208. package/{esm2015/domain/catalog/repositories/subscription-product.repository.js → esm2020/domain/catalog/repositories/subscription-product.repository.mjs} +2 -2
  209. package/{esm2015/domain/catalog/repositories/variant.repository.js → esm2020/domain/catalog/repositories/variant.repository.mjs} +2 -2
  210. package/{esm2015/domain/generic/index.js → esm2020/domain/generic/index.mjs} +3 -3
  211. package/esm2020/domain/generic/model/base.model.mjs +23 -0
  212. package/{esm2015/domain/generic/model/identifier-fields.js → esm2020/domain/generic/model/identifier-fields.mjs} +2 -2
  213. package/{esm2015/domain/generic/model/index.js → esm2020/domain/generic/model/index.mjs} +4 -4
  214. package/esm2020/domain/generic/model/types/base-model-builder.type.mjs +2 -0
  215. package/esm2020/domain/generic/model/types/identifier-model.type.mjs +2 -0
  216. package/{esm2015/domain/generic/model/types/index.js → esm2020/domain/generic/model/types/index.mjs} +6 -6
  217. package/{esm2015/domain/generic/model/types/model-base-structure.type.js → esm2020/domain/generic/model/types/model-base-structure.type.mjs} +2 -2
  218. package/esm2020/domain/generic/model/types/non-function-properties.type.mjs +2 -0
  219. package/{esm2015/domain/generic/model/types/non-function-property-name.type.js → esm2020/domain/generic/model/types/non-function-property-name.type.mjs} +2 -2
  220. package/esm2020/domain/generic/repository/create.repository.mjs +2 -0
  221. package/esm2020/domain/generic/repository/crud.repository.mjs +2 -0
  222. package/esm2020/domain/generic/repository/delete.repository.mjs +2 -0
  223. package/{esm2015/domain/generic/repository/enums/index.js → esm2020/domain/generic/repository/enums/index.mjs} +3 -3
  224. package/{esm2015/domain/generic/repository/enums/update-option-actions.enum.js → esm2020/domain/generic/repository/enums/update-option-actions.enum.mjs} +9 -9
  225. package/{esm2015/domain/generic/repository/enums/where.enum.js → esm2020/domain/generic/repository/enums/where.enum.mjs} +16 -16
  226. package/esm2020/domain/generic/repository/find.repository.mjs +2 -0
  227. package/esm2020/domain/generic/repository/get.repository.mjs +2 -0
  228. package/{esm2015/domain/generic/repository/index.js → esm2020/domain/generic/repository/index.mjs} +10 -10
  229. package/esm2020/domain/generic/repository/read.repository.mjs +2 -0
  230. package/{esm2015/domain/generic/repository/types/index.js → esm2020/domain/generic/repository/types/index.mjs} +7 -7
  231. package/esm2020/domain/generic/repository/types/repository-find-filters.type.mjs +2 -0
  232. package/{esm2015/domain/generic/repository/types/repository-find-result.type.js → esm2020/domain/generic/repository/types/repository-find-result.type.mjs} +2 -2
  233. package/{esm2015/domain/generic/repository/types/repository-limit-options.type.js → esm2020/domain/generic/repository/types/repository-limit-options.type.mjs} +2 -2
  234. package/{esm2015/domain/generic/repository/types/repository-order-by-list.type.js → esm2020/domain/generic/repository/types/repository-order-by-list.type.mjs} +2 -2
  235. package/esm2020/domain/generic/repository/types/repository-update-params.type.mjs +2 -0
  236. package/{esm2015/domain/generic/repository/types/where-options.type.js → esm2020/domain/generic/repository/types/where-options.type.mjs} +2 -2
  237. package/esm2020/domain/generic/repository/update.repository.mjs +2 -0
  238. package/{esm2015/domain/index.js → esm2020/domain/index.mjs} +7 -7
  239. package/{esm2015/domain/location/index.js → esm2020/domain/location/index.mjs} +2 -2
  240. package/esm2020/domain/location/models/address.mjs +7 -0
  241. package/{esm2015/domain/location/models/index.js → esm2020/domain/location/models/index.mjs} +3 -3
  242. package/{esm2015/domain/location/models/types/index.js → esm2020/domain/location/models/types/index.mjs} +4 -4
  243. package/{esm2015/domain/location/models/types/location-bound.type.js → esm2020/domain/location/models/types/location-bound.type.mjs} +2 -2
  244. package/{esm2015/domain/location/models/types/location-geometry.type.js → esm2020/domain/location/models/types/location-geometry.type.mjs} +2 -2
  245. package/{esm2015/domain/location/models/types/location-lat-lng.type.js → esm2020/domain/location/models/types/location-lat-lng.type.mjs} +2 -2
  246. package/{esm2015/domain/shop-settings/enums/filter-type.enum.js → esm2020/domain/shop-settings/enums/filter-type.enum.mjs} +21 -21
  247. package/{esm2015/domain/shop-settings/enums/index.js → esm2020/domain/shop-settings/enums/index.mjs} +3 -3
  248. package/{esm2015/domain/shop-settings/enums/questions-filters.enum.js → esm2020/domain/shop-settings/enums/questions-filters.enum.mjs} +21 -21
  249. package/{esm2015/domain/shop-settings/helpers/beauty-questions.helper.js → esm2020/domain/shop-settings/helpers/beauty-questions.helper.mjs} +46 -46
  250. package/{esm2015/domain/shop-settings/helpers/index.js → esm2020/domain/shop-settings/helpers/index.mjs} +2 -2
  251. package/{esm2015/domain/shop-settings/index.js → esm2020/domain/shop-settings/index.mjs} +5 -5
  252. package/esm2020/domain/shop-settings/models/home.mjs +7 -0
  253. package/{esm2015/domain/shop-settings/models/index.js → esm2020/domain/shop-settings/models/index.mjs} +4 -5
  254. package/{esm2015/domain/shop-settings/models/shop-menu.js → esm2020/domain/shop-settings/models/shop-menu.mjs} +7 -7
  255. package/{esm2015/domain/shop-settings/models/types/banner.type.js → esm2020/domain/shop-settings/models/types/banner.type.mjs} +2 -2
  256. package/{esm2015/domain/shop-settings/models/types/benefit.type.js → esm2020/domain/shop-settings/models/types/benefit.type.mjs} +2 -2
  257. package/esm2020/domain/shop-settings/models/types/home-data.type.mjs +2 -0
  258. package/esm2020/domain/shop-settings/models/types/index.mjs +6 -0
  259. package/{esm2015/domain/shop-settings/models/types/menu-nav.type.js → esm2020/domain/shop-settings/models/types/menu-nav.type.mjs} +2 -2
  260. package/{esm2015/domain/shop-settings/models/types/sub-menu.type.js → esm2020/domain/shop-settings/models/types/sub-menu.type.mjs} +2 -2
  261. package/{esm2015/domain/shop-settings/repositories/home.repository.js → esm2020/domain/shop-settings/repositories/home.repository.mjs} +2 -2
  262. package/{esm2015/domain/shop-settings/repositories/index.js → esm2020/domain/shop-settings/repositories/index.mjs} +3 -4
  263. package/{esm2015/domain/shop-settings/repositories/shop-menu.repository.js → esm2020/domain/shop-settings/repositories/shop-menu.repository.mjs} +2 -2
  264. package/{esm2015/domain/shopping/index.js → esm2020/domain/shopping/index.mjs} +3 -3
  265. package/{esm2015/domain/shopping/models/buy-2-win.js → esm2020/domain/shopping/models/buy-2-win.mjs} +14 -14
  266. package/esm2020/domain/shopping/models/checkout.mjs +38 -0
  267. package/{esm2015/domain/shopping/models/coupons/coupon.js → esm2020/domain/shopping/models/coupons/coupon.mjs} +38 -38
  268. package/{esm2015/domain/shopping/models/coupons/enums/coupon-club-mens.enum.js → esm2020/domain/shopping/models/coupons/enums/coupon-club-mens.enum.mjs} +7 -7
  269. package/{esm2015/domain/shopping/models/coupons/enums/coupon-subtypes.enum.js → esm2020/domain/shopping/models/coupons/enums/coupon-subtypes.enum.mjs} +6 -6
  270. package/{esm2015/domain/shopping/models/coupons/enums/coupon-types.enum.js → esm2020/domain/shopping/models/coupons/enums/coupon-types.enum.mjs} +10 -10
  271. package/{esm2015/domain/shopping/models/coupons/enums/exclusivities.enum.js → esm2020/domain/shopping/models/coupons/enums/exclusivities.enum.mjs} +10 -10
  272. package/{esm2015/domain/shopping/models/coupons/enums/index.js → esm2020/domain/shopping/models/coupons/enums/index.mjs} +4 -4
  273. package/{esm2015/domain/shopping/models/coupons/index.js → esm2020/domain/shopping/models/coupons/index.mjs} +3 -3
  274. package/{esm2015/domain/shopping/models/enums/checkout-types.enum.js → esm2020/domain/shopping/models/enums/checkout-types.enum.mjs} +7 -7
  275. package/{esm2015/domain/shopping/models/enums/index.js → esm2020/domain/shopping/models/enums/index.mjs} +3 -3
  276. package/{esm2015/domain/shopping/models/enums/order-status.enum.js → esm2020/domain/shopping/models/enums/order-status.enum.mjs} +12 -12
  277. package/{esm2015/domain/shopping/models/index.js → esm2020/domain/shopping/models/index.mjs} +12 -12
  278. package/{esm2015/domain/shopping/models/line-item.js → esm2020/domain/shopping/models/line-item.mjs} +4 -4
  279. package/{esm2015/domain/shopping/models/order.js → esm2020/domain/shopping/models/order.mjs} +11 -11
  280. package/esm2020/domain/shopping/models/payment.mjs +169 -0
  281. package/{esm2015/domain/shopping/models/shipping-method.js → esm2020/domain/shopping/models/shipping-method.mjs} +7 -7
  282. package/{esm2015/domain/shopping/models/subscription/checkout.js → esm2020/domain/shopping/models/subscription/checkout.mjs} +28 -28
  283. package/{esm2015/domain/shopping/models/subscription/index.js → esm2020/domain/shopping/models/subscription/index.mjs} +3 -3
  284. package/{esm2015/domain/shopping/models/subscription/plan.js → esm2020/domain/shopping/models/subscription/plan.mjs} +7 -7
  285. package/{esm2015/domain/shopping/models/types/index.js → esm2020/domain/shopping/models/types/index.mjs} +8 -8
  286. package/esm2020/domain/shopping/models/types/payment-address.type.mjs +2 -0
  287. package/{esm2015/domain/shopping/models/types/payment-billing.type.js → esm2020/domain/shopping/models/types/payment-billing.type.mjs} +2 -2
  288. package/esm2020/domain/shopping/models/types/payment-card.type.mjs +2 -0
  289. package/esm2020/domain/shopping/models/types/payment-customer.type.mjs +2 -0
  290. package/{esm2015/domain/shopping/models/types/payment-document.type.js → esm2020/domain/shopping/models/types/payment-document.type.mjs} +2 -2
  291. package/{esm2015/domain/shopping/models/types/payment-item.type.js → esm2020/domain/shopping/models/types/payment-item.type.mjs} +2 -2
  292. package/{esm2015/domain/shopping/models/types/payment-shipping.type.js → esm2020/domain/shopping/models/types/payment-shipping.type.mjs} +2 -2
  293. package/{esm2015/domain/shopping/repositories/buy-2-win.repository.js → esm2020/domain/shopping/repositories/buy-2-win.repository.mjs} +2 -2
  294. package/{esm2015/domain/shopping/repositories/checkout.repository.js → esm2020/domain/shopping/repositories/checkout.repository.mjs} +2 -2
  295. package/{esm2015/domain/shopping/repositories/coupon.repository.js → esm2020/domain/shopping/repositories/coupon.repository.mjs} +2 -2
  296. package/{esm2015/domain/shopping/repositories/index.js → esm2020/domain/shopping/repositories/index.mjs} +8 -8
  297. package/{esm2015/domain/shopping/repositories/legacy-order.repository.js → esm2020/domain/shopping/repositories/legacy-order.repository.mjs} +2 -2
  298. package/{esm2015/domain/shopping/repositories/order.repository.js → esm2020/domain/shopping/repositories/order.repository.mjs} +2 -2
  299. package/{esm2015/domain/shopping/repositories/payment.repository.js → esm2020/domain/shopping/repositories/payment.repository.mjs} +2 -2
  300. package/{esm2015/domain/shopping/repositories/subscription/checkout.repository.js → esm2020/domain/shopping/repositories/subscription/checkout.repository.mjs} +2 -2
  301. package/{esm2015/domain/shopping/repositories/subscription/index.js → esm2020/domain/shopping/repositories/subscription/index.mjs} +3 -3
  302. package/{esm2015/domain/shopping/repositories/subscription/plan.repository.js → esm2020/domain/shopping/repositories/subscription/plan.repository.mjs} +2 -2
  303. package/{esm2015/domain/users/errors/index.js → esm2020/domain/users/errors/index.mjs} +4 -4
  304. package/{esm2015/domain/users/errors/unauthorized.error.js → esm2020/domain/users/errors/unauthorized.error.mjs} +8 -8
  305. package/{esm2015/domain/users/errors/user-already-registered.error.js → esm2020/domain/users/errors/user-already-registered.error.mjs} +8 -8
  306. package/{esm2015/domain/users/errors/weak-password.error.js → esm2020/domain/users/errors/weak-password.error.mjs} +8 -8
  307. package/{esm2015/domain/users/index.js → esm2020/domain/users/index.mjs} +6 -6
  308. package/{esm2015/domain/users/models/beauty-profile.js → esm2020/domain/users/models/beauty-profile.mjs} +12 -12
  309. package/{esm2015/domain/users/models/enums/accessory-importances.enum.js → esm2020/domain/users/models/enums/accessory-importances.enum.mjs} +7 -7
  310. package/{esm2015/domain/users/models/enums/area.enum.js → esm2020/domain/users/models/enums/area.enum.mjs} +13 -13
  311. package/{esm2015/domain/users/models/enums/beard-problems.enum.js → esm2020/domain/users/models/enums/beard-problems.enum.mjs} +11 -11
  312. package/{esm2015/domain/users/models/enums/beard-sizes.enum.js → esm2020/domain/users/models/enums/beard-sizes.enum.mjs} +9 -9
  313. package/{esm2015/domain/users/models/enums/beauty-product-importances.enum.js → esm2020/domain/users/models/enums/beauty-product-importances.enum.mjs} +8 -8
  314. package/{esm2015/domain/users/models/enums/body-problems.enum.js → esm2020/domain/users/models/enums/body-problems.enum.mjs} +13 -13
  315. package/{esm2015/domain/users/models/enums/body-shapes.enum.js → esm2020/domain/users/models/enums/body-shapes.enum.mjs} +9 -9
  316. package/{esm2015/domain/users/models/enums/body-tattoos.enum.js → esm2020/domain/users/models/enums/body-tattoos.enum.mjs} +7 -7
  317. package/{esm2015/domain/users/models/enums/face-skin-oilinesses.enum.js → esm2020/domain/users/models/enums/face-skin-oilinesses.enum.mjs} +9 -9
  318. package/{esm2015/domain/users/models/enums/face-skin-problems.enum.js → esm2020/domain/users/models/enums/face-skin-problems.enum.mjs} +12 -12
  319. package/{esm2015/domain/users/models/enums/face-skin-tones.enum.js → esm2020/domain/users/models/enums/face-skin-tones.enum.mjs} +10 -10
  320. package/{esm2015/domain/users/models/enums/family-incomes.enum.js → esm2020/domain/users/models/enums/family-incomes.enum.mjs} +10 -10
  321. package/{esm2015/domain/users/models/enums/fragrance-importances.enum.js → esm2020/domain/users/models/enums/fragrance-importances.enum.mjs} +7 -7
  322. package/{esm2015/domain/users/models/enums/hair-colors.enum.js → esm2020/domain/users/models/enums/hair-colors.enum.mjs} +12 -12
  323. package/{esm2015/domain/users/models/enums/hair-problems.enum.js → esm2020/domain/users/models/enums/hair-problems.enum.mjs} +12 -12
  324. package/{esm2015/domain/users/models/enums/hair-strands.enum.js → esm2020/domain/users/models/enums/hair-strands.enum.mjs} +10 -10
  325. package/{esm2015/domain/users/models/enums/hair-types.enum.js → esm2020/domain/users/models/enums/hair-types.enum.mjs} +9 -9
  326. package/{esm2015/domain/users/models/enums/index.js → esm2020/domain/users/models/enums/index.mjs} +21 -21
  327. package/{esm2015/domain/users/models/enums/office-position.enum.js → esm2020/domain/users/models/enums/office-position.enum.mjs} +8 -8
  328. package/{esm2015/domain/users/models/enums/product-spents.enum.js → esm2020/domain/users/models/enums/product-spents.enum.mjs} +10 -10
  329. package/{esm2015/domain/users/models/enums/user-type.enum.js → esm2020/domain/users/models/enums/user-type.enum.mjs} +10 -10
  330. package/{esm2015/domain/users/models/index.js → esm2020/domain/users/models/index.mjs} +8 -8
  331. package/{esm2015/domain/users/models/lead.js → esm2020/domain/users/models/lead.mjs} +7 -7
  332. package/esm2020/domain/users/models/subscription/edition.mjs +7 -0
  333. package/{esm2015/domain/users/models/subscription/enums/billing-status.enum.js → esm2020/domain/users/models/subscription/enums/billing-status.enum.mjs} +5 -5
  334. package/{esm2015/domain/users/models/subscription/enums/edition-status.enum.js → esm2020/domain/users/models/subscription/enums/edition-status.enum.mjs} +6 -6
  335. package/{esm2015/domain/users/models/subscription/enums/index.js → esm2020/domain/users/models/subscription/enums/index.mjs} +5 -5
  336. package/{esm2015/domain/users/models/subscription/enums/payment-type.enum.js → esm2020/domain/users/models/subscription/enums/payment-type.enum.mjs} +7 -7
  337. package/{esm2015/domain/users/models/subscription/enums/status.enum.js → esm2020/domain/users/models/subscription/enums/status.enum.mjs} +6 -6
  338. package/{esm2015/domain/users/models/subscription/index.js → esm2020/domain/users/models/subscription/index.mjs} +5 -5
  339. package/{esm2015/domain/users/models/subscription/payment.js → esm2020/domain/users/models/subscription/payment.mjs} +14 -14
  340. package/{esm2015/domain/users/models/subscription/subscription.js → esm2020/domain/users/models/subscription/subscription.mjs} +43 -43
  341. package/{esm2015/domain/users/models/user-address.js → esm2020/domain/users/models/user-address.mjs} +7 -7
  342. package/{esm2015/domain/users/models/user-payment-method.js → esm2020/domain/users/models/user-payment-method.mjs} +7 -7
  343. package/{esm2015/domain/users/models/user.js → esm2020/domain/users/models/user.mjs} +26 -26
  344. package/{esm2015/domain/users/repositories/beauty-profile.repository.js → esm2020/domain/users/repositories/beauty-profile.repository.mjs} +2 -2
  345. package/{esm2015/domain/users/repositories/edition.repository.js → esm2020/domain/users/repositories/edition.repository.mjs} +2 -2
  346. package/{esm2015/domain/users/repositories/index.js → esm2020/domain/users/repositories/index.mjs} +9 -9
  347. package/{esm2015/domain/users/repositories/lead.repository.js → esm2020/domain/users/repositories/lead.repository.mjs} +2 -2
  348. package/{esm2015/domain/users/repositories/subscription-payment.repository.js → esm2020/domain/users/repositories/subscription-payment.repository.mjs} +2 -2
  349. package/{esm2015/domain/users/repositories/subscription.repository.js → esm2020/domain/users/repositories/subscription.repository.mjs} +2 -2
  350. package/{esm2015/domain/users/repositories/user-address.repository.js → esm2020/domain/users/repositories/user-address.repository.mjs} +2 -2
  351. package/{esm2015/domain/users/repositories/user-payment-method.repository.js → esm2020/domain/users/repositories/user-payment-method.repository.mjs} +2 -2
  352. package/esm2020/domain/users/repositories/user.repository.mjs +2 -0
  353. package/esm2020/domain/users/services/authentication.service.mjs +2 -0
  354. package/{esm2015/domain/users/services/index.js → esm2020/domain/users/services/index.mjs} +4 -4
  355. package/{esm2015/domain/users/services/register.service.js → esm2020/domain/users/services/register.service.mjs} +2 -2
  356. package/{esm2015/domain/users/services/types/basic-user-data.type.js → esm2020/domain/users/services/types/basic-user-data.type.mjs} +2 -2
  357. package/{esm2015/domain/users/services/types/index.js → esm2020/domain/users/services/types/index.mjs} +2 -2
  358. package/esm2020/domain/users/use-cases/authentication.mjs +43 -0
  359. package/{esm2015/domain/users/use-cases/index.js → esm2020/domain/users/use-cases/index.mjs} +5 -5
  360. package/esm2020/domain/users/use-cases/recovery-password.mjs +9 -0
  361. package/esm2020/domain/users/use-cases/register.mjs +38 -0
  362. package/esm2020/domain/users/use-cases/signout.mjs +9 -0
  363. package/{esm2015/errors/duplicated-results.error.js → esm2020/errors/duplicated-results.error.mjs} +8 -8
  364. package/{esm2015/errors/index.js → esm2020/errors/index.mjs} +5 -5
  365. package/{esm2015/errors/invalid-argument.error.js → esm2020/errors/invalid-argument.error.mjs} +8 -8
  366. package/{esm2015/errors/not-found.error.js → esm2020/errors/not-found.error.mjs} +8 -8
  367. package/{esm2015/errors/required-argument.error.js → esm2020/errors/required-argument.error.mjs} +9 -9
  368. package/{esm2015/index.js → esm2020/index.mjs} +6 -6
  369. package/esm2020/infra/elasticsearch/adapters/axios.adapter.mjs +48 -0
  370. package/esm2020/infra/elasticsearch/adapters/elastic-search.adapter.mjs +2 -0
  371. package/{esm2015/infra/elasticsearch/adapters/index.js → esm2020/infra/elasticsearch/adapters/index.mjs} +3 -3
  372. package/{esm2015/infra/elasticsearch/index.js → esm2020/infra/elasticsearch/index.mjs} +4 -4
  373. package/{esm2015/infra/elasticsearch/indexes/index.js → esm2020/infra/elasticsearch/indexes/index.mjs} +2 -2
  374. package/esm2020/infra/elasticsearch/indexes/products-index.mjs +88 -0
  375. package/{esm2015/infra/elasticsearch/types/elastic-search-result.js → esm2020/infra/elasticsearch/types/elastic-search-result.mjs} +2 -2
  376. package/{esm2015/infra/elasticsearch/types/index.js → esm2020/infra/elasticsearch/types/index.mjs} +2 -2
  377. package/esm2020/infra/firebase/auth/authentication-firebase-auth.service.mjs +41 -0
  378. package/{esm2015/infra/firebase/auth/index.js → esm2020/infra/firebase/auth/index.mjs} +3 -3
  379. package/esm2020/infra/firebase/auth/register-firebase-auth.service.mjs +23 -0
  380. package/{esm2015/infra/firebase/auth/types/firebase-user-with-id.type.js → esm2020/infra/firebase/auth/types/firebase-user-with-id.type.mjs} +2 -2
  381. package/esm2020/infra/firebase/firestore/enums/firestore-field-type.enum.mjs +10 -0
  382. package/esm2020/infra/firebase/firestore/enums/index.mjs +2 -0
  383. package/{esm2015/infra/firebase/firestore/index.js → esm2020/infra/firebase/firestore/index.mjs} +4 -4
  384. package/{esm2015/infra/firebase/firestore/mixins/index.js → esm2020/infra/firebase/firestore/mixins/index.mjs} +10 -10
  385. package/esm2020/infra/firebase/firestore/mixins/with-create-firestore.mixin.mjs +25 -0
  386. package/esm2020/infra/firebase/firestore/mixins/with-crud-firestore.mixin.mjs +10 -0
  387. package/esm2020/infra/firebase/firestore/mixins/with-delete-firestore.mixin.mjs +15 -0
  388. package/esm2020/infra/firebase/firestore/mixins/with-find-firestore.mixin.mjs +94 -0
  389. package/esm2020/infra/firebase/firestore/mixins/with-firestore.mixin.mjs +52 -0
  390. package/esm2020/infra/firebase/firestore/mixins/with-get-firestore.mixin.mjs +21 -0
  391. package/{esm2015/infra/firebase/firestore/mixins/with-helpers.mixin.js → esm2020/infra/firebase/firestore/mixins/with-helpers.mixin.mjs} +17 -17
  392. package/esm2020/infra/firebase/firestore/mixins/with-sub-collection.mixin.mjs +11 -0
  393. package/esm2020/infra/firebase/firestore/mixins/with-update-firestore.mixin.mjs +42 -0
  394. package/esm2020/infra/firebase/firestore/repositories/catalog/category-firestore.repository.mjs +64 -0
  395. package/{esm2015/infra/firebase/firestore/repositories/catalog/index.js → esm2020/infra/firebase/firestore/repositories/catalog/index.mjs} +5 -5
  396. package/esm2020/infra/firebase/firestore/repositories/catalog/product-firestore.repository.mjs +45 -0
  397. package/{esm2015/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.js → esm2020/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.mjs} +14 -14
  398. package/{esm2015/infra/firebase/firestore/repositories/catalog/subscription-product-firestore.repository.js → esm2020/infra/firebase/firestore/repositories/catalog/subscription-product-firestore.repository.mjs} +12 -12
  399. package/{esm2015/infra/firebase/firestore/repositories/index.js → esm2020/infra/firebase/firestore/repositories/index.mjs} +5 -5
  400. package/esm2020/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.mjs +54 -0
  401. package/{esm2015/infra/firebase/firestore/repositories/shop-settings/index.js → esm2020/infra/firebase/firestore/repositories/shop-settings/index.mjs} +3 -4
  402. package/{esm2015/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.js → esm2020/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.mjs} +12 -12
  403. package/{esm2015/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.js → esm2020/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.mjs} +12 -12
  404. package/{esm2015/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.js → esm2020/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.mjs} +12 -12
  405. package/{esm2015/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.js → esm2020/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.mjs} +12 -12
  406. package/{esm2015/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.js → esm2020/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.mjs} +29 -29
  407. package/{esm2015/infra/firebase/firestore/repositories/shopping/index.js → esm2020/infra/firebase/firestore/repositories/shopping/index.mjs} +9 -9
  408. package/{esm2015/infra/firebase/firestore/repositories/shopping/legacy-order-firestore.repository.js → esm2020/infra/firebase/firestore/repositories/shopping/legacy-order-firestore.repository.mjs} +9 -9
  409. package/esm2020/infra/firebase/firestore/repositories/shopping/order-firestore.repository.mjs +38 -0
  410. package/{esm2015/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.js → esm2020/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.mjs} +12 -12
  411. package/{esm2015/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.js → esm2020/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.mjs} +12 -12
  412. package/{esm2015/infra/firebase/firestore/repositories/users/index.js → esm2020/infra/firebase/firestore/repositories/users/index.mjs} +9 -9
  413. package/{esm2015/infra/firebase/firestore/repositories/users/lead-firestore.repository.js → esm2020/infra/firebase/firestore/repositories/users/lead-firestore.repository.mjs} +12 -12
  414. package/{esm2015/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.js → esm2020/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.mjs} +14 -14
  415. package/{esm2015/infra/firebase/firestore/repositories/users/subscription-firestore.repository.js → esm2020/infra/firebase/firestore/repositories/users/subscription-firestore.repository.mjs} +12 -12
  416. package/{esm2015/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.js → esm2020/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.mjs} +14 -14
  417. package/{esm2015/infra/firebase/firestore/repositories/users/user-address-firestore.repository.js → esm2020/infra/firebase/firestore/repositories/users/user-address-firestore.repository.mjs} +14 -14
  418. package/{esm2015/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.js → esm2020/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.mjs} +14 -14
  419. package/esm2020/infra/firebase/firestore/repositories/users/user-firestore.repository.mjs +56 -0
  420. package/{esm2015/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.js → esm2020/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.mjs} +14 -14
  421. package/esm2020/infra/firebase/firestore/types/firestore-sub.repository.type.mjs +2 -0
  422. package/esm2020/infra/firebase/firestore/types/firestore.helpers.type.mjs +2 -0
  423. package/esm2020/infra/firebase/firestore/types/firestore.repository.type.mjs +2 -0
  424. package/{esm2015/infra/firebase/firestore/types/index.js → esm2020/infra/firebase/firestore/types/index.mjs} +4 -4
  425. package/{esm2015/infra/firebase/index.js → esm2020/infra/firebase/index.mjs} +3 -3
  426. package/{esm2015/infra/hasura-graphql/enums/hasura-graphql-column-type.enum.js → esm2020/infra/hasura-graphql/enums/hasura-graphql-column-type.enum.mjs} +13 -13
  427. package/{esm2015/infra/hasura-graphql/enums/hasura-graphql-where.enum.js → esm2020/infra/hasura-graphql/enums/hasura-graphql-where.enum.mjs} +15 -15
  428. package/{esm2015/infra/hasura-graphql/enums/index.js → esm2020/infra/hasura-graphql/enums/index.mjs} +3 -3
  429. package/{esm2015/infra/hasura-graphql/index.js → esm2020/infra/hasura-graphql/index.mjs} +5 -5
  430. package/esm2020/infra/hasura-graphql/mixins/helpers/attribute-option.helper.mjs +32 -0
  431. package/esm2020/infra/hasura-graphql/mixins/helpers/bind-filter-query.helper.mjs +68 -0
  432. package/esm2020/infra/hasura-graphql/mixins/helpers/filter-option.helper.mjs +22 -0
  433. package/esm2020/infra/hasura-graphql/mixins/helpers/graphql-field.helper.mjs +96 -0
  434. package/{esm2015/infra/hasura-graphql/mixins/helpers/index.js → esm2020/infra/hasura-graphql/mixins/helpers/index.mjs} +5 -4
  435. package/{esm2015/infra/hasura-graphql/mixins/index.js → esm2020/infra/hasura-graphql/mixins/index.mjs} +8 -8
  436. package/esm2020/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.mjs +37 -0
  437. package/esm2020/infra/hasura-graphql/mixins/with-crud-hasura-graphql.mixin.mjs +10 -0
  438. package/esm2020/infra/hasura-graphql/mixins/with-delete-hasura-graphql.mixin.mjs +29 -0
  439. package/esm2020/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.mjs +46 -0
  440. package/esm2020/infra/hasura-graphql/mixins/with-get-hasura-graphql.mixin.mjs +34 -0
  441. package/esm2020/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.mjs +92 -0
  442. package/esm2020/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.mjs +58 -0
  443. package/{esm2015/infra/hasura-graphql/models/category-hasura-graphql.js → esm2020/infra/hasura-graphql/models/category-hasura-graphql.mjs} +4 -4
  444. package/{esm2015/infra/hasura-graphql/models/index.js → esm2020/infra/hasura-graphql/models/index.mjs} +5 -5
  445. package/{esm2015/infra/hasura-graphql/models/kit-product-hasura-graphql.js → esm2020/infra/hasura-graphql/models/kit-product-hasura-graphql.mjs} +15 -15
  446. package/{esm2015/infra/hasura-graphql/models/product-hasura-graphql.js → esm2020/infra/hasura-graphql/models/product-hasura-graphql.mjs} +11 -11
  447. package/{esm2015/infra/hasura-graphql/models/variant-hasura-graphql.js → esm2020/infra/hasura-graphql/models/variant-hasura-graphql.mjs} +9 -9
  448. package/esm2020/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.mjs +219 -0
  449. package/{esm2015/infra/hasura-graphql/repositories/catalog/index.js → esm2020/infra/hasura-graphql/repositories/catalog/index.mjs} +4 -4
  450. package/esm2020/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.mjs +466 -0
  451. package/esm2020/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.mjs +106 -0
  452. package/{esm2015/infra/hasura-graphql/repositories/index.js → esm2020/infra/hasura-graphql/repositories/index.mjs} +2 -2
  453. package/{esm2015/infra/hasura-graphql/types/fields.type.js → esm2020/infra/hasura-graphql/types/fields.type.mjs} +2 -2
  454. package/esm2020/infra/hasura-graphql/types/graphql.repository.type.mjs +2 -0
  455. package/{esm2015/infra/hasura-graphql/types/hasura-graphql-auth-options.type.js → esm2020/infra/hasura-graphql/types/hasura-graphql-auth-options.type.mjs} +2 -2
  456. package/esm2020/infra/hasura-graphql/types/hasura-graphql-fields.type.mjs +2 -0
  457. package/{esm2015/infra/hasura-graphql/types/hasura-graphql-headers.type.js → esm2020/infra/hasura-graphql/types/hasura-graphql-headers.type.mjs} +2 -2
  458. package/{esm2015/infra/hasura-graphql/types/index.js → esm2020/infra/hasura-graphql/types/index.mjs} +9 -9
  459. package/{esm2015/infra/hasura-graphql/types/nested-field.type.js → esm2020/infra/hasura-graphql/types/nested-field.type.mjs} +2 -2
  460. package/{esm2015/infra/hasura-graphql/types/query-builder-options.type.js → esm2020/infra/hasura-graphql/types/query-builder-options.type.mjs} +2 -2
  461. package/{esm2015/infra/hasura-graphql/types/variable-options.type.js → esm2020/infra/hasura-graphql/types/variable-options.type.mjs} +2 -2
  462. package/{esm2015/infra/index.js → esm2020/infra/index.mjs} +4 -4
  463. package/{esm2015/infrab4a-connect.js → esm2020/infrab4a-connect.mjs} +4 -4
  464. package/{esm2015/utils/index.js → esm2020/utils/index.mjs} +8 -8
  465. package/{esm2015/utils/is-uuid.js → esm2020/utils/is-uuid.mjs} +3 -3
  466. package/{esm2015/utils/mixins/base.mixin.js → esm2020/utils/mixins/base.mixin.mjs} +6 -6
  467. package/{esm2015/utils/mixins/index.js → esm2020/utils/mixins/index.mjs} +4 -4
  468. package/{esm2015/utils/mixins/merge-constructor-params.type.js → esm2020/utils/mixins/merge-constructor-params.type.mjs} +2 -2
  469. package/{esm2015/utils/mixins/mixin-ctor.type.js → esm2020/utils/mixins/mixin-ctor.type.mjs} +2 -2
  470. package/{esm2015/utils/parse-datetime.js → esm2020/utils/parse-datetime.mjs} +14 -14
  471. package/{esm2015/utils/types/array-element.type.js → esm2020/utils/types/array-element.type.mjs} +2 -2
  472. package/{esm2015/utils/types/index.js → esm2020/utils/types/index.mjs} +3 -3
  473. package/{esm2015/utils/types/prop.type.js → esm2020/utils/types/prop.type.mjs} +2 -2
  474. package/fesm2015/{infrab4a-connect.js → infrab4a-connect.mjs} +3158 -3073
  475. package/fesm2015/infrab4a-connect.mjs.map +1 -0
  476. package/fesm2020/infrab4a-connect.mjs +3261 -0
  477. package/fesm2020/infrab4a-connect.mjs.map +1 -0
  478. package/index.d.ts +5 -5
  479. package/infra/elasticsearch/adapters/axios.adapter.d.ts +14 -14
  480. package/infra/elasticsearch/adapters/elastic-search.adapter.d.ts +7 -7
  481. package/infra/elasticsearch/adapters/index.d.ts +2 -2
  482. package/infra/elasticsearch/index.d.ts +3 -3
  483. package/infra/elasticsearch/indexes/index.d.ts +1 -1
  484. package/infra/elasticsearch/indexes/products-index.d.ts +15 -15
  485. package/infra/elasticsearch/types/elastic-search-result.d.ts +7 -7
  486. package/infra/elasticsearch/types/index.d.ts +1 -1
  487. package/infra/firebase/auth/authentication-firebase-auth.service.d.ts +12 -12
  488. package/infra/firebase/auth/index.d.ts +2 -2
  489. package/infra/firebase/auth/register-firebase-auth.service.d.ts +8 -8
  490. package/infra/firebase/auth/types/firebase-user-with-id.type.d.ts +3 -3
  491. package/infra/firebase/firestore/enums/firestore-field-type.enum.d.ts +8 -0
  492. package/infra/firebase/firestore/enums/index.d.ts +1 -0
  493. package/infra/firebase/firestore/index.d.ts +3 -3
  494. package/infra/firebase/firestore/mixins/index.d.ts +9 -9
  495. package/infra/firebase/firestore/mixins/with-create-firestore.mixin.d.ts +4 -4
  496. package/infra/firebase/firestore/mixins/with-crud-firestore.mixin.d.ts +4 -4
  497. package/infra/firebase/firestore/mixins/with-delete-firestore.mixin.d.ts +4 -4
  498. package/infra/firebase/firestore/mixins/with-find-firestore.mixin.d.ts +4 -4
  499. package/infra/firebase/firestore/mixins/with-firestore.mixin.d.ts +4 -4
  500. package/infra/firebase/firestore/mixins/with-get-firestore.mixin.d.ts +4 -4
  501. package/infra/firebase/firestore/mixins/with-helpers.mixin.d.ts +11 -11
  502. package/infra/firebase/firestore/mixins/with-sub-collection.mixin.d.ts +7 -7
  503. package/infra/firebase/firestore/mixins/with-update-firestore.mixin.d.ts +7 -7
  504. package/infra/firebase/firestore/repositories/catalog/category-firestore.repository.d.ts +17 -17
  505. package/infra/firebase/firestore/repositories/catalog/index.d.ts +4 -4
  506. package/infra/firebase/firestore/repositories/catalog/product-firestore.repository.d.ts +11 -11
  507. package/infra/firebase/firestore/repositories/catalog/product-variant-firestore.repository.d.ts +13 -13
  508. package/infra/firebase/firestore/repositories/catalog/subscription-product-firestore.repository.d.ts +8 -8
  509. package/infra/firebase/firestore/repositories/index.d.ts +4 -4
  510. package/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.d.ts +16 -16
  511. package/infra/firebase/firestore/repositories/shop-settings/index.d.ts +2 -3
  512. package/infra/firebase/firestore/repositories/shop-settings/shop-menu-firestore.repository.d.ts +8 -8
  513. package/infra/firebase/firestore/repositories/shopping/buy-2-win-firestore.repository.d.ts +8 -8
  514. package/infra/firebase/firestore/repositories/shopping/checkout-firestore.repository.d.ts +8 -8
  515. package/infra/firebase/firestore/repositories/shopping/checkout-subscription-firestore.repository.d.ts +8 -8
  516. package/infra/firebase/firestore/repositories/shopping/coupon-firestore.repository.d.ts +12 -12
  517. package/infra/firebase/firestore/repositories/shopping/index.d.ts +8 -8
  518. package/infra/firebase/firestore/repositories/shopping/legacy-order-firestore.repository.d.ts +7 -7
  519. package/infra/firebase/firestore/repositories/shopping/order-firestore.repository.d.ts +13 -8
  520. package/infra/firebase/firestore/repositories/shopping/payment-firestore.repository.d.ts +8 -8
  521. package/infra/firebase/firestore/repositories/shopping/subscription-plan-firestore.repository.d.ts +8 -8
  522. package/infra/firebase/firestore/repositories/users/index.d.ts +8 -8
  523. package/infra/firebase/firestore/repositories/users/lead-firestore.repository.d.ts +8 -8
  524. package/infra/firebase/firestore/repositories/users/subscription-edition-firestore.repository.d.ts +13 -13
  525. package/infra/firebase/firestore/repositories/users/subscription-firestore.repository.d.ts +8 -8
  526. package/infra/firebase/firestore/repositories/users/subscription-payment-firestore.repository.d.ts +13 -13
  527. package/infra/firebase/firestore/repositories/users/user-address-firestore.repository.d.ts +13 -13
  528. package/infra/firebase/firestore/repositories/users/user-beauty-profile-firestore.repository.d.ts +13 -13
  529. package/infra/firebase/firestore/repositories/users/user-firestore.repository.d.ts +17 -17
  530. package/infra/firebase/firestore/repositories/users/user-payment-method-firestore.repository.d.ts +13 -13
  531. package/infra/firebase/firestore/types/firestore-sub.repository.type.d.ts +6 -6
  532. package/infra/firebase/firestore/types/firestore.helpers.type.d.ts +8 -8
  533. package/infra/firebase/firestore/types/firestore.repository.type.d.ts +14 -12
  534. package/infra/firebase/firestore/types/index.d.ts +3 -3
  535. package/infra/firebase/index.d.ts +2 -2
  536. package/infra/hasura-graphql/enums/hasura-graphql-column-type.enum.d.ts +11 -11
  537. package/infra/hasura-graphql/enums/hasura-graphql-where.enum.d.ts +13 -13
  538. package/infra/hasura-graphql/enums/index.d.ts +2 -2
  539. package/infra/hasura-graphql/index.d.ts +4 -4
  540. package/infra/hasura-graphql/mixins/helpers/attribute-option.helper.d.ts +13 -13
  541. package/infra/hasura-graphql/mixins/helpers/bind-filter-query.helper.d.ts +10 -0
  542. package/infra/hasura-graphql/mixins/helpers/filter-option.helper.d.ts +6 -6
  543. package/infra/hasura-graphql/mixins/helpers/graphql-field.helper.d.ts +8 -8
  544. package/infra/hasura-graphql/mixins/helpers/index.d.ts +4 -3
  545. package/infra/hasura-graphql/mixins/index.d.ts +7 -7
  546. package/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.d.ts +8 -8
  547. package/infra/hasura-graphql/mixins/with-crud-hasura-graphql.mixin.d.ts +11 -11
  548. package/infra/hasura-graphql/mixins/with-delete-hasura-graphql.mixin.d.ts +7 -7
  549. package/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.d.ts +25 -31
  550. package/infra/hasura-graphql/mixins/with-get-hasura-graphql.mixin.d.ts +24 -24
  551. package/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.d.ts +11 -11
  552. package/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.d.ts +14 -14
  553. package/infra/hasura-graphql/models/category-hasura-graphql.d.ts +6 -6
  554. package/infra/hasura-graphql/models/index.d.ts +4 -4
  555. package/infra/hasura-graphql/models/kit-product-hasura-graphql.d.ts +6 -6
  556. package/infra/hasura-graphql/models/product-hasura-graphql.d.ts +14 -14
  557. package/infra/hasura-graphql/models/variant-hasura-graphql.d.ts +9 -9
  558. package/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.d.ts +27 -27
  559. package/infra/hasura-graphql/repositories/catalog/index.d.ts +3 -3
  560. package/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts +28 -28
  561. package/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.d.ts +14 -14
  562. package/infra/hasura-graphql/repositories/index.d.ts +1 -1
  563. package/infra/hasura-graphql/types/fields.type.d.ts +2 -2
  564. package/infra/hasura-graphql/types/graphql.repository.type.d.ts +21 -21
  565. package/infra/hasura-graphql/types/hasura-graphql-auth-options.type.d.ts +8 -8
  566. package/infra/hasura-graphql/types/hasura-graphql-fields.type.d.ts +40 -36
  567. package/infra/hasura-graphql/types/hasura-graphql-headers.type.d.ts +7 -7
  568. package/infra/hasura-graphql/types/index.d.ts +8 -8
  569. package/infra/hasura-graphql/types/nested-field.type.d.ts +7 -7
  570. package/infra/hasura-graphql/types/query-builder-options.type.d.ts +7 -7
  571. package/infra/hasura-graphql/types/variable-options.type.d.ts +9 -9
  572. package/infra/index.d.ts +3 -3
  573. package/package.json +21 -8
  574. package/utils/index.d.ts +7 -7
  575. package/utils/is-uuid.d.ts +1 -1
  576. package/utils/mixins/base.mixin.d.ts +3 -3
  577. package/utils/mixins/index.d.ts +3 -3
  578. package/utils/mixins/merge-constructor-params.type.d.ts +3 -3
  579. package/utils/mixins/mixin-ctor.type.d.ts +1 -1
  580. package/utils/parse-datetime.d.ts +1 -1
  581. package/utils/types/array-element.type.d.ts +1 -1
  582. package/utils/types/index.d.ts +2 -2
  583. package/utils/types/prop.type.d.ts +1 -1
  584. package/bundles/infrab4a-connect.umd.js +0 -4981
  585. package/bundles/infrab4a-connect.umd.js.map +0 -1
  586. package/domain/shop-settings/models/shop-settings.d.ts +0 -9
  587. package/domain/shop-settings/models/types/shop-banner.type.d.ts +0 -10
  588. package/domain/shop-settings/models/types/shop-brands.type.d.ts +0 -10
  589. package/domain/shop-settings/models/types/shop-carousel.type.d.ts +0 -5
  590. package/domain/shop-settings/models/types/shop-collection.type.d.ts +0 -8
  591. package/domain/shop-settings/models/types/shop-section.type.d.ts +0 -9
  592. package/domain/shop-settings/repositories/shop-settings.repository.d.ts +0 -4
  593. package/esm2015/domain/catalog/models/category.js +0 -10
  594. package/esm2015/domain/catalog/models/product.js +0 -17
  595. package/esm2015/domain/catalog/models/types/product-review.type.js +0 -2
  596. package/esm2015/domain/catalog/models/variant.js +0 -10
  597. package/esm2015/domain/catalog/repositories/category.repository.js +0 -2
  598. package/esm2015/domain/catalog/repositories/product.repository.js +0 -2
  599. package/esm2015/domain/generic/model/base.model.js +0 -23
  600. package/esm2015/domain/generic/model/types/base-model-builder.type.js +0 -2
  601. package/esm2015/domain/generic/model/types/identifier-model.type.js +0 -2
  602. package/esm2015/domain/generic/model/types/non-function-properties.type.js +0 -2
  603. package/esm2015/domain/generic/repository/create.repository.js +0 -2
  604. package/esm2015/domain/generic/repository/crud.repository.js +0 -2
  605. package/esm2015/domain/generic/repository/delete.repository.js +0 -2
  606. package/esm2015/domain/generic/repository/find.repository.js +0 -2
  607. package/esm2015/domain/generic/repository/get.repository.js +0 -2
  608. package/esm2015/domain/generic/repository/read.repository.js +0 -2
  609. package/esm2015/domain/generic/repository/types/repository-find-filters.type.js +0 -2
  610. package/esm2015/domain/generic/repository/types/repository-update-params.type.js +0 -2
  611. package/esm2015/domain/generic/repository/update.repository.js +0 -2
  612. package/esm2015/domain/location/models/address.js +0 -7
  613. package/esm2015/domain/shop-settings/models/home.js +0 -7
  614. package/esm2015/domain/shop-settings/models/shop-settings.js +0 -7
  615. package/esm2015/domain/shop-settings/models/types/home-data.type.js +0 -2
  616. package/esm2015/domain/shop-settings/models/types/index.js +0 -11
  617. package/esm2015/domain/shop-settings/models/types/shop-banner.type.js +0 -2
  618. package/esm2015/domain/shop-settings/models/types/shop-brands.type.js +0 -2
  619. package/esm2015/domain/shop-settings/models/types/shop-carousel.type.js +0 -2
  620. package/esm2015/domain/shop-settings/models/types/shop-collection.type.js +0 -2
  621. package/esm2015/domain/shop-settings/models/types/shop-section.type.js +0 -2
  622. package/esm2015/domain/shop-settings/repositories/shop-settings.repository.js +0 -2
  623. package/esm2015/domain/shopping/models/checkout.js +0 -38
  624. package/esm2015/domain/shopping/models/payment.js +0 -169
  625. package/esm2015/domain/shopping/models/types/payment-address.type.js +0 -2
  626. package/esm2015/domain/shopping/models/types/payment-card.type.js +0 -2
  627. package/esm2015/domain/shopping/models/types/payment-customer.type.js +0 -2
  628. package/esm2015/domain/users/models/subscription/edition.js +0 -7
  629. package/esm2015/domain/users/repositories/user.repository.js +0 -2
  630. package/esm2015/domain/users/services/authentication.service.js +0 -2
  631. package/esm2015/domain/users/use-cases/authentication.js +0 -40
  632. package/esm2015/domain/users/use-cases/recovery-password.js +0 -12
  633. package/esm2015/domain/users/use-cases/register.js +0 -34
  634. package/esm2015/domain/users/use-cases/signout.js +0 -12
  635. package/esm2015/infra/elasticsearch/adapters/axios.adapter.js +0 -57
  636. package/esm2015/infra/elasticsearch/adapters/elastic-search.adapter.js +0 -2
  637. package/esm2015/infra/elasticsearch/indexes/products-index.js +0 -93
  638. package/esm2015/infra/firebase/auth/authentication-firebase-auth.service.js +0 -52
  639. package/esm2015/infra/firebase/auth/register-firebase-auth.service.js +0 -26
  640. package/esm2015/infra/firebase/firestore/mixins/with-create-firestore.mixin.js +0 -31
  641. package/esm2015/infra/firebase/firestore/mixins/with-crud-firestore.mixin.js +0 -10
  642. package/esm2015/infra/firebase/firestore/mixins/with-delete-firestore.mixin.js +0 -18
  643. package/esm2015/infra/firebase/firestore/mixins/with-find-firestore.mixin.js +0 -92
  644. package/esm2015/infra/firebase/firestore/mixins/with-firestore.mixin.js +0 -22
  645. package/esm2015/infra/firebase/firestore/mixins/with-get-firestore.mixin.js +0 -24
  646. package/esm2015/infra/firebase/firestore/mixins/with-sub-collection.mixin.js +0 -11
  647. package/esm2015/infra/firebase/firestore/mixins/with-update-firestore.mixin.js +0 -45
  648. package/esm2015/infra/firebase/firestore/repositories/catalog/category-firestore.repository.js +0 -71
  649. package/esm2015/infra/firebase/firestore/repositories/catalog/product-firestore.repository.js +0 -52
  650. package/esm2015/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.js +0 -56
  651. package/esm2015/infra/firebase/firestore/repositories/shop-settings/shop-settings-firestore.repository.js +0 -12
  652. package/esm2015/infra/firebase/firestore/repositories/shopping/order-firestore.repository.js +0 -12
  653. package/esm2015/infra/firebase/firestore/repositories/users/user-firestore.repository.js +0 -68
  654. package/esm2015/infra/firebase/firestore/types/firestore-sub.repository.type.js +0 -2
  655. package/esm2015/infra/firebase/firestore/types/firestore.helpers.type.js +0 -2
  656. package/esm2015/infra/firebase/firestore/types/firestore.repository.type.js +0 -2
  657. package/esm2015/infra/hasura-graphql/mixins/helpers/attribute-option.helper.js +0 -31
  658. package/esm2015/infra/hasura-graphql/mixins/helpers/filter-option.helper.js +0 -22
  659. package/esm2015/infra/hasura-graphql/mixins/helpers/graphql-field.helper.js +0 -72
  660. package/esm2015/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.js +0 -45
  661. package/esm2015/infra/hasura-graphql/mixins/with-crud-hasura-graphql.mixin.js +0 -10
  662. package/esm2015/infra/hasura-graphql/mixins/with-delete-hasura-graphql.mixin.js +0 -29
  663. package/esm2015/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.js +0 -93
  664. package/esm2015/infra/hasura-graphql/mixins/with-get-hasura-graphql.mixin.js +0 -35
  665. package/esm2015/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.js +0 -94
  666. package/esm2015/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.js +0 -56
  667. package/esm2015/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.js +0 -230
  668. package/esm2015/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.js +0 -455
  669. package/esm2015/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.js +0 -116
  670. package/esm2015/infra/hasura-graphql/types/graphql.repository.type.js +0 -2
  671. package/esm2015/infra/hasura-graphql/types/hasura-graphql-fields.type.js +0 -2
  672. package/fesm2015/infrab4a-connect.js.map +0 -1
  673. package/infra/firebase/firestore/repositories/shop-settings/shop-settings-firestore.repository.d.ts +0 -8
  674. package/infrab4a-connect.d.ts +0 -5
@@ -0,0 +1,3261 @@
1
+ import 'reflect-metadata';
2
+ import { plainToInstance, instanceToPlain, Expose, Type } from 'class-transformer';
3
+ import { __decorate, __metadata } from 'tslib';
4
+ import { parseISO } from 'date-fns';
5
+ export { add, addBusinessDays, addDays, addMonths, addYears, endOfDay, format, formatISO9075, parseISO, startOfDay, sub } from 'date-fns';
6
+ import { isString, isNil, isNumber, isDate, set, isObject, isEmpty, chunk, isBoolean, isInteger, isNaN as isNaN$1, omit } from 'lodash';
7
+ export { chunk, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set } from 'lodash';
8
+ import { CustomError } from 'ts-custom-error';
9
+ import axios from 'axios';
10
+ import firebase from 'firebase';
11
+ import { mutation, query } from 'gql-query-builder';
12
+ import fetch from 'node-fetch';
13
+
14
+ class BaseModel {
15
+ get identifier() {
16
+ const fields = this.constructor.identifiersFields.filter((field) => field !== 'identifier');
17
+ return fields.reduce((object, field) => ({ ...object, [field]: this[field] }), {});
18
+ }
19
+ get identifiersFields() {
20
+ return this.constructor.identifiersFields;
21
+ }
22
+ constructor(args) {
23
+ Object.assign(this, args);
24
+ }
25
+ static toInstance(data) {
26
+ return plainToInstance(this, data || {});
27
+ }
28
+ static isModel(value) {
29
+ return value instanceof this;
30
+ }
31
+ toPlain() {
32
+ return instanceToPlain(this);
33
+ }
34
+ }
35
+
36
+ var Where;
37
+ (function (Where) {
38
+ Where["EQUALS"] = "==";
39
+ Where["NOTEQUALS"] = "!=";
40
+ Where["GT"] = ">";
41
+ Where["GTE"] = ">=";
42
+ Where["IN"] = "in";
43
+ Where["NOTIN"] = "not in";
44
+ Where["LT"] = "<";
45
+ Where["LTE"] = "<=";
46
+ Where["LIKE"] = "like";
47
+ Where["NOTLIKE"] = "not like";
48
+ Where["ISNULL"] = "is null";
49
+ Where["ISNOTNULL"] = "is not null";
50
+ })(Where || (Where = {}));
51
+
52
+ var UpdateOptionActions;
53
+ (function (UpdateOptionActions) {
54
+ UpdateOptionActions["UPDATE"] = "update";
55
+ UpdateOptionActions["MERGE"] = "merge";
56
+ UpdateOptionActions["REMOVE"] = "remove";
57
+ UpdateOptionActions["REMOVE_FIELD"] = "removeField";
58
+ UpdateOptionActions["NULL"] = "null";
59
+ })(UpdateOptionActions || (UpdateOptionActions = {}));
60
+
61
+ var AccessoryImportances;
62
+ (function (AccessoryImportances) {
63
+ AccessoryImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
64
+ AccessoryImportances["LIKE_RARELY_USE"] = "Gosto, mas uso poucos";
65
+ AccessoryImportances["LIKE_ALWAYS_FOLLOW_FASHION"] = "Gosto muito de acess\u00F3rios e sempre procuro acompanhar a moda";
66
+ })(AccessoryImportances || (AccessoryImportances = {}));
67
+
68
+ var Area;
69
+ (function (Area) {
70
+ Area["GP"] = "Geral";
71
+ Area["CRM"] = "CRM";
72
+ Area["MediaProd"] = "Media Production";
73
+ Area["Tech"] = "Tecnologia";
74
+ Area["Transactional"] = "Transacional";
75
+ Area["Operations"] = "Opera\u00E7\u00F5es";
76
+ Area["Sales"] = "Comercial";
77
+ Area["Finantial"] = "Financeiro";
78
+ Area["HR"] = "RH";
79
+ })(Area || (Area = {}));
80
+
81
+ var BeardProblems;
82
+ (function (BeardProblems) {
83
+ BeardProblems["NO_PROBLEMS"] = "Sem problemas";
84
+ BeardProblems["DRY"] = "Barba Seca";
85
+ BeardProblems["OILY"] = "Barba Oleaosa";
86
+ BeardProblems["DANCRUFF"] = "Barba com Caspa";
87
+ BeardProblems["INGROWN_HAIRS"] = "P\u00EAlos Encravados";
88
+ BeardProblems["DOESNT_GROW"] = "N\u00E3o Cresce";
89
+ BeardProblems["SPARSE_BEARD"] = "Barba Rala";
90
+ })(BeardProblems || (BeardProblems = {}));
91
+
92
+ var BeardSizes;
93
+ (function (BeardSizes) {
94
+ BeardSizes["BIG"] = "Grande";
95
+ BeardSizes["MEDIUM"] = "M\u00E9dia";
96
+ BeardSizes["SHORT"] = "Curta";
97
+ BeardSizes["MUSTACHE"] = "Bigode";
98
+ BeardSizes["NOTHING"] = "Sem Barba";
99
+ })(BeardSizes || (BeardSizes = {}));
100
+
101
+ var BeautyProductImportances;
102
+ (function (BeautyProductImportances) {
103
+ BeautyProductImportances["KNOW_LITTLE_ABOUT"] = "Conhe\u00E7o bem pouco de produtos de beleza e rotinas de cuidados";
104
+ BeautyProductImportances["ALREADY_BOUGHT_NOTHING_SPECIALIZED"] = "J\u00E1 comprei alguns produtos b\u00E1sicos para cuidar de mim, mas nada muito especializado";
105
+ BeautyProductImportances["GOOD_CARE_MYSELF"] = "Me considero um homem que se cuida bem. Conhe\u00E7o sobre produtos especializados e me preocupo em ter uma rotina de cuidados";
106
+ BeautyProductImportances["PERSONAL_CARE_EXPERT"] = "Sou um expert em cuidados pessoais";
107
+ })(BeautyProductImportances || (BeautyProductImportances = {}));
108
+
109
+ var BodyProblems;
110
+ (function (BodyProblems) {
111
+ BodyProblems["NO_WORRIES"] = "Sem preocupa\u00E7\u00F5es";
112
+ BodyProblems["FLACCIDITY"] = "Flacidez";
113
+ BodyProblems["LOCALIZED_FAT"] = "Gordura Localizada";
114
+ BodyProblems["STRETCH_MARKS"] = "Estrias";
115
+ BodyProblems["SENSITIVE_SKIN"] = "Pele Sens\u00EDvel";
116
+ BodyProblems["DRY_SKIN"] = "Pele Seca";
117
+ BodyProblems["OILY_ACNE"] = "Oleosa/Acne";
118
+ BodyProblems["SKIN_FRECKLES"] = "Pele com Sardas";
119
+ BodyProblems["PHOTOSENSITIVE_SKIN"] = "Pele Fotossens\u00EDvel";
120
+ })(BodyProblems || (BodyProblems = {}));
121
+
122
+ var BodyShapes;
123
+ (function (BodyShapes) {
124
+ BodyShapes["LEAN"] = "Magro";
125
+ BodyShapes["REGULAR"] = "Regular";
126
+ BodyShapes["OVERWEIGHT"] = "Acima do Peso";
127
+ BodyShapes["ATHLETIC"] = "Atl\u00E9tico";
128
+ BodyShapes["MUSCULAR"] = "Musculoso";
129
+ })(BodyShapes || (BodyShapes = {}));
130
+
131
+ var BodyTattoos;
132
+ (function (BodyTattoos) {
133
+ BodyTattoos["NONE"] = "Nenhuma";
134
+ BodyTattoos["HAS_DOESNT_CARE"] = "Tenho mas n\u00E3o cuido";
135
+ BodyTattoos["HAS_CARE_LOT"] = "Tenho e cuido bastante";
136
+ })(BodyTattoos || (BodyTattoos = {}));
137
+
138
+ var FaceSkinOilinesses;
139
+ (function (FaceSkinOilinesses) {
140
+ FaceSkinOilinesses["DRY"] = "Seca";
141
+ FaceSkinOilinesses["OILY"] = "Oleaosa";
142
+ FaceSkinOilinesses["MIXED"] = "Mista";
143
+ FaceSkinOilinesses["NORMAL"] = "Normal";
144
+ FaceSkinOilinesses["DONT_KNOW"] = "Eu n\u00E3o sei como dizer";
145
+ })(FaceSkinOilinesses || (FaceSkinOilinesses = {}));
146
+
147
+ var FaceSkinProblems;
148
+ (function (FaceSkinProblems) {
149
+ FaceSkinProblems["NO_PROBLEMS"] = "Sem problemas";
150
+ FaceSkinProblems["DARK_CIRCLES"] = "Olheiras";
151
+ FaceSkinProblems["WRINKLES"] = "Rugas";
152
+ FaceSkinProblems["BLACKHEADS_PIMPLES"] = "Cravos e Espinhas";
153
+ FaceSkinProblems["STAINS"] = "Manchas";
154
+ FaceSkinProblems["FRECKLES"] = "Sardas";
155
+ FaceSkinProblems["SENSITIVE"] = "Sens\u00EDvel";
156
+ FaceSkinProblems["PHOTOSENSITIVE"] = "Fotossens\u00EDvel";
157
+ })(FaceSkinProblems || (FaceSkinProblems = {}));
158
+
159
+ var FaceSkinTones;
160
+ (function (FaceSkinTones) {
161
+ FaceSkinTones["VERY_CLEAR"] = "Muito Clara";
162
+ FaceSkinTones["CLEAR"] = "Clara";
163
+ FaceSkinTones["MEDIUM_LIGHT"] = "Clara M\u00E9dia";
164
+ FaceSkinTones["MEDIUM_DARK"] = "Escura M\u00E9dia";
165
+ FaceSkinTones["DARK"] = "Escura";
166
+ FaceSkinTones["VERY_DARK"] = "Muito Escura";
167
+ })(FaceSkinTones || (FaceSkinTones = {}));
168
+
169
+ var FamilyIncomes;
170
+ (function (FamilyIncomes) {
171
+ FamilyIncomes["UNTIL_3000"] = "At\u00E9 R$3.000";
172
+ FamilyIncomes["SINCE_3001_TO_7000"] = "De R$3.001 a R$7.000";
173
+ FamilyIncomes["SINCE_7001_TO_10000"] = "De R$7.001 a R$10.000";
174
+ FamilyIncomes["SINCE_10001_TO_15000"] = "De R$10.001 a R$15.000";
175
+ FamilyIncomes["GRAN_THAN_15000"] = "Mais de R$15.000";
176
+ FamilyIncomes["NOW_ANSWER"] = "Prefiro nao responder";
177
+ })(FamilyIncomes || (FamilyIncomes = {}));
178
+
179
+ var FragranceImportances;
180
+ (function (FragranceImportances) {
181
+ FragranceImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
182
+ FragranceImportances["LIKE_ALWAYS_USE_SAME"] = "Gosto de perfumes, mas uso sempre os mesmos";
183
+ FragranceImportances["LIKE_INNOVATE"] = "Gosto de inovar e conhecer novas fragr\u00E2ncias";
184
+ })(FragranceImportances || (FragranceImportances = {}));
185
+
186
+ var HairColors;
187
+ (function (HairColors) {
188
+ HairColors["BLACK"] = "Preto";
189
+ HairColors["DARK_BROWN"] = "Castanho Escuro";
190
+ HairColors["LIGHT_BROWN"] = "Castanho Claro";
191
+ HairColors["DARK_BLONDE"] = "Loiro Escuro";
192
+ HairColors["LIGHT_BLONDE"] = "Loiro Claro";
193
+ HairColors["WHITE_GRAY"] = "Branco/Grisalho";
194
+ HairColors["REDHEAD"] = "Ruivo";
195
+ HairColors["OTHER"] = "RuiOutroo";
196
+ })(HairColors || (HairColors = {}));
197
+
198
+ var HairProblems;
199
+ (function (HairProblems) {
200
+ HairProblems["NO_PROBLEMS"] = "Sem problemas";
201
+ HairProblems["DANCRUFF"] = "Caspa";
202
+ HairProblems["LOSS"] = "Queda";
203
+ HairProblems["OILY"] = "Oleosidade";
204
+ HairProblems["DRYNESS"] = "Ressecamento";
205
+ HairProblems["CHEMICAL"] = "Quimica";
206
+ HairProblems["WHITE_HAIR"] = "Cabelos Brancos";
207
+ HairProblems["REBEL_WIRES"] = "Fios Rebeldes";
208
+ })(HairProblems || (HairProblems = {}));
209
+
210
+ var HairStrands;
211
+ (function (HairStrands) {
212
+ HairStrands["NORMAL"] = "Fio Normal";
213
+ HairStrands["DRY"] = "Fio Seco";
214
+ HairStrands["OILY"] = "Fio Oleoso";
215
+ HairStrands["MIXED"] = "Fio Misto";
216
+ HairStrands["FINE"] = "Fio Fino";
217
+ HairStrands["THICK"] = "Fio Grosso";
218
+ })(HairStrands || (HairStrands = {}));
219
+
220
+ var HairTypes;
221
+ (function (HairTypes) {
222
+ HairTypes["Smooth"] = "Liso";
223
+ HairTypes["WAVY"] = "Ondulado";
224
+ HairTypes["CURLY"] = "Cacheado";
225
+ HairTypes["FRIZZY"] = "Crespo";
226
+ HairTypes["BALD"] = "Sou careca";
227
+ })(HairTypes || (HairTypes = {}));
228
+
229
+ var OfficePosition;
230
+ (function (OfficePosition) {
231
+ OfficePosition["Intern"] = "Estagi\u00E1rio";
232
+ OfficePosition["Analyst"] = "Analista";
233
+ OfficePosition["Manager"] = "Gerente";
234
+ OfficePosition["Director"] = "Diretor";
235
+ })(OfficePosition || (OfficePosition = {}));
236
+
237
+ var ProductSpents;
238
+ (function (ProductSpents) {
239
+ ProductSpents["UNTIL_50"] = "At\u00E9 R$50";
240
+ ProductSpents["SINCE_51_TO_100"] = "De R$51 a R$100";
241
+ ProductSpents["SINCE_101_TO_200"] = "De R$101 a R$200";
242
+ ProductSpents["SINCE_201_TO_300"] = "De R$201 a R$300";
243
+ ProductSpents["GRAN_THAN_300"] = "Mais de R$300";
244
+ ProductSpents["NOW_ANSWER"] = "Prefiro nao responder";
245
+ })(ProductSpents || (ProductSpents = {}));
246
+
247
+ var UserType;
248
+ (function (UserType) {
249
+ UserType["B2C"] = "Cliente Transacional";
250
+ UserType["GlamGirl"] = "Glamgirl";
251
+ UserType["MensBoy"] = "Mensboy";
252
+ UserType["B2B"] = "Company";
253
+ UserType["Collaborator"] = "Funcion\u00E1rio";
254
+ UserType["Influencer"] = "Influencer";
255
+ })(UserType || (UserType = {}));
256
+
257
+ var BillingStatus;
258
+ (function (BillingStatus) {
259
+ BillingStatus["PAYED"] = "PAGO";
260
+ })(BillingStatus || (BillingStatus = {}));
261
+
262
+ var EditionStatus;
263
+ (function (EditionStatus) {
264
+ EditionStatus["ALLOCATION_WAITING"] = "Aguardando aloca\u00E7\u00E3o";
265
+ EditionStatus["SHIPPED"] = "Enviado";
266
+ })(EditionStatus || (EditionStatus = {}));
267
+
268
+ var PaymentType;
269
+ (function (PaymentType) {
270
+ PaymentType["AQUISITION"] = "Aquisi\u00E7\u00E3o";
271
+ PaymentType["RENEWAL"] = "Renova\u00E7\u00E3o";
272
+ PaymentType["FREIGHT"] = "mudan\u00E7a de endere\u00E7o, Frete";
273
+ })(PaymentType || (PaymentType = {}));
274
+
275
+ var Status;
276
+ (function (Status) {
277
+ Status["ACTIVE"] = "active";
278
+ Status["CANCELLED"] = "Cancelado";
279
+ })(Status || (Status = {}));
280
+
281
+ class Edition extends BaseModel {
282
+ static get identifiersFields() {
283
+ return ['id', 'subscriptionId'];
284
+ }
285
+ }
286
+
287
+ class Payment extends BaseModel {
288
+ static get identifiersFields() {
289
+ return ['id'];
290
+ }
291
+ }
292
+ __decorate([
293
+ Expose({ name: 'refuse_reason' }),
294
+ __metadata("design:type", String)
295
+ ], Payment.prototype, "refuseReason", void 0);
296
+ __decorate([
297
+ Expose({ name: 'status_reason' }),
298
+ __metadata("design:type", String)
299
+ ], Payment.prototype, "statusReason", void 0);
300
+ __decorate([
301
+ Expose({ name: 'acquirer_response_code' }),
302
+ __metadata("design:type", String)
303
+ ], Payment.prototype, "acquirerResponseCode", void 0);
304
+ __decorate([
305
+ Expose({ name: 'acquirer_name' }),
306
+ __metadata("design:type", String)
307
+ ], Payment.prototype, "acquirerName", void 0);
308
+ __decorate([
309
+ Expose({ name: 'acquirer_id' }),
310
+ __metadata("design:type", String)
311
+ ], Payment.prototype, "acquirerId", void 0);
312
+ __decorate([
313
+ Expose({ name: 'authorization_code' }),
314
+ __metadata("design:type", String)
315
+ ], Payment.prototype, "authorizationCode", void 0);
316
+ __decorate([
317
+ Expose({ name: 'soft_descriptor' }),
318
+ __metadata("design:type", String)
319
+ ], Payment.prototype, "softDescriptor", void 0);
320
+ __decorate([
321
+ Expose({ name: 'date_created' }),
322
+ __metadata("design:type", String)
323
+ ], Payment.prototype, "dateCreated", void 0);
324
+ __decorate([
325
+ Expose({ name: 'date_updated' }),
326
+ __metadata("design:type", String)
327
+ ], Payment.prototype, "dateUpdated", void 0);
328
+ __decorate([
329
+ Expose({ name: 'authorized_amount' }),
330
+ __metadata("design:type", Number)
331
+ ], Payment.prototype, "authorizedAmount", void 0);
332
+ __decorate([
333
+ Expose({ name: 'paid_amount' }),
334
+ __metadata("design:type", Number)
335
+ ], Payment.prototype, "paidAmount", void 0);
336
+ __decorate([
337
+ Expose({ name: 'refunded_amount' }),
338
+ __metadata("design:type", Number)
339
+ ], Payment.prototype, "refundedAmount", void 0);
340
+ __decorate([
341
+ Expose({ name: 'card_holder_name' }),
342
+ __metadata("design:type", String)
343
+ ], Payment.prototype, "cardHolderName", void 0);
344
+ __decorate([
345
+ Expose({ name: 'card_last_digits' }),
346
+ __metadata("design:type", String)
347
+ ], Payment.prototype, "cardLastDigits", void 0);
348
+ __decorate([
349
+ Expose({ name: 'card_first_digits' }),
350
+ __metadata("design:type", String)
351
+ ], Payment.prototype, "cardFirstDigits", void 0);
352
+ __decorate([
353
+ Expose({ name: 'card_brand' }),
354
+ __metadata("design:type", String)
355
+ ], Payment.prototype, "cardBrand", void 0);
356
+ __decorate([
357
+ Expose({ name: 'card_pin_mode' }),
358
+ __metadata("design:type", String)
359
+ ], Payment.prototype, "cardPinMode", void 0);
360
+ __decorate([
361
+ Expose({ name: 'card_magstripe_fallback' }),
362
+ __metadata("design:type", Boolean)
363
+ ], Payment.prototype, "cardMagstripeFallback", void 0);
364
+ __decorate([
365
+ Expose({ name: 'cvm_pin' }),
366
+ __metadata("design:type", Boolean)
367
+ ], Payment.prototype, "cvmPin", void 0);
368
+ __decorate([
369
+ Expose({ name: 'postback_url' }),
370
+ __metadata("design:type", String)
371
+ ], Payment.prototype, "postbackUrl", void 0);
372
+ __decorate([
373
+ Expose({ name: 'payment_method' }),
374
+ __metadata("design:type", String)
375
+ ], Payment.prototype, "paymentMethod", void 0);
376
+ __decorate([
377
+ Expose({ name: 'capture_method' }),
378
+ __metadata("design:type", String)
379
+ ], Payment.prototype, "captureMethod", void 0);
380
+ __decorate([
381
+ Expose({ name: 'antifraud_score' }),
382
+ __metadata("design:type", String)
383
+ ], Payment.prototype, "antifraudScore", void 0);
384
+ __decorate([
385
+ Expose({ name: 'boleto_url' }),
386
+ __metadata("design:type", String)
387
+ ], Payment.prototype, "boletoUrl", void 0);
388
+ __decorate([
389
+ Expose({ name: 'boleto_barcode' }),
390
+ __metadata("design:type", String)
391
+ ], Payment.prototype, "boletoBarcode", void 0);
392
+ __decorate([
393
+ Expose({ name: 'boleto_expiration_date' }),
394
+ __metadata("design:type", String)
395
+ ], Payment.prototype, "boletoExpirationDate", void 0);
396
+ __decorate([
397
+ Expose({ name: 'subscription_id' }),
398
+ __metadata("design:type", String)
399
+ ], Payment.prototype, "subscriptionId", void 0);
400
+ __decorate([
401
+ Expose({ name: 'split_rules' }),
402
+ __metadata("design:type", String)
403
+ ], Payment.prototype, "splitRules", void 0);
404
+ __decorate([
405
+ Expose({ name: 'antifraud_metadata' }),
406
+ __metadata("design:type", Object)
407
+ ], Payment.prototype, "antifraudMetadata", void 0);
408
+ __decorate([
409
+ Expose({ name: 'reference_key' }),
410
+ __metadata("design:type", String)
411
+ ], Payment.prototype, "referenceKey", void 0);
412
+ __decorate([
413
+ Expose({ name: 'local_transaction_id' }),
414
+ __metadata("design:type", String)
415
+ ], Payment.prototype, "localTransactionId", void 0);
416
+ __decorate([
417
+ Expose({ name: 'local_time' }),
418
+ __metadata("design:type", String)
419
+ ], Payment.prototype, "localTime", void 0);
420
+ __decorate([
421
+ Expose({ name: 'fraud_covered' }),
422
+ __metadata("design:type", Boolean)
423
+ ], Payment.prototype, "fraudCovered", void 0);
424
+ __decorate([
425
+ Expose({ name: 'fraud_reimbursed' }),
426
+ __metadata("design:type", String)
427
+ ], Payment.prototype, "fraudReimbursed", void 0);
428
+ __decorate([
429
+ Expose({ name: 'order_id' }),
430
+ __metadata("design:type", String)
431
+ ], Payment.prototype, "orderId", void 0);
432
+ __decorate([
433
+ Expose({ name: 'risk_level' }),
434
+ __metadata("design:type", String)
435
+ ], Payment.prototype, "riskLevel", void 0);
436
+ __decorate([
437
+ Expose({ name: 'receipt_url' }),
438
+ __metadata("design:type", String)
439
+ ], Payment.prototype, "receiptUrl", void 0);
440
+ __decorate([
441
+ Expose({ name: 'private_label' }),
442
+ __metadata("design:type", String)
443
+ ], Payment.prototype, "privateLabel", void 0);
444
+ __decorate([
445
+ Expose({ name: 'pix_qr_code' }),
446
+ __metadata("design:type", String)
447
+ ], Payment.prototype, "pixQrCode", void 0);
448
+ __decorate([
449
+ Expose({ name: 'pix_expiration_date' }),
450
+ __metadata("design:type", String)
451
+ ], Payment.prototype, "pixExpirationDate", void 0);
452
+
453
+ class SubscriptionPayment extends BaseModel {
454
+ static get identifiersFields() {
455
+ return ['id', 'subscriptionId'];
456
+ }
457
+ }
458
+ __decorate([
459
+ Type(() => Payment),
460
+ __metadata("design:type", Payment)
461
+ ], SubscriptionPayment.prototype, "payment", void 0);
462
+
463
+ class Address extends BaseModel {
464
+ static get identifiersFields() {
465
+ return ['id'];
466
+ }
467
+ }
468
+
469
+ class Base {
470
+ constructor(...args) {
471
+ Object.assign(this, ...args);
472
+ }
473
+ }
474
+
475
+ const isUUID = (value) => 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);
476
+
477
+ const parseDateTime = (value) => {
478
+ if (!isString(value))
479
+ return value;
480
+ if (!/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.test(value) &&
481
+ !/^\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))
482
+ return value;
483
+ const date = parseISO(value);
484
+ if (isNaN(date.getTime()))
485
+ return value;
486
+ return date;
487
+ };
488
+
489
+ var CheckoutTypes;
490
+ (function (CheckoutTypes) {
491
+ CheckoutTypes[CheckoutTypes["ECOMMERCE"] = 1] = "ECOMMERCE";
492
+ CheckoutTypes[CheckoutTypes["SUBSCRIPTION"] = 2] = "SUBSCRIPTION";
493
+ CheckoutTypes[CheckoutTypes["ALL"] = 3] = "ALL";
494
+ })(CheckoutTypes || (CheckoutTypes = {}));
495
+
496
+ var CouponTypes;
497
+ (function (CouponTypes) {
498
+ CouponTypes[CouponTypes["ABSOLUTE"] = 1] = "ABSOLUTE";
499
+ CouponTypes[CouponTypes["PERCENTAGE"] = 2] = "PERCENTAGE";
500
+ // FINANCIAL = 1,
501
+ // PRODUCT,
502
+ // GIFTCARD,
503
+ // VOUCHER,
504
+ })(CouponTypes || (CouponTypes = {}));
505
+
506
+ var CouponSubtypes;
507
+ (function (CouponSubtypes) {
508
+ CouponSubtypes[CouponSubtypes["ABSOLUTE"] = 1] = "ABSOLUTE";
509
+ CouponSubtypes[CouponSubtypes["PERCENTAGE"] = 2] = "PERCENTAGE";
510
+ })(CouponSubtypes || (CouponSubtypes = {}));
511
+
512
+ var Exclusivities;
513
+ (function (Exclusivities) {
514
+ Exclusivities[Exclusivities["ALL_USERS"] = 1] = "ALL_USERS";
515
+ Exclusivities[Exclusivities["SPECIFIC_USER"] = 2] = "SPECIFIC_USER";
516
+ Exclusivities[Exclusivities["COLLABORATORS"] = 3] = "COLLABORATORS";
517
+ Exclusivities[Exclusivities["ACTIVE_SUBSCRIBER"] = 4] = "ACTIVE_SUBSCRIBER";
518
+ Exclusivities[Exclusivities["INACTIVE_SUBSCRIBER"] = 5] = "INACTIVE_SUBSCRIBER";
519
+ Exclusivities[Exclusivities["NON_SUBSCRIBER"] = 6] = "NON_SUBSCRIBER";
520
+ })(Exclusivities || (Exclusivities = {}));
521
+
522
+ const COUPON_EXPIRATION = +1000 * 60 * 60 * 24 * 30;
523
+ class Coupon extends BaseModel {
524
+ get isInfluencer() {
525
+ return !isNil(this.influencerEmail);
526
+ }
527
+ static get identifiersFields() {
528
+ return ['id'];
529
+ }
530
+ static createCoupon(userId) {
531
+ return this.toInstance({
532
+ nickname: `${Date.now()}`,
533
+ type: CouponTypes.ABSOLUTE,
534
+ checkoutType: CheckoutTypes.ECOMMERCE,
535
+ discount: 30,
536
+ user: userId,
537
+ useLimit: 1,
538
+ useLimitPerUser: true,
539
+ createdAt: new Date(Date.now()),
540
+ beginAt: new Date(Date.now()),
541
+ expiresIn: new Date(Date.now() + COUPON_EXPIRATION),
542
+ });
543
+ }
544
+ }
545
+ __decorate([
546
+ Expose({ name: 'checkout_type' }),
547
+ __metadata("design:type", Number)
548
+ ], Coupon.prototype, "checkoutType", void 0);
549
+ __decorate([
550
+ Expose({ name: 'exclusivity_type' }),
551
+ __metadata("design:type", Number)
552
+ ], Coupon.prototype, "exclusivityType", void 0);
553
+
554
+ class SubscriptionPlan extends BaseModel {
555
+ static get identifiersFields() {
556
+ return ['id'];
557
+ }
558
+ }
559
+
560
+ class BeautyProfile extends BaseModel {
561
+ toPlain() {
562
+ const plain = super.toPlain();
563
+ delete plain.id;
564
+ return plain;
565
+ }
566
+ static get identifiersFields() {
567
+ return ['id', 'userId'];
568
+ }
569
+ }
570
+
571
+ class User extends BaseModel {
572
+ static toInstance(data) {
573
+ const instance = super.toInstance(data);
574
+ if (!isNil(data.firstName))
575
+ instance.displayName = `${data.firstName}${!isNil(data.lastName) ? ` ${data.lastName}` : ''}`;
576
+ return instance;
577
+ }
578
+ toPlain() {
579
+ const plain = super.toPlain();
580
+ delete plain.beautyProfile;
581
+ return plain;
582
+ }
583
+ static get identifiersFields() {
584
+ return ['id'];
585
+ }
586
+ }
587
+ __decorate([
588
+ Type(() => BeautyProfile),
589
+ __metadata("design:type", BeautyProfile)
590
+ ], User.prototype, "beautyProfile", void 0);
591
+
592
+ class Subscription extends BaseModel {
593
+ static get identifiersFields() {
594
+ return ['id'];
595
+ }
596
+ }
597
+ __decorate([
598
+ Type(() => User),
599
+ __metadata("design:type", User)
600
+ ], Subscription.prototype, "user", void 0);
601
+ __decorate([
602
+ Type(() => SubscriptionPlan),
603
+ __metadata("design:type", SubscriptionPlan)
604
+ ], Subscription.prototype, "subscriptionPlan", void 0);
605
+ __decorate([
606
+ Type(() => Address),
607
+ __metadata("design:type", Address)
608
+ ], Subscription.prototype, "shippingAddress", void 0);
609
+ __decorate([
610
+ Type(() => Address),
611
+ __metadata("design:type", Address)
612
+ ], Subscription.prototype, "billingAddress", void 0);
613
+ __decorate([
614
+ Type(() => Coupon),
615
+ __metadata("design:type", Coupon)
616
+ ], Subscription.prototype, "coupon", void 0);
617
+ __decorate([
618
+ Type(() => Edition),
619
+ __metadata("design:type", Array)
620
+ ], Subscription.prototype, "editions", void 0);
621
+ __decorate([
622
+ Type(() => SubscriptionPayment),
623
+ __metadata("design:type", Array)
624
+ ], Subscription.prototype, "payment", void 0);
625
+
626
+ class UserAddress extends Address {
627
+ static get identifiersFields() {
628
+ return ['id', 'userId'];
629
+ }
630
+ }
631
+
632
+ class UserPaymentMethod extends BaseModel {
633
+ static get identifiersFields() {
634
+ return ['id', 'userId'];
635
+ }
636
+ }
637
+
638
+ class Lead extends BaseModel {
639
+ static get identifiersFields() {
640
+ return ['id'];
641
+ }
642
+ }
643
+
644
+ class UnauthorizedError extends CustomError {
645
+ constructor(message) {
646
+ super(message);
647
+ this.message = message;
648
+ }
649
+ }
650
+
651
+ var SignInMethods;
652
+ (function (SignInMethods) {
653
+ SignInMethods["EMAIL_PASSWORD"] = "email_password";
654
+ SignInMethods["GOOGLE"] = "google";
655
+ })(SignInMethods || (SignInMethods = {}));
656
+ class Authentication {
657
+ constructor(authService, userRepository) {
658
+ this.authService = authService;
659
+ this.userRepository = userRepository;
660
+ }
661
+ async signIn({ email, password }, signInMethod) {
662
+ const method = this.getServiceByMethod(signInMethod);
663
+ const userAuth = await this.authService[method]({ email, password });
664
+ const user = this.userRepository.get(userAuth);
665
+ if (!isNil(user))
666
+ return user;
667
+ if (/^.+@b4a.com.br$/.test(userAuth.email))
668
+ return this.createsUserByCredential(userAuth);
669
+ throw new UnauthorizedError('Invalid credentials');
670
+ }
671
+ getServiceByMethod(signInMethod) {
672
+ return signInMethod === SignInMethods.EMAIL_PASSWORD ? 'signInWithEmailAndPassword' : 'signInWithGoogle';
673
+ }
674
+ async createsUserByCredential(user) {
675
+ const [firstName, lastName] = user.displayName?.split(/\s/);
676
+ const person = User.toInstance({
677
+ ...user,
678
+ cpf: '',
679
+ birthday: new Date(),
680
+ firstName,
681
+ lastName,
682
+ acceptsNewsletter: false,
683
+ area: Area.Transactional,
684
+ officePosition: OfficePosition.Intern,
685
+ type: UserType.Collaborator,
686
+ });
687
+ return this.userRepository.create(person);
688
+ }
689
+ }
690
+
691
+ class UserAlreadyRegisteredError extends CustomError {
692
+ constructor(message) {
693
+ super(message);
694
+ this.message = message;
695
+ }
696
+ }
697
+
698
+ class WeakPasswordError extends CustomError {
699
+ constructor(message = 'Weak password') {
700
+ super(message);
701
+ this.message = message;
702
+ }
703
+ }
704
+
705
+ class Register {
706
+ constructor(registerService, userRepository) {
707
+ this.registerService = registerService;
708
+ this.userRepository = userRepository;
709
+ }
710
+ async register(params) {
711
+ const email = params.email.toLocaleLowerCase();
712
+ const displayName = `${params.firstName} ${params.lastName}`;
713
+ if (await this.userRepository.checkIfExistsByField('cpf', params.cpf))
714
+ throw new UserAlreadyRegisteredError(`Usuário com CPF ${params.cpf} já registrado.`);
715
+ if (await this.userRepository.checkIfExistsByField('email', params.email))
716
+ throw new UserAlreadyRegisteredError(`Usuário com e-mail ${params.email} já registrado.`);
717
+ const auth = await this.registerService.register({
718
+ birthday: params.birthday,
719
+ email,
720
+ firstName: params.firstName,
721
+ lastName: params.lastName,
722
+ cpf: params.cpf,
723
+ displayName,
724
+ phone: params.phone,
725
+ password: params.password,
726
+ });
727
+ delete params.password;
728
+ const user = await this.userRepository.create({
729
+ ...params,
730
+ id: auth.id,
731
+ email,
732
+ displayName,
733
+ type: UserType.B2C,
734
+ dateCreated: new Date(),
735
+ dateModified: new Date(),
736
+ });
737
+ return user;
738
+ }
739
+ }
740
+
741
+ class SignOut {
742
+ constructor(authService) {
743
+ this.authService = authService;
744
+ }
745
+ async signOut() {
746
+ await this.authService.signOut();
747
+ }
748
+ }
749
+
750
+ class RecoveryPassword {
751
+ constructor(authService) {
752
+ this.authService = authService;
753
+ }
754
+ async sendEmail(email) {
755
+ await this.authService.sendPasswordResetEmail(email);
756
+ }
757
+ }
758
+
759
+ class Category extends BaseModel {
760
+ identifierFields() {
761
+ return ['id'];
762
+ }
763
+ static get identifiersFields() {
764
+ return ['id'];
765
+ }
766
+ }
767
+
768
+ var GenderDestination;
769
+ (function (GenderDestination) {
770
+ GenderDestination["FEMALE"] = "female";
771
+ GenderDestination["MALE"] = "male";
772
+ GenderDestination["UNISEX"] = "unisex";
773
+ })(GenderDestination || (GenderDestination = {}));
774
+
775
+ var Shops;
776
+ (function (Shops) {
777
+ Shops["MENSMARKET"] = "mensmarket";
778
+ Shops["GLAMSHOP"] = "Glamshop";
779
+ Shops["GLAMPOINTS"] = "Glampoints";
780
+ Shops["ALL"] = "ALL";
781
+ })(Shops || (Shops = {}));
782
+
783
+ class Product extends BaseModel {
784
+ identifierFields() {
785
+ return ['id'];
786
+ }
787
+ static get identifiersFields() {
788
+ return ['id'];
789
+ }
790
+ }
791
+ __decorate([
792
+ Type(() => KitProduct),
793
+ __metadata("design:type", Array)
794
+ ], Product.prototype, "kitProducts", void 0);
795
+
796
+ class KitProduct extends BaseModel {
797
+ static get identifiersFields() {
798
+ return ['productId', 'kitProducId'];
799
+ }
800
+ }
801
+ __decorate([
802
+ Type(() => Product),
803
+ __metadata("design:type", Product)
804
+ ], KitProduct.prototype, "kit", void 0);
805
+ __decorate([
806
+ Type(() => Product),
807
+ __metadata("design:type", Product)
808
+ ], KitProduct.prototype, "product", void 0);
809
+
810
+ class Variant extends BaseModel {
811
+ identifierFields() {
812
+ return ['id'];
813
+ }
814
+ static get identifiersFields() {
815
+ return ['id', 'productId'];
816
+ }
817
+ }
818
+
819
+ var OrderStatus;
820
+ (function (OrderStatus) {
821
+ OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
822
+ OrderStatus["EM_PREPARO"] = "Preparando pedido";
823
+ OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
824
+ OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
825
+ OrderStatus["ENVIADO"] = "Enviado";
826
+ OrderStatus["ENTREGUE"] = "Entregue";
827
+ OrderStatus["CANCELADO"] = "Cancelado";
828
+ OrderStatus["CREDIT_CARD"] = "credit_card";
829
+ })(OrderStatus || (OrderStatus = {}));
830
+
831
+ class LineItem extends Product {
832
+ }
833
+
834
+ class ShippingMethod extends BaseModel {
835
+ static get identifiersFields() {
836
+ return ['id'];
837
+ }
838
+ }
839
+
840
+ class Checkout extends BaseModel {
841
+ static get identifiersFields() {
842
+ return ['id'];
843
+ }
844
+ }
845
+ __decorate([
846
+ Type(() => LineItem),
847
+ __metadata("design:type", Array)
848
+ ], Checkout.prototype, "lineItems", void 0);
849
+ __decorate([
850
+ Type(() => User),
851
+ __metadata("design:type", User)
852
+ ], Checkout.prototype, "user", void 0);
853
+ __decorate([
854
+ Type(() => Address),
855
+ __metadata("design:type", Address)
856
+ ], Checkout.prototype, "shippingAddress", void 0);
857
+ __decorate([
858
+ Type(() => Address),
859
+ __metadata("design:type", Address)
860
+ ], Checkout.prototype, "billingAddress", void 0);
861
+ __decorate([
862
+ Type(() => ShippingMethod),
863
+ __metadata("design:type", ShippingMethod)
864
+ ], Checkout.prototype, "shipping", void 0);
865
+ __decorate([
866
+ Type(() => Coupon),
867
+ __metadata("design:type", Coupon)
868
+ ], Checkout.prototype, "coupon", void 0);
869
+
870
+ class Order extends Checkout {
871
+ }
872
+ __decorate([
873
+ Type(() => Payment),
874
+ __metadata("design:type", Payment)
875
+ ], Order.prototype, "payment", void 0);
876
+
877
+ class CheckoutSubscription extends BaseModel {
878
+ static get identifiersFields() {
879
+ return ['id'];
880
+ }
881
+ }
882
+ __decorate([
883
+ Type(() => Address),
884
+ __metadata("design:type", Address)
885
+ ], CheckoutSubscription.prototype, "shippingAddress", void 0);
886
+ __decorate([
887
+ Type(() => Address),
888
+ __metadata("design:type", Address)
889
+ ], CheckoutSubscription.prototype, "billingAddress", void 0);
890
+ __decorate([
891
+ Type(() => SubscriptionPlan),
892
+ __metadata("design:type", SubscriptionPlan)
893
+ ], CheckoutSubscription.prototype, "subscriptionPlan", void 0);
894
+ __decorate([
895
+ Type(() => Coupon),
896
+ __metadata("design:type", Coupon)
897
+ ], CheckoutSubscription.prototype, "coupon", void 0);
898
+
899
+ class Buy2Win extends BaseModel {
900
+ static get identifiersFields() {
901
+ return ['id'];
902
+ }
903
+ }
904
+ __decorate([
905
+ Type(() => Category),
906
+ __metadata("design:type", Array)
907
+ ], Buy2Win.prototype, "categories", void 0);
908
+
909
+ var FilterType;
910
+ (function (FilterType) {
911
+ FilterType["ACCESSORY_IMPORTANCE"] = "accessoryImportance";
912
+ FilterType["BEARD_PROBLEMS"] = "beardProblems";
913
+ FilterType["BEARD_SIZE"] = "beardSize";
914
+ FilterType["BEAUTY_PRODUCT_IMPORTANCE"] = "beautyProductImportance";
915
+ FilterType["BODY_PROBLEMS"] = "bodyProblems";
916
+ FilterType["BODY_SHAPE"] = "bodyShape";
917
+ FilterType["BODY_TATTOOS"] = "bodyTattoos";
918
+ FilterType["FACE_SKIN_OILINESS"] = "faceSkinOiliness";
919
+ FilterType["FACE_SKIN_PROBLEMS"] = "faceSkinProblems";
920
+ FilterType["FACE_SKIN_TONE"] = "faceSkinTone";
921
+ FilterType["FAMILY_INCOME"] = "familyIncome";
922
+ FilterType["FRAGRANCE_IMPORTANCE"] = "fragranceImportance";
923
+ FilterType["HAIR_COLOR"] = "hairColor";
924
+ FilterType["HAIR_PROBLEMS"] = "hairProblems";
925
+ FilterType["HAIR_STRANDS"] = "hairStrands";
926
+ FilterType["HAIR_TYPE"] = "hairType";
927
+ FilterType["PRODUCT_SPENT"] = "productSpent";
928
+ })(FilterType || (FilterType = {}));
929
+
930
+ var QuestionsFilters;
931
+ (function (QuestionsFilters) {
932
+ QuestionsFilters["ACCESSORY_IMPORTANCE"] = "Voc\u00EA gosta de usar acess\u00F3rios masculinos?";
933
+ QuestionsFilters["BEARD_PROBLEMS"] = "Quais problemas de barba voc\u00EA tem?";
934
+ QuestionsFilters["BEARD_SIZE"] = "Quais caracteristicas se aplicam \u00E0 sua BARBA/BIGODE?";
935
+ QuestionsFilters["BEAUTY_PRODUCT_IMPORTANCE"] = "O que descreve melhor a sua rela\u00E7\u00E3o com produtos de beleza e cuidados pessoais?";
936
+ QuestionsFilters["BODY_PROBLEMS"] = "Qual ou quais preocupa\u00E7\u00F5es voc\u00EA tem com a pele do seu corpo?";
937
+ QuestionsFilters["BODY_SHAPE"] = "Qual e seu tipo de CORPO?";
938
+ QuestionsFilters["BODY_TATTOOS"] = "Voc\u00EA tem alguma tatuagem?";
939
+ QuestionsFilters["FACE_SKIN_OILINESS"] = "Quais caracteristicas se aplicam \u00E0 pele do seu ROSTO?";
940
+ QuestionsFilters["FACE_SKIN_PROBLEMS"] = "Quais problemas a pele do seu rosto tem?";
941
+ QuestionsFilters["FACE_SKIN_TONE"] = "Qual seu tom de pele?";
942
+ QuestionsFilters["FAMILY_INCOME"] = "Qual a sua renda familiar mensal (considerando a renda de todas as pessoas que moram com voc\u00EA)?";
943
+ QuestionsFilters["FRAGRANCE_IMPORTANCE"] = "O quanto voc\u00EA gosta de experimentar perfumes?";
944
+ QuestionsFilters["HAIR_COLOR"] = "Seu cabelo \u00E9 naturalmente de qual COR?";
945
+ QuestionsFilters["HAIR_PROBLEMS"] = "Qual ou quais problemas/caracter\u00EDstica de cabelo te preocupam?";
946
+ QuestionsFilters["HAIR_STRANDS"] = "Como s\u00E3o seus fios?";
947
+ QuestionsFilters["HAIR_TYPE"] = "Como \u00E9 o seu cabelo?";
948
+ QuestionsFilters["PRODUCT_SPENT"] = "Qual \u00E9 o seu nivel de gasto mensal em produtos de beleza e cuidados pessoais?";
949
+ })(QuestionsFilters || (QuestionsFilters = {}));
950
+
951
+ class BeautyQuestionsHelper {
952
+ static getAnswers(filter) {
953
+ switch (filter) {
954
+ case FilterType.ACCESSORY_IMPORTANCE:
955
+ return AccessoryImportances;
956
+ case FilterType.BEARD_PROBLEMS:
957
+ return BeardProblems;
958
+ case FilterType.BEARD_SIZE:
959
+ return BeardSizes;
960
+ case FilterType.BEAUTY_PRODUCT_IMPORTANCE:
961
+ return BeautyProductImportances;
962
+ case FilterType.BODY_PROBLEMS:
963
+ return BodyProblems;
964
+ case FilterType.BODY_SHAPE:
965
+ return BodyShapes;
966
+ case FilterType.BODY_TATTOOS:
967
+ return BodyTattoos;
968
+ case FilterType.FACE_SKIN_OILINESS:
969
+ return FaceSkinOilinesses;
970
+ case FilterType.FACE_SKIN_PROBLEMS:
971
+ return FaceSkinProblems;
972
+ case FilterType.FACE_SKIN_TONE:
973
+ return FaceSkinTones;
974
+ case FilterType.FAMILY_INCOME:
975
+ return FamilyIncomes;
976
+ case FilterType.FRAGRANCE_IMPORTANCE:
977
+ return FragranceImportances;
978
+ case FilterType.HAIR_COLOR:
979
+ return HairColors;
980
+ case FilterType.HAIR_PROBLEMS:
981
+ return HairProblems;
982
+ case FilterType.HAIR_STRANDS:
983
+ return HairStrands;
984
+ case FilterType.HAIR_TYPE:
985
+ return HairTypes;
986
+ case FilterType.PRODUCT_SPENT:
987
+ return ProductSpents;
988
+ }
989
+ }
990
+ static getQuestions(filter) {
991
+ return QuestionsFilters[filter];
992
+ }
993
+ }
994
+
995
+ class Home extends BaseModel {
996
+ static get identifiersFields() {
997
+ return ['id'];
998
+ }
999
+ }
1000
+
1001
+ class ShopMenu extends BaseModel {
1002
+ static get identifiersFields() {
1003
+ return ['id'];
1004
+ }
1005
+ }
1006
+
1007
+ class InvalidArgumentError extends CustomError {
1008
+ constructor(message) {
1009
+ super(message);
1010
+ this.message = message;
1011
+ }
1012
+ }
1013
+
1014
+ class RequiredArgumentError extends CustomError {
1015
+ constructor(args) {
1016
+ super(`Required arguments: ${args.join(', ')}`);
1017
+ this.args = args;
1018
+ this.arguments = args;
1019
+ }
1020
+ }
1021
+
1022
+ class NotFoundError extends CustomError {
1023
+ constructor(message) {
1024
+ super(message);
1025
+ this.message = message;
1026
+ }
1027
+ }
1028
+
1029
+ class DuplicatedResultsError extends CustomError {
1030
+ constructor(message) {
1031
+ super(message);
1032
+ this.message = message;
1033
+ }
1034
+ }
1035
+
1036
+ class AxiosAdapter {
1037
+ constructor(config) {
1038
+ this.config = config;
1039
+ }
1040
+ async get(index) {
1041
+ try {
1042
+ const { data } = await axios({
1043
+ url: `${this.config.url}/${index}`,
1044
+ method: 'GET',
1045
+ headers: { Authorization: `Basic ${this.config.credential}` },
1046
+ });
1047
+ return data._source;
1048
+ }
1049
+ catch (error) {
1050
+ throw new NotFoundError(error.message);
1051
+ }
1052
+ }
1053
+ async query(index, query) {
1054
+ const { data } = await axios({
1055
+ url: `${this.config.url}/${index}`,
1056
+ method: 'POST',
1057
+ headers: { Authorization: `Basic ${this.config.credential}` },
1058
+ data: query,
1059
+ });
1060
+ return {
1061
+ total: data.hits.total.value,
1062
+ hits: data.hits.hits,
1063
+ };
1064
+ }
1065
+ async save(index, data) {
1066
+ await axios({
1067
+ url: `${this.config.url}/${index}`,
1068
+ method: 'PUT',
1069
+ headers: { Authorization: `Basic ${this.config.credential}` },
1070
+ data,
1071
+ });
1072
+ }
1073
+ async delete(index) {
1074
+ await axios({
1075
+ url: `${this.config.url}/${index}`,
1076
+ method: 'DELETE',
1077
+ headers: { Authorization: `Basic ${this.config.credential}` },
1078
+ });
1079
+ }
1080
+ }
1081
+
1082
+ class ProductsIndex {
1083
+ constructor(adapter) {
1084
+ this.adapter = adapter;
1085
+ }
1086
+ async get(id) {
1087
+ const data = await this.adapter.get(`products/_doc/${id}`);
1088
+ return Product.toInstance(data);
1089
+ }
1090
+ async findById(ids, options) {
1091
+ const fields = [
1092
+ 'brand',
1093
+ 'id',
1094
+ 'images',
1095
+ 'miniatures',
1096
+ 'name',
1097
+ 'price',
1098
+ 'sku',
1099
+ 'stock',
1100
+ 'slug',
1101
+ 'reviews',
1102
+ 'pricePaid',
1103
+ 'isGift',
1104
+ 'stock',
1105
+ 'weight',
1106
+ 'tags',
1107
+ 'hasVariants',
1108
+ 'type'
1109
+ ];
1110
+ const { hits } = await this.adapter.query('products/_search', {
1111
+ _source: fields,
1112
+ query: {
1113
+ bool: {
1114
+ filter: [
1115
+ {
1116
+ terms: {
1117
+ _id: ids,
1118
+ },
1119
+ },
1120
+ {
1121
+ term: {
1122
+ published: true,
1123
+ },
1124
+ },
1125
+ ...(options.hasStock
1126
+ ? [
1127
+ {
1128
+ range: {
1129
+ 'stock.quantity': {
1130
+ gt: 0,
1131
+ },
1132
+ },
1133
+ },
1134
+ ]
1135
+ : []),
1136
+ ],
1137
+ },
1138
+ },
1139
+ ...(options.size ? { size: options.size } : {}),
1140
+ });
1141
+ return hits.map((hit) => Product.toInstance(hit._source));
1142
+ }
1143
+ async save(product) {
1144
+ delete product.createdAt;
1145
+ delete product.updatedAt;
1146
+ delete product.kitProducts;
1147
+ try {
1148
+ if (!product.firestoreId)
1149
+ throw new Error('Is not a product from firestore');
1150
+ await this.get(product.firestoreId);
1151
+ await this.adapter.save(`products/_doc/${product.firestoreId}`, product.toPlain());
1152
+ }
1153
+ catch (error) {
1154
+ console.error(error.message);
1155
+ await this.adapter.save(`products/_doc/${product.id}`, product.toPlain());
1156
+ }
1157
+ }
1158
+ async delete(product) {
1159
+ try {
1160
+ await this.get(product.firestoreId);
1161
+ await this.adapter.delete(`products/_doc/${product.firestoreId}`);
1162
+ }
1163
+ catch (error) {
1164
+ await this.adapter.delete(`products/_doc/${product.id}`);
1165
+ }
1166
+ }
1167
+ }
1168
+
1169
+ const withFirestore = (MixinBase) => {
1170
+ const isObjectsAndNoDate = (data) => data &&
1171
+ !Array.isArray(data) &&
1172
+ typeof data === 'object' &&
1173
+ data?.constructor.name !== 'Timestamp' &&
1174
+ !('seconds' in data);
1175
+ const bindDate = (data, keyName) => {
1176
+ if (data?.constructor.name === 'Timestamp')
1177
+ return data.toDate();
1178
+ if (data && typeof data === 'object' && 'seconds' in data)
1179
+ return new Date(data.seconds * 1000);
1180
+ if (typeof data === 'number' && ['createdAt', 'updatedAt'].includes(keyName))
1181
+ return new Date(data);
1182
+ return data;
1183
+ };
1184
+ const bindAllDateFromObject = (data) => {
1185
+ return Object.keys(data).reduce((object, key) => ({
1186
+ ...object,
1187
+ [key]: isObjectsAndNoDate(data[key])
1188
+ ? bindAllDateFromObject(data[key])
1189
+ : Array.isArray(data[key])
1190
+ ? data[key].map((element) => (isObjectsAndNoDate(element) ? bindAllDateFromObject(element) : element))
1191
+ : bindDate(data[key], key),
1192
+ }), {});
1193
+ };
1194
+ return class extends MixinBase {
1195
+ collection(path) {
1196
+ return this.firestore.collection(path || this.collectionName).withConverter(this.buildModelInstance());
1197
+ }
1198
+ buildModelInstance() {
1199
+ return {
1200
+ toFirestore: (data) => (data?.toPlain ? data.toPlain() : data),
1201
+ fromFirestore: (snap) => {
1202
+ const data = snap.data();
1203
+ let bindedData;
1204
+ try {
1205
+ const ids = { id: snap.id };
1206
+ bindedData = bindAllDateFromObject(data);
1207
+ return this.model.toInstance({ ...bindedData, ...ids });
1208
+ }
1209
+ catch (error) {
1210
+ console.info('id', snap.id);
1211
+ console.info('data', JSON.stringify(bindedData));
1212
+ console.error(error);
1213
+ throw error;
1214
+ }
1215
+ },
1216
+ };
1217
+ }
1218
+ };
1219
+ };
1220
+
1221
+ const withHelpers = (MixinBase) => {
1222
+ return class extends MixinBase {
1223
+ toArray(snapShot) {
1224
+ if (Array.isArray(snapShot)) {
1225
+ return snapShot.map((doc) => doc.data());
1226
+ }
1227
+ else {
1228
+ return snapShot.docs.map((doc) => doc.data());
1229
+ }
1230
+ }
1231
+ isSubCollection(repository) {
1232
+ return !isNil(Object.keys(this).find((key) => key === 'parentRepository'));
1233
+ }
1234
+ };
1235
+ };
1236
+
1237
+ const withGetFirestore = (MixinBase) => {
1238
+ return class GetFirestore extends MixinBase {
1239
+ async get(identifiers) {
1240
+ const doc = await this.collection(this.buildCollectionPathForGet(identifiers))
1241
+ .doc(Object.values(identifiers).shift().toString())
1242
+ .get();
1243
+ const data = doc.data();
1244
+ if (isNil(data))
1245
+ throw new NotFoundError(`Document ${JSON.stringify(identifiers)} not found`);
1246
+ return data;
1247
+ }
1248
+ buildCollectionPathForGet(identifiers) {
1249
+ return this.isSubCollection(this)
1250
+ ? `${this.parentRepository.collectionName}/${identifiers[this.parentIdField]}/${this.collectionName}`
1251
+ : this.collectionName;
1252
+ }
1253
+ };
1254
+ };
1255
+
1256
+ var FirestoreFieldType;
1257
+ (function (FirestoreFieldType) {
1258
+ FirestoreFieldType["String"] = "string";
1259
+ FirestoreFieldType["Number"] = "number";
1260
+ FirestoreFieldType["Boolean"] = "boolean";
1261
+ FirestoreFieldType["Timestamp"] = "timestamp";
1262
+ FirestoreFieldType["Array"] = "array";
1263
+ FirestoreFieldType["Map"] = "map";
1264
+ })(FirestoreFieldType || (FirestoreFieldType = {}));
1265
+
1266
+ const withFindFirestore = (MixinBase) => {
1267
+ const checkIfIsFilterOption = (filter) => !isNil(filter?.operator);
1268
+ const getValueFromFilter = (filter) => {
1269
+ return checkIfIsFilterOption(filter) ? filter.value : filter;
1270
+ };
1271
+ const getFinalValueFrom = (value) => isNumber(value) || isString(value) || isDate(value) || Array.isArray(value)
1272
+ ? value
1273
+ : Object.values(getFinalValueFrom);
1274
+ return class FindFirestore extends MixinBase {
1275
+ constructor() {
1276
+ super(...arguments);
1277
+ this.makeFirestoreWhere = (queryReference, filter) => Object.keys(filter).reduce((query, fieldName) => this.buildWhereSentence(query, fieldName, filter[fieldName]), queryReference);
1278
+ this.buildWhereSentence = (queryReference, fieldName, options) => {
1279
+ if (this.isSubCollection(this) && fieldName === this.parentIdField)
1280
+ return queryReference;
1281
+ const value = options?.value || options;
1282
+ const object = {};
1283
+ set(object, fieldName, value);
1284
+ const plainInstance = new this.model(object).toPlain();
1285
+ const firestoreFieldName = fieldName.toString().indexOf('.') > -1
1286
+ ? fieldName.toString()
1287
+ : Object.keys(plainInstance).find((key) => plainInstance[key]);
1288
+ if (options?.operator === Where.LIKE) {
1289
+ if (Array.isArray(options?.value) &&
1290
+ (this.fields[firestoreFieldName] === FirestoreFieldType.Array || !this.fields[firestoreFieldName]))
1291
+ return queryReference.where(firestoreFieldName, 'array-contains-any', options.value);
1292
+ queryReference = queryReference.where(firestoreFieldName, '>=', options.value);
1293
+ queryReference = queryReference.where(firestoreFieldName, '<=', `${options.value}~`);
1294
+ return queryReference;
1295
+ }
1296
+ if (options?.operator === Where.IN &&
1297
+ Array.isArray(options?.value) &&
1298
+ (this.fields[firestoreFieldName] === FirestoreFieldType.Array || !this.fields[firestoreFieldName]))
1299
+ return queryReference.where(firestoreFieldName, 'array-contains', options.value);
1300
+ if (isObject(options) && isNil(options?.operator) && isNil(options?.value)) {
1301
+ return Object.keys(options).reduce((queryReferenceWithWhere, key) => this.buildWhereSentence(queryReferenceWithWhere, `${fieldName.toString()}.${key}`, options[key]), queryReference);
1302
+ }
1303
+ return queryReference.where(firestoreFieldName, options?.operator || '==', options?.value || options);
1304
+ };
1305
+ }
1306
+ async find({ filters, limits, orderBy, } = {}) {
1307
+ const orderByKeys = Object.keys(orderBy || {});
1308
+ let query = this.collection(this.buildCollectionPathForFind(filters || {}));
1309
+ query = this.makeFirestoreWhere(query, filters || {});
1310
+ if (orderByKeys.length) {
1311
+ const filtersKeysWithUnordered = Object.keys(filters || {}).filter((filterKey) => !orderByKeys.includes(filterKey));
1312
+ if (filtersKeysWithUnordered.length)
1313
+ filtersKeysWithUnordered.forEach((filterKey) => (orderBy = {
1314
+ ...(![Where.EQUALS].includes(filters[filterKey].operator) ? { [filterKey]: 'asc' } : {}),
1315
+ ...orderBy,
1316
+ }));
1317
+ Object.keys(orderBy).forEach((fieldName) => (query = query.orderBy(fieldName, orderBy[fieldName])));
1318
+ }
1319
+ query = await this.defineLimits(query, filters, limits);
1320
+ const docs = await query.get();
1321
+ const data = docs.docs.map((doc) => doc.data());
1322
+ return {
1323
+ data,
1324
+ count: this.calculateCount(data, limits),
1325
+ };
1326
+ }
1327
+ buildCollectionPathForFind(filters) {
1328
+ if (!this.isSubCollection(this))
1329
+ return this.collectionName;
1330
+ const parentIdField = this.parentIdField;
1331
+ const parentId = getValueFromFilter(filters?.[parentIdField]);
1332
+ return `${this.parentRepository.collectionName}/${parentId}/${this.collectionName}`;
1333
+ }
1334
+ async defineLimits(query, filters, limits) {
1335
+ if (limits?.offset) {
1336
+ if (this.model.isModel(limits.offset))
1337
+ query = query.startAfter(await this.collection(this.buildCollectionPathForFind(filters))
1338
+ .doc(limits.offset[limits.offset.identifiersFields.shift()])
1339
+ .get());
1340
+ else if (isNumber(limits.offset) || isString(limits.offset))
1341
+ query = query.startAt(limits.offset);
1342
+ }
1343
+ if (limits?.limit)
1344
+ query = query.limit(limits.limit);
1345
+ return query;
1346
+ }
1347
+ calculateCount(data, limits) {
1348
+ if (data.length <= 0)
1349
+ return 0;
1350
+ if (data.length < limits?.limit)
1351
+ return data.length;
1352
+ return Infinity;
1353
+ }
1354
+ };
1355
+ };
1356
+
1357
+ const withCreateFirestore = (MixinBase) => {
1358
+ return class CreateFirestore extends MixinBase {
1359
+ async create(data) {
1360
+ const docRef = await this.save(this.model.toInstance(data));
1361
+ const doc = await docRef.get();
1362
+ return doc.data();
1363
+ }
1364
+ async save(data) {
1365
+ const id = data[data.identifiersFields.shift()]?.toString();
1366
+ const collectionPath = this.buildCollectionPathForAdd(data);
1367
+ if (isEmpty(id))
1368
+ return this.collection(collectionPath).add(data);
1369
+ const docRef = this.collection(collectionPath).doc(id);
1370
+ await docRef.set(data);
1371
+ return docRef;
1372
+ }
1373
+ buildCollectionPathForAdd(identifiers) {
1374
+ return this.isSubCollection(this)
1375
+ ? `${this.parentRepository.collectionName}/${identifiers[this.parentIdField]}/${this.collectionName}`
1376
+ : this.collectionName;
1377
+ }
1378
+ };
1379
+ };
1380
+
1381
+ const withUpdateFirestore = (MixinBase) => {
1382
+ const getValueFromParams = (params, field) => (isNil(params[field]?.value) ? params[field] : params[field].value) || null;
1383
+ const getValueByAction = (options) => {
1384
+ const fieldValues = firebase.firestore.FieldValue;
1385
+ if (isNil(options.action))
1386
+ return options;
1387
+ if (options.action === UpdateOptionActions.REMOVE_FIELD)
1388
+ return fieldValues.delete();
1389
+ if (Array.isArray(options.value)) {
1390
+ if (options.action === UpdateOptionActions.MERGE)
1391
+ return fieldValues.arrayUnion(...options.value);
1392
+ if (options.action === UpdateOptionActions.REMOVE)
1393
+ return fieldValues.arrayRemove(...options.value);
1394
+ }
1395
+ return options.value;
1396
+ };
1397
+ return class UpdateFirestore extends MixinBase {
1398
+ async update(data) {
1399
+ const model = new this.model();
1400
+ const keyField = model.identifiersFields.shift();
1401
+ const docRef = this.collection(this.buildCollectionPathForUpdate(data)).doc(getValueFromParams(data, keyField).toString());
1402
+ await docRef.set(this.paramsToPlain(data), { merge: true });
1403
+ const doc = await docRef.get();
1404
+ return doc.data();
1405
+ }
1406
+ buildCollectionPathForUpdate(identifiers) {
1407
+ return this.isSubCollection(this)
1408
+ ? `${this.parentRepository.collectionName}/${getValueFromParams(identifiers, this.parentIdField)}/${this.collectionName}`
1409
+ : this.collectionName;
1410
+ }
1411
+ paramsToPlain(params) {
1412
+ const model = this.model;
1413
+ if (model.isModel(params))
1414
+ return params.toPlain();
1415
+ return Object.keys(params).reduce((data, currentKey) => ({ ...data, [currentKey]: getValueByAction(params[currentKey]) }), {});
1416
+ }
1417
+ };
1418
+ };
1419
+
1420
+ const withDeleteFirestore = (MixinBase) => {
1421
+ return class DeleteFirestore extends MixinBase {
1422
+ async delete(identifiers) {
1423
+ await this.collection(this.buildCollectionPathForRemove(identifiers))
1424
+ .doc(Object.values(identifiers).shift().toString())
1425
+ .delete();
1426
+ }
1427
+ buildCollectionPathForRemove(identifiers) {
1428
+ return this.isSubCollection(this)
1429
+ ? `${this.parentRepository.collectionName}/${identifiers[this.parentIdField]}/${this.collectionName}`
1430
+ : this.collectionName;
1431
+ }
1432
+ };
1433
+ };
1434
+
1435
+ const withSubCollection = (MixinBase, ParentModel) => {
1436
+ return class SubCollectionMix extends MixinBase {
1437
+ constructor(...args) {
1438
+ super(args);
1439
+ }
1440
+ collection(path) {
1441
+ return super.collection(path);
1442
+ }
1443
+ };
1444
+ };
1445
+
1446
+ const withCrudFirestore = (MixinBase) => {
1447
+ return class CrudFirestore extends withUpdateFirestore(withGetFirestore(withFindFirestore(withDeleteFirestore(withCreateFirestore(MixinBase))))) {
1448
+ };
1449
+ };
1450
+
1451
+ class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1452
+ constructor(firestore) {
1453
+ super();
1454
+ this.firestore = firestore;
1455
+ this.collectionName = 'leads';
1456
+ this.model = Lead;
1457
+ }
1458
+ }
1459
+
1460
+ class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
1461
+ constructor(firestore, parentRepository) {
1462
+ super();
1463
+ this.firestore = firestore;
1464
+ this.parentRepository = parentRepository;
1465
+ this.collectionName = 'editions';
1466
+ this.parentIdField = 'subscriptionId';
1467
+ this.model = Edition;
1468
+ }
1469
+ }
1470
+
1471
+ class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1472
+ constructor(firestore) {
1473
+ super();
1474
+ this.firestore = firestore;
1475
+ this.collectionName = 'subscription';
1476
+ this.model = Subscription;
1477
+ }
1478
+ }
1479
+
1480
+ class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
1481
+ constructor(firestore, parentRepository) {
1482
+ super();
1483
+ this.firestore = firestore;
1484
+ this.parentRepository = parentRepository;
1485
+ this.collectionName = 'payments';
1486
+ this.parentIdField = 'subscriptionId';
1487
+ this.model = SubscriptionPayment;
1488
+ }
1489
+ }
1490
+
1491
+ class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
1492
+ constructor(firestore, parentRepository) {
1493
+ super();
1494
+ this.firestore = firestore;
1495
+ this.parentRepository = parentRepository;
1496
+ this.collectionName = 'address';
1497
+ this.parentIdField = 'userId';
1498
+ this.model = UserAddress;
1499
+ }
1500
+ }
1501
+
1502
+ class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
1503
+ constructor(firestore, parentRepository) {
1504
+ super();
1505
+ this.firestore = firestore;
1506
+ this.parentRepository = parentRepository;
1507
+ this.collectionName = 'CX';
1508
+ this.parentIdField = 'userId';
1509
+ this.model = BeautyProfile;
1510
+ }
1511
+ }
1512
+
1513
+ class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1514
+ constructor(firestore) {
1515
+ super();
1516
+ this.firestore = firestore;
1517
+ this.collectionName = 'users';
1518
+ this.model = User;
1519
+ }
1520
+ async get(identifiers) {
1521
+ const user = await super.get({ id: identifiers.id });
1522
+ user.beautyProfile = await this.getBeautyProfile(user.id);
1523
+ user.isSubscriber = await this.checkIfIsSubscriber(user.id);
1524
+ return user;
1525
+ }
1526
+ async checkIfExistsByField(field, value) {
1527
+ const result = await this.find({ filters: { [field]: value } });
1528
+ return result.count > 0;
1529
+ }
1530
+ buildModelInstance() {
1531
+ const { fromFirestore, toFirestore } = super.buildModelInstance();
1532
+ return {
1533
+ toFirestore: (data) => {
1534
+ const plain = toFirestore(data);
1535
+ delete plain.isSubscriber;
1536
+ return plain;
1537
+ },
1538
+ fromFirestore,
1539
+ };
1540
+ }
1541
+ async getBeautyProfile(userId) {
1542
+ const beautyProfile = await this.collection()
1543
+ .doc(userId)
1544
+ .collection('CX')
1545
+ .withConverter(this.buildBeautyProfileModelInstance())
1546
+ .doc('beautyProfile')
1547
+ .get();
1548
+ return beautyProfile.data();
1549
+ }
1550
+ async checkIfIsSubscriber(userId) {
1551
+ const docs = await this.firestore
1552
+ .collection('subscription')
1553
+ .where('user.id', '==', userId)
1554
+ .where('status', '==', 'active')
1555
+ .get();
1556
+ return !!docs && !!docs.size;
1557
+ }
1558
+ buildBeautyProfileModelInstance() {
1559
+ return {
1560
+ toFirestore: (data) => data.toPlain(),
1561
+ fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
1562
+ };
1563
+ }
1564
+ }
1565
+
1566
+ class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
1567
+ constructor(firestore, parentRepository) {
1568
+ super();
1569
+ this.firestore = firestore;
1570
+ this.parentRepository = parentRepository;
1571
+ this.collectionName = 'payment_method';
1572
+ this.parentIdField = 'userId';
1573
+ this.model = UserPaymentMethod;
1574
+ }
1575
+ }
1576
+
1577
+ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1578
+ constructor(firestore) {
1579
+ super();
1580
+ this.firestore = firestore;
1581
+ this.collectionName = 'categories';
1582
+ this.model = Category;
1583
+ }
1584
+ getCategoryBySlug(slug, shop) {
1585
+ return this.collection(this.collectionName)
1586
+ .where('slug', '==', slug)
1587
+ .where('shop', '==', shop)
1588
+ .where('published', '==', true)
1589
+ .get()
1590
+ .then((snap) => {
1591
+ if (snap.size > 1)
1592
+ throw new DuplicatedResultsError('Query returned duplicated values');
1593
+ if (snap.empty)
1594
+ throw new NotFoundError(`Document with slug ${slug} not found`);
1595
+ return snap.docs[0].data();
1596
+ })
1597
+ .catch((error) => error);
1598
+ }
1599
+ async getCategoriesForHome(categoryIds, limit = 4) {
1600
+ const categorySnap = await this.collection(this.collectionName)
1601
+ .where('id', 'in', categoryIds.filter(Boolean))
1602
+ .where('published', '==', true)
1603
+ .get();
1604
+ if (categorySnap.empty)
1605
+ throw new NotFoundError('Categories not found');
1606
+ const categories = categorySnap.docs.map((doc) => doc.data());
1607
+ const homeSections = await Promise.all(categories.map(async (category) => ({
1608
+ category,
1609
+ products: await this.mountCategory(category, { limit, hasStock: true }),
1610
+ })));
1611
+ return homeSections;
1612
+ }
1613
+ async mountCategory(category, options) {
1614
+ if (!category.products)
1615
+ throw new RequiredArgumentError(['Category products is empty']);
1616
+ const chunks = chunk(category.products, 10);
1617
+ const products = [];
1618
+ for (const productIds of chunks) {
1619
+ if (options?.limit && products.length >= options?.limit)
1620
+ break;
1621
+ let query = await this.collection('productsErpVitrine')
1622
+ .where('published', '==', true)
1623
+ .where('id', 'in', productIds);
1624
+ if (options?.hasStock)
1625
+ query = query.where('stock.quantity', '>', 0);
1626
+ if (options?.limit)
1627
+ query = query.limit(options?.limit);
1628
+ const productSnap = await query.get();
1629
+ if (productSnap.empty)
1630
+ continue;
1631
+ products.push(...productSnap.docs.map((doc) => doc.data()));
1632
+ }
1633
+ return products;
1634
+ }
1635
+ }
1636
+
1637
+ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1638
+ constructor(firestore) {
1639
+ super();
1640
+ this.firestore = firestore;
1641
+ this.reviews = {};
1642
+ this.collectionName = 'productsErpVitrine';
1643
+ this.model = Product;
1644
+ }
1645
+ async getBySlug(slug) {
1646
+ const result = await this.find({
1647
+ filters: {
1648
+ slug: { operator: Where.EQUALS, value: slug },
1649
+ },
1650
+ });
1651
+ return result?.data?.shift();
1652
+ }
1653
+ async fetchReviews(status) {
1654
+ const { data: products } = await this.find();
1655
+ products.forEach((product) => {
1656
+ if ([undefined, 0].includes(product.reviews?.length))
1657
+ return;
1658
+ const productInfo = {
1659
+ productId: product.id,
1660
+ productName: product.name,
1661
+ productSku: product.sku,
1662
+ };
1663
+ this.reviews.pending = [];
1664
+ this.reviews.approved = [];
1665
+ this.reviews.rejected = [];
1666
+ product.reviews.forEach((review) => {
1667
+ if ([null, undefined].includes(review.status))
1668
+ return this.reviews.pending.push({ ...review, ...productInfo });
1669
+ if (review.status === false)
1670
+ return this.reviews.rejected.push({ ...review, ...productInfo });
1671
+ if (!!review.status)
1672
+ return this.reviews.approved.push({ ...review, ...productInfo });
1673
+ });
1674
+ });
1675
+ return this.reviews[status];
1676
+ }
1677
+ }
1678
+
1679
+ class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Product) {
1680
+ constructor(firestore, parentRepository) {
1681
+ super();
1682
+ this.firestore = firestore;
1683
+ this.parentRepository = parentRepository;
1684
+ this.collectionName = 'variants';
1685
+ this.parentIdField = 'productId';
1686
+ this.model = Variant;
1687
+ }
1688
+ }
1689
+
1690
+ class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1691
+ constructor(firestore) {
1692
+ super();
1693
+ this.firestore = firestore;
1694
+ this.collectionName = 'subscriptionProducts';
1695
+ this.model = Product;
1696
+ }
1697
+ }
1698
+
1699
+ class CheckoutFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1700
+ constructor(firestore) {
1701
+ super();
1702
+ this.firestore = firestore;
1703
+ this.collectionName = 'checkouts';
1704
+ this.model = Checkout;
1705
+ }
1706
+ }
1707
+
1708
+ class CouponFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1709
+ constructor(firestore) {
1710
+ super();
1711
+ this.firestore = firestore;
1712
+ this.collectionName = 'coupons';
1713
+ this.model = Coupon;
1714
+ }
1715
+ buildModelInstance() {
1716
+ const { fromFirestore, toFirestore } = super.buildModelInstance();
1717
+ return {
1718
+ toFirestore: (data) => {
1719
+ const plain = toFirestore(data);
1720
+ if (!!data.expiresIn)
1721
+ plain.expiresIn = data.expiresIn.getTime();
1722
+ return plain;
1723
+ },
1724
+ fromFirestore: (snap) => {
1725
+ const instance = fromFirestore(snap);
1726
+ if (!isNil(instance.expiresIn))
1727
+ instance.expiresIn = new Date(snap.data().expiresIn);
1728
+ return instance;
1729
+ },
1730
+ };
1731
+ }
1732
+ }
1733
+
1734
+ class OrderFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1735
+ constructor(firestore) {
1736
+ super();
1737
+ this.firestore = firestore;
1738
+ this.orderFromFirestore = (order) => {
1739
+ if (!!order?.lineItems?.length) {
1740
+ order.lineItems = order.lineItems.map((lineItem) => {
1741
+ if (!!lineItem.price?.[order.shop]) {
1742
+ const shopPrice = lineItem['price'][order.shop];
1743
+ lineItem['price'] = shopPrice;
1744
+ }
1745
+ return lineItem;
1746
+ });
1747
+ }
1748
+ return order;
1749
+ };
1750
+ this.collectionName = 'orders';
1751
+ this.model = Order;
1752
+ this.fields = {
1753
+ status: FirestoreFieldType.String,
1754
+ };
1755
+ }
1756
+ buildModelInstance() {
1757
+ const { fromFirestore, toFirestore } = super.buildModelInstance();
1758
+ return {
1759
+ toFirestore: (data) => toFirestore(data?.toPlain ? data.toPlain() : data),
1760
+ fromFirestore: (snap) => {
1761
+ const instance = fromFirestore(snap);
1762
+ return this.orderFromFirestore(instance);
1763
+ },
1764
+ };
1765
+ }
1766
+ }
1767
+
1768
+ class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1769
+ constructor(firestore) {
1770
+ super();
1771
+ this.firestore = firestore;
1772
+ this.collectionName = 'payments';
1773
+ this.model = Payment;
1774
+ }
1775
+ }
1776
+
1777
+ class CheckoutSubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1778
+ constructor(firestore) {
1779
+ super();
1780
+ this.firestore = firestore;
1781
+ this.collectionName = 'checkoutsSubscription';
1782
+ this.model = CheckoutSubscription;
1783
+ }
1784
+ }
1785
+
1786
+ class SubscriptionPlanFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1787
+ constructor(firestore) {
1788
+ super();
1789
+ this.firestore = firestore;
1790
+ this.collectionName = 'subscriptionPlans';
1791
+ this.model = SubscriptionPlan;
1792
+ }
1793
+ }
1794
+
1795
+ class Buy2WinFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1796
+ constructor(firestore) {
1797
+ super();
1798
+ this.firestore = firestore;
1799
+ this.collectionName = 'buy2win';
1800
+ this.model = Buy2Win;
1801
+ }
1802
+ }
1803
+
1804
+ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
1805
+ constructor(firestore) {
1806
+ super(firestore);
1807
+ this.firestore = firestore;
1808
+ this.collectionName = 'legacyOrders';
1809
+ }
1810
+ }
1811
+
1812
+ class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1813
+ constructor(firestore) {
1814
+ super();
1815
+ this.firestore = firestore;
1816
+ this.homeToFirestore = (home) => {
1817
+ if (home.data?.data) {
1818
+ home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.homeCategoryGroupToPlain);
1819
+ home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.homeCategoryGroupToPlain);
1820
+ home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.homeCategoryGroupToPlain);
1821
+ }
1822
+ return home;
1823
+ };
1824
+ this.homeCategoryGroupToPlain = (homeCategoryGroup) => ({
1825
+ category: homeCategoryGroup.category.toPlain(),
1826
+ products: homeCategoryGroup.products.map((product) => product.toPlain()),
1827
+ });
1828
+ this.homeFromFirestore = (home) => {
1829
+ if (home.data?.data) {
1830
+ home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
1831
+ home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
1832
+ home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
1833
+ home.data.createdAt =
1834
+ home.data.createdAt instanceof firebase.firestore.Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
1835
+ home.data.expiresAt =
1836
+ home.data.expiresAt instanceof firebase.firestore.Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
1837
+ }
1838
+ return home;
1839
+ };
1840
+ this.plainToHomeCategoryGroup = (homeCategoryGroup) => ({
1841
+ category: Category.toInstance(homeCategoryGroup.category),
1842
+ products: homeCategoryGroup.products.map((product) => Product.toInstance(product)),
1843
+ });
1844
+ this.collectionName = 'dms';
1845
+ this.model = Home;
1846
+ }
1847
+ buildModelInstance() {
1848
+ const { fromFirestore, toFirestore } = super.buildModelInstance();
1849
+ return {
1850
+ toFirestore: (data) => {
1851
+ const modifiedData = this.homeToFirestore(data);
1852
+ return toFirestore(modifiedData);
1853
+ },
1854
+ fromFirestore: (snap) => {
1855
+ const instance = fromFirestore(snap);
1856
+ return this.homeFromFirestore(instance);
1857
+ },
1858
+ };
1859
+ }
1860
+ }
1861
+
1862
+ class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
1863
+ constructor(firestore) {
1864
+ super();
1865
+ this.firestore = firestore;
1866
+ this.collectionName = 'shopMenus';
1867
+ this.model = ShopMenu;
1868
+ }
1869
+ }
1870
+
1871
+ class AuthenticationFirebaseAuthService {
1872
+ constructor(firebaseAuth) {
1873
+ this.firebaseAuth = firebaseAuth;
1874
+ }
1875
+ async signInWithEmailAndPassword(data) {
1876
+ const credentials = await this.firebaseAuth.signInWithEmailAndPassword(data.email, data.password);
1877
+ const user = credentials.user;
1878
+ return {
1879
+ id: user.uid,
1880
+ displayName: user.displayName,
1881
+ email: user.email,
1882
+ phone: user.phoneNumber,
1883
+ isAnonymous: false,
1884
+ };
1885
+ }
1886
+ async signInWithGoogle() {
1887
+ const credentials = await this.firebaseAuth.signInWithPopup(new firebase.auth.GoogleAuthProvider());
1888
+ const user = credentials.user;
1889
+ return {
1890
+ id: user.uid,
1891
+ displayName: user.displayName,
1892
+ email: user.email,
1893
+ phone: user.phoneNumber,
1894
+ isAnonymous: false,
1895
+ };
1896
+ }
1897
+ async signOut() {
1898
+ this.firebaseAuth.signOut();
1899
+ }
1900
+ async signInAnonymously() {
1901
+ const auth = await this.firebaseAuth.signInAnonymously();
1902
+ const user = auth.user;
1903
+ user.id = auth.user.uid;
1904
+ return user;
1905
+ }
1906
+ async sendPasswordResetEmail(email) {
1907
+ return this.firebaseAuth.sendPasswordResetEmail(email);
1908
+ }
1909
+ }
1910
+
1911
+ class RegisterFirebaseAuthService {
1912
+ constructor(firebaseAuth) {
1913
+ this.firebaseAuth = firebaseAuth;
1914
+ }
1915
+ async register(params) {
1916
+ try {
1917
+ const auth = await this.firebaseAuth.createUserWithEmailAndPassword(params.email, params.password);
1918
+ const user = auth.user;
1919
+ user.sendEmailVerification();
1920
+ user.id = auth.user.uid;
1921
+ return user;
1922
+ }
1923
+ catch (error) {
1924
+ if (error.code === 'auth/email-already-in-use')
1925
+ throw new UserAlreadyRegisteredError('Email already registered');
1926
+ if (error.code === 'auth/weak-password')
1927
+ throw new WeakPasswordError();
1928
+ throw error;
1929
+ }
1930
+ }
1931
+ }
1932
+
1933
+ class AttributeOptionHelper {
1934
+ }
1935
+ AttributeOptionHelper.FindByAttribute = (attributeName, fields) => {
1936
+ if (fields.includes(attributeName))
1937
+ return { columnName: attributeName.toString(), attributeName };
1938
+ const field = fields.find((columnOption) => isObject(columnOption) && Object.keys(columnOption).includes(attributeName.toString()));
1939
+ const fieldOption = field?.[attributeName.toString()];
1940
+ if (isNil(fieldOption))
1941
+ return { columnName: attributeName.toString(), attributeName };
1942
+ if (Array.isArray(fieldOption))
1943
+ return { columnName: attributeName.toString(), attributeName, fields: fieldOption };
1944
+ return { attributeName, columnName: attributeName.toString(), ...fieldOption };
1945
+ };
1946
+ AttributeOptionHelper.CheckIsColumnOption = (fieldValue) => !!fieldValue.columnName;
1947
+ AttributeOptionHelper.FindColumnOptionFromList = (columnName, fields) => {
1948
+ if (fields.includes(columnName))
1949
+ return { columnName, attributeName: columnName };
1950
+ const field = fields.find((columnOption) => isObject(columnOption) &&
1951
+ Object.values(columnOption).find((option) => AttributeOptionHelper.CheckIsColumnOption(option) && option.columnName === columnName)?.columnName === columnName) || {};
1952
+ const attributeName = Object.keys(field).find((fieldOptionFromList) => AttributeOptionHelper.CheckIsColumnOption(field[fieldOptionFromList]) ||
1953
+ Array.isArray(field[fieldOptionFromList]));
1954
+ const fieldOption = field?.[attributeName];
1955
+ if (Array.isArray(fieldOption))
1956
+ return { attributeName: attributeName, fields: fieldOption };
1957
+ return {
1958
+ attributeName: attributeName || columnName,
1959
+ columnName,
1960
+ ...fieldOption,
1961
+ };
1962
+ };
1963
+
1964
+ var HasuraGraphQLWhere;
1965
+ (function (HasuraGraphQLWhere) {
1966
+ HasuraGraphQLWhere["EQUALS"] = "_eq";
1967
+ HasuraGraphQLWhere["GT"] = "_gt";
1968
+ HasuraGraphQLWhere["GTE"] = "_gte";
1969
+ HasuraGraphQLWhere["IN"] = "_in";
1970
+ HasuraGraphQLWhere["NOTIN"] = "_nin";
1971
+ HasuraGraphQLWhere["LT"] = "_lt";
1972
+ HasuraGraphQLWhere["LTE"] = "_lte";
1973
+ HasuraGraphQLWhere["LIKE"] = "_like";
1974
+ HasuraGraphQLWhere["NOTLIKE"] = "_nlike";
1975
+ HasuraGraphQLWhere["ISNULL"] = "_is_null";
1976
+ HasuraGraphQLWhere["ISNOTNULL"] = "_is_null";
1977
+ })(HasuraGraphQLWhere || (HasuraGraphQLWhere = {}));
1978
+
1979
+ var HasuraGraphQLColumnType;
1980
+ (function (HasuraGraphQLColumnType) {
1981
+ HasuraGraphQLColumnType["Int"] = "Int";
1982
+ HasuraGraphQLColumnType["Float"] = "Float";
1983
+ HasuraGraphQLColumnType["Boolean"] = "Boolean";
1984
+ HasuraGraphQLColumnType["String"] = "String";
1985
+ HasuraGraphQLColumnType["DateTime"] = "timestampz";
1986
+ HasuraGraphQLColumnType["Json"] = "json";
1987
+ HasuraGraphQLColumnType["Jsonb"] = "jsonb";
1988
+ HasuraGraphQLColumnType["Enum"] = "enum";
1989
+ HasuraGraphQLColumnType["Uuid"] = "uuid";
1990
+ })(HasuraGraphQLColumnType || (HasuraGraphQLColumnType = {}));
1991
+
1992
+ class FilterOptionHelper {
1993
+ }
1994
+ FilterOptionHelper.CheckIfIsFilterOption = (filter) => !isNil(filter?.operator);
1995
+ FilterOptionHelper.GetValueFromFilter = (filter, fieldOption) => {
1996
+ if (!FilterOptionHelper.CheckIfIsFilterOption(filter))
1997
+ return filter;
1998
+ if (filter.operator === Where.ISNULL)
1999
+ return true;
2000
+ if (filter.operator === Where.ISNOTNULL)
2001
+ return false;
2002
+ const converter = fieldOption.to
2003
+ ? fieldOption.to
2004
+ : (value) => filter.operator === Where.LIKE && !Array.isArray(filter.value) && value.indexOf('%') < 0
2005
+ ? `%${value}%`
2006
+ : value;
2007
+ return Array.isArray(filter.value) && !fieldOption.fields && [Where.IN, Where.NOTIN].includes(filter.operator)
2008
+ ? filter.value.map((fieldValue) => converter(fieldValue))
2009
+ : converter(filter.value);
2010
+ };
2011
+
2012
+ class BindFilterQueryHelper {
2013
+ }
2014
+ BindFilterQueryHelper.MakeGraphQLWhere = (filter, fields) => Object.keys(filter).reduce((variables, fieldName) => {
2015
+ const columnOption = AttributeOptionHelper.FindByAttribute(fieldName, fields);
2016
+ if (!columnOption.bindFindFilter)
2017
+ return {
2018
+ ...variables,
2019
+ ...{
2020
+ [columnOption.columnName]: BindFilterQueryHelper.BuildWhereSentence(fieldName, filter[fieldName], fields),
2021
+ },
2022
+ };
2023
+ const builtFilter = columnOption.bindFindFilter(filter[fieldName]);
2024
+ return {
2025
+ ...variables,
2026
+ ...Object.keys(builtFilter).reduce((variablesList, columnName) => ({
2027
+ ...variablesList,
2028
+ [columnName]: BindFilterQueryHelper.BuildWhereSentence(fieldName, builtFilter[columnName], fields),
2029
+ }), {}),
2030
+ };
2031
+ }, {});
2032
+ BindFilterQueryHelper.BuildWhereSentence = (field, options, fields) => {
2033
+ const fieldSentenceOptions = AttributeOptionHelper.FindByAttribute(field, fields);
2034
+ if (!Array.isArray(options) &&
2035
+ isObject(options) &&
2036
+ isNil(options?.operator) &&
2037
+ isNil(options?.value) &&
2038
+ isNil(fieldSentenceOptions?.to))
2039
+ return Object.keys(options).reduce((variables, key) => {
2040
+ const fieldOptions = AttributeOptionHelper.FindByAttribute(key, fieldSentenceOptions?.fields || fields);
2041
+ const columnName = fieldOptions.columnName;
2042
+ const columnFields = fieldOptions.fields;
2043
+ return {
2044
+ ...variables,
2045
+ [columnName]: BindFilterQueryHelper.BuildWhereSentence(key, options[key], columnFields || []),
2046
+ };
2047
+ }, {});
2048
+ if (!Array.isArray(options) && !isNil(fieldSentenceOptions.fields))
2049
+ return {
2050
+ [fieldSentenceOptions.fields[0]]: BindFilterQueryHelper.BuildOperatorSentence(options, fieldSentenceOptions),
2051
+ };
2052
+ if (isObject(options) && !FilterOptionHelper.CheckIfIsFilterOption(options))
2053
+ options = Object.values(options)[0];
2054
+ return Array.isArray(options)
2055
+ ? options.reduce((whereSentence, option) => ({
2056
+ ...whereSentence,
2057
+ ...BindFilterQueryHelper.BuildOperatorSentence(option, fieldSentenceOptions),
2058
+ }), {})
2059
+ : BindFilterQueryHelper.BuildOperatorSentence(options, fieldSentenceOptions);
2060
+ };
2061
+ BindFilterQueryHelper.BuildOperatorSentence = (options, fieldOption) => ({
2062
+ [BindFilterQueryHelper.GetHasuraOperator(options, fieldOption)]: FilterOptionHelper.GetValueFromFilter(options, fieldOption),
2063
+ });
2064
+ BindFilterQueryHelper.GetHasuraOperator = (options, fieldOption) => FilterOptionHelper.CheckIfIsFilterOption(options)
2065
+ ? fieldOption.type === HasuraGraphQLColumnType.Jsonb
2066
+ ? BindFilterQueryHelper.GetHasuraJsonbOperator(options)
2067
+ : HasuraGraphQLWhere[Object.keys(HasuraGraphQLWhere).find((graphQLOperator) => graphQLOperator === Object.keys(Where).find((operator) => Where[operator] === options?.operator))]
2068
+ : HasuraGraphQLWhere.EQUALS;
2069
+ BindFilterQueryHelper.GetHasuraJsonbOperator = (options) => options.operator === Where.IN
2070
+ ? '_contains'
2071
+ : options.operator === Where.LIKE
2072
+ ? '_has_keys_any'
2073
+ : HasuraGraphQLWhere[Object.keys(HasuraGraphQLWhere).find((graphQLOperator) => graphQLOperator === Object.keys(Where).find((operator) => Where[operator] === options?.operator))];
2074
+
2075
+ class GraphQLFieldHelper {
2076
+ }
2077
+ GraphQLFieldHelper.CheckIsGraphQLParams = (params) => !isString(params) && Array.isArray(params) && params.length >= 0 && !!params[0].operation;
2078
+ GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields = (fields) => {
2079
+ return fields
2080
+ ?.map((field) => {
2081
+ if (isString(field))
2082
+ return field.toString();
2083
+ const fieldName = Object.keys(field).shift();
2084
+ const fieldValue = field[fieldName];
2085
+ if (Array.isArray(fieldValue))
2086
+ return { [fieldName]: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue) };
2087
+ if (!AttributeOptionHelper.CheckIsColumnOption(fieldValue))
2088
+ return;
2089
+ if (fieldValue.fields)
2090
+ return !fieldValue.filters
2091
+ ? {
2092
+ [fieldValue.columnName || fieldName]: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue.fields),
2093
+ }
2094
+ : {
2095
+ operation: fieldValue.columnName || fieldName,
2096
+ fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue.fields),
2097
+ variables: {
2098
+ [`${fieldValue.columnName}_where`]: {
2099
+ name: 'where',
2100
+ type: fieldValue.filters.filterType,
2101
+ value: BindFilterQueryHelper.MakeGraphQLWhere(fieldValue.filters.filters, fieldValue.fields),
2102
+ required: true,
2103
+ },
2104
+ },
2105
+ };
2106
+ return fieldValue.columnName;
2107
+ })
2108
+ .filter((field) => !!field);
2109
+ };
2110
+ GraphQLFieldHelper.ConvertFieldValueFrom = (data, fields) => Object.keys(data).reduce((result, columnName) => {
2111
+ const { attributeName, fields: attributeFields, from, } = AttributeOptionHelper.FindColumnOptionFromList(columnName, fields);
2112
+ if (!!attributeFields && Array.isArray(attributeFields)) {
2113
+ if (Array.isArray(data[columnName]))
2114
+ return {
2115
+ ...result,
2116
+ [attributeName]: from
2117
+ ? from(data[columnName], data)
2118
+ : data[columnName].map((value) => GraphQLFieldHelper.ConvertFieldValueFrom(value, attributeFields)),
2119
+ };
2120
+ if (isObject(data[columnName]))
2121
+ return {
2122
+ ...result,
2123
+ [attributeName]: !!from
2124
+ ? from(data[columnName])
2125
+ : GraphQLFieldHelper.ConvertFieldValueFrom(data[columnName], attributeFields),
2126
+ };
2127
+ }
2128
+ if (!!from)
2129
+ return { ...result, [attributeName]: from(data[columnName], data) };
2130
+ return { ...result, [attributeName]: parseDateTime(data[columnName]) };
2131
+ }, {});
2132
+ GraphQLFieldHelper.ConvertFieldValueTo = (instance, fields, update = false) => {
2133
+ const data = instance.toPlain?.() || instance;
2134
+ return Object.keys(data).reduce((result, attributeName) => {
2135
+ const { columnName, fields: attributeFields, foreignKeyColumn, to, bindPersistData, } = AttributeOptionHelper.FindByAttribute(attributeName, fields);
2136
+ if (bindPersistData)
2137
+ return { ...result, ...bindPersistData(data[attributeName], instance) };
2138
+ if (isNil(columnName))
2139
+ return result;
2140
+ if (!!foreignKeyColumn &&
2141
+ !isEmpty(foreignKeyColumn) &&
2142
+ !Object.keys(foreignKeyColumn).filter((key) => !data[attributeName]?.[key]).length)
2143
+ return Object.keys(foreignKeyColumn).reduce((object, current) => ({ ...object, [foreignKeyColumn[current]]: data[attributeName]?.[current] }), { ...result });
2144
+ if (update && isObject(data[attributeName]) && !isNil(attributeFields) && !isDate(data[attributeName]))
2145
+ return result;
2146
+ if (!!columnName && Array.isArray(attributeFields) && isObject(data[attributeName])) {
2147
+ const converted = !isNil(columnName) && to ? to(instance[attributeName], instance) : data[attributeName];
2148
+ return {
2149
+ ...result,
2150
+ ...(converted !== undefined
2151
+ ? {
2152
+ [columnName]: {
2153
+ data: instance[attributeName] instanceof BaseModel
2154
+ ? GraphQLFieldHelper.ConvertFieldValueTo(data[attributeName], attributeFields)
2155
+ : converted,
2156
+ },
2157
+ }
2158
+ : {}),
2159
+ };
2160
+ }
2161
+ if (!!to)
2162
+ return { ...result, [columnName]: to(instance[attributeName], instance) };
2163
+ return { ...result, [columnName]: data[attributeName] };
2164
+ }, {});
2165
+ };
2166
+
2167
+ const withCreateHasuraGraphQL = (MixinBase) => {
2168
+ return class CreateHasuraGraphQLMixin extends MixinBase {
2169
+ constructor(...params) {
2170
+ const options = params?.[0];
2171
+ super(...params);
2172
+ this.insertGraphQLOperation = options?.insertGraphQLOperation || `insert_${this.tableName}_one`;
2173
+ this.insertGraphQLObjectType = options?.insertGraphQLObjectType || `${this.tableName}_insert_input`;
2174
+ }
2175
+ async create(data) {
2176
+ const newData = await this.save(this.model.toInstance(data));
2177
+ return this.model.toInstance(newData);
2178
+ }
2179
+ async save(data) {
2180
+ const primaryKeyColumns = this.model.identifiersFields.map((field) => AttributeOptionHelper.FindByAttribute(field, this.fields).columnName);
2181
+ const foreignKeyColumns = this.fields
2182
+ .map((field) => {
2183
+ const columnOptions = Object.values(field).shift();
2184
+ return (AttributeOptionHelper.CheckIsColumnOption(columnOptions) &&
2185
+ columnOptions.foreignKeyColumn && [
2186
+ ...Object.values(columnOptions.foreignKeyColumn),
2187
+ {
2188
+ [columnOptions.columnName]: Object.keys(columnOptions.foreignKeyColumn).map((foreignKeyField) => AttributeOptionHelper.FindByAttribute(foreignKeyField, columnOptions?.fields)?.columnName ||
2189
+ foreignKeyField),
2190
+ },
2191
+ ]);
2192
+ })
2193
+ .filter(Boolean)
2194
+ .reduce((keys, current) => [...keys, ...current], []);
2195
+ const result = await this.mutation(this.insertGraphQLOperation, [...primaryKeyColumns, ...foreignKeyColumns], {
2196
+ object: { type: this.insertGraphQLObjectType, required: true, value: this.convertDataToHasura(data) },
2197
+ });
2198
+ return { ...data.toPlain(), ...this.convertDataFromHasura(result[this.insertGraphQLOperation]).toPlain() };
2199
+ }
2200
+ };
2201
+ };
2202
+
2203
+ const withDeleteHasuraGraphQL = (MixinBase) => {
2204
+ return class DeleteHasuraGraphQLMixin extends MixinBase {
2205
+ constructor(...params) {
2206
+ const options = params?.[0];
2207
+ super(...params);
2208
+ this.deleteGraphQLOperation = options?.deleteGraphQLOperation || `delete_${this.tableName}_by_pk`;
2209
+ }
2210
+ async delete(identifiers) {
2211
+ const instance = this.model.toInstance(identifiers);
2212
+ await this.mutation(this.deleteGraphQLOperation, this.model.identifiersFields.map((field) => AttributeOptionHelper.FindByAttribute(field, this.fields).columnName), this.model.identifiersFields.reduce((ids, identifier) => {
2213
+ if (isNil(instance[identifier]))
2214
+ return ids;
2215
+ const columnOption = AttributeOptionHelper.FindByAttribute(identifier, this.fields);
2216
+ const value = columnOption.to(identifiers[identifier.toString()], instance);
2217
+ return {
2218
+ ...ids,
2219
+ [columnOption.columnName]: {
2220
+ type: this.getAttributeGraphQLTypeOf(columnOption.type || value),
2221
+ value,
2222
+ required: true,
2223
+ },
2224
+ };
2225
+ }, {}));
2226
+ }
2227
+ };
2228
+ };
2229
+
2230
+ const withHasuraGraphQL = (MixinBase) => {
2231
+ return class HasuraGraphQLMixin extends MixinBase {
2232
+ constructor(...params) {
2233
+ const options = params[0];
2234
+ super(...params);
2235
+ this.tableName = options.tableName;
2236
+ this.endpoint = options.endpoint;
2237
+ this.authOptions = options.authOptions;
2238
+ this.model = options.model;
2239
+ this.fields = options.fields || this.model.identifiersFields;
2240
+ }
2241
+ get headers() {
2242
+ return {
2243
+ 'Content-Type': 'application/json',
2244
+ ...(isNil(this.authOptions.authToken) ? {} : { Authorization: this.authOptions.authToken }),
2245
+ ...(isNil(this.authOptions.adminSecret) ? {} : { 'X-Hasura-Admin-Secret': this.authOptions.adminSecret }),
2246
+ ...(isNil(this.authOptions.authRole)
2247
+ ? {}
2248
+ : { 'X-Hasura-Role': this.authOptions.authRole.role, 'X-Hasura-User-Id': this.authOptions.authRole.userId }),
2249
+ };
2250
+ }
2251
+ async mutation(operation, fields, variables) {
2252
+ const resultQuery = mutation({
2253
+ operation,
2254
+ variables,
2255
+ fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fields),
2256
+ });
2257
+ return this.fetch(resultQuery);
2258
+ }
2259
+ async query(operation, fields, variables) {
2260
+ const resultQuery = GraphQLFieldHelper.CheckIsGraphQLParams(operation)
2261
+ ? query(operation.map((option) => ({
2262
+ operation: option.operation,
2263
+ variables: option.variables,
2264
+ fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(option.fields),
2265
+ })))
2266
+ : query({
2267
+ operation,
2268
+ variables,
2269
+ fields: GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fields),
2270
+ });
2271
+ return this.fetch(resultQuery);
2272
+ }
2273
+ async fetch(params) {
2274
+ const headers = this.headers;
2275
+ const response = await fetch(`${this.endpoint}`, {
2276
+ method: 'POST',
2277
+ body: JSON.stringify(params),
2278
+ headers,
2279
+ });
2280
+ const result = await response.json();
2281
+ if (!isNil(result.errors))
2282
+ throw new Error(JSON.stringify(result.errors));
2283
+ return result.data;
2284
+ }
2285
+ getAttributeGraphQLTypeOf(value) {
2286
+ if (isUUID(value))
2287
+ return 'uuid';
2288
+ if (isString(value))
2289
+ return 'String';
2290
+ if (isBoolean(value))
2291
+ return 'Boolean';
2292
+ if (value instanceof Date)
2293
+ return 'timestamptz';
2294
+ if (isInteger(value))
2295
+ return 'Int';
2296
+ if (isNumber(value))
2297
+ return 'numeric';
2298
+ throw new Error('Type not implemented yet');
2299
+ }
2300
+ checkIfIsDateTimeAndParse(value) {
2301
+ if (!/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.test(value))
2302
+ return value;
2303
+ const date = parseISO(value);
2304
+ if (isNaN$1(date.getTime()))
2305
+ return value;
2306
+ return date;
2307
+ }
2308
+ convertDataFromHasura(data) {
2309
+ const plain = GraphQLFieldHelper.ConvertFieldValueFrom(data, this.fields);
2310
+ return this.model.toInstance(plain);
2311
+ }
2312
+ convertDataToHasura(instance, update = false) {
2313
+ return GraphQLFieldHelper.ConvertFieldValueTo(instance, this.fields, update);
2314
+ }
2315
+ };
2316
+ };
2317
+
2318
+ const withUpdateHasuraGraphQL = (MixinBase) => {
2319
+ const getValueByAction = (options) => {
2320
+ if (options instanceof BaseModel)
2321
+ return options.toPlain();
2322
+ if (isNil(options?.action))
2323
+ return options;
2324
+ if ([UpdateOptionActions.REMOVE_FIELD.toString(), UpdateOptionActions.NULL.toString()].includes(options.action))
2325
+ return null;
2326
+ return options.value;
2327
+ };
2328
+ return class UpdateHasuraGraphQLMixin extends MixinBase {
2329
+ constructor(...params) {
2330
+ const options = params?.[0];
2331
+ super(...params);
2332
+ this.updateGraphQLOperation = options?.updateGraphQLOperation || `update_${this.tableName}_by_pk`;
2333
+ this.updateGraphQLObjectType = options?.updateGraphQLObjectType || `${this.tableName}_set_input`;
2334
+ this.updateGraphQLPKType = options?.updateGraphQLPKType || `${this.tableName}_pk_columns_input`;
2335
+ }
2336
+ async update(data) {
2337
+ const plainData = this.paramsToPlain(data);
2338
+ await this.mutation(this.updateGraphQLOperation, this.model.identifiersFields.map((field) => AttributeOptionHelper.FindByAttribute(field, this.fields).columnName), {
2339
+ _set: {
2340
+ type: this.updateGraphQLObjectType,
2341
+ value: this.convertDataToHasura(this.model.toInstance(plainData), true),
2342
+ required: true,
2343
+ },
2344
+ pk_columns: { type: this.updateGraphQLPKType, value: this.getUpdateModelKeys(plainData), required: true },
2345
+ });
2346
+ return this.model.toInstance(plainData);
2347
+ }
2348
+ paramsToPlain(params) {
2349
+ const model = this.model;
2350
+ if (model.isModel(params))
2351
+ return params.toPlain();
2352
+ return Object.keys(params).reduce((data, currentKey) => ({
2353
+ ...data,
2354
+ ...(params[currentKey] !== undefined && { [currentKey]: getValueByAction(params[currentKey]) }),
2355
+ }), {});
2356
+ }
2357
+ getUpdateModelKeys(data) {
2358
+ const instance = this.model.toInstance(data);
2359
+ return this.model.identifiersFields.reduce((ids, identifier) => {
2360
+ if (isNil(instance[identifier]))
2361
+ return ids;
2362
+ const columnOption = AttributeOptionHelper.FindByAttribute(identifier, this.fields);
2363
+ const value = columnOption?.to?.(data[identifier.toString()], instance) || data[columnOption.attributeName];
2364
+ return {
2365
+ ...ids,
2366
+ [columnOption.columnName]: value,
2367
+ };
2368
+ }, {});
2369
+ }
2370
+ };
2371
+ };
2372
+
2373
+ const withGetHasuraGraphQL = (MixinBase) => {
2374
+ return class GetHasuraGraphQLMixin extends MixinBase {
2375
+ constructor(...params) {
2376
+ const options = params?.[0];
2377
+ super(...params);
2378
+ this.getGraphQLOperation = options?.getGraphQLOperation || `${this.tableName}_by_pk`;
2379
+ }
2380
+ async get(identifiers) {
2381
+ const instance = this.model.toInstance(identifiers);
2382
+ const result = await this.query(this.getGraphQLOperation, this.fields, this.model.identifiersFields.reduce((ids, identifier) => {
2383
+ if (isNil(instance[identifier]))
2384
+ return ids;
2385
+ const columnOption = AttributeOptionHelper.FindByAttribute(identifier, this.fields);
2386
+ const value = columnOption?.to?.(identifiers[identifier.toString()], instance) || identifiers[identifier.toString()];
2387
+ return {
2388
+ ...ids,
2389
+ [columnOption.columnName]: {
2390
+ type: this.getAttributeGraphQLTypeOf(columnOption.type || value),
2391
+ value,
2392
+ required: true,
2393
+ },
2394
+ };
2395
+ }, {}));
2396
+ const data = result[this.getGraphQLOperation];
2397
+ if (isNil(data))
2398
+ throw new NotFoundError(`${instance.constructor.name} not found`);
2399
+ return this.convertDataFromHasura(result[this.getGraphQLOperation]);
2400
+ }
2401
+ };
2402
+ };
2403
+
2404
+ const withFindHasuraGraphQL = (MixinBase) => {
2405
+ return class FindHasuraGraphQLMixin extends MixinBase {
2406
+ async find(options) {
2407
+ const { filters, limits, orderBy } = options || {};
2408
+ const variablesCount = {
2409
+ ...(isNil(orderBy) ? {} : { order_by: { type: `${this.tableName}_order_by!`, list: true, value: orderBy } }),
2410
+ ...(isNil(filters)
2411
+ ? {}
2412
+ : {
2413
+ where: {
2414
+ value: BindFilterQueryHelper.MakeGraphQLWhere(filters, this.fields),
2415
+ type: `${this.tableName}_bool_exp`,
2416
+ required: true,
2417
+ },
2418
+ }),
2419
+ };
2420
+ const variables = {
2421
+ ...(isNil(limits) ? {} : limits),
2422
+ ...variablesCount,
2423
+ };
2424
+ const result = await this.query([
2425
+ {
2426
+ operation: this.tableName,
2427
+ fields: options.fields
2428
+ ? options.fields
2429
+ .map((fieldName) => this.fields.find((fieldOption) => fieldOption === fieldName) ??
2430
+ this.fields.find((fieldOption) => Object.keys(fieldOption).shift() === fieldName))
2431
+ .filter(Boolean)
2432
+ : this.fields,
2433
+ variables,
2434
+ },
2435
+ {
2436
+ operation: `${this.tableName}_aggregate`,
2437
+ fields: [{ aggregate: ['count'] }],
2438
+ variables: variablesCount,
2439
+ },
2440
+ ]);
2441
+ const data = result[this.tableName].map((row) => this.convertDataFromHasura(row));
2442
+ const count = result[`${this.tableName}_aggregate`].aggregate.count;
2443
+ return { count, data };
2444
+ }
2445
+ };
2446
+ };
2447
+
2448
+ const withCrudHasuraGraphQL = (MixinBase) => {
2449
+ return class CrudHasuraGraphQLMixin extends withUpdateHasuraGraphQL(withGetHasuraGraphQL(withFindHasuraGraphQL(withDeleteHasuraGraphQL(withCreateHasuraGraphQL(MixinBase))))) {
2450
+ };
2451
+ };
2452
+
2453
+ class CategoryHasuraGraphQL extends Category {
2454
+ }
2455
+
2456
+ class ProductHasuraGraphQL extends Product {
2457
+ }
2458
+ __decorate([
2459
+ Type(() => KitProductHasuraGraphQL),
2460
+ __metadata("design:type", Array)
2461
+ ], ProductHasuraGraphQL.prototype, "kitProducts", void 0);
2462
+
2463
+ class KitProductHasuraGraphQL extends KitProduct {
2464
+ }
2465
+ __decorate([
2466
+ Type(() => ProductHasuraGraphQL),
2467
+ __metadata("design:type", ProductHasuraGraphQL)
2468
+ ], KitProductHasuraGraphQL.prototype, "kit", void 0);
2469
+ __decorate([
2470
+ Type(() => ProductHasuraGraphQL),
2471
+ __metadata("design:type", ProductHasuraGraphQL)
2472
+ ], KitProductHasuraGraphQL.prototype, "product", void 0);
2473
+
2474
+ class VariantHasuraGraphQL extends Variant {
2475
+ constructor() {
2476
+ super(...arguments);
2477
+ this.name = '';
2478
+ this.hasVariants = false;
2479
+ }
2480
+ }
2481
+
2482
+ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
2483
+ constructor(endpoint, authOptions, productRepository) {
2484
+ super({
2485
+ tableName: 'category',
2486
+ model: Category,
2487
+ endpoint,
2488
+ authOptions,
2489
+ fields: [
2490
+ { id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
2491
+ { firestoreId: { columnName: 'firestore_id' } },
2492
+ 'name',
2493
+ 'description',
2494
+ 'image',
2495
+ 'published',
2496
+ 'shop',
2497
+ 'slug',
2498
+ { brandCategory: { columnName: 'brand_category' } },
2499
+ { brandCategoryBanner: { columnName: 'brand_banner' } },
2500
+ { brandCategoryBannerMobile: { columnName: 'brand_banner_mobile' } },
2501
+ { brandLogo: { columnName: 'brand_logo' } },
2502
+ { brandCondition: { columnName: 'brand_condition' } },
2503
+ {
2504
+ conditions: {
2505
+ columnName: 'tag_condition',
2506
+ type: HasuraGraphQLColumnType.Jsonb,
2507
+ from: (tags, row) => ({ brand: row.brand_condition, tags: Array.isArray(tags) ? tags : [] }),
2508
+ bindPersistData: (value) => {
2509
+ return {
2510
+ brand_condition: value.brand,
2511
+ tag_condition: value?.tags || [],
2512
+ };
2513
+ },
2514
+ bindFindFilter: (sentence) => {
2515
+ return {
2516
+ ...(sentence.brand ? { brand_condition: sentence.brand } : {}),
2517
+ ...(sentence.tags ? { tag_condition: sentence.tags } : {}),
2518
+ };
2519
+ },
2520
+ },
2521
+ },
2522
+ 'filters',
2523
+ { createdAt: { columnName: 'created_at' } },
2524
+ { updatedAt: { columnName: 'updated_at' } },
2525
+ {
2526
+ products: {
2527
+ columnName: 'products',
2528
+ fields: ['product_id'],
2529
+ from: (value) => value.map((product) => product.product_id.toString()),
2530
+ to: (productIds) => productIds.map((productId) => ({
2531
+ product_id: +productId,
2532
+ })),
2533
+ },
2534
+ },
2535
+ {
2536
+ metadata: {
2537
+ columnName: 'metadata',
2538
+ fields: ['title', 'description'],
2539
+ bindPersistData: (value) => ({
2540
+ metadata: { data: value },
2541
+ }),
2542
+ },
2543
+ },
2544
+ ],
2545
+ });
2546
+ this.productRepository = productRepository;
2547
+ }
2548
+ async create(params) {
2549
+ const { metadata, ...data } = params;
2550
+ return super.create({ ...data, metadata: metadata || { description: null, title: null } });
2551
+ }
2552
+ async get(identifiers) {
2553
+ return Number.isNaN(+identifiers.id)
2554
+ ? (await this.find({ filters: { firestoreId: identifiers.id } })).data?.[0]
2555
+ : super.get(identifiers);
2556
+ }
2557
+ async update(params) {
2558
+ const { products, id: checkId, metadata, ...data } = params;
2559
+ const plainData = this.paramsToPlain({ id: checkId });
2560
+ const id = await this.getId(plainData.id);
2561
+ const category = await super.update({ id, ...data });
2562
+ category.products = products && (await this.updateProducts(+id, { products }));
2563
+ category.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
2564
+ return category;
2565
+ }
2566
+ async getCategoryBySlug(slug, shop) {
2567
+ if (!slug)
2568
+ return;
2569
+ const { data, count } = await this.find({ filters: { slug, shop, published: true } });
2570
+ if (count > 1)
2571
+ throw new DuplicatedResultsError('Query returned duplicated values');
2572
+ if (!count)
2573
+ throw new NotFoundError(`Category with slug ${slug} not found`);
2574
+ return data.shift();
2575
+ }
2576
+ async getCategoriesForHome(categoryIds, limit = 4) {
2577
+ if (!categoryIds?.length)
2578
+ return [];
2579
+ const categoriesFirestore = categoryIds.filter((categoryId) => Number.isNaN(+categoryId));
2580
+ const categoriesHasura = categoryIds.filter((categoryId) => +categoryId > 0);
2581
+ const categories = [];
2582
+ if (categoriesFirestore.length)
2583
+ categories.push(...(await this.find({
2584
+ filters: { firestoreId: { operator: Where.IN, value: categoriesFirestore.filter(Boolean) }, published: true },
2585
+ }).then(({ data }) => data)));
2586
+ if (categoriesHasura.length)
2587
+ categories.push(...(await this.find({
2588
+ filters: { id: { operator: Where.IN, value: categoriesHasura.filter(Boolean) }, published: true },
2589
+ }).then(({ data }) => data)));
2590
+ if (!categories.length)
2591
+ return [];
2592
+ const homeSections = await Promise.all(categories.map(async (category) => ({
2593
+ category,
2594
+ products: await this.mountCategory(category, { limit, hasStock: true }),
2595
+ })));
2596
+ return homeSections;
2597
+ }
2598
+ async mountCategory(category, options) {
2599
+ if (!category?.products?.length)
2600
+ return [];
2601
+ const products = [];
2602
+ const { data: productsData } = await this.productRepository.find({
2603
+ filters: {
2604
+ id: { operator: Where.IN, value: category.products },
2605
+ published: true,
2606
+ ...(options?.hasStock ? { stock: { quantity: { operator: Where.GT, value: 0 } } } : {}),
2607
+ },
2608
+ fields: [
2609
+ 'id',
2610
+ 'name',
2611
+ 'slug',
2612
+ 'images',
2613
+ 'miniatures',
2614
+ 'price',
2615
+ 'fullPrice',
2616
+ 'subscriberDiscountPercentage',
2617
+ 'subscriberPrice',
2618
+ 'stock',
2619
+ 'published',
2620
+ 'CEST',
2621
+ 'EAN',
2622
+ 'NCM',
2623
+ 'brand',
2624
+ 'costPrice',
2625
+ 'hasVariants',
2626
+ 'isKit',
2627
+ 'sku',
2628
+ 'rate',
2629
+ 'tags',
2630
+ 'type',
2631
+ 'shoppingCount',
2632
+ ],
2633
+ ...(options?.limit ? { limits: { limit: options?.limit } } : {}),
2634
+ });
2635
+ products.push(...productsData);
2636
+ return products;
2637
+ }
2638
+ async getId(id) {
2639
+ if (!Number.isNaN(+id))
2640
+ return id;
2641
+ const { data } = await this.find({ filters: { firestoreId: id } });
2642
+ if (data?.[0]?.id)
2643
+ return data?.[0]?.id;
2644
+ throw new NotFoundError(`Category with id ${id} not found`);
2645
+ }
2646
+ async updateProducts(categoryId, { products }) {
2647
+ if ('action' in products && products.action === 'remove') {
2648
+ await this.mutation('delete_category_product', ['affected_rows'], {
2649
+ where: {
2650
+ type: 'category_product_bool_exp',
2651
+ required: true,
2652
+ value: { category_id: { _eq: categoryId } },
2653
+ },
2654
+ });
2655
+ return [];
2656
+ }
2657
+ const plainData = this.paramsToPlain({ products });
2658
+ if (!plainData.products || plainData.products.length <= 0)
2659
+ return [];
2660
+ await this.mutation('delete_category_product', ['affected_rows'], {
2661
+ where: {
2662
+ type: 'category_product_bool_exp',
2663
+ required: true,
2664
+ value: { category_id: { _eq: categoryId } },
2665
+ },
2666
+ });
2667
+ await this.mutation('insert_category_product', ['affected_rows'], {
2668
+ objects: {
2669
+ type: '[category_product_insert_input!]',
2670
+ required: true,
2671
+ value: plainData.products.map((productId) => ({ category_id: categoryId, product_id: productId })),
2672
+ },
2673
+ });
2674
+ return plainData.products;
2675
+ }
2676
+ async updateMetadata(categoryId, { metadata }) {
2677
+ const plainData = this.paramsToPlain({ metadata });
2678
+ if (!plainData.metadata)
2679
+ return;
2680
+ await this.mutation('update_category_metadata_by_pk', ['category_id'], {
2681
+ pk_columns: {
2682
+ value: { category_id: categoryId },
2683
+ type: 'category_metadata_pk_columns_input',
2684
+ required: true,
2685
+ },
2686
+ _set: {
2687
+ value: omit(metadata, ['category_id']),
2688
+ type: 'category_metadata_set_input',
2689
+ required: true,
2690
+ },
2691
+ });
2692
+ return plainData.metadata;
2693
+ }
2694
+ }
2695
+
2696
+ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
2697
+ constructor(endpoint, authOptions) {
2698
+ super({
2699
+ tableName: 'product',
2700
+ model: ProductHasuraGraphQL,
2701
+ endpoint,
2702
+ authOptions,
2703
+ fields: [],
2704
+ });
2705
+ this.bindReviewToModel = (plain) => ({
2706
+ ...omit(plain, ['product_id', 'created_at', 'updated_at', 'person_id', 'order_id']),
2707
+ createdAt: typeof plain.created_at === 'string' ? new Date(plain.created_at) : plain.created_at,
2708
+ updatedAt: typeof plain.updated_at === 'string' ? new Date(plain.updated_at) : plain.updated_at,
2709
+ personId: plain.person_id,
2710
+ orderId: plain.order_id,
2711
+ });
2712
+ this.bindReviewToHasura = (review) => ({
2713
+ ...omit(review, ['productId', 'createdAt', 'updatedAt', 'personId', 'orderId']),
2714
+ person_id: review.personId,
2715
+ order_id: review.orderId,
2716
+ });
2717
+ const commonFields = [
2718
+ { id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
2719
+ { firestoreId: { columnName: 'firestore_id' } },
2720
+ { productId: { columnName: 'main_product_id' } },
2721
+ { CEST: { columnName: 'cest' } },
2722
+ { EAN: { columnName: 'ean' } },
2723
+ { NCM: { columnName: 'ncm' } },
2724
+ 'brand',
2725
+ { costPrice: { columnName: 'cost_price' } },
2726
+ {
2727
+ description: {
2728
+ columnName: 'description',
2729
+ from: (description, data) => ({
2730
+ description,
2731
+ differentials: data.differentials,
2732
+ whoMustUse: data.who_must_use,
2733
+ howToUse: data.how_to_use,
2734
+ brand: data.brand_description,
2735
+ }),
2736
+ bindFindFilter: (sentence) => {
2737
+ const filters = Object.values(sentence).shift();
2738
+ return {
2739
+ ...(filters?.description && { description: filters.description }),
2740
+ ...(filters.differentials && { differentials: filters.differentials }),
2741
+ ...(filters.whoMustUse && {
2742
+ who_must_use: filters.whoMustUse,
2743
+ }),
2744
+ ...(filters.howToUse && {
2745
+ how_to_use: filters.howToUse,
2746
+ }),
2747
+ ...(filters.brand && {
2748
+ brand_description: filters.brand,
2749
+ }),
2750
+ };
2751
+ },
2752
+ bindPersistData: (descriptionData) => ({
2753
+ ...(descriptionData?.description && { description: descriptionData.description }),
2754
+ ...(descriptionData.differentials && { differentials: descriptionData.differentials }),
2755
+ ...(descriptionData.whoMustUse && {
2756
+ who_must_use: descriptionData.whoMustUse,
2757
+ }),
2758
+ ...(descriptionData.howToUse && { how_to_use: descriptionData.howToUse }),
2759
+ ...(descriptionData.brand && { brand_description: descriptionData.brand }),
2760
+ }),
2761
+ },
2762
+ },
2763
+ { differentials: { columnName: 'differentials' } },
2764
+ { whoMustUse: { columnName: 'who_must_use' } },
2765
+ { howToUse: { columnName: 'how_to_use' } },
2766
+ { brandDescription: { columnName: 'brand_description' } },
2767
+ { hasVariants: { columnName: 'has_variants' } },
2768
+ {
2769
+ images: {
2770
+ columnName: 'images',
2771
+ to: (value) => (value?.length > 0 ? `{"${value?.join?.(`","`) || ''}"}` : `{}`),
2772
+ },
2773
+ },
2774
+ {
2775
+ miniatures: {
2776
+ columnName: 'miniatures',
2777
+ to: (value) => (value?.length > 0 ? `{"${value?.join?.(`","`) || ''}"}` : `{}`),
2778
+ },
2779
+ },
2780
+ 'name',
2781
+ {
2782
+ price: {
2783
+ columnName: 'price',
2784
+ from: (price, data) => ({
2785
+ price,
2786
+ fullPrice: data.full_price,
2787
+ subscriberDiscountPercentage: data.subscriber_discount_percentage,
2788
+ subscriberPrice: data.subscriber_price,
2789
+ }),
2790
+ bindFindFilter: (sentence) => {
2791
+ const filters = Object.values(sentence).shift();
2792
+ return {
2793
+ ...((filters?.price || filters?.price === 0) && { price: filters.price }),
2794
+ ...((filters.fullPrice || filters.fullPrice === 0) && { full_price: filters.fullPrice }),
2795
+ ...((filters.subscriberDiscountPercentage || filters.subscriberDiscountPercentage === 0) && {
2796
+ subscriber_discount_percentage: filters.subscriberDiscountPercentage,
2797
+ }),
2798
+ ...((filters.subscriberPrice || filters.subscriberPrice === 0) && {
2799
+ subscriber_price: filters.subscriberPrice,
2800
+ }),
2801
+ };
2802
+ },
2803
+ bindPersistData: (priceData) => ({
2804
+ ...(priceData?.price >= 0 && { price: priceData.price }),
2805
+ ...(priceData.fullPrice >= 0 && { full_price: priceData.fullPrice }),
2806
+ ...(priceData.subscriberDiscountPercentage >= 0 && {
2807
+ subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
2808
+ }),
2809
+ ...(priceData.subscriberPrice >= 0 && { subscriber_price: priceData.subscriberPrice }),
2810
+ }),
2811
+ },
2812
+ },
2813
+ { fullPrice: { columnName: 'full_price' } },
2814
+ { subscriberDiscountPercentage: { columnName: 'subscriber_discount_percentage' } },
2815
+ { subscriberPrice: { columnName: 'subscriber_price' } },
2816
+ 'published',
2817
+ 'sku',
2818
+ {
2819
+ stock: {
2820
+ columnName: 'stock',
2821
+ from: (quantity) => ({ quantity }),
2822
+ to: (value) => (isNil(value?.quantity) ? value : value?.quantity),
2823
+ },
2824
+ },
2825
+ 'slug',
2826
+ 'type',
2827
+ 'video',
2828
+ 'weight',
2829
+ 'gender',
2830
+ { tags: { columnName: 'tags', type: HasuraGraphQLColumnType.Jsonb } },
2831
+ { isKit: { columnName: 'is_kit' } },
2832
+ { createdAt: { columnName: 'created_at' } },
2833
+ { updatedAt: { columnName: 'updated_at' } },
2834
+ {
2835
+ rate: {
2836
+ columnName: 'reviews_aggregate',
2837
+ filters: {
2838
+ filters: { status: true },
2839
+ filterType: 'product_review_bool_exp',
2840
+ },
2841
+ fields: [{ aggregate: [{ avg: ['rate'] }] }],
2842
+ from: (value) => value.aggregate.avg.rate,
2843
+ },
2844
+ },
2845
+ { shoppingCount: { columnName: 'shopping_count' } },
2846
+ ];
2847
+ this.fields = [
2848
+ ...commonFields,
2849
+ {
2850
+ categories: {
2851
+ columnName: 'categories',
2852
+ fields: ['category_id'],
2853
+ bindPersistData: (value) => ({
2854
+ categories: { data: value.map((category) => ({ category_id: +category })) },
2855
+ }),
2856
+ to: (categories) => categories.map((categoryId) => +categoryId),
2857
+ from: (categories) => categories?.map((category) => category?.category_id?.toString()) || [],
2858
+ },
2859
+ },
2860
+ {
2861
+ kitProducts: {
2862
+ columnName: 'kit_products',
2863
+ foreignKeyColumn: { productId: 'id' },
2864
+ fields: [
2865
+ { productId: { columnName: 'product_id' } },
2866
+ { kitProductId: { columnName: 'kit_product_id' } },
2867
+ 'quantity',
2868
+ { product: { columnName: 'product', foreignKeyColumn: { id: 'product_id' }, fields: commonFields } },
2869
+ ],
2870
+ },
2871
+ },
2872
+ {
2873
+ reviews: {
2874
+ columnName: 'reviews',
2875
+ foreignKeyColumn: { product_id: 'id' },
2876
+ fields: this.reviewsFields,
2877
+ },
2878
+ },
2879
+ {
2880
+ metadata: {
2881
+ columnName: 'metadata',
2882
+ fields: ['title', 'description'],
2883
+ bindPersistData: (value) => ({
2884
+ metadata: { data: value },
2885
+ }),
2886
+ },
2887
+ },
2888
+ ];
2889
+ }
2890
+ get reviewsFields() {
2891
+ return [
2892
+ 'id',
2893
+ 'shop',
2894
+ 'rate',
2895
+ 'author',
2896
+ 'email',
2897
+ 'location',
2898
+ 'review',
2899
+ 'status',
2900
+ 'title',
2901
+ { personId: { columnName: 'person_id' } },
2902
+ 'points',
2903
+ { orderId: { columnName: 'order_id' } },
2904
+ { createdAt: { columnName: 'created_at' } },
2905
+ { updatedAt: { columnName: 'updated_at' } },
2906
+ ];
2907
+ }
2908
+ async create(params) {
2909
+ const { metadata, ...data } = params;
2910
+ const product = await super.create(omit({ ...data, metadata: metadata || { description: null, title: null } }, ['reviews']));
2911
+ try {
2912
+ product.reviews = data.reviews && (await this.updateReviews(+product.id, data));
2913
+ }
2914
+ catch (error) {
2915
+ await this.delete({ id: product.id });
2916
+ throw error;
2917
+ }
2918
+ return product;
2919
+ }
2920
+ async get(identifiers) {
2921
+ const product = Number.isNaN(+identifiers.id)
2922
+ ? (await this.find({ filters: { firestoreId: identifiers.id } })).data?.[0]
2923
+ : await super.get(identifiers);
2924
+ if (product.productId)
2925
+ throw new NotFoundError('Product not found, it is a variant');
2926
+ product.reviews = product.reviews || (await this.findReviewsByProduct(+product.id));
2927
+ return product;
2928
+ }
2929
+ async find(params) {
2930
+ const { filters, fields, ...options } = params || {};
2931
+ const bindFields = fields ||
2932
+ this.fields
2933
+ .map((field) => (typeof field === 'string' ? field : Object.keys(field).shift()))
2934
+ .filter((field) => field !== 'reviews');
2935
+ return super.find({
2936
+ ...options,
2937
+ filters: { ...filters, productId: { operator: Where.ISNULL } },
2938
+ fields: bindFields,
2939
+ });
2940
+ }
2941
+ async getBySlug(slug) {
2942
+ const result = await this.find({
2943
+ filters: {
2944
+ slug,
2945
+ },
2946
+ });
2947
+ const product = result?.data?.shift();
2948
+ product.reviews = await this.findReviewsByProduct(+product.id);
2949
+ return product;
2950
+ }
2951
+ async update(params) {
2952
+ const { categories, kitProducts, reviews, id: checkId, rate, metadata, ...data } = params;
2953
+ const plainData = this.paramsToPlain({ id: checkId });
2954
+ const id = await this.getId(plainData.id);
2955
+ const product = await super.update({ id, ...data });
2956
+ product.categories = categories && (await this.updateCategories(+id, { categories }));
2957
+ product.kitProducts = kitProducts && (await this.updateKitProducts(+id, { kitProducts }));
2958
+ product.reviews = reviews && (await this.updateReviews(+id, { reviews }));
2959
+ product.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
2960
+ return product;
2961
+ }
2962
+ async fetchReviews(status) {
2963
+ const reviewsExpression = {
2964
+ status: status === 'pending'
2965
+ ? { [HasuraGraphQLWhere.ISNULL]: true }
2966
+ : { [HasuraGraphQLWhere.EQUALS]: status === 'approved' },
2967
+ };
2968
+ const { product: data } = await this.query('product', ['id', 'name', 'sku', { reviews: { columnName: 'reviews', fields: this.reviewsFields } }], {
2969
+ where: { value: { reviews: reviewsExpression }, type: 'product_bool_exp', required: true },
2970
+ });
2971
+ return data.reduce((reviews, product) => [
2972
+ ...reviews,
2973
+ ...product.reviews
2974
+ .filter((review) => (status === 'pending' && [undefined, null].includes(review.status)) ||
2975
+ (status === 'approved' && review.status === true) ||
2976
+ (status === 'rejected' && review.status === false))
2977
+ .map((review) => ({
2978
+ ...this.bindReviewToModel(review),
2979
+ productId: product.id,
2980
+ productName: product.name,
2981
+ productSku: product.sku,
2982
+ })),
2983
+ ], []);
2984
+ }
2985
+ async updateCategories(productId, { categories }) {
2986
+ if ('action' in categories && categories.action === 'remove') {
2987
+ await this.mutation('delete_category_product', ['affected_rows'], {
2988
+ where: {
2989
+ type: 'category_product_bool_exp',
2990
+ required: true,
2991
+ value: { product_id: { _eq: productId } },
2992
+ },
2993
+ });
2994
+ return [];
2995
+ }
2996
+ const plainData = this.paramsToPlain({ categories });
2997
+ if (!plainData.categories || plainData.categories.length <= 0)
2998
+ return [];
2999
+ await this.mutation('delete_category_product', ['affected_rows'], {
3000
+ where: {
3001
+ type: 'category_product_bool_exp',
3002
+ required: true,
3003
+ value: { product_id: { _eq: productId } },
3004
+ },
3005
+ });
3006
+ await this.mutation('insert_category_product', ['affected_rows'], {
3007
+ objects: {
3008
+ type: '[category_product_insert_input!]',
3009
+ required: true,
3010
+ value: plainData.categories.map((categoryId) => ({ category_id: categoryId, product_id: productId })),
3011
+ },
3012
+ });
3013
+ return plainData.categories;
3014
+ }
3015
+ async updateKitProducts(productId, { kitProducts }) {
3016
+ const plainData = this.paramsToPlain({ kitProducts });
3017
+ await this.mutation('delete_product_kit', ['affected_rows'], {
3018
+ where: {
3019
+ type: 'product_kit_bool_exp',
3020
+ required: true,
3021
+ value: { kit_product_id: { _eq: productId } },
3022
+ },
3023
+ });
3024
+ await this.mutation('insert_product_kit', ['affected_rows'], {
3025
+ objects: {
3026
+ type: '[product_kit_insert_input!]',
3027
+ required: true,
3028
+ value: plainData.kitProducts.map((kitProduct) => ({
3029
+ kit_product_id: productId,
3030
+ product_id: kitProduct.productId || kitProduct.product.id,
3031
+ quantity: kitProduct.quantity,
3032
+ })),
3033
+ },
3034
+ });
3035
+ return plainData.kitProducts;
3036
+ }
3037
+ async updateReviews(productId, { reviews }) {
3038
+ if (!reviews)
3039
+ return [];
3040
+ if ('action' in reviews && reviews.action === 'remove') {
3041
+ const reviewIds = await Promise.all(reviews.value.map(async (reviewData) => {
3042
+ const review = await this.findReview(reviewData, productId);
3043
+ return review?.id;
3044
+ }));
3045
+ await this.mutation('delete_product_review', ['affected_rows'], {
3046
+ where: { value: { id: { _in: reviewIds.filter(Boolean) } }, type: 'product_review_bool_exp', required: true },
3047
+ });
3048
+ return reviews.value.map((review, index) => !reviewIds[index] && review).filter(Boolean);
3049
+ }
3050
+ const plainData = this.paramsToPlain({ reviews });
3051
+ if (!plainData.reviews || plainData.reviews.length <= 0)
3052
+ return [];
3053
+ return Promise.all(plainData.reviews.map(async (reviewData) => {
3054
+ const review = await this.findReview(reviewData, productId);
3055
+ if (review.id)
3056
+ return this.bindReviewToModel((await this.mutation('update_product_review_by_pk', this.reviewsFields, {
3057
+ pk_columns: {
3058
+ value: { id: review.id },
3059
+ type: 'product_review_pk_columns_input',
3060
+ required: true,
3061
+ },
3062
+ _set: {
3063
+ value: omit(this.bindReviewToHasura(reviewData), ['id', 'product_id']),
3064
+ type: 'product_review_set_input',
3065
+ required: true,
3066
+ },
3067
+ })).update_product_review_by_pk);
3068
+ return this.bindReviewToModel((await this.mutation('insert_product_review_one', this.reviewsFields, {
3069
+ object: {
3070
+ value: omit({ ...this.bindReviewToHasura(reviewData), product_id: productId }, ['id']),
3071
+ type: 'product_review_insert_input',
3072
+ required: true,
3073
+ },
3074
+ })).insert_product_review_one);
3075
+ }));
3076
+ }
3077
+ async updateMetadata(productId, { metadata }) {
3078
+ const plainData = this.paramsToPlain({ metadata });
3079
+ if (!plainData.metadata)
3080
+ return;
3081
+ await this.mutation('update_product_metadata_by_pk', ['product_id'], {
3082
+ pk_columns: {
3083
+ value: { product_id: productId },
3084
+ type: 'product_metadata_pk_columns_input',
3085
+ required: true,
3086
+ },
3087
+ _set: {
3088
+ value: omit(metadata, ['product_id']),
3089
+ type: 'product_metadata_set_input',
3090
+ required: true,
3091
+ },
3092
+ });
3093
+ return plainData.metadata;
3094
+ }
3095
+ async getId(id) {
3096
+ if (!Number.isNaN(+id))
3097
+ return id;
3098
+ const { data } = await this.find({ filters: { firestoreId: id } });
3099
+ if (data?.[0]?.id)
3100
+ return data?.[0]?.id;
3101
+ throw new NotFoundError(`Product with id ${id} not found`);
3102
+ }
3103
+ async findReviewsByProduct(productId) {
3104
+ const { product_review: data } = await this.query('product_review', this.reviewsFields, {
3105
+ where: {
3106
+ value: {
3107
+ product_id: { _eq: productId },
3108
+ },
3109
+ type: 'product_review_bool_exp',
3110
+ required: true,
3111
+ },
3112
+ });
3113
+ return data && data.map((review) => this.bindReviewToModel(review));
3114
+ }
3115
+ async findReview(review, productId) {
3116
+ if (review.id)
3117
+ return review;
3118
+ let loadedReview;
3119
+ if (review.personId)
3120
+ loadedReview = await this.getReviewByPersonId(review.personId, productId, review.orderId);
3121
+ if (!loadedReview && review.author && review.email)
3122
+ loadedReview = await this.getReviewByAuthorAndEmail(review.author, review.email, productId, review.orderId);
3123
+ return loadedReview || review;
3124
+ }
3125
+ async getReviewByPersonId(personId, productId, orderId) {
3126
+ const { product_review: data } = await this.query('product_review', this.reviewsFields, {
3127
+ where: {
3128
+ value: {
3129
+ product_id: { _eq: productId },
3130
+ person_id: { _eq: personId },
3131
+ ...(orderId && { order_id: { _eq: orderId } }),
3132
+ },
3133
+ type: `product_review_bool_exp`,
3134
+ required: true,
3135
+ },
3136
+ });
3137
+ return data && data[0] && this.bindReviewToModel(data[0]);
3138
+ }
3139
+ async getReviewByAuthorAndEmail(author, email, productId, orderId) {
3140
+ const { product_review: data } = await this.query('product_review', this.reviewsFields, {
3141
+ where: {
3142
+ value: {
3143
+ product_id: { _eq: productId },
3144
+ author: { _eq: author },
3145
+ email: { _eq: email },
3146
+ ...(orderId && { order_id: { _eq: orderId } }),
3147
+ },
3148
+ type: `product_review_bool_exp`,
3149
+ required: true,
3150
+ },
3151
+ });
3152
+ return data && data[0] && this.bindReviewToModel(data[0]);
3153
+ }
3154
+ }
3155
+
3156
+ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
3157
+ constructor(endpoint, authOptions) {
3158
+ super({
3159
+ tableName: 'product',
3160
+ model: VariantHasuraGraphQL,
3161
+ endpoint,
3162
+ authOptions,
3163
+ fields: [
3164
+ { id: { columnName: 'id', to: (value) => +value, from: (value) => value.toString() } },
3165
+ { firestoreId: { columnName: 'firestore_id' } },
3166
+ { productId: { columnName: 'main_product_id', to: (value) => +value, from: (value) => value?.toString() } },
3167
+ { EAN: { columnName: 'ean' } },
3168
+ { costPrice: { columnName: 'cost_price' } },
3169
+ {
3170
+ price: {
3171
+ columnName: 'price',
3172
+ from: (price, data) => ({
3173
+ price,
3174
+ fullPrice: data.full_price,
3175
+ subscriberDiscountPercentage: data.subscriber_discount_percentage,
3176
+ subscriberPrice: data.subscriber_price,
3177
+ }),
3178
+ bindFindFilter: (sentence) => {
3179
+ const filters = Object.values(sentence).shift();
3180
+ return {
3181
+ ...((filters?.price || filters?.price === 0) && { price: filters.price }),
3182
+ ...((filters.fullPrice || filters.fullPrice === 0) && { full_price: filters.fullPrice }),
3183
+ ...((filters.subscriberDiscountPercentage || filters.subscriberDiscountPercentage === 0) && {
3184
+ subscriber_discount_percentage: filters.subscriberDiscountPercentage,
3185
+ }),
3186
+ ...((filters.subscriberPrice || filters.subscriberPrice === 0) && {
3187
+ subscriber_price: filters.subscriberPrice,
3188
+ }),
3189
+ };
3190
+ },
3191
+ bindPersistData: (priceData) => ({
3192
+ ...(priceData?.price >= 0 && { price: priceData.price }),
3193
+ ...(priceData.fullPrice >= 0 && { full_price: priceData.fullPrice }),
3194
+ ...(priceData.subscriberDiscountPercentage >= 0 && {
3195
+ subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
3196
+ }),
3197
+ ...(priceData.subscriberPrice >= 0 && { subscriber_price: priceData.subscriberPrice }),
3198
+ }),
3199
+ },
3200
+ },
3201
+ { fullPrice: { columnName: 'full_price' } },
3202
+ { subscriberDiscountPercentage: { columnName: 'subscriber_discount_percentage' } },
3203
+ { subscriberPrice: { columnName: 'subscriber_price' } },
3204
+ 'sku',
3205
+ {
3206
+ stock: {
3207
+ columnName: 'stock',
3208
+ from: (quantity) => ({ quantity }),
3209
+ to: (value) => (isNil(value?.quantity) ? value : value?.quantity),
3210
+ },
3211
+ },
3212
+ 'weight',
3213
+ { name: { to: () => '', from: () => undefined } },
3214
+ { hasVariants: { columnName: 'has_variants', to: () => false, from: () => undefined } },
3215
+ { createdAt: { columnName: 'created_at' } },
3216
+ { updatedAt: { columnName: 'updated_at' } },
3217
+ {
3218
+ grade: {
3219
+ columnName: 'grade',
3220
+ type: HasuraGraphQLColumnType.Jsonb,
3221
+ },
3222
+ },
3223
+ ],
3224
+ });
3225
+ }
3226
+ async get(identifiers) {
3227
+ const variant = Number.isNaN(+identifiers.id)
3228
+ ? (await this.find({ filters: { firestoreId: identifiers.id } })).data?.[0]
3229
+ : await super.get(identifiers);
3230
+ if (!variant.productId)
3231
+ throw new NotFoundError(`Variant not found, it is a product`);
3232
+ return variant;
3233
+ }
3234
+ async find(params) {
3235
+ const { filters, ...options } = params || {};
3236
+ return super.find({ ...options, filters: { productId: { operator: Where.ISNOTNULL }, ...filters } });
3237
+ }
3238
+ async update(params) {
3239
+ const { productId, id: checkId, ...data } = params;
3240
+ const dataWithProductId = this.paramsToPlain({ id: checkId, productId });
3241
+ const id = await this.getId(dataWithProductId.id);
3242
+ const product = await super.update({ id, ...data });
3243
+ product.productId = dataWithProductId.productId;
3244
+ return product;
3245
+ }
3246
+ async getId(id) {
3247
+ if (!Number.isNaN(+id))
3248
+ return id;
3249
+ const { data } = await this.find({ filters: { firestoreId: id } });
3250
+ if (data?.[0]?.id)
3251
+ return data?.[0]?.id;
3252
+ throw new NotFoundError(`Product with id ${id} not found`);
3253
+ }
3254
+ }
3255
+
3256
+ /**
3257
+ * Generated bundle index. Do not edit.
3258
+ */
3259
+
3260
+ export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Category, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, FilterType, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, Register, RegisterFirebaseAuthService, RequiredArgumentError, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
3261
+ //# sourceMappingURL=infrab4a-connect.mjs.map