fix(instanda): hygiene pass + v1.1.0 (uninstall, notices, cron, resubmit, theme)

- F-15: uninstall now removes ALL espinstanda_* options and transients (incl. the
  encrypted password and its self-provisioned key).
- F-16: register the "Gravity Forms required" admin notice unconditionally so it is
  reachable when GF is inactive (gform_loaded never fires then).
- F-22: self-heal the daily retention cron on admin_init (matches the schema self-heal).
- F-19: re-validate the stored payload via Field_Mapper::validate_payload() before a
  resubmit (DB-tamper trust boundary).
- F-20: increment the retry count on resubmit and dispatch the previously-dead
  espinstanda_resubmit_success notification event.
- F-23: emit the theme's Form-5 date-range JS only on pages that embed a Gravity Form
  and disconnect the MutationObserver (was observing the DOM subtree forever).
- F-24: bump plugin to 1.1.0; add readme.txt changelog documenting the audit fixes and
  the required ops actions.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-02 16:20:10 -06:00
co-authored by Claude Fable 5
parent 0732dd662d
commit 5d2e9cb7e5
7 changed files with 175 additions and 18 deletions
@@ -3,7 +3,7 @@
* Plugin Name: ESP INSTANDA Start Quote Integration
* Plugin URI: https://getfused.com
* Description: Pushes Gravity Forms "Start a Quote" submissions into INSTANDA's Package API with write-ahead transaction logging, native entry recording, admin resubmit, and a test-mode lock. Form-agnostic - attach the feed to any form.
* Version: 1.0.7
* Version: 1.1.0
* Requires at least: 7.0
* Requires PHP: 8.5
* Author: Getfused
@@ -75,25 +75,36 @@ function platform_blockers(): array {
}
\add_action('admin_init', static function (): void {
if (!empty(platform_blockers())) {
return;
}
// Keep the schema current if the plugin was updated without re-activation.
if (empty(platform_blockers()) && Transaction_Store::needs_migration()) {
if (Transaction_Store::needs_migration()) {
Transaction_Store::install_table();
}
// Self-heal the retention cron if its scheduled event was ever lost (the schema
// self-heals above; the cron must too, or retention silently stops forever).
if (!\wp_next_scheduled(CLEANUP_HOOK)) {
\wp_schedule_event(time(), 'daily', CLEANUP_HOOK);
}
});
// Requirements notice registered UNCONDITIONALLY: gform_loaded never fires when Gravity
// Forms is absent, so a notice registered only inside it would be unreachable in exactly
// the case (GF missing) an admin most needs to see it.
\add_action('admin_notices', static function (): void {
$errors = platform_blockers();
if ($errors) {
echo '<div class="notice notice-error"><p><strong>ESP INSTANDA Integration is inactive:</strong> '
. esc_html(implode(' ', $errors)) . '</p></div>';
}
});
/* ------------------------------------------------ Gravity Forms Add-On registration */
\add_action('gform_loaded', Guard::wrap(static function (): void {
if (!empty(platform_blockers()) || !method_exists('GFForms', 'include_feed_addon_framework')) {
\add_action('admin_notices', static function (): void {
$errors = platform_blockers();
if (!$errors) {
return;
}
echo '<div class="notice notice-error"><p><strong>ESP INSTANDA Integration is inactive:</strong> '
. esc_html(implode(' ', $errors)) . '</p></div>';
});
return;
return; // the requirements notice is registered unconditionally above
}
\GFForms::include_feed_addon_framework();