* Add Product Image Gallery woocommerce/woocommerce-blocks#8233
Add Product Image Gallery
* Add Product Image Gallery block
* remove support global styles
* remove support global styles
* address CSS feedback
* add support for the custom classname
* remove save function
* add second parameter to the subscribe function
* update @types/wordpress__data package
* update placeholder, icon and description
* update tsconfig
* Move ValidatedTextInput and ValidationInputError to checkout package
* Include checkout package in tsconfig file
* Remove unnecessary index file
We export these components from packages/checkout/index.js instead
* Import ValidatedTextInput & ValidationInput error from checkout package
* Only add validationError.message when validationError is an object
* Explicitly add undefined to optional props
* Import isObject to test validationError
* Extend the HTML Input element attributes
* Use more performant useDispatch instead of dispatch
* Export component without withInstanceId hoc for testing
* Add tests for ValidatedTextInput
* bot: update checkstyle.xml
* Rename export of unwrapped component to have __
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* WIP add filter for place order button label
* Solve TS issue
* Add display priority
* Refactor display priority
* WIP Implement useMemo()
* Try using a global cache
* Add docs for placeOrderLabel filter
* Update docs/third-party-developers/extensibility/checkout-block/available-filters.md
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
* Adjust docs
* Rename “placeOrderLabel” to “placeOrderButtonLabel”
* Update assets/js/types/type-defs/payments.ts
Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
Co-authored-by: Thomas Roberts <5656702+opr@users.noreply.github.com>
Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
Co-authored-by: Lucio Giannotta <lucio.giannotta@a8c.com>
* Sub/Total/Fee inner blocks
* Row blocks within the inner block
* Update icons
* Resolve stying issues
* Remove old block
* Pin totals row
* Locking logic update
* Heading inner block
* Refactor where inner blocks are defined
* Add todos
* Todo for Consider deprecating OrderMetaSlotFill and DiscountSlotFill in favour of inner block areas.
* Improve frontend registration of components using new entrypoint
* Experiment- external block context
* Revert "Experiment- external block context"
This reverts commit 4b75668ec7eb62f065c6a488cd942a666e26204f.
* Duplicate inner blocks to avoid conflicts with context
* Remove todo
* Rename block dir
* Some test fixes
* Fix import
* fix import
* linting
* Remove unused attributes
* Optional classname
* fix coupons import
* fix shipping mocks
* Styling
* Fix selectors in e2e tests
* Add back the wc-block-components-totals-wrapper class that was used for each segment in the totals Order summary
Because, removing them was:
- a breaking change for the old structure
- was making it harder to target the inner blocks. Before the class was used to target each segment
- it was making the wc-block-components-totals-item behave as a child or parent depending on the inner block, inconsitency
* Reuse the TotalsWrapper component for C& C blocks inner blocks
This component was removed in this PR, but we wrap components in the Cart and Checkout sidebar in a TotalsWrapper. This will ensure consistent spacing and borders are applied to items in the sidebar.
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
Co-authored-by: Raluca Stan <ralucastn@gmail.com>
* Remove unnecessary setup step and use node v16 in E2E action
* Ensure storefront is active
* Use new checkout fixture
* Try with only checkout test
* Update package.json
* Run all tests, not just checkout
* Add block title to AbstractBlock class
* Add block title to Checkout block
* Include all block.json files in tsconfig
* Add get_block_title method to Checkout.php
* Remove redundant block_title field
* Add block.json and remove static attributes from attributes.ts
* Register block using attributes from block.json
* Add metadata_path to AbstractBlock
* Add function to AssetsApi to get the metadata path from the plugin root
* Register the block using metadata if it's set in the block's class
* Remove get_block_title method
* Only add supports and attributes to the block when not registering with metadata
* Change get_block_metadata to get_block_metadata_path
* Change indentation to tabs in block.json
* Update comment to clarify why attributes and supports are set later
* Check if path to metadata is not empty instead of set and not empty
* Move checkout block out of cart-checkout directory
* Update get_block_metadata_path function to find block.json automatically
* Remove metadata path from AbstractBlock
* Check if there's a metadata file and register blocks with metadata if so
* Move deprecated attributes out of metadata and into attributes.ts
* Re-add deprecated attributes to checkout index
* Move order notes test
* Move test for checkout phone number in edito
* Fix indentation in checkout/block.json
* Move checkout terms tests
* Try forcing storefront theme in e2e tests
* Revert "Try forcing storefront theme in e2e tests"
This reverts commit 5b0fd47a2c39aadb0141a4ed28cbc0e6baa89625.
* Try capturing screenshot on test failures
* Try uploading error in try catch
* Try uploading artefacts on error
* Test uploading artefacts
* Screenshot just before looking for edit post layout
* Revert "Screenshot just before looking for edit post layout"
This reverts commit 61dff027789ce13a0d84e7b6f11e431637c5a450.
* Revert "Test uploading artefacts"
This reverts commit adf5cc55bcdb677f889bf5a62803b4150d98e665.
* Revert "Try uploading artefacts on error"
This reverts commit 7441a832a113a95fef89cc1b8db6dc79271be516.
* Revert "Try uploading error in try catch"
This reverts commit ca412ce505d56286b164f588a201a451f6bceeb6.
* Revert "Try capturing screenshot on test failures"
This reverts commit 0de6e97df19b116091a7bb3b8652713867d2d80f.
Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
* Migrate stories for `ProductName` to latest Storybook. Also add props
documentation and add named export.
* Migrate `TotalsFooterItem` to TypeScript and latest Storybook
* Add a `LooselyMustHave` utility type.
* Export `allSettings` so that they can be manipulated in stories and tests
* Implement a way to easily define and reuse Storybook controls
Implement a currency control for a common use-case of selecting currencies.
It currently implements EUR and USD as they have different properties.
* Migrate `TotalsDiscount` to TypeScript and implement stories
* Migrate `TotalsCoupon` to TypeScript and fix stories
* Change Coupon name within Storybook
* Nicer handling of removal of a coupon from Storybook
It now dynamically calculates the discount from the actual coupons.
* add view switcher for mini cart contents block
* editor view switcher
* update mini cart template file
* render the empty state template parts for the Mini Cart Block woocommerce/woocommerce-blocks#4674
render the empty state template parts for the Mini Cart Block woocommerce/woocommerce-blocks#4674
* update selector
* allow empty mini cart block to add all blocks
* fix tests; improve code style
* install @wordpress/block-editor package
* fix warning on frontend side
* block-editor package is not necessary
* merge attributes object
Co-authored-by: Tung Du <dinhtungdu@gmail.com>
* Remove i2 from build
* Remove i2 php registration
* Rename old checkout dir
* Rename i2 dir
* Migrate i1 to i2 code
* Register block metadata to fix frontend rendering when migrating to i2
* Register in correct order
* Missing styles
* add register-components to side effectful list
* wrong block class in e2e test
* wp prefix missing on selector
* Fix top level block test
* Reselect labels to work around rerendering
* missing empty cart styles
* Consolodate duplicate styles
* remove init code
* update selectBlockByName
Co-authored-by: Nadir Seghir <nadir.seghir@gmail.com>
* Update registry to register components with block JSON metadata
* Use updated registration API in sample block
* remove editorScript
* Rename area and allow forced blocks to do it's thing without defining a template manually
* More naming consistency
* Validate a registered checkout block has at least one valid parent
* Remove item and change quantity doAction hooks
* Cart event
* Event/Action system for cart events
* GA implementation
* Revert some unrelated commits
* revert change
* Listing impression config for all products
* Category support
* remove unrelated change
* Remove listype and block import
* wrap action in try catch
* Tidy
* Only load analytics scripts in experimental builds
* Made console log more specific
* Wrap script reg in experimental check
* Add Typescript to Panel and Icon
* Fix Icon component import
* Convert packages/checkout/utils/validation/index to TypeScript
* Convert checkout registry to TypeScript
* Add return type to mustContain
* Add TypeScript to Totals components from @woocommerce/blocks-checkout
* Add TypeScript to @woocommerce/price-format
* Use types from @woocommerce/type-defs when possible
* Allow empty objects when loading
* Fix formatting in payment-method-data-context.js
* Add missing return types
* Fix up price warnings
* Fix more warnings in FormattedMonetaryAmount
Co-authored-by: Raluca Stan <ralucastn@gmail.com>
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Add tsconfig to components directory and include it as project
* Add @types/classnames package
* Migrate Label component to TSX
* Remove unused imports from Label component
* fix package-lock.json
It was generated with npm 7 and we don’t support that yet (and that update should be done in a separate pull)
* Add interface for LabelProps and implement.
Also:
- import `Fragment` from @wordpress/element.
- import `HTMLAttributes` explicitly as a type from react (@types/wordpress__element doesn’t export this interface).
* fix jest configuration
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* add typescript support
* Add type declarations for Cart and CartResponse interfaces
* make sure we’re resolving .ts files as well as .js files on imports
* add more types
* type the cart data store
* Apply suggestions from code review (implement .tsx in configs)
Co-authored-by: Jon Surrell <jon.surrell@automattic.com>
* remove global fetchMock declaration and directly import where used.
* rename type
* remove named action types and just infer by returning action creator values as const
* use interface instead of type
* rename
* renames
* create CartAction type as union of action creator returned types and implement in reducer
* remove unused imports
* refresh package-lock after rebase
* Add base TS config that projects will inherit from
* Add tsconfig for assets/js/data project
* Ignore TS error on cart store registration
We will address this in cooldown when we have time to investigate further
* Add tsc to build step to catch TypeScript errors
* add a separate command for tsc and tweak build command to use
* restore checkJs and allowJs values in config and remove ts check from build command
* Add ts:check-all command
* Add TypeScript checking workflows
* Change triggers for TypeScript workflow
* Use npm ci instead of npm install
* Remove ts:check-all from TypeScript workflow
* Remove TS Check GitHub workflow
* Remove type-defs dir from TS include, and remove ts:check-all script
We no longer need the ts:check-all script because ts:check will do this for us, the old ts:check did nothing and did not work.
* fix coupon loading issues
* include .ts files only from type-defs folder
Co-authored-by: Jon Surrell <jon.surrell@automattic.com>
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
* add plugin area
* add invisible errorBoundary
* introduce slot
* change name to OrderMeta
* fix rebase
* wip
* create checkout file
* Import ExperimentalOrderMeta from @woocommerce/checkout
* Rename wc-checkout-packages handle to wc-blocks-checkout
* Only import wc-blocks-checkout in the feature plugin
* Move checkout package to packages folder
* Add @woocommerce/blocks-checkout to tsconfig
* Move TotalsItem to @woocommerce/checkout
* Use Fragment short syntax
* Remove example code
* Honor renderError prop in BlockErrorBoundary
* Rename error boundary
* Add example code
This reverts commit 9b6af7178cbef05589779ef7f5a750d53e7fc8cf.
* Revert "Add example code"
This reverts commit 2f50349692f53c5bb143516365eee7a98d580dfd.
* Add @woocommerce/blocks-checkout to jest config
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* Add stories to Cart & Checkout totals components
* Create @woocommerce/knobs alias
* Update TotalsFooterItem default values so they are in line with other stories
* convert eslint config to use @woocommerce/eslint-plugin
- removes unnecessary dependencies
- adds e2e-tests/specs to eslint ignore (they are automatically generated)
- turns off rules that will be handled in subsequent pulls (to avoid a mammoth changeset for review).
- NOTE: prettier config needs left in because of a bug with the existing version of `@wordpress/eslint-plugin` pulled in (fixed in https://github.com/WordPress/gutenberg/pull/25068) so I left the file for now.
* prettier fixes.
* remove obsolete plugin and fixes for eslint update
This branch brings an update to eslint which also changes some syntax with plugins. So this commit:
- fixes featuer-flag plugin syntax.
- removed obsolete dependency-group plugin (which is now in the `@woocommerce/eslint-plugin` configuration.
* add to-do comment
* fixes for test runs
- this also converts our e2e test scripts to use `wp-script test:e2e`, an advantage of this is it will load CHROMIUM on demand for the e2e test run.
* fixes for test runs
- this also converts our e2e test scripts to use `wp-script test:e2e`, an advantage of this is it will load CHROMIUM on demand for the e2e test run.
* include prettier alias as a dependency
This has to be done because prettier is installed with storybook and thus the alias setup in `@wordpress/scripts` is over-ridden by the storybook import.
* another attempt at e2e-test-fix
* add some debugging and temporarily just add one e2e config test for travis
* more debugging
* try installing full puppeteer and see if fixes
* fix package-lock?
* setupSettings separately from other fixture loading
* add debugging of files
* add another console.log (hopefully trigger travis)
* split out blockPage creation to it’s own as well
* fixed! remove debugging and re-enable travis configs for entire test suite
* fix config and rename e2e-tests to e2e
- fixes the failing product-search test
- tests/e2e-tests was redundant, I changed to `tests/e2e` (this follows a file pattern change made in woocommerce core as well).
* add todo for some eslint properties
* remove unnecessary early function execution
* revert earlier commit and remove duplicate call to createBlockPages
* mass-rename js/components => js/editor-components & update webpack
* mass-change import '@woocommerce/editor-components' +
+ jsprettier quotes fix
* more mass-rename @woocommerce/editor-components
* fix up references to js/editor-components in various places:
- docs/readmes
- jest config
- typescritp config
* fix story path to match new folder/alias 'editor-components'
* fix jest tests: use new alias for editor-components
* include renamed `editor-components` in editor stylesheet cache group
* Form/button stucture
* Use registerBlockComponent
* Context for add to cart form
* Working cart button
* Tidy up button component
* Add todos
* Revert reg block
* Hide stock indicator if not purchasable
* Hide terms if empty
* Add url and type to API
* Skip default category from term response
* Rename form element
* Form for product types
* Tidy up context provider and expand todos
* No longer using qty icon
* Update todos
* Correct text domain
* registerExperimentalBlockType
* Duplicate method
* Remove prevent default
* Update docblock
* Description for button code
* more setup configuration for rtl
* move default state for cart out of reducer
This also creates a file for default store states, it should make it easier to execute tests in various environments.
* Make sure there’s a default object for cart line item row
* set defaults for cartData
* add fetchMock as a global in eslint config
* add initial cart flow tests
This is just to get the ball rolling, the cart block needs more tests
* fix missing @wordpress/jest-console configs (because I overwrote the original configuration)
* update test because of change in branch
* switch import order
* add globals.d.ts file to declare globals we use.
This is a quick solution to prevent typescript linting warning about `fetchMock`. At some point we could also create a proper interface for it or import the types (if they exist) for the `jest-mock` package.
The new `globals.d.ts` file is excluded from published builds.
- restructures `@woocommerce/base-context` imports so it pulls from `index.js` in the `base/context` folder. That way tree-shaking will be used if possible. This also helps with organizing the folder structure a bit better for the new contexts.
- Fixes all the various imports through the code due to the above change.
- Adds `CheckoutContextProvider`, `useCheckoutContext` and related files.
- Adds `PaymentMethodDataProvider`, `usePaymentMethodDataContext` and related files.
- Adds `ShippingMethodDataProvider`, `useShippingMethodDataContext` and related files.
- Adds typedefs used for the various context interfaces.
* Fix background overlap of feedback box
* TS notices
* Add company name toggle
* Implement new attributes and toggles in editor
* Handle field config in address component
* Remove other hoc rule from tsconfig
* map -> forEach
* Remove return from forEach
* Export and extend field config
* Fix optional text for all field types
* unit text
* Update snapshot
* install typescript and add typedef support
* add typedefs for Cart things
* improve typescript config
- adds more base config
- add our aliases
* fix error caught by typescript!
* Tweak typescript configuration
* Add missing `@woocommerce/settings` alias to ts config
* Add alias for type-defs