-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cc-pricing-*: handle multi-currency, add state
, typecheck, fix small issues & cleanup
#1218
base: master
Are you sure you want to change the base?
cc-pricing-*: handle multi-currency, add state
, typecheck, fix small issues & cleanup
#1218
Conversation
3666269
to
62af712
Compare
🔎 A preview has been automatically published : https://clever-components-preview.cellar-c2.services.clever-cloud.com/cc-pricing-components/states-typecheck-and-multicurrency/index.html. This preview will be deleted once this PR is closed. |
aa58745
to
b6f5fed
Compare
b6f5fed
to
1430178
Compare
state
, typecheck, fix small issues & cleanup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What an awesome PR! So much things tackeled in a very complex component. So, well done Florian.
During my tests, I did not encountered any problems.
However, I left some comments (and some questions too).
src/components/cc-pricing-product-consumption/cc-pricing-product-consumption.smart.md
Show resolved
Hide resolved
1a54752
to
09730b7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e1760e4
to
af21fd9
Compare
373e4c6
to
abed39d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small question but LGTM, thanks Florian! 💪
The new fetch is triggered by changing the context of their common smart container when the zone or currency changes. | ||
The typical HTML for a basic `cc-pricing-page` implementation looks like this: | ||
```html | ||
<cc-smart-container context='{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: now that apiConfig is mandatory, shouldn't it appear here too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch, forgot about that, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. well done for this huge work!
BREAKING CHANGE: the component no longer supports hard coded change rate Prices displayed in pricing components are no longer computed based on hard coded change rate. Prices related to the selected currency come from the API priceSytem endpoint. This means that some types for the component properties have changed: - `currency` is now a `string` (ISO 4217 currency code), - `selectedCurrency` is now a `string` (ISO 4217 currency code). Fixes #1167
Smart components: - The `addonFeatures` context parameter of the `cc-pricing-product.smart-addon` component is now optional as it should always have been (default value: `[]` meaning that all features are displayed by default). - The `zoneId` context parameter of both `cc-pricing-product.smart-addon` & `cc-pricing-product.smart-runtime` is now optional (default value: `'par'`). BREAKING CHANGE: the component no longer supports hard coded change rate Prices displayed in pricing components are no longer computed based on hard coded change rate. Prices related to the selected currency come from the API priceSytem endpoint. The component also relies on the new `state` prop for data coming from the API. This means that some types for the component properties have changed: - `currency` is now a `string` (ISO 4217 currency code), - `product` has been removed, - `state` has been added to replace `product`, - `product.state` is now `state.type`. The payload type of the `cc-pricing-product:add-plan` dispatched event has changed. Plans must now include a `priceId` property to be handled by the `cc-pricing-estimation` correctly. This also means that custom products / plans can no longer be added to the estimation because they are not part of the priceSystem and have no `priceId`. The payload type of the `cc-pricing-product:add-plan` dispatched event has changed. Plans must now include a `priceId` property to be handled by the `cc-pricing-estimation` correctly. This also means that custom products / plans can no longer be added to the estimation because they are not part of the priceSystem and have no `priceId`. Fixes #1167 Fixes #1109 Fixes #1174 Fixes #1176
…urrency Smart components: - The `zoneId` context parameter of `cc-pricing-product-consumption.smart` is now optional (default value: `'par'`). BREAKING CHANGE: the component no longer supports hard coded change rate Prices displayed in pricing components are no longer computed based on hard coded change rate. Prices related to the selected currency come from the API priceSytem endpoint. The component also relies on the new `state` prop for data coming from the API. This means that some types for the component properties have changed: - `currency` is now a `string` (ISO 4217 currency code), - `product` has been removed, - `state` has been added to replace `product`, - `product.state` is now `state.type`. The type of the payload dispatched with the event `cc-pricing-product:add-plan` has changed: - `sections` (`Array<PricingSection>`) are now part of the payload so that prices can be computed by the `cc-pricing-estimation` component everytime the currency changes. Fixes #1167 Fixes #1176 Fixes #1109
…em currency BREAKING CHANGE: the component no longer supports hard coded change rate Prices displayed in pricing components are no longer computed based on hard coded change rate. Prices related to the selected currency come from the API priceSytem endpoint. This means the component now has a dedicated smart component ( `cc-pricing-estimation.smart`) to fetch the `priceSystem` corresponding to the selected currency everytime it changes. The component also relies on the new `state` prop for data coming from the API. This means that some types for the component properties have changed: - `selectedCurrency` is now a `string` (ISO 4217 currency code), - `currency` is now a `string` (ISO 4217 currency code), - `state` has been added to receive data from the `priceSystem`. Fixes #1167
BREAKING CHANGE: the component no longer supports hard coded change rate Prices displayed in pricing components are no longer computed based on hard coded change rate. Prices related to the selected currency come from the API priceSytem endpoint. This means that some types for the component properties have changed: - `selectedCurrency` is now a `string` (ISO 4217 currency code), - `selectedPlans` now handles plans differently (they must have a `priceId` if they come from `cc-pricing-product` or `sections` if they come from `cc-pricing-product-consumption`). Fixes #1167
abed39d
to
458dce3
Compare
What does this PR do?
currency
is now a simple string ("EUR", "USD", etc.),cc-pricing-product
,cc-pricing-product-consumption
&cc-pricing-estimation
) support an optionalcurrency
context parameter.cc-pricing-estimation.smart
has been created because everytime the currency changed, it used to compute the new prices based on the hard coded change rate,cc-pricing-estimation
relies on thepriceSystem
to find the product prices for the selected currency and compute the total price based on quantity.cc-pricing-product-consumption
because prices for "countable" products (consumption based products) rely onintervals
.interval
corresponds to a price range to which a specific price applies (check pulsar / cellar products for instance). Some intervals are progressive (like taxes in France) and some are not (as soon as you reach a threshold, the previous threshold no longer applies). Ping me if you need explanation about this but playing with the prod pricing page should help too.PricingSimulator
class) used by thecc-pricing-product-consumption
for thecc-pricing-estimation
.cc-pricing-product.smart-addon.js
, theaddonFeatures
was mandatory even though it had a default value which doesn't make sense. It is now optional.zoneId
was mandatory even though it had a default value which doesn't make sense. It is now optional.apiConfig
as an optional context parameter for all pricing smart components:apiConfig
param is optional because these components require no authentication.How to review?
Some stuff was left unchanged, for instance temporality features, responsive & CSS overall.
You should focus on currency, states, smart, and how the components work / interact together when adding / removing product / changing currency, etc.
If you don't have much time, it's better to spend it playing with the component as stated above than actually checking the code thoroughly.
demo-smart/cc-pricing-page
page (this is where you should play the most with the component).