@triptease/tt-navbar 0.0.40 → 0.0.41

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,4 +1,4 @@
1
1
  /**
2
- * @triptease/tt-navbar v0.0.40
2
+ * @triptease/tt-navbar v0.0.41
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.40
2
+ * @triptease/tt-navbar v0.0.41
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -2027,23 +2027,24 @@ var Routes = {
2027
2027
  var NavbarController = class {
2028
2028
  constructor(host) {
2029
2029
  this._isOpen = true;
2030
+ this._hasInitialized = false;
2030
2031
  (this.host = host).addController(this);
2031
2032
  }
2032
2033
  get isOpen() {
2033
2034
  return this._isOpen;
2034
2035
  }
2035
- hostConnected() {
2036
- if (window.Clerk) {
2036
+ hostUpdate() {
2037
+ if (!this._hasInitialized && window.Clerk) {
2037
2038
  const userSetting = window.Clerk.user?.unsafeMetadata?.preferences?.ui?.navigationOpen;
2038
2039
  if (userSetting !== void 0) {
2039
2040
  this._isOpen = userSetting;
2041
+ this._hasInitialized = true;
2040
2042
  this.host.requestUpdate();
2041
2043
  }
2042
2044
  }
2043
2045
  }
2044
2046
  async toggle() {
2045
- const newState = !this._isOpen;
2046
- this._isOpen = newState;
2047
+ this._isOpen = !this._isOpen;
2047
2048
  if (window.Clerk) {
2048
2049
  await window.Clerk.user?.update({
2049
2050
  unsafeMetadata: {
@@ -2052,7 +2053,7 @@ var NavbarController = class {
2052
2053
  ...window.Clerk.user?.unsafeMetadata?.preferences,
2053
2054
  ui: {
2054
2055
  ...window.Clerk.user?.unsafeMetadata?.preferences?.ui,
2055
- navigationOpen: newState
2056
+ navigationOpen: this.isOpen
2056
2057
  }
2057
2058
  }
2058
2059
  }
@@ -2113,7 +2114,6 @@ var TtNavbar = class extends i4 {
2113
2114
  const clientSpecificUrl = mappedUrl.includes("$CLIENT_KEY") ? mappedUrl.replace("$CLIENT_KEY", this.clientKey) : mappedUrl;
2114
2115
  const links = Object.values(this.allNavLinks);
2115
2116
  bestMatch = links.find((link) => link.href.includes(clientSpecificUrl));
2116
- console.log({ mappedUrl, clientSpecificUrl, bestMatch });
2117
2117
  }
2118
2118
  }
2119
2119
  if (!bestMatch) {
@@ -2375,24 +2375,24 @@ var TtNavbar = class extends i4 {
2375
2375
  <div class='nav-items'>
2376
2376
  <div id="client-selector">
2377
2377
  ${this.clients.length > 1 ? x`
2378
- <tt-combobox
2379
- .openUpward=${true}
2380
- .value=${this.clientKey ? [this.clientKey] : []}
2381
- @change=${this.handleClientChange}
2382
- >
2383
- ${this.clients.map(
2378
+ <tt-combobox
2379
+ .openUpward=${true}
2380
+ .value=${this.clientKey ? [this.clientKey] : []}
2381
+ @change=${this.handleClientChange}
2382
+ >
2383
+ ${this.clients.map(
2384
2384
  (client) => x`
2385
- <option slot="option" value=${client.clientKey}>
2386
- ${client.displayName}
2387
- </option>
2388
- `
2385
+ <option slot="option" value=${client.clientKey}>
2386
+ ${client.displayName}
2387
+ </option>
2388
+ `
2389
2389
  )}
2390
- </tt-combobox>
2391
- ` : x`
2392
- <div class="single-client-name">
2393
- ${this.clients.find((m3) => m3.clientKey === this.clientKey)?.displayName}
2394
- </div>
2395
- `}
2390
+ </tt-combobox>
2391
+ ` : x`
2392
+ <div class="single-client-name">
2393
+ ${this.clients.find((m3) => m3.clientKey === this.clientKey)?.displayName}
2394
+ </div>
2395
+ `}
2396
2396
  </div>
2397
2397
  <a
2398
2398
  id="logout-link"