@sylergydigital/issue-pin-sdk 0.6.5 → 0.6.7
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/CHANGELOG.md +5 -0
- package/dist/index.cjs +40 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +40 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -157,6 +157,7 @@ interface FeedbackContextType {
|
|
|
157
157
|
submitThread: (body: string, visibility: "public" | "internal") => Promise<void>;
|
|
158
158
|
submitScreenshotThread: (body: string, visibility: "public" | "internal") => Promise<void>;
|
|
159
159
|
refreshThreads: () => Promise<void>;
|
|
160
|
+
openThreadInDashboard: (threadId: string) => void;
|
|
160
161
|
}
|
|
161
162
|
/**
|
|
162
163
|
* SDK Entry Point — wrap your app to enable in-app feedback.
|
package/dist/index.d.ts
CHANGED
|
@@ -157,6 +157,7 @@ interface FeedbackContextType {
|
|
|
157
157
|
submitThread: (body: string, visibility: "public" | "internal") => Promise<void>;
|
|
158
158
|
submitScreenshotThread: (body: string, visibility: "public" | "internal") => Promise<void>;
|
|
159
159
|
refreshThreads: () => Promise<void>;
|
|
160
|
+
openThreadInDashboard: (threadId: string) => void;
|
|
160
161
|
}
|
|
161
162
|
/**
|
|
162
163
|
* SDK Entry Point — wrap your app to enable in-app feedback.
|
package/dist/index.js
CHANGED
|
@@ -437,6 +437,34 @@ function FeedbackProvider({
|
|
|
437
437
|
const onModeChangeUnified = config.onModeChange ?? (config.onFeedbackActiveChange ? ((m) => config.onFeedbackActiveChange(m === "annotate")) : void 0);
|
|
438
438
|
const controlledModeFromProps = config.mode !== void 0 ? config.mode : config.feedbackActive !== void 0 ? config.feedbackActive ? "annotate" : "view" : void 0;
|
|
439
439
|
const initialModeUncontrolled = config.mode ?? (config.feedbackActive !== void 0 ? config.feedbackActive ? "annotate" : "view" : "view");
|
|
440
|
+
const openThreadInDashboard = useCallback((threadId) => {
|
|
441
|
+
const threadPath = `/threads/${threadId}`;
|
|
442
|
+
const baseUrl = resolved.siteUrl?.replace(/\/+$/, "") || window.location.origin;
|
|
443
|
+
if (config.apiKey && autoIdentity.accessToken) {
|
|
444
|
+
const functionsBaseUrl = getFunctionsBaseUrl(resolved.supabaseUrl);
|
|
445
|
+
fetch(`${functionsBaseUrl}/external-sso-launch`, {
|
|
446
|
+
method: "POST",
|
|
447
|
+
headers: {
|
|
448
|
+
"Content-Type": "application/json",
|
|
449
|
+
Authorization: `Bearer ${autoIdentity.accessToken}`
|
|
450
|
+
},
|
|
451
|
+
body: JSON.stringify({
|
|
452
|
+
apiKey: config.apiKey,
|
|
453
|
+
nextPath: threadPath
|
|
454
|
+
})
|
|
455
|
+
}).then((res) => res.ok ? res.json() : null).then((data) => {
|
|
456
|
+
if (data?.redirect_url) {
|
|
457
|
+
window.open(data.redirect_url, "_blank", "noopener,noreferrer");
|
|
458
|
+
} else {
|
|
459
|
+
window.open(`${baseUrl}${threadPath}`, "_blank", "noopener,noreferrer");
|
|
460
|
+
}
|
|
461
|
+
}).catch(() => {
|
|
462
|
+
window.open(`${baseUrl}${threadPath}`, "_blank", "noopener,noreferrer");
|
|
463
|
+
});
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
window.open(`${baseUrl}${threadPath}`, "_blank", "noopener,noreferrer");
|
|
467
|
+
}, [resolved.supabaseUrl, resolved.siteUrl, config.apiKey, autoIdentity.accessToken]);
|
|
440
468
|
return /* @__PURE__ */ jsx(
|
|
441
469
|
FeedbackProviderInner,
|
|
442
470
|
{
|
|
@@ -463,6 +491,7 @@ function FeedbackProvider({
|
|
|
463
491
|
userId: effectiveUserId,
|
|
464
492
|
userEmail: effectiveEmail,
|
|
465
493
|
userDisplayName: effectiveDisplayName,
|
|
494
|
+
openThreadInDashboard,
|
|
466
495
|
children
|
|
467
496
|
}
|
|
468
497
|
);
|
|
@@ -491,7 +520,8 @@ function FeedbackProviderInner({
|
|
|
491
520
|
debug,
|
|
492
521
|
userId,
|
|
493
522
|
userEmail,
|
|
494
|
-
userDisplayName
|
|
523
|
+
userDisplayName,
|
|
524
|
+
openThreadInDashboard
|
|
495
525
|
}) {
|
|
496
526
|
const debugLog = useCallback((message, extra) => {
|
|
497
527
|
if (!debug) return;
|
|
@@ -602,6 +632,7 @@ function FeedbackProviderInner({
|
|
|
602
632
|
const target = event.target;
|
|
603
633
|
if (!(target instanceof Element)) return;
|
|
604
634
|
if (!target.closest('[data-ew-feedback-interactive="true"]')) return;
|
|
635
|
+
if (target.closest("[data-ew-launcher]")) return;
|
|
605
636
|
event.stopPropagation();
|
|
606
637
|
};
|
|
607
638
|
window.addEventListener("pointerdown", handleSdkPointerDownCapture, true);
|
|
@@ -882,7 +913,8 @@ function FeedbackProviderInner({
|
|
|
882
913
|
setPendingScreenshotPin,
|
|
883
914
|
submitThread,
|
|
884
915
|
submitScreenshotThread,
|
|
885
|
-
refreshThreads: fetchThreads
|
|
916
|
+
refreshThreads: fetchThreads,
|
|
917
|
+
openThreadInDashboard
|
|
886
918
|
},
|
|
887
919
|
children: [
|
|
888
920
|
children,
|
|
@@ -1242,7 +1274,7 @@ function ThreadPins() {
|
|
|
1242
1274
|
const signedUrlCache = useRef2({});
|
|
1243
1275
|
const threads = ctx?.threads ?? EMPTY_THREADS;
|
|
1244
1276
|
const client = ctx?.client;
|
|
1245
|
-
const
|
|
1277
|
+
const openThreadInDashboard = ctx?.openThreadInDashboard;
|
|
1246
1278
|
const scrollContainer = ctx?.scrollContainer;
|
|
1247
1279
|
const container = scrollContainer?.ref.current ?? null;
|
|
1248
1280
|
const getSignedUrl = useCallback4(async (path) => {
|
|
@@ -1366,8 +1398,8 @@ function ThreadPins() {
|
|
|
1366
1398
|
});
|
|
1367
1399
|
return;
|
|
1368
1400
|
}
|
|
1369
|
-
|
|
1370
|
-
}, [getSignedUrl,
|
|
1401
|
+
openThreadInDashboard?.(pin.threadId);
|
|
1402
|
+
}, [getSignedUrl, openThreadInDashboard]);
|
|
1371
1403
|
const containerLayer = useMemo3(() => {
|
|
1372
1404
|
if (!container || containerPositions.length === 0) return null;
|
|
1373
1405
|
const { width, height } = getContainerContentSize(container);
|
|
@@ -1494,7 +1526,7 @@ function ReviewSurfaceOverlay() {
|
|
|
1494
1526
|
const mode = ctx?.mode ?? "view";
|
|
1495
1527
|
const reviewUrl = ctx?.reviewUrl ?? null;
|
|
1496
1528
|
const threads = ctx?.threads ?? EMPTY_THREADS2;
|
|
1497
|
-
const
|
|
1529
|
+
const openThreadInDashboard = ctx?.openThreadInDashboard;
|
|
1498
1530
|
const updateMetrics = useCallback5(() => {
|
|
1499
1531
|
const iframe = iframeRef.current;
|
|
1500
1532
|
if (!iframe) return;
|
|
@@ -1672,7 +1704,7 @@ function ReviewSurfaceOverlay() {
|
|
|
1672
1704
|
index: index + 1,
|
|
1673
1705
|
left,
|
|
1674
1706
|
top,
|
|
1675
|
-
onClick: () =>
|
|
1707
|
+
onClick: () => openThreadInDashboard?.(thread.id)
|
|
1676
1708
|
},
|
|
1677
1709
|
thread.id
|
|
1678
1710
|
);
|
|
@@ -2329,6 +2361,7 @@ function FeedbackButton({ position = "bottom-right" }) {
|
|
|
2329
2361
|
{
|
|
2330
2362
|
ref: menuRef,
|
|
2331
2363
|
"data-ew-feedback-interactive": "true",
|
|
2364
|
+
"data-ew-launcher": true,
|
|
2332
2365
|
style: { ...wrapperStyle, touchAction: "none" },
|
|
2333
2366
|
onPointerDown: handlePointerDown,
|
|
2334
2367
|
onPointerMove: handlePointerMove,
|