Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation + OAuth instructions #315

Merged
merged 2 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,21 @@

## Install

With `npm`:

```shell
$ npm install @quiltt/core
# or
```

With `yarn`:

```shell
$ yarn add @quiltt/core
# or
```

With `pnpm`:

```shell
$ pnpm add @quiltt/core
```

Expand Down
6 changes: 6 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"directory": "packages/core"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/quiltt/quiltt-js/issues"
},
"sideEffects": [],
"type": "module",
"exports": {
Expand Down Expand Up @@ -44,6 +47,9 @@
"rimraf": "6.0.1",
"typescript": "5.7.2"
},
"tags": [
"quiltt"
],
"publishConfig": {
"access": "public"
}
Expand Down
34 changes: 25 additions & 9 deletions packages/react-native/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,31 @@

`@quiltt/react-native` expects `react`, `react-native`,`react-native-webview`, `base-64` and `react-native-url-polyfill` as peer dependencies.

With `npm`:

```shell
$ npm install base-64 react-native-webview react-native-url-polyfill
$ npm install @quiltt/react-native
# or
```

With `yarn`:

```shell
$ yarn add base-64 react-native-webview react-native-url-polyfill
$ yarn add @quiltt/react-native
# or
# Please note that you will need to add `node-linker=hoisted` in `.npmrc` if you are using pnpm in expo app.`
```

With `pnpm`:

```shell
# Make sure to add `node-linker=hoisted` to your `.npmrc` when using pnpm in an Expo app.
$ pnpm add base-64 react-native-webview react-native-url-polyfill
$ pnpm add @quiltt/react-native
```

## Documentation
For SDK documentation and more code examples, see the [React Native guide](https://www.quiltt.dev/connector/sdk/react-native).

For full SDK documentation and more code examples, see the Connector [React Native guide](https://www.quiltt.dev/connector/sdk/react-native).

### QuilttConnector

Expand All @@ -35,23 +46,28 @@ Launch the [Quiltt Connector](https://www.quiltt.dev/connector) in a webview.
```tsx
import { QuilttProvider } from '@quiltt/react'
import { QuilttConnector } from '@quiltt/react-native'
import type { ConnectorSDKCallbackMetadata } from '@quiltt/react'

export const App = () => {
// See: https://www.quiltt.dev/authentication/issuing-session-tokens
const sessionToken = '<TOKEN_OBTAINED_FROM_THE_SERVER>'
const oAuthRedirectUrl = 'quilttexample://open.reactnative.app'

const handleExitSuccess = (metadata) => {
console.log('Successfully created connection!', metadata)
// Use a universal link or deep link to redirect back to your app
const oauthRedirectUrl = 'https://myapp.com/my_universal_link'

const handleExitSuccess = (metadata: ConnectorSDKCallbackMetadata) => {
console.log('Successfully created connection!', {
connectionId: metadata.connectionId,
})
}

return (
<QuilttProvider token={sessionToken}>
<QuilttConnector
connectorId="<CONNECTOR_ID>"
oAuthRedirectUrl={oAuthRedirectUrl}
oauthRedirectUrl={oauthRedirectUrl}

// See the JavaScript API docs for the full list of available callbacks
// See the JavaScript API docs for the full list of available callbacks...
onExitSuccess={handleExitSuccess}
/>
</QuilttProvider>
Expand Down
9 changes: 8 additions & 1 deletion packages/react-native/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
{
"name": "@quiltt/react-native",
"version": "3.9.1",
"description": "React Native components for Quiltt Connector",
"description": "React Native Components for Quiltt Connector",
"homepage": "https://github.com/quiltt/quiltt-js/tree/main/packages/react-native#readme",
"repository": {
"type": "git",
"url": "https://github.com/quiltt/quiltt-js.git",
"directory": "packages/react-native"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/quiltt/quiltt-js/issues"
},
"type": "module",
"exports": {
".": {
Expand Down Expand Up @@ -55,6 +58,10 @@
"react-native-url-polyfill": "^2.0.0",
"react-native-webview": ">=13.0.0"
},
"tags": [
"quiltt",
"react-native"
],
"publishConfig": {
"access": "public"
}
Expand Down
24 changes: 18 additions & 6 deletions packages/react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,27 @@ See the guides [here](https://www.quiltt.dev/connector/sdks/react).

## Installation

With `npm`:

```shell
$ npm install @quiltt/react
# or
```

With `yarn`:

```shell
$ yarn add @quiltt/react
# or
```

With `pnpm`:

```shell
$ pnpm add @quiltt/react
```

## Core Modules and Types

The `@quiltt/react` library ships with `@quiltt/core`, which provides an Auth API and essential functionality for building Javascript-based applications with Quiltt. See the [Core README](../core/README.md) for more information.
The `@quiltt/react` library ships with `@quiltt/core`, which provides an API clients and essential functionality for building Javascript-based applications with Quiltt. See the [Core README](../core/README.md) for more information.

## React Components

Expand All @@ -38,10 +48,11 @@ By default, the rendered component will be a `<button>` element, but you can sup
```tsx
import { useState } from 'react'
import { QuilttButton } from '@quiltt/react'
import type { ConnectorSDKCallbackMetadata } from '@quiltt/react'

export const App = () => {
const [connectionId, setConnectionId] = useState<string>()
const handleExitSuccess = (metadata) => {
const handleExitSuccess = (metadata: ConnectorSDKCallbackMetadata) => {
setConnectionId(metadata?.connectionId)
}

Expand Down Expand Up @@ -71,10 +82,11 @@ By default, the rendered component will be a `<div>` element, but you can supply
```tsx
import { useState } from 'react'
import { QuilttContainer } from '@quiltt/react'
import type { ConnectorSDKCallbackMetadata } from '@quiltt/react'

export const App = () => {
const [connectionId, setConnectionId] = useState<string>()
const handleExitSuccess = (metadata) => {
const handleExitSuccess = (metadata: ConnectorSDKCallbackMetadata) => {
setConnectionId(metadata?.connectionId)
}

Expand Down Expand Up @@ -184,7 +196,7 @@ export default App

## Typescript support

`@quiltt/react` is written in Typescript and ships with its own type definitions. It also ships with the type definitions from `@quiltt/core`.
`@quiltt/react` is written in Typescript and ships with its own type definitions, as well as the type definitions from `@quiltt/core`.

## License

Expand Down
9 changes: 8 additions & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@quiltt/react",
"version": "3.9.1",
"description": "React components and hooks for Quiltt Connector",
"description": "React Components and Hooks for Quiltt Connector",
"keywords": ["quiltt", "quiltt-connector", "react", "typescript"],
"homepage": "https://github.com/quiltt/quiltt-js/tree/main/packages/react#readme",
"repository": {
Expand All @@ -10,6 +10,9 @@
"directory": "packages/react"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/quiltt/quiltt-js/issues"
},
"sideEffects": [],
"type": "module",
"exports": {
Expand Down Expand Up @@ -46,6 +49,10 @@
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
},
"tags": [
"quiltt",
"react"
],
"publishConfig": {
"access": "public"
}
Expand Down
Loading