@akinon/ui-shell-dev 1.3.5 → 1.3.6

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.
@@ -140,7 +140,12 @@ export class ShellDevServer {
140
140
  console.log(
141
141
  `🚀 Shell development server running on http://localhost:${this.config.shell.port}`
142
142
  );
143
- console.log(`📱 Plugin expected at: ${this.config.plugin.url}`);
143
+ if (this.config.apps && this.config.apps.length > 0) {
144
+ console.log(`📱 Applications configured:`);
145
+ this.config.apps.forEach((app, index) => {
146
+ console.log(` ${index + 1}. ${app.name} (${app.type}) at ${app.url}`);
147
+ });
148
+ }
144
149
  console.log(`🎨 Theme: ${this.config.shell.theme}`);
145
150
  console.log(`🔍 Server bound to 0.0.0.0:${this.config.shell.port}`);
146
151
  });
@@ -185,19 +190,33 @@ export class ShellDevServer {
185
190
  res.json(this.config);
186
191
  });
187
192
 
188
- // Plugin proxy endpoint (for development)
189
- this.app.get('/api/plugin/health', async (req, res) => {
190
- try {
191
- const response = await fetch(`${this.config.plugin.url}/api/health`);
192
- const data = await response.json();
193
- res.json({ plugin: data, shell: { status: 'ok' } });
194
- } catch (error) {
195
- res.status(502).json({
196
- error: 'Plugin not available',
197
- plugin_url: this.config.plugin.url,
198
- message: error.message
199
- });
193
+ // Apps health check endpoint (for development)
194
+ this.app.get('/api/apps/health', async (req, res) => {
195
+ const results = [];
196
+
197
+ if (this.config.apps && this.config.apps.length > 0) {
198
+ for (const app of this.config.apps) {
199
+ try {
200
+ const response = await fetch(`${app.url}/api/health`);
201
+ const data = await response.json();
202
+ results.push({
203
+ name: app.name,
204
+ url: app.url,
205
+ status: 'ok',
206
+ data
207
+ });
208
+ } catch (error) {
209
+ results.push({
210
+ name: app.name,
211
+ url: app.url,
212
+ status: 'error',
213
+ error: error.message
214
+ });
215
+ }
216
+ }
200
217
  }
218
+
219
+ res.json({ apps: results, shell: { status: 'ok' } });
201
220
  });
202
221
  }
203
222
  }
@@ -87,7 +87,12 @@ export class ShellDevServer {
87
87
  console.log(
88
88
  `🚀 Shell development server running on http://localhost:${this.config.shell.port}`
89
89
  );
90
- console.log(`📱 Plugin expected at: ${this.config.plugin.url}`);
90
+ if (this.config.apps && this.config.apps.length > 0) {
91
+ console.log(`📱 Applications configured:`);
92
+ this.config.apps.forEach((app, index) => {
93
+ console.log(` ${index + 1}. ${app.name} (${app.type}) at ${app.url}`);
94
+ });
95
+ }
91
96
  console.log(`🎨 Theme: ${this.config.shell.theme}`);
92
97
  });
93
98
 
@@ -124,19 +129,33 @@ export class ShellDevServer {
124
129
  res.json(this.config);
125
130
  });
126
131
 
127
- // Plugin proxy endpoint (for development)
128
- this.app.get('/api/plugin/health', async (req, res) => {
129
- try {
130
- const response = await fetch(`${this.config.plugin.url}/api/health`);
131
- const data = await response.json();
132
- res.json({ plugin: data, shell: { status: 'ok' } });
133
- } catch (error) {
134
- res.status(502).json({
135
- error: 'Plugin not available',
136
- plugin_url: this.config.plugin.url,
137
- message: error.message
138
- });
132
+ // Apps health check endpoint (for development)
133
+ this.app.get('/api/apps/health', async (req, res) => {
134
+ const results = [];
135
+
136
+ if (this.config.apps && this.config.apps.length > 0) {
137
+ for (const app of this.config.apps) {
138
+ try {
139
+ const response = await fetch(`${app.url}/api/health`);
140
+ const data = await response.json();
141
+ results.push({
142
+ name: app.name,
143
+ url: app.url,
144
+ status: 'ok',
145
+ data
146
+ });
147
+ } catch (error) {
148
+ results.push({
149
+ name: app.name,
150
+ url: app.url,
151
+ status: 'error',
152
+ error: error.message
153
+ });
154
+ }
155
+ }
139
156
  }
157
+
158
+ res.json({ apps: results, shell: { status: 'ok' } });
140
159
  });
141
160
  }
142
161
  }
package/src/types.ts CHANGED
@@ -1,18 +1,20 @@
1
1
  export interface ShellConfig {
2
- plugin: {
2
+ apps: Array<{
3
3
  url: string;
4
4
  path: string;
5
5
  name: string;
6
- type: 'fullpage' | 'plugin';
7
- };
6
+ type: 'full_page' | 'plugin';
7
+ navTitle?: string; // Optional navigation title for full_page apps
8
+ }>;
8
9
  shell: {
9
10
  port: number;
10
11
  theme: 'omnitron' | 'seller-center' | 'minimal';
11
12
  title: string;
12
13
  };
13
- sidebar: {
14
+ sidebar?: {
14
15
  items: SidebarItem[];
15
16
  };
17
+ data?: Record<string, any>;
16
18
  }
17
19
 
18
20
  export interface SidebarItem {
@@ -8,16 +8,31 @@ const STATIC_NAVIGATION_ITEMS: TMenuItemType[] = [
8
8
  icon: 'dashboard'
9
9
  },
10
10
  {
11
- key: '/placeholder-1',
12
- label: 'Settings',
13
- icon: 'ayarlar',
11
+ key: '/products-and-catalogs',
12
+ label: 'Products & Catalogs',
13
+ icon: 'fiyatlistesi',
14
14
  disabled: true
15
15
  },
16
+ {
17
+ key: '/orders',
18
+ label: 'Orders',
19
+ icon: 'siparis',
20
+ disabled: true
21
+ }
22
+ ];
23
+
24
+ const STATIC_NAVIGATION_ITEMS_BOTTOM: TMenuItemType[] = [
16
25
  {
17
26
  key: '/placeholder-2',
18
27
  label: 'Help & Support',
19
28
  icon: 'bilgilendirme_servis',
20
29
  disabled: true
30
+ },
31
+ {
32
+ key: '/placeholder-1',
33
+ label: 'Settings',
34
+ icon: 'ayarlar',
35
+ disabled: true
21
36
  }
22
37
  ];
23
38
 
@@ -33,6 +48,10 @@ export const getStaticNavigationItems = () => {
33
48
  return STATIC_NAVIGATION_ITEMS;
34
49
  };
35
50
 
51
+ export const getStaticNavigationItemsBottom = () => {
52
+ return STATIC_NAVIGATION_ITEMS_BOTTOM;
53
+ };
54
+
36
55
  export const getFullpageNavigationItems = (
37
56
  apps: RegisteredApp[],
38
57
  configs: Map<number, any>
@@ -60,6 +79,8 @@ export const getFullpageNavigationItems = (
60
79
  });
61
80
  };
62
81
 
63
- export const getPluginNavigationItems = () => {
64
- return PLUGIN_NAVIGATION_ITEMS;
82
+ export const getPluginNavigationItems = (apps: RegisteredApp[]) => {
83
+ // Only show plugin test page if there are plugin type apps
84
+ const hasPluginApps = apps.some(app => app.type === 'plugin');
85
+ return hasPluginApps ? PLUGIN_NAVIGATION_ITEMS : [];
65
86
  };