@infrab4a/connect 4.2.1-beta.0 → 4.2.2-beta.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/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;
@@ -5557,15 +5561,19 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5557
5561
  const plainData = this.paramsToPlain({ products });
5558
5562
  if (!plainData.products || plainData.products.length <= 0)
5559
5563
  return [];
5560
- 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
+ });
5561
5571
  await this.categoryFilterRepository.deleteByCategory(categoryId);
5562
5572
  await this.mutation('insert_category_product', ['affected_rows'], {
5563
5573
  objects: {
5564
5574
  type: '[category_product_insert_input!]',
5565
5575
  required: true,
5566
- value: plainData.products
5567
- .filter((productId) => !category.products.includes(productId))
5568
- .map((productId) => ({ category_id: categoryId, product_id: productId })),
5576
+ value: plainData.products.map((productId) => ({ category_id: categoryId, product_id: productId })),
5569
5577
  },
5570
5578
  });
5571
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;
@@ -5533,15 +5537,19 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5533
5537
  const plainData = this.paramsToPlain({ products });
5534
5538
  if (!plainData.products || plainData.products.length <= 0)
5535
5539
  return [];
5536
- 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
+ });
5537
5547
  await this.categoryFilterRepository.deleteByCategory(categoryId);
5538
5548
  await this.mutation('insert_category_product', ['affected_rows'], {
5539
5549
  objects: {
5540
5550
  type: '[category_product_insert_input!]',
5541
5551
  required: true,
5542
- value: plainData.products
5543
- .filter((productId) => !category.products.includes(productId))
5544
- .map((productId) => ({ category_id: categoryId, product_id: productId })),
5552
+ value: plainData.products.map((productId) => ({ category_id: categoryId, product_id: productId })),
5545
5553
  },
5546
5554
  });
5547
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.0",
3
+ "version": "4.2.2-beta.0",
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];