Commit Graph

11 Commits

Author SHA1 Message Date
Mike Jolley e0c62dce79
Extensibility: Format currency config so it can be consumed more easily (#48727)
* Export pre-formatted SITE_CURRENCY object from settings

* Fallback to SITE_CURRENCY

* Changelog

* Fix typedef

* Update mocks

* Inject site currency into cart preview data

* Update test

* Add currency formatting to preview data

* Mock currency in tests

* More currency mocking
2024-07-12 14:24:22 +01:00
Michael P. Pfeiffer 521f93619b Upgrade wp-prettier to 2.6.2 and reformat the codebase (https://github.com/woocommerce/woocommerce-blocks/pull/6566)
* Remove mixed tabs and spaces in tsconfig.json

* Update formatting in json files

* Upgrade wp-prettier to 2.6.2
2022-06-15 11:56:52 +02:00
Tung Du 6531c4cb0b Fix: Convert Filter Products by Price Block to TypeScript (https://github.com/woocommerce/woocommerce-blocks/pull/6514) 2022-06-14 15:48:49 +07:00
Niels Lange 29d0cd0b64 Display decimals if intended by the merchant (https://github.com/woocommerce/woocommerce-blocks/pull/5219) 2021-11-24 20:21:40 +07:00
Mike Jolley c2fb8751be Add support for decimal and thousand separators in the `formatPrice` function (https://github.com/woocommerce/woocommerce-blocks/pull/5188)
* Format with decimal and thousands, with tests

* Update packages/prices/utils/price.ts

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>

Co-authored-by: Albert Juhé Lluveras <contact@albertjuhe.com>
2021-11-19 12:32:37 +00:00
Tung Du edce72e2fb Mini Cart block: improve button accessibility (https://github.com/woocommerce/woocommerce-blocks/pull/4852) 2021-10-04 10:54:28 +07:00
Mike Jolley cf8ab9fa93 Add key to each `CartTotalItem` (https://github.com/woocommerce/woocommerce-blocks/pull/4240)
* Move type defs

* Move type guards

* Fix imports

* Extract prepareTotalItems to TS file

* usePaymentMethodInterface as TS file

* Fix TS props

* Fix currency type defs

* Add return type to usePaymentMethodInterface

* Add key prop to CartTotalItem

* Fixed up js tests

* Move SymbolPosition into type-defs package

Co-authored-by: Thomas Roberts <thomas.roberts@automattic.com>
2021-05-25 12:49:13 +01:00
Thomas Roberts 6ffa778729 Convert shipping components to typescript (https://github.com/woocommerce/woocommerce-blocks/pull/4135)
* Add type defs for customer

Taken from 194ecccf78/assets/js/type-defs/customer.ts

* Convert ShippingCalculatorAddress to TypeScript

* Convert ShippingCalculator to TypeScript

* Convert ShippingLocation to TypeScript

* Allow packageId to be a number or string in useSelectShippingRate(s)

* Convert ShippingRatesControl to TypeScript

* Convert ShippingOptionsStep to TypeScript

* Allow package_id to be a string or number

This is because of Subscriptions using strings for package IDs

* Change to use CartShippingRateItemShippingRate instead of Rate

* Add extra props to PackageProps type

* Make ShippingAddress have the correct type

* Use CartShippingRateItemShippingRate instead of Rate

* Remove Rate type

* Set return types to JSX.Element

* Change type of props.renderOption in ShippingRatesControl

* Remove customer type defs and relocate aliases to default-address-fields

* Add EnteredAddress type

* Import EnteredAddress from new location

* Remove unnecessary eslint ignore

* Remove unused variable

* Remove confusing use of word Item in Shipping types

* Remove confusing use of word Item in Shipping types
2021-05-10 10:03:30 +01:00
Raluca Stan e187b9ef88 Update/typescript checkout shipping (https://github.com/woocommerce/woocommerce-blocks/pull/3925)
* 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>
2021-03-09 10:55:24 +00:00
Albert Juhé Lluveras 0e1b1e3579 Add types to packages directory (https://github.com/woocommerce/woocommerce-blocks/pull/3914)
* 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>
2021-03-05 14:03:48 +00:00
Seghir Nadir 99b78a1c9a add price package (https://github.com/woocommerce/woocommerce-blocks/pull/3790) 2021-02-04 15:30:28 +00:00