@infrab4a/connect-angular 5.8.14 → 5.8.16

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 (295) hide show
  1. package/angular-connect.module.d.ts +36 -0
  2. package/angular-elastic-search.module.d.ts +9 -0
  3. package/angular-firebase-auth.module.d.ts +11 -0
  4. package/angular-firestore.module.d.ts +17 -0
  5. package/angular-hasura-graphql.module.d.ts +14 -0
  6. package/angular-vertex-search.module.d.ts +9 -0
  7. package/consts/backend-url.const.d.ts +1 -0
  8. package/consts/category-structure.d.ts +1 -0
  9. package/consts/default-shop.const.d.ts +1 -0
  10. package/consts/es-config.const.d.ts +1 -0
  11. package/consts/firebase-const.d.ts +4 -0
  12. package/consts/hasura-options.const.d.ts +1 -0
  13. package/consts/index.d.ts +8 -0
  14. package/consts/persistence.const.d.ts +1 -0
  15. package/consts/storage-base-url.const.d.ts +1 -0
  16. package/consts/vertex-config.const.d.ts +1 -0
  17. package/esm2020/angular-connect.module.mjs +289 -0
  18. package/esm2020/angular-elastic-search.module.mjs +34 -0
  19. package/esm2020/angular-firebase-auth.module.mjs +141 -0
  20. package/esm2020/angular-firestore.module.mjs +625 -0
  21. package/esm2020/angular-hasura-graphql.module.mjs +421 -0
  22. package/esm2020/angular-vertex-search.module.mjs +34 -0
  23. package/esm2020/consts/backend-url.const.mjs +2 -0
  24. package/esm2020/consts/category-structure.mjs +2 -0
  25. package/esm2020/consts/default-shop.const.mjs +2 -0
  26. package/esm2020/consts/es-config.const.mjs +2 -0
  27. package/esm2020/consts/firebase-const.mjs +5 -0
  28. package/esm2020/consts/hasura-options.const.mjs +2 -0
  29. package/esm2020/consts/index.mjs +9 -0
  30. package/esm2020/consts/persistence.const.mjs +2 -0
  31. package/esm2020/consts/storage-base-url.const.mjs +2 -0
  32. package/esm2020/consts/vertex-config.const.mjs +2 -0
  33. package/esm2020/helpers/index.mjs +2 -0
  34. package/esm2020/helpers/mobile-operation-system-checker.helper.mjs +7 -0
  35. package/esm2020/index.mjs +7 -0
  36. package/esm2020/infrab4a-connect-angular.mjs +5 -0
  37. package/esm2020/interfaces/catalog-strategies.interface.mjs +2 -0
  38. package/esm2020/interfaces/category-facades.interface.mjs +2 -0
  39. package/esm2020/interfaces/index.mjs +3 -0
  40. package/esm2020/persistence/cookie-data-persistence.mjs +22 -0
  41. package/esm2020/persistence/data-persistence.mjs +2 -0
  42. package/esm2020/persistence/index.mjs +3 -0
  43. package/esm2020/services/auth.service.mjs +37 -0
  44. package/esm2020/services/cart/cart-services.facade.mjs +21 -0
  45. package/esm2020/services/cart/index.mjs +2 -0
  46. package/esm2020/services/cart.service.mjs +84 -0
  47. package/esm2020/services/catalog/adapters/category-structure.adapter.mjs +2 -0
  48. package/esm2020/services/catalog/adapters/index.mjs +4 -0
  49. package/esm2020/services/catalog/adapters/new-category-structure.adapter.mjs +43 -0
  50. package/esm2020/services/catalog/adapters/old-category-structure.adapter.mjs +23 -0
  51. package/esm2020/services/catalog/catalog.service.mjs +111 -0
  52. package/esm2020/services/catalog/category.service.mjs +42 -0
  53. package/esm2020/services/catalog/context/catalog-search.context.mjs +40 -0
  54. package/esm2020/services/catalog/enums/index.mjs +2 -0
  55. package/esm2020/services/catalog/enums/product-sorts.enum.mjs +11 -0
  56. package/esm2020/services/catalog/facades/catalog-service.facade.mjs +32 -0
  57. package/esm2020/services/catalog/facades/catalog-strategies.facade.mjs +17 -0
  58. package/esm2020/services/catalog/facades/category-repository.facade.mjs +20 -0
  59. package/esm2020/services/catalog/facades/category-service.facade.mjs +30 -0
  60. package/esm2020/services/catalog/facades/index.mjs +6 -0
  61. package/esm2020/services/catalog/facades/product-catalog.facade.mjs +21 -0
  62. package/esm2020/services/catalog/helpers/brand-manager.helper.mjs +62 -0
  63. package/esm2020/services/catalog/helpers/catalog-filter.helper.mjs +44 -0
  64. package/esm2020/services/catalog/helpers/catalog-sort.helper.mjs +52 -0
  65. package/esm2020/services/catalog/helpers/index.mjs +5 -0
  66. package/esm2020/services/catalog/helpers/product-fields.helper.mjs +43 -0
  67. package/esm2020/services/catalog/index.mjs +8 -0
  68. package/esm2020/services/catalog/models/category-with-tree.model.mjs +10 -0
  69. package/esm2020/services/catalog/models/index.mjs +2 -0
  70. package/esm2020/services/catalog/services/catalog-helpers.service.mjs +33 -0
  71. package/esm2020/services/catalog/services/catalog-operations.facade.mjs +26 -0
  72. package/esm2020/services/catalog/services/catalog-repository.service.mjs +25 -0
  73. package/esm2020/services/catalog/services/index.mjs +5 -0
  74. package/esm2020/services/catalog/services/product-management.facade.mjs +25 -0
  75. package/esm2020/services/catalog/strategies/category-search.strategy.mjs +133 -0
  76. package/esm2020/services/catalog/strategies/index.mjs +4 -0
  77. package/esm2020/services/catalog/strategies/profile-search.strategy.mjs +42 -0
  78. package/esm2020/services/catalog/strategies/term-search.strategy.mjs +126 -0
  79. package/esm2020/services/catalog/strategies/types/strategy-params.type.mjs +2 -0
  80. package/esm2020/services/catalog/types/fetch-products-options.type.mjs +2 -0
  81. package/esm2020/services/catalog/types/fetch-products-params.type.mjs +2 -0
  82. package/esm2020/services/catalog/types/fetch-products-response.type.mjs +2 -0
  83. package/esm2020/services/catalog/types/index.mjs +6 -0
  84. package/esm2020/services/catalog/types/method-params.type.mjs +2 -0
  85. package/esm2020/services/catalog/types/product-sort.type.mjs +2 -0
  86. package/esm2020/services/catalog/wishlist.service.mjs +258 -0
  87. package/esm2020/services/checkout/checkout-dependencies.facade.mjs +20 -0
  88. package/esm2020/services/checkout/checkout-repositories.facade.mjs +20 -0
  89. package/esm2020/services/checkout/index.mjs +3 -0
  90. package/esm2020/services/checkout.service.mjs +131 -0
  91. package/esm2020/services/coupon/coupon-repositories.facade.mjs +24 -0
  92. package/esm2020/services/coupon/index.mjs +2 -0
  93. package/esm2020/services/helpers/index.mjs +2 -0
  94. package/esm2020/services/helpers/util.helper.mjs +18 -0
  95. package/esm2020/services/home-shop/home-shop-repositories.facade.mjs +24 -0
  96. package/esm2020/services/home-shop/index.mjs +2 -0
  97. package/esm2020/services/home-shop.service.mjs +130 -0
  98. package/esm2020/services/index.mjs +10 -0
  99. package/esm2020/services/order-product-review.service.mjs +126 -0
  100. package/esm2020/services/order-recurrence.service.mjs +76 -0
  101. package/esm2020/services/order.service.mjs +30 -0
  102. package/esm2020/services/shared/configuration.facade.mjs +29 -0
  103. package/esm2020/services/shared/index.mjs +2 -0
  104. package/esm2020/services/types/index.mjs +5 -0
  105. package/esm2020/services/types/pending-product-review.type.mjs +2 -0
  106. package/esm2020/services/types/product-review-create.type.mjs +2 -0
  107. package/esm2020/services/types/required-checkout-data.type.mjs +2 -0
  108. package/esm2020/services/types/required-checkout-subscription-data.type.mjs +2 -0
  109. package/esm2020/types/firebase-app-config.type.mjs +2 -0
  110. package/esm2020/types/index.mjs +2 -0
  111. package/fesm2015/infrab4a-connect-angular.mjs +3476 -0
  112. package/fesm2015/infrab4a-connect-angular.mjs.map +1 -0
  113. package/fesm2020/infrab4a-connect-angular.mjs +3411 -0
  114. package/fesm2020/infrab4a-connect-angular.mjs.map +1 -0
  115. package/helpers/index.d.ts +1 -0
  116. package/helpers/mobile-operation-system-checker.helper.d.ts +3 -0
  117. package/index.d.ts +6 -0
  118. package/interfaces/catalog-strategies.interface.d.ts +31 -0
  119. package/interfaces/category-facades.interface.d.ts +6 -0
  120. package/interfaces/index.d.ts +2 -0
  121. package/package.json +24 -4
  122. package/persistence/cookie-data-persistence.d.ts +10 -0
  123. package/persistence/data-persistence.d.ts +6 -0
  124. package/persistence/index.d.ts +2 -0
  125. package/services/auth.service.d.ts +18 -0
  126. package/services/cart/cart-services.facade.d.ts +12 -0
  127. package/services/cart/index.d.ts +1 -0
  128. package/services/cart.service.d.ts +27 -0
  129. package/services/catalog/adapters/category-structure.adapter.d.ts +4 -0
  130. package/services/catalog/adapters/index.d.ts +3 -0
  131. package/services/catalog/adapters/new-category-structure.adapter.d.ts +12 -0
  132. package/services/catalog/adapters/old-category-structure.adapter.d.ts +10 -0
  133. package/services/catalog/catalog.service.d.ts +24 -0
  134. package/services/catalog/category.service.d.ts +23 -0
  135. package/services/catalog/context/catalog-search.context.d.ts +14 -0
  136. package/services/catalog/enums/index.d.ts +1 -0
  137. package/services/catalog/enums/product-sorts.enum.d.ts +9 -0
  138. package/services/catalog/facades/catalog-service.facade.d.ts +15 -0
  139. package/services/catalog/facades/catalog-strategies.facade.d.ts +10 -0
  140. package/services/catalog/facades/category-repository.facade.d.ts +9 -0
  141. package/services/catalog/facades/category-service.facade.d.ts +15 -0
  142. package/{src/services/catalog/facades/index.ts → services/catalog/facades/index.d.ts} +5 -5
  143. package/services/catalog/facades/product-catalog.facade.d.ts +10 -0
  144. package/services/catalog/helpers/brand-manager.helper.d.ts +14 -0
  145. package/services/catalog/helpers/catalog-filter.helper.d.ts +8 -0
  146. package/services/catalog/helpers/catalog-sort.helper.d.ts +7 -0
  147. package/services/catalog/helpers/index.d.ts +4 -0
  148. package/services/catalog/helpers/product-fields.helper.d.ts +7 -0
  149. package/services/catalog/index.d.ts +7 -0
  150. package/services/catalog/models/category-with-tree.model.d.ts +4 -0
  151. package/services/catalog/models/index.d.ts +1 -0
  152. package/services/catalog/services/catalog-helpers.service.d.ts +17 -0
  153. package/services/catalog/services/catalog-operations.facade.d.ts +13 -0
  154. package/services/catalog/services/catalog-repository.service.d.ts +12 -0
  155. package/{src/services/catalog/services/index.ts → services/catalog/services/index.d.ts} +4 -4
  156. package/services/catalog/services/product-management.facade.d.ts +12 -0
  157. package/services/catalog/strategies/category-search.strategy.d.ts +19 -0
  158. package/services/catalog/strategies/index.d.ts +3 -0
  159. package/services/catalog/strategies/profile-search.strategy.d.ts +14 -0
  160. package/services/catalog/strategies/term-search.strategy.d.ts +20 -0
  161. package/services/catalog/strategies/types/strategy-params.type.d.ts +59 -0
  162. package/services/catalog/types/fetch-products-options.type.d.ts +8 -0
  163. package/services/catalog/types/fetch-products-params.type.d.ts +25 -0
  164. package/services/catalog/types/fetch-products-response.type.d.ts +19 -0
  165. package/services/catalog/types/index.d.ts +5 -0
  166. package/services/catalog/types/method-params.type.d.ts +17 -0
  167. package/services/catalog/types/product-sort.type.d.ts +2 -0
  168. package/services/catalog/wishlist.service.d.ts +60 -0
  169. package/services/checkout/checkout-dependencies.facade.d.ts +10 -0
  170. package/services/checkout/checkout-repositories.facade.d.ts +9 -0
  171. package/{src/services/checkout/index.ts → services/checkout/index.d.ts} +2 -2
  172. package/services/checkout.service.d.ts +33 -0
  173. package/services/coupon/coupon-repositories.facade.d.ts +10 -0
  174. package/{src/services/coupon/index.ts → services/coupon/index.d.ts} +1 -1
  175. package/services/helpers/index.d.ts +1 -0
  176. package/services/helpers/util.helper.d.ts +3 -0
  177. package/services/home-shop/home-shop-repositories.facade.d.ts +10 -0
  178. package/{src/services/home-shop/index.ts → services/home-shop/index.d.ts} +1 -1
  179. package/services/home-shop.service.d.ts +34 -0
  180. package/services/index.d.ts +9 -0
  181. package/services/order-product-review.service.d.ts +18 -0
  182. package/services/order-recurrence.service.d.ts +25 -0
  183. package/services/order.service.d.ts +13 -0
  184. package/services/shared/configuration.facade.d.ts +12 -0
  185. package/services/shared/index.d.ts +1 -0
  186. package/services/types/index.d.ts +4 -0
  187. package/services/types/pending-product-review.type.d.ts +12 -0
  188. package/services/types/product-review-create.type.d.ts +14 -0
  189. package/services/types/required-checkout-data.type.d.ts +2 -0
  190. package/services/types/required-checkout-subscription-data.type.d.ts +2 -0
  191. package/types/firebase-app-config.type.d.ts +1 -0
  192. package/types/index.d.ts +1 -0
  193. package/eslint.config.js +0 -18
  194. package/index.ts +0 -1
  195. package/karma.conf.js +0 -32
  196. package/ng-package.json +0 -8
  197. package/project.json +0 -37
  198. package/src/angular-connect.module.ts +0 -270
  199. package/src/angular-elastic-search.module.ts +0 -23
  200. package/src/angular-firebase-auth.module.ts +0 -101
  201. package/src/angular-firestore.module.ts +0 -416
  202. package/src/angular-hasura-graphql.module.ts +0 -269
  203. package/src/angular-vertex-search.module.ts +0 -23
  204. package/src/consts/backend-url.const.ts +0 -1
  205. package/src/consts/category-structure.ts +0 -1
  206. package/src/consts/default-shop.const.ts +0 -1
  207. package/src/consts/es-config.const.ts +0 -1
  208. package/src/consts/firebase-const.ts +0 -5
  209. package/src/consts/hasura-options.const.ts +0 -1
  210. package/src/consts/index.ts +0 -8
  211. package/src/consts/persistence.const.ts +0 -1
  212. package/src/consts/storage-base-url.const.ts +0 -1
  213. package/src/consts/vertex-config.const.ts +0 -1
  214. package/src/helpers/index.ts +0 -1
  215. package/src/helpers/mobile-operation-system-checker.helper.ts +0 -10
  216. package/src/index.ts +0 -6
  217. package/src/interfaces/catalog-strategies.interface.ts +0 -36
  218. package/src/interfaces/category-facades.interface.ts +0 -7
  219. package/src/interfaces/index.ts +0 -2
  220. package/src/persistence/cookie-data-persistence.ts +0 -21
  221. package/src/persistence/data-persistence.ts +0 -7
  222. package/src/persistence/index.ts +0 -2
  223. package/src/services/auth.service.ts +0 -39
  224. package/src/services/cart/cart-services.facade.ts +0 -14
  225. package/src/services/cart/index.ts +0 -1
  226. package/src/services/cart.service.ts +0 -148
  227. package/src/services/catalog/adapters/category-structure.adapter.ts +0 -5
  228. package/src/services/catalog/adapters/index.ts +0 -3
  229. package/src/services/catalog/adapters/new-category-structure.adapter.ts +0 -42
  230. package/src/services/catalog/adapters/old-category-structure.adapter.ts +0 -17
  231. package/src/services/catalog/catalog.service.ts +0 -153
  232. package/src/services/catalog/category.service.ts +0 -56
  233. package/src/services/catalog/context/catalog-search.context.ts +0 -59
  234. package/src/services/catalog/enums/index.ts +0 -1
  235. package/src/services/catalog/enums/product-sorts.enum.ts +0 -9
  236. package/src/services/catalog/facades/catalog-service.facade.ts +0 -32
  237. package/src/services/catalog/facades/catalog-strategies.facade.ts +0 -12
  238. package/src/services/catalog/facades/category-repository.facade.ts +0 -10
  239. package/src/services/catalog/facades/category-service.facade.ts +0 -25
  240. package/src/services/catalog/facades/product-catalog.facade.ts +0 -13
  241. package/src/services/catalog/helpers/brand-manager.helper.ts +0 -69
  242. package/src/services/catalog/helpers/catalog-filter.helper.ts +0 -50
  243. package/src/services/catalog/helpers/catalog-sort.helper.ts +0 -54
  244. package/src/services/catalog/helpers/index.ts +0 -4
  245. package/src/services/catalog/helpers/product-fields.helper.ts +0 -39
  246. package/src/services/catalog/index.ts +0 -7
  247. package/src/services/catalog/models/category-with-tree.model.ts +0 -7
  248. package/src/services/catalog/models/index.ts +0 -1
  249. package/src/services/catalog/services/catalog-helpers.service.ts +0 -35
  250. package/src/services/catalog/services/catalog-operations.facade.ts +0 -24
  251. package/src/services/catalog/services/catalog-repository.service.ts +0 -20
  252. package/src/services/catalog/services/product-management.facade.ts +0 -20
  253. package/src/services/catalog/strategies/category-search.strategy.ts +0 -168
  254. package/src/services/catalog/strategies/index.ts +0 -3
  255. package/src/services/catalog/strategies/profile-search.strategy.ts +0 -51
  256. package/src/services/catalog/strategies/term-search.strategy.ts +0 -163
  257. package/src/services/catalog/strategies/types/strategy-params.type.ts +0 -59
  258. package/src/services/catalog/types/fetch-products-options.type.ts +0 -10
  259. package/src/services/catalog/types/fetch-products-params.type.ts +0 -27
  260. package/src/services/catalog/types/fetch-products-response.type.ts +0 -11
  261. package/src/services/catalog/types/index.ts +0 -5
  262. package/src/services/catalog/types/method-params.type.ts +0 -21
  263. package/src/services/catalog/types/product-sort.type.ts +0 -3
  264. package/src/services/catalog/wishlist.service.ts +0 -364
  265. package/src/services/checkout/checkout-dependencies.facade.ts +0 -13
  266. package/src/services/checkout/checkout-repositories.facade.ts +0 -10
  267. package/src/services/checkout-subscription.service.ts +0 -76
  268. package/src/services/checkout.service.ts +0 -236
  269. package/src/services/coupon/coupon-repositories.facade.ts +0 -11
  270. package/src/services/coupon/types/coupon-params.type.ts +0 -15
  271. package/src/services/coupon.service.ts +0 -347
  272. package/src/services/errors/group-invalid-coupon.error.ts +0 -9
  273. package/src/services/errors/index.ts +0 -2
  274. package/src/services/errors/invalid-coupon.error.ts +0 -7
  275. package/src/services/helpers/index.ts +0 -1
  276. package/src/services/helpers/util.helper.ts +0 -17
  277. package/src/services/home-shop/home-shop-repositories.facade.ts +0 -11
  278. package/src/services/home-shop.service.ts +0 -210
  279. package/src/services/index.ts +0 -12
  280. package/src/services/order-product-review.service.ts +0 -135
  281. package/src/services/order-recurrence.service.ts +0 -121
  282. package/src/services/order.service.ts +0 -23
  283. package/src/services/shared/configuration.facade.ts +0 -21
  284. package/src/services/shared/index.ts +0 -1
  285. package/src/services/types/index.ts +0 -4
  286. package/src/services/types/pending-product-review.type.ts +0 -12
  287. package/src/services/types/product-review-create.type.ts +0 -15
  288. package/src/services/types/required-checkout-data.type.ts +0 -3
  289. package/src/services/types/required-checkout-subscription-data.type.ts +0 -3
  290. package/src/types/firebase-app-config.type.ts +0 -1
  291. package/src/types/index.ts +0 -1
  292. package/tsconfig.json +0 -17
  293. package/tsconfig.lib.json +0 -13
  294. package/tsconfig.lib.prod.json +0 -13
  295. package/tsconfig.spec.json +0 -17
@@ -0,0 +1,3476 @@
1
+ import * as i0 from '@angular/core';
2
+ import { NgModule, InjectionToken, PLATFORM_ID, Injectable, Inject } from '@angular/core';
3
+ import * as i1$3 from '@angular/fire/app';
4
+ import { FirebaseApp, provideFirebaseApp, getApp, initializeApp } from '@angular/fire/app';
5
+ import * as i2 from '@angular/fire/app-check';
6
+ import { provideAppCheck, initializeAppCheck } from '@angular/fire/app-check';
7
+ import * as i3$1 from '@angular/fire/storage';
8
+ import { Storage, provideStorage, getStorage } from '@angular/fire/storage';
9
+ import * as i3 from '@infrab4a/connect';
10
+ import { ProductsIndex, AxiosAdapter, Authentication, AuthenticationFirebaseAuthService, Register, RegisterFirebaseAuthService, SignOut, RecoveryPassword, ConnectFirestoreService, UserBeautyProfileFirestoreRepository, Buy2WinFirestoreRepository, CategoryFirestoreRepository, CheckoutFirestoreRepository, CheckoutSubscriptionFirestoreRepository, CouponFirestoreRepository, CampaignHashtagFirestoreRepository, CampaignHashtagPostsFirestoreRepository, CampaignDashboardFirestoreRepository, SubscriptionEditionFirestoreRepository, GroupFirestoreRepository, HomeFirestoreRepository, LeadFirestoreRepository, LegacyOrderFirestoreRepository, ShopMenuFirestoreRepository, OrderFirestoreRepository, PaymentFirestoreRepository, ShoppingRecurrenceFirestoreRepository, ShoppingRecurrenceEditionFirestoreRepository, ShoppingRecurrenceErrorLogFirestoreRepository, ProductFirestoreRepository, ShopSettingsFirestoreRepository, SubscriptionPaymentFirestoreRepository, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionFirestoreRepository, UserFirestoreRepository, UserAddressFirestoreRepository, UserPaymentMethodFirestoreRepository, SubscriptionMaterializationFirestoreRepository, SubscriptionSummaryFirestoreRepository, ProductVariantFirestoreRepository, OrderBlockedFirestoreRepository, LogFirestoreRepository, SequenceFirestoreRepository, BrandCategoryFirestoreRepository, ShopConfigsFirestoreRepository, resolveCacheConfig, CategoryHasuraGraphQLRepository, ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository, ProductReviewHasuraGraphQLRepository, VariantHasuraGraphQLRepository, ProductStockNotificationHasuraGraphQLRepository, FilterOptionHasuraGraphQLRepository, FilterHasuraGraphQLRepository, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryProductHasuraGraphQLRepository, WishlistHasuraGraphQLRepository, ProductErrorsHasuraGraphQLRepository, ProductCatalogHasuraGraphQLRepository, ProductStockEntryHasuraGraphQLRepository, ProductGroupHasuraGraphQLRepository, ProductPriceLogHasuraGraphQLRepository, ProductsVertexSearch, VertexAxiosAdapter, isNil, NotFoundError, Checkout, pick, LineItem, Where, isEmpty, Shops, set, InvalidArgumentError, RoundProductPricesHelper, Category, WishlistLogType, PersonTypes, Wishlist, Product, RequiredArgumentError, add, OrderStatus, ProductReview, Order, UpdateUserImage, FirebaseFileUploaderService } from '@infrab4a/connect';
11
+ import * as i1 from '@angular/fire/auth';
12
+ import { Auth, provideAuth, initializeAuth, indexedDBLocalPersistence, browserLocalPersistence, browserSessionPersistence, getAuth, getIdToken, authState } from '@angular/fire/auth';
13
+ import { isPlatformBrowser, isPlatformServer } from '@angular/common';
14
+ import * as i1$1 from '@angular/fire/firestore';
15
+ import { Firestore, provideFirestore, initializeFirestore, memoryLocalCache, docSnapshots, doc } from '@angular/fire/firestore';
16
+ import cookie from 'js-cookie';
17
+ import { of, from, combineLatest, throwError, Subject, forkJoin } from 'rxjs';
18
+ import { map, mergeMap, catchError, concatMap, tap } from 'rxjs/operators';
19
+ import { __awaiter, __decorate, __metadata } from 'tslib';
20
+ import * as i1$2 from '@angular/common/http';
21
+ import { Type } from 'class-transformer';
22
+
23
+ const ES_CONFIG = 'ES_CONFIG';
24
+
25
+ class AngularElasticSeachModule {
26
+ static initializeApp(options) {
27
+ return {
28
+ ngModule: AngularElasticSeachModule,
29
+ providers: [{ provide: ES_CONFIG, useValue: options }],
30
+ };
31
+ }
32
+ }
33
+ AngularElasticSeachModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularElasticSeachModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
34
+ AngularElasticSeachModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularElasticSeachModule });
35
+ AngularElasticSeachModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularElasticSeachModule, providers: [
36
+ {
37
+ provide: ProductsIndex,
38
+ useFactory: (configuration) => new ProductsIndex(new AxiosAdapter(configuration)),
39
+ deps: [ES_CONFIG],
40
+ },
41
+ ] });
42
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularElasticSeachModule, decorators: [{
43
+ type: NgModule,
44
+ args: [{
45
+ providers: [
46
+ {
47
+ provide: ProductsIndex,
48
+ useFactory: (configuration) => new ProductsIndex(new AxiosAdapter(configuration)),
49
+ deps: [ES_CONFIG],
50
+ },
51
+ ],
52
+ }]
53
+ }] });
54
+
55
+ const BACKEND_URL = 'BACKEND_URL';
56
+
57
+ const CATEGORY_STRUCTURE = 'CATEGORY_STRUCTURE';
58
+
59
+ const DEFAULT_SHOP = 'DEFAULT_SHOP';
60
+
61
+ const FIREBASE_APP_NAME = new InjectionToken('firebaseAppName');
62
+ const FIREBASE_OPTIONS = new InjectionToken('firebaseOptions');
63
+ const APP_CHECK_PROVIDER = new InjectionToken('appCheckProvider');
64
+
65
+ const HASURA_OPTIONS = 'HASURA_OPTIONS';
66
+
67
+ const PERSISTENCE_PROVIDER = 'PERSISTENCE_PROVIDER';
68
+
69
+ const VERTEX_CONFIG = 'VERTEX_CONFIG';
70
+
71
+ class AngularFirebaseAuthModule {
72
+ static initializeApp(options, nameOrConfig) {
73
+ return {
74
+ ngModule: AngularFirebaseAuthModule,
75
+ providers: [
76
+ { provide: FIREBASE_OPTIONS, useValue: options },
77
+ { provide: FIREBASE_APP_NAME, useValue: nameOrConfig },
78
+ ],
79
+ };
80
+ }
81
+ }
82
+ AngularFirebaseAuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
83
+ AngularFirebaseAuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, imports: [i1.AuthModule] });
84
+ AngularFirebaseAuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, providers: [
85
+ {
86
+ provide: 'Authentication',
87
+ useFactory: (authenticationService, userRepository) => {
88
+ return new Authentication(authenticationService, userRepository);
89
+ },
90
+ deps: ['AuthenticationService', 'UserRepository'],
91
+ },
92
+ {
93
+ provide: 'AuthenticationService',
94
+ useFactory: (angularFireAuth) => {
95
+ return new AuthenticationFirebaseAuthService(angularFireAuth);
96
+ },
97
+ deps: [Auth],
98
+ },
99
+ {
100
+ provide: 'Register',
101
+ useFactory: (registerService, userRepository) => {
102
+ return new Register(registerService, userRepository);
103
+ },
104
+ deps: ['RegisterService', 'UserRepository'],
105
+ },
106
+ {
107
+ provide: 'RegisterService',
108
+ useFactory: (angularFireAuth) => {
109
+ return new RegisterFirebaseAuthService(angularFireAuth);
110
+ },
111
+ deps: [Auth],
112
+ },
113
+ {
114
+ provide: 'SignOut',
115
+ useFactory: (authenticationService) => {
116
+ return new SignOut(authenticationService);
117
+ },
118
+ deps: ['AuthenticationService'],
119
+ },
120
+ {
121
+ provide: 'RecoveryPassword',
122
+ useFactory: (authenticationService) => {
123
+ return new RecoveryPassword(authenticationService);
124
+ },
125
+ deps: ['AuthenticationService'],
126
+ },
127
+ ], imports: [provideAuth((injector) => {
128
+ const app = injector.get(FirebaseApp);
129
+ try {
130
+ return initializeAuth(app, {
131
+ persistence: [indexedDBLocalPersistence, browserLocalPersistence, browserSessionPersistence],
132
+ });
133
+ }
134
+ catch (error) {
135
+ if (error instanceof Error)
136
+ console.error('Error initializing auth', error.message);
137
+ return getAuth(app);
138
+ }
139
+ })] });
140
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirebaseAuthModule, decorators: [{
141
+ type: NgModule,
142
+ args: [{
143
+ imports: [
144
+ provideAuth((injector) => {
145
+ const app = injector.get(FirebaseApp);
146
+ try {
147
+ return initializeAuth(app, {
148
+ persistence: [indexedDBLocalPersistence, browserLocalPersistence, browserSessionPersistence],
149
+ });
150
+ }
151
+ catch (error) {
152
+ if (error instanceof Error)
153
+ console.error('Error initializing auth', error.message);
154
+ return getAuth(app);
155
+ }
156
+ }),
157
+ ],
158
+ providers: [
159
+ {
160
+ provide: 'Authentication',
161
+ useFactory: (authenticationService, userRepository) => {
162
+ return new Authentication(authenticationService, userRepository);
163
+ },
164
+ deps: ['AuthenticationService', 'UserRepository'],
165
+ },
166
+ {
167
+ provide: 'AuthenticationService',
168
+ useFactory: (angularFireAuth) => {
169
+ return new AuthenticationFirebaseAuthService(angularFireAuth);
170
+ },
171
+ deps: [Auth],
172
+ },
173
+ {
174
+ provide: 'Register',
175
+ useFactory: (registerService, userRepository) => {
176
+ return new Register(registerService, userRepository);
177
+ },
178
+ deps: ['RegisterService', 'UserRepository'],
179
+ },
180
+ {
181
+ provide: 'RegisterService',
182
+ useFactory: (angularFireAuth) => {
183
+ return new RegisterFirebaseAuthService(angularFireAuth);
184
+ },
185
+ deps: [Auth],
186
+ },
187
+ {
188
+ provide: 'SignOut',
189
+ useFactory: (authenticationService) => {
190
+ return new SignOut(authenticationService);
191
+ },
192
+ deps: ['AuthenticationService'],
193
+ },
194
+ {
195
+ provide: 'RecoveryPassword',
196
+ useFactory: (authenticationService) => {
197
+ return new RecoveryPassword(authenticationService);
198
+ },
199
+ deps: ['AuthenticationService'],
200
+ },
201
+ ],
202
+ }]
203
+ }] });
204
+
205
+ class MobileOperationSystemCheckerHelper {
206
+ static isAppleDevice() {
207
+ var _a, _b;
208
+ return (['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'].includes(navigator === null || navigator === void 0 ? void 0 : navigator.platform) ||
209
+ (((_b = (_a = navigator === null || navigator === void 0 ? void 0 : navigator.userAgent) === null || _a === void 0 ? void 0 : _a.includes) === null || _b === void 0 ? void 0 : _b.call(_a, 'Mac')) && 'ontouchend' in (document || {})));
210
+ }
211
+ }
212
+
213
+ class AngularFirestoreModule {
214
+ static initializeApp(options, nameOrConfig) {
215
+ return {
216
+ ngModule: AngularFirestoreModule,
217
+ providers: [
218
+ { provide: FIREBASE_OPTIONS, useValue: options.firebase },
219
+ { provide: FIREBASE_APP_NAME, useValue: nameOrConfig },
220
+ { provide: ES_CONFIG, useValue: options.elasticSearch },
221
+ ],
222
+ };
223
+ }
224
+ }
225
+ AngularFirestoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
226
+ AngularFirestoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, imports: [AngularElasticSeachModule, i1$1.FirestoreModule] });
227
+ AngularFirestoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, providers: [
228
+ {
229
+ provide: 'FirestoreOptions',
230
+ useFactory: (firestore, platformId) => ({
231
+ firestore: new ConnectFirestoreService(firestore),
232
+ interceptors: {
233
+ request: (request) => {
234
+ if (isPlatformBrowser(platformId))
235
+ return request;
236
+ const interval = setInterval(() => { }, 100);
237
+ request.interval = interval;
238
+ return request;
239
+ },
240
+ response: (response, request) => {
241
+ if (isPlatformBrowser(platformId))
242
+ return response;
243
+ clearInterval(request.interval);
244
+ return response;
245
+ },
246
+ },
247
+ }),
248
+ deps: [Firestore, PLATFORM_ID],
249
+ },
250
+ {
251
+ provide: 'BeautyProfileRepository',
252
+ useFactory: (config, userRepository) => {
253
+ return new UserBeautyProfileFirestoreRepository(config, userRepository);
254
+ },
255
+ deps: ['FirestoreOptions', 'UserRepository'],
256
+ },
257
+ {
258
+ provide: 'Buy2WinRepository',
259
+ useFactory: (options) => {
260
+ return new Buy2WinFirestoreRepository(options);
261
+ },
262
+ deps: ['FirestoreOptions'],
263
+ },
264
+ {
265
+ provide: CategoryFirestoreRepository,
266
+ useFactory: (options) => {
267
+ return new CategoryFirestoreRepository(options);
268
+ },
269
+ deps: ['FirestoreOptions'],
270
+ },
271
+ {
272
+ provide: 'CheckoutRepository',
273
+ useFactory: (options) => {
274
+ return new CheckoutFirestoreRepository(options);
275
+ },
276
+ deps: ['FirestoreOptions'],
277
+ },
278
+ {
279
+ provide: 'CheckoutSubscriptionRepository',
280
+ useFactory: (options) => {
281
+ return new CheckoutSubscriptionFirestoreRepository(options);
282
+ },
283
+ deps: ['FirestoreOptions'],
284
+ },
285
+ {
286
+ provide: 'CouponRepository',
287
+ useFactory: (options) => {
288
+ return new CouponFirestoreRepository(options);
289
+ },
290
+ deps: ['FirestoreOptions'],
291
+ },
292
+ {
293
+ provide: 'CampaignHashtagRepository',
294
+ useFactory: (options) => {
295
+ return new CampaignHashtagFirestoreRepository(options);
296
+ },
297
+ deps: ['FirestoreOptions'],
298
+ },
299
+ {
300
+ provide: 'CampaignHashtagPostsRepository',
301
+ useFactory: (options) => {
302
+ return new CampaignHashtagPostsFirestoreRepository(options);
303
+ },
304
+ deps: ['FirestoreOptions'],
305
+ },
306
+ {
307
+ provide: 'CampaignDashboardRepository',
308
+ useFactory: (options) => {
309
+ return new CampaignDashboardFirestoreRepository(options);
310
+ },
311
+ deps: ['FirestoreOptions'],
312
+ },
313
+ {
314
+ provide: 'EditionRepository',
315
+ useFactory: (options, subscriptionRepository) => {
316
+ return new SubscriptionEditionFirestoreRepository(options, subscriptionRepository);
317
+ },
318
+ deps: ['FirestoreOptions', 'SubscriptionRepository'],
319
+ },
320
+ {
321
+ provide: 'GroupRepository',
322
+ useFactory: (options) => {
323
+ return new GroupFirestoreRepository(options);
324
+ },
325
+ deps: ['FirestoreOptions'],
326
+ },
327
+ {
328
+ provide: 'HomeRepository',
329
+ useFactory: (options) => {
330
+ return new HomeFirestoreRepository(options);
331
+ },
332
+ deps: ['FirestoreOptions'],
333
+ },
334
+ {
335
+ provide: 'LeadRepository',
336
+ useFactory: (options) => {
337
+ return new LeadFirestoreRepository(options);
338
+ },
339
+ deps: ['FirestoreOptions'],
340
+ },
341
+ {
342
+ provide: 'LegacyOrderRepository',
343
+ useFactory: (options) => {
344
+ return new LegacyOrderFirestoreRepository(options);
345
+ },
346
+ deps: ['FirestoreOptions'],
347
+ },
348
+ {
349
+ provide: 'ShopMenuRepository',
350
+ useFactory: (options) => {
351
+ return new ShopMenuFirestoreRepository(options);
352
+ },
353
+ deps: ['FirestoreOptions'],
354
+ },
355
+ {
356
+ provide: 'OrderRepository',
357
+ useFactory: (options) => {
358
+ return new OrderFirestoreRepository(options);
359
+ },
360
+ deps: ['FirestoreOptions'],
361
+ },
362
+ {
363
+ provide: 'PaymentRepository',
364
+ useFactory: (options) => {
365
+ return new PaymentFirestoreRepository(options);
366
+ },
367
+ deps: ['FirestoreOptions'],
368
+ },
369
+ {
370
+ provide: 'ShoppingRecurrenceRepository',
371
+ useFactory: (options) => {
372
+ return new ShoppingRecurrenceFirestoreRepository(options);
373
+ },
374
+ deps: ['FirestoreOptions'],
375
+ },
376
+ {
377
+ provide: 'ShoppingRecurrenceEditionRepository',
378
+ useFactory: (options) => {
379
+ return new ShoppingRecurrenceEditionFirestoreRepository(options);
380
+ },
381
+ deps: ['FirestoreOptions'],
382
+ },
383
+ {
384
+ provide: 'ShoppingRecurrenceErrorLogRepository',
385
+ useFactory: (options) => {
386
+ return new ShoppingRecurrenceErrorLogFirestoreRepository(options);
387
+ },
388
+ deps: ['FirestoreOptions'],
389
+ },
390
+ {
391
+ provide: ProductFirestoreRepository,
392
+ useFactory: (options) => {
393
+ return new ProductFirestoreRepository(options);
394
+ },
395
+ deps: ['FirestoreOptions'],
396
+ },
397
+ {
398
+ provide: 'ShopSettingsRepository',
399
+ useFactory: (options) => {
400
+ return new ShopSettingsFirestoreRepository(options);
401
+ },
402
+ deps: ['FirestoreOptions'],
403
+ },
404
+ {
405
+ provide: 'SubscriptionPaymentRepository',
406
+ useFactory: (options, subscriptionRepository) => {
407
+ return new SubscriptionPaymentFirestoreRepository(options, subscriptionRepository);
408
+ },
409
+ deps: ['FirestoreOptions', 'SubscriptionRepository'],
410
+ },
411
+ {
412
+ provide: 'SubscriptionPlanRepository',
413
+ useFactory: (options) => {
414
+ return new SubscriptionPlanFirestoreRepository(options);
415
+ },
416
+ deps: ['FirestoreOptions'],
417
+ },
418
+ {
419
+ provide: 'SubscriptionProductRepository',
420
+ useFactory: (options) => {
421
+ return new SubscriptionProductFirestoreRepository(options);
422
+ },
423
+ deps: ['FirestoreOptions'],
424
+ },
425
+ {
426
+ provide: 'SubscriptionRepository',
427
+ useFactory: (options) => {
428
+ return new SubscriptionFirestoreRepository(options);
429
+ },
430
+ deps: ['FirestoreOptions'],
431
+ },
432
+ {
433
+ provide: 'UserRepository',
434
+ useFactory: (options) => {
435
+ return new UserFirestoreRepository(options);
436
+ },
437
+ deps: ['FirestoreOptions'],
438
+ },
439
+ {
440
+ provide: 'UserAddressRepository',
441
+ useFactory: (options, userRepository) => {
442
+ return new UserAddressFirestoreRepository(options, userRepository);
443
+ },
444
+ deps: ['FirestoreOptions', 'UserRepository'],
445
+ },
446
+ {
447
+ provide: 'UserPaymentMethodRepository',
448
+ useFactory: (options, userRepository) => {
449
+ return new UserPaymentMethodFirestoreRepository(options, userRepository);
450
+ },
451
+ deps: ['FirestoreOptions', 'UserRepository'],
452
+ },
453
+ {
454
+ provide: 'SubscriptionMaterializationRepository',
455
+ useFactory: (options) => {
456
+ return new SubscriptionMaterializationFirestoreRepository(options);
457
+ },
458
+ deps: ['FirestoreOptions'],
459
+ },
460
+ {
461
+ provide: 'SubscriptionSummaryRepository',
462
+ useFactory: (options) => {
463
+ return new SubscriptionSummaryFirestoreRepository(options);
464
+ },
465
+ deps: ['FirestoreOptions'],
466
+ },
467
+ {
468
+ provide: ProductVariantFirestoreRepository,
469
+ useFactory: (options, productRepository) => {
470
+ return new ProductVariantFirestoreRepository(options, productRepository);
471
+ },
472
+ deps: ['FirestoreOptions', ProductFirestoreRepository],
473
+ },
474
+ {
475
+ provide: 'OrderBlockedRepository',
476
+ useFactory: (options) => {
477
+ return new OrderBlockedFirestoreRepository(options);
478
+ },
479
+ deps: ['FirestoreOptions'],
480
+ },
481
+ {
482
+ provide: 'LogRepository',
483
+ useFactory: (options) => {
484
+ return new LogFirestoreRepository(options);
485
+ },
486
+ deps: ['FirestoreOptions'],
487
+ },
488
+ {
489
+ provide: 'SequenceRepository',
490
+ useFactory: (options) => {
491
+ return new SequenceFirestoreRepository(options);
492
+ },
493
+ deps: ['FirestoreOptions'],
494
+ },
495
+ {
496
+ provide: 'BrandCategoryRepository',
497
+ useFactory: (options) => {
498
+ return new BrandCategoryFirestoreRepository(options);
499
+ },
500
+ deps: ['FirestoreOptions'],
501
+ },
502
+ {
503
+ provide: 'ShopConfigsRepository',
504
+ useFactory: (options) => {
505
+ return new ShopConfigsFirestoreRepository(options);
506
+ },
507
+ deps: ['FirestoreOptions'],
508
+ },
509
+ ], imports: [AngularElasticSeachModule,
510
+ provideFirestore((injector) => {
511
+ const platformId = injector.get(PLATFORM_ID);
512
+ if (isPlatformServer(platformId) || !MobileOperationSystemCheckerHelper.isAppleDevice())
513
+ return initializeFirestore(injector.get(FirebaseApp), {
514
+ ignoreUndefinedProperties: true,
515
+ });
516
+ const firestore = initializeFirestore(injector.get(FirebaseApp), {
517
+ experimentalForceLongPolling: true,
518
+ ignoreUndefinedProperties: true,
519
+ localCache: memoryLocalCache(),
520
+ });
521
+ return firestore;
522
+ })] });
523
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularFirestoreModule, decorators: [{
524
+ type: NgModule,
525
+ args: [{
526
+ imports: [
527
+ AngularElasticSeachModule,
528
+ provideFirestore((injector) => {
529
+ const platformId = injector.get(PLATFORM_ID);
530
+ if (isPlatformServer(platformId) || !MobileOperationSystemCheckerHelper.isAppleDevice())
531
+ return initializeFirestore(injector.get(FirebaseApp), {
532
+ ignoreUndefinedProperties: true,
533
+ });
534
+ const firestore = initializeFirestore(injector.get(FirebaseApp), {
535
+ experimentalForceLongPolling: true,
536
+ ignoreUndefinedProperties: true,
537
+ localCache: memoryLocalCache(),
538
+ });
539
+ return firestore;
540
+ }),
541
+ ],
542
+ providers: [
543
+ {
544
+ provide: 'FirestoreOptions',
545
+ useFactory: (firestore, platformId) => ({
546
+ firestore: new ConnectFirestoreService(firestore),
547
+ interceptors: {
548
+ request: (request) => {
549
+ if (isPlatformBrowser(platformId))
550
+ return request;
551
+ const interval = setInterval(() => { }, 100);
552
+ request.interval = interval;
553
+ return request;
554
+ },
555
+ response: (response, request) => {
556
+ if (isPlatformBrowser(platformId))
557
+ return response;
558
+ clearInterval(request.interval);
559
+ return response;
560
+ },
561
+ },
562
+ }),
563
+ deps: [Firestore, PLATFORM_ID],
564
+ },
565
+ {
566
+ provide: 'BeautyProfileRepository',
567
+ useFactory: (config, userRepository) => {
568
+ return new UserBeautyProfileFirestoreRepository(config, userRepository);
569
+ },
570
+ deps: ['FirestoreOptions', 'UserRepository'],
571
+ },
572
+ {
573
+ provide: 'Buy2WinRepository',
574
+ useFactory: (options) => {
575
+ return new Buy2WinFirestoreRepository(options);
576
+ },
577
+ deps: ['FirestoreOptions'],
578
+ },
579
+ {
580
+ provide: CategoryFirestoreRepository,
581
+ useFactory: (options) => {
582
+ return new CategoryFirestoreRepository(options);
583
+ },
584
+ deps: ['FirestoreOptions'],
585
+ },
586
+ {
587
+ provide: 'CheckoutRepository',
588
+ useFactory: (options) => {
589
+ return new CheckoutFirestoreRepository(options);
590
+ },
591
+ deps: ['FirestoreOptions'],
592
+ },
593
+ {
594
+ provide: 'CheckoutSubscriptionRepository',
595
+ useFactory: (options) => {
596
+ return new CheckoutSubscriptionFirestoreRepository(options);
597
+ },
598
+ deps: ['FirestoreOptions'],
599
+ },
600
+ {
601
+ provide: 'CouponRepository',
602
+ useFactory: (options) => {
603
+ return new CouponFirestoreRepository(options);
604
+ },
605
+ deps: ['FirestoreOptions'],
606
+ },
607
+ {
608
+ provide: 'CampaignHashtagRepository',
609
+ useFactory: (options) => {
610
+ return new CampaignHashtagFirestoreRepository(options);
611
+ },
612
+ deps: ['FirestoreOptions'],
613
+ },
614
+ {
615
+ provide: 'CampaignHashtagPostsRepository',
616
+ useFactory: (options) => {
617
+ return new CampaignHashtagPostsFirestoreRepository(options);
618
+ },
619
+ deps: ['FirestoreOptions'],
620
+ },
621
+ {
622
+ provide: 'CampaignDashboardRepository',
623
+ useFactory: (options) => {
624
+ return new CampaignDashboardFirestoreRepository(options);
625
+ },
626
+ deps: ['FirestoreOptions'],
627
+ },
628
+ {
629
+ provide: 'EditionRepository',
630
+ useFactory: (options, subscriptionRepository) => {
631
+ return new SubscriptionEditionFirestoreRepository(options, subscriptionRepository);
632
+ },
633
+ deps: ['FirestoreOptions', 'SubscriptionRepository'],
634
+ },
635
+ {
636
+ provide: 'GroupRepository',
637
+ useFactory: (options) => {
638
+ return new GroupFirestoreRepository(options);
639
+ },
640
+ deps: ['FirestoreOptions'],
641
+ },
642
+ {
643
+ provide: 'HomeRepository',
644
+ useFactory: (options) => {
645
+ return new HomeFirestoreRepository(options);
646
+ },
647
+ deps: ['FirestoreOptions'],
648
+ },
649
+ {
650
+ provide: 'LeadRepository',
651
+ useFactory: (options) => {
652
+ return new LeadFirestoreRepository(options);
653
+ },
654
+ deps: ['FirestoreOptions'],
655
+ },
656
+ {
657
+ provide: 'LegacyOrderRepository',
658
+ useFactory: (options) => {
659
+ return new LegacyOrderFirestoreRepository(options);
660
+ },
661
+ deps: ['FirestoreOptions'],
662
+ },
663
+ {
664
+ provide: 'ShopMenuRepository',
665
+ useFactory: (options) => {
666
+ return new ShopMenuFirestoreRepository(options);
667
+ },
668
+ deps: ['FirestoreOptions'],
669
+ },
670
+ {
671
+ provide: 'OrderRepository',
672
+ useFactory: (options) => {
673
+ return new OrderFirestoreRepository(options);
674
+ },
675
+ deps: ['FirestoreOptions'],
676
+ },
677
+ {
678
+ provide: 'PaymentRepository',
679
+ useFactory: (options) => {
680
+ return new PaymentFirestoreRepository(options);
681
+ },
682
+ deps: ['FirestoreOptions'],
683
+ },
684
+ {
685
+ provide: 'ShoppingRecurrenceRepository',
686
+ useFactory: (options) => {
687
+ return new ShoppingRecurrenceFirestoreRepository(options);
688
+ },
689
+ deps: ['FirestoreOptions'],
690
+ },
691
+ {
692
+ provide: 'ShoppingRecurrenceEditionRepository',
693
+ useFactory: (options) => {
694
+ return new ShoppingRecurrenceEditionFirestoreRepository(options);
695
+ },
696
+ deps: ['FirestoreOptions'],
697
+ },
698
+ {
699
+ provide: 'ShoppingRecurrenceErrorLogRepository',
700
+ useFactory: (options) => {
701
+ return new ShoppingRecurrenceErrorLogFirestoreRepository(options);
702
+ },
703
+ deps: ['FirestoreOptions'],
704
+ },
705
+ {
706
+ provide: ProductFirestoreRepository,
707
+ useFactory: (options) => {
708
+ return new ProductFirestoreRepository(options);
709
+ },
710
+ deps: ['FirestoreOptions'],
711
+ },
712
+ {
713
+ provide: 'ShopSettingsRepository',
714
+ useFactory: (options) => {
715
+ return new ShopSettingsFirestoreRepository(options);
716
+ },
717
+ deps: ['FirestoreOptions'],
718
+ },
719
+ {
720
+ provide: 'SubscriptionPaymentRepository',
721
+ useFactory: (options, subscriptionRepository) => {
722
+ return new SubscriptionPaymentFirestoreRepository(options, subscriptionRepository);
723
+ },
724
+ deps: ['FirestoreOptions', 'SubscriptionRepository'],
725
+ },
726
+ {
727
+ provide: 'SubscriptionPlanRepository',
728
+ useFactory: (options) => {
729
+ return new SubscriptionPlanFirestoreRepository(options);
730
+ },
731
+ deps: ['FirestoreOptions'],
732
+ },
733
+ {
734
+ provide: 'SubscriptionProductRepository',
735
+ useFactory: (options) => {
736
+ return new SubscriptionProductFirestoreRepository(options);
737
+ },
738
+ deps: ['FirestoreOptions'],
739
+ },
740
+ {
741
+ provide: 'SubscriptionRepository',
742
+ useFactory: (options) => {
743
+ return new SubscriptionFirestoreRepository(options);
744
+ },
745
+ deps: ['FirestoreOptions'],
746
+ },
747
+ {
748
+ provide: 'UserRepository',
749
+ useFactory: (options) => {
750
+ return new UserFirestoreRepository(options);
751
+ },
752
+ deps: ['FirestoreOptions'],
753
+ },
754
+ {
755
+ provide: 'UserAddressRepository',
756
+ useFactory: (options, userRepository) => {
757
+ return new UserAddressFirestoreRepository(options, userRepository);
758
+ },
759
+ deps: ['FirestoreOptions', 'UserRepository'],
760
+ },
761
+ {
762
+ provide: 'UserPaymentMethodRepository',
763
+ useFactory: (options, userRepository) => {
764
+ return new UserPaymentMethodFirestoreRepository(options, userRepository);
765
+ },
766
+ deps: ['FirestoreOptions', 'UserRepository'],
767
+ },
768
+ {
769
+ provide: 'SubscriptionMaterializationRepository',
770
+ useFactory: (options) => {
771
+ return new SubscriptionMaterializationFirestoreRepository(options);
772
+ },
773
+ deps: ['FirestoreOptions'],
774
+ },
775
+ {
776
+ provide: 'SubscriptionSummaryRepository',
777
+ useFactory: (options) => {
778
+ return new SubscriptionSummaryFirestoreRepository(options);
779
+ },
780
+ deps: ['FirestoreOptions'],
781
+ },
782
+ {
783
+ provide: ProductVariantFirestoreRepository,
784
+ useFactory: (options, productRepository) => {
785
+ return new ProductVariantFirestoreRepository(options, productRepository);
786
+ },
787
+ deps: ['FirestoreOptions', ProductFirestoreRepository],
788
+ },
789
+ {
790
+ provide: 'OrderBlockedRepository',
791
+ useFactory: (options) => {
792
+ return new OrderBlockedFirestoreRepository(options);
793
+ },
794
+ deps: ['FirestoreOptions'],
795
+ },
796
+ {
797
+ provide: 'LogRepository',
798
+ useFactory: (options) => {
799
+ return new LogFirestoreRepository(options);
800
+ },
801
+ deps: ['FirestoreOptions'],
802
+ },
803
+ {
804
+ provide: 'SequenceRepository',
805
+ useFactory: (options) => {
806
+ return new SequenceFirestoreRepository(options);
807
+ },
808
+ deps: ['FirestoreOptions'],
809
+ },
810
+ {
811
+ provide: 'BrandCategoryRepository',
812
+ useFactory: (options) => {
813
+ return new BrandCategoryFirestoreRepository(options);
814
+ },
815
+ deps: ['FirestoreOptions'],
816
+ },
817
+ {
818
+ provide: 'ShopConfigsRepository',
819
+ useFactory: (options) => {
820
+ return new ShopConfigsFirestoreRepository(options);
821
+ },
822
+ deps: ['FirestoreOptions'],
823
+ },
824
+ ],
825
+ }]
826
+ }] });
827
+
828
+ class AngularHasuraGraphQLModule {
829
+ static initializeApp(options) {
830
+ return {
831
+ ngModule: AngularHasuraGraphQLModule,
832
+ providers: [{ provide: HASURA_OPTIONS, useValue: options }],
833
+ };
834
+ }
835
+ }
836
+ AngularHasuraGraphQLModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
837
+ AngularHasuraGraphQLModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule });
838
+ AngularHasuraGraphQLModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, providers: [
839
+ {
840
+ provide: 'HasuraConfig',
841
+ useFactory: (options, platformId) => ({
842
+ endpoint: options.endpoint,
843
+ authOptions: options.credentials,
844
+ cache: resolveCacheConfig(options.cache),
845
+ interceptors: {
846
+ request: (request) => {
847
+ if (isPlatformBrowser(platformId))
848
+ return request;
849
+ const interval = setInterval(() => { }, 100);
850
+ request.interval = interval;
851
+ return request;
852
+ },
853
+ response: (response, request) => {
854
+ if (isPlatformBrowser(platformId))
855
+ return response;
856
+ clearInterval(request.interval);
857
+ return response;
858
+ },
859
+ },
860
+ }),
861
+ deps: [HASURA_OPTIONS, PLATFORM_ID],
862
+ },
863
+ {
864
+ provide: 'CategoryRepository',
865
+ useExisting: CategoryHasuraGraphQLRepository,
866
+ },
867
+ {
868
+ provide: CategoryHasuraGraphQLRepository,
869
+ useFactory: (options, productRepository, categoryFilterRepository) => {
870
+ return new CategoryHasuraGraphQLRepository(options, productRepository, categoryFilterRepository);
871
+ },
872
+ deps: ['HasuraConfig', ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
873
+ },
874
+ {
875
+ provide: 'ProductRepository',
876
+ useExisting: ProductHasuraGraphQLRepository,
877
+ },
878
+ {
879
+ provide: ProductHasuraGraphQLRepository,
880
+ useFactory: (hasuraConfig) => {
881
+ return new ProductHasuraGraphQLRepository(hasuraConfig);
882
+ },
883
+ deps: ['HasuraConfig'],
884
+ },
885
+ {
886
+ provide: 'ProductReviewRepository',
887
+ useExisting: ProductReviewHasuraGraphQLRepository,
888
+ },
889
+ {
890
+ provide: ProductReviewHasuraGraphQLRepository,
891
+ useFactory: (hasuraConfig) => {
892
+ return new ProductReviewHasuraGraphQLRepository(hasuraConfig);
893
+ },
894
+ deps: ['HasuraConfig'],
895
+ },
896
+ {
897
+ provide: 'VariantRepository',
898
+ useExisting: VariantHasuraGraphQLRepository,
899
+ },
900
+ {
901
+ provide: VariantHasuraGraphQLRepository,
902
+ useFactory: (hasuraConfig) => {
903
+ return new VariantHasuraGraphQLRepository(hasuraConfig);
904
+ },
905
+ deps: ['HasuraConfig'],
906
+ },
907
+ {
908
+ provide: 'ProductStockNotificationRepository',
909
+ useExisting: ProductStockNotificationHasuraGraphQLRepository,
910
+ },
911
+ {
912
+ provide: ProductStockNotificationHasuraGraphQLRepository,
913
+ useFactory: (hasuraConfig) => {
914
+ return new ProductStockNotificationHasuraGraphQLRepository(hasuraConfig);
915
+ },
916
+ deps: ['HasuraConfig'],
917
+ },
918
+ {
919
+ provide: 'CategoryFilterRepository',
920
+ useExisting: CategoryFilterHasuraGraphQLRepository,
921
+ },
922
+ {
923
+ provide: CategoryFilterHasuraGraphQLRepository,
924
+ useFactory: (options) => {
925
+ return new CategoryFilterHasuraGraphQLRepository(options);
926
+ },
927
+ deps: ['HasuraConfig'],
928
+ },
929
+ {
930
+ provide: 'FilterOptionRepository',
931
+ useExisting: FilterOptionHasuraGraphQLRepository,
932
+ },
933
+ {
934
+ provide: FilterOptionHasuraGraphQLRepository,
935
+ useFactory: (options) => {
936
+ return new FilterOptionHasuraGraphQLRepository(options);
937
+ },
938
+ deps: ['HasuraConfig'],
939
+ },
940
+ {
941
+ provide: 'FilterRepository',
942
+ useExisting: FilterHasuraGraphQLRepository,
943
+ },
944
+ {
945
+ provide: FilterHasuraGraphQLRepository,
946
+ useFactory: (options, filterOptionRepository, categoryFilterRepository) => {
947
+ return new FilterHasuraGraphQLRepository(options, filterOptionRepository, categoryFilterRepository);
948
+ },
949
+ deps: ['HasuraConfig', FilterOptionHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
950
+ },
951
+ {
952
+ provide: CategoryCollectionChildrenHasuraGraphQLRepository,
953
+ useFactory: (options) => new CategoryCollectionChildrenHasuraGraphQLRepository(options),
954
+ deps: ['HasuraConfig'],
955
+ },
956
+ {
957
+ provide: 'CategoryCollectionChildrenRepository',
958
+ useExisting: CategoryCollectionChildrenHasuraGraphQLRepository,
959
+ },
960
+ {
961
+ provide: CategoryProductHasuraGraphQLRepository,
962
+ useFactory: (options) => {
963
+ return new CategoryProductHasuraGraphQLRepository(options);
964
+ },
965
+ deps: ['HasuraConfig'],
966
+ },
967
+ {
968
+ provide: 'CategoryProductRepository',
969
+ useExisting: CategoryProductHasuraGraphQLRepository,
970
+ },
971
+ {
972
+ provide: WishlistHasuraGraphQLRepository,
973
+ useFactory: (options, categoryProductRepository) => {
974
+ return new WishlistHasuraGraphQLRepository(options, categoryProductRepository);
975
+ },
976
+ deps: ['HasuraConfig', CategoryProductHasuraGraphQLRepository],
977
+ },
978
+ {
979
+ provide: 'WishlistRepository',
980
+ useExisting: WishlistHasuraGraphQLRepository,
981
+ },
982
+ {
983
+ provide: ProductErrorsHasuraGraphQLRepository,
984
+ useFactory: (options, productRepository) => {
985
+ return new ProductErrorsHasuraGraphQLRepository(options, productRepository);
986
+ },
987
+ deps: ['HasuraConfig', ProductHasuraGraphQLRepository],
988
+ },
989
+ {
990
+ provide: 'ProductErrorsRepository',
991
+ useExisting: ProductErrorsHasuraGraphQLRepository,
992
+ },
993
+ {
994
+ provide: ProductCatalogHasuraGraphQLRepository,
995
+ useFactory: (options) => {
996
+ return new ProductCatalogHasuraGraphQLRepository(options);
997
+ },
998
+ deps: ['HasuraConfig'],
999
+ },
1000
+ {
1001
+ provide: 'ProductCatalogRepository',
1002
+ useExisting: ProductCatalogHasuraGraphQLRepository,
1003
+ },
1004
+ {
1005
+ provide: ProductStockEntryHasuraGraphQLRepository,
1006
+ useFactory: (options) => {
1007
+ return new ProductStockEntryHasuraGraphQLRepository(options);
1008
+ },
1009
+ deps: ['HasuraConfig'],
1010
+ },
1011
+ {
1012
+ provide: 'ProductStockEntryRepository',
1013
+ useExisting: ProductStockEntryHasuraGraphQLRepository,
1014
+ },
1015
+ {
1016
+ provide: ProductGroupHasuraGraphQLRepository,
1017
+ useFactory: (options) => {
1018
+ return new ProductGroupHasuraGraphQLRepository(options);
1019
+ },
1020
+ deps: ['HasuraConfig'],
1021
+ },
1022
+ {
1023
+ provide: 'ProductGroupRepository',
1024
+ useExisting: ProductGroupHasuraGraphQLRepository,
1025
+ },
1026
+ {
1027
+ provide: ProductPriceLogHasuraGraphQLRepository,
1028
+ useFactory: (options) => {
1029
+ return new ProductPriceLogHasuraGraphQLRepository(options);
1030
+ },
1031
+ deps: ['HasuraConfig'],
1032
+ },
1033
+ {
1034
+ provide: 'ProductPriceLogRepository',
1035
+ useExisting: ProductPriceLogHasuraGraphQLRepository,
1036
+ },
1037
+ ] });
1038
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularHasuraGraphQLModule, decorators: [{
1039
+ type: NgModule,
1040
+ args: [{
1041
+ providers: [
1042
+ {
1043
+ provide: 'HasuraConfig',
1044
+ useFactory: (options, platformId) => ({
1045
+ endpoint: options.endpoint,
1046
+ authOptions: options.credentials,
1047
+ cache: resolveCacheConfig(options.cache),
1048
+ interceptors: {
1049
+ request: (request) => {
1050
+ if (isPlatformBrowser(platformId))
1051
+ return request;
1052
+ const interval = setInterval(() => { }, 100);
1053
+ request.interval = interval;
1054
+ return request;
1055
+ },
1056
+ response: (response, request) => {
1057
+ if (isPlatformBrowser(platformId))
1058
+ return response;
1059
+ clearInterval(request.interval);
1060
+ return response;
1061
+ },
1062
+ },
1063
+ }),
1064
+ deps: [HASURA_OPTIONS, PLATFORM_ID],
1065
+ },
1066
+ {
1067
+ provide: 'CategoryRepository',
1068
+ useExisting: CategoryHasuraGraphQLRepository,
1069
+ },
1070
+ {
1071
+ provide: CategoryHasuraGraphQLRepository,
1072
+ useFactory: (options, productRepository, categoryFilterRepository) => {
1073
+ return new CategoryHasuraGraphQLRepository(options, productRepository, categoryFilterRepository);
1074
+ },
1075
+ deps: ['HasuraConfig', ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
1076
+ },
1077
+ {
1078
+ provide: 'ProductRepository',
1079
+ useExisting: ProductHasuraGraphQLRepository,
1080
+ },
1081
+ {
1082
+ provide: ProductHasuraGraphQLRepository,
1083
+ useFactory: (hasuraConfig) => {
1084
+ return new ProductHasuraGraphQLRepository(hasuraConfig);
1085
+ },
1086
+ deps: ['HasuraConfig'],
1087
+ },
1088
+ {
1089
+ provide: 'ProductReviewRepository',
1090
+ useExisting: ProductReviewHasuraGraphQLRepository,
1091
+ },
1092
+ {
1093
+ provide: ProductReviewHasuraGraphQLRepository,
1094
+ useFactory: (hasuraConfig) => {
1095
+ return new ProductReviewHasuraGraphQLRepository(hasuraConfig);
1096
+ },
1097
+ deps: ['HasuraConfig'],
1098
+ },
1099
+ {
1100
+ provide: 'VariantRepository',
1101
+ useExisting: VariantHasuraGraphQLRepository,
1102
+ },
1103
+ {
1104
+ provide: VariantHasuraGraphQLRepository,
1105
+ useFactory: (hasuraConfig) => {
1106
+ return new VariantHasuraGraphQLRepository(hasuraConfig);
1107
+ },
1108
+ deps: ['HasuraConfig'],
1109
+ },
1110
+ {
1111
+ provide: 'ProductStockNotificationRepository',
1112
+ useExisting: ProductStockNotificationHasuraGraphQLRepository,
1113
+ },
1114
+ {
1115
+ provide: ProductStockNotificationHasuraGraphQLRepository,
1116
+ useFactory: (hasuraConfig) => {
1117
+ return new ProductStockNotificationHasuraGraphQLRepository(hasuraConfig);
1118
+ },
1119
+ deps: ['HasuraConfig'],
1120
+ },
1121
+ {
1122
+ provide: 'CategoryFilterRepository',
1123
+ useExisting: CategoryFilterHasuraGraphQLRepository,
1124
+ },
1125
+ {
1126
+ provide: CategoryFilterHasuraGraphQLRepository,
1127
+ useFactory: (options) => {
1128
+ return new CategoryFilterHasuraGraphQLRepository(options);
1129
+ },
1130
+ deps: ['HasuraConfig'],
1131
+ },
1132
+ {
1133
+ provide: 'FilterOptionRepository',
1134
+ useExisting: FilterOptionHasuraGraphQLRepository,
1135
+ },
1136
+ {
1137
+ provide: FilterOptionHasuraGraphQLRepository,
1138
+ useFactory: (options) => {
1139
+ return new FilterOptionHasuraGraphQLRepository(options);
1140
+ },
1141
+ deps: ['HasuraConfig'],
1142
+ },
1143
+ {
1144
+ provide: 'FilterRepository',
1145
+ useExisting: FilterHasuraGraphQLRepository,
1146
+ },
1147
+ {
1148
+ provide: FilterHasuraGraphQLRepository,
1149
+ useFactory: (options, filterOptionRepository, categoryFilterRepository) => {
1150
+ return new FilterHasuraGraphQLRepository(options, filterOptionRepository, categoryFilterRepository);
1151
+ },
1152
+ deps: ['HasuraConfig', FilterOptionHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
1153
+ },
1154
+ {
1155
+ provide: CategoryCollectionChildrenHasuraGraphQLRepository,
1156
+ useFactory: (options) => new CategoryCollectionChildrenHasuraGraphQLRepository(options),
1157
+ deps: ['HasuraConfig'],
1158
+ },
1159
+ {
1160
+ provide: 'CategoryCollectionChildrenRepository',
1161
+ useExisting: CategoryCollectionChildrenHasuraGraphQLRepository,
1162
+ },
1163
+ {
1164
+ provide: CategoryProductHasuraGraphQLRepository,
1165
+ useFactory: (options) => {
1166
+ return new CategoryProductHasuraGraphQLRepository(options);
1167
+ },
1168
+ deps: ['HasuraConfig'],
1169
+ },
1170
+ {
1171
+ provide: 'CategoryProductRepository',
1172
+ useExisting: CategoryProductHasuraGraphQLRepository,
1173
+ },
1174
+ {
1175
+ provide: WishlistHasuraGraphQLRepository,
1176
+ useFactory: (options, categoryProductRepository) => {
1177
+ return new WishlistHasuraGraphQLRepository(options, categoryProductRepository);
1178
+ },
1179
+ deps: ['HasuraConfig', CategoryProductHasuraGraphQLRepository],
1180
+ },
1181
+ {
1182
+ provide: 'WishlistRepository',
1183
+ useExisting: WishlistHasuraGraphQLRepository,
1184
+ },
1185
+ {
1186
+ provide: ProductErrorsHasuraGraphQLRepository,
1187
+ useFactory: (options, productRepository) => {
1188
+ return new ProductErrorsHasuraGraphQLRepository(options, productRepository);
1189
+ },
1190
+ deps: ['HasuraConfig', ProductHasuraGraphQLRepository],
1191
+ },
1192
+ {
1193
+ provide: 'ProductErrorsRepository',
1194
+ useExisting: ProductErrorsHasuraGraphQLRepository,
1195
+ },
1196
+ {
1197
+ provide: ProductCatalogHasuraGraphQLRepository,
1198
+ useFactory: (options) => {
1199
+ return new ProductCatalogHasuraGraphQLRepository(options);
1200
+ },
1201
+ deps: ['HasuraConfig'],
1202
+ },
1203
+ {
1204
+ provide: 'ProductCatalogRepository',
1205
+ useExisting: ProductCatalogHasuraGraphQLRepository,
1206
+ },
1207
+ {
1208
+ provide: ProductStockEntryHasuraGraphQLRepository,
1209
+ useFactory: (options) => {
1210
+ return new ProductStockEntryHasuraGraphQLRepository(options);
1211
+ },
1212
+ deps: ['HasuraConfig'],
1213
+ },
1214
+ {
1215
+ provide: 'ProductStockEntryRepository',
1216
+ useExisting: ProductStockEntryHasuraGraphQLRepository,
1217
+ },
1218
+ {
1219
+ provide: ProductGroupHasuraGraphQLRepository,
1220
+ useFactory: (options) => {
1221
+ return new ProductGroupHasuraGraphQLRepository(options);
1222
+ },
1223
+ deps: ['HasuraConfig'],
1224
+ },
1225
+ {
1226
+ provide: 'ProductGroupRepository',
1227
+ useExisting: ProductGroupHasuraGraphQLRepository,
1228
+ },
1229
+ {
1230
+ provide: ProductPriceLogHasuraGraphQLRepository,
1231
+ useFactory: (options) => {
1232
+ return new ProductPriceLogHasuraGraphQLRepository(options);
1233
+ },
1234
+ deps: ['HasuraConfig'],
1235
+ },
1236
+ {
1237
+ provide: 'ProductPriceLogRepository',
1238
+ useExisting: ProductPriceLogHasuraGraphQLRepository,
1239
+ },
1240
+ ],
1241
+ }]
1242
+ }] });
1243
+
1244
+ class AngularVertexSeachModule {
1245
+ static initializeApp(options) {
1246
+ return {
1247
+ ngModule: AngularVertexSeachModule,
1248
+ providers: [{ provide: VERTEX_CONFIG, useValue: options }],
1249
+ };
1250
+ }
1251
+ }
1252
+ AngularVertexSeachModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularVertexSeachModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1253
+ AngularVertexSeachModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularVertexSeachModule });
1254
+ AngularVertexSeachModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularVertexSeachModule, providers: [
1255
+ {
1256
+ provide: ProductsVertexSearch,
1257
+ useFactory: (configuration) => new ProductsVertexSearch(new VertexAxiosAdapter(configuration)),
1258
+ deps: [VERTEX_CONFIG],
1259
+ },
1260
+ ] });
1261
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularVertexSeachModule, decorators: [{
1262
+ type: NgModule,
1263
+ args: [{
1264
+ providers: [
1265
+ {
1266
+ provide: ProductsVertexSearch,
1267
+ useFactory: (configuration) => new ProductsVertexSearch(new VertexAxiosAdapter(configuration)),
1268
+ deps: [VERTEX_CONFIG],
1269
+ },
1270
+ ],
1271
+ }]
1272
+ }] });
1273
+
1274
+ const STORAGE_BASE_URL = 'STORAGE_BASE_URL';
1275
+
1276
+ class CookieDataPersistence {
1277
+ get(key) {
1278
+ return of(cookie.get(key));
1279
+ }
1280
+ remove(key) {
1281
+ return of(cookie.remove(key));
1282
+ }
1283
+ set(key, value) {
1284
+ return from(cookie.set(key, value)).pipe(map(() => { }));
1285
+ }
1286
+ }
1287
+ CookieDataPersistence.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CookieDataPersistence, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1288
+ CookieDataPersistence.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CookieDataPersistence });
1289
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CookieDataPersistence, decorators: [{
1290
+ type: Injectable
1291
+ }] });
1292
+
1293
+ class AuthService {
1294
+ constructor(angularFireAuth, userRepository) {
1295
+ this.angularFireAuth = angularFireAuth;
1296
+ this.userRepository = userRepository;
1297
+ }
1298
+ getAuthstate() {
1299
+ const observables = [this.getFireUser(), this.getUser()];
1300
+ return combineLatest(observables).pipe(map(([fireUser, user]) => ({
1301
+ user,
1302
+ isAnonymous: fireUser === null || fireUser === void 0 ? void 0 : fireUser.isAnonymous,
1303
+ })));
1304
+ }
1305
+ getUser() {
1306
+ return this.getFireUser().pipe(map((user) => user === null || user === void 0 ? void 0 : user.uid), mergeMap((id) => (id ? from(this.userRepository.get({ id })).pipe(catchError(() => of(null))) : of(null))));
1307
+ }
1308
+ getTokenId() {
1309
+ return from(getIdToken(this.angularFireAuth.currentUser));
1310
+ }
1311
+ getFireUser() {
1312
+ return authState(this.angularFireAuth).pipe(catchError(() => of(null)));
1313
+ }
1314
+ }
1315
+ AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AuthService, deps: [{ token: i1.Auth }, { token: 'UserRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
1316
+ AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AuthService });
1317
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AuthService, decorators: [{
1318
+ type: Injectable
1319
+ }], ctorParameters: function () {
1320
+ return [{ type: i1.Auth }, { type: undefined, decorators: [{
1321
+ type: Inject,
1322
+ args: ['UserRepository']
1323
+ }] }];
1324
+ } });
1325
+
1326
+ class CheckoutRepositoriesFacade {
1327
+ constructor(checkoutRepository, userRepository) {
1328
+ this.checkoutRepository = checkoutRepository;
1329
+ this.userRepository = userRepository;
1330
+ }
1331
+ }
1332
+ CheckoutRepositoriesFacade.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CheckoutRepositoriesFacade, deps: [{ token: 'CheckoutRepository' }, { token: 'UserRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
1333
+ CheckoutRepositoriesFacade.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CheckoutRepositoriesFacade });
1334
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CheckoutRepositoriesFacade, decorators: [{
1335
+ type: Injectable
1336
+ }], ctorParameters: function () {
1337
+ return [{ type: undefined, decorators: [{
1338
+ type: Inject,
1339
+ args: ['CheckoutRepository']
1340
+ }] }, { type: undefined, decorators: [{
1341
+ type: Inject,
1342
+ args: ['UserRepository']
1343
+ }] }];
1344
+ } });
1345
+
1346
+ class CheckoutDependenciesFacade {
1347
+ constructor(dataPersistence, httpClient) {
1348
+ this.dataPersistence = dataPersistence;
1349
+ this.httpClient = httpClient;
1350
+ }
1351
+ }
1352
+ CheckoutDependenciesFacade.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CheckoutDependenciesFacade, deps: [{ token: PERSISTENCE_PROVIDER }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1353
+ CheckoutDependenciesFacade.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CheckoutDependenciesFacade });
1354
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CheckoutDependenciesFacade, decorators: [{
1355
+ type: Injectable
1356
+ }], ctorParameters: function () {
1357
+ return [{ type: undefined, decorators: [{
1358
+ type: Inject,
1359
+ args: [PERSISTENCE_PROVIDER]
1360
+ }] }, { type: i1$2.HttpClient }];
1361
+ } });
1362
+
1363
+ class ConfigurationFacade {
1364
+ constructor(defaultShop, firebaseOptions) {
1365
+ this.defaultShop = defaultShop;
1366
+ this.firebaseOptions = firebaseOptions;
1367
+ }
1368
+ getCheckoutUrl() {
1369
+ return `https://southamerica-east1-${this.firebaseOptions.projectId}.cloudfunctions.net`;
1370
+ }
1371
+ getProjectId() {
1372
+ return this.firebaseOptions.projectId;
1373
+ }
1374
+ }
1375
+ ConfigurationFacade.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ConfigurationFacade, deps: [{ token: DEFAULT_SHOP }, { token: FIREBASE_OPTIONS }], target: i0.ɵɵFactoryTarget.Injectable });
1376
+ ConfigurationFacade.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ConfigurationFacade });
1377
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ConfigurationFacade, decorators: [{
1378
+ type: Injectable
1379
+ }], ctorParameters: function () {
1380
+ return [{ type: i3.Shops, decorators: [{
1381
+ type: Inject,
1382
+ args: [DEFAULT_SHOP]
1383
+ }] }, { type: undefined, decorators: [{
1384
+ type: Inject,
1385
+ args: [FIREBASE_OPTIONS]
1386
+ }] }];
1387
+ } });
1388
+
1389
+ class CheckoutService {
1390
+ constructor(repositoriesFacade, dependenciesFacade, configurationFacade) {
1391
+ this.repositoriesFacade = repositoriesFacade;
1392
+ this.dependenciesFacade = dependenciesFacade;
1393
+ this.configurationFacade = configurationFacade;
1394
+ this.checkoutUrl = null;
1395
+ this.checkoutUrl = this.configurationFacade.getCheckoutUrl();
1396
+ }
1397
+ getCheckout(checkoutData) {
1398
+ return this.dependenciesFacade.dataPersistence
1399
+ .get('checkoutId')
1400
+ .pipe(concatMap((id) => !isNil(id) ? this.repositoriesFacade.checkoutRepository.get({ id }) : this.createCheckout(checkoutData)));
1401
+ }
1402
+ getUserByCheckout(checkoutId) {
1403
+ return from(this.repositoriesFacade.checkoutRepository.get({ id: checkoutId })).pipe(concatMap((checkout) => {
1404
+ var _a;
1405
+ return ((_a = checkout === null || checkout === void 0 ? void 0 : checkout.user) === null || _a === void 0 ? void 0 : _a.id)
1406
+ ? of(checkout.user)
1407
+ : from(this.repositoriesFacade.userRepository.get({ id: checkout.user.id }));
1408
+ }), concatMap((user) => of(user) || throwError(() => new NotFoundError('User is not found'))));
1409
+ }
1410
+ updateCheckoutLineItems(checkout) {
1411
+ return from(this.repositoriesFacade.checkoutRepository.update(Checkout.toInstance({ id: checkout.id, lineItems: checkout.lineItems })));
1412
+ }
1413
+ updateCheckoutUser(checkout) {
1414
+ return from(this.repositoriesFacade.checkoutRepository.update(Checkout.toInstance({ id: checkout.id, user: checkout.user })));
1415
+ }
1416
+ clearCheckoutFromSession() {
1417
+ return this.dependenciesFacade.dataPersistence.remove('checkoutId');
1418
+ }
1419
+ resetCheckoutValues() {
1420
+ return this.getCheckout().pipe(concatMap((checkout) => this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/checkoutResetValues`, {
1421
+ checkoutId: checkout.id,
1422
+ })), concatMap(() => this.getCheckout()));
1423
+ }
1424
+ applyCouponDiscount(nickname, checkoutType) {
1425
+ return this.getCheckout().pipe(concatMap((checkout) => this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/checkoutApplyDiscount`, {
1426
+ checkoutId: checkout.id,
1427
+ coupon: nickname,
1428
+ checkoutType,
1429
+ })), concatMap(() => this.getCheckout()), map((checkout) => checkout.coupon));
1430
+ }
1431
+ removeCouponDiscount() {
1432
+ return this.getCheckout().pipe(concatMap((checkout) => this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/checkoutRemoveDiscount`, {
1433
+ checkoutId: checkout.id,
1434
+ })), concatMap(() => this.getCheckout()));
1435
+ }
1436
+ applyPointsDiscount(points) {
1437
+ return this.getCheckout().pipe(concatMap((checkout) => this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/checkoutApplyPointsDiscount`, {
1438
+ checkoutId: checkout.id,
1439
+ points,
1440
+ })), concatMap(() => this.getCheckout()));
1441
+ }
1442
+ removePointsDiscount() {
1443
+ return this.getCheckout().pipe(concatMap((checkout) => this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/checkoutRemovePointsDiscount`, {
1444
+ checkoutId: checkout.id,
1445
+ })), concatMap(() => this.getCheckout()));
1446
+ }
1447
+ validateStockProducts() {
1448
+ return this.getCheckout().pipe(concatMap((checkout) => this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/checkoutValidateProductStock`, {
1449
+ checkoutId: checkout.id,
1450
+ })));
1451
+ }
1452
+ selectShippingAddress(address) {
1453
+ const formattedAddress = Object.assign(Object.assign({}, address), { zip: this.formatZip(address.zip) });
1454
+ return this.getCheckout().pipe(concatMap((checkout) => {
1455
+ return this.repositoriesFacade.checkoutRepository.update(Checkout.toInstance({
1456
+ id: checkout.id,
1457
+ shippingAddress: formattedAddress,
1458
+ billingAddress: formattedAddress,
1459
+ }));
1460
+ }));
1461
+ }
1462
+ formatZip(zip) {
1463
+ if (!zip)
1464
+ return zip;
1465
+ const digits = zip.replace(/\D/g, '');
1466
+ return digits;
1467
+ }
1468
+ getAvailableShippingForProduct(productShipping) {
1469
+ return this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/checkoutGetAvailableShipping`, {
1470
+ checkoutId: null,
1471
+ productShipping,
1472
+ });
1473
+ }
1474
+ getAvailableShippingForCheckout() {
1475
+ return this.getCheckout().pipe(concatMap((checkout) => this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/checkoutGetAvailableShipping`, {
1476
+ checkoutId: checkout.id,
1477
+ productShipping: null,
1478
+ })));
1479
+ }
1480
+ selectShipping(option) {
1481
+ return this.getCheckout().pipe(concatMap((checkout) => this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/checkoutSelectShipping`, {
1482
+ checkoutId: checkout.id,
1483
+ shippingOption: option,
1484
+ })), concatMap(() => this.getCheckout()));
1485
+ }
1486
+ createOrder(checkoutPayload, paymentProvider, applicationVersion) {
1487
+ return this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/checkout`, {
1488
+ data: Object.assign(Object.assign({}, checkoutPayload), { applicationVersion,
1489
+ paymentProvider }),
1490
+ });
1491
+ }
1492
+ createCheckout(checkoutData) {
1493
+ return __awaiter(this, void 0, void 0, function* () {
1494
+ const checkout = yield this.repositoriesFacade.checkoutRepository.create(Object.assign(Object.assign({ createdAt: new Date() }, Checkout.toInstance(pick(checkoutData, ['user', 'shop'])).toPlain()), { shop: (checkoutData === null || checkoutData === void 0 ? void 0 : checkoutData.shop) || this.configurationFacade.defaultShop }));
1495
+ yield this.dependenciesFacade.dataPersistence.set('checkoutId', checkout.id).toPromise();
1496
+ return checkout;
1497
+ });
1498
+ }
1499
+ }
1500
+ CheckoutService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CheckoutService, deps: [{ token: CheckoutRepositoriesFacade }, { token: CheckoutDependenciesFacade }, { token: ConfigurationFacade }], target: i0.ɵɵFactoryTarget.Injectable });
1501
+ CheckoutService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CheckoutService });
1502
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CheckoutService, decorators: [{
1503
+ type: Injectable
1504
+ }], ctorParameters: function () { return [{ type: CheckoutRepositoriesFacade }, { type: CheckoutDependenciesFacade }, { type: ConfigurationFacade }]; } });
1505
+
1506
+ class CartServicesFacade {
1507
+ constructor(authService, checkoutService, httpClient) {
1508
+ this.authService = authService;
1509
+ this.checkoutService = checkoutService;
1510
+ this.httpClient = httpClient;
1511
+ }
1512
+ }
1513
+ CartServicesFacade.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartServicesFacade, deps: [{ token: AuthService }, { token: CheckoutService }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1514
+ CartServicesFacade.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartServicesFacade });
1515
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartServicesFacade, decorators: [{
1516
+ type: Injectable
1517
+ }], ctorParameters: function () { return [{ type: AuthService }, { type: CheckoutService }, { type: i1$2.HttpClient }]; } });
1518
+
1519
+ /* eslint-disable max-params */
1520
+ class CartService {
1521
+ constructor(servicesFacade, configurationFacade) {
1522
+ this.servicesFacade = servicesFacade;
1523
+ this.configurationFacade = configurationFacade;
1524
+ this.cartSubject = new Subject();
1525
+ this.checkoutUrl = null;
1526
+ this.generateCartObject = (items) => (items === null || items === void 0 ? void 0 : items.reduce((cart, item) => {
1527
+ var _a;
1528
+ return (Object.assign(Object.assign({}, cart), { [item.id]: LineItem.toInstance(Object.assign(Object.assign({}, (cart[item.id] || item)), { quantity: (((_a = cart[item.id]) === null || _a === void 0 ? void 0 : _a.quantity) || 0) + (item.quantity ? item.quantity : 1) })) }));
1529
+ }, {})) || {};
1530
+ this.checkoutUrl = this.configurationFacade.getCheckoutUrl();
1531
+ }
1532
+ addItem(item, quantity = 1, recurrence = false, recurrenceCycle = null) {
1533
+ return this.servicesFacade.checkoutService.getCheckout().pipe(concatMap((checkout) => this.servicesFacade.httpClient.post(`${this.checkoutUrl}/checkoutAddItemToCart`, {
1534
+ checkoutId: checkout.id,
1535
+ productId: item.id,
1536
+ quantity,
1537
+ recurrence,
1538
+ recurrenceCycle,
1539
+ })), concatMap(() => this.servicesFacade.checkoutService.getCheckout()), map((updatedCheckout) => this.generateCartObject(updatedCheckout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
1540
+ }
1541
+ updateItemRecurrence(item, recurrence = false, recurrenceCycle = null) {
1542
+ return this.servicesFacade.checkoutService.getCheckout().pipe(concatMap((checkout) => this.servicesFacade.httpClient.post(`${this.checkoutUrl}/checkoutUpdateItemRecurrence`, {
1543
+ checkoutId: checkout.id,
1544
+ productId: item.id,
1545
+ recurrence,
1546
+ recurrenceCycle,
1547
+ })), concatMap(() => this.servicesFacade.checkoutService.getCheckout()), map((updatedCheckout) => this.generateCartObject(updatedCheckout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
1548
+ }
1549
+ decreaseItem(item) {
1550
+ return this.servicesFacade.checkoutService.getCheckout().pipe(concatMap((checkout) => this.servicesFacade.httpClient.post(`${this.checkoutUrl}/checkoutDecreaseProductFromCart`, {
1551
+ checkoutId: checkout.id,
1552
+ productId: item.id,
1553
+ quantity: 1,
1554
+ })), concatMap(() => this.servicesFacade.checkoutService.getCheckout()), map((updatedCheckout) => this.generateCartObject(updatedCheckout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
1555
+ }
1556
+ removeItem(item) {
1557
+ return this.servicesFacade.checkoutService.getCheckout().pipe(concatMap((checkout) => this.servicesFacade.httpClient.post(`${this.checkoutUrl}/checkoutRemoveProductFromCart`, {
1558
+ checkoutId: checkout.id,
1559
+ productId: item.id,
1560
+ })), concatMap(() => this.servicesFacade.checkoutService.getCheckout()), map((updatedCheckout) => this.generateCartObject(updatedCheckout.lineItems)), tap((cart) => this.cartSubject.next(cart)));
1561
+ }
1562
+ updateUserCart(user) {
1563
+ return this.servicesFacade.checkoutService.getCheckout().pipe(concatMap((checkout) => this.servicesFacade.checkoutService.updateCheckoutUser(Checkout.toInstance(Object.assign(Object.assign({}, checkout.toPlain()), { user })))), concatMap((checkout) => {
1564
+ return this.servicesFacade.httpClient.post(`${this.checkoutUrl}/checkoutUpdateUserCart`, {
1565
+ checkoutId: checkout.id,
1566
+ });
1567
+ }), concatMap(() => this.servicesFacade.checkoutService.getCheckout()), map((updatedCheckout) => {
1568
+ return this.generateCartObject(updatedCheckout.lineItems);
1569
+ }), tap((cart) => this.cartSubject.next(cart)));
1570
+ }
1571
+ getCart(checkout) {
1572
+ this.buildCartFromCheckout(checkout).subscribe((cart) => this.cartSubject.next(cart));
1573
+ return this.cartSubject;
1574
+ }
1575
+ clearCart() {
1576
+ return this.servicesFacade.checkoutService.getCheckout().pipe(map((checkout) => {
1577
+ this.servicesFacade.checkoutService.clearCheckoutFromSession();
1578
+ return checkout;
1579
+ }), concatMap((oldCheckout) => this.buildCartFromCheckout(oldCheckout)), tap((cart) => this.cartSubject.next(cart)));
1580
+ }
1581
+ buildCartFromCheckout(checkoutData) {
1582
+ return this.servicesFacade.checkoutService.getCheckout(checkoutData).pipe(map((checkout) => checkout.lineItems), concatMap((lineItems) => of(this.generateCartObject(lineItems))));
1583
+ }
1584
+ }
1585
+ CartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartService, deps: [{ token: CartServicesFacade }, { token: ConfigurationFacade }], target: i0.ɵɵFactoryTarget.Injectable });
1586
+ CartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartService });
1587
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CartService, decorators: [{
1588
+ type: Injectable
1589
+ }], ctorParameters: function () { return [{ type: CartServicesFacade }, { type: ConfigurationFacade }]; } });
1590
+
1591
+ class NewCategoryStructureAdapter {
1592
+ constructor(categoryRepository) {
1593
+ this.categoryRepository = categoryRepository;
1594
+ }
1595
+ buildProductFilterByCategory(category) {
1596
+ return __awaiter(this, void 0, void 0, function* () {
1597
+ const loadedCategory = yield this.getCategory(category);
1598
+ if (loadedCategory.isCollection)
1599
+ return { id: { operator: Where.IN, value: loadedCategory.products } };
1600
+ const categoryIds = [...(yield this.getAllCategoriesIdFromCategory(category)), category.id.toString()];
1601
+ return {
1602
+ category: {
1603
+ id: {
1604
+ operator: Where.IN,
1605
+ value: categoryIds,
1606
+ },
1607
+ },
1608
+ };
1609
+ });
1610
+ }
1611
+ getAllCategoriesIdFromCategory(category) {
1612
+ return __awaiter(this, void 0, void 0, function* () {
1613
+ return this.categoryRepository
1614
+ .getChildren(+category.id)
1615
+ .then((categories) => categories.map((category) => category.id.toString()));
1616
+ });
1617
+ }
1618
+ getCategory(category) {
1619
+ var _a;
1620
+ return __awaiter(this, void 0, void 0, function* () {
1621
+ const collectionCategory = category.isCollection ||
1622
+ (isNil(category.isCollection) && !((_a = category.products) === null || _a === void 0 ? void 0 : _a.length)) ||
1623
+ category.isWishlist ||
1624
+ category.brandCategory;
1625
+ return collectionCategory ? this.categoryRepository.get({ id: category.id }) : category;
1626
+ });
1627
+ }
1628
+ }
1629
+ NewCategoryStructureAdapter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NewCategoryStructureAdapter, deps: [{ token: 'CategoryRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
1630
+ NewCategoryStructureAdapter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NewCategoryStructureAdapter });
1631
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: NewCategoryStructureAdapter, decorators: [{
1632
+ type: Injectable
1633
+ }], ctorParameters: function () {
1634
+ return [{ type: undefined, decorators: [{
1635
+ type: Inject,
1636
+ args: ['CategoryRepository']
1637
+ }] }];
1638
+ } });
1639
+
1640
+ class OldCategoryStructureAdapter {
1641
+ constructor(categoryRepository) {
1642
+ this.categoryRepository = categoryRepository;
1643
+ }
1644
+ buildProductFilterByCategory(category) {
1645
+ var _a;
1646
+ return __awaiter(this, void 0, void 0, function* () {
1647
+ const productsIds = ((_a = category.products) === null || _a === void 0 ? void 0 : _a.length)
1648
+ ? category.products
1649
+ : yield this.categoryRepository.get({ id: category.id }).then((categoryFound) => categoryFound.products);
1650
+ return { id: { operator: Where.IN, value: productsIds } };
1651
+ });
1652
+ }
1653
+ }
1654
+ OldCategoryStructureAdapter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OldCategoryStructureAdapter, deps: [{ token: 'CategoryRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
1655
+ OldCategoryStructureAdapter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OldCategoryStructureAdapter });
1656
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OldCategoryStructureAdapter, decorators: [{
1657
+ type: Injectable
1658
+ }], ctorParameters: function () {
1659
+ return [{ type: undefined, decorators: [{
1660
+ type: Inject,
1661
+ args: ['CategoryRepository']
1662
+ }] }];
1663
+ } });
1664
+
1665
+ class CatalogSearchContext {
1666
+ constructor(categoryStrategy, termStrategy, profileStrategy) {
1667
+ this.categoryStrategy = categoryStrategy;
1668
+ this.termStrategy = termStrategy;
1669
+ this.profileStrategy = profileStrategy;
1670
+ this.strategies = new Map();
1671
+ this.initializeStrategies();
1672
+ }
1673
+ executeSearch(params, shop, optionsCache) {
1674
+ return __awaiter(this, void 0, void 0, function* () {
1675
+ const strategy = this.selectStrategy(params);
1676
+ return strategy.search(params, shop, optionsCache);
1677
+ });
1678
+ }
1679
+ initializeStrategies() {
1680
+ this.strategies.set('category', this.categoryStrategy);
1681
+ this.strategies.set('term', this.termStrategy);
1682
+ this.strategies.set('profile', this.profileStrategy);
1683
+ }
1684
+ selectStrategy(params) {
1685
+ var _a;
1686
+ if (params.category) {
1687
+ const strategy = this.strategies.get('category');
1688
+ if (!strategy)
1689
+ throw new Error('Category strategy not found');
1690
+ return strategy;
1691
+ }
1692
+ if (params.term) {
1693
+ const strategy = this.strategies.get('term');
1694
+ if (!strategy)
1695
+ throw new Error('Term strategy not found');
1696
+ return strategy;
1697
+ }
1698
+ if ((_a = params.profile) === null || _a === void 0 ? void 0 : _a.length) {
1699
+ const strategy = this.strategies.get('profile');
1700
+ if (!strategy)
1701
+ throw new Error('Profile strategy not found');
1702
+ return strategy;
1703
+ }
1704
+ throw new Error('No valid search strategy found for the given parameters');
1705
+ }
1706
+ }
1707
+
1708
+ class CategorySearchStrategy {
1709
+ constructor(repositoryService, helpersService) {
1710
+ this.repositoryService = repositoryService;
1711
+ this.helpersService = helpersService;
1712
+ }
1713
+ search(params, shop, optionsCache) {
1714
+ return __awaiter(this, void 0, void 0, function* () {
1715
+ const { category, filters, limits, sort, mainGender } = params;
1716
+ if (!category) {
1717
+ throw new Error('Category is required for CategorySearchStrategy');
1718
+ }
1719
+ const fields = this.helpersService.getFieldsHelper().getStandardFields();
1720
+ if (sort === 'most-relevant') {
1721
+ return this.searchWithMostRelevant({
1722
+ category,
1723
+ filters,
1724
+ limits,
1725
+ shop,
1726
+ mainGender,
1727
+ optionsCache,
1728
+ fields,
1729
+ });
1730
+ }
1731
+ return this.searchDefault({
1732
+ category,
1733
+ filters,
1734
+ limits,
1735
+ shop,
1736
+ mainGender,
1737
+ sort,
1738
+ optionsCache,
1739
+ fields,
1740
+ });
1741
+ });
1742
+ }
1743
+ searchWithMostRelevant(params) {
1744
+ return __awaiter(this, void 0, void 0, function* () {
1745
+ const { category, filters, shop, optionsCache } = params;
1746
+ const mostRelevant = category.isWishlist ? [] : category.getMostRelevantByShop(shop);
1747
+ const productsIds = yield this.getProductIds(category, filters, optionsCache);
1748
+ return this.findAndSortByMostRelevant({
1749
+ mostRelevants: mostRelevant,
1750
+ productIds: productsIds,
1751
+ filters: params.filters,
1752
+ limits: params.limits,
1753
+ shop: params.shop,
1754
+ mainGender: params.mainGender,
1755
+ optionsCache: params.optionsCache,
1756
+ fields: params.fields,
1757
+ });
1758
+ });
1759
+ }
1760
+ searchDefault(params) {
1761
+ return __awaiter(this, void 0, void 0, function* () {
1762
+ const { category, filters, limits, sort, optionsCache, fields } = params;
1763
+ const productCatalog = this.repositoryService.getProductCatalog();
1764
+ const filterHelper = this.helpersService.getFilterHelper();
1765
+ const sortHelper = this.helpersService.getSortHelper();
1766
+ const repoParams = Object.assign(Object.assign({ fields, filters: Object.assign(Object.assign({}, (yield productCatalog.categoryStructureAdapter.buildProductFilterByCategory(category))), filterHelper.buildFilterQuery(filters || {})) }, (sort ? { orderBy: sortHelper.buildSortQuery(sort) } : {})), { limits, options: {
1767
+ minimal: ['price'],
1768
+ maximum: ['price'],
1769
+ distinct: ['brand'],
1770
+ } });
1771
+ return productCatalog.productCatalogRepository.findCatalog(repoParams, null, optionsCache);
1772
+ });
1773
+ }
1774
+ getProductIds(category, filters, optionsCache) {
1775
+ return __awaiter(this, void 0, void 0, function* () {
1776
+ const productCatalog = this.repositoryService.getProductCatalog();
1777
+ const filterHelper = this.helpersService.getFilterHelper();
1778
+ return productCatalog.productCatalogRepository
1779
+ .findCatalog({
1780
+ fields: ['id'],
1781
+ filters: Object.assign(Object.assign({}, (yield productCatalog.categoryStructureAdapter.buildProductFilterByCategory(category))), filterHelper.buildFilterQuery(filters || {})),
1782
+ }, undefined, optionsCache)
1783
+ .then((products) => products.data.map((product) => product.id));
1784
+ });
1785
+ }
1786
+ findAndSortByMostRelevant(params) {
1787
+ return __awaiter(this, void 0, void 0, function* () {
1788
+ const { mostRelevants, productIds, filters, shop, mainGender, optionsCache, fields, limits } = params;
1789
+ const productCatalog = this.repositoryService.getProductCatalog();
1790
+ const filterHelper = this.helpersService.getFilterHelper();
1791
+ const sortHelper = this.helpersService.getSortHelper();
1792
+ const mostRelevantProductsIds = [...new Set(mostRelevants.concat(productIds))];
1793
+ const totalResult = yield productCatalog.productCatalogRepository.findCatalog({
1794
+ fields,
1795
+ filters: Object.assign({ id: { operator: Where.IN, value: mostRelevantProductsIds } }, filterHelper.buildFilterQuery(filters || {})),
1796
+ orderBy: sortHelper.buildSortQuery('best-sellers'),
1797
+ options: Object.assign({ minimal: ['price'], maximum: ['price'] }, (isEmpty(filters === null || filters === void 0 ? void 0 : filters.brands) ? { distinct: ['brand'] } : {})),
1798
+ }, mainGender || (shop === Shops.MENSMARKET ? 'male' : 'female'), optionsCache);
1799
+ return this.sortProductsByRelevance(totalResult, mostRelevants, limits);
1800
+ });
1801
+ }
1802
+ sortProductsByRelevance(totalResult, mostRelevants, limits) {
1803
+ const mostRelevantWithoutStock = totalResult.data.filter((product) => mostRelevants.includes(product.id) && product.stock.quantity <= 0);
1804
+ const firstProducts = totalResult.data
1805
+ .filter((product) => mostRelevants.includes(product.id) && product.stock.quantity > 0)
1806
+ .sort((a, b) => mostRelevants.indexOf(a.id) - mostRelevants.indexOf(b.id));
1807
+ const lastProducts = totalResult.data
1808
+ .filter((product) => !mostRelevants.includes(product.id))
1809
+ .concat(mostRelevantWithoutStock);
1810
+ const categoryMostRelevants = firstProducts.concat(lastProducts);
1811
+ const resultFinal = categoryMostRelevants.slice(limits.offset, limits.offset + limits.limit);
1812
+ return {
1813
+ data: resultFinal,
1814
+ count: totalResult.count,
1815
+ maximum: totalResult.maximum,
1816
+ minimal: totalResult.minimal,
1817
+ distinct: totalResult.distinct,
1818
+ };
1819
+ }
1820
+ }
1821
+ CategorySearchStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CategorySearchStrategy, deps: [{ token: CatalogRepositoryService }, { token: CatalogHelpersService }], target: i0.ɵɵFactoryTarget.Injectable });
1822
+ CategorySearchStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CategorySearchStrategy });
1823
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CategorySearchStrategy, decorators: [{
1824
+ type: Injectable
1825
+ }], ctorParameters: function () { return [{ type: CatalogRepositoryService }, { type: CatalogHelpersService }]; } });
1826
+
1827
+ class ProfileSearchStrategy {
1828
+ constructor(repositoryService, helpersService) {
1829
+ this.repositoryService = repositoryService;
1830
+ this.helpersService = helpersService;
1831
+ }
1832
+ search(params, shop, optionsCache) {
1833
+ return __awaiter(this, void 0, void 0, function* () {
1834
+ const { profile, filters, limits, sort, mainGender } = params;
1835
+ if (!profile) {
1836
+ throw new Error('Profile is required for ProfileSearchStrategy');
1837
+ }
1838
+ const productCatalog = this.repositoryService.getProductCatalog();
1839
+ const filterHelper = this.helpersService.getFilterHelper();
1840
+ const sortHelper = this.helpersService.getSortHelper();
1841
+ const fieldsHelper = this.helpersService.getFieldsHelper();
1842
+ const repoParams = Object.assign(Object.assign({ fields: fieldsHelper.getStandardFields(), filters: Object.assign({ tagsProfile: { operator: Where.LIKE, value: profile } }, filterHelper.buildFilterQuery(filters || {})) }, (sort ? { orderBy: sortHelper.buildSortQuery(sort) } : {})), { limits, options: {
1843
+ minimal: ['price'],
1844
+ maximum: ['price'],
1845
+ distinct: ['brand'],
1846
+ } });
1847
+ return productCatalog.productCatalogRepository.findCatalog(repoParams, mainGender || (shop === Shops.MENSMARKET ? 'male' : 'female'), optionsCache);
1848
+ });
1849
+ }
1850
+ }
1851
+ ProfileSearchStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ProfileSearchStrategy, deps: [{ token: CatalogRepositoryService }, { token: CatalogHelpersService }], target: i0.ɵɵFactoryTarget.Injectable });
1852
+ ProfileSearchStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ProfileSearchStrategy });
1853
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ProfileSearchStrategy, decorators: [{
1854
+ type: Injectable
1855
+ }], ctorParameters: function () { return [{ type: CatalogRepositoryService }, { type: CatalogHelpersService }]; } });
1856
+
1857
+ class TermSearchStrategy {
1858
+ constructor(repositoryService, helpersService) {
1859
+ this.repositoryService = repositoryService;
1860
+ this.helpersService = helpersService;
1861
+ this.productsByTerm = {};
1862
+ }
1863
+ search(params, shop, _optionsCache) {
1864
+ return __awaiter(this, void 0, void 0, function* () {
1865
+ const { term, filters, limits, sort, mainGender } = params;
1866
+ if (!term) {
1867
+ throw new Error('Term is required for TermSearchStrategy');
1868
+ }
1869
+ const productIds = yield this.findCatalogIdsBySearch(term, shop);
1870
+ if (sort === 'most-relevant') {
1871
+ return this.searchWithMostRelevant({
1872
+ productIds,
1873
+ filters,
1874
+ limits,
1875
+ shop,
1876
+ mainGender,
1877
+ });
1878
+ }
1879
+ return this.searchDefault({
1880
+ productIds,
1881
+ filters,
1882
+ limits,
1883
+ shop,
1884
+ mainGender,
1885
+ sort,
1886
+ fields: this.helpersService.getFieldsHelper().getStandardFields(),
1887
+ });
1888
+ });
1889
+ }
1890
+ searchWithMostRelevant(params) {
1891
+ return __awaiter(this, void 0, void 0, function* () {
1892
+ const { productIds, filters, shop, mainGender } = params;
1893
+ const productCatalog = this.repositoryService.getProductCatalog();
1894
+ const filterHelper = this.helpersService.getFilterHelper();
1895
+ const totalResult = yield productCatalog.productCatalogRepository.findCatalog({
1896
+ fields: ['id', 'stock', 'gender'],
1897
+ filters: Object.assign({ id: { operator: Where.IN, value: productIds }, published: { operator: Where.EQUALS, value: true } }, filterHelper.buildFilterQuery(filters || {})),
1898
+ options: Object.assign({ minimal: ['price'], maximum: ['price'] }, (isEmpty(filters === null || filters === void 0 ? void 0 : filters.brands) ? { distinct: ['brand'] } : {})),
1899
+ });
1900
+ return this.sortByTermRelevance({
1901
+ productIds,
1902
+ totalResult,
1903
+ limits: params.limits,
1904
+ filters,
1905
+ fieldsHelper: this.helpersService.getFieldsHelper(),
1906
+ });
1907
+ });
1908
+ }
1909
+ searchDefault(params) {
1910
+ return __awaiter(this, void 0, void 0, function* () {
1911
+ const { productIds, filters, limits, sort, shop, mainGender, fields } = params;
1912
+ const productCatalog = this.repositoryService.getProductCatalog();
1913
+ const filterHelper = this.helpersService.getFilterHelper();
1914
+ const sortHelper = this.helpersService.getSortHelper();
1915
+ return productCatalog.productCatalogRepository.findCatalog(Object.assign(Object.assign({ fields, filters: Object.assign({ id: { operator: Where.IN, value: productIds }, published: { operator: Where.EQUALS, value: true } }, filterHelper.buildFilterQuery(filters || {})), limits }, (sort ? { orderBy: sortHelper.buildSortQuery(sort) } : {})), { options: {
1916
+ minimal: ['price'],
1917
+ maximum: ['price'],
1918
+ distinct: ['brand'],
1919
+ } }));
1920
+ });
1921
+ }
1922
+ sortByTermRelevance(params) {
1923
+ const { productIds, totalResult, limits, filters, fieldsHelper } = params;
1924
+ // const defaultGender = filters?.gender?.at(0) || 'male'
1925
+ const stockData = totalResult.data.filter((product) => product.stock.quantity > 0);
1926
+ const stockOut = totalResult.data.filter((product) => product.stock.quantity <= 0);
1927
+ const productIdsStock = productIds.filter((product) => stockData.some((result) => result.id === product));
1928
+ const productIdsStockOut = productIds.filter((product) => stockOut.some((result) => result.id === product));
1929
+ const limitedProductId = productIdsStock
1930
+ .concat(productIdsStockOut)
1931
+ .slice(limits.offset, limits.offset + limits.limit);
1932
+ return this.getDetailedProducts(limitedProductId, totalResult, fieldsHelper);
1933
+ }
1934
+ getDetailedProducts(orderedId, totalResult, fieldsHelper) {
1935
+ return __awaiter(this, void 0, void 0, function* () {
1936
+ const productCatalog = this.repositoryService.getProductCatalog();
1937
+ const fields = fieldsHelper.getStandardFields();
1938
+ const productResult = yield productCatalog.productCatalogRepository.findCatalog({
1939
+ filters: {
1940
+ id: { operator: Where.IN, value: orderedId },
1941
+ },
1942
+ fields,
1943
+ });
1944
+ return {
1945
+ data: orderedId.map((id) => productResult.data.find((product) => product.id === id)).filter(Boolean),
1946
+ count: totalResult.count,
1947
+ maximum: totalResult.maximum,
1948
+ minimal: totalResult.minimal,
1949
+ distinct: totalResult.distinct,
1950
+ };
1951
+ });
1952
+ }
1953
+ findCatalogIdsBySearch(term, shop) {
1954
+ return __awaiter(this, void 0, void 0, function* () {
1955
+ if (this.productsByTerm[term])
1956
+ return this.productsByTerm[term];
1957
+ const productServices = this.repositoryService.getProductServices();
1958
+ return (this.productsByTerm[term] = yield productServices.productSearch
1959
+ .search(term, 999, shop === Shops.GLAMSHOP ? 'female' : 'male')
1960
+ .then((products) => [...new Set(products.map((product) => product.id))]));
1961
+ });
1962
+ }
1963
+ }
1964
+ TermSearchStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: TermSearchStrategy, deps: [{ token: CatalogRepositoryService }, { token: CatalogHelpersService }], target: i0.ɵɵFactoryTarget.Injectable });
1965
+ TermSearchStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: TermSearchStrategy });
1966
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: TermSearchStrategy, decorators: [{
1967
+ type: Injectable
1968
+ }], ctorParameters: function () { return [{ type: CatalogRepositoryService }, { type: CatalogHelpersService }]; } });
1969
+
1970
+ class CatalogStrategiesFacade {
1971
+ constructor(categoryStrategy, termStrategy, profileStrategy) {
1972
+ this.categoryStrategy = categoryStrategy;
1973
+ this.termStrategy = termStrategy;
1974
+ this.profileStrategy = profileStrategy;
1975
+ }
1976
+ }
1977
+ CatalogStrategiesFacade.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogStrategiesFacade, deps: [{ token: CategorySearchStrategy }, { token: TermSearchStrategy }, { token: ProfileSearchStrategy }], target: i0.ɵɵFactoryTarget.Injectable });
1978
+ CatalogStrategiesFacade.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogStrategiesFacade });
1979
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogStrategiesFacade, decorators: [{
1980
+ type: Injectable
1981
+ }], ctorParameters: function () { return [{ type: CategorySearchStrategy }, { type: TermSearchStrategy }, { type: ProfileSearchStrategy }]; } });
1982
+
1983
+ class CatalogServiceFacade {
1984
+ constructor(helpersService, strategiesFacade, shop) {
1985
+ this.helpersService = helpersService;
1986
+ this.strategiesFacade = strategiesFacade;
1987
+ this.shop = shop;
1988
+ const searchContext = new CatalogSearchContext(this.strategiesFacade.categoryStrategy, this.strategiesFacade.termStrategy, this.strategiesFacade.profileStrategy);
1989
+ this.catalogService = new CatalogService(searchContext, this.helpersService, this.shop);
1990
+ }
1991
+ getCatalogService() {
1992
+ return this.catalogService;
1993
+ }
1994
+ }
1995
+ CatalogServiceFacade.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogServiceFacade, deps: [{ token: CatalogHelpersService }, { token: CatalogStrategiesFacade }, { token: DEFAULT_SHOP }], target: i0.ɵɵFactoryTarget.Injectable });
1996
+ CatalogServiceFacade.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogServiceFacade });
1997
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogServiceFacade, decorators: [{
1998
+ type: Injectable
1999
+ }], ctorParameters: function () {
2000
+ return [{ type: CatalogHelpersService }, { type: CatalogStrategiesFacade }, { type: i3.Shops, decorators: [{
2001
+ type: Inject,
2002
+ args: [DEFAULT_SHOP]
2003
+ }] }];
2004
+ } });
2005
+
2006
+ class CategoryRepositoryFacade {
2007
+ constructor(categoryRepository, categoryFilterRepository) {
2008
+ this.categoryRepository = categoryRepository;
2009
+ this.categoryFilterRepository = categoryFilterRepository;
2010
+ }
2011
+ }
2012
+ CategoryRepositoryFacade.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CategoryRepositoryFacade, deps: [{ token: 'CategoryRepository' }, { token: 'CategoryFilterRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
2013
+ CategoryRepositoryFacade.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CategoryRepositoryFacade });
2014
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CategoryRepositoryFacade, decorators: [{
2015
+ type: Injectable
2016
+ }], ctorParameters: function () {
2017
+ return [{ type: undefined, decorators: [{
2018
+ type: Inject,
2019
+ args: ['CategoryRepository']
2020
+ }] }, { type: undefined, decorators: [{
2021
+ type: Inject,
2022
+ args: ['CategoryFilterRepository']
2023
+ }] }];
2024
+ } });
2025
+
2026
+ class CategoryService {
2027
+ constructor(categoryFacade, productCatalog, shop) {
2028
+ this.categoryFacade = categoryFacade;
2029
+ this.productCatalog = productCatalog;
2030
+ this.shop = shop;
2031
+ }
2032
+ fetchBrands(category, options, optionsCache) {
2033
+ return __awaiter(this, void 0, void 0, function* () {
2034
+ const brands = yield this.productCatalog.productCatalogRepository
2035
+ .findCatalog({
2036
+ filters: yield this.productCatalog.categoryStructureAdapter.buildProductFilterByCategory(category),
2037
+ fields: ['brand'],
2038
+ }, null, optionsCache)
2039
+ .then(({ data }) => Object.keys(data.map((product) => product.brand).reduce((brands, brand) => (Object.assign(Object.assign({}, brands), { [brand]: true })), {})));
2040
+ return this.categoryFacade.categoryRepository
2041
+ .find({ filters: { brandCategory: true, shop: (options === null || options === void 0 ? void 0 : options.shop) || this.shop }, orderBy: { name: 'asc' } }, optionsCache)
2042
+ .then(({ data }) => data.filter((category) => brands.includes(category.conditions.brand)));
2043
+ });
2044
+ }
2045
+ getMenuBrands() {
2046
+ return __awaiter(this, void 0, void 0, function* () {
2047
+ return this.categoryFacade.categoryRepository.getBrandsWithProducts();
2048
+ });
2049
+ }
2050
+ fetchFilterOptions(category, optionsCache) {
2051
+ return __awaiter(this, void 0, void 0, function* () {
2052
+ return yield this.categoryFacade.categoryFilterRepository
2053
+ .find({ filters: { categoryId: +category.id } }, optionsCache)
2054
+ .then(({ data }) => data.map((categoryFilter) => categoryFilter.filter));
2055
+ });
2056
+ }
2057
+ }
2058
+ CategoryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CategoryService, deps: [{ token: CategoryRepositoryFacade }, { token: ProductCatalogFacade }, { token: DEFAULT_SHOP }], target: i0.ɵɵFactoryTarget.Injectable });
2059
+ CategoryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CategoryService });
2060
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CategoryService, decorators: [{
2061
+ type: Injectable
2062
+ }], ctorParameters: function () {
2063
+ return [{ type: CategoryRepositoryFacade }, { type: ProductCatalogFacade }, { type: i3.Shops, decorators: [{
2064
+ type: Inject,
2065
+ args: [DEFAULT_SHOP]
2066
+ }] }];
2067
+ } });
2068
+
2069
+ class ProductCatalogFacade {
2070
+ constructor(productCatalogRepository, categoryStructureAdapter) {
2071
+ this.productCatalogRepository = productCatalogRepository;
2072
+ this.categoryStructureAdapter = categoryStructureAdapter;
2073
+ }
2074
+ }
2075
+ ProductCatalogFacade.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ProductCatalogFacade, deps: [{ token: 'ProductCatalogRepository' }, { token: CATEGORY_STRUCTURE }], target: i0.ɵɵFactoryTarget.Injectable });
2076
+ ProductCatalogFacade.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ProductCatalogFacade });
2077
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ProductCatalogFacade, decorators: [{
2078
+ type: Injectable
2079
+ }], ctorParameters: function () {
2080
+ return [{ type: undefined, decorators: [{
2081
+ type: Inject,
2082
+ args: ['ProductCatalogRepository']
2083
+ }] }, { type: undefined, decorators: [{
2084
+ type: Inject,
2085
+ args: [CATEGORY_STRUCTURE]
2086
+ }] }];
2087
+ } });
2088
+
2089
+ class CategoryServiceFacade {
2090
+ constructor(categoryRepositoryFacade, productCatalogFacade, shop) {
2091
+ this.categoryRepositoryFacade = categoryRepositoryFacade;
2092
+ this.productCatalogFacade = productCatalogFacade;
2093
+ this.shop = shop;
2094
+ this.categoryService = new CategoryService(this.categoryRepositoryFacade, this.productCatalogFacade, this.shop);
2095
+ }
2096
+ getCategoryService() {
2097
+ return this.categoryService;
2098
+ }
2099
+ }
2100
+ CategoryServiceFacade.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CategoryServiceFacade, deps: [{ token: CategoryRepositoryFacade }, { token: ProductCatalogFacade }, { token: DEFAULT_SHOP }], target: i0.ɵɵFactoryTarget.Injectable });
2101
+ CategoryServiceFacade.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CategoryServiceFacade });
2102
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CategoryServiceFacade, decorators: [{
2103
+ type: Injectable
2104
+ }], ctorParameters: function () {
2105
+ return [{ type: CategoryRepositoryFacade }, { type: ProductCatalogFacade }, { type: i3.Shops, decorators: [{
2106
+ type: Inject,
2107
+ args: [DEFAULT_SHOP]
2108
+ }] }];
2109
+ } });
2110
+
2111
+ class BrandManagerHelper {
2112
+ constructor(productCatalog) {
2113
+ this.productCatalog = productCatalog;
2114
+ this.brandsList = {};
2115
+ }
2116
+ setBrandsList(options, brands) {
2117
+ var _a;
2118
+ return __awaiter(this, void 0, void 0, function* () {
2119
+ const filterBrands = (_a = options.filters) === null || _a === void 0 ? void 0 : _a.brands;
2120
+ const indexKey = this.buildIndexBrands(options);
2121
+ if (isEmpty(brands) && options.filters) {
2122
+ delete options.filters.brands;
2123
+ }
2124
+ this.brandsList[indexKey] = this.brandsList[indexKey] || brands || (yield this.fetchBrandsOnly(options));
2125
+ this.brandsList[indexKey] = this.brandsList[indexKey].filter(Boolean);
2126
+ if (options.filters) {
2127
+ options.filters = Object.assign(Object.assign({}, options.filters), { brands: filterBrands });
2128
+ }
2129
+ });
2130
+ }
2131
+ getBrandsList(indexKey) {
2132
+ return this.brandsList[indexKey];
2133
+ }
2134
+ buildIndexBrands(options) {
2135
+ if (options.category)
2136
+ return `category-${options.category.id}`;
2137
+ if (options.term)
2138
+ return `term-${options.term}`;
2139
+ if (options.profile)
2140
+ return `profile-${options.profile.join(',')}`;
2141
+ return '';
2142
+ }
2143
+ fetchBrandsOnly(options) {
2144
+ return __awaiter(this, void 0, void 0, function* () {
2145
+ let filters = {};
2146
+ if (options.category) {
2147
+ filters = yield this.productCatalog.categoryStructureAdapter.buildProductFilterByCategory(options.category);
2148
+ }
2149
+ return this.productCatalog.productCatalogRepository
2150
+ .findCatalog({
2151
+ fields: ['id'],
2152
+ filters: Object.assign(Object.assign({}, filters), { published: { operator: Where.EQUALS, value: true } }),
2153
+ options: {
2154
+ distinct: ['brand'],
2155
+ },
2156
+ }, options.mainGender)
2157
+ .then((result) => result.distinct.brand);
2158
+ });
2159
+ }
2160
+ }
2161
+ BrandManagerHelper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: BrandManagerHelper, deps: [{ token: ProductCatalogFacade }], target: i0.ɵɵFactoryTarget.Injectable });
2162
+ BrandManagerHelper.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: BrandManagerHelper });
2163
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: BrandManagerHelper, decorators: [{
2164
+ type: Injectable
2165
+ }], ctorParameters: function () { return [{ type: ProductCatalogFacade }]; } });
2166
+
2167
+ class CatalogFilterHelper {
2168
+ buildFilterQuery(filters) {
2169
+ var _a, _b, _c, _d, _e, _f, _g;
2170
+ const filterQuery = {};
2171
+ if ((_a = filters.clubDiscount) === null || _a === void 0 ? void 0 : _a.length) {
2172
+ set(filterQuery, 'price.subscriberDiscountPercentage', {
2173
+ operator: Where.IN,
2174
+ value: filters.clubDiscount,
2175
+ });
2176
+ }
2177
+ if ((_b = filters.brands) === null || _b === void 0 ? void 0 : _b.length) {
2178
+ filterQuery.brand = { operator: Where.IN, value: filters.brands };
2179
+ }
2180
+ if ((_c = filters.gender) === null || _c === void 0 ? void 0 : _c.length) {
2181
+ filterQuery.gender = { operator: Where.IN, value: filters.gender };
2182
+ }
2183
+ if (((_d = filters.prices) === null || _d === void 0 ? void 0 : _d.min) || ((_e = filters.prices) === null || _e === void 0 ? void 0 : _e.max)) {
2184
+ const priceField = filters.prices.subscriberPrice ? 'price.subscriberPrice' : 'price.price';
2185
+ const priceFilters = [
2186
+ ...(filters.prices.min ? [{ operator: Where.GTE, value: Math.floor(filters.prices.min) }] : []),
2187
+ ...(filters.prices.max ? [{ operator: Where.LTE, value: Math.ceil(filters.prices.max) }] : []),
2188
+ ];
2189
+ set(filterQuery, priceField, priceFilters);
2190
+ }
2191
+ if (filters.rate) {
2192
+ filterQuery.rate = { operator: Where.GTE, value: filters.rate };
2193
+ }
2194
+ if ((_f = filters.tags) === null || _f === void 0 ? void 0 : _f.length) {
2195
+ filterQuery.tagsProfile = { operator: Where.LIKE, value: filters.tags };
2196
+ }
2197
+ if ((_g = filters.customOptions) === null || _g === void 0 ? void 0 : _g.length) {
2198
+ filterQuery.filters = { operator: Where.LIKE, value: filters.customOptions };
2199
+ }
2200
+ return filterQuery;
2201
+ }
2202
+ }
2203
+ CatalogFilterHelper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogFilterHelper, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2204
+ CatalogFilterHelper.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogFilterHelper });
2205
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogFilterHelper, decorators: [{
2206
+ type: Injectable
2207
+ }] });
2208
+
2209
+ class CatalogSortHelper {
2210
+ buildSortQuery(sort) {
2211
+ if (!sort || sort === 'most-relevant')
2212
+ return {};
2213
+ switch (sort) {
2214
+ case 'best-sellers':
2215
+ return {
2216
+ shoppingCount: 'desc',
2217
+ rate: 'desc',
2218
+ stock: 'desc',
2219
+ name: 'asc',
2220
+ };
2221
+ case 'biggest-price':
2222
+ return {
2223
+ subscriberPrice: 'desc',
2224
+ rate: 'desc',
2225
+ shoppingCount: 'desc',
2226
+ };
2227
+ case 'lowest-price':
2228
+ return {
2229
+ subscriberPrice: 'asc',
2230
+ rate: 'desc',
2231
+ shoppingCount: 'desc',
2232
+ };
2233
+ case 'best-rating':
2234
+ return {
2235
+ rate: 'desc',
2236
+ shoppingCount: 'desc',
2237
+ stock: 'desc',
2238
+ name: 'asc',
2239
+ };
2240
+ case 'news':
2241
+ return { createdAt: 'desc' };
2242
+ case 'biggest-discount':
2243
+ return {
2244
+ subscriberDiscountPercentage: 'desc',
2245
+ rate: 'desc',
2246
+ shoppingCount: 'desc',
2247
+ };
2248
+ default:
2249
+ return {};
2250
+ }
2251
+ }
2252
+ }
2253
+ CatalogSortHelper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogSortHelper, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2254
+ CatalogSortHelper.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogSortHelper });
2255
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogSortHelper, decorators: [{
2256
+ type: Injectable
2257
+ }] });
2258
+
2259
+ class ProductFieldsHelper {
2260
+ getStandardFields() {
2261
+ return [
2262
+ 'id',
2263
+ 'name',
2264
+ 'slug',
2265
+ 'images',
2266
+ 'imagesCard',
2267
+ 'miniatures',
2268
+ 'price',
2269
+ 'stock',
2270
+ 'published',
2271
+ 'CEST',
2272
+ 'EAN',
2273
+ 'NCM',
2274
+ 'brand',
2275
+ 'costPrice',
2276
+ 'hasVariants',
2277
+ 'isKit',
2278
+ 'sku',
2279
+ 'rate',
2280
+ 'tagsProfile',
2281
+ 'tagsCollection',
2282
+ 'type',
2283
+ 'shoppingCount',
2284
+ 'gender',
2285
+ 'createdAt',
2286
+ 'label',
2287
+ 'outlet',
2288
+ 'group',
2289
+ 'variantSlug',
2290
+ 'filters',
2291
+ ];
2292
+ }
2293
+ }
2294
+ ProductFieldsHelper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ProductFieldsHelper, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2295
+ ProductFieldsHelper.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ProductFieldsHelper });
2296
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ProductFieldsHelper, decorators: [{
2297
+ type: Injectable
2298
+ }] });
2299
+
2300
+ class CatalogOperationsFacade {
2301
+ constructor(filterHelper, sortHelper, fieldsHelper) {
2302
+ this.filterHelper = filterHelper;
2303
+ this.sortHelper = sortHelper;
2304
+ this.fieldsHelper = fieldsHelper;
2305
+ }
2306
+ getFilterHelper() {
2307
+ return this.filterHelper;
2308
+ }
2309
+ getSortHelper() {
2310
+ return this.sortHelper;
2311
+ }
2312
+ getFieldsHelper() {
2313
+ return this.fieldsHelper;
2314
+ }
2315
+ }
2316
+ CatalogOperationsFacade.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogOperationsFacade, deps: [{ token: CatalogFilterHelper }, { token: CatalogSortHelper }, { token: ProductFieldsHelper }], target: i0.ɵɵFactoryTarget.Injectable });
2317
+ CatalogOperationsFacade.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogOperationsFacade });
2318
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogOperationsFacade, decorators: [{
2319
+ type: Injectable
2320
+ }], ctorParameters: function () { return [{ type: CatalogFilterHelper }, { type: CatalogSortHelper }, { type: ProductFieldsHelper }]; } });
2321
+
2322
+ class ProductManagementFacade {
2323
+ constructor(brandManager, productServices) {
2324
+ this.brandManager = brandManager;
2325
+ this.productServices = productServices;
2326
+ }
2327
+ getBrandManager() {
2328
+ return this.brandManager;
2329
+ }
2330
+ getProductServices() {
2331
+ return this.productServices;
2332
+ }
2333
+ }
2334
+ ProductManagementFacade.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ProductManagementFacade, deps: [{ token: BrandManagerHelper }, { token: 'ProductServicesFacade' }], target: i0.ɵɵFactoryTarget.Injectable });
2335
+ ProductManagementFacade.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ProductManagementFacade });
2336
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: ProductManagementFacade, decorators: [{
2337
+ type: Injectable
2338
+ }], ctorParameters: function () {
2339
+ return [{ type: BrandManagerHelper }, { type: undefined, decorators: [{
2340
+ type: Inject,
2341
+ args: ['ProductServicesFacade']
2342
+ }] }];
2343
+ } });
2344
+
2345
+ class CatalogHelpersService {
2346
+ constructor(catalogOperations, productManagement) {
2347
+ this.catalogOperations = catalogOperations;
2348
+ this.productManagement = productManagement;
2349
+ }
2350
+ getFilterHelper() {
2351
+ return this.catalogOperations.getFilterHelper();
2352
+ }
2353
+ getSortHelper() {
2354
+ return this.catalogOperations.getSortHelper();
2355
+ }
2356
+ getFieldsHelper() {
2357
+ return this.catalogOperations.getFieldsHelper();
2358
+ }
2359
+ getBrandManager() {
2360
+ return this.productManagement.getBrandManager();
2361
+ }
2362
+ getProductServices() {
2363
+ return this.productManagement.getProductServices();
2364
+ }
2365
+ }
2366
+ CatalogHelpersService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogHelpersService, deps: [{ token: CatalogOperationsFacade }, { token: ProductManagementFacade }], target: i0.ɵɵFactoryTarget.Injectable });
2367
+ CatalogHelpersService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogHelpersService });
2368
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogHelpersService, decorators: [{
2369
+ type: Injectable
2370
+ }], ctorParameters: function () { return [{ type: CatalogOperationsFacade }, { type: ProductManagementFacade }]; } });
2371
+
2372
+ class CatalogRepositoryService {
2373
+ constructor(productCatalog, productServices) {
2374
+ this.productCatalog = productCatalog;
2375
+ this.productServices = productServices;
2376
+ }
2377
+ getProductCatalog() {
2378
+ return this.productCatalog;
2379
+ }
2380
+ getProductServices() {
2381
+ return this.productServices;
2382
+ }
2383
+ }
2384
+ CatalogRepositoryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogRepositoryService, deps: [{ token: ProductCatalogFacade }, { token: 'ProductServicesFacade' }], target: i0.ɵɵFactoryTarget.Injectable });
2385
+ CatalogRepositoryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogRepositoryService });
2386
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogRepositoryService, decorators: [{
2387
+ type: Injectable
2388
+ }], ctorParameters: function () {
2389
+ return [{ type: ProductCatalogFacade }, { type: undefined, decorators: [{
2390
+ type: Inject,
2391
+ args: ['ProductServicesFacade']
2392
+ }] }];
2393
+ } });
2394
+
2395
+ class CatalogService {
2396
+ constructor(searchContext, helpersService, shop) {
2397
+ this.searchContext = searchContext;
2398
+ this.helpersService = helpersService;
2399
+ this.shop = shop;
2400
+ }
2401
+ fetchProducts(options, optionsCache) {
2402
+ return __awaiter(this, void 0, void 0, function* () {
2403
+ this.validateRequest(options);
2404
+ const searchParams = this.buildSearchParams(options);
2405
+ const { data, count: total, maximum, minimal, distinct, } = yield this.searchContext.executeSearch(searchParams, this.shop, optionsCache);
2406
+ yield this.helpersService.getBrandManager().setBrandsList(searchParams, distinct === null || distinct === void 0 ? void 0 : distinct.brand);
2407
+ return this.buildResponse({
2408
+ data,
2409
+ total,
2410
+ maximum,
2411
+ minimal,
2412
+ searchParams,
2413
+ options,
2414
+ });
2415
+ });
2416
+ }
2417
+ addCustomerToStockNotification(params) {
2418
+ return __awaiter(this, void 0, void 0, function* () {
2419
+ const { shop, productId, name, email } = params;
2420
+ const productServices = this.helpersService.getProductServices();
2421
+ return productServices.productStockNotificationRepository.addCustomerEmail({
2422
+ shop,
2423
+ productId,
2424
+ name,
2425
+ email,
2426
+ });
2427
+ });
2428
+ }
2429
+ validateRequest(options) {
2430
+ var _a, _b, _c;
2431
+ if (this.hasProfile(options) && ((_a = options.filters) === null || _a === void 0 ? void 0 : _a.customOptions)) {
2432
+ throw new InvalidArgumentError(`It couldn't filled customOptions when profile is given`);
2433
+ }
2434
+ if (this.hasProfile(options) && ((_b = options.filters) === null || _b === void 0 ? void 0 : _b.tags)) {
2435
+ throw new InvalidArgumentError(`It couldn't filled tags when profile is given`);
2436
+ }
2437
+ if (this.hasTerm(options) && ((_c = options.filters) === null || _c === void 0 ? void 0 : _c.customOptions)) {
2438
+ throw new InvalidArgumentError(`It couldn't filled customOptions when term is given`);
2439
+ }
2440
+ }
2441
+ buildSearchParams(options) {
2442
+ const limits = this.buildLimitQuery(options);
2443
+ return {
2444
+ category: this.hasCategory(options) ? options.category : undefined,
2445
+ profile: this.hasProfile(options) ? options.profile : undefined,
2446
+ term: this.hasTerm(options) ? options.term : undefined,
2447
+ filters: options.filters,
2448
+ mainGender: options.mainGender,
2449
+ sort: options.sort,
2450
+ limits,
2451
+ };
2452
+ }
2453
+ buildResponse(params) {
2454
+ var _a, _b, _c, _d, _e, _f, _g, _h;
2455
+ const { data, total, maximum, minimal, searchParams } = params;
2456
+ const limits = searchParams.limits;
2457
+ const indexKey = this.helpersService.getBrandManager().buildIndexBrands(searchParams);
2458
+ return {
2459
+ products: {
2460
+ data: data.map((product) => RoundProductPricesHelper.roundProductPrices(product)),
2461
+ total,
2462
+ },
2463
+ pages: Math.ceil(total / limits.limit),
2464
+ prices: {
2465
+ price: {
2466
+ min: +(((_b = (_a = minimal === null || minimal === void 0 ? void 0 : minimal.price) === null || _a === void 0 ? void 0 : _a.price) === null || _b === void 0 ? void 0 : _b.toFixed(2)) || 0),
2467
+ max: +(((_d = (_c = maximum === null || maximum === void 0 ? void 0 : maximum.price) === null || _c === void 0 ? void 0 : _c.price) === null || _d === void 0 ? void 0 : _d.toFixed(2)) || 0),
2468
+ },
2469
+ subscriberPrice: {
2470
+ min: +(((_f = (_e = minimal === null || minimal === void 0 ? void 0 : minimal.price) === null || _e === void 0 ? void 0 : _e.subscriberPrice) === null || _f === void 0 ? void 0 : _f.toFixed(2)) || 0),
2471
+ max: +(((_h = (_g = maximum === null || maximum === void 0 ? void 0 : maximum.price) === null || _g === void 0 ? void 0 : _g.subscriberPrice) === null || _h === void 0 ? void 0 : _h.toFixed(2)) || 0),
2472
+ },
2473
+ },
2474
+ brands: this.helpersService.getBrandManager().getBrandsList(indexKey),
2475
+ };
2476
+ }
2477
+ buildLimitQuery(options) {
2478
+ const limit = (options === null || options === void 0 ? void 0 : options.perPage) || 20;
2479
+ return {
2480
+ limit,
2481
+ offset: (((options === null || options === void 0 ? void 0 : options.page) || 1) - 1) * limit,
2482
+ };
2483
+ }
2484
+ hasProfile(options) {
2485
+ return 'profile' in options;
2486
+ }
2487
+ hasTerm(options) {
2488
+ return 'term' in options;
2489
+ }
2490
+ hasCategory(options) {
2491
+ return 'category' in options;
2492
+ }
2493
+ }
2494
+ CatalogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogService, deps: [{ token: CatalogSearchContext }, { token: CatalogHelpersService }, { token: DEFAULT_SHOP }], target: i0.ɵɵFactoryTarget.Injectable });
2495
+ CatalogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogService });
2496
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogService, decorators: [{
2497
+ type: Injectable
2498
+ }], ctorParameters: function () {
2499
+ return [{ type: CatalogSearchContext }, { type: CatalogHelpersService }, { type: i3.Shops, decorators: [{
2500
+ type: Inject,
2501
+ args: [DEFAULT_SHOP]
2502
+ }] }];
2503
+ } });
2504
+
2505
+ var ProductSorts;
2506
+ (function (ProductSorts) {
2507
+ ProductSorts["MOST_RELEVANT"] = "most-relevant";
2508
+ ProductSorts["BEST_SELLER"] = "best-sellers";
2509
+ ProductSorts["BIGGEST_PRICE"] = "biggest-price";
2510
+ ProductSorts["LOWEST_PRICE"] = "lowest-price";
2511
+ ProductSorts["BIGGEST_DISCOUNT"] = "biggest-discount";
2512
+ ProductSorts["BEST_RATING"] = "best-rating";
2513
+ ProductSorts["NEWS"] = "news";
2514
+ })(ProductSorts || (ProductSorts = {}));
2515
+
2516
+ class CategoryWithTree extends Category {
2517
+ }
2518
+ __decorate([
2519
+ Type(() => CategoryWithTree),
2520
+ __metadata("design:type", Array)
2521
+ ], CategoryWithTree.prototype, "children", void 0);
2522
+
2523
+ class WishlistService {
2524
+ constructor(wishlistRepository, productRepository, productCatalogRepository, logRepository, shop) {
2525
+ this.wishlistRepository = wishlistRepository;
2526
+ this.productRepository = productRepository;
2527
+ this.productCatalogRepository = productCatalogRepository;
2528
+ this.logRepository = logRepository;
2529
+ this.shop = shop;
2530
+ }
2531
+ initializeServices(catalogServiceFacade, categoryServiceFacade) {
2532
+ this.catalogService = catalogServiceFacade.getCatalogService();
2533
+ this.categoryService = categoryServiceFacade.getCategoryService();
2534
+ }
2535
+ getCatalogService() {
2536
+ return this.catalogService;
2537
+ }
2538
+ getCategoryService() {
2539
+ return this.categoryService;
2540
+ }
2541
+ create({ personId, title, description, published, userFullName, userPhoto, theme, bannerUrl, personType, personIsSubscriber, }) {
2542
+ return __awaiter(this, void 0, void 0, function* () {
2543
+ const wishlistData = this.buildWishlistData({
2544
+ title,
2545
+ description,
2546
+ published,
2547
+ userFullName,
2548
+ userPhoto,
2549
+ theme,
2550
+ bannerUrl,
2551
+ personType,
2552
+ personIsSubscriber,
2553
+ personId,
2554
+ });
2555
+ const existingWishlist = yield this.findExistingWishlistByPersonId(personId);
2556
+ yield this.createWishlistLog(WishlistLogType.CREATE, wishlistData);
2557
+ if (existingWishlist)
2558
+ return existingWishlist;
2559
+ return this.createNewWishlist(wishlistData);
2560
+ });
2561
+ }
2562
+ buildWishlistData({ title, description, published, userFullName, userPhoto, theme, bannerUrl, personType, personIsSubscriber, personId, }) {
2563
+ return {
2564
+ slug: '',
2565
+ name: title,
2566
+ description,
2567
+ metadatas: [
2568
+ {
2569
+ shop: this.shop,
2570
+ title: `${userFullName} - ${title}`,
2571
+ description: `${userFullName} - ${description}`,
2572
+ },
2573
+ ],
2574
+ shop: this.shop,
2575
+ shops: [this.shop],
2576
+ personId,
2577
+ personName: userFullName,
2578
+ personPhoto: userPhoto,
2579
+ brandCategory: false,
2580
+ published,
2581
+ theme,
2582
+ bannerUrl,
2583
+ personType: personType !== null && personType !== void 0 ? personType : PersonTypes.NONE,
2584
+ personIsSubscriber: personIsSubscriber !== null && personIsSubscriber !== void 0 ? personIsSubscriber : false,
2585
+ };
2586
+ }
2587
+ findExistingWishlistByPersonId(personId) {
2588
+ return __awaiter(this, void 0, void 0, function* () {
2589
+ const hasWishlist = yield this.wishlistRepository
2590
+ .find({
2591
+ filters: {
2592
+ personId,
2593
+ },
2594
+ options: {
2595
+ enableCount: false,
2596
+ },
2597
+ orderBy: {
2598
+ id: 'asc',
2599
+ },
2600
+ })
2601
+ .then((res) => res.data);
2602
+ return hasWishlist.length ? hasWishlist.at(0) : null;
2603
+ });
2604
+ }
2605
+ createNewWishlist(data) {
2606
+ return __awaiter(this, void 0, void 0, function* () {
2607
+ const newWishlist = yield this.wishlistRepository.create(data);
2608
+ yield this.wishlistRepository.update({ id: newWishlist.id, slug: newWishlist.id });
2609
+ return Wishlist.toInstance(Object.assign(Object.assign({}, newWishlist.toPlain()), { slug: newWishlist.id }));
2610
+ });
2611
+ }
2612
+ update({ id, title, description, published, userFullName, userPhoto, theme, bannerUrl, personType, personIsSubscriber, }) {
2613
+ return __awaiter(this, void 0, void 0, function* () {
2614
+ const data = {
2615
+ id,
2616
+ name: title,
2617
+ description,
2618
+ published,
2619
+ metadatas: [
2620
+ {
2621
+ shop: this.shop,
2622
+ title: `${userFullName} - ${title}`,
2623
+ description: `${userFullName} - ${description}`,
2624
+ },
2625
+ ],
2626
+ personName: userFullName,
2627
+ personPhoto: userPhoto,
2628
+ theme,
2629
+ bannerUrl,
2630
+ personType: personType !== null && personType !== void 0 ? personType : PersonTypes.NONE,
2631
+ personIsSubscriber: personIsSubscriber !== null && personIsSubscriber !== void 0 ? personIsSubscriber : false,
2632
+ };
2633
+ yield this.createWishlistLog(WishlistLogType.UPDATE, data);
2634
+ return this.wishlistRepository.update(data);
2635
+ });
2636
+ }
2637
+ delete(wishlistId) {
2638
+ return __awaiter(this, void 0, void 0, function* () {
2639
+ const wishlist = yield this.findById(wishlistId);
2640
+ yield this.createWishlistLog(WishlistLogType.DELETE, wishlist);
2641
+ return this.wishlistRepository.delete({ id: wishlistId });
2642
+ });
2643
+ }
2644
+ getWishlistBySlug(slug) {
2645
+ const [id] = slug.split('-');
2646
+ if (+id)
2647
+ return this.wishlistRepository.get({ id });
2648
+ return this.wishlistRepository.getWishlistBySlug(slug);
2649
+ }
2650
+ getWishlistsByPerson(personId) {
2651
+ return this.wishlistRepository.getWishlistByPerson(personId);
2652
+ }
2653
+ addProduct(wishlistId, productId) {
2654
+ return __awaiter(this, void 0, void 0, function* () {
2655
+ const wishlist = yield this.wishlistRepository.get({ id: wishlistId });
2656
+ const hasProduct = wishlist.products.some((p) => p == productId);
2657
+ const wishlistData = yield this.findById(wishlistId);
2658
+ const productData = yield this.findProductById(productId);
2659
+ yield this.createWishlistLog(WishlistLogType.ADD_PRODUCT, wishlistData, productData);
2660
+ if (!hasProduct) {
2661
+ wishlist.products = [...wishlist.products, productId];
2662
+ yield this.wishlistRepository.addProduct(wishlistId, productId);
2663
+ }
2664
+ return wishlist;
2665
+ });
2666
+ }
2667
+ removeProduct(wishlistId, productId) {
2668
+ return __awaiter(this, void 0, void 0, function* () {
2669
+ const wishlist = yield this.wishlistRepository.get({ id: wishlistId });
2670
+ const productIndex = wishlist.products.findIndex((p) => p == productId);
2671
+ if (productIndex != -1) {
2672
+ wishlist.products.splice(productIndex, 1);
2673
+ const wishlistData = yield this.findById(wishlistId);
2674
+ const productData = yield this.findProductById(productId);
2675
+ yield this.createWishlistLog(WishlistLogType.REMOVE_PRODUCT, wishlistData, productData);
2676
+ yield this.wishlistRepository.removeProduct(wishlistId, productId);
2677
+ }
2678
+ return wishlist;
2679
+ });
2680
+ }
2681
+ findById(id) {
2682
+ return __awaiter(this, void 0, void 0, function* () {
2683
+ return this.wishlistRepository
2684
+ .find({
2685
+ fields: ['id', 'name', 'description', 'personId', 'personIsSubscriber', 'personType', 'personName'],
2686
+ filters: {
2687
+ id,
2688
+ },
2689
+ })
2690
+ .then((res) => res.data.at(0));
2691
+ });
2692
+ }
2693
+ findProductById(id) {
2694
+ return __awaiter(this, void 0, void 0, function* () {
2695
+ return this.productCatalogRepository
2696
+ .find({
2697
+ fields: ['id', 'sku', 'EAN', 'name', 'brand'],
2698
+ filters: {
2699
+ id,
2700
+ },
2701
+ })
2702
+ .then((res) => res.data.at(0));
2703
+ });
2704
+ }
2705
+ createWishlistLog(type, wishlist, product) {
2706
+ return __awaiter(this, void 0, void 0, function* () {
2707
+ switch (type) {
2708
+ case WishlistLogType.CREATE:
2709
+ case WishlistLogType.UPDATE:
2710
+ case WishlistLogType.DELETE:
2711
+ yield this.createWishlistOperationLog(type, wishlist);
2712
+ break;
2713
+ case WishlistLogType.ADD_PRODUCT:
2714
+ case WishlistLogType.REMOVE_PRODUCT:
2715
+ yield this.createWishlistProductLog(type, wishlist, product);
2716
+ break;
2717
+ default:
2718
+ break;
2719
+ }
2720
+ });
2721
+ }
2722
+ createWishlistOperationLog(type, wishlist) {
2723
+ return __awaiter(this, void 0, void 0, function* () {
2724
+ const operation = this.getOperationTypeFromWishlistLogType(type);
2725
+ yield this.logRepository.create({
2726
+ collection: 'wishlist',
2727
+ date: new Date(),
2728
+ operation,
2729
+ documentId: wishlist.id,
2730
+ document: this.buildWishlistLogDocument(wishlist, type),
2731
+ });
2732
+ });
2733
+ }
2734
+ createWishlistProductLog(type, wishlist, product) {
2735
+ return __awaiter(this, void 0, void 0, function* () {
2736
+ yield this.logRepository.create({
2737
+ collection: 'wishlist',
2738
+ date: new Date(),
2739
+ operation: 'UPDATE',
2740
+ documentId: wishlist.id,
2741
+ document: Object.assign(Object.assign({}, this.buildWishlistLogDocument(wishlist, type)), this.buildProductLogData(product)),
2742
+ });
2743
+ });
2744
+ }
2745
+ getOperationTypeFromWishlistLogType(type) {
2746
+ if (type === WishlistLogType.CREATE)
2747
+ return 'CREATE';
2748
+ if (type === WishlistLogType.UPDATE)
2749
+ return 'UPDATE';
2750
+ return 'DELETE';
2751
+ }
2752
+ buildWishlistLogDocument(wishlist, type) {
2753
+ return {
2754
+ id: wishlist.id,
2755
+ shop: this.shop,
2756
+ name: wishlist.name,
2757
+ description: wishlist.description,
2758
+ published: wishlist.published,
2759
+ type: type,
2760
+ personType: wishlist.personType,
2761
+ personId: wishlist.personId,
2762
+ personName: wishlist.personName,
2763
+ personIsSubscriber: wishlist.personIsSubscriber,
2764
+ };
2765
+ }
2766
+ buildProductLogData(product) {
2767
+ return {
2768
+ productId: product.id,
2769
+ productEAN: product.EAN,
2770
+ productSKU: product.sku,
2771
+ productName: product.name,
2772
+ productBrand: product.brand,
2773
+ };
2774
+ }
2775
+ }
2776
+ WishlistService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: WishlistService, deps: [{ token: 'WishlistRepository' }, { token: 'ProductRepository' }, { token: 'ProductCatalogRepository' }, { token: 'LogRepository' }, { token: DEFAULT_SHOP }], target: i0.ɵɵFactoryTarget.Injectable });
2777
+ WishlistService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: WishlistService });
2778
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: WishlistService, decorators: [{
2779
+ type: Injectable
2780
+ }], ctorParameters: function () {
2781
+ return [{ type: undefined, decorators: [{
2782
+ type: Inject,
2783
+ args: ['WishlistRepository']
2784
+ }] }, { type: undefined, decorators: [{
2785
+ type: Inject,
2786
+ args: ['ProductRepository']
2787
+ }] }, { type: undefined, decorators: [{
2788
+ type: Inject,
2789
+ args: ['ProductCatalogRepository']
2790
+ }] }, { type: undefined, decorators: [{
2791
+ type: Inject,
2792
+ args: ['LogRepository']
2793
+ }] }, { type: i3.Shops, decorators: [{
2794
+ type: Inject,
2795
+ args: [DEFAULT_SHOP]
2796
+ }] }];
2797
+ } });
2798
+
2799
+ class UtilHelper {
2800
+ static createSlug(name) {
2801
+ return name
2802
+ .toLowerCase()
2803
+ .replace(/\s+/g, '-')
2804
+ .replace(/[ãàáäâ]/g, 'a')
2805
+ .replace(/[ẽèéëê]/g, 'e')
2806
+ .replace(/[ìíïî]/g, 'i')
2807
+ .replace(/[õòóöô]/g, 'o')
2808
+ .replace(/[ùúüû]/g, 'u')
2809
+ .replace(/[ñ]/g, 'n')
2810
+ .replace(/[ç]/g, 'c')
2811
+ .replace(/[&]/g, 'and')
2812
+ .replace(/[^\w-]+/g, '')
2813
+ .replace(/--+/g, '-');
2814
+ }
2815
+ }
2816
+
2817
+ class HomeShopRepositoriesFacade {
2818
+ constructor(categoryRepository, homeRepository, productRepository) {
2819
+ this.categoryRepository = categoryRepository;
2820
+ this.homeRepository = homeRepository;
2821
+ this.productRepository = productRepository;
2822
+ }
2823
+ }
2824
+ HomeShopRepositoriesFacade.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: HomeShopRepositoriesFacade, deps: [{ token: 'CategoryRepository' }, { token: 'HomeRepository' }, { token: 'ProductRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
2825
+ HomeShopRepositoriesFacade.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: HomeShopRepositoriesFacade });
2826
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: HomeShopRepositoriesFacade, decorators: [{
2827
+ type: Injectable
2828
+ }], ctorParameters: function () {
2829
+ return [{ type: undefined, decorators: [{
2830
+ type: Inject,
2831
+ args: ['CategoryRepository']
2832
+ }] }, { type: undefined, decorators: [{
2833
+ type: Inject,
2834
+ args: ['HomeRepository']
2835
+ }] }, { type: undefined, decorators: [{
2836
+ type: Inject,
2837
+ args: ['ProductRepository']
2838
+ }] }];
2839
+ } });
2840
+
2841
+ class HomeShopService {
2842
+ get homeId() {
2843
+ if (this.configurationFacade.defaultShop === Shops.GLAMSHOP)
2844
+ return 'glamshop';
2845
+ if (this.configurationFacade.defaultShop === Shops.MENSMARKET)
2846
+ return 'mens_market';
2847
+ return null;
2848
+ }
2849
+ constructor(repositoriesFacade, configurationFacade) {
2850
+ this.repositoriesFacade = repositoriesFacade;
2851
+ this.configurationFacade = configurationFacade;
2852
+ this.buildCategoryGroupWithRequiredData = (group) => {
2853
+ var _a, _b;
2854
+ return ({
2855
+ category: Category.toInstance(pick(((_a = group === null || group === void 0 ? void 0 : group.category) === null || _a === void 0 ? void 0 : _a.toPlain()) || {}, ['id', 'name', 'slug', 'conditions'])),
2856
+ products: ((_b = group === null || group === void 0 ? void 0 : group.products) === null || _b === void 0 ? void 0 : _b.map((product) => Product.toInstance(pick((product === null || product === void 0 ? void 0 : product.toPlain()) || {}, [
2857
+ 'id',
2858
+ 'price',
2859
+ 'reviews',
2860
+ 'hasVariants',
2861
+ 'slug',
2862
+ 'sku',
2863
+ 'stock',
2864
+ 'costPrice',
2865
+ 'images',
2866
+ 'miniatures',
2867
+ 'name',
2868
+ 'weight',
2869
+ 'rate',
2870
+ 'type',
2871
+ 'brand',
2872
+ ])))) || [],
2873
+ });
2874
+ };
2875
+ }
2876
+ getHomeData() {
2877
+ return this.getHomeConfiguration().pipe(map((home) => { var _a; return (((_a = home === null || home === void 0 ? void 0 : home.data) === null || _a === void 0 ? void 0 : _a.expiresAt) > new Date() ? home : null); }), concatMap((home) => home
2878
+ ? of(home)
2879
+ : forkJoin([
2880
+ this.getDiscoverProducts(this.gender),
2881
+ this.getFeaturedProducts(this.gender),
2882
+ this.getVerticalProducts(this.gender),
2883
+ ]).pipe(map(([discoverProducts, featuredProducts, verticalProducts]) => ({
2884
+ discoverProducts,
2885
+ featuredProducts,
2886
+ verticalProducts,
2887
+ })), concatMap((data) => this.saveHomeData(data)))));
2888
+ }
2889
+ getBanners(type) {
2890
+ return this.getHomeConfiguration().pipe(map((home) => {
2891
+ if (type === 'brand')
2892
+ return home.brandsCarousel;
2893
+ if (type === 'buyToWin')
2894
+ return [home.buyToWinBanner];
2895
+ if (type === 'block')
2896
+ return home.blockBanners;
2897
+ if (type === 'blog')
2898
+ return [home.blogBanner];
2899
+ return [];
2900
+ }));
2901
+ }
2902
+ getMinValueForFreeShipping() {
2903
+ return this.getHomeConfiguration().pipe(map((home) => home.minValueForFreeShipping));
2904
+ }
2905
+ /**
2906
+ * Retorna os thresholds de frete grátis estruturados configurados no documento
2907
+ * Home (`shippingThresholds`). Quando o documento ainda não possui essa
2908
+ * estrutura, retorna um default conservador equivalente à regra legada
2909
+ * (edition: 50, avulsoSp: 99, avulsoOutro: null) para que consumidores não
2910
+ * quebrem durante a migração.
2911
+ */
2912
+ getShippingThresholds() {
2913
+ const conservativeDefault = { edition: 50, avulsoSp: 99, avulsoOutro: null };
2914
+ return this.getHomeConfiguration().pipe(map((home) => { var _a; return (_a = home.shippingThresholds) !== null && _a !== void 0 ? _a : conservativeDefault; }));
2915
+ }
2916
+ getDiscoverProducts(_gender) {
2917
+ return this.getHomeConfiguration().pipe(concatMap((home) => from(this.repositoriesFacade.categoryRepository.getCategoriesForHome({
2918
+ categoryIds: home.discoverCategories,
2919
+ shop: this.configurationFacade.defaultShop,
2920
+ })).pipe(map((groups) => groups.map(this.buildCategoryGroupWithRequiredData)))));
2921
+ }
2922
+ getFeaturedProducts(_gender) {
2923
+ return this.getHomeConfiguration().pipe(concatMap((home) => from(this.repositoriesFacade.categoryRepository.getCategoriesForHome({
2924
+ categoryIds: home.featuredCategories,
2925
+ shop: this.configurationFacade.defaultShop,
2926
+ })).pipe(map((groups) => groups.map(this.buildCategoryGroupWithRequiredData)))));
2927
+ }
2928
+ getVerticalProducts(gender) {
2929
+ return this.getHomeConfiguration().pipe(concatMap((home) => forkJoin(home.verticalCarousels.filter(Boolean).map((id) => from(this.repositoriesFacade.categoryRepository.get({ id })).pipe(concatMap((category) => from(this.repositoriesFacade.productRepository.find({
2930
+ filters: Object.assign({ categories: { operator: Where.IN, value: [category.id] } }, (gender ? { tags: { operator: Where.IN, value: [gender] } } : {})),
2931
+ limits: { limit: 12 },
2932
+ })).pipe(map((products) => ({ category, products })))), map(({ category, products }) => ({ category, products: products.data })), map(this.buildCategoryGroupWithRequiredData))))));
2933
+ }
2934
+ getHomeConfiguration() {
2935
+ return of(this.homeConfiguration).pipe(concatMap((home) => home
2936
+ ? of(home)
2937
+ : !this.homeId
2938
+ ? throwError(() => new RequiredArgumentError(['homeId']))
2939
+ : from(this.repositoriesFacade.homeRepository.get({ id: this.homeId })).pipe(tap((homeLoaded) => (this.homeConfiguration = homeLoaded)))));
2940
+ }
2941
+ saveHomeData(homeData) {
2942
+ const data = {
2943
+ createdAt: new Date(),
2944
+ expiresAt: add(new Date(), { hours: 1 }),
2945
+ data: homeData,
2946
+ };
2947
+ return from(this.repositoriesFacade.homeRepository.update({
2948
+ id: this.homeId,
2949
+ data,
2950
+ })).pipe(tap(() => (this.homeConfiguration.data = data)), map(() => this.homeConfiguration));
2951
+ }
2952
+ get gender() {
2953
+ return this.homeId === 'mens_market' ? 'masculino' : undefined;
2954
+ }
2955
+ }
2956
+ HomeShopService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: HomeShopService, deps: [{ token: HomeShopRepositoriesFacade }, { token: ConfigurationFacade }], target: i0.ɵɵFactoryTarget.Injectable });
2957
+ HomeShopService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: HomeShopService });
2958
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: HomeShopService, decorators: [{
2959
+ type: Injectable
2960
+ }], ctorParameters: function () { return [{ type: HomeShopRepositoriesFacade }, { type: ConfigurationFacade }]; } });
2961
+
2962
+ class OrderProductReviewService {
2963
+ constructor(orderRepository, productReviewRepository, variantRepository, defaultShop) {
2964
+ this.orderRepository = orderRepository;
2965
+ this.productReviewRepository = productReviewRepository;
2966
+ this.variantRepository = variantRepository;
2967
+ this.defaultShop = defaultShop;
2968
+ }
2969
+ getPendingReviewsByEmail(email) {
2970
+ return __awaiter(this, void 0, void 0, function* () {
2971
+ const products = [];
2972
+ const orders = yield this.getOrdersByEmail(email);
2973
+ if (orders.length) {
2974
+ for (const order of orders) {
2975
+ const lineItems = order.lineItems.filter((item) => !item.isGift);
2976
+ for (const item of lineItems) {
2977
+ const productReview = yield this.getProductReview(order, item);
2978
+ if ((productReview === null || productReview === void 0 ? void 0 : productReview.status) != null)
2979
+ continue;
2980
+ products.push(this.buildProductReview(order, item, productReview));
2981
+ }
2982
+ }
2983
+ }
2984
+ return products;
2985
+ });
2986
+ }
2987
+ getOrdersByEmail(email) {
2988
+ return __awaiter(this, void 0, void 0, function* () {
2989
+ const { data: orders } = yield this.orderRepository.find({
2990
+ filters: {
2991
+ user: {
2992
+ email: email,
2993
+ },
2994
+ shop: this.defaultShop,
2995
+ status: OrderStatus.ENTREGUE,
2996
+ createdAt: {
2997
+ operator: Where.GTE,
2998
+ value: new Date(2024, 0, 0, 0, 0, 0).getTime(),
2999
+ },
3000
+ },
3001
+ orderBy: {
3002
+ createdAt: 'desc',
3003
+ },
3004
+ });
3005
+ return orders;
3006
+ });
3007
+ }
3008
+ getProductReview(order, item) {
3009
+ return __awaiter(this, void 0, void 0, function* () {
3010
+ const products = [item.id];
3011
+ const isVariant = yield this.variantRepository
3012
+ .find({
3013
+ filters: {
3014
+ id: item.id,
3015
+ },
3016
+ })
3017
+ .then((res) => res.data.at(0));
3018
+ if (isVariant)
3019
+ products.push(isVariant.productId);
3020
+ const productReview = yield this.productReviewRepository
3021
+ .find({
3022
+ filters: {
3023
+ orderId: { operator: Where.IN, value: [order.id, order.orderNumber].filter(Boolean) },
3024
+ productId: { operator: Where.IN, value: products },
3025
+ },
3026
+ })
3027
+ .then((res) => res.data.at(0));
3028
+ return productReview;
3029
+ });
3030
+ }
3031
+ buildProductReview(order, item, review) {
3032
+ return {
3033
+ id: item.id,
3034
+ orderId: order.id,
3035
+ orderNumber: order.orderNumber,
3036
+ isEdition: false,
3037
+ name: item.name,
3038
+ image: item.image,
3039
+ deliveryDate: order.deliveredAt || null,
3040
+ evaluationInAnalysis: review ? true : false,
3041
+ rating: review ? review.rate : null,
3042
+ shopProductSlug: item.slug,
3043
+ };
3044
+ }
3045
+ createReview(review) {
3046
+ return __awaiter(this, void 0, void 0, function* () {
3047
+ return this.productReviewRepository.create(ProductReview.toInstance({
3048
+ productId: review.productId.toString(),
3049
+ shop: review.shop,
3050
+ rate: review.rate,
3051
+ author: review.author,
3052
+ email: review.email,
3053
+ location: review.location,
3054
+ review: review.comment,
3055
+ title: review.title,
3056
+ personId: review.personId,
3057
+ points: review.points,
3058
+ orderId: review.orderId,
3059
+ }));
3060
+ });
3061
+ }
3062
+ verifyReviewProductAndOrder(orderId, productId) {
3063
+ return __awaiter(this, void 0, void 0, function* () {
3064
+ return this.productReviewRepository
3065
+ .find({
3066
+ filters: {
3067
+ orderId: { operator: Where.IN, value: orderId },
3068
+ productId: productId,
3069
+ },
3070
+ })
3071
+ .then((res) => res.data);
3072
+ });
3073
+ }
3074
+ }
3075
+ OrderProductReviewService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderProductReviewService, deps: [{ token: 'OrderRepository' }, { token: 'ProductReviewRepository' }, { token: 'VariantRepository' }, { token: DEFAULT_SHOP }], target: i0.ɵɵFactoryTarget.Injectable });
3076
+ OrderProductReviewService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderProductReviewService });
3077
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderProductReviewService, decorators: [{
3078
+ type: Injectable
3079
+ }], ctorParameters: function () {
3080
+ return [{ type: i3.OrderFirestoreRepository, decorators: [{
3081
+ type: Inject,
3082
+ args: ['OrderRepository']
3083
+ }] }, { type: undefined, decorators: [{
3084
+ type: Inject,
3085
+ args: ['ProductReviewRepository']
3086
+ }] }, { type: undefined, decorators: [{
3087
+ type: Inject,
3088
+ args: ['VariantRepository']
3089
+ }] }, { type: i3.Shops, decorators: [{
3090
+ type: Inject,
3091
+ args: [DEFAULT_SHOP]
3092
+ }] }];
3093
+ } });
3094
+
3095
+ class OrderRecurrenceService {
3096
+ constructor(shoppingRecurrenceRepository, defaultShop, dependenciesFacade, configurationFacade) {
3097
+ this.shoppingRecurrenceRepository = shoppingRecurrenceRepository;
3098
+ this.defaultShop = defaultShop;
3099
+ this.dependenciesFacade = dependenciesFacade;
3100
+ this.configurationFacade = configurationFacade;
3101
+ this.checkoutUrl = null;
3102
+ this.checkoutUrl = this.configurationFacade.getCheckoutUrl();
3103
+ }
3104
+ getRecurrenceOrder(recurrenceId) {
3105
+ return from(this.shoppingRecurrenceRepository.get({ id: recurrenceId }));
3106
+ }
3107
+ createRecurrenceOrder(recurrencePayload) {
3108
+ return this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/createShoppingRecurrence`, {
3109
+ data: recurrencePayload,
3110
+ });
3111
+ }
3112
+ updatePaymentMethod(data) {
3113
+ return this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/updateShoppingRecurrencePaymentMethod`, {
3114
+ data,
3115
+ });
3116
+ }
3117
+ getRecurrenceAvailableShipping(data) {
3118
+ return this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/getShoppingRecurrenceAvailableShipping`, {
3119
+ data,
3120
+ });
3121
+ }
3122
+ updateShippingAddress(data) {
3123
+ return this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/updateShoppingRecurrenceShippingAddress`, {
3124
+ data,
3125
+ });
3126
+ }
3127
+ cancelRecurrenceOrder(data) {
3128
+ return this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/cancelShoppingRecurrence`, {
3129
+ data,
3130
+ });
3131
+ }
3132
+ enableOrDisableRecurrenceOrder(recurrenceId, active) {
3133
+ const payload = { recurrenceId, active };
3134
+ return this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/enableOrDisableShoppingRecurrence`, payload);
3135
+ }
3136
+ skipRecurrenceOrder(recurrenceEditionId) {
3137
+ const payload = { recurrenceEditionId };
3138
+ return this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/skipShoppingRecurrenceEdition`, payload);
3139
+ }
3140
+ updateFrequency(recurrenceId, frequency) {
3141
+ const payload = { recurrenceId, frequency };
3142
+ return this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/updateShoppingRecurrenceFrequency`, payload);
3143
+ }
3144
+ updateLineItems(recurrenceId, lineItems) {
3145
+ const payload = { recurrenceId, lineItems };
3146
+ return this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/updateShoppingRecurrenceLineItems`, payload);
3147
+ }
3148
+ }
3149
+ OrderRecurrenceService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderRecurrenceService, deps: [{ token: 'ShoppingRecurrenceRepository' }, { token: DEFAULT_SHOP }, { token: CheckoutDependenciesFacade }, { token: ConfigurationFacade }], target: i0.ɵɵFactoryTarget.Injectable });
3150
+ OrderRecurrenceService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderRecurrenceService });
3151
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderRecurrenceService, decorators: [{
3152
+ type: Injectable
3153
+ }], ctorParameters: function () {
3154
+ return [{ type: i3.ShoppingRecurrenceFirestoreRepository, decorators: [{
3155
+ type: Inject,
3156
+ args: ['ShoppingRecurrenceRepository']
3157
+ }] }, { type: i3.Shops, decorators: [{
3158
+ type: Inject,
3159
+ args: [DEFAULT_SHOP]
3160
+ }] }, { type: CheckoutDependenciesFacade }, { type: ConfigurationFacade }];
3161
+ } });
3162
+
3163
+ class OrderService {
3164
+ constructor(angularFirestore, orderRepository) {
3165
+ this.angularFirestore = angularFirestore;
3166
+ this.orderRepository = orderRepository;
3167
+ this.orderSubject = new Subject();
3168
+ }
3169
+ getOrder(id) {
3170
+ docSnapshots(doc(this.angularFirestore, `${this.orderRepository.collectionName}/${id}`))
3171
+ .pipe(map((doc) => Order.toInstance(doc.data())))
3172
+ .subscribe((doc) => this.orderSubject.next(doc));
3173
+ return this.orderSubject;
3174
+ }
3175
+ }
3176
+ OrderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService, deps: [{ token: i1$1.Firestore }, { token: 'OrderRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
3177
+ OrderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService });
3178
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderService, decorators: [{
3179
+ type: Injectable
3180
+ }], ctorParameters: function () {
3181
+ return [{ type: i1$1.Firestore }, { type: i3.OrderFirestoreRepository, decorators: [{
3182
+ type: Inject,
3183
+ args: ['OrderRepository']
3184
+ }] }];
3185
+ } });
3186
+
3187
+ class CouponRepositoriesFacade {
3188
+ constructor(couponRepository, orderRepository, categoryRepository) {
3189
+ this.couponRepository = couponRepository;
3190
+ this.orderRepository = orderRepository;
3191
+ this.categoryRepository = categoryRepository;
3192
+ }
3193
+ }
3194
+ CouponRepositoriesFacade.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CouponRepositoriesFacade, deps: [{ token: 'CouponRepository' }, { token: 'OrderRepository' }, { token: 'CategoryRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
3195
+ CouponRepositoriesFacade.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CouponRepositoriesFacade });
3196
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CouponRepositoriesFacade, decorators: [{
3197
+ type: Injectable
3198
+ }], ctorParameters: function () {
3199
+ return [{ type: undefined, decorators: [{
3200
+ type: Inject,
3201
+ args: ['CouponRepository']
3202
+ }] }, { type: undefined, decorators: [{
3203
+ type: Inject,
3204
+ args: ['OrderRepository']
3205
+ }] }, { type: undefined, decorators: [{
3206
+ type: Inject,
3207
+ args: ['CategoryRepository']
3208
+ }] }];
3209
+ } });
3210
+
3211
+ class AngularConnectModule {
3212
+ static initializeApp(defaultShop, options, nameOrConfig) {
3213
+ return {
3214
+ ngModule: AngularConnectModule,
3215
+ providers: [
3216
+ ...this.buildCoreProviders(nameOrConfig, options),
3217
+ ...this.buildConditionalProviders(defaultShop, options),
3218
+ ],
3219
+ };
3220
+ }
3221
+ static buildCoreProviders(nameOrConfig, options) {
3222
+ return [
3223
+ { provide: FIREBASE_APP_NAME, useValue: nameOrConfig },
3224
+ { provide: APP_CHECK_PROVIDER, useValue: options.appCheckProvider },
3225
+ {
3226
+ provide: CATEGORY_STRUCTURE,
3227
+ useClass: this.selectCategoryStructureAdapter(options.oldCategoryStructure),
3228
+ },
3229
+ { provide: PERSISTENCE_PROVIDER, useClass: (options === null || options === void 0 ? void 0 : options.persistenceProvider) || CookieDataPersistence },
3230
+ ];
3231
+ }
3232
+ static buildConditionalProviders(defaultShop, options) {
3233
+ return [
3234
+ ...this.createProviderIfExists(DEFAULT_SHOP, defaultShop),
3235
+ ...this.createProviderIfExists(FIREBASE_OPTIONS, options.firebase),
3236
+ ...this.createProviderIfExists(ES_CONFIG, options.elasticSearch),
3237
+ ...this.createProviderIfExists(VERTEX_CONFIG, options.vertexConfig),
3238
+ ...this.createProviderIfExists(HASURA_OPTIONS, options.hasura),
3239
+ ...this.createProviderIfExists(BACKEND_URL, options.backendUrl),
3240
+ ...this.createProviderIfExists(STORAGE_BASE_URL, options.storageBaseUrl),
3241
+ ];
3242
+ }
3243
+ static selectCategoryStructureAdapter(oldCategoryStructure) {
3244
+ return isNil(oldCategoryStructure) || oldCategoryStructure
3245
+ ? OldCategoryStructureAdapter
3246
+ : NewCategoryStructureAdapter;
3247
+ }
3248
+ static createProviderIfExists(token, value) {
3249
+ return isNil(value) ? [] : [{ provide: token, useValue: value }];
3250
+ }
3251
+ }
3252
+ AngularConnectModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularConnectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3253
+ AngularConnectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0", ngImport: i0, type: AngularConnectModule, imports: [i1$3.FirebaseAppModule, i2.AppCheckModule, i3$1.StorageModule, AngularElasticSeachModule,
3254
+ AngularVertexSeachModule,
3255
+ AngularFirebaseAuthModule,
3256
+ AngularFirestoreModule,
3257
+ AngularHasuraGraphQLModule] });
3258
+ AngularConnectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularConnectModule, providers: [
3259
+ AuthService,
3260
+ CartService,
3261
+ CatalogService,
3262
+ CategoryService,
3263
+ CheckoutService,
3264
+ HomeShopService,
3265
+ OrderService,
3266
+ WishlistService,
3267
+ ConfigurationFacade,
3268
+ CartServicesFacade,
3269
+ CheckoutRepositoriesFacade,
3270
+ CheckoutDependenciesFacade,
3271
+ CategoryRepositoryFacade,
3272
+ ProductCatalogFacade,
3273
+ CatalogServiceFacade,
3274
+ CategoryServiceFacade,
3275
+ CatalogStrategiesFacade,
3276
+ CatalogOperationsFacade,
3277
+ ProductManagementFacade,
3278
+ {
3279
+ provide: 'ProductServicesFacade',
3280
+ useFactory: (productStockNotificationRepository, categoryRepository, productSearch) => ({
3281
+ productStockNotificationRepository,
3282
+ categoryRepository,
3283
+ productSearch,
3284
+ }),
3285
+ deps: ['ProductStockNotificationRepository', 'CategoryRepository', 'ProductSearch'],
3286
+ },
3287
+ CatalogFilterHelper,
3288
+ CatalogSortHelper,
3289
+ ProductFieldsHelper,
3290
+ BrandManagerHelper,
3291
+ CatalogRepositoryService,
3292
+ CatalogHelpersService,
3293
+ CategorySearchStrategy,
3294
+ TermSearchStrategy,
3295
+ ProfileSearchStrategy,
3296
+ {
3297
+ provide: CatalogSearchContext,
3298
+ useFactory: (categoryStrategy, termStrategy, profileStrategy) => {
3299
+ return new CatalogSearchContext(categoryStrategy, termStrategy, profileStrategy);
3300
+ },
3301
+ deps: [CategorySearchStrategy, TermSearchStrategy, ProfileSearchStrategy],
3302
+ },
3303
+ {
3304
+ provide: UpdateUserImage,
3305
+ useFactory: (userRepository, fileUploader) => {
3306
+ return new UpdateUserImage(userRepository, fileUploader);
3307
+ },
3308
+ deps: ['UserRepository', 'FileUploaderService'],
3309
+ },
3310
+ {
3311
+ provide: 'FileUploaderService',
3312
+ useFactory: (storage, baseUrl) => {
3313
+ return new FirebaseFileUploaderService(storage, baseUrl);
3314
+ },
3315
+ deps: [Storage, STORAGE_BASE_URL],
3316
+ },
3317
+ {
3318
+ provide: 'ProductSearch',
3319
+ useExisting: ProductsVertexSearch,
3320
+ },
3321
+ CouponRepositoriesFacade,
3322
+ HomeShopRepositoriesFacade,
3323
+ OrderProductReviewService,
3324
+ OrderRecurrenceService,
3325
+ ], imports: [provideFirebaseApp((injector) => {
3326
+ const appName = injector.get(FIREBASE_APP_NAME);
3327
+ try {
3328
+ const app = appName ? getApp(appName) : getApp();
3329
+ return app;
3330
+ }
3331
+ catch (error) {
3332
+ console.warn('Firebase app not found, initializing new app');
3333
+ if (error instanceof Error)
3334
+ console.error(error.message);
3335
+ return initializeApp(injector.get(FIREBASE_OPTIONS), appName);
3336
+ }
3337
+ }),
3338
+ provideAppCheck((injector) => {
3339
+ const app = injector.get(FirebaseApp);
3340
+ try {
3341
+ const provider = injector.get(APP_CHECK_PROVIDER);
3342
+ if (provider)
3343
+ return initializeAppCheck(app, {
3344
+ provider,
3345
+ isTokenAutoRefreshEnabled: true,
3346
+ });
3347
+ }
3348
+ catch (error) {
3349
+ if (error instanceof Error)
3350
+ console.error(error.message);
3351
+ return;
3352
+ }
3353
+ }),
3354
+ provideStorage((injector) => getStorage(injector.get(FirebaseApp))),
3355
+ AngularElasticSeachModule,
3356
+ AngularVertexSeachModule,
3357
+ AngularFirebaseAuthModule,
3358
+ AngularFirestoreModule,
3359
+ AngularHasuraGraphQLModule] });
3360
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: AngularConnectModule, decorators: [{
3361
+ type: NgModule,
3362
+ args: [{
3363
+ imports: [
3364
+ provideFirebaseApp((injector) => {
3365
+ const appName = injector.get(FIREBASE_APP_NAME);
3366
+ try {
3367
+ const app = appName ? getApp(appName) : getApp();
3368
+ return app;
3369
+ }
3370
+ catch (error) {
3371
+ console.warn('Firebase app not found, initializing new app');
3372
+ if (error instanceof Error)
3373
+ console.error(error.message);
3374
+ return initializeApp(injector.get(FIREBASE_OPTIONS), appName);
3375
+ }
3376
+ }),
3377
+ provideAppCheck((injector) => {
3378
+ const app = injector.get(FirebaseApp);
3379
+ try {
3380
+ const provider = injector.get(APP_CHECK_PROVIDER);
3381
+ if (provider)
3382
+ return initializeAppCheck(app, {
3383
+ provider,
3384
+ isTokenAutoRefreshEnabled: true,
3385
+ });
3386
+ }
3387
+ catch (error) {
3388
+ if (error instanceof Error)
3389
+ console.error(error.message);
3390
+ return;
3391
+ }
3392
+ }),
3393
+ provideStorage((injector) => getStorage(injector.get(FirebaseApp))),
3394
+ AngularElasticSeachModule,
3395
+ AngularVertexSeachModule,
3396
+ AngularFirebaseAuthModule,
3397
+ AngularFirestoreModule,
3398
+ AngularHasuraGraphQLModule,
3399
+ ],
3400
+ providers: [
3401
+ AuthService,
3402
+ CartService,
3403
+ CatalogService,
3404
+ CategoryService,
3405
+ CheckoutService,
3406
+ HomeShopService,
3407
+ OrderService,
3408
+ WishlistService,
3409
+ ConfigurationFacade,
3410
+ CartServicesFacade,
3411
+ CheckoutRepositoriesFacade,
3412
+ CheckoutDependenciesFacade,
3413
+ CategoryRepositoryFacade,
3414
+ ProductCatalogFacade,
3415
+ CatalogServiceFacade,
3416
+ CategoryServiceFacade,
3417
+ CatalogStrategiesFacade,
3418
+ CatalogOperationsFacade,
3419
+ ProductManagementFacade,
3420
+ {
3421
+ provide: 'ProductServicesFacade',
3422
+ useFactory: (productStockNotificationRepository, categoryRepository, productSearch) => ({
3423
+ productStockNotificationRepository,
3424
+ categoryRepository,
3425
+ productSearch,
3426
+ }),
3427
+ deps: ['ProductStockNotificationRepository', 'CategoryRepository', 'ProductSearch'],
3428
+ },
3429
+ CatalogFilterHelper,
3430
+ CatalogSortHelper,
3431
+ ProductFieldsHelper,
3432
+ BrandManagerHelper,
3433
+ CatalogRepositoryService,
3434
+ CatalogHelpersService,
3435
+ CategorySearchStrategy,
3436
+ TermSearchStrategy,
3437
+ ProfileSearchStrategy,
3438
+ {
3439
+ provide: CatalogSearchContext,
3440
+ useFactory: (categoryStrategy, termStrategy, profileStrategy) => {
3441
+ return new CatalogSearchContext(categoryStrategy, termStrategy, profileStrategy);
3442
+ },
3443
+ deps: [CategorySearchStrategy, TermSearchStrategy, ProfileSearchStrategy],
3444
+ },
3445
+ {
3446
+ provide: UpdateUserImage,
3447
+ useFactory: (userRepository, fileUploader) => {
3448
+ return new UpdateUserImage(userRepository, fileUploader);
3449
+ },
3450
+ deps: ['UserRepository', 'FileUploaderService'],
3451
+ },
3452
+ {
3453
+ provide: 'FileUploaderService',
3454
+ useFactory: (storage, baseUrl) => {
3455
+ return new FirebaseFileUploaderService(storage, baseUrl);
3456
+ },
3457
+ deps: [Storage, STORAGE_BASE_URL],
3458
+ },
3459
+ {
3460
+ provide: 'ProductSearch',
3461
+ useExisting: ProductsVertexSearch,
3462
+ },
3463
+ CouponRepositoriesFacade,
3464
+ HomeShopRepositoriesFacade,
3465
+ OrderProductReviewService,
3466
+ OrderRecurrenceService,
3467
+ ],
3468
+ }]
3469
+ }] });
3470
+
3471
+ /**
3472
+ * Generated bundle index. Do not edit.
3473
+ */
3474
+
3475
+ export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule, AuthService, CartService, CatalogService, CategoryService, CategoryWithTree, CheckoutService, CookieDataPersistence, HomeShopService, NewCategoryStructureAdapter, OldCategoryStructureAdapter, OrderProductReviewService, OrderRecurrenceService, OrderService, ProductSorts, UtilHelper, WishlistService };
3476
+ //# sourceMappingURL=infrab4a-connect-angular.mjs.map