From 8ffb907ca2ea18de4eda9622eb47fd5ae690a949 Mon Sep 17 00:00:00 2001 From: Alano Terblanche <18033717+Benehiko@users.noreply.github.com> Date: Fri, 29 Sep 2023 13:51:17 +0200 Subject: [PATCH] feat: strict eslint (#148) * feat: strict eslint * style: format * chore: eslint ignore specific files * chore: remove uneeded type * fix: eslint errors in storybook stories * style: format * fix: oidc button * test: node error message * chore: update snapshots * chore: restore express changes * chore: update snapshots * chore: relax snapshot comparison * test: consent card * test: translation template strings * chore: cleanup * test: update consent card snapshots * chore: normalize browser css and increse playwright workers * chore: remove flaky snapshot * chore: reduce workers * chore: patch translation test Co-authored-by: Jonas Hungershausen * test: error message formatting * fix: export portuguese --------- Co-authored-by: Jonas Hungershausen --- .eslintignore | 5 +- .eslintrc.js => .eslintrc.cjs | 15 +- .gitignore | 3 +- package-lock.json | 636 +++++++++--- package.json | 14 +- playwright-ct.config.ts | 34 +- playwright/index.tsx | 2 +- src/locales/index.ts | 4 + src/locales/nl.json | 2 +- src/markup/express.ts | 22 - src/react-components/button-link.tsx | 2 +- src/react-components/card.tsx | 2 +- src/react-components/codebox.tsx | 2 +- src/react-components/nav.tsx | 2 +- src/react-components/ory/helpers/common.tsx | 6 +- .../ory/helpers/error-flow-nodes.spec.tsx | 152 +++ .../ory/helpers/error-messages.tsx | 6 +- .../ory/helpers/node.spec.tsx | 134 +++ src/react-components/ory/helpers/node.tsx | 166 ++- .../ory/helpers/user-auth-form.tsx | 28 +- .../ory/sections/auth-code-section.spec.tsx | 2 +- .../ory/sections/auth-code-section.tsx | 8 +- .../ory/sections/link-section.tsx | 8 +- .../ory/sections/logged-info.tsx | 8 +- .../ory/sections/login-section.tsx | 2 +- .../lookup-secret-settings-section.tsx | 2 +- .../ory/sections/lookup-secrets-section.tsx | 2 +- .../ory/sections/oidc-settings-section.tsx | 2 +- .../sections/password-settings-section.tsx | 2 +- .../ory/sections/profile-settings-section.tsx | 2 +- .../ory/sections/registration-section.tsx | 2 +- .../ory/sections/totp-settings-section.tsx | 2 +- .../sections/webauthn-settings-section.tsx | 2 +- .../ory/user-auth-card.spec.tsx | 142 ++- src/react-components/ory/user-auth-card.tsx | 53 +- .../ory/user-consent-card.spec.tsx | 3 +- .../ory/user-consent-card.tsx | 13 +- src/react-components/ory/user-error-card.tsx | 18 +- .../ory/user-logout-card.spec.tsx | 4 +- src/react-components/ory/user-logout-card.tsx | 14 +- .../ory/user-settings-card.tsx | 12 +- .../ory/user-settings-screen.tsx | 12 +- src/react-components/provider.tsx | 2 +- .../tests/translations.spec.ts | 69 ++ src/react-components/translations.spec.ts | 16 - src/stories/Ory/Auth.stories.tsx | 91 +- src/stories/Ory/AuthError.stories.tsx | 8 +- src/stories/Ory/AuthSettings.stories.tsx | 20 +- src/stories/Ory/SettingsScreen.stories.tsx | 6 +- src/stories/Ory/auth-error-400.json | 12 - src/stories/Ory/auth-error-500.json | 12 - src/stories/Ory/auth-error-data.ts | 34 + src/stories/Ory/login-data.ts | 974 ++++++++++++++++++ src/stories/Ory/login-flow-2fa.json | 143 --- src/stories/Ory/login-flow-code-1.json | 70 -- src/stories/Ory/login-flow-code-2.json | 131 --- src/stories/Ory/login-flow-error.json | 143 --- src/stories/Ory/login-flow-hydra.json | 122 --- src/stories/Ory/login-flow-refresh.json | 93 -- src/stories/Ory/login-flow-ui-error.json | 122 --- src/stories/Ory/login-flow.json | 111 -- src/stories/Ory/recovery-data.ts | 73 ++ src/stories/Ory/recovery-flow.json | 66 -- src/stories/Ory/register-flow-code.json | 178 ---- src/stories/Ory/register-flow-webauthn.json | 175 ---- src/stories/Ory/register-flow.json | 187 ---- src/stories/Ory/registration-data.ts | 562 ++++++++++ src/stories/Ory/settings-data.ts | 748 ++++++++++++++ src/stories/Ory/settings-flow.json | 352 ------- src/stories/Ory/settings-unlink-flow.json | 379 ------- src/stories/Ory/svg.d.ts | 7 + src/stories/Ory/verification-data.ts | 153 +++ src/stories/Ory/verification-flow.json | 66 -- src/stories/Ory/verification-submit-flow.json | 76 -- src/test/fixtures/login.ts | 117 ++- src/test/fixtures/registration.ts | 5 +- src/test/mock/login.ts | 2 +- src/test/mock/recovery.ts | 4 +- src/test/models/AuthPage.ts | 10 +- src/test/models/LoginPage.ts | 9 +- src/test/models/RecoveryPage.ts | 4 +- src/test/models/RegistrationPage.ts | 5 +- src/test/models/SettingsPage.ts | 4 +- src/test/models/VerificationPage.ts | 2 +- src/test/playwright-fixture.ts | 8 +- src/test/types.ts | 8 +- src/test/utils.ts | 14 +- src/theme/consts.ts | 4 +- src/theme/message.css.ts | 7 +- src/vite-env.d.ts | 4 - 90 files changed, 4037 insertions(+), 2923 deletions(-) rename .eslintrc.js => .eslintrc.cjs (60%) delete mode 100644 src/markup/express.ts create mode 100644 src/react-components/ory/helpers/error-flow-nodes.spec.tsx create mode 100644 src/react-components/tests/translations.spec.ts delete mode 100644 src/react-components/translations.spec.ts delete mode 100644 src/stories/Ory/auth-error-400.json delete mode 100644 src/stories/Ory/auth-error-500.json create mode 100644 src/stories/Ory/auth-error-data.ts create mode 100644 src/stories/Ory/login-data.ts delete mode 100644 src/stories/Ory/login-flow-2fa.json delete mode 100644 src/stories/Ory/login-flow-code-1.json delete mode 100644 src/stories/Ory/login-flow-code-2.json delete mode 100644 src/stories/Ory/login-flow-error.json delete mode 100644 src/stories/Ory/login-flow-hydra.json delete mode 100644 src/stories/Ory/login-flow-refresh.json delete mode 100644 src/stories/Ory/login-flow-ui-error.json delete mode 100644 src/stories/Ory/login-flow.json create mode 100644 src/stories/Ory/recovery-data.ts delete mode 100644 src/stories/Ory/recovery-flow.json delete mode 100644 src/stories/Ory/register-flow-code.json delete mode 100644 src/stories/Ory/register-flow-webauthn.json delete mode 100644 src/stories/Ory/register-flow.json create mode 100644 src/stories/Ory/registration-data.ts create mode 100644 src/stories/Ory/settings-data.ts delete mode 100644 src/stories/Ory/settings-flow.json delete mode 100644 src/stories/Ory/settings-unlink-flow.json create mode 100644 src/stories/Ory/svg.d.ts create mode 100644 src/stories/Ory/verification-data.ts delete mode 100644 src/stories/Ory/verification-flow.json delete mode 100644 src/stories/Ory/verification-submit-flow.json delete mode 100644 src/vite-env.d.ts diff --git a/.eslintignore b/.eslintignore index 76add878f..5d21e1203 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,5 @@ node_modules -dist \ No newline at end of file +dist +src/markup-components/component-wrapper.tsx +src/markup-components/components.ts +src/markup-components/express.ts diff --git a/.eslintrc.js b/.eslintrc.cjs similarity index 60% rename from .eslintrc.js rename to .eslintrc.cjs index 2429e991a..64a257611 100644 --- a/.eslintrc.js +++ b/.eslintrc.cjs @@ -10,23 +10,34 @@ module.exports = { extends: [ "eslint:recommended", "plugin:react/recommended", - "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/stylistic-type-checked", + "plugin:@typescript-eslint/recommended-type-checked", "plugin:react/jsx-runtime", "plugin:storybook/recommended", + "plugin:playwright/recommended", ], overrides: [], parser: "@typescript-eslint/parser", + ignorePatterns: ["src/assets/*.js"], parserOptions: { - tsconfigRootDir: "./", + project: "./tsconfig.json", + tsconfigRootDir: __dirname, ecmaVersion: 2021, sourceType: "module", ecmaFeatures: { jsx: true, }, }, + settings: { + playwright: { + additionalAssertFunctionNames: [], + }, + }, + root: true, plugins: ["react", "@typescript-eslint", "eslint-plugin-tsdoc", "formatjs"], rules: { "tsdoc/syntax": "warn", "formatjs/no-offset": "error", + "@typescript-eslint/no-floating-promises": "error", }, } diff --git a/.gitignore b/.gitignore index 97885efc9..28f89be7c 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ dist dist-ssr *.local .bin/ +tests-dist/ # Editor directories and files .vscode/* @@ -37,4 +38,4 @@ pnpm-lock.yaml /playwright/.cache/ /test-results/ /playwright-report/ -/playwright/.cache/ \ No newline at end of file +/playwright/.cache/ diff --git a/package-lock.json b/package-lock.json index 6c3cc43dc..03f27b9e6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,28 +33,28 @@ "@types/node": "18.16.19", "@types/react": "18.2.20", "@types/react-dom": "18.2.7", - "@typescript-eslint/eslint-plugin": "5.33.1", - "@typescript-eslint/parser": "5.33.1", + "@typescript-eslint/eslint-plugin": "6.7.2", + "@typescript-eslint/parser": "6.7.2", "@vanilla-extract/css": "1.13.0", "@vanilla-extract/dynamic": "2.0.3", "@vanilla-extract/recipes": "0.5.0", "@vanilla-extract/sprinkles": "1.6.1", "@vanilla-extract/vite-plugin": "3.9.0", "@vitejs/plugin-react": "4.0.4", - "autoprefixer": "10.4.15", + "autoprefixer": "10.4.16", "chromatic": "6.21.0", "classnames": "2.3.2", "eslint": "8.49.0", "eslint-config-semistandard": "17.0.0", "eslint-config-standard": "17.1.0", - "eslint-plugin-formatjs": "4.10.3", + "eslint-plugin-formatjs": "4.10.5", "eslint-plugin-import": "2.28.1", - "eslint-plugin-n": "15.7.0", + "eslint-plugin-n": "16.1.0", "eslint-plugin-playwright": "0.16.0", "eslint-plugin-promise": "6.1.1", "eslint-plugin-react": "7.32.2", "eslint-plugin-react-hooks": "4.6.0", - "eslint-plugin-storybook": "0.6.13", + "eslint-plugin-storybook": "0.6.14", "eslint-plugin-tsdoc": "0.2.17", "lerna": "5.6.2", "license-checker": "25.0.1", @@ -69,7 +69,7 @@ "typedoc": "0.23.16", "typescript": "5.2.2", "vite": "4.4.9", - "vite-plugin-dts": "3.5.3", + "vite-plugin-dts": "3.5.4", "vite-plugin-static-copy": "0.17.0" }, "engines": { @@ -3750,9 +3750,10 @@ } }, "node_modules/@eslint-community/eslint-utils": { - "version": "4.3.0", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", "dev": true, - "license": "MIT", "dependencies": { "eslint-visitor-keys": "^3.3.0" }, @@ -3941,12 +3942,12 @@ } }, "node_modules/@formatjs/ts-transformer": { - "version": "3.13.3", - "resolved": "https://registry.npmjs.org/@formatjs/ts-transformer/-/ts-transformer-3.13.3.tgz", - "integrity": "sha512-W6+huH4dLYx8eZfZue6fcreNzLZHoPboreqJSkickYCKIOicI35zC0Txb4xCT6kau/DXAKTpNEln3V2NgX6Igg==", + "version": "3.13.5", + "resolved": "https://registry.npmjs.org/@formatjs/ts-transformer/-/ts-transformer-3.13.5.tgz", + "integrity": "sha512-dh2mmZqkId0UeM+FQtmwugpMGvyzTBmXj5LjwD4M5OeSm62tcgkScjqeO/1EetaNS/JkTUBbsFBnHzaDzh3yOw==", "dev": true, "dependencies": { - "@formatjs/icu-messageformat-parser": "2.6.0", + "@formatjs/icu-messageformat-parser": "2.6.2", "@types/json-stable-stringify": "^1.0.32", "@types/node": "14 || 16 || 17", "chalk": "^4.0.0", @@ -3963,6 +3964,46 @@ } } }, + "node_modules/@formatjs/ts-transformer/node_modules/@formatjs/ecma402-abstract": { + "version": "1.17.2", + "resolved": "https://registry.npmjs.org/@formatjs/ecma402-abstract/-/ecma402-abstract-1.17.2.tgz", + "integrity": "sha512-k2mTh0m+IV1HRdU0xXM617tSQTi53tVR2muvYOsBeYcUgEAyxV1FOC7Qj279th3fBVQ+Dj6muvNJZcHSPNdbKg==", + "dev": true, + "dependencies": { + "@formatjs/intl-localematcher": "0.4.2", + "tslib": "^2.4.0" + } + }, + "node_modules/@formatjs/ts-transformer/node_modules/@formatjs/icu-messageformat-parser": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/@formatjs/icu-messageformat-parser/-/icu-messageformat-parser-2.6.2.tgz", + "integrity": "sha512-nF/Iww7sc5h+1MBCDRm68qpHTCG4xvGzYs/x9HFcDETSGScaJ1Fcadk5U/NXjXeCtzD+DhN4BAwKFVclHfKMdA==", + "dev": true, + "dependencies": { + "@formatjs/ecma402-abstract": "1.17.2", + "@formatjs/icu-skeleton-parser": "1.6.2", + "tslib": "^2.4.0" + } + }, + "node_modules/@formatjs/ts-transformer/node_modules/@formatjs/icu-skeleton-parser": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/@formatjs/icu-skeleton-parser/-/icu-skeleton-parser-1.6.2.tgz", + "integrity": "sha512-VtB9Slo4ZL6QgtDFJ8Injvscf0xiDd4bIV93SOJTBjUF4xe2nAWOoSjLEtqIG+hlIs1sNrVKAaFo3nuTI4r5ZA==", + "dev": true, + "dependencies": { + "@formatjs/ecma402-abstract": "1.17.2", + "tslib": "^2.4.0" + } + }, + "node_modules/@formatjs/ts-transformer/node_modules/@formatjs/intl-localematcher": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/@formatjs/intl-localematcher/-/intl-localematcher-0.4.2.tgz", + "integrity": "sha512-BGdtJFmaNJy5An/Zan4OId/yR9Ih1OojFjcduX/xOvq798OgWSyDtd6Qd5jqJXwJs1ipe4Fxu9+cshic5Ox2tA==", + "dev": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, "node_modules/@formatjs/ts-transformer/node_modules/@types/node": { "version": "17.0.45", "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.45.tgz", @@ -11317,9 +11358,10 @@ } }, "node_modules/@types/json-schema": { - "version": "7.0.11", - "dev": true, - "license": "MIT" + "version": "7.0.13", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.13.tgz", + "integrity": "sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ==", + "dev": true }, "node_modules/@types/json-stable-stringify": { "version": "1.0.34", @@ -11432,9 +11474,10 @@ "license": "MIT" }, "node_modules/@types/semver": { - "version": "7.3.13", - "dev": true, - "license": "MIT" + "version": "7.5.2", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.2.tgz", + "integrity": "sha512-7aqorHYgdNO4DM36stTiGO3DvKoex9TQRwsJU6vMaFGyqpBA1MNZkz+PG3gaNUPpTAOYhT1WR7M1JyA3fbS9Cw==", + "dev": true }, "node_modules/@types/serve-static": { "version": "1.15.1", @@ -11469,30 +11512,33 @@ "license": "MIT" }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.33.1", + "version": "6.7.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.7.2.tgz", + "integrity": "sha512-ooaHxlmSgZTM6CHYAFRlifqh1OAr3PAQEwi7lhYhaegbnXrnh7CDcHmc3+ihhbQC7H0i4JF0psI5ehzkF6Yl6Q==", "dev": true, - "license": "MIT", "dependencies": { - "@typescript-eslint/scope-manager": "5.33.1", - "@typescript-eslint/type-utils": "5.33.1", - "@typescript-eslint/utils": "5.33.1", + "@eslint-community/regexpp": "^4.5.1", + "@typescript-eslint/scope-manager": "6.7.2", + "@typescript-eslint/type-utils": "6.7.2", + "@typescript-eslint/utils": "6.7.2", + "@typescript-eslint/visitor-keys": "6.7.2", "debug": "^4.3.4", - "functional-red-black-tree": "^1.0.1", - "ignore": "^5.2.0", - "regexpp": "^3.2.0", - "semver": "^7.3.7", - "tsutils": "^3.21.0" + "graphemer": "^1.4.0", + "ignore": "^5.2.4", + "natural-compare": "^1.4.0", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^5.0.0", - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + "@typescript-eslint/parser": "^6.0.0 || ^6.0.0-alpha", + "eslint": "^7.0.0 || ^8.0.0" }, "peerDependenciesMeta": { "typescript": { @@ -11501,15 +11547,16 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { - "version": "5.33.1", + "version": "6.7.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.7.2.tgz", + "integrity": "sha512-bgi6plgyZjEqapr7u2mhxGR6E8WCzKNUFWNh6fkpVe9+yzRZeYtDTbsIBzKbcxI+r1qVWt6VIoMSNZ4r2A+6Yw==", "dev": true, - "license": "MIT", "dependencies": { - "@typescript-eslint/types": "5.33.1", - "@typescript-eslint/visitor-keys": "5.33.1" + "@typescript-eslint/types": "6.7.2", + "@typescript-eslint/visitor-keys": "6.7.2" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", @@ -11517,23 +11564,25 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/type-utils": { - "version": "5.33.1", + "version": "6.7.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.7.2.tgz", + "integrity": "sha512-36F4fOYIROYRl0qj95dYKx6kybddLtsbmPIYNK0OBeXv2j9L5nZ17j9jmfy+bIDHKQgn2EZX+cofsqi8NPATBQ==", "dev": true, - "license": "MIT", "dependencies": { - "@typescript-eslint/utils": "5.33.1", + "@typescript-eslint/typescript-estree": "6.7.2", + "@typescript-eslint/utils": "6.7.2", "debug": "^4.3.4", - "tsutils": "^3.21.0" + "ts-api-utils": "^1.0.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "*" + "eslint": "^7.0.0 || ^8.0.0" }, "peerDependenciesMeta": { "typescript": { @@ -11542,64 +11591,80 @@ } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/utils": { - "version": "5.33.1", + "version": "6.7.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.7.2.tgz", + "integrity": "sha512-ZCcBJug/TS6fXRTsoTkgnsvyWSiXwMNiPzBUani7hDidBdj1779qwM1FIAmpH4lvlOZNF3EScsxxuGifjpLSWQ==", "dev": true, - "license": "MIT", "dependencies": { - "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.33.1", - "@typescript-eslint/types": "5.33.1", - "@typescript-eslint/typescript-estree": "5.33.1", - "eslint-scope": "^5.1.1", - "eslint-utils": "^3.0.0" + "@eslint-community/eslint-utils": "^4.4.0", + "@types/json-schema": "^7.0.12", + "@types/semver": "^7.5.0", + "@typescript-eslint/scope-manager": "6.7.2", + "@typescript-eslint/types": "6.7.2", + "@typescript-eslint/typescript-estree": "6.7.2", + "semver": "^7.5.4" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + "eslint": "^7.0.0 || ^8.0.0" } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.33.1", + "version": "6.7.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.7.2.tgz", + "integrity": "sha512-uVw9VIMFBUTz8rIeaUT3fFe8xIUx8r4ywAdlQv1ifH+6acn/XF8Y6rwJ7XNmkNMDrTW+7+vxFFPIF40nJCVsMQ==", "dev": true, - "license": "MIT", "dependencies": { - "@typescript-eslint/types": "5.33.1", - "eslint-visitor-keys": "^3.3.0" + "@typescript-eslint/types": "6.7.2", + "eslint-visitor-keys": "^3.4.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/eslint-scope": { - "version": "5.1.1", + "node_modules/@typescript-eslint/eslint-plugin/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", "dev": true, - "license": "BSD-2-Clause", "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" + "yallist": "^4.0.0" }, "engines": { - "node": ">=8.0.0" + "node": ">=10" } }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/estraverse": { - "version": "4.3.0", + "node_modules/@typescript-eslint/eslint-plugin/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, - "license": "BSD-2-Clause", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, "engines": { - "node": ">=4.0" + "node": ">=10" } }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "node_modules/@typescript-eslint/experimental-utils": { "version": "5.56.0", "dev": true, @@ -11734,24 +11799,26 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "5.33.1", + "version": "6.7.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.7.2.tgz", + "integrity": "sha512-KA3E4ox0ws+SPyxQf9iSI25R6b4Ne78ORhNHeVKrPQnoYsb9UhieoiRoJgrzgEeKGOXhcY1i8YtOeCHHTDa6Fw==", "dev": true, - "license": "BSD-2-Clause", "dependencies": { - "@typescript-eslint/scope-manager": "5.33.1", - "@typescript-eslint/types": "5.33.1", - "@typescript-eslint/typescript-estree": "5.33.1", + "@typescript-eslint/scope-manager": "6.7.2", + "@typescript-eslint/types": "6.7.2", + "@typescript-eslint/typescript-estree": "6.7.2", + "@typescript-eslint/visitor-keys": "6.7.2", "debug": "^4.3.4" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + "eslint": "^7.0.0 || ^8.0.0" }, "peerDependenciesMeta": { "typescript": { @@ -11760,15 +11827,16 @@ } }, "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": { - "version": "5.33.1", + "version": "6.7.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.7.2.tgz", + "integrity": "sha512-bgi6plgyZjEqapr7u2mhxGR6E8WCzKNUFWNh6fkpVe9+yzRZeYtDTbsIBzKbcxI+r1qVWt6VIoMSNZ4r2A+6Yw==", "dev": true, - "license": "MIT", "dependencies": { - "@typescript-eslint/types": "5.33.1", - "@typescript-eslint/visitor-keys": "5.33.1" + "@typescript-eslint/types": "6.7.2", + "@typescript-eslint/visitor-keys": "6.7.2" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", @@ -11776,15 +11844,16 @@ } }, "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.33.1", + "version": "6.7.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.7.2.tgz", + "integrity": "sha512-uVw9VIMFBUTz8rIeaUT3fFe8xIUx8r4ywAdlQv1ifH+6acn/XF8Y6rwJ7XNmkNMDrTW+7+vxFFPIF40nJCVsMQ==", "dev": true, - "license": "MIT", "dependencies": { - "@typescript-eslint/types": "5.33.1", - "eslint-visitor-keys": "^3.3.0" + "@typescript-eslint/types": "6.7.2", + "eslint-visitor-keys": "^3.4.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", @@ -11884,11 +11953,12 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "5.33.1", + "version": "6.7.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.7.2.tgz", + "integrity": "sha512-flJYwMYgnUNDAN9/GAI3l8+wTmvTYdv64fcH8aoJK76Y+1FCZ08RtI5zDerM/FYT5DMkAc+19E4aLmd5KqdFyg==", "dev": true, - "license": "MIT", "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", @@ -11896,20 +11966,21 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.33.1", + "version": "6.7.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.7.2.tgz", + "integrity": "sha512-kiJKVMLkoSciGyFU0TOY0fRxnp9qq1AzVOHNeN1+B9erKFCJ4Z8WdjAkKQPP+b1pWStGFqezMLltxO+308dJTQ==", "dev": true, - "license": "BSD-2-Clause", "dependencies": { - "@typescript-eslint/types": "5.33.1", - "@typescript-eslint/visitor-keys": "5.33.1", + "@typescript-eslint/types": "6.7.2", + "@typescript-eslint/visitor-keys": "6.7.2", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", - "semver": "^7.3.7", - "tsutils": "^3.21.0" + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", @@ -11922,21 +11993,55 @@ } }, "node_modules/@typescript-eslint/typescript-estree/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.33.1", + "version": "6.7.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.7.2.tgz", + "integrity": "sha512-uVw9VIMFBUTz8rIeaUT3fFe8xIUx8r4ywAdlQv1ifH+6acn/XF8Y6rwJ7XNmkNMDrTW+7+vxFFPIF40nJCVsMQ==", "dev": true, - "license": "MIT", "dependencies": { - "@typescript-eslint/types": "5.33.1", - "eslint-visitor-keys": "^3.3.0" + "@typescript-eslint/types": "6.7.2", + "eslint-visitor-keys": "^3.4.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "node_modules/@typescript-eslint/utils": { "version": "5.49.0", "dev": true, @@ -12941,7 +13046,9 @@ } }, "node_modules/autoprefixer": { - "version": "10.4.15", + "version": "10.4.16", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.16.tgz", + "integrity": "sha512-7vd3UC6xKp0HLfua5IjZlcXvGAGy7cBAXTg2lyQ/8WpNhd6SiZ8Be+xm3FyBSYJx5GKcpRCzBh7RH4/0dnY+uQ==", "dev": true, "funding": [ { @@ -12957,11 +13064,10 @@ "url": "https://github.com/sponsors/ai" } ], - "license": "MIT", "dependencies": { "browserslist": "^4.21.10", - "caniuse-lite": "^1.0.30001520", - "fraction.js": "^4.2.0", + "caniuse-lite": "^1.0.30001538", + "fraction.js": "^4.3.6", "normalize-range": "^0.1.2", "picocolors": "^1.0.0", "postcss-value-parser": "^4.2.0" @@ -13601,7 +13707,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001520", + "version": "1.0.30001538", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001538.tgz", + "integrity": "sha512-HWJnhnID+0YMtGlzcp3T9drmBJUVDchPJ08tpUGFLs9CYlwWPH2uLgpHn8fND5pCgXVtnGS3H4QR9XLMHVNkHw==", "funding": [ { "type": "opencollective", @@ -13615,8 +13723,7 @@ "type": "github", "url": "https://github.com/sponsors/ai" } - ], - "license": "CC-BY-4.0" + ] }, "node_modules/caseless": { "version": "0.12.0", @@ -15676,6 +15783,107 @@ "typescript": "*" } }, + "node_modules/eslint-config-standard-with-typescript/node_modules/@typescript-eslint/parser": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.62.0.tgz", + "integrity": "sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "5.62.0", + "@typescript-eslint/types": "5.62.0", + "@typescript-eslint/typescript-estree": "5.62.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/eslint-config-standard-with-typescript/node_modules/@typescript-eslint/scope-manager": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz", + "integrity": "sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.62.0", + "@typescript-eslint/visitor-keys": "5.62.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/eslint-config-standard-with-typescript/node_modules/@typescript-eslint/types": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.62.0.tgz", + "integrity": "sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/eslint-config-standard-with-typescript/node_modules/@typescript-eslint/typescript-estree": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.62.0.tgz", + "integrity": "sha512-CmcQ6uY7b9y694lKdRB8FEel7JbU/40iSAPomu++SjLMntB+2Leay2LO6i8VnJk58MtE9/nQSFIH6jpyRWyYzA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.62.0", + "@typescript-eslint/visitor-keys": "5.62.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "semver": "^7.3.7", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/eslint-config-standard-with-typescript/node_modules/@typescript-eslint/visitor-keys": { + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.62.0.tgz", + "integrity": "sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.62.0", + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, "node_modules/eslint-config-standard-with-typescript/node_modules/eslint-config-standard": { "version": "17.0.0", "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-17.0.0.tgz", @@ -15830,6 +16038,25 @@ "eslint": ">=4.19.1" } }, + "node_modules/eslint-plugin-es-x": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-es-x/-/eslint-plugin-es-x-7.2.0.tgz", + "integrity": "sha512-9dvv5CcvNjSJPqnS5uZkqb3xmbeqRLnvXKK7iI5+oK/yTusyc46zbBZKENGsOfojm/mKfszyZb+wNqNPAPeGXA==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.1.2", + "@eslint-community/regexpp": "^4.6.0" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ota-meshi" + }, + "peerDependencies": { + "eslint": ">=8" + } + }, "node_modules/eslint-plugin-es/node_modules/eslint-utils": { "version": "2.1.0", "dev": true, @@ -15853,20 +16080,20 @@ } }, "node_modules/eslint-plugin-formatjs": { - "version": "4.10.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-formatjs/-/eslint-plugin-formatjs-4.10.3.tgz", - "integrity": "sha512-EHKuEMCmWhAiMdCc8oZU8qBAvnvHPUiJuhGxPqA+GX2Nb7GBsGm2o616KYnSSffDisK+v0E9TDCrS8oJ0QLgcw==", + "version": "4.10.5", + "resolved": "https://registry.npmjs.org/eslint-plugin-formatjs/-/eslint-plugin-formatjs-4.10.5.tgz", + "integrity": "sha512-pBPA4idiYHXPQMrIb9/Le+D0snlNa7MFQsw12yIzyva/z9uz0u/4NOK3NkfyENMBNMeTX2tZXtugk9FyqM5SRw==", "dev": true, "dependencies": { - "@formatjs/icu-messageformat-parser": "2.6.0", - "@formatjs/ts-transformer": "3.13.3", + "@formatjs/icu-messageformat-parser": "2.6.2", + "@formatjs/ts-transformer": "3.13.5", "@types/eslint": "7 || 8", "@types/picomatch": "^2.3.0", - "@typescript-eslint/typescript-estree": "5.59.0", + "@typescript-eslint/typescript-estree": "5.62.0", "emoji-regex": "^10.2.1", "magic-string": "^0.30.0", "picomatch": "^2.3.1", - "tslib": "2.5.0", + "tslib": "2.6.0", "typescript": "^4.7 || 5", "unicode-emoji-utils": "^1.1.1" }, @@ -15874,6 +16101,46 @@ "eslint": "7 || 8" } }, + "node_modules/eslint-plugin-formatjs/node_modules/@formatjs/ecma402-abstract": { + "version": "1.17.2", + "resolved": "https://registry.npmjs.org/@formatjs/ecma402-abstract/-/ecma402-abstract-1.17.2.tgz", + "integrity": "sha512-k2mTh0m+IV1HRdU0xXM617tSQTi53tVR2muvYOsBeYcUgEAyxV1FOC7Qj279th3fBVQ+Dj6muvNJZcHSPNdbKg==", + "dev": true, + "dependencies": { + "@formatjs/intl-localematcher": "0.4.2", + "tslib": "^2.4.0" + } + }, + "node_modules/eslint-plugin-formatjs/node_modules/@formatjs/icu-messageformat-parser": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/@formatjs/icu-messageformat-parser/-/icu-messageformat-parser-2.6.2.tgz", + "integrity": "sha512-nF/Iww7sc5h+1MBCDRm68qpHTCG4xvGzYs/x9HFcDETSGScaJ1Fcadk5U/NXjXeCtzD+DhN4BAwKFVclHfKMdA==", + "dev": true, + "dependencies": { + "@formatjs/ecma402-abstract": "1.17.2", + "@formatjs/icu-skeleton-parser": "1.6.2", + "tslib": "^2.4.0" + } + }, + "node_modules/eslint-plugin-formatjs/node_modules/@formatjs/icu-skeleton-parser": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/@formatjs/icu-skeleton-parser/-/icu-skeleton-parser-1.6.2.tgz", + "integrity": "sha512-VtB9Slo4ZL6QgtDFJ8Injvscf0xiDd4bIV93SOJTBjUF4xe2nAWOoSjLEtqIG+hlIs1sNrVKAaFo3nuTI4r5ZA==", + "dev": true, + "dependencies": { + "@formatjs/ecma402-abstract": "1.17.2", + "tslib": "^2.4.0" + } + }, + "node_modules/eslint-plugin-formatjs/node_modules/@formatjs/intl-localematcher": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/@formatjs/intl-localematcher/-/intl-localematcher-0.4.2.tgz", + "integrity": "sha512-BGdtJFmaNJy5An/Zan4OId/yR9Ih1OojFjcduX/xOvq798OgWSyDtd6Qd5jqJXwJs1ipe4Fxu9+cshic5Ox2tA==", + "dev": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, "node_modules/eslint-plugin-formatjs/node_modules/@jridgewell/sourcemap-codec": { "version": "1.4.15", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", @@ -15881,9 +16148,9 @@ "dev": true }, "node_modules/eslint-plugin-formatjs/node_modules/@typescript-eslint/types": { - "version": "5.59.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.0.tgz", - "integrity": "sha512-yR2h1NotF23xFFYKHZs17QJnB51J/s+ud4PYU4MqdZbzeNxpgUr05+dNeCN/bb6raslHvGdd6BFCkVhpPk/ZeA==", + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.62.0.tgz", + "integrity": "sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -15894,13 +16161,13 @@ } }, "node_modules/eslint-plugin-formatjs/node_modules/@typescript-eslint/typescript-estree": { - "version": "5.59.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.0.tgz", - "integrity": "sha512-sUNnktjmI8DyGzPdZ8dRwW741zopGxltGs/SAPgGL/AAgDpiLsCFLcMNSpbfXfmnNeHmK9h3wGmCkGRGAoUZAg==", + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.62.0.tgz", + "integrity": "sha512-CmcQ6uY7b9y694lKdRB8FEel7JbU/40iSAPomu++SjLMntB+2Leay2LO6i8VnJk58MtE9/nQSFIH6jpyRWyYzA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.59.0", - "@typescript-eslint/visitor-keys": "5.59.0", + "@typescript-eslint/types": "5.62.0", + "@typescript-eslint/visitor-keys": "5.62.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -15921,12 +16188,12 @@ } }, "node_modules/eslint-plugin-formatjs/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.59.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.0.tgz", - "integrity": "sha512-qZ3iXxQhanchCeaExlKPV3gDQFxMUmU35xfd5eCXB6+kUw1TUAbIy2n7QIrwz9s98DQLzNWyHp61fY0da4ZcbA==", + "version": "5.62.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.62.0.tgz", + "integrity": "sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.59.0", + "@typescript-eslint/types": "5.62.0", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -16069,22 +16336,23 @@ } }, "node_modules/eslint-plugin-n": { - "version": "15.7.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-15.7.0.tgz", - "integrity": "sha512-jDex9s7D/Qial8AGVIHq4W7NswpUD5DPDL2RH8Lzd9EloWUuvUkHfv4FRLMipH5q2UtyurorBkPeNi1wVWNh3Q==", + "version": "16.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-16.1.0.tgz", + "integrity": "sha512-3wv/TooBst0N4ND+pnvffHuz9gNPmk/NkLwAxOt2JykTl/hcuECe6yhTtLJcZjIxtZwN+GX92ACp/QTLpHA3Hg==", "dev": true, "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", "builtins": "^5.0.1", - "eslint-plugin-es": "^4.1.0", - "eslint-utils": "^3.0.0", - "ignore": "^5.1.1", - "is-core-module": "^2.11.0", + "eslint-plugin-es-x": "^7.1.0", + "get-tsconfig": "^4.7.0", + "ignore": "^5.2.4", + "is-core-module": "^2.12.1", "minimatch": "^3.1.2", - "resolve": "^1.22.1", - "semver": "^7.3.8" + "resolve": "^1.22.2", + "semver": "^7.5.3" }, "engines": { - "node": ">=12.22.0" + "node": ">=16.0.0" }, "funding": { "url": "https://github.com/sponsors/mysticatea" @@ -16093,6 +16361,39 @@ "eslint": ">=7.0.0" } }, + "node_modules/eslint-plugin-n/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/eslint-plugin-n/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/eslint-plugin-n/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "node_modules/eslint-plugin-playwright": { "version": "0.16.0", "resolved": "https://registry.npmjs.org/eslint-plugin-playwright/-/eslint-plugin-playwright-0.16.0.tgz", @@ -16190,9 +16491,10 @@ } }, "node_modules/eslint-plugin-storybook": { - "version": "0.6.13", + "version": "0.6.14", + "resolved": "https://registry.npmjs.org/eslint-plugin-storybook/-/eslint-plugin-storybook-0.6.14.tgz", + "integrity": "sha512-IeYigPur/MvESNDo43Z+Z5UvlcEVnt0dDZmnw1odi9X2Th1R3bpGyOZsHXb9bp1pFecOpRUuoMG5xdID2TwwOg==", "dev": true, - "license": "MIT", "dependencies": { "@storybook/csf": "^0.0.1", "@typescript-eslint/utils": "^5.45.0", @@ -17063,15 +17365,16 @@ } }, "node_modules/fraction.js": { - "version": "4.2.0", + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.6.tgz", + "integrity": "sha512-n2aZ9tNfYDwaHhvFTkhFErqOMIb8uyzSQ+vGJBjZyanAKZVbGUQ1sngfk9FdkBw7G26O7AgNjLcecLffD1c7eg==", "dev": true, - "license": "MIT", "engines": { "node": "*" }, "funding": { "type": "patreon", - "url": "https://www.patreon.com/infusion" + "url": "https://github.com/sponsors/rawify" } }, "node_modules/fresh": { @@ -17152,11 +17455,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/functional-red-black-tree": { - "version": "1.0.1", - "dev": true, - "license": "MIT" - }, "node_modules/functions-have-names": { "version": "1.2.3", "license": "MIT", @@ -17310,8 +17608,12 @@ } }, "node_modules/get-tsconfig": { - "version": "4.4.0", - "license": "MIT", + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.0.tgz", + "integrity": "sha512-pmjiZ7xtB8URYm74PlGJozDNyhvsVLUcpBa8DZBG3bWHwaHa9bPiRpiSfovw+fjhwONSCWKRyk+JQHEGZmMrzw==", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, "funding": { "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" } @@ -23166,10 +23468,11 @@ "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" }, "node_modules/resolve": { - "version": "1.22.1", - "license": "MIT", + "version": "1.22.6", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.6.tgz", + "integrity": "sha512-njhxM7mV12JfufShqGy3Rz8j11RPdLy4xi15UurGJeoHLfJpVXKdh3ueuOqbYUcDZnffr6X739JBo5LzyahEsw==", "dependencies": { - "is-core-module": "^2.9.0", + "is-core-module": "^2.13.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, @@ -23199,6 +23502,14 @@ "node": ">=8" } }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, "node_modules/restore-cursor": { "version": "3.1.0", "dev": true, @@ -24460,6 +24771,18 @@ "node": ">=8" } }, + "node_modules/ts-api-utils": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.3.tgz", + "integrity": "sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==", + "dev": true, + "engines": { + "node": ">=16.13.0" + }, + "peerDependencies": { + "typescript": ">=4.2.0" + } + }, "node_modules/ts-dedent": { "version": "2.2.0", "dev": true, @@ -24496,8 +24819,9 @@ } }, "node_modules/tslib": { - "version": "2.5.0", - "license": "0BSD" + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.0.tgz", + "integrity": "sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==" }, "node_modules/tsutils": { "version": "3.21.0", @@ -25213,9 +25537,9 @@ } }, "node_modules/vite-plugin-dts": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/vite-plugin-dts/-/vite-plugin-dts-3.5.3.tgz", - "integrity": "sha512-h94j/+SR1PhLR9jnEtcjZILagE2QZBAV8V1y3T2Ujcet1VI0Et4dZSU1W8fbnp6obB7B3/b8hArqdi2/9HuH+w==", + "version": "3.5.4", + "resolved": "https://registry.npmjs.org/vite-plugin-dts/-/vite-plugin-dts-3.5.4.tgz", + "integrity": "sha512-BJLBj1Vg9kV7ZMXAULT9UGogrElwz5s+k8TzC7LsFkHv5Jy90OWnHKUp8qm7sypu2pkF5pTJ5McUuHudnT0Imw==", "dev": true, "dependencies": { "@microsoft/api-extractor": "^7.36.4", diff --git a/package.json b/package.json index 43c15f0ef..b1a5e0a11 100644 --- a/package.json +++ b/package.json @@ -46,28 +46,28 @@ "@types/node": "18.16.19", "@types/react": "18.2.20", "@types/react-dom": "18.2.7", - "@typescript-eslint/eslint-plugin": "5.33.1", - "@typescript-eslint/parser": "5.33.1", + "@typescript-eslint/eslint-plugin": "6.7.2", + "@typescript-eslint/parser": "6.7.2", "@vanilla-extract/css": "1.13.0", "@vanilla-extract/dynamic": "2.0.3", "@vanilla-extract/recipes": "0.5.0", "@vanilla-extract/sprinkles": "1.6.1", "@vanilla-extract/vite-plugin": "3.9.0", "@vitejs/plugin-react": "4.0.4", - "autoprefixer": "10.4.15", + "autoprefixer": "10.4.16", "chromatic": "6.21.0", "classnames": "2.3.2", "eslint": "8.49.0", "eslint-config-semistandard": "17.0.0", "eslint-config-standard": "17.1.0", - "eslint-plugin-formatjs": "4.10.3", + "eslint-plugin-formatjs": "4.10.5", "eslint-plugin-import": "2.28.1", - "eslint-plugin-n": "15.7.0", + "eslint-plugin-n": "16.1.0", "eslint-plugin-playwright": "0.16.0", "eslint-plugin-promise": "6.1.1", "eslint-plugin-react": "7.32.2", "eslint-plugin-react-hooks": "4.6.0", - "eslint-plugin-storybook": "0.6.13", + "eslint-plugin-storybook": "0.6.14", "eslint-plugin-tsdoc": "0.2.17", "lerna": "5.6.2", "license-checker": "25.0.1", @@ -82,7 +82,7 @@ "typedoc": "0.23.16", "typescript": "5.2.2", "vite": "4.4.9", - "vite-plugin-dts": "3.5.3", + "vite-plugin-dts": "3.5.4", "vite-plugin-static-copy": "0.17.0" }, "files": [ diff --git a/playwright-ct.config.ts b/playwright-ct.config.ts index 883e5b5c6..b5ddfe5fb 100644 --- a/playwright-ct.config.ts +++ b/playwright-ct.config.ts @@ -1,17 +1,15 @@ // Copyright © 2023 Ory Corp // SPDX-License-Identifier: Apache-2.0 - import { defineConfig, devices } from "@playwright/experimental-ct-react" import { vanillaExtractPlugin } from "@vanilla-extract/vite-plugin" import react from "@vitejs/plugin-react" +import dts from "vite-plugin-dts" /** * See https://playwright.dev/docs/test-configuration. */ export default defineConfig({ - testDir: "./src/react-components", - /* The base directory, relative to the config file, for snapshot files created with toMatchSnapshot and toHaveScreenshot. */ - snapshotDir: "./__snapshots__", + testDir: "./src", /* Maximum time one test can run for. */ timeout: 10 * 1000, /* Run tests in files in parallel */ @@ -25,17 +23,39 @@ export default defineConfig({ /* Reporter to use. See https://playwright.dev/docs/test-reporters */ reporter: "html", /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ + expect: { + /** + * Maximum time expect() should wait for the condition to be met. + * For example in `await expect(locator).toHaveText();` + */ + timeout: 5000, + toHaveScreenshot: { + maxDiffPixelRatio: 0.05, + }, + }, use: { /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: "on-first-retry", - /* Port to use for Playwright component endpoint. */ ctPort: 3100, ctViteConfig: { - plugins: [vanillaExtractPlugin(), react()], + plugins: [ + vanillaExtractPlugin(), + react(), + dts({ insertTypesEntry: true }), + ], + build: { + rollupOptions: { + external: ["express"], + output: { + globals: { + express: "express", + }, + }, + }, + }, }, }, - /* Configure projects for major browsers */ projects: [ { diff --git a/playwright/index.tsx b/playwright/index.tsx index fdc1b49c7..18ef323c4 100644 --- a/playwright/index.tsx +++ b/playwright/index.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // Import styles, initialize component theme here. -// import '../src/common.css'; +import "../src/assets/normalize.css" import { IntlProvider } from "../src/react-components" import { beforeMount } from "@playwright/experimental-ct-react/hooks" diff --git a/src/locales/index.ts b/src/locales/index.ts index 5f57bb59f..22c1934b9 100644 --- a/src/locales/index.ts +++ b/src/locales/index.ts @@ -4,3 +4,7 @@ export { default as en } from "./en.json" export { default as es } from "./es.json" export { default as de } from "./de.json" +export { default as fr } from "./fr.json" +export { default as nl } from "./nl.json" +export { default as se } from "./se.json" +export { default as pt } from "./pt.json" diff --git a/src/locales/nl.json b/src/locales/nl.json index ffc203221..2aaaee0ca 100644 --- a/src/locales/nl.json +++ b/src/locales/nl.json @@ -92,7 +92,7 @@ "identities.messages.4000019": "moet > {minimum} zijn, maar is {actual}", "identities.messages.4000020": "moet <= {maximum} zijn, maar is {actual}", "identities.messages.4000021": "moet < {maximum} zijn, maar is {actual}", - "identities.messages.4000022": "{actual} is geen veelvoud van {basic}", + "identities.messages.4000022": "{actual} is geen veelvoud van {base}", "identities.messages.4000023": "maximaal {max_items} items toegestaan, maar er zijn {actual_items} items gevonden", "identities.messages.4000024": "minimaal {min_items} items toegestaan, maar er zijn {actual_items} items gevonden", "identities.messages.4000025": "items op index {index_a} en {index_b} zijn gelijk", diff --git a/src/markup/express.ts b/src/markup/express.ts deleted file mode 100644 index a88f49687..000000000 --- a/src/markup/express.ts +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright © 2023 Ory Corp -// SPDX-License-Identifier: Apache-2.0 - -import { assignInlineVars } from "@vanilla-extract/dynamic" -import express from "express" -import { oryTheme, Theme } from "../theme" - -export const RegisterOryElementsExpress = ( - app: express.Application, - theme: Theme, -) => { - app.use("/theme.css", (req, res) => { - res.header("Content-Type", "text/css") - res.send( - `body {${assignInlineVars(oryTheme, { - ...oryTheme, - ...theme, - }).toString()}}`, - ) - }) - app.use("/", express.static("node_modules/@ory/elements-markup/dist")) -} diff --git a/src/react-components/button-link.tsx b/src/react-components/button-link.tsx index 73e411d6b..cdb4c6e43 100644 --- a/src/react-components/button-link.tsx +++ b/src/react-components/button-link.tsx @@ -9,7 +9,7 @@ import { buttonLinkStyle, } from "../theme/button-link.css" -export type CustomHref = { +export interface CustomHref { href: string handler: (url: string) => void } diff --git a/src/react-components/card.tsx b/src/react-components/card.tsx index 82870e4f2..1b2bde652 100644 --- a/src/react-components/card.tsx +++ b/src/react-components/card.tsx @@ -11,7 +11,7 @@ import { export interface CardProps extends React.HTMLAttributes { heading: string | React.ReactNode - image?: string | React.ReactNode + image?: string | React.ReactNode | React.FunctionComponent className?: string children?: React.ReactNode size?: "wide" | "default" diff --git a/src/react-components/codebox.tsx b/src/react-components/codebox.tsx index 32f9ab8f1..9b3ce7021 100644 --- a/src/react-components/codebox.tsx +++ b/src/react-components/codebox.tsx @@ -34,7 +34,7 @@ export const CodeBox = ({ htmlFor={id} className={cn(typographyStyle({ size: "small" }), codeboxHeaderStyle)} > -
{toggleText || "Toggle content"}
+
{toggleText ?? "Toggle content"}
-export type NavSection = { +export interface NavSection { title?: string titleIcon?: string floatBottom?: boolean diff --git a/src/react-components/ory/helpers/common.tsx b/src/react-components/ory/helpers/common.tsx index 462963139..0bcf3e0e8 100644 --- a/src/react-components/ory/helpers/common.tsx +++ b/src/react-components/ory/helpers/common.tsx @@ -4,7 +4,7 @@ import { colorSprinkle } from "../../../theme" import { ButtonLink, CustomHref } from "../../button-link" import { Message } from "../../message" -export type ErrorProps = { +export interface ErrorProps { code: number details: { docs: string @@ -16,14 +16,14 @@ export type ErrorProps = { reason: string } -export type AdditionalProps = { +export interface AdditionalProps { forgotPasswordURL?: CustomHref | string signupURL?: CustomHref | string logoutURL?: CustomHref | string loginURL?: CustomHref | string } -export type MessageSectionProps = { +export interface MessageSectionProps { url?: CustomHref | string buttonText: string dataTestId?: string diff --git a/src/react-components/ory/helpers/error-flow-nodes.spec.tsx b/src/react-components/ory/helpers/error-flow-nodes.spec.tsx new file mode 100644 index 000000000..71d62bcbd --- /dev/null +++ b/src/react-components/ory/helpers/error-flow-nodes.spec.tsx @@ -0,0 +1,152 @@ +import { test, expect } from "@playwright/experimental-ct-react" +import { NodeMessages } from "./error-messages" + +test("should render error message", async ({ mount }) => { + const component = await mount( + , + ) + await expect( + component.locator("[data-testid='ui/message/4000010']"), + ).toBeVisible() + await expect(component).toContainText( + "Account not active yet. Did you forget to verify your email address?", + ) +}) + +test("should render info message", async ({ mount }) => { + const component = await mount( + , + ) + + await expect( + component.locator("[data-testid='ui/message/1080002']"), + ).toBeVisible() + await expect(component).toContainText( + "You successfully verified your email address.", + ) +}) + +test("can render multiple messages", async ({ mount }) => { + const component = await mount( + , + ) + + await expect( + component.locator("[data-testid='ui/message/4000002']"), + ).toBeVisible() + + await expect(component).toContainText("Property name is missing.") + + await expect(component).toContainText( + "You successfully verified your email address.", + ) + await expect( + component.locator("[data-testid='ui/message/1080002']"), + ).toBeVisible() +}) + +test("message unix expired_at timestamp with formatted date", async ({ + mount, +}) => { + const component = await mount( + , + ) + + // we check relative time here, because the test runner might be a bit slow + await expect(component).toContainText( + /The login flow expired (9|10)\.[0-9]{2} minutes ago, please try again\./, + ) +}) + +test("message unix until minutes with formatted date", async ({ mount }) => { + const component = await mount( + , + ) + + // we check relative time here, because the test runner might be a bit slow + await expect(component).toContainText( + /You successfully recovered your account\. Please change your password or set up an alternative login method \(e\.g\. social sign in\) within the next (9|10)\.[0-9]{2} minutes\./, + ) +}) diff --git a/src/react-components/ory/helpers/error-messages.tsx b/src/react-components/ory/helpers/error-messages.tsx index 2b2608b21..d6d03dc17 100644 --- a/src/react-components/ory/helpers/error-messages.tsx +++ b/src/react-components/ory/helpers/error-messages.tsx @@ -8,7 +8,7 @@ import { uiTextToFormattedMessage } from "./node" export type NodeMessagesProps = { nodes?: UiNode[] - uiMessages?: Array + uiMessages?: UiText[] } & GridStyle & MessageStyleProps @@ -59,12 +59,12 @@ export const NodeMessages = ({ nodeMessage({ message, key: `ui-messsage-${message.id}-${key}` }), ) - const $allMessages = [...($groupMessages || []), ...($messages || [])] + const $allMessages = [...($groupMessages ?? []), ...($messages ?? [])] return $allMessages.length > 0 ? (
diff --git a/src/react-components/ory/helpers/node.spec.tsx b/src/react-components/ory/helpers/node.spec.tsx index 4eeca7232..aadb9bd4f 100644 --- a/src/react-components/ory/helpers/node.spec.tsx +++ b/src/react-components/ory/helpers/node.spec.tsx @@ -26,3 +26,137 @@ test("hidden input field shouldn't show label", async ({ mount }) => { await expect(component).toBeHidden() }) + +test("uiTextToFormattedMessage on a list", async ({ mount }) => { + const component = await mount( + , + ) + + await expect(component).toContainText( + "These are your back up recovery codes. Please keep them in a safe place!", + ) + await expect(component).toContainText("te45pbc0") + await expect(component).toContainText("q3vvtd4i") +}) diff --git a/src/react-components/ory/helpers/node.tsx b/src/react-components/ory/helpers/node.tsx index ab2e65b4e..8fdb62737 100644 --- a/src/react-components/ory/helpers/node.tsx +++ b/src/react-components/ory/helpers/node.tsx @@ -27,7 +27,7 @@ interface ButtonSubmit { value: string } -export type NodeOverrideProps = { +export interface NodeOverrideProps { buttonOverrideProps?: Partial buttonSocialOverrideProps?: Partial } @@ -56,47 +56,131 @@ export const getNodeLabel = (node: UiNode): UiText | undefined => { return node.meta.label } +/** + * Converts a UiText to a FormattedMessage. + * The UiText contains the id of the message and the context. + * The context is used to inject values into the message from Kratos, e.g. a timestamp. + * For example a UI Node from Kratos might look like this: + * + * \{ + * "type":"input", + * "group":"default", + * "attributes": \{ + * "name":"traits.email", + * "type":"email", + * "required":true, + * "autocomplete":"email", + * "disabled":false, + * "node_type":"input" + * \}, + * "messages":[], + * "meta": \{ + * "label": \{ + * "id":1070002, + * "text":"E-Mail", + * "type":"info", + * "context":\{ + * "title":"E-Mail" + * \}, + * \} + * \} + * \} + * + * The context has the key "title" which matches the formatter template name "\{title\}" + * An example translation file would look like this: + * \{ + * "identities.messages.1070002": "\{title\}" + * \} + * + * The formwatter would then take the meta.label.id and look for the translation with the key matching the id. + * It would then replace the template "\{title\}" with the value from the context with the key "title". + * + * @param uiText - The UiText is part of the UiNode object sent by Kratos when performing a flow. + */ export const uiTextToFormattedMessage = ( { id, context = {}, text }: Omit, intl: IntlShape, -) => - intl.formatMessage( +) => { + const contextInjectedMessage = Object.entries(context).reduce( + (accumulator, [key, value]) => { + // context might provide an array of objects instead of a single object + // for example when looking up a recovery code + /* + * + { + "text": { + "id": 1050015, + "text": "3r9noma8, tv14n5tu, ...", + "type": "info", + "context": { + "secrets": [ + { + "context": { + "secret": "3r9noma8" + }, + "id": 1050009, + "text": "3r9noma8", + "type": "info" + }, + { + "context": { + "secret": "tv14n5tu" + }, + "id": 1050009, + "text": "tv14n5tu", + "type": "info" + }, + ] + } + }, + "id": "lookup_secret_codes", + "node_type": "text" + } + */ + if (Array.isArray(value)) { + return { + ...accumulator, + [key]: value, + [key + "_list"]: intl.formatList(value), + } + } else if (key.endsWith("_unix")) { + if (typeof value === "number") { + return { + ...accumulator, + [key]: intl.formatDate(new Date(value * 1000)), + [key + "_since"]: intl.formatDateTimeRange( + new Date(value), + new Date(), + ), + [key + "_since_minutes"]: Math.abs( + (value - new Date().getTime() / 1000) / 60, + ).toFixed(2), + [key + "_until"]: intl.formatDateTimeRange( + new Date(), + new Date(value), + ), + [key + "_until_minutes"]: Math.abs( + (new Date().getTime() / 1000 - value) / 60, + ).toFixed(2), + } + } + } + return { + ...accumulator, + [key]: value as string | number, + } + }, + {}, + ) + + return intl.formatMessage( { id: `identities.messages.${id}`, defaultMessage: text, }, - Object.entries(context).reduce>( - (values, [key, value]) => - Array.isArray(value) - ? { - ...values, - [key]: value, - [key + "_list"]: intl.formatList(value), - } - : key.endsWith("_unix") - ? { - ...values, - [key]: intl.formatDate(new Date(value * 1000)), - [key + "_since"]: intl.formatDateTimeRange( - new Date(value), - new Date(), - ), - [key + "_since_minutes"]: - (value - new Date().getTime() / 1000) / 60, - [key + "_until"]: intl.formatDateTimeRange( - new Date(), - new Date(value), - ), - [key + "_until_minutes"]: - (new Date().getTime() / 1000 - value) / 60, - } - : { - ...values, - [key]: value, - }, - {}, - ), + contextInjectedMessage, ) +} export const Node = ({ node, @@ -178,8 +262,8 @@ export const Node = ({ const submit: ButtonSubmit = { type: attrs.type as "submit" | "reset" | "button" | undefined, name: attrs.name, - ...(attrs.value && { value: attrs.value }), - } + ...(attrs.value && { value: attrs.value as string }), + } as ButtonSubmit switch (nodeType) { case "button": @@ -204,7 +288,7 @@ export const Node = ({ // the recovery code resend button if ( - node.meta.label?.id === 1070007 || // TODO: remove this once everyone has migrated to the fix (https://github.com/ory/kratos/pull/3067) + node.meta.label?.id === 1070007 ?? // TODO: remove this once everyone has migrated to the fix (https://github.com/ory/kratos/pull/3067) node.meta.label?.id === 1070008 ) { // on html forms the required flag on an input field will prevent the form from submitting. @@ -216,7 +300,7 @@ export const Node = ({ diff --git a/src/react-components/ory/helpers/user-auth-form.tsx b/src/react-components/ory/helpers/user-auth-form.tsx index d3aa6158d..9e9092e71 100644 --- a/src/react-components/ory/helpers/user-auth-form.tsx +++ b/src/react-components/ory/helpers/user-auth-form.tsx @@ -13,7 +13,13 @@ import { formStyle } from "../../../theme" import { FilterFlowNodes } from "./filter-flow-nodes" import { SelfServiceFlow } from "./types" -export type UserAuthFormAdditionalProps = { +/** + * Additional props that can be passed to the UserAuthForm component + * @see UserAuthForm + * + * @param onSubmit - function that is called when the form is submitted. It automatically maps the form data to the request body and prevents native form submits. + */ +export interface UserAuthFormAdditionalProps { onSubmit?: ({ body, event, @@ -28,7 +34,16 @@ export type UserAuthFormAdditionalProps = { }) => void } -// SelfServiceFlowForm props +/** + * UserAuthFormProps is the props interface for the UserAuthForm component + * @see UserAuthForm + * + * @param flow - the Ory flow object that is used to add the form action and method and add csrf tokens to the form + * @param children - the children of the form + * @param formFilterOverride - the filter that is used to filter the form nodes. By default, only hidden fields are included. + * @param submitOnEnter - if true, the form will be submitted when the enter key is pressed. Otherwise, the enter key will be ignored. + * @param className - css class overrides for the form component + */ export interface UserAuthFormProps extends Omit, "onSubmit">, UserAuthFormAdditionalProps { @@ -39,6 +54,13 @@ export interface UserAuthFormProps className?: string } +/** + * UserAuthForm is a component that renders a form for a given Ory flow. + * It automatically adds the form action and method and adds csrf tokens to the form. + * When the `onSubmit` parameter is passed, it also automatically maps the form data to the request body and prevents native form submits. + * @see UserAuthFormProps + * @returns JSX.Element + */ export const UserAuthForm = ({ flow, children, @@ -94,7 +116,7 @@ export const UserAuthForm = ({ {/*always add csrf token and other hidden fields to form*/}