diff --git a/.distignore b/.distignore index 2e8b3b91..815f11c7 100644 --- a/.distignore +++ b/.distignore @@ -27,4 +27,4 @@ phpunit.xml README.md webpack.config.js webpack.gutenberg.config.js -wpacceptance.json +.wp-env.json diff --git a/.eslintignore b/.eslintignore index 00b176ac..cf112fdc 100644 --- a/.eslintignore +++ b/.eslintignore @@ -2,3 +2,4 @@ assets dist node_modules vendor +tests \ No newline at end of file diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml new file mode 100644 index 00000000..ad80c791 --- /dev/null +++ b/.github/workflows/cypress.yml @@ -0,0 +1,54 @@ +name: E2E Tests + +on: + push: + branches: + - develop + - trunk + pull_request: + branches: + - develop + +jobs: + cypress: + runs-on: ubuntu-latest + + strategy: + matrix: + core: + - { name: 'WP latest', version: 'latest' } + - { name: 'WP trunk', version: 'WordPress/WordPress#master' } + - { name: 'WP minimum', version: 'WordPress/WordPress#5.2' } + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dependencies + run: npm i && npm i -g cypress@9.0.0 + + - name: Build asset + run: npm run build + + - name: Add dependencies + run: composer install -o --no-dev --ignore-platform-reqs + + - name: Set the core version + run: ./tests/bin/set-core-version.js ${{ matrix.core.version }} + + - name: Set up WP environment + run: npm run env:start + + - name: Test + run: cypress run --config-file tests/cypress/config.json --env TWITTER_API_KEY=${{ secrets.TWITTER_API_KEY }},TWITTER_API_SECRET=${{ secrets.TWITTER_API_SECRET }},TWITTER_ACCESS_TOKEN=${{ secrets.TWITTER_ACCESS_TOKEN }},TWITTER_ACCESS_SECRET=${{ secrets.TWITTER_ACCESS_SECRET }} + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + if: failure() + with: + name: cypress-artifact-autoshare-for-twitter + retention-days: 2 + path: | + ${{ github.workspace }}/tests/cypress/screenshots/ + ${{ github.workspace }}/tests/cypress/videos/ + ${{ github.workspace }}/tests/cypress/logs/ diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml new file mode 100644 index 00000000..4a4dff68 --- /dev/null +++ b/.github/workflows/eslint.yml @@ -0,0 +1,24 @@ +name: ESLint + +on: + push: + branches: + - develop + - trunk + pull_request: + branches: + - develop + +jobs: + eslint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: install node v12 + uses: actions/setup-node@v1 + with: + node-version: 12 + - name: npm install + run: npm install + - name: Run eslint + run: npm run lint \ No newline at end of file diff --git a/.github/workflows/php-compatibility.yml b/.github/workflows/php-compatibility.yml new file mode 100644 index 00000000..6f8eb1ee --- /dev/null +++ b/.github/workflows/php-compatibility.yml @@ -0,0 +1,35 @@ +name: PHP Compatibility + +on: + push: + branches: + - develop + - trunk + pull_request: + branches: + - develop + +jobs: + php_compatibility: + name: PHP minimum 7.2 + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set PHP version + uses: shivammathur/setup-php@v2 + with: + php-version: 7.2 + tools: composer:v2 + coverage: none + + - name: Remove non-production dependencies + run: rm composer.lock && composer remove --dev phpunit/phpunit yoast/phpunit-polyfills + + - name: Install dependencies + run: composer install + + - name: Run PHP Compatibility + run: vendor/bin/phpcs autoshare-for-twitter.php includes/ --standard=PHPCompatibilityWP --extensions=php --runtime-set testVersion 7.2- \ No newline at end of file diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml new file mode 100644 index 00000000..0d9520a7 --- /dev/null +++ b/.github/workflows/phpcs.yml @@ -0,0 +1,31 @@ +name: PHPCS + +on: + push: + branches: + - develop + - trunk + pull_request: + branches: + - develop + +jobs: + phpcs: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set PHP version + uses: shivammathur/setup-php@v2 + with: + php-version: '7.3' + tools: composer:v2 + coverage: none + + - name: Install dependencies + run: composer install + + - name: Run PHPCS + run: vendor/bin/phpcs autoshare-for-twitter.php includes/ --extensions=php -s \ No newline at end of file diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml new file mode 100644 index 00000000..0492ecd9 --- /dev/null +++ b/.github/workflows/phpunit.yml @@ -0,0 +1,39 @@ +name: PHPUnit + +on: + push: + branches: + - develop + - trunk + pull_request: + branches: + - develop + +jobs: + phpunit: + runs-on: ubuntu-latest + services: + mysql: + image: mariadb:10.4 + env: + MYSQL_ROOT_PASSWORD: root + ports: + - 3306:3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10 + strategy: + fail-fast: false + matrix: + php-versions: ['7.3', '8.0'] + + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set PHP version + uses: shivammathur/setup-php@v1 + with: + php-version: ${{ matrix.php-versions }} + coverage: none + extensions: mysql, imagick + + - name: Run PHPUnit + run: ./bin/test.sh \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 1a198860..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: Test - -on: - push: - branches: - - develop - - trunk - pull_request: - branches: - - develop - -jobs: - eslint: - name: eslint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: install node v12 - uses: actions/setup-node@v1 - with: - node-version: 12 - - name: npm install - run: npm install - - name: eslint - uses: icrawl/action-eslint@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - with: - job-name: eslint - - test_php: - runs-on: ubuntu-latest - services: - mysql: - image: mariadb:10.4 - env: - MYSQL_ROOT_PASSWORD: root - ports: - - 3306:3306 - options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10 - strategy: - matrix: - php-versions: ['7.2', '7.3'] - - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Set PHP version - uses: shivammathur/setup-php@v1 - with: - php-version: ${{ matrix.php-versions }} - coverage: none - extensions: mysql, imagick - - - name: Test - run: ./bin/test.sh - env: - PHP_VERSION: ${{ matrix.php-versions }} - GITHUB_WORKSPACE: ${{ github.workspace }} - AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }} - SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS_KEY }} diff --git a/.gitignore b/.gitignore index 86cab594..494ad306 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,7 @@ node_modules screenshots tests/coverage vendor + +tests/cypress/downloads +tests/cypress/screenshots +tests/cypress/videos \ No newline at end of file diff --git a/.wp-env.json b/.wp-env.json new file mode 100644 index 00000000..71732907 --- /dev/null +++ b/.wp-env.json @@ -0,0 +1,13 @@ +{ + "plugins": [ + "https://downloads.wordpress.org/plugin/classic-editor.1.6.1.zip", + "." + ], + "env": { + "tests": { + "mappings": { + "wp-cli.yml": "./tests/bin/wp-cli.yml" + } + } + } +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ed8b3856..a8de24de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,23 +6,43 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] - TBD +## [1.1.0] - 2022-04-13 +### Added +- Colored icons to represent autoshare status (props [@linawiezkowiak](https://github.com/linawiezkowiak), [@oszkarnagy](https://github.com/oszkarnagy), [@Sidsector9](https://github.com/Sidsector9), [@dinhtungdu](https://github.com/dinhtungdu) via [#142](https://github.com/10up/autoshare-for-twitter/pull/142)). +- Sample copy for example responses (props [@iamdharmesh](https://github.com/iamdharmesh), [@Sidsector9](https://github.com/Sidsector9), [@jeffpaul](https://github.com/jeffpaul) via [#149](https://github.com/10up/autoshare-for-twitter/pull/149)). +- PHP 8 compatibility (props [@Sidsector9](https://github.com/Sidsector9), [@faisal-alvi](https://github.com/faisal-alvi) via [#144](https://github.com/10up/autoshare-for-twitter/pull/144)). +- E2E Tests with Cypress (props [@thrijith](https://github.com/thrijith), [@iamdharmesh](https://github.com/iamdharmesh), [@dinhtungdu](https://github.com/dinhtungdu), [@jeffpaul](https://github.com/jeffpaul) via [#145](https://github.com/10up/autoshare-for-twitter/pull/145)). + +### Changed +- Update dependency `abraham/twitteroauth` from 1.2.0 to 2.0.0 to ensure PHP 8.0 support (props [@Sidsector9](https://github.com/Sidsector9), [@faisal-alvi](https://github.com/faisal-alvi) via [#144](https://github.com/10up/autoshare-for-twitter/pull/144)). +- App setup instructions for getting API keys and tokens (props [@iamdharmesh](https://github.com/iamdharmesh), [@Sidsector9](https://github.com/Sidsector9), [@jeffpaul](https://github.com/jeffpaul) via [#149](https://github.com/10up/autoshare-for-twitter/pull/149)). +- Bump WordPress version "tested up to" 5.9 (props [@iamdharmesh](https://github.com/iamdharmesh), [@Sidsector9](https://github.com/Sidsector9), [@sudip-10up](https://github.com/sudip-10up) via [#151](https://github.com/10up/autoshare-for-twitter/pull/151)). + +### Fixed +- Warning thrown on activating plugin for the first time (props [@Sidsector9](https://github.com/Sidsector9), [@dinhtungdu](https://github.com/dinhtungdu) via [#138](https://github.com/10up/autoshare-for-twitter/pull/138)). +- CI pipeline failures (props [@dkotter](https://github.com/dkotter), [@iamdharmesh](https://github.com/iamdharmesh), [@Sidsector9](https://github.com/Sidsector9) via [#147](https://github.com/10up/autoshare-for-twitter/pull/147)). +### Security +- Bump ajv from 6.10.2 to 6.12.6 (props [@dependabot](https://github.com/apps/dependabot) via [#141](https://github.com/10up/autoshare-for-twitter/pull/141)). +- Bump tar from 4.4.8 to 4.4.19 (props [@dependabot](https://github.com/apps/dependabot) via [#143](https://github.com/10up/autoshare-for-twitter/pull/143)). +- Bump ini from 1.3.5 to 1.3.8 (props [@dependabot](https://github.com/apps/dependabot) via [#152](https://github.com/10up/autoshare-for-twitter/pull/152)). + ## [1.0.6] - 2020-09-19 - Note: this was a hotfix release to fix an issue with deploys to WordPress.org. ## [1.0.5] - 2021-09-15 -## Added +### Added - Tweeted status column to All Posts table list view (props [@thrijith](https://github.com/thrijith), [@dinhtungdu](https://github.com/dinhtungdu), [@linawiezkowiak](https://github.com/linawiezkowiak), [@oszkarnagy](https://github.com/oszkarnagy), [@jeffpaul](https://github.com/jeffpaul/) via [#121](https://github.com/10up/autoshare-for-twitter/pull/121)). -## Changed +### Changed - Bump WordPress version "tested up to" 5.8 (props [@thrijith](https://github.com/thrijith), [@barneyjeffries](https://github.com/barneyjeffries), [@jeffpaul](https://github.com/jeffpaul/) via [#126](https://github.com/10up/autoshare-for-twitter/pull/126)). - WP Snapshot for auotmated testing to WP 5.6 (props [@dinhtungdu](https://github.com/dinhtungdu), [@jeffpaul](https://github.com/jeffpaul/) via [#107](https://github.com/10up/autoshare-for-twitter/pull/107)). - Update dependency `abraham/twitteroauth` from ^0.7.4 to 1.2.0 to ensure PHP 7.4 support and WordPress VIP Go compatability (props [@thrijith](https://github.com/thrijith), [@dinhtungdu](https://github.com/dinhtungdu), [@rickalee](https://github.com/rickalee) via [#122](https://github.com/10up/autoshare-for-twitter/pull/122)). - Update PHPUnit test cases to include new functions (props [@thrijith](https://github.com/thrijith) via [#124](https://github.com/10up/autoshare-for-twitter/pull/124)). -## Fixed +### Fixed - Ensure that special characters are properly encoded (props [@dinhtungdu](https://github.com/dinhtungdu), [@rickalee](https://github.com/rickalee) via [#116](https://github.com/10up/autoshare-for-twitter/pull/116)). -## Security +### Security - Bump `lodash` from 4.17.15 to 4.17.21 (props [@dependabot](https://github.com/apps/dependabot) via [#108](https://github.com/10up/autoshare-for-twitter/pull/108), [#130](https://github.com/10up/autoshare-for-twitter/pull/130)). - Bump `elliptic` from 6.5.1 to 6.5.4 (props [@dependabot](https://github.com/apps/dependabot) via [#109](https://github.com/10up/autoshare-for-twitter/pull/109), [#123](https://github.com/10up/autoshare-for-twitter/pull/123)). - Bump `yargs-parser` from 13.1.1 to 13.1.2 (props [@dependabot](https://github.com/apps/dependabot) via [#111](https://github.com/10up/autoshare-for-twitter/pull/111)). @@ -88,6 +108,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Initial closed source release (props [@scottlee](https://github.com/scottlee/)). [Unreleased]: https://github.com/10up/autoshare-for-twitter/compare/trunk...develop +[1.1.0]: https://github.com/10up/autoshare-for-twitter/compare/1.0.6...1.1.0 [1.0.6]: https://github.com/10up/autoshare-for-twitter/compare/1.0.5...1.0.6 [1.0.5]: https://github.com/10up/autoshare-for-twitter/compare/1.0.4...1.0.5 [1.0.4]: https://github.com/10up/autoshare-for-twitter/compare/1.0.3...1.0.4 diff --git a/CREDITS.md b/CREDITS.md index fd2f0298..fbea1574 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -4,13 +4,13 @@ The following acknowledges the Maintainers for this repository, those who have C The following individuals are responsible for curating the list of issues, responding to pull requests, and ensuring regular releases happen. -[John Watkins (@johnwatkins0)](https://github.com/johnwatkins0), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul). +[Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Dharmesh Patel (@iamdharmesh)](https://github.com/iamdharmesh). ## Contributors Thank you to all the people who have already contributed to this repository via bug reports, code, design, ideas, project management, translation, testing, etc. -[Adam Silverstein (@adamsilverstein)](https://github.com/adamsilverstein), [John Watkins (@johnwatkins0)](https://github.com/johnwatkins0), [Scott Lee (@scottlee)](https://github.com/scottlee), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Stephanie Campbell (@sncampbell)](https://github.com/sncampbell), [Ryan Welcher (@ryanwelcher)](https://github.com/ryanwelcher), [Ricky Lee Whittemore (@rickalee)](https://github.com/rickalee), [Tung Du (@dinhtungdu)](https://github.com/dinhtungdu), [Lina Wiezkowiak (@linawiezkowiak)](https://github.com/linawiezkowiak), [Oszkar Nagy (@oszkarnagy)](https://github.com/oszkarnagy), [Helen Hou-Sandi (@helen)](https://github.com/helen), [Thrijith Thankachan (@thrijith)](https://github.com/thrijith), [Barney Jeffries (@barneyjeffries)](https://github.com/barneyjeffries). +[Adam Silverstein (@adamsilverstein)](https://github.com/adamsilverstein), [John Watkins (@johnwatkins0)](https://github.com/johnwatkins0), [Scott Lee (@scottlee)](https://github.com/scottlee), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Stephanie Campbell (@sncampbell)](https://github.com/sncampbell), [Ryan Welcher (@ryanwelcher)](https://github.com/ryanwelcher), [Ricky Lee Whittemore (@rickalee)](https://github.com/rickalee), [Tung Du (@dinhtungdu)](https://github.com/dinhtungdu), [Lina Wiezkowiak (@linawiezkowiak)](https://github.com/linawiezkowiak), [Oszkar Nagy (@oszkarnagy)](https://github.com/oszkarnagy), [Helen Hou-Sandi (@helen)](https://github.com/helen), [Thrijith Thankachan (@thrijith)](https://github.com/thrijith), [Barney Jeffries (@barneyjeffries)](https://github.com/barneyjeffries), [Darin Kotter (@dkotter)](https://github.com/dkotter), [Siddharth Thevaril (@Sidsector9)](https://github.com/Sidsector9), [Dharmesh Patel (@iamdharmesh)](https://github.com/iamdharmesh), [Faisal Alvi (@faisal-alvi)](https://github.com/faisal-alvi), [@sudip-10up](https://github.com/sudip-10up). ## Libraries diff --git a/README.md b/README.md index 588b3a7d..2063b5f8 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,12 @@ > Automatically tweets the post title or custom message and a link to the post. -[![Support Level](https://img.shields.io/badge/support-active-green.svg)](#support-level) [![Release Version](https://img.shields.io/github/release/10up/autoshare-for-twitter.svg)](https://github.com/10up/autoshare-for-twitter/releases/latest) ![WordPress tested up to version](https://img.shields.io/badge/WordPress-v5.8%20tested-success.svg) [![GPLv2 License](https://img.shields.io/github/license/10up/autoshare-for-twitter.svg)](https://github.com/10up/autoshare-for-twitter/blob/develop/LICENSE.md) +[![Support Level](https://img.shields.io/badge/support-active-green.svg)](#support-level) [![Release Version](https://img.shields.io/github/release/10up/autoshare-for-twitter.svg)](https://github.com/10up/autoshare-for-twitter/releases/latest) ![WordPress tested up to version](https://img.shields.io/wordpress/plugin/tested/autoshare-for-twitter?label=WordPress) [![GPLv2 License](https://img.shields.io/github/license/10up/autoshare-for-twitter.svg)](https://github.com/10up/autoshare-for-twitter/blob/develop/LICENSE.md) +[![ESLint](https://github.com/10up/autoshare-for-twitter/actions/workflows/eslint.yml/badge.svg)](https://github.com/10up/autoshare-for-twitter/actions/workflows/eslint.yml) +[![PHPCompatibility](https://github.com/10up/autoshare-for-twitter/actions/workflows/php-compatibility.yml/badge.svg)](https://github.com/10up/autoshare-for-twitter/actions/workflows/php-compatibility.yml) +[![PHPCS](https://github.com/10up/autoshare-for-twitter/actions/workflows/phpcs.yml/badge.svg)](https://github.com/10up/autoshare-for-twitter/actions/workflows/phpcs.yml) +[![PHPUnit](https://github.com/10up/autoshare-for-twitter/actions/workflows/phpunit.yml/badge.svg)](https://github.com/10up/autoshare-for-twitter/actions/workflows/phpunit.yml) +[![E2E Tests](https://github.com/10up/autoshare-for-twitter/actions/workflows/cypress.yml/badge.svg)](https://github.com/10up/autoshare-for-twitter/actions/workflows/cypress.yml) ## Overview diff --git a/assets/css/admin-autoshare-for-twitter-settings.css b/assets/css/admin-autoshare-for-twitter-settings.css index 34bced5a..e6a1675c 100644 --- a/assets/css/admin-autoshare-for-twitter-settings.css +++ b/assets/css/admin-autoshare-for-twitter-settings.css @@ -56,6 +56,31 @@ display: none; } +.autoshare-settings p.copy-container { + position: relative; + border: 2px #ccc solid; + padding: 10px; + padding-right: 36px; + font-family: monospace; + font-weight: bold; +} + +.autoshare-settings p.copy-container a { + position: absolute; + top: 0; + right: 0; + border: 0; + background: #ccc; + padding: 8px; + font-weight: 100; + text-decoration: none; + color: inherit; +} + +.autoshare-settings p.copy-container a:hover { + background: #bbb; +} + @media (min-width: 1024px) { .autoshare-settings { display: flex; diff --git a/assets/css/admin-autoshare-for-twitter.css b/assets/css/admin-autoshare-for-twitter.css index e086cc45..c8645289 100644 --- a/assets/css/admin-autoshare-for-twitter.css +++ b/assets/css/admin-autoshare-for-twitter.css @@ -118,7 +118,7 @@ span.over-limit { } .autoshare-for-twitter-status-logo::before { - background-image: url('../images/twitter_black.svg'); + background-image: url('../images/twitter_default.svg'); background-repeat: no-repeat; background-size: 25px 25px; content: ' '; @@ -127,6 +127,18 @@ span.over-limit { width: 25px; } -tbody .autoshare-for-twitter-status-logo:hover::before { - background-image: url('../images/twitter_blue.svg'); -} \ No newline at end of file +tbody .autoshare-for-twitter-status-logo--published::before { + background-image: url('../images/twitter_tweeted.svg'); +} + +tbody .autoshare-for-twitter-status-logo--error::before { + background-image: url('../images/twitter_failed.svg'); +} + +tbody .autoshare-for-twitter-status-logo--enabled::before { + background-image: url('../images/twitter_enabled.svg'); +} + +tbody .autoshare-for-twitter-status-logo--disabled::before { + background-image: url('../images/twitter_disabled.svg'); +} diff --git a/assets/images/twitter_black.svg b/assets/images/twitter_default.svg similarity index 98% rename from assets/images/twitter_black.svg rename to assets/images/twitter_default.svg index f63ea717..20317b0f 100644 --- a/assets/images/twitter_black.svg +++ b/assets/images/twitter_default.svg @@ -1,5 +1,5 @@ - + diff --git a/assets/images/twitter_disabled.svg b/assets/images/twitter_disabled.svg new file mode 100644 index 00000000..4cfc1c6b --- /dev/null +++ b/assets/images/twitter_disabled.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/images/twitter_enabled.svg b/assets/images/twitter_enabled.svg new file mode 100644 index 00000000..beaa7aa5 --- /dev/null +++ b/assets/images/twitter_enabled.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/images/twitter_failed.svg b/assets/images/twitter_failed.svg new file mode 100644 index 00000000..bfd7c491 --- /dev/null +++ b/assets/images/twitter_failed.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/images/twitter_tweeted.svg b/assets/images/twitter_tweeted.svg new file mode 100644 index 00000000..e5b7cd65 --- /dev/null +++ b/assets/images/twitter_tweeted.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/js/admin-autoshare-for-twitter-settings.js b/assets/js/admin-autoshare-for-twitter-settings.js index cdf706ea..20fb93ec 100644 --- a/assets/js/admin-autoshare-for-twitter-settings.js +++ b/assets/js/admin-autoshare-for-twitter-settings.js @@ -7,23 +7,51 @@ postTypesWrap = document.querySelector( '.post-types' ), postTypesCheckboxes = document.getElementsByName( 'autoshare-for-twitter[enable_for]' ); - openCredSettingsBtn.addEventListener( 'click', function() { - credSetup.classList.remove( 'connected' ); - } ); - - closeCredSettingsBtn.addEventListener( 'click', function() { - credSetup.classList.add( 'connected' ); - } ); - - postTypesCheckboxes.forEach( function( item ) { - item.addEventListener( 'change', function( event) { - if ( event.target.value === 'all' ) - return postTypesWrap.classList.add( 'hidden' ); - return postTypesWrap.classList.remove( 'hidden' ); + if ( openCredSettingsBtn ) { + openCredSettingsBtn.addEventListener( 'click', function() { + credSetup.classList.remove( 'connected' ); } ); - } ); + } + if ( closeCredSettingsBtn ) { + closeCredSettingsBtn.addEventListener( 'click', function() { + credSetup.classList.add( 'connected' ); + } ); + } + if ( postTypesCheckboxes ) { + postTypesCheckboxes.forEach( function( item ) { + item.addEventListener( 'change', function( event) { + if ( event.target.value === 'all' ) + return postTypesWrap.classList.add( 'hidden' ); + return postTypesWrap.classList.remove( 'hidden' ); + } ); + } ); + } } ); + jQuery( document ).ready(function() { + jQuery( document ).on( 'click', ".astCopyToClipCard", function( e ) { + e.preventDefault(); + $el = jQuery(this); + var text = $el.closest("p.copy-container").find("span.copy-content").first().text(); + const $temp_input = jQuery( '