@triptease/tt-navbar 0.0.53 → 0.0.55

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @triptease/tt-navbar v0.0.53
2
+ * @triptease/tt-navbar v0.0.55
3
3
  */
4
4
 
5
5
  // src/Config.ts
@@ -1,4 +1,4 @@
1
1
  /**
2
- * @triptease/tt-navbar v0.0.53
2
+ * @triptease/tt-navbar v0.0.55
3
3
  */
4
4
  //# sourceMappingURL=global.d.js.map
package/dist/web/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @triptease/tt-navbar v0.0.53
2
+ * @triptease/tt-navbar v0.0.55
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1909,6 +1909,7 @@ var styles2 = i`
1909
1909
  display: flex;
1910
1910
  align-items: center;
1911
1911
  padding: var(--space-scale-1) 0;
1912
+ margin-bottom: var(--space-scale-2);
1912
1913
  }
1913
1914
 
1914
1915
  #client-selector tt-combobox {
@@ -1949,23 +1950,14 @@ var tripteaseLogo = `<svg width="112" height="32" viewBox="0 0 112 32" fill="no
1949
1950
 
1950
1951
  // src/urlMappings.ts
1951
1952
  var urlMappings = {
1952
- "/paidsearch/$CLIENT_KEY/performance": "/channels",
1953
- "/meta/$CLIENT_KEY/performance": "/channels",
1954
- "/retargeting/$CLIENT_KEY/performance": "/channels",
1955
- "/retargeting/$CLIENT_KEY/ad-config": "/channels",
1956
- "/messages/$CLIENT_KEY/messages": "/channels",
1957
- "/messages/$CLIENT_KEY/messages/wizard": "/channels",
1958
- "/messages/$CLIENT_KEY/messages/type": "/channels",
1959
- "/messages/$CLIENT_KEY/messages/notifications": "/channels",
1960
- "/messages/$CLIENT_KEY/messages/templates/nudge": "/channels",
1961
- "/$CLIENT_KEY/email": "/channels",
1962
- "/pricematch/$CLIENT_KEY/performance": "/channels",
1963
- "/chat/insights/$CLIENT_KEY": "/channels",
1964
- "/settings/$CLIENT_KEY/branding": "/settings/$CLIENT_KEY/guides",
1965
- "/settings/$CLIENT_KEY/price-check": "/settings/$CLIENT_KEY/guides",
1966
- "/settings/$CLIENT_KEY/price-config": "/settings/$CLIENT_KEY/guides",
1967
- "/settings/$CLIENT_KEY/hotel-details-finder": "/settings/$CLIENT_KEY/guides",
1968
- "/settings/$CLIENT_KEY/deactivation-center": "/settings/$CLIENT_KEY/guides"
1953
+ "/paidsearch/:clientKey/*": "/channels",
1954
+ "/meta/:clientKey/*": "/channels",
1955
+ "/retargeting/:clientKey/*": "/channels",
1956
+ "/messages/:clientKey/*": "/channels",
1957
+ "/:clientKey/email": "/channels",
1958
+ "/pricematch/:clientKey/*": "/channels",
1959
+ "/chat/insights/:clientKey": "/channels",
1960
+ "/settings/:clientKey/*": "/settings/$CLIENT_KEY/guides"
1969
1961
  };
1970
1962
 
1971
1963
  // src/Routes.ts
@@ -2021,14 +2013,17 @@ var TtNavbar = class extends i4 {
2021
2013
  let bestMatch;
2022
2014
  let bestMatchLength = 0;
2023
2015
  if (this.activeRoute === Routes.CampaignManager) {
2024
- const links = Object.values(this.allNavLinks);
2025
- bestMatch = links.find((link) => link.id === Routes.CampaignManager);
2016
+ bestMatch = this.campaignManagerLink;
2026
2017
  }
2027
2018
  if (!bestMatch && this.clientKey) {
2028
2019
  const parsedPath = currentPath.replace(this.clientKey, "$CLIENT_KEY");
2029
- const mappedUrl = urlMappings[parsedPath];
2020
+ let mappedUrl = urlMappings[parsedPath];
2021
+ const matchedPattern = this.mappedUrlPatterns.find((pattern) => pattern.test(currentPath, window.location.origin))?.pathname;
2022
+ if (matchedPattern) {
2023
+ mappedUrl = urlMappings[matchedPattern];
2024
+ }
2030
2025
  if (mappedUrl) {
2031
- const clientSpecificUrl = mappedUrl.includes("$CLIENT_KEY") ? mappedUrl.replace("$CLIENT_KEY", this.clientKey) : mappedUrl;
2026
+ const clientSpecificUrl = mappedUrl.replace("$CLIENT_KEY", this.clientKey);
2032
2027
  const links = Object.values(this.allNavLinks);
2033
2028
  bestMatch = links.find((link) => link.href.includes(clientSpecificUrl));
2034
2029
  }
@@ -2127,6 +2122,10 @@ var TtNavbar = class extends i4 {
2127
2122
  window.removeEventListener("tetris:navigate", this.setActiveState);
2128
2123
  super.disconnectedCallback();
2129
2124
  }
2125
+ // eslint-disable-next-line no-undef
2126
+ get mappedUrlPatterns() {
2127
+ return Object.keys(urlMappings).map((pattern) => new URLPattern({ pathname: pattern, baseURL: window.location.origin }));
2128
+ }
2130
2129
  render() {
2131
2130
  return x`
2132
2131
  <nav id=${this.id} class="${this.isOpen ? "" : "sidebar-closed"}">
@@ -2369,6 +2368,9 @@ __decorateClass([
2369
2368
  __decorateClass([
2370
2369
  r6("a")
2371
2370
  ], TtNavbar.prototype, "allNavLinks", 2);
2371
+ __decorateClass([
2372
+ e5(`a#${Routes.CampaignManager}`)
2373
+ ], TtNavbar.prototype, "campaignManagerLink", 2);
2372
2374
 
2373
2375
  // src/getInitialNavbarState.ts
2374
2376
  var getInitialNavbarState = (cookieString) => {