@infrab4a/connect 4.0.0-beta.24 → 4.0.0-beta.26
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/domain/catalog/helpers/RoundProdutcPriceHelper.d.ts +4 -0
- package/domain/catalog/helpers/index.d.ts +1 -0
- package/domain/catalog/index.d.ts +1 -0
- package/domain/catalog/models/category-collection-children.d.ts +14 -0
- package/domain/catalog/models/category.d.ts +2 -1
- package/domain/catalog/models/index.d.ts +1 -0
- package/domain/catalog/models/types/category-product.d.ts +4 -0
- package/domain/catalog/models/types/index.d.ts +1 -0
- package/domain/catalog/repositories/category-collection-children.repository.d.ts +4 -0
- package/domain/catalog/repositories/category.repository.d.ts +1 -0
- package/domain/catalog/repositories/index.d.ts +1 -0
- package/domain/location/models/address.d.ts +1 -0
- package/esm2020/domain/catalog/helpers/RoundProdutcPriceHelper.mjs +15 -0
- package/esm2020/domain/catalog/helpers/index.mjs +2 -0
- package/esm2020/domain/catalog/index.mjs +2 -1
- package/esm2020/domain/catalog/models/category-collection-children.mjs +16 -0
- package/esm2020/domain/catalog/models/category.mjs +1 -1
- package/esm2020/domain/catalog/models/index.mjs +2 -1
- package/esm2020/domain/catalog/models/types/category-product.mjs +2 -0
- package/esm2020/domain/catalog/models/types/index.mjs +2 -1
- package/esm2020/domain/catalog/repositories/category-collection-children.repository.mjs +2 -0
- package/esm2020/domain/catalog/repositories/category.repository.mjs +1 -1
- package/esm2020/domain/catalog/repositories/index.mjs +2 -1
- package/esm2020/domain/location/models/address.mjs +1 -1
- package/esm2020/infra/firebase/firestore/repositories/catalog/category-firestore.repository.mjs +4 -1
- package/esm2020/infra/firebase/firestore/repositories/shop-settings/home-firestore.repository.mjs +4 -2
- package/esm2020/infra/hasura-graphql/repositories/catalog/category-collection-children-hasura-graphql.repository.mjs +38 -0
- package/esm2020/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.mjs +26 -2
- package/esm2020/infra/hasura-graphql/repositories/catalog/index.mjs +2 -1
- package/esm2020/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.mjs +3 -2
- package/fesm2015/infrab4a-connect.mjs +95 -3
- package/fesm2015/infrab4a-connect.mjs.map +1 -1
- package/fesm2020/infrab4a-connect.mjs +95 -3
- package/fesm2020/infrab4a-connect.mjs.map +1 -1
- package/infra/firebase/firestore/repositories/catalog/category-firestore.repository.d.ts +1 -0
- package/infra/hasura-graphql/repositories/catalog/category-collection-children-hasura-graphql.repository.d.ts +10 -0
- package/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.d.ts +1 -0
- package/infra/hasura-graphql/repositories/catalog/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -780,6 +780,19 @@ __decorate([
|
|
|
780
780
|
__metadata("design:type", Array)
|
|
781
781
|
], Category.prototype, "filters", void 0);
|
|
782
782
|
|
|
783
|
+
class CategoryCollectionChildren extends BaseModel {
|
|
784
|
+
identifierFields() {
|
|
785
|
+
return ['collectionId', 'categoryId'];
|
|
786
|
+
}
|
|
787
|
+
static get identifiersFields() {
|
|
788
|
+
return ['collectionId', 'categoryId'];
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
__decorate([
|
|
792
|
+
Type(() => CategoryCollectionChildren),
|
|
793
|
+
__metadata("design:type", CategoryCollectionChildren)
|
|
794
|
+
], CategoryCollectionChildren.prototype, "parent", void 0);
|
|
795
|
+
|
|
783
796
|
class CategoryFilter extends BaseModel {
|
|
784
797
|
static get identifiersFields() {
|
|
785
798
|
return ['id'];
|
|
@@ -974,6 +987,20 @@ __decorate([
|
|
|
974
987
|
__metadata("design:type", Coupon)
|
|
975
988
|
], CheckoutSubscription.prototype, "coupon", void 0);
|
|
976
989
|
|
|
990
|
+
class RoundProductPricesHelper {
|
|
991
|
+
static roundProductPrices(product) {
|
|
992
|
+
product.price.price = Number(product.price.price.toFixed(2));
|
|
993
|
+
product.price.fullPrice = Number(product.price.fullPrice.toFixed(2));
|
|
994
|
+
if (product.price.subscriberPrice) {
|
|
995
|
+
product.price.subscriberPrice = Number(product.price.subscriberPrice.toFixed(2));
|
|
996
|
+
}
|
|
997
|
+
if (product instanceof LineItem && product.pricePaid) {
|
|
998
|
+
product.pricePaid = Number(product.pricePaid.toFixed(2));
|
|
999
|
+
}
|
|
1000
|
+
return product;
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
|
|
977
1004
|
var FilterType;
|
|
978
1005
|
(function (FilterType) {
|
|
979
1006
|
FilterType["ACCESSORY_IMPORTANCE"] = "accessoryImportance";
|
|
@@ -1834,6 +1861,9 @@ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFire
|
|
|
1834
1861
|
return is(products);
|
|
1835
1862
|
});
|
|
1836
1863
|
}
|
|
1864
|
+
getCategoryByShop(shop) {
|
|
1865
|
+
return;
|
|
1866
|
+
}
|
|
1837
1867
|
}
|
|
1838
1868
|
|
|
1839
1869
|
class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
@@ -2080,7 +2110,7 @@ class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestor
|
|
|
2080
2110
|
category: ((_a = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _a === void 0 ? void 0 : _a.toPlain)
|
|
2081
2111
|
? (_b = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _b === void 0 ? void 0 : _b.toPlain()
|
|
2082
2112
|
: homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category,
|
|
2083
|
-
products: ((_c = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.products) === null || _c === void 0 ? void 0 : _c.map((product) => product === null || product === void 0 ? void 0 : product.toPlain()).filter(Boolean)) || [],
|
|
2113
|
+
products: ((_c = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.products) === null || _c === void 0 ? void 0 : _c.map((product) => ((product === null || product === void 0 ? void 0 : product.toPlain) ? product === null || product === void 0 ? void 0 : product.toPlain() : product)).filter(Boolean)) || [],
|
|
2084
2114
|
});
|
|
2085
2115
|
};
|
|
2086
2116
|
this.plainToHomeCategoryGroup = (homeCategoryGroup) => {
|
|
@@ -2793,6 +2823,41 @@ class VariantHasuraGraphQL extends Variant {
|
|
|
2793
2823
|
}
|
|
2794
2824
|
}
|
|
2795
2825
|
|
|
2826
|
+
class CategoryCollectionChildrenHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
2827
|
+
constructor(endpoint, authOptions) {
|
|
2828
|
+
super({
|
|
2829
|
+
tableName: 'category_collection_children',
|
|
2830
|
+
model: CategoryCollectionChildren,
|
|
2831
|
+
endpoint,
|
|
2832
|
+
authOptions,
|
|
2833
|
+
fields: [
|
|
2834
|
+
{ collectionId: { columnName: 'collection_id' } },
|
|
2835
|
+
{ categoryId: { columnName: 'category_id' } },
|
|
2836
|
+
'name',
|
|
2837
|
+
'slug',
|
|
2838
|
+
'reference',
|
|
2839
|
+
{ parentCollectionId: { columnName: 'parent_collection_id' } },
|
|
2840
|
+
{ parentCategoryId: { columnName: 'parent_category_id' } },
|
|
2841
|
+
{
|
|
2842
|
+
parent: {
|
|
2843
|
+
columnName: 'parent',
|
|
2844
|
+
foreignKeyColumn: { collectionId: 'parentCollectionId', categoryId: 'parentCategoryId' },
|
|
2845
|
+
fields: [
|
|
2846
|
+
{ collectionId: { columnName: 'collection_id' } },
|
|
2847
|
+
{ categoryId: { columnName: 'category_id' } },
|
|
2848
|
+
'name',
|
|
2849
|
+
'slug',
|
|
2850
|
+
'reference',
|
|
2851
|
+
{ parentCollectionId: { columnName: 'parent_collection_id' } },
|
|
2852
|
+
{ parentCategoryId: { columnName: 'parent_category_id' } },
|
|
2853
|
+
],
|
|
2854
|
+
},
|
|
2855
|
+
},
|
|
2856
|
+
],
|
|
2857
|
+
});
|
|
2858
|
+
}
|
|
2859
|
+
}
|
|
2860
|
+
|
|
2796
2861
|
class CategoryFilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
2797
2862
|
constructor({ endpoint, authOptions, interceptors, }) {
|
|
2798
2863
|
super({
|
|
@@ -2862,6 +2927,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
2862
2927
|
'image',
|
|
2863
2928
|
'published',
|
|
2864
2929
|
'shop',
|
|
2930
|
+
{ shops: { columnName: 'shops', type: HasuraGraphQLColumnType.Jsonb } },
|
|
2865
2931
|
'slug',
|
|
2866
2932
|
{ brandCategory: { columnName: 'brand_category' } },
|
|
2867
2933
|
{ brandCategoryBanner: { columnName: 'brand_banner' } },
|
|
@@ -2973,7 +3039,16 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
2973
3039
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2974
3040
|
if (!slug)
|
|
2975
3041
|
return null;
|
|
2976
|
-
const { data } = yield this.find({
|
|
3042
|
+
const { data } = yield this.find({
|
|
3043
|
+
filters: {
|
|
3044
|
+
slug,
|
|
3045
|
+
shops: { operator: Where.IN, value: [shop] },
|
|
3046
|
+
published: { operator: Where.EQUALS, value: true },
|
|
3047
|
+
},
|
|
3048
|
+
options: {
|
|
3049
|
+
enableCount: false,
|
|
3050
|
+
},
|
|
3051
|
+
});
|
|
2977
3052
|
if (!data.length)
|
|
2978
3053
|
throw new NotFoundError(`Category with slug ${slug} not found`);
|
|
2979
3054
|
if (data.length > 1)
|
|
@@ -2981,6 +3056,22 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
2981
3056
|
return data.shift();
|
|
2982
3057
|
});
|
|
2983
3058
|
}
|
|
3059
|
+
getCategoryByShop(shop) {
|
|
3060
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3061
|
+
if (!shop)
|
|
3062
|
+
return;
|
|
3063
|
+
const { data } = yield this.find({
|
|
3064
|
+
filters: {
|
|
3065
|
+
shops: { operator: Where.IN, value: [shop] },
|
|
3066
|
+
published: { operator: Where.EQUALS, value: true },
|
|
3067
|
+
},
|
|
3068
|
+
options: {
|
|
3069
|
+
enableCount: false,
|
|
3070
|
+
},
|
|
3071
|
+
});
|
|
3072
|
+
return data;
|
|
3073
|
+
});
|
|
3074
|
+
}
|
|
2984
3075
|
getCategoriesForHome(categoryIds, limit = 4, gender) {
|
|
2985
3076
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2986
3077
|
if (!(categoryIds === null || categoryIds === void 0 ? void 0 : categoryIds.length))
|
|
@@ -3561,6 +3652,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
3561
3652
|
},
|
|
3562
3653
|
});
|
|
3563
3654
|
const product = (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.shift();
|
|
3655
|
+
RoundProductPricesHelper.roundProductPrices(product);
|
|
3564
3656
|
return product;
|
|
3565
3657
|
});
|
|
3566
3658
|
}
|
|
@@ -3916,5 +4008,5 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
3916
4008
|
* Generated bundle index. Do not edit.
|
|
3917
4009
|
*/
|
|
3918
4010
|
|
|
3919
|
-
export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, Register, RegisterFirebaseAuthService, RequiredArgumentError, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, get, is, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
|
|
4011
|
+
export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, get, is, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
|
|
3920
4012
|
//# sourceMappingURL=infrab4a-connect.mjs.map
|