@infrab4a/connect-angular 5.4.0-beta.0 → 5.4.0-beta.10
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.
- package/esm2020/services/catalog/helpers/catalog-filter.helper.mjs +3 -3
- package/esm2020/services/catalog/helpers/product-fields.helper.mjs +3 -2
- package/esm2020/services/catalog/strategies/profile-search.strategy.mjs +2 -2
- package/esm2020/services/order-product-review.service.mjs +67 -22
- package/esm2020/services/types/index.mjs +2 -1
- package/esm2020/services/types/pending-product-review.type.mjs +1 -1
- package/esm2020/services/types/product-review-create.type.mjs +2 -0
- package/fesm2015/infrab4a-connect-angular.mjs +76 -24
- package/fesm2015/infrab4a-connect-angular.mjs.map +1 -1
- package/fesm2020/infrab4a-connect-angular.mjs +70 -24
- package/fesm2020/infrab4a-connect-angular.mjs.map +1 -1
- package/package.json +2 -2
- package/services/order-product-review.service.d.ts +7 -3
- package/services/types/index.d.ts +1 -0
- package/services/types/pending-product-review.type.d.ts +3 -0
- package/services/types/product-review-create.type.d.ts +14 -0
|
@@ -7,7 +7,7 @@ import { provideAppCheck, initializeAppCheck } from '@angular/fire/app-check';
|
|
|
7
7
|
import * as i3$1 from '@angular/fire/storage';
|
|
8
8
|
import { Storage, provideStorage, getStorage } from '@angular/fire/storage';
|
|
9
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, ProductFirestoreRepository, ShopSettingsFirestoreRepository, SubscriptionPaymentFirestoreRepository, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionFirestoreRepository, UserFirestoreRepository, UserAddressFirestoreRepository, UserPaymentMethodFirestoreRepository, SubscriptionMaterializationFirestoreRepository, SubscriptionSummaryFirestoreRepository, ProductVariantFirestoreRepository, OrderBlockedFirestoreRepository, LogFirestoreRepository, SequenceFirestoreRepository, CategoryHasuraGraphQLRepository, ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository, ProductReviewHasuraGraphQLRepository, VariantHasuraGraphQLRepository, ProductStockNotificationHasuraGraphQLRepository, FilterOptionHasuraGraphQLRepository, FilterHasuraGraphQLRepository, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryProductHasuraGraphQLRepository, WishlistHasuraGraphQLRepository, ProductErrorsHasuraGraphQLRepository, 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, Order, UpdateUserImage, FirebaseFileUploaderService } 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, ProductFirestoreRepository, ShopSettingsFirestoreRepository, SubscriptionPaymentFirestoreRepository, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionFirestoreRepository, UserFirestoreRepository, UserAddressFirestoreRepository, UserPaymentMethodFirestoreRepository, SubscriptionMaterializationFirestoreRepository, SubscriptionSummaryFirestoreRepository, ProductVariantFirestoreRepository, OrderBlockedFirestoreRepository, LogFirestoreRepository, SequenceFirestoreRepository, CategoryHasuraGraphQLRepository, ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository, ProductReviewHasuraGraphQLRepository, VariantHasuraGraphQLRepository, ProductStockNotificationHasuraGraphQLRepository, FilterOptionHasuraGraphQLRepository, FilterHasuraGraphQLRepository, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryProductHasuraGraphQLRepository, WishlistHasuraGraphQLRepository, ProductErrorsHasuraGraphQLRepository, 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
11
|
import * as i1 from '@angular/fire/auth';
|
|
12
12
|
import { Auth, provideAuth, initializeAuth, indexedDBLocalPersistence, browserLocalPersistence, browserSessionPersistence, getAuth, getIdToken, authState } from '@angular/fire/auth';
|
|
13
13
|
import { isPlatformBrowser, isPlatformServer } from '@angular/common';
|
|
@@ -1624,7 +1624,7 @@ class ProfileSearchStrategy {
|
|
|
1624
1624
|
const repoParams = {
|
|
1625
1625
|
fields: fieldsHelper.getStandardFields(),
|
|
1626
1626
|
filters: {
|
|
1627
|
-
|
|
1627
|
+
tagsProfile: { operator: Where.LIKE, value: profile },
|
|
1628
1628
|
...filterHelper.buildFilterQuery(filters || {}),
|
|
1629
1629
|
},
|
|
1630
1630
|
...(sort ? { orderBy: sortHelper.buildSortQuery(sort) } : {}),
|
|
@@ -1963,7 +1963,7 @@ class CatalogFilterHelper {
|
|
|
1963
1963
|
filterQuery.rate = { operator: Where.GTE, value: filters.rate };
|
|
1964
1964
|
}
|
|
1965
1965
|
if (filters.tags?.length) {
|
|
1966
|
-
filterQuery.
|
|
1966
|
+
filterQuery.tagsProfile = { operator: Where.LIKE, value: filters.tags };
|
|
1967
1967
|
}
|
|
1968
1968
|
if (filters.customOptions?.length) {
|
|
1969
1969
|
filterQuery.filters = { operator: Where.LIKE, value: filters.customOptions };
|
|
@@ -2047,7 +2047,8 @@ class ProductFieldsHelper {
|
|
|
2047
2047
|
'isKit',
|
|
2048
2048
|
'sku',
|
|
2049
2049
|
'rate',
|
|
2050
|
-
'
|
|
2050
|
+
'tagsProfile',
|
|
2051
|
+
'tagsCollection',
|
|
2051
2052
|
'type',
|
|
2052
2053
|
'shoppingCount',
|
|
2053
2054
|
'gender',
|
|
@@ -2984,55 +2985,97 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
2984
2985
|
}], ctorParameters: function () { return [{ type: HomeShopRepositoriesFacade }, { type: ConfigurationFacade }]; } });
|
|
2985
2986
|
|
|
2986
2987
|
class OrderProductReviewService {
|
|
2987
|
-
constructor(orderRepository, productReviewRepository) {
|
|
2988
|
+
constructor(orderRepository, productReviewRepository, variantRepository) {
|
|
2988
2989
|
this.orderRepository = orderRepository;
|
|
2989
2990
|
this.productReviewRepository = productReviewRepository;
|
|
2991
|
+
this.variantRepository = variantRepository;
|
|
2990
2992
|
}
|
|
2991
2993
|
async getPendingReviewsByEmail(email) {
|
|
2992
2994
|
const products = [];
|
|
2995
|
+
const orders = await this.getOrdersByEmail(email);
|
|
2996
|
+
if (orders.length) {
|
|
2997
|
+
for (const order of orders) {
|
|
2998
|
+
const lineItems = order.lineItems.filter((item) => !item.isGift);
|
|
2999
|
+
for (const item of lineItems) {
|
|
3000
|
+
const productReview = await this.getProductReview(order, item);
|
|
3001
|
+
if (productReview?.status != null)
|
|
3002
|
+
continue;
|
|
3003
|
+
products.push(this.buildProductReview(order, item, productReview));
|
|
3004
|
+
}
|
|
3005
|
+
}
|
|
3006
|
+
}
|
|
3007
|
+
return products;
|
|
3008
|
+
}
|
|
3009
|
+
async getOrdersByEmail(email) {
|
|
2993
3010
|
const { data: orders } = await this.orderRepository.find({
|
|
2994
3011
|
filters: {
|
|
2995
3012
|
user: {
|
|
2996
3013
|
email: email,
|
|
2997
3014
|
},
|
|
2998
3015
|
status: OrderStatus.ENTREGUE,
|
|
3016
|
+
createdAt: {
|
|
3017
|
+
operator: Where.GTE,
|
|
3018
|
+
value: new Date(2024, 0, 0, 0, 0, 0).getTime(),
|
|
3019
|
+
},
|
|
2999
3020
|
},
|
|
3000
3021
|
orderBy: {
|
|
3001
3022
|
createdAt: 'desc',
|
|
3002
3023
|
},
|
|
3003
3024
|
});
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3025
|
+
return orders;
|
|
3026
|
+
}
|
|
3027
|
+
async getProductReview(order, item) {
|
|
3028
|
+
const products = [item.id];
|
|
3029
|
+
const isVariant = await this.variantRepository
|
|
3030
|
+
.find({
|
|
3031
|
+
filters: {
|
|
3032
|
+
id: item.id,
|
|
3033
|
+
},
|
|
3034
|
+
})
|
|
3035
|
+
.then((res) => res.data.at(0));
|
|
3036
|
+
if (isVariant)
|
|
3037
|
+
products.push(isVariant.productId);
|
|
3038
|
+
const productReview = await this.productReviewRepository
|
|
3039
|
+
.find({
|
|
3040
|
+
filters: {
|
|
3041
|
+
orderId: { operator: Where.IN, value: [order.id, order.orderNumber].filter(Boolean) },
|
|
3042
|
+
productId: { operator: Where.IN, value: products },
|
|
3043
|
+
},
|
|
3044
|
+
})
|
|
3045
|
+
.then((res) => res.data.at(0));
|
|
3046
|
+
return productReview;
|
|
3022
3047
|
}
|
|
3023
3048
|
buildProductReview(order, item, review) {
|
|
3024
3049
|
return {
|
|
3025
3050
|
id: item.id,
|
|
3051
|
+
orderId: order.id,
|
|
3052
|
+
orderNumber: order.orderNumber,
|
|
3026
3053
|
isEdition: false,
|
|
3027
3054
|
name: item.name,
|
|
3028
3055
|
image: item.image,
|
|
3029
3056
|
deliveryDate: order.deliveredAt || null,
|
|
3030
3057
|
evaluationInAnalysis: review ? true : false,
|
|
3058
|
+
rating: review ? review.rate : null,
|
|
3031
3059
|
shopProductSlug: item.slug,
|
|
3032
3060
|
};
|
|
3033
3061
|
}
|
|
3062
|
+
async createReview(review) {
|
|
3063
|
+
return this.productReviewRepository.create(ProductReview.toInstance({
|
|
3064
|
+
productId: review.productId.toString(),
|
|
3065
|
+
shop: review.shop,
|
|
3066
|
+
rate: review.rate,
|
|
3067
|
+
author: review.author,
|
|
3068
|
+
email: review.email,
|
|
3069
|
+
location: review.location,
|
|
3070
|
+
review: review.comment,
|
|
3071
|
+
title: review.title,
|
|
3072
|
+
personId: review.personId,
|
|
3073
|
+
points: review.points,
|
|
3074
|
+
orderId: review.orderId,
|
|
3075
|
+
}));
|
|
3076
|
+
}
|
|
3034
3077
|
}
|
|
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 });
|
|
3078
|
+
OrderProductReviewService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderProductReviewService, deps: [{ token: 'OrderRepository' }, { token: 'ProductReviewRepository' }, { token: 'VariantRepository' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3036
3079
|
OrderProductReviewService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderProductReviewService });
|
|
3037
3080
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderProductReviewService, decorators: [{
|
|
3038
3081
|
type: Injectable
|
|
@@ -3042,6 +3085,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
3042
3085
|
}] }, { type: undefined, decorators: [{
|
|
3043
3086
|
type: Inject,
|
|
3044
3087
|
args: ['ProductReviewRepository']
|
|
3088
|
+
}] }, { type: undefined, decorators: [{
|
|
3089
|
+
type: Inject,
|
|
3090
|
+
args: ['VariantRepository']
|
|
3045
3091
|
}] }]; } });
|
|
3046
3092
|
|
|
3047
3093
|
class OrderService {
|