@infrab4a/connect-angular 5.3.0-beta.0 → 5.4.0-beta.0

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.
@@ -2983,6 +2983,67 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
2983
2983
  type: Injectable
2984
2984
  }], ctorParameters: function () { return [{ type: HomeShopRepositoriesFacade }, { type: ConfigurationFacade }]; } });
2985
2985
 
2986
+ class OrderProductReviewService {
2987
+ constructor(orderRepository, productReviewRepository) {
2988
+ this.orderRepository = orderRepository;
2989
+ this.productReviewRepository = productReviewRepository;
2990
+ }
2991
+ async getPendingReviewsByEmail(email) {
2992
+ const products = [];
2993
+ const { data: orders } = await this.orderRepository.find({
2994
+ filters: {
2995
+ user: {
2996
+ email: email,
2997
+ },
2998
+ status: OrderStatus.ENTREGUE,
2999
+ },
3000
+ orderBy: {
3001
+ createdAt: 'desc',
3002
+ },
3003
+ });
3004
+ if (orders.length) {
3005
+ for (const order of orders) {
3006
+ const lineItems = order.lineItems.filter((item) => !item.isGift);
3007
+ for (const item of lineItems) {
3008
+ const productReview = await this.productReviewRepository
3009
+ .find({
3010
+ filters: {
3011
+ orderId: order.id,
3012
+ productId: item.id,
3013
+ status: { operator: Where.EQUALS, value: null },
3014
+ },
3015
+ })
3016
+ .then((res) => res.data.at(0));
3017
+ products.push(this.buildProductReview(order, item, productReview));
3018
+ }
3019
+ }
3020
+ }
3021
+ return products;
3022
+ }
3023
+ buildProductReview(order, item, review) {
3024
+ return {
3025
+ id: item.id,
3026
+ isEdition: false,
3027
+ name: item.name,
3028
+ image: item.image,
3029
+ deliveryDate: order.deliveredAt || null,
3030
+ evaluationInAnalysis: review ? true : false,
3031
+ shopProductSlug: item.slug,
3032
+ };
3033
+ }
3034
+ }
3035
+ OrderProductReviewService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderProductReviewService, deps: [{ token: 'OrderRepository' }, { token: 'ProductReviewRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
3036
+ OrderProductReviewService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderProductReviewService });
3037
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderProductReviewService, decorators: [{
3038
+ type: Injectable
3039
+ }], ctorParameters: function () { return [{ type: i3.OrderFirestoreRepository, decorators: [{
3040
+ type: Inject,
3041
+ args: ['OrderRepository']
3042
+ }] }, { type: undefined, decorators: [{
3043
+ type: Inject,
3044
+ args: ['ProductReviewRepository']
3045
+ }] }]; } });
3046
+
2986
3047
  class OrderService {
2987
3048
  constructor(angularFirestore, orderRepository) {
2988
3049
  this.angularFirestore = angularFirestore;
@@ -3119,6 +3180,7 @@ AngularConnectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", ve
3119
3180
  },
3120
3181
  CouponRepositoriesFacade,
3121
3182
  HomeShopRepositoriesFacade,
3183
+ OrderProductReviewService,
3122
3184
  ], imports: [provideFirebaseApp((injector) => {
3123
3185
  const appName = injector.get(FIREBASE_APP_NAME);
3124
3186
  try {
@@ -3261,6 +3323,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
3261
3323
  },
3262
3324
  CouponRepositoriesFacade,
3263
3325
  HomeShopRepositoriesFacade,
3326
+ OrderProductReviewService,
3264
3327
  ],
3265
3328
  }]
3266
3329
  }] });
@@ -3269,5 +3332,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
3269
3332
  * Generated bundle index. Do not edit.
3270
3333
  */
3271
3334
 
3272
- export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule, AuthService, CartService, CatalogService, CategoryService, CategoryWithTree, CheckoutService, CheckoutSubscriptionService, CookieDataPersistence, CouponService, HomeShopService, NewCategoryStructureAdapter, OldCategoryStructureAdapter, OrderService, ProductSorts, UtilHelper, WishlistService };
3335
+ export { AngularConnectModule, AngularFirebaseAuthModule, AngularFirestoreModule, AngularHasuraGraphQLModule, AuthService, CartService, CatalogService, CategoryService, CategoryWithTree, CheckoutService, CheckoutSubscriptionService, CookieDataPersistence, CouponService, HomeShopService, NewCategoryStructureAdapter, OldCategoryStructureAdapter, OrderProductReviewService, OrderService, ProductSorts, UtilHelper, WishlistService };
3273
3336
  //# sourceMappingURL=infrab4a-connect-angular.mjs.map