@agentic-survey/core 0.1.1 → 0.1.2
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/sharelink.d.ts +1 -1
- package/dist/sharelink.js +6 -2
- package/dist/surveys.js +1 -1
- package/package.json +1 -1
package/dist/sharelink.d.ts
CHANGED
|
@@ -11,4 +11,4 @@ export interface LinkConfig {
|
|
|
11
11
|
/** The user's client-safe publishable key (sb_publishable_…). */
|
|
12
12
|
publishableKey: string;
|
|
13
13
|
}
|
|
14
|
-
export declare function buildShareUrl(link: LinkConfig, surveyId: string): string;
|
|
14
|
+
export declare function buildShareUrl(link: LinkConfig, surveyId: string, title?: string): string;
|
package/dist/sharelink.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
export function buildShareUrl(link, surveyId) {
|
|
1
|
+
export function buildShareUrl(link, surveyId, title) {
|
|
2
2
|
const base = link.pageEndpoint.replace(/\/+$/, '');
|
|
3
3
|
const key = encodeURIComponent(link.publishableKey);
|
|
4
|
-
|
|
4
|
+
// The survey title rides in the query string (server-visible, unlike the
|
|
5
|
+
// fragment) so link-preview crawlers can render it as the card title without
|
|
6
|
+
// ever needing the key. Capped to keep URLs sane; previews truncate anyway.
|
|
7
|
+
const t = title?.trim() ? `?t=${encodeURIComponent(title.trim().slice(0, 150))}` : '';
|
|
8
|
+
return `${base}/s/${link.projectRef}/${surveyId}${t}#k=${key}`;
|
|
5
9
|
}
|
package/dist/surveys.js
CHANGED
|
@@ -49,7 +49,7 @@ export async function publishSurvey(db, id, link) {
|
|
|
49
49
|
if (error)
|
|
50
50
|
return err('publish_survey_failed', error.message);
|
|
51
51
|
const survey = toSurvey(data);
|
|
52
|
-
return ok({ survey, shareUrl: link ? buildShareUrl(link, survey.id) : undefined });
|
|
52
|
+
return ok({ survey, shareUrl: link ? buildShareUrl(link, survey.id, survey.title) : undefined });
|
|
53
53
|
}
|
|
54
54
|
catch (e) {
|
|
55
55
|
return fromThrown('publish_survey_failed', e);
|
package/package.json
CHANGED