@infrab4a/connect-angular 5.8.3 → 5.8.4

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