Merge branch 'woocommerce:trunk' into flexcss

This commit is contained in:
Atanas Penchev 2023-03-10 18:34:19 +02:00 committed by GitHub
commit 420127107b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
195 changed files with 5179 additions and 3931 deletions

View File

@ -1,12 +0,0 @@
# Duplicate workflow that returns success for this check when there is no relevant file change. See https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
name: Run tests against PR
on:
pull_request:
paths:
- '!**'
- '**/changelog/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required"'

View File

@ -13,6 +13,7 @@ permissions: {}
jobs:
e2e-tests-run:
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.user.login != 'github-actions[bot]' }}
name: Runs E2E tests.
runs-on: ubuntu-20.04
permissions:

View File

@ -1,12 +0,0 @@
# Duplicate workflow that returns success for this check when there is no relevant file change. See https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
name: Build Live Branch
on:
pull_request:
paths:
- '!**'
- '**/changelog/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required"'

View File

@ -13,7 +13,7 @@ permissions: {}
jobs:
build:
if: github.repository_owner == 'woocommerce'
if: github.repository_owner == 'woocommerce' && github.event.pull_request.user.login != 'github-actions[bot]'
runs-on: ubuntu-20.04
permissions:
contents: read

View File

@ -1,12 +0,0 @@
# Duplicate workflow that returns success for this check when there is no relevant file change. See https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
name: Run code coverage on PR
on:
pull_request:
paths:
- '!**'
- '**/changelog/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required"'

View File

@ -15,6 +15,7 @@ permissions: {}
jobs:
test:
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.user.login != 'github-actions[bot]' }}
name: Code coverage (PHP 7.4, WP Latest)
timeout-minutes: 30
runs-on: ubuntu-20.04

View File

@ -1,12 +0,0 @@
# Duplicate workflow that returns success for this check when there is no relevant file change. See https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
name: Run code coverage on PR
on:
pull_request:
paths:
- '!**'
- '**/changelog/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required"'

View File

@ -16,6 +16,7 @@ permissions: {}
jobs:
test:
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.user.login != 'github-actions[bot]' }}
name: Code sniff (PHP 7.4, WP Latest)
timeout-minutes: 15
runs-on: ubuntu-20.04

View File

@ -1,12 +0,0 @@
# Duplicate workflow that returns success for this check when there is no relevant file change. See https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
name: Highlight templates changes
on:
pull_request:
paths:
- '!**'
- '**/changelog/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required"'

View File

@ -8,6 +8,7 @@ permissions: {}
jobs:
analyze:
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.user.login != 'github-actions[bot]' }}
name: Check pull request changes to highlight
runs-on: ubuntu-20.04
permissions:

View File

@ -11,6 +11,7 @@ permissions: {}
jobs:
changelogger_used:
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.user.login != 'github-actions[bot]' }}
name: Changelogger use
runs-on: ubuntu-20.04
permissions:

View File

@ -12,6 +12,7 @@ permissions: {}
jobs:
lint-test-js:
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.user.login != 'github-actions[bot]' }}
name: Lint and Test JS
runs-on: ubuntu-20.04
permissions:

View File

@ -1,12 +0,0 @@
# Duplicate workflow that returns success for this check when there is no relevant file change. See https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
name: Run smoke tests against pull request.
on:
pull_request:
paths:
- '!**'
- '**/changelog/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required"'

View File

@ -1,12 +0,0 @@
# Duplicate workflow that returns success for this check when there is no relevant file change. See https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
name: Lint and tests for JS packages and woocommerce-admin/client
on:
pull_request:
paths:
- '!**'
- '**/changelog/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required"'

View File

@ -1,12 +0,0 @@
# Duplicate workflow that returns success for this check when there is no relevant file change. See https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
name: Run unit tests on PR
on:
pull_request:
paths:
- '!**'
- '**/changelog/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required"'

View File

@ -14,6 +14,7 @@ permissions: {}
jobs:
test:
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.user.login != 'github-actions[bot]' }}
name: PHP ${{ matrix.php }} WP ${{ matrix.wp }}
timeout-minutes: 30
runs-on: ubuntu-20.04

View File

@ -1,14 +1,14 @@
name: Smoke test release
on:
release:
types: [published]
types: [released, prereleased, published]
workflow_dispatch:
inputs:
tag:
description: 'WooCommerce Release Tag'
required: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.event.release.tag_name || inputs.tag }}
cancel-in-progress: true
permissions: {}
env:
@ -23,31 +23,31 @@ jobs:
contents: read
runs-on: ubuntu-20.04
outputs:
tag: ${{ steps.tag.outputs.result }}
tag: ${{ steps.get-tag.outputs.tag }}
created: ${{ steps.created-at.outputs.created }}
steps:
- name: Validate tag
if: ${{ github.event_name == 'workflow_dispatch' }}
env:
GH_TOKEN: ${{ github.token }}
run: gh release view "${{ github.event.inputs.tag }}" --repo=woocommerce/woocommerce
GH_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
run: gh release view "${{ inputs.tag }}" --repo=woocommerce/woocommerce
- name: Get tag
uses: actions/github-script@v6
id: tag
with:
result-encoding: string
script: |
console.log( "${{ github.event_name }}" );
return "${{ github.event.release.tag_name }}" || "${{ github.event.inputs.tag }}"
- name: Get tag from triggered event
id: get-tag
env:
RELEASE_TAG: ${{ github.event.release.tag_name || inputs.tag }}
run: |
echo "Triggered event: ${{ github.event_name }}"
echo "Tag from event: $RELEASE_TAG"
echo "tag=$RELEASE_TAG" >> $GITHUB_OUTPUT
- name: Verify woocommerce.zip asset
env:
GITHUB_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ steps.tag.outputs.result }}
GH_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
RELEASE_TAG: ${{ steps.get-tag.outputs.tag }}
run: |
gh release download $RELEASE_TAG --repo woocommerce/woocommerce
if [[ -f "woocommerce.zip" ]]
ASSET_NAMES=$(gh release view $RELEASE_TAG --repo woocommerce/woocommerce --json assets --jq ".assets[].name")
if [[ $ASSET_NAMES == *"woocommerce.zip"* ]]
then
echo "$RELEASE_TAG has a valid woocommerce.zip asset."
exit 0
@ -59,8 +59,8 @@ jobs:
- name: Get 'created-at' of WooCommerce zip
id: created-at
env:
GH_TOKEN: ${{ github.token }}
run: echo "created=$(gh release view ${{ steps.tag.outputs.result }} --json assets --jq .assets[0].createdAt --repo woocommerce/woocommerce)" >> $GITHUB_OUTPUT
GH_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
run: echo "created=$(gh release view ${{ steps.get-tag.outputs.tag }} --json assets --jq .assets[0].createdAt --repo woocommerce/woocommerce)" >> $GITHUB_OUTPUT
e2e-update-wc:
name: Test WooCommerce update
@ -93,6 +93,7 @@ jobs:
CUSTOMER_PASSWORD: ${{ secrets.RELEASE_TEST_CUSTOMER_PASSWORD }}
CUSTOMER_USER: ${{ secrets.RELEASE_TEST_CUSTOMER_USER }}
DEFAULT_TIMEOUT_OVERRIDE: 120000
GITHUB_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
UPDATE_WC: ${{ needs.get-tag.outputs.tag }}
run: |
pnpm exec playwright test \
@ -106,7 +107,7 @@ jobs:
- name: Configure AWS credentials
if: success() || failure()
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v1-node16
with:
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
aws-access-key-id: ${{ secrets.REPORTS_AWS_ACCESS_KEY_ID }}
@ -183,7 +184,7 @@ jobs:
- name: Configure AWS credentials
if: success() || failure()
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v1-node16
with:
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
aws-access-key-id: ${{ secrets.REPORTS_AWS_ACCESS_KEY_ID }}
@ -284,7 +285,7 @@ jobs:
- name: Configure AWS credentials
if: success() || failure()
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v1-node16
with:
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
aws-access-key-id: ${{ secrets.REPORTS_AWS_ACCESS_KEY_ID }}
@ -393,7 +394,7 @@ jobs:
- name: Download release zip
env:
GITHUB_TOKEN: ${{ github.token }}
GH_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
run: gh release download ${{ needs.get-wp-versions.outputs.tag }} --dir tmp
- name: Replace `plugins/woocommerce` with unzipped woocommerce release build
@ -427,7 +428,7 @@ jobs:
- name: Configure AWS credentials
if: success() || failure()
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v1-node16
with:
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
aws-access-key-id: ${{ secrets.REPORTS_AWS_ACCESS_KEY_ID }}
@ -567,7 +568,7 @@ jobs:
- name: Download release zip
env:
GITHUB_TOKEN: ${{ github.token }}
GH_TOKEN: ${{ secrets.E2E_GH_TOKEN }}
run: gh release download ${{ needs.get-tag.outputs.tag }} --dir tmp
- name: Replace `plugins/woocommerce` with unzipped woocommerce release build
@ -587,7 +588,7 @@ jobs:
- name: Configure AWS credentials
if: success() || failure()
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v1-node16
with:
aws-region: ${{ secrets.REPORTS_AWS_REGION }}
aws-access-key-id: ${{ secrets.REPORTS_AWS_ACCESS_KEY_ID }}

View File

@ -0,0 +1,61 @@
# Duplicate workflow that returns success for this check when the author is "github-actions". See https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
name: Status Check Bypass for Automation
on:
pull_request:
jobs:
bypass-lint:
if: ${{ github.event.pull_request.user.login == 'github-actions[bot]' }}
runs-on: ubuntu-latest
name: "Lint and Test JS"
steps:
- run: 'echo "No build required"'
bypass-7-4-latest:
if: ${{ github.event.pull_request.user.login == 'github-actions[bot]' }}
runs-on: ubuntu-latest
name: "PHP 7.4 WP latest"
steps:
- run: 'echo "No build required"'
bypass-8-0-latest:
if: ${{ github.event.pull_request.user.login == 'github-actions[bot]' }}
runs-on: ubuntu-latest
name: "PHP 8.0 WP latest"
steps:
- run: 'echo "No build required"'
bypass-api-tests:
if: ${{ github.event.pull_request.user.login == 'github-actions[bot]' }}
runs-on: ubuntu-latest
name: "Runs API tests."
steps:
- run: 'echo "No build required"'
bypass-k6:
if: ${{ github.event.pull_request.user.login == 'github-actions[bot]' }}
runs-on: ubuntu-latest
name: "Runs k6 Performance tests"
steps:
- run: 'echo "No build required"'
bypass-sniff:
if: ${{ github.event.pull_request.user.login == 'github-actions[bot]' }}
runs-on: ubuntu-latest
name: "Code sniff (PHP 7.4, WP Latest)"
steps:
- run: 'echo "No build required"'
bypass-changelogger-use:
if: ${{ github.event.pull_request.user.login == 'github-actions[bot]' }}
runs-on: ubuntu-latest
name: "Changelogger use"
steps:
- run: 'echo "No build required"'
bypass-e2e:
if: ${{ github.event.pull_request.user.login == 'github-actions[bot]' }}
runs-on: ubuntu-latest
name: "Runs E2E tests."
steps:
- run: 'echo "No build required"'
bypass-pr-highlight:
if: ${{ github.event.pull_request.user.login == 'github-actions[bot]' }}
runs-on: ubuntu-latest
name: "Check pull request changes to highlight"
steps:
- run: 'echo "No build required"'

View File

@ -0,0 +1,56 @@
# Duplicate workflow that returns success for this check when there is no relevant file change. See https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
name: Status Check Bypass for Changelog Only Changes
on:
pull_request:
paths:
- '!**'
- '**/changelog/**'
jobs:
bypass-lint:
runs-on: ubuntu-latest
name: "Lint and Test JS"
steps:
- run: 'echo "No build required"'
bypass-7-4-latest:
runs-on: ubuntu-latest
name: "PHP 7.4 WP latest"
steps:
- run: 'echo "No build required"'
bypass-8-0-latest:
runs-on: ubuntu-latest
name: "PHP 8.0 WP latest"
steps:
- run: 'echo "No build required"'
bypass-api-tests:
runs-on: ubuntu-latest
name: "Runs API tests."
steps:
- run: 'echo "No build required"'
bypass-k6:
runs-on: ubuntu-latest
name: "Runs k6 Performance tests"
steps:
- run: 'echo "No build required"'
bypass-sniff:
runs-on: ubuntu-latest
name: "Code sniff (PHP 7.4, WP Latest)"
steps:
- run: 'echo "No build required"'
bypass-changelogger-use:
runs-on: ubuntu-latest
name: "Changelogger use"
steps:
- run: 'echo "No build required"'
bypass-e2e:
runs-on: ubuntu-latest
name: "Runs E2E tests."
steps:
- run: 'echo "No build required"'
bypass-pr-highlight:
runs-on: ubuntu-latest
name: "Check pull request changes to highlight"
steps:
- run: 'echo "No build required"'

View File

@ -25,7 +25,7 @@ jobs:
node-version: 16
- name: 'Install Syncpack'
run: npm install -g syncpack@^8.2.4
run: npm install -g syncpack@^9.8.4
- name: 'List Mismatches'
run: syncpack list-mismatches

View File

@ -1,6 +1,6 @@
{
"dev": true,
"filter": "^(?:config|react|react-dom|eslint|typescript|@typescript-eslint|@types/react).*$",
"filter": "^(?:config|react|react-dom|eslint|typescript|@typescript-eslint|@types/react|@wordpress|@types/wordpress__components|postcss).*$",
"indent": "\t",
"overrides": true,
"peer": true,
@ -72,6 +72,88 @@
"**"
],
"pinVersion": "^8.32.0"
},
{
"dependencies": [
"@wordpress/eslint-plugin",
"@wordpress/babel-plugin-import-jsx-pragma",
"@wordpress/babel-preset-default",
"@wordpress/env",
"@wordpress/stylelint-config",
"@wordpress/prettier-config",
"@wordpress/scripts",
"@wordpress/jest-console",
"@wordpress/dependency-extraction-webpack-plugin",
"@wordpress/e2e-test-utils",
"@wordpress/jest-preset-default",
"@wordpress/postcss-plugins-preset",
"@wordpress/custom-templated-path-webpack-plugin",
"@wordpress/postcss-themes"
],
"packages": [
"**"
],
"isIgnored": true
},
{
"dependencies": [
"@wordpress/block**",
"@wordpress/viewport"
],
"packages": [
"@woocommerce/product-editor",
"woocommerce/client/admin",
"@woocommerce/components"
],
"isIgnored": true
},
{
"dependencies": [
"@wordpress/**"
],
"packages": [
"@woocommerce/experimental"
],
"isIgnored": true
},
{
"dependencies": [
"@wordpress/**"
],
"packages": [
"**"
],
"pinVersion": "wp-6.0"
},
{
"dependencies": [
"@types/wordpress__components"
],
"packages": [
"**"
],
"pinVersion": "^19.10.3"
},
{
"dependencies": [
"postcss-loader"
],
"dependencyTypes": [
"devDependencies"
],
"packages": [
"**"
],
"pinVersion": "^4.3.0"
},
{
"dependencies": [
"postcss"
],
"packages": [
"**"
],
"pinVersion": "^8.4.7"
}
]
}

View File

@ -27,7 +27,7 @@ pnpm exec syncpack -- list-mismatches
if [ $? -ne 0 ]; then
echo "You must sync the dependencies listed above before you can push this branch."
echo "This can usually be accomplished automatically by updating the pinned version in `.syncpackrc` and then running \`pnpm run sync-dependencies\`."
echo "This can usually be accomplished automatically by updating the pinned version in \`.syncpackrc\` and then running \`pnpm run sync-dependencies\`."
exit 1
fi

View File

@ -29,7 +29,7 @@
"@babel/runtime": "^7.17.2",
"@types/node": "14.14.33",
"@woocommerce/eslint-plugin": "workspace:*",
"@wordpress/data": "^6.15.0",
"@wordpress/data": "wp-6.0",
"@wordpress/eslint-plugin": "^11.1.0",
"@wordpress/prettier-config": "^1.1.1",
"babel-loader": "^8.2.3",
@ -44,13 +44,13 @@
"mkdirp": "^1.0.4",
"moment": "^2.29.1",
"node-stream-zip": "^1.15.0",
"postcss-loader": "^3.0.0",
"postcss-loader": "^4.3.0",
"prettier": "npm:wp-prettier@^2.2.1-beta-1",
"regenerator-runtime": "^0.13.9",
"request": "^2.88.2",
"sass": "^1.49.9",
"sass-loader": "^10.2.1",
"syncpack": "^8.3.9",
"syncpack": "^9.8.4",
"turbo": "^1.7.0",
"typescript": "^4.8.3",
"url-loader": "^1.1.2",

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Use syncpack to update dependencies.

View File

@ -41,7 +41,7 @@
"@types/config": "0.0.41",
"@types/expect-puppeteer": "^4.4.7",
"@types/puppeteer": "^5.4.5",
"@typescript-eslint/eslint-plugin": "^5.43.0",
"@typescript-eslint/eslint-plugin": "^5.54.0",
"@woocommerce/api": "^0.2.0",
"@woocommerce/eslint-plugin": "workspace:*",
"eslint": "^8.32.0",

View File

@ -0,0 +1 @@
package-lock=false

View File

@ -0,0 +1,11 @@
# Admin Layout
A collection of WooCommerce Admin layout components and utilities.
## Installation
Install the module
```bash
pnpm install @woocommerce/product-editor --save
```

View File

@ -0,0 +1,3 @@
# Changelog
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Create @woocommerce/admin-layout package to house header, footer, and similar components and utilities.

View File

@ -0,0 +1,32 @@
{
"name": "woocommerce/admin-layout",
"description": "WooCommerce Admin layout component library",
"type": "library",
"license": "GPL-3.0-or-later",
"minimum-stability": "dev",
"require-dev": {
"automattic/jetpack-changelogger": "3.3.0"
},
"config": {
"platform": {
"php": "7.2"
}
},
"extra": {
"changelogger": {
"formatter": {
"filename": "../../../tools/changelogger/class-package-formatter.php"
},
"types": {
"fix": "Fixes an existing bug",
"add": "Adds functionality",
"update": "Update existing functionality",
"dev": "Development related task",
"tweak": "A minor adjustment to the codebase",
"performance": "Address performance issues",
"enhancement": "Improve existing functionality"
},
"changelog": "CHANGELOG.md"
}
}
}

483
packages/js/admin-layout/composer.lock generated Normal file
View File

@ -0,0 +1,483 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "5ce7bfd856ef579554b96ae2f7451072",
"packages": [],
"packages-dev": [
{
"name": "automattic/jetpack-changelogger",
"version": "v3.3.0",
"source": {
"type": "git",
"url": "https://github.com/Automattic/jetpack-changelogger.git",
"reference": "8f63c829b8d1b0d7b1d5de93510d78523ed18959"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Automattic/jetpack-changelogger/zipball/8f63c829b8d1b0d7b1d5de93510d78523ed18959",
"reference": "8f63c829b8d1b0d7b1d5de93510d78523ed18959",
"shasum": ""
},
"require": {
"php": ">=5.6",
"symfony/console": "^3.4 || ^5.2 || ^6.0",
"symfony/process": "^3.4 || ^5.2 || ^6.0",
"wikimedia/at-ease": "^1.2 || ^2.0"
},
"require-dev": {
"wikimedia/testing-access-wrapper": "^1.0 || ^2.0",
"yoast/phpunit-polyfills": "1.0.4"
},
"bin": [
"bin/changelogger"
],
"type": "project",
"extra": {
"autotagger": true,
"branch-alias": {
"dev-trunk": "3.3.x-dev"
},
"mirror-repo": "Automattic/jetpack-changelogger",
"version-constants": {
"::VERSION": "src/Application.php"
},
"changelogger": {
"link-template": "https://github.com/Automattic/jetpack-changelogger/compare/${old}...${new}"
}
},
"autoload": {
"psr-4": {
"Automattic\\Jetpack\\Changelog\\": "lib",
"Automattic\\Jetpack\\Changelogger\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-2.0-or-later"
],
"description": "Jetpack Changelogger tool. Allows for managing changelogs by dropping change files into a changelog directory with each PR.",
"support": {
"source": "https://github.com/Automattic/jetpack-changelogger/tree/v3.3.0"
},
"time": "2022-12-26T13:49:01+00:00"
},
{
"name": "psr/log",
"version": "1.1.4",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "d49695b909c3b7628b6289db5479a1c204601f11"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11",
"reference": "d49695b909c3b7628b6289db5479a1c204601f11",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Log\\": "Psr/Log/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for logging libraries",
"homepage": "https://github.com/php-fig/log",
"keywords": [
"log",
"psr",
"psr-3"
],
"support": {
"source": "https://github.com/php-fig/log/tree/1.1.4"
},
"time": "2021-05-03T11:20:27+00:00"
},
{
"name": "symfony/console",
"version": "3.4.x-dev",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "a10b1da6fc93080c180bba7219b5ff5b7518fe81"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/a10b1da6fc93080c180bba7219b5ff5b7518fe81",
"reference": "a10b1da6fc93080c180bba7219b5ff5b7518fe81",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8",
"symfony/debug": "~2.8|~3.0|~4.0",
"symfony/polyfill-mbstring": "~1.0"
},
"conflict": {
"symfony/dependency-injection": "<3.4",
"symfony/process": "<3.3"
},
"provide": {
"psr/log-implementation": "1.0"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/config": "~3.3|~4.0",
"symfony/dependency-injection": "~3.4|~4.0",
"symfony/event-dispatcher": "~2.8|~3.0|~4.0",
"symfony/lock": "~3.4|~4.0",
"symfony/process": "~3.3|~4.0"
},
"suggest": {
"psr/log": "For using the console logger",
"symfony/event-dispatcher": "",
"symfony/lock": "",
"symfony/process": ""
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Console\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/console/tree/3.4"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-10-24T10:57:07+00:00"
},
{
"name": "symfony/debug",
"version": "4.4.x-dev",
"source": {
"type": "git",
"url": "https://github.com/symfony/debug.git",
"reference": "1a692492190773c5310bc7877cb590c04c2f05be"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/1a692492190773c5310bc7877cb590c04c2f05be",
"reference": "1a692492190773c5310bc7877cb590c04c2f05be",
"shasum": ""
},
"require": {
"php": ">=7.1.3",
"psr/log": "^1|^2|^3"
},
"conflict": {
"symfony/http-kernel": "<3.4"
},
"require-dev": {
"symfony/http-kernel": "^3.4|^4.0|^5.0"
},
"default-branch": true,
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Debug\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Provides tools to ease debugging PHP code",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/debug/tree/v4.4.44"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"abandoned": "symfony/error-handler",
"time": "2022-07-28T16:29:46+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "dev-main",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "f9c7affe77a00ae32ca127ca6833d034e6d33f25"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/f9c7affe77a00ae32ca127ca6833d034e6d33f25",
"reference": "f9c7affe77a00ae32ca127ca6833d034e6d33f25",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"provide": {
"ext-mbstring": "*"
},
"suggest": {
"ext-mbstring": "For best performance"
},
"default-branch": true,
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.28-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Mbstring extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"mbstring",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/main"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2023-01-30T17:25:47+00:00"
},
{
"name": "symfony/process",
"version": "3.4.x-dev",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "b8648cf1d5af12a44a51d07ef9bf980921f15fca"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/b8648cf1d5af12a44a51d07ef9bf980921f15fca",
"reference": "b8648cf1d5af12a44a51d07ef9bf980921f15fca",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Process\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/process/tree/3.4"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-10-24T10:57:07+00:00"
},
{
"name": "wikimedia/at-ease",
"version": "v2.0.0",
"source": {
"type": "git",
"url": "https://github.com/wikimedia/at-ease.git",
"reference": "013ac61929797839c80a111a3f1a4710d8248e7a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/wikimedia/at-ease/zipball/013ac61929797839c80a111a3f1a4710d8248e7a",
"reference": "013ac61929797839c80a111a3f1a4710d8248e7a",
"shasum": ""
},
"require": {
"php": ">=5.6.99"
},
"require-dev": {
"jakub-onderka/php-console-highlighter": "0.3.2",
"jakub-onderka/php-parallel-lint": "1.0.0",
"mediawiki/mediawiki-codesniffer": "22.0.0",
"mediawiki/minus-x": "0.3.1",
"ockcyp/covers-validator": "0.5.1 || 0.6.1",
"phpunit/phpunit": "4.8.36 || ^6.5"
},
"type": "library",
"autoload": {
"files": [
"src/Wikimedia/Functions.php"
],
"psr-4": {
"Wikimedia\\AtEase\\": "src/Wikimedia/AtEase/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-2.0-or-later"
],
"authors": [
{
"name": "Tim Starling",
"email": "tstarling@wikimedia.org"
},
{
"name": "MediaWiki developers",
"email": "wikitech-l@lists.wikimedia.org"
}
],
"description": "Safe replacement to @ for suppressing warnings.",
"homepage": "https://www.mediawiki.org/wiki/at-ease",
"support": {
"source": "https://github.com/wikimedia/at-ease/tree/master"
},
"time": "2018-10-10T15:39:06+00:00"
}
],
"aliases": [],
"minimum-stability": "dev",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": [],
"platform-overrides": {
"php": "7.2"
},
"plugin-api-version": "2.3.0"
}

View File

@ -0,0 +1,72 @@
{
"name": "@woocommerce/admin-layout",
"version": "1.0.0-beta.0",
"description": "WooCommerce admin layout copmonents and utilities.",
"author": "Automattic",
"license": "GPL-2.0-or-later",
"keywords": [
"wordpress",
"woocommerce"
],
"homepage": "https://github.com/woocommerce/woocommerce/tree/trunk/packages/js/admin-layout/README.md",
"repository": {
"type": "git",
"url": "https://github.com/woocommerce/woocommerce.git"
},
"bugs": {
"url": "https://github.com/woocommerce/woocommerce/issues"
},
"main": "build/index.js",
"module": "build-module/index.js",
"types": "build-types",
"react-native": "src/index",
"sideEffects": [
"build-style/**",
"src/**/*.scss"
],
"publishConfig": {
"access": "public"
},
"scripts": {
"turbo:build": "pnpm run build:js && pnpm run build:css",
"prepare": "composer install",
"changelog": "composer exec -- changelogger",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
"lint": "eslint src",
"build:js": "tsc --build ./tsconfig.json ./tsconfig-cjs.json",
"build:css": "webpack",
"start": "concurrently \"tsc --build --watch\" \"webpack --watch\"",
"prepack": "pnpm run clean && pnpm run build",
"lint:fix": "eslint src --fix"
},
"devDependencies": {
"@types/react": "^17.0.2",
"@types/wordpress__components": "^19.10.3",
"@woocommerce/eslint-plugin": "workspace:*",
"@woocommerce/internal-style-build": "workspace:*",
"@wordpress/browserslist-config": "wp-6.0",
"css-loader": "^3.6.0",
"eslint": "^8.32.0",
"jest": "^27.5.1",
"jest-cli": "^27.5.1",
"postcss-loader": "^4.3.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"sass-loader": "^10.2.1",
"ts-jest": "^27.1.3",
"typescript": "^4.8.3",
"webpack": "^5.70.0",
"webpack-cli": "^3.3.12"
},
"peerDependencies": {
"@types/react": "^17.0.2",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"dependencies": {
"@woocommerce/components": "workspace:*",
"@wordpress/components": "wp-6.0",
"@wordpress/element": "wp-6.0"
}
}

View File

@ -0,0 +1 @@
export * from './plugins';

View File

@ -0,0 +1,10 @@
export { WC_FOOTER_SLOT_NAME, WooFooterItem } from './woo-footer-item';
export { WC_HEADER_SLOT_NAME, WooHeaderItem } from './woo-header-item';
export {
WC_HEADER_NAVIGATION_SLOT_NAME,
WooHeaderNavigationItem,
} from './woo-header-navigation-item';
export {
WC_HEADER_PAGE_TITLE_SLOT_NAME,
WooHeaderPageTitle,
} from './woo-header-page-title';

View File

@ -1,14 +1,16 @@
/**
* External dependencies
*/
import React from 'react';
import { Slot, Fill } from '@wordpress/components';
/**
* Internal dependencies
*/
import { createOrderedChildren, sortFillsByOrder } from '~/utils';
import { createElement } from '@wordpress/element';
import {
createOrderedChildren,
sortFillsByOrder,
} from '@woocommerce/components';
export const WC_FOOTER_SLOT_NAME = 'woocommerce_footer_item';
/**
* Create a Fill for extensions to add items to the WooCommerce Admin footer.
*
@ -27,7 +29,10 @@ export const WC_FOOTER_SLOT_NAME = 'woocommerce_footer_item';
* @param {Array} param0.children - Node children.
* @param {Array} param0.order - Node order.
*/
export const WooFooterItem: React.FC< { order?: number } > & {
export const WooFooterItem: React.FC< {
children?: React.ReactNode;
order?: number;
} > & {
Slot: React.FC< Slot.Props >;
} = ( { children, order = 1 } ) => {
return (

View File

@ -0,0 +1,51 @@
/**
* External dependencies
*/
import React from 'react';
import { Slot, Fill } from '@wordpress/components';
import { createElement } from '@wordpress/element';
import {
createOrderedChildren,
sortFillsByOrder,
} from '@woocommerce/components';
export const WC_HEADER_SLOT_NAME = 'woocommerce_header_item';
/**
* Create a Fill for extensions to add items to the WooCommerce Admin header.
*
* @slotFill WooHeaderItem
* @scope woocommerce-admin
* @example
* const MyHeaderItem = () => (
* <WooHeaderItem>My header item</WooHeaderItem>
* );
*
* registerPlugin( 'my-extension', {
* render: MyHeaderItem,
* scope: 'woocommerce-admin',
* } );
* @param {Object} param0
* @param {Array} param0.children - Node children.
* @param {Array} param0.order - Node order.
*/
export const WooHeaderItem: React.FC< {
children?: React.ReactNode;
order?: number;
} > & {
Slot: React.FC< Slot.Props >;
} = ( { children, order = 1 } ) => {
return (
<Fill name={ WC_HEADER_SLOT_NAME }>
{ ( fillProps: Fill.Props ) => {
return createOrderedChildren( children, order, fillProps );
} }
</Fill>
);
};
WooHeaderItem.Slot = ( { fillProps } ) => (
<Slot name={ WC_HEADER_SLOT_NAME } fillProps={ fillProps }>
{ sortFillsByOrder }
</Slot>
);

View File

@ -0,0 +1,53 @@
/**
* External dependencies
*/
import React from 'react';
import { Slot, Fill } from '@wordpress/components';
import { createElement } from '@wordpress/element';
import {
createOrderedChildren,
sortFillsByOrder,
} from '@woocommerce/components';
export const WC_HEADER_NAVIGATION_SLOT_NAME =
'woocommerce_header_navigation_item';
/**
* Create a Fill for extensions to add items to the WooCommerce Admin
* navigation area left of the page title.
*
* @slotFill WooHeaderNavigationItem
* @scope woocommerce-admin
* @example
* const MyNavigationItem = () => (
* <WooHeaderNavigationItem>My nav item</WooHeaderNavigationItem>
* );
*
* registerPlugin( 'my-extension', {
* render: MyNavigationItem,
* scope: 'woocommerce-admin',
* } );
* @param {Object} param0
* @param {Array} param0.children - Node children.
* @param {Array} param0.order - Node order.
*/
export const WooHeaderNavigationItem: React.FC< {
children?: React.ReactNode;
order?: number;
} > & {
Slot: React.FC< Slot.Props >;
} = ( { children, order = 1 } ) => {
return (
<Fill name={ WC_HEADER_NAVIGATION_SLOT_NAME }>
{ ( fillProps: Fill.Props ) => {
return createOrderedChildren( children, order, fillProps );
} }
</Fill>
);
};
WooHeaderNavigationItem.Slot = ( { fillProps }: Slot.Props ) => (
<Slot name={ WC_HEADER_NAVIGATION_SLOT_NAME } fillProps={ fillProps }>
{ sortFillsByOrder }
</Slot>
);

View File

@ -0,0 +1,41 @@
/**
* External dependencies
*/
import React from 'react';
import { Slot, Fill } from '@wordpress/components';
import { createElement, Fragment } from '@wordpress/element';
export const WC_HEADER_PAGE_TITLE_SLOT_NAME = 'woocommerce_header_page_title';
/**
* Create a Fill for extensions to add custom page titles.
*
* @slotFill WooHeaderPageTitle
* @scope woocommerce-admin
* @example
* const MyPageTitle = () => (
* <WooHeaderPageTitle>My page title</WooHeaderPageTitle>
* );
*
* registerPlugin( 'my-page-title', {
* render: MyPageTitle,
* scope: 'woocommerce-admin',
* } );
* @param {Object} param0
* @param {Array} param0.children - Node children.
*/
export const WooHeaderPageTitle: React.FC< {
children?: React.ReactNode;
} > & {
Slot: React.FC< Slot.Props >;
} = ( { children } ) => {
return <Fill name={ WC_HEADER_PAGE_TITLE_SLOT_NAME }>{ children }</Fill>;
};
WooHeaderPageTitle.Slot = ( { fillProps } ) => (
<Slot name={ WC_HEADER_PAGE_TITLE_SLOT_NAME } fillProps={ fillProps }>
{ ( fills ) => {
return <>{ [ ...fills ].pop() }</>;
} }
</Slot>
);

View File

View File

@ -0,0 +1,6 @@
{
"extends": "../tsconfig-cjs",
"compilerOptions": {
"outDir": "build"
}
}

View File

@ -0,0 +1,10 @@
{
"extends": "../tsconfig",
"compilerOptions": {
"rootDir": "src",
"outDir": "build-module",
"declaration": true,
"declarationMap": true,
"declarationDir": "./build-types"
}
}

View File

@ -0,0 +1,18 @@
/**
* Internal dependencies
*/
const { webpackConfig } = require( '@woocommerce/internal-style-build' );
module.exports = {
mode: process.env.NODE_ENV || 'development',
entry: {
'build-style': __dirname + '/src/style.scss',
},
output: {
path: __dirname,
},
module: {
rules: webpackConfig.rules,
},
plugins: webpackConfig.plugins,
};

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Syncpack update of @typescript/eslint dependencies.

View File

@ -51,8 +51,8 @@
"@types/create-hmac": "1.1.0",
"@types/jest": "^27.4.1",
"@types/node": "13.13.5",
"@typescript-eslint/eslint-plugin": "^5.43.0",
"@typescript-eslint/parser": "^5.43.0",
"@typescript-eslint/eslint-plugin": "^5.54.0",
"@typescript-eslint/parser": "^5.54.0",
"@woocommerce/eslint-plugin": "workspace:*",
"axios-mock-adapter": "^1.20.0",
"eslint": "^8.32.0",

View File

@ -0,0 +1,4 @@
Significance: minor
Type: add
Fix dependency versions

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Sync @wordpress package versions via syncpack.

View File

@ -37,33 +37,34 @@
"@types/wordpress__block-library": "^2.6.1",
"@types/wordpress__blocks": "^11.0.7",
"@types/wordpress__rich-text": "^3.4.6",
"@types/wordpress__components": "^19.10.3",
"@woocommerce/csv-export": "workspace:*",
"@woocommerce/currency": "workspace:*",
"@woocommerce/data": "workspace:*",
"@woocommerce/date": "workspace:*",
"@woocommerce/navigation": "workspace:*",
"@wordpress/a11y": "3.5.0",
"@wordpress/api-fetch": "^6.0.1",
"@wordpress/base-styles": "^4.3.0",
"@wordpress/a11y": "wp-6.0",
"@wordpress/api-fetch": "wp-6.0",
"@wordpress/base-styles": "wp-6.0",
"@wordpress/block-editor": "^9.8.0",
"@wordpress/block-library": "^7.16.0",
"@wordpress/blocks": "^11.18.0",
"@wordpress/components": "19.8.5",
"@wordpress/compose": "5.4.1",
"@wordpress/core-data": "^4.2.1",
"@wordpress/date": "^4.3.1",
"@wordpress/deprecated": "^3.3.1",
"@wordpress/dom": "^3.3.2",
"@wordpress/element": "^4.1.1",
"@wordpress/hooks": "^3.5.0",
"@wordpress/html-entities": "^3.3.1",
"@wordpress/i18n": "^4.3.1",
"@wordpress/icons": "^8.1.0",
"@wordpress/keyboard-shortcuts": "^3.17.0",
"@wordpress/keycodes": "^3.3.1",
"@wordpress/media-utils": "^4.6.0",
"@wordpress/rich-text": "^5.17.0",
"@wordpress/url": "^3.4.1",
"@wordpress/components": "wp-6.0",
"@wordpress/compose": "wp-6.0",
"@wordpress/core-data": "wp-6.0",
"@wordpress/date": "wp-6.0",
"@wordpress/deprecated": "wp-6.0",
"@wordpress/dom": "wp-6.0",
"@wordpress/element": "wp-6.0",
"@wordpress/hooks": "wp-6.0",
"@wordpress/html-entities": "wp-6.0",
"@wordpress/i18n": "wp-6.0",
"@wordpress/icons": "wp-6.0",
"@wordpress/keyboard-shortcuts": "wp-6.0",
"@wordpress/keycodes": "wp-6.0",
"@wordpress/media-utils": "wp-6.0",
"@wordpress/rich-text": "wp-6.0",
"@wordpress/url": "wp-6.0",
"@wordpress/viewport": "^4.1.2",
"classnames": "^2.3.1",
"core-js": "^3.21.1",
@ -86,8 +87,10 @@
"react-transition-group": "^4.4.2"
},
"peerDependencies": {
"@wordpress/data": "^6.2.1",
"@wordpress/data": "wp-6.0",
"lodash": "^4.17.0",
"@types/react": "^17.0.2",
"@types/react-dom": "^17.0.2",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
@ -117,23 +120,23 @@
"@types/jest": "^27.4.1",
"@types/lodash": "^4.14.184",
"@types/prop-types": "^15.7.4",
"@types/react": "^17.0.2",
"@types/testing-library__jest-dom": "^5.14.3",
"@types/uuid": "^8.3.0",
"@types/wordpress__components": "^19.10.1",
"@types/wordpress__components": "^19.10.3",
"@types/wordpress__data": "^6.0.0",
"@types/wordpress__media-utils": "^3.0.0",
"@types/wordpress__viewport": "^2.5.4",
"@woocommerce/eslint-plugin": "workspace:*",
"@woocommerce/internal-style-build": "workspace:*",
"@wordpress/browserslist-config": "^4.1.1",
"@wordpress/browserslist-config": "wp-6.0",
"@wordpress/scripts": "^12.6.1",
"concurrently": "^7.0.0",
"css-loader": "^3.6.0",
"eslint": "^8.32.0",
"jest": "^27.5.1",
"jest-cli": "^27.5.1",
"postcss-loader": "^3.0.0",
"postcss": "^8.4.7",
"postcss-loader": "^4.3.0",
"react": "^17.0.2",
"rimraf": "^3.0.2",
"sass-loader": "^10.2.1",
@ -168,6 +171,8 @@
},
"pnpm": {
"overrides": {
"@types/react": "^17.0.2",
"@types/react-dom": "^17.0.2",
"react": "^17.0.2",
"react-dom": "^17.0.2"
}

View File

@ -131,7 +131,8 @@ export const DateTimePickerControl: React.FC< DateTimePickerControlProps > = ( {
const formatDateTimeForDisplay = useCallback(
( dateTime: Moment ) => {
return dateTime.isValid()
? formatDate( displayFormat, dateTime.local() )
? // @ts-expect-error TODO - fix this type error with moment
formatDate( displayFormat, dateTime.local() )
: dateTime.creationData().input?.toString() || '';
},
[ displayFormat ]

View File

@ -103,6 +103,7 @@ describe( 'DateTimePickerControl', () => {
const input = container.querySelector( 'input' );
expect( input?.value ).toBe(
// @ts-expect-error TODO - fix this type error with moment
formatDate( default24HourDateTimeFormat, dateTime )
);
} );
@ -122,6 +123,7 @@ describe( 'DateTimePickerControl', () => {
expect( input?.value ).toBe(
formatDate(
default24HourDateTimeFormat,
// @ts-expect-error TODO - fix this type error with moment
moment.utc( ambiguousISODateTimeString ).local()
)
);
@ -142,6 +144,7 @@ describe( 'DateTimePickerControl', () => {
expect( input?.value ).toBe(
formatDate(
default24HourDateTimeFormat,
// @ts-expect-error TODO - fix this type error with moment
moment.utc( unambiguousISODateTimeString ).local()
)
);
@ -159,6 +162,7 @@ describe( 'DateTimePickerControl', () => {
const input = container.querySelector( 'input' );
expect( input?.value ).toBe(
// @ts-expect-error TODO - fix this type error with moment
formatDate( default12HourDateTimeFormat, dateTime )
);
} );
@ -175,6 +179,7 @@ describe( 'DateTimePickerControl', () => {
);
const input = container.querySelector( 'input' );
// @ts-expect-error TODO - fix this type error with moment
expect( input?.value ).toBe( formatDate( dateTimeFormat, dateTime ) );
} );
@ -198,6 +203,7 @@ describe( 'DateTimePickerControl', () => {
const input = container.querySelector( 'input' );
expect( input?.value ).toBe(
// @ts-expect-error TODO - fix this type error with moment
formatDate( default24HourDateTimeFormat, updatedDateTime )
);
} );

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Sync @wordpress package versions via syncpack.

View File

@ -27,11 +27,11 @@
"react-native": "src/index",
"dependencies": {
"@woocommerce/number": "workspace:*",
"@wordpress/deprecated": "^2.12.3",
"@wordpress/element": "^4.1.1",
"@wordpress/hooks": "^3.5.0",
"@wordpress/html-entities": "^3.3.1",
"@wordpress/i18n": "^3.20.0"
"@wordpress/deprecated": "wp-6.0",
"@wordpress/element": "wp-6.0",
"@wordpress/hooks": "wp-6.0",
"@wordpress/html-entities": "wp-6.0",
"@wordpress/i18n": "wp-6.0"
},
"publishConfig": {
"access": "public"

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Sync @wordpress package versions via syncpack.

View File

@ -26,12 +26,12 @@
"react-native": "src/index",
"dependencies": {
"@woocommerce/experimental": "workspace:*",
"@wordpress/components": "^19.5.0",
"@wordpress/compose": "^5.1.2",
"@wordpress/data": "^6.15.0",
"@wordpress/element": "^4.1.1",
"@wordpress/i18n": "^4.3.1",
"@wordpress/notices": "^3.3.2",
"@wordpress/components": "wp-6.0",
"@wordpress/compose": "wp-6.0",
"@wordpress/data": "wp-6.0",
"@wordpress/element": "wp-6.0",
"@wordpress/i18n": "wp-6.0",
"@wordpress/notices": "wp-6.0",
"classnames": "^2.3.1",
"prop-types": "^15.8.1",
"react-transition-group": "^4.4.2"
@ -45,17 +45,18 @@
"@types/jest": "^27.4.1",
"@types/prop-types": "^15.7.4",
"@types/testing-library__jest-dom": "^5.14.3",
"@types/wordpress__components": "^19.10.1",
"@types/wordpress__components": "^19.10.3",
"@types/wordpress__data": "^6.0.0",
"@woocommerce/eslint-plugin": "workspace:*",
"@woocommerce/internal-style-build": "workspace:*",
"@wordpress/browserslist-config": "^4.1.1",
"@wordpress/browserslist-config": "wp-6.0",
"concurrently": "^7.0.0",
"css-loader": "^3.6.0",
"eslint": "^8.32.0",
"jest": "^27.5.1",
"jest-cli": "^27.5.1",
"postcss-loader": "^3.0.0",
"postcss": "^8.4.7",
"postcss-loader": "^4.3.0",
"rimraf": "^3.0.2",
"sass-loader": "^10.2.1",
"ts-jest": "^27.1.3",

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Sync @wordpress package versions via syncpack.

View File

@ -28,16 +28,16 @@
"dependencies": {
"@woocommerce/date": "workspace:*",
"@woocommerce/navigation": "workspace:*",
"@wordpress/api-fetch": "^6.0.1",
"@wordpress/compose": "^5.1.2",
"@wordpress/core-data": "^4.1.2",
"@wordpress/data": "^6.15.0",
"@wordpress/data-controls": "^2.3.2",
"@wordpress/deprecated": "^3.3.1",
"@wordpress/element": "^4.1.1",
"@wordpress/hooks": "^3.5.0",
"@wordpress/i18n": "^4.3.1",
"@wordpress/url": "^3.4.1",
"@wordpress/api-fetch": "wp-6.0",
"@wordpress/compose": "wp-6.0",
"@wordpress/core-data": "wp-6.0",
"@wordpress/data": "wp-6.0",
"@wordpress/data-controls": "wp-6.0",
"@wordpress/deprecated": "wp-6.0",
"@wordpress/element": "wp-6.0",
"@wordpress/hooks": "wp-6.0",
"@wordpress/i18n": "wp-6.0",
"@wordpress/url": "wp-6.0",
"dompurify": "^2.3.6",
"md5": "^2.3.0",
"qs": "^6.10.3",
@ -72,7 +72,7 @@
"typescript": "^4.8.3"
},
"peerDependencies": {
"@wordpress/core-data": "^4.1.0",
"@wordpress/core-data": "wp-6.0",
"moment": "^2.18.1",
"react": "^17.0.2",
"react-dom": "^17.0.2"

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Sync @wordpress package versions via syncpack.

View File

@ -27,8 +27,8 @@
"react-native": "src/index",
"dependencies": {
"@types/d3-time-format": "^2.3.0",
"@wordpress/date": "^4.3.1",
"@wordpress/i18n": "^4.3.1",
"@wordpress/date": "wp-6.0",
"@wordpress/i18n": "wp-6.0",
"moment": "^2.29.1",
"moment-timezone": "^0.5.34",
"qs": "^6.10.3"

View File

@ -1,5 +1,6 @@
module.exports = [
// wc-admin packages
'@woocommerce/admin-layout',
'@woocommerce/components',
'@woocommerce/csv-export',
'@woocommerce/currency',

View File

@ -0,0 +1,4 @@
Significance: minor
Type: add
Add @woocommerce/admin-layout package.

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Sync @wordpress package versions via syncpack.

View File

@ -24,7 +24,7 @@
],
"dependencies": {
"@jest/globals": "^27.5.1",
"@wordpress/deprecated": "^3.2.3",
"@wordpress/deprecated": "wp-6.0",
"config": "3.3.7"
},
"devDependencies": {
@ -40,7 +40,7 @@
"@woocommerce/internal-e2e-builds": "workspace:*",
"@wordpress/babel-plugin-import-jsx-pragma": "1.1.3",
"@wordpress/babel-preset-default": "3.0.2",
"@wordpress/browserslist-config": "^4.1.0",
"@wordpress/browserslist-config": "wp-6.0",
"eslint": "^8.32.0",
"eslint-plugin-jest": "23.20.0"
},

View File

@ -57,7 +57,7 @@
"@woocommerce/internal-e2e-builds": "workspace:*",
"@wordpress/babel-plugin-import-jsx-pragma": "1.1.3",
"@wordpress/babel-preset-default": "3.0.2",
"@wordpress/browserslist-config": "^4.1.0",
"@wordpress/browserslist-config": "wp-6.0",
"ndb": "^1.1.5",
"semver": "^7.3.2"
},

View File

@ -16,8 +16,8 @@
"module": "build-module/index.js",
"dependencies": {
"@automattic/puppeteer-utils": "github:Automattic/puppeteer-utils#0f3ec50",
"@wordpress/deprecated": "^3.2.3",
"@wordpress/e2e-test-utils": "wp-5.8",
"@wordpress/deprecated": "wp-6.0",
"@wordpress/e2e-test-utils": "wp-6.0",
"config": "3.3.7",
"fishery": "^1.2.0"
},
@ -30,13 +30,13 @@
"@babel/plugin-transform-runtime": "^7.16.4",
"@babel/polyfill": "7.12.1",
"@babel/preset-env": "7.12.7",
"@typescript-eslint/eslint-plugin": "^5.43.0",
"@typescript-eslint/parser": "^5.43.0",
"@typescript-eslint/eslint-plugin": "^5.54.0",
"@typescript-eslint/parser": "^5.54.0",
"@woocommerce/eslint-plugin": "workspace:*",
"@woocommerce/internal-e2e-builds": "workspace:*",
"@wordpress/babel-plugin-import-jsx-pragma": "1.1.3",
"@wordpress/babel-preset-default": "3.0.2",
"@wordpress/browserslist-config": "^4.1.0",
"@wordpress/browserslist-config": "wp-6.0",
"eslint": "^8.32.0",
"eslint-plugin-jest": "23.20.0"
},

View File

@ -0,0 +1,4 @@
module.exports = {
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
root: true,
};

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Sync @wordpress package versions via syncpack.

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Sync @wordpress package versions via syncpack.

View File

@ -59,16 +59,17 @@
"@types/jest": "^27.4.1",
"@types/react-transition-group": "^4.4.4",
"@types/testing-library__jest-dom": "^5.14.3",
"@types/wordpress__components": "^19.10.1",
"@types/wordpress__components": "^19.10.3",
"@woocommerce/eslint-plugin": "workspace:*",
"@woocommerce/internal-style-build": "workspace:*",
"@wordpress/browserslist-config": "^4.1.1",
"@wordpress/browserslist-config": "wp-6.0",
"concurrently": "^7.0.0",
"css-loader": "^3.6.0",
"eslint": "^8.32.0",
"jest": "^27.5.1",
"jest-cli": "^27.5.1",
"postcss-loader": "^3.0.0",
"postcss": "^8.4.7",
"postcss-loader": "^4.3.0",
"rimraf": "^3.0.2",
"sass-loader": "^10.2.1",
"ts-jest": "^27.1.3",

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Sync @wordpress package versions via syncpack.

View File

@ -32,8 +32,8 @@
"dependencies": {
"@automattic/explat-client": "^0.0.3",
"@automattic/explat-client-react-helpers": "^0.0.4",
"@wordpress/api-fetch": "^6.0.1",
"@wordpress/hooks": "^3.5.0",
"@wordpress/api-fetch": "wp-6.0",
"@wordpress/hooks": "wp-6.0",
"cookie": "^0.4.2",
"qs": "^6.10.3"
},

View File

@ -32,8 +32,8 @@
"dependencies": {
"@testing-library/jest-dom": "^5.16.2",
"@testing-library/react": "^12.1.3",
"@wordpress/data": "^6.15.0",
"@wordpress/i18n": "^4.3.1",
"@wordpress/data": "wp-6.0",
"@wordpress/i18n": "wp-6.0",
"@wordpress/jest-console": "^5.0.1",
"regenerator-runtime": "^0.13.9"
},

View File

@ -9,10 +9,15 @@ if ( global.window ) {
};
global.window.requestAnimationFrame = setTimeout;
global.window.cancelAnimationFrame = clearTimeout;
global.window.matchMedia = () => ( {
global.window.matchMedia = ( query ) => ( {
matches: false,
addListener: () => {},
removeListener: () => {},
media: query,
onchange: null,
addListener: () => {}, // Deprecated
removeListener: () => {}, // Deprecated
addEventListener: () => {},
removeEventListener: () => {},
dispatchEvent: () => true,
} );
// Setup fake localStorage

View File

@ -21,10 +21,11 @@ module.exports = {
{
loader: 'postcss-loader',
options: {
ident: 'postcss',
postcssOptions: {
plugins: postcssPlugins,
},
},
},
{
loader: 'sass-loader',
options: {

View File

@ -23,11 +23,11 @@
"main": "index.js",
"dependencies": {
"@automattic/color-studio": "^2.5.0",
"@wordpress/base-styles": "^4.3.0",
"@wordpress/postcss-plugins-preset": "^1.6.0",
"@wordpress/base-styles": "wp-6.0",
"@wordpress/postcss-plugins-preset": "wp-6.0",
"css-loader": "^3.6.0",
"mini-css-extract-plugin": "^2.6.0",
"postcss-loader": "^3.0.0",
"postcss-loader": "^4.3.0",
"sass-loader": "^10.2.1",
"webpack-remove-empty-scripts": "^0.7.3",
"webpack-rtl-plugin": "^2.0.0"

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Sync @wordpress package versions via syncpack.

View File

@ -26,13 +26,13 @@
"types": "build-types",
"react-native": "src/index",
"dependencies": {
"@wordpress/api-fetch": "^6.0.1",
"@wordpress/components": "^19.5.0",
"@wordpress/compose": "^5.1.2",
"@wordpress/element": "^4.1.1",
"@wordpress/hooks": "^3.5.0",
"@wordpress/notices": "^3.3.2",
"@wordpress/url": "^3.4.1",
"@wordpress/api-fetch": "wp-6.0",
"@wordpress/components": "wp-6.0",
"@wordpress/compose": "wp-6.0",
"@wordpress/element": "wp-6.0",
"@wordpress/hooks": "wp-6.0",
"@wordpress/notices": "wp-6.0",
"@wordpress/url": "wp-6.0",
"history": "^5.3.0",
"qs": "^6.10.3",
"react-router-dom": "^6.3.0"

View File

@ -27,9 +27,9 @@
"types": "build-types",
"react-native": "src/index",
"dependencies": {
"@wordpress/a11y": "^3.5.0",
"@wordpress/data": "^6.15.0",
"@wordpress/notices": "^3.3.2"
"@wordpress/a11y": "wp-6.0",
"@wordpress/data": "wp-6.0",
"@wordpress/notices": "wp-6.0"
},
"peerDependencies": {
"lodash": "^4.17.0",

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Sync @wordpress package versions via syncpack.

View File

@ -34,24 +34,25 @@
"@woocommerce/experimental": "workspace:*",
"@woocommerce/explat": "workspace:*",
"@woocommerce/tracks": "workspace:*",
"@wordpress/components": "^19.5.0",
"@wordpress/element": "^4.1.1",
"@wordpress/i18n": "^4.3.1",
"@wordpress/components": "wp-6.0",
"@wordpress/element": "wp-6.0",
"@wordpress/i18n": "wp-6.0",
"concurrently": "^7.0.0",
"gridicons": "^3.4.0"
},
"devDependencies": {
"@babel/core": "^7.17.5",
"@types/wordpress__components": "^19.10.3",
"@types/wordpress__data": "^6.0.0",
"@woocommerce/eslint-plugin": "workspace:*",
"@woocommerce/internal-style-build": "workspace:*",
"@wordpress/browserslist-config": "^4.1.1",
"@types/wordpress__components": "^19.10.1",
"@wordpress/browserslist-config": "wp-6.0",
"css-loader": "^3.6.0",
"eslint": "^8.32.0",
"jest": "^27.5.1",
"jest-cli": "^27.5.1",
"postcss-loader": "^3.0.0",
"postcss": "^8.4.7",
"postcss-loader": "^4.3.0",
"rimraf": "^3.0.2",
"sass-loader": "^10.2.1",
"ts-jest": "^27.1.3",

View File

@ -0,0 +1,12 @@
module.exports = {
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended' ],
root: true,
overrides: [
{
files: [ '**/*.js', '**/*.jsx', '**/*.tsx' ],
rules: {
'react/react-in-jsx-scope': 'off',
},
},
],
};

View File

@ -0,0 +1,4 @@
Significance: minor
Type: add
Create the product block editor

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Suppress errant TS lint errors.

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
Sync @wordpress package versions via syncpack.

View File

@ -36,14 +36,19 @@
"@woocommerce/data": "workspace:^4.1.0",
"@woocommerce/number": "workspace:*",
"@woocommerce/tracks": "workspace:^1.3.0",
"@wordpress/blocks": "^11.17.0",
"@wordpress/components": "^19.5.0",
"@wordpress/compose": "^5.1.2",
"@wordpress/element": "^4.1.1",
"@wordpress/html-entities": "^3.3.1",
"@wordpress/i18n": "^4.26.0",
"@wordpress/icons": "^8.1.0",
"@wordpress/url": "^3.4.1",
"@wordpress/block-editor": "^9.8.0",
"@wordpress/blocks": "^12.3.0",
"@wordpress/data": "wp-6.0",
"@wordpress/interface": "wp-6.0",
"@wordpress/keyboard-shortcuts": "wp-6.0",
"@wordpress/media-utils": "wp-6.0",
"@wordpress/components": "wp-6.0",
"@wordpress/compose": "wp-6.0",
"@wordpress/element": "wp-6.0",
"@wordpress/html-entities": "wp-6.0",
"@wordpress/i18n": "wp-6.0",
"@wordpress/icons": "wp-6.0",
"@wordpress/url": "wp-6.0",
"classnames": "^2.3.1",
"lodash": "^4.17.21",
"react-router-dom": "^6.3.0"
@ -51,18 +56,22 @@
"devDependencies": {
"@testing-library/react": "^12.1.3",
"@types/react": "^17.0.2",
"@types/wordpress__components": "^19.10.1",
"@types/wordpress__data": "^6.0.0",
"@types/wordpress__block-editor": "^7.0.0",
"@types/wordpress__blocks": "^11.0.7",
"@types/wordpress__components": "^19.10.3",
"@types/wordpress__data": "^6.0.2",
"@types/wordpress__media-utils": "^3.0.0",
"@woocommerce/eslint-plugin": "workspace:*",
"@woocommerce/internal-style-build": "workspace:*",
"@wordpress/block-editor": "^9.8.0",
"@wordpress/browserslist-config": "^4.1.1",
"@wordpress/browserslist-config": "wp-6.0",
"concurrently": "^7.0.0",
"css-loader": "^3.6.0",
"eslint": "^8.32.0",
"jest": "^27.5.1",
"jest-cli": "^27.5.1",
"postcss-loader": "^3.0.0",
"postcss": "^8.4.7",
"postcss-loader": "^4.3.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-hooks^8.0.1": "link:@testing-library/react-hooks^8.0.1",
@ -88,7 +97,7 @@
},
"peerDependencies": {
"@types/react": "^17.0.2",
"@wordpress/data": "^6.15.0",
"@wordpress/data": "wp-6.0",
"react": "^17.0.2",
"react-dom": "^17.0.2"
}

View File

@ -0,0 +1,114 @@
/**
* External dependencies
*/
import { BlockInstance } from '@wordpress/blocks';
import { createElement, useState, useMemo } from '@wordpress/element';
import { Product } from '@woocommerce/data';
import { useSelect, select as WPSelect } from '@wordpress/data';
import { uploadMedia } from '@wordpress/media-utils';
import {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore No types for this exist yet.
BlockBreadcrumb,
BlockEditorKeyboardShortcuts,
BlockEditorProvider,
BlockList,
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore No types for this exist yet.
BlockTools,
BlockInspector,
EditorSettings,
EditorBlockListSettings,
WritingFlow,
ObserveTyping,
} from '@wordpress/block-editor';
/**
* Internal dependencies
*/
import { Sidebar } from '../sidebar';
type BlockEditorProps = {
product: Partial< Product >;
settings: Partial< EditorSettings & EditorBlockListSettings > | undefined;
};
export function BlockEditor( { settings: _settings }: BlockEditorProps ) {
const [ blocks, updateBlocks ] = useState< BlockInstance[] >();
const canUserCreateMedia = useSelect( ( select: typeof WPSelect ) => {
const { canUser } = select( 'core' ) as Record<
string,
( ...args: string[] ) => boolean
>;
return canUser( 'create', 'media' ) !== false;
}, [] );
const settings = useMemo( () => {
if ( ! canUserCreateMedia ) {
return _settings;
}
return {
..._settings,
mediaUpload( {
onError,
...rest
}: {
onError: ( message: string ) => void;
} ) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore No types for this exist yet.
uploadMedia( {
wpAllowedMimeTypes:
_settings?.allowedMimeTypes || undefined,
onError: ( { message } ) => onError( message ),
...rest,
} );
},
};
}, [ canUserCreateMedia, _settings ] );
/**
* Wrapper for updating blocks. Required as `onInput` callback passed to
* `BlockEditorProvider` is now called with more than 1 argument. Therefore
* attempting to setState directly via `updateBlocks` will trigger an error
* in React.
*
* @param _blocks
*/
function handleUpdateBlocks( _blocks: BlockInstance[] ) {
updateBlocks( _blocks );
}
function handlePersistBlocks( newBlocks: BlockInstance[] ) {
updateBlocks( newBlocks );
}
return (
<div className="woocommerce-product-block-editor">
<BlockEditorProvider
value={ blocks }
onInput={ handleUpdateBlocks }
onChange={ handlePersistBlocks }
settings={ settings }
>
<BlockBreadcrumb />
<Sidebar.InspectorFill>
<BlockInspector />
</Sidebar.InspectorFill>
<div className="editor-styles-wrapper">
{ /* eslint-disable-next-line @typescript-eslint/ban-ts-comment */ }
{ /* @ts-ignore No types for this exist yet. */ }
<BlockEditorKeyboardShortcuts.Register />
<BlockTools>
<WritingFlow>
<ObserveTyping>
<BlockList className="woocommerce-product-block-editor__block-list" />
</ObserveTyping>
</WritingFlow>
</BlockTools>
</div>
</BlockEditorProvider>
</div>
);
}

View File

@ -0,0 +1 @@
export * from './block-editor';

View File

@ -0,0 +1,7 @@
.woocommerce-product-block-editor {
.editor-styles-wrapper {
max-width: 650px;
margin-left: auto;
margin-right: auto;
}
}

View File

@ -122,10 +122,13 @@ export async function getCategoriesTreeWithMissingParents(
// Retrieve the missing parent objects incase not all of them were included.
if ( missingParents.length > 0 ) {
return resolveSelect( EXPERIMENTAL_PRODUCT_CATEGORIES_STORE_NAME )
return (
resolveSelect( EXPERIMENTAL_PRODUCT_CATEGORIES_STORE_NAME )
.getProductCategories( {
include: missingParents,
} )
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
.then( ( parentCategories ) => {
return getCategoriesTreeWithMissingParents(
[
@ -134,7 +137,8 @@ export async function getCategoriesTreeWithMissingParents(
],
search
);
} );
} )
);
}
const categoryTreeList = sortCategoryTreeItems(
Object.values( items ).filter( ( item ) => item.parentID === 0 )
@ -158,6 +162,8 @@ const productCategoryQueryObject = {
export const useCategorySearch = () => {
const lastSearchValue = useRef( '' );
const { initialCategories, totalCount } = useSelect(
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
( select: WCDataSelector ) => {
const { getProductCategories, getProductCategoriesTotalCount } =
select( EXPERIMENTAL_PRODUCT_CATEGORIES_STORE_NAME );

View File

@ -27,6 +27,8 @@ export const DetailsNameField = ( {} ) => {
useFormContext< Product >();
const { permalinkPrefix, permalinkSuffix } = useSelect(
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
( select: WCDataSelector ) => {
const { getPermalinkParts } = select( PRODUCTS_STORE_NAME );
if ( values.id ) {

View File

@ -11,6 +11,14 @@ import { createElement } from '@wordpress/element';
*/
import { EditProductLinkModal } from '../';
jest.mock( '@woocommerce/product-editor', () => ( {
__experimentalUseProductHelper: jest.fn().mockReturnValue( {
updateProductWithStatus: jest.fn(),
isUpdatingDraft: jest.fn(),
isUpdatingPublished: jest.fn(),
} ),
} ) );
describe( 'EditProductLinkModal', () => {
beforeEach( () => {
jest.clearAllMocks();

View File

@ -0,0 +1,55 @@
/**
* External dependencies
*/
import { createElement, StrictMode } from '@wordpress/element';
import {
EditorSettings,
EditorBlockListSettings,
} from '@wordpress/block-editor';
import { SlotFillProvider } from '@wordpress/components';
import { Product } from '@woocommerce/data';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore No types for this exist yet.
// eslint-disable-next-line @woocommerce/dependency-group
import { ShortcutProvider } from '@wordpress/keyboard-shortcuts';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore No types for this exist yet.
// eslint-disable-next-line @woocommerce/dependency-group
import { FullscreenMode, InterfaceSkeleton } from '@wordpress/interface';
/**
* Internal dependencies
*/
import { Header } from '../header';
import { Sidebar } from '../sidebar';
import { BlockEditor } from '../block-editor';
import { initBlocks } from './init-blocks';
initBlocks();
type EditorProps = {
product: Product;
settings: Partial< EditorSettings & EditorBlockListSettings > | undefined;
};
export function Editor( { product, settings }: EditorProps ) {
return (
<StrictMode>
<ShortcutProvider>
<FullscreenMode isActive={ false } />
<SlotFillProvider>
<InterfaceSkeleton
header={ <Header title={ product.name } /> }
sidebar={ <Sidebar /> }
content={
<BlockEditor
settings={ settings }
product={ product }
/>
}
/>
</SlotFillProvider>
</ShortcutProvider>
</StrictMode>
);
}

View File

@ -0,0 +1 @@
export * from './editor';

View File

@ -0,0 +1,5 @@
/**
* Internal dependencies
*/
export const initBlocks = () => {};

View File

@ -0,0 +1,13 @@
@import '@wordpress/interface/src/style.scss';
.interface-interface-skeleton {
@include breakpoint( '<782px' ) {
top: $adminbar-height-mobile;
}
top: $adminbar-height;
background-color: $white;
}
.interface-interface-skeleton__sidebar {
width: 280px;
}

View File

@ -0,0 +1,22 @@
/**
* External dependencies
*/
import { __ } from '@wordpress/i18n';
import { createElement } from '@wordpress/element';
export type HeaderProps = {
title: string;
};
export function Header( { title }: HeaderProps ) {
return (
<div
className="woocommerce-product-header"
role="region"
aria-label={ __( 'Product Editor top bar.', 'woocommerce' ) }
tabIndex={ -1 }
>
<h1 className="woocommerce-product-header__title">{ title }</h1>
</div>
);
}

View File

@ -0,0 +1 @@
export * from './header';

View File

@ -0,0 +1,6 @@
.woocommerce-product-header {
height: $header-height;
display: flex;
align-items: center;
padding: 0 $gap;
}

View File

@ -10,3 +10,4 @@ export { DetailsFeatureField as __experimentalDetailsFeatureField } from './deta
export { DetailsCategoriesField as __experimentalDetailsCategoriesField } from './details-categories-field';
export { DetailsSummaryField as __experimentalDetailsSummaryField } from './details-summary-field';
export { DetailsDescriptionField as __experimentalDetailsDescriptionField } from './details-description-field';
export { Editor as __experimentalEditor } from './editor';

View File

@ -0,0 +1 @@
export * from './sidebar';

View File

@ -0,0 +1,30 @@
/**
* External dependencies
*/
import { __ } from '@wordpress/i18n';
import { createElement } from '@wordpress/element';
import { createSlotFill, Panel } from '@wordpress/components';
const { Slot: InspectorSlot, Fill: InspectorFill } = createSlotFill(
'ProductBlockEditorSidebarInspector'
);
export function Sidebar() {
return (
<div
className="woocommerce-product-sidebar"
role="region"
aria-label={ __(
'Product Block Editor advanced settings.',
'woocommerce'
) }
tabIndex={ -1 }
>
<Panel header={ __( 'Inspector', 'woocommerce' ) }>
<InspectorSlot bubblesVirtually />
</Panel>
</div>
);
}
Sidebar.InspectorFill = InspectorFill;

View File

@ -60,7 +60,15 @@ export function useProductHelper() {
const {
batchUpdateProductVariations,
invalidateResolutionForStoreSelector,
} = useDispatch( EXPERIMENTAL_PRODUCT_VARIATIONS_STORE_NAME );
} = useDispatch( EXPERIMENTAL_PRODUCT_VARIATIONS_STORE_NAME ) as {
batchUpdateProductVariations< T >(
id: Record< string, number >,
data: Record< string, unknown >
): T;
invalidateResolutionForStoreSelector(
...args: string[]
): Promise< void >;
};
const { createNotice } = useDispatch( 'core/notices' );
const [ isDeleting, setIsDeleting ] = useState( false );

Some files were not shown because too many files have changed in this diff Show More