Commit Graph

94 Commits

Author SHA1 Message Date
Rish
9edb3d2e58 Reworded usage section in readme
Simple rewording to make usage section shorter and to point
2020-04-29 13:38:29 +05:30
Rish
87215f56a0 0.2.2 2020-04-28 23:41:52 +05:30
Rish
f237a6ee37 Updated unpkg link in readme to use latest version
no issue

Instead of pinning to specific released version, we use `@latest` for picking the last released version automatically
2020-04-28 23:41:20 +05:30
Rish
7fee47b9a7 Added yarn ship for publishing to npm/unpkg
refs https://github.com/TryGhost/members.js/issues/5

We use `yarn ship` across all our packages for publishing new versions.
2020-04-28 23:38:24 +05:30
Rish
4d99e881d7 Added basic anoymous checkout flow setup
refs https://github.com/TryGhost/members.js/issues/10

Adds happy path flow for triggering anonymous checkout from signup page when monthly or yearly plan is selected. Opens the stripe checkout session with empty email, and currently doesn't handle the success or failure redirect.
2020-04-28 23:33:22 +05:30
Rish
e0c222f25c Fixed incorrect default page load
no issue

Missed passing `member` param while fetching default page, which then always returns `signup` page even if member is signed in
2020-04-28 23:31:20 +05:30
Rish
7da315acba Switched to recommended absolute test-utils path setup
refs https://github.com/TryGhost/members.js/issues/5

Switched to using absolute path for default test-utils setup file as relative imports become too messy when we keep tests for a component next to it. This setup allows using absolute path for common test-utils file which is used in almost all tests for initial setup.
2020-04-28 23:29:56 +05:30
Rish
d83382ffb5 Allowed .env file in source control for test-utils setup
refs https://github.com/TryGhost/members.js/issues/5

- We want to allow .env in source control mainly to use react-testing-library's recommended setup for common test-utils. It uses .env file to define NODE_PATH, which helps in avoiding relative imports in tests as we keep test files next to UI components.
- CRA also by default suggests committing .env files to source control
2020-04-28 23:15:09 +05:30
Rish
c3907f24dd Fixed tests
Fixed incorrect fixtures path
2020-04-28 13:12:11 +05:30
Rish
c86550a68f Cleaned up initialization and data fetching
refs https://github.com/TryGhost/members.js/issues/5

- Streamlined data init flow
- Streamlined development mode initialization
- Moved fixtures to utils
- Removed unused or redundant methods
2020-04-28 13:08:17 +05:30
Renovate Bot
971afdf468 Update dependency eslint-plugin-ghost to v1.3.0 2020-04-28 06:14:02 +00:00
Rish
4b01a1eac9 Fixed eslint no-console error
no issue

- Throws error on signout failure instead of console log
- Disables eslint for data initialization failure to allow logging error to console
2020-04-28 10:39:04 +05:30
Renovate Bot
982c9d19ef Pin dependencies 2020-04-28 08:51:04 +05:30
Rish
197070bcfe Updated readme
Added note about adding drop-in script in code injection footer in admin
2020-04-28 01:22:44 +05:30
Rish
e7e9ceab7d Updated readme
Removes comment about explicit need for admin url not ending in trailing slash, we handle trailing slash in code now.
2020-04-28 01:12:10 +05:30
Rish
9bf219459b Updated admin url for local env
refs https://github.com/TryGhost/members.js/issues/5

- Removes `/ghost` from local development .env file
2020-04-28 01:11:12 +05:30
Rish
487bea51b2 Refactored code structure using react context
ref https://github.com/TryGhost/members.js/issues/5

React context allows us cleaner setup in codebase with shared data and methods across components at different nesting levels. This should allow faster iteration and easier development going forward.

- Uses Parent context for shared data and methods across different components instead of passed down props
- Uses new `init` method in API for data initialization
- Removes `PopupMenu` component in favor of `PopupModal`
- Adds new test util for custom render for easier base setup - https://testing-library.com/docs/react-testing-library/setup#custom-render
- Updates tests to use new test util for easier test setup
2020-04-28 01:10:08 +05:30
Rish
2214a5048b Added new parent context
refs https://github.com/TryGhost/members.js/issues/5

- Adds new parent context with default values for all common context data we want to pass through

This adds base for using contexts (https://reactjs.org/docs/context.html) in our application as that allows easier overall base data and method sharing between different components instead of passing them down
2020-04-28 01:04:30 +05:30
Rish
e8a05c252b Added init method to api
refs https://github.com/TryGhost/members.js/issues/5

- renamed default function name
- Adds `init` method to api for fetching site data and member session data together
- Update site url from site data to remove window.location.origin dependency in case of iframe
2020-04-28 00:52:21 +05:30
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