@gxp-dev/tools 2.0.5
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.
- package/.github/workflows/npm-publish.yml +48 -0
- package/CLAUDE.md +400 -0
- package/README.md +247 -0
- package/REFACTOR_PLAN.md +194 -0
- package/bin/gx-devtools.js +87 -0
- package/bin/lib/cli.js +251 -0
- package/bin/lib/commands/assets.js +337 -0
- package/bin/lib/commands/build.js +259 -0
- package/bin/lib/commands/datastore.js +433 -0
- package/bin/lib/commands/dev.js +328 -0
- package/bin/lib/commands/extensions.js +298 -0
- package/bin/lib/commands/index.js +35 -0
- package/bin/lib/commands/init.js +307 -0
- package/bin/lib/commands/publish.js +189 -0
- package/bin/lib/commands/socket.js +158 -0
- package/bin/lib/commands/ssl.js +47 -0
- package/bin/lib/constants.js +120 -0
- package/bin/lib/tui/App.tsx +600 -0
- package/bin/lib/tui/components/CommandInput.tsx +278 -0
- package/bin/lib/tui/components/GeminiPanel.tsx +161 -0
- package/bin/lib/tui/components/Header.tsx +27 -0
- package/bin/lib/tui/components/LogPanel.tsx +122 -0
- package/bin/lib/tui/components/TabBar.tsx +56 -0
- package/bin/lib/tui/components/WelcomeScreen.tsx +80 -0
- package/bin/lib/tui/index.tsx +63 -0
- package/bin/lib/tui/services/ExtensionService.ts +122 -0
- package/bin/lib/tui/services/GeminiService.ts +395 -0
- package/bin/lib/tui/services/ServiceManager.ts +336 -0
- package/bin/lib/tui/services/SocketService.ts +204 -0
- package/bin/lib/tui/services/ViteService.ts +107 -0
- package/bin/lib/tui/services/index.ts +13 -0
- package/bin/lib/utils/files.js +180 -0
- package/bin/lib/utils/index.js +17 -0
- package/bin/lib/utils/paths.js +138 -0
- package/bin/lib/utils/prompts.js +71 -0
- package/bin/lib/utils/ssl.js +233 -0
- package/browser-extensions/README.md +1 -0
- package/browser-extensions/chrome/background.js +857 -0
- package/browser-extensions/chrome/content.js +51 -0
- package/browser-extensions/chrome/devtools.html +9 -0
- package/browser-extensions/chrome/devtools.js +23 -0
- package/browser-extensions/chrome/icons/gx_off_128.png +0 -0
- package/browser-extensions/chrome/icons/gx_off_16.png +0 -0
- package/browser-extensions/chrome/icons/gx_off_32.png +0 -0
- package/browser-extensions/chrome/icons/gx_off_64.png +0 -0
- package/browser-extensions/chrome/icons/gx_on_128.png +0 -0
- package/browser-extensions/chrome/icons/gx_on_16.png +0 -0
- package/browser-extensions/chrome/icons/gx_on_32.png +0 -0
- package/browser-extensions/chrome/icons/gx_on_64.png +0 -0
- package/browser-extensions/chrome/inspector.js +1087 -0
- package/browser-extensions/chrome/manifest.json +70 -0
- package/browser-extensions/chrome/panel.html +638 -0
- package/browser-extensions/chrome/panel.js +862 -0
- package/browser-extensions/chrome/popup.html +399 -0
- package/browser-extensions/chrome/popup.js +515 -0
- package/browser-extensions/chrome/rules.json +1 -0
- package/browser-extensions/chrome/test-chrome.html +145 -0
- package/browser-extensions/chrome/test-mixed-content.html +190 -0
- package/browser-extensions/chrome/test-uri-pattern.html +199 -0
- package/browser-extensions/firefox/README.md +134 -0
- package/browser-extensions/firefox/background.js +804 -0
- package/browser-extensions/firefox/content.js +120 -0
- package/browser-extensions/firefox/debug-errors.html +229 -0
- package/browser-extensions/firefox/debug-https.html +113 -0
- package/browser-extensions/firefox/devtools.html +9 -0
- package/browser-extensions/firefox/devtools.js +24 -0
- package/browser-extensions/firefox/icons/gx_off_128.png +0 -0
- package/browser-extensions/firefox/icons/gx_off_16.png +0 -0
- package/browser-extensions/firefox/icons/gx_off_32.png +0 -0
- package/browser-extensions/firefox/icons/gx_off_64.png +0 -0
- package/browser-extensions/firefox/icons/gx_on_128.png +0 -0
- package/browser-extensions/firefox/icons/gx_on_16.png +0 -0
- package/browser-extensions/firefox/icons/gx_on_32.png +0 -0
- package/browser-extensions/firefox/icons/gx_on_64.png +0 -0
- package/browser-extensions/firefox/inspector.js +1087 -0
- package/browser-extensions/firefox/manifest.json +67 -0
- package/browser-extensions/firefox/panel.html +638 -0
- package/browser-extensions/firefox/panel.js +862 -0
- package/browser-extensions/firefox/popup.html +525 -0
- package/browser-extensions/firefox/popup.js +536 -0
- package/browser-extensions/firefox/test-gramercy.html +126 -0
- package/browser-extensions/firefox/test-imports.html +58 -0
- package/browser-extensions/firefox/test-masking.html +147 -0
- package/browser-extensions/firefox/test-uri-pattern.html +199 -0
- package/docs/DOCUSAURUS_IMPORT.md +378 -0
- package/docs/_category_.json +8 -0
- package/docs/app-manifest.md +272 -0
- package/docs/building-for-platform.md +315 -0
- package/docs/dev-tools.md +291 -0
- package/docs/getting-started.md +180 -0
- package/docs/gxp-store.md +305 -0
- package/docs/index.md +44 -0
- package/package.json +77 -0
- package/runtime/PortalContainer.vue +326 -0
- package/runtime/dev-tools/DevToolsModal.vue +217 -0
- package/runtime/dev-tools/LayoutSwitcher.vue +221 -0
- package/runtime/dev-tools/MockDataEditor.vue +621 -0
- package/runtime/dev-tools/SocketSimulator.vue +562 -0
- package/runtime/dev-tools/StoreInspector.vue +644 -0
- package/runtime/dev-tools/index.js +6 -0
- package/runtime/gxpStringsPlugin.js +428 -0
- package/runtime/index.html +22 -0
- package/runtime/main.js +32 -0
- package/runtime/mock-api/auth-middleware.js +97 -0
- package/runtime/mock-api/image-generator.js +221 -0
- package/runtime/mock-api/index.js +197 -0
- package/runtime/mock-api/response-generator.js +394 -0
- package/runtime/mock-api/route-generator.js +323 -0
- package/runtime/mock-api/socket-triggers.js +371 -0
- package/runtime/mock-api/spec-loader.js +300 -0
- package/runtime/server.js +180 -0
- package/runtime/stores/gxpPortalConfigStore.js +554 -0
- package/runtime/stores/index.js +6 -0
- package/runtime/vite-inspector-plugin.js +749 -0
- package/runtime/vite-source-tracker-plugin.js +232 -0
- package/runtime/vite.config.js +402 -0
- package/scripts/launch-chrome.js +90 -0
- package/scripts/pack-chrome.js +91 -0
- package/socket-events/AiSessionMessageCreated.json +18 -0
- package/socket-events/SocialStreamPostCreated.json +24 -0
- package/socket-events/SocialStreamPostVariantCompleted.json +23 -0
- package/template/README.md +332 -0
- package/template/app-manifest.json +32 -0
- package/template/dev-assets/images/avatar-placeholder.png +0 -0
- package/template/dev-assets/images/background-placeholder.jpg +0 -0
- package/template/dev-assets/images/banner-placeholder.jpg +0 -0
- package/template/dev-assets/images/icon-placeholder.png +0 -0
- package/template/dev-assets/images/logo-placeholder.png +0 -0
- package/template/dev-assets/images/product-placeholder.jpg +0 -0
- package/template/dev-assets/images/thumbnail-placeholder.jpg +0 -0
- package/template/env.example +51 -0
- package/template/gitignore +53 -0
- package/template/index.html +22 -0
- package/template/main.js +28 -0
- package/template/src/DemoPage.vue +459 -0
- package/template/src/Plugin.vue +38 -0
- package/template/src/stores/index.js +9 -0
- package/template/src/stores/test-data.json +173 -0
- package/template/theme-layouts/AdditionalStyling.css +0 -0
- package/template/theme-layouts/PrivateLayout.vue +39 -0
- package/template/theme-layouts/PublicLayout.vue +39 -0
- package/template/theme-layouts/SystemLayout.vue +39 -0
- package/template/vite.config.js +333 -0
- package/tsconfig.tui.json +21 -0
- package/vite.config.js +164 -0
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 6
|
|
3
|
+
title: Building for Platform
|
|
4
|
+
description: Prepare your plugin for production deployment on the GxP platform
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Building for Platform
|
|
8
|
+
|
|
9
|
+
This guide covers how to build and prepare your plugin for deployment to the GxP platform.
|
|
10
|
+
|
|
11
|
+
## Build Command
|
|
12
|
+
|
|
13
|
+
Run the build command to create a production-ready bundle:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
gxdev build
|
|
17
|
+
# or
|
|
18
|
+
npm run build
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
This creates a `dist/` folder with optimized assets:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
dist/
|
|
25
|
+
├── assets/
|
|
26
|
+
│ ├── Plugin-[hash].js # Main plugin bundle
|
|
27
|
+
│ ├── Plugin-[hash].css # Extracted styles
|
|
28
|
+
│ └── [other chunks] # Code-split chunks
|
|
29
|
+
├── index.html # (dev only, not deployed)
|
|
30
|
+
└── manifest.json # Build manifest
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## What Gets Built
|
|
34
|
+
|
|
35
|
+
The build process:
|
|
36
|
+
|
|
37
|
+
1. **Compiles Vue SFCs** - Single File Components are compiled to JavaScript
|
|
38
|
+
2. **Bundles dependencies** - Tree-shakes and bundles only what you use
|
|
39
|
+
3. **Extracts CSS** - Styles are extracted to separate files
|
|
40
|
+
4. **Minifies code** - JavaScript and CSS are minified
|
|
41
|
+
5. **Generates hashes** - File names include content hashes for caching
|
|
42
|
+
6. **Creates source maps** - Optional source maps for debugging
|
|
43
|
+
|
|
44
|
+
## Build Configuration
|
|
45
|
+
|
|
46
|
+
### vite.config.js
|
|
47
|
+
|
|
48
|
+
Your project's `vite.config.js` controls the build:
|
|
49
|
+
|
|
50
|
+
```javascript
|
|
51
|
+
import { defineConfig } from 'vite';
|
|
52
|
+
import vue from '@vitejs/plugin-vue';
|
|
53
|
+
import path from 'path';
|
|
54
|
+
|
|
55
|
+
export default defineConfig({
|
|
56
|
+
plugins: [vue()],
|
|
57
|
+
resolve: {
|
|
58
|
+
alias: {
|
|
59
|
+
'@': path.resolve(__dirname, './src'),
|
|
60
|
+
'@layouts': path.resolve(__dirname, './theme-layouts'),
|
|
61
|
+
'@gx-runtime': path.resolve(__dirname, './node_modules/@gramercytech/gx-devtools/runtime'),
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
build: {
|
|
65
|
+
lib: {
|
|
66
|
+
entry: path.resolve(__dirname, 'src/Plugin.vue'),
|
|
67
|
+
name: 'GxpPlugin',
|
|
68
|
+
fileName: (format) => `plugin.${format}.js`,
|
|
69
|
+
},
|
|
70
|
+
rollupOptions: {
|
|
71
|
+
external: ['vue', 'pinia'],
|
|
72
|
+
output: {
|
|
73
|
+
globals: {
|
|
74
|
+
vue: 'Vue',
|
|
75
|
+
pinia: 'Pinia',
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Environment Variables
|
|
84
|
+
|
|
85
|
+
Production builds use `.env.production` if present:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# .env.production
|
|
89
|
+
VITE_API_URL=https://api.gramercy.cloud
|
|
90
|
+
VITE_ENVIRONMENT=production
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Access in code:
|
|
94
|
+
|
|
95
|
+
```javascript
|
|
96
|
+
const apiUrl = import.meta.env.VITE_API_URL;
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Pre-Build Checklist
|
|
100
|
+
|
|
101
|
+
Before building for production:
|
|
102
|
+
|
|
103
|
+
### 1. Remove Development Code
|
|
104
|
+
|
|
105
|
+
```javascript
|
|
106
|
+
// Remove or wrap in dev checks
|
|
107
|
+
if (import.meta.env.DEV) {
|
|
108
|
+
console.log('Debug info:', data);
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 2. Verify All Strings Are Extracted
|
|
113
|
+
|
|
114
|
+
Run the string scanner to find hardcoded text:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
gxdev datastore scan-strings
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Ensure all user-facing text uses `gxp-string` directives.
|
|
121
|
+
|
|
122
|
+
### 3. Check Asset References
|
|
123
|
+
|
|
124
|
+
Verify all assets use `gxp-src` directives:
|
|
125
|
+
|
|
126
|
+
```html
|
|
127
|
+
<!-- Good -->
|
|
128
|
+
<img gxp-src="hero_image" src="/dev-assets/placeholder.jpg" />
|
|
129
|
+
|
|
130
|
+
<!-- Bad - hardcoded URL won't work in production -->
|
|
131
|
+
<img src="/dev-assets/images/hero.jpg" />
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### 4. Test All Layouts
|
|
135
|
+
|
|
136
|
+
Test your plugin in all layout contexts:
|
|
137
|
+
|
|
138
|
+
- Public layout
|
|
139
|
+
- Private layout
|
|
140
|
+
- System layout
|
|
141
|
+
|
|
142
|
+
Use the Dev Tools layout switcher or:
|
|
143
|
+
|
|
144
|
+
```javascript
|
|
145
|
+
window.gxDevTools.setLayout('public');
|
|
146
|
+
window.gxDevTools.setLayout('private');
|
|
147
|
+
window.gxDevTools.setLayout('system');
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### 5. Validate Manifest
|
|
151
|
+
|
|
152
|
+
Ensure your `app-manifest.json` is complete:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# Check for JSON syntax errors
|
|
156
|
+
cat app-manifest.json | python -m json.tool
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Production Considerations
|
|
160
|
+
|
|
161
|
+
### Performance
|
|
162
|
+
|
|
163
|
+
- **Lazy load routes** - Use dynamic imports for large components
|
|
164
|
+
- **Optimize images** - Use appropriate sizes and formats
|
|
165
|
+
- **Minimize dependencies** - Only import what you need
|
|
166
|
+
|
|
167
|
+
```javascript
|
|
168
|
+
// Lazy load heavy components
|
|
169
|
+
const HeavyChart = defineAsyncComponent(() =>
|
|
170
|
+
import('./components/HeavyChart.vue')
|
|
171
|
+
);
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Error Handling
|
|
175
|
+
|
|
176
|
+
Add proper error boundaries:
|
|
177
|
+
|
|
178
|
+
```vue
|
|
179
|
+
<template>
|
|
180
|
+
<div v-if="error" class="error-state">
|
|
181
|
+
<p gxp-string="error_generic">Something went wrong</p>
|
|
182
|
+
<button @click="retry">Retry</button>
|
|
183
|
+
</div>
|
|
184
|
+
<div v-else>
|
|
185
|
+
<!-- Normal content -->
|
|
186
|
+
</div>
|
|
187
|
+
</template>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Offline Support
|
|
191
|
+
|
|
192
|
+
Consider what happens when the network is unavailable:
|
|
193
|
+
|
|
194
|
+
```javascript
|
|
195
|
+
const store = useGxpStore();
|
|
196
|
+
|
|
197
|
+
try {
|
|
198
|
+
const data = await store.apiGet('/endpoint');
|
|
199
|
+
} catch (error) {
|
|
200
|
+
if (!navigator.onLine) {
|
|
201
|
+
store.updateState('offline_mode', true);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Accessibility
|
|
207
|
+
|
|
208
|
+
Ensure your plugin is accessible:
|
|
209
|
+
|
|
210
|
+
- Use semantic HTML elements
|
|
211
|
+
- Add ARIA labels where needed
|
|
212
|
+
- Support keyboard navigation
|
|
213
|
+
- Test with screen readers
|
|
214
|
+
|
|
215
|
+
```html
|
|
216
|
+
<button
|
|
217
|
+
gxp-string="btn_checkin"
|
|
218
|
+
aria-label="Check in to the event"
|
|
219
|
+
@keydown.enter="handleCheckin"
|
|
220
|
+
>
|
|
221
|
+
Check In
|
|
222
|
+
</button>
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Deployment
|
|
226
|
+
|
|
227
|
+
### Upload to Platform
|
|
228
|
+
|
|
229
|
+
After building, upload your plugin to the GxP platform:
|
|
230
|
+
|
|
231
|
+
1. Log in to the GxP admin portal
|
|
232
|
+
2. Navigate to Plugins > Upload
|
|
233
|
+
3. Select your `dist/` folder contents
|
|
234
|
+
4. Configure plugin settings
|
|
235
|
+
5. Assign to kiosks
|
|
236
|
+
|
|
237
|
+
### Version Management
|
|
238
|
+
|
|
239
|
+
Track your plugin versions:
|
|
240
|
+
|
|
241
|
+
```json
|
|
242
|
+
// package.json
|
|
243
|
+
{
|
|
244
|
+
"name": "my-plugin",
|
|
245
|
+
"version": "1.2.0"
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Use semantic versioning:
|
|
250
|
+
- **MAJOR** - Breaking changes
|
|
251
|
+
- **MINOR** - New features (backward compatible)
|
|
252
|
+
- **PATCH** - Bug fixes
|
|
253
|
+
|
|
254
|
+
### Testing in Production
|
|
255
|
+
|
|
256
|
+
Use the browser extensions to test your plugin on production kiosks:
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
# Build extensions for distribution
|
|
260
|
+
gxdev ext:build
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
This creates installable extension packages for Chrome and Firefox.
|
|
264
|
+
|
|
265
|
+
## Troubleshooting Builds
|
|
266
|
+
|
|
267
|
+
### Build Fails with Import Errors
|
|
268
|
+
|
|
269
|
+
Check that all imports use the correct aliases:
|
|
270
|
+
|
|
271
|
+
```javascript
|
|
272
|
+
// Correct
|
|
273
|
+
import { useGxpStore } from '@gx-runtime/stores/gxpPortalConfigStore';
|
|
274
|
+
|
|
275
|
+
// Wrong - path won't resolve in production
|
|
276
|
+
import { useGxpStore } from '../../node_modules/@gramercytech/gx-devtools/runtime/stores/gxpPortalConfigStore';
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### CSS Not Loading
|
|
280
|
+
|
|
281
|
+
Ensure styles are properly scoped or imported:
|
|
282
|
+
|
|
283
|
+
```vue
|
|
284
|
+
<style scoped>
|
|
285
|
+
/* Scoped styles are extracted correctly */
|
|
286
|
+
.my-component {
|
|
287
|
+
color: blue;
|
|
288
|
+
}
|
|
289
|
+
</style>
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### Bundle Too Large
|
|
293
|
+
|
|
294
|
+
Analyze your bundle:
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
# Add to package.json scripts
|
|
298
|
+
"analyze": "vite build --mode analyze"
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
Check for:
|
|
302
|
+
- Unused dependencies
|
|
303
|
+
- Large libraries that could be lazy-loaded
|
|
304
|
+
- Duplicate code
|
|
305
|
+
|
|
306
|
+
### Assets Not Found
|
|
307
|
+
|
|
308
|
+
Production assets come from the platform. Ensure you're using directives:
|
|
309
|
+
|
|
310
|
+
```html
|
|
311
|
+
<!-- Platform provides the actual URL -->
|
|
312
|
+
<img gxp-src="logo" src="/placeholder.jpg" />
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
The `src` attribute is only used during development as a fallback.
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 5
|
|
3
|
+
title: Dev Tools
|
|
4
|
+
description: In-browser debugging tools and browser extensions for plugin development
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Dev Tools
|
|
8
|
+
|
|
9
|
+
The GxP Toolkit includes powerful debugging tools to help you develop and test your plugins.
|
|
10
|
+
|
|
11
|
+
## In-Browser Dev Tools
|
|
12
|
+
|
|
13
|
+
Press `Ctrl+Shift+D` (or `Cmd+Shift+D` on Mac) to toggle the in-browser development tools.
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
#### Store Inspector
|
|
18
|
+
|
|
19
|
+
View and edit all store state in real-time:
|
|
20
|
+
|
|
21
|
+
- **pluginVars** - Settings from your manifest
|
|
22
|
+
- **stringsList** - Translatable strings
|
|
23
|
+
- **assetList** - Asset URLs
|
|
24
|
+
- **triggerState** - Runtime state
|
|
25
|
+
|
|
26
|
+
**Interactive features:**
|
|
27
|
+
- Hover over keys to highlight matching elements on the page
|
|
28
|
+
- Double-click values to edit them in real-time
|
|
29
|
+
- Changes are reflected immediately in your plugin
|
|
30
|
+
|
|
31
|
+
#### Layout Switcher
|
|
32
|
+
|
|
33
|
+
Toggle between different layout contexts:
|
|
34
|
+
|
|
35
|
+
- **Public** - Public-facing layout (unauthenticated users)
|
|
36
|
+
- **Private** - Authenticated user layout
|
|
37
|
+
- **System** - System/admin layout
|
|
38
|
+
|
|
39
|
+
This simulates how your plugin appears in different platform contexts.
|
|
40
|
+
|
|
41
|
+
#### Socket Simulator
|
|
42
|
+
|
|
43
|
+
Send test socket events to your plugin:
|
|
44
|
+
|
|
45
|
+
1. Select an event from the dropdown
|
|
46
|
+
2. Modify the JSON payload if needed
|
|
47
|
+
3. Click "Send" to emit the event
|
|
48
|
+
|
|
49
|
+
Your plugin receives the event as if it came from the real platform.
|
|
50
|
+
|
|
51
|
+
#### Mock Data Editor
|
|
52
|
+
|
|
53
|
+
Edit platform-provided mock data:
|
|
54
|
+
|
|
55
|
+
- **Theme colors** - Primary, secondary, background colors
|
|
56
|
+
- **Navigation** - Mock router state
|
|
57
|
+
- **Permissions** - Toggle permission flags
|
|
58
|
+
- **Dependencies** - Configure mock dependencies
|
|
59
|
+
|
|
60
|
+
### Console API
|
|
61
|
+
|
|
62
|
+
Access dev tools programmatically from the browser console:
|
|
63
|
+
|
|
64
|
+
```javascript
|
|
65
|
+
// Open/close dev tools
|
|
66
|
+
window.gxDevTools.open()
|
|
67
|
+
window.gxDevTools.close()
|
|
68
|
+
window.gxDevTools.toggle()
|
|
69
|
+
|
|
70
|
+
// Access the store directly
|
|
71
|
+
const store = window.gxDevTools.store()
|
|
72
|
+
console.log(store.stringsList)
|
|
73
|
+
store.updateState('test_value', 123)
|
|
74
|
+
|
|
75
|
+
// Change layout
|
|
76
|
+
window.gxDevTools.setLayout('private')
|
|
77
|
+
window.gxDevTools.setLayout('public')
|
|
78
|
+
window.gxDevTools.setLayout('system')
|
|
79
|
+
|
|
80
|
+
// Get current layout
|
|
81
|
+
const layout = window.gxDevTools.getLayout()
|
|
82
|
+
console.log(layout) // 'private'
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Browser Extensions
|
|
86
|
+
|
|
87
|
+
The toolkit includes browser extensions for Chrome and Firefox that provide advanced inspection capabilities.
|
|
88
|
+
|
|
89
|
+
### Installation
|
|
90
|
+
|
|
91
|
+
#### Chrome
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Launch Chrome with extension auto-loaded
|
|
95
|
+
gxdev dev --chrome
|
|
96
|
+
|
|
97
|
+
# Or install manually:
|
|
98
|
+
# 1. Go to chrome://extensions
|
|
99
|
+
# 2. Enable "Developer mode"
|
|
100
|
+
# 3. Click "Load unpacked"
|
|
101
|
+
# 4. Select browser-extensions/chrome/
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
#### Firefox
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Launch Firefox with extension auto-loaded
|
|
108
|
+
gxdev dev --firefox
|
|
109
|
+
|
|
110
|
+
# Or install manually:
|
|
111
|
+
# 1. Go to about:debugging
|
|
112
|
+
# 2. Click "This Firefox"
|
|
113
|
+
# 3. Click "Load Temporary Add-on"
|
|
114
|
+
# 4. Select browser-extensions/firefox/manifest.json
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Extension Features
|
|
118
|
+
|
|
119
|
+
#### Element Selection
|
|
120
|
+
|
|
121
|
+
Click the selection tool in the DevTools panel, then click any element on the page to inspect it.
|
|
122
|
+
|
|
123
|
+
#### Visual Highlighting
|
|
124
|
+
|
|
125
|
+
- **Hover** - Orange dashed border shows element boundaries
|
|
126
|
+
- **Selected** - Cyan pulsing glow indicates the selected element
|
|
127
|
+
|
|
128
|
+
#### Smart Labels
|
|
129
|
+
|
|
130
|
+
Elements are labeled with their component context:
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
ComponentName::element::gxp-string-key
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Examples:
|
|
137
|
+
- `DemoPage::h1::welcome_title`
|
|
138
|
+
- `CheckInForm::button::btn_submit`
|
|
139
|
+
- `Header::img::logo`
|
|
140
|
+
|
|
141
|
+
#### String Extraction
|
|
142
|
+
|
|
143
|
+
Identify hardcoded strings and convert them to `gxp-string` directives:
|
|
144
|
+
|
|
145
|
+
1. Select an element with hardcoded text
|
|
146
|
+
2. Click "Extract to gxp-string"
|
|
147
|
+
3. Enter a key name
|
|
148
|
+
4. The extension suggests the code change
|
|
149
|
+
|
|
150
|
+
#### Component Inspector
|
|
151
|
+
|
|
152
|
+
View Vue component details:
|
|
153
|
+
|
|
154
|
+
- Component name and hierarchy
|
|
155
|
+
- Props and their values
|
|
156
|
+
- Reactive data
|
|
157
|
+
- Computed properties
|
|
158
|
+
|
|
159
|
+
### Reloading Extensions
|
|
160
|
+
|
|
161
|
+
After modifying extension code in `browser-extensions/`:
|
|
162
|
+
|
|
163
|
+
**Chrome:**
|
|
164
|
+
1. Go to `chrome://extensions`
|
|
165
|
+
2. Find "GxP Inspector"
|
|
166
|
+
3. Click the refresh icon
|
|
167
|
+
|
|
168
|
+
**Firefox:**
|
|
169
|
+
1. Go to `about:debugging`
|
|
170
|
+
2. Find "GxP Inspector"
|
|
171
|
+
3. Click "Reload"
|
|
172
|
+
|
|
173
|
+
## CLI Dev Commands
|
|
174
|
+
|
|
175
|
+
### Datastore Commands
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
# List all store variables
|
|
179
|
+
gxdev datastore list
|
|
180
|
+
|
|
181
|
+
# Add a new variable interactively
|
|
182
|
+
gxdev datastore add
|
|
183
|
+
|
|
184
|
+
# Scan components for hardcoded strings
|
|
185
|
+
gxdev datastore scan-strings
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
The scan-strings command finds text that should be extracted to your manifest:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
$ gxdev datastore scan-strings
|
|
192
|
+
|
|
193
|
+
Scanning components for hardcoded strings...
|
|
194
|
+
|
|
195
|
+
src/CheckInForm.vue:
|
|
196
|
+
Line 12: "Welcome to the event" -> Suggest: welcome_title
|
|
197
|
+
Line 24: "Check In" -> Suggest: btn_checkin
|
|
198
|
+
|
|
199
|
+
src/ErrorPage.vue:
|
|
200
|
+
Line 8: "Something went wrong" -> Suggest: error_generic
|
|
201
|
+
|
|
202
|
+
Found 3 hardcoded strings in 2 files.
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Socket Commands
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
# List available socket events
|
|
209
|
+
gxdev socket list
|
|
210
|
+
|
|
211
|
+
# Send a test event
|
|
212
|
+
gxdev socket send --event SessionUpdated
|
|
213
|
+
|
|
214
|
+
# Send with custom data
|
|
215
|
+
gxdev socket send --event AttendeeCheckedIn --data '{"id": 123}'
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Asset Commands
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
# List development assets
|
|
222
|
+
gxdev assets list
|
|
223
|
+
|
|
224
|
+
# Initialize asset directories
|
|
225
|
+
gxdev assets init
|
|
226
|
+
|
|
227
|
+
# Generate placeholder images
|
|
228
|
+
gxdev assets generate --size 400x300 --name hero
|
|
229
|
+
gxdev assets generate --size 200x200 --name avatar --format png
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Debugging Tips
|
|
233
|
+
|
|
234
|
+
### 1. Use Vue DevTools
|
|
235
|
+
|
|
236
|
+
Install the [Vue DevTools browser extension](https://devtools.vuejs.org/) for component inspection:
|
|
237
|
+
|
|
238
|
+
- Component tree visualization
|
|
239
|
+
- State inspection
|
|
240
|
+
- Event tracking
|
|
241
|
+
- Performance profiling
|
|
242
|
+
|
|
243
|
+
### 2. Enable Source Maps
|
|
244
|
+
|
|
245
|
+
Source maps are enabled by default in development. Check your browser's Sources panel to debug original source files.
|
|
246
|
+
|
|
247
|
+
### 3. Console Logging
|
|
248
|
+
|
|
249
|
+
Use the store's console helpers:
|
|
250
|
+
|
|
251
|
+
```javascript
|
|
252
|
+
const store = useGxpStore();
|
|
253
|
+
|
|
254
|
+
// Log current state
|
|
255
|
+
console.log('Settings:', store.pluginVars);
|
|
256
|
+
console.log('Strings:', store.stringsList);
|
|
257
|
+
console.log('State:', store.triggerState);
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### 4. Network Tab
|
|
261
|
+
|
|
262
|
+
Monitor API calls in your browser's Network tab. The store's API client logs requests in development mode.
|
|
263
|
+
|
|
264
|
+
### 5. Hot Reload Issues
|
|
265
|
+
|
|
266
|
+
If hot reload stops working:
|
|
267
|
+
|
|
268
|
+
1. Check the terminal for Vite errors
|
|
269
|
+
2. Look for syntax errors in your components
|
|
270
|
+
3. Try a manual page refresh
|
|
271
|
+
4. Restart the dev server if needed
|
|
272
|
+
|
|
273
|
+
## Troubleshooting
|
|
274
|
+
|
|
275
|
+
### Dev tools not opening
|
|
276
|
+
|
|
277
|
+
- Ensure you're on the development server (localhost:3060)
|
|
278
|
+
- Check browser console for JavaScript errors
|
|
279
|
+
- Try refreshing the page
|
|
280
|
+
|
|
281
|
+
### Extension not highlighting elements
|
|
282
|
+
|
|
283
|
+
- Reload the extension after code changes
|
|
284
|
+
- Check console for `[GxP Inspector] Loaded` message
|
|
285
|
+
- Ensure you're inspecting the correct tab
|
|
286
|
+
|
|
287
|
+
### Store changes not reflecting
|
|
288
|
+
|
|
289
|
+
- Verify your manifest syntax is valid JSON
|
|
290
|
+
- Check for typos in key names
|
|
291
|
+
- Ensure you're using the correct getter method
|