-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
15 changed files
with
246 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
lib | ||
example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
module.exports = { | ||
env: { | ||
es6: true, | ||
node: true, | ||
browser: true, | ||
}, | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
ecmaVersion: 2022, | ||
sourceType: 'module', | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
plugins: ['@typescript-eslint', 'react'], | ||
extends: [ | ||
'eslint:recommended', | ||
'prettier', | ||
'plugin:@typescript-eslint/eslint-recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:react/recommended', | ||
], | ||
rules: { | ||
'no-console': ['error', { allow: ['warn', 'error', 'time'] }], | ||
'react/jsx-pascal-case': 2, | ||
'react/no-multi-comp': 2, | ||
'react/prefer-es6-class': 2, | ||
'react/prefer-stateless-function': 2, | ||
'@typescript-eslint/no-var-requires': 0, | ||
'@typescript-eslint/no-unused-vars': [ | ||
'error', | ||
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' }, | ||
], | ||
'@typescript-eslint/no-empty-function': 0, | ||
'@typescript-eslint/no-explicit-any': 0, | ||
'@typescript-eslint/naming-convention': [ | ||
'error', | ||
{ | ||
selector: 'variableLike', | ||
format: ['camelCase', 'PascalCase'], | ||
}, | ||
{ | ||
selector: 'variable', | ||
modifiers: ['destructured'], | ||
format: null, | ||
}, | ||
], | ||
'no-undef': 'error', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
name: Bug report | ||
about: Report a bug or issue to help us improve | ||
title: '' | ||
labels: bug | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Describe the bug** | ||
A clear and concise description of what the bug is. | ||
|
||
**To Reproduce** | ||
Some steps involved to reproduce the bug and any code samples you can share. | ||
``` | ||
// Helps us with reproducing the error :) | ||
``` | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**SDK Version:** | ||
Providing the SDK version can help with the reproduction of the issue and to know if a change could have broken something. | ||
|
||
**Additional context** | ||
Add any other context about the problem here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea for this project | ||
title: '' | ||
labels: enhancement | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] | ||
|
||
**Describe the solution you'd like** | ||
A clear and concise description of what you want to happen. | ||
|
||
**Describe alternatives you've considered** | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
|
||
**Additional context** | ||
Add any other context or screenshots about the feature request here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Description | ||
<!-- Add information about what your PR achieves --> | ||
|
||
# Usage | ||
<!-- If your PR brings a new feature or a change to how you use the SDK, show it off here! --> | ||
```typescript jsx | ||
// Adding a code snippet also helps if it makes sense to do so :) | ||
``` | ||
|
||
# License | ||
I confirm that this contribution is made under the terms of the MIT license and that I have the authority necessary to make this contribution on behalf of its copyright owner. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Pull Request | ||
on: | ||
# Trigger the workflow on push or pull request, | ||
# but only for the main branch | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
checks: | ||
runs-on: ubuntu-latest | ||
name: Lint and check code styling | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup Nodejs ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 16 | ||
|
||
- name: Install dependencies and build | ||
run: npm install | ||
|
||
- name: Run lint checks | ||
run: npm run lint:ci | ||
|
||
- name: Run prettier checks | ||
run: npm run lint:prettier:check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
lib | ||
example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"semi": true, | ||
"trailingComma": "es5", | ||
"singleQuote": true, | ||
"printWidth": 80 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Changelog | ||
|
||
### 0.1.0 / TBD | ||
* Initial release of the Nylas React SDK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Contribute to Nylas | ||
👍🎉 First off, thanks for taking the time to contribute! 🎉👍 | ||
|
||
The following is a set of guidelines for contributing to the Nylas JavaScript SDK; these are guidelines, not rules, so please use your best judgement and feel free to propose changes to this document via pull request. | ||
|
||
## How to Ask a Question | ||
|
||
If you have a question about how to use the JavaScript SDK, please [create an issue](https://github.com/nylas/nylas-js/issues) and label it as a question. If you have more general questions about the Nylas Communications Platform, or the Nylas Email, Calendar, and Contacts API, please reach out to [email protected] to get help. | ||
|
||
## How To Contribute | ||
### Report a Bug or Request a Feature | ||
|
||
If you encounter any bugs while using this software, or want to request a new feature or enhancement, please [create an issue](https://github.com/nylas/nylas-js/issues) to report it, and make sure you add a label to indicate what type of issue it is. | ||
|
||
### Contribute Code | ||
|
||
Pull requests are welcome for bug fixes. If you want to implement something new, [please request a feature](https://github.com/nylas/nylas-js/issues) first so we can discuss it. | ||
|
||
While writing your code contribution, make sure you lint your code by running: | ||
|
||
`npm run lint` | ||
|
||
and apply our code styling standards: | ||
|
||
`npm run lint:prettier` | ||
|
||
To use the package during local development, symlink the directory: | ||
|
||
`npm link` in the `nylas-js` directory | ||
`npm link @nylas/nylas-js` in the directory with your code that uses the package | ||
|
||
### Creating a Pull Request | ||
|
||
When your code is ready to be submitted, you can [submit a pull request](https://help.github.com/articles/creating-a-pull-request/) to begin the code review process. Please ensure to title it appropriately with a nice, quick summary of what the PR is achieving. We've also provided a [template for pull requests](pull_request_template.md) as a guide. | ||
|
||
All PRs from contributors that aren't employed by Nylas must contain the following text in the PR description: "I confirm that this contribution is made under the terms of the MIT license and that I have the authority necessary to make this contribution on behalf of its copyright owner." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
The MIT License (MIT) | ||
---- | ||
|
||
Copyright (c) 2014-2015 InboxApp, Inc. and Contributors | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
export { | ||
default as NylasContainer, | ||
NylasContainerOptions | ||
NylasContainerOptions, | ||
} from './nylas-container'; | ||
export { | ||
default as NylasContext, | ||
NylasContextInterface, | ||
useNylas | ||
useNylas, | ||
} from './nylas-context'; | ||
export { | ||
NylasProps, | ||
AuthUrlOptions, | ||
ExchangeCodeOptions | ||
} from '@nylas/nylas-js'; | ||
ExchangeCodeOptions, | ||
} from '@nylas/nylas-js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
import * as React from 'react'; | ||
import Nylas, {AuthUrlOptions, ExchangeCodeOptions} from "@nylas/nylas-js"; | ||
import Nylas, { AuthUrlOptions, ExchangeCodeOptions } from '@nylas/nylas-js'; | ||
|
||
export interface NylasContextInterface { | ||
client: Nylas; | ||
authState: boolean; | ||
authWithRedirect(opts: AuthUrlOptions): Promise<void|boolean>; | ||
exchangeCodeFromUrlForToken(opts?: ExchangeCodeOptions): Promise<string | boolean>; | ||
authWithRedirect(opts: AuthUrlOptions): Promise<void | boolean>; | ||
exchangeCodeFromUrlForToken( | ||
opts?: ExchangeCodeOptions | ||
): Promise<string | boolean>; | ||
} | ||
|
||
const NylasContext = React.createContext<NylasContextInterface | null>(null); | ||
|
||
export const useNylas = (): NylasContextInterface => React.useContext(NylasContext) as NylasContextInterface; | ||
export const useNylas = (): NylasContextInterface => | ||
React.useContext(NylasContext) as NylasContextInterface; | ||
|
||
export default NylasContext; | ||
export default NylasContext; |