@triptease/tt-navbar 0.0.54 → 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.54
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.54
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.54
2
+ * @triptease/tt-navbar v0.0.55
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1950,23 +1950,14 @@ var tripteaseLogo = `<svg width="112" height="32" viewBox="0 0 112 32" fill="no
1950
1950
 
1951
1951
  // src/urlMappings.ts
1952
1952
  var urlMappings = {
1953
- "/paidsearch/$CLIENT_KEY/performance": "/channels",
1954
- "/meta/$CLIENT_KEY/performance": "/channels",
1955
- "/retargeting/$CLIENT_KEY/performance": "/channels",
1956
- "/retargeting/$CLIENT_KEY/ad-config": "/channels",
1957
- "/messages/$CLIENT_KEY/messages": "/channels",
1958
- "/messages/$CLIENT_KEY/messages/wizard": "/channels",
1959
- "/messages/$CLIENT_KEY/messages/type": "/channels",
1960
- "/messages/$CLIENT_KEY/messages/notifications": "/channels",
1961
- "/messages/$CLIENT_KEY/messages/templates/nudge": "/channels",
1962
- "/$CLIENT_KEY/email": "/channels",
1963
- "/pricematch/$CLIENT_KEY/performance": "/channels",
1964
- "/chat/insights/$CLIENT_KEY": "/channels",
1965
- "/settings/$CLIENT_KEY/branding": "/settings/$CLIENT_KEY/guides",
1966
- "/settings/$CLIENT_KEY/price-check": "/settings/$CLIENT_KEY/guides",
1967
- "/settings/$CLIENT_KEY/price-config": "/settings/$CLIENT_KEY/guides",
1968
- "/settings/$CLIENT_KEY/hotel-details-finder": "/settings/$CLIENT_KEY/guides",
1969
- "/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"
1970
1961
  };
1971
1962
 
1972
1963
  // src/Routes.ts
@@ -2022,14 +2013,17 @@ var TtNavbar = class extends i4 {
2022
2013
  let bestMatch;
2023
2014
  let bestMatchLength = 0;
2024
2015
  if (this.activeRoute === Routes.CampaignManager) {
2025
- const links = Object.values(this.allNavLinks);
2026
- bestMatch = links.find((link) => link.id === Routes.CampaignManager);
2016
+ bestMatch = this.campaignManagerLink;
2027
2017
  }
2028
2018
  if (!bestMatch && this.clientKey) {
2029
2019
  const parsedPath = currentPath.replace(this.clientKey, "$CLIENT_KEY");
2030
- 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
+ }
2031
2025
  if (mappedUrl) {
2032
- const clientSpecificUrl = mappedUrl.includes("$CLIENT_KEY") ? mappedUrl.replace("$CLIENT_KEY", this.clientKey) : mappedUrl;
2026
+ const clientSpecificUrl = mappedUrl.replace("$CLIENT_KEY", this.clientKey);
2033
2027
  const links = Object.values(this.allNavLinks);
2034
2028
  bestMatch = links.find((link) => link.href.includes(clientSpecificUrl));
2035
2029
  }
@@ -2128,6 +2122,10 @@ var TtNavbar = class extends i4 {
2128
2122
  window.removeEventListener("tetris:navigate", this.setActiveState);
2129
2123
  super.disconnectedCallback();
2130
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
+ }
2131
2129
  render() {
2132
2130
  return x`
2133
2131
  <nav id=${this.id} class="${this.isOpen ? "" : "sidebar-closed"}">
@@ -2370,6 +2368,9 @@ __decorateClass([
2370
2368
  __decorateClass([
2371
2369
  r6("a")
2372
2370
  ], TtNavbar.prototype, "allNavLinks", 2);
2371
+ __decorateClass([
2372
+ e5(`a#${Routes.CampaignManager}`)
2373
+ ], TtNavbar.prototype, "campaignManagerLink", 2);
2373
2374
 
2374
2375
  // src/getInitialNavbarState.ts
2375
2376
  var getInitialNavbarState = (cookieString) => {