turbowrap-issue-widget 1.0.10 → 1.0.11
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/dist/api/client.d.ts +2 -2
- package/dist/api/types.d.ts +9 -0
- package/dist/issue-widget.es.js +45 -21
- package/dist/issue-widget.es.js.map +1 -1
- package/dist/issue-widget.min.js +32 -18
- package/dist/issue-widget.min.js.map +1 -1
- package/dist/issue-widget.umd.js +32 -18
- package/dist/issue-widget.umd.js.map +1 -1
- package/dist/ui/styles.d.ts +1 -1
- package/package.json +11 -11
package/dist/api/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WidgetConfig, AnalyzeRequest, AnalyzeResult, FinalizeRequest, IssueCreatedResult, ChatContext, ChatSessionResponse, ChatActionData } from './types';
|
|
1
|
+
import { WidgetConfig, AnalyzeRequest, AnalyzeResult, FinalizeRequest, IssueCreatedResult, ChatContext, ChatSessionOptions, ChatSessionResponse, ChatActionData } from './types';
|
|
2
2
|
export declare class IssueAPIClient {
|
|
3
3
|
private baseUrl;
|
|
4
4
|
private apiKey;
|
|
@@ -7,7 +7,7 @@ export declare class IssueAPIClient {
|
|
|
7
7
|
analyzeIssue(data: AnalyzeRequest, onProgress: (msg: string) => void, onComplete: (result: AnalyzeResult) => void, onError: (error: string) => void): Promise<void>;
|
|
8
8
|
finalizeIssue(data: FinalizeRequest, onProgress: (msg: string) => void, onComplete: (result: IssueCreatedResult) => void, onError: (error: string) => void): Promise<void>;
|
|
9
9
|
private parseSSEStream;
|
|
10
|
-
createChatSession(
|
|
10
|
+
createChatSession(options?: ChatSessionOptions): Promise<ChatSessionResponse>;
|
|
11
11
|
sendChatMessage(sessionId: string, message: string, context: ChatContext | undefined, onChunk: (content: string) => void, onAction: (action: ChatActionData) => void, onComplete: () => void, onError: (error: string) => void): Promise<void>;
|
|
12
12
|
deleteChatSession(sessionId: string): Promise<void>;
|
|
13
13
|
private parseChatSSEStream;
|
package/dist/api/types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export interface WidgetConfig {
|
|
|
3
3
|
apiUrl: string;
|
|
4
4
|
apiKey: string;
|
|
5
5
|
teamId: string;
|
|
6
|
+
repositoryId?: string;
|
|
6
7
|
position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
7
8
|
theme?: 'light' | 'dark' | 'auto';
|
|
8
9
|
buttonText?: string;
|
|
@@ -26,6 +27,7 @@ export interface AnalyzeRequest {
|
|
|
26
27
|
description: string;
|
|
27
28
|
issueType: IssueType;
|
|
28
29
|
screenshots: Blob[];
|
|
30
|
+
repositoryId?: string;
|
|
29
31
|
figmaLink?: string;
|
|
30
32
|
websiteLink?: string;
|
|
31
33
|
selectedElement?: ElementInfo;
|
|
@@ -76,8 +78,15 @@ export interface ChatMessage {
|
|
|
76
78
|
timestamp: Date;
|
|
77
79
|
isStreaming?: boolean;
|
|
78
80
|
}
|
|
81
|
+
export interface ChatSessionOptions {
|
|
82
|
+
context?: ChatContext;
|
|
83
|
+
model?: string;
|
|
84
|
+
agent?: string;
|
|
85
|
+
}
|
|
79
86
|
export interface ChatSessionResponse {
|
|
80
87
|
session_id: string;
|
|
88
|
+
model: string;
|
|
89
|
+
agent: string;
|
|
81
90
|
message?: string;
|
|
82
91
|
}
|
|
83
92
|
export interface ChatActionData {
|
package/dist/issue-widget.es.js
CHANGED
|
@@ -13,7 +13,7 @@ class Cn {
|
|
|
13
13
|
n.append("title", A.title), n.append("description", A.description), n.append("issue_type", A.issueType), A.screenshots.forEach((i, o) => {
|
|
14
14
|
const a = Date.now();
|
|
15
15
|
n.append("screenshots", i, `screenshot-${o}-${a}.png`);
|
|
16
|
-
}), A.figmaLink && n.append("figma_link", A.figmaLink), A.websiteLink && n.append("website_link", A.websiteLink), A.selectedElement && n.append("selected_element", JSON.stringify(A.selectedElement));
|
|
16
|
+
}), A.repositoryId && n.append("repository_id", A.repositoryId), A.figmaLink && n.append("figma_link", A.figmaLink), A.websiteLink && n.append("website_link", A.websiteLink), A.selectedElement && n.append("selected_element", JSON.stringify(A.selectedElement));
|
|
17
17
|
try {
|
|
18
18
|
const i = await fetch(`${this.baseUrl}/api/linear/create/analyze`, {
|
|
19
19
|
method: "POST",
|
|
@@ -124,7 +124,11 @@ class Cn {
|
|
|
124
124
|
"Content-Type": "application/json",
|
|
125
125
|
"X-Widget-Key": this.apiKey
|
|
126
126
|
},
|
|
127
|
-
body: JSON.stringify({
|
|
127
|
+
body: JSON.stringify({
|
|
128
|
+
context: A == null ? void 0 : A.context,
|
|
129
|
+
model: A == null ? void 0 : A.model,
|
|
130
|
+
agent: A == null ? void 0 : A.agent
|
|
131
|
+
})
|
|
128
132
|
});
|
|
129
133
|
if (!e.ok)
|
|
130
134
|
throw new Error(`HTTP ${e.status}: ${e.statusText}`);
|
|
@@ -5449,8 +5453,8 @@ const qc = `
|
|
|
5449
5453
|
|
|
5450
5454
|
.iw-progress-bar {
|
|
5451
5455
|
display: flex;
|
|
5452
|
-
padding:
|
|
5453
|
-
gap:
|
|
5456
|
+
padding: 8px 20px;
|
|
5457
|
+
gap: 6px;
|
|
5454
5458
|
border-bottom: 1px solid var(--iw-border);
|
|
5455
5459
|
}
|
|
5456
5460
|
|
|
@@ -5459,19 +5463,19 @@ const qc = `
|
|
|
5459
5463
|
display: flex;
|
|
5460
5464
|
flex-direction: column;
|
|
5461
5465
|
align-items: center;
|
|
5462
|
-
gap:
|
|
5466
|
+
gap: 3px;
|
|
5463
5467
|
}
|
|
5464
5468
|
|
|
5465
5469
|
.iw-step-dot {
|
|
5466
|
-
width:
|
|
5467
|
-
height:
|
|
5470
|
+
width: 20px;
|
|
5471
|
+
height: 20px;
|
|
5468
5472
|
border-radius: 50%;
|
|
5469
5473
|
background: var(--iw-bg-secondary);
|
|
5470
|
-
border:
|
|
5474
|
+
border: 1px solid var(--iw-border);
|
|
5471
5475
|
display: flex;
|
|
5472
5476
|
align-items: center;
|
|
5473
5477
|
justify-content: center;
|
|
5474
|
-
font-size:
|
|
5478
|
+
font-size: 11px;
|
|
5475
5479
|
font-weight: 600;
|
|
5476
5480
|
color: var(--iw-text-secondary);
|
|
5477
5481
|
transition: all 0.3s;
|
|
@@ -5490,10 +5494,10 @@ const qc = `
|
|
|
5490
5494
|
}
|
|
5491
5495
|
|
|
5492
5496
|
.iw-step-label {
|
|
5493
|
-
font-size:
|
|
5497
|
+
font-size: 9px;
|
|
5494
5498
|
color: var(--iw-text-secondary);
|
|
5495
5499
|
text-transform: uppercase;
|
|
5496
|
-
letter-spacing: 0.
|
|
5500
|
+
letter-spacing: 0.3px;
|
|
5497
5501
|
}
|
|
5498
5502
|
|
|
5499
5503
|
.iw-content {
|
|
@@ -5880,15 +5884,15 @@ const qc = `
|
|
|
5880
5884
|
display: flex;
|
|
5881
5885
|
flex-direction: column;
|
|
5882
5886
|
align-items: center;
|
|
5883
|
-
gap:
|
|
5884
|
-
padding:
|
|
5887
|
+
gap: 3px;
|
|
5888
|
+
padding: 8px 6px;
|
|
5885
5889
|
border: 1px solid var(--iw-border);
|
|
5886
5890
|
border-radius: 8px;
|
|
5887
5891
|
background: var(--iw-bg);
|
|
5888
5892
|
cursor: pointer;
|
|
5889
5893
|
transition: all 0.2s;
|
|
5890
5894
|
font-family: var(--iw-font);
|
|
5891
|
-
font-size:
|
|
5895
|
+
font-size: 11px;
|
|
5892
5896
|
color: var(--iw-text);
|
|
5893
5897
|
}
|
|
5894
5898
|
|
|
@@ -5904,7 +5908,7 @@ const qc = `
|
|
|
5904
5908
|
}
|
|
5905
5909
|
|
|
5906
5910
|
.iw-type-icon {
|
|
5907
|
-
font-size:
|
|
5911
|
+
font-size: 16px;
|
|
5908
5912
|
}
|
|
5909
5913
|
|
|
5910
5914
|
@media (max-width: 480px) {
|
|
@@ -6222,6 +6226,19 @@ const qc = `
|
|
|
6222
6226
|
height: 48px;
|
|
6223
6227
|
}
|
|
6224
6228
|
}
|
|
6229
|
+
|
|
6230
|
+
.iw-version {
|
|
6231
|
+
position: absolute;
|
|
6232
|
+
bottom: 4px;
|
|
6233
|
+
right: 8px;
|
|
6234
|
+
font-size: 9px;
|
|
6235
|
+
font-style: italic;
|
|
6236
|
+
color: var(--iw-text-secondary);
|
|
6237
|
+
opacity: 0.5;
|
|
6238
|
+
font-family: var(--iw-font);
|
|
6239
|
+
pointer-events: none;
|
|
6240
|
+
user-select: none;
|
|
6241
|
+
}
|
|
6225
6242
|
`, j = {
|
|
6226
6243
|
bug: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
6227
6244
|
<path d="M8 2l1.88 1.88"/>
|
|
@@ -6269,8 +6286,8 @@ const qc = `
|
|
|
6269
6286
|
<line x1="22" y1="2" x2="11" y2="13"/>
|
|
6270
6287
|
<polygon points="22 2 15 22 11 13 2 9 22 2"/>
|
|
6271
6288
|
</svg>`
|
|
6272
|
-
}, cs = 100,
|
|
6273
|
-
class
|
|
6289
|
+
}, $c = "1.0.10", cs = 100, jc = 50;
|
|
6290
|
+
class Al {
|
|
6274
6291
|
constructor(A) {
|
|
6275
6292
|
$(this, "config");
|
|
6276
6293
|
$(this, "client");
|
|
@@ -6305,6 +6322,8 @@ class jc {
|
|
|
6305
6322
|
error: null,
|
|
6306
6323
|
isLoading: !1,
|
|
6307
6324
|
isCapturingScreenshot: !1,
|
|
6325
|
+
// Repository context
|
|
6326
|
+
repositoryId: this.config.repositoryId || null,
|
|
6308
6327
|
// Chat mode
|
|
6309
6328
|
mode: "form",
|
|
6310
6329
|
chatSessionId: null,
|
|
@@ -6329,7 +6348,7 @@ class jc {
|
|
|
6329
6348
|
this.state.chatMessages.push(A), this.state.chatMessages.length > cs && (this.state.chatMessages = this.state.chatMessages.slice(-cs));
|
|
6330
6349
|
}
|
|
6331
6350
|
addProgressMessage(A) {
|
|
6332
|
-
this.state.progressMessages.push(A), this.state.progressMessages.length >
|
|
6351
|
+
this.state.progressMessages.push(A), this.state.progressMessages.length > jc && this.state.progressMessages.shift();
|
|
6333
6352
|
}
|
|
6334
6353
|
getHTML() {
|
|
6335
6354
|
const A = this.config.position || "bottom-right", { step: e, isOpen: t, mode: s } = this.state;
|
|
@@ -6380,6 +6399,7 @@ class jc {
|
|
|
6380
6399
|
${this.renderChatMode()}
|
|
6381
6400
|
</div>
|
|
6382
6401
|
`}
|
|
6402
|
+
<div class="iw-version">v${$c}</div>
|
|
6383
6403
|
</div>
|
|
6384
6404
|
`;
|
|
6385
6405
|
}
|
|
@@ -6707,6 +6727,8 @@ class jc {
|
|
|
6707
6727
|
error: null,
|
|
6708
6728
|
isLoading: !1,
|
|
6709
6729
|
isCapturingScreenshot: !1,
|
|
6730
|
+
// Repository context (preserved from config)
|
|
6731
|
+
repositoryId: this.config.repositoryId || null,
|
|
6710
6732
|
// Chat mode - reset
|
|
6711
6733
|
mode: "form",
|
|
6712
6734
|
chatSessionId: null,
|
|
@@ -6884,7 +6906,7 @@ class jc {
|
|
|
6884
6906
|
pageUrl: window.location.href,
|
|
6885
6907
|
pageTitle: document.title,
|
|
6886
6908
|
selectedElement: this.state.selectedElement || void 0
|
|
6887
|
-
}, s = await this.client.createChatSession(t);
|
|
6909
|
+
}, s = await this.client.createChatSession({ context: t });
|
|
6888
6910
|
this.state.chatSessionId = s.session_id;
|
|
6889
6911
|
}
|
|
6890
6912
|
await this.client.sendChatMessage(
|
|
@@ -6981,6 +7003,7 @@ class jc {
|
|
|
6981
7003
|
description: this.state.description,
|
|
6982
7004
|
issueType: this.state.issueType,
|
|
6983
7005
|
screenshots: this.state.screenshots,
|
|
7006
|
+
repositoryId: this.state.repositoryId || void 0,
|
|
6984
7007
|
websiteLink: window.location.href,
|
|
6985
7008
|
selectedElement: this.state.selectedElement || void 0
|
|
6986
7009
|
},
|
|
@@ -7071,6 +7094,7 @@ class jc {
|
|
|
7071
7094
|
error: null,
|
|
7072
7095
|
isLoading: !1,
|
|
7073
7096
|
isCapturingScreenshot: !1,
|
|
7097
|
+
repositoryId: null,
|
|
7074
7098
|
mode: "form",
|
|
7075
7099
|
chatSessionId: null,
|
|
7076
7100
|
chatMessages: [],
|
|
@@ -7107,10 +7131,10 @@ function ls() {
|
|
|
7107
7131
|
console.error("[IssueWidget] Missing required config: teamId");
|
|
7108
7132
|
return;
|
|
7109
7133
|
}
|
|
7110
|
-
window.IssueWidget = new
|
|
7134
|
+
window.IssueWidget = new Al(r);
|
|
7111
7135
|
}
|
|
7112
7136
|
typeof window < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", ls) : ls());
|
|
7113
7137
|
export {
|
|
7114
|
-
|
|
7138
|
+
Al as IssueWidget
|
|
7115
7139
|
};
|
|
7116
7140
|
//# sourceMappingURL=issue-widget.es.js.map
|