-
Notifications
You must be signed in to change notification settings - Fork 3k
Improving the analytics setup prompts #3528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,6 +3,8 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| BookOpen, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Button, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Check, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Codex, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Cursor, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| OpenAI, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Popover, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| useCopyToClipboard, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -14,6 +16,169 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { toast } from "sonner"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { IntegrationGuide } from "./integrations"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const CONVERSION_TRACKING_PATTERNS = [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /data-publishable-key=/, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /publishableKey=/, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /s\.setAttribute\("data-publishable-key"/, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const PUBLISHABLE_KEY_PLACEHOLDER = "<YOUR_DUB_PUBLISHABLE_KEY>"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const OUTBOUND_DOMAIN_PLACEHOLDER = '["<YOUR_DOMAIN_1>", "<YOUR_DOMAIN_2>"]'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const REFER_DOMAIN_PLACEHOLDER = "<YOUR_REFERRING_DOMAIN>"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function getGuideOptionName(guide: IntegrationGuide) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return guide.description || [guide.title, guide.subtitle].filter(Boolean).join(" "); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function sanitizeClientScriptMarkdown(markdown: string) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return markdown | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .replace(/<!--[\s\S]*?-->/g, "") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .replace(/dub_pk_[A-Za-z0-9_-]+/g, PUBLISHABLE_KEY_PLACEHOLDER) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .replace( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /data-publishable-key="[^"]*"/g, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `data-publishable-key="${PUBLISHABLE_KEY_PLACEHOLDER}"`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .replace( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /publishableKey="[^"]*"/g, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `publishableKey="${PUBLISHABLE_KEY_PLACEHOLDER}"`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .replace( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /s\.setAttribute\("data-publishable-key", "[^"]*"\);/g, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `s.setAttribute("data-publishable-key", "${PUBLISHABLE_KEY_PLACEHOLDER}");`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .replace( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /"outbound": \["example\.com", "example\.sh"\]/g, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `"outbound": ${OUTBOUND_DOMAIN_PLACEHOLDER}`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .replace( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /outbound: \["example\.com", "example\.sh"\]/g, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `outbound: ${OUTBOUND_DOMAIN_PLACEHOLDER}`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .replace( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /"refer":\s*"[^"]*"/g, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `"refer": "${REFER_DOMAIN_PLACEHOLDER}"`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .replace( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /refer:\s*"[^"]*"/g, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `refer: "${REFER_DOMAIN_PLACEHOLDER}"`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .trim(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function sanitizeGuideInstructions(markdown: string) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return markdown.replace(/<!--[\s\S]*?-->/g, "").trim(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
marcusljf marked this conversation as resolved.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function isOutboundDomainTrackingEnabled(markdown: string) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /script\.[^"'\s]*outbound-domains[^"'\s]*\.js/.test(markdown) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /"outbound"\s*:/.test(markdown) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /\boutbound\s*:/.test(markdown) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function getReactStepOnePrompt(markdown: string, guide: IntegrationGuide) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const conversionTrackingEnabled = CONVERSION_TRACKING_PATTERNS.some((pattern) => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pattern.test(markdown), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const outboundTrackingEnabled = isOutboundDomainTrackingEnabled(markdown); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const analyticsProps = [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| conversionTrackingEnabled | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? ` publishableKey="${PUBLISHABLE_KEY_PLACEHOLDER}"` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : null, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| outboundTrackingEnabled | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? ` domainsConfig={{\n refer: "${REFER_DOMAIN_PLACEHOLDER}",\n outbound: ${OUTBOUND_DOMAIN_PLACEHOLDER}\n }}` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : null, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ].filter(Boolean); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const analyticsComponent = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| analyticsProps.length > 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? `<DubAnalytics\n${analyticsProps.join("\n")}\n />` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : "<DubAnalytics />"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "I'm using Dub and need to install the client-side script. Help me add the script from the instructions below.", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| conversionTrackingEnabled | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? "Ask me for my publishable key before finalizing the conversion tracking setup." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : null, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "Ask me if I want to enable client-side click tracking (Dub Partners). If yes, add `domainsConfig={{ refer: \"<YOUR_REFERRING_DOMAIN>\" }}`.", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| outboundTrackingEnabled | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? "Ask me which outbound domains I want to track before finalizing the setup." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : null, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "Step 1: Install Dub package to your project", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "```bash\nnpm install @dub/analytics\n```", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "Step 2: Initialize package in your code", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `\`\`\`jsx | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { Analytics as DubAnalytics } from '@dub/analytics/react'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export default function RootLayout({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| children, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }: Readonly<{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| children: React.ReactNode; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <html lang="en"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <body>{children}</body> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ${analyticsComponent} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </html> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| \`\`\``, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
marcusljf marked this conversation as resolved.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `Full guide link for reference: ${guide.url}`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .filter(Boolean) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .join("\n\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function getGuidePrompt(guide: IntegrationGuide, markdown: string) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (guide.type === "client-sdk" && guide.key === "shopify") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return `Read from ${guide.url} so I can ask questions about it.`; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+137
to
+139
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shopify branch bypasses the new setup-question flow. At Line 137–Line 139, the early return for 💡 Proposed fix function getGuidePrompt(guide: IntegrationGuide, markdown: string) {
- if (guide.type === "client-sdk" && guide.key === "shopify") {
- return `Read from ${guide.url} so I can ask questions about it.`;
- }
-
if (guide.type === "client-sdk" && guide.key === "react") {
return getReactStepOnePrompt(markdown, guide);
}
if (guide.type === "client-sdk") {
const conversionTrackingEnabled = CONVERSION_TRACKING_PATTERNS.some((pattern) =>
pattern.test(markdown),
);
const outboundTrackingEnabled = isOutboundDomainTrackingEnabled(markdown);
const sanitizedMarkdown = sanitizeClientScriptMarkdown(markdown);
return [
- "I'm using Dub and need to install the client-side script.",
+ guide.key === "shopify"
+ ? "I'm using Dub with Shopify and need to install client-side tracking."
+ : "I'm using Dub and need to install the client-side script.",
"Help me add the script from the instructions below.",
conversionTrackingEnabled
? "Ask me for my publishable key before finalizing the conversion tracking setup."
: null,
"Ask me if I want to enable client-side click tracking (Dub Partners). If yes, add `domainsConfig.refer` with my referring domain.",
outboundTrackingEnabled
? "Ask me which outbound domains I want to track before finalizing the setup."
: null,
"Instructions:",
sanitizedMarkdown,
`Full guide link for reference: ${guide.url}`,
]
.filter(Boolean)
.join("\n\n");
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (guide.type === "client-sdk" && guide.key === "react") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return getReactStepOnePrompt(markdown, guide); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (guide.type === "client-sdk") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const conversionTrackingEnabled = CONVERSION_TRACKING_PATTERNS.some((pattern) => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pattern.test(markdown), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const outboundTrackingEnabled = isOutboundDomainTrackingEnabled(markdown); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const sanitizedMarkdown = sanitizeClientScriptMarkdown(markdown); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "I'm using Dub and need to install the client-side script.", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "Help me add the script from the instructions below.", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| conversionTrackingEnabled | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? "Ask me for my publishable key before finalizing the conversion tracking setup." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : null, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "Ask me if I want to enable client-side click tracking (Dub Partners). If yes, add `domainsConfig.refer` with my referring domain.", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| outboundTrackingEnabled | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? "Ask me which outbound domains I want to track before finalizing the setup." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : null, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "Instructions:", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sanitizedMarkdown, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `Full guide link for reference: ${guide.url}`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .filter(Boolean) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .join("\n\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const optionName = getGuideOptionName(guide); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const intro = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| guide.type === "track-lead" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? `I'm using Dub and need to track lead events with ${optionName}. Help set that up with these instructions.` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : `I'm using Dub and need to track sale events with ${optionName}. Help set that up with these instructions.`; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| intro, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "Instructions:", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sanitizeGuideInstructions(markdown), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| `Full guide link for reference: ${guide.url}`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ].join("\n\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const GuideActionButton = ({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| guide, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| markdown, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -25,13 +190,15 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const [copied, copyToClipboard] = useCopyToClipboard(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const prompt = `Read from ${guide.url} so I can ask questions about it.`; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const prompt = getGuidePrompt(guide, markdown); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const cursorUrl = `https://cursor.com/link/prompt?text=${encodeURIComponent(prompt)}`; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const codexUrl = `https://chatgpt.com/codex?prompt=${encodeURIComponent(prompt)}`; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div className="border-border-subtle flex h-8 items-center overflow-hidden rounded-lg border"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Link href={guide.url} target="_blank" rel="noopener noreferrer"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Button | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| text="Read full guide" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| text="View docs" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| variant="secondary" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| className="rounded-none border-0 px-3" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| icon={<BookOpen className="size-3.5" />} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -63,7 +230,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div className="flex flex-col items-start"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <span className="font-medium">Copy content</span> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <span className="text-xs text-neutral-500"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Copy page as Markdown for LLMs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Copy as Markdown for LLMs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </span> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </button> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -72,7 +239,6 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| className="flex w-full cursor-pointer items-center gap-2 rounded-md p-2 text-sm text-neutral-600 transition-colors hover:bg-neutral-100" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onClick={() => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const chatgptUrl = `https://chatgpt.com?hints=search&prompt=${encodeURIComponent(prompt)}`; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.log("chatgptUrl", chatgptUrl); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| window.open(chatgptUrl, "_blank", "noopener,noreferrer"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -110,6 +276,46 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </span> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </button> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <button | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| className="flex w-full cursor-pointer items-center gap-2 rounded-md p-2 text-sm text-neutral-600 transition-colors hover:bg-neutral-100" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onClick={() => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| window.open(cursorUrl, "_blank", "noopener,noreferrer"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div className="flex h-8 w-8 items-center justify-center rounded border border-neutral-200 transition-colors hover:border-neutral-300"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Cursor className="size-4 text-neutral-600" /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div className="flex flex-1 flex-col items-start"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div className="flex items-center gap-1"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <span className="font-medium">Open in Cursor</span> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <ArrowUpRight className="size-3.5 text-neutral-600" /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <span className="text-xs text-neutral-500"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Ask questions about this step | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </span> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </button> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <button | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| className="flex w-full cursor-pointer items-center gap-2 rounded-md p-2 text-sm text-neutral-600 transition-colors hover:bg-neutral-100" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onClick={() => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| window.open(codexUrl, "_blank", "noopener,noreferrer"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div className="flex h-8 w-8 items-center justify-center rounded border border-neutral-200 transition-colors hover:border-neutral-300"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Codex className="size-4 text-neutral-600" /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div className="flex flex-1 flex-col items-start"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div className="flex items-center gap-1"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <span className="font-medium">Open in Codex</span> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <ArrowUpRight className="size-3.5 text-neutral-600" /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <span className="text-xs text-neutral-500"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Ask questions about this step | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </span> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </button> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| align="end" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import { SVGProps } from "react"; | ||
|
|
||
| export function Codex({ className, ...props }: SVGProps<SVGSVGElement>) { | ||
| return ( | ||
| <svg | ||
| className={className} | ||
| width="83" | ||
| height="83" | ||
| viewBox="0 0 83 83" | ||
| fill="none" | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| {...props} | ||
| > | ||
| <path | ||
| d="M36.3379 7.2627C38.6203 7.26272 40.7886 7.6962 42.8428 8.56348C44.897 9.43083 46.7235 10.6413 48.3213 12.1934C50.0559 11.6 51.8589 11.3027 53.7305 11.3027C56.789 11.3027 59.6197 12.0561 62.2217 13.5625C64.8236 15.0689 66.9001 17.1237 68.4521 19.7256C70.0498 22.3276 70.8496 25.2264 70.8496 28.4219C70.8496 29.7456 70.6669 31.1835 70.3018 32.7354C72.1276 34.4243 73.5426 36.3873 74.5469 38.624C75.5511 40.8152 76.0537 43.1207 76.0537 45.54C76.0537 48.0051 75.5285 50.3796 74.4785 52.6621C73.4286 54.9445 71.9446 56.9302 70.0273 58.6191C68.1558 60.2624 65.9647 61.4039 63.4541 62.043C62.9519 64.6449 61.8787 66.9732 60.2354 69.0273C58.6377 71.1271 56.6519 72.7702 54.2783 73.957C51.9046 75.1439 49.371 75.7373 46.6777 75.7373C44.3952 75.7373 42.2262 75.3039 40.1719 74.4365C38.1178 73.5692 36.292 72.3596 34.6943 70.8076C32.9598 71.401 31.1567 71.6972 29.2852 71.6973C26.2267 71.6973 23.3959 70.9448 20.7939 69.4385C18.1919 67.932 16.0919 65.8774 14.4941 63.2754C12.9421 60.6734 12.166 57.7745 12.166 54.5791C12.166 53.2553 12.3487 51.8167 12.7139 50.2646C10.8879 48.5756 9.47302 46.6355 8.46875 44.4443C7.46448 42.2075 6.96191 39.8794 6.96191 37.46C6.96194 34.9949 7.48719 32.6213 8.53711 30.3389C9.587 28.0565 11.0474 26.0935 12.9189 24.4502C14.8362 22.7611 17.0508 21.5971 19.5615 20.958C20.0636 18.3561 21.1133 16.0278 22.7109 13.9736C24.3543 11.8737 26.3635 10.2299 28.7373 9.04297C31.111 7.85617 33.6447 7.2627 36.3379 7.2627ZM29.168 30.7559C28.4807 29.5585 26.9533 29.1448 25.7559 29.832C24.5585 30.5193 24.1449 32.0467 24.832 33.2441L29.46 41.3086L24.8398 49.2422C24.1452 50.4352 24.5492 51.9653 25.7422 52.6602C26.9353 53.3549 28.4653 52.9508 29.1602 51.7578L34.2168 43.0752C34.8467 41.9935 34.8515 40.658 34.2285 39.5723L29.168 30.7559ZM44.1211 47.6611C42.7405 47.6612 41.6212 48.7806 41.6211 50.1611C41.6211 51.5418 42.7404 52.6611 44.1211 52.6611H56.6211C58.0018 52.6611 59.1211 51.5418 59.1211 50.1611C59.121 48.7806 58.0017 47.6612 56.6211 47.6611H44.1211Z" | ||
| fill="#262626" | ||
| /> | ||
| </svg> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import { SVGProps } from "react"; | ||
|
|
||
| export function Cursor({ className, ...props }: SVGProps<SVGSVGElement>) { | ||
| return ( | ||
| <svg | ||
| className={className} | ||
| width="180" | ||
| height="180" | ||
| viewBox="0 0 180 180" | ||
| fill="none" | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| {...props} | ||
| > | ||
| <path | ||
| d="M154.347 49.9771L93.6488 14.8463C91.6997 13.7179 89.2946 13.7179 87.3455 14.8463L26.6501 49.9771C25.0116 50.9255 24 52.6795 24 54.5792V125.421C24 127.32 25.0116 129.074 26.6501 130.023L87.3484 165.154C89.2975 166.282 91.7025 166.282 93.6516 165.154L154.35 130.023C155.988 129.074 157 127.32 157 125.421V54.5792C157 52.6795 155.988 50.9255 154.35 49.9771H154.347ZM150.534 57.4187L91.939 159.16C91.5429 159.846 90.4972 159.566 90.4972 158.772V92.1525C90.4972 90.8213 89.7876 89.5901 88.6364 88.9216L31.0868 55.6133C30.4029 55.2162 30.6822 54.1678 31.4744 54.1678H148.665C150.329 54.1678 151.369 55.9761 150.537 57.4215H150.534V57.4187Z" | ||
| fill="currentColor" | ||
| /> | ||
| </svg> | ||
| ); | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.