Unpkg recommends tagging exact version in the url to avoid redirects and faster load times. Also ensures the init script is in sync with the unpkg version being picked up in case of any changes.
refs https://github.com/TryGhost/members.js/issues/10
- Added `/page` in components to structure all UI page flows for the app
- Renamed components to highlight just actual purpose/utility
- Cleaned up data loading flow
no issue
Firefox doesn't allow adding content to iframe body without passing `srcDoc={`<!DOCTYPE html>` to the iframe, this allows iframe to load properly
no issue
Previously, we expected theme to include an empty div with id as `root` where we loaded our widget. This change automatically adds a root div to the document and renders widget inside it.
refs https://github.com/TryGhost/members.js/issues/12
- Updates package name and add umd/unpkg setup in `package.json`
- Updated webpack config to publish minified bundle at `umd/memebrs.min.js`
- Updated .gitignore to remove build folders
refs https://github.com/TryGhost/members.js/issues/6
Use member identity and public site data admin API to fetch site data which was previously being passed down from the theme. This change allows us to be directly fetch all relevant site data except adminUrl and use it to initialize the flows.
Also adds a basic loading behavior till we finish fetching site and member logged-in data from API.
refs https://github.com/TryGhost/members.js/issues/6
To self-contain all the data needs for members.js, we load the site data and member's logged in state using available APIs instead of passing them down the theme
- Member Identity API uses member cookie and `/ssr` endpoint to identify if a member is currently logged in or not
- Site data API is the public admin API endpoint for fetching public site data like title, description, logo, brand etc.
Added new pages for different UI flows
- Sign-in Page: Allow member to signin with magic link
- Signup Page: Allow member to signup with name + email, also allow choosing plan in checkout
- Signed-in Page: Default account page if member is signed in
- Magic Link Page: Info page which shows magic link is sent to inbox
- Use local dev config only for development mode
- `.env.local` by default gets triggered for production builds as well, unlike `.env.development.local`
- added eslint-plugin-ghost, extended ghost/browser config & fixed all the issues
- did this because basic things like indent, quotes and semi-colons weren't being enforced resulting in inconsistencies
- we can customise this or create a ghost/react if desired
refs https://github.com/TryGhost/membersjs/issues/8
This allows theme developers to use a custom trigger button in their theme instead of default UI created by script by marking the custom button with data attribute - `data-members-trigger-button` .
In case of a custom trigger button, CRA doesn't render the default trigger button and attaches click event handling to the custom button to control the popup UI. Script also adds new custom class `popup-open` and `popup-close` based on popup state to allow theme developers to handle button UI based on popup state.
refs https://github.com/TryGhost/membersjs/issues/3
Adds signup/signin flow to theme when no member is logged in, uses api utils to send magic-link to member's email which can be used to signup/signin
no issue
We need to initialize members script with data passed down from the theme atm, the default initialization is only useful for quick local testing and UI development but not when script is used directly inside a theme.
refs https://github.com/TryGhost/membersjs/issues/2
We need to make requests to members Admin API and SSR endpoints to handle member's session on theme, send magic-link on email and also for using stripe checkout. This adds a small util that wraps all such external requests for use in CRA UI based on user action
Note: The util setup needs `blogUrl` and `adminUrl` values to setup the API endpoints, which we currently pass from the theme. This might change in immediate future based on how we decide to get these values in CRA script.