@infrab4a/connect 4.2.1-beta.1 → 4.2.2

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 CHANGED
@@ -4595,14 +4595,18 @@ 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
+ await this.mutation('delete_category_product', ['affected_rows'], {
4599
+ where: {
4600
+ type: 'category_product_bool_exp',
4601
+ required: true,
4602
+ value: { category_id: { _eq: categoryId } },
4603
+ },
4604
+ });
4599
4605
  await this.mutation('insert_category_product', ['affected_rows'], {
4600
4606
  objects: {
4601
4607
  type: '[category_product_insert_input!]',
4602
4608
  required: true,
4603
- value: plainData.products
4604
- .filter((productId) => !category.products.includes(productId))
4605
- .map((productId) => ({ category_id: categoryId, product_id: productId })),
4609
+ value: plainData.products.map((productId) => ({ category_id: categoryId, product_id: productId })),
4606
4610
  },
4607
4611
  });
4608
4612
  return plainData.products;
@@ -4640,14 +4644,15 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
4640
4644
  },
4641
4645
  })
4642
4646
  .then((res) => res.data);
4643
- const currentFiltersId = currentFilters.map((f) => f.filterId);
4647
+ const currentFiltersId = currentFilters.map((f) => f.id);
4644
4648
  const filtersUpdatedId = filters.value.map((f) => f.id);
4645
4649
  const filterToBeDeleted = currentFiltersId.filter((c) => !filtersUpdatedId.includes(c));
4646
4650
  const filterToBeInserted = filtersUpdatedId.filter((c) => !currentFiltersId.includes(c));
4647
4651
  for (const filter of filterToBeDeleted) {
4648
4652
  const index = currentFilters.findIndex((f) => f.id == filter);
4649
- if (index != -1)
4653
+ if (index != -1) {
4650
4654
  currentFilters.splice(index, 1);
4655
+ }
4651
4656
  await this.categoryFilterRepository.deleteByCategoryAndFilter(categoryId, filter);
4652
4657
  }
4653
4658
  for (const filter of filterToBeInserted) {
@@ -5556,15 +5561,19 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5556
5561
  const plainData = this.paramsToPlain({ products });
5557
5562
  if (!plainData.products || plainData.products.length <= 0)
5558
5563
  return [];
5559
- const category = await this.get({ id: categoryId.toString() });
5564
+ await this.mutation('delete_category_product', ['affected_rows'], {
5565
+ where: {
5566
+ type: 'category_product_bool_exp',
5567
+ required: true,
5568
+ value: { category_id: { _eq: categoryId } },
5569
+ },
5570
+ });
5560
5571
  await this.categoryFilterRepository.deleteByCategory(categoryId);
5561
5572
  await this.mutation('insert_category_product', ['affected_rows'], {
5562
5573
  objects: {
5563
5574
  type: '[category_product_insert_input!]',
5564
5575
  required: true,
5565
- value: plainData.products
5566
- .filter((productId) => !category.products.includes(productId))
5567
- .map((productId) => ({ category_id: categoryId, product_id: productId })),
5576
+ value: plainData.products.map((productId) => ({ category_id: categoryId, product_id: productId })),
5568
5577
  },
5569
5578
  });
5570
5579
  return plainData.products;
package/index.esm.js CHANGED
@@ -4571,14 +4571,18 @@ 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
+ await this.mutation('delete_category_product', ['affected_rows'], {
4575
+ where: {
4576
+ type: 'category_product_bool_exp',
4577
+ required: true,
4578
+ value: { category_id: { _eq: categoryId } },
4579
+ },
4580
+ });
4575
4581
  await this.mutation('insert_category_product', ['affected_rows'], {
4576
4582
  objects: {
4577
4583
  type: '[category_product_insert_input!]',
4578
4584
  required: true,
4579
- value: plainData.products
4580
- .filter((productId) => !category.products.includes(productId))
4581
- .map((productId) => ({ category_id: categoryId, product_id: productId })),
4585
+ value: plainData.products.map((productId) => ({ category_id: categoryId, product_id: productId })),
4582
4586
  },
4583
4587
  });
4584
4588
  return plainData.products;
@@ -4616,14 +4620,15 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
4616
4620
  },
4617
4621
  })
4618
4622
  .then((res) => res.data);
4619
- const currentFiltersId = currentFilters.map((f) => f.filterId);
4623
+ const currentFiltersId = currentFilters.map((f) => f.id);
4620
4624
  const filtersUpdatedId = filters.value.map((f) => f.id);
4621
4625
  const filterToBeDeleted = currentFiltersId.filter((c) => !filtersUpdatedId.includes(c));
4622
4626
  const filterToBeInserted = filtersUpdatedId.filter((c) => !currentFiltersId.includes(c));
4623
4627
  for (const filter of filterToBeDeleted) {
4624
4628
  const index = currentFilters.findIndex((f) => f.id == filter);
4625
- if (index != -1)
4629
+ if (index != -1) {
4626
4630
  currentFilters.splice(index, 1);
4631
+ }
4627
4632
  await this.categoryFilterRepository.deleteByCategoryAndFilter(categoryId, filter);
4628
4633
  }
4629
4634
  for (const filter of filterToBeInserted) {
@@ -5532,15 +5537,19 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5532
5537
  const plainData = this.paramsToPlain({ products });
5533
5538
  if (!plainData.products || plainData.products.length <= 0)
5534
5539
  return [];
5535
- const category = await this.get({ id: categoryId.toString() });
5540
+ await this.mutation('delete_category_product', ['affected_rows'], {
5541
+ where: {
5542
+ type: 'category_product_bool_exp',
5543
+ required: true,
5544
+ value: { category_id: { _eq: categoryId } },
5545
+ },
5546
+ });
5536
5547
  await this.categoryFilterRepository.deleteByCategory(categoryId);
5537
5548
  await this.mutation('insert_category_product', ['affected_rows'], {
5538
5549
  objects: {
5539
5550
  type: '[category_product_insert_input!]',
5540
5551
  required: true,
5541
- value: plainData.products
5542
- .filter((productId) => !category.products.includes(productId))
5543
- .map((productId) => ({ category_id: categoryId, product_id: productId })),
5552
+ value: plainData.products.map((productId) => ({ category_id: categoryId, product_id: productId })),
5544
5553
  },
5545
5554
  });
5546
5555
  return plainData.products;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "4.2.1-beta.1",
3
+ "version": "4.2.2",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -0,0 +1,3 @@
1
+ export interface BrandsCarousel {
2
+ carouselColor?: string;
3
+ }
@@ -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];