Commit Graph

1425 Commits

Author SHA1 Message Date
Rish
ead29b9e23 Fixed account button action logging out
no issue

Account button was incorrectly mapped to logout action, adds a temp no-op action for account area
2020-04-27 15:39:02 +05:30
Rish
1a29d0926e Added render tests for common components
no issue

- Adds tests for ActionButton and InputField components
2020-04-27 15:37:48 +05:30
Rish
eb4ed70303 Added id and aria-label values for input field component
no issue

- Adds `aria-label` on input fields and id for label's `for` to map to form control
- Fixes tests
2020-04-27 14:09:12 +05:30
Rish
c53654d89b Updated pages to use common components
no issue

- Updates Signin page to use common ActionButton and Input component
- Updates Signup page to use common ActionButton and Input component
- Updates MagicLink page to use common ActionButton component
2020-04-27 13:51:25 +05:30
Rish
100bfa7b5b Extracted common Input and Button components
no issue

- Add new InputField common component for input fields with label
- Add new ActionButton common component for action <button>
2020-04-27 13:49:59 +05:30
Rish
61de34aac8 Updated readme
Fixed CI status badge
2020-04-27 11:53:18 +05:30
Rish
4565cfb646 Update readme
Bump unpkg version to 0.2.1
2020-04-23 21:21:09 +05:30
Rish
3baffcc3e6 0.2.1 2020-04-23 21:19:23 +05:30
Rish
c44241e27d Fixed signup with email not working on free plan
closes https://github.com/TryGhost/members.js/issues/16

This fix sends magic link to member when they choose free plan to signup using name and email.

Note: We are not storing `name` atm in magic link, so it gets ignored in actual member data on signup atm.
2020-04-23 21:18:34 +05:30
Rish
1fdc514c1f Fixed token handling in url for magic-link
closes https://github.com/TryGhost/members.js/issues/14

This adds handling of url update when signing-in with magic link by removing the token query param, which can cause accidental re-login on refresh.
2020-04-23 20:46:14 +05:30
Rish
72b8a376c6 Updated readme
Updated unpkg link to point to correct version
2020-04-23 18:02:43 +05:30
Rish
067fc9a1bd v0.2.0 2020-04-23 17:58:12 +05:30
Rish
1a97c7d161 Updated readme
Updated reference to admin url needed for initialization as api domain, same as used by other api clients.
2020-04-23 17:57:41 +05:30
Rish
c1a5c67e37 Refactored API setup and admin url initialization
refs https://github.com/TryGhost/members.js/issues/6

- Refactored API util to be more consistent with existing API SDKs
- Updated init method to expect admin url same as other SDKs
2020-04-23 17:54:21 +05:30
Rish
c58f29f1a9 Updated readme to tag latest unpkg version in script
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.
2020-04-23 13:56:09 +05:30
Rish
884e197cca v0.1.1 2020-04-23 13:03:17 +05:30
Rish
f79d022909 Fixed lint 2020-04-23 12:59:47 +05:30
Rish
2cf40fa6b8 Updated readme
Updated example admin url value for local setup
2020-04-23 12:59:26 +05:30
Rish
e999bcd146 Fixed tests
no issue
2020-04-23 12:59:08 +05:30
Rish
93a14eea2e Renamed script init method
refs https://github.com/TryGhost/members.js/issues/6

- Renames script initialization method from `initMembersJS` to simply `init`
- Updates readme
2020-04-23 12:51:51 +05:30
Rish
0a5e0648c8 Refactored fixutres data for site and member
refs https://github.com/TryGhost/members.js/issues/10

Refactored to include free member data and added dummy data for testing
2020-04-23 12:43:28 +05:30
Rish
275655584e Refactored UI structure and component naming
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
2020-04-23 12:42:55 +05:30
Rish
b50abb5ad2 Fixed firefox iframe append issue
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
2020-04-22 19:39:06 +05:30
Rish
e7973cf37a Updated Readme
Fixed init method
2020-04-21 15:18:12 +05:30
Rish
e36b6a8ae5 Updated readme 2020-04-21 14:51:16 +05:30
Rish
c05f3916c0 Updated readme
Cleaned up usage instructions
2020-04-21 11:17:23 +05:30
Rish
5eaa243003 Updated readme
Updates admin url format for initialization
2020-04-20 23:37:44 +05:30
Rish
86340abdc7 Updated Readme
Added Usage section
2020-04-20 23:26:55 +05:30
Rish
0539c543a7 Updated Readme 2020-04-20 23:03:24 +05:30
Rish
0b7707fe7a Added initial dom element insertion in init
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.
2020-04-20 22:44:47 +05:30
Rish
88d8008bcf Updated Readme 2020-04-20 22:12:30 +05:30
Rish
e59e8186bd Cleaned up script intiailization data
refs https://github.com/TryGhost/members.js/issues/6

Removes all data initialization setup except `adminUrl` as we now fetch everything directly from API
2020-04-20 22:12:08 +05:30
Rish
028139a0e1 Updated build and publish setup for unpkg deployment
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
2020-04-20 22:10:58 +05:30
Rish
89a1cab4c1 Fixed lint for webpack config
no issue
2020-04-20 11:57:14 +05:30
Rish
f529959b78 Updated data initialization for member
refs https://github.com/TryGhost/members.js/issues/6

Updates member data initialization through API method instead of using data passed through from theme.
2020-04-20 11:57:14 +05:30
Rish
aafc228ffd Added method to fetch member data from session
refs https://github.com/TryGhost/members.js/issues/6

Adds method to fetch member's data in exchange of identity/session for data initialization
2020-04-20 11:57:14 +05:30
Renovate Bot
b71104b1de Update dependency eslint-plugin-ghost to v1.2.0 2020-04-17 11:14:03 +00:00
Rish
066ec7fcae Added site data initilization through APIs
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.
2020-04-17 14:53:10 +05:30
Rish
0c0e1069ae Added member identity and site data APIs
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.
2020-04-17 14:50:18 +05:30
Rish
4ba70683a8 Added new basic Loading page for data init
We want to show some kind of loading state till we fetch initial site or member data to load the relevant page
2020-04-17 14:46:55 +05:30
Rish
bf901c99cd Added action tests for SIgnup page
Adds test to check actions for signing up with name, email, plan and switching to signin page
2020-04-16 14:30:02 +05:30
Rish
4789f473e3 Added action tests for Account Page
Adds signout button test for account page
2020-04-16 14:20:04 +05:30
Rish
22bee293bc Added action tests to Signin page
Adds tests for send magic link and subscribe button actions
2020-04-16 14:13:37 +05:30
Rish
117a27f86b Setup render tests for components
Adds basic rendering test for all components/pages for expected outputs
2020-04-16 12:21:49 +05:30
Rish
909eb16ced Fixed basic top-level App test 2020-04-15 21:15:56 +05:30
Rish
5b18b464d1 Initialized script with plans
Added default plans value on init for testing
2020-04-14 12:42:35 +05:30
Rish
4d71056e12 Handled empty plans for site
[Temp] Hide the plans section if plans are not present
2020-04-14 12:42:35 +05:30
Rish
f727fdd1ed Refactored Parent pages to use pages
Refactors Parent and Popup-menu pages to load different pages as per UI flows and pass necessary data and actions down to UI components.
2020-04-14 12:42:35 +05:30
Rish
3cbe8d6f0c Added new Signin/Signup/MagicLink pages
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
2020-04-14 12:42:35 +05:30
Rish
582bc46176 Removed unused name prop in App 2020-04-14 12:42:35 +05:30
Rish
768af49ebd Updated members api to return promise
This allows controlling UI state for API actions using async/await
2020-04-14 12:42:35 +05:30
Daniel Lockyer
41303348bb Updated Renovate config
no issue
2020-04-13 10:46:29 +01:00
Renovate Bot
2788eccd49 Add renovate.json 2020-04-13 10:46:29 +01:00
Rish
8be660def0 Updated local dev env configuration
- Use local dev config only for development mode
- `.env.local` by default gets triggered for production builds as well, unlike `.env.development.local`
2020-04-13 13:09:15 +05:30
Hannah Wolfe
c3d13f2451 Added local dev env configuration
- call init by default if there's an env var for ADMIN_URL
- add an example local dev config
2020-04-10 17:41:16 +01:00
Hannah Wolfe
e9a193445d Swapped blog -> site
- this is our preferred wording
2020-04-10 16:52:29 +01:00
Hannah Wolfe
af543c0cc9 Added basic github workflow for running tests
- copied from https://github.com/TryGhost/billing-management/blob/master/.github/workflows/test.yml
2020-04-10 16:42:25 +01:00
Hannah Wolfe
4c358d2cec Added ghost browser ESLint config and fixed errors
- 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
2020-04-10 16:32:37 +01:00
Hannah Wolfe
4f1c95edb8 Removed service worker code
- I don't think it will ever be appropriate to use a service worker in our widget context
2020-04-10 16:30:21 +01:00
Rish
d6bad7132f Updated welcome text for signin/signup
no issue
2020-04-09 13:56:47 +05:30
Rish
0615d54505 Added handling for custom trigger button in theme
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.
2020-04-09 13:54:49 +05:30
Rish
4310a18150 Added basic signup/signin UI flow
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
2020-04-08 22:37:50 +05:30
Rish
f7f683bfc0 Removed default initialization for members script
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.
2020-04-08 22:34:38 +05:30
Rish
bab35b3637 Added util to handle members-api/ssr requests
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.
2020-04-08 22:32:58 +05:30
Peter Zimon
93a634ce5f Added basic styles
no refs.
- added icon for trigger button open/close state to indicate account menu
- updated style of trigger button for better contrast
- updated base font style and size for html and body to access global typographic styles
2020-04-06 11:25:04 +02:00
Rish
b782048421 Added default initialization for local development
no issue
2020-04-02 17:06:22 +05:30
Rish
f4f5a8331d Updated app flow to use external members data
no issue

- Wraps the react rendering initialisation in a function which is accessed by theme to render the members UI as needed
- Uses site logo and logged in member email for rendering
2020-04-02 13:48:54 +05:30
Rish
ee3fd5a18e Updated Frame component to a simpler version
no issue

Makes frame component more efficient and easier to understand
2020-04-02 13:48:54 +05:30
Hannah Wolfe
4ddddabe85 Added linting scripts
- Incorrectly assumed this was automatically part of `react-scripts test`.
2020-04-01 12:43:42 +01:00
Rish
31b80d8270 Added new Frame Component for iframe encapsulation
no issue

- Adds new FrameComponent which allows encapsulating any React Component inside Iframe directly
- Wraps the Popup and Trigger components inside frame components to be rendered inside iframe
2020-03-31 13:51:48 +05:30
Rish
3dca602545 Added trigger and popup UI components - v1
no issue

- Adds new components for membersJs trigger button and popup menu with style
- Adds basic trigger interaction between trigger button and popup menu
- Uses hardcoded member values
- Adds `prop-types` dependency
2020-03-30 19:05:35 +05:30
Rish
f761672e32 Updated Readme 2020-03-30 19:02:19 +05:30
Rish
c23a80e6f0 Updated build process for single minified script
no issue

By default, CRAs build process creates chunked script files and adds them to default index.html. The updated build process uses `rewire` and `webpack` to -

- Tweak CRAs default behavior by switching off chunking, which leads to a single script
- Uses webpack locally to combine JS and CSS built by above step into a single `bundle.min.js`
2020-03-24 18:49:04 +05:30
Rish
1b91730c48 Initial commit 2020-03-24 18:37:38 +05:30
Rish
4ff29d2735 Initialize project using Create React App 2020-03-24 18:37:04 +05:30