Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
594310b
chore: update yarn bundle
OsirisAnubiz Oct 15, 2024
00dcbfd
style(upload): reorder fields in package.json
OsirisAnubiz Oct 15, 2024
c3613af
chore: change husky config
OsirisAnubiz Oct 15, 2024
d976de3
style: fix lint kratos browser flows
OsirisAnubiz Oct 18, 2024
b51fb43
style: fix lint react user package
OsirisAnubiz Oct 18, 2024
efd4513
style: fix lint react app links package
OsirisAnubiz Oct 18, 2024
1b01893
style: fix lint react identity links package
OsirisAnubiz Oct 18, 2024
72e12c9
style: fix lint react react identity user provider package
OsirisAnubiz Oct 18, 2024
28c19d2
style: fix lint payment widget
OsirisAnubiz Oct 22, 2024
afb7f01
style: complete api auth user fix lint
OsirisAnubiz Oct 22, 2024
6801334
style: fix lint upload package
OsirisAnubiz Oct 22, 2024
939a85f
chore: recorded events package version
OsirisAnubiz Oct 22, 2024
e820768
chore: unused libraries removed
OsirisAnubiz Oct 22, 2024
32fce34
chore: recorded types events package version
OsirisAnubiz Oct 22, 2024
4528446
chore: recorded axios package version
OsirisAnubiz Oct 22, 2024
e461fea
chore: recorded react package version
OsirisAnubiz Oct 22, 2024
b41205c
chore: recorded react dom package version
OsirisAnubiz Oct 22, 2024
a52ba06
chore: add package extension for atls ui parts text
OsirisAnubiz Oct 22, 2024
6bb14f8
chore: add package extension for emotion utils
OsirisAnubiz Oct 22, 2024
8352005
chore: bump packages versions
OsirisAnubiz Oct 22, 2024
f0e53c0
fix: package version
OsirisAnubiz Oct 22, 2024
12b9a8a
fix: dependency atls react user package version
OsirisAnubiz Oct 22, 2024
987d4c3
fix: yarn lock file
OsirisAnubiz Oct 22, 2024
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
5 changes: 1 addition & 4 deletions .config/husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn commit message lint
yarn commit message lint
5 changes: 1 addition & 4 deletions .config/husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn commit staged
yarn commit staged
5 changes: 1 addition & 4 deletions .config/husky/prepare-commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn commit message $@
yarn commit message $@
48 changes: 43 additions & 5 deletions .pnp.cjs

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

1,160 changes: 556 additions & 604 deletions .yarn/releases/yarn.cjs

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ packageExtensions:
dependencies:
jest: '*'
typescript: 4.6.2

'@atls-ui-parts/text@*':
dependencies:
'@types/styled-system': '*'
'@emotion/utils@*':
dependencies:
'@emotion/sheet': '*'
preferReuse: true

yarnPath: .yarn/releases/yarn.cjs
4 changes: 2 additions & 2 deletions packages/api-auth-user/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@atls/react-api-auth-user",
"version": "0.0.5",
"version": "0.0.6",
"license": "BSD 3-Clause",
"main": "src/index.ts",
"files": [
Expand All @@ -12,7 +12,7 @@
"postpack": "rm -rf dist"
},
"devDependencies": {
"@atls/react-user": "workspace:0.1.44",
"@atls/react-user": "workspace:0.1.45",
"@types/react": "18.3.6",
"react": "^18.2.0"
},
Expand Down
28 changes: 21 additions & 7 deletions packages/api-auth-user/src/api-auth-user.provider.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
import { useState } from 'react'
import { useEffect } from 'react'
import React from 'react'
import type { ReactNode } from 'react'
import type { FC } from 'react'

import { UserProvider } from '@atls/react-user'
import { useState } from 'react'
import { useEffect } from 'react'
import React from 'react'

const fetchSession = async (url) => {
import { UserProvider } from '@atls/react-user'

type Session = any

interface ApiAuthUserProviderProps {
url?: string
children: ReactNode
}

const fetchSession = async (url: string): Promise<Session> => {
const response = await fetch(url)
const text = await response.text()

// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return text ? JSON.parse(text) : null
}

export const ApiAuthUserProvider = ({ url = '/api/auth/session', children }) => {
const [session, setSession] = useState(null)
export const ApiAuthUserProvider: FC<ApiAuthUserProviderProps> = ({
url = '/api/auth/session',
children,
}) => {
const [session, setSession] = useState<Session>(null)

useEffect(() => {
if (typeof window !== 'undefined') {
Expand Down
2 changes: 1 addition & 1 deletion packages/app-links/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@atls/react-app-links",
"version": "0.0.2",
"version": "0.0.3",
"license": "BSD-3-Clause",
"main": "src/index.ts",
"files": [
Expand Down
7 changes: 4 additions & 3 deletions packages/app-links/src/app-link.component.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { FC } from 'react'
import type { FC } from 'react'

import { AppLinkProps } from './app-url.interfaces'
import { useAppUrl } from './use-app-url.hook'
import type { AppLinkProps } from './app-url.interfaces'

import { useAppUrl } from './use-app-url.hook'

export const AppLink: FC<AppLinkProps> = ({ children, subdomain, pathname }) => {
const url = useAppUrl({ subdomain, pathname })
Expand Down
11 changes: 6 additions & 5 deletions packages/app-links/src/use-app-url.hook.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { useState } from 'react'
import { getDomain } from 'tldjs'
import type { UseAppUrlProps } from './app-url.interfaces'

import { UseAppUrlProps } from './app-url.interfaces'
import { useBrowserEffect } from './use-browser-effect.hook'
import { useState } from 'react'
import { getDomain } from 'tldjs'

import { useBrowserEffect } from './use-browser-effect.hook'

export const useAppUrl = ({ subdomain, pathname = '/' }: UseAppUrlProps = {}): string | null => {
const [url, setUrl] = useState<string | null>(null)
Expand All @@ -12,7 +13,7 @@ export const useAppUrl = ({ subdomain, pathname = '/' }: UseAppUrlProps = {}): s

const domain = getDomain(hostname)

const origin = subdomain ? `${protocol}//${subdomain}.${domain}` : `${protocol}//${domain}`
const origin = subdomain ? `${protocol}//${subdomain}.${domain!}` : `${protocol}//${domain!}`

setUrl(`${origin}${pathname}`)
}, [subdomain, pathname])
Expand Down
9 changes: 6 additions & 3 deletions packages/app-links/src/use-browser-effect.hook.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
/* eslint-disable react-hooks/exhaustive-deps */
/* eslint-disable react-hooks/rules-of-hooks */

import { EffectCallback } from 'react'
import { DependencyList } from 'react'
import { useEffect } from 'react'
import type { EffectCallback } from 'react'
import type { DependencyList } from 'react'

import { useEffect } from 'react'

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type
export const useBrowserEffect = (effect: EffectCallback, deps?: DependencyList) => {
if (typeof window === 'undefined') {
return undefined
}

// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
return useEffect(effect, deps)
}
3 changes: 2 additions & 1 deletion packages/identity-links/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@atls/react-identity-links",
"version": "0.0.4",
"version": "0.0.5",
"license": "MIT",
"main": "src/index.ts",
"files": [
Expand All @@ -21,6 +21,7 @@
"@types/react": "18.3.6",
"@types/react-dom": "^18.2.7",
"@types/testing-library__jest-dom": "^5.14.1",
"@types/tldjs": "2.3.4",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
Expand Down
7 changes: 4 additions & 3 deletions packages/identity-links/src/identity-link.component.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import { IdentityLink } from './identity-link.component'
describe('identity-link.component', () => {
const originalLocation = window.location

const mockWindowLocation = (newLocation) => {
// @ts-ignore
const mockWindowLocation = (newLocation: Location | URL | string): void => {
// @ts-expect-error
delete window.location
// @ts-expect-error
window.location = newLocation
}

Expand All @@ -26,10 +27,10 @@ describe('identity-link.component', () => {
mockWindowLocation(new URL('https://identity.monstrs.dev'))

const { getByText } = render(
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
<IdentityLink returnTo>{(url) => <a href={url}>Login</a>}</IdentityLink>
)

// @ts-ignore
expect(getByText('Login')).toHaveAttribute(
'href',
'https://accounts.monstrs.dev/auth/login?return_to=https://identity.monstrs.dev/'
Expand Down
7 changes: 4 additions & 3 deletions packages/identity-links/src/identity-link.component.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { FC } from 'react'
import type { FC } from 'react'

import { IdentityLinkProps } from './identity-url.interfaces'
import { useIdentityUrl } from './use-identity-url.hook'
import type { IdentityLinkProps } from './identity-url.interfaces'

import { useIdentityUrl } from './use-identity-url.hook'

export const IdentityLink: FC<IdentityLinkProps> = ({ children, type, returnTo }) => {
const url = useIdentityUrl({ type, returnTo })
Expand Down
6 changes: 3 additions & 3 deletions packages/identity-links/src/identity-url.interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export type IdentityUrlType =
| 'login'
| 'logout'
| 'recovery'
| 'registration'
| 'settings'
| 'verification'
| 'recovery'
| 'logout'

export interface UseIdentityUrlReturnToProps {
subdomain?: string
Expand All @@ -13,7 +13,7 @@ export interface UseIdentityUrlReturnToProps {

export interface UseIdentityUrlProps {
type?: IdentityUrlType
returnTo?: true | false | UseIdentityUrlReturnToProps
returnTo?: UseIdentityUrlReturnToProps | false | true
}

export interface IdentityLinkProps extends UseIdentityUrlProps {
Expand Down
9 changes: 6 additions & 3 deletions packages/identity-links/src/use-browser-effect.hook.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
/* eslint-disable react-hooks/exhaustive-deps */
/* eslint-disable react-hooks/rules-of-hooks */

import { EffectCallback } from 'react'
import { DependencyList } from 'react'
import { useEffect } from 'react'
import type { EffectCallback } from 'react'
import type { DependencyList } from 'react'

import { useEffect } from 'react'

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type
export const useBrowserEffect = (effect: EffectCallback, deps?: DependencyList) => {
if (typeof window === 'undefined') {
return undefined
}

// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
return useEffect(effect, deps)
}
5 changes: 3 additions & 2 deletions packages/identity-links/src/use-identity-url.hook.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import { useIdentityUrl } from './use-identity-url.hook'
describe('use-identity-url', () => {
const originalLocation = window.location

const mockWindowLocation = (newLocation) => {
// @ts-ignore
const mockWindowLocation = (newLocation: Location | URL | string): void => {
// @ts-expect-error
delete window.location
// @ts-expect-error
window.location = newLocation
}

Expand Down
Loading