From 63458d31155c82e635699b49078a83e1e1341945 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Feb 2025 12:53:21 +0000 Subject: [PATCH 1/8] chore(deps): bump codeinwp/themeisle-sdk from 3.3.37 to 3.3.42 Bumps [codeinwp/themeisle-sdk](https://github.com/Codeinwp/themeisle-sdk) from 3.3.37 to 3.3.42. - [Release notes](https://github.com/Codeinwp/themeisle-sdk/releases) - [Changelog](https://github.com/Codeinwp/themeisle-sdk/blob/v3.3.42/CHANGELOG.md) - [Commits](https://github.com/Codeinwp/themeisle-sdk/compare/v3.3.37...v3.3.42) --- updated-dependencies: - dependency-name: codeinwp/themeisle-sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 1951a44..9dd413d 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "codeinwp/themeisle-sdk", - "version": "3.3.37", + "version": "3.3.42", "source": { "type": "git", "url": "https://github.com/Codeinwp/themeisle-sdk.git", - "reference": "73e9010fb4e30ad8835f00a0df802733f98c4094" + "reference": "ca5dd49df730fde986af65c61bd20af02e2bcbd7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/73e9010fb4e30ad8835f00a0df802733f98c4094", - "reference": "73e9010fb4e30ad8835f00a0df802733f98c4094", + "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/ca5dd49df730fde986af65c61bd20af02e2bcbd7", + "reference": "ca5dd49df730fde986af65c61bd20af02e2bcbd7", "shasum": "" }, "require-dev": { @@ -43,9 +43,9 @@ ], "support": { "issues": "https://github.com/Codeinwp/themeisle-sdk/issues", - "source": "https://github.com/Codeinwp/themeisle-sdk/tree/v3.3.37" + "source": "https://github.com/Codeinwp/themeisle-sdk/tree/v3.3.42" }, - "time": "2024-11-06T14:44:53+00:00" + "time": "2025-02-17T10:00:05+00:00" } ], "packages-dev": [ @@ -2418,5 +2418,5 @@ "platform-overrides": { "php": "7.0" }, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.3.0" } From c1529809ab38e842e809f509697c7a9af145d356 Mon Sep 17 00:00:00 2001 From: "Soare Robert Daniel (Mac 2023)" Date: Mon, 17 Feb 2025 13:18:16 +0200 Subject: [PATCH 2/8] feat: load survey vis internal pages hooks --- .github/workflows/test-php.yml | 12 +++++----- functions.php | 1 + inc/Admin.php | 44 +++++++++++++++++++++------------- 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/.github/workflows/test-php.yml b/.github/workflows/test-php.yml index e465cd8..9f0f463 100644 --- a/.github/workflows/test-php.yml +++ b/.github/workflows/test-php.yml @@ -3,17 +3,17 @@ name: Test PHP on: push: branches-ignore: - - 'master' + - "master" jobs: phplint: name: Phplint - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Setup PHP version uses: shivammathur/setup-php@v2 with: - php-version: '7.2' + php-version: "7.2" extensions: simplexml - name: Checkout source code uses: actions/checkout@v2 @@ -34,7 +34,7 @@ jobs: run: composer run lint phpunit: name: Phpunit - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 services: mysql: image: mysql:5.7 @@ -47,7 +47,7 @@ jobs: - name: Setup PHP version uses: shivammathur/setup-php@v2 with: - php-version: '7.2' + php-version: "7.2" extensions: simplexml, mysql tools: phpunit-polyfills - name: Checkout source code @@ -69,4 +69,4 @@ jobs: - name: Install composer run: composer install --prefer-dist --no-progress --no-suggest - name: Run phpunit - run: composer run-script phpunit \ No newline at end of file + run: composer run-script phpunit diff --git a/functions.php b/functions.php index 88849f9..4e87459 100644 --- a/functions.php +++ b/functions.php @@ -71,6 +71,7 @@ function define_constants() { define( 'RIVERBANK_DEBUG', defined( 'WP_DEBUG' ) && WP_DEBUG === true ); define( 'RIVERBANK_DIR', trailingslashit( get_template_directory() ) ); define( 'RIVERBANK_URL', trailingslashit( get_template_directory_uri() ) ); + define( 'RIVERBANK_PRODUCT_SLUG', basename( RIVERBANK_DIR ) ); } /** diff --git a/inc/Admin.php b/inc/Admin.php index 7b503a6..6d66b25 100644 --- a/inc/Admin.php +++ b/inc/Admin.php @@ -33,7 +33,7 @@ public function setup_admin_hooks() { add_action( 'admin_notices', array( $this, 'render_welcome_notice' ), 0 ); add_action( 'wp_ajax_riverbank_dismiss_welcome_notice', array( $this, 'remove_welcome_notice' ) ); add_action( 'wp_ajax_riverbank_set_otter_ref', array( $this, 'set_otter_ref' ) ); - add_action( 'admin_print_scripts', array( $this, 'add_nps_form' ) ); + add_action( 'admin_enqueue_scripts', array( $this, 'register_internal_page' ) ); add_action( 'enqueue_block_editor_assets', array( $this, 'add_fse_design_pack_notice' ) ); add_action( 'wp_ajax_riverbank_dismiss_design_pack_notice', array( $this, 'remove_design_pack_notice' ) ); @@ -308,27 +308,37 @@ private function get_otter_status(): string { } /** - * Add NPS form. + * Register internal pages. * * @return void */ - public function add_nps_form() { + public function register_internal_page() { $screen = get_current_screen(); - - if ( current_user_can( 'manage_options' ) && ( 'dashboard' === $screen->id || 'themes' === $screen->id ) ) { - $website_url = preg_replace( '/[^a-zA-Z0-9]+/', '', get_site_url() ); - - $config = array( - 'environmentId' => 'clr7jal6eexcy8up0wdufqz2d', - 'apiHost' => 'https://app.formbricks.com', - 'userId' => 'riverbank_' . $website_url, - 'attributes' => array( - 'days_since_install' => self::convert_to_category( round( ( time() - get_option( 'riverbank_install', time() ) ) / DAY_IN_SECONDS ) ), - ), - ); - - echo ''; + + if ( ! current_user_can( 'manage_options' ) || ( 'dashboard' !== $screen->id && 'themes' !== $screen->id ) ) { + return; } + + add_filter( + 'themeisle-sdk/survey/' . RIVERBANK_PRODUCT_SLUG, + function( $data, $page_slug ) { + $install_days_number = intval( ( time() - get_option( 'riverbank_install', time() ) ) / DAY_IN_SECONDS ); + + $data = array( + 'environmentId' => 'clr7jal6eexcy8up0wdufqz2d', + 'attributes' => array( + 'days_since_install' => self::convert_to_category( $install_days_number ), + 'install_days_number' => $install_days_number, + 'version' => RIVERBANK_VERSION, + ), + ); + + return $data; + }, + 10, + 2 + ); + do_action( 'themeisle_internal_page', RIVERBANK_PRODUCT_SLUG, $screen->id ); } /** From d3af6ffcdd0f584b03abb4d5d0c92adc13e2bb5d Mon Sep 17 00:00:00 2001 From: "Soare Robert Daniel (Mac 2023)" Date: Tue, 18 Feb 2025 14:45:16 +0200 Subject: [PATCH 3/8] refactor: remove install category from survey --- inc/Admin.php | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/inc/Admin.php b/inc/Admin.php index 6d66b25..859aafb 100644 --- a/inc/Admin.php +++ b/inc/Admin.php @@ -327,7 +327,6 @@ function( $data, $page_slug ) { $data = array( 'environmentId' => 'clr7jal6eexcy8up0wdufqz2d', 'attributes' => array( - 'days_since_install' => self::convert_to_category( $install_days_number ), 'install_days_number' => $install_days_number, 'version' => RIVERBANK_VERSION, ), @@ -340,28 +339,4 @@ function( $data, $page_slug ) { ); do_action( 'themeisle_internal_page', RIVERBANK_PRODUCT_SLUG, $screen->id ); } - - /** - * Convert a number to a category. - * - * @param int $number Number to convert. - * @param int $scale Scale. - * - * @return int - */ - public static function convert_to_category( $number, $scale = 1 ) { - $normalized_number = intval( round( $number / $scale ) ); - - if ( 0 === $normalized_number || 1 === $normalized_number ) { - return 0; - } elseif ( $normalized_number > 1 && $normalized_number < 8 ) { - return 7; - } elseif ( $normalized_number >= 8 && $normalized_number < 31 ) { - return 30; - } elseif ( $normalized_number > 30 && $normalized_number < 90 ) { - return 90; - } elseif ( $normalized_number > 90 ) { - return 91; - } - } } From 30bc06b9edbb12bdd5407e5c580ac3c71cd47e7b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Feb 2025 20:06:04 +0000 Subject: [PATCH 4/8] chore(deps): bump codeinwp/themeisle-sdk from 3.3.42 to 3.3.44 Bumps [codeinwp/themeisle-sdk](https://github.com/Codeinwp/themeisle-sdk) from 3.3.42 to 3.3.44. - [Release notes](https://github.com/Codeinwp/themeisle-sdk/releases) - [Changelog](https://github.com/Codeinwp/themeisle-sdk/blob/v3.3.44/CHANGELOG.md) - [Commits](https://github.com/Codeinwp/themeisle-sdk/compare/v3.3.42...v3.3.44) --- updated-dependencies: - dependency-name: codeinwp/themeisle-sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 9dd413d..9d057c8 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "codeinwp/themeisle-sdk", - "version": "3.3.42", + "version": "3.3.44", "source": { "type": "git", "url": "https://github.com/Codeinwp/themeisle-sdk.git", - "reference": "ca5dd49df730fde986af65c61bd20af02e2bcbd7" + "reference": "fed444b52ebf1f689ec2434df177926bf8f238c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/ca5dd49df730fde986af65c61bd20af02e2bcbd7", - "reference": "ca5dd49df730fde986af65c61bd20af02e2bcbd7", + "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/fed444b52ebf1f689ec2434df177926bf8f238c4", + "reference": "fed444b52ebf1f689ec2434df177926bf8f238c4", "shasum": "" }, "require-dev": { @@ -43,9 +43,9 @@ ], "support": { "issues": "https://github.com/Codeinwp/themeisle-sdk/issues", - "source": "https://github.com/Codeinwp/themeisle-sdk/tree/v3.3.42" + "source": "https://github.com/Codeinwp/themeisle-sdk/tree/v3.3.44" }, - "time": "2025-02-17T10:00:05+00:00" + "time": "2025-02-18T21:31:30+00:00" } ], "packages-dev": [ From 99fe3c58da4f7ad6666d30e479fbf9b0986ce010 Mon Sep 17 00:00:00 2001 From: vytisbulkevicius <36594177+vytisbulkevicius@users.noreply.github.com> Date: Mon, 14 Apr 2025 10:23:26 +0300 Subject: [PATCH 5/8] Update create-build-zip.yml --- .github/workflows/create-build-zip.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create-build-zip.yml b/.github/workflows/create-build-zip.yml index 5c12423..01ff7cc 100644 --- a/.github/workflows/create-build-zip.yml +++ b/.github/workflows/create-build-zip.yml @@ -25,7 +25,7 @@ jobs: run: | echo "::set-output name=dir::$(composer config cache-files-dir)" - name: Configure Composer cache - uses: actions/cache@v1 + uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} @@ -103,4 +103,4 @@ jobs: comment-id: ${{ steps.find-comment.outputs.comment-id }} token: ${{ secrets.BOT_TOKEN }} edit-mode: replace - body: ${{ steps.get-comment-body.outputs.body }} \ No newline at end of file + body: ${{ steps.get-comment-body.outputs.body }} From c8adeade179c501ded510bd61ba66a39003ee5c8 Mon Sep 17 00:00:00 2001 From: vytisbulkevicius <36594177+vytisbulkevicius@users.noreply.github.com> Date: Mon, 14 Apr 2025 10:23:48 +0300 Subject: [PATCH 6/8] Update deploy-s3-store.yml --- .github/workflows/deploy-s3-store.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-s3-store.yml b/.github/workflows/deploy-s3-store.yml index aaa0da4..c5c01c1 100644 --- a/.github/workflows/deploy-s3-store.yml +++ b/.github/workflows/deploy-s3-store.yml @@ -17,7 +17,7 @@ jobs: - name: Get yarn cache directory path id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - - uses: actions/cache@v2 + - uses: actions/cache@v4 id: yarn-cache with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} From e4721303cf92ab5abb28164dc87da39d1e8c5475 Mon Sep 17 00:00:00 2001 From: vytisbulkevicius <36594177+vytisbulkevicius@users.noreply.github.com> Date: Mon, 14 Apr 2025 10:24:05 +0300 Subject: [PATCH 7/8] Update test-js.yml --- .github/workflows/test-js.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-js.yml b/.github/workflows/test-js.yml index 622c05f..7e62d6c 100644 --- a/.github/workflows/test-js.yml +++ b/.github/workflows/test-js.yml @@ -22,7 +22,7 @@ jobs: - name: Get yarn cache directory path id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - - uses: actions/cache@v2 + - uses: actions/cache@v4 id: yarn-cache with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} @@ -34,4 +34,4 @@ jobs: - name: Build source run: yarn run build - name: Run lint checks - run: yarn run lint \ No newline at end of file + run: yarn run lint From ff47a3686edf9be3e8734799b71443740ce5dfbd Mon Sep 17 00:00:00 2001 From: vytisbulkevicius <36594177+vytisbulkevicius@users.noreply.github.com> Date: Mon, 14 Apr 2025 10:24:27 +0300 Subject: [PATCH 8/8] Update test-php.yml --- .github/workflows/test-php.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-php.yml b/.github/workflows/test-php.yml index 9f0f463..5acc5d1 100644 --- a/.github/workflows/test-php.yml +++ b/.github/workflows/test-php.yml @@ -22,7 +22,7 @@ jobs: run: | echo "::set-output name=dir::$(composer config cache-files-dir)" - name: Setup Composer cache - uses: actions/cache@v1 + uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} @@ -60,7 +60,7 @@ jobs: run: | echo "::set-output name=dir::$(composer config cache-files-dir)" - name: Setup Composer cache - uses: actions/cache@v1 + uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}