Commit Graph

64 Commits

Author SHA1 Message Date
Joshua T Flowers 64dbeba260
Add ContentPreview component for previewing block content (#37990)
* Allow custom tags and attributes in sanitize html util

* Add ContentPreview component for previewing block content

* Add styling around preview area

* Add changelog entry

* Only show content preview area when content exists
2023-04-26 19:29:50 -07:00
Joel Thiessen 6f7eeeaf49
Refactoring LayoutContext and implementing with product editor (#37720) 2023-04-25 15:17:33 -07:00
Joshua T Flowers 48af8c1333
Add the product description block and callbacks for the IframeEditor (#37852)
* Add onChange and onClose callbacks to IframeEditor

* Add description block

* Add initial blocks to iframe editor

* Update button text when description already exists

* Remove unused editorStyle block property

* Debounce onChange callback

* Add changelog entry

* Handle PR feedback

* Fix up export after rebase
2023-04-25 11:05:25 -07:00
Maikel David Pérez Gómez fb7e68a83d
Track stock quantity for this product should be disabled when Enable stock management within settings is disabled, and enabled otherwise (#37957)
* Track stock quantity for this product should be disabled when Enable stock management within settings is disabled, and enabled otherwise.

* Add changelog files
2023-04-24 13:42:45 -04:00
Joel Thiessen 3c5a96712a
Adding Stock status to inventory tab and toggle block (#37906) 2023-04-21 14:49:34 -07:00
Maikel David Pérez Gómez 1f2d735d0c
Update current block names to reflect use case and avoid conflicts (#37851)
* Change woocommerce/product-name to woocommerce/product-name-field

* Change woocommerce/product-summary to woocommerce/product-summary-field

* Change woocommerce/product-pricing to woocommerce/product-pricing-field

* Change woocommerce/product-radio to woocommerce/product-radio-field

* Change woocommerce/product-images to woocommerce/product-images-field

* Fix product name block invalid class name

* Move woocommerce/product-section to blocks folder

* Move woocommerce/product-tab to blocks folder

* Move woocommerce/product-collapsible to blocks folder

* Organize block registration, imports and styles

* Add changelog files

* Change woocommerce/product-category to woocommerce/product-category-field

* Change woocommerce/product-checkbox to woocommerce/product-checkbox-field

* Change woocommerce/product-inventory-email to woocommerce/product-inventory-email-field

* Change woocommerce/product-sku to woocommerce/product-sku-field

* Register woocommerce/product-schedule-sale-fields in server side

* Register woocommerce/product-track-inventory-fields in server side

* Fix invalid reference in tabs tests
2023-04-21 16:26:53 -04:00
Joel Thiessen 87da63eb3a
Moving section icon svgs to assets folder and loading by URL (#37869) 2023-04-21 11:53:06 -07:00
Joshua T Flowers 343d4d9fdf
Record tracks on product edit/update (#37770)
* Add auto-draft to product statuses

* Record event on draft save

* Record event on product update

* Add changelog entry

* Add data changelog

* Refactor to use shared function for recording product events

* Handle PR feedback
2023-04-21 09:51:59 -07:00
Joshua T Flowers 1cc5d0dd15
Disable toolbars in all relevant product editor blocks (#37912)
* Disable toolbars in all relevant product editor blocks

* Add changelog entry
2023-04-21 09:51:40 -07:00
louwie17 e88152ff3c
Add category field block (#37295)
* Add initial category block

* Add changelogs

* Add label to font family for block editor and fix template

* Fix rebase conflict and add content role

* Some styling changes for the category field

* Move category block to blocks folder and fix merge conflict.

* Address some styling issues, and update keywords

* Fix css lint error
2023-04-21 05:10:35 -03:00
Joel Thiessen 7023a80937
Adding global product block editor styles (#37805)
* Removing unecessary class

* Organizing editor styles

* Tweaking global fonts

* Correcting section spacing and adding divider

* Adding header styles

* Refactoring block editor styles

* Tweaks to spacing

* Adding changelogs

* Removing uneeded styles

* Fixing colors and link decoration

* Unifying error styles
2023-04-20 05:21:23 -03:00
Joshua T Flowers ebe879d5dd
Add IframeEditor component to product editor (#37570)
* Add initial modal editor

* Add in iframe editor styles

* Convert components to TS

* Sync dependencies

* Remove unused components and props

* Set min height to avoid jumpiness during resize

* Fix up private APIs dependency version

* Update ModalEditor name to IframeEditor

* Add changelog entry

* Remove IframeEditor from details block

* Update frozen lock file

* Add support for missing gutenberg assets function

* Fix lock file after rebase

* Use default editor settings when none are provided

* Remove currently unused editor styles

* Remove unused private apis package

* Fix php lint errors

* Remove unused import

* Pin keycodes version

* Remove another unused import from testing

* Add WC changelog entry
2023-04-18 10:52:28 -07:00
Maikel David Pérez Gómez 41545ec459
Invert the useValidation hook behavior to return an error instead of a boolean value (#37695)
* Invert the useValidation hook behavior to return an error instead of a boolean value

* Fix validation logic in schedule-sale and track-inventory blocks

* Add changelog file

* Add validations to product name block

* Fix shipping dimensions validations

* Fix shipping fee validations

* Add i18n error message example to readme.md

* Cover semantic issues
2023-04-17 23:54:15 -04:00
Joshua T Flowers ffcbaf5b3a
Move tabs to header and adjust title position (#37696)
* Move product editor tabs to header

* Update header styles to place tabs on bottom

* Center header title and adjust font size

* Style title and columns on mobile

* Add changelog entry

* Truncate longer titles

* Hide title on smaller viewports

* Truncate via css width instead of character count
2023-04-17 15:39:09 -07:00
Maikel David Pérez Gómez 42cc482ebc
Create shipping fee field block and initial shipping section (#37642)
* Setting up the Fees & dimensions section

* Create product shipping fee block

* Register product shipping fee block

* Add changelog files

* Fix php linter errors

* Add reusable radio field and move the radio block to the blocks folder

* Remove manually set block className because is autogenerated base on the block name
2023-04-14 22:44:28 -04:00
Maikel David Pérez Gómez 3f23301f3f
Create product shipping dimensions block (#37683)
* Move ShippingDimensionsImage component to @woocommerce/product-editor package

* Create woocommerce/product-shipping-dimensions-fields block

* Register woocommerce/product-shipping-dimensions-fields block

* Add changelog files

* Fix php linter error

* Change unused attr name to __contentEditable to better indicate the porpose

* Remove manually set block className because is autogenerated base on the block name
2023-04-14 14:08:57 -04:00
Joel Thiessen 83458a1dee
Adding inventory advanced section with radio and text fields (#37646) 2023-04-14 08:39:53 -07:00
louwie17 6e2c11f556
Select tree dropdown menu SlotFill support (#37574)
* Add initial select tree popover and modal story

* Add slot fill popover support

* Add changelog

* Remove unneeded use of combobox ref in select-tree

* Fix lint errors

* Address PR feedback and fix issue with parent select control

* Add changelog
2023-04-14 04:22:59 -03:00
Joel Thiessen 247787484a
Add inventory section and SKU blocks (#37623) 2023-04-13 15:33:25 -07:00
Joel Thiessen 038b97a318
Add edit product link modal under name field (#37612) 2023-04-13 08:56:47 -07:00
Joel Thiessen fb12ad20fd
Replacing rest_namespace modification with middleware due to blocks issues (#37621) 2023-04-13 08:45:50 -07:00
Maikel David Pérez Gómez f5591b7c9a
Add track inventory field to inventory section (#37585) 2023-04-11 11:52:20 -07:00
Maikel David Pérez Gómez 8354ae2792
Create schedule sale pricing block (#37567)
* Create schedule sale pricing block

* Add auto show/hide and clean fields depending on the initial values

* Add validations to From and To dates fields

* Add changelog files

* Align block with the figma design

* Revert linter replacement in the editor global style.scss file

* Fix some words typos

* Move and rename schedule sale block to the blocks folder

* Load datetime format from @wordpress/date instead of using the woo options datastore

* Remove the min difference using by moment to compare dates from 'minute' to undefined

* Make sure the dates are normalized for comparison
2023-04-11 10:53:37 -04:00
Joshua T Flowers 7734027b4a
Add product radio block and tax class to product blocks editor (#37529)
* Add product radio block

* Wrap tax class radio in collapsible block

* Add link to description and sanitize HTML

* Add changelog entry

* Fix up php lint errors

* Add changelog entry

* Fix linting errors

* Remove unused import
2023-04-05 10:13:05 -07:00
Maikel David Pérez Gómez bb22fd5864
Prevent click event when buttons are aria-disabled (#37577)
* Prevent click event when buttons are aria-disabled

* Add changelog file
2023-04-05 12:55:22 -04:00
Maikel David Pérez Gómez f7572b4361
Move the Save draft and Preview buttons to the product editor header (#37461)
* Add preview button to the product editor header

* Publish the product on add or on save

* Add save draft button

* Save product changes before previewing it

* Add notice messages

* Fix linter errors

* Force the store page to be openned in a new tab after publishing the product

* Enable publish button when the status is not publish

* Add changelog files

* Fix some comment typos

* Address comment suggestions

* Move preview logic to its own component

* Move save draft logic to its own component

* Move publish logic to its own component
2023-04-04 11:30:39 -04:00
Nathan Silveira 6291d10112
Use SelectTree component in Category field (#37479)
* Migrate category field to TreeSelect

* Rename and refactor some props due to changes in SelectTree that were introduced afterwards

* add Changelog

* Rename type to a better name

* Add tests to select-tree and remove tests from category-field

* Restore ts change that broke build

* Run linter

* Fix broken tests

* Update test

* Import from wordpress instead of react
2023-04-04 09:28:19 -03:00
Maikel David Pérez Gómez 6df1cef307
Add Sale price and list price blocks to pricing tab with pricing section (#37513)
* Add pricing section to the pricing tab

* Add changelog file

* Fix php linter errors
2023-03-31 14:47:31 -03:00
Joshua T Flowers 85080f642b
Add block related assets entry points to product editor build (#37318)
* Add editorStyle properties to blocks

* Rename style.scss files to editor.scss

* Get block entry points for block related assets

* Copy block assets to core assets build folder

* Remove unusable dependency

* Add changelog entries

* Fix up RTL style builds for block assets

* Update copy-webpack-plugin dependency and lock file

* Fix up lock file after rebase

* Fix order of webpack rtl stylesheet builds to prevent additional stylsheets

* Fix up lock file after rebase

* Fix tsconfig
2023-03-31 10:36:40 -07:00
Joshua T Flowers 681391a50a
Add product images block to product editor (#37455)
* Add images block to the product editor

* Allow html in section block descriptions

* Add changelog entry

* Add client changelog entry

* Remove SVG related changes

* Fix up lock file after rebase

* Remove unused import

* Fix up php lint errors

* Move sanitize function to utils folder
2023-03-30 11:22:07 -07:00
Joshua T Flowers 49cde4cad6
Content lock all blocks in the product editor (#37382)
* Lock all blocks in the product editor to content only

* Add changelog entry

* Add content role to summary field to allow editing

* Remove unused BlockControls
2023-03-28 15:18:00 -07:00
Matt Sherman eab7750208
Move product-editor CES-related components and utilities (#37131)
* Update package.json and lock file
* Move ProductMVPFeedbackModal to @woocommerce/product-editor
* Move ProductMVPFeedbackModalContainer to @woocommerce/product-editor
* Move ProductMVPCESFooter and useProductMVPCESFooter to @woocommerce/product-editor
* FIx mock of __experimentalUseProductMVPCESFooter in test
2023-03-28 13:38:08 -04:00
louwie17 bc42b853d8
Update product editor interpolate components (#37453)
* Remove use cases of `interpolateComponents`

* Remove from package json

* Add changelog
2023-03-28 04:15:17 -03:00
Maikel David Pérez Gómez a5b104eaed
Add icon support to product section block (#37340)
* Add block icon component

* Use the block icon component within the section block

* Add changelog file

* Fix rebase conflicts

* Remove icon configuration from the client side

* Change the BlockIcon component to get the icon from the attributes first and then from the metadata

* Expose the BlockIcon to be used outside of the package

* Add the BlockIcon documentation

* Configure the block to support the new icon via attributes

* Set the icon to the block section in the server template definition

* Revert back index.tsx -> index.ts in the section block

* Fix php linter errors

* Add changelog file

* Fix php linter error

* Return null instead of a Fragment
2023-03-27 12:52:03 -03:00
Matt Sherman a77e4abffe
Emit error on webpack build when invalid export name used in import for JS (#37195) 2023-03-26 21:42:33 -04:00
Christopher Allford 67cde87fd1
Enforce Strict `@types` Dependencies (#37351) 2023-03-23 18:02:20 -07:00
Christopher Allford 3d614cd862
Removed TypeScript Incremental Build Support (#37374) 2023-03-23 11:25:42 -07:00
Joshua T Flowers 562749b60a
Prevent duplicate registration of core blocks in client (#37350)
* Prevent duplicate registration of core blocks

* Add components changelog entry
2023-03-22 16:56:35 -07:00
Joel Thiessen 4ae467af9e
Adding more menu with items using slot fill (#37255)
* Refactored, adding slot fill, basic working via common components

* Pinning plugins dep

* More menu style tweaks

* Fixing merge issues

* Adding product header item slotfill to support more menu modal

* Fixing moved imports

* Adding changelogs

* Adding hover state for more menu toggle btn

* Fixing typo

* Refactoring to use WooHeaderItem instead of adding new slot-fill

* Removing unneeded fragment

* Adding admin layout changelog

* PR feedback

* Fix up lock file after rebase

---------

Co-authored-by: Joshua Flowers <joshuatf@gmail.com>
2023-03-22 07:30:06 -03:00
Joel Thiessen b8416d7948
Replacing multiple components on the product page with a single hook. (#37283)
* Replacing multiple componments on the product page with a single hook.

* Adding changelog

* Removed the conditional hook logic, because of React rule - Don’t call Hooks inside loops, conditions, or nested functions.

* Use promise for receiving entity, and reload template on product change

* Add changelog

---------

Co-authored-by: Lourens Schep <lourensschep@gmail.com>
2023-03-22 04:48:55 -03:00
Maikel David Pérez Gómez 62ca7a266b
Add the summary field to the product form (#37302)
* Add summary block

* Add changelog files

* Add text alignment

* Add RTL and type definitions

* Add justify text alignment

* Fix rebasing errors
2023-03-21 12:34:24 -03:00
Maikel David Pérez Gómez b9df0e09f0
Create a helper hook for field validation (#37196)
* Add custom hook to validate product fields within blocks

* Add changelog file

* Add unit tests

* Fix non working tests

* Fix linter errors

* Add changelog file

* Fix async validation rejection

* Solve conflicts after rebasing

* Revert false negative lint errors

* Move the hook to its own folder and add the readme.md file
2023-03-20 23:12:09 -03:00
Joel Thiessen edbe36d7ad
Adding collapsible content block with flexible rendering (#37305)
* Adding collapsible content block with flexible rendering

* Adding changelogs

* Move content inside display state to avoid backwards compat issues

---------

Co-authored-by: Lourens Schep <lourensschep@gmail.com>
2023-03-20 18:18:44 -07:00
louwie17 345ad58919
Add product pricing block (#37211)
* Adding initial pricing block

* Have price block render in form

* Make sure price is loaded correctly and fix template rendering

* Make pricing block abstract and add list and sale price to template

* Add changelogs

* Revert changes in wc/data package

* Fix lint issues

* Fix type error

* Add styling

* Fix styling lint issues

* Revert config change missed in rebase

* Make use of base control help text for field info

* Allow additional callbacks for onFocus and onKeyUp
2023-03-17 14:03:10 -03:00
Maikel David Pérez Gómez e370f25c0c
Add a product header component to the blocks interface (#37152)
* Add button and saving logic

* Add comment suggestions

* Add changelog files

* Add comment suggestions

* Set header title to product name if the name field is dirty otherwise the default title value

* Navigate to EditProductPage after creating the product succesfully

* Add get-header-title util and expose edited product name from useSelect
2023-03-17 13:21:15 -03:00
Joshua T Flowers 5ed070d78a
Add tests around product block editor tabs (#37225)
* Add tests around tabs

* Add changelog entry

* Fix up frozen lock file

* Fix up frozen lock file

* Fix up lock file after rebase
2023-03-16 14:46:38 -07:00
Joshua T Flowers 90e7c66ba6
Remove the product block breadcrumbs and sidebar inspector (#37250)
* Remove the product block breadcrumbs and sidebar inspector

* Add changelog entry
2023-03-16 09:12:11 -07:00
Joshua T Flowers cb82998688
Improve accessibility around product editor tabs (#37217)
* Improve accessibility around product editor tabs

* Add changelog entry
2023-03-15 11:50:37 -07:00
louwie17 93506388e3
Update product rest config and template block usage (#37206)
* Update product post rest configs

* Update block usage

* Add changelogs

* Fix lint

* Make use of setupEditorState instead of setupEditor as we do not have a content block

* Simplify product condition

* Make use of core store only
2023-03-15 13:44:05 -03:00
Joshua T Flowers 31ec8d8352
Add tab blocks to the blocks product editor (#37174)
* Add initial tab block and tabs render

* Add tabs styling

* Set initially selected tab on render

* Set initial tab based on query param

* Add template placeholder with tabs

* Add changelog entry

* Allow multiple tab and section blocks

* Add changelog entry for wc

* Fix up arrow alignment

* Fix up block configuration type

* Add missing navigation dependency to product editor
2023-03-13 15:00:50 -07:00