* Add batch route
* Register batch route
* Allow batching on writable endpoints
* Batch in client
* Batch non-GET requests
* Batching support with typescript defs
* Remove unused hook
* Prevent multiple fragment updates
* Only use batch route if detected
* Correct var name
* Move nonce check to validate_callback so it runs before requests are completed
* remove unused imports
* updateCartFragments function as const
* Add phpunit tests for batching functionality
* Reduce batch delay
* increase timeout
* Fix checkbox styling in 2020 and 2017 themes by setting input font size
* 2017 button hover style fixes
* Fix editor dark inputs
* Restore dark color
* 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
* Fix click on Proceed to checkout bug when Coupon error is visible.
The bug happened because of the layout shift produced by the error message disappearance.
* Add cartUpdate middleware
* Include timestamp for when cart data was generated
* Add getCartFromApi action
* Check whether cart can be hydrated or needs to be fetched from API
* Add cartDataIsStale action and remove getCartFromApi action
* Add isCartDataStale selector
* Don't load cart until staleness check is complete
* Add comment to ease worry about locaStorage execution
* Correct doc block and fix typographical error
* Cater for lastCartUpdate or the timestamp being undefined
* Include @woocommerce/api and @woocommerce/e2e-utils
* Add getNormalPagePermalink test utility
This will allow us to get the permalink of a "normal" page, i.e. one that is not using the block editor.
* Add getBlockPagePermalink test utility
This will get the permalink for a page using the Block editor.
* Emit action to update cart staleness in all execution paths
* Add visitPostOfType function
This will allow us to visit the editor page for a post based on its name and post type.
* Add functions to get permalinks from editor pages
* Add front-end tests for cart
* Update package-lock.json
* Create local function to ensure the page permalink is visible
* Change functions for getting permalinks
They were often failing for unknown reasons, these _somehow_ make them more stable.
* Add logging for GitHub actions
* Add more logging for tests
* Add more logging for tests
* Add more logging for tests
* Wait for networkidle on back
* Remove logging except timestamp
* Wait for timestamp to be added to localStorage
* Split tests to make runs slightly shorter
* Wait for add to cart request before continuing test
* Fix formatting in cart.test.js
* Rename cartDataStale to setIsCartDataStale
* Create constant for localStorage timestamp name
* Rename cartDataIsStale to isCartDataStale
This is for consistency, the action to change this is called setIsCartDataStale - I think this reads better.
* Use cleaner logic when determining if the cart should render or fetch
* Change docblock for isCartDataStale selector
* Remove boolean cast from SET_IS_CART_DATA_STALE reducer
* Set longer timeouts for frontend cart tests
* Enclose cart staleness checks in condition/prevent unnecessary execution
* Remove unnecessary boolean cast from selector
* Use constant for local storage key in tests
* Use new localstorage key in tests. cant access constants in page context
* Implement `started` action creator.
Also for TS typing I changed `paymentMethodData` to be optional for both the `success` and `started` action creators.
This is because the behaviour allows for paymentMethodData to be retained in the state if it is not explicitly provided on dispatch.
* Implement started action creator on the exposed payment status dispatcher.
The implementation now allows for receiving payment method data when the `start` status is dispatched.
* Don’t overwrite payment method data when `success` status is set.
It is intended that if paymentMethodData is undefined, that is simply passed through to the dispatched action. This signals the reducer to retain the existing paymentMethodData in state (when undefined).
The correct way to clear the paymentMethodData is to either explictly provide an empty object, or set the status to pristine.
* Fix types for incoming paymentMethodData
* Implement receiving paymentMethodData in reducer.
This changeset also configures the reducer to retain the existing paymentMethodData in state (and related correlated information0 when the provided paymentMethodData property is undefined.
The only time paymentMethodData should be reset in state is when it is explicitly provided or the status is set to PRISTINE.
* Fix types for started action dispatcher.
* Explicitly clear paymentMethodData state when express payment started.
Also restores previous paymentMethodData when express payment cancelled.
* Switch saved tokens to utilize the payment method status started dispatched action instead of success.
This change ensures that savedToken handlers registered by payment methods have access to the `onPaymentProcessing` checkout event.
* fix typedef
Really just need to ensure types are used anywhere, this is a temporary change due to the time sensitive needs for this PR.
* Update assets/js/base/context/cart-checkout/payment-methods/reducer.ts
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* 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
* Fix cart preview when shipping calculator is false and core setting for require address is true
* Type base/components/cart-checkout/totals/shipping/index file
* Fix return statement for ShippingLocation component
* move logic to preivewCart
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* Remove custom style for Product search block and ProductByCategoryBlock
These buttons are overwriting the default button appearance used in other blocks,
making the UI inconsistent. They lack focus and are not visible on dark backgrounds
* Replace the remove filter icon with a svg using currentColor as fill
* Fix Price Slider range icons visual bug
* Adjust close active filter icon colors to work for white as currentColor
* Add new config for saved token processing by payment methods.
* Implement new saved token handling config from registered payment methods.
* Implement new saved token handling config from registered payment met… … 2b42205 …hods.
* make sure saved token handler component is only loaded when a token payment method is selected
* type hooks
* type useStoreCart
* type the rest
* Remove old typedefs
* Specify that the return value from useDispatch is a Promise< void >
* Change return type of removeItem
* If ref.current is undefined then return value without checking shallowEq
* Revert "Specify that the return value from useDispatch is a Promise< void >"
This reverts commit 97863bd584d38024398913a79ce63fa6b964846a.
* Remove type parameter from removeItem and changeCartItemQuantity
* Change action return type to cater for generator functions
* Remove type parameter from addItemToCart
* Add mapped types file to help with actions that are generator functions
* Include addItemToCart in return types of cart actions
* Use custom DispatchFromMap
* Add todos for why we've redefined functionality that exists in Calypso
* update types
* remove fromEntries and use polyfill
* address review
* ignore ts no shadow
* fix test errors
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
* Type shipping related hooks and packages
* Move component interface from shared shipping types file
* Fix Typescript import errors
* Type FormattedMonetaryAmountProps
* Change FormattedMonetaryAmountProps's value prop type
Looks like TotalsItem was the only on sending '-' as a value and it looks like it’s no longer passed through.
* Move `displayType` as a prop on FormattedMonetaryAmount
* Spacing
* Spacing
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* 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>
* Fix tslint warnings
* Install @automattic/data-stores to get access to some type generics for use with our data stores.
* improve ts typing of cart-data store.
* fix incorrect rebase conflict resolution.
* 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>
* Show total sale badge in medium carts
* Add markup to cart line item row to enable it to be displayed as flex
* Add styling to display price and sale badge as flex
* Revert product price being displayed as block
* Rename sale badge and price wrapper
* Hide line-total sale badge on mobile
* Change class name on total price and sale badge wrapper again
* Fix cart line subtotal display when currency has 0 decimals
* Fix wrong usages of getCurrency instead of getCurrencyFromPriceResponse
* Add tests
* Move comment in tests to relevant line
* Take stock status into account for All Products block.
A new `hideOutOfStockItems` setting flag has been added and it is used to hide the out of stock products
from the block. Products that are not out of stock can have 'instock', 'onbackorder' as stock status.
* Update StoreApi docs with new stock_status
* Fix the stock_status query param for collections of products
* Use else if in ProductPrice
This is because the priceComponent variable should be set depending on some conditions, but multiple of them could be true, so by using else if we only handle the first true case
* Update snapshots for jest
* Show cart item total price including taxes when DISPLAY_CART_PRICES_INCLUDING_TAX is true
* Show cart item total price including taxes in Checkout block too
* Add new exceptions for out of stock scenarios
These are needed to differentiate between the different stock validation errors, and so we can create the correct error message.
* Catch new out of stock exceptions when checking the cart for errors
This is so we can get the cart sent back to the client, if we don't catch these, then the route will just return a 500 error and crash.
* Add ArrayUtils class
This will contain methods used to operate on arrays that don't fit anywhere else.
* Handle the case in Checkout where the error is already a WP_Error
This will happen when the cart fails validation.
* Handle StockAvailabilityException in AbstractRoute
This will happen when an item or number of items in the cart are out of stock/insufficient stock.
* Throw exceptions for each type of invalid stock in validate_cart_items
This will allow us to create an error message for each type of violation to display to the user.
* Display additional error notices returned by the API
* Fix wording when throwing exceptions relating to stock
* Handle TooManyInCartException in CartController
* Abstract the merging of cart, status, and additional data into new fn
This allows us to simplify the way errors are returned from the API. The reason we have to add all of the data at once is because of how WP_Error works with the additional data, if there is already existing data in a WP_Error object, it gets moved into additional_data. By adding all of the data in one place, we stop this from happening. Also since we're only adding status and/or cart explicitly, it makes sense to just do it in one place.
* Add get_route_error_response_from_object method
This is so we can differentiate between a string and WP_Error object.
* Remove unnecessary slashes from WP_Error instantiation
* Add option to enclose each item in quotes in natural_language_join
* Abstract adding error messages to error object into single function
A lot of code was repeated, so doing this cuts down on that and ensures any changes only need to be made in one place.
* Create new parent exception for each type of out of stock exception
This is so we don't have to repeat code inside each different exception and we can simply inherit StockAvailabilityException.
* Catch the generic StockAvailabilityException in get_cart_item_errors
* No longer recalculate totals in validate function
It is not needed, the totals are recalculated elsewhere. This call was superfluous.
* Reduce nesting, and only throw exception if error object has errors
* Improve comment on get_route_error_response_from_object method
* Fix nesting when throwing the InvalidStockLevelsInCartException
* Catch errors during cart validation
* Add get_error_message_for_stock_exception_type function
This will be used to get an error message depending on the type of extension, and whether the plural form, or singular form is needed. This abstraction is better because the code is used in more than one place in the API.
* Use error message generation function instead of creating errors individually
* Use specific error codes for each type of error & fix PHPDoc
Now the stock_exceptions_to_wp_errors function will return an array of WP_Errors this is better as the client needs a distinct error code to display and replace notices.
* No longer remove items from cart or modify quantity if there is an error
* Return the WP_Error from RouteException or all Stock WP_Errors
* Fix error in PHPDoc
* No longer necessary to add get_cart_item_errors into an array
This is because the method always returns an array now.
* Rename variables in get_cart_item_errors to be more descriptive
* Improve PHPDoc on get_cart_item_errors
* Replace underscores with hyphens in error code
* Only return WP_Errors that have an actual error in them
* Add unit test for ensure the cart errors relating to stock are handled
* Fix typo in comment
* Use optional chaining to add errors to cart
* Add filter to extend product price
* Extend order summary product price too
* Make it so 'format' is applied to all product price types
* Order
* Pass lineItem to the filter
* Remove code targeting WC Subscriptions
* Rename filter
* Remove unnecessary CSS block that made prices be displayed as blocks
* Use line item totals instead of product price multiplied by quantity to show line item price
* Fix wrong currency usage
* Add comment to disable eslint
* Fix JS error when totals is undefined
* Align order summary item price to the right
* Use extendibility API instead of filters
* Remove __EXPERIMENTAL_CART_ITEM_PRICE_FILTER from docs
* fix rebase
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* Pass get_country_locale via assets
* Create helper to prepare and merge address fields
* Use new helper in address form
* Only pass field overrides now that fields are merged
* Fixc configs and remove lodash usage
* Prevent formatting of empty postcodes to suppress api error
* prevent memo on rerender
* Conitonal enqueue of locale data
* define index in increments of 10
* remove address-form
* circ deps changes
* Workaround for core data issue
* fix test
* remove prepareAddressFields export
* Remove old comment
* object from.entries polyfil
* Revert "object from.entries polyfil"
This reverts commit ba343adcf5fd2f843b225aebe340cce9b664c851.
* replace fromentries
* fix final fromentries
* Add validation function
* Prefix validateElementOrString with __experimental
* Update experimental docs
* Typo
* Update JS docs
* Use an object for applyCheckoutFilter args
* Args doesn't need to be an object
* Wrap validation function execution in a try/catch block
* Only accept strings for the totalLabel filter
* Change applyCheckoutFilter signature
* Add validation function
* Add Product name filter
* rebase
* update second filter call
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Replace filters with an extendibility API to hook into Cart and Checkout blocks
* Update docs
* Add a validate argument
* Add docs comments
* Add tests
* Add validation function
* Prefix validateElementOrString with __experimental
* Update experimental docs
* Typo
* Update comment
* Update JS docs
* Use an object for applyCheckoutFilter args
* Args doesn't need to be an object
* Wrap validation function execution in a try/catch block
* Only accept strings for the totalLabel filter
* Change applyCheckoutFilter signature
* Apply filters for subtotal and sale badge in CartLineItemRow
* Append suffix to prices and SaleBadge if passed in as a prop
* Add subtotal filter to OrderSummaryItem
* Add tests for OrderSummaryItem and ProductPrice
* Rename test for ProductPrice
* Update checkout filter registration plugin name
* Remove obsolete snapshop
* Remove suffix and change to format
This is because we want to make the entire price string editable, not just the part after it.
* Change formatting on SaleBadge to use createInterpolateElement
* Remove tests that are no longer needed.
* Update ProductPrice tests to reflect changes to format prop
* Check that subtotalPriceFormat contains <price/> in OrderSummaryItem
* Fix cart block styling to stop badges overflowing the container
* Add <price/> placeholder in OrderSummaryItem price filter
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Replace filters with an extendibility API to hook into Cart and Checkout blocks
* Update docs
* Add a validate argument
* Add docs comments
* Add tests
* Add validation function
* Prefix validateElementOrString with __experimental
* Update experimental docs
* Typo
* Update comment
* Update JS docs
* Use an object for applyCheckoutFilter args
* Args doesn't need to be an object
* Wrap validation function execution in a try/catch block
* Only accept strings for the totalLabel filter
* Change applyCheckoutFilter signature
* Fix ShippingRatesControl not honoring renderOption prop
* Update order summary design
* Updates TotalsCoupon design
* Update Cart block sidebar title design
* Make values bold and labels regular in Cart and Checkout sidebar
* Update styles of shipping rates selector and radio control
* Remove unnecessary overflow rule in Panel content
* Fix shipping options in Checkout block
* Add some Twenty Twenty One fixes
* Fix saved payment methods display
* Remove top spacing no longer necessary in order summary quantity badge
* turn Totals title to bold
* Move right padding from product name to item description
* Take left margin off list items in product details
This is because in themes where a left margin is applied to li elements, the product detail/addon gets indented and it does not sit flush with the edge of the product details container. Adding this rule to the main wc-block-components-product-details rule will stop other themes indenting <li>s
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
* move shipping-rates-control and shipping totals back into base/components/cart-checkout
* fix notice styling
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* Add left vertical bar to payments methods step.
* Remove horizontal borders around order notes.
* Add class to order notes component.
We need it to traget that element with CSS.
* Update padding on order notes checkbox to match desing.
* Remove full stop to match the design.
* Add label for not saved payment methods option.
* Remove use new payment radio.
* Always show new ayment methods selector
* Remove editor context for now.
* Add accordion component skeleton.
* Small component refactor.
* Use accordion for new payment options.
* Fix jsdoc.
* Add styling.
* Add input styling.
* Hide label if we don't have saved methods.
* Cleanup.
* Cleanup and styling.
* Add target class to aid with alignment.
* Update use new payments label styling.
* Update Place Order button location.
* add full stop to payment method copy
* ensure that there is always a (default) selected payment method:
- using `activePaymentMethod` from context
- this ensures there is a default selected on initial render
- and handles any dynamic changes to available payment methods
- e.g. COD disappearing when change shipping option
- remove unused / redundant selectedMethod prop - context is best
* use tab-based payment UI for 2 or fewer payment methods:
- move saved payment state to payment context; it's shared state needed
by both PaymentMethodOptions and SavedPaymentMethodOptions
- show previous tabs UI if:
- customer has no saved payment methods (cards)
- store has 2 or fewer payment methods available
- when initialising SavedPaymentMethodOptions, only select one if the
user hasn't selected a real payment method - this ensures radio
buttons switch correctly between saved card => `Use another`
- remove various props and local state that is no longer required (🤞🏻)
* experimental - styling tweaks for single payment tab (remove "tab" UI)
* Revert "experimental - styling tweaks for single payment tab (remove "tab" UI)"
This reverts commit e09dd4862b97d989d950a9d67672d83e7b8992e4.
* Add single payment method UI.
* Adjust single method styling.
* Add outline and margin to two methods version.
* Fix gap for order notes on/off option.
* Update Order button spacing CSS.
* Reuse computed values.
* Remove tabs and single payment option.
* We no longer need this test as the UI was changed.
* Fix payment methods labels height.
* Simplify.
* Remove not needed import.
* Typecheck an option.
* Refactor code.
* Rename.
* Rename.
* Update typdefs.
* Remove border for add order notes.
* Correct spacing for radio-button and label.
* Add simple test. Switch to payment method.
* Update style.
Co-authored-by: Rua Haszard <rua.haszard@automattic.com>
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Improve nonce handling by rejecting previous nonces from cache
* use timestamp instead of previous nonce
* Switch back to time()
* Seconds not ms
* Add comment about the date code
* Add supports data to payment methods abstractions. Implement in Stripe.
* Add capabilities to the payment gateway.
* Payment requirements in cart schema.
* Supported features format update.
* Formatting.
* Check required payment features.
* Refactor capabilieties check.
* No need for the cart parameter.
* Allow external modifiacation of features capability.
* Use ExtendRestApi to inject payment requirements into cart endpoint.
* Simplify the code.
* Enable more integrations.
* Enable Stripe payment request.
* Move the filter to a more correc location.
* Add features check.
* Update typedefs and documentation.
* Update tests with new functionality.
* Style fixes.
* Expose schemas
* Accept strings for select shipping rate
* strings are allowed
* Refactor shipping package to hold it's own state
* Add extension data to cart hook
* Progress but state is broken
* Move state back to hook
* Progress but state is broken
* use shipping hook updates
* Fix re-render issue
* hide x1
* Shipping slot fill
* Working slot fills
* Do not export package
* Update extend usage in unit tests
* update mock test data
* Package per slotfill
* Resolved merge conflicts
* Update assets/js/blocks/cart-checkout/subscriptions-integration.js
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* rename slot
* deriveSelectedRates return doc
* useCallback in throwError
* final class ExtendRestApi
* spacing
* Move shipping rate selection to package level
* remove const for counts
* Remove schemas from extend
* unused use
* move to a single fill for packages
* add todos
* move subs code
* fix extra extensions
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* Fix image link in all products block.
- add alt text on product image
- prevent the appearance of both product and placeholder image at the same time
- make anchor with placeholder image accessible
* Add testing for product-elements/image block.
* Create new vars to differentiate between single and multiple item price
This is because we need to display the subtotal of the item AND the total (subtotal * quantity)
* Add subtotal and move quantity picker
As per the new designs, the quantity picker should be moved below the product metadata, and the product subtotals should appear below the product name.
* Move line item total to top of grid on mobile/medium/small
* Remove CSS for trash icon that is no longer used.
* Remove link style colour override from product name and make total bold
* Remove quantity column from CartLineItem
This is because the quantity picker is now displayed below the product metadata and name.
* Fix margins around quantity picker and its width
* Always disable link to product in OrderSummaryItem
* Add single price below product name in OrderSummaryItem
* Add styles for new OrderItemSummary design
* Move total into its own "column"
This is to stop product description text flowing under the total and making it look untidy.
* Add styles to cater for total price being its own column
* Convert precision after multiplication instead of before
* Remove unnecessary div from OrderSummaryItem
* Remove line height from product names on order summary
* Add more margin to the bottom of the product metadata div
* Delete trash icon
* Only remove margin from the bottom of last product-details
* Move quantity input to below product name in cart skeleton
* Add placeholder for individual price to Cart skeleton
* Honor hidden property of cart item data and add support for experimental property
* Add docs to experimental property
* Typo
* Add protection in ProductDetails for the case where 'details' is not an array
* Update ProductDetails so it works properly in cases where 'name' is not provided
* Add snapshot testing to ProductDetails
* Remove savePaymentInfo check when displaying payment methods
This is because the savePaymentInfo is derived from whether the save payment method checkbox shows. This check doesn't make sense to do because it's not a good indicator of whether the payment method is enabled. Subscriptions for example hides the checkbox because it is implied that the method will be saved. We should instead rely on the server-side to only send permitted saved payment methods.
* Add safely_get_request_payment_method
This will allow us to try to get the payment method if it was passed in the request, but will default to an empty string if not. This is different to get_request_payment_method because it doesn't throw any errors. We need it to be different because get_request_payment_method is used when the order definitely needs payment (so a normal checkout scenario, vs. a £0 subscription checkout)
* Add action to update order meta when checking out
This is needed because some extensions rely on this action to add their information to the metadata of order items.
* Remove safely_get_request_payment_method
This is no longer needed.
* Remove @since from experimental hook
* Add PHPDoc for new update_order_meta hook
* Document use of experimental hook
* Reinstate the check for allowing saved cards
* Add method to Stripe integration to determine if saved_cards is enabled
* Add new field to get_payment_method_data
This adds displaySavePaymentMethodCheckbox which will be used to determine if the checkbox to save payment methods should display.
* Add displaySavePaymentMethodCheckbox option to client
This will determine whether the "Save payment information" checkbox will be displayed.
* Add requiresSaving option to Stripe payment method data
This is informed by the saved_cards option and the result of the wc_stripe_display_save_payment_method_checkbox filter.
* Rename displaySavePaymentMethodCheckbox to requiresSaving & fix logic
* Revert negation on display_save_payment method_checkbox filter & rename
We are going to rename the properties we use to determine whether saved cards are shown, or whether the save payment method checkbox is shown, so that their names are more descriptive of what they are for.
* Rename allowSavedCards and requiresSaving in Stripe integration
* Rename savePaymentInfo&requiresSaving to showSavedCards & showSaveOption
This is so we can hide the checkbox independently of hiding the saved payment methods.
* Show deprecated message if payment methods use savePaymentInfo
This is because we are leaving it in to enable backward compatibility but payment methods registering using this should be informed of the change in case it gets removed.
* Update Stripe typedefs and keys of supports object
* Show customer payment methods if showSavedCards is true on the method
* Make PaymentMethodTab accept showSaveOption prop
This will allow us to show the save checkbox only if the payment method says it should be shown.
* Update tests to use new keys in supports when reg'ing payment methods
* Add optional chaining when validating payment method config
This makes the code a little tidier :)
* Update assets/js/blocks-registry/payment-methods/payment-method-config.js
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* Add more information to deprecated call in payment method config
* Fix lint error
* Fix prop types for PaymentMethodTab
* Add information about supports on payment methods to docs
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* move items to package
* move components to package
* fix dep issue
* pass down classname
* move Panel and Price utils
* expose extensions
* fix import
* move cart call to inside slot
* fix unit tests
* fixes after rebase
* move ShippingRatesControl into packages/checkout
This fixes the `wc-blocks-checkout` circular dependency because `Package` was importing from `@woocommerce/checkout`.
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* generating changeset for pull request
* generating changeset for pull request
* Update changelog.txt for 4.3.0 release.
* Update testing instructions for 4.3.0 releae.
* Update testing instruction for review.
* Revert "Improve error displayed to customers when an item's stock status changes during checkout. (https://github.com/woocommerce/woocommerce-blocks/pull/3656)"
This reverts commit a30179f165.
* Revert 3656 documentation changes.
* Update test zip link.
* Update release date for 4.2.0.
* Bumping version strings to new version.
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: budzanowski <bartosz.budzanowski@gmail.com>
* fix circular dependency in text-input
* fix circular dependency in chip component
* fix circular dependencies in AddressForm component
* fix circular dependencies in product-list
* fix circular dependencies in hooks
* fix circular dependencies in context
* Fix circular dependencies in components/cart-checkout
* fix use-checkout-submit test
- can’t mock the hook alias anymore
- account for undefined object returned from `usePaymentMethods`
* Add new exceptions for out of stock scenarios
These are needed to differentiate between the different stock validation errors, and so we can create the correct error message.
* Catch new out of stock exceptions when checking the cart for errors
This is so we can get the cart sent back to the client, if we don't catch these, then the route will just return a 500 error and crash.
* Add ArrayUtils class
This will contain methods used to operate on arrays that don't fit anywhere else.
* Handle the case in Checkout where the error is already a WP_Error
This will happen when the cart fails validation.
* Handle StockAvailabilityException in AbstractRoute
This will happen when an item or number of items in the cart are out of stock/insufficient stock.
* Throw exceptions for each type of invalid stock in validate_cart_items
This will allow us to create an error message for each type of violation to display to the user.
* Display additional error notices returned by the API
* Fix wording when throwing exceptions relating to stock
* Handle TooManyInCartException in CartController
* Abstract the merging of cart, status, and additional data into new fn
This allows us to simplify the way errors are returned from the API. The reason we have to add all of the data at once is because of how WP_Error works with the additional data, if there is already existing data in a WP_Error object, it gets moved into additional_data. By adding all of the data in one place, we stop this from happening. Also since we're only adding status and/or cart explicitly, it makes sense to just do it in one place.
* Add get_route_error_response_from_object method
This is so we can differentiate between a string and WP_Error object.
* Remove unnecessary slashes from WP_Error instantiation
* Add option to enclose each item in quotes in natural_language_join
* Abstract adding error messages to error object into single function
A lot of code was repeated, so doing this cuts down on that and ensures any changes only need to be made in one place.
* Create new parent exception for each type of out of stock exception
This is so we don't have to repeat code inside each different exception and we can simply inherit StockAvailabilityException.
* Catch the generic StockAvailabilityException in get_cart_item_errors
* No longer recalculate totals in validate function
It is not needed, the totals are recalculated elsewhere. This call was superfluous.
* Reduce nesting, and only throw exception if error object has errors
* Improve comment on get_route_error_response_from_object method
* Fix nesting when throwing the InvalidStockLevelsInCartException
* Inject the routes controller
* Cart totals need to be calculated on cart routes or fees will be missing
* Add fees to schema and response
* Add fees to useStoreCart
* Fix styling of multiple fee rows
* Fix test shape
* update input colors for dark and light mode + tweak padding and alignment
* update light input dropdown text color
* Fix lint errors
* Fix package lock.
* Use input-text-active for select options
* Make sizes responsive in radio control
* Unify border colors of text inputs, checkboxes and radio controls
* Unify radio control sizes in mobile/desktop
Co-authored-by: David Levin <davidlevin@Davids-MacBook-Pro-2.local>
Co-authored-by: budzanowski <bartosz.budzanowski@gmail.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.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 you don’t need lodash eslint plugin
* handle lodash.omit eslint errors
- storybook and webpack config implementations were just ignored.
- shared/validation/index.js was converted to use ES6 destructuring to eliminate usage.
* remove lodash assign usage
* convert lodash isNan to Number.isNan
* ignore lodash.flatten lint error for now
* remove usage of lodash.isNil
* add exclusions for lodash rules in main eslintrc file rather than per file.
* Allow integers in payment_data values
* Revert "Allow integers in payment_data values"
This reverts commit b7f2ca4a5b696091afe796f47e84f584a0b27d9e.
* Enforce payment tokens to be strings
* Revert "Add 'hidden' class name when using the 'hidden' attribute"
This reverts commit 0332e33a60a516506718e8ed4659e45d32dc80a4.
* Add styles for hidden panel content
* Add docs about account for the hidden attribute in styles
* Update docs/theming/README.md
Co-authored-by: Rua Haszard <rua.haszard@automattic.com>
Co-authored-by: Rua Haszard <rua.haszard@automattic.com>
* For gateways with disabled saved payment metods, don't show saved items in context.
* Fix style.
* Update name.
* Simplify and fix.
* Whitespace.
* Revert for another PR.
* Formatting fix.
* add fallback screen reader styles
* use shared blocks screen-reader styles from mixin:
- tweak mixin to align with focus-reveal style
- add new mixin for focus-reveal style, since it is coupled to
visually-hidden mixin
* Trim input values before validation on Checkout
* Fixes required field checking at schema level
* Require country during checkout and ensure values are formatted
* Add handling for rest_invalid_param messages
* Remove prepare_address_fields - handled by schema
* Add address validation to OrderController
* Implement address validation
* Error errors from all endpoints more gracefully
* update non-true description
* required prop
* Update tests
* Fix equalityFn so updates are triggered when address changes
* Remove debounce so fields update if context changes
* Update src/StoreApi/Schemas/AbstractAddressSchema.php
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Add missing wp_unslash
* Validate allowed countries should block checkout if no countries are allowed
* Type in locale variable
* Update assets/js/base/utils/errors.js
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Fix validator calls
* Remove refererence
* Restore onChange order
* eslint fix
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Add CSS rules for dark mode theme setting in Twenty Twenty-One
This is required because the theme may be set to dark mode independently of the browser. The reason we need two rules for this is because the checkout block can be set to have dark mode inputs too, so this rule doesn't need to apply then.
* Add theme-specific class for Twenty Twenty-One
* Use the @wordpress/server-side-render package
* Add @wordpress/server-side-render dependency
* Update requiredPackagesInWPLegacy for 5.4 support
* Update package lock
* Add stories to Cart & Checkout totals components
* Create @woocommerce/knobs alias
* Update TotalsFooterItem default values so they are in line with other stories
* Remove no longer used __experimentalPersistItemToCollection function
* Add __experimentalDeRegisterPaymentMethod and __experimentalDeRegisterExpressPaymentMethod to feature flags doc
* generating changeset for pull request
* generating changeset for pull request
* Update readme changelog
* Update requirements
* Testing instructions
* Update zip file
* Update nonce outside of json parse
* Set logged in cookie on store api requests
* Update zip
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Update @wordpress/components and @wordpress/base-styles
* Fix JS warning in Select/downshift
* Remove color definitions that are now imported from @wordpress/base-styles. Fixeswoocommerce/woocommerce-blocks#3311
* Use -unit values from @wordpress/base-styles. Fixeswoocommerce/woocommerce-blocks#3313
* Update snapshots
* Fix payment methods test
* Don't extract dependencies that are not available in WP 5.3
* Avoid extracting @wordpress/compose since last version doesn't have resize observer
* Remove unnecessary uses of @wordpress/compose in a frontend scripts
* Add missing spaces
* refactor and reorder checkout processing
* improve handling of checkout POST with mixed success:
- return coupon errors in a property
- don't throw from coupon validation:
- return info about errors to route handler
- tweak logic in route handler to prevent subsequent processing
- default payment result to fail to avoid accidental successful checkout
- in client, catch errors and new customer id:
- render any errors as notices - i.e. coupon error
- if a customer ID is included, push into store (so UI updates)
* fix linter whitespace issue from rebase merge
* fix MIA order validation/errors (due to rebase):
- reinstate thrown exception when validating order
- return exception was an experiment, now solved in woocommerce/woocommerce-blocks#3454
* hide "Create account" checkbox if account is created during an error response:
- update store with new user id
- remove stale response.errors handling;
- current approach (https://github.com/woocommerce/woocommerce-blocks/pull/3454) is to add data to error response
* show a notice informing user that they have signed up
* white space
* Handle header and update typedef
* Remove "errors" schema
* remove errors
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* refactor and reorder checkout processing
* move experimental order_processed hook as last step before payment:
+ flesh out docs - intention/purpose, introduced version, link to PR,
relationship to legacy hook
* return current user_id with checkout error responses, so UI can update
* clarify user id comment
* Add store API nonce to all responses
* catch new nonce & update store for POST /checkout errors
* ensure $order hook param and database are in sync
* fetchResponse->errorResponse
* Move payment method ID validation to schema
* Add the nonce inline
* Simplify error method
* Add todo for injection
* Hook docs
* Return user ID as a header instead of in error response
* Default to private methods
* Tidied processing logic/order save placement
* White space removal
* Remove duplicate comment
* Remove root slash
* Remove unused created variable
* Remove woocommerce_registration_error_email_exists filter in error message from API
* Move payment validation
* Moved comments
Co-authored-by: Mike Jolley <mike.jolley@me.com>
The hasLink prop was removed from ProductName and disabled is used instead, this change makes the variable name more descriptive, and uses disabled to signal if the ProductName should link or not.
* Reset product list padding
* Adjust placeholder color if css variable exists
This is 2021 specific but may become more prominant.
* FIx editor button styles in 2021
* Adjust button sizes based on columns
* Adjust padding
* Fix price slider styling in Twenty Twenty One
* Fix price slider styling in Twenty Twenty One
* Fix radio control styling in Twenty Twenty One and remove usage of mixin
* Force 0 padding on active filters list
* Hide spinner on cart's "proceed to checkout" button when page unloads
This is required because of a feature of Safari where the page state is saved, including all class names, when a transition occurs. Navigating using the back button restores the page to that cached state, so the spinner class remains on the button. Resetting the state just before the page gets cached stops this from happening.
* Change comment case to sentence case.
* Add catalog_visibility to CartItemSchema.php
This is used to get whether the product is visible in the catalogue, visible in the shop only, visible in search results only, or visible everywhere. We need to know this so we can pass it to the ProductImage and ProductName components.
* Remove links from CartLineItemRow if not visible in catalogue
Added catalog_visibility to lineItems prop, and when the product is not visible in the catalogue do not wrap product image in a link. Also pass down the hasLink prop to ProductName.
* Add hasLink prop to ProductName
When this prop is false we should not output the link around the product name. This is for when the product is hidden from the catalogue but we still want to show its name somewhere.
* Add tests and storybook for ProductName
* Add catalog_visibility check to OrderSummaryItem
When the catalogue visibility of a product is set to hidden or search, then the product name in the checkout sidebar should not be hyperlinked.
* Reverse logic for hiding link on product image & disabling link on name
Following a point from @budzanowski we do not need the hasLink prop, making use of disabled is probably a better idea.
* Remove tabindex from a in ProductName & output span if name is disabled
This change removes the need to pass a tabindex to the a in ProductName. This is because a disabled ProductName will now never output an a tag. When the ProductName is disabled a span is output instead, which has no tabindex by default.
This change also reverses the logic to decide whether the a or span should be output so as to make the code more readable and flow better.
* Update storybook and tests/snapshots for ProductName
* Correct docblock description
* Sync shipping address changes with billing data
* Update inline documentation
* Revert address sync because it fails when shipping is disabled explicitely
* Avoid loading shipping address from customer is shipping is disabled
* Rather than update order from the wc/store/checkout request, update the customer object
This is turn is synced to order, but also allows the cart calcultions to use the posted data. This means that taxes will be updated based on address data even if not displayed on the checkout.
* Add action that combines billing and shipping updates
* Add route for updating billing and shipping address
* Sync billing data to server on change
* Shared constants for billing data
* Skip address update if missing country
* Allow null values to skip formatting
* Add billing to cart schema
* Removed unwanted hooks from previous commit
* Decoding is handled in useStoreCart
* Remove hook
* Make shipping context hold state
* Make billing context hold state
* Add address processors
* Cart does not have billing
* Update tests, remove some unrelated changes affecting the diff
* Revert "Update inline documentation"
This reverts commit 0393f49316de3152c6dcf6fda1192c06a74f1b55.
* Make shippingRatesAreResolving conditonal based on API request
* Shared address processor in cart and checkout
* Rename REST endpoint
* CustomerDataProvider and hook
* Update shipping address type defs
* Rename customer address endpoint, and remove update-shipping
* Update tests
* Fix tests by restoring country validation
* typo
* Update assets/js/base/hooks/cart/use-store-cart.js
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Simplify debounce and request handling
* Remove state from address sync
This will mean billing is "forgotten" if using the checbox, but this greatly simplifies logic.
* Rename shipping rates loading to customer data loading
* Sync based on useStoreCart data
* Made cart API less strict on addresses
* Fix useCheckoutAddress sync
* Add note on currentShippingAsBilling
* Use incoming isCart
* Add more detailed inline comment for shippingAsBilling toggle event
* Combine customer billing and shipping ref
* Update address docblock
* Error handling in pluckAddress
* Fix cart response after rebase
* Update customer tests
* Update src/StoreApi/Routes/CartUpdateCustomer.php
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Pass disabled prop to FormStep in order-notes-step.js
This way we can add the disabled class to the div or fieldset rendered by FormStep.
* Add disabled class & style for disabled FormStep components
Allows us to style disabled elements that cannot have the disabled attribute (divs) the same way as disabled fieldsets are.
* Update test snapshot for FormStep
This is because we added a class to the div/fieldset element when it is disabled.
* Remove redundant selector from form-step styles
Because we now add the --disabled modifier to the class, we no longer need the disabled selector. The new class-name based selector covers both fieldsets and divs.
* Change style rules for checkout step headings
This is required because when the checkout heading text is too long it collided and overlapped the heading content due to its absolute position. In this commit we add a grey line to the left of the checkout step heading to ensure consistency with the checkout step container's styling.
* Remove position rule from checkout-step heading content
This was no longer needed as it nothing relied on the position of this element.
* Check price >= 30
* Force payment methods to react to order totals change
* Fix express payments reducer so it overwrites
* Fallback to 0 if undefined
* handle plain options passed to registerPaymentMethod:
- no need for a callback dance
- support the previous API: if a function is passed, call it as before
* update Stripe for new registerPaymentMethod interface
* update docs & all built-in payment methods to simpler API
* handle plain options arg to registerExpressPaymentMethod:
- add legacy fallback if passed a function
- update stripe express payment method
- update docs
- remove unused `assertValidPaymentMethodCreator` util
* use correct case for `JavaScript`
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* typedefs for payment registration options + tidies for regular methods
* typedef express payment options arg & tidy stripe/payment-request:
- use camelCase for config instance (not a constructor/type)
* mention typedefs in payment method dev docs
* use @wordpress/deprecated to warn if callback passed to payment register
* update unit tests for new payment method API
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Exclude checkout-draft orders from WC Admin reports
* Hook into order query args
* Add comments before applying filters
* Revert "Add comments before applying filters"
This reverts commit 83b695665c05a3a9e7669e8777080c6ff10d8421.
* Revert "Hook into order query args"
This reverts commit 94cec6c83cf5b5ce05cd106daf217c0b08f13a03.
* Hide draft orders from My Account > Orders
* Move filter to its own file
* Use custom plugin namespace for filter
* Remove custom fieldconfig for shipping calculator so required fields for shipping are collected
* If the store config requires an address before shipping, do not return rates or totals
Totals, calculated by the cart, would be set to 0 in this scenario which could lead to customer confusion (why is the rate $10 but shipping shown as $0?)
* The shipping total row is missing a border
* Revert "If the store config requires an address before shipping, do not return rates or totals"
This reverts commit f3a4f24f5785392eb43bfc69a5548d398c47d8bb.
* Add hasCalculatedShipping to schema and hooks
* Show shipping notices with updated wording based on if shipping has calculated yet or not
* Refactor shipping row display to use new API props
* Remove block level isShippingCostHidden
* fix test
* Correct the math in the shipping preview in cart
* Document null
* Remove test—this option no longer exists
* Remove unused settings/constants
* Strip tags from stripe error notices
* Revise abortPayment - this does not need to provide or handle responses
* Decode entities in responseData
* Correctly handle checkoutResponse props
* Show one error at a time from express methods
* Set ID to context to avoid need to manually define it
* Add missing context docs for shouldCreateAccount
* shouldCreateAccount context docs
* No need to handle showOrderNotes in component—just don't render it
* Only render notes if needed
* Create PhoneNumber component to insert when needed
* account for registration enabled setting when creating accounts
* default to false instead of global setting for initial allowCreateAccount attribute
* consider global allows signup value for whether account creation checkbox shows
* include existing hook when determining if checkout signup is available:
- woocommerce_checkout_registration_enabled hook
* use public api for registration settings (via WC_Checkout)
* initial round of test fixes
* fix logic flaw exposed by tests and align tests with actual values in real use
* return early if WC_Checkout is not available
* remove temporary test group and uncomment new test.
* improve test method name
* fix comment to match new routine name
* ensure block shows login prompt when store disables checkout signup
* fix incorrect conditional order and cover with tests
Co-authored-by: Rua Haszard <rua.haszard@automattic.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
* 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
* 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 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
* 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>
* 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
* 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
* 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 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>
* 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
* enqueue order of payment gateways as script data
* use configured gateway order for payment method tabs
* clarify name of payment gateway sort order setting
* fix formatting
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* fix bug - express payment methods not working due to ordering logic:
- move ordering code to payment methods in usePaymentMethods hook;
- this only applies to standard (non express) payment methods
- also any code that uses payment methods will get them in correct order
* why did this formatting not happen pre-commit?
* move method ordering into refreshPaymentMethods to avoid infinite loop:
- pass keys of express payment methods so they work correctly (show up)
- refreshPaymentMethods dispatches availablePaymentMethods to redux
store; I suspect this was causing infinite loop as the callback
depends on registeredPaymentMethods
- handle case when a payment method is not in PAYMENT_GATEWAY_SORT_ORDER
- this happens with COD when dependent on shipping
* fix formatting
* use shallow equal to prevent refreshCanMakePayments infinite loop
* use native Set instead of lodash.union for unique gateway names
* code formatting
* check to ensure we register paymentGatewaySortOrder asset once only
* fix COD tab showing out of order if not available at page load:
- return ALL gateways in sort order array
- note this includes gateways that are not enabled by merchant
* reinstate return bool from usePaymentMethods hook (broken in refactor)
* add basic typedefs for payment methods hooks
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Add Checkout Order notes (UI)
* Add Checkout Order notes (context)
* Add missing useEffect dependencies
* Remove duplicate toggle in editor
* Minor fixes
* Check whether orderNotes have changed before creating a new state object
* Rename showCounter to showStepNumber
* Rename 'onChange' with 'onTextChange'
* Add comment and tests to FormStep component
* Rename 'with-counter' to 'with-step-number'
* Fix wrong prop
* Make it so order notes are persisted when toggling the checkbox
* Update type-defs
* Set showStepNumber default value to true
* Provider progress
* Revert nonce change for debugging
* Working emitters
* Fix dismiss link alignment in notices
* Fix button state and double adds
* Remove old context file
* Add type defs
* Fix context name
* Leftovers from merge
* Hooks up the variation picker to cart context
* Group event emitters in context
* Fix external product display
* Pass product through to VariationAttributes
* Pass around dispatchers
* Update assets/js/base/context/add-to-cart-form/form-state/reducer.js
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Update assets/js/atomic/blocks/product-elements/add-to-cart/product-types/variable/variation-attributes/attribute-select-control.js
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Update assets/js/base/context/add-to-cart-form/form-state/reducer.js
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* remove placeholder comment
* content->container
* Clarify variation method comment
* update comment
* Switch nesting of providers
* Variation attribute utils test coverage
* If nothing is selected yet, just return all variations.
* Comments to explain loops
* Use refs to avoid recalculation of attributes on every render
* Update memo usage
* typo
* move mock data to test file
* Switch to useShallowEqual
* trigger cart fragment refresh after add to cart
* Decode option entities
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* enqueue and respect merchant option for disabling stripe express pay
* don't even register express payment method if merchant has disabled it
* add StripeServerData.allowPaymentRequest to typedef
* add changelog to readme.txt
* Add testing docs for release
* add some new commands to help with release testing phase
* Add testing notes for 3.0.0
* fix testing note typo
* updae notest to reference the new package-plugin:deploy script for use as part of the release process
* Add note about creating manual tag for the release.
* automate creation of dev tag for release.
* remove release branch from travis branches because we now do pull requests for releases
* remove duplicate back order badge for cart (https://github.com/woocommerce/woocommerce-blocks/pull/2890)
* update zip link in testing notes
* only update stable version in readme.txt if not a pre-release
* Add handling for conditional github release creation based on WP deploy question
* add distignore fir wp deploy builds
* Cart & Checkout: fix '0' visible when product stock was 0 and it allowed backorders (https://github.com/woocommerce/woocommerce-blocks/pull/2891)
* Create wordpress-deploy.yml
* fix cod not accounting for global rate values (https://github.com/woocommerce/woocommerce-blocks/pull/2894)
* ensure we’re only running checks for `wc_reserved_stock` table when necessary (https://github.com/woocommerce/woocommerce-blocks/pull/2895)
* update readme.txt changelog
* remove unnecesary variable definitions
* update github deploy script
* Bumping version strings to new version.
* add missing step for checking out code from tag
* fix exclusion for docker-compose.yml
* fix zip name (it differs from repository name)
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Product selection when out of context for price and title blocks
* Move product element name/description/icons to constant files
* Add attributes and hocs to all elements
* Standalone block rendering
* Add a placeholder if title has no content
* Revert "Add a placeholder if title has no content"
This reverts commit 29115154b33eedc661ccd3cc758acdbc5041ffbc.
* parentClassName is not always present
* Loading state
* Wrap description in P
* Fixed loading styles when nested
* Maintain product shape in useProductData
* feature gate elements from showing in inserter
* fix feature flag
* include price PR
* edit withProductSelector to be a hoc
* fix lint issue
Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
* Fix Credit Card input font size in some themes
* Fix spacing between credit card icon and input label
* Fix min-width of credit card input fields
* Improvements to the way credit card input fields are resized
* Simplify min-width
* stub out COD payment method for checkout block
* consistently use sentence case for (default) payment tab labels
* expose COD `enable_for_virtual` option to client
* correct docblock return value comment Stripe::get_inline_cc_form()
* allow merchant to disable COD payment for virtual/downloadable orders
* tweak canMakePayment dev docs - add cart-dependent example use case
* only allow (show) COD if initially-selected shipping method(s) allow
* tweak `canMakePayment` payment extension API docs
* use $VID:$ substitution for `@since` version in new payment methods
* use FILTER_VALIDATE_BOOLEAN for payment method boolean options
* use more semantic `some` when hunting for COD-unsupported shipping
* clarify `canMakePayment` API docs
* re-select payment method if selected method disappears (e.g. COD) +
+ factor out early return into separate if at top for clarity
* Deregister core cart/checkout scripts and styles when rendering the blocks
* Fix regression: redirect to full cart when adding a product from empty cart
* Make it so it scrolls to the top
* Update assets/js/base/utils/legacy-events.js
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Add check for jQuery availability
* Listen to removed from cart event too
* Remove unnecessary useEffect dependency
* Remove jQuery event subscriptions on component unmount
* Fix tests
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* Show backorder notice in the Cart block
* Don't render variation <div> if empty
* Create ProductBackorderNotification component
* Add product backorder notification to the checkout block
* Fix classname and comment
* Rename notification->badge and don't show low stock badge if backorder is shown
* Use ternary to dispaly backorder/low stock badge
* allow payment methods to disable based on shipping or other factors:
- renamed 'initialized' array 'available' to match primary purpose of
`canMakePayment` api - whether payment method should be available
- trigger refresh of available payment methods when shopper chooses
different shipping method
- rename resolveCanMakePayments => refreshCanMakePayments
- tweaked some variable names and scope for clarity
- added comments to clarify things
Note this should not affect behaviour yet - no existing payment methods
use this new feature. COD payment method will need this - woocommerce/woocommerce-blocks#2831
* optimise refreshCanMakePayments:
- useShallowEqual to avoid unnecessary call when shipping methods have
not actually changed (but object value has)
* replace ("set") payment methods in store, was appending:
- payment methods may come and go depending on cart/checkout state
- the previous SET action appended provided payment methods to the
collection
- this prevents dynamic payment methods e.g. COD from being able to hide
i.e. disable
* cache test payment request to avoid unnecessary stripe API calls:
- in the canMakePayment callback there's a test payment to determine if
chrome pay/apple pay is set up and available
- canMakePayment is now called multiple times as checkout state changes
- now the results of the test payment are stored in variable, and
returned on subsequent calls
* set init flag to avoid additional attempts to init stripe API:
+ tweak naming of init flag
* stubs for bank transfer payment method
* allow merchant to disable BACS payment method
* show customised BACS title & description in checkout
* re-add entry point for BACS payment method (lost in rebase)
* Reduce specificity of some button styles
* Submit container: make it possible for themes to change the shadow color without the need to rewrite shadow values
* Use background-color instead of background property in docs
* Add docs to style the button and the submit container
* Remove border from button
* Add back state styles to button component
* Docs improvements
* Undo unncessary changes in button component styles
* Add spaces
* Fix Cart test async logic
* tweak test
* refactor test to not call response twice
* add comment for why we're calling fetch twice
* fix duplicate calls
* reset empty test to normal value
* switch to mockResponse
* convert comment to todo block
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* modify dashicon replacements to be consistent with other icon exports
This also involved modifying the dashicon module replacement to use `cloneElement` instead of `createElement`.
* import from packages not global
* export woo icon consistent with other icons from the library
The Woo category icon was not using the Icon system and not exported consistent with other icons.
* add missing viewbox to arrowBack
* add story for icon library
* Update assets/js/icons/stories/index.js
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Remove legacy files
* Use thumbnail product image for Cart, Checkout and Reviews blocks
* Add option to toggle between full size and cropped image to the Atomic Product image block
* Add attributes to API
* Add component
* API updates to return variation data
* Update to handle updated api responses
* Working picker
* Update tests
* update test
* Use SelectControl
* Add Picker to Form Block
* Code cleanup and splitting
* Inline todos
* Update todos
* Update assets/js/atomic/blocks/product/add-to-cart/product-types/variable/variation-attributes/index.js
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* change classname and move styles within component
* Correct conditional
* Avoid nesting filters
* Remove exclude from getVariationsMatchingSelectedAttributes
* basic select styles
* remove custom select styles
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Update base/components classnames
* Fix class name conflict
* Fix some class names mismatch
* Fix review loading placeholder styles
* Fix docs format
* Update old class name
* Fix price slider regression
* Fix load more button component missing legacy class
* Fix wrong loading mask styles classname
* Remove 'checkout' from 'wc-block-components-checkout-payment-methods__save-card-info' classname
* Make it explicit legacy classes will be removed in the next major version
* Make product variation data styles belong to product metadata
* Improve docs sentence
* 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
* Order summary: Add spacing between product name and price name
* Remove border from shipping options in the side bar
* Add a hasBorder prop to Panel
* Checkout Order summary: remove margin product description
* Fix padding when there are multiple packages and remove old code
* Simplify selector
* Add margin botton to no shipping options notice
* Make sure Checkout titles are aligned when there are no express payment methods
* Update step heading margins according to new designs
* Add theming docs
* Update some components to the new class name structure
* Add docs about class name updates
* Update coding guidelines
* Minor improvements
* Update docs/theming/class-names-update-280.md
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
Co-authored-by: Darren Ethier <darren@roughsmootheng.in>
* 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.
* Use same margin-bottom in credit card input as in checkout inputs
* Set cursor:text for Checkout input labels
* Increase line height of expiry and cvc input validation errors in large viewports
* Increase height of expiry and cvc input validation errors in small viewports
* Move order summary styles to component style.scss
* Fix wrong class name in Order summary
* Move express payment methods a little bit higher
* Fix shipping options panel misaligned in the Cart sidebar
* Add right padding to panel button so text doesn't overlap the arrow
* Fix wrong class name in Order summary (II)
* add state for selected saved token in payment data
* add handling for flipping payment status back to pristine when checkout has error
If payment status is successful client side, but the checkout state goes into an error after server side processing, then we reset payment status to pristine to allow for reprocessing of payment method client side.
This is skipped for saved payment method tokens because they effectively are _only_ processed server side.
* Revert "Move blocks to stable flag (https://github.com/woocommerce/woocommerce-blocks/pull/2261)"
This reverts commit a005649ab8.
* migrate to number based gating
* add todo to watch feature flag
* remove flags from build
* change flag in travis
* load flag in right order
* expose flag to js
* simplify flag definition
* more feature flags
* wrap flag in check
* add helper functions
* add helpers in PHP
* fix typo in flag
* move php code to src/domain/package
* tweak if condition
* return flag to travis
* fix broken block name
* remove obsolete useStoreOrder hook and implementation.
This hook was actually never completed and was only implemented in the `usePaymentMethodInterface` hook/api. The original purpose was to expose order details to registered payment methods, but that is now exposed via checkout state event emitters so it’s no longer needed.
OrderId is exposed via the `CheckoutState` context provider.
* remove setBillingData from being exposed to payment methods directly
billingData is updated via event emitter callback responses (see payment method data context provider) and is not something that should be set directly via payment methods.
We want checkout to have control over how billing data is updated in the state.
* Update item count badge styles
* Make sure item count badge doesn't break in multiple lines
* Make item count badge have white background
* Add docs
* Move order summary CSS properties outside of the sidebar class to reduce specificity
* Move Order summary to its own component
* Register Atomic Blocks and save some block content
* renderInnerBlocks utility
* Frontend Rendering
* Clean up atomic block classnames
* Move shared styles
* Create a hoc for attribute mapping
* Rename some unpluralised class names
* Remove prefixes from atomic component class names
* Updated styles
* Update styles from master
* Revert product list styles
* 2020 fixes
* Separate renderFrontend from renderInnerBlocks
* Lazy loading of components
* Tweak loading classes
* FIx all products loading state
* Revert lazy implementation - creates too many unneccessary files due to webpack config
* Cleanup
* Remove wcBlocksBuildUrl
* Move call to register_atomic_blocks
* Remove duplicate key
* reuse render frontend
* Corectly handle frontend attribute mapping to keep editor working
* Style updates
* Update side effects
* Remove width style from rating to fix alignment
* Move ssr grid styles to main stylesheet
* Put back prefixed classnames
* 2020 styling fixes
* Create frontend files instead of doing it all in block map
* Update assets/js/atomic/utils/get-block-map.js
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Update assets/js/atomic/utils/render-parent-block.js
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Fix last child alignment regardless of block type
* More specificity fixes
* 2020 button alignment
* static fix to prevent offsets
* fix placeholder image in firefox
* Issues reported in feedback
Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
* Honor heading styles in Cart and Checkout blocks
* Replace Panel with DisclosureWidget and remove Card
* Remove panel-style from main entry
* Rename DisclosureWidget props
* Simplify TitleTag assign
* Add aria-expanded attribute
* Rename DisclosureWidget to Panel
* Make Panel button clickable area smaller
* Fix specificity issues with Twenty Twenty
* Reset italics in reset-typography mixin
* Make C&C titles font size large
* Add padding to shipping options when in the sidebar
* Fix Sale badge markup discrepancy. Fixeswoocommerce/woocommerce-blocks#2107
* Fix product link markup discrepancy
* Use same class name for ratings markup in product grid blocks
* Remove editor specific class name for product title
* Unify price layout between product grid blocks and All Products block
* Change specificity raising classes to avoid editor class names
* Make small images fill the available width in product grid blocks
* Avoid increasing selector specificity in the frontend
* Undo AbstractProductGrid.php template changes
* Do not remove .wc-block-grid__product-rating__stars from CSS
* Add theming docs
* Remove underline from discounted prices
* Fix position of on sale badge in Twenty Twenty
* Make sure we reset styles from Core
* Fix image on sale badge not correctly positioned
* Fix sale badge alignment when they are on in the right
* Use named font sizes instead of values in px
* Convert rem mixin to em
* Remove unnecessary line-height
* 'Design' -> 'layout'
* Add comment to magic line-heihgt number
* Update a couple of class names to use BEM
* Use consistent name for SCSS variables
* Fix order summary line heights
* Update docs/contributors/coding-guidelines.md
Co-authored-by: Mike Jolley <mike.jolley@me.com>
Co-authored-by: Mike Jolley <mike.jolley@me.com>
* Convert several default buttons to primary
* Align primary and tertiary buttons
* Align select controls of placeholders
* Don't force a placeholder background color
* Add border to placeholder lists
* Add work-around for SearchListComponent compatibility with last version of @wordpress/components