flexible-shipping
/
vendor_prefixed
/
octolize
/
wp-octolize-docs-chat
/
src
/
Chat
Last commit date
views
2 weeks ago
AjaxChatSettings.php
2 weeks ago
Assets.php
2 weeks ago
ChatContainer.php
2 weeks ago
ChatSettings.php
2 weeks ago
ChatSettingsProvider.php
2 weeks ago
ConsentSettings.php
2 weeks ago
DocsChat.php
2 weeks ago
HookableChatObjects.php
2 weeks ago
Assets.php
33 lines
| 1 | <?php |
| 2 | |
| 3 | namespace FSVendor\Octolize\Docs\Chat; |
| 4 | |
| 5 | use FSVendor\WPDesk\PluginBuilder\Plugin\Hookable; |
| 6 | use FSVendor\WPDesk\ShowDecision\ShouldShowStrategy; |
| 7 | class Assets implements Hookable |
| 8 | { |
| 9 | private string $plugin_url; |
| 10 | private string $plugin_version; |
| 11 | private string $assets_version = '1'; |
| 12 | private ShouldShowStrategy $show_strategy; |
| 13 | public function __construct(string $plugin_url, string $version, ShouldShowStrategy $show_strategy) |
| 14 | { |
| 15 | $this->plugin_url = $plugin_url; |
| 16 | $this->plugin_version = $version; |
| 17 | $this->show_strategy = $show_strategy; |
| 18 | } |
| 19 | public function hooks(): void |
| 20 | { |
| 21 | add_action('admin_enqueue_scripts', [$this, 'enqueue_admin_scripts']); |
| 22 | } |
| 23 | public function enqueue_admin_scripts() |
| 24 | { |
| 25 | if (!$this->show_strategy->shouldDisplay()) { |
| 26 | return; |
| 27 | } |
| 28 | $version = $this->plugin_version . '.' . $this->assets_version; |
| 29 | wp_enqueue_script('octolize-docs-chat', trailingslashit($this->plugin_url) . '/vendor_prefixed/octolize/wp-octolize-docs-chat/assets/dist/OctolizeDocsChat.js', [], $version, \true); |
| 30 | wp_enqueue_style('octolize-docs-chat', trailingslashit($this->plugin_url) . '/vendor_prefixed/octolize/wp-octolize-docs-chat/assets/dist/OctolizeDocsChat.css', [], $version); |
| 31 | } |
| 32 | } |
| 33 |