Commit Graph

581 Commits

Author SHA1 Message Date
Matt Sherman aa942771e5 Fix up TS errors 2023-10-18 15:16:17 -04:00
Matt Sherman ea6dc94897 Move useEvaluationContext implementation to product-editor 2023-10-18 15:16:17 -04:00
Matt Sherman 09b0cdcef7 Memoize block context 2023-10-18 15:16:17 -04:00
Matt Sherman 86a0a15588 Include productType in context; don't include editedProduct 2023-10-18 15:16:17 -04:00
Matt Sherman 6f2e89adcb Use registerProductEditorBlockType for variations 2023-10-18 15:16:17 -04:00
Matt Sherman cb15fbcd34 Use registerProductEditorBlockType for variation-options 2023-10-18 15:16:17 -04:00
Matt Sherman dbc3c7a77b Use registerProductEditorBlockType for variation-items 2023-10-18 15:16:17 -04:00
Matt Sherman 9d492800f3 Use registerProductEditorBlockType for tag 2023-10-18 15:16:17 -04:00
Matt Sherman 271258a0c4 Use registerProductEditorBlockType for summary 2023-10-18 15:16:16 -04:00
Matt Sherman ca9b5c3dd9 Use registerProductEditorBlockType for shipping-dimensions 2023-10-18 15:16:16 -04:00
Matt Sherman 686ad5c026 Use registerProductEditorBlockType for shipping-class 2023-10-18 15:16:16 -04:00
Matt Sherman e366809711 Use registerProductEditorBlockType for schedule-sale 2023-10-18 15:16:16 -04:00
Matt Sherman d92d34f9fe Use registerProductEditorBlockType for sale-price 2023-10-18 15:16:16 -04:00
Matt Sherman c937b3eea9 Use registerProductEditorBlockType for regular-price 2023-10-18 15:16:16 -04:00
Matt Sherman c4bd765eb6 Use registerProductEditorBlockType for password 2023-10-18 15:16:16 -04:00
Matt Sherman 6596e9c05c Use registerProductEditorBlockType for notice 2023-10-18 15:16:16 -04:00
Matt Sherman b3e0b2af93 Use registerProductEditorBlockType for name 2023-10-18 15:16:16 -04:00
Matt Sherman 8574fdec36 Use registerProductEditorBlockType for inventory-sku 2023-10-18 15:16:16 -04:00
Matt Sherman 9b161c6667 Use registerProductEditorBlockType for inventory-quantity 2023-10-18 15:16:16 -04:00
Matt Sherman 0d03ad93b3 Use registerProductEditorBlockType for inventory-email 2023-10-18 15:16:16 -04:00
Matt Sherman ccdccc2de3 Use registerProductEditorBlockType for images 2023-10-18 15:16:16 -04:00
Matt Sherman 3324fe2787 Use registerProductEditorBlockType for description 2023-10-18 15:16:16 -04:00
Matt Sherman f9aa73c7d3 Use registerProductEditorBlockType for catalog-visibility 2023-10-18 15:16:16 -04:00
Matt Sherman 8fee2c1669 Use registerProductEditorBlockType for attributes 2023-10-18 15:16:16 -04:00
Matt Sherman 2296f910c9 Use registerProductEditorBlockType for toggle 2023-10-18 15:16:16 -04:00
Matt Sherman f2feaa7d55 Use registerProductEditorBlockType for text 2023-10-18 15:16:16 -04:00
Matt Sherman d082491e1d Use registerProductEditorBlockType for taxonomy 2023-10-18 15:16:16 -04:00
Matt Sherman 7a04b3909e Use registerProductEditorBlockType for tab 2023-10-18 15:16:16 -04:00
Matt Sherman 3afe5d8233 Use registerProductEditorBlockType for section 2023-10-18 15:16:16 -04:00
Matt Sherman aa9ed2d88a Use registerProductEditorBlockType for radio 2023-10-18 15:16:16 -04:00
Matt Sherman 9bb83c1745 Use registerProductEditorBlockType for pricing 2023-10-18 15:16:16 -04:00
Matt Sherman 63d18234f8 Use registerProductEditorBlockType for number 2023-10-18 15:16:16 -04:00
Matt Sherman 57d1c4a0a7 Use registerProductEditorBlockType for conditional 2023-10-18 15:16:16 -04:00
Matt Sherman f3eea29421 Use registerProductEditorBlockType for collapsible 2023-10-18 15:16:16 -04:00
Matt Sherman bf8ea9a016 Use registerProductEditorBlockType for checkbox 2023-10-18 15:16:16 -04:00
Matt Sherman 7448e78aa7 Implement registerProductEditorBlockType 2023-10-18 15:16:16 -04:00
Maikel David Pérez Gómez 40a410ae1f
Product Shipping: New class should automatically create a slug (#40847)
* Remove empty values from the shipping class request so slug can be generated server side

* Add changelog file
2023-10-18 13:04:14 -04:00
Maikel David Pérez Gómez 51c9b9051e
[Downloads] Manage limits (#40797)
* Create ManageDownloadLimitsModal component

* Integrate ManageDownloadLimitsModal with product downloads block

* Add changelog file

* When there's at least 1 file uploaded, we add a Manage limits button to the Downloads section heading

* Both fields only accept numbers

* Add suffix to each input

* Add integer validation message

* Fix validation to support -1 and 0 values
2023-10-18 10:15:43 -04:00
Maikel David Pérez Gómez 39019d2750
Manage single variation as virtual (#40809)
* Add virtual section to the product variation template

* Add changelog file

* Let the toogle block to use inverted value to be checked

* Fix virtual toggle to be inverted

* Add changelog file
2023-10-18 10:47:33 -03:00
louwie17 cee08e44d9
Hide header on variation edit page and remove use of `:has()` CSS selector (#40843)
* Make sure we hide the header on the variation edit page and remove use of has()

* Add changelogs
2023-10-18 09:22:55 -03:00
Maikel David Pérez Gómez 5dedfd7ebe
Add Downloads section to the single variation page (#40807)
* Add support to downloads block to use the context postType

* Register the downloads block into the ProductVariationTemplate

* Add changelog files

* Fix compilation error

* Fix download block init function
2023-10-17 16:58:53 -03:00
Fernando Marichal b1451b8cf8
Display notice at the top single variations (#40679)
* Rename notice component

* Add notice-edit-single-variation

# Conflicts:
#	packages/js/product-editor/src/blocks/style.scss

* Add dismiss button to notice

* Add use-notice hook

* Refactor hook

* Changes in notice

* Rename

# Conflicts:
#	packages/js/product-editor/src/blocks/product-fields/notice/index.ts

* Create helper class

* Add notice block to general tab

* Add notice to other tabs

# Conflicts:
#	plugins/woocommerce/src/Admin/Features/ProductBlockEditor/ProductTemplates/ProductVariationTemplate.php

* Change comment

* Add parent product name to copy

* Fix lint

* Removed space

* Add changelogs

* Refactor notice block

* Remove context

* Refactor useConfirmUnsavedProductChanges

* Add useConfirmUnsavedProductChanges to Notice block

* fix lint

* Add return to `registerWooBlockType`

* Remove `useConfirmUnsavedProductChanges`

* Fix links styles

* Remove ProductEditorHelper use

* Remove ProductEditorHelper

* Refactor noticeLink

* Fix isResolving issue
2023-10-16 15:07:50 -04:00
Nathan Silveira c3ffd5af95
Add 'min' and 'max' attributes to number block (#40715)
* Add 'min' and 'max' attributes to number block

* Rename string
2023-10-16 12:07:17 +00:00
louwie17 7f25060044
Variation switching when deleting (#40780)
* Add variation switcher hook for easier use across multiple components

* Add unregister function for validation

* Add changelogs

* Remove stray console

* Add unRegisterValidator function
2023-10-13 19:25:58 -04:00
Maikel David Pérez Gómez df2bf33bcd
Add edit button to each variation to redirect to the single variation page (#40709)
* Add edit button to each variation to redirect to the single variation page

* Add changelog file

* Fix blocks and plugin registration

* Add router redirection

* Fix css conflicts with the prev experience

* Fix linter errors

* Add changelog file
2023-10-13 16:22:11 -04:00
Maikel David Pérez Gómez 177f8bbe6b
[Virtual] ‘Needs shipping’ toggle (#40735)
* Add virtual section and block to the Shipping tab

* Set shipping disabled when the product is virtual

* Add changelog files

* Fix linter errors
2023-10-13 16:19:32 -04:00
Maikel David Pérez Gómez ff062eed4d
Add new file dropdown menu (#40731)
* Create downloads menu component

* Add the menu to the downloads section

* Create upload-files-menu-item component

* Add upload-files-menu-item to the downloads menu

* Create media-library-menu-item component

* Fix media library menu item zindex conflict with the media upload modal

* Create insert-url-menu-item component

* Add insert-url-menu-item to the downloads menu

* Add support for digital product when product-virtual-downloadable feature is enabled

* Add changelog files

* Remove non needed style

* Fix linter errors

* Fix redirection logic

* Keep drop zone on to of the table

* Avoid duplicate files

* Stringify download ids before persist them

* Fix summary block property value under SimpleProductTemplate

* Fix linter error
2023-10-13 15:25:37 -04:00
Maikel David Pérez Gómez 985d9596d6
Add Delete variation item to the editor actions menu (#40672)
* Create DeleteVariationMenuItem to be added to the Header's MoreMenu

* Move registration menu item fills to each product/variation page

* Export RemoveConfirmationModal from the product editor package

* Request for variation deletion

* Show notice when deleting variation

* Redirect to parent product page after deleting the variation

* Add tracking event

* Manage isRemoving state under RemoveConfirmationModal

* Add changelog files

* Fix linter error

* Fix delete variation modal title

* Add tracking events

* Use the right prop to get the variation name

* Add name and parent_id to the ProductVariation type definition

* Add changelog file

* Feedback modal should get the correct product id when editing a variation

* Fix rebase conflicts

* Fix unit test
2023-10-12 15:59:13 -04:00
louwie17 c4c56f3fc8
Add variation switcher in footer for variation page (#40713)
* Add variation switcher in footer for variation page

* Add productId to make sure template is updated correctly

* Don't show bar when less then 2 variations.

* Add class for when page is scrolled to bottom

* Add changelogs

* Add tracks

* Fix lint error

* Fix css lint issues
2023-10-12 11:56:48 -03:00
Fernando Marichal ff51b07da3
Change the blocks editor header to support variations (#40606)
* Add variation name and parent id to REST API

* Add variation title

* Add changelog

* Change changelog

* Fix lint

* Add changelog

* Fix typo

* Modify header check
2023-10-11 15:34:26 -03:00
Maikel David Pérez Gómez 2cff75c73c
Add virtual and downloads related controls to variation management flows (#40567)
* Add Toggle shipping item to the variations quick actions menu

* Add Downloads -> Set download limit item to the variations quick actions menu

* Add Downloads -> Set download expiry item to the variations quick actions menu

* Add Downloads -> Upload files item to the variations quick actions menu

* Add changelog file

* Fix some styles conflicts and set default uploaded files

* Hide the toggle shipping and downloads menu items behind the feature flag product-virtual-downloadable

* Fix unit tests
2023-10-11 12:50:00 -04:00
Maikel David Pérez Gómez eb9a8b3cde
[Downloads] File list (#40526)
* Add downloads section

* Create and register the downloads block

* Conditionally remove the upload button from the media upload component

* Create upload image component

* Add media uploader component to the downloads block

* Add downloads table

* Add remove file feature to the downloads table

* Set downloadable to false when there are no download files

* Add support to remove uploaded file

* If the file has a custom name added by the user, we show it first. The actual file name is then shown in a second line.

* Add changelog files

* Fix linter error

* Address feedback from comments

* Fix allowed media types

* Register the new feature flag product-virtual-downloadable

* Hide the downloads section behind the feature flag product-virtual-downloadable

* Update editor settings after sync blocks with template

* Get allowedMimeTypes from the editor settings

* Fix linter errors
2023-10-11 10:37:41 -04:00
Maikel David Pérez Gómez e0a138b27b
Complete General tab for Single Variation page (#40633)
* Add description to the Variation details section

* Add Image section block to the Single Variation page

* Add support to the checkbox block for changing non boolean properties and extend it to use the entity context

* Register the product-variation-visibility block into the ProductVariationTemplate

* Null is a valid value but not updafined

* Fix type definitions

* Add changelog files

* Fix linter errors

* Add changelog file

* Change onValue and offValue for checkedValue and unchackedValue for the checkbox block to avoid event naming conflicts

* Set multiple value dynamically into the media uploader component

* Prevent uploading multiple files when multiple is set to false

* Remove cover label when multiple is set to false

* Fix DropZone min height in Image section

* Fix rebase conflict

* Fix linter error
2023-10-10 09:42:26 -04:00
louwie17 98876f54d9
Add pricing tab for variations (#40642)
* Update blocks with postType context

* Add tax class

* Pass context into get_tax_class

* Add parent option

* Add changelog

* Update changelog

* Add isRequired attribute to regular price block for use in variations

* Add additional condition to avoid error in date time picker

* Add changelog

* Fix lint errors
2023-10-10 08:55:05 -03:00
Nathan Silveira a1226d5e30
Add support for 'meta_data.' property format for reusable blocks (#40600)
* Add support to multiple types in useProductEntityProp

* Migrate 'checkbox' to useProductEntityProp

* Migrate 'pricing' to useProductEntityProp

* Migrate 'radio' to useProductEntityProp

* Migrate 'taxonomy' to useProductEntityProp

* Migrate 'text' to useProductEntityProp

* Migrate 'toggle' to useProductEntityProp

* Add changelog

* Update unit tests

* Add postType context to generic blocks and use-product-entity-props and add code review suggestions

* Use postType for meta_data as well

* Fix unit tests
2023-10-09 12:34:37 +00:00
Christopher Allford 1c30563ffc
Separate PHP and JS Unit Tests (#40639)
Since some projects might have both kinds of tests we are
going to have a `test:php` and a `test:js` script for each.
2023-10-06 15:41:47 -07:00
Maikel David Pérez Gómez d1656e12e5
Add Shipping tab to the single variation page (#40637)
* Fix shipping blocks ids into ProductVariationTemplate

* Add support to postType context to product-shipping-class-field block

* Add support to postType context to product-shipping-dimensions-fields block

* Add changelog files
2023-10-06 13:47:45 -04:00
Maikel David Pérez Gómez 5d97297c89
Add Inventory tab to the single variation page (#40636)
* Remove advance section from the inventory section in the ProductVariationTemplate

* Add support to postType context to product-sku-field block

* Add support to postType context to product-toggle-field block

* Add support to postType context to product-inventory-quantity-field block

* Add support to postType context to product-radio-field block

* Fix inventory blocks ids into ProductVariationTemplate

* Add changelog files
2023-10-06 13:45:27 -04:00
Nathan Silveira 129f11df9e
Create woocommerce/product-number-field block (#40619)
* Add initial structure for number block

* Add more attributes and remove currenty formatting

* Add changelog

* Refactor

* Add readme

* Remove unused import

* Add changelog

* Use 'formatNumber' and 'parseNumber' functions from useProductHelper hook

* Use 36px default size

* Fix README
2023-10-06 16:21:33 +00:00
Maikel David Pérez Gómez a918e79093
Setup the product editor to support the product variation (#40605)
* Initial changes needed to get product variation to load in its own form

* Allow the publishing of an individual variation

* Address some PR feedback and do some general cleanup

* Update template with new attribute name

* Add changelogs

* Update label of note field and allow for optional param in summary block

* Remove helpText in variation note field

* Fix PHP lint errors

* Make editor type more abstract

---------

Co-authored-by: Lourens Schep <lourensschep@gmail.com>
2023-10-05 15:27:54 -03:00
Nathan Silveira 793e4a821d
Split product editor blocks into separate directory structures (#40571)
* Create 'generic' and 'product-fields' and separate blocks between the two

* Refactor 'BlockRegistry' to include new directory structure

* Increment README

* Add param documentation

* Add changelogs

* Lint markdown

* Add block directory doc

* Fix jest test

* Update handbook reference
2023-10-04 13:51:25 +00:00
Nathan Silveira 00d14debd4
Create woocommerce/product-text-field block (#40337)
* Add new block woocommerce/product-input-field

* Add required attribute

* Add 'required' validation

* Add validationRegex attribute

* Add changelog

* Use existing meta_data field

* Add validationErrorMessage attribute

* Rename block

* Rename path

* Create 'useMetaEntityProp' hook

* Add changelog

* Add comment to translators

* Rename init function

* Add minLength and maxLength attributes

* Fix wrong copied line

* Fix typescript issues

* Refactor hook to use property name instead of isMeta boolean

* Rename hook

* Add tests to useProductEntityProp

* Fix bug: the meta property shouldn't contain "meta_data."

* Implement code review suggestions

* Use 'useWooBlockProps' hook
2023-10-03 15:12:07 +00:00
Nathan Silveira bda564ad67
Add reusable blocks documentation for remaining blocks (#40521)
* Add documentation for woocommerce/product-radio-field

* Update woocommerce/product-taxonomy-field documentation

* Rename checkbox section for consistency

* Edit pricing attribute name for consistency

* Add documentation for woocommerce/product-pricing-field

* Add 'conditional' documentation

* Update README.md

* Add usage text

* Add documentation to collapsible

* Fix details across all readmes

* Add changelog

* Try adding video html tag

* Allow video html tag

* Fix wrong position in doc

* Rename 'name' to 'property' on InputControl props

* Fix mistake in label position
2023-10-03 12:49:46 +00:00
Fernando Marichal e224445bf6
Add missing Tracks events to attribute modals (#40517)
* Add tracks events

* Add remove icon recording

* Add tracking to new product modal

* Add changelog

* Remove not used `recordEvent`
2023-10-03 08:26:39 -03:00
Fernando Marichal 2e74ab84e8
Fix dropdown and list behavior in attributes variation modals (#40496)
* Fix selectors alignment

* Modify icon

* Hide placeholder when an item has been selected

* Fix methods

* Add changelog
2023-10-02 17:18:05 -03:00
Matt Sherman 0885808c07
Template API: Store edited product in context (#40450) 2023-10-02 15:09:49 -04:00
Nathan Silveira 1903b3a759
Update Product Editor Handbook (#40514)
* Rename title

* Remove common-tasks section as it's currently made redundant by template API documentation

* Create index for reusable blocks doc

* Update reference to the handbook

* Add references to new documentation to the handbook

* Add changelog

* Update README.md
2023-10-02 12:59:35 +00:00
Maikel David Pérez Gómez 69eebe4f17
Fix when adding new attributes, input fields keep the focus styling (#40519)
* Fix invalid focus state of the experimental select control

* Add changelog file

* Fix regression setting readOnlyWhenClosed to false by default

* Add changelog file
2023-09-29 17:31:21 -03:00
Fernando Marichal 650cf476f0
Remove confirmation modal for dismissing unsaved attributes or variation options (#40500)
* Remove the confirmation modal

* Add changelog
2023-09-29 10:23:03 -04:00
Maikel David Pérez Gómez f6f7574f92
Fix the position and sizing of pagination controls in the variations table (#40439)
* Fix the position of pagination controls in the variations table

* Fix the sizing of controls in the variations table

* Add changelog file

* Fix linter errors
2023-09-29 09:48:01 -04:00
Maikel David Pérez Gómez 43a238d730
Show a summary when adding or removing variation option values (#40470)
* Fix server error when generating variations after delete an attribute term, stock_quentity=null and low_stock_amount=null brake

* Show a summary when adding or removing variation option values

* Fix linter error

* Make sure to show variations notice only if the attribute is used for variation
2023-09-29 09:59:55 -03:00
Maikel David Pérez Gómez 57529230ca
Font sizes differ between chips used in the variations options table and variations list (#40447)
* Fix font sizes difference between chips used in the variations options table and variations list

* Add changelog file

* Fix unit test
2023-09-28 15:13:03 -04:00
Fernando Marichal fd6ac01fcd
Improve copy in variation management notifications (#40467)
* Add method `getSnackbarText`

* Add single variation update/delete

* Add changelog

* Refactor method `getSnackbarText`

* Improve code
2023-09-28 14:38:42 -04:00
Fernando Marichal 86a535a224
Fix field label styling in the edit attribute modal (#40449)
* Add prop readOnlyWhenClosed

* Add changelog
2023-09-28 14:22:23 -04:00
Maikel David Pérez Gómez d8aa52d0a7
Hide list controls when no items are selected (#40434)
* The Select all and Clear selection buttons are only displayed when at least 1 item is selected

* Add changelog file
2023-09-28 10:14:48 -03:00
Maikel David Pérez Gómez 756b0a6171
Add cursor: not-allowed; to the disabled Quick updates button (#40448)
* Add cursor: not-allowed; to the disabled Quick updates button

* Add changelog file
2023-09-28 09:38:38 -03:00
Matt Sherman 435e24c58c Update Edit props type for variations 2023-09-27 23:42:29 -04:00
Matt Sherman 99839030e9 Update Edit props type for variation-options 2023-09-27 23:42:15 -04:00
Matt Sherman 1d21956def Update Edit props type for toggle 2023-09-27 23:42:05 -04:00
Matt Sherman f781940c27 Update Edit props type for taxonomy 2023-09-27 23:41:58 -04:00
Matt Sherman abe02a4d6c Update Edit props type for summary 2023-09-27 23:41:35 -04:00
Matt Sherman 2c0117183e Update Edit props type for shipping-dimensions 2023-09-27 23:41:27 -04:00
Matt Sherman db1f257895 Update Edit props type for shipping-class 2023-09-27 23:41:18 -04:00
Matt Sherman d0f02fe0d4 Update Edit props type for section 2023-09-27 23:41:09 -04:00
Matt Sherman de7bb63183 Update Edit props type for schedule-sale 2023-09-27 23:41:01 -04:00
Matt Sherman 0c4782a238 Update Edit props type for sale price 2023-09-27 23:40:52 -04:00
Matt Sherman 020a91e3fd Update Edit props type for regular-price 2023-09-27 23:40:43 -04:00
Matt Sherman 0ad7126f5f Update Edit props type for radio 2023-09-27 23:40:34 -04:00
Matt Sherman 5be0716466 Update Edit props type for pricing 2023-09-27 23:40:26 -04:00
Matt Sherman b56ced02c8 Update Edit props type for password 2023-09-27 23:40:19 -04:00
Matt Sherman 33e350d3d2 Update Edit props type for notice 2023-09-27 23:40:10 -04:00
Matt Sherman 2f11689672 Update Edit props type for name 2023-09-27 23:40:02 -04:00
Matt Sherman 120efa3022 Update Edit props type for inventory-sku 2023-09-27 23:39:55 -04:00
Matt Sherman db0c738b12 Update Edit props type for inventory-quantity 2023-09-27 23:39:43 -04:00
Matt Sherman 11d835aeb7 Update Edit props type for inventory-email 2023-09-27 23:39:31 -04:00
Matt Sherman b800b6ddcc Update Edit props type for images 2023-09-27 23:39:22 -04:00
Matt Sherman e28da2912a Update Edit props type for description 2023-09-27 23:39:12 -04:00
Matt Sherman 73815bdef7 Update Edit props type for collapsible 2023-09-27 23:39:03 -04:00
Matt Sherman 1a2041cef1 Update Edit props type for checkbox 2023-09-27 23:38:46 -04:00
Matt Sherman 857eb39b11 Update Edit props type for catalog-visibility 2023-09-27 23:38:38 -04:00
Matt Sherman ad2e50fb1c Update Edit props type for attributes 2023-09-27 23:38:23 -04:00
Matt Sherman 51370ac88a Update registerWooBlockType for variation-items 2023-09-27 17:18:20 -04:00
Matt Sherman 5bf2e92eff Update registerWooBlockType for tag 2023-09-27 17:18:08 -04:00
Matt Sherman 78fab5c8e3 Update registerWooBlockType for tab 2023-09-27 17:18:00 -04:00
Matt Sherman 898dd99be6 Update registerWooBlockType for conditional 2023-09-27 17:17:52 -04:00
Matt Sherman 57444b5a90 Fix tabs test 2023-09-27 17:00:54 -04:00
Matt Sherman e8184141a6 Changelog 2023-09-27 17:00:54 -04:00
Matt Sherman fd997269cd Remove unused import 2023-09-27 17:00:54 -04:00
Matt Sherman 9ce23c1026 Update conditional to use editedProduct from context 2023-09-27 17:00:51 -04:00
Matt Sherman 8aa42f433f Update context type for variation-items 2023-09-27 17:00:01 -04:00
Matt Sherman bd4c7847b9 Update context type for tag 2023-09-27 16:59:59 -04:00
Matt Sherman a2e9080150 Update context type for tab 2023-09-27 16:59:27 -04:00
Matt Sherman b6dc633e81 Fix typing for initBlock call in tab 2023-09-27 16:58:13 -04:00
Matt Sherman a4a44ef56b Fix typing for initBlock call in variation-items 2023-09-27 16:56:32 -04:00
Matt Sherman ef48cccc23 Fix typing for initBlock call in variations 2023-09-27 16:56:01 -04:00
Matt Sherman 57448d4627 Fix typing for initBlock call in variation-options 2023-09-27 16:55:29 -04:00
Matt Sherman 8a78340b30 Fix typing for initBlock call in toggle 2023-09-27 16:55:03 -04:00
Matt Sherman c2e60a4aa8 Fix typing for initBlock call in summary 2023-09-27 16:53:47 -04:00
Matt Sherman ac7ab2b1a0 Fix typing for initBlock call in shipping-dimensions 2023-09-27 16:53:15 -04:00
Matt Sherman ce4b7af7e8 Fix typing for initBlock call in shipping-class 2023-09-27 16:52:49 -04:00
Matt Sherman 8ff4f6b095 Fix typing for initBlock call in schedule-sale 2023-09-27 16:52:22 -04:00
Matt Sherman 9f55c320dc Fix typing for initBlock call in regular-price 2023-09-27 16:51:41 -04:00
Matt Sherman e94de74d00 Fix typing for initBlock call in section 2023-09-27 16:51:10 -04:00
Matt Sherman edaf1154d0 Fix typing for initBlock call in sale-price 2023-09-27 16:50:47 -04:00
Matt Sherman ed57f267fb Fix typing for initBlock call in radio 2023-09-27 16:49:35 -04:00
Matt Sherman dfaa1b7dfd Fix typing for initBlock call in pricing 2023-09-27 16:49:07 -04:00
Matt Sherman c8ad1de579 Fix typing for initBlock call in password 2023-09-27 16:48:41 -04:00
Matt Sherman 54209362a0 Fix typing for initBlock call in notice 2023-09-27 16:48:02 -04:00
Matt Sherman 4fc547dfb1 Fix typing for initBlock call in inventory-sku 2023-09-27 16:47:29 -04:00
Matt Sherman 1b64e7dd0e Fix typing for initBlock call in inventory-email 2023-09-27 16:46:41 -04:00
Matt Sherman 21929ccd25 Fix typing for initBlock call in inventory-quantity 2023-09-27 16:46:07 -04:00
Matt Sherman c507f02f47 Fix typing for initBlock call in description 2023-09-27 16:45:26 -04:00
Matt Sherman 4f72172426 Fix typing for initBlock call in checkbox 2023-09-27 16:44:56 -04:00
Matt Sherman 51e769d778 Fix typing for initBlock call in catalog-visibility 2023-09-27 16:43:59 -04:00
Matt Sherman a22e92bea3 Type context prop for BlockEditor 2023-09-27 16:42:25 -04:00
Matt Sherman 2f1a5f82ec Add ProductEditorContext and ProductEditorBlockEditProps interfaces 2023-09-27 16:40:56 -04:00
Matt Sherman 1e35d45c99
Template API: Expose template block id and order to client (#40263)
* Update unit tests to handle _templateBlockId and _templateBlockOrder

* Refactor get_formatted_template

* Initial @woocommerce/block-templates package

* Add block-templates to admin webpack

* Add block-templates to dependency-extraction-webpack-plugin

* Add block-templates to admin assets

* Add block-templates dependency

* Update name block

* Update syncpack

* Update regular price block

* Update tab block

* Update section block

* Add @wordpress/deprecated to package

* Deprecated initBlock

* Update attributes block

* Update catalog visibility block

* Update checkbox block

* Update conditional block

* Update collapsible block

* Allow additional props to be passed to useWooBlockProps

* Update inventory sku block

* Update inventory quantity block

* Update inventory email block

* Update images block

* Update description block

* Update radio block

* Update pricing block

* Update password block

* Update notice block

* Update shipping dimensions block

* Update shipping class block

* Update schedule sale block

* Update sale price block

* Update toggle block

* Update taxonomy block

* Update tag block

* Update summary block

* Update variations block

* Update variations options block

* Update variation items blocks

* Changelog

* Changelog

* Changelog

* Changelog

* Changelog

* Add test for registerWooBlockType

* Add @testing-library/react-hooks to devDependencies

* Add test for useWooBlockProps

* Document API

* Fix linting issues in README.md

* Fix tabs tests by mocking useWooBlockProps

* Allow header duplication under different nesting

* Remove unused import (fixes lint error)

* Update lock file
2023-09-27 13:38:56 -07:00
Nathan Silveira 8edcb06348
Add block documentation to woocommerce/product-checkbox-field (#40277)
* Rename block description

* Add documentation for product checkbox field

* Add changelog

* Improve README

* Add description to block's attributes

* Replace example

* Add markdown table with documentation

* Move image to developer.woocommerce.com

* Iterate documentation

* Address lints
2023-09-27 15:07:52 -03:00
Maikel David Pérez Gómez e6df583c65
Add a visibility toggle to the Quick actions list (#40464)
* Create toggle-visibility-menu-item component

* Add toggle-visibility-menu-item to variation-actions-menu

* Add toggle-visibility-menu-item to variations-actions-menu

* Add changelog file
2023-09-27 11:19:49 -04:00
Maikel David Pérez Gómez 6728e73505
Fix the visibility icon (#40419)
* Remove help icon on top of the hidden icon

* Remove help icon on top of the non filterable icon

* Add changelog file
2023-09-27 10:00:10 -04:00
Fernando Marichal 5fa98ace1a
Fix attribute list styles (#40378)
* Fix attribute list style

* Add changelog

* Move changelog

* Fix attributes style
2023-09-26 15:08:57 -04:00
Fernando Marichal a2efd31b6f
Open variation preview in a new tab (#40414)
* Open variation preview in new tab

* Add changelog

* Move changelog

* Add noreferrer
2023-09-26 12:17:21 -04:00
louwie17 247b8990d2
Add default price support to product variations (#40343)
* Optimize crud totalCount queries to avoid two requests

* Make use of same request params for totalCount as getVariations

* Add support for default_values when generating product variations

* Add test for default_values

* Add changelogs

* Only use default values of first variation

* Address some PR feedback

* Update types
2023-09-22 11:39:35 -03:00
Fernando Marichal 1c497f3066
Update copy in the add variation options modal (#40280)
* Change add variation options modal copy

* Add changelog

* Clean component
2023-09-20 09:12:48 -03:00
Fernando Marichal f058e04046
Fix styling errors in variation actions in blocks product editor (#40220)
* Fix actions style

# Conflicts:
#	packages/js/product-editor/src/components/variations-table/styles.scss

* Add changelog

* Fix checkbox

* Refactor fix
2023-09-20 09:05:51 -03:00
louwie17 f9705a531b
Redirect to product editing page when product was still in auto draft (#40225)
* Redirect to product editing page when product was still in auto draft

* Make sure the prevent page does not show up when creating variations

* Add changelog and fix tests
2023-09-19 17:33:15 -03:00
louwie17 6337abc3c5
Add notice when variation prices are not set yet (#40281)
* Add notice dismissal and re-show upon validation

* Add support for notice actions

* Add changelogs

* Add set prices

* Fix build issues

* Add comment

* Replace additionalData with newData
2023-09-19 17:01:54 -03:00
Nathan Silveira 6dc109c3d8
Search for taxonomy with special characters (#40217)
* Decode html escaped characters in SelectTree

* Escape special characters when searching for taxonomies

* Add changelogs

* Remove unneeded decodeEntities

* Increment escapeHTML function to comply with what is happening in the legacy taxonomy editor

* Extract escapeHTML to @woocommerce/components
2023-09-19 14:49:19 -03:00
Fernando Marichal d72316490d
Fix error displaying block after removing variation (#40255)
* Fix error displaying block after removing variation

* Disable Add button

* Add changelog
2023-09-19 13:31:32 -03:00
Fernando Marichal c661186499
Fix issue with deleting variations in new product editor (#40219)
* Fix onDelete param

* Add changelog
2023-09-15 17:20:47 -03:00
louwie17 9ea83d6382
Fix description styling and remove use of `woocommerce-page` in admin pages (#40218)
* Move the header data to the body as the header prop does not exist anymore

* Remove explicit setting of __unstableResolvedAssets given get_block_editor_settings already does this

* Remove use of woocommerce-page class in admin to avoid theme conflicts

* Add changelogs

* Revert change for quick test

* Two additional tweaks for admin related styling
2023-09-15 17:06:42 -03:00
louwie17 26f5cd5a9c
Update variation visibility icon in variations table (#40150)
* Create re-usuable hidden icon and re-use in variations table

* Add changelog
2023-09-15 15:51:28 -03:00
Nathan Silveira 95d7a6b86d
Improve Categories (Taxonomy) field UX (#40059)
* Add 'dialogNameHelpText' attribute to show on create taxonomy dialog

* Tweak CSS margins

* Add changelogs

* Rename "Save" to "Create" and set cancel button to Tertiary

* Add gray color to (optional)

* Create attribute to personalize label for parent
2023-09-14 16:02:16 -03:00
Fernando Marichal 48016efaa6
Fix infinite category loading state (#40073)
* Fix loading state

* Add changelog

* Replace catch with finally
2023-09-08 08:58:34 -03:00
Fernando Marichal ad1920ca2e
Add Tags to product editor (#39966)
* Add block

* Add component tags-field

# Conflicts:
#	packages/js/product-editor/src/style.scss

* Add changelog

* Clean code

* Add style

# Conflicts:
#	packages/js/product-editor/src/style.scss

* Trim styles

* Delete input when creating tag

* Clean input after creating tag

* import Query type

* Add changelogs

* Add tests

* Rename newInputValue

* Remove lodash use

* Add useInstanceId instead of using a fixed id

* Remove pagination related code

* Remove isAsync const

* Fix list filtering

* Abstract useSelect

* Fix tests

* Refactor use-tag-search

* Fix lint
2023-09-06 15:51:22 -03:00
Maikel David Pérez Gómez 5e301f5a6f
Show sale price and list price in each variation row when the variation is on sale (#40048)
* Show sale price and list price in each variation row when the variation is on sale

* Add changelog file
2023-09-06 15:20:34 -03:00
Maikel David Pérez Gómez 9e812dd5da
Show in product details feature under Edit attribute modal (#40006)
* Change the Visible to customers checkbox label and tooltip

* Set default visibility to true if the atribute is non used for variations, false otherwise

* Add changelog file
2023-09-06 15:20:24 -03:00
Nathan Silveira e9aad24125
Migrate Category field to woocommerce/taxonomy-field block (#40021)
* Migrate category field to woocommerce/taxonomy-field block

* Remove details-categories-field

* Add changelogs

* Remove more references

* Rename block and add it to blockregistry

* Add missing setIsCreating calls

* Undo changelog change

* Add changelog
2023-09-06 10:21:37 -03:00
Maikel David Pérez Gómez f3d1526f71
Auto select one or more attribute terms when selecting an attribute (#40004)
* Add auto select first or all terms when an attribute is selected

* Set auto select all terms in variations tab

* Set auto select the first term in Organization tab

* Add changelog file

* Change termsAutoselection to be camel case

* Remove error suppersion when retreiving attribute terms
2023-09-05 16:29:57 -03:00
Fernando Marichal ccb72125e0
Add a notice to "track inventory" toggle (#40011)
* Add notice to "track inventory" toggle

* Add changelogs

* Remove console.logs

* Fix link URL
2023-09-05 08:35:38 -03:00
Maikel David Pérez Gómez 4f867c6736
Components: Select Control dropdown styling issues (#39989)
* Fix select control dropdown menu width, double scroll and item aligment

* Fix attributes dropdown jumping on focus and slot position

* Add changelog files

* Fix double scroll and label margin on Category Select
2023-09-04 14:25:03 -03:00
Maikel David Pérez Gómez cdaae1caac
Add Shipping item to the global Quick Update dropdown (#39973)
* Add Shipping item to the global Quick Update dropdown

* Add changelog file

* Fix Quick update dropdown menu position to bottom left
2023-08-31 15:00:19 -04:00
Nathan Silveira 501abc47b5
Add taxonomy block using SelectTree (#39947)
* Create Hierarchical Taxonomy block

* Add changelog

* Update CSS and remove more references to 'brands'

* Improve error message UX

* Use css variables

* Name block attribute

* Add support for non-hierarchical taxonomies

* Rename attributes

* Fetch "hierarchical" from taxonomy data

* Update changelog

* Remove 'hierarchical' attribute

* Update description

* Fix issue where hierarchy was not displayed in create modal

* Refactor taxonomy details select

* Add README to taxonomy block
2023-08-31 15:19:28 -03:00
Maikel David Pérez Gómez 6673ebecd2
Add Inventory item to the global Quick Update dropdown (#39972)
* Add Inventory item to the global Quick Update dropdown

* Add changelog file
2023-08-31 13:52:06 -04:00
louwie17 785d45fbc3
Update variation pagination table (#39967)
* Add className to sortable and perPageOptions to Pagination

* Refactor pagination into seperate components

* Add PageArrowsWithPicker pagination component and usePagination hook

* Add hook to Pagination story

* Update Pagination readme

* Add changelogs

* Make sure input is updated if currentPage updates outside of PageArrowsWithPicker component

* Only show pagination if total count exceeds the minimum page size

* Add missing doc

* Fix lint errors

* Move totalCount to seperate useSelect to avoid multiple calls on page switch

* Fix merge conflict

* Fix lint error
2023-08-31 09:28:10 -03:00
Maikel David Pérez Gómez 350f758529
Add global quick actions dropdown menu to the Variations table header (#39950)
* Create variations actions menu

* Disable Quick update dropdown menu when no variations are selected

* Add onDelete all selected variations

* Add update stock menu item to the quick updates global menu

* Add changelog file

* Fix linter error

* Add Pricing item to Quick update menu

* Add Set list price to the Quick update menu

* Fix some unit tests
2023-08-30 16:16:47 -04:00
louwie17 6582445e71
Make sure we also save default attributes prior to variation generation (#39938)
* Make sure we also save default attributes prior to variation generation

* Add changelog

* Remove unused code

* Add changelog

* Fix lint errors

* Update and consolidate isDefault logic

* Remove unused function

* Fix tests and add a few more for testing default attributes

* Fix lint error
2023-08-30 17:04:54 -03:00
Maikel David Pérez Gómez a425a62fb8
Product Block Editor: add tracks to the Variations tab (#39914)
* Add product_options_add tracking event to add variation options

* Add product_options_edit tracking event to variation options

* Add product_options_update tracking event to variation options

* Fix set default attribute when editing it

* Add changelog file

* Add product_options_add_button_click tracking event

* Get attribute options from the terms prop instead of options, this ensures to get the updated values when the user edits the options

* Add Variation options section back

* Add changelog file
2023-08-30 14:36:44 -04:00
louwie17 db9cb4db4b
Add variation inventory quick actions (#39935)
* Add new inventory submenu to variations actions

* Move pricing submenu up to its own function

* Add tests

* Move inventory markup to seperate component

* Remove menu group label

* Add changelog

* Move pricing menu to own component

* Fix lint errors

* Update use of handlePrompt to make return more flexible
2023-08-29 11:46:48 -03:00
Maikel David Pérez Gómez 1356f76f7b
Add multiselection to the Variations table under Variations tab (#39937)
* Add a checkbox to each variation row to select the current variation

* Add an indeterminate checkbox to the header of the variations table

* Add Select all and Clear selection buttons to the variations table

* Disable Select all if all items are selected and disable Clear selection when there is no items selected

* Add changelog file

* Fix linter error
2023-08-29 08:52:54 -04:00
Maikel David Pérez Gómez 1708b854f7
Add Shipping item to the Quick Actions menu per Variation item (#39925)
* Add Shipping submenu to the quick actions menu

* Set dimensions correctly

* Add changelog file
2023-08-28 14:49:39 -04:00
louwie17 6688c60fe4
Fix description toolbar (#39873)
* Make sure the iframe block toolbar still contains full width with latest WP version

* Add min height

* Add changelog

* Revert one change

* Remove unused imports
2023-08-25 13:40:51 -03:00
Maikel David Pérez Gómez 23f33a6b74
Add Pricing item to the Quick Actions menu per Variation item (#39872)
* Move the Quick Actions menu to its own component

* Add Set list price item to the Pricing sub menu

* Add notice when a variation gets updated

* Add Set sale price to Pricing sub menu

* Do not fire change if the user cancel the window propmt

* Add Increase list price to Pricing sub menu

* Add Decrease list price to Pricing sub menu

* Add Increase sale price to Pricing sub menu

* Add Decrease sale price to Pricing sub menu

* Add Schedule sale to Pricing sub menu

* Add changelog file

* Fix lint error

* Fix typo

* Add Sale end date to the Schedule sale to Pricing sub menu

* Add tracking events

* Fix tracking event params from camelcase to snakecase
2023-08-25 12:13:16 -04:00
louwie17 9198596918
Set up and migration to use BlockTemplate classes (#39814)
* Initial set up and migration for the BlockTemplate

* Migrate remaining fields to the new SimpleProductTemplate

* Remove re-usable functions and clean up

* Add interfaces

* Add changelogs

* Remove unused id from block attributes

* Update changelog

* Address refactor suggestions

* Fix lint errors

* Add tests

* Address PR feedback

* Extend from BlockContainerInterface instead of BlockInterface
2023-08-24 16:04:44 -03:00
Maikel David Pérez Gómez f2511d4034
Product Block Editor: remove +1 category from the Variations options set of cardinality 3. (#39856)
* Change variation option labels cardinality to 3

* Add changelog file
2023-08-23 16:19:53 -04:00
Maikel David Pérez Gómez 0db29cd8c1
Create several global attributes with the same name (#39827)
* Save changes

* Remove restriction from the variations dropdown to let users create multiple attributes with the same name

* Add support for autogenerate slug in the create attribute endpoint

* Add a tooltip to specify the slug of the attribute when there are more than one listed in the dropdown list

* Add changelog files

* Revert filtering to the prev implementation

* Add review suggestions

* Add return description to the generate_unique_slug function description
2023-08-23 12:08:05 -04:00
Nathan Silveira 97137f15e7
Update new product editor middleware regex to not match 'product_brand' (#39822)
Update regex to not match 'product_brand'
2023-08-23 11:38:20 -03:00
Maikel David Pérez Gómez 897e0673a7
Add quick actions dropdown menu per variation item (#39816)
* Add the dropdown menu to the variations list

* Add preview link to the preview dropdown menu item

* Add delete variation support to the delete menu item

* Fix linter error

* Add changelog file

* Add wcadmin_product_variations_menu_view, wcadmin_product_variations_preview and wcadmin_product_variations_delete tracking events to the variation quick actions menu items
2023-08-22 10:42:18 -04:00
Maikel David Pérez Gómez a4ed336a0d
Variation attributes can not be enabled in Attributes section and Non Variations attributes cannot be enabled in Variation Options section (#39770)
* Disabled attributes used in different section

* Let the attribute input field to disable some items within the dropdown list

* Define disabled attribute ids and message

* Filter non variable attributes as disabled to be used under variations options

* Filter variable attributes as disabled to be used under attributes

* Add changelog file

* Fix linter error

* Add tooltip option to menu item and use it for attribute and variations

* Fix some rebase conflicts

* Add changelog file

---------

Co-authored-by: Lourens Schep <lourensschep@gmail.com>
2023-08-21 15:39:31 -04:00
Fernando Marichal 3f17b9b13b
Allow users to select multiple items from the media library while adding images (#39741)
* Allow select multiple items

* Add changelog

* Fix TS error
2023-08-21 12:10:30 -03:00
Fernando Marichal 278366def9
Disable tabs in parent product page with variations (#39675)
* Add warning block

* Delete warning block

* Add notice component

# Conflicts:
#	packages/js/product-editor/src/style.scss

* Add page notice

# Conflicts:
#	packages/js/product-editor/src/blocks/tab/edit.tsx

* Add `isOptionsNoticeVisible` to tab

* Add utils functions

* Remove warning

* Add notice visibility to tab

* Add notice visibility to pricing, inventory, shipping

* Add changelog

* Remove warning

* Change button text

* Add check to hasAttributesUsedForVariations

* Fix tests

# Conflicts:
#	packages/js/product-editor/src/components/tabs/test/tabs.spec.tsx

* Create notice block and move notice from tabs

* Fix product-notice block declaration

* Remove title from array

* Fix notices

* Fix styles

* Change error to error-type

* Revert "Add notice visibility to pricing, inventory, shipping"

This reverts commit 140703d49e.

* Remove import

* Revert "Fix tests"

This reverts commit 96036c5a6c.

* Remove duplicated function

* Add changelog

* Remove `isSelectedTabApplicableForOptionsNotice`

* Remove styles out of scope

* Fix notice props

* Rename block

* Remove selectedTab

* Update packages/js/product-editor/src/blocks/notice/edit.tsx

Co-authored-by: louwie17 <lourensschep@gmail.com>

* Fix lint

---------

Co-authored-by: louwie17 <lourensschep@gmail.com>
2023-08-18 11:14:02 -03:00
louwie17 c11b11631b
Add/39443 attribute filters (#39685)
* Add not filterable and not visible icons to attribute list

* Fix types

* Add changelogs

* Fix lint errors
2023-08-16 14:49:52 -04:00
Sam Seay 45c49dc232
Add a workflow to separate out eslint and annotate PRs. (#39704) 2023-08-15 18:21:51 +12:00
louwie17 3edd1bd823
Auto delete unused variations when auto generating variations (#39733)
* Add auto delete functionality for variations

* Add the remove confirmation modal

* Update delete unmatched product variation logic

* Add tests

* Add changelogs

* Fix lint errors

* Fix lint errors
2023-08-14 16:35:16 -03:00
louwie17 71e8b699db
Convert simple to variable product and auto add variations (#39673)
* Auto create variations and move product to variable when adding variation options

* Delete unused components

* Add tour to variation options

* Remove unneeded options

* Add changelog

* Fix types

* Fix lint errors

* Fix broken tests

* FIlter out option tags when not included in attributes

* Don't invalidate variations data when no new variations are created
2023-08-11 11:15:05 -03:00
Fernando Marichal 91fadfd8fe
[Product Block Editor] Remove additional create term modal (#39610)
* Remove additional create term modal

# Conflicts:
#	packages/js/product-editor/src/components/attribute-term-input-field/attribute-term-input-field.tsx

# Conflicts:
#	packages/js/product-editor/src/style.scss

* Add changelog

* Fix list refresh and add loading state

* Remove duplicated "invalidateResolutionForStoreSelector"

* Add modal and `autoCreateOnSelect`

* Update packages/js/product-editor/src/components/attribute-term-input-field/attribute-term-input-field.tsx

Co-authored-by: louwie17 <lourensschep@gmail.com>

* Add Attributes `invalidateResolution`

* Improve error handling

* Add term_exists error

* Fix lint errors

* Fix isOpen variable

* Fix lint

---------

Co-authored-by: louwie17 <lourensschep@gmail.com>
2023-08-10 14:21:28 -03:00
Maikel David Pérez Gómez 3ffe7b8376
Create variation items block (#39657)
* Create and register product-variation-items-field block

* Create variations-table component

* Use variations-table component in variation-items block

* Remove last border bottom from the variation options list

* Add changelog file

* Add changelog file
2023-08-09 16:06:59 -03:00
louwie17 592b4feb5e
Fix attribute terms disappearing in list (#39620)
* Fix enhance attribute logic

* Add changelog

* Fix test

* Add auto create global attribute term and fix bug with terms for global attribute

* Fix test and update changelogs

* Add invalidate resolution call and error notice

* Revert auto create on select changes
2023-08-09 10:41:47 -03:00
louwie17 75d64ee063
Create global attributes by default (#39548)
* Add support to attribute control for creating global attributes

* Add create global attribute to variation block

* Add changelog

* Invalidate the attributeTerm search after creating a new attribute term
2023-08-08 12:54:11 -03:00
Maikel David Pérez Gómez 8d8d315d66
Focus the first attribute field when opening the modal (#39549)
* Focus the first attribute field on modal shown

* Add changelog file

* Remove setTimeout to focus the attribute dropdown field
2023-08-08 10:50:11 -04:00
Maikel David Pérez Gómez b546e4fb17
Manage default variation option (#39570)
* Add default attributes property to the Product type

* Add change log file

* Set default attributes when click add from the attribute options modal

* Add Set default value checkbox to the edit attribute modal

* Manage default attributes when update or delete an attribute option

* Show Set default value only when the editing attribute is used for variations

* Add change log file
2023-08-08 10:41:26 -04:00
Maikel David Pérez Gómez d3702c53ba
Add product visibility blocks (#39477)
* Add catalog visibility block

* Add product search visibility block

* Add changelog files

* Fix linter errors

* Remove non necesary block

* Add catalog_visibility property to the Product type
2023-08-08 09:58:00 -03:00
Sam Seay e8c3808527
Upgrade TypeScript to v5.1 (#39531) 2023-08-08 16:35:31 +12:00
Joshua T Flowers 63ca33ae35
Fix toolbar button text not showing in WP 6.3 (#39572)
* Fix toolbar button text not showing in WP 6.3

* Add changelog entry
2023-08-04 16:23:09 -05:00
Maikel David Pérez Gómez b5db405265
Feedback bar is mis-aligned; transient notices overlap (#39233)
* Fix the feedback bar alignment to be centered

* Move the transient notices to the top of the feedback bar

* Add changelog file

* Remove feedback bar animation
2023-08-03 10:06:45 -04:00
louwie17 1212fcb689
Add new variation modal (#39522)
* Hook up add new variations options modal

* Fix duplicate logic and test

* Add changelog

* Match local attributes by name case incentive

* Remove console log

* Make use of some function instead of findIndex
2023-08-02 14:29:09 -03:00
louwie17 86788fcaed
Pass down height of inserter panel to allow for scrolling (#39491)
* Pass down height of inserter panel to allow for scrolling

* Add changelog
2023-07-31 12:36:07 -03:00
Nathan Silveira 403c8ba8b8
[ Product Block Editor ] Create Variation options block (#39256)
* Add support for variable products

* Add 'hello world' block to variations tab

* Add product-section block to template

* Add AttributeControl component to screen

* Add changelog

* Change labels

* Make a copy of AttributeControl to VariationOptionsControl to allow the fields to evolve separately in future

* Fix tests

* Add changelog to woocommerce

* Fix alert error

* Remove copied control and start adapting attribute control to handle both scenarios

* Add -field to block name

* Revert "Add -field to block name"

This reverts commit 50e1ee66e27ffb2df22ea7f6a4f78d1577a273f5.

* Revert "Revert "Add -field to block name""

This reverts commit eee0441c6532f9fa8cf8383d9699fd503dd054ae.

* Extract more labels

* Hide drag handle in variation options
2023-07-28 14:40:18 -03:00
Nathan Silveira bf97630ad0
[Product Block Editor] Add require password block field (#39464)
* Add post password to API

* Add changelog

* Fix phpcs issue

* Remove post_password from tests

* Add additional property to test

* Increment number of properties in product schema

* Update the post when post_password changes

* Start adding password block

* Add css and import it

* Refactor attributes and erase password when checkbox is unchecked

* Add changelogs

* Remove unused imports

* Rename 'fields' to 'field'

* Refactor CSS

* Remove example object
2023-07-28 14:05:03 -03:00
Nathan Silveira 8020f3407b
[Block Product Editor]: Only run name validation if the field has been edited (#39320)
Only run name validation if the field has edit
2023-07-20 10:42:01 -04:00
Maikel David Pérez Gómez 776d567f30
Create the Organization tab (#39232)
* Add Organization to the right of General tab

* Add Product catalog and Attributes sections to the Organization tab

* Add Categories and Disable product reviews blocks to Product catalog section

* Add attributes block to the attributes section

* Add changelog files

* Fix php linter error

* Remove Categories and Attributes blocks from the General tab

* Change Disable product reviews by Enable product reviews
2023-07-19 10:11:03 -04:00
Maikel David Pérez Gómez 24a655aec4
Allow the user to delete the description (#39229) 2023-07-14 11:00:03 -04:00
Fernando Marichal bbd727c257
Add header buttons to the description editor modal (#39156)
* Add header buttons to the description editor modal

# Conflicts:
#	packages/js/product-editor/src/components/iframe-editor/header-toolbar/header-toolbar.scss
#	packages/js/product-editor/src/components/iframe-editor/header-toolbar/header-toolbar.tsx

# Conflicts:
#	packages/js/product-editor/src/components/iframe-editor/header-toolbar/header-toolbar.tsx

* Remove isModalActionsBarVisible

# Conflicts:
#	packages/js/product-editor/src/components/iframe-editor/header-toolbar/header-toolbar.tsx

* Fix styles and removed comment

# Conflicts:
#	packages/js/product-editor/src/components/iframe-editor/header-toolbar/header-toolbar.tsx

* Add changelog

* Fix styles

* Fix gap between buttons
2023-07-14 11:18:16 -03:00
Matt Sherman a706bd666b
Product Editor: Fix description modal editor scrolling (#39212)
* Scroll modal editor

* Set editor to always 100% height

* Only scroll editor canvas

* Scroll sidebar

* Clip inserter

* Comment for inserter clipper

* Move iframe editor css

* Remove unused const

* Changelog
2023-07-13 10:40:02 -04:00
Matt Sherman 408cf8d53c
Product Editor: Add "Copy all content" menu item to description editor modal (#39199)
* Copy all content menu item skeleton

* Add blocks to editor context

* Show notice on copy success

* Use store to get blocks to copy

* Remove blocks from editor context (decided to use store instead)

* Changelog

* Disable menu item if no content
2023-07-13 10:39:34 -04:00
Matt Sherman a51f384021
Product Editor: Disable autocomplete on product name field (#39211) 2023-07-13 10:09:59 -04:00
Matt Sherman 17f83af095
Product Editor: Add help menu item to description modal editor (#39178)
* More menu skeleton

* Help menu item

* Tracks event for help menu item

* Remove invalid/unused ref from MoreMenu

* Changelog
2023-07-11 13:19:53 -04:00
Nathan Silveira e85491bdea
Focus on name field when mounting and update summary field UI (#39050)
* Move placeholder of summary to help text at bottom of the component

* Focus the name field when mounting

* Add changelog

* Create 'autoFocus' block attribute instead of using useEffect

* Add changelog
2023-07-11 09:48:26 -03:00
Maikel David Pérez Gómez 96c0c5bd74
On-/offboarding copy updates (#39055)
* Change the modal's description test in the first step of the product block editor tour

* Change the modal's description text in the first step of the product block editor guide

* Change the modal's description text in the second step of the product block editor guide

* Change the modal's title and description text in the third step of the product block editor guide

* Change the modal's description text in the four step of the product block editor guide

* Enhance the Options menu of the product block editor

* Add slide up animation and translucent background to the feedback bottom bar

* Change de CES's modal heading text in the product block editor

* Change the notice message after the feedback is being sent from the CES Modals

* Enhance leave feedback modal checkbox labels

* Change leave feedback modal submit button text

* Show success notice after submit the leave feedback modal

* Add changelog files

* Change the illustration in the first step of the feature tour

* Change the modal's title and description text in the first step of the product block editor tour for old users

* Change the modal's title and description text in the first step of the product block editor guide for old users

* Change the modal's title and description text in the third step of the product block editor guide for old users

* Fix unit tests

* Change the customer effort score changelog description

* Change footer forward button to primary and backward button to tertiary in the tour guide modal
2023-07-10 14:51:55 -04:00
Maikel David Pérez Gómez 714e50bf4c
Create variations block with empty state (#39038)
* Create and register woocommerce/product-variations-fields block

* Hide or show the empty state or inner blocks if the product has attributes

* Add changelog files

* Fix php linter errors
2023-07-07 17:15:54 -03:00
Nathan Silveira ee900c9b33
Add button on toolbar to toggle show/hide block inspector (#39090)
* Add button on toolbar to toggle show/hide block inspector

* Move changelog

* Copy drawerright icon from @wordpress/icons
2023-07-07 12:14:41 -03:00
Maikel David Pérez Gómez ecd1795b44
Add the list view component and button to the modal editor (#38809)
* Add document overview opened state to the EditorContext

* Create document overview toolbar button

* Add document overview button to the header toolbar

* Create document overview sidebar

* Register document overview sidebar styles

* Set document overview sidebar visible when document overview button is pressed

* Add changelog file
2023-06-27 10:08:08 -04:00
Joshua T Flowers 6bbc4dad1a
Add missing tracks events to product editor (#38728)
* Only record product update on already published products

* Add source into published product tracks event

* Add missing tracks options to product update event

* Track tab clicks in the editor

* Add source to tab clicks

* Record tracks on preview click

* Add events for media gallery, description, and attributes

* Add tracks events to more menu

* Replace new_product_page with source

* Add changelog entry

* Fix lint errors

* Add tracks for About the Editor menu item

* Add onClick event to AboutTheEditor menu item

* Use dropdown option event for classic editor menu click
2023-06-21 09:38:04 -07:00
Matt Sherman 7004396617
Set attributes to visible by default (#38777)
* Default visible to true if not explicitly set

* Refactor onAddingAttributes to reduce complexity

* Changelog

* Improve hasTermsOrOptions based on review suggestion
2023-06-16 18:02:16 -04:00
Fernando Marichal a40543c16d
Fix styles for modals (#38775)
* Fix obw modal

* Fix modal styles

* Add changelog

* Add changelogs

* Move __selection and __errors
2023-06-16 15:48:33 -03:00
Matt Sherman 9a6d9533c9
Keep showing product editor feedback bar after feedback modal shown (#38773)
* Show feedback bar even after feedback is given

* Changelog
2023-06-16 11:51:18 -04:00
Joshua T Flowers 3ad98ec8b4
Add tool selector option to iframe editor (#38686)
* Add tool selector option to iframe editor

* Fix lint errors
2023-06-15 16:29:12 -07:00
Joshua T Flowers ce770bbfd2
Fix empty state for currency inputs in product editor (#38697) 2023-06-15 09:32:57 -07:00
Matt Sherman de6f77d8be
Fix transient notices overlapping product editor footer (take 2) (#38698)
* Use WooFooterItem for Footer

* Use WooFooterItem fill for TransientNotices

* Adjust TransientNotices styling to work in footer

* Fix footer width when in setup wizard

* Change export of TransientNotices from default to named

* Add border to footer

* Changelog

* Changelog

* Mock WooFooterItem to allow unit tests to pass

* Fix lint error in test
2023-06-14 16:32:28 -04:00
Fernando Marichal 47481490d8
CES modal modifications (#38643)
* Add extraFields prop

# Conflicts:
#	packages/js/product-editor/src/components/product-mvp-ces-footer/product-mvp-ces-footer.tsx

* Add changelog

* Add changelogs

* Fix styles

# Conflicts:
#	packages/js/product-editor/src/components/product-mvp-ces-footer/style.scss

* Add extraFields validation

* Remove files

* Add styles and js

* Modify the other share feedback form

* Change modal title

* Fix feedback-bar

* Fix return

* Fix params types

* Rename `extraFields` to `getExtraFieldsToBeShown`

* Fix styles

* Fix error handling

* Fix styles

* Rename prop

* Fix error message
2023-06-14 11:25:51 -03:00
Matt Sherman 0f8d274d7f
Remove editor-styles-wrapper class from product editor (#38681)
* Remove editor-styles-wrapper class from product editor

* Override default block margins and layout applied for themes without a theme.json file

* Changelog
2023-06-12 18:56:57 -04:00
Joshua T Flowers 93262ac019
Add editor history and undo/redo toolbar buttons (#38573)
* Add editor history and undo/redo behavior

* Add option to limit max editor history

* Move inserter properties to editor context

* Move editor toolbar to separate folder

* Add changelog entry

* Remove no longer needed editor provider
2023-06-12 14:23:22 -07:00
Joshua T Flowers 90e4ddbf29
Update product editor CES modal to match new designs (#38592)
* Add new fields and copy update to product CES modal

* Update styling for product CES modal

* Record email in tracks callback if provided

* Fix modal header spacing

* Fix record callback types

* Add optional tag styling

* Allow submitting form when a reason has been selected

* Fix modal padding bottom

* Update modal width to match designs

* Add changelog entries

* Update margin for legend

* Add props to doc comment

* Make className prop optional

* Update tests for recording score with email
2023-06-12 10:58:00 -07:00
Maikel David Pérez Gómez 72f7e6ebbb
Publishing product in classic editor redirects back to new editor (#38551)
* Changes the feature given it's id and a toggle value as a query param

* Swap classic editor and new product block editor url when product_block_editor feature changes

* Turn off the product_block_editor feature when user choose to use the classic editor

* Add changelog files

* Fix linter errors

* Add nonce to each feature change request

* Change the hooks name for better readability

* Use get_current_screen function to better identify if the current screen is the product creation or edition

* Add wp_die if the nonce verification failed

* Change regex for explode/parse_url for better reading
2023-06-09 11:18:40 -04:00
Matt Sherman dadc0eb777
Show feedback footer on product editor page (#38599) 2023-06-08 20:56:07 -04:00
Joshua T Flowers e09e8b8ab0
Show "Save draft" instead of "Saved" on initial product page (#38609) 2023-06-08 15:32:49 -07:00
Joshua T Flowers 4569fda5c1
Add iframe editor header toolbar and block inserter (#38549)
* Add initial toolbar and secondary sidebar

* Style the sidebar and inserter panel

* Adjust toolbar and modal paddings

* Move header toolbar styles to separate file

* Make header toolbar class names consistent with component

* Dont use experimental insertion index and fall back to default insertion point

* Add changelog entry
2023-06-08 12:14:25 -07:00
Maikel David Pérez Gómez 338bf6e45e
Product route not updated after save initially failed and succeeded after (#38507)
* Enhance error handling

* Use last persisted product status to show a right publish button label and notices

* Use last persisted product status to show a right preview button label and notices

* Use last persisted product status to show a right save draft button label and notices

* Uses the last persisted product to better compare it with the most recently updated product so the buttons can behave correctly

* Add changelog file

* Fix getProductErrorMessage unit test

* Fix notice message when create / update the product

* Get product id from within each button hook
2023-06-08 14:22:07 -04:00
Maikel David Pérez Gómez abcedbefe0
[MVP QA #1] Visual: spacings (#38325)
* Update the margin-left on the buttons in the top bar from 16px to 8px

* On mobile, the left and right body margins should be 32 px

* The inner padding in the tab in the top bar should be 12px, not 16px

* In the edit product link modal, let's set this modal’s width to 650 px and remove the line separating the header from the contents

* All modals should now have 8 px window radius

* In the feedback form, can we fix the buttons at the bottom

* The help icon in checkboxes small, detached from the item label, and vertically misaligned. Left margin of 4 px, no vertical adjustment; somehow it has a -2px set for the top margin)

* Fix block-editor-block-contextual-toolbar top position

* When the product is in a draft state, the button in the top bar should say Add, not Save. It should change into Update once it's published on the store

* Fix layout margin top

* Add ection support for blockGap and set title and description to optional

* Remove non needed control field margin bottom

* Fix schedule sale block spacing

* Remove non needed control field help text margin bottom

* Remove the sub section outer spacing

* Move pricing fields into a sub section block

* Fix collapsible-contet margin top

* Remove invalid inner block layout spacing

* Wrap sku, stock toogle and quantity within a sub section

* Group inventory advance section inner blocks into a sub section

* Fix linter error

* Add changelog files

* Fix php lint error

* Change unit names to fit GB definitions
see: b2c16f3c68/packages/base-styles/_variables.scss\#L31-L41
2023-06-01 13:56:31 -04:00
Joshua T Flowers a5e36377f9
Check for unsaved changes before leaving product editor (#38430)
* Check for unsaved changes before leaving product editor

* Add changelog entry

* Add hasEdit convenience method to useProductEdits hook
2023-05-31 10:14:12 -07:00
Sam Seay b076a7b521
Fix linter issues and update Syncpack (#38523) 2023-05-31 11:45:10 +12:00
Matt Sherman 4e530ba2e2
Prevent theme styles from being used in the block-based product editor (#38491) 2023-05-30 13:25:55 -04:00
Maikel David Pérez Gómez a43a418019
List price gets reset on blur when error is shown (#38414)
* List price gets reset on blur when error is shown

* Add changelog file

* Fix linter error
2023-05-24 13:53:28 -04:00
Joshua T Flowers 353e01eb65
Tweak typography and element spacing in product editor (#38351)
* Update header font size

* Remove icons from sections

* Update radio block label and spacing

* Make checkbox tooltips larger and vertically align

* Update description colors

* Update h4 font sizes in editor

* Add changelog entry

* Add core changelog entry

* Handle initial design feedback

* Remove copy of assets in client webpack config
2023-05-24 10:11:00 -04:00
Maikel David Pérez Gómez 195bcd2368
Limit 'email me when stock reaches' field to numerical only (#38353)
* Limit 'email me when stock reaches' field to numerical only

* Add changelog file
2023-05-22 06:59:58 -03:00
Maikel David Pérez Gómez e16792dc11
Make DateTimePickerControl a ForwardedRef (#38306)
* Forward ref the DateTimePickerControl

* Add changelog file

* Remove the component typing definition

* Integrate the forwardedRef component with the schedule-sale block

* Add changelog file
2023-05-22 06:55:07 -03:00
Nathan Silveira 5437ed50c3
Use SelectTree in Parent Category field (#38261)
* Increment label CSS to look the same as TextControl's label

* Migrate Parent Category field to SelectTree

* Add changelogs

* Fix unit test that was edited by mistake

* Revert css changes in select-control.scss

* Use BaseControl as label on SelectTree

* Increment changelog

* Increment changelogs

* Refactor test

* Refactor category-field functions and use them in related places

* Fix ordered list appearing empty
2023-05-19 12:45:11 -03:00
louwie17 2843fbb7a8
Fix editor header hidden in Firefox (#38247)
* Update page config to add support for layout header/footer

* Fix lint error
2023-05-18 13:00:42 -03:00
Joshua T Flowers d17ca83b02
Add error specific messages to product save functionality (#38307)
* Allow errors to be thrown when saving entity records

* Show frontend error message when one exists

* Allow errors to be thrown in preview save entity

* Rename new util to getProductErrorMessage

* Add tests around error message util

* Add changelog entry
2023-05-18 05:28:28 -03:00
Joshua T Flowers 81e92392d5
Fix double scrollbars on product editor page (#38281)
* Refactor Layout component to functional component

* Add class to pages based on page path

* Add styling for interface skeleton on product pages

* Add changelog entries

* Move product page styles out of product editor package and into client

* Fix linting issues

* Check for location before checking path in page tracking

* Dont add body classes when no page path exists

* Record page view without router location for embed pages
2023-05-18 05:25:36 -03:00
Maikel David Pérez Gómez 470ecd0e7d
Fix validation behavior (#38194)
* Create ValidationContext

* Add ValidationProvider to the product editor

* Add new validation to the name block

* Add new validation to the Save button

* Store validations within a useRef instead of useState to improves re-renders

* Create find first visible and invalid element function

* Add focus first invalid element feat when submitting

* Integrate autofocus with name block

* Migrate sale-price block to the new validation system

* Add changelog file

* Migrate regular-price block to the new validation system

* Migrate schedule-sale block to the new validation system

* Migrate inventory-quantity block to the new validation system

* Migrate shipping-dimensions block to the new validation system

* Remove old validation hook

* Add validation to the save-draft button

* Add validation to the preview button

* Expose validation hooks to be used outside of the package

* Make sure the product is in fact saved before calling the onPublishSuccess
2023-05-17 01:01:30 -04:00
Maikel David Pérez Gómez 4b3479595b
Only register blocks when user navigates to the product edit page (#38303)
* Remove block registration from within the Editor component

* Expose the initBlocks function to be used outside of the product package

* Register blocks within the ProductPage component

* Add changelog files

* Unregister blocks when product page gets unmounted
2023-05-16 07:41:26 -03:00
Joshua T Flowers 35e1fed2f9
Wait for editor changes to be debounced before closing modal (#38262)
* Wait for editor changes to be debounced before closing modal

* Handle PR feedback
2023-05-16 04:41:43 -03:00
Maikel David Pérez Gómez 332094e87d
Update shipping class block to match new designs (#38301)
* Change the section title from Shipping fee to Shipping class

* Replace the radio buttons with a regular dropdown

* Add changelog files
2023-05-15 13:06:48 -04:00
Matt Sherman ac78d3de2b
Product Block Editor: Fix product summary field top margin (#38251)
* Fix product summary field margin

* Changelog
2023-05-12 10:45:03 -03:00
Joshua T Flowers a587612934
Add editor styles to product editor and iframe editor (#38168)
* Add editor styles to product editor and iframe editor

* Make section title css selectors more specific

* Add changelog entry

* Remove additional commented component

* Remove unused import
2023-05-11 11:43:22 -03:00
Maikel David Pérez Gómez 227695386d
Fix spacing between pricing fields (#38146)
* Fix spacing between pricing fields

* Add changelog file

* Fix spacing between sale toggle and the next section
2023-05-09 19:13:56 -04:00
Joel Thiessen c76203cde5
Correcting spacing for image gallery block (#38151)
* Correcting spacing for image gallery component

* Adding changelog
2023-05-08 14:18:15 -03:00
Maikel David Pérez Gómez c265db936e
Add Sale price validation (#38078)
* Create sale-price block

* Create regular-price block

* Add changelog files

* Fix some typos in field validator names
2023-05-08 10:05:13 -04:00
Joshua T Flowers c4806c3ac8
Show comma separated list in ready only mode of select tree control (#38052)
* Add read-only state to selected items in select control

* Only close menu on focus outside of select control

* Add changelog entry

* Remove errant comment out of onBlur line

* Fix regression of input focus behavior

* Hide input when in read only mode

* Turn off read only mode when focused

* Show select control input on single item dropdowns and when no selections have been made in multiple dropdowns

* Prevent focus loss when removing an item

* Prevent loss of field focus when clicking on selected item tags

* Fix broken assertion with comma separated list

* Add product editor changelog entry
2023-05-08 04:17:52 -03:00
Joel Thiessen e7d67710fd
Restoring standard tabbing behavior in product block editor (#38105) 2023-05-05 12:39:39 -07:00
Joshua T Flowers f1db682cc6
Fix summary toolbar positioning and selection on blur (#38086)
* Remove block selection on summary input blur

* Move block props to wrapper around rich text

* Fix content ID and for label

* Add changelog entry

* Use useInstanceId instead of lodash uniqueId
2023-05-05 11:52:12 -07:00
Joshua T Flowers bb244484d3
Update shipping dimensions image in new product blocks editor (#38101)
* Update shipping dimensions image SVG

* Allow labels in shipping dimension SVG

* Add changelog entry
2023-05-05 09:15:35 -07:00
Joshua T Flowers 14ed88cd1f
Prevent double debouncing of iframe editor callback (#38087)
* Prevent double debouncing of iframe editor callback

* Add changelog entry
2023-05-05 09:15:07 -07:00
Joshua T Flowers 4deb5b3f84
Remove drag and drop handle in product blocks editor (#38127)
* Remove drag and drop handle in product blocks editor

* Add changelog entry
2023-05-05 04:55:57 -03:00
louwie17 ce07458752
Update disable drag and drop within images block (#38045)
* Allow disabling of drag and drop within ImageGallery component

* Add changelogs

* Fix onReplace logic for images block

* Fixing linting error

---------

Co-authored-by: Joel <dygerati@gmail.com>
2023-05-05 04:45:26 -03:00
Joel Thiessen 4729ea054b
Adding basic ordering to tab slot fill (#38081) 2023-05-04 10:57:19 -07:00
Joel Thiessen 3679f019bb
Adding attributes block to product block editor. (#38051) 2023-05-02 21:13:48 -07:00
Joshua T Flowers 6b141fa2c6
Add fixed toolbar to modal editor (#38031) 2023-05-02 08:45:50 -07:00
Joel Thiessen 16b9191c0d
Adding shipping class option and modal (#37968) 2023-05-01 10:04:54 -07:00
Joshua T Flowers 8827d3fb9a
Add block inspector to modal iframe editor (#38011)
* Add block inspector to modal iframe editor

* Add changelog entry
2023-05-01 10:04:25 -07:00
Joel Thiessen d014e80a20
Fixing more menu width in product block editor header (#38053)
* Fixing more menu styles

* Adding changelog
2023-05-01 06:55:31 -03:00
Maikel David Pérez Gómez a35f2c3d5d
Update List price Pricing link on the general tab to navigate to the Pricing tab (#37961)
* Update List price Pricing link on the general tab to navigate to the Pricing tab

* Add changelog files

* Simplify the event name to product_pricing_help_click
2023-04-28 11:33:56 -04:00
Maikel David Pérez Gómez 1514333162
Remove AUTO-DRAFT in product name field on create new product page (#37982)
* Remove AUTO-DRAFT in product name field on create new product page #37930

* Add changelog file

* Remove non needed useEffect import
2023-04-28 11:33:28 -04:00
Maikel David Pérez Gómez f3959d0700
Summary field remove 'inline image' and 'keyboard input' options (#38012)
* Summary field remove 'inline image' and 'keyboard input' options

* Add changelog file
2023-04-28 10:51:22 -04:00
Joshua T Flowers bf14b26846
Add modal editor for use in product editor (#37937)
* Add modal editor for use in product editor

* Allow title of modal to be modified by consumer

* Add changelog entry

* Remove errant style imports after rebase

* Handle PR feedback
2023-04-28 07:48:36 -07:00
louwie17 452fa75038
Remove strange block editor highlighting within product block editor (#38000)
* Remove or hide block highlighting within product block editor

* Add changelog
2023-04-28 08:31:14 -03:00
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