ctt-puro 0.66.2 → 0.66.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.
@@ -4019,6 +4019,23 @@ class MapperService {
4019
4019
  return false;
4020
4020
  }
4021
4021
  }
4022
+ buildUrl(linkValue) {
4023
+ if (!linkValue)
4024
+ return '';
4025
+ // Si es restaurante, NO añadir prefijo de site
4026
+ const isRestaurant = /restaurante|restaurant/i.test(linkValue);
4027
+ if (isRestaurant) {
4028
+ return linkValue;
4029
+ }
4030
+ let siteUrl = '';
4031
+ if (this.siteId() === 2) {
4032
+ siteUrl = '/purohotels';
4033
+ }
4034
+ else if (this.siteId() === 3) {
4035
+ siteUrl = '/purobeach';
4036
+ }
4037
+ return siteUrl + linkValue;
4038
+ }
4022
4039
  getImageResponsive(image) {
4023
4040
  if (!Utils.isActiveImage(image))
4024
4041
  return undefined;
@@ -5452,7 +5469,8 @@ class MapperService {
5452
5469
  images: this.getArrayImageResponsive(restaurant?.multimedia?.filter((img) => img?.tags?.some((tag) => tag === 'ListRestaurants' ||
5453
5470
  tag?.name === 'ListRestaurants'))),
5454
5471
  buttons: [
5455
- Utils.mapButtons(1, restaurant?.buttons?.filter((btn) => btn?.linkType === 'self_link' || btn?.linkType === 'external_link')),
5472
+ Utils.mapButtons(1, restaurant?.buttons?.filter((btn) => btn?.linkType === 'self_link' ||
5473
+ btn?.linkType === 'external_link')),
5456
5474
  ],
5457
5475
  ...(restaurant?.logos?.length
5458
5476
  ? {
@@ -5820,20 +5838,12 @@ class MapperService {
5820
5838
  }
5821
5839
  mapSubmenu(props) {
5822
5840
  const selected = props?.items?.find((item) => item.selected);
5823
- let siteUrl = '';
5824
- if (this.siteId() === 2) {
5825
- siteUrl = '/purohotels';
5826
- }
5827
- else if (this.siteId() === 3) {
5828
- siteUrl = '/purobeach';
5829
- }
5830
5841
  const submenu = {
5831
- // hotel: props?.hotel,
5832
5842
  items: props?.items
5833
5843
  ?.filter((item) => item.active)
5834
5844
  ?.map((link) => ({
5835
5845
  label: link?.name,
5836
- url: siteUrl + link?.linkValue,
5846
+ url: this.buildUrl(link?.linkValue),
5837
5847
  linkType: 'internal',
5838
5848
  icon: link?.icon,
5839
5849
  mobile: link?.mobile,
@@ -5842,21 +5852,20 @@ class MapperService {
5842
5852
  ?.filter((item) => item.active && !item.mobile)
5843
5853
  ?.map((link) => ({
5844
5854
  label: link?.name,
5845
- url: siteUrl + link?.linkValue,
5855
+ url: this.buildUrl(link?.linkValue),
5846
5856
  linkType: 'internal',
5847
5857
  icon: link?.icon,
5848
5858
  mobile: link?.mobile,
5849
5859
  })),
5850
5860
  selected: {
5851
5861
  label: selected?.name,
5852
- url: selected?.linkValue,
5862
+ url: this.buildUrl(selected?.linkValue),
5853
5863
  },
5854
5864
  bottomLinks: props?.items
5855
- ?.filter((item) => item.active)
5856
- ?.filter((item) => item.mobile)
5865
+ ?.filter((item) => item.active && item.mobile)
5857
5866
  ?.map((link) => ({
5858
5867
  label: link?.name,
5859
- url: siteUrl + link?.linkValue,
5868
+ url: this.buildUrl(link?.linkValue),
5860
5869
  linkType: 'internal',
5861
5870
  })),
5862
5871
  };