Skip to content

Commit af01f48

Browse files
committed
rm RemixAIEvent in matamo types
1 parent 119877a commit af01f48

File tree

8 files changed

+58
-43
lines changed

8 files changed

+58
-43
lines changed

apps/remix-ide/src/app/plugins/remix-ai-assistant.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export class RemixAIAssistant extends ViewPlugin {
103103

104104
async handleActivity(type: string, payload: any) {
105105
// Use the proper type-safe tracking helper with RemixAI events
106-
trackMatomoEvent(this, { category: 'ai', action: 'remixAI', name: `${type}-${payload}`, isClick: true })
106+
trackMatomoEvent(this, { category: 'ai', action: 'chatting', name: `${type}-${payload}`, isClick: true })
107107
}
108108

109109
updateComponent(state: {

apps/remix-ide/src/app/plugins/remixAIPlugin.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ export class RemixAIPlugin extends Plugin {
195195
params.threadId = newThreadID
196196
params.provider = 'anthropic' // enforce all generation to be only on anthropic
197197
useRag = false
198-
trackMatomoEvent(this, { category: 'ai', action: 'remixAI', name: 'GenerateNewAIWorkspace', isClick: false })
198+
trackMatomoEvent(this, { category: 'ai', action: 'GenerateNewAIWorkspace', name: 'GenerateNewAIWorkspace', isClick: false })
199199
let userPrompt = ''
200200

201201
if (useRag) {
@@ -239,7 +239,7 @@ export class RemixAIPlugin extends Plugin {
239239
params.threadId = newThreadID
240240
params.provider = this.assistantProvider
241241
useRag = false
242-
trackMatomoEvent(this, { category: 'ai', action: 'remixAI', name: 'WorkspaceAgentEdit', isClick: false })
242+
trackMatomoEvent(this, { category: 'ai', action: 'GenerateNewAIWorkspace', name: 'WorkspaceAgentEdit', isClick: false })
243243

244244
await statusCallback?.('Performing workspace request...')
245245
if (useRag) {
@@ -310,7 +310,7 @@ export class RemixAIPlugin extends Plugin {
310310
else {
311311
console.log("chatRequestBuffer is not empty. First process the last request.", this.chatRequestBuffer)
312312
}
313-
trackMatomoEvent(this, { category: 'ai', action: 'remixAI', name: 'remixAI_chat', isClick: false })
313+
trackMatomoEvent(this, { category: 'ai', action: 'chatting', name: 'remixAI_chat', isClick: false })
314314
}
315315

316316
async ProcessChatRequestBuffer(params:IParams=GenerationParams){

apps/remix-ide/src/assets/list.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,18 @@
10661066
"urls": [
10671067
"dweb:/ipfs/QmXFsguaaxZj2FZmf2pGLTPDDkDD8nHX4grC4jDVugnMxv"
10681068
]
1069+
},
1070+
{
1071+
"path": "soljson-v0.8.31-pre.1+commit.b59566f6.js",
1072+
"version": "0.8.31",
1073+
"prerelease": "pre.1",
1074+
"build": "commit.b59566f6",
1075+
"longVersion": "0.8.31-pre.1+commit.b59566f6",
1076+
"keccak256": "0x5cbab72123ec1f65e72592375e568788d88c96ffd90a1a3e9107fcd5a3b9cf87",
1077+
"sha256": "0xaf2b74e3c674c09ce89189edfaa81a0d01f1a0dce9100968e0d442de8a93b926",
1078+
"urls": [
1079+
"dweb:/ipfs/QmafWKo2uVeEPMi1GbY2DVPreWtbA6aqXjynnn4wViA6a4"
1080+
]
10691081
}
10701082
],
10711083
"releases": {

libs/remix-api/src/lib/plugins/matomo/events/ai-events.ts

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* AI Events - AI and Copilot related tracking events
3-
*
3+
*
44
* This file contains all AI-related Matomo events including RemixAI interactions,
55
* Ollama local AI, and code completion features.
66
*/
@@ -9,7 +9,7 @@ import { MatomoEventBase } from '../core/base-types';
99

1010
export interface AIEvent extends MatomoEventBase {
1111
category: 'ai';
12-
action:
12+
action:
1313
| 'remixAI'
1414
| 'error_explaining_SolidityError'
1515
| 'vulnerability_check_pasted_code'
@@ -20,6 +20,9 @@ export interface AIEvent extends MatomoEventBase {
2020
| 'code_insertion'
2121
| 'code_completion'
2222
| 'AddingAIContext'
23+
| 'GenerateNewAIWorkspace'
24+
| 'chatting'
25+
| 'completion'
2326
| 'ollama_host_cache_hit'
2427
| 'ollama_port_check'
2528
| 'ollama_host_discovered_success'
@@ -61,25 +64,26 @@ export interface AIEvent extends MatomoEventBase {
6164
| 'ollama_connection_error'
6265
| 'ollama_model_selected'
6366
| 'ollama_model_set_backend_success'
64-
| 'ollama_model_set_backend_failed';
65-
}
66-
67-
68-
69-
/**
70-
* RemixAI Events - Specific to RemixAI interactions
71-
*/
72-
export interface RemixAIEvent extends MatomoEventBase {
73-
category: 'remixAI';
74-
action:
67+
| 'ollama_model_set_backend_failed'
7568
| 'ModeSwitch'
7669
| 'GenerateNewAIWorkspaceFromEditMode'
7770
| 'SetAIProvider'
7871
| 'SetOllamaModel'
7972
| 'GenerateNewAIWorkspaceFromModal';
8073
}
8174

82-
75+
// /**
76+
// * RemixAI Events - Specific to RemixAI interactions
77+
// */
78+
// export interface RemixAIEvent extends MatomoEventBase {
79+
// category: 'remixAI';
80+
// action:
81+
// | 'ModeSwitch'
82+
// | 'GenerateNewAIWorkspaceFromEditMode'
83+
// | 'SetAIProvider'
84+
// | 'SetOllamaModel'
85+
// | 'GenerateNewAIWorkspaceFromModal';
86+
// }
8387

8488
/**
8589
* RemixAI Assistant Events - Specific to assistant interactions

libs/remix-api/src/lib/plugins/matomo/index.ts

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/**
22
* Matomo Events - Modular Event System
3-
*
3+
*
44
* This is the main index for the split Matomo event system.
55
* It re-exports all events to maintain backward compatibility while
66
* organizing the code into manageable modules.
7-
*
7+
*
88
* Usage:
99
* import { trackMatomoEvent } from '@remix-api'
10-
*
10+
*
1111
* trackMatomoEvent(plugin, { category: 'ai', action: 'remixAI', name: 'code_generation', isClick: true })
1212
* trackMatomoEvent(plugin, { category: 'git', action: 'COMMIT', name: 'success', isClick: true })
1313
*/
@@ -18,7 +18,7 @@ export * from './core/categories';
1818

1919
// Event modules - organized by domain
2020
export * from './events/ai-events';
21-
export * from './events/compiler-events';
21+
export * from './events/compiler-events';
2222
export * from './events/git-events';
2323
export * from './events/ui-events';
2424
export * from './events/file-events';
@@ -27,7 +27,7 @@ export * from './events/plugin-events';
2727
export * from './events/tools-events';
2828

2929
// Import types for union
30-
import type { AIEvent, RemixAIEvent, RemixAIAssistantEvent } from './events/ai-events';
30+
import type { AIEvent, RemixAIAssistantEvent } from './events/ai-events';
3131
import type { CompilerEvent, SolidityCompilerEvent, CompilerContainerEvent } from './events/compiler-events';
3232
import type { GitEvent } from './events/git-events';
3333
import type { HomeTabEvent, TopbarEvent, LayoutEvent, SettingsEvent, ThemeEvent, LocaleEvent, LandingPageEvent } from './events/ui-events';
@@ -40,17 +40,16 @@ import type { DebuggerEvent, EditorEvent, SolidityUnitTestingEvent, SolidityStat
4040
export type MatomoEvent = (
4141
// AI & Assistant events
4242
| AIEvent
43-
| RemixAIEvent
4443
| RemixAIAssistantEvent
45-
44+
4645
// Compilation events
4746
| CompilerEvent
4847
| SolidityCompilerEvent
4948
| CompilerContainerEvent
50-
49+
5150
// Version Control events
5251
| GitEvent
53-
52+
5453
// User Interface events
5554
| HomeTabEvent
5655
| TopbarEvent
@@ -59,18 +58,18 @@ export type MatomoEvent = (
5958
| ThemeEvent
6059
| LocaleEvent
6160
| LandingPageEvent
62-
61+
6362
// File Management events
6463
| FileExplorerEvent
6564
| WorkspaceEvent
6665
| StorageEvent
6766
| BackupEvent
68-
67+
6968
// Blockchain & Contract events
7069
| BlockchainEvent
7170
| UdappEvent
7271
| RunEvent
73-
72+
7473
// Plugin Management events
7574
| PluginEvent
7675
| ManagerEvent
@@ -79,7 +78,7 @@ export type MatomoEvent = (
7978
| MatomoManagerEvent
8079
| PluginPanelEvent
8180
| MigrateEvent
82-
81+
8382
// Development Tools events
8483
| DebuggerEvent
8584
| EditorEvent
@@ -97,7 +96,7 @@ export type MatomoEvent = (
9796
| CircuitCompilerEvent
9897
| ContractVerificationEvent
9998
| LearnethEvent
100-
99+
101100
) & {
102101
// Ensure all events have these base properties for backward compatibility
103102
name?: string;

libs/remix-ui/editor/src/lib/providers/inlineCompletionProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ export class RemixInLineCompletionProvider implements monacoTypes.languages.Inli
307307
this.currentCompletion.task = this.task
308308

309309
this.rateLimiter.trackCompletionShown()
310-
this.trackMatomoEvent?.({ category: 'ai', action: 'remixAI', name: this.task + '_did_show', isClick: true })
310+
this.trackMatomoEvent?.({ category: 'ai', action: 'completion', name: this.task + '_did_show', isClick: true })
311311
}
312312

313313
handlePartialAccept?(
@@ -319,7 +319,7 @@ export class RemixInLineCompletionProvider implements monacoTypes.languages.Inli
319319
this.currentCompletion.task = this.task
320320

321321
this.rateLimiter.trackCompletionAccepted()
322-
this.trackMatomoEvent?.({ category: 'ai', action: 'remixAI', name: this.task + '_partial_accept', isClick: true })
322+
this.trackMatomoEvent?.({ category: 'ai', action: 'completion', name: this.task + '_partial_accept', isClick: true })
323323
}
324324

325325
freeInlineCompletions(

libs/remix-ui/remix-ai-assistant/src/components/prompt.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import GroupListMenu from "./contextOptMenu"
44
import { AiContextType, groupListType } from '../types/componentTypes'
55
import { AiAssistantType } from '../types/componentTypes'
66
import { CustomTooltip } from "@remix-ui/helper"
7-
import { RemixAIEvent, MatomoEvent } from '@remix-api';
7+
import { AIEvent, MatomoEvent } from '@remix-api';
88
import { TrackingContext } from '@remix-ide/tracking'
99

1010
// PromptArea component
@@ -84,7 +84,7 @@ export const PromptArea: React.FC<PromptAreaProps> = ({
8484
setIsMaximized
8585
}) => {
8686
const { trackMatomoEvent: baseTrackEvent } = useContext(TrackingContext)
87-
const trackMatomoEvent = <T extends MatomoEvent = RemixAIEvent>(event: T) => {
87+
const trackMatomoEvent = <T extends MatomoEvent = AIEvent>(event: T) => {
8888
baseTrackEvent?.<T>(event)
8989
}
9090

@@ -129,7 +129,7 @@ export const PromptArea: React.FC<PromptAreaProps> = ({
129129
className={`btn btn-sm ${aiMode === 'ask' ? 'btn-primary' : 'btn-outline-secondary'} px-2`}
130130
onClick={() => {
131131
setAiMode('ask')
132-
trackMatomoEvent({ category: 'remixAI', action: 'ModeSwitch', name: 'ask', isClick: true })
132+
trackMatomoEvent({ category: 'ai', action: 'ModeSwitch', name: 'ask', isClick: true })
133133
}}
134134
title="Ask mode - Chat with AI"
135135
>
@@ -140,7 +140,7 @@ export const PromptArea: React.FC<PromptAreaProps> = ({
140140
className={`btn btn-sm ${aiMode === 'edit' ? 'btn-primary' : 'btn-outline-secondary'} px-2`}
141141
onClick={() => {
142142
setAiMode('edit')
143-
trackMatomoEvent({ category: 'remixAI', action: 'ModeSwitch', name: 'edit', isClick: true })
143+
trackMatomoEvent({ category: 'ai', action: 'ModeSwitch', name: 'edit', isClick: true })
144144
}}
145145
title="Edit mode - Edit workspace code"
146146
>

libs/remix-ui/remix-ai-assistant/src/components/remix-ui-remix-ai-assistant.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { HandleOpenAIResponse, HandleMistralAIResponse, HandleAnthropicResponse,
66
import '../css/color.css'
77
import { Plugin } from '@remixproject/engine'
88
import { ModalTypes } from '@remix-ui/app'
9-
import { MatomoEvent, AIEvent, RemixAIEvent, RemixAIAssistantEvent } from '@remix-api'
9+
import { MatomoEvent, AIEvent, RemixAIAssistantEvent } from '@remix-api'
1010
import { TrackingContext } from '@remix-ide/tracking'
1111
import { PromptArea } from './prompt'
1212
import { ChatHistoryComponent } from './chat'
@@ -449,7 +449,7 @@ export const RemixUiRemixAiAssistant = React.forwardRef<
449449
dispatchActivity('button', 'generateWorkspace')
450450
if (prompt && prompt.trim()) {
451451
await sendPrompt(`/workspace ${prompt.trim()}`)
452-
trackMatomoEvent<RemixAIEvent>({ category: 'remixAI', action: 'GenerateNewAIWorkspaceFromEditMode', name: prompt, isClick: true })
452+
trackMatomoEvent<AIEvent>({ category: 'ai', action: 'GenerateNewAIWorkspaceFromEditMode', name: prompt, isClick: true })
453453
}
454454
}, [sendPrompt])
455455

@@ -486,7 +486,7 @@ export const RemixUiRemixAiAssistant = React.forwardRef<
486486
dispatchActivity('button', 'setAssistant')
487487
setMessages([])
488488
sendPrompt(`/setAssistant ${assistantChoice}`)
489-
trackMatomoEvent<RemixAIEvent>({ category: 'remixAI', action: 'SetAIProvider', name: assistantChoice, isClick: true })
489+
trackMatomoEvent<AIEvent>({ category: 'ai', action: 'SetAIProvider', name: assistantChoice, isClick: true })
490490
// Log specific Ollama selection
491491
if (assistantChoice === 'ollama') {
492492
trackMatomoEvent({ category: 'ai', action: 'ollama_provider_selected', name: `from:${choiceSetting || 'unknown'}`, isClick: false })
@@ -605,7 +605,7 @@ export const RemixUiRemixAiAssistant = React.forwardRef<
605605
console.warn('Failed to set model:', error)
606606
trackMatomoEvent({ category: 'ai', action: 'ollama_model_set_backend_failed', name: `${modelName}|${error.message || 'unknown'}`, isClick: false })
607607
}
608-
trackMatomoEvent<RemixAIEvent>({ category: 'remixAI', action: 'SetOllamaModel', name: modelName, isClick: true })
608+
trackMatomoEvent<AIEvent>({ category: 'ai', action: 'SetOllamaModel', name: modelName, isClick: true })
609609
}, [props.plugin, selectedModel])
610610

611611
// refresh context whenever selection changes (even if selector is closed)
@@ -654,7 +654,7 @@ export const RemixUiRemixAiAssistant = React.forwardRef<
654654

655655
if (description && description.trim()) {
656656
sendPrompt(`/generate ${description.trim()}`)
657-
trackMatomoEvent<RemixAIEvent>({ category: 'remixAI', action: 'GenerateNewAIWorkspaceFromModal', name: description, isClick: true })
657+
trackMatomoEvent<AIEvent>({ category: 'ai', action: 'GenerateNewAIWorkspaceFromModal', name: description, isClick: true })
658658
}
659659
} catch {
660660
/* user cancelled */

0 commit comments

Comments
 (0)