* Add woocommerce_blocks_checkout_order_processed action
* pass order object as well
* remove empty post data
* add prefix and docs
* pass order object
* add doc for feature flag and experimental interfaces
* add new doc to TOC
* update pull request template to include checklist item for experimental/feature flag items
* tweak wording for experimental prefix
* fix bad formatting of bold for lines
* fix double slash in url
* add missing sentence case
* remove account signup as that is not included in Cart and Checkout block logic.
* Fix typo
* generating changeset for pull request
* generating changeset for pull request
* tweak wording - testing instructions are focused on new features
* testing instructions (tbc) for 3.7.0
* link in 3.7.0
* add instructions for checkout signup
* 3.7.0 changelog
* Add missing doc links to TOC for release testing notes.
* fix typo in "replace"
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* add testing instructions for various issues fixed in 3.7
* Bumping version strings to new version.
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Rua Haszard <rua.haszard@automattic.com>
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* expose checkout signup feature to release build (feature plugin):
- remove isExperimental from block/editor js (the block is already gated
to plugin only)
- gate entire service class to feature plugin && Woo >= 4.7
- this ensures our custom email and set password flow are only active
for supported woo version, if blocks plugin is active
- also refactored the gating logic so the woo version check is used to
gate all code
* eslint action told me to delete comment `.` ... ?
* remove experimental feature flag for checkout signup front-end:
- "Create Account?" checkbox in address/contact component
- logged-out prompt logic - handle case when signup is enabled and guest
checkout is not enabled, i.e. checkout requires automatic signup
* fix formatting issues
* add allowCreateAccount to proptypes for CheckoutForm and AddressStep
* fix php 8 error when $data is not invocable
`is_callable` is the preferred way for checking whether a variable value is invocable or not.
* use is_callable in AbstractDependencyType
* Add errors to UI in onCheckoutAfterProcessingWithError
* Fix missing useEffect dependency
* Typo
* Reset source id if Stripe intent fails
* Remove default error on onCheckoutAfterProcessingWithError
* Add missing useEffect dependency
* Only add default error message if there is no errors in any other context
* Fix useEffect running too many times
* Add type-defs and minor improvements
* Only count error notices
* Add workflow for linting js and css
* try alternative action to see if we get annotations
* add deliberate linting errors to validate new workflow behaviour
* try to fix annotations?
* maybe invalid check-name?
* try a different eslint action
* fix eslint fails
* remove js/css linting from travis
* remove unnecessary build execution
* Create ZIP before writing testing steps
* Add a note to restore the release branch
* Add a link to the milestones page
* Revert "Add a note to restore the release branch"
This reverts commit 362bf8779be2023c8015bb71a1328eca9bab4997.
* use my-account/lost-password endpoint url for set password (tbd):
- companion for working on https://github.com/woocommerce/woocommerce/issues/27754
* use more appropriate (new) set-password endpoint
* add version check - use new woo core endpoint if woo version is new enough
* use my-account/lost-password for setting password in checkout signup:
- this has been available forever - no need for a version check
- page will show `Lost password`; looking at options for overriding that
* use more explicit `newaccount` action for set password url if available
* tweak feature gating for checkout signup:
- only available in dev builds (will change soon)
- only available if Woo core 4.7 or newer
- checkout signup relies on fixes in 4.7+ (tbc) to
my-account/lost-password endpoint for setting initial password
- standardise feature gate logic so is consistent, ensure feature is
disabled in API/backend, hide editor option, and disable front end
- add new setting `wcVersion` to allow feature gating on woo version
* fix woo-version feature gate of checkout signup:
- fixed version logic, explicit 4.7.0 reference version
- refactor version compare routine so can be used for woo or WP version
* revamp Woo 4.7+ logic so PHPunit tests aren't dependent on Woo version:
- Woo-version feature gating is implemented at integration layer:
- checkout REST API
- register/override new account email handler
* Move 'renderedTabs' to its own component
* Move getRenderedTab to its own component
* Remove 'getPaymentMethod' function
* Fix wrong typedef
* Remove unnecessary useRef
* Simplify NewPaymentMethodTab
* Drop 'New' prefix from components name
* Add JSDocs to new components
* Add propTypes to new components
* prototype 'create account' checkbox in checkout block
* expose store config for generating password/username to blocks:
+ use FILTER_VALIDATE_BOOLEAN instead of hard-coded `yes`
* stub out signup form in checkout block
* context / provider to store checkout signup form data
* revert signup form - checkout block will always generate username etc
* persist signup checkbox in checkout state & pass to checkout API
* add `create_account` param to order API, fix name in client POST
* handle creating user account as part of order (first cut)
* ensure the order is associated with the new customer
* only show 'create account' checkbox when appropriate (guest checkout)
* remove unnecessary username/password variables
* refactor account-creation logic into functions:
- clarify inputs and outputs
- use RouteException for error handling
- use woo options directly, avoid dependency on WC_Checkout
* update "email exists" error message to use existing error message text
* handle all known errors from wc_create_new_customer + use core message
* only show "create account" checkbox to shopper when necessary:
- if guest checkout is disabled, user must create account - not optional
* only show "create account" if account creation is optional:
- fixes incorrect logic in previous commit
- add some comments to clarify
* fix create account logic in API when checkout requires account:
- use correct woo setting option name
- reverse logic to match option = allow guest false means registration required
* strip html tags from create account error messages
* temporarily force enable autogenerate user/pass in new account API
* fix rebase errors
* add new allowCreateAccount attribute in checkout block
* show/hide `Create account` checkbox dependent on block attribute:
- previously was dependent on store setting
* new create user API, with set initial password email (first cut):
- use core register_new_user for creating the user
- this triggers core "set new password" email
- generate username using logic lifted from WC core
- rough cut, lots to tidy/polish here
* remove alternative/unused create account function
* set `Customer` role for signups during checkout
* eslint fix - switch case break
* remove comments that mirror code & might go stale
* tidy func comment
* remove unused function
* use store setting `allow signup` for default value of new block option
* refactor order signup logic to service class first cut:
- new CreateAccount service
- hook up via custom action (for now at least)
- paste over existing create account logic (temporary - will be replaced)
* adapt wc_create_new_customer logic in CreateAccount service (WIP)
* set default_password_nag on new account + throw instead of WP_Error
* rename `createAccount` => `shouldCreateAccount` to clarify meaning
* fix checkout block - renamed `shouldCreateAccount` (missed in prev commit)
* prototype sending alternative email template for checkout signup
* add magic link to set password to blocks new account html email
* tidy up new account email templates - set password link, subject/heading
* use same id so merchant setting tweaks apply to our new improved email
* remove logging
* code tidies in CreateAccount service:
- remove unnecessary constructor
- type-hint in should_create_customer_account
- streamline logic in should_create_customer_account - remove
unnecessary `empty` check
- add comments to illuminate different use-cases handled by should_create_customer_account
* don't provide password to new account email templates (no longer used)
* declare dependencies in root namespace
* code tidies on new account email class:
- correct namespace and camelcase name
- declare class in file, don't instantiate; instantiate in client code
(CreateAccount service) when used
- no require/file import, use `use`
* move CustomerNewEmail to folder matching namespace
* use Package->get_path for email template paths:
- CreateAccount service now depends on Package
- CreateAccount passes Package to email class so it can use `get_path`
- note: CustomerNewAccount is not registered with DI container as it
needs to be instantiated after Woo init (for `WC_Email`)
- shift email templates to {plugin}/templates, consistent with WP
convention
* call CreateAccount::from_order_request directly, no custom hook:
- custom hook is not appropriate as we may not want to allow
extensibility in this way - TBD
* add appropriate margin above create account checkbox
* remove unnecessary direct-access protection
* generalise name of error-handling method
* simplify CustomerNewAccount - instantiate directly, when needed
* remove unused new_account_email member - now instantiated on demand
* numerous fixes and updates due to rebase changes
* fix typo in name of CustomerNewAccount php file (missing `n`)
* experiment - link to lost-password form in my-account (prototype branded screen)
* Revert "experiment - link to lost-password form in my-account (prototype branded screen)"
This reverts commit e1dc6dd5e9f0218ede81da92188d813c2d0856d9.
* feature gate CreateAccount service init to dev build only +
+ remove stale comment
* feature gate front end "Create account" checkbox to feature plugin only
* feature gate editor "allow signup" option to dev build only
* feature gate checkout api create account - dev build only
* tweak feature gating PHP logic so it's robust:
- all PHP feature gating is in the service class
- all publicly-available methods return early if feature gate off
- Checkout rest API transparently calls service - no explicit feature
gate at API level
* ensure frontend/editor features are feature gated (isExperimentalBuild is a function)
* feature gate value of checkoutAllowsSignup - can only be true in feature plugin
* fix a / an typo in comment
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* remove commented code
* hello world unit test (doesn't test anything yet)
* add a command for running unit tests when container already up:
- this should probably move to another PR/branch
* basic tests of core logic in CreateAccount service
* import isExperimentalBuild direct:
- import from alias package was causing an issue, likely a dependency cycle
* refactor from_order_request to return new user ID so it's easier to test
* test creating a customer from an order + rest request:
- i.e. a full end-to-end integration test
* delete redundant test and tidy comments
* generalise test to provider format
* refactor create-dup-user err test to use same approach as success test
* add test for when user should not be created
* don't hard-code options in "create" test, remove redundant provider in no-account-requested test
* de-generalise "user already signed up" test
* add test for malformed email
* flesh out & comment successful signup tests
* flesh out "invalid email" tests
* clarify no account requested test comment
* remove phpunit:quick - I don't think it's needed
* add comment explaining this is an integration test
* experiment – disable feature flag, is this why the tests are failing?
* revert test commit - restore feature gate (experimental flag)
* skip all tests if CreateAccount is disabled due to feature flag
* d'oh - expose CreateAccount:is_feature_enabled so can be used in tests
* add jsdoc for checkout-state shouldCreateAccount field
* remove unnecessary comment + fix whitespace/indentation
* simulate logged-out user for createaccount signup tests
* use a single, compound if statement for early return (review nitpick)
* don't hide `checkoutAllowsSignup` store setting behind feature flag:
- the feature flag should be used to enable/disable behaviour
- it's dangerous to adjust store settings/options based on feature flag
* rejig tests so they require woocommerce_blocks_phase==3:
- make feature gate method private to avoid exposing
- remove feature flag check & test skip for other builds
- set blocks phase in travis config
* remove redundant user-logout in test setup - cleaner to just require this
* use WP function bracket style (same line)
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Update dependency wordpress-element to v2.17.1
* update experimental function to stable version
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* add puppeteer-core as dev-dependency
* tweak .travis.yml to hopefully fix e2e test runs on travis
* revert previous changes and configure renovate to only rebase on conflicts
* add experimental api for deregistering payment methods
Not going to promote this api just yet.
* fix for express payment method bug
Removes incorrect condition for the purpose of this effect. The Effect is expressly for setting a default active payment method if none is set. Since active payment methods might be either a registered express payment method or a registered payment method, the check for whether the payment method is included or not is breaking express payment method behaviour.
* add test for express active state and deactive state transition
* account for possibilitiy active payment method might not be currently registered.
* Show all payment methods when it's an admin and let the error boundary handle errors
* Use StoreNoticesContainer in Payment method error boundary so notices have styling
* Filter out saved payment methods for admin users if they don't accept payments
* Simplify update options logic
* For admins, only show payment methods that errored but canPay was not false
* Simplify how new payment method option is appended
* Wrap canMakePayment in a try catch block to handle payment methods that throw an error
* Add an id to payment method error boundary errors
* Add an error boundary to express payment methods
* Hardcode failing content and savePaymentInfo to false if the payment method failed
* Add some new comments
* Add a notice instead of registering the payment method if it fails and user is admin
* Throw error early if stripe failed to load
* Split express and standard payment method error notices
* Don't add payment methods in the editor and instead add a notice
* Fix error id
* Use noticeContext constant
* Add missing JSdoc param
* Remove unnecessary removeNotice
* generating changeset for pull request
* generating changeset for pull request
* add changelog to readme.txt
* typo fixes to release checklists
* change tested up to for WooCommerce core
* add testing notes for release
* bump version referenced for WP
* Bumping version strings to new version.
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Fix issue with COD not showing when first set
* generating changeset for pull request
* generating changeset for pull request
* change condition to arrays only
Co-authored-by: github-actions <github-actions@github.com>
* Merge ProductPrice atomic block and component
* Update assets/js/atomic/blocks/product-elements/price/block.js
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Update assets/js/atomic/blocks/product-elements/price/block.js
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* If product price component has alignment, make it a block
* Make ProductPrice propTypes more specific
* Add align prop to loading product price
* Add stories to ProductPrice component
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Add several tests to Checkout block in the editor
* Avoid 'visibility' word for toToggleElement rule
* Refactor matchers so they receives the label instead of the text
* Make initial 'isRequired' optional
* Refactor code that produces two clicks to DRY
* Unify error messages
* bail out of setting a default payment method if shopper has saved card
* ensure default payment method is only set as active if necessary:
- use functional form of setState; previous state (current payment
method) is not potentially stale value
- so the default is only set if there really is no active payment method
* remove unnecessary remnant hook dependency 🧟♀️
* 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
* Fix wrong Form component name
* Split CheckoutForm into smaller components for each step
* Centralize call to useCheckoutAddress
* Create DebouncedValidatedTextInput component
* Rename some variables
* 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
* generating changeset for pull request
* generating changeset for pull request
* 3.3.0 changelog + add woocommerce contributor (https://github.com/woocommerce/woocommerce-blocks/pull/3067)
* update min required WooCommerce - 4.2 (out of date!)
* require Woo 4.2+ min (L-2 policy)
* draft test instructions for new feature in 3.3.0
* add testing instructions for 3.3.0 bug fixes
* update TOC for testing instructions and add MIA 3.0-3.2 (!)
* add convenient zip file download to testing instructions
* update zip file - missed `composer install --no-dev` step
* clarify testing instructions for product price block +
+ remove mention of MIA screenshots
* retroactively add release notes for all products child block customization options
* add testing instructions for all products child block changes (3.1.0) +
+ use changelog note for testing headings
* Fix product element styling class names (https://github.com/woocommerce/woocommerce-blocks/pull/3095)
* Update sale badge align class names to match other element blocks
* Update product price align class names to match other element blocks
* Fix Product title alignment class names. Fixeswoocommerce/woocommerce-blocks#3094
* Make styling attributes apply to Product title block when it's not a link. Fixeswoocommerce/woocommerce-blocks#3093
* Linting fixes
* add changelog note for woocommerce/woocommerce-blocks#3095 + use standard changelog prefixes
* update release date
* update zip file link (new test build ft. woocommerce/woocommerce-blocks#3095)
* Bumping version strings to new version.
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Rua Haszard <rua.haszard@automattic.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Update sale badge align class names to match other element blocks
* Update product price align class names to match other element blocks
* Fix Product title alignment class names. Fixeswoocommerce/woocommerce-blocks#3094
* Make styling attributes apply to Product title block when it's not a link. Fixeswoocommerce/woocommerce-blocks#3093
* Linting fixes
* Rename CheckoutForm to Form
* Create CheckoutForm component
* Simplify directory structure
* Add docs about class name changes
* Add PropTypes to CheckoutForm
* Update skeleton class name
* Extract LoginPrompt
* Move loginToCheckoutUrl to a constant
* Move replaced class name docs to 3.4.0 specific file
* improve patch version detection and automatically fix incorrect format for version
* don’t include composer.json version update in commit
* update build-plugin zip to account for autoloader generation
* for zip-only do composer dump-autoload command
* regenerate classmap after composer version change reverted in composer.json and/or deployed
* fix condition
* improve/fix version string splitting
* remove lingering debugging
* Add some more info around the question on whether this is deployed to WordPress.org or not
* update release doc about main branch version bumping
* tweak wording in release docs
* fix grammar in user instructions
* add high-level docs about our components & remove stale detail info
* use current collection/folder naming in docs:
- let's rename js/components in a separate PR
- split paragraphs on to separate lines to improve future diffs
* rename storybook.md => components.md and update link/summary
* tweak component collection docs:
- base have more stringent requirements, since they can be used anywhere
- editor components are less strict and can assume editor context
* clarify js/base/components readme in line with main doc
* remove line about editor components being specialised to woo blocks
* Rename component to match directory
* Typo
* Checkout API: return cart errors as 'notice' property instead of throwing
* Checkout block: display server errors as notices
* Strip tags content
* Use same strings as in Core
* Add support for several notices
* Rename variables and allow all kind of notices
* Strip HTML tags and content in frontend
* Fix Checkout block in editor
* Add stripTagsAndContents tests
* Print notices before running blocks logic
* Shown express payment methods in Cart block
* Fixes
* Create usePositionRelativeToViewport hook
* Typo
* Style fixes
* Remove footer push div
* Styling fixes
* Improve code clarity
* Split ExpressCheckoutFormControl into two components
* Rename visibilityObserver to referenceElement
* Replace 'useEffect' with 'useLayoutEffect'
* Add tests for usePositionRelativeToViewport
* Self-closing div
* Add explanatory comment
* Create a shim for IntersectionObserver
* Update express payment components class names
* Add todo comment to remove IntersectionObserver shim when we drop IE11 support
* add testing checklist
* add zip to file
* add changelog
* Bumping version strings to new version.
* remove version from composer
* fix version number in package.json
* pin wc to 4.3.3
* add jetpack constant to travis
* Add deprecation notice for setSettings
* add todo for followup issue to actually remove the function
* update todo
* fix tests
* fix todo
* Update assets/js/settings/shared/set-setting.js
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* update min version of WordPress core to 5.3 in readmes
* update min WP version to 5.3 - main plugin file & admin compat notice
* remove WordPress 5.2 travis e2e test build
* disable legacy (WP <5.3) webpack entry points
* add "update user docs" step to release process, incl min WP/Woo reqs
* add 5.5 test
* allow test to fail
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* add dark styles setting
* add attributes to blocks
* add colors to input and select
* cover rest of items
* tweak select contrast
* fix ie11 issue
* fix focus
* include checkbox styles
* fix extra spacing after phone number
* add styling to quantity selector
* remove extra rule
* remove editor styles for radio control
* use border-color
* rename variables and classes and wording
* adjust colors
* provide tighter control over colors
* remove redudant outline rule
* add more variables
* add support for order note
* use variables for textarea
* move dark mode panel to last
* remove generic icons from Cheque & Stripe CC payment methods
* remove icon prop from PaymentMethodLabel - no longer supported:
- icons should only be used for recognisable brands
- generic icons (e.g. credit card) are not recommended
* Revert "remove icon prop from PaymentMethodLabel - no longer supported:"
This reverts commit 1990028a6c98b82750fb917ff3086dbe022ef41d.
* Hide saved payment methods if their gateway is disabled
* Fix wrong type-def
* Remove extra blank line
* Rename var
* Use FILTER_VALIDATE_BOOLEAN instead of comparing to 'yes'
* Use data from Payment Method context instead of reading setting from the server
* Use data from Payment Method context instead of reading setting from the server
* fix issue with overlapping margins
* move styles out of select
* remove extra spacing
* remove extra spacing from cart
* move styles to state input and remove extra position.
* use svg for checkbox
* update borders
* switch to rems
* define a rem function
* fix ie11 issue
* fix focus
* add ie hack
* fix spacing and switch to em
* switch to rem
* issue template for cart & checkout feedback
* fix example desktop OS (not iOS!)
* delete `withFeedbackPrompt` - not used
* link cart/checkout editor feedback to GitHub issue:
- add new CartCheckoutFeedbackPrompt with specialised text & url
- use in cart/checkout blocks
- tweaked wording of feedback prompt text
* use speech bubble icon to represent feedbackiness
* simplify cart/checkout feedback prompts
* add default labels to all issue templates
* use markdown heading syntax for headings (was basic bold previously)
* tweak wording (remove hint of frustration) and use new "feedback" label
* Fix JS-rendered blocks inside Empty Cart
* Add deprecation rules
* Performance improvements
* Typo
* Remove 'is-loading' class requirement
* Undo changes moved to woocommerce/woocommerce-blocks#2952
* Improve some comments
* Improve code
* IE 11 fix
* Minor fixes
* Assign default value in arguments destructuring
* Refacot renderFrontend code to make it easier to understand
* Revert "Assign default value in arguments destructuring"
This reverts commit 04ae943c675b94e599a1d1700075a79ef8be5004.
- default styling for validation errors is absolute
- this requires the layout provides appropriate space for errors
- payment form is too compact to provide room for errors,
- especially when checkout is narrow due to window or theme