@eventcatalog/core 2.48.1 → 2.48.2

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.
@@ -37,7 +37,7 @@ var import_axios = __toESM(require("axios"), 1);
37
37
  var import_os = __toESM(require("os"), 1);
38
38
 
39
39
  // package.json
40
- var version = "2.48.1";
40
+ var version = "2.48.2";
41
41
 
42
42
  // src/constants.ts
43
43
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "../chunk-M35UFAGG.js";
4
- import "../chunk-WAVFA46U.js";
3
+ } from "../chunk-SKRYED6N.js";
4
+ import "../chunk-TU4LMTL7.js";
5
5
  export {
6
6
  raiseEvent
7
7
  };
@@ -106,7 +106,7 @@ var import_axios = __toESM(require("axios"), 1);
106
106
  var import_os = __toESM(require("os"), 1);
107
107
 
108
108
  // package.json
109
- var version = "2.48.1";
109
+ var version = "2.48.2";
110
110
 
111
111
  // src/constants.ts
112
112
  var VERSION = version;
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  log_build_default
3
- } from "../chunk-ZI5ZP7I2.js";
4
- import "../chunk-M35UFAGG.js";
5
- import "../chunk-WAVFA46U.js";
3
+ } from "../chunk-UVANOIYF.js";
4
+ import "../chunk-SKRYED6N.js";
5
+ import "../chunk-TU4LMTL7.js";
6
6
  import "../chunk-E7TXTI7G.js";
7
7
  export {
8
8
  log_build_default as default
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-WAVFA46U.js";
3
+ } from "./chunk-TU4LMTL7.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import axios from "axios";
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "2.48.1";
2
+ var version = "2.48.2";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-M35UFAGG.js";
3
+ } from "./chunk-SKRYED6N.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "2.48.1";
28
+ var version = "2.48.2";
29
29
 
30
30
  // src/constants.ts
31
31
  var VERSION = version;
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-WAVFA46U.js";
3
+ } from "./chunk-TU4LMTL7.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -157,7 +157,7 @@ var import_axios = __toESM(require("axios"), 1);
157
157
  var import_os = __toESM(require("os"), 1);
158
158
 
159
159
  // package.json
160
- var version = "2.48.1";
160
+ var version = "2.48.2";
161
161
 
162
162
  // src/constants.ts
163
163
  var VERSION = version;
@@ -101,6 +101,12 @@ interface Config {
101
101
  renderMode?: 'flat' | 'single';
102
102
  };
103
103
  };
104
+ environments?: {
105
+ name: string;
106
+ url: string;
107
+ description?: string;
108
+ shortName?: string;
109
+ }[];
104
110
  }
105
111
 
106
112
  export type { Config, SideBarConfig };
@@ -101,6 +101,12 @@ interface Config {
101
101
  renderMode?: 'flat' | 'single';
102
102
  };
103
103
  };
104
+ environments?: {
105
+ name: string;
106
+ url: string;
107
+ description?: string;
108
+ shortName?: string;
109
+ }[];
104
110
  }
105
111
 
106
112
  export type { Config, SideBarConfig };
@@ -6,8 +6,8 @@ import {
6
6
  } from "./chunk-XE6PFSH5.js";
7
7
  import {
8
8
  log_build_default
9
- } from "./chunk-ZI5ZP7I2.js";
10
- import "./chunk-M35UFAGG.js";
9
+ } from "./chunk-UVANOIYF.js";
10
+ import "./chunk-SKRYED6N.js";
11
11
  import {
12
12
  catalogToAstro,
13
13
  checkAndConvertMdToMdx
@@ -15,7 +15,7 @@ import {
15
15
  import "./chunk-LDBRNJIL.js";
16
16
  import {
17
17
  VERSION
18
- } from "./chunk-WAVFA46U.js";
18
+ } from "./chunk-TU4LMTL7.js";
19
19
  import {
20
20
  isAuthEnabled,
21
21
  isBackstagePluginEnabled,
@@ -0,0 +1,135 @@
1
+ import React, { useState, useEffect, useRef } from 'react';
2
+
3
+ interface Environment {
4
+ name: string;
5
+ url: string;
6
+ description?: string;
7
+ shortName?: string;
8
+ }
9
+
10
+ interface EnvironmentDropdownProps {
11
+ environments: Environment[];
12
+ }
13
+
14
+ export const EnvironmentDropdown: React.FC<EnvironmentDropdownProps> = ({ environments }) => {
15
+ const [isOpen, setIsOpen] = useState(false);
16
+ const [currentEnvironment, setCurrentEnvironment] = useState<Environment | null>(null);
17
+ const dropdownRef = useRef<HTMLDivElement>(null);
18
+
19
+ useEffect(() => {
20
+ // Check if current URL matches any environment
21
+ const currentUrl = window.location.origin;
22
+ const matchedEnv = environments.find((env) => {
23
+ // Normalize URLs for comparison
24
+ const envUrl = new URL(env.url).origin;
25
+ return envUrl === currentUrl;
26
+ });
27
+ setCurrentEnvironment(matchedEnv || null);
28
+ }, [environments]);
29
+
30
+ useEffect(() => {
31
+ // Handle click outside
32
+ const handleClickOutside = (event: MouseEvent) => {
33
+ if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) {
34
+ setIsOpen(false);
35
+ }
36
+ };
37
+
38
+ // Handle escape key
39
+ const handleEscape = (event: KeyboardEvent) => {
40
+ if (event.key === 'Escape') {
41
+ setIsOpen(false);
42
+ }
43
+ };
44
+
45
+ if (isOpen) {
46
+ document.addEventListener('click', handleClickOutside);
47
+ document.addEventListener('keydown', handleEscape);
48
+ }
49
+
50
+ return () => {
51
+ document.removeEventListener('click', handleClickOutside);
52
+ document.removeEventListener('keydown', handleEscape);
53
+ };
54
+ }, [isOpen]);
55
+
56
+ const toggleDropdown = (e: React.MouseEvent) => {
57
+ e.stopPropagation();
58
+ setIsOpen(!isOpen);
59
+ };
60
+
61
+ return (
62
+ <div className="relative" ref={dropdownRef}>
63
+ <button
64
+ type="button"
65
+ onClick={toggleDropdown}
66
+ className="flex items-center space-x-1 text-sm font-medium text-gray-700 hover:text-gray-900 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500 rounded-md px-3 py-2"
67
+ aria-expanded={isOpen}
68
+ aria-haspopup="true"
69
+ >
70
+ <svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
71
+ <path
72
+ strokeLinecap="round"
73
+ strokeLinejoin="round"
74
+ strokeWidth="2"
75
+ d="M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"
76
+ />
77
+ </svg>
78
+ <span>
79
+ Environments
80
+ {currentEnvironment && (
81
+ <span className="font-normal"> ({currentEnvironment.shortName || currentEnvironment.name})</span>
82
+ )}
83
+ </span>
84
+ <svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
85
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M19 9l-7 7-7-7" />
86
+ </svg>
87
+ </button>
88
+ <div
89
+ className={`${isOpen ? '' : 'hidden'} absolute right-0 mt-2 w-64 bg-white rounded-md shadow-lg py-1 z-50 border border-gray-100 overflow-hidden z-20`}
90
+ >
91
+ {environments.map((env) => {
92
+ const isCurrentEnv = currentEnvironment?.name === env.name;
93
+
94
+ return (
95
+ <a
96
+ key={env.name}
97
+ href={env.url}
98
+ onClick={(e) => {
99
+ e.preventDefault();
100
+ // Construct the full URL with the current path when clicked
101
+ const currentPath = window.location.pathname + window.location.search + window.location.hash;
102
+ const targetUrl = new URL(env.url);
103
+ targetUrl.pathname = currentPath;
104
+ window.location.href = targetUrl.toString();
105
+ }}
106
+ className={`block px-4 py-3 text-sm transition-colors border-b border-gray-50 last:border-b-0 ${
107
+ isCurrentEnv ? 'bg-purple-50 text-purple-700 hover:bg-purple-100' : 'text-gray-700 hover:bg-gray-50'
108
+ }`}
109
+ >
110
+ <div className="flex items-center justify-between">
111
+ <div>
112
+ <div className={`font-medium ${isCurrentEnv ? 'text-purple-700' : ''}`}>{env.name}</div>
113
+ {env.description && (
114
+ <div className={`text-xs font-light mt-1 ${isCurrentEnv ? 'text-purple-600' : 'text-gray-500'}`}>
115
+ {env.description}
116
+ </div>
117
+ )}
118
+ </div>
119
+ {isCurrentEnv && (
120
+ <svg className="w-4 h-4 text-purple-600 flex-shrink-0 ml-2" fill="currentColor" viewBox="0 0 20 20">
121
+ <path
122
+ fillRule="evenodd"
123
+ d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
124
+ clipRule="evenodd"
125
+ />
126
+ </svg>
127
+ )}
128
+ </div>
129
+ </a>
130
+ );
131
+ })}
132
+ </div>
133
+ </div>
134
+ );
135
+ };
@@ -5,6 +5,7 @@ import { buildUrl } from '@utils/url-builder';
5
5
  import { showEventCatalogBranding, showCustomBranding } from '@utils/feature';
6
6
  import { getSession } from 'auth-astro/server';
7
7
  import { isAuthEnabled, isSSR } from '@utils/feature';
8
+ import { EnvironmentDropdown } from './EnvironmentDropdown';
8
9
 
9
10
  let session = null;
10
11
  if (isAuthEnabled()) {
@@ -41,7 +42,10 @@ const repositoryUrl = catalog?.repositoryUrl || 'https://github.com/event-catalo
41
42
  <div class="hidden md:block w-3/12">
42
43
  {
43
44
  session ? (
44
- <div class="flex justify-end pr-2">
45
+ <div class="flex items-center space-x-4 justify-end pr-2">
46
+ {catalog.environments && catalog.environments.length > 0 && (
47
+ <EnvironmentDropdown environments={catalog.environments} client:load />
48
+ )}
45
49
  <div class="relative">
46
50
  <button
47
51
  id="profile-menu-button"
@@ -89,6 +93,9 @@ const repositoryUrl = catalog?.repositoryUrl || 'https://github.com/event-catalo
89
93
  ) : (
90
94
  <>
91
95
  <div class="flex items-center space-x-4 justify-end pr-2">
96
+ {catalog.environments && catalog.environments.length > 0 && (
97
+ <EnvironmentDropdown environments={catalog.environments} client:load />
98
+ )}
92
99
  {isAuthEnabled() && (
93
100
  <button
94
101
  id="okta-signin-btn"
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "url": "https://github.com/event-catalog/eventcatalog.git"
7
7
  },
8
8
  "type": "module",
9
- "version": "2.48.1",
9
+ "version": "2.48.2",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },