Skip to content

Commit

Permalink
Fix: add missing form builder dependencies for WP 6.4 compatibility (#…
Browse files Browse the repository at this point in the history
…7028)

Co-authored-by: Jon Waldstein <[email protected]>
  • Loading branch information
jonwaldstein and Jon Waldstein authored Oct 13, 2023
1 parent 74122d6 commit 3767ab4
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
7 changes: 7 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
}
],
"devDependencies": {
"@types/lodash": "^4.14.199",
"@types/react": "^18.0.27",
"@types/react-datepicker": "^4.15.0",
"@types/react-dom": "^18.0.10",
Expand Down
5 changes: 4 additions & 1 deletion src/FormBuilder/Routes/RegisterFormBuilderPageRoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

use Give\FormBuilder\FormBuilderRouteBuilder;
use Give\FormBuilder\ViewModels\FormBuilderViewModel;
use Give\Framework\Support\Facades\Scripts\ScriptAsset;
use Give\Framework\Views\View;
use Give\Helpers\Hooks;
use Give\Log\Log;
Expand Down Expand Up @@ -81,7 +82,9 @@ public function renderPage()
wp_enqueue_script(
'@givewp/form-builder/registrars',
$formBuilderViewModel->jsPathToRegistrars(),
[],
$this->getRegisteredFormBuilderJsDependencies(
$formBuilderViewModel->jsRegistrarsDependencies()
),
GIVE_VERSION,
true
);
Expand Down
13 changes: 11 additions & 2 deletions src/FormBuilder/ViewModels/FormBuilderViewModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Give\Framework\FormDesigns\FormDesign;
use Give\Framework\FormDesigns\Registrars\FormDesignRegistrar;
use Give\Framework\PaymentGateways\PaymentGateway;
use Give\Framework\Support\Facades\Scripts\ScriptAsset;
use Give\Subscriptions\Models\Subscription;

class FormBuilderViewModel
Expand Down Expand Up @@ -217,14 +218,22 @@ public function jsPathToRegistrars(): string
return GIVE_PLUGIN_URL . 'build/formBuilderRegistrars.js';
}

/**
* @since 3.0.0
*/
public function jsRegistrarsDependencies(): array
{
return ScriptAsset::getDependencies(GIVE_PLUGIN_DIR . 'build/formBuilderRegistrars.asset.php');
}

/**
* @since 3.0.0
*/
public function jsDependencies(): array
{
$scriptAsset = require GIVE_PLUGIN_DIR . 'build/formBuilderApp.asset.php';
$dependencies = ScriptAsset::getDependencies(GIVE_PLUGIN_DIR . 'build/formBuilderApp.asset.php');

return array_merge($scriptAsset['dependencies'], ['@givewp/form-builder/registrars']);
return array_merge($dependencies, ['@givewp/form-builder/registrars']);
}

/**
Expand Down

0 comments on commit 3767ab4

Please sign in to comment.