@infrab4a/connect-angular 5.4.0-beta.1 → 5.4.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.
- package/esm2020/services/checkout.service.mjs +3 -3
- 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 +73 -22
- package/fesm2015/infrab4a-connect-angular.mjs.map +1 -1
- package/fesm2020/infrab4a-connect-angular.mjs +67 -22
- package/fesm2020/infrab4a-connect-angular.mjs.map +1 -1
- package/package.json +2 -2
- package/services/checkout.service.d.ts +1 -1
- 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';
|
|
@@ -1278,7 +1278,7 @@ class CheckoutService {
|
|
|
1278
1278
|
})), concatMap(() => this.getCheckout()));
|
|
1279
1279
|
}
|
|
1280
1280
|
createOrder(checkoutPayload, paymentProvider, applicationVersion) {
|
|
1281
|
-
return this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/
|
|
1281
|
+
return this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/checkoutV5`, {
|
|
1282
1282
|
data: {
|
|
1283
1283
|
...checkoutPayload,
|
|
1284
1284
|
applicationVersion,
|
|
@@ -2984,55 +2984,97 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
2984
2984
|
}], ctorParameters: function () { return [{ type: HomeShopRepositoriesFacade }, { type: ConfigurationFacade }]; } });
|
|
2985
2985
|
|
|
2986
2986
|
class OrderProductReviewService {
|
|
2987
|
-
constructor(orderRepository, productReviewRepository) {
|
|
2987
|
+
constructor(orderRepository, productReviewRepository, variantRepository) {
|
|
2988
2988
|
this.orderRepository = orderRepository;
|
|
2989
2989
|
this.productReviewRepository = productReviewRepository;
|
|
2990
|
+
this.variantRepository = variantRepository;
|
|
2990
2991
|
}
|
|
2991
2992
|
async getPendingReviewsByEmail(email) {
|
|
2992
2993
|
const products = [];
|
|
2994
|
+
const orders = await this.getOrdersByEmail(email);
|
|
2995
|
+
if (orders.length) {
|
|
2996
|
+
for (const order of orders) {
|
|
2997
|
+
const lineItems = order.lineItems.filter((item) => !item.isGift);
|
|
2998
|
+
for (const item of lineItems) {
|
|
2999
|
+
const productReview = await this.getProductReview(order, item);
|
|
3000
|
+
if (productReview?.status != null)
|
|
3001
|
+
continue;
|
|
3002
|
+
products.push(this.buildProductReview(order, item, productReview));
|
|
3003
|
+
}
|
|
3004
|
+
}
|
|
3005
|
+
}
|
|
3006
|
+
return products;
|
|
3007
|
+
}
|
|
3008
|
+
async getOrdersByEmail(email) {
|
|
2993
3009
|
const { data: orders } = await this.orderRepository.find({
|
|
2994
3010
|
filters: {
|
|
2995
3011
|
user: {
|
|
2996
3012
|
email: email,
|
|
2997
3013
|
},
|
|
2998
3014
|
status: OrderStatus.ENTREGUE,
|
|
3015
|
+
createdAt: {
|
|
3016
|
+
operator: Where.GTE,
|
|
3017
|
+
value: new Date(2024, 0, 0, 0, 0, 0).getTime(),
|
|
3018
|
+
},
|
|
2999
3019
|
},
|
|
3000
3020
|
orderBy: {
|
|
3001
3021
|
createdAt: 'desc',
|
|
3002
3022
|
},
|
|
3003
3023
|
});
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3024
|
+
return orders;
|
|
3025
|
+
}
|
|
3026
|
+
async getProductReview(order, item) {
|
|
3027
|
+
const products = [item.id];
|
|
3028
|
+
const isVariant = await this.variantRepository
|
|
3029
|
+
.find({
|
|
3030
|
+
filters: {
|
|
3031
|
+
id: item.id,
|
|
3032
|
+
},
|
|
3033
|
+
})
|
|
3034
|
+
.then((res) => res.data.at(0));
|
|
3035
|
+
if (isVariant)
|
|
3036
|
+
products.push(isVariant.productId);
|
|
3037
|
+
const productReview = await this.productReviewRepository
|
|
3038
|
+
.find({
|
|
3039
|
+
filters: {
|
|
3040
|
+
orderId: { operator: Where.IN, value: [order.id, order.orderNumber].filter(Boolean) },
|
|
3041
|
+
productId: { operator: Where.IN, value: products },
|
|
3042
|
+
},
|
|
3043
|
+
})
|
|
3044
|
+
.then((res) => res.data.at(0));
|
|
3045
|
+
return productReview;
|
|
3022
3046
|
}
|
|
3023
3047
|
buildProductReview(order, item, review) {
|
|
3024
3048
|
return {
|
|
3025
3049
|
id: item.id,
|
|
3050
|
+
orderId: order.id,
|
|
3051
|
+
orderNumber: order.orderNumber,
|
|
3026
3052
|
isEdition: false,
|
|
3027
3053
|
name: item.name,
|
|
3028
3054
|
image: item.image,
|
|
3029
3055
|
deliveryDate: order.deliveredAt || null,
|
|
3030
3056
|
evaluationInAnalysis: review ? true : false,
|
|
3057
|
+
rating: review ? review.rate : null,
|
|
3031
3058
|
shopProductSlug: item.slug,
|
|
3032
3059
|
};
|
|
3033
3060
|
}
|
|
3061
|
+
async createReview(review) {
|
|
3062
|
+
return this.productReviewRepository.create(ProductReview.toInstance({
|
|
3063
|
+
productId: review.productId.toString(),
|
|
3064
|
+
shop: review.shop,
|
|
3065
|
+
rate: review.rate,
|
|
3066
|
+
author: review.author,
|
|
3067
|
+
email: review.email,
|
|
3068
|
+
location: review.location,
|
|
3069
|
+
review: review.comment,
|
|
3070
|
+
title: review.title,
|
|
3071
|
+
personId: review.personId,
|
|
3072
|
+
points: review.points,
|
|
3073
|
+
orderId: review.orderId,
|
|
3074
|
+
}));
|
|
3075
|
+
}
|
|
3034
3076
|
}
|
|
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 });
|
|
3077
|
+
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
3078
|
OrderProductReviewService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderProductReviewService });
|
|
3037
3079
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: OrderProductReviewService, decorators: [{
|
|
3038
3080
|
type: Injectable
|
|
@@ -3042,6 +3084,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0", ngImpor
|
|
|
3042
3084
|
}] }, { type: undefined, decorators: [{
|
|
3043
3085
|
type: Inject,
|
|
3044
3086
|
args: ['ProductReviewRepository']
|
|
3087
|
+
}] }, { type: undefined, decorators: [{
|
|
3088
|
+
type: Inject,
|
|
3089
|
+
args: ['VariantRepository']
|
|
3045
3090
|
}] }]; } });
|
|
3046
3091
|
|
|
3047
3092
|
class OrderService {
|