Commit Graph

526 Commits

Author SHA1 Message Date
Rishabh
f3fd043580 Fixed non-default product prices not working
refs https://github.com/TryGhost/Team/issues/718

We passthrough any unknown price ids directly to checkout session as it currently Portal cannot verify prices across all products
2021-06-04 18:09:58 +05:30
Rishabh
ee136bc918 Fixed lint 2021-06-04 14:12:56 +05:30
Rishabh
0f4be436be Handled named plan values in portal_plans setting
refs https://github.com/TryGhost/Team/issues/753

We reverted back to using named plan values - `monthly`, `yearly` - in `portal_plans` setting to allow us to easily handle active prices for a product. This change handles the updated values in `portal_plans` to use new values.
2021-06-04 13:29:22 +05:30
Kevin
701ca69053 🐛 Fixed toggle newsletter subscription (#146)
closes https://github.com/TryGhost/Ghost/issues/12996
2021-06-01 14:27:41 +05:30
Rishabh
07f1d6d3a5 Fixed tests
no refs
2021-05-27 17:52:32 +05:30
Rishabh
0bac70c326 💡 Added resize listener for portal container height change
no refs

We need the Portal preview container on Admin to re-adjust based on height of Portal container. This change adds a resizeObserver for portal container and fires a postMessage with height for Admin to listen and update the iframe height based on height of portal container

Updated resize observer to fire on update

Cleanup
2021-05-27 17:52:32 +05:30
Rishabh
0f31838b35 Updated target origin to all for portal ready event
no refs

The purpose of broadcasting portal-ready event is it allows Preview in Admin to have better UX with showing Portal when its ready than show the site while its loading. Having a strict target origin like site url won't work when sites have custom domains as it browser security will block the event due to origin mismatch.

Since `portal-ready` is just an event message and doesn't contain any sensitive data that needs to be restricted to origin, this bumps it to `*` which allows any site listening to be able to read the message.
2021-05-27 13:39:23 +05:30
Rishabh
08d740133f Updated site and member data to load in parallel
This reverts commit 841793e4d3.
2021-05-24 19:22:07 +05:30
Rishabh
674f6f8e1e Added firing of portal-ready post message for preview""
This reverts commit 5650b8d716.
2021-05-24 19:20:32 +05:30
Rishabh
841793e4d3 Revert "Updated site and member data to load in parallel"
This reverts commit 8ac6364d3a.
2021-05-24 19:13:55 +05:30
Rishabh
5650b8d716 Revert " Added firing of portal-ready post message for preview"
This reverts commit 347805d4d0.
2021-05-24 19:13:37 +05:30
Rishabh
347805d4d0 Added firing of portal-ready post message for preview
no refs

This adds a way for top level site/admin to detect when Portal is loaded on the site and is ready to render, which allows dynamic UI handling specially in Preview mode in Admin.
2021-05-24 18:12:08 +05:30
Rishabh
8ac6364d3a Updated site and member data to load in parallel
no refs

Previously, the site and member data needed by Portal were loaded sequentially, which delayed the first load slightly as both the requests can be instead made in parallel. This change updates the API init to load both requests in parallel.
2021-05-24 18:10:48 +05:30
Peter Zimon
97fdd037ca Design refinements + fixes
- replaced invite only default icon
- removed unused function include
- reseted fixtures
2021-05-18 16:54:39 +02:00
Peter Zimon
afb3e9ad64 UI refinements
- removed cadence indicator from prices
- refined spacings for prices
2021-05-18 16:43:30 +02:00
Peter Zimon
ef10fce723 Setting site title as default title 2021-05-18 16:36:48 +02:00
Rishabh
d4fe243d43 Added signup access setting to preview
no refs

Allows Portal preview to use `members_signup_access` setting from the URL instead of relying on saved setting to change the preview without saving on Admin.
2021-05-18 17:43:18 +05:30
Rishabh
370f721deb 🐛 Fixed falsy value not used in preview
no refs

For some boolean preview keys like `allowSelfSignup` and `disableBackground`, we ignored setting the falsy value which is incorrect and doesnt' load the expected Portal preview
2021-05-18 14:55:37 +05:30
Rishabh
fd6fee4c9d 🐛 Fixed extra email sent for logged in members on upgrade
refs https://github.com/TryGhost/Team/issues/695
refs 212be5fb02 (Patch)

Currently when we have a successful Stripe checkout session, we will always send the member an email confirming their signup when using data-members-* attributes.

This is considered a bug for members who have signed up as a free member first, meaning they have already received this email. This change passes a `checkoutType` metadata same as Portal to not send the email when member is already logged in.
2021-05-18 09:19:00 +05:30
Rishabh
4e14d811bf 💡 Handled updated API response for logged out member
refs https://github.com/TryGhost/Team/issues/560
refs 196cdafe6b

The endpoint `/members/api/member/` is used by Portal for fetching member details on site load to setup different flows. The response from this endpoint for logged out member has now changed from 401 Unauthorized to 204 No Content. This updates the API handling in Portal for updated response status.

This change also handles the visible error messages on console for Portal when it first loads and tries to establish member logged-in status, and instead handles it now behind the scenes. This also makes Portal functioning more transparent on the site.
2021-05-13 15:32:32 +05:30
Rishabh
9fcad8e31d Updated default currency for free price
no refs

Since custom prices now allow prices with multiple currencies to exist, till we have a default currency for a site, we use the currency for first paid price on the list as default currency for a free price visually on Portal UI
2021-05-13 15:28:52 +05:30
Rishabh
52d52c9a9e Updated default page to signin for invite only sites
closes https://github.com/TryGhost/Team/issues/689

For invite only sites, the default page should be signin as it makes more sense and is actionable than a static signup page
2021-05-12 17:11:48 +05:30
Peter Zimon
0bbdccea72 Refined billing period indicator 2021-05-10 21:05:46 +02:00
Rishabh
4d9579e11c Added interval to prices on Plan UI
closes https://github.com/TryGhost/Team/issues/673
2021-05-11 00:07:55 +05:30
Rishabh
56756ff9b6 Fixed lint 2021-05-10 23:05:02 +05:30
Peter Zimon
280181720b Fixed modal width logic 2021-05-10 23:05:02 +05:30
Rishabh
9ac53e5b27 Fixed legacy price names link/data-attribute not working
closed https://github.com/TryGhost/Team/issues/683

The legacy price names `monthly` / `yearly` should still redirect to checkout flows as a special exception.
2021-05-10 23:05:02 +05:30
Rishabh
1ca383df5d Updated default free price fixture
refs https://github.com/TryGhost/Team/issues/648

We use sentence case everywhere for labels, the default description for free price should be the same
2021-05-10 23:05:02 +05:30
Rishabh
bc79df66e8 Added sorted prices in Portal plans UI
refs https://github.com/TryGhost/Team/issues/641

Updated prices list to be sorted on `currency` -> `amount` which is consistent with price list on Admin.
2021-05-10 23:05:02 +05:30
Rishabh
e9d8f25773 Updated old members data attribute handling for custom prices
refs https://github.com/TryGhost/Team/issues/643

With custom products and prices, the old data attributes for members functionality - `data-members-plan` - was still using the plan name for checkout session which won't work as it now expects a price ID. This change reworks how we setup to listen to `data-members-*` attributes and moves them inside App.js so they can work with API data fetched from site settings and use the price ID for the `monthly` and `yearly` names as fallback.
2021-05-10 23:05:02 +05:30
Rishabh
12500c3b95 Added fallback discount description
refs https://github.com/TryGhost/Team/issues/671

When turning on custom products, existing sites should have default price description that retains current behaviour. This change adds custom description with discount value for Yearly Plans to keep the existing behavior for sites that mimic the old setup.
2021-05-10 23:05:02 +05:30
Rishabh
9f154dbcd2 Added free price details handling
refs https://github.com/TryGhost/Team/issues/637

Since we allow setting custom name and description for free price now, this wires up the values for free membership price settings to API
2021-05-10 23:05:02 +05:30
Rishabh
b73fdf66d1 Added interval fallbacks for monthly/yearly plans
refs https://github.com/TryGhost/Team/issues/643

Previously, we always expected `Monthly` or `Yearly` prices to be available for attribtues/links as those were the only prices allowed in Portal. With custom prices, as prices can have dynamic names, we still support Monthly/Yearly prices for backwards compatibility.

The way Monthly/Yearly prices are determined with custom prices is first trying to find the first price by the name same as `Monthly` / `Yearly`, followed by finding a plan having interval `month`/`year`. This gives us the best possible window to continue supporting Monthly/Yearly till all themes have time to adapt to custom prices
2021-05-10 23:05:02 +05:30
Rishabh
815e00c761 Handled custom prices query in links/attributes
refs https://github.com/TryGhost/Team/issues/643

Previously, Portal only worked with hardcoded `Monthly` and `Yearly` plans as those were the only possible prices available to members. With custom prices and products, Portal is now expanded to work with any number of custom prices as well as allow links/attributes for them to work via IDs.

Also, to continue backwards compatibility with Monthly/Yearly, Portal will support their data attributes/links, finding the first relevant Monthly/Yearly plan by nickname, falling back on interval if needed.
2021-05-10 23:05:02 +05:30
Rishabh
811067b7a7 Added product name and description to title 2021-05-10 23:05:02 +05:30
Peter Zimon
d52f054410 Added product description to signup 2021-05-10 23:05:02 +05:30
Rishabh
3358847e78 Updated fixtures for preview mode 2021-05-10 23:05:02 +05:30
Rishabh
33308c61b5 Updated fixtures
no refs
2021-05-10 23:05:02 +05:30
Peter Zimon
fb772638b0 Refined price alignment and sizes 2021-05-10 23:05:02 +05:30
Peter Zimon
d49b3f40e7 Refined price name and value alignment 2021-05-10 23:05:02 +05:30
Peter Zimon
4260ff59a4 Updated dynamic modal width logic 2021-05-10 23:05:02 +05:30
Peter Zimon
80cd22bfaa Updated plan section styles 2021-05-10 23:05:02 +05:30
Rishabh
816560b7ce Updated preview to work in setup mode
refs https://github.com/TryGhost/Team/issues/644

In Preview mode during launch wizard in Admin, we show owners dummy Monthly/Yearly plan since the prices are not yet created but will be created if everything looks good in the next step. This change handles the dummy Monthly/yearly prices without actually having the values in DB or settings.
2021-05-10 23:05:02 +05:30
Rishabh
a7de8e9c47 Fixed tests
no refs

Updated tests to work with custom prices
2021-05-10 23:05:02 +05:30
Rishabh
53b63acf40 Cleaned up Signup and Plan pages
Cleanup Account home

Cleanup - Account Plan Page
2021-05-10 23:05:02 +05:30
Rishabh
7d43811600 Handled portal prices data from Admin 2021-05-10 23:05:02 +05:30
Rishabh
c178c60652 Updated api to use price id instead of plan name 2021-05-10 23:05:02 +05:30
Rishabh
41528e90bf Fixed current plan selection not working 2021-05-10 23:05:02 +05:30
Rishabh
92132a567c Added price change handling 2021-05-10 23:05:02 +05:30
Rishabh
4c2a6b9444 Added plan checkout 2021-05-10 23:05:02 +05:30