@gxp-dev/tools 2.0.63 → 2.0.65

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