* Sync Interactivity API code with Gutenberg
* New store() API
* Store raw actions
* Update wc-interactivity-store implementation
* Replace `wc_store` with `wc_initial_state`
* Parse and populate initial state
* Allow store parts in `store()`
* Accept namespaces in directive paths
* Add $$namespace to directives' object values
* Make namespace parsing more robust
* Use DeepPartial type for store parts
* Do not pass `rawStore` to `afterLoad` callbacks
* Simplify `store()` a bit
* Implement `privateStore()`
* Sync context directive with Gutenberg
* Refactor scope and extract getters per scope
* Add namespace to getters and actions
* Remove current privateStore implementation
* Remove `afterLoad` option from `store`
* Use same proxy handlers for ns, getters and actions
* Set scope inside `evaluate`
* Refactor proxy handlers
* Improve types a bit
* Catch errors in async actions
* Implement stacks for scopes and namespaces
* Implement `getElement`
* Change directives object structure
* Remove unnecessary import
* Implement private stores
* Return value from sync actions
* Minor optimizations and improved comments
* Don't use async inside `data-wp-watch`
* Use a single Provider in context directive
* Remove DeepPartial type
* Do not check if element exists
* Add the `current` prop of state inside the scope
* Move getters outside scope
* Fix wc-key assignment
* Fix missing `navigate` in directives
* Fix namespace not being picked in the same element
* Deep merge raw stores instead of proxied ones
* Fix namespace assignment
* Allow forward slashes in namespaces
* Migration of Product Collection and Product Button blocks to the new `store()` API (https://github.com/woocommerce/woocommerce-blocks/pull/11558)
* Refactor Product Button with new store() API
* Use `wc_initial_state` in Product Button
* Fix namespace
* Remove unnecessary state
* Test namespaces in directive paths
* Add test context with namespace
* Simplify woo-test context
* Move addToCart and animations to a file
* Do not pass `rawStore` to `afterLoad` callbacks
* Move callbacks and actions back to the main file
Because the animation was broken.
* Remove selectors in favor of state
* Use default ns in `getContext` for state and actions
* Remove `afterLoad` callback
* Remove unnecessary ns
* Fix getContext in add-to-cart
* Replace namespace and delete unnecessary store
* Pass context types only once
* Use an alternative for requestIdleCallback
* Add previous react code for notices
* Add namespace to Product Collection block
* Replace getTextButton with getButtonText
* Add block name to the ProductCollection namespace
* fix style HTML code
* Remove circular deps error on the Interactivity API
* Product Gallery block: Migrate to new Interactivity API store (https://github.com/woocommerce/woocommerce-blocks/pull/11721)
* Migrate Product Gallery block to new Interactivity API store
* Fix some references
* Add missing data-wc-interactive
* Fix an additional namespace
* Remove unnecessary click handler
* Dialog working
* Refactor action names
* Reindex PHP array
There was some missing indexes, which turned the array into an object in JS.
* Remove unused event handlers
* Move next/previous logic to external function
* Move StorePart util to the types folder
* Rename namespace to `woocommerce/product-gallery`
* Undo product collection namespace renaming
* Remove unnecessary namespace
* Don't hide the large image on page load
* Minor refactorings
* Fix eslint error
* Fix php cs errors with spacing and double arrows alignment
* Disable no-use-before-define rule for eslint
* Disable @typescript-eslint/ban-types rule for eslint
* Fix parsed context error in e2e tests
* Fix context parser for Thumbnail image
* Move store to the top of the frontend file
* Add interactivity api utils to the @woocommerce/utils alias
* Replace deprecated event attribute
---------
Co-authored-by: Luis Herranz <luisherranz@gmail.com>
Co-authored-by: David Arenas <david.arenas@automattic.com>
Co-authored-by: roykho <roykho77@gmail.com>
---------
Co-authored-by: David Arenas <david.arenas@automattic.com>
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
Co-authored-by: roykho <roykho77@gmail.com>
* Fix error when closing product gallery dialog with keyboard escape key
* use wc_initial_state instead of wc_store
---------
Co-authored-by: Luis Herranz <luisherranz@gmail.com>
Co-authored-by: Luigi Teschio <gigitux@gmail.com>
Co-authored-by: Alexandre Lara <allexandrelara@gmail.com>
Co-authored-by: roykho <roykho77@gmail.com>
* Upgrade terser-webpack-plugin to version 4.2.3
* Upgrade webpack-bundle-analyzer to 4.7.0
* Upgrade to Webpack version 5
* Upgrade @wordpress/dependency-extraction-webpack-plugin to 4.6.0
* Upgrade dependency copy-webpack-plugin to version 11.0.0
* Upgrade dependency terser-webpack-plugin to version 5.3.6
* Replace webpack-rtl-plugin with the new @automattic/webpack-rtl-plugin
* Replace module.issuer with the new ModuleGraph API
There is a warning appearing in the console when running the application. This is due to the fact that the module.issuer has been deprecated on Webpack 5 and replaced with the new ModuleGraph API. This commit replaces the deprecated API with the new one.
* Upgrade babel and babel plugins to latest version
* Replace jsonpFunction with the new uniqueName property
Add a unique name of the webpack build to avoid multiple webpack runtimes to conflict when using globals. It defaults to output.library name or the package name from package.json in the context, if both aren't found, it is set to an ''.
* Replace cacheDirectory inline configuration with options.cacheDirectory
* Upgrade @wordpress/e2e-tests dependency to version 5.6.0
* Remove babel-plugin-transform-react-jsx dependency
Remove babel-plugin-transform-react-jsx dependency because it is already included in @wordpress/babel-preset-default
* Remove unnecessary Babel dependencies
Remove some unnecessary babel dependencies that are already included in the @babel/preset-env package.
* Upgrade puppeteer dependency to version 16.2.0
* Remove caret from package.json dependencies
* Fix Storybook build error
This commit fixes the Storybook build error that was being caused because of Storybook by default uses Webpack 4, but since we are currently upgrading our webpack to version 5, we need to install some required dependencies and also explicitly tell Storybook to use Webpack 5.
* Fix package-lock.json after merging with trunk
* Add own webpack-rtl-plugin implementation to the project
Before upgrading Webpack to version 5, we were using the original `webpack-rtl-plugin` released by Romain Berger; unfortunately, this plugin is not compatible with Webpack 5, so we replaced it with `@automattic/webpack-rtl-plugin`. The problem is that `@automattic/webpack-rtl-plugin` by default generates files with the '.rtl.css' suffix and does not provide a way to change that.
This commit adds our own implementation of the `webpack-rtl-plugin` (adapted from `@automattic/webpack-rtl-plugin`) that is compatible with Webpack 5 and allows us to change the suffix of the generated files to follow the recommended way defined by Wordpress (https://codex.wordpress.org/Right-to-Left_Language_Support)
* Change conditional clause to be multiline
* Fix package-lock.json after merge with trunk
* Fix package-lock.json after merge with trunk
* Rename files to fix ESLint errors
This commit renames files that have the .js extension but contain JSX code. This is causing ESLint to throw errors because by default our Eslint configuration expects only files with the .jsx extension to contain JSX code.
* Fix package-lock.json file
* Add is-plain-obj module to the transformIgnorePatterns of jest config
* Update package-lock.json
* Fix package-lock.json
* Upgrade @wordpress/i18n dependency to version 4.31.0
* Update package-lock.json
* Update composer lock file
* Fix Webpack config for Webpack 5
* Add the package-lock.json
* Remove unsupported config from webpack
* Fix error with Webpack build
* Add wait for network idle to the tests
* Attempt to fix e2e test
* Restore promise.all
* Upgrade puppeteer to v17.1.3
* Upgrade expect-puppeteer
* Update expect-puppeteer
* Downgrade expect-puppeteer
* Revert "Upgrade puppeteer to v17.1.3"
This reverts commit 61ed52a56f131961f3970b6fb22cdd8b540bada3.
* Upgrade Puppeteer to version 17.1.3
* Fix executionContext.frame is not a function error
* Fix e2e tests
* Remove isExperimentalBuild from Product Gallery inner blocks
* Upgrade Webpack and Webpack-cli to latest version
* Upgrade postcss and mini-css plugins
* Fix error with mini-cart block
* Fix styling error with filter blocks
* Fix issue when running unit tests
* Fix storybook script not loading
* Fix a11y issue in Storybook
* Fix error when multiple isExperimentalBuild was being used
* Prevent error when layout is not present in the attributes object
* Update `chunkIds` to `named` in Webpack
* Add cache groups to the Webpack configs
* Make sure the revert button is registered and enqueued for usage exclusively in the site editor.
* Register and enqueue the styles for the revert button.
* Rename the files.
* Revert "Rename the file renames."
This reverts commit c0330ce70fec20bea1f957eddcf458881e16242c.
* Add plugin-proposal-optional-chaining to the WebPack plugins config.
* Rename the files.
* Remove unnecessary dependencies as those are already provided via : more specifically, get_script_data.
* Address CR.
* Update Interactivity API JS files
* Disable TS checks in the Interactivity API for now
* Add new SSR files
* Replace wp_ prefixes with wc_ ones
* Replace wp- prefix with wc-
* Replace guternberg_ prefix with woocommerce_
* Remove file comments from Gutenberg
* Rename files with `wp` prefix
* Fix code to load Interactivity API php files
* Remove TODO comments
* Replace @wordpress with @woocommerce
* Update Webpack configuration
* Fix directive prefix
* Remove interactivity folder from tsconfig exclude
* Add client-side navigation meta tag code
* Remove unneeded blocks.php file
* Fix store tag id
* Register Interactivity API runtime script
* Fix Interactivity API runtime registering
* Remove all files related to directive processing in PHP
* Move json_encode to Store's render method
* Add Interactivity API scripts
* Enqueue scripts if Products exists for testing
* Test client-side transitions
* Remove script enqueue
* Remove hpq dependency
* Update Interactivity scripts to latest version
* Remove interactivity scripts from core entries
* Create webpack config for interactivity api
A plugin for optional chaining is required as the repo uses Webpack 4 for now.
* Enqueue the directives runtime
* Updated wp directives code
* Use a filter to enque the directives runtime
* Remove base-interactivity alias for now
* Add path for modules inside base-interactivity
* Revert "Remove base-interactivity alias for now"
This reverts commit 7c6cbee372c65e430590d98c1819b6b4b0a97d93.
* Remove unnecessary filter and enqueue
* Update router code
* Update Interactivity location and alias
* Use hook `init` for script registering
Co-authored-by: Mario Santos <santosguillamot@gmail.com>
Co-authored-by: Luis Herranz <luisherranz@gmail.com>
* Move payment methods
* Setup entrypoints
* Sortable implementation
* Sortable
* Basic UI in place for settings
* Hydrate real settings
* Form updates values
* Styling and save button placement
* useSettings hook
* Prepare for save
* delete
* Add location button
* Remove className
* Conditional display of taxes
* Save via API
* Update general settings to designs
* Modal styles
* Style table
* Border colors and radius
* Added e2e tests
* use node 16
* Enqueue states in admin
* Use render from wordpress/element
* Missing handle style
* Enable translations
* Remove curried function
* Todo for inline settings
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
* Use backslashes to fix webpack build on windows
* Update regex to use square brackets, and update copywebpack path for Windows
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* Generate Inner Blocks' JSON files in a common folder
* Get the correct metadata path for the Inner Blocks
The Inner Blocks' metadata lives now in the `/build/inner-blocks`. But,
the function `get_block_metadata_path` was only looking for metadata
inside the top-level of the `build/` folder
* Move `EditorBlock` to general `type-defs`
`EditorBlock` was scoped under the `featured-items` directory at the time of its creation. It is, however, a useful type that should be shared repo-wide. For this reason, I am moving it into the `blocks` type-defs and updating all the references.
* Define types for the Product Query block
Also defines a more generic `WooCommerceBlockVariation` type which should be also useful in the future to implement a similar pattern.
* Add Product Query utils
Add two utility functions:
1. `isWooQueryBlockVariation`: is used to check whether a given block is a variation of the core Query Loop block, and also one of the allowed variations within our repo. See: `QueryVariation` enum type.
2. `setCustomQueryAttribute`: is a shorthand to set an attribute within the variation query attribute.
* Refactor and cleanup the JS demo code
Specifically:
1. Creates a `constant.ts` file to store all shared constants. Currently, the default variation attributes.
2. Move the variations to their own directory. One file per variation.
3. Move the inspector controls into own file and create a conditional logic to allow showing only certain settings.
* Update webpack config
* Add ProductQuery class
* Fix `QueryVariation` enum
We had changed the Products on Sale variation slug to something else,
but we had forgotten to update the proper enum.
* Remove unused params from `update_query`
The filter we added to Gutenberg will pass the block and the page,
as we might need them in the future and we want to minimize the
amount of changes we'll have to do upstream.
However, we currently do not use those, so I removed
them from our own inner function.
Co-authored-by: Lucio Giannotta <lucio.giannotta@a8c.com>
* Try registering the "cart taxes" inner block
Registering server side. This example isn't working, but I'm pushing to
share it and see what's wrong with this implementation.
* Fix registering the cart taxes inner block issue
* Update translation script loading
* Remove unnecessary JS translation
The translation should work fine by getting the title & description from
the `block.json` file
* Put back the initial code in the 'Cart Taxes' inner block
We didn't provide the correct `block.json` file path server side,
that's why the `metadata` wasn't correctly registered
* Generate `block.json`files for inner blocks
This is the first step on fixing the missing translations of `metadata`
in `block.json` files
* Set the folder name exactly the same as the inner block name
We are doing this first test for the `Cart taxes` inner block.
The `Block` & its containing folder need to have the same name for:
- Consistency
- We use the `Block` name to get the file Path
* Update imports after folder renaming
* Get block name directly from the JSON metadata
Getting the block name from the JSON metadata is less error prone than
extracting it from the file path.
And no need to rename all our `inner-blocks` to get the correct
`block.json` path
* Revert folder naming change of `Cart taxes` inner block
Since we are getting the `block` name directly from the `block.json`
metadata instead of extracting it from the file path, there is no need
to keep their names in sync anymore
* Fix missing translations for the `Cart Subtotal` Block
* Register only the client-side settings on the client
When the block is registered on the server, you only need to register
the client-side settings on the client using the same block’s name.
See [docs](https://github.com/WordPress/gutenberg/blob/trunk/docs/reference-guides/block-api/block-metadata.md#javascript-client-side).
* Add schema validation to `block.json`
Development is improved by using a defined schema definition file.
Supported editors can provide help like tooltips, autocomplete, and
schema validation.
* Use the same `editor_script` as the parent block
This prevents WordPress from generating script tags to inexistant
inner blocks JS files
* Add C&C inner blocks in Cart.php & Checkout.php
This is a refactoring to keep the block types controller file less
overloaded
* Fix all Cart inner blocks missing translations
* Create the "AbstractInnerBlock" class
The "Inner Blocks" will use their parent's script, so no need to create
new scripts for each one of them
And, our "Inner Blocks" should always be registered using the metadata file
* Update the "Inner Blocks" PHP classes
* Fix PHP lint erros & update function description
* Fix missing translations bug for all Checkout Inner Blocks
* Update src/BlockTypes/Checkout.php
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* skip lazy loaded scripts
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* revert changes to webpack file
* fix loading of chunks
* revert changes to assets api as well
* include chunks from other blocks
* bail early if there is no build folder
* Start using the block.json metadata file for `Products by Tag`
* Remove comment
* Add version, schema, and text domain
* Add defaults
* Remove wrong keyword
* Add tag icon when registering the block
This PR creates a new directory called `featured-items` which includes both blocks.
All the shared code lives at the top level of that directory.
Individual blocks still have their own directories, with their `block.json` and all other relevant configuration.
All the functionalities have been refactored out into their own files, accepting configuration when relevant, but mostly de-duplicating all the code.
Styles have also been refactored using mixins and extends and they mostly live in one place.
* Start using the `block.json` metadata file for `Handpicked products`
* Add the `properties` attribute to properly parse booleans
* Remove comment
* Add schema, delete version
* Start using the `block.json` metadata file for the `Featured Category` block
* Get default attributes from the `block.json` file
* Remove unnecessary `get_block_metadata_defaults` function
* Add alt attribute to the block.json file
* Remove unused imports
* Start using the `block.json` metadata file for the `Feature Product` block
* Get default attributes from the block.json file
* Add removed comment
* Remove unnecessary `get_block_metadata_defaults` function
* Add alt default to block.json
* upgrade wordpress/scripts to 22.3
* update jest config/setup
* add explicit-exports-references plugin
to handle payment-method-config.tsx spying on external methods
the way code is output now changed and tests like this would not
work anymore as transpilet files were no longer using exports but
local references to methods.
* missing snapshot
* make cart-products E2E test more stable
* surppress eslint error in test file
* fix css stylelint issues
* update eslint-plugin-woocommerce eslint package
* remove temp test:e2e:start script
* re-run
* add stylelint as recommended extension
* remove redundant types (provided by packages now)
* patch update @testing-library/jest-dom
* Update storybook to 6.3.6
* @storybook/addon-knobs
* Remove need for wordpress-compose imports
This functionality exists in WP 5.5 so we don't need to import the package any more.
* Update to latest non 17x packages
* Composer update
* Fix for @babel/plugin-proposal-nullish-coalescing-operator and spinner style
* onSelect was called before init
* Add back env
* Update locks
* Revert browserlist config increase (ie11 support dropped needs separate discussion)
* update locks
* SVG can come from the external
* Import from components package where possible (5.5 has Gutenberg 9.2.0) and revert component package version change
* Revert component imports. Import from wordpress-components in the frontend context. This removes `wp-components` dependency from all -frontend asset files.
* Tidy and document current configs
* Add terser package
* sharedConfig with Terser plugin setup
* replace todo
* revert change to alias
* Package lock update
* ci to install
* Revert "ci to install"
This reverts commit a65b7f3ca8ef8ab1cb78f825a43ca8df07f784bb.
* revert shared config
* fix extra comma
* tweak setup
* Missing jsx
* Add isCompact prop to components using SearchListControl
* Update @woocommerce/components to 6.1.2
* Remove legacy CSS code
* Add some CSS rules to override conflicting editor styles
* Replace showCount prop with has-count class name
* Create ExpandableSearchListItem component
* Refactor ProductControl so it uses ExpandableSearchListItem
* Update @woocommerce/components to 6.2.0
* Fix @woocommerce/components builds breaking
* Fix a11y of expandable item list children
* Set categories to an empty array by default
* Render compact control in Attribute filter sidebar
* Add countLabel to ProductAttributeTermControl
* Fix ProductTagControl selected items
* Use sentence case for countLabel
* Fix wrong margins in block editor
* Fix checkbox alignment
* Update package-lock.json
* Fix withCategories test
* Fix JS error in Filter Products by Attribute block
* Make input ids unique
* Fix circular dependencies in Icons package
* CircularDependencyPlugin
* Fix deriveSelectedShippingRates CD
* Move useStoreNotices to context/hooks
* Move useStoreCart to base/context/hooks
* Move useStoreEvents to base/context/hooks
* Move collection/product hooks
* Move useStoreAddToCart
* Move useCustomerData
* move shipping hooks
* Move checkout and payment hooks
* Context should import hooks with relative paths
* Prevent circular dependency in store notices container components
* Move address fields to settings so they are shared
* Import PaymentMethod components direct
* relative import
* Fix select CD
* Move ValidationInputError
* Move components consumed by context
* Fix up internal imports in context
* fix CD in checkout package
* Separate providers
* Fixing context exports
* Fix base context hook import
* fix mocks
* Pass hooks to Slot Fills as Fill Props to avoid imports from base-context
* Export components, not hooks
* Pass props to ExperimentalOrderMeta
* Run CD plugin when using `npm start` only
* Rename CIRCULAR_DEPS to CHECK_CIRCULAR_DEPS
* Remove duplicate key from rebase
* Move packages component back to main file
* Remove dashicon module replacement
* Restore SVG import from package not external
* Move core locale handling to avoid impact settings package size
* Remove deleted file from rebase