feat: Implement rating prompt feature across tools
- Added a rating prompt dispatch mechanism to various tools (ChatPdf, PdfFlowchart, QrCodeGenerator, SummarizePdf, TranslatePdf, TableExtractor) to encourage user feedback after tool usage. - Introduced a new utility for handling rating prompts, including event dispatching and current tool identification. - Updated the ToolRating component to manage user feedback submission, including UI enhancements and state management. - Enhanced the sitemap generation script to include new routes for pricing and blog pages. - Removed hardcoded API key in pdf_ai_service.py for improved security. - Added a project status report documenting current implementation against the roadmap. - Updated translations for rating prompts in Arabic, English, and French. - Ensured consistency in frontend route registry and backend task processing.
This commit is contained in:
28
frontend/src/utils/ratingPrompt.ts
Normal file
28
frontend/src/utils/ratingPrompt.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
export const RATING_PROMPT_EVENT = 'saaspdf:rating-prompt';
|
||||
|
||||
interface RatingPromptOptions {
|
||||
forceOpen?: boolean;
|
||||
}
|
||||
|
||||
export function dispatchRatingPrompt(toolSlug: string, options: RatingPromptOptions = {}) {
|
||||
if (typeof window === 'undefined' || !toolSlug) return;
|
||||
|
||||
window.dispatchEvent(
|
||||
new CustomEvent(RATING_PROMPT_EVENT, {
|
||||
detail: {
|
||||
toolSlug,
|
||||
forceOpen: options.forceOpen === true,
|
||||
},
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
export function dispatchCurrentToolRatingPrompt(options: RatingPromptOptions = {}) {
|
||||
if (typeof window === 'undefined') return;
|
||||
|
||||
const path = window.location.pathname.replace(/\/$/, '');
|
||||
if (!path.startsWith('/tools/')) return;
|
||||
|
||||
const toolSlug = path.replace('/tools/', '');
|
||||
dispatchRatingPrompt(toolSlug, options);
|
||||
}
|
||||
Reference in New Issue
Block a user