Skip to content

Commit 5ad2e69

Browse files
authored
Merge pull request #224 from woocommerce/fix/wc-admin/7781-wc58-compat
2 parents c0b23a7 + 68d3c27 commit 5ad2e69

File tree

4 files changed

+39
-15
lines changed

4 files changed

+39
-15
lines changed

assets/source/setup-guide/index.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
*/
44
import { __ } from '@wordpress/i18n';
55
import { addFilter } from '@wordpress/hooks';
6+
import { getSetting } from '@woocommerce/settings'; // eslint-disable-line import/no-unresolved
7+
// The above is an unpublished package, delivered with WC, we use Dependency Extraction Webpack Plugin to import it.
8+
// See https://github.com/woocommerce/woocommerce-admin/issues/7781,
9+
// https://github.com/woocommerce/woocommerce-admin/issues/7810
10+
// Please note, that this is NOT https://www.npmjs.com/package/@woocommerce/settings,
11+
// or https://github.com/woocommerce/woocommerce-admin/tree/main/packages/wc-admin-settings
12+
// but https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/trunk/assets/js/settings/shared/index.ts
13+
// (at an unknown version).
614

715
/**
816
* Internal dependencies
@@ -15,14 +23,18 @@ import CatalogSyncApp from '../catalog-sync/App';
1523

1624
import './app/style.scss';
1725

26+
const woocommerceTranslation =
27+
// Pre WC 5.8
28+
getSetting( 'woocommerceTranslation' ) ||
29+
// WC 5.8+
30+
getSetting( 'admin' )?.woocommerceTranslation;
31+
1832
addFilter(
1933
'woocommerce_admin_pages_list',
2034
'woocommerce-marketing',
2135
( pages ) => {
2236
const navigationEnabled = !! window.wcAdminFeatures?.navigation;
23-
const initialBreadcrumbs = [
24-
[ '', wcSettings.woocommerceTranslation ],
25-
];
37+
const initialBreadcrumbs = [ [ '', woocommerceTranslation ] ];
2638

2739
/**
2840
* If the WooCommerce Navigation feature is not enabled,

package-lock.json

Lines changed: 22 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"lodash": "^4.17.15"
2424
},
2525
"devDependencies": {
26-
"@woocommerce/dependency-extraction-webpack-plugin": "^1.6.0",
26+
"@woocommerce/dependency-extraction-webpack-plugin": "^1.7.0",
2727
"@woocommerce/eslint-plugin": "^1.2.0",
2828
"@wordpress/base-styles": "^3.6.0",
2929
"@wordpress/eslint-plugin": "^9.0.2",

webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ const SetupTask = {
5050
},
5151
};
5252

53-
module.exports = [ SetupGuide, SetupTask ];
53+
module.exports = [ SetupGuide, SetupTask ];

0 commit comments

Comments
 (0)