Commit Graph

581 Commits

Author SHA1 Message Date
Fernando Marichal b1b9e11323
Add preview and replace button to downloads edit (#40835)
* Add image replace

# Conflicts:
#	packages/js/product-editor/src/blocks/product-fields/downloads/edit-downloads-modal/edit-downloads-modal.tsx

* Add image and replace button

* Change styles

* Add changelog

* Verify the file is an image

* Fix image size

* Fix styles

* Changed left padding

* Fix image gap

* Fix style
2023-11-03 17:07:07 -03:00
Matt Sherman 18faf14db7 Update changelog 2023-11-03 09:16:14 -04:00
Matt Sherman afbe61a4f7 Move PluginArea into BlockEditor so plugins can get block info 2023-11-03 09:16:14 -04:00
Matt Sherman fc2fa8598b Changelog 2023-11-03 09:16:14 -04:00
Matt Sherman 15d46e478c Add PostTypeContext 2023-11-03 09:16:14 -04:00
Matt Sherman eae4dc1b9c Changelog 2023-11-01 15:54:55 -04:00
Matt Sherman 94c7112c00 Only select on focus in currency and number fields if still has focus 2023-11-01 15:54:03 -04:00
Maikel David Pérez Gómez 6b44a969d0
Add filters to Variation table (#40978)
* Create product variations filter component

* Add slug to the product and variation attributes
This is needed to be able to filter variations by specific attribute slugs

* Add support to filter variations by many attribute options

* Integrate attribute options filter in variations table

* Fix rebase conflicts

* Set initial filter values

* Improve intial filter values and cache invalidation

* Add changelog files

* Fix linter errors

* Fix unit tests

* Change the min amount of options to show the search input

* Fix invalid cache key generation for the datastore

* Fix unit tests

* Fix linter errors

* Fix js tests

* Add terms pagination for varition filters

* Load terms on demand plus pagination

* Show selected option names as the dropdown button toggle text

* Fix invalida state when reset and on close the popover

* Revert adding selected options as part of the dropdown toggle text

---------

Co-authored-by: Fernando Marichal <ultimoround@gmail.com>
2023-10-31 13:29:48 -04:00
Fernando Marichal bae33f34de
Fix attributes modal incorrect notice (#40976)
* Remove modal copy

* Fix styles

* Add changelog

* Fix build error
2023-10-31 13:18:32 -03:00
Matt Sherman 17ed81c24f
Order menu items in product editor's more menu (kebab menu) (#41104) 2023-10-31 10:45:20 -04:00
Nathan Silveira 164ae0984c
Fix double scroll in General tab and image upload overlapping (#40977)
Fix double scroll in General tab and image upload overlapping with other blocks
2023-10-31 11:10:40 -03:00
Matt Sherman 16d8215119 Changelog 2023-10-30 15:00:18 -04:00
Matt Sherman c83f581932 Add support for ordering product more menu items 2023-10-30 14:59:37 -04:00
Matt Sherman affbb01136 Changelog 2023-10-30 14:44:08 -04:00
Matt Sherman a921863e40 Remove SlotFillProvider from editor 2023-10-30 14:39:01 -04:00
Nathan Silveira 81cb9e9458
Add tooltip next to label for text and number blocks (#40908)
* Create initial version of TextControl

* Extract 'label' component for reusability

* Reduce gap

* Add label component to number control and add tooltip and required attributes

* Add changelog

* Remove unused CSS

* Add tooltip to type definitions

* Update doc for number block

* Add text block documentation

* Update parameters definition

* Set label to 'mandatory' in TypeScript

* Set label to mandatory

* Organize to alphabetical order

* Refactor required validation to be more consistent with name field

* Generify documentation

* Use createInterpolateElement for label with required indicator
2023-10-26 15:35:39 -03:00
Fernando Marichal 898eb30f7e
[Single Variation] Add missing tracks events (#40996)
* Add note prop

* Add note for single variation

* Add event recording for generic toggle

* Add changelog

* Add parent_id to toggle event

* move logic inside recordProductEvent

* Modify postType
2023-10-26 00:45:53 -03:00
Nathan Silveira a8e4b27df2
Fix 'Hide in product catalog' being unchecked for variations (#41007)
* Don't touch status attribute in variations

* Add missing validate for variations
2023-10-25 16:52:23 -03:00
louwie17 3f7eb0ce31
Invalidate variations upon generation and fix formatted name (#40905)
* Invalidate variations upon generation and fix formatted name

* Add aditional invalidates to keep cache up to date

* Update formatted name to always return attribute term name list
2023-10-25 08:45:58 -04:00
Nathan Silveira bc04234732
Fix checkbox not working when checkedValue is provided (#40979) 2023-10-25 00:29:53 -03:00
Maikel David Pérez Gómez 791af33e95
Empty state for uncreated/empty variations (#40940)
* Move empty-variations-image to the images folder so it can be used in other components

* Create TableEmptyState component

* Add TableEmptyState to the Variations table component

* Add changelog file

* Fix linter error
2023-10-23 15:21:42 -04:00
Fernando Marichal 469a76a82f
Show error message when single variation price is empty (#40885)
* Show notice when price is empty

* Add changelog

* Add variation check

* Allow multiple errors

* Show unique errors

* Change error text

* Rename wpError to wpErrors

* Show single error

* Add error type

* Refactor catch
2023-10-23 16:19:00 -03:00
Maikel David Pérez Gómez eff2b8cca3
Update default visibility settings for variation options (#40949)
* Replace hidden icon by seen icon

* The 'visible' icon is only shown when the Show in product details box in the variation option is checked

* The tooltip displayed when the user hovers over the 'hidden' icon is updated to: Visible in product details

* On hover, the cursor changes to help

* Add changelog file
2023-10-23 14:19:33 -03:00
Maikel David Pérez Gómez 16ce05109f
Add a loading state for the new product form (#40939)
* Create product page skeleton

* Load skeleton in product and variation pages

* Let each page to define own loading/skeleton when the router is resolving the page.

* Add changelog files

* Fix linter error

* Fix unit test
2023-10-23 12:47:26 -04:00
Maikel David Pérez Gómez 50ff379f25
Delete variations from the single page does not reflect correctly in the parent product (#40900)
* Invalidate resolution for paginated variations after removing any from the single variation page

* Add changelog file

* Invalidate resolution also for getProductVariationsTotalCount
2023-10-20 13:06:02 -03:00
louwie17 fbac42aafc
Update variation switcher logic to not loop (#40901) 2023-10-20 11:17:30 -04:00
Matt Sherman 3fa5573706
Template API: Deprecate woocommerce/conditional block (#40883) 2023-10-20 09:53:06 -04:00
Nathan Silveira 3d182f342f
Create React component wrappers for the checkbox and number blocks (#40828)
* Add @woocommerce/number to @woocommerce/components

* Create a component for checkbox and use it on the block

* Create a component for number and use it on the block

* Add changelogs

* Remove scss import

* Rename Numbercontrol prop

* Expose useProductEntityProp

* Move components to product-editor package and fix UI bug created in checkbox component

* Revert unnecessary changes in components and update changelogs

* Revert changes in use-number-input-props

* Fix issue in checkbox

* Revert css change
2023-10-20 10:52:56 -03:00
Fernando Marichal 3426692606
Hide `Switch to draft` button on single variation page (#40856)
* Hide Switch to draft when variable product

* Add changelog

* Change changelog
2023-10-20 09:32:06 -04:00
Matt Sherman 61ef8a9fa2 Changelog 2023-10-19 15:34:32 -04:00
Matt Sherman 60fde2be96 Deprecate woocommerce/conditional block 2023-10-19 15:32:40 -04:00
Maikel David Pérez Gómez 8827e42bd7
Set prices button from the variations notice is not updating the right amount of variations (#40876)
* Improve has_price filter so it can matches when the price record does not exist or it's empty/null

* Get the exact variation ids of those ones that do not have price

* Add changelog files

* Fix linter errors
2023-10-19 13:14:08 -04:00
Matt Sherman 613a63b0ef
Template API: Conditional visibility support (#40722) 2023-10-19 12:02:05 -04:00
Matt Sherman df2a0eb337 Remove productType from ProductEditorContext interface 2023-10-19 11:20:20 -04:00
Fernando Marichal b0113ee555
Add edit downloads modal (#40599)
* Create edit downloads modal

* Add modal to downloads

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

* Refactor removeHandler

* Fix EditDownloadsModal

* Refactor onSave

* Add changelog

* Fix onRemove

* Fix styles

* Fix lint

* Fix lint

* Fix modal closing when copyToClipboard
2023-10-19 11:09:04 -04:00
Matt Sherman 7fd28367d8 Remove order attribute from tab block 2023-10-19 08:28:14 -04:00
Matt Sherman 4605f7ee57 Set tab order based on block's order 2023-10-19 08:23:44 -04:00
Matt Sherman 97dc41e2aa Remove productType from context (it was really just postType, which is already in context) 2023-10-19 07:43:09 -04:00
Matt Sherman abd71af40a Switch conditional block to use postType from context instead of productType 2023-10-19 07:33:29 -04:00
Matt Sherman b40f9d2035 Switch productType to postType in context augmentation 2023-10-19 07:30:53 -04:00
Matt Sherman f399196b39 Changelog 2023-10-18 18:57:27 -04:00
Matt Sherman 6b6ffd184e Remove unused imports 2023-10-18 18:44:32 -04:00
Matt Sherman 48d5cca0b8 Fix block registration for downloads 2023-10-18 15:16:17 -04:00
Matt Sherman 6b55e7c096 Refactor client-side usesContext augmentation 2023-10-18 15:16:17 -04:00
Matt Sherman 23b2953934 Fix block registration on notice-edit-single-variation 2023-10-18 15:16:17 -04:00
Matt Sherman 2981f14a5b Fix block registration for downloads 2023-10-18 15:16:17 -04:00
Matt Sherman b256841135 Use getEditedEntityRecord to get product 2023-10-18 15:16:17 -04:00
Matt Sherman f466d84bf5 Remove editedProduct from usesContext 2023-10-18 15:16:17 -04:00
Matt Sherman 67e3d72095 Add productType to ProductEditorContext interface 2023-10-18 15:16:17 -04:00
Matt Sherman 6f53697df2 Remove console.log 2023-10-18 15:16:17 -04:00
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