| @@ -734,9 +734,10 @@ | ||
| 734 | 734 | | "currency" |
| 735 | 735 | | "integration" |
| 736 | 736 | | "permalink" |
| 737 | 737 | | "seo" |
| 738 | - | "advanced"; | |
| 738 | + | "advanced" | |
| 739 | + | "uninstall"; | |
| 739 | 740 | |
| 740 | 741 | // Form Builder Types |
| 741 | 742 | // Booking form builder types live in components/settings/booking-form-types.ts |
| 742 | 743 | // (shared with the per-trip Conditions popup). |
| @@ -972,8 +973,9 @@ | ||
| 972 | 973 | review_moderation: boolean; |
| 973 | 974 | min_rating: number; |
| 974 | 975 | allow_anonymous_reviews: boolean; |
| 975 | 976 | review_reminder_days: number; |
| 977 | + review_reminder_max_age_days: number; | |
| 976 | 978 | |
| 977 | 979 | // Tax Settings |
| 978 | 980 | enable_tax: boolean; |
| 979 | 981 | tax_name: string; |
| @@ -1073,8 +1075,9 @@ | ||
| 1073 | 1075 | |
| 1074 | 1076 | // Advanced Settings |
| 1075 | 1077 | debug_mode: boolean; |
| 1076 | 1078 | enable_logging: boolean; |
| 1079 | + delete_data_on_uninstall: boolean; | |
| 1077 | 1080 | cache_enabled: boolean; |
| 1078 | 1081 | api_key: string; |
| 1079 | 1082 | api_rate_limit: number; |
| 1080 | 1083 | session_timeout: number; |
| @@ -1574,8 +1577,9 @@ | ||
| 1574 | 1577 | "integration", |
| 1575 | 1578 | "permalink", |
| 1576 | 1579 | "seo", |
| 1577 | 1580 | "advanced", |
| 1581 | + "uninstall", | |
| 1578 | 1582 | ]; |
| 1579 | 1583 | if (typeof window !== "undefined") { |
| 1580 | 1584 | // Allow deep-linking a section via ?section=… (e.g. the Google Calendar |
| 1581 | 1585 | // dashboard's "Back to Settings → Integration" link). |
| @@ -1605,8 +1609,9 @@ | ||
| 1605 | 1609 | "integration", |
| 1606 | 1610 | "permalink", |
| 1607 | 1611 | "seo", |
| 1608 | 1612 | "advanced", |
| 1613 | + "uninstall", | |
| 1609 | 1614 | ].includes(saved) |
| 1610 | 1615 | ) { |
| 1611 | 1616 | return saved as SettingsSection; |
| 1612 | 1617 | } |
| @@ -1877,9 +1882,9 @@ | ||
| 1877 | 1882 | email_template_admin_scheduled_payment_failed: true, |
| 1878 | 1883 | email_template_enquiry_received: true, |
| 1879 | 1884 | email_template_enquiry_admin: true, |
| 1880 | 1885 | email_template_enquiry_response: true, |
| 1881 | - email_template_review_request: true, | |
| 1886 | + email_template_review_request: false, | |
| 1882 | 1887 | email_template_abandoned_booking_recovery_first: true, |
| 1883 | 1888 | email_template_abandoned_booking_recovery_second: true, |
| 1884 | 1889 | email_template_abandoned_booking_recovery_final: true, |
| 1885 | 1890 | smtp_enabled: false, |
| @@ -1947,9 +1952,10 @@ | ||
| 1947 | 1952 | auto_approve_reviews: false, |
| 1948 | 1953 | review_moderation: true, |
| 1949 | 1954 | min_rating: 1, |
| 1950 | 1955 | allow_anonymous_reviews: false, |
| 1951 | - review_reminder_days: 7, | |
| 1956 | + review_reminder_days: 3, | |
| 1957 | + review_reminder_max_age_days: 14, | |
| 1952 | 1958 | enable_tax: true, |
| 1953 | 1959 | tax_name: __("Tax", "yatra"), |
| 1954 | 1960 | tax_rate: 10, |
| 1955 | 1961 | tax_inclusive: false, |
| @@ -1990,8 +1996,9 @@ | ||
| 1990 | 1996 | terms_page_id: 0, |
| 1991 | 1997 | privacy_policy_page_id: 0, |
| 1992 | 1998 | debug_mode: false, |
| 1993 | 1999 | enable_logging: false, |
| 2000 | + delete_data_on_uninstall: false, | |
| 1994 | 2001 | cache_enabled: true, |
| 1995 | 2002 | api_key: "", |
| 1996 | 2003 | api_rate_limit: 100, |
| 1997 | 2004 | session_timeout: 3600, |
| @@ -3147,8 +3154,13 @@ | ||
| 3147 | 3154 | id: "advanced" as SettingsSection, |
| 3148 | 3155 | label: __("Advanced", "yatra"), |
| 3149 | 3156 | icon: Shield, |
| 3150 | 3157 | }, |
| 3158 | + { | |
| 3159 | + id: "uninstall" as SettingsSection, | |
| 3160 | + label: __("Uninstall", "yatra"), | |
| 3161 | + icon: Trash2, | |
| 3162 | + }, | |
| 3151 | 3163 | ]; |
| 3152 | 3164 | |
| 3153 | 3165 | // Helper component for section divider |
| 3154 | 3166 | const SectionDivider = ({ title }: { title: string }) => ( |
| @@ -5927,9 +5939,9 @@ | ||
| 5927 | 5939 | <FormField |
| 5928 | 5940 | id="review_reminder_days" |
| 5929 | 5941 | label={__("Review Reminder Days", "yatra")} |
| 5930 | 5942 | description={__( |
| 5931 | - "Send review reminder email this many days after trip completion", | |
| 5943 | + "Send the review request this many days after the trip ends. Set to 0 to never send one.", | |
| 5932 | 5944 | "yatra", |
| 5933 | 5945 | )} |
| 5934 | 5946 | > |
| 5935 | 5947 | <Input |
| @@ -5940,8 +5952,26 @@ | ||
| 5940 | 5952 | onChange={handleFieldChange} |
| 5941 | 5953 | min="0" |
| 5942 | 5954 | /> |
| 5943 | 5955 | </FormField> |
| 5956 | + | |
| 5957 | + <FormField | |
| 5958 | + id="review_reminder_max_age_days" | |
| 5959 | + label={__("Don't Ask About Trips Older Than", "yatra")} | |
| 5960 | + description={__( | |
| 5961 | + "Days. A trip that ended longer ago than this is never asked about — so marking a backlog of old bookings complete does not email those customers.", | |
| 5962 | + "yatra", | |
| 5963 | + )} | |
| 5964 | + > | |
| 5965 | + <Input | |
| 5966 | + id="review_reminder_max_age_days" | |
| 5967 | + type="number" | |
| 5968 | + value={formData.review_reminder_max_age_days} | |
| 5969 | + name="review_reminder_max_age_days" | |
| 5970 | + onChange={handleFieldChange} | |
| 5971 | + min="0" | |
| 5972 | + /> | |
| 5973 | + </FormField> | |
| 5944 | 5974 | </> |
| 5945 | 5975 | )} |
| 5946 | 5976 | </div> |
| 5947 | 5977 | </div> |
| @@ -8699,8 +8729,68 @@ | ||
| 8699 | 8729 | </p> |
| 8700 | 8730 | </div> |
| 8701 | 8731 | )} |
| 8702 | 8732 | </div> |
| 8733 | + </div> | |
| 8734 | + </div> | |
| 8735 | + ); | |
| 8736 | + | |
| 8737 | + case "uninstall": | |
| 8738 | + return ( | |
| 8739 | + <div className="space-y-6"> | |
| 8740 | + <div className="space-y-4"> | |
| 8741 | + <div className="rounded-md border border-red-200 bg-red-50 p-3 text-xs text-red-700 dark:border-red-900/50 dark:bg-red-950/30 dark:text-red-300"> | |
| 8742 | + {__( | |
| 8743 | + "This only applies when Yatra is deleted from the Plugins screen. Deactivating the plugin never removes anything.", | |
| 8744 | + "yatra", | |
| 8745 | + )} | |
| 8746 | + </div> | |
| 8747 | + | |
| 8748 | + <div className="flex items-start gap-2 p-3 bg-gray-50 dark:bg-gray-800 rounded-md"> | |
| 8749 | + <input | |
| 8750 | + type="checkbox" | |
| 8751 | + id="delete_data_on_uninstall" | |
| 8752 | + checked={formData.delete_data_on_uninstall} | |
| 8753 | + name="delete_data_on_uninstall" | |
| 8754 | + onChange={handleFieldChange} | |
| 8755 | + className="mt-1 w-4 h-4 rounded border-gray-300 text-red-600 focus:ring-red-500" | |
| 8756 | + /> | |
| 8757 | + <div className="flex-1"> | |
| 8758 | + <Label | |
| 8759 | + htmlFor="delete_data_on_uninstall" | |
| 8760 | + className="font-medium cursor-pointer" | |
| 8761 | + > | |
| 8762 | + {__("Delete all data on uninstall", "yatra")} | |
| 8763 | + </Label> | |
| 8764 | + <p className="text-xs text-gray-500 dark:text-gray-400 mt-0.5"> | |
| 8765 | + {__( | |
| 8766 | + "Permanently remove every Yatra database table, setting and scheduled task when the plugin is deleted. Yatra Pro follows the same switch and removes its own data too.", | |
| 8767 | + "yatra", | |
| 8768 | + )} | |
| 8769 | + </p> | |
| 8770 | + </div> | |
| 8771 | + </div> | |
| 8772 | + | |
| 8773 | + {formData.delete_data_on_uninstall ? ( | |
| 8774 | + <div className="rounded-md border border-red-300 bg-red-50 p-3 dark:border-red-900 dark:bg-red-950/40"> | |
| 8775 | + <p className="text-sm font-semibold text-red-800 dark:text-red-200"> | |
| 8776 | + {__("This cannot be undone", "yatra")} | |
| 8777 | + </p> | |
| 8778 | + <p className="text-xs text-red-700 dark:text-red-300 mt-1"> | |
| 8779 | + {__( | |
| 8780 | + "Trips, bookings, customers, payments, reviews and enquiries are destroyed along with the plugin. Take a backup, or use Tools to export first, if you may want this data again.", | |
| 8781 | + "yatra", | |
| 8782 | + )} | |
| 8783 | + </p> | |
| 8784 | + </div> | |
| 8785 | + ) : ( | |
| 8786 | + <div className="rounded-md border border-gray-200 bg-gray-50 p-3 text-xs text-gray-600 dark:border-gray-700 dark:bg-gray-800/50 dark:text-gray-400"> | |
| 8787 | + {__( | |
| 8788 | + "Your data is kept when Yatra is deleted, so reinstalling restores everything as it was.", | |
| 8789 | + "yatra", | |
| 8790 | + )} | |
| 8791 | + </div> | |
| 8792 | + )} | |
| 8703 | 8793 | </div> |
| 8704 | 8794 | </div> |
| 8705 | 8795 | ); |
| 8706 | 8796 | |