diff --git a/.eslintrc b/.eslintrc
index b150925f5..9a90fc4fc 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -1,9 +1,8 @@
{
"env": {
- "browser": true,
- "es2021": true
+ "browser": true
},
- "extends": "wordpress",
+ "extends": "plugin:@wordpress/eslint-plugin/recommended",
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
@@ -63,5 +62,30 @@
"objectsInObjects": false
}
],
+ "prettier/prettier": ["off"],
+ "react-hooks/rules-of-hooks": ["warn"],
+ "dot-notation": ["off"],
+ "@wordpress/no-unsafe-wp-apis": ["warn"],
+ "no-undef": ["warn"],
+ "no-shadow": ["warn"],
+ "@typescript-eslint/no-shadow": "warn",
+ "@wordpress/no-base-control-with-label-without-id": ["warn"],
+ "no-unused-vars": ["warn"],
+ "@typescript-eslint/no-unused-vars": "warn",
+ "jsdoc/require-returns-description": ["warn"],
+ "no-unused-expressions": ["warn"],
+ "jsdoc/require-returns-type": ["warn"],
+ "no-nested-ternary": ["warn"],
+ "no-console": "warn",
+ "jsdoc/require-param-type": "warn",
+ "jsdoc/no-undefined-types": "warn",
+ "jsx-a11y/click-events-have-key-events": "warn",
+ "jsx-a11y/no-static-element-interactions": "warn",
+ "import/no-extraneous-dependencies": "warn",
+ "jsx-a11y/label-has-associated-control": "warn",
+ "jsx-a11y/alt-text": "warn",
+ "jsx-a11y/anchor-is-valid": "warn",
+ "jsx-a11y/no-noninteractive-element-interactions": "warn",
+ "jsx-a11y/no-autofocus": "warn"
}
}
diff --git a/.github/workflows/update-translations.yml b/.github/workflows/update-translations.yml
new file mode 100644
index 000000000..6bf5d0f61
--- /dev/null
+++ b/.github/workflows/update-translations.yml
@@ -0,0 +1,58 @@
+name: Dispatch Update to translations.themeisle.com
+
+on:
+ push:
+ tags:
+ - "*"
+
+jobs:
+ makepot:
+ name: Build, make pot file and upload to S3
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Check out source files
+ uses: actions/checkout@v4
+ - name: Setup node 18
+ uses: actions/setup-node@v4
+ with:
+ node-version: 18.x
+ - name: Install composer deps
+ env:
+ GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
+ run: |
+ composer install --no-dev --prefer-dist --no-progress
+ - name: Install NPM deps
+ run: npm ci
+ - name: Build files
+ run: npm run build
+ - name: Build pot
+ run: npm run build:makepot
+ - name: Upload Latest Version to S3
+ uses: jakejarvis/s3-sync-action@master
+ with:
+ args: --acl public-read --follow-symlinks --delete
+ env:
+ AWS_S3_BUCKET: ${{ secrets.AWS_DEV_BUCKET }}
+ AWS_ACCESS_KEY_ID: ${{ secrets.S3_AWS_KEY_ARTIFACTS }}
+ AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_AWS_SECRET_ARTIFACTS }}
+ SOURCE_DIR: languages/
+ DEST_DIR: ${{ github.event.repository.name }}-translations/
+
+ dispatch-workflow:
+ runs-on: ubuntu-latest
+ needs: makepot
+
+ steps:
+ - name: Dispatch workflow
+ uses: peter-evans/repository-dispatch@v3
+ with:
+ token: ${{ secrets.BOT_TOKEN }}
+ repository: Codeinwp/themeisle-translations
+ event-type: update-potfile
+ client-payload: |
+ {
+ "ref": "${{ github.ref }}",
+ "potfile": "https://verti-artifacts.s3.amazonaws.com/${{ github.event.repository.name }}-translations/otter-pro.pot",
+ "slug": "otter-pro"
+ }
diff --git a/composer.lock b/composer.lock
index d3ec77742..684a2ba69 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,24 +4,25 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "cecd1e21bbd782bb8338e86244ef7ad5",
+ "content-hash": "b22fd93aceb17c6451620051662dcbb4",
"packages": [
{
"name": "codeinwp/themeisle-sdk",
- "version": "3.3.30",
+ "version": "3.3.34",
"source": {
"type": "git",
"url": "https://github.com/Codeinwp/themeisle-sdk.git",
- "reference": "801a07604a297f02de3067948176f91b4c84bd8a"
+ "reference": "2c525df1b692acff0c968faf67f5adf6f1263c7a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/801a07604a297f02de3067948176f91b4c84bd8a",
- "reference": "801a07604a297f02de3067948176f91b4c84bd8a",
+ "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/2c525df1b692acff0c968faf67f5adf6f1263c7a",
+ "reference": "2c525df1b692acff0c968faf67f5adf6f1263c7a",
"shasum": ""
},
"require-dev": {
- "codeinwp/phpcs-ruleset": "dev-main"
+ "codeinwp/phpcs-ruleset": "dev-main",
+ "yoast/phpunit-polyfills": "^2.0"
},
"type": "library",
"notification-url": "https://packagist.org/downloads/",
@@ -42,9 +43,9 @@
],
"support": {
"issues": "https://github.com/Codeinwp/themeisle-sdk/issues",
- "source": "https://github.com/Codeinwp/themeisle-sdk/tree/v3.3.30"
+ "source": "https://github.com/Codeinwp/themeisle-sdk/tree/v3.3.34"
},
- "time": "2024-09-10T23:53:07+00:00"
+ "time": "2024-10-25T07:28:34+00:00"
},
{
"name": "enshrined/svg-sanitize",
diff --git a/inc/class-blocks-animation.php b/inc/class-blocks-animation.php
index 9efb7b298..1920aca11 100644
--- a/inc/class-blocks-animation.php
+++ b/inc/class-blocks-animation.php
@@ -287,8 +287,13 @@ public function render_welcome_notice() {
$notice_html .= '
';
$notice_html .= '
';
- /* translators: %s: Otter Blocks */
- $notice_html .= sprintf( __( 'Power Up Your Site with %1$s, %2$s, %3$s, and more!', 'otter-blocks' ), 'Add-on Blocks ', 'Enhanced Animations ', 'Visibility Conditions ' );
+ $notice_html .= sprintf(
+ /* translators: %1$s: Add-on Blocks, %2$s: Enhanced Animations, %3$s: Visibility Conditions */
+ __( 'Power Up Your Site with %1$s, %2$s, %3$s, and more!', 'otter-blocks' ),
+ '' . __( 'Add-on Blocks', 'otter-blocks' ) . ' ',
+ '' . __( 'Enhanced Animations', 'otter-blocks' ) . ' ',
+ '' . __( 'Visibility Conditions', 'otter-blocks' ) . ' '
+ );
$notice_html .= ' ';
diff --git a/inc/class-main.php b/inc/class-main.php
index 7cde4d20b..814eca3c6 100644
--- a/inc/class-main.php
+++ b/inc/class-main.php
@@ -42,6 +42,7 @@ public function init() {
if ( ! function_exists( 'is_wpcom_vip' ) ) {
add_filter( 'upload_mimes', array( $this, 'allow_meme_types' ), PHP_INT_MAX ); // phpcs:ignore WordPressVIPMinimum.Hooks.RestrictedHooks.upload_mimes
add_filter( 'wp_handle_upload_prefilter', array( $this, 'check_svg_and_sanitize' ) );
+ add_filter( 'wp_handle_sideload_prefilter', array( $this, 'check_svg_and_sanitize' ) );
add_filter( 'wp_check_filetype_and_ext', array( $this, 'fix_mime_type_json_svg' ), 75, 3 );
add_filter( 'wp_generate_attachment_metadata', array( $this, 'generate_svg_attachment_metadata' ), PHP_INT_MAX, 2 );
}
@@ -398,6 +399,10 @@ public function check_svg_and_sanitize( $file ) {
'otter-blocks'
);
}
+
+ $path_info = pathinfo( $file['name'] );
+ $unique_suffix = '-' . substr( md5( uniqid() ), 0, 6 );
+ $file['name'] = $path_info['filename'] . $unique_suffix . '.' . $path_info['extension'];
}
return $file;
diff --git a/inc/integrations/class-form-email.php b/inc/integrations/class-form-email.php
index c73c06776..0383a19a7 100644
--- a/inc/integrations/class-form-email.php
+++ b/inc/integrations/class-form-email.php
@@ -262,27 +262,34 @@ public function build_error_body( $form_data ) {
*/
public function build_test_email( $form_data ) {
return sprintf(
- "
+ '
-
+
-
+
-
-
-
%s%s
+
+
+
%s
%s
- Location:
link .
+ %s
- ",
- esc_html__( 'Mail From: ', 'otter-blocks' ),
- sanitize_email( get_site_option( 'admin_email' ) ),
- esc_html( __( 'This a test email. If you receive this email, your SMTP set-up is working for sending emails via Form Block.', 'otter-blocks' ) ),
- $form_data->get_data_from_payload( 'site' )
+ ',
+ sprintf(
+ // translators: %s is the admin email address.
+ __( 'Mail From: %s', 'otter-blocks' ),
+ sanitize_email( get_site_option( 'admin_email' ) )
+ ),
+ esc_html__( 'This a test email. If you receive this email, your SMTP set-up is working for sending emails via Form Block.', 'otter-blocks' ),
+ sprintf(
+ // translators: %s is the URL of the site from which the email was sent.
+ __( 'Location: %s', 'otter-blocks' ),
+ '
' . esc_html__( 'link', 'otter-blocks' ) . ' '
+ )
);
}
diff --git a/inc/render/class-review-block.php b/inc/render/class-review-block.php
index 2967fe926..0f7db37c7 100644
--- a/inc/render/class-review-block.php
+++ b/inc/render/class-review-block.php
@@ -85,8 +85,12 @@ function() use ( $attributes, $post_id ) {
$html .= ' ';
- // translators: Overall rating from 1 to 10.
- $html .= '
' . sprintf( __( '%1$g out of %2$g', 'otter-blocks' ), $this->get_overall_ratings( $attributes['features'], $scale ), 10 / $scale ) . ' ';
+ $html .= '
' . sprintf(
+ // translators: %1$g is the overall rating, %2$g is the maximum rating.
+ __( '%1$g out of %2$g', 'otter-blocks' ),
+ $this->get_overall_ratings( $attributes['features'], $scale ),
+ 10 / $scale
+ ) . ' ';
$html .= '
';
if ( ( isset( $attributes['price'] ) && ! empty( $attributes['price'] ) ) || isset( $attributes['discounted'] ) ) {
@@ -133,9 +137,12 @@ function() use ( $attributes, $post_id ) {
$html .= ' ';
$html .= $this->get_overall_stars( $feature['rating'], $scale );
$html .= '
';
-
- // translators: Overall rating from 1 to 10.
- $html .= ' ' . sprintf( __( '%1$g out of %2$g', 'otter-blocks' ), 1 <= round( $feature['rating'] / $scale, 1 ) ? round( $feature['rating'] / $scale, 1 ) : 1, 10 / $scale ) . ' ';
+ $html .= ' ' . sprintf(
+ // translators: %1$g is the overall rating, %2$g is the maximum rating.
+ __( '%1$g out of %2$g', 'otter-blocks' ),
+ 1 <= round( $feature['rating'] / $scale, 1 ) ? round( $feature['rating'] / $scale, 1 ) : 1,
+ 10 / $scale
+ ) . ' ';
$html .= ' ';
diff --git a/package-lock.json b/package-lock.json
index 5a47f3275..0c66a6e59 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -6,8 +6,7 @@
"packages": {
"": {
"name": "otter-blocks",
- "version": "3.0.3",
- "version": "3.0.3",
+ "version": "3.0.4",
"license": "GPL-2.0+",
"dependencies": {
"@formbricks/js": "^2.2.0",
@@ -26,7 +25,7 @@
},
"devDependencies": {
"@automattic/babel-plugin-replace-textdomain": "^1.0.35",
- "@playwright/test": "^1.45.3",
+ "@playwright/test": "^1.48.1",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/git": "^10.0.1",
@@ -37,6 +36,7 @@
"@types/object-hash": "^3.0.6",
"@types/wordpress__block-editor": "^11.5.9",
"@types/wordpress__components": "^23.0.11",
+ "@typescript-eslint/eslint-plugin": "^8.8.1",
"@typescript-eslint/parser": "^8.0.0",
"@wordpress/block-editor": "^13.3.0",
"@wordpress/components": "^28.3.0",
@@ -44,10 +44,11 @@
"@wordpress/data": "^10.8.0",
"@wordpress/dom-ready": "^4.9.0",
"@wordpress/e2e-test-utils": "^10.4.0",
- "@wordpress/e2e-test-utils-playwright": "^1.4.0",
+ "@wordpress/e2e-test-utils-playwright": "^1.10.0",
"@wordpress/e2e-tests": "^8.9.0",
"@wordpress/element": "^6.9.0",
"@wordpress/env": "^9.6.0",
+ "@wordpress/eslint-plugin": "^21.2.0",
"@wordpress/scripts": "27.9.0",
"conventional-changelog-simple-preset": "^1.0.24",
"eslint-config-wordpress": "^2.0.0",
@@ -3669,12 +3670,13 @@
}
},
"node_modules/@playwright/test": {
- "version": "1.47.2",
- "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.47.2.tgz",
- "integrity": "sha512-jTXRsoSPONAs8Za9QEQdyjFn+0ZQFjCiIztAIF6bi1HqhBzG9Ma7g1WotyiGqFSBRZjIEqMdT8RUlbk1QVhzCQ==",
+ "version": "1.48.1",
+ "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.48.1.tgz",
+ "integrity": "sha512-s9RtWoxkOLmRJdw3oFvhFbs9OJS0BzrLUc8Hf6l2UdCNd1rqeEyD4BhCJkvzeEoD1FsK4mirsWwGerhVmYKtZg==",
"dev": true,
+ "license": "Apache-2.0",
"dependencies": {
- "playwright": "1.47.2"
+ "playwright": "1.48.1"
},
"bin": {
"playwright": "cli.js"
@@ -6551,6 +6553,203 @@
"@types/node": "*"
}
},
+ "node_modules/@typescript-eslint/eslint-plugin": {
+ "version": "8.8.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.8.1.tgz",
+ "integrity": "sha512-xfvdgA8AP/vxHgtgU310+WBnLB4uJQ9XdyP17RebG26rLtDrQJV3ZYrcopX91GrHmMoH8bdSwMRh2a//TiJ1jQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@eslint-community/regexpp": "^4.10.0",
+ "@typescript-eslint/scope-manager": "8.8.1",
+ "@typescript-eslint/type-utils": "8.8.1",
+ "@typescript-eslint/utils": "8.8.1",
+ "@typescript-eslint/visitor-keys": "8.8.1",
+ "graphemer": "^1.4.0",
+ "ignore": "^5.3.1",
+ "natural-compare": "^1.4.0",
+ "ts-api-utils": "^1.3.0"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "@typescript-eslint/parser": "^8.0.0 || ^8.0.0-alpha.0",
+ "eslint": "^8.57.0 || ^9.0.0"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": {
+ "version": "8.8.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.8.1.tgz",
+ "integrity": "sha512-X4JdU+66Mazev/J0gfXlcC/dV6JI37h+93W9BRYXrSn0hrE64IoWgVkO9MSJgEzoWkxONgaQpICWg8vAN74wlA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@typescript-eslint/types": "8.8.1",
+ "@typescript-eslint/visitor-keys": "8.8.1"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ }
+ },
+ "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/type-utils": {
+ "version": "8.8.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.8.1.tgz",
+ "integrity": "sha512-qSVnpcbLP8CALORf0za+vjLYj1Wp8HSoiI8zYU5tHxRVj30702Z1Yw4cLwfNKhTPWp5+P+k1pjmD5Zd1nhxiZA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@typescript-eslint/typescript-estree": "8.8.1",
+ "@typescript-eslint/utils": "8.8.1",
+ "debug": "^4.3.4",
+ "ts-api-utils": "^1.3.0"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": {
+ "version": "8.8.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.8.1.tgz",
+ "integrity": "sha512-WCcTP4SDXzMd23N27u66zTKMuEevH4uzU8C9jf0RO4E04yVHgQgW+r+TeVTNnO1KIfrL8ebgVVYYMMO3+jC55Q==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ }
+ },
+ "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/typescript-estree": {
+ "version": "8.8.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.8.1.tgz",
+ "integrity": "sha512-A5d1R9p+X+1js4JogdNilDuuq+EHZdsH9MjTVxXOdVFfTJXunKJR/v+fNNyO4TnoOn5HqobzfRlc70NC6HTcdg==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "@typescript-eslint/types": "8.8.1",
+ "@typescript-eslint/visitor-keys": "8.8.1",
+ "debug": "^4.3.4",
+ "fast-glob": "^3.3.2",
+ "is-glob": "^4.0.3",
+ "minimatch": "^9.0.4",
+ "semver": "^7.6.0",
+ "ts-api-utils": "^1.3.0"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/utils": {
+ "version": "8.8.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.8.1.tgz",
+ "integrity": "sha512-/QkNJDbV0bdL7H7d0/y0qBbV2HTtf0TIyjSDTvvmQEzeVx8jEImEbLuOA4EsvE8gIgqMitns0ifb5uQhMj8d9w==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@eslint-community/eslint-utils": "^4.4.0",
+ "@typescript-eslint/scope-manager": "8.8.1",
+ "@typescript-eslint/types": "8.8.1",
+ "@typescript-eslint/typescript-estree": "8.8.1"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "eslint": "^8.57.0 || ^9.0.0"
+ }
+ },
+ "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": {
+ "version": "8.8.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.8.1.tgz",
+ "integrity": "sha512-0/TdC3aeRAsW7MDvYRwEc1Uwm0TIBfzjPFgg60UU2Haj5qsCs9cc3zNgY71edqE3LbWfF/WoZQd3lJoDXFQpag==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@typescript-eslint/types": "8.8.1",
+ "eslint-visitor-keys": "^3.4.3"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ }
+ },
+ "node_modules/@typescript-eslint/eslint-plugin/node_modules/brace-expansion": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
+ "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "balanced-match": "^1.0.0"
+ }
+ },
+ "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": {
+ "version": "5.3.2",
+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",
+ "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 4"
+ }
+ },
+ "node_modules/@typescript-eslint/eslint-plugin/node_modules/minimatch": {
+ "version": "9.0.5",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",
+ "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "brace-expansion": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=16 || 14 >=14.17"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
"node_modules/@typescript-eslint/parser": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.0.0.tgz",
@@ -8178,10 +8377,11 @@
}
},
"node_modules/@wordpress/e2e-test-utils-playwright": {
- "version": "1.9.0",
- "resolved": "https://registry.npmjs.org/@wordpress/e2e-test-utils-playwright/-/e2e-test-utils-playwright-1.9.0.tgz",
- "integrity": "sha512-07k7LnkvEPIaMGgPvm+wgmBGAVI+pyH/jVXD3TEvKq2BLhZ7zUurV4RvOpiOs58rHvQOS+BzS+yXUwtXUrkQ4g==",
+ "version": "1.10.0",
+ "resolved": "https://registry.npmjs.org/@wordpress/e2e-test-utils-playwright/-/e2e-test-utils-playwright-1.10.0.tgz",
+ "integrity": "sha512-pxXW0nLToS/OPKzFnpi6Q9xWF67n+JYk3q2lNXrCirE5IffTmpy+MwbRD2eFiHq7qzTcO9MeQKwq/t8V4NTVqA==",
"dev": true,
+ "license": "GPL-2.0-or-later",
"dependencies": {
"change-case": "^4.1.2",
"form-data": "^4.0.0",
@@ -8273,144 +8473,6 @@
"node": ">=18"
}
},
- "node_modules/@wordpress/e2e-tests/node_modules/@typescript-eslint/eslint-plugin": {
- "version": "6.21.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz",
- "integrity": "sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA==",
- "dev": true,
- "dependencies": {
- "@eslint-community/regexpp": "^4.5.1",
- "@typescript-eslint/scope-manager": "6.21.0",
- "@typescript-eslint/type-utils": "6.21.0",
- "@typescript-eslint/utils": "6.21.0",
- "@typescript-eslint/visitor-keys": "6.21.0",
- "debug": "^4.3.4",
- "graphemer": "^1.4.0",
- "ignore": "^5.2.4",
- "natural-compare": "^1.4.0",
- "semver": "^7.5.4",
- "ts-api-utils": "^1.0.1"
- },
- "engines": {
- "node": "^16.0.0 || >=18.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/typescript-eslint"
- },
- "peerDependencies": {
- "@typescript-eslint/parser": "^6.0.0 || ^6.0.0-alpha",
- "eslint": "^7.0.0 || ^8.0.0"
- },
- "peerDependenciesMeta": {
- "typescript": {
- "optional": true
- }
- }
- },
- "node_modules/@wordpress/e2e-tests/node_modules/@typescript-eslint/parser": {
- "version": "6.21.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.21.0.tgz",
- "integrity": "sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ==",
- "dev": true,
- "dependencies": {
- "@typescript-eslint/scope-manager": "6.21.0",
- "@typescript-eslint/types": "6.21.0",
- "@typescript-eslint/typescript-estree": "6.21.0",
- "@typescript-eslint/visitor-keys": "6.21.0",
- "debug": "^4.3.4"
- },
- "engines": {
- "node": "^16.0.0 || >=18.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/typescript-eslint"
- },
- "peerDependencies": {
- "eslint": "^7.0.0 || ^8.0.0"
- },
- "peerDependenciesMeta": {
- "typescript": {
- "optional": true
- }
- }
- },
- "node_modules/@wordpress/e2e-tests/node_modules/@typescript-eslint/scope-manager": {
- "version": "6.21.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz",
- "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==",
- "dev": true,
- "dependencies": {
- "@typescript-eslint/types": "6.21.0",
- "@typescript-eslint/visitor-keys": "6.21.0"
- },
- "engines": {
- "node": "^16.0.0 || >=18.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/typescript-eslint"
- }
- },
- "node_modules/@wordpress/e2e-tests/node_modules/@typescript-eslint/types": {
- "version": "6.21.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz",
- "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==",
- "dev": true,
- "engines": {
- "node": "^16.0.0 || >=18.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/typescript-eslint"
- }
- },
- "node_modules/@wordpress/e2e-tests/node_modules/@typescript-eslint/typescript-estree": {
- "version": "6.21.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz",
- "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==",
- "dev": true,
- "dependencies": {
- "@typescript-eslint/types": "6.21.0",
- "@typescript-eslint/visitor-keys": "6.21.0",
- "debug": "^4.3.4",
- "globby": "^11.1.0",
- "is-glob": "^4.0.3",
- "minimatch": "9.0.3",
- "semver": "^7.5.4",
- "ts-api-utils": "^1.0.1"
- },
- "engines": {
- "node": "^16.0.0 || >=18.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/typescript-eslint"
- },
- "peerDependenciesMeta": {
- "typescript": {
- "optional": true
- }
- }
- },
- "node_modules/@wordpress/e2e-tests/node_modules/@typescript-eslint/visitor-keys": {
- "version": "6.21.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz",
- "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==",
- "dev": true,
- "dependencies": {
- "@typescript-eslint/types": "6.21.0",
- "eslint-visitor-keys": "^3.4.1"
- },
- "engines": {
- "node": "^16.0.0 || >=18.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/typescript-eslint"
- }
- },
"node_modules/@wordpress/e2e-tests/node_modules/@wordpress/api-fetch": {
"version": "7.9.0",
"resolved": "https://registry.npmjs.org/@wordpress/api-fetch/-/api-fetch-7.9.0.tgz",
@@ -8508,49 +8570,6 @@
"puppeteer-core": ">=11"
}
},
- "node_modules/@wordpress/e2e-tests/node_modules/@wordpress/eslint-plugin": {
- "version": "21.2.0",
- "resolved": "https://registry.npmjs.org/@wordpress/eslint-plugin/-/eslint-plugin-21.2.0.tgz",
- "integrity": "sha512-jsqi1C96FV4wTGPtPVP/bj/rQtDgu4dHP5pKqtwCuPs7AU4pnUJPHut67Ass8POD+c4EvjPVhS8UDpBs2MeSJg==",
- "dev": true,
- "dependencies": {
- "@babel/eslint-parser": "^7.16.0",
- "@typescript-eslint/eslint-plugin": "^6.4.1",
- "@typescript-eslint/parser": "^6.4.1",
- "@wordpress/babel-preset-default": "^8.9.0",
- "@wordpress/prettier-config": "^4.9.0",
- "cosmiconfig": "^7.0.0",
- "eslint-config-prettier": "^8.3.0",
- "eslint-plugin-import": "^2.25.2",
- "eslint-plugin-jest": "^27.2.3",
- "eslint-plugin-jsdoc": "^46.4.6",
- "eslint-plugin-jsx-a11y": "^6.5.1",
- "eslint-plugin-playwright": "^0.15.3",
- "eslint-plugin-prettier": "^5.0.0",
- "eslint-plugin-react": "^7.27.0",
- "eslint-plugin-react-hooks": "^4.3.0",
- "globals": "^13.12.0",
- "requireindex": "^1.2.0"
- },
- "engines": {
- "node": ">=18.12.0",
- "npm": ">=8.19.2"
- },
- "peerDependencies": {
- "@babel/core": ">=7",
- "eslint": ">=8",
- "prettier": ">=3",
- "typescript": ">=4"
- },
- "peerDependenciesMeta": {
- "prettier": {
- "optional": true
- },
- "typescript": {
- "optional": true
- }
- }
- },
"node_modules/@wordpress/e2e-tests/node_modules/@wordpress/i18n": {
"version": "5.9.0",
"resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-5.9.0.tgz",
@@ -8834,15 +8853,6 @@
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"dev": true
},
- "node_modules/@wordpress/e2e-tests/node_modules/brace-expansion": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
- "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
- "dev": true,
- "dependencies": {
- "balanced-match": "^1.0.0"
- }
- },
"node_modules/@wordpress/e2e-tests/node_modules/chromium-bidi": {
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.8.0.tgz",
@@ -8880,146 +8890,6 @@
"integrity": "sha512-75fMas7PkYNDTmDyb6PRJCH7ILmHLp+BhrZGeMsa4bCh40DTxgCz2NRy5UDzII4C5KuD0oBMZ9vXKhEl6UD/3w==",
"dev": true
},
- "node_modules/@wordpress/e2e-tests/node_modules/eslint-plugin-jest": {
- "version": "27.9.0",
- "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.9.0.tgz",
- "integrity": "sha512-QIT7FH7fNmd9n4se7FFKHbsLKGQiw885Ds6Y/sxKgCZ6natwCsXdgPOADnYVxN2QrRweF0FZWbJ6S7Rsn7llug==",
- "dev": true,
- "dependencies": {
- "@typescript-eslint/utils": "^5.10.0"
- },
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- },
- "peerDependencies": {
- "@typescript-eslint/eslint-plugin": "^5.0.0 || ^6.0.0 || ^7.0.0",
- "eslint": "^7.0.0 || ^8.0.0",
- "jest": "*"
- },
- "peerDependenciesMeta": {
- "@typescript-eslint/eslint-plugin": {
- "optional": true
- },
- "jest": {
- "optional": true
- }
- }
- },
- "node_modules/@wordpress/e2e-tests/node_modules/eslint-plugin-jest/node_modules/@typescript-eslint/scope-manager": {
- "version": "5.62.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz",
- "integrity": "sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w==",
- "dev": true,
- "dependencies": {
- "@typescript-eslint/types": "5.62.0",
- "@typescript-eslint/visitor-keys": "5.62.0"
- },
- "engines": {
- "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/typescript-eslint"
- }
- },
- "node_modules/@wordpress/e2e-tests/node_modules/eslint-plugin-jest/node_modules/@typescript-eslint/types": {
- "version": "5.62.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.62.0.tgz",
- "integrity": "sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ==",
- "dev": true,
- "engines": {
- "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/typescript-eslint"
- }
- },
- "node_modules/@wordpress/e2e-tests/node_modules/eslint-plugin-jest/node_modules/@typescript-eslint/typescript-estree": {
- "version": "5.62.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.62.0.tgz",
- "integrity": "sha512-CmcQ6uY7b9y694lKdRB8FEel7JbU/40iSAPomu++SjLMntB+2Leay2LO6i8VnJk58MtE9/nQSFIH6jpyRWyYzA==",
- "dev": true,
- "dependencies": {
- "@typescript-eslint/types": "5.62.0",
- "@typescript-eslint/visitor-keys": "5.62.0",
- "debug": "^4.3.4",
- "globby": "^11.1.0",
- "is-glob": "^4.0.3",
- "semver": "^7.3.7",
- "tsutils": "^3.21.0"
- },
- "engines": {
- "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/typescript-eslint"
- },
- "peerDependenciesMeta": {
- "typescript": {
- "optional": true
- }
- }
- },
- "node_modules/@wordpress/e2e-tests/node_modules/eslint-plugin-jest/node_modules/@typescript-eslint/utils": {
- "version": "5.62.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.62.0.tgz",
- "integrity": "sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ==",
- "dev": true,
- "dependencies": {
- "@eslint-community/eslint-utils": "^4.2.0",
- "@types/json-schema": "^7.0.9",
- "@types/semver": "^7.3.12",
- "@typescript-eslint/scope-manager": "5.62.0",
- "@typescript-eslint/types": "5.62.0",
- "@typescript-eslint/typescript-estree": "5.62.0",
- "eslint-scope": "^5.1.1",
- "semver": "^7.3.7"
- },
- "engines": {
- "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/typescript-eslint"
- },
- "peerDependencies": {
- "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
- }
- },
- "node_modules/@wordpress/e2e-tests/node_modules/eslint-plugin-jest/node_modules/@typescript-eslint/visitor-keys": {
- "version": "5.62.0",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.62.0.tgz",
- "integrity": "sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw==",
- "dev": true,
- "dependencies": {
- "@typescript-eslint/types": "5.62.0",
- "eslint-visitor-keys": "^3.3.0"
- },
- "engines": {
- "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/typescript-eslint"
- }
- },
- "node_modules/@wordpress/e2e-tests/node_modules/eslint-plugin-playwright": {
- "version": "0.15.3",
- "resolved": "https://registry.npmjs.org/eslint-plugin-playwright/-/eslint-plugin-playwright-0.15.3.tgz",
- "integrity": "sha512-LQMW5y0DLK5Fnpya7JR1oAYL2/7Y9wDiYw6VZqlKqcRGSgjbVKNqxraphk7ra1U3Bb5EK444xMgUlQPbMg2M1g==",
- "dev": true,
- "peerDependencies": {
- "eslint": ">=7",
- "eslint-plugin-jest": ">=25"
- },
- "peerDependenciesMeta": {
- "eslint-plugin-jest": {
- "optional": true
- }
- }
- },
"node_modules/@wordpress/e2e-tests/node_modules/extract-zip": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz",
@@ -9106,21 +8976,6 @@
"node": ">=6"
}
},
- "node_modules/@wordpress/e2e-tests/node_modules/globals": {
- "version": "13.24.0",
- "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz",
- "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==",
- "dev": true,
- "dependencies": {
- "type-fest": "^0.20.2"
- },
- "engines": {
- "node": ">=8"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/@wordpress/e2e-tests/node_modules/http-proxy-agent": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz",
@@ -9210,21 +9065,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/@wordpress/e2e-tests/node_modules/minimatch": {
- "version": "9.0.3",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz",
- "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==",
- "dev": true,
- "dependencies": {
- "brace-expansion": "^2.0.1"
- },
- "engines": {
- "node": ">=16 || 14 >=14.17"
- },
- "funding": {
- "url": "https://github.com/sponsors/isaacs"
- }
- },
"node_modules/@wordpress/e2e-tests/node_modules/mitt": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz",
@@ -9530,18 +9370,6 @@
"streamx": "^2.15.0"
}
},
- "node_modules/@wordpress/e2e-tests/node_modules/type-fest": {
- "version": "0.20.2",
- "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz",
- "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==",
- "dev": true,
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/@wordpress/e2e-tests/node_modules/write-file-atomic": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-5.0.1.tgz",
@@ -9644,16 +9472,17 @@
}
},
"node_modules/@wordpress/eslint-plugin": {
- "version": "18.1.0",
- "resolved": "https://registry.npmjs.org/@wordpress/eslint-plugin/-/eslint-plugin-18.1.0.tgz",
- "integrity": "sha512-5eGpXEwaZsKbEh9040nVr4ggmrpPmltP+Ie4iGruWvCme6ZIFYw70CyWEV8S102IkqjH/BaH6d+CWg8tN7sc/g==",
+ "version": "21.2.0",
+ "resolved": "https://registry.npmjs.org/@wordpress/eslint-plugin/-/eslint-plugin-21.2.0.tgz",
+ "integrity": "sha512-jsqi1C96FV4wTGPtPVP/bj/rQtDgu4dHP5pKqtwCuPs7AU4pnUJPHut67Ass8POD+c4EvjPVhS8UDpBs2MeSJg==",
"dev": true,
+ "license": "GPL-2.0-or-later",
"dependencies": {
"@babel/eslint-parser": "^7.16.0",
"@typescript-eslint/eslint-plugin": "^6.4.1",
"@typescript-eslint/parser": "^6.4.1",
- "@wordpress/babel-preset-default": "^7.42.0",
- "@wordpress/prettier-config": "^3.15.0",
+ "@wordpress/babel-preset-default": "^8.9.0",
+ "@wordpress/prettier-config": "^4.9.0",
"cosmiconfig": "^7.0.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.2",
@@ -9668,8 +9497,8 @@
"requireindex": "^1.2.0"
},
"engines": {
- "node": ">=14",
- "npm": ">=6.14.4"
+ "node": ">=18.12.0",
+ "npm": ">=8.19.2"
},
"peerDependencies": {
"@babel/core": ">=7",
@@ -9824,6 +9653,55 @@
"url": "https://opencollective.com/typescript-eslint"
}
},
+ "node_modules/@wordpress/eslint-plugin/node_modules/@wordpress/babel-preset-default": {
+ "version": "8.9.0",
+ "resolved": "https://registry.npmjs.org/@wordpress/babel-preset-default/-/babel-preset-default-8.9.0.tgz",
+ "integrity": "sha512-qkhnRyku8FeiUGXfcMYfr/u2SG6NIj/9hWoe5Ubpay7gpX2A1H9+rLrTvABRiip7zit88JJ6b4VUqLL9Cr23bg==",
+ "dev": true,
+ "license": "GPL-2.0-or-later",
+ "dependencies": {
+ "@babel/core": "^7.16.0",
+ "@babel/plugin-transform-react-jsx": "^7.16.0",
+ "@babel/plugin-transform-runtime": "^7.16.0",
+ "@babel/preset-env": "^7.16.0",
+ "@babel/preset-typescript": "^7.16.0",
+ "@babel/runtime": "^7.16.0",
+ "@wordpress/browserslist-config": "^6.9.0",
+ "@wordpress/warning": "^3.9.0",
+ "browserslist": "^4.21.10",
+ "core-js": "^3.31.0",
+ "react": "^18.3.0"
+ },
+ "engines": {
+ "node": ">=18.12.0",
+ "npm": ">=8.19.2"
+ }
+ },
+ "node_modules/@wordpress/eslint-plugin/node_modules/@wordpress/browserslist-config": {
+ "version": "6.9.0",
+ "resolved": "https://registry.npmjs.org/@wordpress/browserslist-config/-/browserslist-config-6.9.0.tgz",
+ "integrity": "sha512-yv8KJrMZTvhY+PNWQ6CQVTUs/6sAVgim7AxGpgTkVzDYKvTeJKuZqeHzAWtHKTOG+ORIj/29XtpIOU85R9dkng==",
+ "dev": true,
+ "license": "GPL-2.0-or-later",
+ "engines": {
+ "node": ">=18.12.0",
+ "npm": ">=8.19.2"
+ }
+ },
+ "node_modules/@wordpress/eslint-plugin/node_modules/@wordpress/prettier-config": {
+ "version": "4.9.0",
+ "resolved": "https://registry.npmjs.org/@wordpress/prettier-config/-/prettier-config-4.9.0.tgz",
+ "integrity": "sha512-kxBTL/UZS1JEqzWWHo+h3q+ErvCtkiHm6GozUDgX9UlZXHAx/XAc24s4UaYXmZpjuH5hWO4sbp3xbj2ZI+Ohkg==",
+ "dev": true,
+ "license": "GPL-2.0-or-later",
+ "engines": {
+ "node": ">=18.12.0",
+ "npm": ">=8.19.2"
+ },
+ "peerDependencies": {
+ "prettier": ">=3"
+ }
+ },
"node_modules/@wordpress/eslint-plugin/node_modules/brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
@@ -10674,6 +10552,150 @@
"react-dom": "^18.0.0"
}
},
+ "node_modules/@wordpress/scripts/node_modules/@typescript-eslint/eslint-plugin": {
+ "version": "6.21.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz",
+ "integrity": "sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@eslint-community/regexpp": "^4.5.1",
+ "@typescript-eslint/scope-manager": "6.21.0",
+ "@typescript-eslint/type-utils": "6.21.0",
+ "@typescript-eslint/utils": "6.21.0",
+ "@typescript-eslint/visitor-keys": "6.21.0",
+ "debug": "^4.3.4",
+ "graphemer": "^1.4.0",
+ "ignore": "^5.2.4",
+ "natural-compare": "^1.4.0",
+ "semver": "^7.5.4",
+ "ts-api-utils": "^1.0.1"
+ },
+ "engines": {
+ "node": "^16.0.0 || >=18.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "@typescript-eslint/parser": "^6.0.0 || ^6.0.0-alpha",
+ "eslint": "^7.0.0 || ^8.0.0"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@wordpress/scripts/node_modules/@typescript-eslint/parser": {
+ "version": "6.21.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.21.0.tgz",
+ "integrity": "sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "@typescript-eslint/scope-manager": "6.21.0",
+ "@typescript-eslint/types": "6.21.0",
+ "@typescript-eslint/typescript-estree": "6.21.0",
+ "@typescript-eslint/visitor-keys": "6.21.0",
+ "debug": "^4.3.4"
+ },
+ "engines": {
+ "node": "^16.0.0 || >=18.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "eslint": "^7.0.0 || ^8.0.0"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@wordpress/scripts/node_modules/@typescript-eslint/scope-manager": {
+ "version": "6.21.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz",
+ "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@typescript-eslint/types": "6.21.0",
+ "@typescript-eslint/visitor-keys": "6.21.0"
+ },
+ "engines": {
+ "node": "^16.0.0 || >=18.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ }
+ },
+ "node_modules/@wordpress/scripts/node_modules/@typescript-eslint/types": {
+ "version": "6.21.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz",
+ "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^16.0.0 || >=18.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ }
+ },
+ "node_modules/@wordpress/scripts/node_modules/@typescript-eslint/typescript-estree": {
+ "version": "6.21.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz",
+ "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "@typescript-eslint/types": "6.21.0",
+ "@typescript-eslint/visitor-keys": "6.21.0",
+ "debug": "^4.3.4",
+ "globby": "^11.1.0",
+ "is-glob": "^4.0.3",
+ "minimatch": "9.0.3",
+ "semver": "^7.5.4",
+ "ts-api-utils": "^1.0.1"
+ },
+ "engines": {
+ "node": "^16.0.0 || >=18.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@wordpress/scripts/node_modules/@typescript-eslint/visitor-keys": {
+ "version": "6.21.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz",
+ "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@typescript-eslint/types": "6.21.0",
+ "eslint-visitor-keys": "^3.4.1"
+ },
+ "engines": {
+ "node": "^16.0.0 || >=18.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ }
+ },
"node_modules/@wordpress/scripts/node_modules/@wordpress/e2e-test-utils-playwright": {
"version": "0.26.0",
"resolved": "https://registry.npmjs.org/@wordpress/e2e-test-utils-playwright/-/e2e-test-utils-playwright-0.26.0.tgz",
@@ -10697,6 +10719,60 @@
"@playwright/test": ">=1"
}
},
+ "node_modules/@wordpress/scripts/node_modules/@wordpress/eslint-plugin": {
+ "version": "18.1.0",
+ "resolved": "https://registry.npmjs.org/@wordpress/eslint-plugin/-/eslint-plugin-18.1.0.tgz",
+ "integrity": "sha512-5eGpXEwaZsKbEh9040nVr4ggmrpPmltP+Ie4iGruWvCme6ZIFYw70CyWEV8S102IkqjH/BaH6d+CWg8tN7sc/g==",
+ "dev": true,
+ "license": "GPL-2.0-or-later",
+ "dependencies": {
+ "@babel/eslint-parser": "^7.16.0",
+ "@typescript-eslint/eslint-plugin": "^6.4.1",
+ "@typescript-eslint/parser": "^6.4.1",
+ "@wordpress/babel-preset-default": "^7.42.0",
+ "@wordpress/prettier-config": "^3.15.0",
+ "cosmiconfig": "^7.0.0",
+ "eslint-config-prettier": "^8.3.0",
+ "eslint-plugin-import": "^2.25.2",
+ "eslint-plugin-jest": "^27.2.3",
+ "eslint-plugin-jsdoc": "^46.4.6",
+ "eslint-plugin-jsx-a11y": "^6.5.1",
+ "eslint-plugin-playwright": "^0.15.3",
+ "eslint-plugin-prettier": "^5.0.0",
+ "eslint-plugin-react": "^7.27.0",
+ "eslint-plugin-react-hooks": "^4.3.0",
+ "globals": "^13.12.0",
+ "requireindex": "^1.2.0"
+ },
+ "engines": {
+ "node": ">=14",
+ "npm": ">=6.14.4"
+ },
+ "peerDependencies": {
+ "@babel/core": ">=7",
+ "eslint": ">=8",
+ "prettier": ">=3",
+ "typescript": ">=4"
+ },
+ "peerDependenciesMeta": {
+ "prettier": {
+ "optional": true
+ },
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@wordpress/scripts/node_modules/brace-expansion": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
+ "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "balanced-match": "^1.0.0"
+ }
+ },
"node_modules/@wordpress/scripts/node_modules/cross-fetch": {
"version": "3.1.5",
"resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz",
@@ -10712,6 +10788,153 @@
"integrity": "sha512-0cuGS8+jhR67Fy7qG3i3Pc7Aw494sb9yG9QgpG97SFVWwolgYjlhJg7n+UaHxOQT30d1TYu/EYe9k01ivLErIg==",
"dev": true
},
+ "node_modules/@wordpress/scripts/node_modules/eslint-plugin-jest": {
+ "version": "27.9.0",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.9.0.tgz",
+ "integrity": "sha512-QIT7FH7fNmd9n4se7FFKHbsLKGQiw885Ds6Y/sxKgCZ6natwCsXdgPOADnYVxN2QrRweF0FZWbJ6S7Rsn7llug==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@typescript-eslint/utils": "^5.10.0"
+ },
+ "engines": {
+ "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
+ },
+ "peerDependencies": {
+ "@typescript-eslint/eslint-plugin": "^5.0.0 || ^6.0.0 || ^7.0.0",
+ "eslint": "^7.0.0 || ^8.0.0",
+ "jest": "*"
+ },
+ "peerDependenciesMeta": {
+ "@typescript-eslint/eslint-plugin": {
+ "optional": true
+ },
+ "jest": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@wordpress/scripts/node_modules/eslint-plugin-jest/node_modules/@typescript-eslint/scope-manager": {
+ "version": "5.62.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz",
+ "integrity": "sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@typescript-eslint/types": "5.62.0",
+ "@typescript-eslint/visitor-keys": "5.62.0"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ }
+ },
+ "node_modules/@wordpress/scripts/node_modules/eslint-plugin-jest/node_modules/@typescript-eslint/types": {
+ "version": "5.62.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.62.0.tgz",
+ "integrity": "sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ }
+ },
+ "node_modules/@wordpress/scripts/node_modules/eslint-plugin-jest/node_modules/@typescript-eslint/typescript-estree": {
+ "version": "5.62.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.62.0.tgz",
+ "integrity": "sha512-CmcQ6uY7b9y694lKdRB8FEel7JbU/40iSAPomu++SjLMntB+2Leay2LO6i8VnJk58MtE9/nQSFIH6jpyRWyYzA==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "@typescript-eslint/types": "5.62.0",
+ "@typescript-eslint/visitor-keys": "5.62.0",
+ "debug": "^4.3.4",
+ "globby": "^11.1.0",
+ "is-glob": "^4.0.3",
+ "semver": "^7.3.7",
+ "tsutils": "^3.21.0"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@wordpress/scripts/node_modules/eslint-plugin-jest/node_modules/@typescript-eslint/utils": {
+ "version": "5.62.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.62.0.tgz",
+ "integrity": "sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@eslint-community/eslint-utils": "^4.2.0",
+ "@types/json-schema": "^7.0.9",
+ "@types/semver": "^7.3.12",
+ "@typescript-eslint/scope-manager": "5.62.0",
+ "@typescript-eslint/types": "5.62.0",
+ "@typescript-eslint/typescript-estree": "5.62.0",
+ "eslint-scope": "^5.1.1",
+ "semver": "^7.3.7"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
+ }
+ },
+ "node_modules/@wordpress/scripts/node_modules/eslint-plugin-jest/node_modules/@typescript-eslint/visitor-keys": {
+ "version": "5.62.0",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.62.0.tgz",
+ "integrity": "sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@typescript-eslint/types": "5.62.0",
+ "eslint-visitor-keys": "^3.3.0"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ }
+ },
+ "node_modules/@wordpress/scripts/node_modules/eslint-plugin-playwright": {
+ "version": "0.15.3",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-playwright/-/eslint-plugin-playwright-0.15.3.tgz",
+ "integrity": "sha512-LQMW5y0DLK5Fnpya7JR1oAYL2/7Y9wDiYw6VZqlKqcRGSgjbVKNqxraphk7ra1U3Bb5EK444xMgUlQPbMg2M1g==",
+ "dev": true,
+ "license": "MIT",
+ "peerDependencies": {
+ "eslint": ">=7",
+ "eslint-plugin-jest": ">=25"
+ },
+ "peerDependenciesMeta": {
+ "eslint-plugin-jest": {
+ "optional": true
+ }
+ }
+ },
"node_modules/@wordpress/scripts/node_modules/extract-zip": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz",
@@ -10747,6 +10970,38 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/@wordpress/scripts/node_modules/globals": {
+ "version": "13.24.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz",
+ "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "type-fest": "^0.20.2"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/@wordpress/scripts/node_modules/minimatch": {
+ "version": "9.0.3",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz",
+ "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "brace-expansion": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=16 || 14 >=14.17"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
"node_modules/@wordpress/scripts/node_modules/node-fetch": {
"version": "2.6.7",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
@@ -10796,6 +11051,19 @@
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",
"dev": true
},
+ "node_modules/@wordpress/scripts/node_modules/type-fest": {
+ "version": "0.20.2",
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz",
+ "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==",
+ "dev": true,
+ "license": "(MIT OR CC0-1.0)",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/@wordpress/scripts/node_modules/web-vitals": {
"version": "3.5.2",
"resolved": "https://registry.npmjs.org/web-vitals/-/web-vitals-3.5.2.tgz",
@@ -27618,12 +27886,13 @@
}
},
"node_modules/playwright": {
- "version": "1.47.2",
- "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.47.2.tgz",
- "integrity": "sha512-nx1cLMmQWqmA3UsnjaaokyoUpdVaaDhJhMoxX2qj3McpjnsqFHs516QAKYhqHAgOP+oCFTEOCOAaD1RgD/RQfA==",
+ "version": "1.48.1",
+ "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.48.1.tgz",
+ "integrity": "sha512-j8CiHW/V6HxmbntOfyB4+T/uk08tBy6ph0MpBXwuoofkSnLmlfdYNNkFTYD6ofzzlSqLA1fwH4vwvVFvJgLN0w==",
"dev": true,
+ "license": "Apache-2.0",
"dependencies": {
- "playwright-core": "1.47.2"
+ "playwright-core": "1.48.1"
},
"bin": {
"playwright": "cli.js"
@@ -27636,10 +27905,11 @@
}
},
"node_modules/playwright-core": {
- "version": "1.47.2",
- "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.47.2.tgz",
- "integrity": "sha512-3JvMfF+9LJfe16l7AbSmU555PaTl2tPyQsVInqm3id16pdDfvZ8TTZ/pyzmkbDrZTQefyzU7AIHlZqQnxpqHVQ==",
+ "version": "1.48.1",
+ "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.48.1.tgz",
+ "integrity": "sha512-Yw/t4VAFX/bBr1OzwCuOMZkY1Cnb4z/doAFSwf4huqAGWmf9eMNjmK7NiOljCdLmxeRYcGPPmcDgU0zOlzP0YA==",
"dev": true,
+ "license": "Apache-2.0",
"bin": {
"playwright-core": "cli.js"
},
@@ -27653,6 +27923,7 @@
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"dev": true,
"hasInstallScript": true,
+ "license": "MIT",
"optional": true,
"os": [
"darwin"
@@ -34660,7 +34931,6 @@
"resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz",
"integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==",
"license": "MIT",
- "peer": true,
"funding": {
"url": "https://github.com/sponsors/colinhacks"
}
diff --git a/package.json b/package.json
index aa3fc3b56..47b9b0da8 100644
--- a/package.json
+++ b/package.json
@@ -41,7 +41,8 @@
"test:php:watch": "wp-env run --env-cwd='wp-content/plugins/otter-blocks' tests-cli composer run-script test:watch",
"lint:php": "wp-env run --env-cwd='wp-content/plugins/otter-blocks' cli composer run-script lint",
"format:php": "wp-env run --env-cwd='wp-content/plugins/otter-blocks' cli composer run-script format",
- "wp-env": "wp-env"
+ "wp-env": "wp-env",
+ "build:makepot": "docker run --user root --rm --volume \"$(pwd):/var/www/html/otter-blocks\" wordpress:cli bash -c 'php -d memory_limit=512M \"$(which wp)\" --version --allow-root && wp i18n make-pot otter-blocks ./otter-blocks/languages/otter-pro.pot --include=src/pro,otter-pro,build/pro --allow-root --headers={\\\"Last-Translator\\\":\\\"friends@themeisle.com\\\"\\,\\\"Report-Msgid-Bugs-To\\\":\\\"https://github.com/Codeinwp/otter-blocks/issues\\\"\\,\\\"Project-Id-Version\\\":\\\"Otter-Blocks\\\"\\,\\\"POT-Creation-Date\\\":\\\"\\\"}'"
},
"repository": {
"type": "git",
@@ -79,7 +80,7 @@
},
"devDependencies": {
"@automattic/babel-plugin-replace-textdomain": "^1.0.35",
- "@playwright/test": "^1.45.3",
+ "@playwright/test": "^1.48.1",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/git": "^10.0.1",
@@ -90,6 +91,7 @@
"@types/object-hash": "^3.0.6",
"@types/wordpress__block-editor": "^11.5.9",
"@types/wordpress__components": "^23.0.11",
+ "@typescript-eslint/eslint-plugin": "^8.8.1",
"@typescript-eslint/parser": "^8.0.0",
"@wordpress/block-editor": "^13.3.0",
"@wordpress/components": "^28.3.0",
@@ -97,10 +99,11 @@
"@wordpress/data": "^10.8.0",
"@wordpress/dom-ready": "^4.9.0",
"@wordpress/e2e-test-utils": "^10.4.0",
- "@wordpress/e2e-test-utils-playwright": "^1.4.0",
+ "@wordpress/e2e-test-utils-playwright": "^1.10.0",
"@wordpress/e2e-tests": "^8.9.0",
"@wordpress/element": "^6.9.0",
"@wordpress/env": "^9.6.0",
+ "@wordpress/eslint-plugin": "^21.2.0",
"@wordpress/scripts": "27.9.0",
"conventional-changelog-simple-preset": "^1.0.24",
"eslint-config-wordpress": "^2.0.0",
diff --git a/plugins/otter-pro/inc/plugins/class-patterns.php b/plugins/otter-pro/inc/plugins/class-patterns.php
index 08e632234..097e31649 100644
--- a/plugins/otter-pro/inc/plugins/class-patterns.php
+++ b/plugins/otter-pro/inc/plugins/class-patterns.php
@@ -20,6 +20,30 @@ class Patterns {
*/
protected static $instance = null;
+ /**
+ * URL is used to retrieve pattern templates from the Themeisle API.
+ *
+ * @var string PATTERNS_ENDPOINT The endpoint URL for Otter patterns.
+ */
+ const PATTERNS_ENDPOINT = 'https://api.themeisle.com/templates-cloud/otter-patterns';
+
+ /**
+ * Prefix used for translated titles.
+ *
+ * @var string
+ */
+ const TRANSLATED_TITLE_PREFIX = 'title_';
+
+ /**
+ * Array mapping WordPress locale codes to available language codes provided by store.
+ *
+ * @var array
+ */
+ const AVAILABLE_LANGUAGES = [
+ 'de_DE' => 'de',
+ 'de_DE_formal' => 'de',
+ ];
+
/**
* Method to define hooks needed.
*
@@ -57,7 +81,7 @@ public function sync_patterns() {
'license_id' => apply_filters( 'product_otter_license_key', 'free' ),
'cache' => gmdate( 'u' ),
),
- 'https://api.themeisle.com/templates-cloud/otter-patterns'
+ self::PATTERNS_ENDPOINT
);
$response = '';
@@ -110,15 +134,44 @@ public function register_patterns() {
return;
}
+ $user_language = get_user_locale();
+
foreach ( $block_patterns as $block_pattern ) {
if ( ! version_compare( get_bloginfo( 'version' ), $block_pattern['minimum'], '>=' ) ) {
continue;
}
- register_block_pattern( 'otter-pro/' . $block_pattern['slug'], $block_pattern );
+ register_block_pattern( 'otter-pro/' . $block_pattern['slug'], $this->prepare_block_pattern( $block_pattern, $user_language ) );
}
}
+ /**
+ * Prepare the block pattern for registration. Apply translation if possible.
+ *
+ * @param array $block_pattern The block pattern.
+ * @param string $lang_locale The user locale language code.
+ *
+ * @return array The block pattern.
+ */
+ public function prepare_block_pattern( $block_pattern, $lang_locale = '' ) {
+ if ( isset( self::AVAILABLE_LANGUAGES[ $lang_locale ] ) ) {
+ $translated_title = self::TRANSLATED_TITLE_PREFIX . self::AVAILABLE_LANGUAGES[ $lang_locale ];
+ if ( isset( $block_pattern[ $translated_title ] ) ) {
+ $block_pattern['title'] = $block_pattern[ $translated_title ];
+ }
+ }
+
+ foreach ( array_keys( $block_pattern ) as $pattern_key ) {
+ if ( false === strpos( $pattern_key, self::TRANSLATED_TITLE_PREFIX ) ) {
+ continue;
+ }
+
+ unset( $block_pattern[ $pattern_key ] );
+ }
+
+ return $block_pattern;
+ }
+
/**
* Check if the given pattern block has the correct structure.
*
diff --git a/plugins/otter-pro/otter-pro.php b/plugins/otter-pro/otter-pro.php
index ad3d3216f..1ec972a60 100644
--- a/plugins/otter-pro/otter-pro.php
+++ b/plugins/otter-pro/otter-pro.php
@@ -125,3 +125,5 @@ function ( $compatibilities ) {
return $compatibilities;
}
);
+
+add_filter( 'otter-pro_sdk_enable_private_translations', '__return_true' );
diff --git a/src/animation/components/animation-popover.js b/src/animation/components/animation-popover.js
index 95e299e08..588337ad6 100644
--- a/src/animation/components/animation-popover.js
+++ b/src/animation/components/animation-popover.js
@@ -17,8 +17,8 @@ import { useInstanceId } from '@wordpress/compose';
import { Fragment, useState } from '@wordpress/element';
/**
- * Internal dependencies.
- */
+ * Internal dependencies.
+ */
import { categories } from '../data.js';
function AnimationPopover({
@@ -97,14 +97,14 @@ function AnimationPopover({
/>
- { animationsList.map( ( animation ) => {
+ { animationsList.map( ( animation, index ) => {
return (
-
+
{ '' === currentInput &&
- categories.map( ( category ) => {
+ categories.map( ( category, catIndex ) => {
return category.value ===
animation.value ? (
-
+
{ category.label }
) : (
diff --git a/src/animation/editor.js b/src/animation/editor.js
index c66843523..c23c58d3d 100644
--- a/src/animation/editor.js
+++ b/src/animation/editor.js
@@ -7,22 +7,22 @@ import {
Button,
PanelBody,
SelectControl,
- ToggleControl
+ ToggleControl,
+ __experimentalUnitControl as UnitControl
} from '@wordpress/components';
import {
Fragment,
useState,
- useEffect
+ useEffect,
+ memo
} from '@wordpress/element';
import { applyFilters } from '@wordpress/hooks';
-import { __experimentalUnitControl as UnitControl } from '@wordpress/components';
-
/**
- * Internal dependencies.
- */
+ * Internal dependencies.
+ */
import {
animationsList,
delayList,
@@ -44,17 +44,16 @@ const AnimationType = {
default: 'default'
};
-import { memo } from '@wordpress/element';
import { useCSSNode } from '../blocks/helpers/block-utility.js';
/**
* Update the animation config.
*
- * @param {string} type The type of animation. (e.g. count, typing, default)
- * @param {string|undefined} oldValue The old value of the animation.
- * @param {string|undefined} newValue The new value of the animation.
- * @param {Function|undefined} callback The callback function which will be called after the animation is updated.
- * @param {Object} attributes The attributes of the block.
+ * @param {string} type The type of animation. (e.g. count, typing, default)
+ * @param {string|undefined} oldValue The old value of the animation.
+ * @param {string|undefined} newValue The new value of the animation.
+ * @param {Function|undefined} callback The callback function which will be called after the animation is updated.
+ * @param {Object} attributes The attributes of the block.
* @param {(x: Object) => void} setAttributes The setAttributes function of the block.
*/
export const updateAnimConfig = ( type, oldValue, newValue, callback, attributes, setAttributes ) => {
@@ -136,7 +135,7 @@ function AnimationControls({
const updateAnimation = ( e ) => {
let classes;
- let animationValue = 'none' !== e ? e : '';
+ const animationValue = 'none' !== e ? e : '';
if ( attributes.className ) {
classes = attributes.className;
@@ -179,7 +178,7 @@ function AnimationControls({
setAnimation( e );
setAttributes({ className: classes });
- let block = document.querySelector( `#block-${ clientId } .animated` ) || document.querySelector( `#block-${ clientId }.animated` );
+ const block = document.querySelector( `#block-${ clientId } .animated` ) || document.querySelector( `#block-${ clientId }.animated` );
if ( block ) {
outAnimation.forEach( ( i ) => {
diff --git a/src/animation/frontend.js b/src/animation/frontend.js
index 0025671f0..614a2ac6c 100644
--- a/src/animation/frontend.js
+++ b/src/animation/frontend.js
@@ -272,7 +272,7 @@ const animateElements = () => {
};
const isElementInViewport = ( el ) => {
- let scroll = window.scrollY || window.pageYOffset;
+ const scroll = window.scrollY || window.pageYOffset;
const offset = calculateOffset( getTriggerOffset( el ) );
const boundsTop = el.getBoundingClientRect().top + scroll + offset;
diff --git a/src/animation/frontend/count/index.js b/src/animation/frontend/count/index.js
index 7ebbc74aa..c510ce8be 100644
--- a/src/animation/frontend/count/index.js
+++ b/src/animation/frontend/count/index.js
@@ -19,10 +19,10 @@ const speedConfig = {
/**
* Get the configuration option from the element CSS classes.
* @param {HTMLDivElement} elem
- * @returns Configuration options.
+ * @return Configuration options.
*/
const getConfiguration = ( elem ) => {
- let parent = elem.parentElement;
+ const parent = elem.parentElement;
for ( let i = 0; i < MAX_PARENT_SEARCH; ++i ) {
if ( Array.from( parent.classList ).some( o => o.includes( 'o-count-' ) ) ) {
const arr = Array.from( parent.classList );
@@ -52,7 +52,7 @@ const NUMBER_EXTRA_FORMAT = new Set( Array.from( ',' ) );
/**
* Extract the number, prefix, and suffix.
* @param {string} text The selected text
- * @returns An object with the number, prefix and suffix
+ * @return An object with the number, prefix and suffix
*/
const extract = ( text ) => {
const arr = Array.from( text );
@@ -64,7 +64,7 @@ const extract = ( text ) => {
let isPrefix = true;
let isSuffix = false;
- for ( let x of arr ) {
+ for ( const x of arr ) {
if ( NUMERIC_FORMATS.has( x ) ) {
if ( isPrefix ) {
isPrefix = false;
@@ -76,15 +76,13 @@ const extract = ( text ) => {
} else {
number.push( x );
}
+ } else if ( isPrefix ) {
+ prefix.push( x );
} else {
- if ( isPrefix ) {
- prefix.push( x );
- } else {
- if ( ! isSuffix ) {
- isSuffix = true;
- }
- suffix.push( x );
+ if ( ! isSuffix ) {
+ isSuffix = true;
}
+ suffix.push( x );
}
}
diff --git a/src/animation/frontend/typing/index.js b/src/animation/frontend/typing/index.js
index cd4fae4fd..381c99e59 100644
--- a/src/animation/frontend/typing/index.js
+++ b/src/animation/frontend/typing/index.js
@@ -22,10 +22,10 @@ const speedConfig = {
/**
* Get the configuration option from the element CSS classes.
* @param {HTMLDivElement} elem
- * @returns Configuration options.
+ * @return Configuration options.
*/
const getConfiguration = ( elem ) => {
- let parent = elem.parentElement;
+ const parent = elem.parentElement;
for ( let i = 0; i < MAX_PARENT_SEARCH; ++i ) {
if ( Array.from( parent.classList ).some( o => o.includes( 'o-typing-' ) ) ) {
const arr = Array.from( parent.classList );
diff --git a/src/animation/index.js b/src/animation/index.js
index a80ae6971..b21fea478 100644
--- a/src/animation/index.js
+++ b/src/animation/index.js
@@ -18,8 +18,8 @@ import { addFilter } from '@wordpress/hooks';
import { select } from '@wordpress/data';
/**
- * Internal dependencies.
- */
+ * Internal dependencies.
+ */
import './editor.scss';
import Edit from './editor.js';
diff --git a/src/animation/utils.js b/src/animation/utils.js
index 018f5ae1d..edb3e12a2 100644
--- a/src/animation/utils.js
+++ b/src/animation/utils.js
@@ -1,8 +1,8 @@
/**
* Create utility functions for an interval timer.
- * @param {number} duration The duration, in seconds.
+ * @param {number} duration The duration, in seconds.
* @param {number} deltaTime The time between two time ticks, in seconds.
- * @returns Utility functions.
+ * @return Utility functions.
*/
export const makeInterval = ( duration, deltaTime ) => {
@@ -21,7 +21,7 @@ export const makeInterval = ( duration, deltaTime ) => {
/**
* Start the interval. Get a callback function that execute at every tick and the one that execute at the end.
- * @param {Function} callback Function that execute at every tick.
+ * @param {Function} callback Function that execute at every tick.
* @param {Function} endCallback Function that execute at the end.
*/
const start = ( callback, endCallback ) => {
@@ -45,7 +45,7 @@ export const makeInterval = ( duration, deltaTime ) => {
/**
* Specify a function to execute when the DOM is fully loaded.
*
- * @param {Callback} callback A function to execute after the DOM is ready.
+ * @param {()=>{}} callback A function to execute after the DOM is ready.
* @return {void}
*/
export const domReady = ( callback ) => {
diff --git a/src/blocks/blocks/accordion/group/edit.js b/src/blocks/blocks/accordion/group/edit.js
index a1096d140..5399ca46a 100644
--- a/src/blocks/blocks/accordion/group/edit.js
+++ b/src/blocks/blocks/accordion/group/edit.js
@@ -42,7 +42,7 @@ const PREFIX_TO_FAMILY = {
/**
* Accordion Group component
* @param {import('./types').AccordionGroupProps} props
- * @returns
+ * @return
*/
const Edit = ({
name,
diff --git a/src/blocks/blocks/accordion/group/inspector.js b/src/blocks/blocks/accordion/group/inspector.js
index 4029e35c0..efc7a6c48 100644
--- a/src/blocks/blocks/accordion/group/inspector.js
+++ b/src/blocks/blocks/accordion/group/inspector.js
@@ -72,7 +72,7 @@ const gapCompatibility = {
/**
*
* @param {import('./types.js').AccordionGroupInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
clientId,
@@ -137,7 +137,7 @@ const Inspector = ({
const changeBoxShadow = data => {
const boxShadow = { ...attributes.boxShadow };
- Object.entries( data ).map( ([ key, val ] = data ) => {
+ Object.entries( data ).forEach( ([ key, val ] = data ) => {
boxShadow[key] = val;
});
diff --git a/src/blocks/blocks/accordion/item/edit.js b/src/blocks/blocks/accordion/item/edit.js
index 2eec9702c..221a4e8f7 100644
--- a/src/blocks/blocks/accordion/item/edit.js
+++ b/src/blocks/blocks/accordion/item/edit.js
@@ -28,7 +28,7 @@ import { select } from '@wordpress/data';
/**
* Accordion Item component
* @param {import('./types.js').AccordionItemProps} props
- * @returns
+ * @return
*/
const Edit = ({
clientId,
@@ -50,7 +50,7 @@ const Edit = ({
const parentClientId = select( 'core/block-editor' ).getBlockParents( clientId ).at( -1 );
const parentBlock = select( 'core/block-editor' ).getBlock( parentClientId );
- setAttributes({ title: __( 'Accordion item ', 'otter-blocks' ) + parentBlock.innerBlocks.length });
+ setAttributes({ title: __( 'Accordion item', 'otter-blocks' ) + parentBlock.innerBlocks.length });
}
}, []);
diff --git a/src/blocks/blocks/advanced-heading/edit.js b/src/blocks/blocks/advanced-heading/edit.js
index 66ec6b6be..2cfab5e84 100644
--- a/src/blocks/blocks/advanced-heading/edit.js
+++ b/src/blocks/blocks/advanced-heading/edit.js
@@ -45,7 +45,7 @@ const { attributes: defaultAttributes } = metadata;
/**
* Advanced Heading component
* @param {import('./types').AdvancedHeadingProps} props
- * @returns
+ * @return
*/
const Edit = ({
attributes,
diff --git a/src/blocks/blocks/advanced-heading/inspector.js b/src/blocks/blocks/advanced-heading/inspector.js
index 84796c726..4bde8e75e 100644
--- a/src/blocks/blocks/advanced-heading/inspector.js
+++ b/src/blocks/blocks/advanced-heading/inspector.js
@@ -65,7 +65,7 @@ const fieldMapping = {
/**
*
* @param {import('./types.js').AdvancedHeadingInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
diff --git a/src/blocks/blocks/button-group/button/edit.js b/src/blocks/blocks/button-group/button/edit.js
index 3def04c01..0361c8668 100644
--- a/src/blocks/blocks/button-group/button/edit.js
+++ b/src/blocks/blocks/button-group/button/edit.js
@@ -39,7 +39,7 @@ const { attributes: defaultAttributes } = metadata;
/**
* Button component
* @param {import('./types').ButtonGroupButtonProps} props
- * @returns
+ * @return
*/
const Edit = ( props ) => {
const {
diff --git a/src/blocks/blocks/button-group/button/inspector.js b/src/blocks/blocks/button-group/button/inspector.js
index 6d7520731..b85d8bbc9 100644
--- a/src/blocks/blocks/button-group/button/inspector.js
+++ b/src/blocks/blocks/button-group/button/inspector.js
@@ -54,7 +54,7 @@ const styles = [
/**
*
* @param {import('./types.js').ButtonGroupButtonInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
@@ -301,7 +301,7 @@ const Inspector = ({
label={ __( 'Background', 'otter-blocks' ) }
colorValue={ attributes.background }
gradientValue={ attributes.backgroundGradient }
- onColorChange={ background => setAttributes({ background: background })}
+ onColorChange={ background => setAttributes({ background })}
onGradientChange={ backgroundGradient => setAttributes({ backgroundGradient })}
className="is-list"
/>
diff --git a/src/blocks/blocks/button-group/group/controls.tsx b/src/blocks/blocks/button-group/group/controls.tsx
index 3e5d745ce..7d843cb48 100644
--- a/src/blocks/blocks/button-group/group/controls.tsx
+++ b/src/blocks/blocks/button-group/group/controls.tsx
@@ -2,13 +2,13 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
-import { AlignmentToolbar, BlockControls } from '@wordpress/block-editor';
+import { BlockControls } from '@wordpress/block-editor';
import { DropdownMenu, ToolbarGroup } from '@wordpress/components';
/**
* Internal dependencies
*/
-import { ButtonGroupInspectorProps } from './types';
+import type { ButtonGroupInspectorProps } from './types.d.ts';
import { useResponsiveAttributes } from '../../../helpers/utility-hooks';
import { alignCenter, alignLeft, alignRight, menu } from '@wordpress/icons';
diff --git a/src/blocks/blocks/button-group/group/deprecated.js b/src/blocks/blocks/button-group/group/deprecated.js
index 8e85d08e7..35d0de1c5 100644
--- a/src/blocks/blocks/button-group/group/deprecated.js
+++ b/src/blocks/blocks/button-group/group/deprecated.js
@@ -152,6 +152,7 @@ const deprecated = [{
padding: `${ attributes.data[i].paddingTopBottom }px ${ attributes.data[i].paddingLeftRight }px`
};
+ /* eslint-disable react/jsx-no-target-blank */
return (
);
+ /* eslint-enable react/jsx-no-target-blank */
};
return (
diff --git a/src/blocks/blocks/button-group/group/edit.js b/src/blocks/blocks/button-group/group/edit.js
index dc2a29315..54471c0bd 100644
--- a/src/blocks/blocks/button-group/group/edit.js
+++ b/src/blocks/blocks/button-group/group/edit.js
@@ -32,7 +32,7 @@ const { attributes: defaultAttributes } = metadata;
/**
* Button Group Props
* @param {import('./types').ButtonGroupProps} props
- * @returns
+ * @return
*/
const Edit = ({
attributes,
diff --git a/src/blocks/blocks/button-group/group/inspector.js b/src/blocks/blocks/button-group/group/inspector.js
index 222b37fc8..256a8e081 100644
--- a/src/blocks/blocks/button-group/group/inspector.js
+++ b/src/blocks/blocks/button-group/group/inspector.js
@@ -42,7 +42,7 @@ import { useTabSwitch } from '../../../helpers/block-utility';
/**
*
* @param {import('./types.js').ButtonGroupInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
diff --git a/src/blocks/blocks/circle-counter/edit.js b/src/blocks/blocks/circle-counter/edit.js
index 0d5279d7b..c2e263bb8 100644
--- a/src/blocks/blocks/circle-counter/edit.js
+++ b/src/blocks/blocks/circle-counter/edit.js
@@ -37,7 +37,7 @@ const { attributes: defaultAttributes } = metadata;
/**
*
* @param {import('./types').CircleCounterPros} param0
- * @returns
+ * @return
*/
const CircularProgressBarBlock = ({
clientId,
diff --git a/src/blocks/blocks/circle-counter/inspector.js b/src/blocks/blocks/circle-counter/inspector.js
index 3cdccbd11..b87631231 100644
--- a/src/blocks/blocks/circle-counter/inspector.js
+++ b/src/blocks/blocks/circle-counter/inspector.js
@@ -27,14 +27,14 @@ import { Fragment, useState } from '@wordpress/element';
/**
* Internal dependencies
-*/
+ */
import { InspectorHeader } from '../../components';
import { useTabSwitch } from '../../helpers/block-utility';
/**
*
* @param {import('./types').CircleCounterInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
diff --git a/src/blocks/blocks/content-generator/edit.js b/src/blocks/blocks/content-generator/edit.js
index aa6c0f2d7..d357d0552 100644
--- a/src/blocks/blocks/content-generator/edit.js
+++ b/src/blocks/blocks/content-generator/edit.js
@@ -134,7 +134,7 @@ const ContentGenerator = ({
* When destroying the block, the original inner blocks are also destroyed, thus we need to make a copy of them when transferring them to another block.
*
* @param {import('../../helpers/blocks.js').BlockProps
} block The block to copy.
- * @returns {import('../../helpers/blocks.js').BlockProps} The copied block.
+ * @return {import('../../helpers/blocks.js').BlockProps|void} The copied block.
*/
const makeBlockCopy = ( block ) => {
if ( undefined === block ) {
@@ -185,7 +185,7 @@ const ContentGenerator = ({
const PRESETS = {
form: {
title: __( 'AI Form generator', 'otter-blocks' ),
- placeholder: __( 'Start describing what form you need...', 'otter-blocks' ),
+ placeholder: __( 'Start describing what form you need…', 'otter-blocks' ),
actions: ( props ) => {
return (
@@ -209,7 +209,7 @@ const ContentGenerator = ({
},
textTransformation: {
title: __( 'AI Content generator', 'otter-blocks' ),
- placeholder: __( 'Start describing what content you need...', 'otter-blocks' ),
+ placeholder: __( 'Start describing what content you need…', 'otter-blocks' ),
actions: ( props ) => {
return (
diff --git a/src/blocks/blocks/content-generator/inspector.js b/src/blocks/blocks/content-generator/inspector.js
index 948f8f815..7a88f8c77 100644
--- a/src/blocks/blocks/content-generator/inspector.js
+++ b/src/blocks/blocks/content-generator/inspector.js
@@ -8,7 +8,7 @@ import {
/**
*
* @param {import('./types').ContentGeneratorInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
diff --git a/src/blocks/blocks/countdown/common.ts b/src/blocks/blocks/countdown/common.ts
index bd52d0d94..56a533d11 100644
--- a/src/blocks/blocks/countdown/common.ts
+++ b/src/blocks/blocks/countdown/common.ts
@@ -1,4 +1,4 @@
-import { CountdownTimer } from './types';
+import type { CountdownTimer } from './types.d.ts';
import { __ } from '@wordpress/i18n';
const _MS_PER_SECONDS = 1000;
@@ -10,7 +10,7 @@ const _MS_PER_DAY = _MS_PER_HOURS * 24;
* Get the time from a timer structure
*
* @param timer The timer data strcture.
- * @returns The time in miliseconds
+ * @return The time in miliseconds
*/
export const toTimer = ( timer: CountdownTimer = {}): number => {
return ( parseInt( timer?.days || '0' ) * _MS_PER_DAY + parseInt( timer?.hours || '0' ) * _MS_PER_HOURS + parseInt( timer?.minutes || '0' ) * _MS_PER_MINUTES + parseInt( timer?.seconds || '0' ) * _MS_PER_SECONDS ) ?? 0;
@@ -20,8 +20,8 @@ export const toTimer = ( timer: CountdownTimer = {}): number => {
* Get the time interval from two dates.
*
* @param start The start date.
- * @param end The end date.
- * @returns
+ * @param end The end date.
+ * @return
*/
export const fromInterval = ( start?: string, end?: string ): number => {
if ( ! start || ! end ) {
@@ -36,9 +36,11 @@ export const fromInterval = ( start?: string, end?: string ): number => {
/**
* Get the time interval from the unix time
*
- * @param unixTime Time as UNIX
- * @param settings Options to keep a components or/and allow negative time
- * @returns An object with the values for days, hours, minutes, seconds
+ * @param unixTime Time as UNIX
+ * @param settings Options to keep a components or/and allow negative time
+ * @param settings.exclude
+ * @param settings.keepNeg
+ * @return An object with the values for days, hours, minutes, seconds
*/
export const getIntervalFromUnix = ( unixTime: number, settings: { exclude?: string[], keepNeg?: boolean }) => {
unixTime ??= 0; // Check for null/undefined
diff --git a/src/blocks/blocks/countdown/edit.tsx b/src/blocks/blocks/countdown/edit.tsx
index 41bc082bf..accdf6976 100644
--- a/src/blocks/blocks/countdown/edit.tsx
+++ b/src/blocks/blocks/countdown/edit.tsx
@@ -43,7 +43,7 @@ import {
} from '../../helpers/helper-functions.js';
import DisplayTime from './components/display-time';
import { fromInterval, toTimer } from './common';
-import { CountdownProps } from './types';
+import type { CountdownProps } from './types.d.ts';
const { attributes: defaultAttributes } = metadata;
diff --git a/src/blocks/blocks/countdown/inspector.js b/src/blocks/blocks/countdown/inspector.js
index 35e1d25ac..63d89803c 100644
--- a/src/blocks/blocks/countdown/inspector.js
+++ b/src/blocks/blocks/countdown/inspector.js
@@ -143,7 +143,7 @@ const EndActionPanel = () => (
/**
*
* @param {import('./types.js').CountdownInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
@@ -193,7 +193,7 @@ const Inspector = ({
- { applyFilters( 'otter.countdown.controls.settings', , { attributes: attributes, setAttributes: setAttributes }) }
+ { applyFilters( 'otter.countdown.controls.settings', , { attributes, setAttributes }) }
{ attributes.mode === undefined && (
- { applyFilters( 'otter.countdown.controls.end', , { attributes: attributes, setAttributes: setAttributes }) }
+ { applyFilters( 'otter.countdown.controls.end', , { attributes, setAttributes }) }
diff --git a/src/blocks/blocks/countdown/save.tsx b/src/blocks/blocks/countdown/save.tsx
index 7f275f9b8..a10596c34 100644
--- a/src/blocks/blocks/countdown/save.tsx
+++ b/src/blocks/blocks/countdown/save.tsx
@@ -18,7 +18,7 @@ import {
} from '../../helpers/helper-functions.js';
import { getIntervalFromUnix, timerSerialization } from './common';
import { isEmpty } from 'lodash';
-import { CountdownProps } from './types.js';
+import type { CountdownProps } from './types.d.ts';
const DisplayTimeComponent = ({
name,
@@ -62,7 +62,7 @@ const DisplayTime = ({
) : (
-
+ <>>
);
};
diff --git a/src/blocks/blocks/flip/edit.tsx b/src/blocks/blocks/flip/edit.tsx
index 799cf1767..d56abfad1 100644
--- a/src/blocks/blocks/flip/edit.tsx
+++ b/src/blocks/blocks/flip/edit.tsx
@@ -36,7 +36,7 @@ import {
} from '../../helpers/block-utility.js';
import { boxToCSS, getChoice, mergeBoxDefaultValues, stringToBox, _px } from '../../helpers/helper-functions.js';
import { isNumber } from 'lodash';
-import { type FlipProps } from './types';
+import type { FlipProps } from './types.d.ts';
import {
useDarkBackground,
useResponsiveAttributes
@@ -47,7 +47,11 @@ const { attributes: defaultAttributes } = metadata;
/**
* Flip component
* @param props
- * @returns
+ * @param props.attributes
+ * @param props.setAttributes
+ * @param props.clientId
+ * @param props.isSelected
+ * @return
*/
const Edit = ({
attributes,
@@ -162,8 +166,7 @@ const Edit = ({
currentSide={ currentSide }
setSide={ setSide }
/>
-
- {/** @ts-ignore */}
+
) }
diff --git a/src/blocks/blocks/flip/inspector.js b/src/blocks/blocks/flip/inspector.js
index e9cc8e8d5..dbb35c029 100644
--- a/src/blocks/blocks/flip/inspector.js
+++ b/src/blocks/blocks/flip/inspector.js
@@ -95,7 +95,7 @@ const defaultFontSizes = [
/**
*
* @param {import('./types.js').FlipInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
diff --git a/src/blocks/blocks/font-awesome-icons/edit.js b/src/blocks/blocks/font-awesome-icons/edit.js
index 02e2d31b3..5fe413a5e 100644
--- a/src/blocks/blocks/font-awesome-icons/edit.js
+++ b/src/blocks/blocks/font-awesome-icons/edit.js
@@ -44,7 +44,7 @@ export const alignHandler = ( align ) => {
/**
* Icons Component
* @param {import('./types').IconsProps} props
- * @returns
+ * @return
*/
const Edit = ({
name,
diff --git a/src/blocks/blocks/font-awesome-icons/inspector.js b/src/blocks/blocks/font-awesome-icons/inspector.js
index b8b6bd06f..1627f4d9f 100644
--- a/src/blocks/blocks/font-awesome-icons/inspector.js
+++ b/src/blocks/blocks/font-awesome-icons/inspector.js
@@ -64,7 +64,7 @@ const defaultFontSizes = [
/**
*
* @param {import('./types.js').IconInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
diff --git a/src/blocks/blocks/form/common.tsx b/src/blocks/blocks/form/common.tsx
index d9c71b88c..73c61f01a 100644
--- a/src/blocks/blocks/form/common.tsx
+++ b/src/blocks/blocks/form/common.tsx
@@ -12,7 +12,7 @@ import { omit } from 'lodash';
import { createBlock } from '@wordpress/blocks';
import { dispatch } from '@wordpress/data';
-import { BlockProps } from '../../helpers/blocks';
+import type { BlockProps } from '../../helpers/blocks';
import { changeActiveStyle, getActiveStyle, getChoice } from '../../helpers/helper-functions';
import { Fragment } from '@wordpress/element';
import { SortableElement, SortableHandle } from 'react-sortable-hoc';
@@ -160,7 +160,7 @@ export const switchFormFieldTo = ( type?: string, clientId ?:string, attributes?
const newBlock = createBlock( `themeisle-blocks/${ blockName }`,
- omit({ ...attributes, type: type }, 'form-textarea' === blockName ? [ 'multipleSelection', 'options', 'type' ] : [ 'multipleSelection', 'options' ])
+ omit({ ...attributes, type }, 'form-textarea' === blockName ? [ 'multipleSelection', 'options', 'type' ] : [ 'multipleSelection', 'options' ])
);
replaceBlock( clientId, newBlock );
diff --git a/src/blocks/blocks/form/edit.js b/src/blocks/blocks/form/edit.js
index 8cf33231c..3a6ff7a42 100644
--- a/src/blocks/blocks/form/edit.js
+++ b/src/blocks/blocks/form/edit.js
@@ -10,7 +10,7 @@ import hash from 'object-hash';
/**
* WordPress dependencies
*/
-import { __ } from '@wordpress/i18n';
+import { __, sprintf } from '@wordpress/i18n';
import api from '@wordpress/api';
@@ -88,7 +88,7 @@ const formOptionsMap = {
/**
* Form component
* @param {import('./type').FormProps} props
- * @returns
+ * @return
*/
const Edit = ({
attributes,
@@ -118,7 +118,7 @@ const Edit = ({
/**
* Get global value if it is the case.
* @param {import('../../common').SyncAttrs
} field
- * @returns
+ * @return
*/
const getSyncValue = field => {
if ( attributes?.isSynced?.includes( field ) ) {
@@ -651,7 +651,11 @@ const Edit = ({
} else {
createNotice(
'error',
- __( 'An error has occurred: ', 'otter-blocks' ) + ( res?.error || __( 'unknown', 'otter-blocks' ) ),
+ sprintf(
+ // translators: %1$s the error message of the test email
+ __( 'An error has occurred: %1$s', 'otter-blocks' ),
+ res?.error || __( 'unknown', 'otter-blocks' )
+ ),
{
isDismissible: true,
type: 'snackbar'
@@ -700,7 +704,11 @@ const Edit = ({
} else {
createNotice(
'error',
- __( 'An error has occurred: ', 'otter-blocks' ) + ( res?.error || __( 'unknown', 'otter-blocks' ) + __( '. Check your provider for confirmation.', 'otter-blocks' ) ),
+ sprintf(
+ // translators: %s is the error message from the email provider.
+ __( 'An error has occurred: %s. Check your provider for confirmation.', 'otter-blocks' ),
+ res?.error || __( 'unknown', 'otter-blocks' )
+ ),
{
isDismissible: true,
type: 'snackbar'
diff --git a/src/blocks/blocks/form/file/index.js b/src/blocks/blocks/form/file/index.js
index 8807192f3..fb9452045 100644
--- a/src/blocks/blocks/form/file/index.js
+++ b/src/blocks/blocks/form/file/index.js
@@ -2,11 +2,7 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
-
-import { registerBlockType } from '@wordpress/blocks';
-
-import { createBlock } from '@wordpress/blocks';
-
+import { registerBlockType, createBlock } from '@wordpress/blocks';
import { omit } from 'lodash';
/**
diff --git a/src/blocks/blocks/form/file/inspector.js b/src/blocks/blocks/form/file/inspector.js
index ec3980e92..acd93bd25 100644
--- a/src/blocks/blocks/form/file/inspector.js
+++ b/src/blocks/blocks/form/file/inspector.js
@@ -103,7 +103,7 @@ const ProPreview = ({ attributes }) => {
{ ! Boolean( window.themeisleGutenberg.hasPro ) && (
{ __( 'Get more options with Otter Pro. ', 'otter-blocks' ) } }
+ notice={ { __( 'Get more options with Otter Pro.', 'otter-blocks' ) } }
variant="upsell"
/> ) }
@@ -113,7 +113,7 @@ const ProPreview = ({ attributes }) => {
/**
*
* @param {import('./types').FormFileInspectorProps} props
- * @returns {JSX.Element}
+ * @return {JSX.Element}
*/
const Inspector = ({
attributes,
diff --git a/src/blocks/blocks/form/hidden-field/inspector.js b/src/blocks/blocks/form/hidden-field/inspector.js
index 4c01493d1..3be46e681 100644
--- a/src/blocks/blocks/form/hidden-field/inspector.js
+++ b/src/blocks/blocks/form/hidden-field/inspector.js
@@ -30,7 +30,7 @@ import { fieldTypesOptions, mappedNameInfo, switchFormFieldTo } from '../common'
/**
*
* @param {import('./types').FormHiddenFieldInspectorPros} props
- * @returns {JSX.Element}
+ * @return {JSX.Element}
*/
const Inspector = ({
attributes,
@@ -92,7 +92,7 @@ const Inspector = ({
/>
{ __( 'Get more options with Otter Pro. ', 'otter-blocks' ) } }
+ notice={ { __( 'Get more options with Otter Pro.', 'otter-blocks' ) } }
variant="upsell"
/>
diff --git a/src/blocks/blocks/form/input/edit.js b/src/blocks/blocks/form/input/edit.js
index 945238aae..82d02cd4f 100644
--- a/src/blocks/blocks/form/input/edit.js
+++ b/src/blocks/blocks/form/input/edit.js
@@ -26,7 +26,7 @@ const { attributes: defaultAttributes } = metadata;
/**
* Form Input component
* @param {import('./types').FormInputProps} props
- * @returns
+ * @return
*/
const Edit = ({
attributes,
diff --git a/src/blocks/blocks/form/input/index.js b/src/blocks/blocks/form/input/index.js
index 830d35a3b..90c5043c9 100644
--- a/src/blocks/blocks/form/input/index.js
+++ b/src/blocks/blocks/form/input/index.js
@@ -2,11 +2,7 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
-
-import { registerBlockType } from '@wordpress/blocks';
-
-import { createBlock } from '@wordpress/blocks';
-
+import { registerBlockType, createBlock } from '@wordpress/blocks';
import { omit } from 'lodash';
/**
@@ -39,7 +35,7 @@ registerBlockType( name, {
{
name: 'themeisle-blocks/form-input-email',
description: __( 'Insert an email field', 'otter-blocks' ),
- icon: icon,
+ icon,
title: __( 'Email Field', 'otter-blocks' ),
attributes: {
type: 'email'
@@ -48,7 +44,7 @@ registerBlockType( name, {
{
name: 'themeisle-blocks/form-input-date',
description: __( 'Insert a date field', 'otter-blocks' ),
- icon: icon,
+ icon,
title: __( 'Date Field', 'otter-blocks' ),
attributes: {
type: 'date'
@@ -57,7 +53,7 @@ registerBlockType( name, {
{
name: 'themeisle-blocks/form-input-number',
description: __( 'Insert a number field', 'otter-blocks' ),
- icon: icon,
+ icon,
title: __( 'Number Field', 'otter-blocks' ),
attributes: {
type: 'number'
@@ -66,7 +62,7 @@ registerBlockType( name, {
{
name: 'themeisle-blocks/form-input-url',
description: __( 'Insert an URL field', 'otter-blocks' ),
- icon: icon,
+ icon,
title: __( 'URL Field', 'otter-blocks' ),
attributes: {
type: 'url',
diff --git a/src/blocks/blocks/form/input/inspector.js b/src/blocks/blocks/form/input/inspector.js
index c77ea273d..e03dae1c2 100644
--- a/src/blocks/blocks/form/input/inspector.js
+++ b/src/blocks/blocks/form/input/inspector.js
@@ -28,7 +28,7 @@ import { HTMLAnchorControl } from '../../../components';
/**
*
* @param {import('./types').FormInputProps} props
- * @returns {JSX.Element}
+ * @return {JSX.Element}
*/
const Inspector = ({
attributes,
diff --git a/src/blocks/blocks/form/inspector.js b/src/blocks/blocks/form/inspector.js
index fb68a7bfa..0f1af355a 100644
--- a/src/blocks/blocks/form/inspector.js
+++ b/src/blocks/blocks/form/inspector.js
@@ -340,7 +340,7 @@ const FormOptions = ({ formOptions, setFormOption, attributes, setAttributes })
/**
*
* @param {import('./type.js').FormInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
@@ -454,7 +454,7 @@ const Inspector = ({
{ 'loading' === loadingState?.formOptions && (
- { __( 'Loading the options. Please wait...', 'otter-blocks' ) }
+ { __( 'Loading the options. Please wait…', 'otter-blocks' ) }
) }
diff --git a/src/blocks/blocks/form/multiple-choice/edit.js b/src/blocks/blocks/form/multiple-choice/edit.js
index e7827fbcc..3160178d0 100644
--- a/src/blocks/blocks/form/multiple-choice/edit.js
+++ b/src/blocks/blocks/form/multiple-choice/edit.js
@@ -36,7 +36,7 @@ const Field = ({ fieldType, label, position, attributes, checked, onChange }) =>
-
+
{
/**
* Form Input component
* @param {import('./types').FormMultipleChoiceInputProps} props
- * @returns
+ * @return
*/
const Edit = ({
attributes,
diff --git a/src/blocks/blocks/form/multiple-choice/index.js b/src/blocks/blocks/form/multiple-choice/index.js
index 4144d62aa..cd39d3afc 100644
--- a/src/blocks/blocks/form/multiple-choice/index.js
+++ b/src/blocks/blocks/form/multiple-choice/index.js
@@ -2,11 +2,7 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
-
-import { registerBlockType } from '@wordpress/blocks';
-
-import { createBlock } from '@wordpress/blocks';
-
+import { registerBlockType, createBlock } from '@wordpress/blocks';
import { omit } from 'lodash';
/**
@@ -31,7 +27,7 @@ registerBlockType( name, {
{
name: 'themeisle-blocks/form-input-checkbox',
description: __( 'Insert a checkbox list field', 'otter-blocks' ),
- icon: icon,
+ icon,
title: __( 'Checkbox Field', 'otter-blocks' ),
attributes: {
type: 'checkbox'
@@ -40,7 +36,7 @@ registerBlockType( name, {
{
name: 'themeisle-blocks/form-input-radio',
description: __( 'Insert a radio list field', 'otter-blocks' ),
- icon: icon,
+ icon,
title: __( 'Radio Field', 'otter-blocks' ),
attributes: {
type: 'radio'
@@ -49,7 +45,7 @@ registerBlockType( name, {
{
name: 'themeisle-blocks/form-input-select',
description: __( 'Insert a select field', 'otter-blocks' ),
- icon: icon,
+ icon,
title: __( 'Select Field', 'otter-blocks' ),
attributes: {
type: 'select'
diff --git a/src/blocks/blocks/form/multiple-choice/inspector.js b/src/blocks/blocks/form/multiple-choice/inspector.js
index c210f7205..9a0683ec4 100644
--- a/src/blocks/blocks/form/multiple-choice/inspector.js
+++ b/src/blocks/blocks/form/multiple-choice/inspector.js
@@ -46,7 +46,7 @@ const styles = [
/**
*
* @param {import('./types').FormMultipleChoiceInputInspectorProps} props
- * @returns {JSX.Element}
+ * @return {JSX.Element}
*/
const Inspector = ({
attributes,
@@ -75,7 +75,7 @@ const Inspector = ({
tab={tab}
setAsDefault={() => {
const updatedOptions = options.map( ( item, i ) => {
- let updatedItem = { ...item };
+ const updatedItem = { ...item };
if (
( 'select' === attributes.type || 'radio' === attributes.type ) &&
i !== index
diff --git a/src/blocks/blocks/form/nonce/edit.js b/src/blocks/blocks/form/nonce/edit.js
index a0f0da8dc..21fd9f05c 100644
--- a/src/blocks/blocks/form/nonce/edit.js
+++ b/src/blocks/blocks/form/nonce/edit.js
@@ -8,7 +8,7 @@ import { useEffect } from '@wordpress/element';
/**
* Form Nonce component
* @param {import('./types').FormNonceProps} props
- * @returns
+ * @return
*/
const Edit = ({
setAttributes,
diff --git a/src/blocks/blocks/form/sortable-input-fields.tsx b/src/blocks/blocks/form/sortable-input-fields.tsx
index d3e1b6339..9da6f2ae6 100644
--- a/src/blocks/blocks/form/sortable-input-fields.tsx
+++ b/src/blocks/blocks/form/sortable-input-fields.tsx
@@ -12,7 +12,7 @@ import {
import { __ } from '@wordpress/i18n';
import { Button } from '@wordpress/components';
-import { type FormInputProps } from './input/types';
+import type { FormInputProps } from './input/types.d.ts';
const DragHandle = SortableHandle( () => {
return (
diff --git a/src/blocks/blocks/form/stripe-field/inspector.js b/src/blocks/blocks/form/stripe-field/inspector.js
index 182f245fd..4796e7416 100644
--- a/src/blocks/blocks/form/stripe-field/inspector.js
+++ b/src/blocks/blocks/form/stripe-field/inspector.js
@@ -29,8 +29,8 @@ import { fieldTypesOptions, switchFormFieldTo } from '../common';
/**
*
- * @param {FormStripeFieldInspectorPros} props
- * @returns {JSX.Element}
+ * @param {import('../../../../pro/blocks/form-stripe-field/types').FormStripeFieldInspectorPros} props
+ * @return {JSX.Element}
*/
const Inspector = ({
attributes,
@@ -67,7 +67,7 @@ const Inspector = ({
/>
{ __( 'Get more options with Otter Pro. ', 'otter-blocks' ) } }
+ notice={ { __( 'Get more options with Otter Pro.', 'otter-blocks' ) } }
variant="upsell"
/>
diff --git a/src/blocks/blocks/form/textarea/edit.js b/src/blocks/blocks/form/textarea/edit.js
index 58539f7db..7c6532bdb 100644
--- a/src/blocks/blocks/form/textarea/edit.js
+++ b/src/blocks/blocks/form/textarea/edit.js
@@ -26,7 +26,7 @@ const { attributes: defaultAttributes } = metadata;
/**
* Form Textarea component
* @param {import('./types').FormTextareaProps} props
- * @returns
+ * @return
*/
const Edit = ({
attributes,
diff --git a/src/blocks/blocks/form/textarea/index.js b/src/blocks/blocks/form/textarea/index.js
index f58e3b748..92edd488f 100644
--- a/src/blocks/blocks/form/textarea/index.js
+++ b/src/blocks/blocks/form/textarea/index.js
@@ -2,11 +2,7 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
-
-import { registerBlockType } from '@wordpress/blocks';
-
-import { createBlock } from '@wordpress/blocks';
-
+import { registerBlockType, createBlock } from '@wordpress/blocks';
import { omit } from 'lodash';
/**
diff --git a/src/blocks/blocks/form/textarea/inspector.js b/src/blocks/blocks/form/textarea/inspector.js
index 4c5a02a46..9914ecf35 100644
--- a/src/blocks/blocks/form/textarea/inspector.js
+++ b/src/blocks/blocks/form/textarea/inspector.js
@@ -24,7 +24,7 @@ import { HTMLAnchorControl } from '../../../components';
/**
*
* @param {import('./types').FormTextareaProps} props
- * @returns {JSX.Element}
+ * @return {JSX.Element}
*/
const Inspector = ({
attributes,
diff --git a/src/blocks/blocks/google-map/edit.js b/src/blocks/blocks/google-map/edit.js
index 4c9018e36..2df91edbf 100644
--- a/src/blocks/blocks/google-map/edit.js
+++ b/src/blocks/blocks/google-map/edit.js
@@ -38,7 +38,7 @@ const { attributes: defaultAttributes } = metadata;
/**
* Google Map component
* @param {import('./type').GoogleMapProps} props
- * @returns
+ * @return
*/
const Edit = ({
attributes,
diff --git a/src/blocks/blocks/google-map/inspector.js b/src/blocks/blocks/google-map/inspector.js
index 053c0ea9b..b640fc665 100644
--- a/src/blocks/blocks/google-map/inspector.js
+++ b/src/blocks/blocks/google-map/inspector.js
@@ -47,7 +47,7 @@ const mightBeUnit = value => isNumber( value ) ? px( value ) : value;
/**
*
* @param {import('./type.js').GoogleMapInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
diff --git a/src/blocks/blocks/icon-list/edit.js b/src/blocks/blocks/icon-list/edit.js
index 8b313b329..87fa7ea22 100644
--- a/src/blocks/blocks/icon-list/edit.js
+++ b/src/blocks/blocks/icon-list/edit.js
@@ -28,7 +28,7 @@ const { attributes: defaultAttributes } = metadata;
/**
* Icon List component
* @param {import('./types').IconListProps} props
- * @returns
+ * @return
*/
const Edit = ({
attributes,
diff --git a/src/blocks/blocks/icon-list/inspector.js b/src/blocks/blocks/icon-list/inspector.js
index 10e20e24c..7fd7de992 100644
--- a/src/blocks/blocks/icon-list/inspector.js
+++ b/src/blocks/blocks/icon-list/inspector.js
@@ -45,7 +45,7 @@ import { useTabSwitch } from '../../helpers/block-utility';
/**
*
* @param {import('./types.js').IconsListInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
diff --git a/src/blocks/blocks/icon-list/item/edit.js b/src/blocks/blocks/icon-list/item/edit.js
index 43564a7a3..4e5f38c45 100644
--- a/src/blocks/blocks/icon-list/item/edit.js
+++ b/src/blocks/blocks/icon-list/item/edit.js
@@ -6,7 +6,7 @@ import classnames from 'classnames';
/**
* WordPress dependencies
*/
-import { __ } from '@wordpress/i18n';
+import { __, sprintf } from '@wordpress/i18n';
import {
RichText,
@@ -36,7 +36,7 @@ const { attributes: defaultAttributes } = metadata;
/**
* Icon List Item component
* @param {import('./types').IconListItemProps} props
- * @returns
+ * @return
*/
const Edit = ({
attributes,
@@ -100,7 +100,8 @@ const Edit = ({
const parentClientId = select( 'core/block-editor' ).getBlockParents( clientId ).at( -1 );
const parentBlock = select( 'core/block-editor' ).getBlock( parentClientId );
- setAttributes({ content: __( 'List item ', 'otter-blocks' ) + parentBlock.innerBlocks.length });
+ // translators: %d: the number of List item blocks.
+ setAttributes({ content: sprintf( __( 'List item %d', 'otter-blocks' ), parentBlock.innerBlocks.length ) });
}
}, []);
@@ -126,6 +127,7 @@ const Edit = ({
{ 'image' === attributes.library && isURL ? (
+ /* eslint-disable-next-line jsx-a11y/alt-text */
) : (
'themeisle-icons' === attributes.library && attributes.icon && Icon !== undefined ? (
diff --git a/src/blocks/blocks/icon-list/item/inspector.js b/src/blocks/blocks/icon-list/item/inspector.js
index 03aa5e215..237a2b6e5 100644
--- a/src/blocks/blocks/icon-list/item/inspector.js
+++ b/src/blocks/blocks/icon-list/item/inspector.js
@@ -19,7 +19,7 @@ import { IconPickerControl } from '../../../components/index.js';
/**
*
* @param {import('./types.js').IconsListItemInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
diff --git a/src/blocks/blocks/leaflet-map/edit.js b/src/blocks/blocks/leaflet-map/edit.js
index c2a648ae1..208e54e67 100644
--- a/src/blocks/blocks/leaflet-map/edit.js
+++ b/src/blocks/blocks/leaflet-map/edit.js
@@ -11,7 +11,7 @@ import {
merge
} from 'lodash';
-import { __ } from '@wordpress/i18n';
+import { __, sprintf } from '@wordpress/i18n';
import { useBlockProps } from '@wordpress/block-editor';
@@ -53,7 +53,7 @@ export const ActionType = {
/**
* Leaflet Map component
* @param {import('./type').LeafletMapProps} props
- * @returns
+ * @return
*/
const Edit = ({
clientId,
@@ -157,7 +157,8 @@ const Edit = ({
});
default:
- console.warn( __( 'The action for the leaflet block do not have a defined action in marker\'s reducer: ', 'otter-blocks' ) + action.type );
+ // translators: %s is the action type that is not defined in the marker's reducer
+ console.warn( sprintf( __( 'The action for the leaflet block do not have a defined action in marker\'s reducer: %s', 'otter-blocks' ), action.type ) );
}
return oldState;
diff --git a/src/blocks/blocks/leaflet-map/inspector.js b/src/blocks/blocks/leaflet-map/inspector.js
index 0163c180b..b096a4117 100644
--- a/src/blocks/blocks/leaflet-map/inspector.js
+++ b/src/blocks/blocks/leaflet-map/inspector.js
@@ -37,7 +37,7 @@ import { _px } from '../../helpers/helper-functions.js';
/**
*
* @param {import('./type').LeafletMapInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
diff --git a/src/blocks/blocks/leaflet-map/utility.js b/src/blocks/blocks/leaflet-map/utility.js
index f29178081..329a0d46a 100644
--- a/src/blocks/blocks/leaflet-map/utility.js
+++ b/src/blocks/blocks/leaflet-map/utility.js
@@ -18,8 +18,14 @@ async function makeSearchRequest( location ) {
if ( response.ok && 200 === response.status ) {
return response.json();
}
-
- return console.warn( __( 'An error has occured: ', 'otter-blocks' ) + response.status );
+
+ return console.warn(
+ sprintf(
+ // translators: %s: HTTP status code
+ __( 'An error has occurred: %s', 'otter-blocks' ),
+ response.status
+ )
+ );
}
export async function getLocation( location ) {
diff --git a/src/blocks/blocks/lottie/components/lottie-player.js b/src/blocks/blocks/lottie/components/lottie-player.js
index 4ccb0c550..241d005bf 100644
--- a/src/blocks/blocks/lottie/components/lottie-player.js
+++ b/src/blocks/blocks/lottie/components/lottie-player.js
@@ -27,10 +27,8 @@ const LottiePlayer = ({
playerRef.current.addEventListener( 'complete', initLoop );
}
});
- } else {
- if ( ! isEmpty( attributes.file ) && attributes.loop && null !== playerRef.current ) {
- playerRef.current.addEventListener( 'complete', initLoop );
- }
+ } else if ( ! isEmpty( attributes.file ) && attributes.loop && null !== playerRef.current ) {
+ playerRef.current.addEventListener( 'complete', initLoop );
}
}, []);
diff --git a/src/blocks/blocks/lottie/edit.js b/src/blocks/blocks/lottie/edit.js
index ddfd5fc10..34db27320 100644
--- a/src/blocks/blocks/lottie/edit.js
+++ b/src/blocks/blocks/lottie/edit.js
@@ -30,7 +30,7 @@ const { attributes: defaultAttributes } = metadata;
/**
* Lottie component
* @param {import('./types').LottieProps} props
- * @returns
+ * @return
*/
const Edit = ({
attributes,
diff --git a/src/blocks/blocks/lottie/inspector.js b/src/blocks/blocks/lottie/inspector.js
index fcb72a348..af898cdb4 100644
--- a/src/blocks/blocks/lottie/inspector.js
+++ b/src/blocks/blocks/lottie/inspector.js
@@ -24,7 +24,7 @@ import { _px } from '../../helpers/helper-functions';
/**
*
* @param {import('./types').LottieInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
diff --git a/src/blocks/blocks/modal/index.js b/src/blocks/blocks/modal/index.js
index 3bda39c3f..03a9a633f 100644
--- a/src/blocks/blocks/modal/index.js
+++ b/src/blocks/blocks/modal/index.js
@@ -30,6 +30,7 @@ if ( ! Boolean( window.themeisleGutenberg.hasPro ) ) {
],
edit: () => {
const instructions = sprintf(
+ // translators: %1$s is the title of the block that requires Otter Pro activation.
__( 'You need to activate your Otter Pro to use %1$s block.', 'otter-blocks' ),
metadata.title
);
diff --git a/src/blocks/blocks/popup/edit.js b/src/blocks/blocks/popup/edit.js
index 3e5852a90..1a91ffef5 100644
--- a/src/blocks/blocks/popup/edit.js
+++ b/src/blocks/blocks/popup/edit.js
@@ -5,12 +5,8 @@ import {
closeSmall,
external
} from '@wordpress/icons';
-
import classnames from 'classnames';
-
-import { get } from 'lodash';
-
-import { merge } from 'lodash';
+import { get, merge } from 'lodash';
/**
* WordPress dependencies
@@ -51,7 +47,7 @@ const { attributes: defaultAttributes } = metadata;
/**
* Popup component
* @param {import('./types').PopupPros} props
- * @returns
+ * @return
*/
const Edit = ({
attributes,
diff --git a/src/blocks/blocks/popup/inspector.js b/src/blocks/blocks/popup/inspector.js
index 4afeb0fec..35b05145d 100644
--- a/src/blocks/blocks/popup/inspector.js
+++ b/src/blocks/blocks/popup/inspector.js
@@ -39,11 +39,6 @@ import { removeBoxDefaultValues, setUtm } from '../../helpers/helper-functions.j
import { useResponsiveAttributes } from '../../helpers/utility-hooks.js';
import { useTabSwitch } from '../../helpers/block-utility';
-/**
- *
- * @param {import('./types').PopupInspectorProps} props
- * @returns
- */
const ProFeatures = () => {
return (
@@ -64,7 +59,7 @@ const ProFeatures = () => {
{ __( 'Get more options with Otter Pro. ', 'otter-blocks' ) } }
+ notice={ { __( 'Get more options with Otter Pro.', 'otter-blocks' ) } }
variant="upsell"
/>
@@ -74,7 +69,7 @@ const ProFeatures = () => {
/**
*
* @param {import('./types').PopupInspectorProps} param0
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
@@ -113,7 +108,7 @@ const Inspector = ({
const changeBoxShadow = data => {
const boxShadow = { ...attributes.boxShadow };
- Object.entries( data ).map( ([ key, val ] = data ) => {
+ Object.entries( data ).forEach( ([ key, val ] = data ) => {
boxShadow[key] = val;
});
diff --git a/src/blocks/blocks/popup/save.js b/src/blocks/blocks/popup/save.js
index f3c87605e..182622afe 100644
--- a/src/blocks/blocks/popup/save.js
+++ b/src/blocks/blocks/popup/save.js
@@ -36,7 +36,7 @@ const Save = ({
{ attributes.showClose && (
) }
diff --git a/src/blocks/blocks/posts/components/design-layout-builder.js b/src/blocks/blocks/posts/components/design-layout-builder.js
index 594b71647..c9ecb26ed 100644
--- a/src/blocks/blocks/posts/components/design-layout-builder.js
+++ b/src/blocks/blocks/posts/components/design-layout-builder.js
@@ -44,7 +44,7 @@ const ProFeatures = () => {
{ __( 'Get more options with Otter Pro. ', 'otter-blocks' ) } }
+ notice={ { __( 'Get more options with Otter Pro.', 'otter-blocks' ) } }
variant="upsell"
/>
diff --git a/src/blocks/blocks/posts/components/layout/index.js b/src/blocks/blocks/posts/components/layout/index.js
index 9553f7182..08b024efc 100644
--- a/src/blocks/blocks/posts/components/layout/index.js
+++ b/src/blocks/blocks/posts/components/layout/index.js
@@ -175,8 +175,8 @@ export const PostsMeta = ({ attributes, element, post, author, categories }) =>
if ( attributes.displayAuthor && undefined !== author ) {
- /* translators: %s Author of the post */
- postedOn += sprintf( __( ' by %s', 'otter-blocks' ), author.name );
+ /* translators: %1$s is the date, %2$s is the author of the post */
+ postedOn = sprintf( __( '%1$s by %2$s', 'otter-blocks' ), postedOn, author.name ).trim();
}
meta.push( postedOn );
diff --git a/src/blocks/blocks/posts/components/sortable.js b/src/blocks/blocks/posts/components/sortable.js
index fdb8ef08a..84227bff2 100644
--- a/src/blocks/blocks/posts/components/sortable.js
+++ b/src/blocks/blocks/posts/components/sortable.js
@@ -92,8 +92,11 @@ export const SortableItem = ({
const canEdit = templateLookUp[ template ] || customMeta?.display;
const icon = canEdit ? 'visibility' : 'hidden';
- /* translators: %s Label */
- let message = sprintf( __( 'Display %s', 'otter-blocks' ), label );
+ let message = sprintf(
+ /* translators: %s Label */
+ __( 'Display %s', 'otter-blocks' ),
+ label
+ );
if ( canEdit ) {
/* translators: %s Label */
@@ -111,7 +114,7 @@ export const SortableItem = ({
className={ classnames(
'o-sortable-item',
{
- 'disabled': disabled,
+ disabled,
'hidden': ! canEdit,
'editable': canEdit
}
diff --git a/src/blocks/blocks/posts/edit.js b/src/blocks/blocks/posts/edit.js
index 65054a8c8..868c8b2b6 100644
--- a/src/blocks/blocks/posts/edit.js
+++ b/src/blocks/blocks/posts/edit.js
@@ -1,18 +1,18 @@
/**
* External dependencies
*/
-import { debounce } from 'lodash';
+import {
+ isObject,
+ isUndefined,
+ pickBy,
+ debounce
+} from 'lodash';
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
-import {
- isObject,
- isUndefined,
- pickBy
-} from 'lodash';
import {
Disabled,
@@ -66,7 +66,7 @@ const { attributes: defaultAttributes } = metadata;
/**
* Posts component
* @param {import('./types').PostProps} param0
- * @returns
+ * @return
*/
const Edit = ({
attributes,
@@ -205,7 +205,7 @@ const Edit = ({
return {
posts,
- categoriesList: categoriesList,
+ categoriesList,
authors: select( 'core' ).getUsers({ who: 'authors', context: 'view' }),
isLoading
};
diff --git a/src/blocks/blocks/posts/inspector.js b/src/blocks/blocks/posts/inspector.js
index a4613877e..8fe565680 100644
--- a/src/blocks/blocks/posts/inspector.js
+++ b/src/blocks/blocks/posts/inspector.js
@@ -84,7 +84,7 @@ const defaultFontSizes = [
/**
*
* @param {import('./types.js').PostInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
@@ -146,6 +146,8 @@ const Inspector = ({
slug: category?.slug ?? ''
};
}
+
+ return undefined;
}).filter( e => undefined !== e );
}
} else if ( '' !== value ) {
@@ -166,7 +168,7 @@ const Inspector = ({
const changeBoxShadow = ( type, data ) => {
const boxShadow = { ...attributes[ type ] };
- Object.entries( data ).map( ([ key, val ] = data ) => {
+ Object.entries( data ).forEach( ([ key, val ] = data ) => {
boxShadow[key] = val;
});
diff --git a/src/blocks/blocks/progress-bar/inspector.js b/src/blocks/blocks/progress-bar/inspector.js
index 4f97894f7..b3e02cee4 100644
--- a/src/blocks/blocks/progress-bar/inspector.js
+++ b/src/blocks/blocks/progress-bar/inspector.js
@@ -26,7 +26,7 @@ import { Fragment, useState } from '@wordpress/element';
/**
* Internal dependencies
-*/
+ */
import { InspectorHeader } from '../../components';
import { useTabSwitch } from '../../helpers/block-utility';
@@ -57,7 +57,7 @@ const defaultFontSizes = [
/**
*
* @param {import('./types').ProgressBarInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
diff --git a/src/blocks/blocks/review/edit.js b/src/blocks/blocks/review/edit.js
index 295a4edaa..c0cdca204 100644
--- a/src/blocks/blocks/review/edit.js
+++ b/src/blocks/blocks/review/edit.js
@@ -77,7 +77,7 @@ const Stars = ({ rating }) => {
/**
* Review component
* @param {import('./type').ReviewProps} props
- * @returns
+ * @return
*/
const Edit = ({
name,
@@ -94,7 +94,7 @@ const Edit = ({
}, [ attributes.id ]);
const { image } = useSelect( select => {
- let image = undefined;
+ let image;
const size = attributes.imageSize || 'medium';
if ( attributes.image?.id || productAttributes.image?.id ) {
@@ -278,7 +278,15 @@ const Edit = ({
- { /** translators: %s Rating score. */ sprintf( __( '%f out of %f', 'otter-blocks' ), Math.max( Math.abs( overallRatings / divide ).toFixed( 1 ) || 0, 1 ), 10 / divide ) }
+ {
+ sprintf(
+
+ /** translators: %1$f: Rating score, %2$f: Maximum possible score. */
+ __( '%1$f out of %2$f', 'otter-blocks' ),
+ Math.max( Math.abs( overallRatings / divide ).toFixed( 1 ) || 0, 1 ),
+ 10 / divide
+ )
+ }
@@ -349,13 +357,20 @@ const Edit = ({
- { /** translators: %s Rating score. */ sprintf( __( '%f out of %f', 'otter-blocks' ), Math.max( Math.abs( feature.rating / divide ).toFixed( 1 ) || 0, 1 ), 10 / divide ) }
+ {
+ sprintf(
+ /** translators: %1$f: Rating score, %2$f: Maximum possible score. */
+ __( '%1$f out of %2$f', 'otter-blocks' ),
+ Math.max( Math.abs( feature.rating / divide ).toFixed( 1 ) || 0, 1 ),
+ 10 / divide
+ )
+ }
{ ( isSelected || feature.description ) && (
changeFeature( index, { description }) }
diff --git a/src/blocks/blocks/review/inspector.js b/src/blocks/blocks/review/inspector.js
index c91a00753..cf4626669 100644
--- a/src/blocks/blocks/review/inspector.js
+++ b/src/blocks/blocks/review/inspector.js
@@ -174,7 +174,7 @@ const PanelItem = ({
/**
*
* @param {import('./type.js').ReviewInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
@@ -274,7 +274,7 @@ const Inspector = ({
const changeBoxShadow = data => {
const boxShadow = { ...attributes.boxShadow };
- Object.entries( data ).map( ([ key, val ] = data ) => {
+ Object.entries( data ).forEach( ([ key, val ] = data ) => {
boxShadow[key] = val;
});
@@ -841,7 +841,7 @@ const Inspector = ({
initialOpen={ false }
>
{ __( 'Get more options with Otter Pro. ', 'otter-blocks' ) } }
+ notice={ { __( 'Get more options with Otter Pro.', 'otter-blocks' ) } }
variant="upsell"
/>
diff --git a/src/blocks/blocks/section/column/edit.js b/src/blocks/blocks/section/column/edit.js
index bd207c408..e3872ee7c 100644
--- a/src/blocks/blocks/section/column/edit.js
+++ b/src/blocks/blocks/section/column/edit.js
@@ -45,7 +45,7 @@ const { attributes: defaultAttributes } = metadata;
/**
* Section Column component
* @param {import('./types').SectionColumnProps} props
- * @returns
+ * @return
*/
const Edit = ({
name,
diff --git a/src/blocks/blocks/section/column/inspector.js b/src/blocks/blocks/section/column/inspector.js
index 54df15f82..2c243f5e9 100644
--- a/src/blocks/blocks/section/column/inspector.js
+++ b/src/blocks/blocks/section/column/inspector.js
@@ -55,7 +55,7 @@ import { useTabSwitch } from '../../../helpers/block-utility';
/**
*
* @param {import('./types.js').SectionColumnInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
diff --git a/src/blocks/blocks/section/columns/deprecated.js b/src/blocks/blocks/section/columns/deprecated.js
index 8a9ab3215..b9bfb62e0 100644
--- a/src/blocks/blocks/section/columns/deprecated.js
+++ b/src/blocks/blocks/section/columns/deprecated.js
@@ -1870,7 +1870,11 @@ const deprecated = [{
'borderRadiusLeft'
];
- const isEligible = oldAttributes.some( attr => ! isUndefined( attributes[ attr ]) && ( 'number' === typeof attributes[ attr ] || null === typeof attributes[ attr ]) ) || ( undefined !== attributes.backgroundImageURL && undefined !== attributes.backgroundImageID ) || ( undefined !== attributes.backgroundOverlayImageURL && undefined !== attributes.backgroundOverlayImageID ) || ( undefined !== attributes.backgroundPosition && 'object' !== typeof attributes.backgroundPosition ) || ( undefined !== attributes.backgroundOverlayPosition && 'object' !== typeof attributes.backgroundOverlayPosition ) || undefined !== attributes.columnsGap;
+ const isEligible = oldAttributes.some( attr => ! isUndefined( attributes[ attr ]) && ( 'number' === typeof attributes[ attr ] || null === attributes[ attr ]) ) ||
+ ( undefined !== attributes.backgroundImageURL && undefined !== attributes.backgroundImageID ) ||
+ ( undefined !== attributes.backgroundOverlayImageURL && undefined !== attributes.backgroundOverlayImageID ) || ( undefined !== attributes.backgroundPosition && 'object' !== typeof attributes.backgroundPosition ) ||
+ ( undefined !== attributes.backgroundOverlayPosition && 'object' !== typeof attributes.backgroundOverlayPosition )
+ || undefined !== attributes.columnsGap;
return isEligible;
},
diff --git a/src/blocks/blocks/section/columns/edit.js b/src/blocks/blocks/section/columns/edit.js
index 813cfa52a..8c2aaeb2d 100644
--- a/src/blocks/blocks/section/columns/edit.js
+++ b/src/blocks/blocks/section/columns/edit.js
@@ -61,7 +61,7 @@ const { attributes: defaultAttributes } = metadata;
/**
*
* @param {import('./types').SectionProps} props
- * @returns
+ * @return
*/
const Edit = ({
attributes,
@@ -131,7 +131,7 @@ const Edit = ({
};
const updateColumnsWidth = ( columns, layout ) => {
- ( sectionBlock.innerBlocks ).map( ( innerBlock, i ) => {
+ ( sectionBlock.innerBlocks ).forEach( ( innerBlock, i ) => {
updateBlockAttributes( innerBlock.clientId, {
columnWidth: layouts[columns][layout][i]
});
diff --git a/src/blocks/blocks/section/columns/inspector.js b/src/blocks/blocks/section/columns/inspector.js
index 7984478dc..49fec1d8a 100644
--- a/src/blocks/blocks/section/columns/inspector.js
+++ b/src/blocks/blocks/section/columns/inspector.js
@@ -64,7 +64,7 @@ import { useTabSwitch } from '../../../helpers/block-utility';
/**
*
* @param {import('../column/types.js').SectionColumnInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
@@ -303,9 +303,9 @@ const Inspector = ({
};
const getDividerType = () => {
- if ( 'top' == dividerViewType ) {
+ if ( 'top' === dividerViewType ) {
return attributes.dividerTopType;
- } else if ( 'bottom' == dividerViewType ) {
+ } else if ( 'bottom' === dividerViewType ) {
return attributes.dividerBottomType;
}
@@ -315,17 +315,17 @@ const Inspector = ({
const dividerType = getDividerType();
const changeDividerType = value => {
- if ( 'top' == dividerViewType ) {
+ if ( 'top' === dividerViewType ) {
setAttributes({ dividerTopType: value });
- } else if ( 'bottom' == dividerViewType ) {
+ } else if ( 'bottom' === dividerViewType ) {
setAttributes({ dividerBottomType: value });
}
};
const getDividerColor = () => {
- if ( 'top' == dividerViewType ) {
+ if ( 'top' === dividerViewType ) {
return attributes.dividerTopColor;
- } else if ( 'bottom' == dividerViewType ) {
+ } else if ( 'bottom' === dividerViewType ) {
return attributes.dividerBottomColor;
}
@@ -333,15 +333,15 @@ const Inspector = ({
};
const changeDividerColor = value => {
- if ( 'top' == dividerViewType ) {
+ if ( 'top' === dividerViewType ) {
setAttributes({ dividerTopColor: value });
- } else if ( 'bottom' == dividerViewType ) {
+ } else if ( 'bottom' === dividerViewType ) {
setAttributes({ dividerBottomColor: value });
}
};
const getDividerWidth = () => {
- if ( 'top' == dividerViewType ) {
+ if ( 'top' === dividerViewType ) {
switch ( getView ) {
case 'Desktop':
return attributes.dividerTopWidth ?? 100;
@@ -350,7 +350,7 @@ const Inspector = ({
case 'Mobile':
return attributes.dividerTopWidthMobile ?? attributes.dividerTopWidthTablet ?? attributes.dividerTopWidth ?? 100;
}
- } else if ( 'bottom' == dividerViewType ) {
+ } else if ( 'bottom' === dividerViewType ) {
switch ( getView ) {
case 'Desktop':
return attributes.dividerBottomWidth ?? 100;
@@ -365,7 +365,7 @@ const Inspector = ({
};
const changeDividerWidth = value => {
- if ( 'top' == dividerViewType ) {
+ if ( 'top' === dividerViewType ) {
switch ( getView ) {
case 'Desktop':
setAttributes({ dividerTopWidth: value });
@@ -377,7 +377,7 @@ const Inspector = ({
setAttributes({ dividerTopWidthMobile: value });
break;
}
- } else if ( 'bottom' == dividerViewType ) {
+ } else if ( 'bottom' === dividerViewType ) {
switch ( getView ) {
case 'Desktop':
setAttributes({ dividerBottomWidth: value });
@@ -393,7 +393,7 @@ const Inspector = ({
};
const getDividerHeight = () => {
- if ( 'top' == dividerViewType ) {
+ if ( 'top' === dividerViewType ) {
switch ( getView ) {
case 'Desktop':
return attributes.dividerTopHeight;
@@ -402,7 +402,7 @@ const Inspector = ({
case 'Mobile':
return attributes.dividerTopHeightMobile;
}
- } else if ( 'bottom' == dividerViewType ) {
+ } else if ( 'bottom' === dividerViewType ) {
switch ( getView ) {
case 'Desktop':
return attributes.dividerBottomHeight;
@@ -417,7 +417,7 @@ const Inspector = ({
};
const changeDividerHeight = value => {
- if ( 'top' == dividerViewType ) {
+ if ( 'top' === dividerViewType ) {
switch ( getView ) {
case 'Desktop':
setAttributes({ dividerTopHeight: value });
@@ -429,7 +429,7 @@ const Inspector = ({
setAttributes({ dividerTopHeightMobile: value });
break;
}
- } else if ( 'bottom' == dividerViewType ) {
+ } else if ( 'bottom' === dividerViewType ) {
switch ( getView ) {
case 'Desktop':
setAttributes({ dividerBottomHeight: value });
diff --git a/src/blocks/blocks/section/components/layout-control/index.js b/src/blocks/blocks/section/components/layout-control/index.js
index 70ce56d02..e06a444b7 100644
--- a/src/blocks/blocks/section/components/layout-control/index.js
+++ b/src/blocks/blocks/section/components/layout-control/index.js
@@ -103,7 +103,7 @@ const LayoutControl = ({
- { ( 'Mobile' == getView || 'Tablet' == getView ) && (
+ { ( 'Mobile' === getView || 'Tablet' === getView ) && (
- { ( 'Mobile' == getView || 'Tablet' == getView ) && (
+ { ( 'Mobile' === getView || 'Tablet' === getView ) && (
- { ( 'Mobile' == getView || 'Tablet' == getView ) && (
+ { ( 'Mobile' === getView || 'Tablet' === getView ) && (
- { ( 'Mobile' == getView || 'Tablet' == getView ) && (
+ { ( 'Mobile' === getView || 'Tablet' === getView ) && (
- { ( 'Mobile' == getView || 'Tablet' == getView ) && (
+ { ( 'Mobile' === getView || 'Tablet' === getView ) && (
- { attributes.images.map( image => {
- return (
-
-
-
-
- { ! RichText.isEmpty( image.caption ) && (
- {
+ return (
+ // eslint-disable-next-line react/jsx-key
+
+
+
- ) }
-
-
- );
- }) }
+
+ { ! RichText.isEmpty( image.caption ) && (
+
+ ) }
+
+
+ );
+ })
+ }
@@ -191,6 +194,7 @@ const deprecated = [{
{ attributes.images.map( image => {
return (
+ // eslint-disable-next-line react/jsx-key
max([ Math.round( ( imagesLength ?? 0 ) / 2 ), 1 ]);
/**
* Slider component
* @param {import('./types').SliderProps} props
- * @returns
+ * @return
*/
const Edit = ({
attributes,
diff --git a/src/blocks/blocks/slider/inspector.js b/src/blocks/blocks/slider/inspector.js
index 65409eee3..6e7d2d8b7 100644
--- a/src/blocks/blocks/slider/inspector.js
+++ b/src/blocks/blocks/slider/inspector.js
@@ -45,7 +45,7 @@ import { useTabSwitch } from '../../helpers/block-utility';
/**
*
* @param {import('./types.js').SliderInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
diff --git a/src/blocks/blocks/stripe-checkout/edit.tsx b/src/blocks/blocks/stripe-checkout/edit.tsx
index 5b3697831..ea1b6e89e 100644
--- a/src/blocks/blocks/stripe-checkout/edit.tsx
+++ b/src/blocks/blocks/stripe-checkout/edit.tsx
@@ -26,17 +26,16 @@ import {
useState
} from '@wordpress/element';
-import { useSelect } from '@wordpress/data';
+import { useSelect , dispatch } from '@wordpress/data';
import { store } from '@wordpress/icons';
/**
* Internal dependencies.
*/
-import { StripeCheckoutProps } from './types';
+import type { StripeCheckoutProps } from './types.d.ts';
import Inspector from './inspector';
import useSettings from '../../helpers/use-settings';
-import { dispatch } from '@wordpress/data';
type Product = {
id: string,
@@ -50,10 +49,12 @@ type Price = {
};
/**
- * Stripe Checkout component
- * @param props
- * @returns
- */
+ * Stripe Checkout component
+ * @param props
+ * @param props.attributes
+ * @param props.setAttributes
+ * @return
+ */
const Edit = ({
attributes,
setAttributes
@@ -139,8 +140,8 @@ const Edit = ({
const [ meta, setMeta ] = useState
({});
useEffect( () => {
- const product = products?.find( ( i: Product ) => attributes.product == i.id );
- const price = prices?.find( ( i: Price ) => attributes.price == i.id );
+ const product = products?.find( ( i: Product ) => attributes.product === i.id );
+ const price = prices?.find( ( i: Price ) => attributes.price === i.id );
let unitAmount;
@@ -188,7 +189,7 @@ const Edit = ({
( 'loading' === status || 'saving' === status ) && (
- { __( 'Checking the API Key...', 'otter-blocks' ) }
+ { __( 'Checking the API Key…', 'otter-blocks' ) }
)
diff --git a/src/blocks/blocks/stripe-checkout/index.js b/src/blocks/blocks/stripe-checkout/index.js
index 099f1ba6f..529d28cc5 100644
--- a/src/blocks/blocks/stripe-checkout/index.js
+++ b/src/blocks/blocks/stripe-checkout/index.js
@@ -13,8 +13,8 @@ import {
} from '@wordpress/components';
/**
- * Internal dependencies
- */
+ * Internal dependencies
+ */
import metadata from './block.json';
import { cartIcon as icon } from '../../helpers/icons.js';
import edit from './edit';
diff --git a/src/blocks/blocks/tabs/group/edit.js b/src/blocks/blocks/tabs/group/edit.js
index 1d19ee791..7e942713a 100644
--- a/src/blocks/blocks/tabs/group/edit.js
+++ b/src/blocks/blocks/tabs/group/edit.js
@@ -6,7 +6,7 @@ import classnames from 'classnames';
/**
* WordPress dependencies.
*/
-import { __ } from '@wordpress/i18n';
+import { __, sprintf } from '@wordpress/i18n';
import { createBlock } from '@wordpress/blocks';
@@ -37,7 +37,6 @@ import Inspector from './inspector.js';
import Controls from './controls.js';
import { blockInit, getDefaultValueByField } from '../../../helpers/block-utility.js';
import { boxToCSS, objectOrNumberAsBox, _px } from '../../../helpers/helper-functions';
-import classNames from 'classnames';
import BlockAppender from '../../../components/block-appender-button';
import { useDarkBackground } from '../../../helpers/utility-hooks.js';
@@ -56,7 +55,7 @@ const TabHeader = ({
className={ classnames(
'wp-block-themeisle-blocks-tabs__header_item',
{
- 'active': active
+ active
}
) }
onClick={ onClick }
@@ -95,7 +94,7 @@ const AddTabHeader = ({
/**
*
* @param {import('./types').TabsGroupProps} props
- * @returns
+ * @return
*/
const Edit = ({
attributes,
@@ -115,7 +114,7 @@ const Edit = ({
/**
* Get global value if it is the case.
* @param {import('../../../common').SyncAttrs} field
- * @returns
+ * @return
*/
const getSyncValue = field =>{
if ( attributes?.isSynced?.includes( field ) ) {
@@ -199,7 +198,11 @@ const Edit = ({
const addTab = () => {
const itemBlock = createBlock( 'themeisle-blocks/tabs-item', {
- title: __( 'Tab ', 'otter-blocks' ) + ( ( children?.length ?? 0 ) + 1 )
+ title: sprintf(
+ // Translators: %d is the tab number.
+ __( 'Tab %d', 'otter-blocks' ),
+ ( children?.length ?? 0 ) + 1
+ )
});
insertBlock( itemBlock, ( children?.length ) || 0, clientId, false );
};
@@ -227,7 +230,7 @@ const Edit = ({
const blockProps = useBlockProps({
id: attributes.id,
style: inlineStyles,
- className: classNames(
+ className: classnames(
attributes.className,
{ 'has-pos-left': 'left' === attributes.tabsPosition },
`is-align-${ attributes.titleAlignment }`
diff --git a/src/blocks/blocks/tabs/group/inspector.js b/src/blocks/blocks/tabs/group/inspector.js
index b3a594ebd..d1a24e4db 100644
--- a/src/blocks/blocks/tabs/group/inspector.js
+++ b/src/blocks/blocks/tabs/group/inspector.js
@@ -56,7 +56,7 @@ const styles = [
/**
*
* @param {import('./types.js').TabsGroupInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
diff --git a/src/blocks/blocks/timeline/group/edit.js b/src/blocks/blocks/timeline/group/edit.js
index 327a09791..ec50049a0 100644
--- a/src/blocks/blocks/timeline/group/edit.js
+++ b/src/blocks/blocks/timeline/group/edit.js
@@ -37,7 +37,7 @@ const { attributes: defaultAttributes } = metadata;
* Timeline parent component
*
* @param {import('../types').TimelineGroupProps} param
- * @returns
+ * @return
*/
const Edit = ({
attributes,
diff --git a/src/blocks/blocks/timeline/group/inspector.js b/src/blocks/blocks/timeline/group/inspector.js
index 531c260f1..92a770394 100644
--- a/src/blocks/blocks/timeline/group/inspector.js
+++ b/src/blocks/blocks/timeline/group/inspector.js
@@ -21,7 +21,7 @@ import {
/**
* Internal dependencies
-*/
+ */
import { useTabSwitch } from '../../../helpers/block-utility.js';
import { InspectorHeader } from '../../../components/index.js';
import { stringToBox } from '../../../helpers/helper-functions.js';
@@ -30,7 +30,7 @@ import { stringToBox } from '../../../helpers/helper-functions.js';
* Timeline parent inspector component.
*
* @param {import('../types').TimelineGroupInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
diff --git a/src/blocks/blocks/timeline/item/edit.js b/src/blocks/blocks/timeline/item/edit.js
index 7b7ebd2db..10aa562f5 100644
--- a/src/blocks/blocks/timeline/item/edit.js
+++ b/src/blocks/blocks/timeline/item/edit.js
@@ -26,7 +26,7 @@ const { attributes: defaultAttributes } = metadata;
* Timeline Item component.
*
* @param {import('../types').TimelineItemProps} param
- * @returns
+ * @return
*/
const Edit = ({
attributes,
diff --git a/src/blocks/blocks/timeline/item/inspector.js b/src/blocks/blocks/timeline/item/inspector.js
index 8345888ff..205dab75f 100644
--- a/src/blocks/blocks/timeline/item/inspector.js
+++ b/src/blocks/blocks/timeline/item/inspector.js
@@ -20,7 +20,7 @@ import {
/**
* Internal dependencies
-*/
+ */
import { useTabSwitch } from '../../../helpers/block-utility.js';
import { IconPickerControl, InspectorHeader } from '../../../components/index.js';
import { stringToBox } from '../../../helpers/helper-functions.js';
@@ -29,7 +29,7 @@ import { stringToBox } from '../../../helpers/helper-functions.js';
* Timeline item inspector component.
*
* @param {import('../types.js').TimelineItemInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
diff --git a/src/blocks/blocks/timeline/item/save.js b/src/blocks/blocks/timeline/item/save.js
index e1e286767..a5a13b58f 100644
--- a/src/blocks/blocks/timeline/item/save.js
+++ b/src/blocks/blocks/timeline/item/save.js
@@ -21,8 +21,8 @@ const Save = ({
return (
-
-
+
+
{
attributes.hasIcon && (
'image' === attributes.iconType && attributes.icon ? (
@@ -41,7 +41,7 @@ const Save = ({
)
}
-
diff --git a/src/blocks/components/auto-disable-sync-attr/index.tsx b/src/blocks/components/auto-disable-sync-attr/index.tsx
index 7d6f23a06..66f18bfc6 100644
--- a/src/blocks/components/auto-disable-sync-attr/index.tsx
+++ b/src/blocks/components/auto-disable-sync-attr/index.tsx
@@ -10,15 +10,15 @@ type AutoDisableSyncAttrProps
= {
/**
* A wrapper that disable the children when the given attributes name is on the list with the synced attrs.
* @param props The props
- * @returns A wrapper that disable the component when the given attributes name is in sync.
+ * @return A wrapper that disable the component when the given attributes name is in sync.
*/
function AutoDisableSyncAttr( props: AutoDisableSyncAttrProps ) {
/**
- * Info: At first this was used aS inline component in Form,
- * but caused a lot of issues in which React kept loosing the reference of it and caused some unwanted behavior.
- * Making it external solved the issue.
- */
+ * Info: At first this was used aS inline component in Form,
+ * but caused a lot of issues in which React kept loosing the reference of it and caused some unwanted behavior.
+ * Making it external solved the issue.
+ */
return
);
}
+
+ return null;
}) }
diff --git a/src/blocks/components/icon-picker-control/index.js b/src/blocks/components/icon-picker-control/index.js
index ae8dda6b0..86daa80aa 100644
--- a/src/blocks/components/icon-picker-control/index.js
+++ b/src/blocks/components/icon-picker-control/index.js
@@ -271,7 +271,7 @@ const IconPickerControl = ({
renderContent={ ({ onToggle }) => {
if ( 'image' === library ) {
- return
;
+ return <>>;
}
return (
@@ -311,6 +311,8 @@ const IconPickerControl = ({
/>
);
}
+
+ return null;
}) }
@@ -463,10 +465,11 @@ export const IconPickerToolbarControl = ({
) }
- { icons.map( i => {
+ { icons.map( (i, index) => {
if ( ! search || i.name.match( search.toLowerCase() ) || i.label.toLowerCase().match( search.toLowerCase() ) ) {
return (
);
}
+
+ return null;
}) }
diff --git a/src/blocks/components/inspector-header/index.js b/src/blocks/components/inspector-header/index.js
index e182c31c7..6f72933b0 100644
--- a/src/blocks/components/inspector-header/index.js
+++ b/src/blocks/components/inspector-header/index.js
@@ -4,8 +4,8 @@
import classnames from 'classnames';
/**
- * WordPress dependencies.
- */
+ * WordPress dependencies.
+ */
import { __ } from '@wordpress/i18n';
import {
@@ -14,8 +14,8 @@ import {
} from '@wordpress/components';
/**
- * Internal dependencies.
- */
+ * Internal dependencies.
+ */
import './editor.scss';
const InspectorHeader = ({
diff --git a/src/blocks/components/prompt/index.tsx b/src/blocks/components/prompt/index.tsx
index b79305328..e7c6cf13c 100644
--- a/src/blocks/components/prompt/index.tsx
+++ b/src/blocks/components/prompt/index.tsx
@@ -2,7 +2,7 @@
* WordPress dependencies
*/
-import { __ } from '@wordpress/i18n';
+import { __, sprintf } from '@wordpress/i18n';
import { closeSmall, redo, undo } from '@wordpress/icons';
import { ReactNode } from 'react';
import { Button, ExternalLink, Notice, Placeholder, Spinner, TextControl } from '@wordpress/components';
@@ -126,7 +126,7 @@ const PromptBlockEditor = (
};
const PromptPlaceholder = ( props: PromptPlaceholderProps ) => {
- const { title, value, onValueChange, promptID } = props;
+ const { value, onValueChange, promptID } = props;
const [ getOption, updateOption, status ] = useSettings();
const [ apiKey, setApiKey ] = useState
( null );
@@ -135,13 +135,10 @@ const PromptPlaceholder = ( props: PromptPlaceholderProps ) => {
const [ apiKeyStatus, setApiKeyStatus ] = useState<'checking' | 'missing' | 'present' | 'error'>( window.themeisleGutenberg?.hasOpenAiKey ? 'present' : 'checking' );
const [ embeddedPrompts, setEmbeddedPrompts ] = useState([]);
- const [ result, setResult ] = useState( undefined );
const [ resultHistory, setResultHistory ] = useState<{result: string, meta: { usedToken: number, prompt: string }}[]>( props.resultHistory ?? []);
const [ resultHistoryIndex, setResultHistoryIndex ] = useState( 0 );
-
- const [ showResultArea, setShowResultArea ] = useState( false );
-
+
const [ showError, setShowError ] = useState( false );
const [ errorMessage, setErrorMessage ] = useState( '' );
const [ tokenUsageDescription, setTokenUsageDescription ] = useState( '' );
@@ -206,9 +203,14 @@ const PromptPlaceholder = ( props: PromptPlaceholderProps ) => {
if ( resultHistoryIndex > resultHistory.length - 1 ) {
return;
}
-
- setResult( resultHistory?.[ resultHistoryIndex ].result );
- setTokenUsageDescription( __( 'Used tokens: ', 'otter-blocks' ) + resultHistory[ resultHistoryIndex ].meta.usedToken );
+
+ setTokenUsageDescription(
+ sprintf(
+ // translators: %d: number of used tokens
+ __( 'Used tokens: %d', 'otter-blocks' ),
+ resultHistory[ resultHistoryIndex ].meta.usedToken
+ )
+ );
props.onPreview?.( resultHistory[ resultHistoryIndex ].result );
}, [ resultHistoryIndex, resultHistory ]);
@@ -273,8 +275,7 @@ const PromptPlaceholder = ( props: PromptPlaceholderProps ) => {
setErrorMessage( __( 'Empty response from OpenAI. Please try again.', 'otter-blocks' ) );
return;
}
-
- setResult( result );
+
if ( regenerate ) {
const newResultHistory = [ ...resultHistory ];
newResultHistory[ resultHistoryIndex ] = {
@@ -296,8 +297,8 @@ const PromptPlaceholder = ( props: PromptPlaceholderProps ) => {
setResultHistoryIndex( resultHistory.length );
}
- setShowResultArea( true );
- setTokenUsageDescription( __( 'Token used: ', 'otter-blocks' ) + data.usage.total_tokens );
+
+ setTokenUsageDescription( __( 'Token used:', 'otter-blocks' ) + data.usage.total_tokens );
props.onPreview?.( result );
});
}
@@ -312,7 +313,7 @@ const PromptPlaceholder = ( props: PromptPlaceholderProps ) => {
'checking' === apiKeyStatus && (
- { __( 'Checking the api key...', 'otter-blocks' ) }
+ { __( 'Checking the api key…', 'otter-blocks' ) }
)
}
diff --git a/src/blocks/components/prompt/prompt-input.tsx b/src/blocks/components/prompt/prompt-input.tsx
index 55b31cfd3..033e6ba49 100644
--- a/src/blocks/components/prompt/prompt-input.tsx
+++ b/src/blocks/components/prompt/prompt-input.tsx
@@ -4,7 +4,7 @@
import { Button } from '@wordpress/components';
import { Icon } from '@wordpress/icons';
import { __ } from '@wordpress/i18n';
-import { Fragment, useEffect, useRef } from '@wordpress/element';
+import { useRef } from '@wordpress/element';
/**
* Internal dependencies
@@ -23,6 +23,7 @@ const PromptInput = ( props: PromptInputProps ) => {
/**
* Handle keydown event.
+ * @param e
*/
const handleKeyDown = ( e: React.KeyboardEvent ) => {
if ( 'Enter' === e.key && ! e.shiftKey ) {
diff --git a/src/blocks/components/sync-control-dropdown/index.tsx b/src/blocks/components/sync-control-dropdown/index.tsx
index 9653bf5fd..6ee25d5bb 100644
--- a/src/blocks/components/sync-control-dropdown/index.tsx
+++ b/src/blocks/components/sync-control-dropdown/index.tsx
@@ -24,8 +24,8 @@ import { useDispatch } from '@wordpress/data';
import { Fragment } from '@wordpress/element';
/**
- * Internal dependencies.
- */
+ * Internal dependencies.
+ */
import './editor.scss';
const noop = () => {};
@@ -38,8 +38,11 @@ type SyncControlDropdownProps = {
/**
* A dropdown that let you select which of the given attrs to sync with global defaults.
- * @param props The props.
- * @returns
+ * @param props The props.
+ * @param props.isSynced
+ * @param props.options
+ * @param props.setAttributes
+ * @return
*/
const SyncControlDropdown = ({
isSynced = [],
@@ -75,7 +78,7 @@ const SyncControlDropdown = ({
};
const applyAll = () => {
- let fields = [ ...( isSynced || []) ];
+ const fields = [ ...( isSynced || []) ];
options.forEach( option => {
if ( ! isSynced?.includes( option.value ) ) {
diff --git a/src/blocks/components/toogle-group-control/index.js b/src/blocks/components/toogle-group-control/index.js
index 0b82d02ad..142dce2a1 100644
--- a/src/blocks/components/toogle-group-control/index.js
+++ b/src/blocks/components/toogle-group-control/index.js
@@ -20,7 +20,7 @@ import './editor.scss';
* A group of buttons that actions as a toggle
*
* @param {import('./type').ToggleGroupControlProps} props
- * @returns {JSX.Element}
+ * @return {JSX.Element}
*/
const ToogleGroupControl = ({
value,
@@ -45,8 +45,8 @@ const ToogleGroupControl = ({
>
onChange( option?.value )}
diff --git a/src/blocks/components/typography-selector-control/index.tsx b/src/blocks/components/typography-selector-control/index.tsx
index b3cf2e7cc..3fd7ae8e9 100644
--- a/src/blocks/components/typography-selector-control/index.tsx
+++ b/src/blocks/components/typography-selector-control/index.tsx
@@ -1,6 +1,4 @@
import {
- startCase,
- toLower,
mapValues
} from 'lodash';
@@ -30,7 +28,6 @@ import './editor.scss';
import { useInstanceId } from '@wordpress/compose';
import googleFontsLoader from '../../helpers/google-fonts';
import classNames from 'classnames';
-import { all } from 'deepmerge';
const TwoItemOnRow = ({ children }) => {
return
@@ -277,7 +274,7 @@ const TypographySelectorControl = ( props: TypographySelectorControlProps ) => {
] as ( keyof IsEnabled )[])
.filter( o => {
return ! ( 'variant' === o && ! allowVariants );
- }).map( ( component ) => {
+ }).map( ( component, index ) => {
if ( enableComponents?.[component]) {
return {
{ defaultStates.componentNames?.[component] }
;
}
- return ;
+ return <>>;
})
}
@@ -476,6 +473,8 @@ const TypographySelectorControl = ( props: TypographySelectorControlProps ) => {
);
}
+
+ return null;
}) }
diff --git a/src/blocks/frontend/accordion/index.js b/src/blocks/frontend/accordion/index.js
index 744616df0..c646a7f04 100644
--- a/src/blocks/frontend/accordion/index.js
+++ b/src/blocks/frontend/accordion/index.js
@@ -10,7 +10,7 @@ domReady( () => {
* Handle the opening of the accordion items.
*
* @param {HTMLDetailsElement} accordion The accordion root element.
- * @returns
+ * @return {void}
*/
const handleItemOpening = accordion => {
if ( ! accordion.classList.contains( 'exclusive' ) ) {
@@ -42,7 +42,7 @@ domReady( () => {
* Generate FAQPage schema for the accordion.
*
* @param {HTMLDivElement} accordion The accordion root element.
- * @returns {void}
+ * @return {void}
*/
const addFAQSchema = accordion => {
if ( ! accordion.dataset.hasSchema || 'false' === accordion.dataset.hasSchema ) {
@@ -72,7 +72,7 @@ domReady( () => {
const structuredData = {
'@context': 'https://schema.org',
'@type': 'FAQPage',
- 'mainEntity': mainEntity
+ mainEntity
};
// add the structured data to the page
diff --git a/src/blocks/frontend/countdown/index.ts b/src/blocks/frontend/countdown/index.ts
index aa6c4e7db..ed0537414 100644
--- a/src/blocks/frontend/countdown/index.ts
+++ b/src/blocks/frontend/countdown/index.ts
@@ -6,7 +6,7 @@ import { domReady } from '../../helpers/frontend-helper-functions';
/**
* Simple base64 encoding. This is used to hash the url to prevent reusable blocks from accessing and changing the same data --> making them unique per page.
* @param str The string.
- * @returns
+ * @return
*/
const toBase64 = ( str: string ) => {
return window.btoa( unescape( encodeURIComponent( str ) ) );
@@ -150,7 +150,7 @@ class CountdownData {
! lastVisitTimeRecord ||
( 0 > ( parseInt( lastVisitTimeRecord ) + parseInt( this.timer ) - Date.now() ) ) ||
timerValueRecorded !== this.timer ||
- timezoneRecorded != ( new Date() ).getTimezoneOffset().toString()
+ timezoneRecorded !== ( new Date() ).getTimezoneOffset().toString()
) {
// Record the current visit and timer time. Set a new deadline.
@@ -241,7 +241,7 @@ class CountdownData {
/**
* Activate the actions of the countdown when it ends.
- * @returns void
+ * @return {void}
*/
activateActions() {
@@ -408,7 +408,7 @@ class CountdownRunner {
/**
* Update the countdown based on the given time.
- * @param countdown The countdown.
+ * @param countdown The countdown.
* @param currentTime The time that needs to be displayed,
*/
updateCountdown( countdown: CountdownData, currentTime: number ) {
diff --git a/src/blocks/frontend/form/index.js b/src/blocks/frontend/form/index.js
index f631ba6aa..4803ea566 100644
--- a/src/blocks/frontend/form/index.js
+++ b/src/blocks/frontend/form/index.js
@@ -6,7 +6,7 @@ import DisplayFormMessage from './message.js';
import { domReady } from '../../helpers/frontend-helper-functions.js';
let startTimeAntiBot = null;
-let METADATA_VERSION = 1;
+const METADATA_VERSION = 1;
let saveMode = 'permanent';
@@ -32,7 +32,7 @@ const confirmRecord = async() => {
/**
* Get the form fields.
* @param {HTMLDivElement} form The form.
- * @returns {HTMLDivElement[]} The form fields.
+ * @return {HTMLDivElement[]} The form fields.
*/
const getFormFieldInputs = ( form ) => {
@@ -53,7 +53,7 @@ const getFormFieldInputs = ( form ) => {
* Get the fields with their value from the form.
*
* @param {HTMLDivElement} form The form.
- * @returns {Promise<{formFieldsData: import('./types').FormFieldData[]}>}
+ * @return {Promise<{formFieldsData: import('./types').FormFieldData[]}>}
*/
const extractFormFields = async( form ) => {
@@ -74,9 +74,9 @@ const extractFormFields = async( form ) => {
let label = `${( labelElem ?? labelContainer )?.innerHTML?.replace( /<[^>]*>?/gm, '' )}`;
- let value = undefined;
- let fieldType = undefined;
- let mappedName = undefined;
+ let value;
+ let fieldType;
+ let mappedName;
let metadata = {};
const { id } = input;
@@ -89,7 +89,7 @@ const extractFormFields = async( form ) => {
const select = input.querySelector( 'select' );
mappedName = select?.name;
- /** @type{HTMLInputElement} */
+ /** @type {HTMLInputElement} */
const fileInput = input.querySelector( 'input[type="file"]' );
const hiddenInput = input.querySelector( 'input[type="hidden"]' );
@@ -102,10 +102,10 @@ const extractFormFields = async( form ) => {
for ( let i = 0; i < files.length; i++ ) {
formFieldsData.push({
- label: label,
+ label,
value: `${files[i].name} (${ ( files[i].size / ( 1024 * 1024 ) ).toFixed( 4 ) } MB)`,
type: fileInput.type,
- id: id,
+ id,
metadata: {
version: METADATA_VERSION,
name: files[i].name,
@@ -113,7 +113,7 @@ const extractFormFields = async( form ) => {
file: files[i],
fieldOptionName: fileInput?.dataset?.fieldOptionName,
position: index + 1,
- mappedName: mappedName
+ mappedName
}
});
}
@@ -160,14 +160,14 @@ const extractFormFields = async( form ) => {
if ( value ) {
formFieldsData.push({
label: label || '(No label)',
- value: value,
+ value,
type: fieldType,
- id: id,
+ id,
metadata: {
...metadata,
version: METADATA_VERSION,
position: index + 1,
- mappedName: mappedName
+ mappedName
}
});
}
@@ -179,7 +179,7 @@ const extractFormFields = async( form ) => {
/**
* Get the nonce value from the form.
* @param {HTMLDivElement} form The form.
- * @returns {string}
+ * @return {string}
*/
function extractNonceValue( form ) {
const query = `.protection #${form.id || ''}_nonce_field`;
@@ -190,7 +190,7 @@ function extractNonceValue( form ) {
* Validate the inputs from the form.
*
* @param {HTMLDivElement} form The form.
- * @returns
+ * @return
*/
function validateInputs( form ) {
let result = true;
@@ -257,7 +257,7 @@ function validateInputs( form ) {
* @param {import('./types').FormDataStructure} data
*/
const createFormData = ( data ) => {
- var formData = new FormData();
+ const formData = new FormData();
/**
* For simple data, we will encode them as JSON in 'form_data' key.
@@ -266,7 +266,7 @@ const createFormData = ( data ) => {
*/
data?.payload?.formInputsData?.forEach( ( field, index ) => {
if ( 'file' === field.type ) {
- let key = 'file__' + field.metadata.position + '_' + index;
+ const key = 'file__' + field.metadata.position + '_' + index;
formData.append( key, field.metadata.file );
data.payload.formInputsData[index].metadata.file = undefined;
@@ -281,7 +281,7 @@ const createFormData = ( data ) => {
/**
* Try to get the current post id from body class.
- * @returns {number}
+ * @return {number}
*/
const getCurrentPostId = () => {
const body = document.querySelector( 'body' );
@@ -301,11 +301,11 @@ const getCurrentPostId = () => {
/**
* Handle the response after the form is submitted.
*
- * @param {Promise} request
- * @param {DisplayFormMessage} displayMsg
+ * @param {Promise} request
+ * @param {DisplayFormMessage} displayMsg
* @param {(response: import('./types.js').IFormResponse, displayMsg:DisplayFormMessage) => void} onSuccess
* @param {(response: import('./types.js').IFormResponse, displayMsg:DisplayFormMessage) => void} onFail
- * @param {() => void} onCleanUp
+ * @param {() => void} onCleanUp
*/
const handleAfterSubmit = ( request, displayMsg, onSuccess, onFail, onCleanUp ) => {
request.then( r => r.json() ).then( response => {
@@ -371,8 +371,8 @@ const makeSpinner = ( anchor ) => {
/**
* Send the date from the form to the server
*
- * @param {HTMLDivElement} form The element that contains all the inputs
- * @param {HTMLButtonElement} btn The submit button
+ * @param {HTMLDivElement} form The element that contains all the inputs
+ * @param {HTMLButtonElement} btn The submit button
* @param {DisplayFormMessage} displayMsg The display message utility
*/
const collectAndSendInputFormData = async( form, btn, displayMsg ) => {
@@ -382,19 +382,17 @@ const collectAndSendInputFormData = async( form, btn, displayMsg ) => {
// Get the data from the form fields.
const { formFieldsData } = await extractFormFields( form );
const formIsEmpty = 2 > formFieldsData?.length;
- const nonceFieldValue = extractNonceValue( form );
const hasCaptcha = form?.classList?.contains( 'has-captcha' );
const hasValidToken = id && window.themeisleGutenberg?.tokens?.[id]?.token;
-
const spinner = makeSpinner( btn );
-
-
+
if ( formIsEmpty ) {
btn.disabled = false;
spinner.hide();
return;
}
-
+
+ const nonceFieldValue = extractNonceValue( form );
const isValidationSuccessful = validateInputs( form );
if ( hasCaptcha && ! hasValidToken ) {
diff --git a/src/blocks/frontend/form/message.js b/src/blocks/frontend/form/message.js
index 86f76f47f..bdaefc226 100644
--- a/src/blocks/frontend/form/message.js
+++ b/src/blocks/frontend/form/message.js
@@ -30,7 +30,7 @@ class DisplayFormMessage {
/**
* Get the message from global themeisleGutenbergForm?.messages
* @param {string} msgSlug
- * @returns {*|string}
+ * @return {*|string}
*/
getMsgBySlug( msgSlug ) {
return window?.themeisleGutenbergForm?.messages[msgSlug] || 'Messages are missing!';
@@ -38,9 +38,9 @@ class DisplayFormMessage {
/**
* Set the message from global themeisleGutenbergForm?.messages
- * @param {string} msgSlug
+ * @param {string} msgSlug
* @param {'error'|'warning'|'success'} type
- * @returns {DisplayFormMessage}
+ * @return {DisplayFormMessage}
*/
pullMsg( msgSlug, type ) {
return this.setMsg(
@@ -51,9 +51,9 @@ class DisplayFormMessage {
/**
* Set the message.
- * @param {string} msg
+ * @param {string} msg
* @param {'error'|'warning'|'success'} type
- * @returns {DisplayFormMessage}
+ * @return {DisplayFormMessage}
*/
setMsg( msg, type = '' ) {
this.msgElem.innerHTML = msg;
diff --git a/src/blocks/frontend/leaflet-map/leaflet-gesture-handling.js b/src/blocks/frontend/leaflet-map/leaflet-gesture-handling.js
index ed7582eea..ed244d41d 100644
--- a/src/blocks/frontend/leaflet-map/leaflet-gesture-handling.js
+++ b/src/blocks/frontend/leaflet-map/leaflet-gesture-handling.js
@@ -1,3 +1,5 @@
+/* eslint-disable */
+
/*
* * Leaflet Gesture Handling **
* * Version 1.1.8
@@ -20,7 +22,7 @@ const t = setInterval( () => {
let draggingMap = false;
GestureHandling = L.Handler.extend({
- addHooks: function() {
+ addHooks() {
this._handleTouch = this._handleTouch.bind( this );
this._setupPluginOptions();
@@ -50,7 +52,7 @@ const t = setInterval( () => {
L.DomEvent.on( this._map, 'moveend', this._handleDragging, this );
},
- removeHooks: function() {
+ removeHooks() {
this._enableInteractions();
this._map._container.removeEventListener(
@@ -82,7 +84,7 @@ const t = setInterval( () => {
L.DomEvent.off( this._map, 'moveend', this._handleDragging, this );
},
- _handleDragging: function( e ) {
+ _handleDragging( e ) {
if ( 'movestart' === e.type || 'move' === e.type ) {
draggingMap = true;
} else if ( 'moveend' === e.type ) {
@@ -90,7 +92,7 @@ const t = setInterval( () => {
}
},
- _disableInteractions: function() {
+ _disableInteractions() {
this._map.dragging.disable();
this._map.scrollWheelZoom.disable();
if ( this._map.tap ) {
@@ -98,7 +100,7 @@ const t = setInterval( () => {
}
},
- _enableInteractions: function() {
+ _enableInteractions() {
this._map.dragging.enable();
this._map.scrollWheelZoom.enable();
if ( this._map.tap ) {
@@ -106,7 +108,7 @@ const t = setInterval( () => {
}
},
- _setupPluginOptions: function() {
+ _setupPluginOptions() {
//For backwards compatibility, merge gestureHandlingText into the new options object
if ( this._map.options.gestureHandlingText ) {
@@ -114,8 +116,8 @@ const t = setInterval( () => {
}
},
- _setLanguageContent: function() {
- var languageContent;
+ _setLanguageContent() {
+ let languageContent;
//If user has supplied custom language, use that
if (
@@ -179,17 +181,17 @@ const t = setInterval( () => {
);
},
- _getUserLanguage: function() {
- var lang = navigator.languages ?
+ _getUserLanguage() {
+ const lang = navigator.languages ?
navigator.languages[0] :
navigator.language || navigator.userLanguage;
return lang;
},
- _handleTouch: function( e ) {
+ _handleTouch( e ) {
//Disregard touch events on the minimap if present
- var ignoreList = [
+ const ignoreList = [
'leaflet-control-minimap',
'leaflet-interactive',
'leaflet-popup-content',
@@ -199,7 +201,7 @@ const t = setInterval( () => {
'leaflet-control-zoom-out'
];
- var ignoreElement = false;
+ let ignoreElement = false;
for ( let i = 0; i < ignoreList.length; i++ ) {
if ( L.DomUtil.hasClass( e.target, ignoreList[i]) ) {
ignoreElement = true;
@@ -247,7 +249,7 @@ const t = setInterval( () => {
_isScrolling: false,
- _handleScroll: function( e ) {
+ _handleScroll( e ) {
if ( e.metaKey || e.ctrlKey ) {
e.preventDefault();
L.DomUtil.removeClass( this._map._container,
@@ -266,7 +268,7 @@ const t = setInterval( () => {
this._isScrolling = setTimeout( function() {
// Run the callback
- var warnings = document.getElementsByClassName(
+ const warnings = document.getElementsByClassName(
'leaflet-gesture-handling-scroll-warning'
);
for ( let i = 0; i < warnings.length; i++ ) {
@@ -278,11 +280,11 @@ const t = setInterval( () => {
}
},
- _handleMouseOver: function( e ) {
+ _handleMouseOver( e ) {
this._enableInteractions();
},
- _handleMouseOut: function( e ) {
+ _handleMouseOut( e ) {
if ( ! draggingMap ) {
this._disableInteractions();
}
diff --git a/src/blocks/frontend/live-search/index.ts b/src/blocks/frontend/live-search/index.ts
index a52ee66a1..b7932d275 100644
--- a/src/blocks/frontend/live-search/index.ts
+++ b/src/blocks/frontend/live-search/index.ts
@@ -25,7 +25,7 @@ type ResultsContainer = Element | null | undefined;
/**
* Returns an icon component based on the post type.
* @param type - The post type.
- * @returns The icon component.
+ * @return The icon component.
*/
const getPostIcon = ( type: string ) => {
switch ( type ) {
@@ -39,7 +39,7 @@ const getPostIcon = ( type: string ) => {
/**
* Returns a div element containing meta information for a given ResultsEntry object.
* @param entry - The ResultsEntry object to generate meta information for.
- * @returns A div element containing the meta information.
+ * @return A div element containing the meta information.
*/
const getMeta = ( entry: ResultsEntry ) => {
const meta = document.createElement( 'div' );
@@ -74,9 +74,9 @@ domReady( () => {
/**
* Get the post search from our endpoint.
*
- * @param search - The search query string.
- * @param query - The query data to send to the REST API.
- * @returns A Promise that resolves to the JSON response from the REST API.
+ * @param search - The search query string.
+ * @param queryData - The query data to send to the REST API.
+ * @return A Promise that resolves to the JSON response from the REST API.
*/
const requestData = async( search: string, queryData: QueryData ) => {
const options = {
@@ -221,7 +221,6 @@ domReady( () => {
}
const keyEvent = event as KeyboardEvent;
- const containerDimensions = resultsContainer.parentElement.getBoundingClientRect();
const keys = [ 'ArrowDown', 'ArrowUp', 'Escape' ];
if ( ! keys.includes( keyEvent.key ) ) {
@@ -240,6 +239,8 @@ domReady( () => {
return;
}
+ const containerDimensions = resultsContainer.parentElement.getBoundingClientRect();
+
if ( 'ArrowDown' === keyEvent.key && highlighted.nextElementSibling ) {
removeHighlight( highlighted );
highlight( highlighted.nextElementSibling as HTMLElement, inputElement );
@@ -274,7 +275,7 @@ domReady( () => {
};
// Initialize the live search for each block on the page when it becomes visible.
- let observer = new IntersectionObserver( ( entries, observer ) => {
+ const observer = new IntersectionObserver( ( entries, observer ) => {
entries.forEach( entry => {
if ( entry.isIntersecting ) {
initializeLiveSearch( entry.target );
@@ -289,11 +290,11 @@ domReady( () => {
* Creates a container for search results and appends it to the provided wrap element.
* If a resultsContainer is provided and a search_results element is not found in the block, the resultsContainer is appended to the wrap element.
* Otherwise, a new container is created and appended to the wrap element.
- * @param wrap - The element to which the results container will be appended.
+ * @param wrap - The element to which the results container will be appended.
* @param resultsContainer - The pre-existing results container to be appended to the wrap element if a search_results element is not found in the block.
- * @param block - The block element to which the wrap element will be appended.
- * @param inputStyle - The CSSStyleDeclaration object containing the style properties of the input element.
- * @returns The created results container.
+ * @param block - The block element to which the wrap element will be appended.
+ * @param inputStyle - The CSSStyleDeclaration object containing the style properties of the input element.
+ * @return The created results container.
*/
const createResultsContainer = ( wrap: Element, resultsContainer: ResultsContainer, block: Element | null, inputStyle: CSSStyleDeclaration ) => {
wrap.innerHTML = '';
@@ -322,10 +323,10 @@ domReady( () => {
/**
* Removes the results container from the given block element.
*
- * @param block - The block element to remove the results container from.
+ * @param block - The block element to remove the results container from.
* @param resultsContainer - The results container to remove.
- * @param cache - Whether to cache the removed container for later use.
- * @returns The removed container if `cache` is `true`, otherwise `null`.
+ * @param cache - Whether to cache the removed container for later use.
+ * @return The removed container if `cache` is `true`, otherwise `null`.
*/
const removeResultsContainer = ( block: Element | null, resultsContainer: ResultsContainer, cache = true ) => {
const tmpResultsContainer = block?.querySelector( '.container-wrap' );
@@ -345,9 +346,9 @@ domReady( () => {
/**
* Updates the search results in the specified block with the given search value and results.
*
- * @param searchValue - The search value to use for filtering the results.
- * @param block - The block element to update the results in.
- * @param results - The array of results to display.
+ * @param searchValue - The search value to use for filtering the results.
+ * @param block - The block element to update the results in.
+ * @param results - The array of results to display.
* @param inputElement - The input element used for the search.
*/
const updateResults = ( searchValue: string, block: Element | null, results: Array, inputElement: Element ) => {
@@ -423,7 +424,7 @@ domReady( () => {
/**
* Highlights the given element with a background color based on the input element's background color.
* @param element - The element to highlight.
- * @param input - The input element to get the background color from.
+ * @param input - The input element to get the background color from.
*/
const highlight = ( element: HTMLElement, input: Element ) => {
@@ -447,10 +448,10 @@ domReady( () => {
/**
* Returns a DOM element representing a search result.
- * @param entry - The search result entry.
- * @param index - The index of the search result.
+ * @param entry - The search result entry.
+ * @param index - The index of the search result.
* @param inputElement - The input element used for the search.
- * @returns A DOM element representing the search result.
+ * @return A DOM element representing the search result.
*/
const getResultElement = ( entry: ResultsEntry, index: number, inputElement: Element ) => {
const optionWrap = document.createElement( 'div' );
diff --git a/src/blocks/frontend/masonry/index.js b/src/blocks/frontend/masonry/index.js
index 2b281912f..cab77217f 100644
--- a/src/blocks/frontend/masonry/index.js
+++ b/src/blocks/frontend/masonry/index.js
@@ -29,9 +29,7 @@ domReady( () => {
let columns = Array.from( container.classList ).find( className => {
const res = pattern.exec( className );
- if ( null !== res ) {
- return true;
- }
+ return null !== res;
});
columns = pattern.exec( columns );
diff --git a/src/blocks/frontend/progress-bar/index.js b/src/blocks/frontend/progress-bar/index.js
index 48e90b435..4e2f7fc5f 100644
--- a/src/blocks/frontend/progress-bar/index.js
+++ b/src/blocks/frontend/progress-bar/index.js
@@ -59,6 +59,7 @@ domReady( () => {
threshold: [ 0.6 ]
};
+ let interval;
const observer = new IntersectionObserver( entries => {
entries.forEach( entry => {
if ( entry.isIntersecting ) {
@@ -78,8 +79,6 @@ domReady( () => {
return;
}
- let interval;
-
if ( interval ) {
clearInterval( interval );
}
diff --git a/src/blocks/frontend/sticky/index.ts b/src/blocks/frontend/sticky/index.ts
index ec19c1281..9e34c658f 100644
--- a/src/blocks/frontend/sticky/index.ts
+++ b/src/blocks/frontend/sticky/index.ts
@@ -17,9 +17,9 @@ window.debugSticky = false;
/**
* Check if the element can be a sticky container.
*
- * @param parent The parent element to check.
+ * @param parent The parent element to check.
* @param cssClasses The CSS classes to check.
- * @returns
+ * @return
*/
const isParentContainerValid = ( parent: Element, cssClasses: string[]): boolean => {
return cssClasses.some( c => parent.classList.contains( c ) );
@@ -27,7 +27,8 @@ const isParentContainerValid = ( parent: Element, cssClasses: string[]): boolean
/**
* Get the container for the given element
- * @param elem The sticky element
+ * @param elem The sticky element
+ * @param scope
* @return The parent container. Return `body` as default
*/
const getStickyContainer = ( elem: Element, scope: `o-sticky-scope-${string}` ): HTMLElement => {
@@ -165,10 +166,10 @@ class StickyData {
/**
* Create the sticky data container for the element.
*
- * @param selector The selector for the sticky data container.
- * @param config The configuration for the sticky data container.
+ * @param selector The selector for the sticky data container.
+ * @param config The configuration for the sticky data container.
* @param containerSelector The container selector for the sticky data container.
- * @returns
+ * @return
*/
constructor( selector: HTMLDivElement | string, config: Config, containerSelector: HTMLDivElement | string ) {
@@ -542,9 +543,9 @@ class StickyRunner {
/**
* Get the sticky element current position.
*
- * @param sticky The sticky element.
+ * @param sticky The sticky element.
* @param earlyActivation Add on offset to activate early in case of multiple sticky elements.
- * @returns
+ * @return
*/
getCurrentPosition( sticky: StickyData, earlyActivation: number = 0 ): typeof positions[Position] {
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
@@ -608,7 +609,7 @@ class StickyRunner {
* Calculate the gap between the sticky element and other before him that are active.
*
* @param sticky The sticky element.
- * @returns
+ * @return
*/
calculateEarlyActivation( sticky: StickyData ): number {
let gap = 0;
@@ -628,7 +629,7 @@ class StickyRunner {
* Calculate the opacity for the fade effect.
*
* @param sticky The sticky element to calculate the opacity.
- * @returns
+ * @return
*/
calculateOpacity( sticky: StickyData ): number {
let opacity = 1;
@@ -689,7 +690,7 @@ class StickyRunner {
/**
* Get the active sticky elements.
*
- * @returns
+ * @return
*/
get active(): StickyData[] {
return this.items.filter( stickyElem => 'active' === stickyElem.status );
@@ -698,7 +699,7 @@ class StickyRunner {
/**
* Get the dormant sticky elements.
*
- * @returns
+ * @return
*/
get dormant(): StickyData[] {
return this.items.filter( stickyElem => 'dormant' === stickyElem.status );
diff --git a/src/blocks/helpers/block-utility.js b/src/blocks/helpers/block-utility.js
index 44ebfc435..137796212 100644
--- a/src/blocks/helpers/block-utility.js
+++ b/src/blocks/helpers/block-utility.js
@@ -60,9 +60,9 @@ export const addGlobalDefaults = ( attributes, setAttributes, name, defaultAttri
/**
* Utiliy function for getting the default value of the attribute.
*
- * @param {string} name The block's name provided by WordPress
- * @param {string} field Name of the value to be returned
- * @param {Object} defaultAttributes The default attributes of the block.
+ * @param {string} name The block's name provided by WordPress
+ * @param {string} field Name of the value to be returned
+ * @param {Object} defaultAttributes The default attributes of the block.
*/
export const getDefaultValue = ( name, field, defaultAttributes ) => {
const blockDefaults = window.themeisleGutenberg.globalDefaults?.[name];
@@ -74,10 +74,11 @@ export const getDefaultValue = ( name, field, defaultAttributes ) => {
/**
* Utiliy function for getting the default value of the attribute by value.
*
- * @param {string} name The block's name provided by WordPress
- * @param {string} field Name of the value to be returned
- * @param {Object} defaultAttributes The default attributes of the block.
- * @param {Object} attributes The attributes of the block.
+ * @param {Object} params - The parameters object.
+ * @param {string} params.name The block's name provided by WordPress
+ * @param {string} params.field Name of the value to be returned
+ * @param {Object} params.defaultAttributes The default attributes of the block.
+ * @param {Object} params.attributes The attributes of the block.
*/
export const getDefaultValueByField = ({ name, field, defaultAttributes, attributes }) => {
if ( attributes.isSynced?.includes( field ) ) {
@@ -97,7 +98,7 @@ const localIDs = {};
/**
* Check if the ID is inside a reusable block or a Query Loop.
* @param {string} clientId The client id of the block.
- * @returns {boolean}
+ * @return {boolean}
*/
const isSharedBlock = ( clientId ) => getBlockParents( clientId )?.some( id => {
const { attributes, name } = getBlock( id ) ?? {};
@@ -107,7 +108,7 @@ const isSharedBlock = ( clientId ) => getBlockParents( clientId )?.some( id => {
/**
* Check if the ID is empty.
* @param {string} clientId The client id of the block.
- * @returns {boolean}
+ * @return {boolean}
*/
const isEmptyId = ( clientId ) => {
const { attributes } = getBlock( clientId ) ?? {};
@@ -124,7 +125,7 @@ const isEmptyId = ( clientId ) => {
* @param {string} idPrefix The prefix used for generating the block id
* @param {string} clientId The block's client id provided by WordPress
* @param {Set.} idsList The ids list for the current type of block
- * @returns An uniq id instance
+ * @return An uniq id instance
*/
const generateUniqIdInstance = ( idPrefix, clientId, idsList ) => {
@@ -143,7 +144,7 @@ const generateUniqIdInstance = ( idPrefix, clientId, idsList ) => {
* Generate the id prefix based on the name of the block
*
* @param {string} name Name of the block
- * @returns {string}
+ * @return {string}
*/
const generatePrefix = ( name ) => {
return `wp-block-${ name.replace( '/', '-' ) }-`;
@@ -215,12 +216,12 @@ export const addBlockId = ( args ) => {
return ( savedId ) => {
return ( savedId ) => {};
};
- } else {
+ }
- // No conflicts, save the current id only to keep track of it both in local and global mode.
- localIDs[name].add( attributes.id );
- blockIDs.push( attributes.id );
- }
+ // No conflicts, save the current id only to keep track of it both in local and global mode.
+ localIDs[name].add( attributes.id );
+ blockIDs.push( attributes.id );
+
return ( savedId ) => {
idGenerationStatus[clientId] = 'free';
@@ -237,7 +238,7 @@ const { getSelectedBlockClientId } = select( 'core/block-editor' );
* Create the function that behaves like `setAttributes` using the client id
*
* @param {*} clientId The block's client id provided by WordPress
- * @returns {Function} Function that mimics `setAttributes`
+ * @return {Function} Function that mimics `setAttributes`
*/
const updateAttrs = ( clientId ) => ( attr ) => {
updateBlockAttributes( clientId, attr );
@@ -256,7 +257,7 @@ const updateAttrs = ( clientId ) => ( attr ) => {
* Extract the attributes, setAttributes, and the name of the block using the data api
*
* @param {string} clientId The block's client id provided by WordPress
- * @returns {BlockData}
+ * @return {BlockData}
*/
const extractBlockData = ( clientId ) => {
const block = getBlock( clientId );
@@ -302,7 +303,7 @@ export const blockInit = ( clientId, defaultAttributes ) => {
* Create a Style node for handling `head` Node change when working in a Tablet, Mobile mode or in FSE Editor.
*
* @param {import('./blocks.js').OtterNodeCSSOptions } options The options.
- * @returns {import('./blocks.js').OtterNodeCSSReturn} The name of the node and function handler.
+ * @return {import('./blocks.js').OtterNodeCSSReturn} The name of the node and function handler.
*/
export const useCSSNode = ( options = {}) => {
const [ cssList, setCSSProps ] = useState({
@@ -319,7 +320,7 @@ export const useCSSNode = ( options = {}) => {
*
* The `css` and `media` have a 1-1 relationship.
*
- * @param {string[]} css A list with CSS code.
+ * @param {string[]} css A list with CSS code.
* @param {string[]} media A list CSS media options. One for each CSS item.
*
* @example Simple usage.
@@ -351,7 +352,6 @@ export const useCSSNode = ( options = {}) => {
* '@media ( max-width: 600px )'
* ]
* );
- *
*/
const setNodeCSS = ( css = [], media = []) => {
setCSSProps({
@@ -414,8 +414,8 @@ export const getEditorIframe = () => ( document.querySelector( 'iframe[name^="ed
/**
* Copy the JS node asset from main document to the iframe.
*
- * @param {string} assetSelectorId The id of the asset.
- * @param {Function} callback The callback.
+ * @param {string} assetSelectorId The id of the asset.
+ * @param {Function} callback The callback.
*/
export const copyScriptAssetToIframe = ( assetSelectorId, callback ) => {
const iframe = getEditorIframe();
@@ -454,7 +454,7 @@ export const buildGetSyncValue = ( name, attributes, defaultAttributes ) => {
* Get the reusable block content by id.
*
* @param {string} id The id of the reusable block.
- * @returns {BlockInstance[]|*[]} The reusable block content.
+ * @return {BlockInstance[]|*[]} The reusable block content.
*/
export function pullReusableBlockContentById( id ) {
const reusableBlocks = select( 'core' ).getEntityRecords( 'postType', 'wp_block' );
@@ -476,7 +476,7 @@ export function pullReusableBlockContentById( id ) {
* Insert a block below the given block.
*
* @param {string} clientId The client id of the reference block.
- * @param {any} block The block to insert.
+ * @param {any} block The block to insert.
* @see https://github.com/WordPress/gutenberg/blob/e448fa70163ce936eae9aec454ca99f5a6287f15/packages/block-editor/src/store/actions.js#L1604-L1622
*/
export function insertBlockBelow( clientId, block ) {
@@ -517,8 +517,8 @@ export class GlobalStateMemory {
/**
* Handle the message event.
*
- * @param {MessageEvent} event The message event.
- */
+ * @param {MessageEvent} event The message event.
+ */
handleMessage( event ) {
if ( 'object' === typeof event.data && null !== event.data && 'otterMemoryState' in event.data ) {
const { key, value, location, action } = event.data.otterMemoryState;
@@ -547,10 +547,10 @@ export class GlobalStateMemory {
/**
* Get the state value.
- * @param {string} location The location of the state.
- * @param {string} key The key of the state.
- * @returns {undefined|*}
- */
+ * @param {string} location The location of the state.
+ * @param {string} key The key of the state.
+ * @return {undefined|*}
+ */
getState( location, key ) {
if ( this.states[location] === undefined ) {
return undefined;
@@ -562,9 +562,9 @@ export class GlobalStateMemory {
/**
* The global state memory.
*
- * @param {string} key The key of the state.
- * @param {any} defaultValue The default value of the state.
- * @returns {unknown[]}
+ * @param {string} key The key of the state.
+ * @param {any} defaultValue The default value of the state.
+ * @return {unknown[]}
*/
export function useTabSwitch( key, defaultValue ) {
const location = 'tab';
@@ -574,6 +574,7 @@ export function useTabSwitch( key, defaultValue ) {
/**
* Retrieve the initial state from the parent via bi-directional communication.
+ * @param event
*/
const listener = ( event ) => {
if ( 'object' === typeof event.data && null !== event.data && 'otterMemoryState' in event.data ) {
@@ -612,7 +613,7 @@ export function useTabSwitch( key, defaultValue ) {
otterMemoryState: {
key,
location,
- value: value,
+ value,
action: 'set'
}
});
@@ -623,7 +624,7 @@ export function useTabSwitch( key, defaultValue ) {
/**
* Get all registered patterns.
*
- * @returns {Array.<{name: string, title: string, content: string, categories: string[], source: string | undefined, blockTypes: string[]|undefined}>}
+ * @return {Array.<{name: string, title: string, content: string, categories: string[], source: string | undefined, blockTypes: string[]|undefined}>}
*/
export function pullPatterns() {
return select( 'core' )?.getBlockPatterns() ?? [];
@@ -632,7 +633,7 @@ export function pullPatterns() {
/**
* Get all registered patterns that are part of the Otter Blocks category.
*
- * @returns {{name: string, title: string, content: string, categories: string[], source: (string|undefined), blockTypes: (string[]|undefined)}[]}
+ * @return {{name: string, title: string, content: string, categories: string[], source: (string|undefined), blockTypes: (string[]|undefined)}[]}
*/
export function pullOtterPatterns() {
return pullPatterns().filter( pattern => pattern?.name?.startsWith( 'otter-blocks/' ) || pattern?.name?.startsWith( 'otter-pro/' ) );
diff --git a/src/blocks/helpers/cookies.ts b/src/blocks/helpers/cookies.ts
index ccd3cd863..4d40d91c1 100644
--- a/src/blocks/helpers/cookies.ts
+++ b/src/blocks/helpers/cookies.ts
@@ -3,19 +3,19 @@
export function setCookie( cname: string, cvalue: string, exdays: number ) {
const d = new Date();
d.setTime( d.getTime() + ( exdays * 24 * 60 * 60 * 1000 ) );
- let expires = 'expires=' + d.toUTCString();
+ const expires = 'expires=' + d.toUTCString();
document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/';
}
export function getCookie( cname: string ) {
- let name = cname + '=';
- let ca = document.cookie.split( ';' );
+ const name = cname + '=';
+ const ca = document.cookie.split( ';' );
for ( let i = 0; i < ca.length; i++ ) {
let c = ca[i];
- while ( ' ' == c.charAt( 0 ) ) {
+ while ( ' ' === c.charAt( 0 ) ) {
c = c.substring( 1 );
}
- if ( 0 == c.indexOf( name ) ) {
+ if ( 0 === c.indexOf( name ) ) {
return c.substring( name.length, c.length );
}
}
diff --git a/src/blocks/helpers/defered-wp-options-save.js b/src/blocks/helpers/defered-wp-options-save.js
index 2a2e82ef2..d3e0edb07 100644
--- a/src/blocks/helpers/defered-wp-options-save.js
+++ b/src/blocks/helpers/defered-wp-options-save.js
@@ -7,7 +7,7 @@ class DeferredWpOptionsSave {
/**
* We will create a global variable to store the instance of this class.
* This will prevent multiple instances of this class to be created.
- */
+ */
if ( window?.deferredWpOptionsSave ) {
return window?.deferredWpOptionsSave;
}
@@ -25,7 +25,7 @@ class DeferredWpOptionsSave {
/**
* Create a new instance of the Settings model that can fetch the WP Options.
- * @returns {api.models.Settings}
+ * @return {api.models.Settings}
*/
createSettings() {
return ( new api.models.Settings() );
@@ -33,9 +33,9 @@ class DeferredWpOptionsSave {
/**
* Save the option to the server.
- * @param {string} optionType - The option type to save. Internal identifier.
- * @param {string|number|array|object|((currentValue: any) => any)} value - The value to save. It can be a function that receives the current value and returns the new value. If it does not exists, it will receive null.
- * @param {(options: Object, error: any|null) => void} callback - The callback to call after the save is done. It will receive the response from the server and the error if any.
+ * @param {string} optionType - The option type to save. Internal identifier.
+ * @param {string | number | Array | object | ((currentValue: any) => any)} value - The value to save. It can be a function that receives the current value and returns the new value. If it does not exists, it will receive null.
+ * @param {(options: Object, error: any|null) => void} callback - The callback to call after the save is done. It will receive the response from the server and the error if any.
*/
save( optionType, value, callback = () => {}) {
this.changes.push({ optionType, value, callback });
diff --git a/src/blocks/helpers/detect-loading.js b/src/blocks/helpers/detect-loading.js
index 0cf285126..a49b32e3a 100644
--- a/src/blocks/helpers/detect-loading.js
+++ b/src/blocks/helpers/detect-loading.js
@@ -1,15 +1,15 @@
/**
* Trigger a function after loading the elements mentioned in the plugins.
- * @param {Function} onLoaded The callback function.
- * @param {string[]} plugins The plugins.
- * @param {number} timeLimit The time limit to do the detection.
+ * @param {Function} onLoaded The callback function.
+ * @param {string[]} plugins The plugins.
+ * @param {number} timeLimit The time limit to do the detection.
*/
export const detectLoading = ( onLoaded, plugins, timeLimit = 50 ) => {
let loaded = 0;
let trigger = true;
- if ( 0 == plugins.length ) {
+ if ( 0 === plugins.length ) {
onLoaded?.();
return;
}
@@ -41,7 +41,7 @@ export const detectLoading = ( onLoaded, plugins, timeLimit = 50 ) => {
const detectLottieLoading = ( onLoaded ) => {
const lottiePlayers = document.querySelectorAll( 'lottie-player' );
- if ( 0 == lottiePlayers.length ) {
+ if ( 0 === lottiePlayers.length ) {
onLoaded?.();
return;
}
diff --git a/src/blocks/helpers/enhancement.js b/src/blocks/helpers/enhancement.js
index 6b4c99d91..a0316b8ab 100644
--- a/src/blocks/helpers/enhancement.js
+++ b/src/blocks/helpers/enhancement.js
@@ -14,8 +14,7 @@ import { addBlockId } from './block-utility';
* @param {*} Block An Otter Block
* @param {Object} defaultAttributes The default attributes of the block.
* @param {(string|undefined)} idPrefix (Optional) The prefix used for generating the block id
- * @returns {React.FunctionComponent} An enhanced component
- * @alternative blockInit
+ * @return {React.FunctionComponent} An enhanced component
* @example
* import attributes from './attributes.js';
* import edit from './edit.js';
diff --git a/src/blocks/helpers/frontend-helper-functions.js b/src/blocks/helpers/frontend-helper-functions.js
index 422fda326..a91f999f7 100644
--- a/src/blocks/helpers/frontend-helper-functions.js
+++ b/src/blocks/helpers/frontend-helper-functions.js
@@ -1,10 +1,10 @@
/**
* Create a list with numbers from interval [start, end].
*
- * @param number start The start.
- * @param number end The end.
- * @param number step The step.
- * @returns {*[]}
+ * @param {number} start The start.
+ * @param {number} end The end.
+ * @param {number} step The step.
+ * @return {*[]}
*/
export const range = ( start, end, step ) => {
const range = [];
@@ -21,7 +21,7 @@ export const range = ( start, end, step ) => {
throw TypeError( 'Start and end arguments must be of same type.' );
}
- if ( undefined === typeof step ) {
+ if ( 'undefined' === typeof step ) {
step = 1;
}
@@ -59,7 +59,7 @@ export const range = ( start, end, step ) => {
* Linear
*
* @param {number} x
- * @returns {number}
+ * @return {number}
*/
export const linear = ( x ) => {
return x;
@@ -69,7 +69,7 @@ export const linear = ( x ) => {
* Ease In Sine
*
* @param {number} x
- * @returns {number}
+ * @return {number}
*/
export const easeInSine = ( x ) => {
return 1 - Math.cos( ( x * Math.PI ) / 2 );
@@ -79,7 +79,7 @@ export const easeInSine = ( x ) => {
* Ease Out Sine
*
* @param {number} x
- * @returns {number}
+ * @return {number}
*/
export const easeOutSine = ( x ) => {
return Math.sin( ( x * Math.PI ) / 2 );
@@ -88,7 +88,7 @@ export const easeOutSine = ( x ) => {
/**
* Ease In Out SSine
* @param {number} x
- * @returns {number}
+ * @return {number}
*/
export const easeInOutSine = ( x ) => {
return -( Math.cos( Math.PI * x ) - 1 ) / 2;
@@ -97,7 +97,7 @@ export const easeInOutSine = ( x ) => {
/**
* Ease Out Quad
* @param {number} x
- * @returns {number}
+ * @return {number}
*/
export const easeOutQuad = ( x ) => {
return 1 - ( 1 - x ) * ( 1 - x );
@@ -128,9 +128,9 @@ export const domReady = ( callback ) => {
/**
* Debounce function
*
- * @param func The function to apply.
- * @param timeout
- * @returns {(function(...[*]): void)|*}
+ * @param func The function to apply.
+ * @param timeout
+ * @return {(function(...[*]): void)|*}
*/
export const debounce = ( func, timeout = 500 ) => {
let timer;
@@ -145,9 +145,9 @@ export const debounce = ( func, timeout = 500 ) => {
/**
* Converts HEX colors to HSL.
*
- * @param color
- * @param asArray
- * @returns {string|array}
+ * @param color
+ * @param asArray
+ * @return {string | Array}
*/
export const rgb2hsl = ( color, asArray = true ) => {
const rgb = color.substring( 4, color.length - 1 )
@@ -161,8 +161,8 @@ export const rgb2hsl = ( color, asArray = true ) => {
const max = Math.max( r, g, b );
const min = Math.min( r, g, b );
- let h, s,
- l = ( max + min ) / 2;
+ let h, s;
+ const l = ( max + min ) / 2;
if ( max === min ) {
h = s = 0; // achromatic
@@ -190,7 +190,7 @@ export const rgb2hsl = ( color, asArray = true ) => {
* Scrolls the element into view if it's not fully visible.
*
* @param {HTMLElement} element The element to scroll into view.
- * @param {*} options The options for the scrollIntoView method.
+ * @param {*} options The options for the scrollIntoView method.
*/
export const scrollIntoViewIfNeeded = ( element, options = {}) => {
if ( ! element ) {
diff --git a/src/blocks/helpers/google-fonts.js b/src/blocks/helpers/google-fonts.js
index 453aed705..d1e502199 100644
--- a/src/blocks/helpers/google-fonts.js
+++ b/src/blocks/helpers/google-fonts.js
@@ -32,7 +32,7 @@ class GoogleFontsLoader {
/**
* The the loader after is loaded.
*
- * @returns {Promise}
+ * @return {Promise}
*/
async afterLoading() {
await this.requestFonts();
@@ -43,7 +43,7 @@ class GoogleFontsLoader {
* Get the font.
*
* @param {string} fontName The name of the font.
- * @returns {import('../components/google-fonts-control/types').GoogleFontItem}
+ * @return {import('../components/google-fonts-control/types').GoogleFontItem}
*/
getFont( fontName ) {
return this.fonts.find( font => font.family === fontName );
@@ -53,7 +53,7 @@ class GoogleFontsLoader {
* Get the variants of the font.
*
* @param {string} fontName The name of the font.
- * @returns {{label: string, value: string}[]}
+ * @return {{label: string, value: string}[]}
*/
getVariants( fontName ) {
const font = this.getFont( fontName );
@@ -74,8 +74,8 @@ class GoogleFontsLoader {
* Load the font to brower document. Can inject to an iframe.
*
* @param {string} fontName The name of the font.
- * @param {string} variant The font variant.
- * @returns {Promise}
*/
async loadFontToBrowser( fontName, variant = 'regular' ) {
if ( ! fontName ) {
@@ -104,7 +104,7 @@ class GoogleFontsLoader {
* Make a request to get the font list.
*
* @param {boolen} force Force the request to trigger again.
- * @returns {Promise>} Return the result or the request that is in pending.
+ * @return {Promise>} Return the result or the request that is in pending.
*/
async requestFonts( force = false ) {
if ( 'done' === this.status ) {
@@ -184,8 +184,8 @@ class GoogleFontsLoader {
* Add Google Font font link to the document.
*
* @param {string} fontName The name of the font.
- * @param {string} text The text to preview.
- * @returns
+ * @param {string} text The text to preview.
+ * @return {void}
*/
addPreviewFont( fontName, text ) {
diff --git a/src/blocks/helpers/helper-functions.js b/src/blocks/helpers/helper-functions.js
index 98b3eb32b..507019a40 100644
--- a/src/blocks/helpers/helper-functions.js
+++ b/src/blocks/helpers/helper-functions.js
@@ -1,10 +1,7 @@
import { isEmpty, merge, set, unset, without, omitBy, isObjectLike, isString, isNumber, isNil, cloneDeep } from 'lodash';
-import { sprintf } from '@wordpress/i18n';
-
+import { __, sprintf } from '@wordpress/i18n';
import { __experimentalGetSettings } from '@wordpress/date';
-
-import { __ } from '@wordpress/i18n';
import { makeBox } from '../plugins/copy-paste/utils';
// Post types to exclude
@@ -67,7 +64,7 @@ const excludedTypes = [
* HTML to Plaintext
*
* @param {HTMLElement} value
- * @returns {*}
+ * @return {*}
*/
export const unescapeHTML = value => {
const htmlNode = document.createElement( 'div' );
@@ -80,8 +77,8 @@ export const unescapeHTML = value => {
/**
* Decode HTML entities.
- * @param value
- * @returns {string}
+ * @param value
+ * @return {string}
*/
export const decodeHTMLEntities = value => {
const textArea = document.createElement( 'textarea' );
@@ -94,7 +91,7 @@ export const decodeHTMLEntities = value => {
* Format the date.
*
* @param {Date} date
- * @returns {string}
+ * @return {string}
*/
export const formatDate = date => {
const monthNames = [
@@ -114,7 +111,7 @@ export const formatDate = date => {
/**
* Get the custom post types from the post.
*
- * @returns {Promise}
+ * @return {Promise}
*/
export const getCustomPostTypeSlugs = async() => {
const dataTypes = window.themeisleGutenberg.postTypes;
@@ -131,7 +128,7 @@ export const getCustomPostTypeSlugs = async() => {
* Convert a word to title case.
*
* @param {string} word
- * @returns {string}
+ * @return {string}
*/
export const convertToTitleCase = ( word ) => {
if ( 'string' === typeof word || word instanceof String ) {
@@ -145,7 +142,7 @@ export const convertToTitleCase = ( word ) => {
*
* @param {Array} arr
* @param {any} item
- * @returns An array with the given item inserted between initial elements
+ * @return An array with the given item inserted between initial elements
*/
export const insertBetweenItems = ( arr, item ) => {
const _arr = [];
@@ -163,30 +160,30 @@ export const insertBetweenItems = ( arr, item ) => {
/**
* Get site's timezone.
*
- * @returns {*}
+ * @return {*}
*/
export const getTimezone = () => {
const settings = __experimentalGetSettings();
const offset = 60 * settings.timezone.offset;
const sign = 0 > offset ? '-' : '+';
const absmin = Math.abs( offset );
- const timezone = sprintf( '%s%02d:%02d', sign, absmin / 60, absmin % 60 );
+ const timezone = sprintf( '%1$s%2$02d:%3$02d', sign, absmin / 60, absmin % 60 );
return timezone;
};
/**
* Check if object has only null values.
*
- * @param obj
- * @returns {boolean}
+ * @param obj
+ * @return {boolean}
*/
export const isNullObject = obj => ! Object.keys( obj ).some( k => null !== obj[ k ]);
/**
* Check if object has only undefined values.
*
- * @param obj
- * @returns {this is unknown[]}
+ * @param obj
+ * @return {this is unknown[]}
*/
export const isUndefinedObject = obj => Object.values( obj ).every( l => l === undefined );
@@ -199,7 +196,7 @@ export const isUndefinedObject = obj => Object.values( obj ).every( l => l === u
*
* @param {number} value
* @param {string} unit
- * @returns {string|undefined}
+ * @return {string|undefined}
*/
export const _unit = ( value, unit ) => ( isNumber( value ) ? value + unit : value );
@@ -207,7 +204,7 @@ export const _unit = ( value, unit ) => ( isNumber( value ) ? value + unit : val
* Format the value into a `px` unit.
*
* @param {any} value The value.
- * @returns {string|undefined}
+ * @return {string|undefined}
*/
export const _px = value => _unit( value, 'px' );
@@ -215,7 +212,7 @@ export const _px = value => _unit( value, 'px' );
* Format the value into a `em` unit.
*
* @param {any} value The value.
- * @returns {string|undefined}
+ * @return {string|undefined}
*/
export const _em = value => _unit( value, 'em' );
@@ -223,15 +220,15 @@ export const _em = value => _unit( value, 'em' );
* Format the value into a `%` unit.
*
* @param {any} value The value.
- * @returns {string|undefined}
+ * @return {string|undefined}
*/
export const _percent = value => _unit( value, '%' );
/**
* Make a box type from a number or an object with Box like props.
- * @param {Object|number|undefined} value
+ * @param {Object|number|undefined} value
* @param {import('./blocks').BoxType?} defaultValue
- * @returns {import('./blocks').BoxType}
+ * @return {import('./blocks').BoxType}
*/
export const objectOrNumberAsBox = ( value, defaultValue = undefined ) => {
if ( isNumber( value ) ) {
@@ -262,7 +259,7 @@ const verticalMapping = {
* Get the CSS value for the given value position.
*
* @param {string} value The position type.
- * @returns {string|undefined}
+ * @return {string|undefined}
*/
export const _align = value =>{
return verticalMapping[value];
@@ -270,6 +267,7 @@ export const _align = value =>{
/**
* Get parameter from the URL.
+ * @param queryString
*/
export const getObjectFromQueryString = queryString => {
if ( -1 < queryString.indexOf( '?' ) ) {
@@ -291,6 +289,7 @@ export const getObjectFromQueryString = queryString => {
/**
* Object to Query String.
+ * @param params
*/
export const getQueryStringFromObject = params => Object.keys( params ).map( key => key + '=' + params[key]).join( '&' );
@@ -298,7 +297,7 @@ export const getQueryStringFromObject = params => Object.keys( params ).map( key
* Return the value of pair [condition, value] which has the first true condition.
*
* @param {([bool, any]|[any])[]} arr
- * @returns {*}
+ * @return {*}
*/
export const getChoice = arr => {
const r = arr?.filter( x => x?.[0])?.[0];
@@ -308,9 +307,9 @@ export const getChoice = arr => {
/**
* Converts HEX colors to RGBA.
*
- * @param color
- * @param alpha
- * @returns {string}
+ * @param color
+ * @param alpha
+ * @return {string}
*/
export const hex2rgba = ( color, alpha = 100 ) => {
if ( ! color ) {
@@ -328,8 +327,8 @@ export const hex2rgba = ( color, alpha = 100 ) => {
/**
* Check if color is a dark.
*
- * @param color
- * @returns {string|boolean}
+ * @param color
+ * @return {string|boolean}
*/
export const lightnessFromColor = color => {
if ( ! color ) {
@@ -411,13 +410,13 @@ const mapViewToKey = {
/**
* Helper function to add proper utm.
- * @param {string} url Url to add utms.
- * @param {string} linkArea Descriptive name of the link
- * @param {string} content Content of the link
- * @returns {string}
+ * @param {string} urlAddress Url to add utms.
+ * @param {string} linkArea Descriptive name of the link
+ * @param {string} content Content of the link
+ * @return {string}
*/
-export const setUtm = ( urlAdress, linkArea, content ) => {
- const urlLink = new URL( urlAdress );
+export const setUtm = ( urlAddress, linkArea, content ) => {
+ const urlLink = new URL( urlAddress );
urlLink.searchParams.set( 'utm_campaign', linkArea );
if ( content ) {
@@ -430,10 +429,10 @@ export const setUtm = ( urlAdress, linkArea, content ) => {
/**
* Build a responsive wrapper around `setAttributes`
*
- * @param {Function} setAttributes The function that set the attributes.
- * @param {'Desktop'|'Tablet'|'Mobile'} currentView The current view.
+ * @param {Function} setAttributes The function that set the attributes.
+ * @param {'Desktop'|'Tablet'|'Mobile'} currentView The current view.
* @template T
- * @returns {(value: T, keys: string[], oldAttr: Object) => void}) => void}
+ * @return {(value: T, keys: string[], oldAttr: Object) => void}) => void}
*/
export const buildResponsiveSetAttributes = ( setAttributes, currentView ) => {
return ( value, keys, oldAttr = {}) => {
@@ -452,9 +451,9 @@ export const buildResponsiveSetAttributes = ( setAttributes, currentView ) => {
*
* @param {'Desktop'|'Tablet'|'Mobile'} currentView The current view.
* @param {'Desktop'|'Tablet'|'Mobile'} defaultView If the value of the current view is undefined or null, fallback to this view.
- * @param {boolean} cascade Inherit from previous view. Mobile from Tablet, Tablet from Desktop.
+ * @param {boolean} cascade Inherit from previous view. Mobile from Tablet, Tablet from Desktop.
* @template T
- * @returns { (values: T[]) => T}
+ * @return { (values: T[]) => T}
*/
export const buildResponsiveGetAttributes = ( currentView, defaultView = 'Desktop', cascade = true ) => {
return values => {
@@ -469,9 +468,9 @@ export const buildResponsiveGetAttributes = ( currentView, defaultView = 'Deskto
* Get Active Style Name.
*
* @param { import('./blocks').BlockStyle[] } styles Block styles.
- * @param { string | undefined } className Classes of the block.
+ * @param { string | undefined } className Classes of the block.
*
- * @returns { string }
+ * @return { string }
*/
export const getActiveStyle = ( styles, className ) => {
const classes = className?.split( ' ' ) || [];
@@ -497,7 +496,7 @@ export const getActiveStyle = ( styles, className ) => {
* Replaces the active style in the block's className.
*
* @param { string | undefined } className Class name.
- * @param { Object } styles Block styles.
+ * @param { Object } styles Block styles.
* @param { string | undefined } newStyle The replacing style.
*
* @return { string } The updated className.
@@ -520,17 +519,17 @@ export const changeActiveStyle = ( className, styles, newStyle ) =>{
/**
* Create a CSS property declaration.
- * @param {string} prop The name of the property.
- * @param {string | undefined | null} value The value.
+ * @param {string} prop The name of the property.
+ * @param {string | undefined | null} value The value.
* @param { ((c: any) => boolean) | boolean | undefined } condition The condition.
- * @returns
+ * @return
*/
export const _cssProp = ( prop, value, condition = undefined ) => value !== undefined && null !== value && ( condition === undefined || ( 'function' === typeof condition ? condition( value ) : condition ) ) ? `${prop}: ${value};` : undefined;
/**
* Create a CSS block declaration.
* @param {[string, string, ((c: any) => boolean | boolean | undefined) | undefined][]} propsPairs The properties grouped in pairs
- * @returns
+ * @return
*/
export const _cssBlock = ( propsPairs ) => `{\n${
propsPairs
@@ -542,7 +541,7 @@ export const _cssBlock = ( propsPairs ) => `{\n${
/**
* Wrap a given string in a box object.
* @param {string|any} s The value.
- * @returns {import('./blocks').BoxType|any}
+ * @return {import('./blocks').BoxType|any}
*/
export const stringToBox = ( s ) => {
if ( ! isString( s ) ) {
@@ -560,7 +559,7 @@ export const stringToBox = ( s ) => {
/**
* Make a box intro a CSS string. If it is a string, wrap it into a box.
* @param {string|import('./blocks').BoxType | undefined} box The box.
- * @returns
+ * @return
*/
export const boxToCSS = ( box ) => {
if ( box === undefined ) {
@@ -574,7 +573,7 @@ export const boxToCSS = ( box ) => {
/**
* Print the given value then return it. Usefull for debugging.
* @param {any} x
- * @returns
+ * @return
*/
export const _i = x => {
console.log( x );
@@ -584,7 +583,7 @@ export const _i = x => {
/**
* Helper function to remove empty props objects recursivly in a distructive way.
* @param {Object} o The object.
- * @returns {Object | undefined}
+ * @return {Object | undefined}
*/
export const _compactObject = ( o ) => {
if ( ! isObjectLike( o ) ) {
@@ -610,7 +609,7 @@ export const _compactObject = ( o ) => {
/**
* Remove empty props objects recursivly.
* @param {Object} o The object.
- * @returns {Object | undefined}
+ * @return {Object | undefined}
*/
export const compactObject = ( o ) => {
return _compactObject( cloneDeep( o ) );
@@ -618,9 +617,9 @@ export const compactObject = ( o ) => {
/**
* Utility function for rendering to CSS legacy value that were numbers before converting it to a box value type.
- * @param {string|import('./blocks').BoxType | number | undefined} box The box to render.
- * @param {string} unit The unit to add if the box is a number.
- * @returns
+ * @param {string|import('./blocks').BoxType | number | undefined} box The box to render.
+ * @param {string} unit The unit to add if the box is a number.
+ * @return
*/
export const renderBoxOrNumWithUnit = ( box, unit ) => {
if ( isNumber( box ) ) {
@@ -632,9 +631,9 @@ export const renderBoxOrNumWithUnit = ( box, unit ) => {
/**
* If the given value is a number, transform it into a Box Value with the given unit. Otherwise, return the value.
*
- * @param {number | any} n The number to convert.
- * @param {string?} unit The unit to add.
- * @returns {import('./blocks').BoxType | any} The box value or given value.
+ * @param {number | any} x The number to convert.
+ * @param {string?} unit The unit to add.
+ * @return {import('./blocks').BoxType | any} The box value or given value.
*/
export const numberToBox = ( x, unit = 'px' ) => isNumber( x ) ? stringToBox( _unit( x, unit ) ) : x;
@@ -666,7 +665,7 @@ export function isAppleOS( _window = null ) {
* Check if a box value is empty.
*
* @param {import('./blocks').BoxType | undefined} box The box.
- * @returns {boolean}
+ * @return {boolean}
*/
export const isEmptyBox = ( box ) => {
return ! ( box?.top !== undefined && box?.right !== undefined && box?.bottom !== undefined && box?.left !== undefined );
@@ -676,8 +675,8 @@ export const isEmptyBox = ( box ) => {
* Get the saved state for the given key from global scope (window).
*
* @param {string} key
- * @param {any} defaultValue
- * @returns
+ * @param {any} defaultValue
+ * @return
*/
export const pullSavedState = ( key, defaultValue ) => {
if ( key === undefined ) {
@@ -691,8 +690,8 @@ export const pullSavedState = ( key, defaultValue ) => {
* Save a value in global scope (window) for the given key.
*
* @param {string} key
- * @param {any} value
- * @returns
+ * @param {any} value
+ * @return {void}
*/
export const setSavedState = ( key, value ) => {
if ( key === undefined ) {
@@ -706,10 +705,10 @@ export const setSavedState = ( key, value ) => {
/**
* Find the blocks that match the given condition.
*
- * @param {import('./blocks').OtterBlock[]} innerBlocks The inner blocks.
- * @param {(block: import('./blocks').OtterBlock) => boolean} condition The condition.
+ * @param {import('./blocks').OtterBlock[]} innerBlocks The inner blocks.
+ * @param {(block: import('./blocks').OtterBlock) => boolean} condition The condition.
* @param {(block: import('./blocks').OtterBlock) => boolean} nestingCondition The condition that allow to go deeper in the tree.
- * @returns {import('./blocks').OtterBlock[]} The blocks that match the condition.
+ * @return {import('./blocks').OtterBlock[]} The blocks that match the condition.
*/
export const findInnerBlocks = ( innerBlocks, condition, nestingCondition = x => x ) => {
if ( innerBlocks === undefined || condition === undefined ) {
diff --git a/src/blocks/helpers/icons.js b/src/blocks/helpers/icons.js
index 5c31989d3..e2a9176a8 100644
--- a/src/blocks/helpers/icons.js
+++ b/src/blocks/helpers/icons.js
@@ -632,7 +632,7 @@ export const popupWithForm = (
);
export const popupWithImageAndText = (
-
+
diff --git a/src/blocks/helpers/prompt.ts b/src/blocks/helpers/prompt.ts
index 5927e4907..f0b2d57c1 100644
--- a/src/blocks/helpers/prompt.ts
+++ b/src/blocks/helpers/prompt.ts
@@ -113,7 +113,7 @@ function promptRequestBuilder( settings?: OpenAiSettings ) {
};
function removeOtterKeys( obj ) {
- for ( let key in obj ) {
+ for ( const key in obj ) {
if ( key.startsWith( 'otter_' ) ) {
delete obj[key];
}
@@ -180,12 +180,12 @@ const fieldMapping = {
* Small helper to try to parse a prompt response without throwing an error.
*
* @param promptResponse - The prompt response to parse.
- * @returns - The parsed response or undefined.
+ * @return - The parsed response or undefined.
*/
export function tryParseResponse( promptResponse: string ) {
try {
return JSON.parse( promptResponse );
- } catch ( e ) {
+ } catch {
return undefined;
}
}
@@ -194,7 +194,7 @@ export function tryParseResponse( promptResponse: string ) {
* Create a block from a form prompt response.
*
* @param promptResponse - The prompt response to parse.
- * @returns - An array of blocks Form field blocks.
+ * @return - An array of blocks Form field blocks.
*/
export function parseFormPromptResponseToBlocks( promptResponse: string ) {
if ( ! promptResponse ) {
@@ -227,7 +227,7 @@ export function parseFormPromptResponseToBlocks( promptResponse: string ) {
* Retrieves an embedded prompt from the server.
*
* @param promptName - The name of the prompt to retrieve. If not provided, the default prompt is retrieved.
- * @returns - A promise that resolves to the server's response.
+ * @return - A promise that resolves to the server's response.
*/
export function retrieveEmbeddedPrompt( promptName ?: string ) {
return apiFetch({
@@ -242,8 +242,8 @@ export function retrieveEmbeddedPrompt( promptName ?: string ) {
* This function injects an action into an existing prompt.
*
* @param embeddedPrompt - The existing prompt data.
- * @param actionPrompt - The action to be injected.
- * @returns - The updated prompt data with the action injected.
+ * @param actionPrompt - The action to be injected.
+ * @return - The updated prompt data with the action injected.
*/
export function injectActionIntoPrompt( embeddedPrompt: PromptData, actionPrompt: string ): PromptData {
return {
@@ -265,8 +265,8 @@ export function injectActionIntoPrompt( embeddedPrompt: PromptData, actionPrompt
* This function injects a conversation into an existing prompt.
*
* @param embeddedPrompt - The existing prompt data.
- * @param conversation - The conversation to be injected.
- * @returns - The updated prompt data with the conversation injected.
+ * @param conversation - The conversation to be injected.
+ * @return - The updated prompt data with the conversation injected.
*/
export function injectConversationIntoPrompt( embeddedPrompt: PromptData, conversation: PromptConversation ): PromptData {
@@ -291,8 +291,8 @@ export function injectConversationIntoPrompt( embeddedPrompt: PromptData, conver
* Injects content into a template. If no match is found, adds the content at the end.
*
* @param template The template to inject into.
- * @param content The content to inject.
- * @returns The template with the content injected or appended.
+ * @param content The content to inject.
+ * @return The template with the content injected or appended.
*/
export function tryInjectIntoTemplate( template: string, content: string ): string {
if ( ! template ) {
@@ -308,8 +308,8 @@ export function tryInjectIntoTemplate( template: string, content: string ): stri
* Edits the last conversation in the prompt data.
*
* @param embeddedPrompt The existing prompt data.
- * @param content The content to be injected.
- * @returns The updated prompt data with the last conversation edited.
+ * @param callback The callback that returns the content to be injected.
+ * @return The updated prompt data with the last conversation edited.
*/
export function editLastConversation( embeddedPrompt: PromptData, callback: ( currentContent?: string ) => string ): PromptData {
const { messages } = embeddedPrompt;
diff --git a/src/blocks/helpers/use-settings.js b/src/blocks/helpers/use-settings.js
index 710bda3de..0d94f454b 100644
--- a/src/blocks/helpers/use-settings.js
+++ b/src/blocks/helpers/use-settings.js
@@ -26,8 +26,7 @@ import { useState } from '@wordpress/element';
* @see https://github.com/WordPress/gutenberg/blob/trunk/packages/editor/src/components/editor-snackbars/index.js
* @author Hardeep Asrani
* @version 1.1
- * @returns {[(optionName: string) => any, (option: string, value: any, success?: string, noticeId?: string, onSuccess: Function) => void, 'loading' | 'loaded' | 'error' | 'saving']} [ getOption, updateOption, status ]
- *
+ * @return {[(optionName: string) => any, (option: string, value: any, success?: string, noticeId?: string, onSuccess: Function) => void, 'loading' | 'loaded' | 'error' | 'saving']} [ getOption, updateOption, status ]
*/
let updatedSettings = {};
const useSettings = () => {
@@ -37,13 +36,13 @@ const useSettings = () => {
const [ settings, setSettings ] = useState({});
useSelect( select => {
- const { getEntityRecord } = select( 'core' );
-
+
// Bail out if settings are already loaded.
if ( Object.keys( settings ).length ) {
return;
}
-
+
+ const { getEntityRecord } = select( 'core' );
const request = getEntityRecord( 'root', 'site' );
if ( request ) {
@@ -56,7 +55,7 @@ const useSettings = () => {
* Get the value of the given option.
*
* @param {string} option Option name.
- * @returns {any} Option value.
+ * @return {any} Option value.
*/
const getOption = option => {
return updatedSettings?.[option] || settings?.[option];
@@ -65,12 +64,12 @@ const useSettings = () => {
/**
* Set the value of the given option. Also set the message to be displayed on success Notice.
*
- * @param {string} option Option name.
- * @param {any} value Option value.
- * @param {string?} success Success message for Notice.
- * @param {string?} noticeId Notice ID.
- * @param {function?} onSuccess Callback function to be executed on success.
- * @param {function?} onError Callback function to be executed on error.
+ * @param {string} option Option name.
+ * @param {any} value Option value.
+ * @param {string?} success Success message for Notice.
+ * @param {string?} noticeId Notice ID.
+ * @param {Function?} onSuccess Callback function to be executed on success.
+ * @param {Function?} onError Callback function to be executed on error.
*/
const updateOption = ( option, value, success = __( 'Settings saved.', 'otter-blocks' ), noticeId = undefined, onSuccess = () => {}, onError = () => {}) => {
setStatus( 'saving' );
diff --git a/src/blocks/helpers/utility-hooks.js b/src/blocks/helpers/utility-hooks.js
index 37c2fee7c..86805b688 100644
--- a/src/blocks/helpers/utility-hooks.js
+++ b/src/blocks/helpers/utility-hooks.js
@@ -30,10 +30,10 @@ export const useResponsiveAttributes = ( setAttributes = () => {}) => useSelect(
* Utility hook to get/set dark background class.
*
* @param {string|false|undefined} backgroundColor - The background color.
- * @param {Object} attributes - The block attributes.
- * @param {Function} setAttributes - The setAttributes function from the block.
- * @param {string} darkClassName - The dark-bg class name to add/remove.
- * @param {string} lightClassName - The light-bg class name to add/remove.
+ * @param {Object} attributes - The block attributes.
+ * @param {Function} setAttributes - The setAttributes function from the block.
+ * @param {string} darkClassName - The dark-bg class name to add/remove.
+ * @param {string} lightClassName - The light-bg class name to add/remove.
*/
export const useDarkBackground = ( backgroundColor, attributes, setAttributes, darkClassName = 'has-dark-bg', lightClassName = 'has-light-bg' ) => {
useEffect( () => {
diff --git a/src/blocks/index.js b/src/blocks/index.js
index 9b960a7a9..0785a0e14 100644
--- a/src/blocks/index.js
+++ b/src/blocks/index.js
@@ -108,8 +108,8 @@ const hideBlocksInInserter = () => {
/**
* Check if the block is a variation.
- * @param blockSlug The block slug.
- * @returns {boolean} True if the block is a variation.
+ * @param blockSlug The block slug.
+ * @return {boolean} True if the block is a variation.
*/
const isVariation = ( blockSlug ) => {
return variationsMap.hasOwnProperty( blockSlug );
diff --git a/src/blocks/plugins/ai-content/index.tsx b/src/blocks/plugins/ai-content/index.tsx
index cb200ed04..4445b76a0 100644
--- a/src/blocks/plugins/ai-content/index.tsx
+++ b/src/blocks/plugins/ai-content/index.tsx
@@ -33,7 +33,7 @@ import { PromptsData, editLastConversation, injectActionIntoPrompt, retrieveEmbe
import useSettings from '../../helpers/use-settings';
import { openAiAPIKeyName } from '../../components/prompt';
import { insertBlockBelow } from '../../helpers/block-utility';
-import { BlockProps } from '../../helpers/blocks';
+import type { BlockProps } from '../../helpers/blocks';
const isValidBlock = ( blockName: string|undefined ) => {
if ( ! blockName ) {
diff --git a/src/blocks/plugins/conditions/edit.js b/src/blocks/plugins/conditions/edit.js
index b2e0ee471..6fe20cce1 100644
--- a/src/blocks/plugins/conditions/edit.js
+++ b/src/blocks/plugins/conditions/edit.js
@@ -42,23 +42,23 @@ const defaultConditions = {
{
value: 'loggedInUser',
label: __( 'Logged In Users', 'otter-blocks' ),
- help: __( 'The selected block will only be visible to logged-in users.' )
+ help: __( 'The selected block will only be visible to logged-in users.', 'otter-blocks' )
},
{
value: 'loggedOutUser',
label: __( 'Logged Out Users', 'otter-blocks' ),
- help: __( 'The selected block will only be visible to logged-out users.' )
+ help: __( 'The selected block will only be visible to logged-out users.', 'otter-blocks' )
},
{
value: 'userRoles',
label: __( 'User Roles', 'otter-blocks' ),
- help: __( 'The selected block will be visible based on user roles.' ),
+ help: __( 'The selected block will be visible based on user roles.', 'otter-blocks' ),
toogleVisibility: true
},
{
value: 'loggedInUserMeta',
label: __( 'Logged-in User Meta (Pro)', 'otter-blocks' ),
- help: __( 'The selected block will be visible based on meta of the logged-in user condition.' ),
+ help: __( 'The selected block will be visible based on meta of the logged-in user condition.', 'otter-blocks' ),
isDisabled: true
}
]
@@ -69,31 +69,31 @@ const defaultConditions = {
{
value: 'postAuthor',
label: __( 'Post Author', 'otter-blocks' ),
- help: __( 'The selected block will be visible based on post author.' ),
+ help: __( 'The selected block will be visible based on post author.', 'otter-blocks' ),
toogleVisibility: true
},
{
value: 'postType',
label: __( 'Post Type', 'otter-blocks' ),
- help: __( 'The selected block will be visible if post becomes to one of the selected post types.' ),
+ help: __( 'The selected block will be visible if post becomes to one of the selected post types.', 'otter-blocks' ),
toogleVisibility: true
},
{
value: 'postCategory',
label: __( 'Post Category', 'otter-blocks' ),
- help: __( 'The selected block will be visible based on selected post categories.' ),
+ help: __( 'The selected block will be visible based on selected post categories.', 'otter-blocks' ),
toogleVisibility: true
},
{
value: 'postTag',
label: __( 'Post Tag', 'otter-blocks' ),
- help: __( 'The selected block will be visible based on selected post tags.' ),
+ help: __( 'The selected block will be visible based on selected post tags.', 'otter-blocks' ),
toogleVisibility: true
},
{
value: 'postMeta',
label: __( 'Post Meta (Pro)', 'otter-blocks' ),
- help: __( 'The selected block will be visible based on post meta condition.' ),
+ help: __( 'The selected block will be visible based on post meta condition.', 'otter-blocks' ),
isDisabled: true
}
]
@@ -104,19 +104,19 @@ const defaultConditions = {
{
value: 'dateRange',
label: __( 'Date Range (Pro)', 'otter-blocks' ),
- help: __( 'The selected block will be visible based on the date range. Timezone is used based on your WordPress settings.' ),
+ help: __( 'The selected block will be visible based on the date range. Timezone is used based on your WordPress settings.', 'otter-blocks' ),
isDisabled: true
},
{
value: 'dateRecurring',
label: __( 'Date Recurring (Pro)', 'otter-blocks' ),
- help: __( 'The selected block will be visible based on the selected days. Timezone is used based on your WordPress settings.' ),
+ help: __( 'The selected block will be visible based on the selected days. Timezone is used based on your WordPress settings.', 'otter-blocks' ),
isDisabled: true
},
{
value: 'timeRecurring',
label: __( 'Time Recurring (Pro)', 'otter-blocks' ),
- help: __( 'The selected block will be visible during the selected time. Timezone is used based on your WordPress settings.' ),
+ help: __( 'The selected block will be visible during the selected time. Timezone is used based on your WordPress settings.', 'otter-blocks' ),
isDisabled: true
}
]
@@ -127,25 +127,25 @@ const defaultConditions = {
{
value: 'screenSize',
label: __( 'Screen Size', 'otter-blocks' ),
- help: __( 'The selected block will be invisible based on the screen size.' ),
+ help: __( 'The selected block will be invisible based on the screen size.', 'otter-blocks' ),
toggleVisibility: true
},
{
value: 'queryString',
label: __( 'Query String (Pro)', 'otter-blocks' ),
- help: __( 'The condition will be met if the URL contains specified parameters.' ),
+ help: __( 'The condition will be met if the URL contains specified parameters.', 'otter-blocks' ),
isDisabled: true
},
{
value: 'country',
label: __( 'Country (Pro)', 'otter-blocks' ),
- help: __( 'The selected block will be visible based on user\'s country based on the IP address.' ),
+ help: __( 'The selected block will be visible based on user\'s country based on the IP address.', 'otter-blocks' ),
isDisabled: true
},
{
value: 'cookie',
label: __( 'Cookie (Pro)', 'otter-blocks' ),
- help: __( 'The selected block will be visible based on PHP cookies.' ),
+ help: __( 'The selected block will be visible based on PHP cookies.', 'otter-blocks' ),
isDisabled: true
}
]
@@ -156,25 +156,25 @@ const defaultConditions = {
{
value: 'wooProductsInCart',
label: __( 'Products in Cart (Pro)', 'otter-blocks' ),
- help: __( 'The selected block will be visible based on the products added to WooCommerce cart.' ),
+ help: __( 'The selected block will be visible based on the products added to WooCommerce cart.', 'otter-blocks' ),
isDisabled: true
},
{
value: 'wooTotalCartValue',
label: __( 'Total Cart Value (Pro)', 'otter-blocks' ),
- help: __( 'The selected block will be visible based on the total value of WooCommerce cart.' ),
+ help: __( 'The selected block will be visible based on the total value of WooCommerce cart.', 'otter-blocks' ),
isDisabled: true
},
{
value: 'wooPurchaseHistory',
label: __( 'Purchase History (Pro)', 'otter-blocks' ),
- help: __( 'The selected block will be visible based on user\'s WooCommerce purchase history.' ),
+ help: __( 'The selected block will be visible based on user\'s WooCommerce purchase history.', 'otter-blocks' ),
isDisabled: true
},
{
value: 'wooTotalSpent',
label: __( 'Total Spent (Pro)', 'otter-blocks' ),
- help: __( 'The selected block will be visible based on how much the user spent during lifetime.' ),
+ help: __( 'The selected block will be visible based on how much the user spent during lifetime.', 'otter-blocks' ),
isDisabled: true
}
]
@@ -185,19 +185,19 @@ const defaultConditions = {
{
value: 'wooCategory',
label: __( 'Product Category (Pro)', 'otter-blocks' ),
- help: __( 'The selected block will be visible based on the product category.' ),
+ help: __( 'The selected block will be visible based on the product category.', 'otter-blocks' ),
isDisabled: true
},
{
value: 'wooTag',
label: __( 'Product Tag (Pro)', 'otter-blocks' ),
- help: __( 'The selected block will be visible based on the product tag.' ),
+ help: __( 'The selected block will be visible based on the product tag.', 'otter-blocks' ),
isDisabled: true
},
{
value: 'wooAttribute',
label: __( 'Product Attribute (Pro)', 'otter-blocks' ),
- help: __( 'The selected block will be visible based on the product attribute.' ),
+ help: __( 'The selected block will be visible based on the product attribute.', 'otter-blocks' ),
isDisabled: true
}
]
@@ -208,7 +208,7 @@ const defaultConditions = {
{
value: 'stripePurchaseHistory',
label: __( 'Purchase History', 'otter-blocks' ),
- help: __( 'The selected block will be visible based on user\'s Stripe purchase history.' ),
+ help: __( 'The selected block will be visible based on user\'s Stripe purchase history.', 'otter-blocks' ),
toogleVisibility: true
}
]
@@ -219,13 +219,13 @@ const defaultConditions = {
{
value: 'learnDashPurchaseHistory',
label: __( 'Purchase History (Pro)', 'otter-blocks' ),
- help: __( 'The selected block will be visible based on user\'s LearnDash purchase history.' ),
+ help: __( 'The selected block will be visible based on user\'s LearnDash purchase history.', 'otter-blocks' ),
isDisabled: true
},
{
value: 'learnDashCourseStatus',
label: __( 'Course Status (Pro)', 'otter-blocks' ),
- help: __( 'The selected block will be visible based on user\'s LearnDash course status.' ),
+ help: __( 'The selected block will be visible based on user\'s LearnDash course status.', 'otter-blocks' ),
isDisabled: true
}
]
@@ -451,10 +451,10 @@ const Edit = ({
/**
* Change the value of the condition in the nested array.
*
- * @param {any} value The value to set.
+ * @param {any} value The value to set.
* @param {number} index The index of the group.
- * @param {number} key The index of the condition.
- * @param {string} type The type of the condition.
+ * @param {number} key The index of the condition.
+ * @param {string} type The type of the condition.
*/
const changeArrayValue = ( value, index, key, type ) => {
const otterConditions = [ ...attributes.otterConditions ];
@@ -481,10 +481,10 @@ const Edit = ({
/**
* Toggle the value of the condition in the nested array.
*
- * @param {any} value The value to set.
+ * @param {any} value The value to set.
* @param {number} index The index of the group.
- * @param {number} key The index of the condition.
- * @param {string} type The type of the condition.
+ * @param {number} key The index of the condition.
+ * @param {string} type The type of the condition.
*/
const toggleValueInArray = ( value, index, key, type ) => {
const otterConditions = [ ...attributes.otterConditions ];
diff --git a/src/blocks/plugins/copy-paste/adaptors.ts b/src/blocks/plugins/copy-paste/adaptors.ts
index f43013fad..1a7f43a5c 100644
--- a/src/blocks/plugins/copy-paste/adaptors.ts
+++ b/src/blocks/plugins/copy-paste/adaptors.ts
@@ -1,29 +1,28 @@
import { omit, pick, pickBy, isNumber, isObjectLike } from 'lodash';
-import { SectionAttrs } from '../../blocks/section/columns/types';
-import { Storage } from './models';
-import { coreAdaptors } from './core-adaptors';
-import { ColumnAttrs } from '../../blocks/section/column/types';
-import { ButtonGroupAttrs } from '../../blocks/button-group/group/types';
-import { ButtonAttrs } from '../../blocks/button-group/button/types';
-import { addUnit, getInt, makeBox, getSingleValueFromBox, createBoxFrom } from './utils';
-import { IconAttrs } from '../../blocks/font-awesome-icons/types';
-import { IconListAttrs } from '../../blocks/icon-list/types';
-import { IconListItemAttrs } from '../../blocks/icon-list/item/types';
+import type { SectionAttrs } from '../../blocks/section/columns/types';
+import type { Storage } from './models';
+import type { ColumnAttrs } from '../../blocks/section/column/types';
+import type { ButtonGroupAttrs } from '../../blocks/button-group/group/types';
+import type { ButtonAttrs } from '../../blocks/button-group/button/types';
+import { addUnit, getInt, makeBox, getSingleValueFromBox } from './utils';
+import type { IconAttrs } from '../../blocks/font-awesome-icons/types';
+import type { IconListAttrs } from '../../blocks/icon-list/types';
+import type { IconListItemAttrs } from '../../blocks/icon-list/item/types';
import { getChoice, objectOrNumberAsBox, _px } from '../../helpers/helper-functions';
-import { AccordionGroupAttrs } from '../../blocks/accordion/group/types';
-import { ProgressAttrs } from '../../blocks/progress-bar/types';
-import { TabsGroupAttrs } from '../../blocks/tabs/group/types';
-import { FlipAttrs } from '../../blocks/flip/types';
-import { FormAttrs } from '../../blocks/form/type';
-import { CircleCounterAttrs } from '../../blocks/circle-counter/types';
-import { ReviewAttrs } from '../../blocks/review/type';
-import { AdvancedHeadingAttrs } from '../../blocks/advanced-heading/types';
-import { CountdownAttrs } from '../../blocks/countdown/types';
-import { WooComparisonAttrs } from '../../../pro/blocks/woo-comparison/types';
-import { BusinessHoursItemAttrs } from '../../../pro/blocks/business-hours/item/types';
-import { BusinessHoursAttrs } from '../../../pro/blocks/business-hours/types';
-import { SharingIconsAttrs } from '../../blocks/sharing-icons/types';
-import { BoxType } from '../../helpers/blocks';
+import type { AccordionGroupAttrs } from '../../blocks/accordion/group/types';
+import type { ProgressAttrs } from '../../blocks/progress-bar/types';
+import type { TabsGroupAttrs } from '../../blocks/tabs/group/types';
+import type { FlipAttrs } from '../../blocks/flip/types';
+import type { FormAttrs } from '../../blocks/form/type';
+import type { CircleCounterAttrs } from '../../blocks/circle-counter/types';
+import type { ReviewAttrs } from '../../blocks/review/type';
+import type { AdvancedHeadingAttrs } from '../../blocks/advanced-heading/types';
+import type { CountdownAttrs } from '../../blocks/countdown/types';
+import type { WooComparisonAttrs } from '../../../pro/blocks/woo-comparison/types';
+import type { BusinessHoursItemAttrs } from '../../../pro/blocks/business-hours/item/types';
+import type { BusinessHoursAttrs } from '../../../pro/blocks/business-hours/types';
+import type { SharingIconsAttrs } from '../../blocks/sharing-icons/types';
+import type { BoxType } from '../../helpers/blocks';
export const adaptors = {
diff --git a/src/blocks/plugins/copy-paste/copy-paste.ts b/src/blocks/plugins/copy-paste/copy-paste.ts
index d450d1988..e6d2d69ff 100644
--- a/src/blocks/plugins/copy-paste/copy-paste.ts
+++ b/src/blocks/plugins/copy-paste/copy-paste.ts
@@ -1,8 +1,8 @@
import { isNil, pickBy } from 'lodash';
-import { OtterBlock } from '../../helpers/blocks';
+import type { OtterBlock } from '../../helpers/blocks';
import { compactObject } from '../../helpers/helper-functions';
import { adaptors } from './adaptors';
-import { CopyPasteStorage, Storage } from './models';
+import type { CopyPasteStorage, Storage } from './models';
import { copyAnimations, pasteAnimations } from './plugins';
@@ -59,7 +59,7 @@ class CopyPaste {
}
paste( block: OtterBlock ) {
- let pasted = undefined;
+ let pasted;
try {
if ( ! ( adaptors as Adaptors )?.[block.name]) {
return undefined;
diff --git a/src/blocks/plugins/copy-paste/core-adaptors.ts b/src/blocks/plugins/copy-paste/core-adaptors.ts
index ad9c548d5..33d1489e8 100644
--- a/src/blocks/plugins/copy-paste/core-adaptors.ts
+++ b/src/blocks/plugins/copy-paste/core-adaptors.ts
@@ -1,7 +1,7 @@
import { merge, pick } from 'lodash';
-import { BoxType } from '../../helpers/blocks';
+import type { BoxType } from '../../helpers/blocks';
import { getChoice } from '../../helpers/helper-functions';
-import { Storage } from './models';
+import type { Storage } from './models';
import { addUnit, getColorFromThemeStyles, getInt, getSingleValueFromBox, makeBox } from './utils';
const radiusExtract = ( radius: { topLeft: string; topRight: string; bottomRight: string; bottomLeft: string; }) => {
@@ -108,8 +108,9 @@ export const coreAdaptors = {
'core/columns': {
/**
- * https://github.com/WordPress/gutenberg/blob/0d60dbc6e1deb575ceced1b8ecaf50e295d8543a/packages/block-library/src/columns/block.json#L4
- */
+ * https://github.com/WordPress/gutenberg/blob/0d60dbc6e1deb575ceced1b8ecaf50e295d8543a/packages/block-library/src/columns/block.json#L4
+ * @param attrs
+ */
copy( attrs: any ): Storage {
return merge( commonExtractor( attrs ),
{
@@ -126,8 +127,9 @@ export const coreAdaptors = {
'core/column': {
/**
- * https://github.com/WordPress/gutenberg/blob/0d60dbc6e1deb575ceced1b8ecaf50e295d8543a/packages/block-library/src/column/block.json#
- */
+ * https://github.com/WordPress/gutenberg/blob/0d60dbc6e1deb575ceced1b8ecaf50e295d8543a/packages/block-library/src/column/block.json#
+ * @param attrs
+ */
copy( attrs: any ): Storage {
return merge( commonExtractor( attrs ),
{
@@ -150,8 +152,9 @@ export const coreAdaptors = {
'core/group': {
/**
- * https://github.com/WordPress/gutenberg/blob/trunk/packages/block-library/src/group/block.json
- */
+ * https://github.com/WordPress/gutenberg/blob/trunk/packages/block-library/src/group/block.json
+ * @param attrs
+ */
copy( attrs: any ): Storage {
return merge( commonExtractor( attrs ),
{
@@ -174,8 +177,9 @@ export const coreAdaptors = {
'core/paragraph': {
/**
- * https://github.com/WordPress/gutenberg/blob/trunk/packages/block-library/src/group/block.json
- */
+ * https://github.com/WordPress/gutenberg/blob/trunk/packages/block-library/src/group/block.json
+ * @param attrs
+ */
copy( attrs: any ): Storage {
return merge( commonExtractor( attrs ),
{
diff --git a/src/blocks/plugins/copy-paste/index.js b/src/blocks/plugins/copy-paste/index.js
index dfb641c85..81bdc652e 100644
--- a/src/blocks/plugins/copy-paste/index.js
+++ b/src/blocks/plugins/copy-paste/index.js
@@ -26,8 +26,8 @@ import { addFilter } from '@wordpress/hooks';
import { displayShortcut } from '@wordpress/keycodes';
/**
- * Internal dependencies.
- */
+ * Internal dependencies.
+ */
import { adaptors } from './adaptors';
import CopyPaste from './copy-paste';
import { extractThemeCSSVar } from './utils';
@@ -70,7 +70,7 @@ function copy() {
const { createNotice } = dispatch( 'core/notices' );
- if ( 0 < copied?.filter( x => 'SUCCESS' == x )?.length ) {
+ if ( 0 < copied?.filter( x => 'SUCCESS' === x )?.length ) {
createNotice(
'info',
__( 'Copied the styles.', 'otter-blocks' ),
@@ -80,7 +80,7 @@ function copy() {
id: 'o-copied-success'
}
);
- } else if ( 0 < copied?.filter( x => 'ERROR' == x )?.length ) {
+ } else if ( 0 < copied?.filter( x => 'ERROR' === x )?.length ) {
createNotice(
'error',
__( 'An error occurred when trying to copy the style.', 'otter-blocks' ),
@@ -133,7 +133,7 @@ const iconTextWrapper = ( text ) => (
/**
* Separate component to prevent multiple calls from filter.
*
- * @returns
+ * @return
*/
const CopyPasteComponent = ( ) => {
return (
diff --git a/src/blocks/plugins/copy-paste/utils.ts b/src/blocks/plugins/copy-paste/utils.ts
index fda6807b4..ff045dc49 100644
--- a/src/blocks/plugins/copy-paste/utils.ts
+++ b/src/blocks/plugins/copy-paste/utils.ts
@@ -1,20 +1,19 @@
-import { color } from '@wordpress/icons/build-types';
import { isNumber, isString } from 'lodash';
-import { BoxType } from '../../helpers/blocks';
+import type { BoxType } from '../../helpers/blocks';
/**
* Add unit to the given value if it is defined.
- * @param x The value.
+ * @param x The value.
* @param unit The unit.
- * @returns
+ * @return
*/
export const addUnit = ( x?: number, unit?: string ): string | undefined => x !== undefined ? `${x}${unit}` : undefined;
/**
* Extract the number from a given string.
- * @param s The number in string.
+ * @param s The number in string.
* @param defaultValue Default value.
- * @returns
+ * @return
*/
export const getInt = ( s?: string, defaultValue?: number ): number | undefined => {
@@ -36,7 +35,7 @@ export const getInt = ( s?: string, defaultValue?: number ): number | undefined
/**
* Wrapt the given value in a box type.
* @param x The value.
- * @returns
+ * @return
*/
export const makeBox = ( x?: string ): BoxType => {
return {
@@ -50,7 +49,7 @@ export const makeBox = ( x?: string ): BoxType => {
/**
* Extract a single value from the box. Non-zero values have priority.
* @param box The box.
- * @returns
+ * @return
*/
export const getSingleValueFromBox = ( box?: BoxType ) => {
if ( box === undefined ) {
@@ -62,9 +61,9 @@ export const getSingleValueFromBox = ( box?: BoxType ) => {
/**
* Extract the CSS var name from the given string source.
- * @param source The text source with the CSS styles.
+ * @param source The text source with the CSS styles.
* @param colorName The string that is contained in the desired CSS var.
- * @returns
+ * @return
*/
const extractCSSColorVar = ( source: string, colorName: string ) => {
const initPosition = source.indexOf( colorName );
@@ -97,8 +96,8 @@ type ThemeSettings = {
/**
* Extract the styles from Settings and saved it to global value `window.oThemeStyles`
- * @param settings The WP settings.
- * @returns
+ * @param settings The WP settings.
+ * @return {void}
*/
export const extractThemeCSSVar = ( settings: ThemeSettings ) => {
@@ -128,9 +127,9 @@ export const extractThemeCSSVar = ( settings: ThemeSettings ) => {
/**
* Retrieve the desired color from the global object `window.oThemeStyles` that containts the CSS color values and vars for the current theme.
- * @param type The type of the color.
+ * @param type The type of the color.
* @param colorName The string that is contained in the desired CSS var.
- * @returns
+ * @return
*/
const selectColorFromThemeStyles = ( type: 'color' | 'gradient' | 'duotone' | 'any', colorName: string ) => {
if ( 'undefined' === typeof window ) {
@@ -176,9 +175,9 @@ const selectColorFromThemeStyles = ( type: 'color' | 'gradient' | 'duotone' | 'a
/**
* Get the value of the given color name from current theme. This is a wrapper around `selectColorFromThemeStyles`.
- * @param type The type of the color.
+ * @param type The type of the color.
* @param colorName The string that is contained in the desired CSS var.
- * @returns
+ * @return
*/
export const getColorFromThemeStyles = ( type: 'color' | 'gradient' | 'duotone' | 'any', colorName: string ) => {
const color = selectColorFromThemeStyles( type, colorName );
diff --git a/src/blocks/plugins/dynamic-content/link/fields.js b/src/blocks/plugins/dynamic-content/link/fields.js
index 004c31727..af8aaa8fa 100644
--- a/src/blocks/plugins/dynamic-content/link/fields.js
+++ b/src/blocks/plugins/dynamic-content/link/fields.js
@@ -93,7 +93,7 @@ const Fields = ({
{ ( ! Boolean( window.themeisleGutenberg.hasPro ) ) && (
{ __( 'Unlock more options with Otter Pro. ', 'otter-blocks' ) } }
+ notice={ { __( 'Unlock more options with Otter Pro.', 'otter-blocks' ) } }
variant="upsell"
/>
) }
diff --git a/src/blocks/plugins/dynamic-content/media/index.js b/src/blocks/plugins/dynamic-content/media/index.js
index 6f65157db..271d8c6dc 100644
--- a/src/blocks/plugins/dynamic-content/media/index.js
+++ b/src/blocks/plugins/dynamic-content/media/index.js
@@ -42,10 +42,10 @@ if ( Boolean( window.themeisleGutenberg.hasModule.dynamicContent ) ) {
wp.media.view.MediaFrame.Select = oldMediaFrame.extend({
/**
- * overwrite router to
- *
- * @param {wp.media.view.Router} routerView
- */
+ * overwrite router to
+ *
+ * @param {wp.media.view.Router} routerView
+ */
browseRouter( routerView ) {
oldMediaFrame.prototype.browseRouter.apply( this, arguments );
const showDynamicMedia = select( 'core/block-editor' ).getSelectedBlock();
@@ -61,10 +61,10 @@ if ( Boolean( window.themeisleGutenberg.hasModule.dynamicContent ) ) {
},
/**
- * Bind region mode event callbacks.
- *
- * @see media.controller.Region.render
- */
+ * Bind region mode event callbacks.
+ *
+ * @see media.controller.Region.render
+ */
bindHandlers() {
oldMediaFrame.prototype.bindHandlers.apply( this, arguments );
const showDynamicMedia = wp.data.select( 'core/block-editor' ).getSelectedBlock();
@@ -75,10 +75,8 @@ if ( Boolean( window.themeisleGutenberg.hasModule.dynamicContent ) ) {
},
/**
- * Render callback for the content region in the `browse` mode.
- *
- * @param {wp.media.controller.Region} contentRegion
- */
+ * Render callback for the content region in the `browse` mode.
+ */
otterDynamicImages() {
const state = this.state();
@@ -99,8 +97,6 @@ if ( Boolean( window.themeisleGutenberg.hasModule.dynamicContent ) ) {
// Render Otter Tab
const otterImagesMediaTab = () => {
- const html = createWrapperHTML();
-
if ( ! activeFrame ) {
return false;
}
@@ -111,7 +107,7 @@ if ( Boolean( window.themeisleGutenberg.hasModule.dynamicContent ) ) {
}
modal.innerHTML = '';
- modal.appendChild( html );
+ modal.appendChild( createWrapperHTML() );
const element = modal.querySelector( '#otter-media-router-' + activeFrameId );
if ( ! element ) {
@@ -170,7 +166,7 @@ if ( Boolean( window.themeisleGutenberg.hasModule.dynamicContent ) ) {
return false;
}
- let selectedTab = activeFrame.querySelector(
+ const selectedTab = activeFrame.querySelector(
'.media-router button.media-menu-item.active'
);
diff --git a/src/blocks/plugins/dynamic-content/value/autocompleter.js b/src/blocks/plugins/dynamic-content/value/autocompleter.js
index 24a6520f0..d50899532 100644
--- a/src/blocks/plugins/dynamic-content/value/autocompleter.js
+++ b/src/blocks/plugins/dynamic-content/value/autocompleter.js
@@ -17,7 +17,7 @@ import { select } from '@wordpress/data';
*/
import options from './options.js';
-let autocompleteOptions = [];
+const autocompleteOptions = [];
Object.keys( options ).forEach( option => autocompleteOptions.push( ...options[option].options ) );
diff --git a/src/blocks/plugins/dynamic-content/value/fields.js b/src/blocks/plugins/dynamic-content/value/fields.js
index a4375f687..7a8dd7681 100644
--- a/src/blocks/plugins/dynamic-content/value/fields.js
+++ b/src/blocks/plugins/dynamic-content/value/fields.js
@@ -147,7 +147,7 @@ const Fields = ({
{ ( ! Boolean( window.themeisleGutenberg.hasPro ) ) && (
{ __( 'Unlock more options with Otter Pro. ', 'otter-blocks' ) } }
+ notice={ { __( 'Unlock more options with Otter Pro.', 'otter-blocks' ) } }
variant="upsell"
/>
) }
diff --git a/src/blocks/plugins/feedback/feedback-form.js b/src/blocks/plugins/feedback/feedback-form.js
index 31312fbfb..5dc9bf6d7 100644
--- a/src/blocks/plugins/feedback/feedback-form.js
+++ b/src/blocks/plugins/feedback/feedback-form.js
@@ -44,7 +44,7 @@ const helpTextByStatus = {
* Displays a button that opens a modal for sending feedback
*
* @param {import('./type').FeedbackFormProps} props
- * @returns
+ * @return
*/
const FeedbackForm = ({
source,
@@ -80,7 +80,7 @@ const FeedbackForm = ({
},
body: JSON.stringify({
slug: 'otter-blocks',
- version: version,
+ version,
feedback: trimmedFeedback,
data: {
'feedback-area': source
diff --git a/src/blocks/plugins/feedback/index.js b/src/blocks/plugins/feedback/index.js
index a7a981b60..1195c69f6 100644
--- a/src/blocks/plugins/feedback/index.js
+++ b/src/blocks/plugins/feedback/index.js
@@ -75,9 +75,9 @@ export const FeedbackModalComponent = ({
/**
* Displays a button that opens a modal for sending feedback
*
- * @param {string} content
- * @param {string} source
- * @param {string} text
+ * @param {string} content
+ * @param {string} source
+ * @param {string} text
* @param {Button.ButtonVariant} variant
*/
const FeedbackModal = (
diff --git a/src/blocks/plugins/options/global-defaults/controls/button.js b/src/blocks/plugins/options/global-defaults/controls/button.js
index da4bcb49c..eecb79e1d 100644
--- a/src/blocks/plugins/options/global-defaults/controls/button.js
+++ b/src/blocks/plugins/options/global-defaults/controls/button.js
@@ -73,7 +73,7 @@ const ButtonBlock = ({
setAttributes({ background: background })}
+ onColorChange={ background => setAttributes({ background })}
className="is-list"
/>
diff --git a/src/blocks/plugins/options/global-defaults/index.js b/src/blocks/plugins/options/global-defaults/index.js
index ecfe74fc8..e50d7e133 100644
--- a/src/blocks/plugins/options/global-defaults/index.js
+++ b/src/blocks/plugins/options/global-defaults/index.js
@@ -30,7 +30,7 @@ const GlobalDefaults = ({
};
});
- const blocks = getBlockTypes().filter( i => 'themeisle-blocks' === i.category && ( globalControls.find( o => o.name === i.name ) || ( undefined === i.parent && undefined == i.ancestor && ( undefined === i.supports.inserter || true === i.supports.inserter ) ) ) );
+ const blocks = getBlockTypes().filter( i => 'themeisle-blocks' === i.category && ( globalControls.find( o => o.name === i.name ) || ( undefined === i.parent && undefined === i.ancestor && ( undefined === i.supports.inserter || true === i.supports.inserter ) ) ) );
if ( ! isAPILoaded ) {
return (
diff --git a/src/blocks/plugins/options/index.js b/src/blocks/plugins/options/index.js
index 9fc8b1e4b..de0f71421 100644
--- a/src/blocks/plugins/options/index.js
+++ b/src/blocks/plugins/options/index.js
@@ -66,7 +66,7 @@ import { otterIconColored } from '../../helpers/icons.js';
import Tabs from './global-defaults/controls/tabs';
import useSettings from '../../helpers/use-settings';
-export let NavigatorButton = ({
+export const NavigatorButton = ({
path,
isBack = false,
onClickAction = () => {},
@@ -96,7 +96,7 @@ const Sidebar = () => {
return {
isOnboardingVisible: isOnboardingVisible?.(),
- get: get
+ get
};
}, []);
@@ -313,7 +313,7 @@ const Sidebar = () => {
'loading' === status && (
- { __( 'Checking optional module...', 'otter-blocks' ) }
+ { __( 'Checking optional module…', 'otter-blocks' ) }
)
}
diff --git a/src/blocks/plugins/patterns-library/index.js b/src/blocks/plugins/patterns-library/index.js
index 564488b1d..211cbc2ce 100644
--- a/src/blocks/plugins/patterns-library/index.js
+++ b/src/blocks/plugins/patterns-library/index.js
@@ -16,7 +16,7 @@ import domReady from '@wordpress/dom-ready';
/**
* Internal dependencies.
-*/
+ */
import './editor.scss';
import { otterIconColored } from '../../helpers/icons.js';
import Library from './library.js';
diff --git a/src/blocks/plugins/patterns-library/library.js b/src/blocks/plugins/patterns-library/library.js
index f7792216d..5a14e0996 100644
--- a/src/blocks/plugins/patterns-library/library.js
+++ b/src/blocks/plugins/patterns-library/library.js
@@ -139,10 +139,10 @@ const Library = ({
const [ bulkSelection, setBulkSelection ] = useState([]);
const filteredPatterns = useMemo( () => {
- let currentCategory = 'favorites' === selectedCategory ? patterns.filter( pattern => getFavorites.includes( pattern.name ) ) : patterns.filter( pattern => pattern.categories.includes( selectedCategory ) );
+ const currentCategory = 'favorites' === selectedCategory ? patterns.filter( pattern => getFavorites.includes( pattern.name ) ) : patterns.filter( pattern => pattern.categories.includes( selectedCategory ) );
if ( searchInput ) {
- return currentCategory.filter( pattern => pattern.name.toLowerCase().includes( searchInput.toLowerCase() ) );
+ return currentCategory.filter( pattern => pattern.title.toLowerCase().includes( searchInput.toLowerCase() ) );
}
return currentCategory;
diff --git a/src/blocks/plugins/sticky/edit.tsx b/src/blocks/plugins/sticky/edit.tsx
index 035c04d9f..c5806be99 100644
--- a/src/blocks/plugins/sticky/edit.tsx
+++ b/src/blocks/plugins/sticky/edit.tsx
@@ -33,7 +33,7 @@ import { applyFilters } from '@wordpress/hooks';
*/
import Notice from '../../components/notice/index.js';
import { setUtm } from '../../helpers/helper-functions.js';
-import { BlockProps, OtterBlock } from '../../helpers/blocks.js';
+import type { BlockProps, OtterBlock } from '../../helpers/blocks.js';
const FILTER_OPTIONS = {
position: 'o-sticky-pos',
diff --git a/src/blocks/plugins/upsell-block/index.js b/src/blocks/plugins/upsell-block/index.js
index f9d9f58e3..bd8e24b11 100644
--- a/src/blocks/plugins/upsell-block/index.js
+++ b/src/blocks/plugins/upsell-block/index.js
@@ -62,6 +62,7 @@ const edit = props => {
{ __( 'There are 30+ more patterns and full page designs available in Otter PRO.', 'otter-blocks' ) }
+ {/* eslint-disable-next-line react/jsx-no-target-blank */}
{ __( 'View Demos', 'otter-blocks' ) }
diff --git a/src/blocks/test/e2e/blocks/accordion.spec.js b/src/blocks/test/e2e/blocks/accordion.spec.js
index 0efd94b86..3edfdc432 100644
--- a/src/blocks/test/e2e/blocks/accordion.spec.js
+++ b/src/blocks/test/e2e/blocks/accordion.spec.js
@@ -27,7 +27,7 @@ test.describe( 'Accordion Block', () => {
name: 'themeisle-blocks/accordion'
});
- let accordionBlock = ( await editor.getBlocks() ).find( ( block ) => 'themeisle-blocks/accordion' === block.name );
+ const accordionBlock = ( await editor.getBlocks() ).find( ( block ) => 'themeisle-blocks/accordion' === block.name );
expect( accordionBlock.innerBlocks.length ).toBeGreaterThan( 0 );
});
@@ -54,7 +54,7 @@ test.describe( 'Accordion Block', () => {
name: 'themeisle-blocks/accordion'
});
- let accordionBlock = ( await editor.getBlocks() ).find( ( block ) => 'themeisle-blocks/accordion' === block.name );
+ const accordionBlock = ( await editor.getBlocks() ).find( ( block ) => 'themeisle-blocks/accordion' === block.name );
expect( accordionBlock.innerBlocks.length ).toBeGreaterThan( 0 );
diff --git a/src/blocks/test/e2e/blocks/ai-block.spec.js b/src/blocks/test/e2e/blocks/ai-block.spec.js
index 071b01111..d1af16d3e 100644
--- a/src/blocks/test/e2e/blocks/ai-block.spec.js
+++ b/src/blocks/test/e2e/blocks/ai-block.spec.js
@@ -94,7 +94,7 @@ test.describe( 'AI Block', () => {
promptID: 'textTransformation',
replaceTargetBlock: {
name: 'core/paragraph',
- clientId: clientId
+ clientId
}
}
});
diff --git a/src/blocks/test/e2e/blocks/countdown.spec.js b/src/blocks/test/e2e/blocks/countdown.spec.js
index 8b554fc52..4fc9ac998 100644
--- a/src/blocks/test/e2e/blocks/countdown.spec.js
+++ b/src/blocks/test/e2e/blocks/countdown.spec.js
@@ -26,7 +26,7 @@ test.describe( 'Countdown Block', () => {
name: 'themeisle-blocks/countdown'
});
- let countdownBlock = ( await editor.getBlocks() ).find( ( block ) => 'themeisle-blocks/countdown' === block.name );
+ const countdownBlock = ( await editor.getBlocks() ).find( ( block ) => 'themeisle-blocks/countdown' === block.name );
const otterId = countdownBlock.attributes.id;
await page.getByRole( 'button', { name: 'Select Date' }).click();
diff --git a/src/blocks/test/e2e/blocks/form.spec.js b/src/blocks/test/e2e/blocks/form.spec.js
index d6463245f..5a9c70e75 100644
--- a/src/blocks/test/e2e/blocks/form.spec.js
+++ b/src/blocks/test/e2e/blocks/form.spec.js
@@ -275,7 +275,7 @@ test.describe( 'Form Block', () => {
await editor.insertBlock({ name: 'themeisle-blocks/form' });
- let formBlock = ( await editor.getBlocks() ).find( ( block ) => 'themeisle-blocks/form' === block.name );
+ const formBlock = ( await editor.getBlocks() ).find( ( block ) => 'themeisle-blocks/form' === block.name );
expect( formBlock ).toBeTruthy();
@@ -326,7 +326,7 @@ test.describe( 'Form Block', () => {
await editor.insertBlock({ name: 'themeisle-blocks/form' });
- let formBlock = ( await editor.getBlocks() ).find( ( block ) => 'themeisle-blocks/form' === block.name );
+ const formBlock = ( await editor.getBlocks() ).find( ( block ) => 'themeisle-blocks/form' === block.name );
expect( formBlock ).toBeTruthy();
@@ -351,7 +351,7 @@ test.describe( 'Form Block', () => {
await editor.insertBlock({ name: 'themeisle-blocks/form' });
- let formBlock = ( await editor.getBlocks() ).find( ( block ) => 'themeisle-blocks/form' === block.name );
+ const formBlock = ( await editor.getBlocks() ).find( ( block ) => 'themeisle-blocks/form' === block.name );
expect( formBlock ).toBeTruthy();
diff --git a/src/blocks/test/e2e/blocks/live-search.spec.js b/src/blocks/test/e2e/blocks/live-search.spec.js
index a12f656d4..2568e61db 100644
--- a/src/blocks/test/e2e/blocks/live-search.spec.js
+++ b/src/blocks/test/e2e/blocks/live-search.spec.js
@@ -48,7 +48,7 @@ test.describe( 'Live Search Block', () => {
// If the width is 0, it means the results are not rendered properly.
const container = page.locator( '.o-live-search .container-wrap' );
- let width = await container.evaluate( node => node.offsetWidth );
+ const width = await container.evaluate( node => node.offsetWidth );
expect( width ).toBeGreaterThan( 0 );
});
});
diff --git a/src/blocks/test/e2e/blocks/slider.spec.js b/src/blocks/test/e2e/blocks/slider.spec.js
index 6d7db38df..44a900666 100644
--- a/src/blocks/test/e2e/blocks/slider.spec.js
+++ b/src/blocks/test/e2e/blocks/slider.spec.js
@@ -80,7 +80,7 @@ test.describe( 'Slider Block', () => {
await editor.insertBlock({
name: 'themeisle-blocks/slider',
attributes: {
- images: images
+ images
}
});
@@ -110,7 +110,7 @@ test.describe( 'Slider Block', () => {
await editor.insertBlock({
name: 'themeisle-blocks/slider',
attributes: {
- images: images
+ images
}
});
diff --git a/src/blocks/test/e2e/blocks/tabs.spec.js b/src/blocks/test/e2e/blocks/tabs.spec.js
index 4b637f79a..298280ee5 100644
--- a/src/blocks/test/e2e/blocks/tabs.spec.js
+++ b/src/blocks/test/e2e/blocks/tabs.spec.js
@@ -27,7 +27,7 @@ test.describe( 'Tabs Block', () => {
name: 'themeisle-blocks/tabs'
});
- let tabBlock = ( await editor.getBlocks() ).find( ( block ) => 'themeisle-blocks/tabs' === block.name );
+ const tabBlock = ( await editor.getBlocks() ).find( ( block ) => 'themeisle-blocks/tabs' === block.name );
expect( tabBlock.innerBlocks.length ).toBeGreaterThan( 0 );
});
@@ -54,7 +54,7 @@ test.describe( 'Tabs Block', () => {
name: 'themeisle-blocks/tabs'
});
- let tabBlock = ( await editor.getBlocks() ).find( ( block ) => 'themeisle-blocks/tabs' === block.name );
+ const tabBlock = ( await editor.getBlocks() ).find( ( block ) => 'themeisle-blocks/tabs' === block.name );
expect( tabBlock.innerBlocks.length ).toBeGreaterThan( 0 );
diff --git a/src/blocks/test/unit/helper-functions.test.ts b/src/blocks/test/unit/helper-functions.test.ts
index 7021a05cf..c4db851be 100644
--- a/src/blocks/test/unit/helper-functions.test.ts
+++ b/src/blocks/test/unit/helper-functions.test.ts
@@ -57,7 +57,7 @@ describe( 'Build Get Responsive Attributes Function', () => {
describe( 'Build Get Responsive Set Attributes', () => {
let attributes: any = {};
- let setAttributes = ( attrs: any ) => {
+ const setAttributes = ( attrs: any ) => {
attributes = { ...attributes, ...attrs };
};
diff --git a/src/css/editor.js b/src/css/editor.js
index 7f5d09787..b74efdbc6 100644
--- a/src/css/editor.js
+++ b/src/css/editor.js
@@ -32,15 +32,15 @@ const CSSEditor = ({
const [ editorValue, setEditorValue ] = useState( null );
const getClassName = () => {
- const uniqueId = clientId.substring( 0, 8 );
-
+
// remove the ticss class if custom CSS is empty.
if ( editorValue?.replace( /\s+/g, '' ) === ( 'selector {\n}\n' ).replace( /\s+/g, '' ) ) {
return attributes.className ?
attributes.className.split( ' ' ).filter( className => ! className.includes( 'ticss-' ) ).join( ' ' ) :
attributes.className;
}
-
+
+ const uniqueId = clientId.substring( 0, 8 );
const { className } = attributes;
return className ?
@@ -127,7 +127,7 @@ const CSSEditor = ({
setAttributes({
customCSS,
hasCustomCSS: true,
- className: className
+ className
});
}
}, [ editorValue ]);
diff --git a/src/css/index.js b/src/css/index.js
index 3817ab895..4a12fb63f 100644
--- a/src/css/index.js
+++ b/src/css/index.js
@@ -32,6 +32,7 @@ import './editor.scss';
import CSSEditor from './editor.js';
+/* eslint-disable no-duplicate-imports */
import './inject-css.js';
import { onDeselect } from './inject-css.js';
diff --git a/src/css/inject-css.js b/src/css/inject-css.js
index 5247da4f8..358738c9c 100644
--- a/src/css/inject-css.js
+++ b/src/css/inject-css.js
@@ -19,8 +19,6 @@ let isInitialCall = true;
const addStyle = style => {
const iFrame = window.parent.document.querySelector( 'iframe[name="editor-canvas"]' )?.contentWindow;
- let anchor = iFrame?.document.head || document.head;
- let element = anchor.querySelector( '#o-css-editor-styles' );
if ( isInitialCall && iFrame ) {
iFrame.addEventListener( 'DOMContentLoaded', function() {
@@ -35,6 +33,9 @@ const addStyle = style => {
return;
}
+ const anchor = iFrame?.document.head || document.head;
+ let element = anchor.querySelector( '#o-css-editor-styles' );
+
if ( null === element ) {
element = document.createElement( 'style' );
element.setAttribute( 'type', 'text/css' );
@@ -113,14 +114,15 @@ const debouncedSubscription = debounce( () => {
getBlocks,
isTyping
} = select( 'core/block-editor' );
- const __experimentalGetPreviewDeviceType = select( 'core/edit-post' ) ? select( 'core/edit-post' ).__experimentalGetPreviewDeviceType() : false;
- const blocks = getBlocks();
- const reusableBlocks = select( 'core' ).getEntityRecords( 'postType', 'wp_block', { context: 'view' });
const isTypingNow = isTyping();
if ( isTypingNow ) {
return;
}
+
+ const __experimentalGetPreviewDeviceType = select( 'core/edit-post' ) ? select( 'core/edit-post' ).__experimentalGetPreviewDeviceType() : false;
+ const blocks = getBlocks();
+ const reusableBlocks = select( 'core' ).getEntityRecords( 'postType', 'wp_block', { context: 'view' });
if ( ! isEqual( previousBlocks, blocks ) || previewView !== __experimentalGetPreviewDeviceType ) {
const blocksStyle = getCustomCssFromBlocks( blocks, reusableBlocks );
diff --git a/src/dashboard/components/Header.js b/src/dashboard/components/Header.js
index 71a47880b..b0ca153ea 100644
--- a/src/dashboard/components/Header.js
+++ b/src/dashboard/components/Header.js
@@ -53,7 +53,13 @@ const Headers = ({
/>
{ window.otterObj.version }
diff --git a/src/dashboard/components/LicenseField.js b/src/dashboard/components/LicenseField.js
index 7a9181418..d798d695a 100644
--- a/src/dashboard/components/LicenseField.js
+++ b/src/dashboard/components/LicenseField.js
@@ -113,7 +113,13 @@ const LicenseField = () => {
- { sprintf( __( 'Valid - Expires %s', 'otter-blocks' ), license.expiration ) }
+ {
+ sprintf(
+ // translators: %s: expiration date
+ __( 'Valid - Expires %s', 'otter-blocks' ),
+ license.expiration
+ )
+ }
)}
diff --git a/src/dashboard/components/Main.js b/src/dashboard/components/Main.js
index 6471f8e6b..b9c239af6 100644
--- a/src/dashboard/components/Main.js
+++ b/src/dashboard/components/Main.js
@@ -27,7 +27,11 @@ import { applyFilters } from '@wordpress/hooks';
import Blocks from './pages/Blocks';
import Deal from './Deal';
-let daysLeft = sprintf( __( '%s Days', 'otter-blocks' ), Number( window.otterObj.daysLeft ) );
+let daysLeft = sprintf(
+ // Translators: %s is the number of days left.
+ __( '%s Days', 'otter-blocks' ),
+ Number( window.otterObj.daysLeft )
+);
if ( 1 === Number( window.otterObj.daysLeft ) ) {
daysLeft = __( 'Less than 24 hours', 'otter-blocks' );
@@ -99,7 +103,8 @@ const Main = ({
-
+ {/* eslint-disable-next-line jsx-a11y/alt-text */}
+
{ __( 'What\'s the one thing you need in Otter Blocks?', 'otter-blocks' ) }
{ __( 'We\'re always looking for suggestions to further improve Otter Blocks and your feedback can help us do that.', 'otter-blocks' ) }
diff --git a/src/dashboard/components/NeveSidebarUpsell.js b/src/dashboard/components/NeveSidebarUpsell.js
index bc1c240db..e7d8b2365 100644
--- a/src/dashboard/components/NeveSidebarUpsell.js
+++ b/src/dashboard/components/NeveSidebarUpsell.js
@@ -100,7 +100,8 @@ const NeveSidebarUpsell = () => {
-
+ {/* eslint-disable-next-line jsx-a11y/alt-text */}
+
{ __( '- Experience lightning fast performance!', 'otter-blocks' ) }
@@ -115,7 +116,8 @@ const NeveSidebarUpsell = () => {
1050+
-
+ {/* eslint-disable-next-line jsx-a11y/alt-text */}
+
@@ -128,6 +130,7 @@ const NeveSidebarUpsell = () => {
+ {/* eslint-disable-next-line jsx-a11y/alt-text */}
diff --git a/src/dashboard/components/Notices.js b/src/dashboard/components/Notices.js
index 539ec0a42..da566efa3 100644
--- a/src/dashboard/components/Notices.js
+++ b/src/dashboard/components/Notices.js
@@ -1,6 +1,6 @@
/**
- * WordPress dependencies.
- */
+ * WordPress dependencies.
+ */
import { filter } from 'lodash';
import { SnackbarList } from '@wordpress/components';
diff --git a/src/dashboard/components/Sidebar.js b/src/dashboard/components/Sidebar.js
index 9ab62c8f5..e0803acac 100644
--- a/src/dashboard/components/Sidebar.js
+++ b/src/dashboard/components/Sidebar.js
@@ -59,9 +59,9 @@ const Sidebar = ({
title={ __( 'Useful links', 'otter-blocks' ) }
>
diff --git a/src/dashboard/components/pages/Blocks.js b/src/dashboard/components/pages/Blocks.js
index 826e8bbb1..e29505b28 100644
--- a/src/dashboard/components/pages/Blocks.js
+++ b/src/dashboard/components/pages/Blocks.js
@@ -229,7 +229,7 @@ const otterBlocks = [
const BlockCard = ({ block, isLoading, onToggle }) => {
return (
-
+
{ isString( block.icon ) ? : block.icon?.() }
@@ -440,7 +440,7 @@ const Blocks = () => {
{
blocksStatus.map( block => {
return (
-
toggleBlock( block.slug )} />
+ toggleBlock( block.slug )} />
);
})
}
diff --git a/src/dashboard/components/pages/Dashboard.js b/src/dashboard/components/pages/Dashboard.js
index 71890bbed..cd03fd286 100644
--- a/src/dashboard/components/pages/Dashboard.js
+++ b/src/dashboard/components/pages/Dashboard.js
@@ -100,9 +100,9 @@ const initialState = {
/**
* Reducer.
- * @param {Object} state The current state.
+ * @param {Object} state The current state.
* @param {Object} action The action to be performed.
- * @returns {*}
+ * @return {*}
*/
const reducer = ( state, action ) => {
switch ( action.type ) {
@@ -162,7 +162,7 @@ const Dashboard = () => {
/**
* Regenerate styles.
- * @returns {Promise}
+ * @return {Promise}
*/
const regenerateStyles = async() => {
const data = await apiFetch({ path: 'otter/v1/regenerate', method: 'DELETE' });
@@ -340,8 +340,8 @@ const Dashboard = () => {
applyAction({ type: 'update', name: 'enableReviewScale', value }) }
diff --git a/src/dashboard/components/pages/Integrations.js b/src/dashboard/components/pages/Integrations.js
index afef6c3c1..b6d36dcfc 100644
--- a/src/dashboard/components/pages/Integrations.js
+++ b/src/dashboard/components/pages/Integrations.js
@@ -302,7 +302,7 @@ const Integrations = () => {
}
);
- return;
+
}
} }
>
diff --git a/src/dashboard/components/pages/Upsell.js b/src/dashboard/components/pages/Upsell.js
index 2a9f72b00..0f8dda823 100644
--- a/src/dashboard/components/pages/Upsell.js
+++ b/src/dashboard/components/pages/Upsell.js
@@ -27,7 +27,7 @@ const FEATURES = [
},
{
label: __( 'Extended Visibility Conditions & Sticky Blocks functionality', 'otter-blocks' ),
- description: __( 'The Visibility Conditions feature allows you to set which conditions should be met for your chosen blocks to be displayed on the page. While the Sticky feature lets you set a Block as sticky, so that it sticks to its parent. ', 'otter-blocks' )
+ description: __( 'The Visibility Conditions feature allows you to set which conditions should be met for your chosen blocks to be displayed on the page. While the Sticky feature lets you set a Block as sticky, so that it sticks to its parent.', 'otter-blocks' )
},
{
label: __( 'Dynamic Values', 'otter-blocks' ),
diff --git a/src/dashboard/index.js b/src/dashboard/index.js
index 993c3156c..844a12a64 100644
--- a/src/dashboard/index.js
+++ b/src/dashboard/index.js
@@ -2,6 +2,7 @@
/**
* External dependencies.
*/
+/* eslint-disable import/no-unresolved */
import formbricks from '@formbricks/js/app';
/**
diff --git a/src/onboarding/components/PalettePreview.js b/src/onboarding/components/PalettePreview.js
index 5c28d2d68..9e80efefe 100644
--- a/src/onboarding/components/PalettePreview.js
+++ b/src/onboarding/components/PalettePreview.js
@@ -79,7 +79,7 @@ const PalettePreview = ({
{
const setLogo = ( newLogo ) => {
const blocks = select( 'core/block-editor' ).getBlocks();
- let siteLogoBlock = findBlock( blocks, 'core/site-logo' );
+ const siteLogoBlock = findBlock( blocks, 'core/site-logo' );
if ( ! siteLogoBlock ) {
const siteTitleBlock = findBlock( blocks, 'core/site-title' );
diff --git a/src/onboarding/store.js b/src/onboarding/store.js
index aa74d7d3c..dff1b06d5 100644
--- a/src/onboarding/store.js
+++ b/src/onboarding/store.js
@@ -114,9 +114,7 @@ const actions = {
onContinue() {
return async({ dispatch, select }) => {
const step = select.getStep();
- const changedData = select.getChangedData();
-
- let event = {
+ const event = {
type: step.id,
step_id: step.value + 1,
step_status: 'completed'
@@ -149,7 +147,7 @@ const actions = {
}
editEntityRecord( 'postType', 'wp_template', currentTemplate.id, {
- 'content': content
+ content
});
}
@@ -161,6 +159,8 @@ const actions = {
}) );
}
+ const changedData = select.getChangedData();
+
if ( 'site_info' === step.id ) {
event.fields_filled = changedData.fields_filled;
}
@@ -404,7 +404,7 @@ const store = createReduxStore( 'otter/onboarding', {
resolvers: {
*getTemplate( query ) {
- let path = addQueryArgs( '/wp/v2/templates/lookup', query );
+ const path = addQueryArgs( '/wp/v2/templates/lookup', query );
const value = yield actions.fetchFromAPI( path );
return actions.setTemplate( value );
},
diff --git a/src/onboarding/utils.js b/src/onboarding/utils.js
index bebbf60df..257933677 100644
--- a/src/onboarding/utils.js
+++ b/src/onboarding/utils.js
@@ -31,13 +31,14 @@ export const recordEvent = async( data = {}) => {
return;
}
- const { setSessionID } = dispatch( 'otter/onboarding' );
- const { getSessionID } = select( 'otter/onboarding' );
- const { getCurrentTheme } = select( 'core' );
-
- const trackingId = getSessionID();
-
+
try {
+ const { setSessionID } = dispatch( 'otter/onboarding' );
+ const { getSessionID } = select( 'otter/onboarding' );
+ const { getCurrentTheme } = select( 'core' );
+
+ const trackingId = getSessionID();
+
const response = await fetch(
'https://api.themeisle.com/tracking/onboarding',
{
diff --git a/src/pro/blocks/add-to-cart-button/edit.js b/src/pro/blocks/add-to-cart-button/edit.js
index 3893fa000..1e975db47 100644
--- a/src/pro/blocks/add-to-cart-button/edit.js
+++ b/src/pro/blocks/add-to-cart-button/edit.js
@@ -24,7 +24,7 @@ import Inspector from './inspector.js';
/**
* Add To Card Button component
* @param {import('./types.js').AddToCartButtonProps} props
- * @returns
+ * @return
*/
const Edit = ({
attributes,
diff --git a/src/pro/blocks/business-hours/edit.js b/src/pro/blocks/business-hours/edit.js
index c9438161c..e70946ebd 100644
--- a/src/pro/blocks/business-hours/edit.js
+++ b/src/pro/blocks/business-hours/edit.js
@@ -34,7 +34,7 @@ const { attributes: defaultAttributes } = metadata;
/**
* Business Hours component
* @param {import('./types').BusinessHoursProps} props
- * @returns
+ * @return
*/
const Edit = ({
attributes,
diff --git a/src/pro/blocks/business-hours/inspector.js b/src/pro/blocks/business-hours/inspector.js
index 1f7c2cef8..cfa60acb4 100644
--- a/src/pro/blocks/business-hours/inspector.js
+++ b/src/pro/blocks/business-hours/inspector.js
@@ -17,7 +17,7 @@ import {
/**
*
* @param {import('./types').BusinessHoursInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
diff --git a/src/pro/blocks/business-hours/item/edit.js b/src/pro/blocks/business-hours/item/edit.js
index 2baa1474b..2512459a6 100644
--- a/src/pro/blocks/business-hours/item/edit.js
+++ b/src/pro/blocks/business-hours/item/edit.js
@@ -27,7 +27,7 @@ const { attributes: defaultAttributes } = metadata;
/**
* Business Hours Item component
* @param {import('./types').BusinessHoursItemProps} props
- * @returns
+ * @return
*/
const Edit = ({
attributes,
diff --git a/src/pro/blocks/file/edit.js b/src/pro/blocks/file/edit.js
index 49296defd..8b02299cd 100644
--- a/src/pro/blocks/file/edit.js
+++ b/src/pro/blocks/file/edit.js
@@ -33,7 +33,7 @@ const { attributes: defaultAttributes } = metadata;
/**
* Form Input component
* @param {import('./types').FormFileProps} props
- * @returns
+ * @return
*/
const Edit = ({
attributes,
diff --git a/src/pro/blocks/file/index.js b/src/pro/blocks/file/index.js
index d0afc610e..22452818b 100644
--- a/src/pro/blocks/file/index.js
+++ b/src/pro/blocks/file/index.js
@@ -2,11 +2,7 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
-
-import { registerBlockType } from '@wordpress/blocks';
-
-import { createBlock } from '@wordpress/blocks';
-
+import { registerBlockType, createBlock } from '@wordpress/blocks';
import { omit } from 'lodash';
/**
diff --git a/src/pro/blocks/file/inspector.js b/src/pro/blocks/file/inspector.js
index 960203248..ad8d4d4c0 100644
--- a/src/pro/blocks/file/inspector.js
+++ b/src/pro/blocks/file/inspector.js
@@ -107,7 +107,7 @@ const ProPreview = ({ attributes }) => {
{ ! Boolean( window.themeisleGutenberg.hasPro ) && (
{ __( 'Get more options with Otter Pro. ', 'otter-blocks' ) } }
+ notice={ { __( 'Get more options with Otter Pro.', 'otter-blocks' ) } }
variant="upsell"
/> ) }
@@ -117,7 +117,7 @@ const ProPreview = ({ attributes }) => {
/**
*
* @param {import('./types').FormFileInspectorProps} props
- * @returns {JSX.Element}
+ * @return {JSX.Element}
*/
const Inspector = ({
attributes,
@@ -157,7 +157,7 @@ const Inspector = ({
{
( ! window.themeisleGutenberg.hasPro ) ? : (
- applyFilters( 'otter.form.file.inspector', , { attributes: attributes, setAttributes: setAttributes })
+ applyFilters( 'otter.form.file.inspector', , { attributes, setAttributes })
)
}
diff --git a/src/pro/blocks/form-hidden-field/edit.js b/src/pro/blocks/form-hidden-field/edit.js
index ba8117fc5..25b0c2546 100644
--- a/src/pro/blocks/form-hidden-field/edit.js
+++ b/src/pro/blocks/form-hidden-field/edit.js
@@ -2,8 +2,8 @@
* WordPress dependencies
*/
-import { Fragment, useContext, useEffect } from '@wordpress/element';
-import { __ } from '@wordpress/i18n';
+import { Fragment, useEffect } from '@wordpress/element';
+import { __, sprintf } from '@wordpress/i18n';
import { RichText, useBlockProps } from '@wordpress/block-editor';
/**
@@ -20,7 +20,7 @@ const { attributes: defaultAttributes } = metadata;
/**
* Form Nonce component
* @param {import('./types').FormHiddenFieldProps} props
- * @returns
+ * @return
*/
const Edit = ({
attributes,
@@ -44,7 +44,11 @@ const Edit = ({
className: 'wp-block wp-block-themeisle-blocks-form-input'
});
- const placeholder = attributes.paramName ? __( 'Get the value of the URL param: ', 'otter-blocks' ) + attributes.paramName : '';
+ const placeholder = attributes.paramName ? sprintf(
+ /* translators: %s: URL parameter name */
+ __( 'Get the value of the URL param: %s', 'otter-blocks' ),
+ attributes.paramName
+ ) : '';
return (
diff --git a/src/pro/blocks/form-hidden-field/inspector.js b/src/pro/blocks/form-hidden-field/inspector.js
index b68cd94c7..969e27c14 100644
--- a/src/pro/blocks/form-hidden-field/inspector.js
+++ b/src/pro/blocks/form-hidden-field/inspector.js
@@ -28,7 +28,7 @@ import { fieldTypesOptions, mappedNameInfo, switchFormFieldTo } from '../../../b
/**
*
* @param {import('./types').FormHiddenFieldInspectorPros} props
- * @returns {JSX.Element}
+ * @return {JSX.Element}
*/
const Inspector = ({
attributes,
diff --git a/src/pro/blocks/form-stripe-field/edit.js b/src/pro/blocks/form-stripe-field/edit.js
index 5f32ecfe3..2f18641d2 100644
--- a/src/pro/blocks/form-stripe-field/edit.js
+++ b/src/pro/blocks/form-stripe-field/edit.js
@@ -28,7 +28,7 @@ const { attributes: defaultAttributes } = metadata;
/**
* Stripe Field component
* @param {import('./types').FormStripeFieldProps} props
- * @returns
+ * @return
*/
const Edit = ({
attributes,
@@ -265,7 +265,7 @@ const Edit = ({
( 'loading' === status || 'saving' === status ) && (
- { __( 'Checking the API Key...', 'otter-blocks' ) }
+ { __( 'Checking the API Key…', 'otter-blocks' ) }
)
diff --git a/src/pro/blocks/form-stripe-field/inspector.js b/src/pro/blocks/form-stripe-field/inspector.js
index 57a120c10..7bb4a58a3 100644
--- a/src/pro/blocks/form-stripe-field/inspector.js
+++ b/src/pro/blocks/form-stripe-field/inspector.js
@@ -33,7 +33,7 @@ import { objectOrNumberAsBox } from '../../../blocks/helpers/helper-functions';
/**
*
* @param {import('./types').FormStripeFieldInspectorPros} props
- * @returns {JSX.Element}
+ * @return {JSX.Element}
*/
const Inspector = ({
attributes,
diff --git a/src/pro/blocks/modal/edit.js b/src/pro/blocks/modal/edit.js
index 51156379d..ce95a6366 100644
--- a/src/pro/blocks/modal/edit.js
+++ b/src/pro/blocks/modal/edit.js
@@ -49,7 +49,7 @@ const { attributes: defaultAttributes } = metadata;
/**
* Popup component
* @param {import('./types').PopupPros} props
- * @returns
+ * @return
*/
const Edit = ({
attributes,
diff --git a/src/pro/blocks/modal/inspector.js b/src/pro/blocks/modal/inspector.js
index 3799da26f..af04cc852 100644
--- a/src/pro/blocks/modal/inspector.js
+++ b/src/pro/blocks/modal/inspector.js
@@ -43,7 +43,7 @@ import { useTabSwitch } from '../../../blocks/helpers/block-utility.js';
/**
*
* @param {import('./types').PopupInspectorProps} param0
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
@@ -58,7 +58,7 @@ const Inspector = ({
const changeBoxShadow = data => {
const boxShadow = { ...attributes.boxShadow };
- Object.entries( data ).map( ([ key, val ] = data ) => {
+ Object.entries( data ).forEach( ([ key, val ] = data ) => {
boxShadow[key] = val;
});
diff --git a/src/pro/blocks/review-comparison/edit.js b/src/pro/blocks/review-comparison/edit.js
index 938b1f750..102f56000 100644
--- a/src/pro/blocks/review-comparison/edit.js
+++ b/src/pro/blocks/review-comparison/edit.js
@@ -52,7 +52,7 @@ let tableLinks = [];
/**
* Review Comparison component
* @param {import('./types').ReviewComparisionProps} props
- * @returns
+ * @return
*/
const Edit = ({
attributes,
@@ -151,7 +151,7 @@ const Edit = ({
);
});
- tableImages.push( { review.attrs.image && } );
+ tableImages.push( { review.attrs.image && } );
tableName.push( { review.attrs.title || __( 'Untitled review', 'otter-blocks' ) } );
tablePrice.push( { review.attrs.discounted ? { currency + review.attrs.price } { currency + review.attrs.discounted } : ( review.attrs.price ? ( currency + review.attrs.price ) : '-' ) } );
tableRating.push( { getStars( overallRatings ) }
);
diff --git a/src/pro/blocks/review-comparison/inspector.js b/src/pro/blocks/review-comparison/inspector.js
index 6bb8bc9e5..8857c2f58 100644
--- a/src/pro/blocks/review-comparison/inspector.js
+++ b/src/pro/blocks/review-comparison/inspector.js
@@ -12,7 +12,7 @@ import {
/**
*
* @param {import('./types').ReviewComparisionInspectorProps} props
- * @returns
+ * @return
*/
const Inspector = ({
attributes,
diff --git a/src/pro/components/inactive/index.js b/src/pro/components/inactive/index.js
index b228f9dd5..c307eb724 100644
--- a/src/pro/components/inactive/index.js
+++ b/src/pro/components/inactive/index.js
@@ -14,6 +14,7 @@ const Inactive = ({
blockProps
}) => {
const instructions = sprintf(
+ // translators: %1$s: block name, %2$s: action (renew or activate)
__( 'You need to %2$s your Otter Pro license in order to use %1$s block.', 'otter-blocks' ),
label,
Boolean( window.otterPro.isExpired ) ? __( 'renew', 'otter-blocks' ) : __( 'activate', 'otter-blocks' )
diff --git a/src/pro/components/webhook-editor/index.tsx b/src/pro/components/webhook-editor/index.tsx
index 87d910b8c..070ab31ab 100644
--- a/src/pro/components/webhook-editor/index.tsx
+++ b/src/pro/components/webhook-editor/index.tsx
@@ -16,7 +16,7 @@ import {
Spinner,
TextControl
} from '@wordpress/components';
-import { __ } from '@wordpress/i18n';
+import { __, sprintf } from '@wordpress/i18n';
import { useEffect, useState, Fragment } from '@wordpress/element';
import { arrowRight, closeSmall } from '@wordpress/icons';
@@ -94,7 +94,11 @@ const WebhookEditor = ( props: WebhookEditorProps ) => {
for ( const webhook of webhooksToSave ) {
const check = checkWebhook( webhook );
if ( true !== check ) {
- const msg = __( 'There was an error saving the webhook: ', 'otter-blocks' ) + webhook?.name + '\n';
+ const msg = sprintf(
+ /* translators: %s: webhook name */
+ __( 'There was an error saving the webhook: %s', 'otter-blocks' ),
+ webhook?.name
+ ) + '\n';
setError( msg + check );
return;
}
@@ -280,7 +284,7 @@ const WebhookEditor = ( props: WebhookEditorProps ) => {
{
webhooks?.map( ( webhook ) => {
return (
-
+
{ webhook.name }
diff --git a/src/pro/helpers/helper-functions.tsx b/src/pro/helpers/helper-functions.tsx
index c372909c7..f8a582f5d 100644
--- a/src/pro/helpers/helper-functions.tsx
+++ b/src/pro/helpers/helper-functions.tsx
@@ -4,7 +4,7 @@ import { isEmpty, omitBy } from 'lodash';
* Remove undefined values from the object. Make the value undefined is the object is empty.
*
* @param {Object} object
- * @returns {Object}
+ * @return {Object}
*/
export const objectCleaner = ( object: Object ) => {
const filtered = omitBy( object, ( x: any ) => x === undefined || null === x || '' === x );
diff --git a/src/pro/plugins/conditions/edit.js b/src/pro/plugins/conditions/edit.js
index e3d2958f0..c3ee1b5fa 100644
--- a/src/pro/plugins/conditions/edit.js
+++ b/src/pro/plugins/conditions/edit.js
@@ -595,7 +595,7 @@ const Edit = ({
{ 'country' === item.type && (
{ ! Boolean( window.otterPro.hasIPHubAPI ) && (
- { __( 'Setup API to use this feature. ', 'otter-blocks' ) }
+ { __( 'Setup API to use this feature.', 'otter-blocks' ) }
) }
changeValue( e, groupIndex, itemIndex, 'value' ) }
/>
- { __( 'A list of country codes. ', 'otter-blocks' ) }
+ { __( 'A list of country codes.', 'otter-blocks' ) }
) }
@@ -873,7 +873,13 @@ const Edit = ({
{ 'wooTotalCartValue' === item.type && (
changeValue( e.replace( /[^0-9.]/g, '' ), groupIndex, itemIndex, 'value' ) }
@@ -883,7 +889,13 @@ const Edit = ({
{ 'wooTotalSpent' === item.type && (
changeValue( e.replace( /[^0-9.]/g, '' ), groupIndex, itemIndex, 'value' ) }
diff --git a/src/pro/plugins/conditions/index.js b/src/pro/plugins/conditions/index.js
index 80d199341..6e28b5ca7 100644
--- a/src/pro/plugins/conditions/index.js
+++ b/src/pro/plugins/conditions/index.js
@@ -194,7 +194,7 @@ const applyProDefaults = ( attrs, value ) => {
attrs.cookie_compare = 'is_true';
}
- if ( 'wooProductsInCart' == value ) {
+ if ( 'wooProductsInCart' === value ) {
attrs.on = 'products';
}
@@ -202,11 +202,11 @@ const applyProDefaults = ( attrs, value ) => {
attrs.compare = 'greater_than';
}
- if ( 'learnDashPurchaseHistory' == value ) {
+ if ( 'learnDashPurchaseHistory' === value ) {
attrs.on = 'courses';
}
- if ( 'learnDashCourseStatus' == value ) {
+ if ( 'learnDashCourseStatus' === value ) {
attrs.status = 'not_started';
}
diff --git a/src/pro/plugins/countdown/index.tsx b/src/pro/plugins/countdown/index.tsx
index 5dd2b101d..986c2f692 100644
--- a/src/pro/plugins/countdown/index.tsx
+++ b/src/pro/plugins/countdown/index.tsx
@@ -25,8 +25,8 @@ import { addFilter } from '@wordpress/hooks';
/**
* Internal dependencies.
*/
-import { CountdownInspectorProps } from '../../../blocks/blocks/countdown/types';
import { objectCleaner } from '../../helpers/helper-functions';
+import type { CountdownInspectorProps } from '../../../blocks/blocks/countdown/types';
const { Notice } = window.otterComponents;
diff --git a/src/pro/plugins/dynamic-content/value-edit.js b/src/pro/plugins/dynamic-content/value-edit.js
index 70c0b0e1e..8dedcdc8c 100644
--- a/src/pro/plugins/dynamic-content/value-edit.js
+++ b/src/pro/plugins/dynamic-content/value-edit.js
@@ -330,7 +330,7 @@ const Edit = ({
) }
{ ( 'country' === attributes.type && ! Boolean( window.otterPro.hasIPHubAPI ) ) && (
- { __( 'Setup API to use this feature. ', 'otter-blocks' ) }
+ { __( 'Setup API to use this feature.', 'otter-blocks' ) }
) }
);
diff --git a/src/pro/plugins/form/index.js b/src/pro/plugins/form/index.js
index bfab69af7..96948cf55 100644
--- a/src/pro/plugins/form/index.js
+++ b/src/pro/plugins/form/index.js
@@ -42,12 +42,12 @@ const helpMessages = {
/**
* Form Options
*
- * @param {React.ReactNode} Options The children of the FormOptions component.
- * @param {import('../../../blocks/blocks/form/type').FormOptions} formOptions The form options.
+ * @param {React.ReactNode} Options The children of the FormOptions component.
+ * @param {import('../../../blocks/blocks/form/type').FormOptions} formOptions The form options.
* @param { (options: import('../../../blocks/blocks/form/type').FormOptions) => void } setFormOption The function to set the form options.
- * @param {any} config The form config.
- * @param {import('../../../blocks/blocks/form/type').FormAttrs} attributes The form attributes.
- * @returns {JSX.Element}
+ * @param {any} config The form config.
+ * @param {import('../../../blocks/blocks/form/type').FormAttrs} attributes The form attributes.
+ * @return {JSX.Element}
*/
const FormOptions = ( Options, formOptions, setFormOption, config, attributes ) => {
@@ -168,7 +168,7 @@ const FormOptions = ( Options, formOptions, setFormOption, config, attributes )
onChange={( webhookId ) => {
window.oTrk?.add({ feature: 'form-webhook', featureComponent: 'webhook-set', groupID: attributes.id });
setFormOption({
- webhookId: webhookId
+ webhookId
});
}}
/>
diff --git a/src/pro/plugins/index.js b/src/pro/plugins/index.js
index b94b42409..a57e01d78 100644
--- a/src/pro/plugins/index.js
+++ b/src/pro/plugins/index.js
@@ -2,11 +2,8 @@
* Internal dependencies
*/
import './conditions/index.js';
-import './countdown/index';
import './data/index.js';
import './dynamic-content/index.js';
-import './form/index.js';
-import './live-search/index.js';
import './posts/index.js';
import './popup/index.js';
import './sticky/index.js';
diff --git a/src/pro/plugins/posts/index.js b/src/pro/plugins/posts/index.js
index 47e9d45af..74e9eee24 100644
--- a/src/pro/plugins/posts/index.js
+++ b/src/pro/plugins/posts/index.js
@@ -152,7 +152,7 @@ const PostsCustomMeta = ({ customFieldData }) => {
}, []);
if ( ! customFieldData || ( ! customFieldData.display ) ) {
- return ;
+ return <>>;
}
const meta = fields[ customFieldData.field ];
diff --git a/tests/assets/test-img.png b/tests/assets/test-img.png
new file mode 100644
index 000000000..252d9502d
Binary files /dev/null and b/tests/assets/test-img.png differ
diff --git a/tests/test-patterns-class.php b/tests/test-patterns-class.php
index 674577064..7d3e70835 100644
--- a/tests/test-patterns-class.php
+++ b/tests/test-patterns-class.php
@@ -18,27 +18,56 @@ class TestPatterns extends WP_UnitTestCase {
*/
public function test_fetch_patterns() {
- $json_data = file_get_contents( dirname( dirname( __FILE__ ) ) . '/license.json' );
- $array_data = json_decode( $json_data, true );
+ $json_data = file_get_contents( dirname( dirname( __FILE__ ) ) . '/license.json' );
+ $array_data = json_decode( $json_data, true );
- $url = add_query_arg(
- array(
- 'site_url' => get_site_url(),
- 'license_id' => $array_data['key'],
- 'cache' => time(),
- ),
- 'https://api.themeisle.com/templates-cloud/otter-patterns'
- );
+ $url = add_query_arg(
+ array(
+ 'site_url' => get_site_url(),
+ 'license_id' => $array_data['key'],
+ 'cache' => time(),
+ ),
+ ThemeIsle\OtterPro\Plugins\Patterns::PATTERNS_ENDPOINT
+ );
- $response = wp_remote_get( $url );
- $response = wp_remote_retrieve_body( $response );
+ $response = wp_remote_get( $url );
+ $response = wp_remote_retrieve_body( $response );
- $this->assertTrue( 2000 < strlen( $response ) );
+ $this->assertTrue( 2000 < strlen( $response ) );
- $response = json_decode( $response, true );
+ $response = json_decode( $response, true );
- $this->assertIsArray( $response );
+ $this->assertIsArray( $response );
- $this->assertArrayHasKey( 'slug', $response[0] );
- }
+ $this->assertArrayHasKey( 'slug', $response[0] );
+ }
+
+ public function test_prepare_block_pattern() {
+ $patterns_instance = new ThemeIsle\OtterPro\Plugins\Patterns();
+
+ $block_pattern = array(
+ 'slug' => 'test-pattern',
+ 'title' => 'Default Title',
+ 'title_es' => 'Título en Español',
+ 'title_fr' => 'Titre en Français',
+ 'title_de' => 'Titel auf Deutsch',
+ 'content' => 'Test content
',
+ 'categories' => array( 'test-category' ),
+ 'minimum' => '5.0',
+ );
+
+ // Test with German locale
+ $prepared_pattern = $patterns_instance->prepare_block_pattern( $block_pattern, 'de_DE' );
+ $this->assertEquals( 'Titel auf Deutsch', $prepared_pattern['title'] );
+ $this->assertArrayNotHasKey( 'title_es', $prepared_pattern );
+ $this->assertArrayNotHasKey( 'title_fr', $prepared_pattern );
+ $this->assertArrayNotHasKey( 'title_de', $prepared_pattern );
+
+ // Test with default locale (no translation)
+ $prepared_pattern = $patterns_instance->prepare_block_pattern( $block_pattern, 'en_US' );
+ $this->assertEquals( 'Default Title', $prepared_pattern['title'] );
+ $this->assertArrayNotHasKey( 'title_es', $prepared_pattern );
+ $this->assertArrayNotHasKey( 'title_fr', $prepared_pattern );
+ $this->assertArrayNotHasKey( 'title_de', $prepared_pattern );
+ }
}
diff --git a/tests/test-svg-upload.php b/tests/test-svg-upload.php
index 16e776e7a..2c5e10517 100644
--- a/tests/test-svg-upload.php
+++ b/tests/test-svg-upload.php
@@ -21,7 +21,7 @@ private function handle_upload( $file ) {
if ( file_exists( $tmp_path ) ) {
return [
- 'name' => $file,
+ 'name' => $filename,
'type' => 'image/svg+xml',
'tmp_name' => $tmp_path,
'error' => 0,
@@ -44,9 +44,29 @@ public function test_svg_upload() {
// We check that no error was attached.
$this->assertTrue( empty( $response['error'] ) );
+ // Check if the filename has been changed.
+ $this->assertNotEquals( $file['name'], $response['name'] );
+
$contents = file_get_contents( $response['tmp_name'] );
// We check that the SVG was sanitized.
$this->assertTrue( strpos( $contents, '