Commit graph

10 commits

Author SHA1 Message Date
Antoine Clausse
b2ef7a935f [web] Use localized number formatting for currencies (#17622)
* Add a unit test on `SubscriptionFormatters.formatPrice`

* Add JSDoc to `formatPrice`

Also: Name the functions before exporting:
This fixes my IDE (WebStorm) navigation

* Make `'USD'` the default param instead of reassigning

* Create `formatCurrency` function

* Use `formatCurrency` in SubscriptionFormatters

* Use an `isNoCentsCurrency` logic for `CLP` `JPY` `KRW` `VND`

And remove custom `CLP` logic and locale

* Add `locale` param to `formatPrice`

* Generate `groups.json` and `localizedPlanPricing.json`

```
bin/exec web node ./scripts/recurly/recurly_prices.js --download -o prices.json
bin/exec web node ./scripts/plan-prices/plans.js -f ../../prices.json -o dir
```

* Update scripts/plan-prices/plans.js to generate numbers instead of localized amounts

* Generate `groups.json` and `localizedPlanPricing.json`

```
bin/exec web node ./scripts/recurly/recurly_prices.js --download -o prices.json
bin/exec web node ./scripts/plan-prices/plans.js -f ../../prices.json -o dir
```

* Remove generation of `plans.json`

As /services/web/frontend/js/main/plans.js was removed in https://github.com/overleaf/internal/pull/12593

* Sort currencies in alphabetical order in scripts/plan-prices/plans.js

* Generate `groups.json` and `localizedPlanPricing.json`

```
bin/exec web node ./scripts/recurly/recurly_prices.js --download -o prices.json
bin/exec web node ./scripts/plan-prices/plans.js -f ../../prices.json -o dir
```

* Use `formatCurrency` in price-summary.tsx

* Use `formatCurrency` in Subscription Pug files

* Fix unit tests SubscriptionHelperTests.js

* Remove unused `currencySymbol`

* Change to `formatCurrency` in other React components

* Add `CurrencyCode` JSDoc types

* Duplicate `formatCurrency` into services/web/app/src/util

* Wrap tests in a top-level describe block

* Use `narrowSymbol`

* Fix tests with `narrowSymbol` expects

* Revert deletion of old `formatPrice` in SubscriptionFormatters.js

* Rename `formatCurrency` -> `formatCurrencyLocalized`

* Revert deletion of `CurrencySymbol`

* Add split-test in SubscriptionController.js

* Add split-test in SubscriptionViewModelBuilder.js

* Add split-test in plans

* Add split-test in subscription-dashboard-context.tsx

* Add split-test in 4 more components

* Update tests

* Show currency and payment methods in interstitial page

* Fix `–` being printed. Use `–` instead

* Fix test with NOK

* Storybook: Fix missing `SplitTestProvider`

* Storybook: Revert "Remove unused `currencySymbol`"

This reverts commit e55387d4753f97bbf8e39e0fdc3ad17312122aaa.

* Replace `getSplitTestVariant` by `useSplitTestContext`

* Use parameterize currencyFormat in `generateInitialLocalizedGroupPrice`

* Fixup import paths of `formatCurrencyLocalized`

* Replace `% 1 === 0` by `Number.isInteger`

* Add comment explaining that any combinations of languages/currencies could happen

* Fixup after rebase: import `useSplitTestContext`

* Revert "Remove SplitTestProvider from subscription root"

This reverts commit be9f378fda715b86589ab0759737581c72321d87.

* Revert "Remove split test provider from some tests"

This reverts commit 985522932b550cfd38fa6a4f4c3d2ebaee6ff7df.

GitOrigin-RevId: 59a83cbbe0f7cc7e45f189c654e23fcf9bfa37af
2024-04-19 08:03:54 +00:00
Davinder Singh
2ba92141ee Merge pull request #17719 from overleaf/ds-latam-pricing-web-config
Latam Geo Pricing V2 - Updating Web configurations file for new prices

GitOrigin-RevId: 0cd7abc565e971dd68f0860f00ea2ed8c1e713f8
2024-04-09 08:04:10 +00:00
Thomas
8efac32c8a Add LATAM currencies/prices to plan and group settings/scripts (#13661)
* Add LATAM currencies to plan-prices generator script

* Add LATAM prices to web configs

* Add LATAM currencies to group plan price formatting

* Use toLocaleString to format currencies for LATAM regions

GitOrigin-RevId: ce672043bef16298c87efa007eac23b004be8205
2023-07-17 11:01:00 +00:00
Brian Gough
426128554d Merge pull request #12813 from overleaf/bg-add-inr-currency
add Indian Rupee (INR) prices to plan and group settings

GitOrigin-RevId: 6c058ed034d1566cfda17e73a8ba23d8bd7b7ab0
2023-04-27 08:07:45 +00:00
Thomas
17be32f90d Merge pull request #10908 from overleaf/tm-adjust-prices-10886
Adjust all prices for 10% increase from previous baseline

GitOrigin-RevId: a895f862e404d91bc17914164fe19fac2f2d1dde
2022-12-16 09:02:53 +00:00
Eric Mc Sween
682406b797 Merge pull request #10380 from overleaf/ii-change-plans-prices
Change plans prices

GitOrigin-RevId: 9229e9be916c8377f6fdd259f934a9f0811f3d94
2022-11-15 09:06:04 +00:00
Tim Alby
bbac46156b convert price_in_unit to price_in_cents
GitOrigin-RevId: bae030e9c90f8286d6e6550744849984fe81f63d
2022-01-21 09:03:29 +00:00
Tim Alby
3e70546e18 rename price attributes to price_in_cents or price_in_unit
GitOrigin-RevId: 8045472c96862078583fcb522099ad78926281dc
2022-01-21 09:03:23 +00:00
Thomas
5e61fce3b4 Enable additional currencies when purchasing (or upgrading to) a group plan (#4884)
* Add script to fetch group data pricing from Recurly

* Update groups pricing data using script to fetch prices from Recurly

* Add additional currencies to saas settings

* Refactor group plans upgrade modal to use shared options from settings

GitOrigin-RevId: 6d13d5b152d01e0399f9d2b8f6f8bf99784589e8
2022-01-12 09:03:21 +00:00
James Allen
140f97eb20 Merge pull request #1107 from sharelatex/ja-purchase-groups
Purchase group/team accounts directly via app

GitOrigin-RevId: 1a502878753de77758fb431f45a6366f199f1cb0
2018-11-13 13:50:46 +00:00