Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/npm_and_yarn/tough-cookie-4.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
panvourtsis committed Mar 13, 2024
2 parents 2b35211 + 7f2b4c5 commit 7892d6e
Show file tree
Hide file tree
Showing 284 changed files with 14,646 additions and 13,148 deletions.
49 changes: 30 additions & 19 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
},
"rules": {
/* React rules */
"react/react-in-jsx-scope": "off",
"react/no-direct-mutation-state": "error",
"react/no-unused-prop-types": "warn",
"react/self-closing-comp": [
Expand All @@ -31,6 +32,9 @@
"react/no-render-return-value": 0,
/* JSX rules */
"react/jsx-key": "error",
/* Since we are using React 17+ we no longer need these */
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
/* eslint basic rules */
"padding-line-between-statements": [
"error",
Expand All @@ -56,27 +60,34 @@
// "no-unused-expressions": "warn",
"no-unused-vars": "off",
"no-debugger": "warn",
"no-console": "warn",

"no-console": "warn"
},
"overrides": [
/* Typescript rules */
"@typescript-eslint/no-unused-expressions": "warn",
"@typescript-eslint/no-unused-vars": [
"warn",
{
"args": "all",
"argsIgnorePattern": "^__",
"varsIgnorePattern": "^__|React"
{
"files": ["**/*.ts?(x)"],
"rules": {
"@typescript-eslint/no-unused-expressions": "warn",
"@typescript-eslint/no-unused-vars": [
"warn",
{
"args": "all",
"argsIgnorePattern": "^__",
"varsIgnorePattern": "^__|React"
}
],
"@typescript-eslint/ban-ts-ignore": 0,
"@typescript-eslint/no-empty-function": 0,
"@typescript-eslint/camelcase": 0,
"@typescript-eslint/prefer-interface": 0,
"@typescript-eslint/no-inferrable-types": 0,
"@typescript-eslint/explicit-member-accessibility": 0,
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/ban-ts-comment": "warn",
"@typescript-eslint/no-explicit-any": "warn"
}
],
"@typescript-eslint/ban-ts-ignore": 0,
"@typescript-eslint/no-empty-function": 0,
"@typescript-eslint/camelcase": 0,
"@typescript-eslint/prefer-interface": 0,
"@typescript-eslint/no-inferrable-types": 0,
"@typescript-eslint/explicit-member-accessibility": 0,
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/ban-ts-comment": "warn"
},
}
],
"settings": {
"react": {
"pragma": "React",
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ on:
- 'next'
- 'v3.x'

permissions:
packages: write
contents: write
id-token: write

jobs:
deploy:
name: Deploy
Expand All @@ -25,9 +30,9 @@ jobs:
with:
fetch-depth: 0

- uses: actions/setup-node@v1
- uses: actions/setup-node@v2
with:
node-version: '18.13.0'
node-version: '18.17.0'

- name: Install dependencies and build app
run: |
Expand Down Expand Up @@ -106,9 +111,9 @@ jobs:
with:
fetch-depth: 0

- uses: actions/setup-node@v1
- uses: actions/setup-node@v2
with:
node-version: '18.13.0'
node-version: '18.17.0'

- name: Install dependencies
run: yarn install
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- 'master'
- 'next'
- 'v3.x'
- '**'

jobs:
deploy-review-app:
Expand All @@ -30,16 +31,18 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: '18.13.0' # Replace with your node version
node-version: '18.17.0' # Replace with your node version

- name: Install dependencies and build app
run: |
yarn
yarn documentation:build
- name: Run Tests
env:
NODE_OPTIONS: "--max_old_space_size=4096"
run: yarn test

- name: Configure AWS credentials
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '18.17.0' # Replace with your node version

- name: Install dependencies
run: yarn install

- name: Run Tests
env:
NODE_OPTIONS: "--max_old_space_size=4096"
run: yarn test --coverage

- uses: sonarsource/sonarqube-scan-action@master
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/teardown-review-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,19 @@ on:
pull_request:
types: [closed]

concurrency:
group: ${{ github.ref }}
cancel-in-progress: false

permissions:
packages: write
contents: write
issues: write
pull-requests: write
id-token: write

jobs:
delete-review-app:
uses: Orfium/orfium-github-actions/.github/workflows/teardown-frontend.yml@master
secrets:
REVIEW_TEARDOWN_TOKEN: ${{ secrets.REVIEW_TEARDOWN_TOKEN }}
REVIEW_TEARDOWN_TOKEN: ${{ secrets.REVIEW_TEARDOWN_TOKEN }}
90 changes: 44 additions & 46 deletions __mocks__/@auth0/auth0-spa-js.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,59 +38,57 @@ export const handleRedirectCallback = jest.fn(() => {
export const isAuthenticated = jest.fn();
export const logout = jest.fn();
export const loginWithPopup = jest.fn();
export const createAuth0 = jest.fn().mockImplementation((options: any) =>
Promise.resolve({
getTokenSilently,
loginWithRedirect,
loginWithPopup,
getUser,
logout,
handleRedirectCallback,
isAuthenticated,
options: {
...options,
onRedirectCallback,
},
cacheLocation: 'localstorage',
httpTimeoutMs: 10000,
cookieStorage: {
export const Auth0Client = jest.fn().mockImplementation((options: any) => ({
getTokenSilently,
loginWithRedirect,
loginWithPopup,
getUser,
logout,
handleRedirectCallback,
isAuthenticated,
options: {
...options,
onRedirectCallback,
},
cacheLocation: 'localstorage',
httpTimeoutMs: 10000,
cookieStorage: {
get: jest.fn(),
save: jest.fn(),
remove: jest.fn(),
},
orgHintCookieName: 'auth0..organization_hint',
isAuthenticatedCookieName: 'auth0..is.authenticated',
sessionCheckExpiryDays: 1,
scope: 'offline_access',
transactionManager: {
storage: {
get: jest.fn(),
save: jest.fn(),
remove: jest.fn(),
},
orgHintCookieName: 'auth0..organization_hint',
isAuthenticatedCookieName: 'auth0..is.authenticated',
sessionCheckExpiryDays: 1,
scope: 'offline_access',
transactionManager: {
storage: {
get: jest.fn(),
save: jest.fn(),
remove: jest.fn(),
},
clientId: '',
storageKey: 'a0.spajs.txs.',
transaction: null,
},
clientId: '',
storageKey: 'a0.spajs.txs.',
transaction: null,
},
nowProvider: jest.fn(),
cacheManager: {
cache: {},
keyManifest: null,
nowProvider: jest.fn(),
cacheManager: {
cache: {},
keyManifest: null,
nowProvider: jest.fn(),
},
domainUrl: 'https://',
tokenIssuer: 'https:///',
defaultScope: 'openid profile email',
customOptions: {
onRedirectCallback,
organization: undefined,
},
useRefreshTokensFallback: true,
})
);
},
domainUrl: 'https://',
tokenIssuer: 'https:///',
defaultScope: 'openid profile email',
customOptions: {
onRedirectCallback,
organization: undefined,
},
useRefreshTokensFallback: true,
useRefreshTokens: true,
}));

/*
* Mock auth0 client with predefined values
* All necessary functions are mocked jest.fn() that can be used to run tests internally.
*/
export default createAuth0;
18 changes: 0 additions & 18 deletions app.json

This file was deleted.

6 changes: 6 additions & 0 deletions documentation/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": ["../.eslintrc.json"],
"rules": {
"@typescript-eslint/no-var-requires": "off"
}
}
44 changes: 44 additions & 0 deletions documentation/docs/api/Components/LinkWithStatePassthrough.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
id: "LinkWithStatePassthrough"
title: "LinkWithStatePassthrough"
sidebar_label: "LinkWithStatePassthrough"
sidebar_position: 3
---

```ts
import { LinkWithStatePassthrough } from '@orfium/toolbox';
```

:::info
Must be a descendant of [`Router`](https://v5.reactrouter.com/web/api/Router).
:::

## Description

A utility component that wraps over React Router's [`Link`](https://v5.reactrouter.com/web/api/Link) component,
but takes care to pass the _current_ history state over to the next link location.

**Example usage**

```tsx
// `to` value can be a full or partial location object
// (do note that explicitly passing a `state` object here will be ignored)
function EmptyPage() {
return (
<LinkWithStatePassthrough to={{ pathname: '/login' }} />
);
}
```

```tsx
// `to` value can also just be a string
function EmptyPage() {
return (
<LinkWithStatePassthrough to={'/login'} />
);
}
```

## Props

Ƭ `LinkProps`
45 changes: 45 additions & 0 deletions documentation/docs/api/Components/NavLinkWithStatePassthrough.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
id: "NavLinkWithStatePassthrough"
title: "NavLinkWithStatePassthrough"
sidebar_label: "NavLinkWithStatePassthrough"
sidebar_position: 3
---

```ts
import { NavLinkWithStatePassthrough } from '@orfium/toolbox';
```

:::info
Must be a descendant of [`Router`](https://v5.reactrouter.com/web/api/Router).
:::


## Description

A utility component that wraps over React Router's [`NavLink`](https://v5.reactrouter.com/web/api/NavLink) component,
but takes care to pass the _current_ history state over to the next link location.

**Example usage**

```tsx
// `to` value can be a full or partial location object
// (do note that explicitly passing a `state` object here will be ignored)
function EmptyPage() {
return (
<NavLinkWithStatePassthrough to={{ pathname: '/login' }} />
);
}
```

```tsx
// `to` value can also just be a string
function EmptyPage() {
return (
<NavLinkWithStatePassthrough to={'/login'} />
);
}
```

## Props

Ƭ `NavLinkProps`
Loading

0 comments on commit 7892d6e

Please sign in to comment.