Skip to content

Commit

Permalink
feat(identity-integration): export page and app router flows
Browse files Browse the repository at this point in the history
  • Loading branch information
Nelfimov committed Sep 11, 2024
1 parent e4b343c commit ec161d8
Show file tree
Hide file tree
Showing 27 changed files with 1,087 additions and 150 deletions.
12 changes: 1 addition & 11 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ enableGlobalCache: true
globalFolder: ../.yarn/berry

yarnPath: .yarn/releases/yarn.cjs

preferReuse: true

defaultSemverRangePrefix: ''

pnpEnableEsmLoader: true
6 changes: 6 additions & 0 deletions packages/identity-integration/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Identity Integration

## BREAKING CHANGE 1.0.0

- Flow экспортируются:
- `@atls/next-identity-integration/app-router` - для `app` роутера
- `@atls/next-identity-integration/page-router` - для `pages` роутера

## BREAKING CHANGE 0.2.0

- Переход на `App Router` для `Next.JS@14`
Expand Down
25 changes: 23 additions & 2 deletions packages/identity-integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
"license": "BSD-3-Clause",
"type": "module",
"exports": {
".": "./src/index.ts"
".": "./src/index.ts",
"./package.json": "./package.json",
"./app-router": "./src/app-router.ts",
"./page-router": "./src/page-router.ts"
},
"main": "src/index.ts",
"files": [
Expand All @@ -25,7 +28,7 @@
"@types/react": "18.2.40",
"@types/react-dom": "18.2.10",
"@types/tldjs": "2.3.4",
"axios": "1.5.1",
"axios": "1.7.7",
"next": "14.2.9",
"react": "18.3.1",
"react-dom": "18.3.1"
Expand All @@ -36,6 +39,24 @@
},
"publishConfig": {
"access": "public",
"exports": {
"./package.json": "./package.json",
".": {
"import": "./dist/index.js",
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./app-router": {
"import": "./dist/app-router.js",
"types": "./dist/app-router.d.ts",
"default": "./dist/app-router.js"
},
"./page-router": {
"import": "./dist/page-router.js",
"types": "./dist/page-router.d.ts",
"default": "./dist/page-router.js"
}
},
"main": "dist/index.js",
"typings": "dist/index.d.ts"
},
Expand Down
1 change: 1 addition & 0 deletions packages/identity-integration/src/app-router.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './flows-app-router/index.js'
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { FlowError } from '@ory/kratos-client'
import { AxiosError } from 'axios'
import { PropsWithChildren } from 'react'
import { FC } from 'react'
import { useRouter } from 'next/navigation.js'
import { useSearchParams } from 'next/navigation.js'
import { useState } from 'react'
import { useEffect } from 'react'
import React from 'react'

import { ErrorProvider } from '../providers/index.js'
import { useKratosClient } from '../providers/index.js'
import type { FlowError } from '@ory/kratos-client'
import type { AxiosError } from 'axios'
import type { PropsWithChildren } from 'react'
import type { FC } from 'react'

import { useRouter } from 'next/navigation.js'
import { useSearchParams } from 'next/navigation.js'
import { useState } from 'react'
import { useEffect } from 'react'
import React from 'react'

import { ErrorProvider } from '../providers/index.js'
import { useKratosClient } from '../providers/index.js'

export interface ErrorErrorProps {
returnToUrl?: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import { UpdateLoginFlowBody } from '@ory/kratos-client'
import { LoginFlow as KratosLoginFlow } from '@ory/kratos-client'
import { AxiosError } from 'axios'
import { PropsWithChildren } from 'react'
import { FC } from 'react'
import { useSearchParams } from 'next/navigation.js'
import { useRouter } from 'next/navigation.js'
import { useState } from 'react'
import { useEffect } from 'react'
import { useMemo } from 'react'
import { useCallback } from 'react'
import React from 'react'

import { FlowProvider } from '../providers/index.js'
import { ValuesProvider } from '../providers/index.js'
import { ValuesStore } from '../providers/index.js'
import { SubmitProvider } from '../providers/index.js'
import { useKratosClient } from '../providers/index.js'
import { handleFlowError } from './handle-errors.util.js'
import type { UpdateLoginFlowBody } from '@ory/kratos-client'
import type { LoginFlow as KratosLoginFlow } from '@ory/kratos-client'
import type { AxiosError } from 'axios'
import type { PropsWithChildren } from 'react'
import type { FC } from 'react'

import { useSearchParams } from 'next/navigation.js'
import { useRouter } from 'next/navigation.js'
import { useState } from 'react'
import { useEffect } from 'react'
import { useMemo } from 'react'
import { useCallback } from 'react'
import React from 'react'

import { FlowProvider } from '../providers/index.js'
import { ValuesProvider } from '../providers/index.js'
import { ValuesStore } from '../providers/index.js'
import { SubmitProvider } from '../providers/index.js'
import { useKratosClient } from '../providers/index.js'
import { handleFlowError } from './handle-errors.util.js'

export interface LoginFlowProps {
onError?: (error: { id: string }) => void
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { LogoutFlow as KratosLogoutFlow } from '@ory/kratos-client'
import { AxiosError } from 'axios'
import { PropsWithChildren } from 'react'
import { FC } from 'react'
import { useSearchParams } from 'next/navigation.js'
import { useRouter } from 'next/navigation.js'
import { useState } from 'react'
import { useEffect } from 'react'
import React from 'react'

import { useKratosClient } from '../providers/index.js'
import type { LogoutFlow as KratosLogoutFlow } from '@ory/kratos-client'
import type { AxiosError } from 'axios'
import type { PropsWithChildren } from 'react'
import type { FC } from 'react'

import { useSearchParams } from 'next/navigation.js'
import { useRouter } from 'next/navigation.js'
import { useState } from 'react'
import { useEffect } from 'react'
import React from 'react'

import { useKratosClient } from '../providers/index.js'

interface LogoutFlowProps {
returnToUrl?: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import { UpdateRecoveryFlowBody } from '@ory/kratos-client'
import { RecoveryFlow as KratosRecoveryFlow } from '@ory/kratos-client'
import { AxiosError } from 'axios'
import { PropsWithChildren } from 'react'
import { FC } from 'react'
import { useSearchParams } from 'next/navigation.js'
import { useRouter } from 'next/navigation.js'
import { useState } from 'react'
import { useEffect } from 'react'
import { useMemo } from 'react'
import { useCallback } from 'react'
import React from 'react'

import { FlowProvider } from '../providers/index.js'
import { ValuesProvider } from '../providers/index.js'
import { ValuesStore } from '../providers/index.js'
import { SubmitProvider } from '../providers/index.js'
import { useKratosClient } from '../providers/index.js'
import { handleFlowError } from './handle-errors.util.js'
import type { UpdateRecoveryFlowBody } from '@ory/kratos-client'
import type { RecoveryFlow as KratosRecoveryFlow } from '@ory/kratos-client'
import type { AxiosError } from 'axios'
import type { PropsWithChildren } from 'react'
import type { FC } from 'react'

import { useSearchParams } from 'next/navigation.js'
import { useRouter } from 'next/navigation.js'
import { useState } from 'react'
import { useEffect } from 'react'
import { useMemo } from 'react'
import { useCallback } from 'react'
import React from 'react'

import { FlowProvider } from '../providers/index.js'
import { ValuesProvider } from '../providers/index.js'
import { ValuesStore } from '../providers/index.js'
import { SubmitProvider } from '../providers/index.js'
import { useKratosClient } from '../providers/index.js'
import { handleFlowError } from './handle-errors.util.js'

export interface RecoveryFlowProps {
onError?: (error: { id: string }) => void
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
import { Identity } from '@ory/kratos-client'
import { UpdateRegistrationFlowBody } from '@ory/kratos-client'
import { RegistrationFlow as KratosRegistrationFlow } from '@ory/kratos-client'
import { ContinueWith as KratosContinueWith } from '@ory/kratos-client'
import { UiNodeInputAttributes } from '@ory/kratos-client'
import { AxiosError } from 'axios'
import { PropsWithChildren } from 'react'
import { FC } from 'react'
import { useSearchParams } from 'next/navigation.js'
import { useRouter } from 'next/navigation.js'
import { useState } from 'react'
import { useEffect } from 'react'
import { useMemo } from 'react'
import { useCallback } from 'react'
import React from 'react'

import { FlowProvider } from '../providers/index.js'
import { ValuesProvider } from '../providers/index.js'
import { ValuesStore } from '../providers/index.js'
import { SubmitProvider } from '../providers/index.js'
import { useKratosClient } from '../providers/index.js'
import { handleFlowError } from './handle-errors.util.js'
import type { Identity } from '@ory/kratos-client'
import type { UpdateRegistrationFlowBody } from '@ory/kratos-client'
import type { RegistrationFlow as KratosRegistrationFlow } from '@ory/kratos-client'
import type { ContinueWith as KratosContinueWith } from '@ory/kratos-client'
import type { UiNodeInputAttributes } from '@ory/kratos-client'
import type { AxiosError } from 'axios'
import type { PropsWithChildren } from 'react'
import type { FC } from 'react'

import { useSearchParams } from 'next/navigation.js'
import { useRouter } from 'next/navigation.js'
import { useState } from 'react'
import { useEffect } from 'react'
import { useMemo } from 'react'
import { useCallback } from 'react'
import React from 'react'

import { FlowProvider } from '../providers/index.js'
import { ValuesProvider } from '../providers/index.js'
import { ValuesStore } from '../providers/index.js'
import { SubmitProvider } from '../providers/index.js'
import { useKratosClient } from '../providers/index.js'
import { handleFlowError } from './handle-errors.util.js'

export interface RegistrationFlowProps {
onError?: (error: { id: string }) => void
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import { UpdateSettingsFlowBody } from '@ory/kratos-client'
import { SettingsFlow as KratosSettingsFlow } from '@ory/kratos-client'
import { AxiosError } from 'axios'
import { PropsWithChildren } from 'react'
import { FC } from 'react'
import { useSearchParams } from 'next/navigation.js'
import { useRouter } from 'next/navigation.js'
import { useState } from 'react'
import { useEffect } from 'react'
import { useMemo } from 'react'
import { useCallback } from 'react'
import React from 'react'

import { FlowProvider } from '../providers/index.js'
import { ValuesProvider } from '../providers/index.js'
import { ValuesStore } from '../providers/index.js'
import { SubmitProvider } from '../providers/index.js'
import { useKratosClient } from '../providers/index.js'
import { handleFlowError } from './handle-errors.util.js'
import type { UpdateSettingsFlowBody } from '@ory/kratos-client'
import type { SettingsFlow as KratosSettingsFlow } from '@ory/kratos-client'
import type { AxiosError } from 'axios'
import type { PropsWithChildren } from 'react'
import type { FC } from 'react'

import { useSearchParams } from 'next/navigation.js'
import { useRouter } from 'next/navigation.js'
import { useState } from 'react'
import { useEffect } from 'react'
import { useMemo } from 'react'
import { useCallback } from 'react'
import React from 'react'

import { FlowProvider } from '../providers/index.js'
import { ValuesProvider } from '../providers/index.js'
import { ValuesStore } from '../providers/index.js'
import { SubmitProvider } from '../providers/index.js'
import { useKratosClient } from '../providers/index.js'
import { handleFlowError } from './handle-errors.util.js'

export interface SettingsFlowProps {
onError?: (error: { id: string }) => void
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
/* eslint-disable default-case */

import { UpdateVerificationFlowBody } from '@ory/kratos-client'
import { VerificationFlow as KratosVerificationFlow } from '@ory/kratos-client'
import { AxiosError } from 'axios'
import { PropsWithChildren } from 'react'
import { FC } from 'react'
import { useSearchParams } from 'next/navigation.js'
import { useRouter } from 'next/navigation.js'
import { useState } from 'react'
import { useEffect } from 'react'
import { useMemo } from 'react'
import { useCallback } from 'react'
import React from 'react'

import { FlowProvider } from '../providers/index.js'
import { ValuesProvider } from '../providers/index.js'
import { ValuesStore } from '../providers/index.js'
import { SubmitProvider } from '../providers/index.js'
import { useKratosClient } from '../providers/index.js'
import type { UpdateVerificationFlowBody } from '@ory/kratos-client'
import type { VerificationFlow as KratosVerificationFlow } from '@ory/kratos-client'
import type { AxiosError } from 'axios'
import type { PropsWithChildren } from 'react'
import type { FC } from 'react'

import { useSearchParams } from 'next/navigation.js'
import { useRouter } from 'next/navigation.js'
import { useState } from 'react'
import { useEffect } from 'react'
import { useMemo } from 'react'
import { useCallback } from 'react'
import React from 'react'

import { FlowProvider } from '../providers/index.js'
import { ValuesProvider } from '../providers/index.js'
import { ValuesStore } from '../providers/index.js'
import { SubmitProvider } from '../providers/index.js'
import { useKratosClient } from '../providers/index.js'

export interface VerificationFlowProps {
onError?: (error: { id: string }) => void
Expand Down
Loading

0 comments on commit ec161d8

Please sign in to comment.