@gxp-dev/tools 2.0.63 → 2.0.64
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/README.md +32 -31
- package/bin/gx-devtools.js +74 -54
- package/bin/lib/cli.js +23 -21
- package/bin/lib/commands/add-dependency.js +366 -325
- package/bin/lib/commands/assets.js +137 -139
- package/bin/lib/commands/build.js +169 -174
- package/bin/lib/commands/datastore.js +181 -183
- package/bin/lib/commands/dev.js +127 -131
- package/bin/lib/commands/extensions.js +147 -149
- package/bin/lib/commands/extract-config.js +73 -67
- package/bin/lib/commands/index.js +12 -12
- package/bin/lib/commands/init.js +342 -240
- package/bin/lib/commands/publish.js +69 -75
- package/bin/lib/commands/socket.js +69 -69
- package/bin/lib/commands/ssl.js +14 -14
- package/bin/lib/constants.js +10 -24
- package/bin/lib/tui/App.tsx +761 -705
- package/bin/lib/tui/components/AIPanel.tsx +191 -171
- package/bin/lib/tui/components/CommandInput.tsx +394 -343
- package/bin/lib/tui/components/GeminiPanel.tsx +175 -151
- package/bin/lib/tui/components/Header.tsx +23 -21
- package/bin/lib/tui/components/LogPanel.tsx +244 -220
- package/bin/lib/tui/components/TabBar.tsx +50 -48
- package/bin/lib/tui/components/WelcomeScreen.tsx +126 -71
- package/bin/lib/tui/index.tsx +37 -39
- package/bin/lib/tui/services/AIService.ts +518 -462
- package/bin/lib/tui/services/ExtensionService.ts +140 -129
- package/bin/lib/tui/services/GeminiService.ts +367 -337
- package/bin/lib/tui/services/ServiceManager.ts +344 -322
- package/bin/lib/tui/services/SocketService.ts +168 -168
- package/bin/lib/tui/services/ViteService.ts +88 -88
- package/bin/lib/tui/services/index.ts +47 -22
- package/bin/lib/utils/ai-scaffold.js +291 -280
- package/bin/lib/utils/extract-config.js +157 -140
- package/bin/lib/utils/files.js +82 -86
- package/bin/lib/utils/index.js +7 -7
- package/bin/lib/utils/paths.js +34 -34
- package/bin/lib/utils/prompts.js +194 -169
- package/bin/lib/utils/ssl.js +79 -81
- package/browser-extensions/README.md +0 -1
- package/browser-extensions/chrome/background.js +244 -237
- package/browser-extensions/chrome/content.js +32 -29
- package/browser-extensions/chrome/devtools.html +7 -7
- package/browser-extensions/chrome/devtools.js +19 -19
- package/browser-extensions/chrome/inspector.js +802 -767
- package/browser-extensions/chrome/manifest.json +71 -63
- package/browser-extensions/chrome/panel.html +674 -636
- package/browser-extensions/chrome/panel.js +722 -712
- package/browser-extensions/chrome/popup.html +586 -543
- package/browser-extensions/chrome/popup.js +282 -244
- package/browser-extensions/chrome/rules.json +1 -1
- package/browser-extensions/chrome/test-chrome.html +216 -136
- package/browser-extensions/chrome/test-mixed-content.html +284 -189
- package/browser-extensions/chrome/test-uri-pattern.html +221 -198
- package/browser-extensions/firefox/README.md +9 -6
- package/browser-extensions/firefox/background.js +221 -218
- package/browser-extensions/firefox/content.js +55 -52
- package/browser-extensions/firefox/debug-errors.html +386 -228
- package/browser-extensions/firefox/debug-https.html +153 -105
- package/browser-extensions/firefox/devtools.html +7 -7
- package/browser-extensions/firefox/devtools.js +23 -20
- package/browser-extensions/firefox/inspector.js +802 -767
- package/browser-extensions/firefox/manifest.json +68 -68
- package/browser-extensions/firefox/panel.html +674 -636
- package/browser-extensions/firefox/panel.js +722 -712
- package/browser-extensions/firefox/popup.html +572 -535
- package/browser-extensions/firefox/popup.js +281 -236
- package/browser-extensions/firefox/test-gramercy.html +170 -125
- package/browser-extensions/firefox/test-imports.html +59 -55
- package/browser-extensions/firefox/test-masking.html +231 -140
- package/browser-extensions/firefox/test-uri-pattern.html +221 -198
- package/dist/tui/App.d.ts +1 -1
- package/dist/tui/App.d.ts.map +1 -1
- package/dist/tui/App.js +154 -150
- package/dist/tui/App.js.map +1 -1
- package/dist/tui/components/AIPanel.d.ts.map +1 -1
- package/dist/tui/components/AIPanel.js +42 -35
- package/dist/tui/components/AIPanel.js.map +1 -1
- package/dist/tui/components/CommandInput.d.ts +1 -1
- package/dist/tui/components/CommandInput.d.ts.map +1 -1
- package/dist/tui/components/CommandInput.js +92 -62
- package/dist/tui/components/CommandInput.js.map +1 -1
- package/dist/tui/components/GeminiPanel.d.ts.map +1 -1
- package/dist/tui/components/GeminiPanel.js +37 -30
- package/dist/tui/components/GeminiPanel.js.map +1 -1
- package/dist/tui/components/Header.d.ts.map +1 -1
- package/dist/tui/components/Header.js +1 -1
- package/dist/tui/components/Header.js.map +1 -1
- package/dist/tui/components/LogPanel.d.ts +1 -1
- package/dist/tui/components/LogPanel.d.ts.map +1 -1
- package/dist/tui/components/LogPanel.js +26 -24
- package/dist/tui/components/LogPanel.js.map +1 -1
- package/dist/tui/components/TabBar.d.ts +2 -2
- package/dist/tui/components/TabBar.d.ts.map +1 -1
- package/dist/tui/components/TabBar.js +11 -11
- package/dist/tui/components/TabBar.js.map +1 -1
- package/dist/tui/components/WelcomeScreen.d.ts.map +1 -1
- package/dist/tui/components/WelcomeScreen.js +6 -6
- package/dist/tui/components/WelcomeScreen.js.map +1 -1
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +8 -8
- package/dist/tui/index.js.map +1 -1
- package/dist/tui/services/AIService.d.ts +2 -2
- package/dist/tui/services/AIService.d.ts.map +1 -1
- package/dist/tui/services/AIService.js +165 -125
- package/dist/tui/services/AIService.js.map +1 -1
- package/dist/tui/services/ExtensionService.d.ts +1 -1
- package/dist/tui/services/ExtensionService.d.ts.map +1 -1
- package/dist/tui/services/ExtensionService.js +33 -26
- package/dist/tui/services/ExtensionService.js.map +1 -1
- package/dist/tui/services/GeminiService.d.ts +1 -1
- package/dist/tui/services/GeminiService.d.ts.map +1 -1
- package/dist/tui/services/GeminiService.js +87 -76
- package/dist/tui/services/GeminiService.js.map +1 -1
- package/dist/tui/services/ServiceManager.d.ts +3 -3
- package/dist/tui/services/ServiceManager.d.ts.map +1 -1
- package/dist/tui/services/ServiceManager.js +72 -58
- package/dist/tui/services/ServiceManager.js.map +1 -1
- package/dist/tui/services/SocketService.d.ts.map +1 -1
- package/dist/tui/services/SocketService.js +32 -32
- package/dist/tui/services/SocketService.js.map +1 -1
- package/dist/tui/services/ViteService.d.ts.map +1 -1
- package/dist/tui/services/ViteService.js +26 -28
- package/dist/tui/services/ViteService.js.map +1 -1
- package/dist/tui/services/index.d.ts +6 -6
- package/dist/tui/services/index.d.ts.map +1 -1
- package/dist/tui/services/index.js +6 -6
- package/dist/tui/services/index.js.map +1 -1
- package/mcp/gxp-api-server.js +83 -81
- package/package.json +109 -93
- package/runtime/PortalContainer.vue +258 -234
- package/runtime/dev-tools/DevToolsModal.vue +153 -155
- package/runtime/dev-tools/LayoutSwitcher.vue +144 -140
- package/runtime/dev-tools/MockDataEditor.vue +456 -433
- package/runtime/dev-tools/SocketSimulator.vue +379 -371
- package/runtime/dev-tools/StoreInspector.vue +517 -455
- package/runtime/dev-tools/index.js +5 -5
- package/runtime/fallback-layouts/PrivateLayout.vue +2 -2
- package/runtime/fallback-layouts/PublicLayout.vue +2 -2
- package/runtime/fallback-layouts/SystemLayout.vue +2 -2
- package/runtime/gxpStringsPlugin.js +159 -134
- package/runtime/index.html +17 -19
- package/runtime/main.js +24 -22
- package/runtime/mock-api/auth-middleware.js +15 -15
- package/runtime/mock-api/image-generator.js +46 -46
- package/runtime/mock-api/index.js +55 -55
- package/runtime/mock-api/response-generator.js +116 -105
- package/runtime/mock-api/route-generator.js +107 -84
- package/runtime/mock-api/socket-triggers.js +94 -93
- package/runtime/mock-api/spec-loader.js +79 -80
- package/runtime/package.json +3 -0
- package/runtime/server.js +68 -68
- package/runtime/stores/gxpPortalConfigStore.js +204 -186
- package/runtime/stores/index.js +2 -2
- package/runtime/vite-inspector-plugin.js +858 -707
- package/runtime/vite-source-tracker-plugin.js +132 -113
- package/runtime/vite.config.js +191 -139
- package/scripts/launch-chrome.js +41 -41
- package/scripts/pack-chrome.js +38 -39
- package/socket-events/AiSessionMessageCreated.json +17 -17
- package/socket-events/SocialStreamPostCreated.json +23 -23
- package/socket-events/SocialStreamPostVariantCompleted.json +22 -22
- package/template/.claude/agents/gxp-developer.md +100 -99
- package/template/.claude/settings.json +7 -7
- package/template/AGENTS.md +30 -23
- package/template/GEMINI.md +20 -20
- package/template/README.md +70 -53
- package/template/app-manifest.json +2 -4
- package/template/configuration.json +10 -10
- package/template/default-styling.css +1 -1
- package/template/index.html +18 -20
- package/template/main.js +24 -22
- package/template/src/DemoPage.vue +415 -362
- package/template/src/Plugin.vue +76 -85
- package/template/src/stores/index.js +3 -3
- package/template/src/stores/test-data.json +164 -172
- package/template/theme-layouts/AdditionalStyling.css +50 -50
- package/template/theme-layouts/PrivateLayout.vue +8 -12
- package/template/theme-layouts/PublicLayout.vue +8 -12
- package/template/theme-layouts/SystemLayout.vue +8 -12
- package/template/vite.extend.js +45 -0
- package/template/vite.config.js +0 -409
|
@@ -1,187 +1,217 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="plugin-container">
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
/>
|
|
22
|
-
<div class="asset-controls">
|
|
23
|
-
<button @click="addDevAssets" class="action-btn secondary small">
|
|
24
|
-
Add Dev Assets
|
|
25
|
-
</button>
|
|
26
|
-
<button @click="listAllAssets" class="action-btn secondary small">
|
|
27
|
-
List Assets
|
|
28
|
-
</button>
|
|
29
|
-
<button @click="updateLogo" class="action-btn secondary small">
|
|
30
|
-
Update Logo
|
|
31
|
-
</button>
|
|
32
|
-
</div>
|
|
33
|
-
<div v-if="currentAssets" class="asset-preview">
|
|
34
|
-
<h3>Current Assets:</h3>
|
|
35
|
-
<div v-for="(url, key) in currentAssets" :key="key" class="asset-item">
|
|
36
|
-
<strong>{{ key }}:</strong>
|
|
37
|
-
<a :href="url" target="_blank" class="asset-link">{{ url }}</a>
|
|
3
|
+
<!-- Example usage of the GxP Datastore -->
|
|
4
|
+
<div class="content-wrapper">
|
|
5
|
+
<h1 gxp-string="welcome_text">Welcome!</h1>
|
|
6
|
+
|
|
7
|
+
<div class="info-section">
|
|
8
|
+
<h2>Plugin Information</h2>
|
|
9
|
+
<p>
|
|
10
|
+
<strong>Primary Color:</strong>
|
|
11
|
+
<span gxp-string="primary_color"></span>
|
|
12
|
+
</p>
|
|
13
|
+
<p>
|
|
14
|
+
<strong>Project ID:</strong>
|
|
15
|
+
<span gxp-settings gxp-string="projectId"></span>
|
|
16
|
+
</p>
|
|
17
|
+
<p>
|
|
18
|
+
<strong>Environment:</strong>
|
|
19
|
+
<span gxp-settings gxp-string="environment"></span>
|
|
20
|
+
</p>
|
|
38
21
|
</div>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
22
|
+
|
|
23
|
+
<div class="assets-section">
|
|
24
|
+
<h2>Assets</h2>
|
|
25
|
+
<img
|
|
26
|
+
v-if="gxpStore.getAsset('main_logo')"
|
|
27
|
+
:src="gxpStore.getAsset('main_logo')"
|
|
28
|
+
alt="Main Logo"
|
|
29
|
+
class="logo"
|
|
30
|
+
/>
|
|
31
|
+
<div class="asset-controls">
|
|
32
|
+
<button @click="addDevAssets" class="action-btn secondary small">
|
|
33
|
+
Add Dev Assets
|
|
34
|
+
</button>
|
|
35
|
+
<button @click="listAllAssets" class="action-btn secondary small">
|
|
36
|
+
List Assets
|
|
37
|
+
</button>
|
|
38
|
+
<button @click="updateLogo" class="action-btn secondary small">
|
|
39
|
+
Update Logo
|
|
40
|
+
</button>
|
|
41
|
+
</div>
|
|
42
|
+
<div v-if="currentAssets" class="asset-preview">
|
|
43
|
+
<h3>Current Assets:</h3>
|
|
44
|
+
<div
|
|
45
|
+
v-for="(url, key) in currentAssets"
|
|
46
|
+
:key="key"
|
|
47
|
+
class="asset-item"
|
|
48
|
+
>
|
|
49
|
+
<strong>{{ key }}:</strong>
|
|
50
|
+
<a :href="url" target="_blank" class="asset-link">{{ url }}</a>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
<div class="actions-section">
|
|
56
|
+
<button
|
|
57
|
+
@click="handleApiCall"
|
|
58
|
+
class="action-btn"
|
|
59
|
+
:style="{ backgroundColor: gxpStore.getSetting('primary_color') }"
|
|
60
|
+
>
|
|
61
|
+
{{ gxpStore.getString("continue_button", "Continue") }}
|
|
62
|
+
</button>
|
|
63
|
+
|
|
64
|
+
<button @click="handleSocketTest" class="action-btn secondary">
|
|
65
|
+
Test Socket
|
|
66
|
+
</button>
|
|
67
|
+
|
|
68
|
+
<button
|
|
69
|
+
@click="props.router?.visit('/start')"
|
|
70
|
+
class="action-btn secondary"
|
|
71
|
+
>
|
|
72
|
+
{{ gxpStore.getString("back_button", "Back") }}
|
|
73
|
+
</button>
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
<div class="permissions-section">
|
|
77
|
+
<h2>Permissions</h2>
|
|
78
|
+
<ul>
|
|
79
|
+
<li
|
|
80
|
+
v-for="permission in [
|
|
81
|
+
'can_access_camera',
|
|
82
|
+
'can_save_data',
|
|
83
|
+
'can_share_content',
|
|
84
|
+
]"
|
|
85
|
+
:key="permission"
|
|
86
|
+
>
|
|
87
|
+
{{ permission }}:
|
|
88
|
+
<span
|
|
89
|
+
:class="gxpStore.hasPermission(permission) ? 'granted' : 'denied'"
|
|
90
|
+
>
|
|
91
|
+
{{ gxpStore.hasPermission(permission) ? "Granted" : "Denied" }}
|
|
92
|
+
</span>
|
|
93
|
+
</li>
|
|
94
|
+
</ul>
|
|
95
|
+
</div>
|
|
96
|
+
|
|
97
|
+
<div class="dependencies-section">
|
|
98
|
+
<h2>Available Dependencies</h2>
|
|
99
|
+
<div v-if="Array.isArray(gxpStore.dependencyList)">
|
|
100
|
+
<div
|
|
101
|
+
v-for="dependency in gxpStore.dependencyList"
|
|
102
|
+
:key="dependency.identifier"
|
|
103
|
+
class="dependency-item"
|
|
104
|
+
>
|
|
105
|
+
<h3>{{ dependency.identifier }}</h3>
|
|
106
|
+
<p><strong>Model:</strong> {{ dependency.model }}</p>
|
|
107
|
+
<p>
|
|
108
|
+
<strong>Events:</strong>
|
|
109
|
+
{{ Object.keys(dependency.events || {}).join(", ") || "None" }}
|
|
110
|
+
</p>
|
|
111
|
+
<button
|
|
112
|
+
@click="testDependencyAPI(dependency.identifier)"
|
|
113
|
+
class="action-btn secondary small"
|
|
114
|
+
>
|
|
115
|
+
Test API
|
|
116
|
+
</button>
|
|
117
|
+
<button
|
|
118
|
+
v-if="
|
|
119
|
+
dependency.events && Object.keys(dependency.events).length > 0
|
|
120
|
+
"
|
|
121
|
+
@click="setupDependencyListeners(dependency)"
|
|
122
|
+
class="action-btn secondary small"
|
|
123
|
+
>
|
|
124
|
+
Listen for Events
|
|
125
|
+
</button>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
<div v-else>
|
|
129
|
+
<ul>
|
|
130
|
+
<li v-for="(id, key) in gxpStore.dependencyList" :key="key">
|
|
131
|
+
{{ key }}: {{ id }}
|
|
132
|
+
</li>
|
|
133
|
+
</ul>
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
|
|
137
|
+
<!-- Example of how to use socket listeners -->
|
|
138
|
+
<div class="socket-section">
|
|
139
|
+
<h2>Socket Events</h2>
|
|
140
|
+
<button @click="emitTestEvent" class="action-btn secondary">
|
|
141
|
+
Emit Test Event
|
|
142
|
+
</button>
|
|
143
|
+
<div v-if="socketMessages.length > 0" class="socket-messages">
|
|
144
|
+
<h3>Received Messages:</h3>
|
|
145
|
+
<ul>
|
|
146
|
+
<li v-for="(message, index) in socketMessages" :key="index">
|
|
147
|
+
{{ message }}
|
|
148
|
+
</li>
|
|
149
|
+
</ul>
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
|
|
153
|
+
<!-- Complete button -->
|
|
154
|
+
<div class="complete-section">
|
|
155
|
+
<button
|
|
156
|
+
@click="props.router?.visit('/final')"
|
|
157
|
+
class="action-btn complete"
|
|
158
|
+
:style="{
|
|
159
|
+
backgroundColor: gxpStore.getSetting('final_background_color'),
|
|
160
|
+
}"
|
|
161
|
+
>
|
|
162
|
+
Complete Experience
|
|
163
|
+
</button>
|
|
98
164
|
</div>
|
|
99
|
-
</div>
|
|
100
|
-
<div v-else>
|
|
101
|
-
<ul>
|
|
102
|
-
<li v-for="(id, key) in gxpStore.dependencyList" :key="key">
|
|
103
|
-
{{ key }}: {{ id }}
|
|
104
|
-
</li>
|
|
105
|
-
</ul>
|
|
106
|
-
</div>
|
|
107
|
-
</div>
|
|
108
|
-
|
|
109
|
-
<!-- Example of how to use socket listeners -->
|
|
110
|
-
<div class="socket-section">
|
|
111
|
-
<h2>Socket Events</h2>
|
|
112
|
-
<button @click="emitTestEvent" class="action-btn secondary">
|
|
113
|
-
Emit Test Event
|
|
114
|
-
</button>
|
|
115
|
-
<div v-if="socketMessages.length > 0" class="socket-messages">
|
|
116
|
-
<h3>Received Messages:</h3>
|
|
117
|
-
<ul>
|
|
118
|
-
<li v-for="(message, index) in socketMessages" :key="index">
|
|
119
|
-
{{ message }}
|
|
120
|
-
</li>
|
|
121
|
-
</ul>
|
|
122
|
-
</div>
|
|
123
|
-
</div>
|
|
124
|
-
|
|
125
|
-
<!-- Complete button -->
|
|
126
|
-
<div class="complete-section">
|
|
127
|
-
<button
|
|
128
|
-
@click="props.router?.visit('/final')"
|
|
129
|
-
class="action-btn complete"
|
|
130
|
-
:style="{ backgroundColor: gxpStore.getSetting('final_background_color') }"
|
|
131
|
-
>
|
|
132
|
-
Complete Experience
|
|
133
|
-
</button>
|
|
134
165
|
</div>
|
|
135
|
-
</div>
|
|
136
166
|
</div>
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
167
|
+
</template>
|
|
168
|
+
|
|
169
|
+
<style scoped>
|
|
170
|
+
.plugin-container {
|
|
141
171
|
padding: 20px;
|
|
142
172
|
max-width: 800px;
|
|
143
173
|
margin: 0 auto;
|
|
144
174
|
font-family: Arial, sans-serif;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.content-wrapper {
|
|
148
178
|
background: white;
|
|
149
179
|
border-radius: 8px;
|
|
150
180
|
padding: 30px;
|
|
151
181
|
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
h1 {
|
|
155
185
|
color: v-bind('gxpStore.getSetting("primary_color")');
|
|
156
186
|
text-align: center;
|
|
157
187
|
margin-bottom: 30px;
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
h2 {
|
|
161
191
|
color: #333;
|
|
162
192
|
border-bottom: 2px solid #eee;
|
|
163
193
|
padding-bottom: 10px;
|
|
164
194
|
margin: 20px 0 15px 0;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.info-section,
|
|
198
|
+
.assets-section,
|
|
199
|
+
.actions-section,
|
|
200
|
+
.permissions-section,
|
|
201
|
+
.dependencies-section,
|
|
202
|
+
.socket-section,
|
|
203
|
+
.complete-section {
|
|
174
204
|
margin: 20px 0;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.logo {
|
|
178
208
|
max-width: 200px;
|
|
179
209
|
height: auto;
|
|
180
210
|
display: block;
|
|
181
211
|
margin: 10px 0;
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.action-btn {
|
|
185
215
|
background-color: #007bff;
|
|
186
216
|
color: white;
|
|
187
217
|
border: none;
|
|
@@ -191,269 +221,292 @@
|
|
|
191
221
|
cursor: pointer;
|
|
192
222
|
font-size: 16px;
|
|
193
223
|
transition: background-color 0.3s;
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.action-btn:hover {
|
|
197
227
|
opacity: 0.9;
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.action-btn.secondary {
|
|
201
231
|
background-color: #6c757d;
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.action-btn.complete {
|
|
205
235
|
background-color: #28a745;
|
|
206
236
|
font-size: 18px;
|
|
207
237
|
padding: 15px 30px;
|
|
208
238
|
display: block;
|
|
209
239
|
margin: 20px auto 0;
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.granted {
|
|
213
243
|
color: #28a745;
|
|
214
244
|
font-weight: bold;
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.denied {
|
|
218
248
|
color: #dc3545;
|
|
219
249
|
font-weight: bold;
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.socket-messages {
|
|
223
253
|
background: #f8f9fa;
|
|
224
254
|
padding: 15px;
|
|
225
255
|
border-radius: 4px;
|
|
226
256
|
margin-top: 10px;
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.dependency-item {
|
|
230
260
|
background: #f8f9fa;
|
|
231
261
|
padding: 15px;
|
|
232
262
|
margin: 10px 0;
|
|
233
263
|
border-radius: 4px;
|
|
234
264
|
border-left: 4px solid #007bff;
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.dependency-item h3 {
|
|
238
268
|
margin: 0 0 10px 0;
|
|
239
269
|
color: #007bff;
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.action-btn.small {
|
|
243
273
|
padding: 8px 16px;
|
|
244
274
|
font-size: 14px;
|
|
245
275
|
margin: 2px;
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
ul {
|
|
249
279
|
list-style-type: none;
|
|
250
280
|
padding: 0;
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
li {
|
|
254
284
|
padding: 5px 0;
|
|
255
285
|
border-bottom: 1px solid #eee;
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
li:last-child {
|
|
259
289
|
border-bottom: none;
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.asset-controls {
|
|
263
293
|
margin: 15px 0;
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.asset-preview {
|
|
267
297
|
background: #f8f9fa;
|
|
268
298
|
padding: 15px;
|
|
269
299
|
border-radius: 4px;
|
|
270
300
|
margin-top: 15px;
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.asset-preview h3 {
|
|
274
304
|
margin: 0 0 10px 0;
|
|
275
305
|
color: #333;
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.asset-item {
|
|
279
309
|
margin: 8px 0;
|
|
280
310
|
padding: 8px;
|
|
281
311
|
background: white;
|
|
282
312
|
border-radius: 4px;
|
|
283
313
|
border-left: 3px solid #007bff;
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.asset-link {
|
|
287
317
|
color: #007bff;
|
|
288
318
|
text-decoration: none;
|
|
289
319
|
word-break: break-all;
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.asset-link:hover {
|
|
293
323
|
text-decoration: underline;
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
324
|
+
}
|
|
325
|
+
</style>
|
|
326
|
+
|
|
327
|
+
<script setup>
|
|
328
|
+
defineOptions({
|
|
299
329
|
inheritAttrs: false,
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
330
|
+
})
|
|
331
|
+
|
|
332
|
+
import { ref, onMounted, onUnmounted } from "vue"
|
|
333
|
+
|
|
334
|
+
// Initialize the GxP store
|
|
335
|
+
import { useGxpStore } from "@/stores/gxpPortalConfigStore"
|
|
336
|
+
|
|
337
|
+
const gxpStore = useGxpStore()
|
|
338
|
+
|
|
339
|
+
// Define props (router will be passed from platform)
|
|
340
|
+
const props = defineProps({
|
|
311
341
|
router: {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
342
|
+
type: Object,
|
|
343
|
+
required: false,
|
|
344
|
+
default: () => ({
|
|
345
|
+
visit: (url, options) =>
|
|
346
|
+
console.log("Router not available:", url, options),
|
|
347
|
+
}),
|
|
317
348
|
},
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
349
|
+
})
|
|
350
|
+
|
|
351
|
+
// Router is now available as props.router for navigation
|
|
352
|
+
|
|
353
|
+
// Local state
|
|
354
|
+
const socketMessages = ref([])
|
|
355
|
+
const socketUnsubscribers = ref([])
|
|
356
|
+
const currentAssets = ref(null)
|
|
357
|
+
|
|
358
|
+
// Example API call using the store
|
|
359
|
+
async function handleApiCall() {
|
|
329
360
|
try {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
361
|
+
console.log("Making API call...")
|
|
362
|
+
// Example API call - this would work with your actual API
|
|
363
|
+
// const result = await gxpStore.apiGet('/some-endpoint');
|
|
364
|
+
// console.log('API Result:', result);
|
|
365
|
+
|
|
366
|
+
// For demo purposes, simulate API call
|
|
367
|
+
setTimeout(() => {
|
|
368
|
+
console.log("Simulated API call completed")
|
|
369
|
+
}, 1000)
|
|
340
370
|
} catch (error) {
|
|
341
|
-
|
|
371
|
+
console.error("API call failed:", error)
|
|
342
372
|
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
// Example dependency API call using new methods
|
|
376
|
+
async function testDependencyAPI(identifier) {
|
|
347
377
|
try {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
378
|
+
console.log(`Testing API for dependency: ${identifier}`)
|
|
379
|
+
|
|
380
|
+
// Example of the new getList method
|
|
381
|
+
// const result = await gxpStore.getList(identifier, { page: 1, limit: 10 });
|
|
382
|
+
// console.log(`API Result for ${identifier}:`, result);
|
|
383
|
+
|
|
384
|
+
// For demo purposes, simulate API call
|
|
385
|
+
socketMessages.value.unshift(`API call simulated for ${identifier}`)
|
|
357
386
|
} catch (error) {
|
|
358
|
-
|
|
359
|
-
|
|
387
|
+
console.error(`API call failed for ${identifier}:`, error)
|
|
388
|
+
socketMessages.value.unshift(
|
|
389
|
+
`API call failed for ${identifier}: ${error.message}`,
|
|
390
|
+
)
|
|
360
391
|
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
console.log(`Setting up listeners for ${dependency.identifier}`)
|
|
366
|
-
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// Set up socket listeners for a specific dependency
|
|
395
|
+
function setupDependencyListeners(dependency) {
|
|
396
|
+
console.log(`Setting up listeners for ${dependency.identifier}`)
|
|
397
|
+
|
|
367
398
|
// Set up listeners for each event type
|
|
368
|
-
Object.keys(dependency.events || {}).forEach(eventType => {
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
399
|
+
Object.keys(dependency.events || {}).forEach((eventType) => {
|
|
400
|
+
const eventName = dependency.events[eventType]
|
|
401
|
+
|
|
402
|
+
if (
|
|
403
|
+
gxpStore.sockets[dependency.identifier] &&
|
|
404
|
+
gxpStore.sockets[dependency.identifier][eventType]
|
|
405
|
+
) {
|
|
406
|
+
const unsubscribe = gxpStore.sockets[dependency.identifier][
|
|
407
|
+
eventType
|
|
408
|
+
].listen((data) => {
|
|
409
|
+
console.log(
|
|
410
|
+
`Received ${eventType} event for ${dependency.identifier}:`,
|
|
411
|
+
data,
|
|
412
|
+
)
|
|
413
|
+
socketMessages.value.unshift(
|
|
414
|
+
`${dependency.identifier}.${eventType}: ${data.message || JSON.stringify(data).substring(0, 50)}...`,
|
|
415
|
+
)
|
|
416
|
+
})
|
|
417
|
+
|
|
418
|
+
socketUnsubscribers.value.push(unsubscribe)
|
|
419
|
+
}
|
|
420
|
+
})
|
|
421
|
+
|
|
422
|
+
socketMessages.value.unshift(
|
|
423
|
+
`Listening for events on ${dependency.identifier}`,
|
|
424
|
+
)
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
// Example socket functionality
|
|
428
|
+
function handleSocketTest() {
|
|
388
429
|
// Emit a test event
|
|
389
|
-
gxpStore.emitSocket(
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
430
|
+
gxpStore.emitSocket("primary", "test-event", {
|
|
431
|
+
message: "Hello from plugin!",
|
|
432
|
+
})
|
|
433
|
+
console.log("Emitted test event via socket")
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
function emitTestEvent() {
|
|
437
|
+
const timestamp = new Date().toLocaleTimeString()
|
|
438
|
+
gxpStore.emitSocket("primary", "plugin-message", {
|
|
439
|
+
message: `Test message at ${timestamp}`,
|
|
440
|
+
timestamp: Date.now(),
|
|
441
|
+
})
|
|
442
|
+
|
|
443
|
+
socketMessages.value.unshift(`Sent: Test message at ${timestamp}`)
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// Asset management methods
|
|
447
|
+
function addDevAssets() {
|
|
405
448
|
// Add some development assets using the convenience method
|
|
406
|
-
gxpStore.addDevAsset(
|
|
407
|
-
gxpStore.addDevAsset(
|
|
408
|
-
gxpStore.addDevAsset(
|
|
409
|
-
gxpStore.addDevAsset(
|
|
410
|
-
|
|
411
|
-
console.log(
|
|
412
|
-
listAllAssets()
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
currentAssets.value = gxpStore.listAssets()
|
|
417
|
-
console.log(
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
449
|
+
gxpStore.addDevAsset("main_logo", "logo-placeholder.png")
|
|
450
|
+
gxpStore.addDevAsset("background_image", "background-placeholder.jpg")
|
|
451
|
+
gxpStore.addDevAsset("product_image", "product-placeholder.jpg")
|
|
452
|
+
gxpStore.addDevAsset("avatar_placeholder", "avatar-placeholder.png")
|
|
453
|
+
|
|
454
|
+
console.log("Added development assets")
|
|
455
|
+
listAllAssets()
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
function listAllAssets() {
|
|
459
|
+
currentAssets.value = gxpStore.listAssets()
|
|
460
|
+
console.log("Listed all assets")
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
function updateLogo() {
|
|
421
464
|
// Example of updating a specific asset
|
|
422
|
-
const appPort = window.location.port || 3000
|
|
423
|
-
const appProtocol = window.location.protocol ||
|
|
424
|
-
const newLogoUrl = `${appProtocol}://localhost:${appPort}/dev-assets/images/logo-placeholder.png
|
|
425
|
-
gxpStore.updateAsset(
|
|
426
|
-
console.log(
|
|
427
|
-
listAllAssets()
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
465
|
+
const appPort = window.location.port || 3000
|
|
466
|
+
const appProtocol = window.location.protocol || "http"
|
|
467
|
+
const newLogoUrl = `${appProtocol}://localhost:${appPort}/dev-assets/images/logo-placeholder.png`
|
|
468
|
+
gxpStore.updateAsset("main_logo", newLogoUrl)
|
|
469
|
+
console.log("Updated logo asset")
|
|
470
|
+
listAllAssets()
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
// Set up socket listeners when component mounts
|
|
474
|
+
onMounted(() => {
|
|
432
475
|
// Listen for test events
|
|
433
|
-
const unsubscribe1 = gxpStore.useSocketListener(
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
476
|
+
const unsubscribe1 = gxpStore.useSocketListener(
|
|
477
|
+
"primary",
|
|
478
|
+
"test-response",
|
|
479
|
+
(data) => {
|
|
480
|
+
console.log("Received test response:", data)
|
|
481
|
+
socketMessages.value.unshift(`Received: ${JSON.stringify(data)}`)
|
|
482
|
+
},
|
|
483
|
+
)
|
|
484
|
+
|
|
438
485
|
// Listen for any incoming messages
|
|
439
|
-
const unsubscribe2 = gxpStore.useSocketListener(
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
486
|
+
const unsubscribe2 = gxpStore.useSocketListener(
|
|
487
|
+
"primary",
|
|
488
|
+
"incoming-message",
|
|
489
|
+
(data) => {
|
|
490
|
+
console.log("Received incoming message:", data)
|
|
491
|
+
socketMessages.value.unshift(
|
|
492
|
+
`Incoming: ${data.message || JSON.stringify(data)}`,
|
|
493
|
+
)
|
|
494
|
+
},
|
|
495
|
+
)
|
|
496
|
+
|
|
444
497
|
// Store unsubscribers for cleanup
|
|
445
|
-
socketUnsubscribers.value = [unsubscribe1, unsubscribe2]
|
|
446
|
-
|
|
447
|
-
console.log(
|
|
448
|
-
console.log(
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
socketUnsubscribers.value.forEach(unsubscribe => {
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
})
|
|
458
|
-
|
|
459
|
-
|
|
498
|
+
socketUnsubscribers.value = [unsubscribe1, unsubscribe2]
|
|
499
|
+
|
|
500
|
+
console.log("Plugin component mounted with GxP Datastore")
|
|
501
|
+
console.log("Available store methods:", Object.keys(gxpStore))
|
|
502
|
+
})
|
|
503
|
+
|
|
504
|
+
// Clean up socket listeners when component unmounts
|
|
505
|
+
onUnmounted(() => {
|
|
506
|
+
socketUnsubscribers.value.forEach((unsubscribe) => {
|
|
507
|
+
if (typeof unsubscribe === "function") {
|
|
508
|
+
unsubscribe()
|
|
509
|
+
}
|
|
510
|
+
})
|
|
511
|
+
})
|
|
512
|
+
</script>
|