@infrab4a/connect 4.3.0-beta.2 → 4.3.0-beta.3
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/index.cjs.js +23 -8
- package/index.esm.js +23 -8
- package/package.json +1 -1
- package/src/domain/shop-settings/models/types/brands-carousel.type.d.ts +3 -0
- package/src/domain/shop-settings/models/types/index.d.ts +3 -0
- package/src/domain/shop-settings/models/types/landing-page.d.ts +8 -0
- package/src/domain/shop-settings/models/types/promotion-page.d.ts +10 -0
- package/src/domain/shop-settings/models/types/sections.type.d.ts +6 -0
- package/src/domain/users/models/user.d.ts +1 -0
- package/src/infra/hasura-graphql/repositories/catalog/wishlist-hasura-graphql.repository.d.ts +2 -1
package/index.cjs.js
CHANGED
|
@@ -4595,18 +4595,24 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4595
4595
|
const plainData = this.paramsToPlain({ products });
|
|
4596
4596
|
if (!plainData.products || plainData.products.length <= 0)
|
|
4597
4597
|
return [];
|
|
4598
|
+
const category = await this.get({ id: categoryId.toString() });
|
|
4598
4599
|
await this.mutation('delete_category_product', ['affected_rows'], {
|
|
4599
4600
|
where: {
|
|
4600
4601
|
type: 'category_product_bool_exp',
|
|
4601
4602
|
required: true,
|
|
4602
|
-
value: {
|
|
4603
|
+
value: {
|
|
4604
|
+
category_id: { _eq: categoryId },
|
|
4605
|
+
product_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
|
|
4606
|
+
},
|
|
4603
4607
|
},
|
|
4604
4608
|
});
|
|
4605
4609
|
await this.mutation('insert_category_product', ['affected_rows'], {
|
|
4606
4610
|
objects: {
|
|
4607
4611
|
type: '[category_product_insert_input!]',
|
|
4608
4612
|
required: true,
|
|
4609
|
-
value: plainData.products
|
|
4613
|
+
value: plainData.products
|
|
4614
|
+
.filter((productId) => !category.products.includes(productId))
|
|
4615
|
+
.map((productId) => ({ category_id: categoryId, product_id: productId })),
|
|
4610
4616
|
},
|
|
4611
4617
|
});
|
|
4612
4618
|
return plainData.products;
|
|
@@ -4644,15 +4650,14 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4644
4650
|
},
|
|
4645
4651
|
})
|
|
4646
4652
|
.then((res) => res.data);
|
|
4647
|
-
const currentFiltersId = currentFilters.map((f) => f.
|
|
4653
|
+
const currentFiltersId = currentFilters.map((f) => f.filterId);
|
|
4648
4654
|
const filtersUpdatedId = filters.value.map((f) => f.id);
|
|
4649
4655
|
const filterToBeDeleted = currentFiltersId.filter((c) => !filtersUpdatedId.includes(c));
|
|
4650
4656
|
const filterToBeInserted = filtersUpdatedId.filter((c) => !currentFiltersId.includes(c));
|
|
4651
4657
|
for (const filter of filterToBeDeleted) {
|
|
4652
4658
|
const index = currentFilters.findIndex((f) => f.id == filter);
|
|
4653
|
-
if (index != -1)
|
|
4659
|
+
if (index != -1)
|
|
4654
4660
|
currentFilters.splice(index, 1);
|
|
4655
|
-
}
|
|
4656
4661
|
await this.categoryFilterRepository.deleteByCategoryAndFilter(categoryId, filter);
|
|
4657
4662
|
}
|
|
4658
4663
|
for (const filter of filterToBeInserted) {
|
|
@@ -5503,6 +5508,10 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5503
5508
|
throw new NotFoundError(`Category with id ${identifiers.id} is not a wishlist`);
|
|
5504
5509
|
return data;
|
|
5505
5510
|
}
|
|
5511
|
+
async find(params) {
|
|
5512
|
+
const { filters } = params, rest = tslib_1.__rest(params, ["filters"]);
|
|
5513
|
+
return await super.find(Object.assign(Object.assign({}, rest), { filters: Object.assign(Object.assign({}, filters), { isWishlist: { operator: exports.Where.EQUALS, value: true } }) }));
|
|
5514
|
+
}
|
|
5506
5515
|
async update(params) {
|
|
5507
5516
|
const { products, id: checkId, metadata, filters } = params, data = tslib_1.__rest(params, ["products", "id", "metadata", "filters"]);
|
|
5508
5517
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
@@ -5561,19 +5570,25 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5561
5570
|
const plainData = this.paramsToPlain({ products });
|
|
5562
5571
|
if (!plainData.products || plainData.products.length <= 0)
|
|
5563
5572
|
return [];
|
|
5573
|
+
const category = await this.get({ id: categoryId.toString() });
|
|
5574
|
+
await this.categoryFilterRepository.deleteByCategory(categoryId);
|
|
5564
5575
|
await this.mutation('delete_category_product', ['affected_rows'], {
|
|
5565
5576
|
where: {
|
|
5566
5577
|
type: 'category_product_bool_exp',
|
|
5567
5578
|
required: true,
|
|
5568
|
-
value: {
|
|
5579
|
+
value: {
|
|
5580
|
+
category_id: categoryId,
|
|
5581
|
+
product_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
|
|
5582
|
+
},
|
|
5569
5583
|
},
|
|
5570
5584
|
});
|
|
5571
|
-
await this.categoryFilterRepository.deleteByCategory(categoryId);
|
|
5572
5585
|
await this.mutation('insert_category_product', ['affected_rows'], {
|
|
5573
5586
|
objects: {
|
|
5574
5587
|
type: '[category_product_insert_input!]',
|
|
5575
5588
|
required: true,
|
|
5576
|
-
value: plainData.products
|
|
5589
|
+
value: plainData.products
|
|
5590
|
+
.filter((productId) => !category.products.includes(productId))
|
|
5591
|
+
.map((productId) => ({ category_id: categoryId, product_id: productId })),
|
|
5577
5592
|
},
|
|
5578
5593
|
});
|
|
5579
5594
|
return plainData.products;
|
package/index.esm.js
CHANGED
|
@@ -4571,18 +4571,24 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4571
4571
|
const plainData = this.paramsToPlain({ products });
|
|
4572
4572
|
if (!plainData.products || plainData.products.length <= 0)
|
|
4573
4573
|
return [];
|
|
4574
|
+
const category = await this.get({ id: categoryId.toString() });
|
|
4574
4575
|
await this.mutation('delete_category_product', ['affected_rows'], {
|
|
4575
4576
|
where: {
|
|
4576
4577
|
type: 'category_product_bool_exp',
|
|
4577
4578
|
required: true,
|
|
4578
|
-
value: {
|
|
4579
|
+
value: {
|
|
4580
|
+
category_id: { _eq: categoryId },
|
|
4581
|
+
product_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
|
|
4582
|
+
},
|
|
4579
4583
|
},
|
|
4580
4584
|
});
|
|
4581
4585
|
await this.mutation('insert_category_product', ['affected_rows'], {
|
|
4582
4586
|
objects: {
|
|
4583
4587
|
type: '[category_product_insert_input!]',
|
|
4584
4588
|
required: true,
|
|
4585
|
-
value: plainData.products
|
|
4589
|
+
value: plainData.products
|
|
4590
|
+
.filter((productId) => !category.products.includes(productId))
|
|
4591
|
+
.map((productId) => ({ category_id: categoryId, product_id: productId })),
|
|
4586
4592
|
},
|
|
4587
4593
|
});
|
|
4588
4594
|
return plainData.products;
|
|
@@ -4620,15 +4626,14 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4620
4626
|
},
|
|
4621
4627
|
})
|
|
4622
4628
|
.then((res) => res.data);
|
|
4623
|
-
const currentFiltersId = currentFilters.map((f) => f.
|
|
4629
|
+
const currentFiltersId = currentFilters.map((f) => f.filterId);
|
|
4624
4630
|
const filtersUpdatedId = filters.value.map((f) => f.id);
|
|
4625
4631
|
const filterToBeDeleted = currentFiltersId.filter((c) => !filtersUpdatedId.includes(c));
|
|
4626
4632
|
const filterToBeInserted = filtersUpdatedId.filter((c) => !currentFiltersId.includes(c));
|
|
4627
4633
|
for (const filter of filterToBeDeleted) {
|
|
4628
4634
|
const index = currentFilters.findIndex((f) => f.id == filter);
|
|
4629
|
-
if (index != -1)
|
|
4635
|
+
if (index != -1)
|
|
4630
4636
|
currentFilters.splice(index, 1);
|
|
4631
|
-
}
|
|
4632
4637
|
await this.categoryFilterRepository.deleteByCategoryAndFilter(categoryId, filter);
|
|
4633
4638
|
}
|
|
4634
4639
|
for (const filter of filterToBeInserted) {
|
|
@@ -5479,6 +5484,10 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5479
5484
|
throw new NotFoundError(`Category with id ${identifiers.id} is not a wishlist`);
|
|
5480
5485
|
return data;
|
|
5481
5486
|
}
|
|
5487
|
+
async find(params) {
|
|
5488
|
+
const { filters } = params, rest = __rest(params, ["filters"]);
|
|
5489
|
+
return await super.find(Object.assign(Object.assign({}, rest), { filters: Object.assign(Object.assign({}, filters), { isWishlist: { operator: Where.EQUALS, value: true } }) }));
|
|
5490
|
+
}
|
|
5482
5491
|
async update(params) {
|
|
5483
5492
|
const { products, id: checkId, metadata, filters } = params, data = __rest(params, ["products", "id", "metadata", "filters"]);
|
|
5484
5493
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
@@ -5537,19 +5546,25 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5537
5546
|
const plainData = this.paramsToPlain({ products });
|
|
5538
5547
|
if (!plainData.products || plainData.products.length <= 0)
|
|
5539
5548
|
return [];
|
|
5549
|
+
const category = await this.get({ id: categoryId.toString() });
|
|
5550
|
+
await this.categoryFilterRepository.deleteByCategory(categoryId);
|
|
5540
5551
|
await this.mutation('delete_category_product', ['affected_rows'], {
|
|
5541
5552
|
where: {
|
|
5542
5553
|
type: 'category_product_bool_exp',
|
|
5543
5554
|
required: true,
|
|
5544
|
-
value: {
|
|
5555
|
+
value: {
|
|
5556
|
+
category_id: categoryId,
|
|
5557
|
+
product_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
|
|
5558
|
+
},
|
|
5545
5559
|
},
|
|
5546
5560
|
});
|
|
5547
|
-
await this.categoryFilterRepository.deleteByCategory(categoryId);
|
|
5548
5561
|
await this.mutation('insert_category_product', ['affected_rows'], {
|
|
5549
5562
|
objects: {
|
|
5550
5563
|
type: '[category_product_insert_input!]',
|
|
5551
5564
|
required: true,
|
|
5552
|
-
value: plainData.products
|
|
5565
|
+
value: plainData.products
|
|
5566
|
+
.filter((productId) => !category.products.includes(productId))
|
|
5567
|
+
.map((productId) => ({ category_id: categoryId, product_id: productId })),
|
|
5553
5568
|
},
|
|
5554
5569
|
});
|
|
5555
5570
|
return plainData.products;
|
package/package.json
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export * from './banner.type';
|
|
2
2
|
export * from './benefit.type';
|
|
3
|
+
export * from './brands-carousel.type';
|
|
3
4
|
export * from './campaign-page';
|
|
4
5
|
export * from './home-data.type';
|
|
6
|
+
export * from './landing-page';
|
|
5
7
|
export * from './menu-nav.type';
|
|
6
8
|
export * from './sections.type';
|
|
7
9
|
export * from './shop-banner.type';
|
|
@@ -9,6 +11,7 @@ export * from './shop-brands.type';
|
|
|
9
11
|
export * from './shop-carousel.type';
|
|
10
12
|
export * from './shop-collection.type';
|
|
11
13
|
export * from './shop-gift.type';
|
|
14
|
+
export * from './shop-home';
|
|
12
15
|
export * from './shop-post.type';
|
|
13
16
|
export * from './shop-section.type';
|
|
14
17
|
export * from './sub-menu.type';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ShopBanner } from './shop-banner.type';
|
|
2
|
+
import { ShopCarousel } from './shop-carousel.type';
|
|
3
|
+
import { ShopSection } from './shop-section.type';
|
|
4
|
+
export type LandingPageList = {
|
|
5
|
+
ShopCarousel: ShopCarousel;
|
|
6
|
+
ShopBanner: ShopBanner;
|
|
7
|
+
};
|
|
8
|
+
export type LandingPage<T extends keyof LandingPageList> = LandingPageList[T] & ShopSection;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BrandsCarousel } from './brands-carousel.type';
|
|
2
|
+
import { ShopBanner } from './shop-banner.type';
|
|
3
|
+
import { ShopGift } from './shop-gift.type';
|
|
4
|
+
import { ShopSection } from './shop-section.type';
|
|
5
|
+
export type PromotionPageList = {
|
|
6
|
+
ShopBanner: ShopBanner;
|
|
7
|
+
BrandsCarousel: BrandsCarousel;
|
|
8
|
+
ShopGift: ShopGift;
|
|
9
|
+
};
|
|
10
|
+
export type PromotionPage<T extends keyof PromotionPageList> = PromotionPageList[T] & ShopSection;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { LandingPage } from './landing-page';
|
|
2
|
+
import { PromotionPage } from './promotion-page';
|
|
1
3
|
import { ShopBanner } from './shop-banner.type';
|
|
2
4
|
import { ShopCarousel } from './shop-carousel.type';
|
|
3
5
|
import { ShopGift } from './shop-gift.type';
|
|
@@ -17,6 +19,8 @@ export type GlampointsVitrineShopSection = [ShopBanner];
|
|
|
17
19
|
export type SimpleLPShopSection = [(ShopBanner & {
|
|
18
20
|
carouselColor?: string;
|
|
19
21
|
})[]];
|
|
22
|
+
export type LandingPageSection = [LandingPage<any>];
|
|
23
|
+
export type PromotionPageSection = [PromotionPage<any>];
|
|
20
24
|
export type SectionList = {
|
|
21
25
|
HomeSection: HomeSection;
|
|
22
26
|
LPClubeShopSection: LPClubeShopSection;
|
|
@@ -27,5 +31,7 @@ export type SectionList = {
|
|
|
27
31
|
PostsShopSection: PostsShopSection;
|
|
28
32
|
GlampointsVitrineShopSection: GlampointsVitrineShopSection;
|
|
29
33
|
SimpleLPShopSection: SimpleLPShopSection;
|
|
34
|
+
LandingPageSection: LandingPageSection;
|
|
35
|
+
PromotionPageSection: PromotionPageSection;
|
|
30
36
|
};
|
|
31
37
|
export type Section<T extends keyof SectionList> = SectionList[T];
|
|
@@ -20,6 +20,7 @@ export declare class User extends BaseModel<User> {
|
|
|
20
20
|
badgeMultiplier?: number;
|
|
21
21
|
dateCreated?: Date;
|
|
22
22
|
dateModified?: Date;
|
|
23
|
+
urlImageProfile?: string;
|
|
23
24
|
beautyProfile?: BeautyProfile;
|
|
24
25
|
static toInstance<T>(this: new () => T, data?: Partial<NonFunctionAndIdentifierProperties<User>>): T;
|
|
25
26
|
toPlain(): Record<string, any>;
|
package/src/infra/hasura-graphql/repositories/catalog/wishlist-hasura-graphql.repository.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Category, CreateRepositoryParams, GetRepositoryParams, Product, Shops, UpdateRepositoryParams, Wishlist, WishlistRepository } from '../../../../domain';
|
|
1
|
+
import { Category, CreateRepositoryParams, FindRepositoryParams, GetRepositoryParams, Product, RepositoryFindResult, Shops, UpdateRepositoryParams, Wishlist, WishlistRepository } from '../../../../domain';
|
|
2
2
|
import { HasuraConstructorParams } from '../../mixins';
|
|
3
3
|
import { CategoryFilterHasuraGraphQLRepository } from './category-filter-hasura-graphql.repository';
|
|
4
4
|
declare const WishlistHasuraGraphQLRepository_base: import("../../../../utils").MixinCtor<import("../..").GraphQLRepository<Wishlist> & import("../../../../domain").CrudRepository<Wishlist, import("../../../../domain").CrudParams<Wishlist>> & import("../../../../domain").UpdateRepository<Wishlist, import("../../../../domain").RepositoryUpdateParams<Wishlist>> & {
|
|
@@ -9,6 +9,7 @@ export declare class WishlistHasuraGraphQLRepository extends WishlistHasuraGraph
|
|
|
9
9
|
constructor({ endpoint, authOptions, interceptors, }: Pick<HasuraConstructorParams<Wishlist>, 'endpoint' | 'authOptions' | 'interceptors'>, categoryFilterRepository: CategoryFilterHasuraGraphQLRepository);
|
|
10
10
|
create(params: CreateRepositoryParams<Wishlist>): Promise<Wishlist>;
|
|
11
11
|
get(identifiers: GetRepositoryParams<Wishlist>): Promise<Wishlist>;
|
|
12
|
+
find(params?: FindRepositoryParams<Wishlist>): Promise<RepositoryFindResult<Wishlist>>;
|
|
12
13
|
update(params: UpdateRepositoryParams<Wishlist>): Promise<Wishlist>;
|
|
13
14
|
getWishlistBySlug(slug: string): Promise<Wishlist>;
|
|
14
15
|
getWishlistByPerson(personId: string): Promise<Wishlist[]>;
|