@infrab4a/connect 5.5.5-beta.0 → 5.5.6-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
@@ -2410,21 +2410,24 @@ var ShopPageSectionType;
2410
2410
  (function (ShopPageSectionType) {
2411
2411
  ShopPageSectionType["LIVE"] = "LIVE";
2412
2412
  ShopPageSectionType["CAROUSEL"] = "CAROUSEL";
2413
+ ShopPageSectionType["BANNER"] = "BANNER";
2413
2414
  ShopPageSectionType["INFOBARS"] = "INFOBARS";
2414
2415
  ShopPageSectionType["HIGHLIGHTS"] = "HIGHLIGHTS";
2415
2416
  ShopPageSectionType["SUBSCRIBER_INFO"] = "SUBSCRIBER_INFO";
2416
2417
  ShopPageSectionType["COLLECTION"] = "COLLECTION";
2418
+ ShopPageSectionType["BEAUTY_PROFILE_COLLECTION"] = "BEAUTY_PROFILE_COLLECTION";
2417
2419
  ShopPageSectionType["PLANS"] = "PLANS";
2418
2420
  ShopPageSectionType["SINGLE_PLAN"] = "SINGLE_PLAN";
2419
2421
  ShopPageSectionType["BRANDS"] = "BRANDS";
2420
2422
  ShopPageSectionType["NEWSLETTER"] = "NEWSLETTER";
2421
2423
  })(ShopPageSectionType || (ShopPageSectionType = {}));
2422
2424
 
2425
+ /* eslint-disable max-lines-per-function */
2423
2426
  class ShopSettings extends BaseModel {
2424
2427
  static get identifiersFields() {
2425
2428
  return ['id'];
2426
2429
  }
2427
- pageSections(displayRules) {
2430
+ getPageSections(displayRules) {
2428
2431
  const now = new Date();
2429
2432
  return (Array.isArray(this.sections) ? this.sections : [])
2430
2433
  .map((section) => {
@@ -2433,7 +2436,7 @@ class ShopSettings extends BaseModel {
2433
2436
  const filteredBanners = section.banners.filter((banner) => {
2434
2437
  // Filtra por displayRules
2435
2438
  const rulesMatch = banner.displayRules
2436
- ? Object.keys(displayRules).every((key) => banner.displayRules && banner.displayRules[key] === displayRules[key])
2439
+ ? Object.keys(displayRules).some((key) => banner.displayRules && banner.displayRules[key] === displayRules[key])
2437
2440
  : true;
2438
2441
  // Filtra por publishDate e expirationDate
2439
2442
  const publishOk = !banner.publishDate || now >= new Date(banner.publishDate);
@@ -2442,15 +2445,38 @@ class ShopSettings extends BaseModel {
2442
2445
  });
2443
2446
  return { ...section, banners: filteredBanners };
2444
2447
  }
2448
+ // Filtra highlights
2449
+ if (section.type === ShopPageSectionType.HIGHLIGHTS && Array.isArray(section.highlights)) {
2450
+ const filteredHighlights = section.highlights.filter((highlight) => {
2451
+ // Filtra por displayRules
2452
+ const rulesMatch = highlight.displayRules
2453
+ ? Object.keys(displayRules).some((key) => highlight.displayRules && highlight.displayRules[key] === displayRules[key])
2454
+ : true;
2455
+ return rulesMatch;
2456
+ });
2457
+ return { ...section, highlights: filteredHighlights };
2458
+ }
2445
2459
  // Filtra collections
2446
2460
  if (section.type === ShopPageSectionType.COLLECTION) {
2447
2461
  const rulesMatch = section.displayRules
2448
- ? Object.keys(displayRules).every((key) => section.displayRules && section.displayRules[key] === displayRules[key])
2462
+ ? Object.keys(displayRules).some((key) => section.displayRules && section.displayRules[key] === displayRules[key])
2449
2463
  : true;
2450
2464
  const publishOk = !section.publishDate || now >= new Date(section.publishDate);
2451
2465
  const expireOk = !section.expirationDate || now <= new Date(section.expirationDate);
2452
2466
  return rulesMatch && publishOk && expireOk ? section : null;
2453
2467
  }
2468
+ // Filtra banners
2469
+ if (section.type === ShopPageSectionType.BANNER) {
2470
+ const rulesMatch = section.displayRules
2471
+ ? Object.keys(displayRules).some((key) => section.displayRules && section.displayRules[key] === displayRules[key])
2472
+ : true;
2473
+ const publishOk = !section.publishDate || now >= new Date(section.publishDate);
2474
+ const expireOk = !section.expirationDate || now <= new Date(section.expirationDate);
2475
+ return rulesMatch && publishOk && expireOk ? section : null;
2476
+ }
2477
+ if (section.type === ShopPageSectionType.LIVE) {
2478
+ return section.active ? section : null;
2479
+ }
2454
2480
  // Demais seções retornam normalmente
2455
2481
  return section;
2456
2482
  })
@@ -9755,6 +9781,7 @@ class MercadoPagoCardAxiosAdapter {
9755
9781
  limiteRange: 'day',
9756
9782
  card,
9757
9783
  gatewayInfo: {
9784
+ gateway: exports.PaymentProviders.MERCADOPAGO,
9758
9785
  status: data.status,
9759
9786
  statusDetail: data.status_detail,
9760
9787
  },
@@ -10770,6 +10797,7 @@ class PagarmeV5CardAxiosAdapter {
10770
10797
  card,
10771
10798
  orderBlockedRepository: this.orderBlockedRepository,
10772
10799
  gatewayInfo: {
10800
+ gateway: exports.PaymentProviders.PAGARME,
10773
10801
  status: charge.status,
10774
10802
  statusDetail: charge.last_transaction?.status,
10775
10803
  },
package/index.esm.js CHANGED
@@ -2386,21 +2386,24 @@ var ShopPageSectionType;
2386
2386
  (function (ShopPageSectionType) {
2387
2387
  ShopPageSectionType["LIVE"] = "LIVE";
2388
2388
  ShopPageSectionType["CAROUSEL"] = "CAROUSEL";
2389
+ ShopPageSectionType["BANNER"] = "BANNER";
2389
2390
  ShopPageSectionType["INFOBARS"] = "INFOBARS";
2390
2391
  ShopPageSectionType["HIGHLIGHTS"] = "HIGHLIGHTS";
2391
2392
  ShopPageSectionType["SUBSCRIBER_INFO"] = "SUBSCRIBER_INFO";
2392
2393
  ShopPageSectionType["COLLECTION"] = "COLLECTION";
2394
+ ShopPageSectionType["BEAUTY_PROFILE_COLLECTION"] = "BEAUTY_PROFILE_COLLECTION";
2393
2395
  ShopPageSectionType["PLANS"] = "PLANS";
2394
2396
  ShopPageSectionType["SINGLE_PLAN"] = "SINGLE_PLAN";
2395
2397
  ShopPageSectionType["BRANDS"] = "BRANDS";
2396
2398
  ShopPageSectionType["NEWSLETTER"] = "NEWSLETTER";
2397
2399
  })(ShopPageSectionType || (ShopPageSectionType = {}));
2398
2400
 
2401
+ /* eslint-disable max-lines-per-function */
2399
2402
  class ShopSettings extends BaseModel {
2400
2403
  static get identifiersFields() {
2401
2404
  return ['id'];
2402
2405
  }
2403
- pageSections(displayRules) {
2406
+ getPageSections(displayRules) {
2404
2407
  const now = new Date();
2405
2408
  return (Array.isArray(this.sections) ? this.sections : [])
2406
2409
  .map((section) => {
@@ -2409,7 +2412,7 @@ class ShopSettings extends BaseModel {
2409
2412
  const filteredBanners = section.banners.filter((banner) => {
2410
2413
  // Filtra por displayRules
2411
2414
  const rulesMatch = banner.displayRules
2412
- ? Object.keys(displayRules).every((key) => banner.displayRules && banner.displayRules[key] === displayRules[key])
2415
+ ? Object.keys(displayRules).some((key) => banner.displayRules && banner.displayRules[key] === displayRules[key])
2413
2416
  : true;
2414
2417
  // Filtra por publishDate e expirationDate
2415
2418
  const publishOk = !banner.publishDate || now >= new Date(banner.publishDate);
@@ -2418,15 +2421,38 @@ class ShopSettings extends BaseModel {
2418
2421
  });
2419
2422
  return { ...section, banners: filteredBanners };
2420
2423
  }
2424
+ // Filtra highlights
2425
+ if (section.type === ShopPageSectionType.HIGHLIGHTS && Array.isArray(section.highlights)) {
2426
+ const filteredHighlights = section.highlights.filter((highlight) => {
2427
+ // Filtra por displayRules
2428
+ const rulesMatch = highlight.displayRules
2429
+ ? Object.keys(displayRules).some((key) => highlight.displayRules && highlight.displayRules[key] === displayRules[key])
2430
+ : true;
2431
+ return rulesMatch;
2432
+ });
2433
+ return { ...section, highlights: filteredHighlights };
2434
+ }
2421
2435
  // Filtra collections
2422
2436
  if (section.type === ShopPageSectionType.COLLECTION) {
2423
2437
  const rulesMatch = section.displayRules
2424
- ? Object.keys(displayRules).every((key) => section.displayRules && section.displayRules[key] === displayRules[key])
2438
+ ? Object.keys(displayRules).some((key) => section.displayRules && section.displayRules[key] === displayRules[key])
2425
2439
  : true;
2426
2440
  const publishOk = !section.publishDate || now >= new Date(section.publishDate);
2427
2441
  const expireOk = !section.expirationDate || now <= new Date(section.expirationDate);
2428
2442
  return rulesMatch && publishOk && expireOk ? section : null;
2429
2443
  }
2444
+ // Filtra banners
2445
+ if (section.type === ShopPageSectionType.BANNER) {
2446
+ const rulesMatch = section.displayRules
2447
+ ? Object.keys(displayRules).some((key) => section.displayRules && section.displayRules[key] === displayRules[key])
2448
+ : true;
2449
+ const publishOk = !section.publishDate || now >= new Date(section.publishDate);
2450
+ const expireOk = !section.expirationDate || now <= new Date(section.expirationDate);
2451
+ return rulesMatch && publishOk && expireOk ? section : null;
2452
+ }
2453
+ if (section.type === ShopPageSectionType.LIVE) {
2454
+ return section.active ? section : null;
2455
+ }
2430
2456
  // Demais seções retornam normalmente
2431
2457
  return section;
2432
2458
  })
@@ -9731,6 +9757,7 @@ class MercadoPagoCardAxiosAdapter {
9731
9757
  limiteRange: 'day',
9732
9758
  card,
9733
9759
  gatewayInfo: {
9760
+ gateway: PaymentProviders.MERCADOPAGO,
9734
9761
  status: data.status,
9735
9762
  statusDetail: data.status_detail,
9736
9763
  },
@@ -10746,6 +10773,7 @@ class PagarmeV5CardAxiosAdapter {
10746
10773
  card,
10747
10774
  orderBlockedRepository: this.orderBlockedRepository,
10748
10775
  gatewayInfo: {
10776
+ gateway: PaymentProviders.PAGARME,
10749
10777
  status: charge.status,
10750
10778
  statusDetail: charge.last_transaction?.status,
10751
10779
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "5.5.5-beta.0",
3
+ "version": "5.5.6-beta.0",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -14,5 +14,5 @@ export declare class ShopSettings extends BaseModel<ShopSettings> {
14
14
  hasMultiples?: boolean;
15
15
  pagePath?: string;
16
16
  static get identifiersFields(): GenericIdentifier[];
17
- pageSections(displayRules: DisplayRules): SectionUnion[];
17
+ getPageSections(displayRules: DisplayRules): SectionUnion[];
18
18
  }
@@ -1,18 +1,21 @@
1
1
  export type ShopPageSection = Array<SectionUnion>;
2
- export type SectionUnion = SectionLive | SectionCarousel | SectionInfobars | SectionHighlights | SectionSubscriberInfo | SectionCollection | SectionPlans | SectionSinglePlan | SectionBrands | SectionNewsletter;
2
+ export type SectionUnion = SectionLive | SectionCarousel | SectionBanner | SectionInfobars | SectionHighlights | SectionSubscriberInfo | SectionCollection | SectionBeautyProfileCollection | SectionPlans | SectionSinglePlan | SectionBrands | SectionNewsletter;
3
3
  export declare enum ShopPageSectionType {
4
4
  LIVE = "LIVE",
5
5
  CAROUSEL = "CAROUSEL",
6
+ BANNER = "BANNER",
6
7
  INFOBARS = "INFOBARS",
7
8
  HIGHLIGHTS = "HIGHLIGHTS",
8
9
  SUBSCRIBER_INFO = "SUBSCRIBER_INFO",
9
10
  COLLECTION = "COLLECTION",
11
+ BEAUTY_PROFILE_COLLECTION = "BEAUTY_PROFILE_COLLECTION",
10
12
  PLANS = "PLANS",
11
13
  SINGLE_PLAN = "SINGLE_PLAN",
12
14
  BRANDS = "BRANDS",
13
15
  NEWSLETTER = "NEWSLETTER"
14
16
  }
15
17
  export type SectionLive = {
18
+ id: string;
16
19
  type: ShopPageSectionType.LIVE;
17
20
  fixed: boolean;
18
21
  editable: boolean;
@@ -21,41 +24,51 @@ export type SectionLive = {
21
24
  active: boolean;
22
25
  };
23
26
  export type SectionCarousel = {
27
+ id: string;
24
28
  type: ShopPageSectionType.CAROUSEL;
25
29
  fixed: boolean;
26
30
  editable: boolean;
27
31
  banners: Banner[];
28
32
  };
29
33
  export type SectionInfobars = {
34
+ id: string;
30
35
  type: ShopPageSectionType.INFOBARS;
31
36
  fixed: boolean;
32
37
  editable: boolean;
33
38
  infobars: Infobar[];
34
39
  };
35
40
  export type Infobar = {
41
+ id: string;
36
42
  link: string;
37
43
  text: string;
38
44
  active: boolean;
39
45
  };
40
46
  export type SectionHighlights = {
47
+ id: string;
41
48
  type: ShopPageSectionType.HIGHLIGHTS;
42
49
  fixed: boolean;
43
50
  editable: boolean;
44
51
  highlights: Highlight[];
45
52
  };
46
53
  export type Highlight = {
54
+ id: string;
47
55
  title: string;
56
+ subtitle: string;
48
57
  link: string;
49
58
  image: string;
50
59
  altText: string;
51
60
  highlighted: boolean;
61
+ starred: boolean;
62
+ displayRules?: DisplayRules;
52
63
  };
53
64
  export type SectionSubscriberInfo = {
65
+ id: string;
54
66
  type: ShopPageSectionType.SUBSCRIBER_INFO;
55
67
  fixed: boolean;
56
68
  editable: boolean;
57
69
  };
58
70
  export type Banner = {
71
+ id: string;
59
72
  mobileImage: string;
60
73
  desktopImage: string;
61
74
  link: string;
@@ -65,7 +78,13 @@ export type Banner = {
65
78
  publishDate?: Date;
66
79
  expirationDate?: Date;
67
80
  };
81
+ export type SectionBanner = Banner & {
82
+ type: ShopPageSectionType.BANNER;
83
+ fixed: boolean;
84
+ editable: boolean;
85
+ };
68
86
  export type SectionCollection = {
87
+ id: string;
69
88
  type: ShopPageSectionType.COLLECTION;
70
89
  fixed: boolean;
71
90
  editable: boolean;
@@ -76,23 +95,33 @@ export type SectionCollection = {
76
95
  publishDate?: Date;
77
96
  expirationDate?: Date;
78
97
  };
98
+ export type SectionBeautyProfileCollection = {
99
+ id: string;
100
+ type: ShopPageSectionType.BEAUTY_PROFILE_COLLECTION;
101
+ fixed: boolean;
102
+ editable: boolean;
103
+ };
79
104
  export type DisplayRules = {
80
105
  subscriberBuyer: boolean;
81
106
  notSubscriber: boolean;
82
107
  subscriberNotBuyer: boolean;
83
108
  topBadgeSubscriber: boolean;
109
+ beautyProfile?: boolean;
84
110
  };
85
111
  export type SectionPlans = {
112
+ id: string;
86
113
  type: ShopPageSectionType.PLANS;
87
114
  fixed: boolean;
88
115
  editable: boolean;
89
116
  };
90
117
  export type SectionSinglePlan = {
118
+ id: string;
91
119
  type: ShopPageSectionType.SINGLE_PLAN;
92
120
  fixed: boolean;
93
121
  editable: boolean;
94
122
  };
95
123
  export type SectionBrands = {
124
+ id: string;
96
125
  type: ShopPageSectionType.BRANDS;
97
126
  fixed: boolean;
98
127
  editable: boolean;
@@ -105,6 +134,7 @@ export type SectionBrands = {
105
134
  ];
106
135
  };
107
136
  export type SectionNewsletter = {
137
+ id: string;
108
138
  type: ShopPageSectionType.NEWSLETTER;
109
139
  fixed: boolean;
110
140
  editable: boolean;
@@ -19,7 +19,11 @@ export declare class OrderBlocked extends BaseModel<OrderBlocked> {
19
19
  type: OrderBlockedType;
20
20
  card?: any;
21
21
  checkout: Checkout;
22
- gatewayInfo?: any;
22
+ gatewayInfo?: {
23
+ gateway?: string;
24
+ status?: string;
25
+ statusDetail?: string;
26
+ };
23
27
  date: Date;
24
28
  static get identifiersFields(): GenericIdentifier[];
25
29
  }
@@ -7,7 +7,11 @@ type CreateBlockedOrderParams = {
7
7
  type: string;
8
8
  limiteRange: string;
9
9
  card?: PaymentCardInfo;
10
- gatewayInfo?: any;
10
+ gatewayInfo?: {
11
+ gateway?: string;
12
+ status?: string;
13
+ statusDetail?: string;
14
+ };
11
15
  };
12
16
  export interface OrderBlockedRepository extends CrudRepository<OrderBlocked> {
13
17
  createBlockedOrderOrPayment(params: CreateBlockedOrderParams): Promise<OrderBlocked>;
@@ -6,6 +6,7 @@ interface BlockedOrderParams {
6
6
  card: PaymentCardInfo;
7
7
  orderBlockedRepository: OrderBlockedRepository;
8
8
  gatewayInfo?: {
9
+ gateway: string;
9
10
  status: string;
10
11
  statusDetail: string;
11
12
  };