From 26d1e480747d0dae2862d4c7676fa2fdd66a64f3 Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Thu, 12 Oct 2023 18:23:31 +0200 Subject: [PATCH 01/35] chore: update to mfa branch of web-js --- package-lock.json | 11 +++++------ package.json | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index ce7194225..2cb349e42 100644 --- a/package-lock.json +++ b/package-lock.json @@ -88,7 +88,7 @@ "peerDependencies": { "react": ">=16.8.0", "react-dom": ">=16.8.0", - "supertokens-web-js": "^0.8.0" + "supertokens-web-js": "github:supertokens/supertokens-web-js#feat/mfa" } }, "eslint": { @@ -16244,8 +16244,8 @@ }, "node_modules/supertokens-web-js": { "version": "0.8.0", - "resolved": "https://registry.npmjs.org/supertokens-web-js/-/supertokens-web-js-0.8.0.tgz", - "integrity": "sha512-kkvuPbdy1I0e7nejVJAhpPJhR5h7EUHdn7Fh1YqfSjZfSJh46J3JU2qWGCgSDVZuD1hSuUKb6skF9CQnltHWrQ==", + "resolved": "git+ssh://git@github.com/supertokens/supertokens-web-js.git#9a99c7c946307a23c0b0473ea37cf37aa24e096b", + "license": "Apache-2.0", "peer": true, "dependencies": { "supertokens-js-override": "0.0.4", @@ -29414,9 +29414,8 @@ "integrity": "sha512-r0JFBjkMIdep3Lbk3JA+MpnpuOtw4RSyrlRAbrzMcxwiYco3GFWl/daimQZ5b1forOiUODpOlXbSOljP/oyurg==" }, "supertokens-web-js": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/supertokens-web-js/-/supertokens-web-js-0.8.0.tgz", - "integrity": "sha512-kkvuPbdy1I0e7nejVJAhpPJhR5h7EUHdn7Fh1YqfSjZfSJh46J3JU2qWGCgSDVZuD1hSuUKb6skF9CQnltHWrQ==", + "version": "git+ssh://git@github.com/supertokens/supertokens-web-js.git#9a99c7c946307a23c0b0473ea37cf37aa24e096b", + "from": "supertokens-web-js@github:supertokens/supertokens-web-js#feat/mfa", "peer": true, "requires": { "supertokens-js-override": "0.0.4", diff --git a/package.json b/package.json index 93f767599..18ed6e8a1 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "peerDependencies": { "react": ">=16.8.0", "react-dom": ">=16.8.0", - "supertokens-web-js": "^0.8.0" + "supertokens-web-js": "github:supertokens/supertokens-web-js#feat/mfa" }, "scripts": { "init": "bash ./init.sh", From db3be18c81be0e41c067d302982ad041224bfb4a Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Fri, 13 Oct 2023 11:49:12 +0200 Subject: [PATCH 02/35] feat: mfa recipe setup --- lib/build/emailpassword-shared.js | 33 +- lib/build/emailpassword-shared2.js | 26 +- lib/build/emailpassword-shared3.js | 30 +- lib/build/emailpassword-shared4.js | 509 +--- lib/build/emailpassword-shared5.js | 556 ++++- lib/build/emailpassword-shared6.js | 1612 +------------ lib/build/emailpassword-shared7.js | 2058 ++++++++++++----- lib/build/emailpassword-shared8.js | 774 +++++++ lib/build/emailpassword.js | 6 +- lib/build/emailpasswordprebuiltui.js | 13 +- lib/build/emailverification-shared2.js | 24 - lib/build/emailverificationprebuiltui.js | 9 +- lib/build/multifactorauth-shared.js | 197 ++ lib/build/multifactorauth.js | 62 + lib/build/multifactorauthprebuiltui.js | 367 +++ lib/build/passwordless-shared3.js | 8 +- lib/build/passwordlessprebuiltui.js | 6 +- .../componentOverrideContext.d.ts | 9 + .../features/factorChooser/index.d.ts | 11 + .../themes/factorChooser/index.d.ts | 5 + .../components/themes/translations.d.ts | 23 + .../recipe/multifactorauth/constants.d.ts | 1 + .../multifactorauth/functionOverrides.d.ts | 6 + lib/build/recipe/multifactorauth/index.d.ts | 46 + .../recipe/multifactorauth/prebuiltui.d.ts | 29 + lib/build/recipe/multifactorauth/recipe.d.ts | 32 + lib/build/recipe/multifactorauth/types.d.ts | 54 + lib/build/recipe/multifactorauth/utils.d.ts | 2 + lib/build/thirdparty-shared2.js | 2 +- lib/build/thirdpartyemailpassword-shared.js | 2 +- lib/build/thirdpartyemailpassword.js | 4 +- .../thirdpartyemailpasswordprebuiltui.js | 17 +- lib/build/thirdpartypasswordlessprebuiltui.js | 8 +- lib/build/thirdpartyprebuiltui.js | 2 +- .../componentOverrideContext.tsx | 7 + .../features/factorChooser/index.tsx | 109 + .../components/themes/factorChooser/index.tsx | 48 + .../components/themes/translations.ts | 23 + lib/ts/recipe/multifactorauth/constants.ts | 15 + .../multifactorauth/functionOverrides.ts | 12 + lib/ts/recipe/multifactorauth/index.ts | 67 + lib/ts/recipe/multifactorauth/prebuiltui.tsx | 102 + lib/ts/recipe/multifactorauth/recipe.tsx | 136 ++ lib/ts/recipe/multifactorauth/types.ts | 81 + lib/ts/recipe/multifactorauth/utils.ts | 41 + package-lock.json | 4 +- package.json | 4 + recipe/multifactorauth/index.d.ts | 17 + recipe/multifactorauth/index.js | 20 + recipe/multifactorauth/prebuiltui.d.ts | 17 + recipe/multifactorauth/prebuiltui.js | 20 + rollup.config.mjs | 2 + 52 files changed, 4420 insertions(+), 2848 deletions(-) create mode 100644 lib/build/emailpassword-shared8.js create mode 100644 lib/build/multifactorauth-shared.js create mode 100644 lib/build/multifactorauth.js create mode 100644 lib/build/multifactorauthprebuiltui.js create mode 100644 lib/build/recipe/multifactorauth/componentOverrideContext.d.ts create mode 100644 lib/build/recipe/multifactorauth/components/features/factorChooser/index.d.ts create mode 100644 lib/build/recipe/multifactorauth/components/themes/factorChooser/index.d.ts create mode 100644 lib/build/recipe/multifactorauth/components/themes/translations.d.ts create mode 100644 lib/build/recipe/multifactorauth/constants.d.ts create mode 100644 lib/build/recipe/multifactorauth/functionOverrides.d.ts create mode 100644 lib/build/recipe/multifactorauth/index.d.ts create mode 100644 lib/build/recipe/multifactorauth/prebuiltui.d.ts create mode 100644 lib/build/recipe/multifactorauth/recipe.d.ts create mode 100644 lib/build/recipe/multifactorauth/types.d.ts create mode 100644 lib/build/recipe/multifactorauth/utils.d.ts create mode 100644 lib/ts/recipe/multifactorauth/componentOverrideContext.tsx create mode 100644 lib/ts/recipe/multifactorauth/components/features/factorChooser/index.tsx create mode 100644 lib/ts/recipe/multifactorauth/components/themes/factorChooser/index.tsx create mode 100644 lib/ts/recipe/multifactorauth/components/themes/translations.ts create mode 100644 lib/ts/recipe/multifactorauth/constants.ts create mode 100644 lib/ts/recipe/multifactorauth/functionOverrides.ts create mode 100644 lib/ts/recipe/multifactorauth/index.ts create mode 100644 lib/ts/recipe/multifactorauth/prebuiltui.tsx create mode 100644 lib/ts/recipe/multifactorauth/recipe.tsx create mode 100644 lib/ts/recipe/multifactorauth/types.ts create mode 100644 lib/ts/recipe/multifactorauth/utils.ts create mode 100644 recipe/multifactorauth/index.d.ts create mode 100644 recipe/multifactorauth/index.js create mode 100644 recipe/multifactorauth/prebuiltui.d.ts create mode 100644 recipe/multifactorauth/prebuiltui.js diff --git a/lib/build/emailpassword-shared.js b/lib/build/emailpassword-shared.js index de43f35f2..fd2e82a3d 100644 --- a/lib/build/emailpassword-shared.js +++ b/lib/build/emailpassword-shared.js @@ -1,16 +1,27 @@ "use strict"; -var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); var jsxRuntime = require("react/jsx-runtime"); -var translationContext = require("./translationContext.js"); +var React = require("react"); -function GeneralError(_a) { - var error = _a.error; - var t = translationContext.useTranslation(); - return jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign({ "data-supertokens": "generalError" }, { children: t(error) }) - ); -} +var styles = + '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n\n[data-supertokens~="resetPasswordHeaderTitle"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n'; -exports.GeneralError = GeneralError; +var ThemeBase = function (_a) { + var children = _a.children, + userStyles = _a.userStyles, + loadDefaultFont = _a.loadDefaultFont; + return jsxRuntime.jsxs(React.Fragment, { + children: [ + children, + loadDefaultFont && + jsxRuntime.jsx("link", { + href: "//fonts.googleapis.com/css?family=Rubik:wght@300;400;600;500;700", + rel: "stylesheet", + type: "text/css", + }), + jsxRuntime.jsxs("style", { children: [styles, userStyles.join("\n")] }), + ], + }); +}; + +exports.ThemeBase = ThemeBase; diff --git a/lib/build/emailpassword-shared2.js b/lib/build/emailpassword-shared2.js index 2cf2045e7..de43f35f2 100644 --- a/lib/build/emailpassword-shared2.js +++ b/lib/build/emailpassword-shared2.js @@ -2,29 +2,15 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); var jsxRuntime = require("react/jsx-runtime"); -require("./index2.js"); var translationContext = require("./translationContext.js"); -/* - * Component. - */ -function Button(_a) { - var type = _a.type, - label = _a.label, - disabled = _a.disabled, - isLoading = _a.isLoading, - onClick = _a.onClick; +function GeneralError(_a) { + var error = _a.error; var t = translationContext.useTranslation(); - if (disabled === undefined) { - disabled = false; - } - return jsxRuntime.jsxs( - "button", - genericComponentOverrideContext.__assign( - { type: type, disabled: disabled, onClick: onClick, "data-supertokens": "button" }, - { children: [t(label), isLoading && "..."] } - ) + return jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign({ "data-supertokens": "generalError" }, { children: t(error) }) ); } -exports.Button = Button; +exports.GeneralError = GeneralError; diff --git a/lib/build/emailpassword-shared3.js b/lib/build/emailpassword-shared3.js index bd3b554b5..2cf2045e7 100644 --- a/lib/build/emailpassword-shared3.js +++ b/lib/build/emailpassword-shared3.js @@ -1,10 +1,30 @@ "use strict"; var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); +var jsxRuntime = require("react/jsx-runtime"); +require("./index2.js"); +var translationContext = require("./translationContext.js"); -var _a = genericComponentOverrideContext.createGenericComponentsOverrideContext(), - useContext = _a[0], - Provider = _a[1]; +/* + * Component. + */ +function Button(_a) { + var type = _a.type, + label = _a.label, + disabled = _a.disabled, + isLoading = _a.isLoading, + onClick = _a.onClick; + var t = translationContext.useTranslation(); + if (disabled === undefined) { + disabled = false; + } + return jsxRuntime.jsxs( + "button", + genericComponentOverrideContext.__assign( + { type: type, disabled: disabled, onClick: onClick, "data-supertokens": "button" }, + { children: [t(label), isLoading && "..."] } + ) + ); +} -exports.Provider = Provider; -exports.useContext = useContext; +exports.Button = Button; diff --git a/lib/build/emailpassword-shared4.js b/lib/build/emailpassword-shared4.js index e3070936a..bd3b554b5 100644 --- a/lib/build/emailpassword-shared4.js +++ b/lib/build/emailpassword-shared4.js @@ -1,509 +1,10 @@ "use strict"; var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); -var EmailPasswordWebJS = require("supertokens-web-js/recipe/emailpassword"); -var NormalisedURLPath = require("supertokens-web-js/utils/normalisedURLPath"); -var utils = require("./authRecipe-shared.js"); -var validators = require("./emailpassword-shared5.js"); -function _interopDefault(e) { - return e && e.__esModule ? e : { default: e }; -} +var _a = genericComponentOverrideContext.createGenericComponentsOverrideContext(), + useContext = _a[0], + Provider = _a[1]; -var EmailPasswordWebJS__default = /*#__PURE__*/ _interopDefault(EmailPasswordWebJS); -var NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath); - -var getFunctionOverrides = function (onHandleEvent) { - return function (originalImp) { - return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, originalImp), { - submitNewPassword: function (input) { - return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { - var response; - return genericComponentOverrideContext.__generator(this, function (_a) { - switch (_a.label) { - case 0: - return [ - 4 /*yield*/, - originalImp.submitNewPassword( - genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, input), - { formFields: [input.formFields[0]] } - ) - ), - ]; - case 1: - response = _a.sent(); - if (response.status === "OK") { - onHandleEvent({ - action: "PASSWORD_RESET_SUCCESSFUL", - userContext: input.userContext, - }); - } - return [2 /*return*/, response]; - } - }); - }); - }, - sendPasswordResetEmail: function (input) { - return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { - var response; - return genericComponentOverrideContext.__generator(this, function (_a) { - switch (_a.label) { - case 0: - return [4 /*yield*/, originalImp.sendPasswordResetEmail(input)]; - case 1: - response = _a.sent(); - if (response.status === "OK") { - onHandleEvent({ - action: "RESET_PASSWORD_EMAIL_SENT", - email: input.formFields.find(function (_a) { - var id = _a.id; - return id === "email"; - }).value, - userContext: input.userContext, - }); - } - return [2 /*return*/, response]; - } - }); - }); - }, - signUp: function (input) { - return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { - var response; - return genericComponentOverrideContext.__generator(this, function (_a) { - switch (_a.label) { - case 0: - return [4 /*yield*/, originalImp.signUp(input)]; - case 1: - response = _a.sent(); - if (response.status === "OK") { - onHandleEvent({ - action: "SUCCESS", - isNewRecipeUser: true, - user: response.user, - userContext: input.userContext, - }); - } - return [2 /*return*/, response]; - } - }); - }); - }, - signIn: function (input) { - return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { - var response; - return genericComponentOverrideContext.__generator(this, function (_a) { - switch (_a.label) { - case 0: - return [4 /*yield*/, originalImp.signIn(input)]; - case 1: - response = _a.sent(); - if (response.status === "OK") { - onHandleEvent({ - action: "SUCCESS", - isNewRecipeUser: false, - user: response.user, - userContext: input.userContext, - }); - } - return [2 /*return*/, response]; - } - }); - }); - }, - }); - }; -}; - -/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. - * - * This software is licensed under the Apache License, Version 2.0 (the - * "License") as published by the Apache Software Foundation. - * - * You may not use this file except in compliance with the License. You may - * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -function normaliseEmailPasswordConfig(config) { - if (config === undefined) { - config = {}; - } - var signInAndUpFeature = normaliseSignInAndUpFeature(config.signInAndUpFeature); - var signUpPasswordField = signInAndUpFeature.signUpForm.formFields.find(function (field) { - return field.id === "password"; - }); - var signUpEmailField = signInAndUpFeature.signUpForm.formFields.find(function (field) { - return field.id === "email"; - }); - var resetPasswordUsingTokenFeature = normaliseResetPasswordUsingTokenFeature( - signUpPasswordField.validate, - signUpEmailField, - config.resetPasswordUsingTokenFeature - ); - var override = genericComponentOverrideContext.__assign( - { - functions: function (originalImplementation) { - return originalImplementation; - }, - }, - config.override - ); - return genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, utils.normaliseAuthRecipe(config)), - { - signInAndUpFeature: signInAndUpFeature, - resetPasswordUsingTokenFeature: resetPasswordUsingTokenFeature, - override: override, - } - ); -} -function normaliseSignInAndUpFeature(config) { - if (config === undefined) { - config = {}; - } - var disableDefaultUI = config.disableDefaultUI === true; - var signUpForm = normaliseSignUpFormFeatureConfig(config.signUpForm); - var defaultToSignUp = config.defaultToSignUp !== undefined ? config.defaultToSignUp : false; - /* - * Default Sign In corresponds to computed Sign Up fields filtered by email and password only. - * i.e. If the user overrides sign Up fields, that is propagated to default sign In fields. - * Exception made of the password validator which only verifies that the value is not empty for login - * https://github.com/supertokens/supertokens-auth-react/issues/21 - */ - var defaultSignInFields = signUpForm.formFields.reduce(function (signInFieldsAccumulator, field) { - if (field.id === "email") { - return genericComponentOverrideContext.__spreadArray( - genericComponentOverrideContext.__spreadArray([], signInFieldsAccumulator, true), - [field], - false - ); - } - if (field.id === "password") { - return genericComponentOverrideContext.__spreadArray( - genericComponentOverrideContext.__spreadArray([], signInFieldsAccumulator, true), - [ - genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, field), { - autoComplete: "current-password", - validate: validators.defaultLoginPasswordValidator, - }), - ], - false - ); - } - return signInFieldsAccumulator; - }, []); - var signInForm = normaliseSignInFormFeatureConfig(defaultSignInFields, config.signInForm); - return { - disableDefaultUI: disableDefaultUI, - defaultToSignUp: defaultToSignUp, - signUpForm: signUpForm, - signInForm: signInForm, - }; -} -function normaliseSignUpFormFeatureConfig(config) { - if (config === undefined) { - config = {}; - } - var defaultFormFields = getDefaultFormFields(); - var userFormFields = []; - if (config.formFields !== undefined) { - userFormFields = config.formFields; - } - var formFields = mergeFormFields(defaultFormFields, userFormFields); - var privacyPolicyLink = config.privacyPolicyLink; - var termsOfServiceLink = config.termsOfServiceLink; - var style = config.style !== undefined ? config.style : ""; - return { - style: style, - formFields: formFields, - privacyPolicyLink: privacyPolicyLink, - termsOfServiceLink: termsOfServiceLink, - }; -} -function normaliseSignInFormFeatureConfig(defaultFormFields, config) { - if (config === undefined) { - config = {}; - } - var userFormFields = []; - if (config.formFields !== undefined) { - userFormFields = config.formFields - // Filter on email and password only. - .filter(function (field) { - return validators.MANDATORY_FORM_FIELDS_ID_ARRAY.includes(field.id); - }) - // Sign In fields are never optional. - .map(function (field) { - return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, field), { - optional: false, - }); - }); - } - var formFields = mergeFormFields(defaultFormFields, userFormFields); - var style = config.style !== undefined ? config.style : ""; - return { - style: style, - formFields: formFields, - }; -} -function getDefaultFormFields() { - return [getDefaultEmailFormField(), getDefaultPasswordFormField()]; -} -function getDefaultEmailFormField() { - return { - id: "email", - label: "EMAIL_PASSWORD_EMAIL_LABEL", - placeholder: "EMAIL_PASSWORD_EMAIL_PLACEHOLDER", - validate: validators.defaultEmailValidator, - optional: false, - autoComplete: "email", - }; -} -function getDefaultPasswordFormField() { - return { - id: "password", - label: "EMAIL_PASSWORD_PASSWORD_LABEL", - placeholder: "EMAIL_PASSWORD_PASSWORD_PLACEHOLDER", - validate: validators.defaultPasswordValidator, - optional: false, - autoComplete: "new-password", - }; -} -function normaliseResetPasswordUsingTokenFeature(signUpPasswordFieldValidate, signUpEmailField, config) { - if (config === undefined) { - config = {}; - } - var disableDefaultUI = config.disableDefaultUI === true; - var submitNewPasswordFormStyle = - config.submitNewPasswordForm !== undefined && config.submitNewPasswordForm.style !== undefined - ? config.submitNewPasswordForm.style - : ""; - var submitNewPasswordForm = { - style: submitNewPasswordFormStyle, - formFields: [ - { - id: "password", - label: "EMAIL_PASSWORD_NEW_PASSWORD_LABEL", - placeholder: "EMAIL_PASSWORD_NEW_PASSWORD_PLACEHOLDER", - validate: signUpPasswordFieldValidate, - optional: false, - autoComplete: "new-password", - }, - { - id: "confirm-password", - label: "EMAIL_PASSWORD_CONFIRM_PASSWORD_LABEL", - placeholder: "EMAIL_PASSWORD_CONFIRM_PASSWORD_PLACEHOLDER", - validate: signUpPasswordFieldValidate, - optional: false, - autoComplete: "new-password", - }, - ], - }; - var enterEmailFormStyle = - config.enterEmailForm !== undefined && config.enterEmailForm.style !== undefined - ? config.enterEmailForm.style - : ""; - var enterEmailForm = { - style: enterEmailFormStyle, - formFields: [ - genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, getDefaultEmailFormField()), - { validate: signUpEmailField.validate, placeholder: "", autofocus: true } - ), - ], - }; - return { - disableDefaultUI: disableDefaultUI, - submitNewPasswordForm: submitNewPasswordForm, - enterEmailForm: enterEmailForm, - }; -} -/* - * mergeFormFields by keeping the provided order, defaultFormFields or merged first, and unmerged userFormFields after. - */ -function mergeFormFields(defaultFormFields, userFormFields) { - // Create a new array with default fields. - var mergedFormFields = defaultFormFields; - // Loop through user provided fields. - for (var i = 0; i < userFormFields.length; i++) { - var userField = userFormFields[i]; - var isNewField = true; - // Loop through the merged fields array. - for (var j = 0; j < mergedFormFields.length; j++) { - var mergedField = mergedFormFields[j]; - // If id is equal, merge the fields - if (userField.id === mergedField.id) { - // Make sure that email and password are kept mandatory. - var optional = mergedField.optional; // Init with default value. - // If user provided value, overwrite. - if (userField.optional !== undefined) { - optional = userField.optional; - } - // If "email" or "password", always mandatory. - if (validators.MANDATORY_FORM_FIELDS_ID_ARRAY.includes(userField.id)) { - optional = false; - } - // Merge. - mergedFormFields[j] = genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, mergedFormFields[j]), - userField - ), - { optional: optional } - ); - isNewField = false; - break; - } - } - // If new field, push to mergeFormFields. - if (isNewField) { - mergedFormFields.push( - genericComponentOverrideContext.__assign( - { optional: false, placeholder: userField.label, validate: validators.defaultValidate }, - userField - ) - ); - } - } - return mergedFormFields.map(function (field) { - return getFormattedFormField(field); - }); -} -function getFormattedFormField(field) { - var _this = this; - return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, field), { - validate: function (value) { - return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { - return genericComponentOverrideContext.__generator(this, function (_a) { - switch (_a.label) { - case 0: - // Absent or not optional empty field - if (value === "" && field.optional === false) { - return [2 /*return*/, "ERROR_NON_OPTIONAL"]; - } - return [4 /*yield*/, field.validate(value)]; - case 1: - return [2 /*return*/, _a.sent()]; - } - }); - }); - }, - }); -} - -/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. - * - * This software is licensed under the Apache License, Version 2.0 (the - * "License") as published by the Apache Software Foundation. - * - * You may not use this file except in compliance with the License. You may - * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -/* - * Class. - */ -var EmailPassword = /** @class */ (function (_super) { - genericComponentOverrideContext.__extends(EmailPassword, _super); - function EmailPassword(config, webJSRecipe) { - if (webJSRecipe === void 0) { - webJSRecipe = EmailPasswordWebJS__default.default; - } - var _this = _super.call(this, config) || this; - _this.webJSRecipe = webJSRecipe; - _this.recipeID = EmailPassword.RECIPE_ID; - _this.getDefaultRedirectionURL = function (context) { - return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { - var resetPasswordPath; - return genericComponentOverrideContext.__generator(this, function (_a) { - if (context.action === "RESET_PASSWORD") { - resetPasswordPath = new NormalisedURLPath__default.default( - validators.DEFAULT_RESET_PASSWORD_PATH - ); - return [ - 2 /*return*/, - "" - .concat( - this.config.appInfo.websiteBasePath - .appendPath(resetPasswordPath) - .getAsStringDangerous(), - "?rid=" - ) - .concat(this.config.recipeId), - ]; - } - return [2 /*return*/, this.getAuthRecipeDefaultRedirectionURL(context)]; - }); - }); - }; - return _this; - } - EmailPassword.init = function (config) { - var normalisedConfig = normaliseEmailPasswordConfig(config); - return { - recipeID: EmailPassword.RECIPE_ID, - authReact: function (appInfo) { - EmailPassword.instance = new EmailPassword( - genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, normalisedConfig), - { appInfo: appInfo, recipeId: EmailPassword.RECIPE_ID } - ) - ); - return EmailPassword.instance; - }, - webJS: EmailPasswordWebJS__default.default.init( - genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, normalisedConfig), - { - override: { - functions: function (originalImpl, builder) { - var functions = getFunctionOverrides(normalisedConfig.onHandleEvent); - builder.override(functions); - builder.override(normalisedConfig.override.functions); - return originalImpl; - }, - }, - } - ) - ), - }; - }; - EmailPassword.getInstanceOrThrow = function () { - if (EmailPassword.instance === undefined) { - var error = - "No instance of EmailPassword found. Make sure to call the EmailPassword.init method." + - "See https://supertokens.io/docs/emailpassword/quick-setup/frontend"; - // eslint-disable-next-line supertokens-auth-react/no-direct-window-object - if (typeof window === "undefined") { - error = error + genericComponentOverrideContext.SSR_ERROR; - } - throw Error(error); - } - return EmailPassword.instance; - }; - /* - * Tests methods. - */ - EmailPassword.reset = function () { - if (!genericComponentOverrideContext.isTest()) { - return; - } - EmailPassword.instance = undefined; - return; - }; - EmailPassword.RECIPE_ID = "emailpassword"; - return EmailPassword; -})(utils.AuthRecipe); - -exports.EmailPassword = EmailPassword; -exports.normaliseEmailPasswordConfig = normaliseEmailPasswordConfig; +exports.Provider = Provider; +exports.useContext = useContext; diff --git a/lib/build/emailpassword-shared5.js b/lib/build/emailpassword-shared5.js index 2f2d37441..0fef60a98 100644 --- a/lib/build/emailpassword-shared5.js +++ b/lib/build/emailpassword-shared5.js @@ -1,6 +1,120 @@ "use strict"; var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); +var EmailPasswordWebJS = require("supertokens-web-js/recipe/emailpassword"); +var NormalisedURLPath = require("supertokens-web-js/utils/normalisedURLPath"); +var utils = require("./authRecipe-shared.js"); +var validators = require("./emailpassword-shared6.js"); + +function _interopDefault(e) { + return e && e.__esModule ? e : { default: e }; +} + +var EmailPasswordWebJS__default = /*#__PURE__*/ _interopDefault(EmailPasswordWebJS); +var NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath); + +var getFunctionOverrides = function (onHandleEvent) { + return function (originalImp) { + return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, originalImp), { + submitNewPassword: function (input) { + return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { + var response; + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + return [ + 4 /*yield*/, + originalImp.submitNewPassword( + genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, input), + { formFields: [input.formFields[0]] } + ) + ), + ]; + case 1: + response = _a.sent(); + if (response.status === "OK") { + onHandleEvent({ + action: "PASSWORD_RESET_SUCCESSFUL", + userContext: input.userContext, + }); + } + return [2 /*return*/, response]; + } + }); + }); + }, + sendPasswordResetEmail: function (input) { + return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { + var response; + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + return [4 /*yield*/, originalImp.sendPasswordResetEmail(input)]; + case 1: + response = _a.sent(); + if (response.status === "OK") { + onHandleEvent({ + action: "RESET_PASSWORD_EMAIL_SENT", + email: input.formFields.find(function (_a) { + var id = _a.id; + return id === "email"; + }).value, + userContext: input.userContext, + }); + } + return [2 /*return*/, response]; + } + }); + }); + }, + signUp: function (input) { + return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { + var response; + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + return [4 /*yield*/, originalImp.signUp(input)]; + case 1: + response = _a.sent(); + if (response.status === "OK") { + onHandleEvent({ + action: "SUCCESS", + isNewRecipeUser: true, + user: response.user, + userContext: input.userContext, + }); + } + return [2 /*return*/, response]; + } + }); + }); + }, + signIn: function (input) { + return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { + var response; + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + return [4 /*yield*/, originalImp.signIn(input)]; + case 1: + response = _a.sent(); + if (response.status === "OK") { + onHandleEvent({ + action: "SUCCESS", + isNewRecipeUser: false, + user: response.user, + userContext: input.userContext, + }); + } + return [2 /*return*/, response]; + } + }); + }); + }, + }); + }; +}; /* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. * @@ -16,8 +130,271 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext * License for the specific language governing permissions and limitations * under the License. */ -var MANDATORY_FORM_FIELDS_ID_ARRAY = ["email", "password"]; -var DEFAULT_RESET_PASSWORD_PATH = "/reset-password"; +function normaliseEmailPasswordConfig(config) { + if (config === undefined) { + config = {}; + } + var signInAndUpFeature = normaliseSignInAndUpFeature(config.signInAndUpFeature); + var signUpPasswordField = signInAndUpFeature.signUpForm.formFields.find(function (field) { + return field.id === "password"; + }); + var signUpEmailField = signInAndUpFeature.signUpForm.formFields.find(function (field) { + return field.id === "email"; + }); + var resetPasswordUsingTokenFeature = normaliseResetPasswordUsingTokenFeature( + signUpPasswordField.validate, + signUpEmailField, + config.resetPasswordUsingTokenFeature + ); + var override = genericComponentOverrideContext.__assign( + { + functions: function (originalImplementation) { + return originalImplementation; + }, + }, + config.override + ); + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, utils.normaliseAuthRecipe(config)), + { + signInAndUpFeature: signInAndUpFeature, + resetPasswordUsingTokenFeature: resetPasswordUsingTokenFeature, + override: override, + } + ); +} +function normaliseSignInAndUpFeature(config) { + if (config === undefined) { + config = {}; + } + var disableDefaultUI = config.disableDefaultUI === true; + var signUpForm = normaliseSignUpFormFeatureConfig(config.signUpForm); + var defaultToSignUp = config.defaultToSignUp !== undefined ? config.defaultToSignUp : false; + /* + * Default Sign In corresponds to computed Sign Up fields filtered by email and password only. + * i.e. If the user overrides sign Up fields, that is propagated to default sign In fields. + * Exception made of the password validator which only verifies that the value is not empty for login + * https://github.com/supertokens/supertokens-auth-react/issues/21 + */ + var defaultSignInFields = signUpForm.formFields.reduce(function (signInFieldsAccumulator, field) { + if (field.id === "email") { + return genericComponentOverrideContext.__spreadArray( + genericComponentOverrideContext.__spreadArray([], signInFieldsAccumulator, true), + [field], + false + ); + } + if (field.id === "password") { + return genericComponentOverrideContext.__spreadArray( + genericComponentOverrideContext.__spreadArray([], signInFieldsAccumulator, true), + [ + genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, field), { + autoComplete: "current-password", + validate: validators.defaultLoginPasswordValidator, + }), + ], + false + ); + } + return signInFieldsAccumulator; + }, []); + var signInForm = normaliseSignInFormFeatureConfig(defaultSignInFields, config.signInForm); + return { + disableDefaultUI: disableDefaultUI, + defaultToSignUp: defaultToSignUp, + signUpForm: signUpForm, + signInForm: signInForm, + }; +} +function normaliseSignUpFormFeatureConfig(config) { + if (config === undefined) { + config = {}; + } + var defaultFormFields = getDefaultFormFields(); + var userFormFields = []; + if (config.formFields !== undefined) { + userFormFields = config.formFields; + } + var formFields = mergeFormFields(defaultFormFields, userFormFields); + var privacyPolicyLink = config.privacyPolicyLink; + var termsOfServiceLink = config.termsOfServiceLink; + var style = config.style !== undefined ? config.style : ""; + return { + style: style, + formFields: formFields, + privacyPolicyLink: privacyPolicyLink, + termsOfServiceLink: termsOfServiceLink, + }; +} +function normaliseSignInFormFeatureConfig(defaultFormFields, config) { + if (config === undefined) { + config = {}; + } + var userFormFields = []; + if (config.formFields !== undefined) { + userFormFields = config.formFields + // Filter on email and password only. + .filter(function (field) { + return validators.MANDATORY_FORM_FIELDS_ID_ARRAY.includes(field.id); + }) + // Sign In fields are never optional. + .map(function (field) { + return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, field), { + optional: false, + }); + }); + } + var formFields = mergeFormFields(defaultFormFields, userFormFields); + var style = config.style !== undefined ? config.style : ""; + return { + style: style, + formFields: formFields, + }; +} +function getDefaultFormFields() { + return [getDefaultEmailFormField(), getDefaultPasswordFormField()]; +} +function getDefaultEmailFormField() { + return { + id: "email", + label: "EMAIL_PASSWORD_EMAIL_LABEL", + placeholder: "EMAIL_PASSWORD_EMAIL_PLACEHOLDER", + validate: validators.defaultEmailValidator, + optional: false, + autoComplete: "email", + }; +} +function getDefaultPasswordFormField() { + return { + id: "password", + label: "EMAIL_PASSWORD_PASSWORD_LABEL", + placeholder: "EMAIL_PASSWORD_PASSWORD_PLACEHOLDER", + validate: validators.defaultPasswordValidator, + optional: false, + autoComplete: "new-password", + }; +} +function normaliseResetPasswordUsingTokenFeature(signUpPasswordFieldValidate, signUpEmailField, config) { + if (config === undefined) { + config = {}; + } + var disableDefaultUI = config.disableDefaultUI === true; + var submitNewPasswordFormStyle = + config.submitNewPasswordForm !== undefined && config.submitNewPasswordForm.style !== undefined + ? config.submitNewPasswordForm.style + : ""; + var submitNewPasswordForm = { + style: submitNewPasswordFormStyle, + formFields: [ + { + id: "password", + label: "EMAIL_PASSWORD_NEW_PASSWORD_LABEL", + placeholder: "EMAIL_PASSWORD_NEW_PASSWORD_PLACEHOLDER", + validate: signUpPasswordFieldValidate, + optional: false, + autoComplete: "new-password", + }, + { + id: "confirm-password", + label: "EMAIL_PASSWORD_CONFIRM_PASSWORD_LABEL", + placeholder: "EMAIL_PASSWORD_CONFIRM_PASSWORD_PLACEHOLDER", + validate: signUpPasswordFieldValidate, + optional: false, + autoComplete: "new-password", + }, + ], + }; + var enterEmailFormStyle = + config.enterEmailForm !== undefined && config.enterEmailForm.style !== undefined + ? config.enterEmailForm.style + : ""; + var enterEmailForm = { + style: enterEmailFormStyle, + formFields: [ + genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, getDefaultEmailFormField()), + { validate: signUpEmailField.validate, placeholder: "", autofocus: true } + ), + ], + }; + return { + disableDefaultUI: disableDefaultUI, + submitNewPasswordForm: submitNewPasswordForm, + enterEmailForm: enterEmailForm, + }; +} +/* + * mergeFormFields by keeping the provided order, defaultFormFields or merged first, and unmerged userFormFields after. + */ +function mergeFormFields(defaultFormFields, userFormFields) { + // Create a new array with default fields. + var mergedFormFields = defaultFormFields; + // Loop through user provided fields. + for (var i = 0; i < userFormFields.length; i++) { + var userField = userFormFields[i]; + var isNewField = true; + // Loop through the merged fields array. + for (var j = 0; j < mergedFormFields.length; j++) { + var mergedField = mergedFormFields[j]; + // If id is equal, merge the fields + if (userField.id === mergedField.id) { + // Make sure that email and password are kept mandatory. + var optional = mergedField.optional; // Init with default value. + // If user provided value, overwrite. + if (userField.optional !== undefined) { + optional = userField.optional; + } + // If "email" or "password", always mandatory. + if (validators.MANDATORY_FORM_FIELDS_ID_ARRAY.includes(userField.id)) { + optional = false; + } + // Merge. + mergedFormFields[j] = genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, mergedFormFields[j]), + userField + ), + { optional: optional } + ); + isNewField = false; + break; + } + } + // If new field, push to mergeFormFields. + if (isNewField) { + mergedFormFields.push( + genericComponentOverrideContext.__assign( + { optional: false, placeholder: userField.label, validate: validators.defaultValidate }, + userField + ) + ); + } + } + return mergedFormFields.map(function (field) { + return getFormattedFormField(field); + }); +} +function getFormattedFormField(field) { + var _this = this; + return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, field), { + validate: function (value) { + return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + // Absent or not optional empty field + if (value === "" && field.optional === false) { + return [2 /*return*/, "ERROR_NON_OPTIONAL"]; + } + return [4 /*yield*/, field.validate(value)]; + case 1: + return [2 /*return*/, _a.sent()]; + } + }); + }); + }, + }); +} /* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. * @@ -34,88 +411,99 @@ var DEFAULT_RESET_PASSWORD_PATH = "/reset-password"; * under the License. */ /* - * defaultEmailValidator. + * Class. */ -function defaultEmailValidator(value) { - return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { - var defaultEmailValidatorRegexp; - return genericComponentOverrideContext.__generator(this, function (_a) { - if (typeof value !== "string") { - return [2 /*return*/, "ERROR_EMAIL_NON_STRING"]; - } - value = value.trim(); - defaultEmailValidatorRegexp = - // eslint-disable-next-line no-useless-escape - /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; - // We check if the email syntax is correct - // As per https://github.com/supertokens/supertokens-auth-react/issues/5#issuecomment-709512438 - // Regex from https://stackoverflow.com/a/46181/3867175 - if (value.match(defaultEmailValidatorRegexp) === null) { - return [2 /*return*/, "ERROR_EMAIL_INVALID"]; +var EmailPassword = /** @class */ (function (_super) { + genericComponentOverrideContext.__extends(EmailPassword, _super); + function EmailPassword(config, webJSRecipe) { + if (webJSRecipe === void 0) { + webJSRecipe = EmailPasswordWebJS__default.default; + } + var _this = _super.call(this, config) || this; + _this.webJSRecipe = webJSRecipe; + _this.recipeID = EmailPassword.RECIPE_ID; + _this.getDefaultRedirectionURL = function (context) { + return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { + var resetPasswordPath; + return genericComponentOverrideContext.__generator(this, function (_a) { + if (context.action === "RESET_PASSWORD") { + resetPasswordPath = new NormalisedURLPath__default.default( + validators.DEFAULT_RESET_PASSWORD_PATH + ); + return [ + 2 /*return*/, + "" + .concat( + this.config.appInfo.websiteBasePath + .appendPath(resetPasswordPath) + .getAsStringDangerous(), + "?rid=" + ) + .concat(this.config.recipeId), + ]; + } + return [2 /*return*/, this.getAuthRecipeDefaultRedirectionURL(context)]; + }); + }); + }; + return _this; + } + EmailPassword.init = function (config) { + var normalisedConfig = normaliseEmailPasswordConfig(config); + return { + recipeID: EmailPassword.RECIPE_ID, + authReact: function (appInfo) { + EmailPassword.instance = new EmailPassword( + genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, normalisedConfig), + { appInfo: appInfo, recipeId: EmailPassword.RECIPE_ID } + ) + ); + return EmailPassword.instance; + }, + webJS: EmailPasswordWebJS__default.default.init( + genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, normalisedConfig), + { + override: { + functions: function (originalImpl, builder) { + var functions = getFunctionOverrides(normalisedConfig.onHandleEvent); + builder.override(functions); + builder.override(normalisedConfig.override.functions); + return originalImpl; + }, + }, + } + ) + ), + }; + }; + EmailPassword.getInstanceOrThrow = function () { + if (EmailPassword.instance === undefined) { + var error = + "No instance of EmailPassword found. Make sure to call the EmailPassword.init method." + + "See https://supertokens.io/docs/emailpassword/quick-setup/frontend"; + // eslint-disable-next-line supertokens-auth-react/no-direct-window-object + if (typeof window === "undefined") { + error = error + genericComponentOverrideContext.SSR_ERROR; } - return [2 /*return*/, undefined]; - }); - }); -} -/* - * defaultPasswordValidator. - * min 8 characters. - * Contains lowercase, uppercase, and numbers. - */ -function defaultPasswordValidator(value) { - return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { - return genericComponentOverrideContext.__generator(this, function (_a) { - if (typeof value !== "string") { - return [2 /*return*/, "ERROR_PASSWORD_NON_STRING"]; - } - // length >= 8 && < 100 - // must have a number and a character - // as per https://github.com/supertokens/supertokens-auth-react/issues/5#issuecomment-709512438 - if (value.length < 8) { - return [2 /*return*/, "ERROR_PASSWORD_TOO_SHORT"]; - } - if (value.length >= 100) { - return [2 /*return*/, "ERROR_PASSWORD_TOO_LONG"]; - } - if (value.match(/^.*[A-Za-z]+.*$/) === null) { - return [2 /*return*/, "ERROR_PASSWORD_NO_ALPHA"]; - } - if (value.match(/^.*[0-9]+.*$/) === null) { - return [2 /*return*/, "ERROR_PASSWORD_NO_NUM"]; - } - return [2 /*return*/, undefined]; - }); - }); -} -/* - * defaultLoginPasswordValidator. - * type string - */ -function defaultLoginPasswordValidator(value) { - return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { - return genericComponentOverrideContext.__generator(this, function (_a) { - if (typeof value !== "string") { - return [2 /*return*/, "ERROR_PASSWORD_NON_STRING"]; - } - return [2 /*return*/, undefined]; - }); - }); -} -/* - * defaultValidate - */ -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function defaultValidate(_) { - return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { - return genericComponentOverrideContext.__generator(this, function (_a) { - return [2 /*return*/, undefined]; - }); - }); -} + throw Error(error); + } + return EmailPassword.instance; + }; + /* + * Tests methods. + */ + EmailPassword.reset = function () { + if (!genericComponentOverrideContext.isTest()) { + return; + } + EmailPassword.instance = undefined; + return; + }; + EmailPassword.RECIPE_ID = "emailpassword"; + return EmailPassword; +})(utils.AuthRecipe); -exports.DEFAULT_RESET_PASSWORD_PATH = DEFAULT_RESET_PASSWORD_PATH; -exports.MANDATORY_FORM_FIELDS_ID_ARRAY = MANDATORY_FORM_FIELDS_ID_ARRAY; -exports.defaultEmailValidator = defaultEmailValidator; -exports.defaultLoginPasswordValidator = defaultLoginPasswordValidator; -exports.defaultPasswordValidator = defaultPasswordValidator; -exports.defaultValidate = defaultValidate; +exports.EmailPassword = EmailPassword; +exports.normaliseEmailPasswordConfig = normaliseEmailPasswordConfig; diff --git a/lib/build/emailpassword-shared6.js b/lib/build/emailpassword-shared6.js index 86d336eb2..2f2d37441 100644 --- a/lib/build/emailpassword-shared6.js +++ b/lib/build/emailpassword-shared6.js @@ -1,59 +1,6 @@ "use strict"; var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); -var jsxRuntime = require("react/jsx-runtime"); -var NormalisedURLPath = require("supertokens-web-js/utils/normalisedURLPath"); -var uiEntry = require("./index2.js"); -var SuperTokensBranding = require("./SuperTokensBranding.js"); -var componentOverrideContext = require("./emailpassword-shared3.js"); -var React = require("react"); -var translations = require("./translations.js"); -var translations$1 = require("./emailverification-shared2.js"); -var translationContext = require("./translationContext.js"); -var arrowLeftIcon = require("./arrowLeftIcon.js"); -var formBase = require("./emailpassword-shared7.js"); -var generalError = require("./emailpassword-shared.js"); -var STGeneralError = require("supertokens-web-js/utils/error"); -var button = require("./emailpassword-shared2.js"); -var recipe = require("./session-shared2.js"); -var STGeneralError$1 = require("supertokens-web-js/lib/build/error"); -var validators = require("./emailpassword-shared5.js"); -var recipe$1 = require("./emailpassword-shared4.js"); - -function _interopDefault(e) { - return e && e.__esModule ? e : { default: e }; -} - -function _interopNamespace(e) { - if (e && e.__esModule) return e; - var n = Object.create(null); - if (e) { - Object.keys(e).forEach(function (k) { - if (k !== "default") { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty( - n, - k, - d.get - ? d - : { - enumerable: true, - get: function () { - return e[k]; - }, - } - ); - } - }); - } - n.default = e; - return Object.freeze(n); -} - -var NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath); -var React__namespace = /*#__PURE__*/ _interopNamespace(React); -var STGeneralError__default = /*#__PURE__*/ _interopDefault(STGeneralError); -var STGeneralError__default$1 = /*#__PURE__*/ _interopDefault(STGeneralError$1); /* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. * @@ -69,1499 +16,106 @@ var STGeneralError__default$1 = /*#__PURE__*/ _interopDefault(STGeneralError$1); * License for the specific language governing permissions and limitations * under the License. */ -/* - * Imports. - */ -/* - * Component. - */ -function HeavyArrowLeftIcon(_a) { - var color = _a.color; - return jsxRuntime.jsx( - "svg", - genericComponentOverrideContext.__assign( - { - xmlns: "http://www.w3.org/2000/svg", - width: "16", - height: "13", - viewBox: "0 0 16 13", - "data-supertokens": "heavyArrowLeftIcon", - }, - { - children: jsxRuntime.jsx("path", { - fill: color, - d: "M13 6.8h.022H3.8l2.9 2.9a.761.761 0 0 1 0 1.07l-.451.451a.754.754 0 0 1-1.064 0L.22 6.254a.759.759 0 0 1 0-1.068L5.186.22a.755.755 0 0 1 1.064 0l.45.451a.746.746 0 0 1 .22.532.724.724 0 0 1-.22.522l-2.93 2.92h9.24a.781.781 0 0 1 .764.773v.638A.766.766 0 0 1 13 6.8z", - transform: "translate(1.182 .708)", - }), - } - ) - ); -} +var MANDATORY_FORM_FIELDS_ID_ARRAY = ["email", "password"]; +var DEFAULT_RESET_PASSWORD_PATH = "/reset-password"; +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ /* - * Component. + * defaultEmailValidator. */ -function BackButton(_a) { - var onClick = _a.onClick; - return jsxRuntime.jsx( - "button", - genericComponentOverrideContext.__assign( - { onClick: onClick, "data-supertokens": "backButton backButtonCommon" }, - { children: jsxRuntime.jsx(HeavyArrowLeftIcon, { color: "rgb(var(--palette-textTitle))" }) } - ) - ); +function defaultEmailValidator(value) { + return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { + var defaultEmailValidatorRegexp; + return genericComponentOverrideContext.__generator(this, function (_a) { + if (typeof value !== "string") { + return [2 /*return*/, "ERROR_EMAIL_NON_STRING"]; + } + value = value.trim(); + defaultEmailValidatorRegexp = + // eslint-disable-next-line no-useless-escape + /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; + // We check if the email syntax is correct + // As per https://github.com/supertokens/supertokens-auth-react/issues/5#issuecomment-709512438 + // Regex from https://stackoverflow.com/a/46181/3867175 + if (value.match(defaultEmailValidatorRegexp) === null) { + return [2 /*return*/, "ERROR_EMAIL_INVALID"]; + } + return [2 /*return*/, undefined]; + }); + }); } - /* - * Component. + * defaultPasswordValidator. + * min 8 characters. + * Contains lowercase, uppercase, and numbers. */ -function BackToSignInButton(_a) { - var onClick = _a.onClick; - var t = translationContext.useTranslation(); - return jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "secondaryText secondaryLinkWithLeftArrow", onClick: onClick }, - { - children: [ - jsxRuntime.jsx(arrowLeftIcon.ArrowLeftIcon, { color: "rgb(var(--palette-secondaryText))" }), - t("EMAIL_PASSWORD_RESET_SIGN_IN_LINK"), - ], +function defaultPasswordValidator(value) { + return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { + return genericComponentOverrideContext.__generator(this, function (_a) { + if (typeof value !== "string") { + return [2 /*return*/, "ERROR_PASSWORD_NON_STRING"]; } - ) - ); -} - -var EmailPasswordResetPasswordEmail = function (props) { - var t = translationContext.useTranslation(); - var userContext = uiEntry.useUserContext(); - var _a = React.useState("READY"), - status = _a[0], - setStatus = _a[1]; - var _b = React.useState(""), - emailFieldValue = _b[0], - setEmailFieldValue = _b[1]; - var onSuccess = function () { - setStatus("SENT"); - }; - var resend = function () { - setStatus("READY"); - }; - var formFields = props.formFields; - var emailSuccessText = - t("EMAIL_PASSWORD_RESET_SEND_BEFORE_EMAIL") + - (emailFieldValue !== undefined && emailFieldValue.length > 0 - ? emailFieldValue - : t("EMAIL_PASSWORD_RESET_SEND_FALLBACK_EMAIL")) + - t("EMAIL_PASSWORD_RESET_SEND_AFTER_EMAIL"); - if (status === "SENT") { - return jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "container" }, - { - children: jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "row" }, - { - children: [ - jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "primaryText enterEmailSuccessMessage" }, - { - children: [ - emailSuccessText, - jsxRuntime.jsx( - "span", - genericComponentOverrideContext.__assign( - { - "data-supertokens": "link resendEmailLink", - onClick: resend, - }, - { children: t("EMAIL_PASSWORD_RESET_RESEND_LINK") } - ) - ), - ], - } - ) - ), - jsxRuntime.jsx(BackToSignInButton, { onClick: props.onBackButtonClicked }), - ], - } - ) - ), - } - ) - ); - } - // Otherwise, return Form. - return jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "container" }, - { - children: jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "row" }, - { - children: [ - jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "headerTitle resetPasswordHeaderTitle" }, - { - children: [ - jsxRuntime.jsx(BackButton, { onClick: props.onBackButtonClicked }), - t("EMAIL_PASSWORD_RESET_HEADER_TITLE"), - jsxRuntime.jsx("span", { - "data-supertokens": "backButtonPlaceholder backButtonCommon", - }), - ], - } - ) - ), - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "headerSubtitle" }, - { - children: jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "secondaryText" }, - { children: t("EMAIL_PASSWORD_RESET_HEADER_SUBTITLE") } - ) - ), - } - ) - ), - props.error !== undefined && - jsxRuntime.jsx(generalError.GeneralError, { error: props.error }), - jsxRuntime.jsx(formBase.FormBase, { - clearError: props.clearError, - onError: props.onError, - formFields: formFields, - buttonLabel: "EMAIL_PASSWORD_RESET_SEND_BTN", - onSuccess: onSuccess, - callAPI: function (formFields) { - return genericComponentOverrideContext.__awaiter( - void 0, - void 0, - void 0, - function () { - var validationErrors, emailField, resp; - return genericComponentOverrideContext.__generator(this, function (_a) { - switch (_a.label) { - case 0: - return [ - 4 /*yield*/, - genericComponentOverrideContext.validateForm( - formFields, - props.config.resetPasswordUsingTokenFeature - .enterEmailForm.formFields - ), - ]; - case 1: - validationErrors = _a.sent(); - if (validationErrors.length > 0) { - return [ - 2 /*return*/, - { - status: "FIELD_ERROR", - formFields: validationErrors, - }, - ]; - } - emailField = formFields.find(function (field) { - return field.id === "email"; - }); - if (emailField !== undefined) { - setEmailFieldValue(emailField.value); - } - return [ - 4 /*yield*/, - props.recipeImplementation.sendPasswordResetEmail({ - formFields: formFields, - userContext: userContext, - }), - ]; - case 2: - resp = _a.sent(); - if (resp.status === "PASSWORD_RESET_NOT_ALLOWED") { - return [ - 2 /*return*/, - { - status: "FIELD_ERROR", - formFields: [ - { id: "email", error: resp.reason }, - ], - }, - ]; - } - return [2 /*return*/, resp]; - } - }); - } - ); - }, - showLabels: true, - validateOnBlur: true, - }), - ], - } - ) - ), + // length >= 8 && < 100 + // must have a number and a character + // as per https://github.com/supertokens/supertokens-auth-react/issues/5#issuecomment-709512438 + if (value.length < 8) { + return [2 /*return*/, "ERROR_PASSWORD_TOO_SHORT"]; } - ) - ); -}; -var ResetPasswordEmail = uiEntry.withOverride("EmailPasswordResetPasswordEmail", EmailPasswordResetPasswordEmail); - -var EmailPasswordSubmitNewPassword = function (props) { - var t = translationContext.useTranslation(); - var userContext = uiEntry.useUserContext(); - var _a = React.useState("READY"), - status = _a[0], - setStatus = _a[1]; - var onSuccess = function () { - setStatus("SUCCESS"); - }; - var formFields = props.formFields, - onSignInClicked = props.onSignInClicked; - if (status === "SUCCESS") { - return jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "container" }, - { - children: jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "row" }, - { - children: [ - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "headerTitle" }, - { children: t("EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_HEADER_TITLE") } - ) - ), - jsxRuntime.jsx( - formBase.FormRow, - { - children: jsxRuntime.jsxs(React.Fragment, { - children: [ - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { - "data-supertokens": - "primaryText submitNewPasswordSuccessMessage", - }, - { - children: t( - "EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_DESC" - ), - } - ) - ), - jsxRuntime.jsx(button.Button, { - disabled: false, - isLoading: false, - type: "button", - onClick: onSignInClicked, - label: "EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_SIGN_IN_BTN", - }), - ], - }), - }, - "form-button" - ), - ], - } - ) - ), - } - ) - ); - } - return jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "container" }, - { - children: jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "row" }, - { - children: [ - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "headerTitle" }, - { children: t("EMAIL_PASSWORD_RESET_SUBMIT_PW_HEADER_TITLE") } - ) - ), - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "headerSubtitle" }, - { - children: jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "secondaryText" }, - { children: t("EMAIL_PASSWORD_RESET_SUBMIT_PW_HEADER_SUBTITLE") } - ) - ), - } - ) - ), - props.error !== undefined && - jsxRuntime.jsx(generalError.GeneralError, { error: props.error }), - jsxRuntime.jsx(formBase.FormBase, { - formFields: formFields, - clearError: props.clearError, - onError: props.onError, - buttonLabel: "EMAIL_PASSWORD_RESET_SUBMIT_PW_CHANGE_PW_BTN", - onSuccess: onSuccess, - validateOnBlur: true, - callAPI: function (fields) { - return genericComponentOverrideContext.__awaiter( - void 0, - void 0, - void 0, - function () { - var validationErrors, response; - return genericComponentOverrideContext.__generator(this, function (_a) { - switch (_a.label) { - case 0: - return [ - 4 /*yield*/, - genericComponentOverrideContext.validateForm( - fields, - props.config.resetPasswordUsingTokenFeature - .submitNewPasswordForm.formFields - ), - ]; - case 1: - validationErrors = _a.sent(); - if (validationErrors.length > 0) { - return [ - 2 /*return*/, - { - status: "FIELD_ERROR", - formFields: validationErrors, - }, - ]; - } - // Verify that both passwords match. - if (fields[0].value !== fields[1].value) { - return [ - 2 /*return*/, - { - status: "FIELD_ERROR", - formFields: [ - { - id: fields[1].id, - error: "ERROR_CONFIRM_PASSWORD_NO_MATCH", - }, - ], - }, - ]; - } - return [ - 4 /*yield*/, - props.recipeImplementation.submitNewPassword({ - formFields: fields, - userContext: userContext, - }), - ]; - case 2: - response = _a.sent(); - if ( - response.status === "RESET_PASSWORD_INVALID_TOKEN_ERROR" - ) { - throw new STGeneralError__default.default( - "EMAIL_PASSWORD_RESET_PASSWORD_INVALID_TOKEN_ERROR" - ); - } - return [ - 2 /*return*/, - response.status === "FIELD_ERROR" - ? response - : { - status: "OK", - }, - ]; - } - }); - } - ); - }, - showLabels: true, - }), - ], - } - ) - ), + if (value.length >= 100) { + return [2 /*return*/, "ERROR_PASSWORD_TOO_LONG"]; } - ) - ); -}; -var SubmitNewPassword = uiEntry.withOverride("EmailPasswordSubmitNewPassword", EmailPasswordSubmitNewPassword); - -/* - * Component. - */ -function ResetPasswordUsingTokenTheme(props) { - /* - * Render. - */ - // If no token, return SubmitNewPassword. - if (props.submitNewPasswordForm !== undefined) { - return jsxRuntime.jsx( - SubmitNewPassword, - genericComponentOverrideContext.__assign({}, props.submitNewPasswordForm) - ); - } - // Otherwise, return EnterEmail. - return jsxRuntime.jsx(ResetPasswordEmail, genericComponentOverrideContext.__assign({}, props.enterEmailForm)); -} -function ResetPasswordUsingTokenThemeWrapper(props) { - var hasFont = translations.hasFontDefined(props.config.rootStyle); - var userStyles = props.submitNewPasswordForm - ? props.config.resetPasswordUsingTokenFeature.submitNewPasswordForm.style - : props.config.resetPasswordUsingTokenFeature.enterEmailForm.style; - return jsxRuntime.jsx( - uiEntry.UserContextWrapper, - genericComponentOverrideContext.__assign( - { userContext: props.userContext }, - { - children: jsxRuntime.jsx( - translations$1.ThemeBase, - genericComponentOverrideContext.__assign( - { loadDefaultFont: !hasFont, userStyles: [props.config.rootStyle, userStyles] }, - { - children: jsxRuntime.jsx( - ResetPasswordUsingTokenTheme, - genericComponentOverrideContext.__assign({}, props) - ), - } - ) - ), + if (value.match(/^.*[A-Za-z]+.*$/) === null) { + return [2 /*return*/, "ERROR_PASSWORD_NO_ALPHA"]; } - ) - ); -} - -var defaultTranslationsEmailPassword = { - en: genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, translations.defaultTranslationsCommon.en), - translations$1.defaultTranslationsEmailVerification.en - ), - { - EMAIL_PASSWORD_EMAIL_LABEL: "Email", - EMAIL_PASSWORD_EMAIL_PLACEHOLDER: "Email address", - EMAIL_PASSWORD_PASSWORD_LABEL: "Password", - EMAIL_PASSWORD_PASSWORD_PLACEHOLDER: "Password", - EMAIL_PASSWORD_SIGN_IN_HEADER_TITLE: "Sign In", - EMAIL_PASSWORD_SIGN_IN_HEADER_SUBTITLE_START: "Not registered yet?", - EMAIL_PASSWORD_SIGN_IN_HEADER_SUBTITLE_SIGN_UP_LINK: "Sign Up", - EMAIL_PASSWORD_SIGN_IN_HEADER_SUBTITLE_END: "", - EMAIL_PASSWORD_SIGN_IN_FOOTER_FORGOT_PW_LINK: "Forgot password?", - EMAIL_PASSWORD_SIGN_IN_SUBMIT_BTN: "SIGN IN", - EMAIL_PASSWORD_SIGN_IN_WRONG_CREDENTIALS_ERROR: "Incorrect email and password combination", - EMAIL_PASSWORD_SIGN_UP_HEADER_TITLE: "Sign Up", - EMAIL_PASSWORD_SIGN_UP_HEADER_SUBTITLE_START: "Already have an account?", - EMAIL_PASSWORD_SIGN_UP_HEADER_SUBTITLE_SIGN_IN_LINK: "Sign In", - EMAIL_PASSWORD_SIGN_UP_HEADER_SUBTITLE_END: "", - EMAIL_PASSWORD_SIGN_UP_FOOTER_START: "By continuing, you agree to our ", - EMAIL_PASSWORD_SIGN_UP_FOOTER_TOS: "Terms of Service", - EMAIL_PASSWORD_SIGN_UP_FOOTER_AND: " and ", - EMAIL_PASSWORD_SIGN_UP_FOOTER_PP: "Privacy Policy", - EMAIL_PASSWORD_SIGN_UP_FOOTER_END: "", - EMAIL_PASSWORD_SIGN_UP_SUBMIT_BTN: "SIGN UP", - EMAIL_PASSWORD_EMAIL_ALREADY_EXISTS: "This email already exists. Please sign in instead", - EMAIL_PASSWORD_RESET_HEADER_TITLE: "Reset your password", - EMAIL_PASSWORD_RESET_HEADER_SUBTITLE: "We will send you an email to reset your password", - EMAIL_PASSWORD_RESET_SEND_FALLBACK_EMAIL: "your account", - EMAIL_PASSWORD_RESET_SEND_BEFORE_EMAIL: "A password reset email has been sent to ", - EMAIL_PASSWORD_RESET_SEND_AFTER_EMAIL: ", if it exists in our system. ", - EMAIL_PASSWORD_RESET_RESEND_LINK: "Resend or change email", - EMAIL_PASSWORD_RESET_SEND_BTN: "Email me", - EMAIL_PASSWORD_RESET_SIGN_IN_LINK: "Sign In", - EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_HEADER_TITLE: "Success!", - EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_DESC: "Your password has been updated successfully", - EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_SIGN_IN_BTN: "SIGN IN", - EMAIL_PASSWORD_NEW_PASSWORD_LABEL: "New password", - EMAIL_PASSWORD_NEW_PASSWORD_PLACEHOLDER: "New password", - EMAIL_PASSWORD_CONFIRM_PASSWORD_LABEL: "Confirm password", - EMAIL_PASSWORD_CONFIRM_PASSWORD_PLACEHOLDER: "Confirm your password", - EMAIL_PASSWORD_RESET_SUBMIT_PW_HEADER_TITLE: "Change your password", - EMAIL_PASSWORD_RESET_SUBMIT_PW_HEADER_SUBTITLE: "Enter a new password below to change your password", - EMAIL_PASSWORD_RESET_SUBMIT_PW_CHANGE_PW_BTN: "CHANGE PASSWORD", - EMAIL_PASSWORD_RESET_PASSWORD_INVALID_TOKEN_ERROR: "Invalid password reset token", - ERROR_EMAIL_NON_STRING: "Email must be of type string", - ERROR_EMAIL_INVALID: "Email is invalid", - ERROR_PASSWORD_NON_STRING: "Password must be of type string", - ERROR_PASSWORD_TOO_SHORT: "Password must contain at least 8 characters, including a number", - ERROR_PASSWORD_TOO_LONG: "Password's length must be lesser than 100 characters", - ERROR_PASSWORD_NO_ALPHA: "Password must contain at least one alphabet", - ERROR_PASSWORD_NO_NUM: "Password must contain at least one number", - ERROR_CONFIRM_PASSWORD_NO_MATCH: "Confirmation password doesn't match", - ERROR_NON_OPTIONAL: "Field is not optional", - /* - * The following are error messages from our backend SDK. - * These are returned as full messages to preserver compatibilty, but they work just like the keys above. - * They are shown as is by default (setting the value to undefined will display the raw translation key) - */ - "This email already exists. Please sign in instead.": undefined, - "Field is not optional": undefined, - "Password must contain at least 8 characters, including a number": undefined, - "Password's length must be lesser than 100 characters": undefined, - "Password must contain at least one alphabet": undefined, - "Password must contain at least one number": undefined, - "Email is invalid": undefined, - "Reset password link was not created because of account take over risk. Please contact support. (ERR_CODE_001)": - undefined, - "Cannot sign up due to security reasons. Please try logging in, use a different login method or contact support. (ERR_CODE_007)": - undefined, - "Cannot sign in due to security reasons. Please try resetting your password, use a different login method or contact support. (ERR_CODE_008)": - undefined, - } - ), -}; - -var ResetPasswordUsingToken$1 = function (props) { - var token = genericComponentOverrideContext.getQueryParams("token"); - var _a = React__namespace.useState(), - error = _a[0], - setError = _a[1]; - var enterEmailFormFeature = props.recipe.config.resetPasswordUsingTokenFeature.enterEmailForm; - var submitNewPasswordFormFeature = props.recipe.config.resetPasswordUsingTokenFeature.submitNewPasswordForm; - var submitNewPasswordForm = - token === undefined || token === null - ? undefined - : { - error: error, - onError: function (error) { - return setError(error); - }, - clearError: function () { - return setError(undefined); - }, - styleFromInit: submitNewPasswordFormFeature.style, - formFields: submitNewPasswordFormFeature.formFields, - recipeImplementation: props.recipe.webJSRecipe, - config: props.recipe.config, - onSignInClicked: function () { - void genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().redirectToAuth({ - show: "signin", - history: props.history, - redirectBack: false, - }); - }, - token: token, - }; - var enterEmailForm = { - onBackButtonClicked: function () { - return genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().redirectToAuth({ - show: "signin", - history: props.history, - redirectBack: false, - }); - }, - error: error, - onError: function (error) { - return setError(error); - }, - clearError: function () { - return setError(undefined); - }, - styleFromInit: enterEmailFormFeature.style, - formFields: enterEmailFormFeature.formFields, - recipeImplementation: props.recipe.webJSRecipe, - config: props.recipe.config, - }; - var childProps = { - config: props.recipe.config, - submitNewPasswordForm: submitNewPasswordForm, - enterEmailForm: enterEmailForm, - }; - var recipeComponentOverrides = props.useComponentOverrides(); - return jsxRuntime.jsx( - uiEntry.ComponentOverrideContext.Provider, - genericComponentOverrideContext.__assign( - { value: recipeComponentOverrides }, - { - children: jsxRuntime.jsx( - uiEntry.FeatureWrapper, - genericComponentOverrideContext.__assign( - { - useShadowDom: props.recipe.config.useShadowDom, - defaultStore: defaultTranslationsEmailPassword, - }, - { - children: jsxRuntime.jsxs(React.Fragment, { - children: [ - props.children === undefined && - jsxRuntime.jsx( - ResetPasswordUsingTokenThemeWrapper, - genericComponentOverrideContext.__assign({}, childProps) - ), - props.children && - React__namespace.Children.map(props.children, function (child) { - if (React__namespace.isValidElement(child)) { - return React__namespace.cloneElement(child, childProps); - } - return child; - }), - ], - }), - } - ) - ), + if (value.match(/^.*[0-9]+.*$/) === null) { + return [2 /*return*/, "ERROR_PASSWORD_NO_NUM"]; } - ) - ); -}; - -var SignInFooter = uiEntry.withOverride("EmailPasswordSignInFooter", function EmailPasswordSignInFooter(_a) { - var onClick = _a.onClick; - var t = translationContext.useTranslation(); - return jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "link secondaryText forgotPasswordLink", onClick: onClick }, - { children: t("EMAIL_PASSWORD_SIGN_IN_FOOTER_FORGOT_PW_LINK") } - ) - ); -}); - -var SignInForm = uiEntry.withOverride("EmailPasswordSignInForm", function EmailPasswordSignInForm(props) { - var _this = this; - var userContext = uiEntry.useUserContext(); - return jsxRuntime.jsx(formBase.FormBase, { - formFields: props.formFields, - clearError: props.clearError, - onError: props.onError, - buttonLabel: "EMAIL_PASSWORD_SIGN_IN_SUBMIT_BTN", - onSuccess: props.onSuccess, - callAPI: function (formFields) { - return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { - var validationErrors, response; - return genericComponentOverrideContext.__generator(this, function (_a) { - switch (_a.label) { - case 0: - return [ - 4 /*yield*/, - genericComponentOverrideContext.validateForm( - formFields, - props.config.signInAndUpFeature.signInForm.formFields - ), - ]; - case 1: - validationErrors = _a.sent(); - if (validationErrors.length > 0) { - return [ - 2 /*return*/, - { - status: "FIELD_ERROR", - formFields: validationErrors, - }, - ]; - } - return [ - 4 /*yield*/, - props.recipeImplementation.signIn({ - formFields: formFields, - userContext: userContext, - }), - ]; - case 2: - response = _a.sent(); - if (response.status === "WRONG_CREDENTIALS_ERROR") { - throw new STGeneralError__default.default( - "EMAIL_PASSWORD_SIGN_IN_WRONG_CREDENTIALS_ERROR" - ); - } else if (response.status === "SIGN_IN_NOT_ALLOWED") { - throw new STGeneralError__default.default(response.reason); - } else { - return [2 /*return*/, response]; - } - } - }); - }); - }, - validateOnBlur: false, - showLabels: true, - footer: props.footer, - }); -}); - -var SignInHeader = uiEntry.withOverride("EmailPasswordSignInHeader", function EmailPasswordSignInHeader(_a) { - var onClick = _a.onClick; - var t = translationContext.useTranslation(); - return jsxRuntime.jsxs(React.Fragment, { - children: [ - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "headerTitle" }, - { children: t("EMAIL_PASSWORD_SIGN_IN_HEADER_TITLE") } - ) - ), - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "headerSubtitle" }, - { - children: jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "secondaryText" }, - { - children: [ - t("EMAIL_PASSWORD_SIGN_IN_HEADER_SUBTITLE_START"), - jsxRuntime.jsx( - "span", - genericComponentOverrideContext.__assign( - { "data-supertokens": "link", onClick: onClick }, - { children: t("EMAIL_PASSWORD_SIGN_IN_HEADER_SUBTITLE_SIGN_UP_LINK") } - ) - ), - t("EMAIL_PASSWORD_SIGN_IN_HEADER_SUBTITLE_END"), - ], - } - ) - ), - } - ) - ), - jsxRuntime.jsx("div", { "data-supertokens": "divider" }), - ], + return [2 /*return*/, undefined]; + }); }); -}); - -var SignIn = uiEntry.withOverride("EmailPasswordSignIn", function EmailPasswordSignIn(props) { - return jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "container" }, - { - children: [ - jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "row" }, - { - children: [ - jsxRuntime.jsx(SignInHeader, { onClick: props.signUpClicked }), - props.error !== undefined && - jsxRuntime.jsx(generalError.GeneralError, { error: props.error }), - jsxRuntime.jsx( - SignInForm, - genericComponentOverrideContext.__assign({}, props, { - footer: jsxRuntime.jsx(SignInFooter, { - onClick: props.forgotPasswordClick, - }), - }) - ), - ], - } - ) - ), - jsxRuntime.jsx(SuperTokensBranding.SuperTokensBranding, {}), - ], - } - ) - ); -}); - -var SignUpFooter = uiEntry.withOverride("EmailPasswordSignUpFooter", function EmailPasswordSignUpFooter(_a) { - var termsOfServiceLink = _a.termsOfServiceLink, - privacyPolicyLink = _a.privacyPolicyLink; - var t = translationContext.useTranslation(); - if (termsOfServiceLink === undefined && privacyPolicyLink === undefined) { - return null; - } - return jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "secondaryText privacyPolicyAndTermsAndConditions" }, - { - children: [ - t("EMAIL_PASSWORD_SIGN_UP_FOOTER_START"), - termsOfServiceLink !== undefined && - jsxRuntime.jsx( - "a", - genericComponentOverrideContext.__assign( - { - "data-supertokens": "link", - href: termsOfServiceLink, - target: "_blank", - rel: "noopener noreferer", - }, - { children: t("EMAIL_PASSWORD_SIGN_UP_FOOTER_TOS") } - ) - ), - termsOfServiceLink !== undefined && - privacyPolicyLink !== undefined && - t("EMAIL_PASSWORD_SIGN_UP_FOOTER_AND"), - privacyPolicyLink !== undefined && - jsxRuntime.jsx( - "a", - genericComponentOverrideContext.__assign( - { - "data-supertokens": "link", - href: privacyPolicyLink, - target: "_blank", - rel: "noopener noreferer", - }, - { children: t("EMAIL_PASSWORD_SIGN_UP_FOOTER_PP") } - ) - ), - t("EMAIL_PASSWORD_SIGN_UP_FOOTER_END"), - ], - } - ) - ); -}); - +} /* - * Component. + * defaultLoginPasswordValidator. + * type string */ -var SignUpForm = uiEntry.withOverride("EmailPasswordSignUpForm", function EmailPasswordSignUpForm(props) { - var _this = this; - var userContext = uiEntry.useUserContext(); - return jsxRuntime.jsx(formBase.FormBase, { - formFields: props.formFields, - clearError: props.clearError, - onError: props.onError, - buttonLabel: "EMAIL_PASSWORD_SIGN_UP_SUBMIT_BTN", - onSuccess: props.onSuccess, - callAPI: function (formFields) { - return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { - var validationErrors, res; - return genericComponentOverrideContext.__generator(this, function (_a) { - switch (_a.label) { - case 0: - return [ - 4 /*yield*/, - genericComponentOverrideContext.validateForm( - formFields, - props.config.signInAndUpFeature.signUpForm.formFields - ), - ]; - case 1: - validationErrors = _a.sent(); - if (validationErrors.length > 0) { - return [ - 2 /*return*/, - { - status: "FIELD_ERROR", - formFields: validationErrors, - }, - ]; - } - return [ - 4 /*yield*/, - props.recipeImplementation.signUp({ - formFields: formFields, - userContext: userContext, - }), - ]; - case 2: - res = _a.sent(); - if (res.status === "SIGN_UP_NOT_ALLOWED") { - throw new STGeneralError__default$1.default(res.reason); - } - return [2 /*return*/, res]; - } - }); - }); - }, - validateOnBlur: true, - showLabels: true, - footer: props.footer, - }); -}); - -var SignUpHeader = uiEntry.withOverride("EmailPasswordSignUpHeader", function EmailPasswordSignUpHeader(_a) { - var onClick = _a.onClick; - var t = translationContext.useTranslation(); - return jsxRuntime.jsxs(React.Fragment, { - children: [ - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "headerTitle" }, - { children: t("EMAIL_PASSWORD_SIGN_UP_HEADER_TITLE") } - ) - ), - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "headerSubtitle" }, - { - children: jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "secondaryText" }, - { - children: [ - t("EMAIL_PASSWORD_SIGN_UP_HEADER_SUBTITLE_START"), - jsxRuntime.jsx( - "span", - genericComponentOverrideContext.__assign( - { "data-supertokens": "link", onClick: onClick }, - { children: t("EMAIL_PASSWORD_SIGN_UP_HEADER_SUBTITLE_SIGN_IN_LINK") } - ) - ), - t("EMAIL_PASSWORD_SIGN_UP_HEADER_SUBTITLE_END"), - ], - } - ) - ), - } - ) - ), - jsxRuntime.jsx("div", { "data-supertokens": "divider" }), - ], - }); -}); - -var SignUp = uiEntry.withOverride("EmailPasswordSignUp", function EmailPasswordSignUp(props) { - return jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "container" }, - { - children: [ - jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "row" }, - { - children: [ - jsxRuntime.jsx(SignUpHeader, { onClick: props.signInClicked }), - props.error !== undefined && - jsxRuntime.jsx(generalError.GeneralError, { error: props.error }), - jsxRuntime.jsx( - SignUpForm, - genericComponentOverrideContext.__assign({}, props, { - footer: jsxRuntime.jsx(SignUpFooter, { - privacyPolicyLink: - props.config.signInAndUpFeature.signUpForm.privacyPolicyLink, - termsOfServiceLink: - props.config.signInAndUpFeature.signUpForm.termsOfServiceLink, - }), - }) - ), - ], - } - ) - ), - jsxRuntime.jsx(SuperTokensBranding.SuperTokensBranding, {}), - ], +function defaultLoginPasswordValidator(value) { + return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { + return genericComponentOverrideContext.__generator(this, function (_a) { + if (typeof value !== "string") { + return [2 /*return*/, "ERROR_PASSWORD_NON_STRING"]; } - ) - ); -}); - -var SignInAndUpTheme = function (props) { - // If isSignUp, return signUp. - if (props.featureState.isSignUp) { - return jsxRuntime.jsx( - SignUp, - genericComponentOverrideContext.__assign({}, props.signUpForm, { - signInClicked: function () { - props.dispatch({ type: "setSignIn" }); - }, - }) - ); - } - // Otherwise, return SignIn. - return jsxRuntime.jsx( - SignIn, - genericComponentOverrideContext.__assign({}, props.signInForm, { - signUpClicked: function () { - props.dispatch({ type: "setSignUp" }); - }, - }) - ); -}; -function SignInAndUpThemeWrapper(props) { - var hasFont = translations.hasFontDefined(props.config.rootStyle); - var activeStyle = props.featureState.isSignUp - ? props.config.signInAndUpFeature.signUpForm.style - : props.config.signInAndUpFeature.signInForm.style; - return jsxRuntime.jsx( - uiEntry.UserContextWrapper, - genericComponentOverrideContext.__assign( - { userContext: props.userContext }, - { - children: jsxRuntime.jsx( - translations$1.ThemeBase, - genericComponentOverrideContext.__assign( - { loadDefaultFont: !hasFont, userStyles: [props.config.rootStyle, activeStyle] }, - { - children: jsxRuntime.jsx( - SignInAndUpTheme, - genericComponentOverrideContext.__assign({}, props) - ), - } - ) - ), - } - ) - ); -} - -var useFeatureReducer = function (recipe) { - return React__namespace.useReducer( - function (oldState, action) { - switch (action.type) { - case "setSignIn": - return genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, oldState), - { error: undefined, isSignUp: false } - ); - case "setSignUp": - return genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, oldState), - { error: undefined, isSignUp: true } - ); - case "setError": - return genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, oldState), - { error: action.error } - ); - default: - return oldState; - } - }, - { - isSignUp: recipe === undefined ? false : recipe.config.signInAndUpFeature.defaultToSignUp, - user: undefined, - error: undefined, - }, - function (initArg) { - var show = genericComponentOverrideContext.getQueryParams("show"); - var isSignUp = initArg.isSignUp; - if (show !== null) { - isSignUp = show === "signup"; - } - return { - isSignUp: isSignUp, - user: undefined, - error: undefined, - }; - } - ); -}; -function useChildProps(recipe$1, state, dispatch, history) { - var _this = this; - var recipeImplementation = React.useMemo( - function () { - return recipe$1 && getModifiedRecipeImplementation(recipe$1.webJSRecipe); - }, - [recipe$1] - ); - var userContext = uiEntry.useUserContext(); - var onSignInSuccess = React.useCallback( - function (response) { - return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { - return genericComponentOverrideContext.__generator(this, function (_a) { - return [ - 2 /*return*/, - recipe.Session.getInstanceOrThrow().validateGlobalClaimsAndHandleSuccessRedirection( - { - rid: recipe$1.config.recipeId, - successRedirectContext: { - action: "SUCCESS", - isNewRecipeUser: false, - user: response.user, - redirectToPath: genericComponentOverrideContext.getRedirectToPathFromURL(), - }, - }, - userContext, - history - ), - ]; - }); - }); - }, - [recipe$1, userContext, history] - ); - var onSignUpSuccess = React.useCallback( - function (response) { - return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { - return genericComponentOverrideContext.__generator(this, function (_a) { - return [ - 2 /*return*/, - recipe.Session.getInstanceOrThrow().validateGlobalClaimsAndHandleSuccessRedirection( - { - rid: recipe$1.config.recipeId, - successRedirectContext: { - action: "SUCCESS", - isNewRecipeUser: true, - user: response.user, - redirectToPath: genericComponentOverrideContext.getRedirectToPathFromURL(), - }, - }, - userContext, - history - ), - ]; - }); - }); - }, - [recipe$1, userContext, history] - ); - return React.useMemo( - function () { - if (recipe$1 === undefined || recipeImplementation === undefined) { - return; - } - var signInAndUpFeature = recipe$1.config.signInAndUpFeature; - var signUpFeature = signInAndUpFeature.signUpForm; - var signInFeature = signInAndUpFeature.signInForm; - var signInForm = { - recipeImplementation: recipeImplementation, - config: recipe$1.config, - styleFromInit: signInFeature.style, - formFields: signInFeature.formFields, - error: state.error, - clearError: function () { - return dispatch({ type: "setError", error: undefined }); - }, - onError: function (error) { - return dispatch({ type: "setError", error: error }); - }, - onSuccess: onSignInSuccess, - forgotPasswordClick: function () { - return recipe$1.redirect({ action: "RESET_PASSWORD" }, history); - }, - }; - var signUpForm = { - recipeImplementation: recipeImplementation, - config: recipe$1.config, - styleFromInit: signUpFeature.style, - formFields: getThemeSignUpFeatureFormFields(signUpFeature.formFields, recipe$1, userContext), - error: state.error, - clearError: function () { - return dispatch({ type: "setError", error: undefined }); - }, - onError: function (error) { - return dispatch({ type: "setError", error: error }); - }, - onSuccess: onSignUpSuccess, - }; - return { - config: recipe$1.config, - signInForm: signInForm, - signUpForm: signUpForm, - }; - }, - [recipe$1, state, dispatch] - ); + return [2 /*return*/, undefined]; + }); + }); } -var SignInAndUpFeature = function (props) { - var _a = useFeatureReducer(props.recipe), - state = _a[0], - dispatch = _a[1]; - var childProps = useChildProps(props.recipe, state, dispatch, props.history); - var recipeComponentOverrides = props.useComponentOverrides(); - return jsxRuntime.jsx( - uiEntry.ComponentOverrideContext.Provider, - genericComponentOverrideContext.__assign( - { value: recipeComponentOverrides }, - { - children: jsxRuntime.jsx( - uiEntry.FeatureWrapper, - genericComponentOverrideContext.__assign( - { - useShadowDom: props.recipe.config.useShadowDom, - defaultStore: defaultTranslationsEmailPassword, - }, - { - children: jsxRuntime.jsxs(React.Fragment, { - children: [ - props.children === undefined && - jsxRuntime.jsx( - SignInAndUpThemeWrapper, - genericComponentOverrideContext.__assign({}, childProps, { - featureState: state, - dispatch: dispatch, - }) - ), - props.children && - React__namespace.Children.map(props.children, function (child) { - if (React__namespace.isValidElement(child)) { - return React__namespace.cloneElement( - child, - genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, childProps), - { featureState: state, dispatch: dispatch } - ) - ); - } - return child; - }), - ], - }), - } - ) - ), - } - ) - ); -}; -var getModifiedRecipeImplementation = function (origImpl) { - return genericComponentOverrideContext.__assign({}, origImpl); -}; -function getThemeSignUpFeatureFormFields(formFields, recipe, userContext) { - var _this = this; - var emailPasswordOnly = formFields.length === 2; - return formFields.map(function (field) { - return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, field), { - showIsRequired: (function () { - // If email and password only, do not show required indicator (*). - if (emailPasswordOnly) { - return false; - } - // Otherwise, show for all non optional fields (including email and password). - return field.optional === false; - })(), - validate: (function () { - // If field is not email, return field validate unchanged. - if (field.id !== "email") { - return field.validate; - } - // Otherwise, if email, use syntax validate method and check if email exists. - return function (value) { - return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { - var error, emailExists, err_1; - return genericComponentOverrideContext.__generator(this, function (_a) { - switch (_a.label) { - case 0: - return [4 /*yield*/, field.validate(value)]; - case 1: - error = _a.sent(); - if (error !== undefined) { - return [2 /*return*/, error]; - } - if (typeof value !== "string") { - return [2 /*return*/, "GENERAL_ERROR_EMAIL_NON_STRING"]; - } - _a.label = 2; - case 2: - _a.trys.push([2, 4, , 5]); - return [ - 4 /*yield*/, - recipe.webJSRecipe.doesEmailExist({ - email: value, - userContext: userContext, - }), - ]; - case 3: - emailExists = _a.sent().doesExist; - if (emailExists) { - return [2 /*return*/, "EMAIL_PASSWORD_EMAIL_ALREADY_EXISTS"]; - } - return [3 /*break*/, 5]; - case 4: - err_1 = _a.sent(); - if (STGeneralError__default.default.isThisError(err_1)) { - return [2 /*return*/, err_1.message]; - } - return [3 /*break*/, 5]; - case 5: - return [2 /*return*/, undefined]; - } - }); - }); - }; - })(), +/* + * defaultValidate + */ +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function defaultValidate(_) { + return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { + return genericComponentOverrideContext.__generator(this, function (_a) { + return [2 /*return*/, undefined]; }); }); } -var EmailPasswordPreBuiltUI = /** @class */ (function (_super) { - genericComponentOverrideContext.__extends(EmailPasswordPreBuiltUI, _super); - function EmailPasswordPreBuiltUI(recipeInstance) { - var _this = _super.call(this) || this; - _this.recipeInstance = recipeInstance; - // Instance methods - _this.getFeatures = function (useComponentOverrides) { - if (useComponentOverrides === void 0) { - useComponentOverrides = componentOverrideContext.useContext; - } - var features = {}; - if (_this.recipeInstance.config.signInAndUpFeature.disableDefaultUI !== true) { - var normalisedFullPath = _this.recipeInstance.config.appInfo.websiteBasePath.appendPath( - new NormalisedURLPath__default.default("/") - ); - features[normalisedFullPath.getAsStringDangerous()] = { - matches: genericComponentOverrideContext.matchRecipeIdUsingQueryParams( - _this.recipeInstance.config.recipeId - ), - component: function (props) { - return _this.getFeatureComponent("signinup", props, useComponentOverrides); - }, - recipeID: recipe$1.EmailPassword.RECIPE_ID, - }; - } - if (_this.recipeInstance.config.resetPasswordUsingTokenFeature.disableDefaultUI !== true) { - var normalisedFullPath = _this.recipeInstance.config.appInfo.websiteBasePath.appendPath( - new NormalisedURLPath__default.default(validators.DEFAULT_RESET_PASSWORD_PATH) - ); - features[normalisedFullPath.getAsStringDangerous()] = { - matches: genericComponentOverrideContext.matchRecipeIdUsingQueryParams( - _this.recipeInstance.config.recipeId - ), - component: function (props) { - return _this.getFeatureComponent("resetpassword", props, useComponentOverrides); - }, - recipeID: recipe$1.EmailPassword.RECIPE_ID, - }; - } - return features; - }; - _this.getFeatureComponent = function (componentName, props, useComponentOverrides) { - if (useComponentOverrides === void 0) { - useComponentOverrides = componentOverrideContext.useContext; - } - if (componentName === "signinup") { - if (props.redirectOnSessionExists !== false) { - return jsxRuntime.jsx( - uiEntry.UserContextWrapper, - genericComponentOverrideContext.__assign( - { userContext: props.userContext }, - { - children: jsxRuntime.jsx( - SuperTokensBranding.AuthWidgetWrapper, - genericComponentOverrideContext.__assign( - { authRecipe: _this.recipeInstance, history: props.history }, - { - children: jsxRuntime.jsx( - SignInAndUpFeature, - genericComponentOverrideContext.__assign( - { recipe: _this.recipeInstance }, - props, - { useComponentOverrides: useComponentOverrides } - ) - ), - } - ) - ), - } - ) - ); - } else { - return jsxRuntime.jsx( - uiEntry.UserContextWrapper, - genericComponentOverrideContext.__assign( - { userContext: props.userContext }, - { - children: jsxRuntime.jsx( - SignInAndUpFeature, - genericComponentOverrideContext.__assign({ recipe: _this.recipeInstance }, props, { - useComponentOverrides: useComponentOverrides, - }) - ), - } - ) - ); - } - } else if (componentName === "resetpassword") { - return jsxRuntime.jsx( - uiEntry.UserContextWrapper, - genericComponentOverrideContext.__assign( - { userContext: props.userContext }, - { - children: jsxRuntime.jsx( - ResetPasswordUsingToken$1, - genericComponentOverrideContext.__assign({ recipe: _this.recipeInstance }, props, { - useComponentOverrides: useComponentOverrides, - }) - ), - } - ) - ); - } else { - throw new Error("Should never come here."); - } - }; - return _this; - } - // Static methods - EmailPasswordPreBuiltUI.getInstanceOrInitAndGetInstance = function () { - if (EmailPasswordPreBuiltUI.instance === undefined) { - var recipeInstance = recipe$1.EmailPassword.getInstanceOrThrow(); - EmailPasswordPreBuiltUI.instance = new EmailPasswordPreBuiltUI(recipeInstance); - } - return EmailPasswordPreBuiltUI.instance; - }; - EmailPasswordPreBuiltUI.getFeatures = function (useComponentOverrides) { - if (useComponentOverrides === void 0) { - useComponentOverrides = componentOverrideContext.useContext; - } - return EmailPasswordPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatures(useComponentOverrides); - }; - EmailPasswordPreBuiltUI.getFeatureComponent = function (componentName, props, useComponentOverrides) { - if (useComponentOverrides === void 0) { - useComponentOverrides = componentOverrideContext.useContext; - } - return EmailPasswordPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent( - componentName, - props, - useComponentOverrides - ); - }; - // For tests - EmailPasswordPreBuiltUI.reset = function () { - if (!genericComponentOverrideContext.isTest()) { - return; - } - EmailPasswordPreBuiltUI.instance = undefined; - return; - }; - EmailPasswordPreBuiltUI.SignInAndUp = function (prop) { - if (prop === void 0) { - prop = {}; - } - return EmailPasswordPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent("signinup", prop); - }; - EmailPasswordPreBuiltUI.ResetPasswordUsingToken = function (prop) { - return EmailPasswordPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent("resetpassword", prop); - }; - EmailPasswordPreBuiltUI.ResetPasswordUsingTokenTheme = ResetPasswordUsingTokenThemeWrapper; - EmailPasswordPreBuiltUI.SignInAndUpTheme = SignInAndUpThemeWrapper; - return EmailPasswordPreBuiltUI; -})(uiEntry.RecipeRouter); -var SignInAndUp = EmailPasswordPreBuiltUI.SignInAndUp; -var ResetPasswordUsingToken = EmailPasswordPreBuiltUI.ResetPasswordUsingToken; - -exports.EmailPasswordPreBuiltUI = EmailPasswordPreBuiltUI; -exports.ResetPasswordUsingToken = ResetPasswordUsingToken; -exports.ResetPasswordUsingTokenThemeWrapper = ResetPasswordUsingTokenThemeWrapper; -exports.SignInAndUp = SignInAndUp; -exports.SignInAndUpThemeWrapper = SignInAndUpThemeWrapper; -exports.SignInFooter = SignInFooter; -exports.SignInForm = SignInForm; -exports.SignInHeader = SignInHeader; -exports.SignUpFooter = SignUpFooter; -exports.SignUpForm = SignUpForm; -exports.SignUpHeader = SignUpHeader; -exports.defaultTranslationsEmailPassword = defaultTranslationsEmailPassword; -exports.useChildProps = useChildProps; -exports.useFeatureReducer = useFeatureReducer; +exports.DEFAULT_RESET_PASSWORD_PATH = DEFAULT_RESET_PASSWORD_PATH; +exports.MANDATORY_FORM_FIELDS_ID_ARRAY = MANDATORY_FORM_FIELDS_ID_ARRAY; +exports.defaultEmailValidator = defaultEmailValidator; +exports.defaultLoginPasswordValidator = defaultLoginPasswordValidator; +exports.defaultPasswordValidator = defaultPasswordValidator; +exports.defaultValidate = defaultValidate; diff --git a/lib/build/emailpassword-shared7.js b/lib/build/emailpassword-shared7.js index 6415dc169..9f025d0f4 100644 --- a/lib/build/emailpassword-shared7.js +++ b/lib/build/emailpassword-shared7.js @@ -2,34 +2,60 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); var jsxRuntime = require("react/jsx-runtime"); +var NormalisedURLPath = require("supertokens-web-js/utils/normalisedURLPath"); +var uiEntry = require("./index2.js"); +var SuperTokensBranding = require("./SuperTokensBranding.js"); +var componentOverrideContext = require("./emailpassword-shared4.js"); var React = require("react"); -var STGeneralError = require("supertokens-web-js/utils/error"); -var validators = require("./emailpassword-shared5.js"); -var button = require("./emailpassword-shared2.js"); -require("./index2.js"); +var translations = require("./translations.js"); +var themeBase = require("./emailpassword-shared.js"); var translationContext = require("./translationContext.js"); +var arrowLeftIcon = require("./arrowLeftIcon.js"); +var formBase = require("./emailpassword-shared8.js"); +var generalError = require("./emailpassword-shared2.js"); +var STGeneralError = require("supertokens-web-js/utils/error"); +var button = require("./emailpassword-shared3.js"); +var translations$1 = require("./emailverification-shared2.js"); +var recipe = require("./session-shared2.js"); +var STGeneralError$1 = require("supertokens-web-js/lib/build/error"); +var validators = require("./emailpassword-shared6.js"); +var recipe$1 = require("./emailpassword-shared5.js"); function _interopDefault(e) { return e && e.__esModule ? e : { default: e }; } -var STGeneralError__default = /*#__PURE__*/ _interopDefault(STGeneralError); - -/* - * Component. - */ -function FormRow(_a) { - var children = _a.children, - hasError = _a.hasError; - return jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": ["formRow", hasError ? "hasError" : ""].join(" ") }, - { children: children } - ) - ); +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + Object.keys(e).forEach(function (k) { + if (k !== "default") { + var d = Object.getOwnPropertyDescriptor(e, k); + Object.defineProperty( + n, + k, + d.get + ? d + : { + enumerable: true, + get: function () { + return e[k]; + }, + } + ); + } + }); + } + n.default = e; + return Object.freeze(n); } +var NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath); +var React__namespace = /*#__PURE__*/ _interopNamespace(React); +var STGeneralError__default = /*#__PURE__*/ _interopDefault(STGeneralError); +var STGeneralError__default$1 = /*#__PURE__*/ _interopDefault(STGeneralError$1); + /* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. * * This software is licensed under the Apache License, Version 2.0 (the @@ -50,364 +76,437 @@ function FormRow(_a) { /* * Component. */ -function CheckedIcon() { +function HeavyArrowLeftIcon(_a) { + var color = _a.color; return jsxRuntime.jsx( "svg", genericComponentOverrideContext.__assign( { xmlns: "http://www.w3.org/2000/svg", - width: "14.862", - height: "12.033", - viewBox: "0 0 14.862 12.033", - "data-supertokens": "checkedIcon", + width: "16", + height: "13", + viewBox: "0 0 16 13", + "data-supertokens": "heavyArrowLeftIcon", }, { children: jsxRuntime.jsx("path", { - fill: "rgb(var(--palette-primary))", - d: "M12.629 49L5.06 56.572l-2.829-2.829L0 55.977l5.057 5.057.654-.651 9.152-9.152z", - transform: "translate(0 -49)", + fill: color, + d: "M13 6.8h.022H3.8l2.9 2.9a.761.761 0 0 1 0 1.07l-.451.451a.754.754 0 0 1-1.064 0L.22 6.254a.759.759 0 0 1 0-1.068L5.186.22a.755.755 0 0 1 1.064 0l.45.451a.746.746 0 0 1 .22.532.724.724 0 0 1-.22.522l-2.93 2.92h9.24a.781.781 0 0 1 .764.773v.638A.766.766 0 0 1 13 6.8z", + transform: "translate(1.182 .708)", }), } ) ); } -/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. - * - * This software is licensed under the Apache License, Version 2.0 (the - * "License") as published by the Apache Software Foundation. - * - * You may not use this file except in compliance with the License. You may - * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -/* - * Imports. - */ /* * Component. */ -function ErrorIcon() { +function BackButton(_a) { + var onClick = _a.onClick; return jsxRuntime.jsx( - "svg", + "button", genericComponentOverrideContext.__assign( - { - xmlns: "http://www.w3.org/2000/svg", - width: "17", - height: "15", - viewBox: "0 0 17 15", - "data-supertokens": "errorIcon", - }, - { - children: jsxRuntime.jsxs("g", { - children: [ - jsxRuntime.jsx( - "g", - genericComponentOverrideContext.__assign( - { className: "Asdf", fill: "rgb(var(--palette-error))" }, - { - children: jsxRuntime.jsx("path", { - d: "M13.568 14.75H3.432c-.63 0-1.195-.325-1.512-.869-.317-.544-.32-1.196-.01-1.744l5.067-8.943c.315-.556.884-.887 1.523-.887.639 0 1.208.331 1.523.887l5.067 8.943c.31.548.307 1.2-.01 1.744s-.882.869-1.512.869z", - transform: "translate(-824.894 -352.829) translate(824.894 352.829)", - }), - } - ) - ), - jsxRuntime.jsx( - "text", - genericComponentOverrideContext.__assign( - { - fill: "#fff", - fontSize: "10px", - fontWeight: "700", - transform: "translate(-824.894 -352.829) translate(832.014 365.198)", - }, - { - children: jsxRuntime.jsx( - "tspan", - genericComponentOverrideContext.__assign({ x: "0", y: "0" }, { children: "!" }) - ), - } - ) - ), - ], - }), - } + { onClick: onClick, "data-supertokens": "backButton backButtonCommon" }, + { children: jsxRuntime.jsx(HeavyArrowLeftIcon, { color: "rgb(var(--palette-textTitle))" }) } ) ); } -/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. - * - * This software is licensed under the Apache License, Version 2.0 (the - * "License") as published by the Apache Software Foundation. - * - * You may not use this file except in compliance with the License. You may - * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -/* - * Imports. - */ /* * Component. */ -function ShowPasswordIcon(_a) { - var showPassword = _a.showPassword; - if (showPassword === true) { - return jsxRuntime.jsx("div", { - children: jsxRuntime.jsx( - "svg", - genericComponentOverrideContext.__assign( - { - xmlns: "http://www.w3.org/2000/svg", - width: "18.391", - height: "16.276", - viewBox: "0 0 18.391 16.276", - "data-supertokens": "showPasswordIcon show", - }, - { - children: jsxRuntime.jsxs("g", { +function BackToSignInButton(_a) { + var onClick = _a.onClick; + var t = translationContext.useTranslation(); + return jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "secondaryText secondaryLinkWithLeftArrow", onClick: onClick }, + { + children: [ + jsxRuntime.jsx(arrowLeftIcon.ArrowLeftIcon, { color: "rgb(var(--palette-secondaryText))" }), + t("EMAIL_PASSWORD_RESET_SIGN_IN_LINK"), + ], + } + ) + ); +} + +var EmailPasswordResetPasswordEmail = function (props) { + var t = translationContext.useTranslation(); + var userContext = uiEntry.useUserContext(); + var _a = React.useState("READY"), + status = _a[0], + setStatus = _a[1]; + var _b = React.useState(""), + emailFieldValue = _b[0], + setEmailFieldValue = _b[1]; + var onSuccess = function () { + setStatus("SENT"); + }; + var resend = function () { + setStatus("READY"); + }; + var formFields = props.formFields; + var emailSuccessText = + t("EMAIL_PASSWORD_RESET_SEND_BEFORE_EMAIL") + + (emailFieldValue !== undefined && emailFieldValue.length > 0 + ? emailFieldValue + : t("EMAIL_PASSWORD_RESET_SEND_FALLBACK_EMAIL")) + + t("EMAIL_PASSWORD_RESET_SEND_AFTER_EMAIL"); + if (status === "SENT") { + return jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "container" }, + { + children: jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "row" }, + { + children: [ + jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "primaryText enterEmailSuccessMessage" }, + { + children: [ + emailSuccessText, + jsxRuntime.jsx( + "span", + genericComponentOverrideContext.__assign( + { + "data-supertokens": "link resendEmailLink", + onClick: resend, + }, + { children: t("EMAIL_PASSWORD_RESET_RESEND_LINK") } + ) + ), + ], + } + ) + ), + jsxRuntime.jsx(BackToSignInButton, { onClick: props.onBackButtonClicked }), + ], + } + ) + ), + } + ) + ); + } + // Otherwise, return Form. + return jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "container" }, + { + children: jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "row" }, + { children: [ - jsxRuntime.jsx("g", { - children: jsxRuntime.jsx("g", { - children: jsxRuntime.jsx("g", { - children: jsxRuntime.jsx("path", { - fill: "rgb(var(--palette-textPrimary))", - d: "M29.289 100.33c-2.4-3.63-5.619-5.63-9.069-5.63s-6.67 2-9.069 5.63a.767.767 0 0 0 0 .845c2.4 3.63 5.619 5.63 9.069 5.63s6.67-2 9.069-5.63a.767.767 0 0 0 0-.845zm-9.069 4.944c-2.785 0-5.435-1.6-7.5-4.519 2.065-2.92 4.715-4.519 7.5-4.519s5.435 1.6 7.5 4.519c-2.064 2.92-4.711 4.519-7.5 4.519z", - transform: - "translate(-822 -420.048) translate(822 422.035) translate(-11.025 -94.7)", - }), - }), - }), - }), jsxRuntime.jsxs( - "g", + "div", genericComponentOverrideContext.__assign( - { - fill: "rgb(var(--palette-textPrimary))", - stroke: "rgb(var(--palette-inputBackground))", - transform: "translate(-822 -420.048) translate(827.164 424.055)", - }, + { "data-supertokens": "headerTitle resetPasswordHeaderTitle" }, { children: [ - jsxRuntime.jsx("circle", { - cx: "4.036", - cy: "4.036", - r: "4.036", - stroke: "none", - }), - jsxRuntime.jsx("circle", { - cx: "4.036", - cy: "4.036", - r: "3.536", - fill: "none", + jsxRuntime.jsx(BackButton, { onClick: props.onBackButtonClicked }), + t("EMAIL_PASSWORD_RESET_HEADER_TITLE"), + jsxRuntime.jsx("span", { + "data-supertokens": "backButtonPlaceholder backButtonCommon", }), ], } ) ), - jsxRuntime.jsx("path", { - fill: "none", - stroke: "#707070", - strokeLinecap: "round", - strokeWidth: "2.25px", - d: "M11.981 0L0 11.981", - transform: "translate(-822 -420.048) translate(825.084 421.639)", - }), - jsxRuntime.jsx("path", { - fill: "none", - stroke: "rgb(var(--palette-inputBackground))", - strokeLinecap: "round", - d: "M13.978 0L0 13.978", - transform: "translate(-822 -420.048) translate(825.084 421.639)", + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "headerSubtitle" }, + { + children: jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "secondaryText" }, + { children: t("EMAIL_PASSWORD_RESET_HEADER_SUBTITLE") } + ) + ), + } + ) + ), + props.error !== undefined && + jsxRuntime.jsx(generalError.GeneralError, { error: props.error }), + jsxRuntime.jsx(formBase.FormBase, { + clearError: props.clearError, + onError: props.onError, + formFields: formFields, + buttonLabel: "EMAIL_PASSWORD_RESET_SEND_BTN", + onSuccess: onSuccess, + callAPI: function (formFields) { + return genericComponentOverrideContext.__awaiter( + void 0, + void 0, + void 0, + function () { + var validationErrors, emailField, resp; + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + return [ + 4 /*yield*/, + genericComponentOverrideContext.validateForm( + formFields, + props.config.resetPasswordUsingTokenFeature + .enterEmailForm.formFields + ), + ]; + case 1: + validationErrors = _a.sent(); + if (validationErrors.length > 0) { + return [ + 2 /*return*/, + { + status: "FIELD_ERROR", + formFields: validationErrors, + }, + ]; + } + emailField = formFields.find(function (field) { + return field.id === "email"; + }); + if (emailField !== undefined) { + setEmailFieldValue(emailField.value); + } + return [ + 4 /*yield*/, + props.recipeImplementation.sendPasswordResetEmail({ + formFields: formFields, + userContext: userContext, + }), + ]; + case 2: + resp = _a.sent(); + if (resp.status === "PASSWORD_RESET_NOT_ALLOWED") { + return [ + 2 /*return*/, + { + status: "FIELD_ERROR", + formFields: [ + { id: "email", error: resp.reason }, + ], + }, + ]; + } + return [2 /*return*/, resp]; + } + }); + } + ); + }, + showLabels: true, + validateOnBlur: true, }), ], - }), - } - ) - ), - }); - } - return jsxRuntime.jsx("div", { - children: jsxRuntime.jsx( - "svg", + } + ) + ), + } + ) + ); +}; +var ResetPasswordEmail = uiEntry.withOverride("EmailPasswordResetPasswordEmail", EmailPasswordResetPasswordEmail); + +var EmailPasswordSubmitNewPassword = function (props) { + var t = translationContext.useTranslation(); + var userContext = uiEntry.useUserContext(); + var _a = React.useState("READY"), + status = _a[0], + setStatus = _a[1]; + var onSuccess = function () { + setStatus("SUCCESS"); + }; + var formFields = props.formFields, + onSignInClicked = props.onSignInClicked; + if (status === "SUCCESS") { + return jsxRuntime.jsx( + "div", genericComponentOverrideContext.__assign( + { "data-supertokens": "container" }, { - xmlns: "http://www.w3.org/2000/svg", - width: "18.281", - height: "12.033", - viewBox: "0 0 18.281 12.033", - "data-supertokens": "showPasswordIcon hide", - }, - { - children: jsxRuntime.jsxs("g", { - children: [ - jsxRuntime.jsx("g", { - children: jsxRuntime.jsx("g", { - children: jsxRuntime.jsx("g", { - children: jsxRuntime.jsx("path", { - fill: "rgb(var(--palette-textPrimary))", - d: "M29.18 100.3c-2.384-3.608-5.586-5.6-9.015-5.6s-6.63 1.989-9.015 5.6a.763.763 0 0 0 0 .84c2.384 3.608 5.586 5.6 9.015 5.6s6.63-1.989 9.015-5.6a.763.763 0 0 0 0-.84zm-9.015 4.914c-2.769 0-5.4-1.589-7.459-4.492 2.052-2.9 4.686-4.492 7.459-4.492s5.4 1.589 7.459 4.492c-2.056 2.899-4.686 4.489-7.458 4.489z", - transform: - "translate(-822 -422.088) translate(822 422.088) translate(-11.025 -94.7)", - }), - }), - }), - }), - jsxRuntime.jsxs( - "g", - genericComponentOverrideContext.__assign( - { - fill: "rgb(var(--palette-textPrimary))", - stroke: "rgb(var(--palette-inputBackground))", - transform: "translate(-822 -422.088) translate(827.133 424.096)", - }, - { - children: [ - jsxRuntime.jsx("circle", { - cx: "4.012", - cy: "4.012", - r: "4.012", - stroke: "none", - }), - jsxRuntime.jsx("circle", { - cx: "4.012", - cy: "4.012", - r: "3.512", - fill: "none", + children: jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "row" }, + { + children: [ + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "headerTitle" }, + { children: t("EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_HEADER_TITLE") } + ) + ), + jsxRuntime.jsx( + formBase.FormRow, + { + children: jsxRuntime.jsxs(React.Fragment, { + children: [ + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { + "data-supertokens": + "primaryText submitNewPasswordSuccessMessage", + }, + { + children: t( + "EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_DESC" + ), + } + ) + ), + jsxRuntime.jsx(button.Button, { + disabled: false, + isLoading: false, + type: "button", + onClick: onSignInClicked, + label: "EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_SIGN_IN_BTN", + }), + ], }), - ], - } - ) - ), - ], - }), + }, + "form-button" + ), + ], + } + ) + ), } ) - ), - }); -} - -var Input = function (_a) { - var type = _a.type, - name = _a.name, - hasError = _a.hasError, - autoComplete = _a.autoComplete, - onInputFocus = _a.onInputFocus, - onInputBlur = _a.onInputBlur, - onChange = _a.onChange, - value = _a.value, - placeholder = _a.placeholder, - validated = _a.validated, - autofocus = _a.autofocus; - var t = translationContext.useTranslation(); - var _b = React.useState(false), - showPassword = _b[0], - setShowPassword = _b[1]; - /* - * Method. - */ - function handleFocus() { - if (onInputFocus !== undefined) { - onInputFocus({ - id: name, - value: value, - }); - } - } - function handleBlur() { - if (onInputBlur !== undefined) { - onInputBlur({ - id: name, - value: value, - }); - } - } - function handleChange(event) { - if (onChange) { - onChange({ - id: name, - value: event.target.value, - }); - } - } - if (autoComplete === undefined) { - autoComplete = "off"; - } - var inputType = type; - if (type === "password" && showPassword === true) { - inputType = "text"; + ); } return jsxRuntime.jsx( "div", genericComponentOverrideContext.__assign( - { "data-supertokens": "inputContainer" }, + { "data-supertokens": "container" }, { children: jsxRuntime.jsxs( "div", genericComponentOverrideContext.__assign( - { "data-supertokens": ["inputWrapper", hasError ? "inputError" : ""].join(" ") }, + { "data-supertokens": "row" }, { children: [ - jsxRuntime.jsx("input", { - autoFocus: autofocus, - autoComplete: autoComplete, - "data-supertokens": "input", - className: "supertokens-input", - onFocus: handleFocus, - onBlur: handleBlur, - type: inputType, - name: name, - placeholder: t(placeholder), - onChange: handleChange, - value: value, - }), - hasError === true && - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "inputAdornment inputAdornmentError" }, - { children: jsxRuntime.jsx(ErrorIcon, {}) } - ) - ), - validated === true && - hasError === false && - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "inputAdornment inputAdornmentSuccess" }, - { children: jsxRuntime.jsx(CheckedIcon, {}) } - ) - ), - type === "password" && - value.length > 0 && - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { - onClick: function () { - return setShowPassword(showPassword === false); - }, - "data-supertokens": "inputAdornment showPassword", - }, - { - children: jsxRuntime.jsx(ShowPasswordIcon, { - showPassword: showPassword, - }), + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "headerTitle" }, + { children: t("EMAIL_PASSWORD_RESET_SUBMIT_PW_HEADER_TITLE") } + ) + ), + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "headerSubtitle" }, + { + children: jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "secondaryText" }, + { children: t("EMAIL_PASSWORD_RESET_SUBMIT_PW_HEADER_SUBTITLE") } + ) + ), + } + ) + ), + props.error !== undefined && + jsxRuntime.jsx(generalError.GeneralError, { error: props.error }), + jsxRuntime.jsx(formBase.FormBase, { + formFields: formFields, + clearError: props.clearError, + onError: props.onError, + buttonLabel: "EMAIL_PASSWORD_RESET_SUBMIT_PW_CHANGE_PW_BTN", + onSuccess: onSuccess, + validateOnBlur: true, + callAPI: function (fields) { + return genericComponentOverrideContext.__awaiter( + void 0, + void 0, + void 0, + function () { + var validationErrors, response; + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + return [ + 4 /*yield*/, + genericComponentOverrideContext.validateForm( + fields, + props.config.resetPasswordUsingTokenFeature + .submitNewPasswordForm.formFields + ), + ]; + case 1: + validationErrors = _a.sent(); + if (validationErrors.length > 0) { + return [ + 2 /*return*/, + { + status: "FIELD_ERROR", + formFields: validationErrors, + }, + ]; + } + // Verify that both passwords match. + if (fields[0].value !== fields[1].value) { + return [ + 2 /*return*/, + { + status: "FIELD_ERROR", + formFields: [ + { + id: fields[1].id, + error: "ERROR_CONFIRM_PASSWORD_NO_MATCH", + }, + ], + }, + ]; + } + return [ + 4 /*yield*/, + props.recipeImplementation.submitNewPassword({ + formFields: fields, + userContext: userContext, + }), + ]; + case 2: + response = _a.sent(); + if ( + response.status === "RESET_PASSWORD_INVALID_TOKEN_ERROR" + ) { + throw new STGeneralError__default.default( + "EMAIL_PASSWORD_RESET_PASSWORD_INVALID_TOKEN_ERROR" + ); + } + return [ + 2 /*return*/, + response.status === "FIELD_ERROR" + ? response + : { + status: "OK", + }, + ]; + } + }); } - ) - ), + ); + }, + showLabels: true, + }), ], } ) @@ -416,359 +515,1054 @@ var Input = function (_a) { ) ); }; +var SubmitNewPassword = uiEntry.withOverride("EmailPasswordSubmitNewPassword", EmailPasswordSubmitNewPassword); -function InputError(_a) { - var error = _a.error; - var t = translationContext.useTranslation(); - return jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign({ "data-supertokens": "inputErrorMessage" }, { children: t(error) }) - ); +/* + * Component. + */ +function ResetPasswordUsingTokenTheme(props) { + /* + * Render. + */ + // If no token, return SubmitNewPassword. + if (props.submitNewPasswordForm !== undefined) { + return jsxRuntime.jsx( + SubmitNewPassword, + genericComponentOverrideContext.__assign({}, props.submitNewPasswordForm) + ); + } + // Otherwise, return EnterEmail. + return jsxRuntime.jsx(ResetPasswordEmail, genericComponentOverrideContext.__assign({}, props.enterEmailForm)); } - -function Label(_a) { - var value = _a.value, - showIsRequired = _a.showIsRequired; - var t = translationContext.useTranslation(); - return jsxRuntime.jsxs( - "div", +function ResetPasswordUsingTokenThemeWrapper(props) { + var hasFont = translations.hasFontDefined(props.config.rootStyle); + var userStyles = props.submitNewPasswordForm + ? props.config.resetPasswordUsingTokenFeature.submitNewPasswordForm.style + : props.config.resetPasswordUsingTokenFeature.enterEmailForm.style; + return jsxRuntime.jsx( + uiEntry.UserContextWrapper, genericComponentOverrideContext.__assign( - { "data-supertokens": "label" }, - { children: [t(value), showIsRequired && " *"] } + { userContext: props.userContext }, + { + children: jsxRuntime.jsx( + themeBase.ThemeBase, + genericComponentOverrideContext.__assign( + { loadDefaultFont: !hasFont, userStyles: [props.config.rootStyle, userStyles] }, + { + children: jsxRuntime.jsx( + ResetPasswordUsingTokenTheme, + genericComponentOverrideContext.__assign({}, props) + ), + } + ) + ), + } ) ); } -var FormBase = function (props) { - var footer = props.footer, - buttonLabel = props.buttonLabel, - showLabels = props.showLabels, - validateOnBlur = props.validateOnBlur, - formFields = props.formFields; - var unmounting = React.useRef(new AbortController()); - React.useEffect( - function () { - // We need this because in some cases this gets called multiple times - unmounting.current = new AbortController(); - return function () { - unmounting.current.abort(); - }; - }, - [unmounting] - ); - var _a = React.useState( - props.formFields.map(function (f) { - return { id: f.id, value: "" }; - }) +var defaultTranslationsEmailPassword = { + en: genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, translations.defaultTranslationsCommon.en), + translations$1.defaultTranslationsEmailVerification.en ), - fieldStates = _a[0], - setFieldStates = _a[1]; - var _b = React.useState(false), - isLoading = _b[0], - setIsLoading = _b[1]; - var updateFieldState = React.useCallback( - function (id, update) { - setFieldStates(function (os) { - var field = os.find(function (f) { - return f.id === id; - }); - if (field === undefined) { - return genericComponentOverrideContext.__spreadArray( - genericComponentOverrideContext.__spreadArray([], os, true), - [update({ id: id, value: "" })], - false - ); - } - return os - .filter(function (f) { - return f !== field; - }) - .concat(update(field)); + { + EMAIL_PASSWORD_EMAIL_LABEL: "Email", + EMAIL_PASSWORD_EMAIL_PLACEHOLDER: "Email address", + EMAIL_PASSWORD_PASSWORD_LABEL: "Password", + EMAIL_PASSWORD_PASSWORD_PLACEHOLDER: "Password", + EMAIL_PASSWORD_SIGN_IN_HEADER_TITLE: "Sign In", + EMAIL_PASSWORD_SIGN_IN_HEADER_SUBTITLE_START: "Not registered yet?", + EMAIL_PASSWORD_SIGN_IN_HEADER_SUBTITLE_SIGN_UP_LINK: "Sign Up", + EMAIL_PASSWORD_SIGN_IN_HEADER_SUBTITLE_END: "", + EMAIL_PASSWORD_SIGN_IN_FOOTER_FORGOT_PW_LINK: "Forgot password?", + EMAIL_PASSWORD_SIGN_IN_SUBMIT_BTN: "SIGN IN", + EMAIL_PASSWORD_SIGN_IN_WRONG_CREDENTIALS_ERROR: "Incorrect email and password combination", + EMAIL_PASSWORD_SIGN_UP_HEADER_TITLE: "Sign Up", + EMAIL_PASSWORD_SIGN_UP_HEADER_SUBTITLE_START: "Already have an account?", + EMAIL_PASSWORD_SIGN_UP_HEADER_SUBTITLE_SIGN_IN_LINK: "Sign In", + EMAIL_PASSWORD_SIGN_UP_HEADER_SUBTITLE_END: "", + EMAIL_PASSWORD_SIGN_UP_FOOTER_START: "By continuing, you agree to our ", + EMAIL_PASSWORD_SIGN_UP_FOOTER_TOS: "Terms of Service", + EMAIL_PASSWORD_SIGN_UP_FOOTER_AND: " and ", + EMAIL_PASSWORD_SIGN_UP_FOOTER_PP: "Privacy Policy", + EMAIL_PASSWORD_SIGN_UP_FOOTER_END: "", + EMAIL_PASSWORD_SIGN_UP_SUBMIT_BTN: "SIGN UP", + EMAIL_PASSWORD_EMAIL_ALREADY_EXISTS: "This email already exists. Please sign in instead", + EMAIL_PASSWORD_RESET_HEADER_TITLE: "Reset your password", + EMAIL_PASSWORD_RESET_HEADER_SUBTITLE: "We will send you an email to reset your password", + EMAIL_PASSWORD_RESET_SEND_FALLBACK_EMAIL: "your account", + EMAIL_PASSWORD_RESET_SEND_BEFORE_EMAIL: "A password reset email has been sent to ", + EMAIL_PASSWORD_RESET_SEND_AFTER_EMAIL: ", if it exists in our system. ", + EMAIL_PASSWORD_RESET_RESEND_LINK: "Resend or change email", + EMAIL_PASSWORD_RESET_SEND_BTN: "Email me", + EMAIL_PASSWORD_RESET_SIGN_IN_LINK: "Sign In", + EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_HEADER_TITLE: "Success!", + EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_DESC: "Your password has been updated successfully", + EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_SIGN_IN_BTN: "SIGN IN", + EMAIL_PASSWORD_NEW_PASSWORD_LABEL: "New password", + EMAIL_PASSWORD_NEW_PASSWORD_PLACEHOLDER: "New password", + EMAIL_PASSWORD_CONFIRM_PASSWORD_LABEL: "Confirm password", + EMAIL_PASSWORD_CONFIRM_PASSWORD_PLACEHOLDER: "Confirm your password", + EMAIL_PASSWORD_RESET_SUBMIT_PW_HEADER_TITLE: "Change your password", + EMAIL_PASSWORD_RESET_SUBMIT_PW_HEADER_SUBTITLE: "Enter a new password below to change your password", + EMAIL_PASSWORD_RESET_SUBMIT_PW_CHANGE_PW_BTN: "CHANGE PASSWORD", + EMAIL_PASSWORD_RESET_PASSWORD_INVALID_TOKEN_ERROR: "Invalid password reset token", + ERROR_EMAIL_NON_STRING: "Email must be of type string", + ERROR_EMAIL_INVALID: "Email is invalid", + ERROR_PASSWORD_NON_STRING: "Password must be of type string", + ERROR_PASSWORD_TOO_SHORT: "Password must contain at least 8 characters, including a number", + ERROR_PASSWORD_TOO_LONG: "Password's length must be lesser than 100 characters", + ERROR_PASSWORD_NO_ALPHA: "Password must contain at least one alphabet", + ERROR_PASSWORD_NO_NUM: "Password must contain at least one number", + ERROR_CONFIRM_PASSWORD_NO_MATCH: "Confirmation password doesn't match", + ERROR_NON_OPTIONAL: "Field is not optional", + /* + * The following are error messages from our backend SDK. + * These are returned as full messages to preserver compatibilty, but they work just like the keys above. + * They are shown as is by default (setting the value to undefined will display the raw translation key) + */ + "This email already exists. Please sign in instead.": undefined, + "Field is not optional": undefined, + "Password must contain at least 8 characters, including a number": undefined, + "Password's length must be lesser than 100 characters": undefined, + "Password must contain at least one alphabet": undefined, + "Password must contain at least one number": undefined, + "Email is invalid": undefined, + "Reset password link was not created because of account take over risk. Please contact support. (ERR_CODE_001)": + undefined, + "Cannot sign up due to security reasons. Please try logging in, use a different login method or contact support. (ERR_CODE_007)": + undefined, + "Cannot sign in due to security reasons. Please try resetting your password, use a different login method or contact support. (ERR_CODE_008)": + undefined, + } + ), +}; + +var ResetPasswordUsingToken$1 = function (props) { + var token = genericComponentOverrideContext.getQueryParams("token"); + var _a = React__namespace.useState(), + error = _a[0], + setError = _a[1]; + var enterEmailFormFeature = props.recipe.config.resetPasswordUsingTokenFeature.enterEmailForm; + var submitNewPasswordFormFeature = props.recipe.config.resetPasswordUsingTokenFeature.submitNewPasswordForm; + var submitNewPasswordForm = + token === undefined || token === null + ? undefined + : { + error: error, + onError: function (error) { + return setError(error); + }, + clearError: function () { + return setError(undefined); + }, + styleFromInit: submitNewPasswordFormFeature.style, + formFields: submitNewPasswordFormFeature.formFields, + recipeImplementation: props.recipe.webJSRecipe, + config: props.recipe.config, + onSignInClicked: function () { + void genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().redirectToAuth({ + show: "signin", + history: props.history, + redirectBack: false, + }); + }, + token: token, + }; + var enterEmailForm = { + onBackButtonClicked: function () { + return genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().redirectToAuth({ + show: "signin", + history: props.history, + redirectBack: false, }); }, - [setFieldStates] - ); - var onInputFocus = React.useCallback( - function (field) { - updateFieldState(field.id, function (os) { - return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, os), { - validated: false, - }); - }); + error: error, + onError: function (error) { + return setError(error); }, - [updateFieldState] - ); - var onInputBlur = React.useCallback( - function (field) { - return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () { - var fieldConfig, error, _a; - return genericComponentOverrideContext.__generator(this, function (_b) { - switch (_b.label) { - case 0: - if (!validateOnBlur) { - return [2 /*return*/]; - } - fieldConfig = props.formFields.find(function (f) { - return f.id === field.id; - }); - if (!(fieldConfig && field.value !== "")) return [3 /*break*/, 2]; - return [4 /*yield*/, fieldConfig.validate(field.value)]; - case 1: - _a = _b.sent(); - return [3 /*break*/, 3]; - case 2: - _a = undefined; - _b.label = 3; - case 3: - error = _a; - updateFieldState(field.id, function (os) { - return genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, os), - { error: error, validated: error === undefined && field.value.length !== 0 } - ); - }); - return [2 /*return*/]; - } - }); - }); + clearError: function () { + return setError(undefined); }, - [validateOnBlur, updateFieldState, props.formFields] + styleFromInit: enterEmailFormFeature.style, + formFields: enterEmailFormFeature.formFields, + recipeImplementation: props.recipe.webJSRecipe, + config: props.recipe.config, + }; + var childProps = { + config: props.recipe.config, + submitNewPasswordForm: submitNewPasswordForm, + enterEmailForm: enterEmailForm, + }; + var recipeComponentOverrides = props.useComponentOverrides(); + return jsxRuntime.jsx( + uiEntry.ComponentOverrideContext.Provider, + genericComponentOverrideContext.__assign( + { value: recipeComponentOverrides }, + { + children: jsxRuntime.jsx( + uiEntry.FeatureWrapper, + genericComponentOverrideContext.__assign( + { + useShadowDom: props.recipe.config.useShadowDom, + defaultStore: defaultTranslationsEmailPassword, + }, + { + children: jsxRuntime.jsxs(React.Fragment, { + children: [ + props.children === undefined && + jsxRuntime.jsx( + ResetPasswordUsingTokenThemeWrapper, + genericComponentOverrideContext.__assign({}, childProps) + ), + props.children && + React__namespace.Children.map(props.children, function (child) { + if (React__namespace.isValidElement(child)) { + return React__namespace.cloneElement(child, childProps); + } + return child; + }), + ], + }), + } + ) + ), + } + ) ); - var onInputChange = React.useCallback( - function (field) { - updateFieldState(field.id, function (os) { - return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, os), { - value: field.value, - error: undefined, - }); - }); - props.clearError(); - }, - [updateFieldState] +}; + +var SignInFooter = uiEntry.withOverride("EmailPasswordSignInFooter", function EmailPasswordSignInFooter(_a) { + var onClick = _a.onClick; + var t = translationContext.useTranslation(); + return jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "link secondaryText forgotPasswordLink", onClick: onClick }, + { children: t("EMAIL_PASSWORD_SIGN_IN_FOOTER_FORGOT_PW_LINK") } + ) ); - var onFormSubmit = React.useCallback( - function (e) { - return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () { - var apiFields, fieldUpdates, result, generalError, e_1, _loop_1, _i, formFields_1, field, errorFields_1; +}); + +var SignInForm = uiEntry.withOverride("EmailPasswordSignInForm", function EmailPasswordSignInForm(props) { + var _this = this; + var userContext = uiEntry.useUserContext(); + return jsxRuntime.jsx(formBase.FormBase, { + formFields: props.formFields, + clearError: props.clearError, + onError: props.onError, + buttonLabel: "EMAIL_PASSWORD_SIGN_IN_SUBMIT_BTN", + onSuccess: props.onSuccess, + callAPI: function (formFields) { + return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { + var validationErrors, response; return genericComponentOverrideContext.__generator(this, function (_a) { switch (_a.label) { case 0: - // Prevent default event propagation. - e.preventDefault(); - // Set loading state. - setIsLoading(true); - setFieldStates(function (os) { - return os.map(function (fs) { - return genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, fs), - { error: undefined } - ); - }); - }); - apiFields = formFields.map(function (field) { - var fieldState = fieldStates.find(function (fs) { - return fs.id === field.id; - }); - return { - id: field.id, - value: fieldState === undefined ? "" : fieldState.value, - }; - }); - fieldUpdates = []; - _a.label = 1; + return [ + 4 /*yield*/, + genericComponentOverrideContext.validateForm( + formFields, + props.config.signInAndUpFeature.signInForm.formFields + ), + ]; case 1: - _a.trys.push([1, 6, 7, 8]); - result = void 0; - generalError = void 0; - _a.label = 2; - case 2: - _a.trys.push([2, 4, , 5]); + validationErrors = _a.sent(); + if (validationErrors.length > 0) { + return [ + 2 /*return*/, + { + status: "FIELD_ERROR", + formFields: validationErrors, + }, + ]; + } return [ 4 /*yield*/, - props.callAPI(apiFields, function (id, value) { - return fieldUpdates.push({ id: id, value: value }); + props.recipeImplementation.signIn({ + formFields: formFields, + userContext: userContext, }), ]; - case 3: - result = _a.sent(); - return [3 /*break*/, 5]; - case 4: - e_1 = _a.sent(); - if (STGeneralError__default.default.isThisError(e_1)) { - generalError = e_1; - } else { - throw e_1; - } - return [3 /*break*/, 5]; - case 5: - if (unmounting.current.signal.aborted) { - return [2 /*return*/]; - } - _loop_1 = function (field) { - var update = fieldUpdates.find(function (f) { - return f.id === field.id; - }); - if (update || field.clearOnSubmit === true) { - // We can do these one by one, it's almost never more than one field - updateFieldState(field.id, function (os) { - return genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, os), - { value: update ? update.value : "" } - ); - }); - } - }; - for (_i = 0, formFields_1 = formFields; _i < formFields_1.length; _i++) { - field = formFields_1[_i]; - _loop_1(field); - } - if (generalError !== undefined) { - props.onError(generalError.message); + case 2: + response = _a.sent(); + if (response.status === "WRONG_CREDENTIALS_ERROR") { + throw new STGeneralError__default.default( + "EMAIL_PASSWORD_SIGN_IN_WRONG_CREDENTIALS_ERROR" + ); + } else if (response.status === "SIGN_IN_NOT_ALLOWED") { + throw new STGeneralError__default.default(response.reason); } else { - // If successful - if (result.status === "OK") { - setIsLoading(false); - props.clearError(); - if (props.onSuccess !== undefined) { - props.onSuccess(result); - } - } - if (unmounting.current.signal.aborted) { - return [2 /*return*/]; - } - // If field error. - if (result.status === "FIELD_ERROR") { - errorFields_1 = result.formFields; - setFieldStates(function (os) { - return os.map(function (fs) { - var _a; - return genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, fs), - { - error: - (_a = errorFields_1.find(function (ef) { - return ef.id === fs.id; - })) === null || _a === void 0 - ? void 0 - : _a.error, - } - ); - }); - }); - } + return [2 /*return*/, response]; } - return [3 /*break*/, 8]; - case 6: - _a.sent(); - props.onError("SOMETHING_WENT_WRONG_ERROR"); - return [3 /*break*/, 8]; - case 7: - setIsLoading(false); - return [7 /*endfinally*/]; - case 8: - return [2 /*return*/]; } }); }); }, - [setIsLoading, setFieldStates, props, formFields, fieldStates] + validateOnBlur: false, + showLabels: true, + footer: props.footer, + }); +}); + +var SignInHeader = uiEntry.withOverride("EmailPasswordSignInHeader", function EmailPasswordSignInHeader(_a) { + var onClick = _a.onClick; + var t = translationContext.useTranslation(); + return jsxRuntime.jsxs(React.Fragment, { + children: [ + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "headerTitle" }, + { children: t("EMAIL_PASSWORD_SIGN_IN_HEADER_TITLE") } + ) + ), + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "headerSubtitle" }, + { + children: jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "secondaryText" }, + { + children: [ + t("EMAIL_PASSWORD_SIGN_IN_HEADER_SUBTITLE_START"), + jsxRuntime.jsx( + "span", + genericComponentOverrideContext.__assign( + { "data-supertokens": "link", onClick: onClick }, + { children: t("EMAIL_PASSWORD_SIGN_IN_HEADER_SUBTITLE_SIGN_UP_LINK") } + ) + ), + t("EMAIL_PASSWORD_SIGN_IN_HEADER_SUBTITLE_END"), + ], + } + ) + ), + } + ) + ), + jsxRuntime.jsx("div", { "data-supertokens": "divider" }), + ], + }); +}); + +var SignIn = uiEntry.withOverride("EmailPasswordSignIn", function EmailPasswordSignIn(props) { + return jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "container" }, + { + children: [ + jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "row" }, + { + children: [ + jsxRuntime.jsx(SignInHeader, { onClick: props.signUpClicked }), + props.error !== undefined && + jsxRuntime.jsx(generalError.GeneralError, { error: props.error }), + jsxRuntime.jsx( + SignInForm, + genericComponentOverrideContext.__assign({}, props, { + footer: jsxRuntime.jsx(SignInFooter, { + onClick: props.forgotPasswordClick, + }), + }) + ), + ], + } + ) + ), + jsxRuntime.jsx(SuperTokensBranding.SuperTokensBranding, {}), + ], + } + ) ); +}); + +var SignUpFooter = uiEntry.withOverride("EmailPasswordSignUpFooter", function EmailPasswordSignUpFooter(_a) { + var termsOfServiceLink = _a.termsOfServiceLink, + privacyPolicyLink = _a.privacyPolicyLink; + var t = translationContext.useTranslation(); + if (termsOfServiceLink === undefined && privacyPolicyLink === undefined) { + return null; + } return jsxRuntime.jsxs( - "form", + "div", genericComponentOverrideContext.__assign( - { autoComplete: "on", noValidate: true, onSubmit: onFormSubmit }, + { "data-supertokens": "secondaryText privacyPolicyAndTermsAndConditions" }, { children: [ - formFields.map(function (field) { - var type = "text"; - // If email or password, replace field type. - if (validators.MANDATORY_FORM_FIELDS_ID_ARRAY.includes(field.id)) { - type = field.id; - } - if (field.id === "confirm-password") { - type = "password"; - } - var fstate = fieldStates.find(function (s) { - return s.id === field.id; - }) || { - id: field.id, - validated: false, - error: undefined, - value: "", - }; - return jsxRuntime.jsx( - FormRow, + t("EMAIL_PASSWORD_SIGN_UP_FOOTER_START"), + termsOfServiceLink !== undefined && + jsxRuntime.jsx( + "a", + genericComponentOverrideContext.__assign( + { + "data-supertokens": "link", + href: termsOfServiceLink, + target: "_blank", + rel: "noopener noreferer", + }, + { children: t("EMAIL_PASSWORD_SIGN_UP_FOOTER_TOS") } + ) + ), + termsOfServiceLink !== undefined && + privacyPolicyLink !== undefined && + t("EMAIL_PASSWORD_SIGN_UP_FOOTER_AND"), + privacyPolicyLink !== undefined && + jsxRuntime.jsx( + "a", genericComponentOverrideContext.__assign( - { hasError: fstate.error !== undefined }, { - children: jsxRuntime.jsxs(React.Fragment, { - children: [ - showLabels && - (field.labelComponent !== undefined - ? field.labelComponent - : jsxRuntime.jsx(Label, { - value: field.label, - showIsRequired: field.showIsRequired, - })), - field.inputComponent !== undefined - ? jsxRuntime.jsx(field.inputComponent, { - type: type, - name: field.id, - validated: fstate.validated === true, - placeholder: field.placeholder, - value: fstate.value, - autoComplete: field.autoComplete, - autofocus: field.autofocus, - onInputFocus: onInputFocus, - onInputBlur: onInputBlur, - onChange: onInputChange, - hasError: fstate.error !== undefined, - }) - : jsxRuntime.jsx(Input, { - type: type, - name: field.id, - validated: fstate.validated === true, - placeholder: field.placeholder, - value: fstate.value, - autoComplete: field.autoComplete, - onInputFocus: onInputFocus, - onInputBlur: onInputBlur, - onChange: onInputChange, - autofocus: field.autofocus, - hasError: fstate.error !== undefined, - }), - fstate.error && jsxRuntime.jsx(InputError, { error: fstate.error }), - ], - }), + "data-supertokens": "link", + href: privacyPolicyLink, + target: "_blank", + rel: "noopener noreferer", + }, + { children: t("EMAIL_PASSWORD_SIGN_UP_FOOTER_PP") } + ) + ), + t("EMAIL_PASSWORD_SIGN_UP_FOOTER_END"), + ], + } + ) + ); +}); + +/* + * Component. + */ +var SignUpForm = uiEntry.withOverride("EmailPasswordSignUpForm", function EmailPasswordSignUpForm(props) { + var _this = this; + var userContext = uiEntry.useUserContext(); + return jsxRuntime.jsx(formBase.FormBase, { + formFields: props.formFields, + clearError: props.clearError, + onError: props.onError, + buttonLabel: "EMAIL_PASSWORD_SIGN_UP_SUBMIT_BTN", + onSuccess: props.onSuccess, + callAPI: function (formFields) { + return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { + var validationErrors, res; + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + return [ + 4 /*yield*/, + genericComponentOverrideContext.validateForm( + formFields, + props.config.signInAndUpFeature.signUpForm.formFields + ), + ]; + case 1: + validationErrors = _a.sent(); + if (validationErrors.length > 0) { + return [ + 2 /*return*/, + { + status: "FIELD_ERROR", + formFields: validationErrors, + }, + ]; + } + return [ + 4 /*yield*/, + props.recipeImplementation.signUp({ + formFields: formFields, + userContext: userContext, + }), + ]; + case 2: + res = _a.sent(); + if (res.status === "SIGN_UP_NOT_ALLOWED") { + throw new STGeneralError__default$1.default(res.reason); + } + return [2 /*return*/, res]; + } + }); + }); + }, + validateOnBlur: true, + showLabels: true, + footer: props.footer, + }); +}); + +var SignUpHeader = uiEntry.withOverride("EmailPasswordSignUpHeader", function EmailPasswordSignUpHeader(_a) { + var onClick = _a.onClick; + var t = translationContext.useTranslation(); + return jsxRuntime.jsxs(React.Fragment, { + children: [ + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "headerTitle" }, + { children: t("EMAIL_PASSWORD_SIGN_UP_HEADER_TITLE") } + ) + ), + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "headerSubtitle" }, + { + children: jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "secondaryText" }, + { + children: [ + t("EMAIL_PASSWORD_SIGN_UP_HEADER_SUBTITLE_START"), + jsxRuntime.jsx( + "span", + genericComponentOverrideContext.__assign( + { "data-supertokens": "link", onClick: onClick }, + { children: t("EMAIL_PASSWORD_SIGN_UP_HEADER_SUBTITLE_SIGN_IN_LINK") } + ) + ), + t("EMAIL_PASSWORD_SIGN_UP_HEADER_SUBTITLE_END"), + ], } + ) + ), + } + ) + ), + jsxRuntime.jsx("div", { "data-supertokens": "divider" }), + ], + }); +}); + +var SignUp = uiEntry.withOverride("EmailPasswordSignUp", function EmailPasswordSignUp(props) { + return jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "container" }, + { + children: [ + jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "row" }, + { + children: [ + jsxRuntime.jsx(SignUpHeader, { onClick: props.signInClicked }), + props.error !== undefined && + jsxRuntime.jsx(generalError.GeneralError, { error: props.error }), + jsxRuntime.jsx( + SignUpForm, + genericComponentOverrideContext.__assign({}, props, { + footer: jsxRuntime.jsx(SignUpFooter, { + privacyPolicyLink: + props.config.signInAndUpFeature.signUpForm.privacyPolicyLink, + termsOfServiceLink: + props.config.signInAndUpFeature.signUpForm.termsOfServiceLink, + }), + }) + ), + ], + } + ) + ), + jsxRuntime.jsx(SuperTokensBranding.SuperTokensBranding, {}), + ], + } + ) + ); +}); + +var SignInAndUpTheme = function (props) { + // If isSignUp, return signUp. + if (props.featureState.isSignUp) { + return jsxRuntime.jsx( + SignUp, + genericComponentOverrideContext.__assign({}, props.signUpForm, { + signInClicked: function () { + props.dispatch({ type: "setSignIn" }); + }, + }) + ); + } + // Otherwise, return SignIn. + return jsxRuntime.jsx( + SignIn, + genericComponentOverrideContext.__assign({}, props.signInForm, { + signUpClicked: function () { + props.dispatch({ type: "setSignUp" }); + }, + }) + ); +}; +function SignInAndUpThemeWrapper(props) { + var hasFont = translations.hasFontDefined(props.config.rootStyle); + var activeStyle = props.featureState.isSignUp + ? props.config.signInAndUpFeature.signUpForm.style + : props.config.signInAndUpFeature.signInForm.style; + return jsxRuntime.jsx( + uiEntry.UserContextWrapper, + genericComponentOverrideContext.__assign( + { userContext: props.userContext }, + { + children: jsxRuntime.jsx( + themeBase.ThemeBase, + genericComponentOverrideContext.__assign( + { loadDefaultFont: !hasFont, userStyles: [props.config.rootStyle, activeStyle] }, + { + children: jsxRuntime.jsx( + SignInAndUpTheme, + genericComponentOverrideContext.__assign({}, props) ), - field.id - ); - }), - jsxRuntime.jsx( - FormRow, + } + ) + ), + } + ) + ); +} + +var useFeatureReducer = function (recipe) { + return React__namespace.useReducer( + function (oldState, action) { + switch (action.type) { + case "setSignIn": + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, oldState), + { error: undefined, isSignUp: false } + ); + case "setSignUp": + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, oldState), + { error: undefined, isSignUp: true } + ); + case "setError": + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, oldState), + { error: action.error } + ); + default: + return oldState; + } + }, + { + isSignUp: recipe === undefined ? false : recipe.config.signInAndUpFeature.defaultToSignUp, + user: undefined, + error: undefined, + }, + function (initArg) { + var show = genericComponentOverrideContext.getQueryParams("show"); + var isSignUp = initArg.isSignUp; + if (show !== null) { + isSignUp = show === "signup"; + } + return { + isSignUp: isSignUp, + user: undefined, + error: undefined, + }; + } + ); +}; +function useChildProps(recipe$1, state, dispatch, history) { + var _this = this; + var recipeImplementation = React.useMemo( + function () { + return recipe$1 && getModifiedRecipeImplementation(recipe$1.webJSRecipe); + }, + [recipe$1] + ); + var userContext = uiEntry.useUserContext(); + var onSignInSuccess = React.useCallback( + function (response) { + return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { + return genericComponentOverrideContext.__generator(this, function (_a) { + return [ + 2 /*return*/, + recipe.Session.getInstanceOrThrow().validateGlobalClaimsAndHandleSuccessRedirection( + { + rid: recipe$1.config.recipeId, + successRedirectContext: { + action: "SUCCESS", + isNewRecipeUser: false, + user: response.user, + redirectToPath: genericComponentOverrideContext.getRedirectToPathFromURL(), + }, + }, + userContext, + history + ), + ]; + }); + }); + }, + [recipe$1, userContext, history] + ); + var onSignUpSuccess = React.useCallback( + function (response) { + return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { + return genericComponentOverrideContext.__generator(this, function (_a) { + return [ + 2 /*return*/, + recipe.Session.getInstanceOrThrow().validateGlobalClaimsAndHandleSuccessRedirection( + { + rid: recipe$1.config.recipeId, + successRedirectContext: { + action: "SUCCESS", + isNewRecipeUser: true, + user: response.user, + redirectToPath: genericComponentOverrideContext.getRedirectToPathFromURL(), + }, + }, + userContext, + history + ), + ]; + }); + }); + }, + [recipe$1, userContext, history] + ); + return React.useMemo( + function () { + if (recipe$1 === undefined || recipeImplementation === undefined) { + return; + } + var signInAndUpFeature = recipe$1.config.signInAndUpFeature; + var signUpFeature = signInAndUpFeature.signUpForm; + var signInFeature = signInAndUpFeature.signInForm; + var signInForm = { + recipeImplementation: recipeImplementation, + config: recipe$1.config, + styleFromInit: signInFeature.style, + formFields: signInFeature.formFields, + error: state.error, + clearError: function () { + return dispatch({ type: "setError", error: undefined }); + }, + onError: function (error) { + return dispatch({ type: "setError", error: error }); + }, + onSuccess: onSignInSuccess, + forgotPasswordClick: function () { + return recipe$1.redirect({ action: "RESET_PASSWORD" }, history); + }, + }; + var signUpForm = { + recipeImplementation: recipeImplementation, + config: recipe$1.config, + styleFromInit: signUpFeature.style, + formFields: getThemeSignUpFeatureFormFields(signUpFeature.formFields, recipe$1, userContext), + error: state.error, + clearError: function () { + return dispatch({ type: "setError", error: undefined }); + }, + onError: function (error) { + return dispatch({ type: "setError", error: error }); + }, + onSuccess: onSignUpSuccess, + }; + return { + config: recipe$1.config, + signInForm: signInForm, + signUpForm: signUpForm, + }; + }, + [recipe$1, state, dispatch] + ); +} +var SignInAndUpFeature = function (props) { + var _a = useFeatureReducer(props.recipe), + state = _a[0], + dispatch = _a[1]; + var childProps = useChildProps(props.recipe, state, dispatch, props.history); + var recipeComponentOverrides = props.useComponentOverrides(); + return jsxRuntime.jsx( + uiEntry.ComponentOverrideContext.Provider, + genericComponentOverrideContext.__assign( + { value: recipeComponentOverrides }, + { + children: jsxRuntime.jsx( + uiEntry.FeatureWrapper, + genericComponentOverrideContext.__assign( + { + useShadowDom: props.recipe.config.useShadowDom, + defaultStore: defaultTranslationsEmailPassword, + }, { children: jsxRuntime.jsxs(React.Fragment, { children: [ - jsxRuntime.jsx(button.Button, { - disabled: isLoading, - isLoading: isLoading, - type: "submit", - label: buttonLabel, - }), - footer, + props.children === undefined && + jsxRuntime.jsx( + SignInAndUpThemeWrapper, + genericComponentOverrideContext.__assign({}, childProps, { + featureState: state, + dispatch: dispatch, + }) + ), + props.children && + React__namespace.Children.map(props.children, function (child) { + if (React__namespace.isValidElement(child)) { + return React__namespace.cloneElement( + child, + genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, childProps), + { featureState: state, dispatch: dispatch } + ) + ); + } + return child; + }), ], }), - }, - "form-button" - ), - ], + } + ) + ), } ) ); }; +var getModifiedRecipeImplementation = function (origImpl) { + return genericComponentOverrideContext.__assign({}, origImpl); +}; +function getThemeSignUpFeatureFormFields(formFields, recipe, userContext) { + var _this = this; + var emailPasswordOnly = formFields.length === 2; + return formFields.map(function (field) { + return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, field), { + showIsRequired: (function () { + // If email and password only, do not show required indicator (*). + if (emailPasswordOnly) { + return false; + } + // Otherwise, show for all non optional fields (including email and password). + return field.optional === false; + })(), + validate: (function () { + // If field is not email, return field validate unchanged. + if (field.id !== "email") { + return field.validate; + } + // Otherwise, if email, use syntax validate method and check if email exists. + return function (value) { + return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { + var error, emailExists, err_1; + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + return [4 /*yield*/, field.validate(value)]; + case 1: + error = _a.sent(); + if (error !== undefined) { + return [2 /*return*/, error]; + } + if (typeof value !== "string") { + return [2 /*return*/, "GENERAL_ERROR_EMAIL_NON_STRING"]; + } + _a.label = 2; + case 2: + _a.trys.push([2, 4, , 5]); + return [ + 4 /*yield*/, + recipe.webJSRecipe.doesEmailExist({ + email: value, + userContext: userContext, + }), + ]; + case 3: + emailExists = _a.sent().doesExist; + if (emailExists) { + return [2 /*return*/, "EMAIL_PASSWORD_EMAIL_ALREADY_EXISTS"]; + } + return [3 /*break*/, 5]; + case 4: + err_1 = _a.sent(); + if (STGeneralError__default.default.isThisError(err_1)) { + return [2 /*return*/, err_1.message]; + } + return [3 /*break*/, 5]; + case 5: + return [2 /*return*/, undefined]; + } + }); + }); + }; + })(), + }); + }); +} + +var EmailPasswordPreBuiltUI = /** @class */ (function (_super) { + genericComponentOverrideContext.__extends(EmailPasswordPreBuiltUI, _super); + function EmailPasswordPreBuiltUI(recipeInstance) { + var _this = _super.call(this) || this; + _this.recipeInstance = recipeInstance; + // Instance methods + _this.getFeatures = function (useComponentOverrides) { + if (useComponentOverrides === void 0) { + useComponentOverrides = componentOverrideContext.useContext; + } + var features = {}; + if (_this.recipeInstance.config.signInAndUpFeature.disableDefaultUI !== true) { + var normalisedFullPath = _this.recipeInstance.config.appInfo.websiteBasePath.appendPath( + new NormalisedURLPath__default.default("/") + ); + features[normalisedFullPath.getAsStringDangerous()] = { + matches: genericComponentOverrideContext.matchRecipeIdUsingQueryParams( + _this.recipeInstance.config.recipeId + ), + component: function (props) { + return _this.getFeatureComponent("signinup", props, useComponentOverrides); + }, + recipeID: recipe$1.EmailPassword.RECIPE_ID, + }; + } + if (_this.recipeInstance.config.resetPasswordUsingTokenFeature.disableDefaultUI !== true) { + var normalisedFullPath = _this.recipeInstance.config.appInfo.websiteBasePath.appendPath( + new NormalisedURLPath__default.default(validators.DEFAULT_RESET_PASSWORD_PATH) + ); + features[normalisedFullPath.getAsStringDangerous()] = { + matches: genericComponentOverrideContext.matchRecipeIdUsingQueryParams( + _this.recipeInstance.config.recipeId + ), + component: function (props) { + return _this.getFeatureComponent("resetpassword", props, useComponentOverrides); + }, + recipeID: recipe$1.EmailPassword.RECIPE_ID, + }; + } + return features; + }; + _this.getFeatureComponent = function (componentName, props, useComponentOverrides) { + if (useComponentOverrides === void 0) { + useComponentOverrides = componentOverrideContext.useContext; + } + if (componentName === "signinup") { + if (props.redirectOnSessionExists !== false) { + return jsxRuntime.jsx( + uiEntry.UserContextWrapper, + genericComponentOverrideContext.__assign( + { userContext: props.userContext }, + { + children: jsxRuntime.jsx( + SuperTokensBranding.AuthWidgetWrapper, + genericComponentOverrideContext.__assign( + { authRecipe: _this.recipeInstance, history: props.history }, + { + children: jsxRuntime.jsx( + SignInAndUpFeature, + genericComponentOverrideContext.__assign( + { recipe: _this.recipeInstance }, + props, + { useComponentOverrides: useComponentOverrides } + ) + ), + } + ) + ), + } + ) + ); + } else { + return jsxRuntime.jsx( + uiEntry.UserContextWrapper, + genericComponentOverrideContext.__assign( + { userContext: props.userContext }, + { + children: jsxRuntime.jsx( + SignInAndUpFeature, + genericComponentOverrideContext.__assign({ recipe: _this.recipeInstance }, props, { + useComponentOverrides: useComponentOverrides, + }) + ), + } + ) + ); + } + } else if (componentName === "resetpassword") { + return jsxRuntime.jsx( + uiEntry.UserContextWrapper, + genericComponentOverrideContext.__assign( + { userContext: props.userContext }, + { + children: jsxRuntime.jsx( + ResetPasswordUsingToken$1, + genericComponentOverrideContext.__assign({ recipe: _this.recipeInstance }, props, { + useComponentOverrides: useComponentOverrides, + }) + ), + } + ) + ); + } else { + throw new Error("Should never come here."); + } + }; + return _this; + } + // Static methods + EmailPasswordPreBuiltUI.getInstanceOrInitAndGetInstance = function () { + if (EmailPasswordPreBuiltUI.instance === undefined) { + var recipeInstance = recipe$1.EmailPassword.getInstanceOrThrow(); + EmailPasswordPreBuiltUI.instance = new EmailPasswordPreBuiltUI(recipeInstance); + } + return EmailPasswordPreBuiltUI.instance; + }; + EmailPasswordPreBuiltUI.getFeatures = function (useComponentOverrides) { + if (useComponentOverrides === void 0) { + useComponentOverrides = componentOverrideContext.useContext; + } + return EmailPasswordPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatures(useComponentOverrides); + }; + EmailPasswordPreBuiltUI.getFeatureComponent = function (componentName, props, useComponentOverrides) { + if (useComponentOverrides === void 0) { + useComponentOverrides = componentOverrideContext.useContext; + } + return EmailPasswordPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent( + componentName, + props, + useComponentOverrides + ); + }; + // For tests + EmailPasswordPreBuiltUI.reset = function () { + if (!genericComponentOverrideContext.isTest()) { + return; + } + EmailPasswordPreBuiltUI.instance = undefined; + return; + }; + EmailPasswordPreBuiltUI.SignInAndUp = function (prop) { + if (prop === void 0) { + prop = {}; + } + return EmailPasswordPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent("signinup", prop); + }; + EmailPasswordPreBuiltUI.ResetPasswordUsingToken = function (prop) { + return EmailPasswordPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent("resetpassword", prop); + }; + EmailPasswordPreBuiltUI.ResetPasswordUsingTokenTheme = ResetPasswordUsingTokenThemeWrapper; + EmailPasswordPreBuiltUI.SignInAndUpTheme = SignInAndUpThemeWrapper; + return EmailPasswordPreBuiltUI; +})(uiEntry.RecipeRouter); +var SignInAndUp = EmailPasswordPreBuiltUI.SignInAndUp; +var ResetPasswordUsingToken = EmailPasswordPreBuiltUI.ResetPasswordUsingToken; -exports.ErrorIcon = ErrorIcon; -exports.FormBase = FormBase; -exports.FormRow = FormRow; -exports.Label = Label; +exports.EmailPasswordPreBuiltUI = EmailPasswordPreBuiltUI; +exports.ResetPasswordUsingToken = ResetPasswordUsingToken; +exports.ResetPasswordUsingTokenThemeWrapper = ResetPasswordUsingTokenThemeWrapper; +exports.SignInAndUp = SignInAndUp; +exports.SignInAndUpThemeWrapper = SignInAndUpThemeWrapper; +exports.SignInFooter = SignInFooter; +exports.SignInForm = SignInForm; +exports.SignInHeader = SignInHeader; +exports.SignUpFooter = SignUpFooter; +exports.SignUpForm = SignUpForm; +exports.SignUpHeader = SignUpHeader; +exports.defaultTranslationsEmailPassword = defaultTranslationsEmailPassword; +exports.useChildProps = useChildProps; +exports.useFeatureReducer = useFeatureReducer; diff --git a/lib/build/emailpassword-shared8.js b/lib/build/emailpassword-shared8.js new file mode 100644 index 000000000..3346c417d --- /dev/null +++ b/lib/build/emailpassword-shared8.js @@ -0,0 +1,774 @@ +"use strict"; + +var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); +var jsxRuntime = require("react/jsx-runtime"); +var React = require("react"); +var STGeneralError = require("supertokens-web-js/utils/error"); +var validators = require("./emailpassword-shared6.js"); +var button = require("./emailpassword-shared3.js"); +require("./index2.js"); +var translationContext = require("./translationContext.js"); + +function _interopDefault(e) { + return e && e.__esModule ? e : { default: e }; +} + +var STGeneralError__default = /*#__PURE__*/ _interopDefault(STGeneralError); + +/* + * Component. + */ +function FormRow(_a) { + var children = _a.children, + hasError = _a.hasError; + return jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": ["formRow", hasError ? "hasError" : ""].join(" ") }, + { children: children } + ) + ); +} + +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +/* + * Imports. + */ +/* + * Component. + */ +function CheckedIcon() { + return jsxRuntime.jsx( + "svg", + genericComponentOverrideContext.__assign( + { + xmlns: "http://www.w3.org/2000/svg", + width: "14.862", + height: "12.033", + viewBox: "0 0 14.862 12.033", + "data-supertokens": "checkedIcon", + }, + { + children: jsxRuntime.jsx("path", { + fill: "rgb(var(--palette-primary))", + d: "M12.629 49L5.06 56.572l-2.829-2.829L0 55.977l5.057 5.057.654-.651 9.152-9.152z", + transform: "translate(0 -49)", + }), + } + ) + ); +} + +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +/* + * Imports. + */ +/* + * Component. + */ +function ErrorIcon() { + return jsxRuntime.jsx( + "svg", + genericComponentOverrideContext.__assign( + { + xmlns: "http://www.w3.org/2000/svg", + width: "17", + height: "15", + viewBox: "0 0 17 15", + "data-supertokens": "errorIcon", + }, + { + children: jsxRuntime.jsxs("g", { + children: [ + jsxRuntime.jsx( + "g", + genericComponentOverrideContext.__assign( + { className: "Asdf", fill: "rgb(var(--palette-error))" }, + { + children: jsxRuntime.jsx("path", { + d: "M13.568 14.75H3.432c-.63 0-1.195-.325-1.512-.869-.317-.544-.32-1.196-.01-1.744l5.067-8.943c.315-.556.884-.887 1.523-.887.639 0 1.208.331 1.523.887l5.067 8.943c.31.548.307 1.2-.01 1.744s-.882.869-1.512.869z", + transform: "translate(-824.894 -352.829) translate(824.894 352.829)", + }), + } + ) + ), + jsxRuntime.jsx( + "text", + genericComponentOverrideContext.__assign( + { + fill: "#fff", + fontSize: "10px", + fontWeight: "700", + transform: "translate(-824.894 -352.829) translate(832.014 365.198)", + }, + { + children: jsxRuntime.jsx( + "tspan", + genericComponentOverrideContext.__assign({ x: "0", y: "0" }, { children: "!" }) + ), + } + ) + ), + ], + }), + } + ) + ); +} + +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +/* + * Imports. + */ +/* + * Component. + */ +function ShowPasswordIcon(_a) { + var showPassword = _a.showPassword; + if (showPassword === true) { + return jsxRuntime.jsx("div", { + children: jsxRuntime.jsx( + "svg", + genericComponentOverrideContext.__assign( + { + xmlns: "http://www.w3.org/2000/svg", + width: "18.391", + height: "16.276", + viewBox: "0 0 18.391 16.276", + "data-supertokens": "showPasswordIcon show", + }, + { + children: jsxRuntime.jsxs("g", { + children: [ + jsxRuntime.jsx("g", { + children: jsxRuntime.jsx("g", { + children: jsxRuntime.jsx("g", { + children: jsxRuntime.jsx("path", { + fill: "rgb(var(--palette-textPrimary))", + d: "M29.289 100.33c-2.4-3.63-5.619-5.63-9.069-5.63s-6.67 2-9.069 5.63a.767.767 0 0 0 0 .845c2.4 3.63 5.619 5.63 9.069 5.63s6.67-2 9.069-5.63a.767.767 0 0 0 0-.845zm-9.069 4.944c-2.785 0-5.435-1.6-7.5-4.519 2.065-2.92 4.715-4.519 7.5-4.519s5.435 1.6 7.5 4.519c-2.064 2.92-4.711 4.519-7.5 4.519z", + transform: + "translate(-822 -420.048) translate(822 422.035) translate(-11.025 -94.7)", + }), + }), + }), + }), + jsxRuntime.jsxs( + "g", + genericComponentOverrideContext.__assign( + { + fill: "rgb(var(--palette-textPrimary))", + stroke: "rgb(var(--palette-inputBackground))", + transform: "translate(-822 -420.048) translate(827.164 424.055)", + }, + { + children: [ + jsxRuntime.jsx("circle", { + cx: "4.036", + cy: "4.036", + r: "4.036", + stroke: "none", + }), + jsxRuntime.jsx("circle", { + cx: "4.036", + cy: "4.036", + r: "3.536", + fill: "none", + }), + ], + } + ) + ), + jsxRuntime.jsx("path", { + fill: "none", + stroke: "#707070", + strokeLinecap: "round", + strokeWidth: "2.25px", + d: "M11.981 0L0 11.981", + transform: "translate(-822 -420.048) translate(825.084 421.639)", + }), + jsxRuntime.jsx("path", { + fill: "none", + stroke: "rgb(var(--palette-inputBackground))", + strokeLinecap: "round", + d: "M13.978 0L0 13.978", + transform: "translate(-822 -420.048) translate(825.084 421.639)", + }), + ], + }), + } + ) + ), + }); + } + return jsxRuntime.jsx("div", { + children: jsxRuntime.jsx( + "svg", + genericComponentOverrideContext.__assign( + { + xmlns: "http://www.w3.org/2000/svg", + width: "18.281", + height: "12.033", + viewBox: "0 0 18.281 12.033", + "data-supertokens": "showPasswordIcon hide", + }, + { + children: jsxRuntime.jsxs("g", { + children: [ + jsxRuntime.jsx("g", { + children: jsxRuntime.jsx("g", { + children: jsxRuntime.jsx("g", { + children: jsxRuntime.jsx("path", { + fill: "rgb(var(--palette-textPrimary))", + d: "M29.18 100.3c-2.384-3.608-5.586-5.6-9.015-5.6s-6.63 1.989-9.015 5.6a.763.763 0 0 0 0 .84c2.384 3.608 5.586 5.6 9.015 5.6s6.63-1.989 9.015-5.6a.763.763 0 0 0 0-.84zm-9.015 4.914c-2.769 0-5.4-1.589-7.459-4.492 2.052-2.9 4.686-4.492 7.459-4.492s5.4 1.589 7.459 4.492c-2.056 2.899-4.686 4.489-7.458 4.489z", + transform: + "translate(-822 -422.088) translate(822 422.088) translate(-11.025 -94.7)", + }), + }), + }), + }), + jsxRuntime.jsxs( + "g", + genericComponentOverrideContext.__assign( + { + fill: "rgb(var(--palette-textPrimary))", + stroke: "rgb(var(--palette-inputBackground))", + transform: "translate(-822 -422.088) translate(827.133 424.096)", + }, + { + children: [ + jsxRuntime.jsx("circle", { + cx: "4.012", + cy: "4.012", + r: "4.012", + stroke: "none", + }), + jsxRuntime.jsx("circle", { + cx: "4.012", + cy: "4.012", + r: "3.512", + fill: "none", + }), + ], + } + ) + ), + ], + }), + } + ) + ), + }); +} + +var Input = function (_a) { + var type = _a.type, + name = _a.name, + hasError = _a.hasError, + autoComplete = _a.autoComplete, + onInputFocus = _a.onInputFocus, + onInputBlur = _a.onInputBlur, + onChange = _a.onChange, + value = _a.value, + placeholder = _a.placeholder, + validated = _a.validated, + autofocus = _a.autofocus; + var t = translationContext.useTranslation(); + var _b = React.useState(false), + showPassword = _b[0], + setShowPassword = _b[1]; + /* + * Method. + */ + function handleFocus() { + if (onInputFocus !== undefined) { + onInputFocus({ + id: name, + value: value, + }); + } + } + function handleBlur() { + if (onInputBlur !== undefined) { + onInputBlur({ + id: name, + value: value, + }); + } + } + function handleChange(event) { + if (onChange) { + onChange({ + id: name, + value: event.target.value, + }); + } + } + if (autoComplete === undefined) { + autoComplete = "off"; + } + var inputType = type; + if (type === "password" && showPassword === true) { + inputType = "text"; + } + return jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "inputContainer" }, + { + children: jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": ["inputWrapper", hasError ? "inputError" : ""].join(" ") }, + { + children: [ + jsxRuntime.jsx("input", { + autoFocus: autofocus, + autoComplete: autoComplete, + "data-supertokens": "input", + className: "supertokens-input", + onFocus: handleFocus, + onBlur: handleBlur, + type: inputType, + name: name, + placeholder: t(placeholder), + onChange: handleChange, + value: value, + }), + hasError === true && + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "inputAdornment inputAdornmentError" }, + { children: jsxRuntime.jsx(ErrorIcon, {}) } + ) + ), + validated === true && + hasError === false && + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "inputAdornment inputAdornmentSuccess" }, + { children: jsxRuntime.jsx(CheckedIcon, {}) } + ) + ), + type === "password" && + value.length > 0 && + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { + onClick: function () { + return setShowPassword(showPassword === false); + }, + "data-supertokens": "inputAdornment showPassword", + }, + { + children: jsxRuntime.jsx(ShowPasswordIcon, { + showPassword: showPassword, + }), + } + ) + ), + ], + } + ) + ), + } + ) + ); +}; + +function InputError(_a) { + var error = _a.error; + var t = translationContext.useTranslation(); + return jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign({ "data-supertokens": "inputErrorMessage" }, { children: t(error) }) + ); +} + +function Label(_a) { + var value = _a.value, + showIsRequired = _a.showIsRequired; + var t = translationContext.useTranslation(); + return jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "label" }, + { children: [t(value), showIsRequired && " *"] } + ) + ); +} + +var FormBase = function (props) { + var footer = props.footer, + buttonLabel = props.buttonLabel, + showLabels = props.showLabels, + validateOnBlur = props.validateOnBlur, + formFields = props.formFields; + var unmounting = React.useRef(new AbortController()); + React.useEffect( + function () { + // We need this because in some cases this gets called multiple times + unmounting.current = new AbortController(); + return function () { + unmounting.current.abort(); + }; + }, + [unmounting] + ); + var _a = React.useState( + props.formFields.map(function (f) { + return { id: f.id, value: "" }; + }) + ), + fieldStates = _a[0], + setFieldStates = _a[1]; + var _b = React.useState(false), + isLoading = _b[0], + setIsLoading = _b[1]; + var updateFieldState = React.useCallback( + function (id, update) { + setFieldStates(function (os) { + var field = os.find(function (f) { + return f.id === id; + }); + if (field === undefined) { + return genericComponentOverrideContext.__spreadArray( + genericComponentOverrideContext.__spreadArray([], os, true), + [update({ id: id, value: "" })], + false + ); + } + return os + .filter(function (f) { + return f !== field; + }) + .concat(update(field)); + }); + }, + [setFieldStates] + ); + var onInputFocus = React.useCallback( + function (field) { + updateFieldState(field.id, function (os) { + return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, os), { + validated: false, + }); + }); + }, + [updateFieldState] + ); + var onInputBlur = React.useCallback( + function (field) { + return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () { + var fieldConfig, error, _a; + return genericComponentOverrideContext.__generator(this, function (_b) { + switch (_b.label) { + case 0: + if (!validateOnBlur) { + return [2 /*return*/]; + } + fieldConfig = props.formFields.find(function (f) { + return f.id === field.id; + }); + if (!(fieldConfig && field.value !== "")) return [3 /*break*/, 2]; + return [4 /*yield*/, fieldConfig.validate(field.value)]; + case 1: + _a = _b.sent(); + return [3 /*break*/, 3]; + case 2: + _a = undefined; + _b.label = 3; + case 3: + error = _a; + updateFieldState(field.id, function (os) { + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, os), + { error: error, validated: error === undefined && field.value.length !== 0 } + ); + }); + return [2 /*return*/]; + } + }); + }); + }, + [validateOnBlur, updateFieldState, props.formFields] + ); + var onInputChange = React.useCallback( + function (field) { + updateFieldState(field.id, function (os) { + return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, os), { + value: field.value, + error: undefined, + }); + }); + props.clearError(); + }, + [updateFieldState] + ); + var onFormSubmit = React.useCallback( + function (e) { + return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () { + var apiFields, fieldUpdates, result, generalError, e_1, _loop_1, _i, formFields_1, field, errorFields_1; + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + // Prevent default event propagation. + e.preventDefault(); + // Set loading state. + setIsLoading(true); + setFieldStates(function (os) { + return os.map(function (fs) { + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, fs), + { error: undefined } + ); + }); + }); + apiFields = formFields.map(function (field) { + var fieldState = fieldStates.find(function (fs) { + return fs.id === field.id; + }); + return { + id: field.id, + value: fieldState === undefined ? "" : fieldState.value, + }; + }); + fieldUpdates = []; + _a.label = 1; + case 1: + _a.trys.push([1, 6, 7, 8]); + result = void 0; + generalError = void 0; + _a.label = 2; + case 2: + _a.trys.push([2, 4, , 5]); + return [ + 4 /*yield*/, + props.callAPI(apiFields, function (id, value) { + return fieldUpdates.push({ id: id, value: value }); + }), + ]; + case 3: + result = _a.sent(); + return [3 /*break*/, 5]; + case 4: + e_1 = _a.sent(); + if (STGeneralError__default.default.isThisError(e_1)) { + generalError = e_1; + } else { + throw e_1; + } + return [3 /*break*/, 5]; + case 5: + if (unmounting.current.signal.aborted) { + return [2 /*return*/]; + } + _loop_1 = function (field) { + var update = fieldUpdates.find(function (f) { + return f.id === field.id; + }); + if (update || field.clearOnSubmit === true) { + // We can do these one by one, it's almost never more than one field + updateFieldState(field.id, function (os) { + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, os), + { value: update ? update.value : "" } + ); + }); + } + }; + for (_i = 0, formFields_1 = formFields; _i < formFields_1.length; _i++) { + field = formFields_1[_i]; + _loop_1(field); + } + if (generalError !== undefined) { + props.onError(generalError.message); + } else { + // If successful + if (result.status === "OK") { + setIsLoading(false); + props.clearError(); + if (props.onSuccess !== undefined) { + props.onSuccess(result); + } + } + if (unmounting.current.signal.aborted) { + return [2 /*return*/]; + } + // If field error. + if (result.status === "FIELD_ERROR") { + errorFields_1 = result.formFields; + setFieldStates(function (os) { + return os.map(function (fs) { + var _a; + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, fs), + { + error: + (_a = errorFields_1.find(function (ef) { + return ef.id === fs.id; + })) === null || _a === void 0 + ? void 0 + : _a.error, + } + ); + }); + }); + } + } + return [3 /*break*/, 8]; + case 6: + _a.sent(); + props.onError("SOMETHING_WENT_WRONG_ERROR"); + return [3 /*break*/, 8]; + case 7: + setIsLoading(false); + return [7 /*endfinally*/]; + case 8: + return [2 /*return*/]; + } + }); + }); + }, + [setIsLoading, setFieldStates, props, formFields, fieldStates] + ); + return jsxRuntime.jsxs( + "form", + genericComponentOverrideContext.__assign( + { autoComplete: "on", noValidate: true, onSubmit: onFormSubmit }, + { + children: [ + formFields.map(function (field) { + var type = "text"; + // If email or password, replace field type. + if (validators.MANDATORY_FORM_FIELDS_ID_ARRAY.includes(field.id)) { + type = field.id; + } + if (field.id === "confirm-password") { + type = "password"; + } + var fstate = fieldStates.find(function (s) { + return s.id === field.id; + }) || { + id: field.id, + validated: false, + error: undefined, + value: "", + }; + return jsxRuntime.jsx( + FormRow, + genericComponentOverrideContext.__assign( + { hasError: fstate.error !== undefined }, + { + children: jsxRuntime.jsxs(React.Fragment, { + children: [ + showLabels && + (field.labelComponent !== undefined + ? field.labelComponent + : jsxRuntime.jsx(Label, { + value: field.label, + showIsRequired: field.showIsRequired, + })), + field.inputComponent !== undefined + ? jsxRuntime.jsx(field.inputComponent, { + type: type, + name: field.id, + validated: fstate.validated === true, + placeholder: field.placeholder, + value: fstate.value, + autoComplete: field.autoComplete, + autofocus: field.autofocus, + onInputFocus: onInputFocus, + onInputBlur: onInputBlur, + onChange: onInputChange, + hasError: fstate.error !== undefined, + }) + : jsxRuntime.jsx(Input, { + type: type, + name: field.id, + validated: fstate.validated === true, + placeholder: field.placeholder, + value: fstate.value, + autoComplete: field.autoComplete, + onInputFocus: onInputFocus, + onInputBlur: onInputBlur, + onChange: onInputChange, + autofocus: field.autofocus, + hasError: fstate.error !== undefined, + }), + fstate.error && jsxRuntime.jsx(InputError, { error: fstate.error }), + ], + }), + } + ), + field.id + ); + }), + jsxRuntime.jsx( + FormRow, + { + children: jsxRuntime.jsxs(React.Fragment, { + children: [ + jsxRuntime.jsx(button.Button, { + disabled: isLoading, + isLoading: isLoading, + type: "submit", + label: buttonLabel, + }), + footer, + ], + }), + }, + "form-button" + ), + ], + } + ) + ); +}; + +exports.ErrorIcon = ErrorIcon; +exports.FormBase = FormBase; +exports.FormRow = FormRow; +exports.Label = Label; diff --git a/lib/build/emailpassword.js b/lib/build/emailpassword.js index 54ade2cbb..bf30757c0 100644 --- a/lib/build/emailpassword.js +++ b/lib/build/emailpassword.js @@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); -var componentOverrideContext = require("./emailpassword-shared3.js"); -var recipe = require("./emailpassword-shared4.js"); +var componentOverrideContext = require("./emailpassword-shared4.js"); +var recipe = require("./emailpassword-shared5.js"); require("supertokens-web-js"); require("supertokens-web-js/utils/cookieHandler"); require("supertokens-web-js/utils/postSuperTokensInitCallbacks"); @@ -20,7 +20,7 @@ require("./authRecipe-shared.js"); require("./recipeModule-shared.js"); require("./session-shared2.js"); require("supertokens-web-js/recipe/session"); -require("./emailpassword-shared5.js"); +require("./emailpassword-shared6.js"); /* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. * diff --git a/lib/build/emailpasswordprebuiltui.js b/lib/build/emailpasswordprebuiltui.js index dbf36ecd1..d95b5c900 100644 --- a/lib/build/emailpasswordprebuiltui.js +++ b/lib/build/emailpasswordprebuiltui.js @@ -5,10 +5,10 @@ require("react/jsx-runtime"); require("supertokens-web-js/utils/normalisedURLPath"); require("./index2.js"); require("./SuperTokensBranding.js"); -require("./emailpassword-shared3.js"); -var emailpasswordprebuiltui = require("./emailpassword-shared6.js"); -require("./emailpassword-shared5.js"); require("./emailpassword-shared4.js"); +var emailpasswordprebuiltui = require("./emailpassword-shared7.js"); +require("./emailpassword-shared6.js"); +require("./emailpassword-shared5.js"); require("supertokens-web-js"); require("supertokens-web-js/utils/cookieHandler"); require("supertokens-web-js/utils/postSuperTokensInitCallbacks"); @@ -26,12 +26,13 @@ require("./recipeModule-shared.js"); require("./session-shared3.js"); require("./session-shared.js"); require("./translations.js"); -require("./emailverification-shared2.js"); +require("./emailpassword-shared.js"); require("./arrowLeftIcon.js"); -require("./emailpassword-shared7.js"); +require("./emailpassword-shared8.js"); require("supertokens-web-js/utils/error"); +require("./emailpassword-shared3.js"); require("./emailpassword-shared2.js"); -require("./emailpassword-shared.js"); +require("./emailverification-shared2.js"); require("supertokens-web-js/lib/build/error"); require("supertokens-web-js/recipe/emailpassword"); require("./authRecipe-shared.js"); diff --git a/lib/build/emailverification-shared2.js b/lib/build/emailverification-shared2.js index 6db26e977..ce5456c45 100644 --- a/lib/build/emailverification-shared2.js +++ b/lib/build/emailverification-shared2.js @@ -1,31 +1,8 @@ "use strict"; -var jsxRuntime = require("react/jsx-runtime"); -var React = require("react"); var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); var translations = require("./translations.js"); -var styles = - '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n\n[data-supertokens~="resetPasswordHeaderTitle"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n'; - -var ThemeBase = function (_a) { - var children = _a.children, - userStyles = _a.userStyles, - loadDefaultFont = _a.loadDefaultFont; - return jsxRuntime.jsxs(React.Fragment, { - children: [ - children, - loadDefaultFont && - jsxRuntime.jsx("link", { - href: "//fonts.googleapis.com/css?family=Rubik:wght@300;400;600;500;700", - rel: "stylesheet", - type: "text/css", - }), - jsxRuntime.jsxs("style", { children: [styles, userStyles.join("\n")] }), - ], - }); -}; - var defaultTranslationsEmailVerification = { en: genericComponentOverrideContext.__assign( genericComponentOverrideContext.__assign({}, translations.defaultTranslationsCommon.en), @@ -50,5 +27,4 @@ var defaultTranslationsEmailVerification = { ), }; -exports.ThemeBase = ThemeBase; exports.defaultTranslationsEmailVerification = defaultTranslationsEmailVerification; diff --git a/lib/build/emailverificationprebuiltui.js b/lib/build/emailverificationprebuiltui.js index ad8732620..cd953b081 100644 --- a/lib/build/emailverificationprebuiltui.js +++ b/lib/build/emailverificationprebuiltui.js @@ -9,12 +9,13 @@ var recipe$1 = require("./emailverification-shared.js"); var React = require("react"); var recipe = require("./session-shared2.js"); var translations = require("./translations.js"); -var translations$1 = require("./emailverification-shared2.js"); +var themeBase = require("./emailpassword-shared.js"); var STGeneralError = require("supertokens-web-js/utils/error"); var checkedRoundIcon = require("./checkedRoundIcon.js"); var translationContext = require("./translationContext.js"); -var generalError = require("./emailpassword-shared.js"); -var button = require("./emailpassword-shared2.js"); +var generalError = require("./emailpassword-shared2.js"); +var button = require("./emailpassword-shared3.js"); +var translations$1 = require("./emailverification-shared2.js"); require("supertokens-web-js"); require("supertokens-web-js/utils/cookieHandler"); require("supertokens-web-js/utils/postSuperTokensInitCallbacks"); @@ -724,7 +725,7 @@ function EmailVerificationThemeWrapper(props) { { userContext: props.userContext }, { children: jsxRuntime.jsx( - translations$1.ThemeBase, + themeBase.ThemeBase, genericComponentOverrideContext.__assign( { loadDefaultFont: !hasFont, diff --git a/lib/build/multifactorauth-shared.js b/lib/build/multifactorauth-shared.js new file mode 100644 index 000000000..3078bf480 --- /dev/null +++ b/lib/build/multifactorauth-shared.js @@ -0,0 +1,197 @@ +"use strict"; + +var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); +var MultiFactorAuthWebJS = require("supertokens-web-js/recipe/multifactorauth"); +var NormalisedURLPath = require("supertokens-web-js/utils/normalisedURLPath"); +var postSuperTokensInitCallbacks = require("supertokens-web-js/utils/postSuperTokensInitCallbacks"); +var sessionClaimValidatorStore = require("supertokens-web-js/utils/sessionClaimValidatorStore"); +var index = require("./recipeModule-shared.js"); + +function _interopDefault(e) { + return e && e.__esModule ? e : { default: e }; +} + +var MultiFactorAuthWebJS__default = /*#__PURE__*/ _interopDefault(MultiFactorAuthWebJS); +var NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath); + +var _a = genericComponentOverrideContext.createGenericComponentsOverrideContext(), + useContext = _a[0], + Provider = _a[1]; + +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +var DEFAULT_FACTOR_CHOOSER_PATH = "/verify-email"; + +var getFunctionOverrides = function ( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _onHandleEvent +) { + return function (originalImp) { + return genericComponentOverrideContext.__assign({}, originalImp); + }; +}; + +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +function normaliseMultiFactorAuthFeature(config) { + var _a; + if (config === undefined) { + config = {}; + } + var disableDefaultUI = config.disableDefaultUI === true; + var override = genericComponentOverrideContext.__assign( + { + functions: function (originalImplementation) { + return originalImplementation; + }, + }, + config.override + ); + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign( + {}, + genericComponentOverrideContext.normaliseRecipeModuleConfig(config) + ), + { + disableDefaultUI: disableDefaultUI, + getFirstFactors: function () { + return MultiFactorAuth.getInstanceOrThrow().getDefaultFirstFactors(); + }, + factorChooserScreen: (_a = config.factorChooserScreen) !== null && _a !== void 0 ? _a : {}, + override: override, + } + ); +} + +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +var MultiFactorAuth = /** @class */ (function (_super) { + genericComponentOverrideContext.__extends(MultiFactorAuth, _super); + function MultiFactorAuth(config, webJSRecipe) { + if (webJSRecipe === void 0) { + webJSRecipe = MultiFactorAuthWebJS__default.default; + } + var _this = _super.call(this, config) || this; + _this.webJSRecipe = webJSRecipe; + _this.recipeID = MultiFactorAuth.RECIPE_ID; + _this.getDefaultRedirectionURL = function (context) { + return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { + var chooserPath; + return genericComponentOverrideContext.__generator(this, function (_a) { + if (context.action === "FACTOR_CHOICE_REQUIRED") { + chooserPath = new NormalisedURLPath__default.default(DEFAULT_FACTOR_CHOOSER_PATH); + return [ + 2 /*return*/, + "" + .concat( + this.config.appInfo.websiteBasePath.appendPath(chooserPath).getAsStringDangerous(), + "?rid=" + ) + .concat(this.config.recipeId), + ]; + } else if (context.action === "GO_TO_FACTOR") { + // TODO + return [2 /*return*/, "/"]; + } else { + return [2 /*return*/, "/"]; + } + }); + }); + }; + postSuperTokensInitCallbacks.PostSuperTokensInitCallbacks.addPostInitCallback(function () { + var defaultFactorsValidator = MultiFactorAuth.MultiFactorAuthClaim.validators.hasCompletedDefaultFactors(); + sessionClaimValidatorStore.SessionClaimValidatorStore.addClaimValidatorFromOtherRecipe( + defaultFactorsValidator + ); + }); + return _this; + } + MultiFactorAuth.init = function (config) { + var normalisedConfig = normaliseMultiFactorAuthFeature(config); + return { + recipeID: MultiFactorAuth.RECIPE_ID, + authReact: function (appInfo) { + MultiFactorAuth.instance = new MultiFactorAuth( + genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, normalisedConfig), + { appInfo: appInfo, recipeId: MultiFactorAuth.RECIPE_ID } + ) + ); + return MultiFactorAuth.instance; + }, + webJS: MultiFactorAuthWebJS__default.default.init( + genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, normalisedConfig), + { + override: { + functions: function (originalImpl, builder) { + var functions = getFunctionOverrides(normalisedConfig.onHandleEvent); + builder.override(functions); + builder.override(normalisedConfig.override.functions); + return originalImpl; + }, + }, + } + ) + ), + }; + }; + MultiFactorAuth.getInstanceOrThrow = function () { + if (MultiFactorAuth.instance === undefined) { + var error = "No instance of EmailVerification found. Make sure to call the EmailVerification.init method."; + // eslint-disable-next-line supertokens-auth-react/no-direct-window-object + if (typeof window === "undefined") { + error = error + genericComponentOverrideContext.SSR_ERROR; + } + throw Error(error); + } + return MultiFactorAuth.instance; + }; + MultiFactorAuth.prototype.getDefaultFirstFactors = function () { + return []; + }; + MultiFactorAuth.RECIPE_ID = "multifactorauth"; + MultiFactorAuth.MultiFactorAuthClaim = MultiFactorAuthWebJS.MultiFactorAuthClaim; + return MultiFactorAuth; +})(index.RecipeModule); + +exports.DEFAULT_FACTOR_CHOOSER_PATH = DEFAULT_FACTOR_CHOOSER_PATH; +exports.MultiFactorAuth = MultiFactorAuth; +exports.Provider = Provider; +exports.useContext = useContext; diff --git a/lib/build/multifactorauth.js b/lib/build/multifactorauth.js new file mode 100644 index 000000000..2644efd85 --- /dev/null +++ b/lib/build/multifactorauth.js @@ -0,0 +1,62 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); + +var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); +var recipe = require("./multifactorauth-shared.js"); +require("supertokens-web-js"); +require("supertokens-web-js/utils/cookieHandler"); +require("supertokens-web-js/utils/postSuperTokensInitCallbacks"); +require("supertokens-web-js/utils/windowHandler"); +require("supertokens-web-js/recipe/multitenancy"); +require("supertokens-web-js/utils"); +require("react"); +require("supertokens-web-js/utils/normalisedURLDomain"); +require("supertokens-web-js/utils/normalisedURLPath"); +require("react/jsx-runtime"); +require("supertokens-web-js/recipe/multifactorauth"); +require("supertokens-web-js/utils/sessionClaimValidatorStore"); +require("./recipeModule-shared.js"); + +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +var Wrapper = /** @class */ (function () { + function Wrapper() {} + Wrapper.init = function (config) { + return recipe.MultiFactorAuth.init(config); + }; + Wrapper.getMFAInfo = function (input) { + return recipe.MultiFactorAuth.getInstanceOrThrow().webJSRecipe.getMFAInfo( + genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, input), { + userContext: genericComponentOverrideContext.getNormalisedUserContext( + input === null || input === void 0 ? void 0 : input.userContext + ), + }) + ); + }; + Wrapper.MultiFactorAuthClaim = recipe.MultiFactorAuth.MultiFactorAuthClaim; + Wrapper.ComponentsOverrideProvider = recipe.Provider; + return Wrapper; +})(); +var init = Wrapper.init; +var getMFAInfo = Wrapper.getMFAInfo; +var MultiFactorAuthComponentsOverrideProvider = Wrapper.ComponentsOverrideProvider; +var MultiFactorAuthClaim = recipe.MultiFactorAuth.MultiFactorAuthClaim; + +exports.MultiFactorAuthClaim = MultiFactorAuthClaim; +exports.MultiFactorAuthComponentsOverrideProvider = MultiFactorAuthComponentsOverrideProvider; +exports.default = Wrapper; +exports.getMFAInfo = getMFAInfo; +exports.init = init; diff --git a/lib/build/multifactorauthprebuiltui.js b/lib/build/multifactorauthprebuiltui.js new file mode 100644 index 000000000..fe5f9d1f6 --- /dev/null +++ b/lib/build/multifactorauthprebuiltui.js @@ -0,0 +1,367 @@ +"use strict"; + +var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); +var jsxRuntime = require("react/jsx-runtime"); +var NormalisedURLPath = require("supertokens-web-js/utils/normalisedURLPath"); +var uiEntry = require("./index2.js"); +var session = require("./session-shared3.js"); +var recipe$1 = require("./multifactorauth-shared.js"); +var React = require("react"); +var recipe = require("./session-shared2.js"); +var translations = require("./translations.js"); +var themeBase = require("./emailpassword-shared.js"); +require("supertokens-web-js"); +require("supertokens-web-js/utils/cookieHandler"); +require("supertokens-web-js/utils/postSuperTokensInitCallbacks"); +require("supertokens-web-js/utils/windowHandler"); +require("supertokens-web-js/recipe/multitenancy"); +require("supertokens-web-js/utils"); +require("supertokens-web-js/utils/normalisedURLDomain"); +require("./translationContext.js"); +require("react-dom"); +require("./multitenancy-shared.js"); +require("supertokens-web-js/recipe/session"); +require("./session-shared.js"); +require("supertokens-web-js/recipe/multifactorauth"); +require("supertokens-web-js/utils/sessionClaimValidatorStore"); +require("./recipeModule-shared.js"); + +function _interopDefault(e) { + return e && e.__esModule ? e : { default: e }; +} + +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + Object.keys(e).forEach(function (k) { + if (k !== "default") { + var d = Object.getOwnPropertyDescriptor(e, k); + Object.defineProperty( + n, + k, + d.get + ? d + : { + enumerable: true, + get: function () { + return e[k]; + }, + } + ); + } + }); + } + n.default = e; + return Object.freeze(n); +} + +var NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath); +var React__namespace = /*#__PURE__*/ _interopNamespace(React); + +function FactorChooserTheme(props) { + var sessionContext = session.useSessionContext$1(); + if (sessionContext.loading === false && sessionContext.doesSessionExist === true) { + return jsxRuntime.jsx("pre", { + children: JSON.stringify({ props: props, sessionContext: sessionContext }, null, 2), + }); + } + // Otherwise, return an empty screen, waiting for the feature component to redirection to complete. + return jsxRuntime.jsx(jsxRuntime.Fragment, {}); +} +function FactorChooserThemeWrapper(props) { + var hasFont = translations.hasFontDefined(props.config.rootStyle); + return jsxRuntime.jsx( + uiEntry.UserContextWrapper, + genericComponentOverrideContext.__assign( + { userContext: props.userContext }, + { + children: jsxRuntime.jsx( + themeBase.ThemeBase, + genericComponentOverrideContext.__assign( + { + loadDefaultFont: !hasFont, + userStyles: [props.config.rootStyle, props.config.factorChooserScreen.style], + }, + { + children: jsxRuntime.jsx( + FactorChooserTheme, + genericComponentOverrideContext.__assign({}, props) + ), + } + ) + ), + } + ) + ); +} + +var defaultTranslationsEmailVerification = { + en: genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, translations.defaultTranslationsCommon.en), + { + EMAIL_VERIFICATION_RESEND_SUCCESS: "Email resent", + EMAIL_VERIFICATION_SEND_TITLE: "Verify your email address", + EMAIL_VERIFICATION_SEND_DESC_START: "", + EMAIL_VERIFICATION_SEND_DESC_STRONG: "Please click on the link", + EMAIL_VERIFICATION_SEND_DESC_END: " in the email we just sent you to confirm your email address.", + EMAIL_VERIFICATION_RESEND_BTN: "Resend Email", + EMAIL_VERIFICATION_LOGOUT: "Logout ", + EMAIL_VERIFICATION_SUCCESS: "Email verification successful!", + EMAIL_VERIFICATION_CONTINUE_BTN: "CONTINUE", + EMAIL_VERIFICATION_CONTINUE_LINK: "Continue", + EMAIL_VERIFICATION_EXPIRED: "The email verification link has expired", + EMAIL_VERIFICATION_ERROR_TITLE: "Something went wrong", + EMAIL_VERIFICATION_ERROR_DESC: "We encountered an unexpected error. Please contact support for assistance", + EMAIL_VERIFICATION_LINK_CLICKED_HEADER: "Verify your email address", + EMAIL_VERIFICATION_LINK_CLICKED_DESC: "Please click on the button below to verify your email address", + EMAIL_VERIFICATION_LINK_CLICKED_CONTINUE_BUTTON: "CONTINUE", + } + ), +}; + +var EmailVerification = function (props) { + var sessionContext = React.useContext(uiEntry.SessionContext); + var _a = React.useState("LOADING"), + status = _a[0], + setStatus = _a[1]; + var userContext = uiEntry.useUserContext(); + var recipeComponentOverrides = props.useComponentOverrides(); + var redirectToAuthWithHistory = React.useCallback( + function () { + return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () { + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + return [ + 4 /*yield*/, + uiEntry.redirectToAuth({ redirectBack: false, history: props.history }), + ]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); + }); + }, + [props.history] + ); + var fetchIsEmailVerified = React.useCallback( + function () { + return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () { + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + if (sessionContext.loading === true) { + // This callback should only be called if the session is already loaded + throw new Error("Should never come here"); + } + return [4 /*yield*/, props.recipe.webJSRecipe.getMFAInfo({ userContext: userContext })]; + case 1: + return [2 /*return*/, _a.sent()]; + } + }); + }); + }, + [props.recipe, sessionContext, redirectToAuthWithHistory, userContext] + ); + var checkIsEmailVerified = React.useCallback( + function (mfaInfo) { + return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () { + return genericComponentOverrideContext.__generator(this, function (_a) { + setStatus("READY" + mfaInfo.factors.isAllowedToSetup.length); // TODO + return [2 /*return*/]; + }); + }); + }, + [setStatus] + ); + var handleError = React.useCallback( + function (err) { + return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () { + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + return [ + 4 /*yield*/, + recipe.Session.getInstanceOrThrow().doesSessionExist({ userContext: userContext }), + ]; + case 1: + if (!_a.sent()) return [3 /*break*/, 2]; + throw err; + case 2: + return [4 /*yield*/, redirectToAuthWithHistory()]; + case 3: + _a.sent(); + _a.label = 4; + case 4: + return [2 /*return*/]; + } + }); + }); + }, + [redirectToAuthWithHistory] + ); + genericComponentOverrideContext.useOnMountAPICall( + fetchIsEmailVerified, + checkIsEmailVerified, + handleError, + sessionContext.loading === false + ); + if (status === "LOADING") { + return jsxRuntime.jsx(React.Fragment, {}); + } + // const factorChooserScreen = props.recipe.config.factorChooserScreen; + var childProps = { + config: props.recipe.config, + }; + return jsxRuntime.jsx( + uiEntry.ComponentOverrideContext.Provider, + genericComponentOverrideContext.__assign( + { value: recipeComponentOverrides }, + { + children: jsxRuntime.jsx( + uiEntry.FeatureWrapper, + genericComponentOverrideContext.__assign( + { + useShadowDom: props.recipe.config.useShadowDom, + defaultStore: defaultTranslationsEmailVerification, + }, + { + children: jsxRuntime.jsxs(React.Fragment, { + children: [ + props.children === undefined && + jsxRuntime.jsx( + FactorChooserThemeWrapper, + genericComponentOverrideContext.__assign({}, childProps) + ), + props.children && + React__namespace.Children.map(props.children, function (child) { + if (React__namespace.isValidElement(child)) { + return React__namespace.cloneElement(child, childProps); + } + return child; + }), + ], + }), + } + ) + ), + } + ) + ); +}; + +var MultiFactorAuthPreBuiltUI = /** @class */ (function (_super) { + genericComponentOverrideContext.__extends(MultiFactorAuthPreBuiltUI, _super); + function MultiFactorAuthPreBuiltUI(recipeInstance) { + var _this = _super.call(this) || this; + _this.recipeInstance = recipeInstance; + // Instance methods + _this.getFeatures = function (useComponentOverrides) { + if (useComponentOverrides === void 0) { + useComponentOverrides = recipe$1.useContext; + } + var features = {}; + if (_this.recipeInstance.config.disableDefaultUI !== true) { + var normalisedFullPath = _this.recipeInstance.config.appInfo.websiteBasePath.appendPath( + new NormalisedURLPath__default.default(recipe$1.DEFAULT_FACTOR_CHOOSER_PATH) + ); + features[normalisedFullPath.getAsStringDangerous()] = { + matches: genericComponentOverrideContext.matchRecipeIdUsingQueryParams( + _this.recipeInstance.config.recipeId + ), + component: function (props) { + return _this.getFeatureComponent("factorchooser", props, useComponentOverrides); + }, + recipeID: recipe$1.MultiFactorAuth.RECIPE_ID, + }; + } + return features; + }; + _this.getFeatureComponent = function ( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _, + props, + useComponentOverrides + ) { + if (useComponentOverrides === void 0) { + useComponentOverrides = recipe$1.useContext; + } + return jsxRuntime.jsx( + uiEntry.UserContextWrapper, + genericComponentOverrideContext.__assign( + { userContext: props.userContext }, + { + children: jsxRuntime.jsx( + session.SessionAuth, + genericComponentOverrideContext.__assign( + { + requireAuth: false, + overrideGlobalClaimValidators: function () { + return []; + }, + }, + { + children: jsxRuntime.jsx( + EmailVerification, + genericComponentOverrideContext.__assign( + { + recipe: _this.recipeInstance, + useComponentOverrides: useComponentOverrides, + }, + props + ) + ), + } + ) + ), + } + ) + ); + }; + return _this; + } + // Static methods + MultiFactorAuthPreBuiltUI.getInstanceOrInitAndGetInstance = function () { + if (MultiFactorAuthPreBuiltUI.instance === undefined) { + var recipeInstance = recipe$1.MultiFactorAuth.getInstanceOrThrow(); + MultiFactorAuthPreBuiltUI.instance = new MultiFactorAuthPreBuiltUI(recipeInstance); + } + return MultiFactorAuthPreBuiltUI.instance; + }; + MultiFactorAuthPreBuiltUI.getFeatures = function (useComponentOverrides) { + if (useComponentOverrides === void 0) { + useComponentOverrides = recipe$1.useContext; + } + return MultiFactorAuthPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatures(useComponentOverrides); + }; + MultiFactorAuthPreBuiltUI.getFeatureComponent = function (componentName, props, useComponentOverrides) { + if (useComponentOverrides === void 0) { + useComponentOverrides = recipe$1.useContext; + } + return MultiFactorAuthPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent( + componentName, + props, + useComponentOverrides + ); + }; + // For tests + MultiFactorAuthPreBuiltUI.reset = function () { + if (!genericComponentOverrideContext.isTest()) { + return; + } + MultiFactorAuthPreBuiltUI.instance = undefined; + return; + }; + MultiFactorAuthPreBuiltUI.FactorChooser = function (props) { + return MultiFactorAuthPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent("factorchooser", props); + }; + MultiFactorAuthPreBuiltUI.FactorChooserTheme = FactorChooserThemeWrapper; + return MultiFactorAuthPreBuiltUI; +})(uiEntry.RecipeRouter); +var FactorChooser = MultiFactorAuthPreBuiltUI.FactorChooser; + +exports.FactorChooser = FactorChooser; +exports.FactorChooserTheme = FactorChooserThemeWrapper; +exports.MultiFactorAuthPreBuiltUI = MultiFactorAuthPreBuiltUI; diff --git a/lib/build/passwordless-shared3.js b/lib/build/passwordless-shared3.js index 54b23e5a7..1f2c19d3d 100644 --- a/lib/build/passwordless-shared3.js +++ b/lib/build/passwordless-shared3.js @@ -11,13 +11,13 @@ var STGeneralError = require("supertokens-web-js/utils/error"); var recipe = require("./session-shared2.js"); var translations = require("./translations.js"); var translationContext = require("./translationContext.js"); -var button = require("./emailpassword-shared2.js"); +var button = require("./emailpassword-shared3.js"); var session = require("./session-shared3.js"); var recipe$1 = require("./passwordless-shared2.js"); -var generalError = require("./emailpassword-shared.js"); +var generalError = require("./emailpassword-shared2.js"); var checkedRoundIcon = require("./checkedRoundIcon.js"); -var formBase = require("./emailpassword-shared7.js"); -var validators = require("./emailpassword-shared5.js"); +var formBase = require("./emailpassword-shared8.js"); +var validators = require("./emailpassword-shared6.js"); var arrowLeftIcon = require("./arrowLeftIcon.js"); function _interopDefault(e) { diff --git a/lib/build/passwordlessprebuiltui.js b/lib/build/passwordlessprebuiltui.js index 3f0620aa5..386c93baf 100644 --- a/lib/build/passwordlessprebuiltui.js +++ b/lib/build/passwordlessprebuiltui.js @@ -26,11 +26,11 @@ require("./session-shared3.js"); require("./session-shared.js"); require("supertokens-web-js/utils/error"); require("./translations.js"); +require("./emailpassword-shared3.js"); require("./emailpassword-shared2.js"); -require("./emailpassword-shared.js"); require("./checkedRoundIcon.js"); -require("./emailpassword-shared7.js"); -require("./emailpassword-shared5.js"); +require("./emailpassword-shared8.js"); +require("./emailpassword-shared6.js"); require("./arrowLeftIcon.js"); require("supertokens-web-js/recipe/passwordless"); require("./authRecipe-shared.js"); diff --git a/lib/build/recipe/multifactorauth/componentOverrideContext.d.ts b/lib/build/recipe/multifactorauth/componentOverrideContext.d.ts new file mode 100644 index 000000000..288fc18e7 --- /dev/null +++ b/lib/build/recipe/multifactorauth/componentOverrideContext.d.ts @@ -0,0 +1,9 @@ +/// +import type { ComponentOverrideMap } from "./types"; +declare const useContext: () => ComponentOverrideMap, + Provider: import("react").FC< + import("react").PropsWithChildren<{ + components: ComponentOverrideMap; + }> + >; +export { useContext as useRecipeComponentOverrideContext, Provider as RecipeComponentsOverrideContextProvider }; diff --git a/lib/build/recipe/multifactorauth/components/features/factorChooser/index.d.ts b/lib/build/recipe/multifactorauth/components/features/factorChooser/index.d.ts new file mode 100644 index 000000000..c7f642081 --- /dev/null +++ b/lib/build/recipe/multifactorauth/components/features/factorChooser/index.d.ts @@ -0,0 +1,11 @@ +import * as React from "react"; +import type { FeatureBaseProps } from "../../../../../types"; +import type Recipe from "../../../recipe"; +import type { ComponentOverrideMap } from "../../../types"; +declare type Prop = FeatureBaseProps & { + recipe: Recipe; + userContext?: any; + useComponentOverrides: () => ComponentOverrideMap; +}; +export declare const EmailVerification: React.FC; +export default EmailVerification; diff --git a/lib/build/recipe/multifactorauth/components/themes/factorChooser/index.d.ts b/lib/build/recipe/multifactorauth/components/themes/factorChooser/index.d.ts new file mode 100644 index 000000000..16fad15b4 --- /dev/null +++ b/lib/build/recipe/multifactorauth/components/themes/factorChooser/index.d.ts @@ -0,0 +1,5 @@ +/// +import type { FactorChooserThemeProps } from "../../../types"; +export declare function FactorChooserTheme(props: FactorChooserThemeProps): JSX.Element; +declare function FactorChooserThemeWrapper(props: FactorChooserThemeProps): JSX.Element; +export default FactorChooserThemeWrapper; diff --git a/lib/build/recipe/multifactorauth/components/themes/translations.d.ts b/lib/build/recipe/multifactorauth/components/themes/translations.d.ts new file mode 100644 index 000000000..69ea4bf00 --- /dev/null +++ b/lib/build/recipe/multifactorauth/components/themes/translations.d.ts @@ -0,0 +1,23 @@ +export declare const defaultTranslationsEmailVerification: { + en: { + EMAIL_VERIFICATION_RESEND_SUCCESS: string; + EMAIL_VERIFICATION_SEND_TITLE: string; + EMAIL_VERIFICATION_SEND_DESC_START: string; + EMAIL_VERIFICATION_SEND_DESC_STRONG: string; + EMAIL_VERIFICATION_SEND_DESC_END: string; + EMAIL_VERIFICATION_RESEND_BTN: string; + EMAIL_VERIFICATION_LOGOUT: string; + EMAIL_VERIFICATION_SUCCESS: string; + EMAIL_VERIFICATION_CONTINUE_BTN: string; + EMAIL_VERIFICATION_CONTINUE_LINK: string; + EMAIL_VERIFICATION_EXPIRED: string; + EMAIL_VERIFICATION_ERROR_TITLE: string; + EMAIL_VERIFICATION_ERROR_DESC: string; + EMAIL_VERIFICATION_LINK_CLICKED_HEADER: string; + EMAIL_VERIFICATION_LINK_CLICKED_DESC: string; + EMAIL_VERIFICATION_LINK_CLICKED_CONTINUE_BUTTON: string; + BRANDING_POWERED_BY_START: string; + BRANDING_POWERED_BY_END: string; + SOMETHING_WENT_WRONG_ERROR: string; + }; +}; diff --git a/lib/build/recipe/multifactorauth/constants.d.ts b/lib/build/recipe/multifactorauth/constants.d.ts new file mode 100644 index 000000000..f809b8826 --- /dev/null +++ b/lib/build/recipe/multifactorauth/constants.d.ts @@ -0,0 +1 @@ +export declare const DEFAULT_FACTOR_CHOOSER_PATH = "/verify-email"; diff --git a/lib/build/recipe/multifactorauth/functionOverrides.d.ts b/lib/build/recipe/multifactorauth/functionOverrides.d.ts new file mode 100644 index 000000000..45b83c694 --- /dev/null +++ b/lib/build/recipe/multifactorauth/functionOverrides.d.ts @@ -0,0 +1,6 @@ +import type { OnHandleEventContext } from "./types"; +import type { RecipeOnHandleEventFunction } from "../recipeModule/types"; +import type { RecipeInterface } from "supertokens-web-js/recipe/multifactorauth"; +export declare const getFunctionOverrides: ( + _onHandleEvent: RecipeOnHandleEventFunction +) => (originalImp: RecipeInterface) => RecipeInterface; diff --git a/lib/build/recipe/multifactorauth/index.d.ts b/lib/build/recipe/multifactorauth/index.d.ts new file mode 100644 index 000000000..4794457c1 --- /dev/null +++ b/lib/build/recipe/multifactorauth/index.d.ts @@ -0,0 +1,46 @@ +/// +import { RecipeInterface } from "supertokens-web-js/recipe/emailverification"; +import { GetRedirectionURLContext, PreAPIHookContext, OnHandleEventContext } from "./types"; +import { UserInput } from "./types"; +import type { MFAFactorInfo } from "supertokens-web-js/lib/build/recipe/multifactorauth/types"; +import type { RecipeFunctionOptions } from "supertokens-web-js/recipe/emailverification"; +export default class Wrapper { + static MultiFactorAuthClaim: import("supertokens-web-js/lib/build/recipe/multifactorauth/multiFactorAuthClaim").MultiFactorAuthClaimClass; + static init( + config?: UserInput + ): import("../../types").RecipeInitResult< + GetRedirectionURLContext, + "GET_MFA_INFO", + OnHandleEventContext, + import("./types").NormalisedConfig + >; + static getMFAInfo(input?: { userContext?: any; options?: RecipeFunctionOptions }): Promise<{ + status: "OK"; + factors: MFAFactorInfo; + fetchResponse: Response; + }>; + static ComponentsOverrideProvider: import("react").FC< + import("react").PropsWithChildren<{ + components: import("./types").ComponentOverrideMap; + }> + >; +} +declare const init: typeof Wrapper.init; +declare const getMFAInfo: typeof Wrapper.getMFAInfo; +declare const MultiFactorAuthComponentsOverrideProvider: import("react").FC< + import("react").PropsWithChildren<{ + components: import("./types").ComponentOverrideMap; + }> +>; +declare const MultiFactorAuthClaim: import("supertokens-web-js/lib/build/recipe/multifactorauth/multiFactorAuthClaim").MultiFactorAuthClaimClass; +export { + init, + getMFAInfo, + MultiFactorAuthComponentsOverrideProvider, + GetRedirectionURLContext, + PreAPIHookContext as PreAPIHookContext, + OnHandleEventContext, + UserInput, + RecipeInterface, + MultiFactorAuthClaim, +}; diff --git a/lib/build/recipe/multifactorauth/prebuiltui.d.ts b/lib/build/recipe/multifactorauth/prebuiltui.d.ts new file mode 100644 index 000000000..ce25236b7 --- /dev/null +++ b/lib/build/recipe/multifactorauth/prebuiltui.d.ts @@ -0,0 +1,29 @@ +/// +import { RecipeRouter } from "../recipeRouter"; +import FactorChooserTheme from "./components/themes/factorChooser"; +import MultiFactorAuthRecipe from "./recipe"; +import type { GenericComponentOverrideMap } from "../../components/componentOverride/componentOverrideContext"; +import type { RecipeFeatureComponentMap } from "../../types"; +export declare class MultiFactorAuthPreBuiltUI extends RecipeRouter { + readonly recipeInstance: MultiFactorAuthRecipe; + static instance?: MultiFactorAuthPreBuiltUI; + constructor(recipeInstance: MultiFactorAuthRecipe); + static getInstanceOrInitAndGetInstance(): MultiFactorAuthPreBuiltUI; + static getFeatures(useComponentOverrides?: () => GenericComponentOverrideMap): RecipeFeatureComponentMap; + static getFeatureComponent( + componentName: "factorchooser", + props: any, + useComponentOverrides?: () => GenericComponentOverrideMap + ): JSX.Element; + getFeatures: (useComponentOverrides?: () => GenericComponentOverrideMap) => RecipeFeatureComponentMap; + getFeatureComponent: ( + _: "factorchooser", + props: any, + useComponentOverrides?: () => GenericComponentOverrideMap + ) => JSX.Element; + static reset(): void; + static FactorChooser: (props?: any) => JSX.Element; + static FactorChooserTheme: typeof FactorChooserTheme; +} +declare const FactorChooser: (props?: any) => JSX.Element; +export { FactorChooser, FactorChooserTheme }; diff --git a/lib/build/recipe/multifactorauth/recipe.d.ts b/lib/build/recipe/multifactorauth/recipe.d.ts new file mode 100644 index 000000000..bc30eceec --- /dev/null +++ b/lib/build/recipe/multifactorauth/recipe.d.ts @@ -0,0 +1,32 @@ +import MultiFactorAuthWebJS from "supertokens-web-js/recipe/multifactorauth"; +import RecipeModule from "../recipeModule"; +import type { + UserInput, + NormalisedConfig, + GetRedirectionURLContext, + OnHandleEventContext, + PreAndPostAPIHookAction, +} from "./types"; +import type { NormalisedConfigWithAppInfoAndRecipeID, RecipeInitResult, WebJSRecipeInterface } from "../../types"; +export default class MultiFactorAuth extends RecipeModule< + GetRedirectionURLContext, + PreAndPostAPIHookAction, + OnHandleEventContext, + NormalisedConfig +> { + readonly webJSRecipe: WebJSRecipeInterface; + static instance?: MultiFactorAuth; + static RECIPE_ID: string; + static MultiFactorAuthClaim: import("supertokens-web-js/lib/build/recipe/multifactorauth/multiFactorAuthClaim").MultiFactorAuthClaimClass; + recipeID: string; + constructor( + config: NormalisedConfigWithAppInfoAndRecipeID, + webJSRecipe?: WebJSRecipeInterface + ); + static init( + config?: UserInput + ): RecipeInitResult; + static getInstanceOrThrow(): MultiFactorAuth; + getDefaultRedirectionURL: (context: GetRedirectionURLContext) => Promise; + getDefaultFirstFactors(): string[]; +} diff --git a/lib/build/recipe/multifactorauth/types.d.ts b/lib/build/recipe/multifactorauth/types.d.ts new file mode 100644 index 000000000..476044b29 --- /dev/null +++ b/lib/build/recipe/multifactorauth/types.d.ts @@ -0,0 +1,54 @@ +import type { ComponentOverride } from "../../components/componentOverride/componentOverride"; +import type { FeatureBaseConfig } from "../../types"; +import type { + Config as RecipeModuleConfig, + NormalisedConfig as NormalisedRecipeModuleConfig, + UserInput as RecipeModuleUserInput, +} from "../recipeModule/types"; +import type { OverrideableBuilder } from "supertokens-js-override"; +import type { RecipeInterface } from "supertokens-web-js/recipe/multifactorauth"; +export declare type ComponentOverrideMap = { + FactorChooser_Override?: ComponentOverride; +}; +export declare type UserInput = { + firstFactors?: string[]; + disableDefaultUI?: boolean; + factorChooserScreen?: FeatureBaseConfig; + override?: { + functions?: ( + originalImplementation: RecipeInterface, + builder?: OverrideableBuilder + ) => RecipeInterface; + }; +} & RecipeModuleUserInput; +export declare type Config = UserInput & + RecipeModuleConfig; +export declare type NormalisedConfig = { + getFirstFactors?: () => string[]; + disableDefaultUI: boolean; + factorChooserScreen: FeatureBaseConfig; + override: { + functions: ( + originalImplementation: RecipeInterface, + builder?: OverrideableBuilder + ) => RecipeInterface; + }; +} & NormalisedRecipeModuleConfig; +export declare type GetRedirectionURLContext = { + action: "FACTOR_CHOICE_REQUIRED" | "GO_TO_FACTOR"; +}; +export declare type PreAndPostAPIHookAction = "GET_MFA_INFO"; +export declare type PreAPIHookContext = { + action: PreAndPostAPIHookAction; + requestInit: RequestInit; + url: string; + userContext: any; +}; +export declare type OnHandleEventContext = { + action: "FACTOR_CHOSEN"; + userContext: any; +}; +export declare type FactorChooserThemeProps = { + config: NormalisedConfig; + userContext?: any; +}; diff --git a/lib/build/recipe/multifactorauth/utils.d.ts b/lib/build/recipe/multifactorauth/utils.d.ts new file mode 100644 index 000000000..a4fa4a376 --- /dev/null +++ b/lib/build/recipe/multifactorauth/utils.d.ts @@ -0,0 +1,2 @@ +import type { Config, NormalisedConfig } from "./types"; +export declare function normaliseMultiFactorAuthFeature(config?: Config): NormalisedConfig; diff --git a/lib/build/thirdparty-shared2.js b/lib/build/thirdparty-shared2.js index c5f17c5db..6ee399424 100644 --- a/lib/build/thirdparty-shared2.js +++ b/lib/build/thirdparty-shared2.js @@ -8,7 +8,7 @@ var SuperTokensBranding = require("./SuperTokensBranding.js"); var recipe = require("./thirdparty-shared.js"); var React = require("react"); var translations = require("./translations.js"); -var generalError = require("./emailpassword-shared.js"); +var generalError = require("./emailpassword-shared2.js"); var STGeneralError = require("supertokens-web-js/utils/error"); var translationContext = require("./translationContext.js"); var recipe$1 = require("./session-shared2.js"); diff --git a/lib/build/thirdpartyemailpassword-shared.js b/lib/build/thirdpartyemailpassword-shared.js index a215a9380..d3f87b796 100644 --- a/lib/build/thirdpartyemailpassword-shared.js +++ b/lib/build/thirdpartyemailpassword-shared.js @@ -3,7 +3,7 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); var ThirdPartyEmailPasswordWebJS = require("supertokens-web-js/recipe/thirdpartyemailpassword"); var utils = require("./authRecipe-shared.js"); -var recipe$1 = require("./emailpassword-shared4.js"); +var recipe$1 = require("./emailpassword-shared5.js"); var recipe = require("./thirdparty-shared.js"); function _interopDefault(e) { diff --git a/lib/build/thirdpartyemailpassword.js b/lib/build/thirdpartyemailpassword.js index def27b758..8f2c2c5a9 100644 --- a/lib/build/thirdpartyemailpassword.js +++ b/lib/build/thirdpartyemailpassword.js @@ -24,9 +24,9 @@ require("supertokens-web-js/recipe/session"); require("./translationContext.js"); require("supertokens-web-js/lib/build/normalisedURLPath"); require("supertokens-web-js/recipe/thirdpartyemailpassword"); -require("./emailpassword-shared4.js"); -require("supertokens-web-js/recipe/emailpassword"); require("./emailpassword-shared5.js"); +require("supertokens-web-js/recipe/emailpassword"); +require("./emailpassword-shared6.js"); var Wrapper = /** @class */ (function () { function Wrapper() {} diff --git a/lib/build/thirdpartyemailpasswordprebuiltui.js b/lib/build/thirdpartyemailpasswordprebuiltui.js index 091b64450..b2c554c94 100644 --- a/lib/build/thirdpartyemailpasswordprebuiltui.js +++ b/lib/build/thirdpartyemailpasswordprebuiltui.js @@ -5,13 +5,13 @@ var jsxRuntime = require("react/jsx-runtime"); var NormalisedURLPath = require("supertokens-web-js/utils/normalisedURLPath"); var uiEntry = require("./index2.js"); var SuperTokensBranding = require("./SuperTokensBranding.js"); -var emailpasswordprebuiltui = require("./emailpassword-shared6.js"); +var emailpasswordprebuiltui = require("./emailpassword-shared7.js"); var thirdpartyprebuiltui = require("./thirdparty-shared2.js"); var recipe = require("./thirdpartyemailpassword-shared.js"); var React = require("react"); var translations = require("./translations.js"); var translationContext = require("./translationContext.js"); -var generalError = require("./emailpassword-shared.js"); +var generalError = require("./emailpassword-shared2.js"); require("supertokens-web-js"); require("supertokens-web-js/utils/cookieHandler"); require("supertokens-web-js/utils/postSuperTokensInitCallbacks"); @@ -26,15 +26,16 @@ require("supertokens-web-js/recipe/session"); require("./recipeModule-shared.js"); require("./session-shared3.js"); require("./session-shared.js"); -require("./emailpassword-shared3.js"); -require("./emailverification-shared2.js"); +require("./emailpassword-shared4.js"); +require("./emailpassword-shared.js"); require("./arrowLeftIcon.js"); -require("./emailpassword-shared7.js"); +require("./emailpassword-shared8.js"); require("supertokens-web-js/utils/error"); -require("./emailpassword-shared5.js"); -require("./emailpassword-shared2.js"); +require("./emailpassword-shared6.js"); +require("./emailpassword-shared3.js"); +require("./emailverification-shared2.js"); require("supertokens-web-js/lib/build/error"); -require("./emailpassword-shared4.js"); +require("./emailpassword-shared5.js"); require("supertokens-web-js/recipe/emailpassword"); require("./authRecipe-shared.js"); require("./thirdparty-shared.js"); diff --git a/lib/build/thirdpartypasswordlessprebuiltui.js b/lib/build/thirdpartypasswordlessprebuiltui.js index 4809d98f0..f855a7556 100644 --- a/lib/build/thirdpartypasswordlessprebuiltui.js +++ b/lib/build/thirdpartypasswordlessprebuiltui.js @@ -10,7 +10,7 @@ var thirdpartyprebuiltui = require("./thirdparty-shared2.js"); var recipe = require("./thirdpartypasswordless-shared.js"); var React = require("react"); var translations = require("./translations.js"); -var generalError = require("./emailpassword-shared.js"); +var generalError = require("./emailpassword-shared2.js"); var translationContext = require("./translationContext.js"); require("supertokens-web-js"); require("supertokens-web-js/utils/cookieHandler"); @@ -28,13 +28,13 @@ require("./session-shared3.js"); require("./session-shared.js"); require("./passwordless-shared.js"); require("supertokens-web-js/utils/error"); -require("./emailpassword-shared2.js"); +require("./emailpassword-shared3.js"); require("./passwordless-shared2.js"); require("supertokens-web-js/recipe/passwordless"); require("./authRecipe-shared.js"); require("./checkedRoundIcon.js"); -require("./emailpassword-shared7.js"); -require("./emailpassword-shared5.js"); +require("./emailpassword-shared8.js"); +require("./emailpassword-shared6.js"); require("./arrowLeftIcon.js"); require("./thirdparty-shared.js"); require("supertokens-web-js/recipe/thirdparty"); diff --git a/lib/build/thirdpartyprebuiltui.js b/lib/build/thirdpartyprebuiltui.js index 9e1e89e29..79ddc4d7d 100644 --- a/lib/build/thirdpartyprebuiltui.js +++ b/lib/build/thirdpartyprebuiltui.js @@ -27,7 +27,7 @@ require("supertokens-web-js/recipe/thirdparty"); require("./authRecipe-shared.js"); require("supertokens-web-js/lib/build/normalisedURLPath"); require("./translations.js"); -require("./emailpassword-shared.js"); +require("./emailpassword-shared2.js"); require("supertokens-web-js/utils/error"); exports.SignInAndUp = thirdpartyprebuiltui.SignInAndUp; diff --git a/lib/ts/recipe/multifactorauth/componentOverrideContext.tsx b/lib/ts/recipe/multifactorauth/componentOverrideContext.tsx new file mode 100644 index 000000000..467bd5485 --- /dev/null +++ b/lib/ts/recipe/multifactorauth/componentOverrideContext.tsx @@ -0,0 +1,7 @@ +import { createGenericComponentsOverrideContext } from "../../components/componentOverride/genericComponentOverrideContext"; + +import type { ComponentOverrideMap } from "./types"; + +const [useContext, Provider] = createGenericComponentsOverrideContext(); + +export { useContext as useRecipeComponentOverrideContext, Provider as RecipeComponentsOverrideContextProvider }; diff --git a/lib/ts/recipe/multifactorauth/components/features/factorChooser/index.tsx b/lib/ts/recipe/multifactorauth/components/features/factorChooser/index.tsx new file mode 100644 index 000000000..61632b15e --- /dev/null +++ b/lib/ts/recipe/multifactorauth/components/features/factorChooser/index.tsx @@ -0,0 +1,109 @@ +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +/* + * Imports. + */ +import * as React from "react"; +import { useContext, useState, useCallback, Fragment } from "react"; + +import { redirectToAuth } from "../../../../.."; +import { ComponentOverrideContext } from "../../../../../components/componentOverride/componentOverrideContext"; +import FeatureWrapper from "../../../../../components/featureWrapper"; +import { useUserContext } from "../../../../../usercontext"; +import { useOnMountAPICall } from "../../../../../utils"; +import { SessionContext } from "../../../../session"; +import Session from "../../../../session/recipe"; +import FactorChooserTheme from "../../themes/factorChooser"; +import { defaultTranslationsEmailVerification } from "../../themes/translations"; + +import type { FeatureBaseProps } from "../../../../../types"; +import type Recipe from "../../../recipe"; +import type { ComponentOverrideMap } from "../../../types"; +import type { MFAFactorInfo } from "supertokens-web-js/lib/build/recipe/multifactorauth/types"; + +type Prop = FeatureBaseProps & { recipe: Recipe; userContext?: any; useComponentOverrides: () => ComponentOverrideMap }; + +export const EmailVerification: React.FC = (props) => { + const sessionContext = useContext(SessionContext); + const [status, setStatus] = useState("LOADING"); + const userContext = useUserContext(); + const recipeComponentOverrides = props.useComponentOverrides(); + + const redirectToAuthWithHistory = useCallback(async () => { + await redirectToAuth({ redirectBack: false, history: props.history }); + }, [props.history]); + + const fetchIsEmailVerified = useCallback(async () => { + if (sessionContext.loading === true) { + // This callback should only be called if the session is already loaded + throw new Error("Should never come here"); + } + return await props.recipe.webJSRecipe.getMFAInfo({ userContext }); + }, [props.recipe, sessionContext, redirectToAuthWithHistory, userContext]); + + const checkIsEmailVerified = useCallback( + async (mfaInfo: { factors: MFAFactorInfo }): Promise => { + setStatus("READY" + mfaInfo.factors.isAllowedToSetup.length); // TODO + }, + [setStatus] + ); + + const handleError = useCallback( + async (err) => { + if (await Session.getInstanceOrThrow().doesSessionExist({ userContext })) { + throw err; + } else { + await redirectToAuthWithHistory(); + } + }, + [redirectToAuthWithHistory] + ); + + useOnMountAPICall(fetchIsEmailVerified, checkIsEmailVerified, handleError, sessionContext.loading === false); + + if (status === "LOADING") { + return ; + } + + // const factorChooserScreen = props.recipe.config.factorChooserScreen; + + const childProps = { + config: props.recipe.config, + }; + return ( + + + + {/* No custom theme, use default. */} + {props.children === undefined && } + {/* Otherwise, custom theme is provided, propagate props. */} + {props.children && + React.Children.map(props.children, (child) => { + if (React.isValidElement(child)) { + return React.cloneElement(child, childProps); + } + + return child; + })} + + + + ); +}; + +export default EmailVerification; diff --git a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/index.tsx b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/index.tsx new file mode 100644 index 000000000..1a75ed57f --- /dev/null +++ b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/index.tsx @@ -0,0 +1,48 @@ +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +import { hasFontDefined } from "../../../../../styles/styles"; +import UserContextWrapper from "../../../../../usercontext/userContextWrapper"; +import { ThemeBase } from "../../../../emailpassword/components/themes/themeBase"; +import { useSessionContext } from "../../../../session"; + +import type { FactorChooserThemeProps } from "../../../types"; + +export function FactorChooserTheme(props: FactorChooserThemeProps): JSX.Element { + const sessionContext = useSessionContext(); + + if (sessionContext.loading === false && sessionContext.doesSessionExist === true) { + return
{JSON.stringify({ props, sessionContext }, null, 2)}
; + } + + // Otherwise, return an empty screen, waiting for the feature component to redirection to complete. + return <>; +} + +function FactorChooserThemeWrapper(props: FactorChooserThemeProps): JSX.Element { + const hasFont = hasFontDefined(props.config.rootStyle); + + return ( + + + + + + ); +} + +export default FactorChooserThemeWrapper; diff --git a/lib/ts/recipe/multifactorauth/components/themes/translations.ts b/lib/ts/recipe/multifactorauth/components/themes/translations.ts new file mode 100644 index 000000000..1931f1623 --- /dev/null +++ b/lib/ts/recipe/multifactorauth/components/themes/translations.ts @@ -0,0 +1,23 @@ +import { defaultTranslationsCommon } from "../../../../translation/translations"; + +export const defaultTranslationsEmailVerification = { + en: { + ...defaultTranslationsCommon.en, + EMAIL_VERIFICATION_RESEND_SUCCESS: "Email resent", + EMAIL_VERIFICATION_SEND_TITLE: "Verify your email address", + EMAIL_VERIFICATION_SEND_DESC_START: "", + EMAIL_VERIFICATION_SEND_DESC_STRONG: "Please click on the link", + EMAIL_VERIFICATION_SEND_DESC_END: " in the email we just sent you to confirm your email address.", + EMAIL_VERIFICATION_RESEND_BTN: "Resend Email", + EMAIL_VERIFICATION_LOGOUT: "Logout ", + EMAIL_VERIFICATION_SUCCESS: "Email verification successful!", + EMAIL_VERIFICATION_CONTINUE_BTN: "CONTINUE", + EMAIL_VERIFICATION_CONTINUE_LINK: "Continue", + EMAIL_VERIFICATION_EXPIRED: "The email verification link has expired", + EMAIL_VERIFICATION_ERROR_TITLE: "Something went wrong", + EMAIL_VERIFICATION_ERROR_DESC: "We encountered an unexpected error. Please contact support for assistance", + EMAIL_VERIFICATION_LINK_CLICKED_HEADER: "Verify your email address", + EMAIL_VERIFICATION_LINK_CLICKED_DESC: "Please click on the button below to verify your email address", + EMAIL_VERIFICATION_LINK_CLICKED_CONTINUE_BUTTON: "CONTINUE", + }, +}; diff --git a/lib/ts/recipe/multifactorauth/constants.ts b/lib/ts/recipe/multifactorauth/constants.ts new file mode 100644 index 000000000..045f9d64d --- /dev/null +++ b/lib/ts/recipe/multifactorauth/constants.ts @@ -0,0 +1,15 @@ +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +export const DEFAULT_FACTOR_CHOOSER_PATH = "/verify-email"; diff --git a/lib/ts/recipe/multifactorauth/functionOverrides.ts b/lib/ts/recipe/multifactorauth/functionOverrides.ts new file mode 100644 index 000000000..a8128f845 --- /dev/null +++ b/lib/ts/recipe/multifactorauth/functionOverrides.ts @@ -0,0 +1,12 @@ +import type { OnHandleEventContext } from "./types"; +import type { RecipeOnHandleEventFunction } from "../recipeModule/types"; +import type { RecipeInterface } from "supertokens-web-js/recipe/multifactorauth"; + +export const getFunctionOverrides = + ( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _onHandleEvent: RecipeOnHandleEventFunction + ) => + (originalImp: RecipeInterface): RecipeInterface => ({ + ...originalImp, + }); diff --git a/lib/ts/recipe/multifactorauth/index.ts b/lib/ts/recipe/multifactorauth/index.ts new file mode 100644 index 000000000..572c17f70 --- /dev/null +++ b/lib/ts/recipe/multifactorauth/index.ts @@ -0,0 +1,67 @@ +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +/* + * Imports. + */ +import { RecipeInterface } from "supertokens-web-js/recipe/emailverification"; + +import { getNormalisedUserContext } from "../../utils"; + +import { RecipeComponentsOverrideContextProvider } from "./componentOverrideContext"; +import MultiFactorAuthRecipe from "./recipe"; +import { GetRedirectionURLContext, PreAPIHookContext, OnHandleEventContext } from "./types"; +import { UserInput } from "./types"; + +import type { MFAFactorInfo } from "supertokens-web-js/lib/build/recipe/multifactorauth/types"; +import type { RecipeFunctionOptions } from "supertokens-web-js/recipe/emailverification"; + +export default class Wrapper { + static MultiFactorAuthClaim = MultiFactorAuthRecipe.MultiFactorAuthClaim; + + static init(config?: UserInput) { + return MultiFactorAuthRecipe.init(config); + } + + static getMFAInfo(input?: { userContext?: any; options?: RecipeFunctionOptions }): Promise<{ + status: "OK"; + factors: MFAFactorInfo; + fetchResponse: Response; + }> { + return MultiFactorAuthRecipe.getInstanceOrThrow().webJSRecipe.getMFAInfo({ + ...input, + userContext: getNormalisedUserContext(input?.userContext), + }); + } + + static ComponentsOverrideProvider = RecipeComponentsOverrideContextProvider; +} + +const init = Wrapper.init; +const getMFAInfo = Wrapper.getMFAInfo; +const MultiFactorAuthComponentsOverrideProvider = Wrapper.ComponentsOverrideProvider; +const MultiFactorAuthClaim = MultiFactorAuthRecipe.MultiFactorAuthClaim; + +export { + init, + getMFAInfo, + MultiFactorAuthComponentsOverrideProvider, + GetRedirectionURLContext, + PreAPIHookContext as PreAPIHookContext, + OnHandleEventContext, + UserInput, + RecipeInterface, + MultiFactorAuthClaim, +}; diff --git a/lib/ts/recipe/multifactorauth/prebuiltui.tsx b/lib/ts/recipe/multifactorauth/prebuiltui.tsx new file mode 100644 index 000000000..872706efd --- /dev/null +++ b/lib/ts/recipe/multifactorauth/prebuiltui.tsx @@ -0,0 +1,102 @@ +import NormalisedURLPath from "supertokens-web-js/utils/normalisedURLPath"; + +import UserContextWrapper from "../../usercontext/userContextWrapper"; +import { isTest, matchRecipeIdUsingQueryParams } from "../../utils"; +import { RecipeRouter } from "../recipeRouter"; +import { SessionAuth } from "../session"; + +import { useRecipeComponentOverrideContext } from "./componentOverrideContext"; +import { default as EmailVerificationFeature } from "./components/features/factorChooser"; +import FactorChooserTheme from "./components/themes/factorChooser"; +import { DEFAULT_FACTOR_CHOOSER_PATH } from "./constants"; +import MultiFactorAuthRecipe from "./recipe"; + +import type { GenericComponentOverrideMap } from "../../components/componentOverride/componentOverrideContext"; +import type { RecipeFeatureComponentMap } from "../../types"; + +export class MultiFactorAuthPreBuiltUI extends RecipeRouter { + static instance?: MultiFactorAuthPreBuiltUI; + constructor(public readonly recipeInstance: MultiFactorAuthRecipe) { + super(); + } + + // Static methods + static getInstanceOrInitAndGetInstance(): MultiFactorAuthPreBuiltUI { + if (MultiFactorAuthPreBuiltUI.instance === undefined) { + const recipeInstance = MultiFactorAuthRecipe.getInstanceOrThrow(); + MultiFactorAuthPreBuiltUI.instance = new MultiFactorAuthPreBuiltUI(recipeInstance); + } + + return MultiFactorAuthPreBuiltUI.instance; + } + static getFeatures( + useComponentOverrides: () => GenericComponentOverrideMap = useRecipeComponentOverrideContext + ): RecipeFeatureComponentMap { + return MultiFactorAuthPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatures(useComponentOverrides); + } + static getFeatureComponent( + componentName: "factorchooser", + props: any, + useComponentOverrides: () => GenericComponentOverrideMap = useRecipeComponentOverrideContext + ): JSX.Element { + return MultiFactorAuthPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent( + componentName, + props, + useComponentOverrides + ); + } + + // Instance methods + getFeatures = ( + useComponentOverrides: () => GenericComponentOverrideMap = useRecipeComponentOverrideContext + ): RecipeFeatureComponentMap => { + const features: RecipeFeatureComponentMap = {}; + if (this.recipeInstance.config.disableDefaultUI !== true) { + const normalisedFullPath = this.recipeInstance.config.appInfo.websiteBasePath.appendPath( + new NormalisedURLPath(DEFAULT_FACTOR_CHOOSER_PATH) + ); + features[normalisedFullPath.getAsStringDangerous()] = { + matches: matchRecipeIdUsingQueryParams(this.recipeInstance.config.recipeId), + component: (props: any) => this.getFeatureComponent("factorchooser", props, useComponentOverrides), + recipeID: MultiFactorAuthRecipe.RECIPE_ID, + }; + } + return features; + }; + getFeatureComponent = ( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + _: "factorchooser", + props: any, + useComponentOverrides: () => GenericComponentOverrideMap = useRecipeComponentOverrideContext + ): JSX.Element => { + return ( + + []}> + + + + ); + }; + + // For tests + static reset(): void { + if (!isTest()) { + return; + } + + MultiFactorAuthPreBuiltUI.instance = undefined; + return; + } + + static FactorChooser = (props?: any): JSX.Element => + MultiFactorAuthPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent("factorchooser", props); + static FactorChooserTheme = FactorChooserTheme; +} + +const FactorChooser = MultiFactorAuthPreBuiltUI.FactorChooser; + +export { FactorChooser, FactorChooserTheme }; diff --git a/lib/ts/recipe/multifactorauth/recipe.tsx b/lib/ts/recipe/multifactorauth/recipe.tsx new file mode 100644 index 000000000..ace54711d --- /dev/null +++ b/lib/ts/recipe/multifactorauth/recipe.tsx @@ -0,0 +1,136 @@ +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +/* + * Imports. + */ + +import MultiFactorAuthWebJS from "supertokens-web-js/recipe/multifactorauth"; +import { MultiFactorAuthClaim } from "supertokens-web-js/recipe/multifactorauth"; +import NormalisedURLPath from "supertokens-web-js/utils/normalisedURLPath"; +import { PostSuperTokensInitCallbacks } from "supertokens-web-js/utils/postSuperTokensInitCallbacks"; +import { SessionClaimValidatorStore } from "supertokens-web-js/utils/sessionClaimValidatorStore"; + +import { SSR_ERROR } from "../../constants"; +import RecipeModule from "../recipeModule"; + +import { DEFAULT_FACTOR_CHOOSER_PATH } from "./constants"; +import { getFunctionOverrides } from "./functionOverrides"; +import { normaliseMultiFactorAuthFeature } from "./utils"; + +import type { + UserInput, + NormalisedConfig, + GetRedirectionURLContext, + OnHandleEventContext, + PreAndPostAPIHookAction, +} from "./types"; +import type { NormalisedConfigWithAppInfoAndRecipeID, RecipeInitResult, WebJSRecipeInterface } from "../../types"; +import type { NormalisedAppInfo } from "../../types"; + +export default class MultiFactorAuth extends RecipeModule< + GetRedirectionURLContext, + PreAndPostAPIHookAction, + OnHandleEventContext, + NormalisedConfig +> { + static instance?: MultiFactorAuth; + static RECIPE_ID = "multifactorauth"; + + static MultiFactorAuthClaim = MultiFactorAuthClaim; + + public recipeID = MultiFactorAuth.RECIPE_ID; + + constructor( + config: NormalisedConfigWithAppInfoAndRecipeID, + public readonly webJSRecipe: WebJSRecipeInterface = MultiFactorAuthWebJS + ) { + super(config); + + PostSuperTokensInitCallbacks.addPostInitCallback(() => { + const defaultFactorsValidator = + MultiFactorAuth.MultiFactorAuthClaim.validators.hasCompletedDefaultFactors(); + SessionClaimValidatorStore.addClaimValidatorFromOtherRecipe(defaultFactorsValidator); + }); + } + + static init( + config?: UserInput + ): RecipeInitResult { + const normalisedConfig = normaliseMultiFactorAuthFeature(config); + + return { + recipeID: MultiFactorAuth.RECIPE_ID, + authReact: ( + appInfo: NormalisedAppInfo + ): RecipeModule< + GetRedirectionURLContext, + PreAndPostAPIHookAction, + OnHandleEventContext, + NormalisedConfig + > => { + MultiFactorAuth.instance = new MultiFactorAuth({ + ...normalisedConfig, + appInfo, + recipeId: MultiFactorAuth.RECIPE_ID, + }); + return MultiFactorAuth.instance; + }, + webJS: MultiFactorAuthWebJS.init({ + ...normalisedConfig, + override: { + functions: (originalImpl, builder) => { + const functions = getFunctionOverrides(normalisedConfig.onHandleEvent); + builder.override(functions); + builder.override(normalisedConfig.override.functions); + return originalImpl; + }, + }, + }), + }; + } + + static getInstanceOrThrow(): MultiFactorAuth { + if (MultiFactorAuth.instance === undefined) { + let error = "No instance of EmailVerification found. Make sure to call the EmailVerification.init method."; + + // eslint-disable-next-line supertokens-auth-react/no-direct-window-object + if (typeof window === "undefined") { + error = error + SSR_ERROR; + } + throw Error(error); + } + + return MultiFactorAuth.instance; + } + + getDefaultRedirectionURL = async (context: GetRedirectionURLContext): Promise => { + if (context.action === "FACTOR_CHOICE_REQUIRED") { + const chooserPath = new NormalisedURLPath(DEFAULT_FACTOR_CHOOSER_PATH); + return `${this.config.appInfo.websiteBasePath.appendPath(chooserPath).getAsStringDangerous()}?rid=${ + this.config.recipeId + }`; + } else if (context.action === "GO_TO_FACTOR") { + // TODO + return "/"; + } else { + return "/"; + } + }; + + getDefaultFirstFactors(): string[] { + return []; + } +} diff --git a/lib/ts/recipe/multifactorauth/types.ts b/lib/ts/recipe/multifactorauth/types.ts new file mode 100644 index 000000000..897a698d6 --- /dev/null +++ b/lib/ts/recipe/multifactorauth/types.ts @@ -0,0 +1,81 @@ +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +import type { ComponentOverride } from "../../components/componentOverride/componentOverride"; +import type { FeatureBaseConfig } from "../../types"; +import type { + Config as RecipeModuleConfig, + NormalisedConfig as NormalisedRecipeModuleConfig, + UserInput as RecipeModuleUserInput, +} from "../recipeModule/types"; +import type { OverrideableBuilder } from "supertokens-js-override"; +import type { RecipeInterface } from "supertokens-web-js/recipe/multifactorauth"; + +export type ComponentOverrideMap = { + FactorChooser_Override?: ComponentOverride; // TODO +}; + +// Config is what does in the constructor of the recipe. +export type UserInput = { + firstFactors?: string[]; + disableDefaultUI?: boolean; + factorChooserScreen?: FeatureBaseConfig; + + override?: { + functions?: ( + originalImplementation: RecipeInterface, + builder?: OverrideableBuilder + ) => RecipeInterface; + }; +} & RecipeModuleUserInput; + +// Config is what does in the constructor of the recipe. +export type Config = UserInput & + RecipeModuleConfig; + +export type NormalisedConfig = { + getFirstFactors?: () => string[]; + disableDefaultUI: boolean; + factorChooserScreen: FeatureBaseConfig; + + override: { + functions: ( + originalImplementation: RecipeInterface, + builder?: OverrideableBuilder + ) => RecipeInterface; + }; +} & NormalisedRecipeModuleConfig; + +export type GetRedirectionURLContext = { + action: "FACTOR_CHOICE_REQUIRED" | "GO_TO_FACTOR"; +}; + +export type PreAndPostAPIHookAction = "GET_MFA_INFO"; + +export type PreAPIHookContext = { + action: PreAndPostAPIHookAction; + requestInit: RequestInit; + url: string; + userContext: any; +}; + +export type OnHandleEventContext = { + action: "FACTOR_CHOSEN"; + userContext: any; +}; + +export type FactorChooserThemeProps = { + config: NormalisedConfig; + userContext?: any; +}; diff --git a/lib/ts/recipe/multifactorauth/utils.ts b/lib/ts/recipe/multifactorauth/utils.ts new file mode 100644 index 000000000..10fa202da --- /dev/null +++ b/lib/ts/recipe/multifactorauth/utils.ts @@ -0,0 +1,41 @@ +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +import { normaliseRecipeModuleConfig } from "../recipeModule/utils"; + +import MultiFactorAuth from "./recipe"; + +import type { Config, NormalisedConfig } from "./types"; +import type { RecipeInterface } from "supertokens-web-js/recipe/multifactorauth"; + +export function normaliseMultiFactorAuthFeature(config?: Config): NormalisedConfig { + if (config === undefined) { + config = {}; + } + const disableDefaultUI = config.disableDefaultUI === true; + + const override = { + functions: (originalImplementation: RecipeInterface) => originalImplementation, + ...config.override, + }; + + return { + ...normaliseRecipeModuleConfig(config), + disableDefaultUI, + getFirstFactors: () => MultiFactorAuth.getInstanceOrThrow().getDefaultFirstFactors(), + factorChooserScreen: config.factorChooserScreen ?? {}, + override, + }; +} diff --git a/package-lock.json b/package-lock.json index 2cb349e42..1aef3c02e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16244,7 +16244,7 @@ }, "node_modules/supertokens-web-js": { "version": "0.8.0", - "resolved": "git+ssh://git@github.com/supertokens/supertokens-web-js.git#9a99c7c946307a23c0b0473ea37cf37aa24e096b", + "resolved": "git+ssh://git@github.com/supertokens/supertokens-web-js.git#e0035834475c5bae41295bd97d3e06cbf138c867", "license": "Apache-2.0", "peer": true, "dependencies": { @@ -29414,7 +29414,7 @@ "integrity": "sha512-r0JFBjkMIdep3Lbk3JA+MpnpuOtw4RSyrlRAbrzMcxwiYco3GFWl/daimQZ5b1forOiUODpOlXbSOljP/oyurg==" }, "supertokens-web-js": { - "version": "git+ssh://git@github.com/supertokens/supertokens-web-js.git#9a99c7c946307a23c0b0473ea37cf37aa24e096b", + "version": "git+ssh://git@github.com/supertokens/supertokens-web-js.git#e0035834475c5bae41295bd97d3e06cbf138c867", "from": "supertokens-web-js@github:supertokens/supertokens-web-js#feat/mfa", "peer": true, "requires": { diff --git a/package.json b/package.json index 18ed6e8a1..e1a2eb98a 100644 --- a/package.json +++ b/package.json @@ -180,6 +180,10 @@ { "path": "recipe/multitenancy/index.js", "limit": "10kb" + }, + { + "path": "recipe/multifactorauth/index.js", + "limit": "10kb" } ], "browserslist": { diff --git a/recipe/multifactorauth/index.d.ts b/recipe/multifactorauth/index.d.ts new file mode 100644 index 000000000..7c2f43e97 --- /dev/null +++ b/recipe/multifactorauth/index.d.ts @@ -0,0 +1,17 @@ +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +export * from "../../lib/build/recipe/multifactorauth"; +import * as _default from "../../lib/build/recipe/multifactorauth"; +export default _default; diff --git a/recipe/multifactorauth/index.js b/recipe/multifactorauth/index.js new file mode 100644 index 000000000..08bb1dd78 --- /dev/null +++ b/recipe/multifactorauth/index.js @@ -0,0 +1,20 @@ +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("../../lib/build/multifactorauth")); diff --git a/recipe/multifactorauth/prebuiltui.d.ts b/recipe/multifactorauth/prebuiltui.d.ts new file mode 100644 index 000000000..8e6be5592 --- /dev/null +++ b/recipe/multifactorauth/prebuiltui.d.ts @@ -0,0 +1,17 @@ +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +export * from "../../lib/build/recipe/multifactorauth/prebuiltui"; +import * as _default from "../../lib/build/recipe/multifactorauth/prebuiltui"; +export default _default; diff --git a/recipe/multifactorauth/prebuiltui.js b/recipe/multifactorauth/prebuiltui.js new file mode 100644 index 000000000..0b8a61f89 --- /dev/null +++ b/recipe/multifactorauth/prebuiltui.js @@ -0,0 +1,20 @@ +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +exports.__esModule = true; +__export(require("../../lib/build/multifactorauthprebuiltui")); diff --git a/rollup.config.mjs b/rollup.config.mjs index fd42eb136..da0a0d34e 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -32,6 +32,8 @@ export default [ thirdpartypasswordless: "lib/ts/recipe/thirdpartypasswordless/index.ts", thirdpartypasswordlessprebuiltui: "lib/ts/recipe/thirdpartypasswordless/prebuiltui.tsx", multitenancy: "lib/ts/recipe/multitenancy/index.ts", + multifactorauth: "lib/ts/recipe/multifactorauth/index.ts", + multifactorauthprebuiltui: "lib/ts/recipe/multifactorauth/prebuiltui.tsx", userroles: "lib/ts/recipe/userroles/index.ts", }, plugins: [ From 8b339a4499b2a8103e206bedfb003a980101364d Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Fri, 13 Oct 2023 23:58:35 +0200 Subject: [PATCH 03/35] feat: add support for firstFactor --- lib/build/emailpasswordprebuiltui.js | 5 +- lib/build/emailverificationprebuiltui.js | 6 +- lib/build/genericComponentOverrideContext.js | 10 +- lib/build/index.js | 5 +- lib/build/index2.js | 152 +++++++++++++----- lib/build/multifactorauth-shared.js | 39 +++-- lib/build/multifactorauth-shared2.js | 10 ++ lib/build/multifactorauth.js | 3 +- lib/build/multifactorauthprebuiltui.js | 13 +- lib/build/passwordlessprebuiltui.js | 5 +- lib/build/recipe/multifactorauth/recipe.d.ts | 5 + lib/build/recipe/multifactorauth/types.d.ts | 19 ++- lib/build/recipe/multitenancy/types.d.ts | 1 + lib/build/session.js | 3 + lib/build/sessionprebuiltui.js | 5 +- .../thirdpartyemailpasswordprebuiltui.js | 5 +- lib/build/thirdpartypasswordlessprebuiltui.js | 5 +- lib/build/thirdpartyprebuiltui.js | 5 +- lib/build/ui-entry.js | 7 +- lib/ts/recipe/multifactorauth/recipe.tsx | 20 ++- lib/ts/recipe/multifactorauth/types.ts | 20 ++- lib/ts/recipe/multifactorauth/utils.ts | 5 +- lib/ts/recipe/multitenancy/recipe.ts | 5 +- lib/ts/recipe/multitenancy/types.ts | 1 + lib/ts/recipe/multitenancy/utils.ts | 6 +- lib/ts/recipe/recipeRouter/index.tsx | 114 ++++++++++--- package-lock.json | 4 +- 27 files changed, 371 insertions(+), 107 deletions(-) create mode 100644 lib/build/multifactorauth-shared2.js diff --git a/lib/build/emailpasswordprebuiltui.js b/lib/build/emailpasswordprebuiltui.js index d95b5c900..3ac657334 100644 --- a/lib/build/emailpasswordprebuiltui.js +++ b/lib/build/emailpasswordprebuiltui.js @@ -20,9 +20,12 @@ require("supertokens-web-js/utils/normalisedURLDomain"); require("./translationContext.js"); require("react-dom"); require("./multitenancy-shared.js"); +require("./multifactorauth-shared.js"); +require("supertokens-web-js/recipe/multifactorauth"); +require("supertokens-web-js/utils/sessionClaimValidatorStore"); +require("./recipeModule-shared.js"); require("./session-shared2.js"); require("supertokens-web-js/recipe/session"); -require("./recipeModule-shared.js"); require("./session-shared3.js"); require("./session-shared.js"); require("./translations.js"); diff --git a/lib/build/emailverificationprebuiltui.js b/lib/build/emailverificationprebuiltui.js index cd953b081..8b3493cba 100644 --- a/lib/build/emailverificationprebuiltui.js +++ b/lib/build/emailverificationprebuiltui.js @@ -25,11 +25,13 @@ require("supertokens-web-js/utils"); require("supertokens-web-js/utils/normalisedURLDomain"); require("react-dom"); require("./multitenancy-shared.js"); +require("./multifactorauth-shared.js"); +require("supertokens-web-js/recipe/multifactorauth"); +require("supertokens-web-js/utils/sessionClaimValidatorStore"); +require("./recipeModule-shared.js"); require("supertokens-web-js/recipe/session"); require("./session-shared.js"); require("supertokens-web-js/recipe/emailverification"); -require("supertokens-web-js/utils/sessionClaimValidatorStore"); -require("./recipeModule-shared.js"); function _interopDefault(e) { return e && e.__esModule ? e : { default: e }; diff --git a/lib/build/genericComponentOverrideContext.js b/lib/build/genericComponentOverrideContext.js index 5b9a429eb..6ac26e707 100644 --- a/lib/build/genericComponentOverrideContext.js +++ b/lib/build/genericComponentOverrideContext.js @@ -843,6 +843,7 @@ function getShouldUseShadowDomBasedOnBrowser(useShadowDom) { return useShadowDom !== undefined ? useShadowDom : true; } +var loginMethodTypes = ["emailpassword", "thirdparty", "passwordless"]; function normaliseMultitenancyConfig(config) { return exports.__assign(exports.__assign({}, normaliseRecipeModuleConfig(config)), { override: exports.__assign( @@ -867,7 +868,8 @@ function hasIntersectingRecipes(tenantMethods, recipeList) { return { value: true }; } }; - for (var key in tenantMethods) { + for (var _i = 0, loginMethodTypes_1 = loginMethodTypes; _i < loginMethodTypes_1.length; _i++) { + var key = loginMethodTypes_1[_i]; var state_1 = _loop_1(key); if (typeof state_1 === "object") return state_1.value; } @@ -938,7 +940,7 @@ var Multitenancy = /** @class */ (function (_super) { }; Multitenancy.getDynamicLoginMethods = function (input) { return __awaiter(this, void 0, void 0, function () { - var _a, emailPassword, passwordless, thirdParty; + var _a, emailPassword, passwordless, thirdParty, firstFactors; return __generator(this, function (_b) { switch (_b.label) { case 0: @@ -947,13 +949,15 @@ var Multitenancy = /** @class */ (function (_super) { (_a = _b.sent()), (emailPassword = _a.emailPassword), (passwordless = _a.passwordless), - (thirdParty = _a.thirdParty); + (thirdParty = _a.thirdParty), + (firstFactors = _a.firstFactors); return [ 2 /*return*/, { passwordless: passwordless, emailpassword: emailPassword, thirdparty: thirdParty, + firstFactors: firstFactors, }, ]; } diff --git a/lib/build/index.js b/lib/build/index.js index 4862636e7..7f59d9b47 100644 --- a/lib/build/index.js +++ b/lib/build/index.js @@ -17,9 +17,12 @@ require("supertokens-web-js/utils/normalisedURLPath"); require("react/jsx-runtime"); require("react-dom"); require("./multitenancy-shared.js"); +require("./multifactorauth-shared.js"); +require("supertokens-web-js/recipe/multifactorauth"); +require("supertokens-web-js/utils/sessionClaimValidatorStore"); +require("./recipeModule-shared.js"); require("./session-shared2.js"); require("supertokens-web-js/recipe/session"); -require("./recipeModule-shared.js"); exports.SuperTokensWrapper = uiEntry.SuperTokensWrapper; exports.changeLanguage = uiEntry.changeLanguage; diff --git a/lib/build/index2.js b/lib/build/index2.js index 2b9fda041..5da46d854 100644 --- a/lib/build/index2.js +++ b/lib/build/index2.js @@ -7,7 +7,8 @@ var NormalisedURLPath = require("supertokens-web-js/utils/normalisedURLPath"); var translationContext = require("./translationContext.js"); var reactDom = require("react-dom"); var componentOverrideContext = require("./multitenancy-shared.js"); -var recipe = require("./session-shared2.js"); +var recipe = require("./multifactorauth-shared.js"); +var recipe$1 = require("./session-shared2.js"); function _interopDefault(e) { return e && e.__esModule ? e : { default: e }; @@ -386,6 +387,74 @@ var DynamicLoginMethodsSpinner = function () { ); }; +// The related ADR: https://supertokens.com/docs/contribute/decisions/multitenancy/0006 +var priorityOrder = [ + { + rid: "thirdpartyemailpassword", + includes: ["thirdparty", "emailpassword"], + factorsProvided: ["thirdparty", "emailpassword"], + }, + { + rid: "thirdpartypasswordless", + includes: ["thirdparty", "passwordless"], + factorsProvided: ["thirdparty", "otp-phone", "otp-email", "link-phone", "link-email"], + }, + { rid: "emailpassword", includes: ["emailpassword"], factorsProvided: ["emailpassword"] }, + { + rid: "passwordless", + includes: ["passwordless"], + factorsProvided: ["otp-phone", "otp-email", "link-phone", "link-email"], + }, + { rid: "thirdparty", includes: ["thirdparty"], factorsProvided: ["thirdparty"] }, +]; +function chooseComponentBasedOnFirstFactors(firstFactors, routeComponents) { + var _loop_1 = function (rid, factorsProvided) { + if ( + firstFactors.length === factorsProvided.length && + factorsProvided.every(function (factor) { + return firstFactors.includes(factor); + }) + ) { + var matchingComp = routeComponents.find(function (comp) { + return comp.recipeID === rid; + }); + if (matchingComp) { + return { value: matchingComp }; + } + } + }; + // We first try to find an exact match + for (var _i = 0, priorityOrder_1 = priorityOrder; _i < priorityOrder_1.length; _i++) { + var _a = priorityOrder_1[_i], + rid = _a.rid, + factorsProvided = _a.factorsProvided; + var state_1 = _loop_1(rid, factorsProvided); + if (typeof state_1 === "object") return state_1.value; + } + var maxProvided = 0; + var component = undefined; + var _loop_2 = function (rid, factorsProvided) { + var providedByCurrent = factorsProvided.filter(function (id) { + return firstFactors.includes(id); + }).length; + if (providedByCurrent > maxProvided) { + var matchingComp = routeComponents.find(function (comp) { + return comp.recipeID === rid; + }); + if (matchingComp) { + component = matchingComp; + } + } + }; + // We find the component that provides the most factors + for (var _b = 0, _c = priorityOrder.reverse(); _b < _c.length; _b++) { + var _d = _c[_b], + rid = _d.rid, + factorsProvided = _d.factorsProvided; + _loop_2(rid, factorsProvided); + } + return component; +} var RecipeRouter = /** @class */ (function () { function RecipeRouter() { var _this = this; @@ -435,13 +504,36 @@ var RecipeRouter = /** @class */ (function () { var componentMatchingRid = routeComponents.find(function (c) { return c.matches(); }); - if (genericComponentOverrideContext.SuperTokens.usesDynamicLoginMethods === false || defaultToStaticList) { - if (routeComponents.length === 0) { - return undefined; - } else if (componentMatchingRid !== undefined) { + var defaultComp; + if (routeComponents.length === 0) { + defaultComp = undefined; + } else if (componentMatchingRid !== undefined) { + defaultComp = componentMatchingRid; + } else { + defaultComp = routeComponents[0]; + } + var matchingNonAuthComponent = routeComponents.find(function (comp) { + return !priorityOrder + .map(function (a) { + return a.rid; + }) + .includes(comp.recipeID); + }); + if (matchingNonAuthComponent) { + return matchingNonAuthComponent; + } + if (defaultToStaticList) { + return defaultComp; + } + var mfaRecipe = recipe.MultiFactorAuth.getInstance(); + if (genericComponentOverrideContext.SuperTokens.usesDynamicLoginMethods === false) { + if (componentMatchingRid) { return componentMatchingRid; + } + if (mfaRecipe) { + return chooseComponentBasedOnFirstFactors(mfaRecipe.config.getFirstFactors(), routeComponents); } else { - return routeComponents[0]; + return defaultComp; } } if (dynamicLoginMethods === undefined) { @@ -449,14 +541,6 @@ var RecipeRouter = /** @class */ (function () { "Should never come here: dynamic login methods info has not been loaded but recipeRouter rendered" ); } - // The related ADR: https://supertokens.com/docs/contribute/decisions/multitenancy/0006 - var priorityOrder = [ - { rid: "thirdpartyemailpassword", includes: ["thirdparty", "emailpassword"] }, - { rid: "thirdpartypasswordless", includes: ["thirdparty", "passwordless"] }, - { rid: "emailpassword", includes: ["emailpassword"] }, - { rid: "passwordless", includes: ["passwordless"] }, - { rid: "thirdparty", includes: ["thirdparty"] }, - ]; if ( componentMatchingRid && // if we find a component matching by rid (!priorityOrder @@ -470,20 +554,14 @@ var RecipeRouter = /** @class */ (function () { ) { return componentMatchingRid; } - var matchingNonAuthComponent = routeComponents.find(function (comp) { - return !priorityOrder - .map(function (a) { - return a.rid; - }) - .includes(comp.recipeID); - }); - if (matchingNonAuthComponent) { - return matchingNonAuthComponent; + if (dynamicLoginMethods.firstFactors !== undefined) { + return chooseComponentBasedOnFirstFactors(dynamicLoginMethods.firstFactors, routeComponents); } + // TODO: do we even need the else branch? (maybe for backwards comp.) var enabledRecipeCount = Object.keys(dynamicLoginMethods).filter(function (key) { return dynamicLoginMethods[key].enabled; }).length; - var _loop_1 = function (rid, includes) { + var _loop_3 = function (rid, includes) { if ( enabledRecipeCount === includes.length && includes.every(function (subRId) { @@ -499,14 +577,14 @@ var RecipeRouter = /** @class */ (function () { } }; // We first try to find an exact match - for (var _i = 0, priorityOrder_1 = priorityOrder; _i < priorityOrder_1.length; _i++) { - var _b = priorityOrder_1[_i], + for (var _i = 0, priorityOrder_2 = priorityOrder; _i < priorityOrder_2.length; _i++) { + var _b = priorityOrder_2[_i], rid = _b.rid, includes = _b.includes; - var state_1 = _loop_1(rid, includes); - if (typeof state_1 === "object") return state_1.value; + var state_2 = _loop_3(rid, includes); + if (typeof state_2 === "object") return state_2.value; } - var _loop_2 = function (rid, includes) { + var _loop_4 = function (rid, includes) { if ( includes.some(function (subRId) { return dynamicLoginMethods[subRId].enabled; @@ -521,12 +599,12 @@ var RecipeRouter = /** @class */ (function () { } }; // We try to find a partial match - for (var _c = 0, priorityOrder_2 = priorityOrder; _c < priorityOrder_2.length; _c++) { - var _d = priorityOrder_2[_c], + for (var _c = 0, priorityOrder_3 = priorityOrder; _c < priorityOrder_3.length; _c++) { + var _d = priorityOrder_3[_c], rid = _d.rid, includes = _d.includes; - var state_2 = _loop_2(rid, includes); - if (typeof state_2 === "object") return state_2.value; + var state_3 = _loop_4(rid, includes); + if (typeof state_3 === "object") return state_3.value; } return undefined; }; @@ -897,7 +975,7 @@ var SessionAuth = function (_a) { switch (_b.label) { case 0: if (session.current === undefined) { - session.current = recipe.Session.getInstanceOrThrow(); + session.current = recipe$1.Session.getInstanceOrThrow(); } return [ 4 /*yield*/, @@ -1029,7 +1107,7 @@ var SessionAuth = function (_a) { if (!(toSetContext.invalidClaims.length !== 0)) return [3 /*break*/, 4]; return [ 4 /*yield*/, - recipe.getFailureRedirectionInfo({ + recipe$1.getFailureRedirectionInfo({ invalidClaims: toSetContext.invalidClaims, overrideGlobalClaimValidators: props.overrideGlobalClaimValidators, userContext: userContext, @@ -1125,7 +1203,7 @@ var SessionAuth = function (_a) { if (!(props.doRedirection !== false)) return [3 /*break*/, 6]; return [ 4 /*yield*/, - recipe.getFailureRedirectionInfo({ + recipe$1.getFailureRedirectionInfo({ invalidClaims: invalidClaims, overrideGlobalClaimValidators: props.overrideGlobalClaimValidators, userContext: userContext, @@ -1209,7 +1287,7 @@ var SessionAuth = function (_a) { }); } if (session.current === undefined) { - session.current = recipe.Session.getInstanceOrThrow(); + session.current = recipe$1.Session.getInstanceOrThrow(); } if (context.loading === false) { // we return here cause addEventListener returns a function that removes diff --git a/lib/build/multifactorauth-shared.js b/lib/build/multifactorauth-shared.js index 3078bf480..21a0fff16 100644 --- a/lib/build/multifactorauth-shared.js +++ b/lib/build/multifactorauth-shared.js @@ -14,10 +14,6 @@ function _interopDefault(e) { var MultiFactorAuthWebJS__default = /*#__PURE__*/ _interopDefault(MultiFactorAuthWebJS); var NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath); -var _a = genericComponentOverrideContext.createGenericComponentsOverrideContext(), - useContext = _a[0], - Provider = _a[1]; - /* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. * * This software is licensed under the Apache License, Version 2.0 (the @@ -78,9 +74,14 @@ function normaliseMultiFactorAuthFeature(config) { ), { disableDefaultUI: disableDefaultUI, - getFirstFactors: function () { - return MultiFactorAuth.getInstanceOrThrow().getDefaultFirstFactors(); - }, + getFirstFactors: + (config === null || config === void 0 ? void 0 : config.firstFactors) !== undefined + ? function () { + return config.firstFactors; + } + : function () { + return MultiFactorAuth.getInstanceOrThrow().getDefaultFirstFactors(); + }, factorChooserScreen: (_a = config.factorChooserScreen) !== null && _a !== void 0 ? _a : {}, override: override, } @@ -110,9 +111,11 @@ var MultiFactorAuth = /** @class */ (function (_super) { var _this = _super.call(this, config) || this; _this.webJSRecipe = webJSRecipe; _this.recipeID = MultiFactorAuth.RECIPE_ID; + _this.firstFactors = []; + _this.factorRedirectionInfo = []; _this.getDefaultRedirectionURL = function (context) { return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { - var chooserPath; + var chooserPath, redirectInfo; return genericComponentOverrideContext.__generator(this, function (_a) { if (context.action === "FACTOR_CHOICE_REQUIRED") { chooserPath = new NormalisedURLPath__default.default(DEFAULT_FACTOR_CHOOSER_PATH); @@ -126,7 +129,13 @@ var MultiFactorAuth = /** @class */ (function (_super) { .concat(this.config.recipeId), ]; } else if (context.action === "GO_TO_FACTOR") { - // TODO + redirectInfo = this.factorRedirectionInfo.find(function (f) { + return f.id === context.factorId; + }); + if (redirectInfo !== undefined) { + return [2 /*return*/, redirectInfo.path]; + } + // TODO: access denied screen if not defined? return [2 /*return*/, "/"]; } else { return [2 /*return*/, "/"]; @@ -172,6 +181,9 @@ var MultiFactorAuth = /** @class */ (function (_super) { ), }; }; + MultiFactorAuth.getInstance = function () { + return MultiFactorAuth.instance; + }; MultiFactorAuth.getInstanceOrThrow = function () { if (MultiFactorAuth.instance === undefined) { var error = "No instance of EmailVerification found. Make sure to call the EmailVerification.init method."; @@ -184,7 +196,12 @@ var MultiFactorAuth = /** @class */ (function (_super) { return MultiFactorAuth.instance; }; MultiFactorAuth.prototype.getDefaultFirstFactors = function () { - return []; + return this.firstFactors; + }; + MultiFactorAuth.prototype.addMFAFactors = function (firstFactors, secondaryFactors) { + var _a, _b; + (_a = this.firstFactors).push.apply(_a, firstFactors); + (_b = this.factorRedirectionInfo).push.apply(_b, secondaryFactors); }; MultiFactorAuth.RECIPE_ID = "multifactorauth"; MultiFactorAuth.MultiFactorAuthClaim = MultiFactorAuthWebJS.MultiFactorAuthClaim; @@ -193,5 +210,3 @@ var MultiFactorAuth = /** @class */ (function (_super) { exports.DEFAULT_FACTOR_CHOOSER_PATH = DEFAULT_FACTOR_CHOOSER_PATH; exports.MultiFactorAuth = MultiFactorAuth; -exports.Provider = Provider; -exports.useContext = useContext; diff --git a/lib/build/multifactorauth-shared2.js b/lib/build/multifactorauth-shared2.js new file mode 100644 index 000000000..bd3b554b5 --- /dev/null +++ b/lib/build/multifactorauth-shared2.js @@ -0,0 +1,10 @@ +"use strict"; + +var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); + +var _a = genericComponentOverrideContext.createGenericComponentsOverrideContext(), + useContext = _a[0], + Provider = _a[1]; + +exports.Provider = Provider; +exports.useContext = useContext; diff --git a/lib/build/multifactorauth.js b/lib/build/multifactorauth.js index 2644efd85..e024655e5 100644 --- a/lib/build/multifactorauth.js +++ b/lib/build/multifactorauth.js @@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); +var componentOverrideContext = require("./multifactorauth-shared2.js"); var recipe = require("./multifactorauth-shared.js"); require("supertokens-web-js"); require("supertokens-web-js/utils/cookieHandler"); @@ -47,7 +48,7 @@ var Wrapper = /** @class */ (function () { ); }; Wrapper.MultiFactorAuthClaim = recipe.MultiFactorAuth.MultiFactorAuthClaim; - Wrapper.ComponentsOverrideProvider = recipe.Provider; + Wrapper.ComponentsOverrideProvider = componentOverrideContext.Provider; return Wrapper; })(); var init = Wrapper.init; diff --git a/lib/build/multifactorauthprebuiltui.js b/lib/build/multifactorauthprebuiltui.js index fe5f9d1f6..7a562b90c 100644 --- a/lib/build/multifactorauthprebuiltui.js +++ b/lib/build/multifactorauthprebuiltui.js @@ -5,11 +5,12 @@ var jsxRuntime = require("react/jsx-runtime"); var NormalisedURLPath = require("supertokens-web-js/utils/normalisedURLPath"); var uiEntry = require("./index2.js"); var session = require("./session-shared3.js"); -var recipe$1 = require("./multifactorauth-shared.js"); +var componentOverrideContext = require("./multifactorauth-shared2.js"); var React = require("react"); var recipe = require("./session-shared2.js"); var translations = require("./translations.js"); var themeBase = require("./emailpassword-shared.js"); +var recipe$1 = require("./multifactorauth-shared.js"); require("supertokens-web-js"); require("supertokens-web-js/utils/cookieHandler"); require("supertokens-web-js/utils/postSuperTokensInitCallbacks"); @@ -22,9 +23,9 @@ require("react-dom"); require("./multitenancy-shared.js"); require("supertokens-web-js/recipe/session"); require("./session-shared.js"); +require("./recipeModule-shared.js"); require("supertokens-web-js/recipe/multifactorauth"); require("supertokens-web-js/utils/sessionClaimValidatorStore"); -require("./recipeModule-shared.js"); function _interopDefault(e) { return e && e.__esModule ? e : { default: e }; @@ -260,7 +261,7 @@ var MultiFactorAuthPreBuiltUI = /** @class */ (function (_super) { // Instance methods _this.getFeatures = function (useComponentOverrides) { if (useComponentOverrides === void 0) { - useComponentOverrides = recipe$1.useContext; + useComponentOverrides = componentOverrideContext.useContext; } var features = {}; if (_this.recipeInstance.config.disableDefaultUI !== true) { @@ -286,7 +287,7 @@ var MultiFactorAuthPreBuiltUI = /** @class */ (function (_super) { useComponentOverrides ) { if (useComponentOverrides === void 0) { - useComponentOverrides = recipe$1.useContext; + useComponentOverrides = componentOverrideContext.useContext; } return jsxRuntime.jsx( uiEntry.UserContextWrapper, @@ -332,13 +333,13 @@ var MultiFactorAuthPreBuiltUI = /** @class */ (function (_super) { }; MultiFactorAuthPreBuiltUI.getFeatures = function (useComponentOverrides) { if (useComponentOverrides === void 0) { - useComponentOverrides = recipe$1.useContext; + useComponentOverrides = componentOverrideContext.useContext; } return MultiFactorAuthPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatures(useComponentOverrides); }; MultiFactorAuthPreBuiltUI.getFeatureComponent = function (componentName, props, useComponentOverrides) { if (useComponentOverrides === void 0) { - useComponentOverrides = recipe$1.useContext; + useComponentOverrides = componentOverrideContext.useContext; } return MultiFactorAuthPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent( componentName, diff --git a/lib/build/passwordlessprebuiltui.js b/lib/build/passwordlessprebuiltui.js index 386c93baf..9fc3e1e3c 100644 --- a/lib/build/passwordlessprebuiltui.js +++ b/lib/build/passwordlessprebuiltui.js @@ -19,9 +19,12 @@ require("supertokens-web-js/utils/normalisedURLDomain"); require("./translationContext.js"); require("react-dom"); require("./multitenancy-shared.js"); +require("./multifactorauth-shared.js"); +require("supertokens-web-js/recipe/multifactorauth"); +require("supertokens-web-js/utils/sessionClaimValidatorStore"); +require("./recipeModule-shared.js"); require("./session-shared2.js"); require("supertokens-web-js/recipe/session"); -require("./recipeModule-shared.js"); require("./session-shared3.js"); require("./session-shared.js"); require("supertokens-web-js/utils/error"); diff --git a/lib/build/recipe/multifactorauth/recipe.d.ts b/lib/build/recipe/multifactorauth/recipe.d.ts index bc30eceec..1abf88682 100644 --- a/lib/build/recipe/multifactorauth/recipe.d.ts +++ b/lib/build/recipe/multifactorauth/recipe.d.ts @@ -6,6 +6,7 @@ import type { GetRedirectionURLContext, OnHandleEventContext, PreAndPostAPIHookAction, + SecondaryFactorRedirectionInfo, } from "./types"; import type { NormalisedConfigWithAppInfoAndRecipeID, RecipeInitResult, WebJSRecipeInterface } from "../../types"; export default class MultiFactorAuth extends RecipeModule< @@ -19,6 +20,8 @@ export default class MultiFactorAuth extends RecipeModule< static RECIPE_ID: string; static MultiFactorAuthClaim: import("supertokens-web-js/lib/build/recipe/multifactorauth/multiFactorAuthClaim").MultiFactorAuthClaimClass; recipeID: string; + firstFactors: string[]; + factorRedirectionInfo: SecondaryFactorRedirectionInfo[]; constructor( config: NormalisedConfigWithAppInfoAndRecipeID, webJSRecipe?: WebJSRecipeInterface @@ -26,7 +29,9 @@ export default class MultiFactorAuth extends RecipeModule< static init( config?: UserInput ): RecipeInitResult; + static getInstance(): MultiFactorAuth | undefined; static getInstanceOrThrow(): MultiFactorAuth; getDefaultRedirectionURL: (context: GetRedirectionURLContext) => Promise; getDefaultFirstFactors(): string[]; + addMFAFactors(firstFactors: string[], secondaryFactors: SecondaryFactorRedirectionInfo[]): void; } diff --git a/lib/build/recipe/multifactorauth/types.d.ts b/lib/build/recipe/multifactorauth/types.d.ts index 476044b29..12f7aefa7 100644 --- a/lib/build/recipe/multifactorauth/types.d.ts +++ b/lib/build/recipe/multifactorauth/types.d.ts @@ -24,7 +24,7 @@ export declare type UserInput = { export declare type Config = UserInput & RecipeModuleConfig; export declare type NormalisedConfig = { - getFirstFactors?: () => string[]; + getFirstFactors: () => string[]; disableDefaultUI: boolean; factorChooserScreen: FeatureBaseConfig; override: { @@ -34,9 +34,14 @@ export declare type NormalisedConfig = { ) => RecipeInterface; }; } & NormalisedRecipeModuleConfig; -export declare type GetRedirectionURLContext = { - action: "FACTOR_CHOICE_REQUIRED" | "GO_TO_FACTOR"; -}; +export declare type GetRedirectionURLContext = + | { + action: "FACTOR_CHOICE_REQUIRED"; + } + | { + action: "GO_TO_FACTOR"; + factorId: string; + }; export declare type PreAndPostAPIHookAction = "GET_MFA_INFO"; export declare type PreAPIHookContext = { action: PreAndPostAPIHookAction; @@ -52,3 +57,9 @@ export declare type FactorChooserThemeProps = { config: NormalisedConfig; userContext?: any; }; +export declare type SecondaryFactorRedirectionInfo = { + id: string; + name: string; + description: string; + path: string; +}; diff --git a/lib/build/recipe/multitenancy/types.d.ts b/lib/build/recipe/multitenancy/types.d.ts index 3ed4901a9..b65184946 100644 --- a/lib/build/recipe/multitenancy/types.d.ts +++ b/lib/build/recipe/multitenancy/types.d.ts @@ -37,6 +37,7 @@ export declare type GetLoginMethodsResponseNormalized = { name: string; }[]; }; + firstFactors: string[]; }; export declare type ComponentOverrideMap = { MultitenancyDynamicLoginMethodsSpinnerTheme_Override?: ComponentOverride; diff --git a/lib/build/session.js b/lib/build/session.js index 53f86d87f..c109ea077 100644 --- a/lib/build/session.js +++ b/lib/build/session.js @@ -22,6 +22,9 @@ require("./recipeModule-shared.js"); require("./translationContext.js"); require("react-dom"); require("./multitenancy-shared.js"); +require("./multifactorauth-shared.js"); +require("supertokens-web-js/recipe/multifactorauth"); +require("supertokens-web-js/utils/sessionClaimValidatorStore"); exports.BooleanClaim = session.BooleanClaim; exports.PrimitiveArrayClaim = session.PrimitiveArrayClaim; diff --git a/lib/build/sessionprebuiltui.js b/lib/build/sessionprebuiltui.js index 6aab3f72e..229b076ee 100644 --- a/lib/build/sessionprebuiltui.js +++ b/lib/build/sessionprebuiltui.js @@ -19,8 +19,11 @@ require("supertokens-web-js/utils/normalisedURLDomain"); require("supertokens-web-js/utils/normalisedURLPath"); require("react-dom"); require("./multitenancy-shared.js"); -require("supertokens-web-js/recipe/session"); +require("./multifactorauth-shared.js"); +require("supertokens-web-js/recipe/multifactorauth"); +require("supertokens-web-js/utils/sessionClaimValidatorStore"); require("./recipeModule-shared.js"); +require("supertokens-web-js/recipe/session"); function ErrorRoundIcon() { return jsxRuntime.jsxs( diff --git a/lib/build/thirdpartyemailpasswordprebuiltui.js b/lib/build/thirdpartyemailpasswordprebuiltui.js index b2c554c94..81d1dc42f 100644 --- a/lib/build/thirdpartyemailpasswordprebuiltui.js +++ b/lib/build/thirdpartyemailpasswordprebuiltui.js @@ -21,9 +21,12 @@ require("supertokens-web-js/utils"); require("supertokens-web-js/utils/normalisedURLDomain"); require("react-dom"); require("./multitenancy-shared.js"); +require("./multifactorauth-shared.js"); +require("supertokens-web-js/recipe/multifactorauth"); +require("supertokens-web-js/utils/sessionClaimValidatorStore"); +require("./recipeModule-shared.js"); require("./session-shared2.js"); require("supertokens-web-js/recipe/session"); -require("./recipeModule-shared.js"); require("./session-shared3.js"); require("./session-shared.js"); require("./emailpassword-shared4.js"); diff --git a/lib/build/thirdpartypasswordlessprebuiltui.js b/lib/build/thirdpartypasswordlessprebuiltui.js index f855a7556..7a42a4b29 100644 --- a/lib/build/thirdpartypasswordlessprebuiltui.js +++ b/lib/build/thirdpartypasswordlessprebuiltui.js @@ -21,9 +21,12 @@ require("supertokens-web-js/utils"); require("supertokens-web-js/utils/normalisedURLDomain"); require("react-dom"); require("./multitenancy-shared.js"); +require("./multifactorauth-shared.js"); +require("supertokens-web-js/recipe/multifactorauth"); +require("supertokens-web-js/utils/sessionClaimValidatorStore"); +require("./recipeModule-shared.js"); require("./session-shared2.js"); require("supertokens-web-js/recipe/session"); -require("./recipeModule-shared.js"); require("./session-shared3.js"); require("./session-shared.js"); require("./passwordless-shared.js"); diff --git a/lib/build/thirdpartyprebuiltui.js b/lib/build/thirdpartyprebuiltui.js index 79ddc4d7d..dca4df3b9 100644 --- a/lib/build/thirdpartyprebuiltui.js +++ b/lib/build/thirdpartyprebuiltui.js @@ -18,9 +18,12 @@ require("supertokens-web-js/utils/normalisedURLDomain"); require("./translationContext.js"); require("react-dom"); require("./multitenancy-shared.js"); +require("./multifactorauth-shared.js"); +require("supertokens-web-js/recipe/multifactorauth"); +require("supertokens-web-js/utils/sessionClaimValidatorStore"); +require("./recipeModule-shared.js"); require("./session-shared2.js"); require("supertokens-web-js/recipe/session"); -require("./recipeModule-shared.js"); require("./session-shared3.js"); require("./session-shared.js"); require("supertokens-web-js/recipe/thirdparty"); diff --git a/lib/build/ui-entry.js b/lib/build/ui-entry.js index da116aaec..5a2e95d9f 100644 --- a/lib/build/ui-entry.js +++ b/lib/build/ui-entry.js @@ -10,13 +10,16 @@ require("supertokens-web-js/utils/normalisedURLPath"); require("./translationContext.js"); require("react-dom"); require("./multitenancy-shared.js"); +require("./multifactorauth-shared.js"); +require("supertokens-web-js/recipe/multifactorauth"); +require("supertokens-web-js/utils/postSuperTokensInitCallbacks"); +require("supertokens-web-js/utils/sessionClaimValidatorStore"); +require("./recipeModule-shared.js"); require("./session-shared2.js"); require("supertokens-web-js/recipe/session"); -require("./recipeModule-shared.js"); require("supertokens-web-js/utils"); require("supertokens-web-js"); require("supertokens-web-js/utils/cookieHandler"); -require("supertokens-web-js/utils/postSuperTokensInitCallbacks"); require("supertokens-web-js/utils/windowHandler"); require("supertokens-web-js/recipe/multitenancy"); require("supertokens-web-js/utils/normalisedURLDomain"); diff --git a/lib/ts/recipe/multifactorauth/recipe.tsx b/lib/ts/recipe/multifactorauth/recipe.tsx index ace54711d..e6a71bb36 100644 --- a/lib/ts/recipe/multifactorauth/recipe.tsx +++ b/lib/ts/recipe/multifactorauth/recipe.tsx @@ -36,6 +36,7 @@ import type { GetRedirectionURLContext, OnHandleEventContext, PreAndPostAPIHookAction, + SecondaryFactorRedirectionInfo, } from "./types"; import type { NormalisedConfigWithAppInfoAndRecipeID, RecipeInitResult, WebJSRecipeInterface } from "../../types"; import type { NormalisedAppInfo } from "../../types"; @@ -52,6 +53,8 @@ export default class MultiFactorAuth extends RecipeModule< static MultiFactorAuthClaim = MultiFactorAuthClaim; public recipeID = MultiFactorAuth.RECIPE_ID; + public firstFactors: string[] = []; + public factorRedirectionInfo: SecondaryFactorRedirectionInfo[] = []; constructor( config: NormalisedConfigWithAppInfoAndRecipeID, @@ -102,6 +105,10 @@ export default class MultiFactorAuth extends RecipeModule< }; } + static getInstance(): MultiFactorAuth | undefined { + return MultiFactorAuth.instance; + } + static getInstanceOrThrow(): MultiFactorAuth { if (MultiFactorAuth.instance === undefined) { let error = "No instance of EmailVerification found. Make sure to call the EmailVerification.init method."; @@ -123,7 +130,11 @@ export default class MultiFactorAuth extends RecipeModule< this.config.recipeId }`; } else if (context.action === "GO_TO_FACTOR") { - // TODO + const redirectInfo = this.factorRedirectionInfo.find((f) => f.id === context.factorId); + if (redirectInfo !== undefined) { + return redirectInfo.path; + } + // TODO: access denied screen if not defined? return "/"; } else { return "/"; @@ -131,6 +142,11 @@ export default class MultiFactorAuth extends RecipeModule< }; getDefaultFirstFactors(): string[] { - return []; + return this.firstFactors; + } + + addMFAFactors(firstFactors: string[], secondaryFactors: SecondaryFactorRedirectionInfo[]) { + this.firstFactors.push(...firstFactors); + this.factorRedirectionInfo.push(...secondaryFactors); } } diff --git a/lib/ts/recipe/multifactorauth/types.ts b/lib/ts/recipe/multifactorauth/types.ts index 897a698d6..3386a5eb7 100644 --- a/lib/ts/recipe/multifactorauth/types.ts +++ b/lib/ts/recipe/multifactorauth/types.ts @@ -45,7 +45,7 @@ export type Config = UserInput & RecipeModuleConfig; export type NormalisedConfig = { - getFirstFactors?: () => string[]; + getFirstFactors: () => string[]; disableDefaultUI: boolean; factorChooserScreen: FeatureBaseConfig; @@ -57,9 +57,14 @@ export type NormalisedConfig = { }; } & NormalisedRecipeModuleConfig; -export type GetRedirectionURLContext = { - action: "FACTOR_CHOICE_REQUIRED" | "GO_TO_FACTOR"; -}; +export type GetRedirectionURLContext = + | { + action: "FACTOR_CHOICE_REQUIRED"; + } + | { + action: "GO_TO_FACTOR"; + factorId: string; + }; export type PreAndPostAPIHookAction = "GET_MFA_INFO"; @@ -79,3 +84,10 @@ export type FactorChooserThemeProps = { config: NormalisedConfig; userContext?: any; }; + +export type SecondaryFactorRedirectionInfo = { + id: string; + name: string; + description: string; + path: string; +}; diff --git a/lib/ts/recipe/multifactorauth/utils.ts b/lib/ts/recipe/multifactorauth/utils.ts index 10fa202da..8a1d9e39e 100644 --- a/lib/ts/recipe/multifactorauth/utils.ts +++ b/lib/ts/recipe/multifactorauth/utils.ts @@ -34,7 +34,10 @@ export function normaliseMultiFactorAuthFeature(config?: Config): NormalisedConf return { ...normaliseRecipeModuleConfig(config), disableDefaultUI, - getFirstFactors: () => MultiFactorAuth.getInstanceOrThrow().getDefaultFirstFactors(), + getFirstFactors: + config?.firstFactors !== undefined + ? () => config!.firstFactors! + : () => MultiFactorAuth.getInstanceOrThrow().getDefaultFirstFactors(), factorChooserScreen: config.factorChooserScreen ?? {}, override, }; diff --git a/lib/ts/recipe/multitenancy/recipe.ts b/lib/ts/recipe/multitenancy/recipe.ts index cf6daf3eb..240cba59f 100644 --- a/lib/ts/recipe/multitenancy/recipe.ts +++ b/lib/ts/recipe/multitenancy/recipe.ts @@ -77,12 +77,15 @@ export default class Multitenancy extends BaseRecipeModule { static async getDynamicLoginMethods( input: Parameters[0] ): Promise { - const { emailPassword, passwordless, thirdParty } = await MultitenancyWebJS.getLoginMethods(input); + const { emailPassword, passwordless, thirdParty, firstFactors } = await MultitenancyWebJS.getLoginMethods( + input + ); return { passwordless: passwordless, emailpassword: emailPassword, thirdparty: thirdParty, + firstFactors, }; } diff --git a/lib/ts/recipe/multitenancy/types.ts b/lib/ts/recipe/multitenancy/types.ts index 32a373b89..37e99a15c 100644 --- a/lib/ts/recipe/multitenancy/types.ts +++ b/lib/ts/recipe/multitenancy/types.ts @@ -41,6 +41,7 @@ export type GetLoginMethodsResponseNormalized = { name: string; }[]; }; + firstFactors: string[]; }; export type ComponentOverrideMap = { diff --git a/lib/ts/recipe/multitenancy/utils.ts b/lib/ts/recipe/multitenancy/utils.ts index 8b6310bff..5693b41e1 100644 --- a/lib/ts/recipe/multitenancy/utils.ts +++ b/lib/ts/recipe/multitenancy/utils.ts @@ -3,6 +3,8 @@ import { normaliseRecipeModuleConfig } from "../recipeModule/utils"; import type { UserInput, NormalisedConfig, GetLoginMethodsResponseNormalized } from "./types"; import type { BaseRecipeModule } from "../recipeModule/baseRecipeModule"; +const loginMethodTypes = ["emailpassword", "thirdparty", "passwordless"] as const; + export function normaliseMultitenancyConfig(config?: UserInput): NormalisedConfig { return { ...normaliseRecipeModuleConfig(config), @@ -17,9 +19,9 @@ export function hasIntersectingRecipes( tenantMethods: GetLoginMethodsResponseNormalized, recipeList: BaseRecipeModule[] ): boolean { - for (const key in tenantMethods) { + for (const key of loginMethodTypes) { const hasIntersection = recipeList.some((recipe) => { - if (tenantMethods[key as keyof GetLoginMethodsResponseNormalized].enabled) { + if (tenantMethods[key].enabled) { return recipe.recipeID === key || recipe.recipeID.includes(key); } return false; diff --git a/lib/ts/recipe/recipeRouter/index.tsx b/lib/ts/recipe/recipeRouter/index.tsx index 612439c51..36f1a6d6b 100644 --- a/lib/ts/recipe/recipeRouter/index.tsx +++ b/lib/ts/recipe/recipeRouter/index.tsx @@ -1,4 +1,5 @@ import SuperTokens from "../../superTokens"; +import MultiFactorAuth from "../multifactorauth/recipe"; import type { RecipeFeatureComponentMap } from "../../types"; import type { BaseFeatureComponentMap, ComponentWithRecipeAndMatchingMethod } from "../../types"; @@ -6,6 +7,64 @@ import type { GetLoginMethodsResponseNormalized } from "../multitenancy/types"; import type RecipeModule from "../recipeModule"; import type NormalisedURLPath from "supertokens-web-js/lib/build/normalisedURLPath"; +// The related ADR: https://supertokens.com/docs/contribute/decisions/multitenancy/0006 +const priorityOrder: { + rid: string; + includes: ("thirdparty" | "emailpassword" | "passwordless")[]; + factorsProvided: string[]; +}[] = [ + { + rid: "thirdpartyemailpassword", + includes: ["thirdparty", "emailpassword"], + factorsProvided: ["thirdparty", "emailpassword"], + }, + { + rid: "thirdpartypasswordless", + includes: ["thirdparty", "passwordless"], + factorsProvided: ["thirdparty", "otp-phone", "otp-email", "link-phone", "link-email"], + }, + { rid: "emailpassword", includes: ["emailpassword"], factorsProvided: ["emailpassword"] }, + { + rid: "passwordless", + includes: ["passwordless"], + factorsProvided: ["otp-phone", "otp-email", "link-phone", "link-email"], + }, + { rid: "thirdparty", includes: ["thirdparty"], factorsProvided: ["thirdparty"] }, +]; + +function chooseComponentBasedOnFirstFactors( + firstFactors: string[], + routeComponents: ComponentWithRecipeAndMatchingMethod[] +) { + // We first try to find an exact match + for (const { rid, factorsProvided } of priorityOrder) { + if ( + firstFactors.length === factorsProvided.length && + factorsProvided.every((factor) => firstFactors.includes(factor)) + ) { + const matchingComp = routeComponents.find((comp) => comp.recipeID === rid); + if (matchingComp) { + return matchingComp; + } + } + } + + const maxProvided = 0; + let component = undefined; + // We find the component that provides the most factors + for (const { rid, factorsProvided } of priorityOrder.reverse()) { + const providedByCurrent = factorsProvided.filter((id) => firstFactors.includes(id)).length; + if (providedByCurrent > maxProvided) { + const matchingComp = routeComponents.find((comp) => comp.recipeID === rid); + if (matchingComp) { + component = matchingComp; + } + } + } + + return component; +} + export abstract class RecipeRouter { private pathsToFeatureComponentWithRecipeIdMap?: BaseFeatureComponentMap; public abstract recipeInstance: RecipeModule; @@ -31,13 +90,38 @@ export abstract class RecipeRouter { }, [] as ComponentWithRecipeAndMatchingMethod[]); const componentMatchingRid = routeComponents.find((c) => c.matches()); - if (SuperTokens.usesDynamicLoginMethods === false || defaultToStaticList) { - if (routeComponents.length === 0) { - return undefined; - } else if (componentMatchingRid !== undefined) { + + let defaultComp; + if (routeComponents.length === 0) { + defaultComp = undefined; + } else if (componentMatchingRid !== undefined) { + defaultComp = componentMatchingRid; + } else { + defaultComp = routeComponents[0]; + } + + const matchingNonAuthComponent = routeComponents.find( + (comp) => !priorityOrder.map((a) => a.rid).includes(comp.recipeID) + ); + + if (matchingNonAuthComponent) { + return matchingNonAuthComponent; + } + + if (defaultToStaticList) { + return defaultComp; + } + + const mfaRecipe = MultiFactorAuth.getInstance(); + if (SuperTokens.usesDynamicLoginMethods === false) { + if (componentMatchingRid) { return componentMatchingRid; + } + + if (mfaRecipe) { + return chooseComponentBasedOnFirstFactors(mfaRecipe.config.getFirstFactors(), routeComponents); } else { - return routeComponents[0]; + return defaultComp; } } @@ -47,32 +131,20 @@ export abstract class RecipeRouter { ); } - // The related ADR: https://supertokens.com/docs/contribute/decisions/multitenancy/0006 - const priorityOrder: { rid: string; includes: (keyof GetLoginMethodsResponseNormalized)[] }[] = [ - { rid: "thirdpartyemailpassword", includes: ["thirdparty", "emailpassword"] }, - { rid: "thirdpartypasswordless", includes: ["thirdparty", "passwordless"] }, - { rid: "emailpassword", includes: ["emailpassword"] }, - { rid: "passwordless", includes: ["passwordless"] }, - { rid: "thirdparty", includes: ["thirdparty"] }, - ]; - if ( componentMatchingRid && // if we find a component matching by rid (!priorityOrder.map((a) => a.rid).includes(componentMatchingRid.recipeID) || // from a non-auth recipe - dynamicLoginMethods[componentMatchingRid.recipeID as keyof GetLoginMethodsResponseNormalized] + dynamicLoginMethods[componentMatchingRid.recipeID as "passwordless" | "thirdparty" | "emailpassword"] ?.enabled === true) // or an enabled auth recipe ) { return componentMatchingRid; } - const matchingNonAuthComponent = routeComponents.find( - (comp) => !priorityOrder.map((a) => a.rid).includes(comp.recipeID) - ); - - if (matchingNonAuthComponent) { - return matchingNonAuthComponent; + if (dynamicLoginMethods.firstFactors !== undefined) { + return chooseComponentBasedOnFirstFactors(dynamicLoginMethods.firstFactors, routeComponents); } + // TODO: do we even need the else branch? (maybe for backwards comp.) const enabledRecipeCount = Object.keys(dynamicLoginMethods).filter( (key) => (dynamicLoginMethods as any)[key].enabled ).length; diff --git a/package-lock.json b/package-lock.json index 1aef3c02e..5fa17dd82 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16244,7 +16244,7 @@ }, "node_modules/supertokens-web-js": { "version": "0.8.0", - "resolved": "git+ssh://git@github.com/supertokens/supertokens-web-js.git#e0035834475c5bae41295bd97d3e06cbf138c867", + "resolved": "git+ssh://git@github.com/supertokens/supertokens-web-js.git#f6aa50d8b92dff7d86221ecc03eb1cc808ac2273", "license": "Apache-2.0", "peer": true, "dependencies": { @@ -29414,7 +29414,7 @@ "integrity": "sha512-r0JFBjkMIdep3Lbk3JA+MpnpuOtw4RSyrlRAbrzMcxwiYco3GFWl/daimQZ5b1forOiUODpOlXbSOljP/oyurg==" }, "supertokens-web-js": { - "version": "git+ssh://git@github.com/supertokens/supertokens-web-js.git#e0035834475c5bae41295bd97d3e06cbf138c867", + "version": "git+ssh://git@github.com/supertokens/supertokens-web-js.git#f6aa50d8b92dff7d86221ecc03eb1cc808ac2273", "from": "supertokens-web-js@github:supertokens/supertokens-web-js#feat/mfa", "peer": true, "requires": { From 02429f8e7879b05f15b8be1ba198aec54fb71c73 Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Sun, 15 Oct 2023 18:15:12 +0200 Subject: [PATCH 04/35] fix: fix chooseComponentBasedOnFirstFactors to properly get the max count --- lib/build/index2.js | 22 +++++++++++++++++++++- lib/ts/recipe/recipeRouter/index.tsx | 5 +++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/lib/build/index2.js b/lib/build/index2.js index 5da46d854..75c54626c 100644 --- a/lib/build/index2.js +++ b/lib/build/index2.js @@ -408,6 +408,8 @@ var priorityOrder = [ { rid: "thirdparty", includes: ["thirdparty"], factorsProvided: ["thirdparty"] }, ]; function chooseComponentBasedOnFirstFactors(firstFactors, routeComponents) { + console.log("chooseComponentBasedOnFirstFactors"); + console.log({ firstFactors: firstFactors }); var _loop_1 = function (rid, factorsProvided) { if ( firstFactors.length === factorsProvided.length && @@ -418,6 +420,7 @@ function chooseComponentBasedOnFirstFactors(firstFactors, routeComponents) { var matchingComp = routeComponents.find(function (comp) { return comp.recipeID === rid; }); + console.log("exact match", rid, !!matchingComp); if (matchingComp) { return { value: matchingComp }; } @@ -437,11 +440,20 @@ function chooseComponentBasedOnFirstFactors(firstFactors, routeComponents) { var providedByCurrent = factorsProvided.filter(function (id) { return firstFactors.includes(id); }).length; - if (providedByCurrent > maxProvided) { + console.log({ + rid: rid, + providedByCurrent: factorsProvided.filter(function (id) { + return firstFactors.includes(id); + }), + c: providedByCurrent, + }); + if (providedByCurrent >= maxProvided) { var matchingComp = routeComponents.find(function (comp) { return comp.recipeID === rid; }); + console.log("new max", rid); if (matchingComp) { + maxProvided = providedByCurrent; component = matchingComp; } } @@ -519,6 +531,11 @@ var RecipeRouter = /** @class */ (function () { }) .includes(comp.recipeID); }); + console.log({ + defaultToStaticList: defaultToStaticList, + matchingNonAuthComponent: !!matchingNonAuthComponent, + componentMatchingRid: !!componentMatchingRid, + }); if (matchingNonAuthComponent) { return matchingNonAuthComponent; } @@ -527,12 +544,15 @@ var RecipeRouter = /** @class */ (function () { } var mfaRecipe = recipe.MultiFactorAuth.getInstance(); if (genericComponentOverrideContext.SuperTokens.usesDynamicLoginMethods === false) { + console.log("usesDynamicLoginMethods false"); if (componentMatchingRid) { return componentMatchingRid; } if (mfaRecipe) { + console.log("mfa enabled"); return chooseComponentBasedOnFirstFactors(mfaRecipe.config.getFirstFactors(), routeComponents); } else { + console.log("returning default"); return defaultComp; } } diff --git a/lib/ts/recipe/recipeRouter/index.tsx b/lib/ts/recipe/recipeRouter/index.tsx index 36f1a6d6b..183468877 100644 --- a/lib/ts/recipe/recipeRouter/index.tsx +++ b/lib/ts/recipe/recipeRouter/index.tsx @@ -49,14 +49,15 @@ function chooseComponentBasedOnFirstFactors( } } - const maxProvided = 0; + let maxProvided = 0; let component = undefined; // We find the component that provides the most factors for (const { rid, factorsProvided } of priorityOrder.reverse()) { const providedByCurrent = factorsProvided.filter((id) => firstFactors.includes(id)).length; - if (providedByCurrent > maxProvided) { + if (providedByCurrent >= maxProvided) { const matchingComp = routeComponents.find((comp) => comp.recipeID === rid); if (matchingComp) { + maxProvided = providedByCurrent; component = matchingComp; } } From f3c955e6564e73f7a5abc82571eefc61bc628ec8 Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Mon, 16 Oct 2023 11:27:54 +0200 Subject: [PATCH 05/35] feat: navigation based on claim validation failures --- examples/for-tests/src/App.js | 4 + examples/for-tests/src/testContext.js | 2 +- lib/build/emailverification-shared.js | 32 ++--- lib/build/index2.js | 19 --- lib/build/multifactorauth-shared.js | 111 +++++++++++++++++- lib/build/passwordless-shared2.js | 18 +++ lib/build/passwordless.js | 3 + .../emailVerificationClaim.d.ts | 2 +- lib/build/recipe/emailverification/index.d.ts | 4 +- .../recipe/emailverification/recipe.d.ts | 2 +- lib/build/recipe/multifactorauth/index.d.ts | 10 +- .../multifactorauth/multiFactorAuthClaim.d.ts | 48 ++++++++ lib/build/recipe/multifactorauth/recipe.d.ts | 3 +- lib/build/thirdpartypasswordless.js | 3 + .../emailVerificationClaim.ts | 4 +- lib/ts/recipe/emailverification/recipe.tsx | 2 +- lib/ts/recipe/multifactorauth/index.ts | 6 +- .../multifactorauth/multiFactorAuthClaim.ts | 92 +++++++++++++++ lib/ts/recipe/multifactorauth/recipe.tsx | 7 +- lib/ts/recipe/passwordless/recipe.tsx | 19 +++ test/server/index.js | 12 ++ 21 files changed, 344 insertions(+), 59 deletions(-) rename lib/build/{claims => recipe/emailverification}/emailVerificationClaim.d.ts (86%) create mode 100644 lib/build/recipe/multifactorauth/multiFactorAuthClaim.d.ts rename lib/ts/{claims => recipe/emailverification}/emailVerificationClaim.ts (92%) create mode 100644 lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts diff --git a/examples/for-tests/src/App.js b/examples/for-tests/src/App.js index f65dac002..6273474b2 100644 --- a/examples/for-tests/src/App.js +++ b/examples/for-tests/src/App.js @@ -14,6 +14,7 @@ import Multitenancy from "supertokens-auth-react/recipe/multitenancy"; import ThirdPartyEmailPassword from "supertokens-auth-react/recipe/thirdpartyemailpassword"; import ThirdPartyPasswordless from "supertokens-auth-react/recipe/thirdpartypasswordless"; import UserRoles from "supertokens-auth-react/recipe/userroles"; +import MultiFactorAuth from "supertokens-auth-react/recipe/multifactorauth"; import axios from "axios"; import { useSessionContext } from "supertokens-auth-react/recipe/session"; @@ -171,6 +172,9 @@ const formFields = [ const testContext = getTestContext(); let recipeList = [ + MultiFactorAuth.init({ + firstFactors: ["emailpassword", "thirdparty"], + }), Multitenancy.init({ override: { functions: (oI) => ({ diff --git a/examples/for-tests/src/testContext.js b/examples/for-tests/src/testContext.js index 618e990ba..ab1e6e3c5 100644 --- a/examples/for-tests/src/testContext.js +++ b/examples/for-tests/src/testContext.js @@ -23,7 +23,7 @@ export function getEnabledRecipes() { let enabledRecipes = []; - if (testContext.usesDynamicLoginMethods) { + if (true) { if (testContext.clientRecipeListForDynamicLogin) { enabledRecipes = JSON.parse(testContext.clientRecipeListForDynamicLogin); } else { diff --git a/lib/build/emailverification-shared.js b/lib/build/emailverification-shared.js index f025cfe3e..d6a0e2799 100644 --- a/lib/build/emailverification-shared.js +++ b/lib/build/emailverification-shared.js @@ -18,6 +18,22 @@ var _a = genericComponentOverrideContext.createGenericComponentsOverrideContext( useContext = _a[0], Provider = _a[1]; +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +var DEFAULT_VERIFY_EMAIL_PATH = "/verify-email"; + var EmailVerificationClaimClass = /** @class */ (function (_super) { genericComponentOverrideContext.__extends(EmailVerificationClaimClass, _super); function EmailVerificationClaimClass(getRecipeImpl, onFailureRedirection) { @@ -57,22 +73,6 @@ var EmailVerificationClaimClass = /** @class */ (function (_super) { return EmailVerificationClaimClass; })(EmailVerificationWebJS.EmailVerificationClaimClass); -/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. - * - * This software is licensed under the Apache License, Version 2.0 (the - * "License") as published by the Apache Software Foundation. - * - * You may not use this file except in compliance with the License. You may - * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -var DEFAULT_VERIFY_EMAIL_PATH = "/verify-email"; - var getFunctionOverrides = function (onHandleEvent) { return function (originalImp) { return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, originalImp), { diff --git a/lib/build/index2.js b/lib/build/index2.js index 75c54626c..0b24c118d 100644 --- a/lib/build/index2.js +++ b/lib/build/index2.js @@ -408,8 +408,6 @@ var priorityOrder = [ { rid: "thirdparty", includes: ["thirdparty"], factorsProvided: ["thirdparty"] }, ]; function chooseComponentBasedOnFirstFactors(firstFactors, routeComponents) { - console.log("chooseComponentBasedOnFirstFactors"); - console.log({ firstFactors: firstFactors }); var _loop_1 = function (rid, factorsProvided) { if ( firstFactors.length === factorsProvided.length && @@ -420,7 +418,6 @@ function chooseComponentBasedOnFirstFactors(firstFactors, routeComponents) { var matchingComp = routeComponents.find(function (comp) { return comp.recipeID === rid; }); - console.log("exact match", rid, !!matchingComp); if (matchingComp) { return { value: matchingComp }; } @@ -440,18 +437,10 @@ function chooseComponentBasedOnFirstFactors(firstFactors, routeComponents) { var providedByCurrent = factorsProvided.filter(function (id) { return firstFactors.includes(id); }).length; - console.log({ - rid: rid, - providedByCurrent: factorsProvided.filter(function (id) { - return firstFactors.includes(id); - }), - c: providedByCurrent, - }); if (providedByCurrent >= maxProvided) { var matchingComp = routeComponents.find(function (comp) { return comp.recipeID === rid; }); - console.log("new max", rid); if (matchingComp) { maxProvided = providedByCurrent; component = matchingComp; @@ -531,11 +520,6 @@ var RecipeRouter = /** @class */ (function () { }) .includes(comp.recipeID); }); - console.log({ - defaultToStaticList: defaultToStaticList, - matchingNonAuthComponent: !!matchingNonAuthComponent, - componentMatchingRid: !!componentMatchingRid, - }); if (matchingNonAuthComponent) { return matchingNonAuthComponent; } @@ -544,15 +528,12 @@ var RecipeRouter = /** @class */ (function () { } var mfaRecipe = recipe.MultiFactorAuth.getInstance(); if (genericComponentOverrideContext.SuperTokens.usesDynamicLoginMethods === false) { - console.log("usesDynamicLoginMethods false"); if (componentMatchingRid) { return componentMatchingRid; } if (mfaRecipe) { - console.log("mfa enabled"); return chooseComponentBasedOnFirstFactors(mfaRecipe.config.getFirstFactors(), routeComponents); } else { - console.log("returning default"); return defaultComp; } } diff --git a/lib/build/multifactorauth-shared.js b/lib/build/multifactorauth-shared.js index 21a0fff16..4bec6918c 100644 --- a/lib/build/multifactorauth-shared.js +++ b/lib/build/multifactorauth-shared.js @@ -39,6 +39,98 @@ var getFunctionOverrides = function ( }; }; +var MultiFactorAuthClaimClass = /** @class */ (function () { + function MultiFactorAuthClaimClass(getRecipeImpl, getRedirectURL, onFailureRedirection) { + var _this = this; + this.webJSClaim = new MultiFactorAuthWebJS.MultiFactorAuthClaimClass(getRecipeImpl); + this.refresh = this.webJSClaim.refresh; + this.getLastFetchedTime = this.webJSClaim.getLastFetchedTime; + this.getValueFromPayload = this.webJSClaim.getValueFromPayload; + this.id = this.webJSClaim.id; + var defaultOnFailureRedirection = function (_a) { + var reason = _a.reason, + userContext = _a.userContext; + if (reason.nextFactorOptions) { + if (reason.nextFactorOptions.length === 1) { + return getRedirectURL( + { action: "GO_TO_FACTOR", factorId: reason.nextFactorOptions[0] }, + userContext + ); + } else { + return getRedirectURL({ action: "FACTOR_CHOICE_REQUIRED" }, userContext); + } + } + return getRedirectURL({ action: "GO_TO_FACTOR", factorId: reason.factorId }, userContext); + }; + this.validators = genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, this.webJSClaim.validators), + { + hasCompletedDefaultFactors: function (doRedirection, showAccessDeniedOnFailure) { + if (doRedirection === void 0) { + doRedirection = true; + } + if (showAccessDeniedOnFailure === void 0) { + showAccessDeniedOnFailure = true; + } + var orig = _this.webJSClaim.validators.hasCompletedDefaultFactors(); + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, orig), + { + showAccessDeniedOnFailure: showAccessDeniedOnFailure, + onFailureRedirection: + onFailureRedirection !== null && onFailureRedirection !== void 0 + ? onFailureRedirection + : function ( + _a // TODO: feels brittle to rely on reason + ) { + var reason = _a.reason, + userContext = _a.userContext; + return doRedirection + ? defaultOnFailureRedirection({ + reason: reason, + userContext: userContext, + }) + : undefined; + }, + } + ); + }, + hasCompletedFactors: function (requirements, doRedirection, showAccessDeniedOnFailure) { + if (doRedirection === void 0) { + doRedirection = true; + } + if (showAccessDeniedOnFailure === void 0) { + showAccessDeniedOnFailure = true; + } + var orig = _this.webJSClaim.validators.hasCompletedFactors(requirements); + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, orig), + { + showAccessDeniedOnFailure: showAccessDeniedOnFailure, + onFailureRedirection: + onFailureRedirection !== null && onFailureRedirection !== void 0 + ? onFailureRedirection + : function ( + _a // TODO: feels brittle to rely on reason + ) { + var reason = _a.reason, + userContext = _a.userContext; + return doRedirection + ? defaultOnFailureRedirection({ + reason: reason, + userContext: userContext, + }) + : undefined; + }, + } + ); + }, + } + ); + } + return MultiFactorAuthClaimClass; +})(); + /* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. * * This software is licensed under the Apache License, Version 2.0 (the @@ -116,7 +208,7 @@ var MultiFactorAuth = /** @class */ (function (_super) { _this.getDefaultRedirectionURL = function (context) { return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { var chooserPath, redirectInfo; - return genericComponentOverrideContext.__generator(this, function (_a) { + return genericComponentOverrideContext.__generator(this, function (_b) { if (context.action === "FACTOR_CHOICE_REQUIRED") { chooserPath = new NormalisedURLPath__default.default(DEFAULT_FACTOR_CHOOSER_PATH); return [ @@ -199,12 +291,21 @@ var MultiFactorAuth = /** @class */ (function (_super) { return this.firstFactors; }; MultiFactorAuth.prototype.addMFAFactors = function (firstFactors, secondaryFactors) { - var _a, _b; - (_a = this.firstFactors).push.apply(_a, firstFactors); - (_b = this.factorRedirectionInfo).push.apply(_b, secondaryFactors); + var _b, _c; + (_b = this.firstFactors).push.apply(_b, firstFactors); + (_c = this.factorRedirectionInfo).push.apply(_c, secondaryFactors); }; + var _a; + _a = MultiFactorAuth; MultiFactorAuth.RECIPE_ID = "multifactorauth"; - MultiFactorAuth.MultiFactorAuthClaim = MultiFactorAuthWebJS.MultiFactorAuthClaim; + MultiFactorAuth.MultiFactorAuthClaim = new MultiFactorAuthClaimClass( + function () { + return MultiFactorAuth.getInstanceOrThrow().webJSRecipe; + }, + function (context) { + return _a.getInstanceOrThrow().getDefaultRedirectionURL(context); + } + ); return MultiFactorAuth; })(index.RecipeModule); diff --git a/lib/build/passwordless-shared2.js b/lib/build/passwordless-shared2.js index 06f1fa598..addc013cf 100644 --- a/lib/build/passwordless-shared2.js +++ b/lib/build/passwordless-shared2.js @@ -2,7 +2,9 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); var PasswordlessWebJS = require("supertokens-web-js/recipe/passwordless"); +var postSuperTokensInitCallbacks = require("supertokens-web-js/utils/postSuperTokensInitCallbacks"); var utils = require("./authRecipe-shared.js"); +var recipe = require("./multifactorauth-shared.js"); var windowHandler = require("supertokens-web-js/utils/windowHandler"); function _interopDefault(e) { @@ -493,6 +495,22 @@ var Passwordless = /** @class */ (function (_super) { } Passwordless.init = function (config) { var normalisedConfig = normalisePasswordlessConfig(config); + postSuperTokensInitCallbacks.PostSuperTokensInitCallbacks.addPostInitCallback(function () { + var mfa = recipe.MultiFactorAuth.getInstance(); + if (mfa !== undefined) { + mfa.addMFAFactors( + ["otp-phone", "otp-email", "link-phone", "link-email"], + [ + { + id: "otp-phone", + name: "Phone-based OTP", + description: "OTP delivered by a text message", + path: "/check-auth/otp", + }, + ] + ); + } + }); return { recipeID: Passwordless.RECIPE_ID, authReact: function (appInfo) { diff --git a/lib/build/passwordless.js b/lib/build/passwordless.js index f8cba3862..ce950e342 100644 --- a/lib/build/passwordless.js +++ b/lib/build/passwordless.js @@ -20,6 +20,9 @@ require("./authRecipe-shared.js"); require("./recipeModule-shared.js"); require("./session-shared2.js"); require("supertokens-web-js/recipe/session"); +require("./multifactorauth-shared.js"); +require("supertokens-web-js/recipe/multifactorauth"); +require("supertokens-web-js/utils/sessionClaimValidatorStore"); /* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. * diff --git a/lib/build/claims/emailVerificationClaim.d.ts b/lib/build/recipe/emailverification/emailVerificationClaim.d.ts similarity index 86% rename from lib/build/claims/emailVerificationClaim.d.ts rename to lib/build/recipe/emailverification/emailVerificationClaim.d.ts index 1308ba5a1..732815830 100644 --- a/lib/build/claims/emailVerificationClaim.d.ts +++ b/lib/build/recipe/emailverification/emailVerificationClaim.d.ts @@ -1,5 +1,5 @@ import { EmailVerificationClaimClass as EmailVerificationClaimClassWebJS } from "supertokens-web-js/recipe/emailverification"; -import type { ValidationFailureCallback } from "../types"; +import type { ValidationFailureCallback } from "../../types"; import type { RecipeInterface } from "supertokens-web-js/recipe/emailverification"; export declare class EmailVerificationClaimClass extends EmailVerificationClaimClassWebJS { constructor(getRecipeImpl: () => RecipeInterface, onFailureRedirection?: ValidationFailureCallback); diff --git a/lib/build/recipe/emailverification/index.d.ts b/lib/build/recipe/emailverification/index.d.ts index 4a0c471e9..f03efd525 100644 --- a/lib/build/recipe/emailverification/index.d.ts +++ b/lib/build/recipe/emailverification/index.d.ts @@ -4,7 +4,7 @@ import { GetRedirectionURLContext, PreAPIHookContext, OnHandleEventContext } fro import { UserInput } from "./types"; import type { RecipeFunctionOptions } from "supertokens-web-js/recipe/emailverification"; export default class Wrapper { - static EmailVerificationClaim: import("../../claims/emailVerificationClaim").EmailVerificationClaimClass; + static EmailVerificationClaim: import("./emailVerificationClaim").EmailVerificationClaimClass; static init( config?: UserInput ): import("../../types").RecipeInitResult< @@ -43,7 +43,7 @@ declare const EmailVerificationComponentsOverrideProvider: import("react").FC< components: import("./types").ComponentOverrideMap; }> >; -declare const EmailVerificationClaim: import("../../claims/emailVerificationClaim").EmailVerificationClaimClass; +declare const EmailVerificationClaim: import("./emailVerificationClaim").EmailVerificationClaimClass; export { init, isEmailVerified, diff --git a/lib/build/recipe/emailverification/recipe.d.ts b/lib/build/recipe/emailverification/recipe.d.ts index bac2db2ea..5944564d7 100644 --- a/lib/build/recipe/emailverification/recipe.d.ts +++ b/lib/build/recipe/emailverification/recipe.d.ts @@ -1,6 +1,6 @@ import EmailVerificationWebJS from "supertokens-web-js/recipe/emailverification"; -import { EmailVerificationClaimClass } from "../../claims/emailVerificationClaim"; import RecipeModule from "../recipeModule"; +import { EmailVerificationClaimClass } from "./emailVerificationClaim"; import type { UserInput, NormalisedConfig, diff --git a/lib/build/recipe/multifactorauth/index.d.ts b/lib/build/recipe/multifactorauth/index.d.ts index 4794457c1..3b28cd3c9 100644 --- a/lib/build/recipe/multifactorauth/index.d.ts +++ b/lib/build/recipe/multifactorauth/index.d.ts @@ -1,11 +1,11 @@ /// -import { RecipeInterface } from "supertokens-web-js/recipe/emailverification"; +import { RecipeInterface } from "supertokens-web-js/recipe/multifactorauth"; import { GetRedirectionURLContext, PreAPIHookContext, OnHandleEventContext } from "./types"; import { UserInput } from "./types"; -import type { MFAFactorInfo } from "supertokens-web-js/lib/build/recipe/multifactorauth/types"; -import type { RecipeFunctionOptions } from "supertokens-web-js/recipe/emailverification"; +import type { RecipeFunctionOptions } from "supertokens-web-js/recipe/multifactorauth"; +import type { MFAFactorInfo } from "supertokens-web-js/recipe/multifactorauth/types"; export default class Wrapper { - static MultiFactorAuthClaim: import("supertokens-web-js/lib/build/recipe/multifactorauth/multiFactorAuthClaim").MultiFactorAuthClaimClass; + static MultiFactorAuthClaim: import("./multiFactorAuthClaim").MultiFactorAuthClaimClass; static init( config?: UserInput ): import("../../types").RecipeInitResult< @@ -32,7 +32,7 @@ declare const MultiFactorAuthComponentsOverrideProvider: import("react").FC< components: import("./types").ComponentOverrideMap; }> >; -declare const MultiFactorAuthClaim: import("supertokens-web-js/lib/build/recipe/multifactorauth/multiFactorAuthClaim").MultiFactorAuthClaimClass; +declare const MultiFactorAuthClaim: import("./multiFactorAuthClaim").MultiFactorAuthClaimClass; export { init, getMFAInfo, diff --git a/lib/build/recipe/multifactorauth/multiFactorAuthClaim.d.ts b/lib/build/recipe/multifactorauth/multiFactorAuthClaim.d.ts new file mode 100644 index 000000000..7caac34d3 --- /dev/null +++ b/lib/build/recipe/multifactorauth/multiFactorAuthClaim.d.ts @@ -0,0 +1,48 @@ +import { MultiFactorAuthClaimClass as MultiFactorAuthClaimClassWebJS } from "supertokens-web-js/recipe/multifactorauth"; +import type { SessionClaimValidator, ValidationFailureCallback } from "../../types"; +import type { RecipeInterface } from "supertokens-web-js/recipe/multifactorauth"; +import type { MFARequirementList } from "supertokens-web-js/recipe/multifactorauth/types"; +export declare class MultiFactorAuthClaimClass { + private webJSClaim; + readonly id: string; + readonly refresh: (userContext: any) => Promise; + readonly getLastFetchedTime: (payload: any, _userContext?: any) => number | undefined; + readonly getValueFromPayload: ( + payload: any, + _userContext?: any + ) => + | { + c: Record; + n: string[]; + } + | undefined; + validators: Omit< + MultiFactorAuthClaimClassWebJS["validators"], + "hasCompletedDefaultFactors" | "hasCompletedFactors" + > & { + hasCompletedDefaultFactors: ( + doRedirection?: boolean, + showAccessDeniedOnFailure?: boolean + ) => SessionClaimValidator; + hasCompletedFactors: ( + requirements: MFARequirementList, + doRedirection?: boolean, + showAccessDeniedOnFailure?: boolean + ) => SessionClaimValidator; + }; + constructor( + getRecipeImpl: () => RecipeInterface, + getRedirectURL: ( + context: + | { + action: "GO_TO_FACTOR"; + factorId: string; + } + | { + action: "FACTOR_CHOICE_REQUIRED"; + }, + userContext: any + ) => Promise, + onFailureRedirection?: ValidationFailureCallback + ); +} diff --git a/lib/build/recipe/multifactorauth/recipe.d.ts b/lib/build/recipe/multifactorauth/recipe.d.ts index 1abf88682..c4aa11fe1 100644 --- a/lib/build/recipe/multifactorauth/recipe.d.ts +++ b/lib/build/recipe/multifactorauth/recipe.d.ts @@ -1,5 +1,6 @@ import MultiFactorAuthWebJS from "supertokens-web-js/recipe/multifactorauth"; import RecipeModule from "../recipeModule"; +import { MultiFactorAuthClaimClass } from "./multiFactorAuthClaim"; import type { UserInput, NormalisedConfig, @@ -18,7 +19,7 @@ export default class MultiFactorAuth extends RecipeModule< readonly webJSRecipe: WebJSRecipeInterface; static instance?: MultiFactorAuth; static RECIPE_ID: string; - static MultiFactorAuthClaim: import("supertokens-web-js/lib/build/recipe/multifactorauth/multiFactorAuthClaim").MultiFactorAuthClaimClass; + static MultiFactorAuthClaim: MultiFactorAuthClaimClass; recipeID: string; firstFactors: string[]; factorRedirectionInfo: SecondaryFactorRedirectionInfo[]; diff --git a/lib/build/thirdpartypasswordless.js b/lib/build/thirdpartypasswordless.js index 7de9631c9..796cbe40c 100644 --- a/lib/build/thirdpartypasswordless.js +++ b/lib/build/thirdpartypasswordless.js @@ -26,6 +26,9 @@ require("supertokens-web-js/lib/build/normalisedURLPath"); require("supertokens-web-js/recipe/thirdpartypasswordless"); require("./passwordless-shared2.js"); require("supertokens-web-js/recipe/passwordless"); +require("./multifactorauth-shared.js"); +require("supertokens-web-js/recipe/multifactorauth"); +require("supertokens-web-js/utils/sessionClaimValidatorStore"); var Wrapper = /** @class */ (function () { function Wrapper() {} diff --git a/lib/ts/claims/emailVerificationClaim.ts b/lib/ts/recipe/emailverification/emailVerificationClaim.ts similarity index 92% rename from lib/ts/claims/emailVerificationClaim.ts rename to lib/ts/recipe/emailverification/emailVerificationClaim.ts index ec735c115..a1929fb26 100644 --- a/lib/ts/claims/emailVerificationClaim.ts +++ b/lib/ts/recipe/emailverification/emailVerificationClaim.ts @@ -1,8 +1,8 @@ import { EmailVerificationClaimClass as EmailVerificationClaimClassWebJS } from "supertokens-web-js/recipe/emailverification"; -import EmailVerification from "../recipe/emailverification/recipe"; +import EmailVerification from "./recipe"; -import type { ValidationFailureCallback } from "../types"; +import type { ValidationFailureCallback } from "../../types"; import type { RecipeInterface } from "supertokens-web-js/recipe/emailverification"; export class EmailVerificationClaimClass extends EmailVerificationClaimClassWebJS { diff --git a/lib/ts/recipe/emailverification/recipe.tsx b/lib/ts/recipe/emailverification/recipe.tsx index 8d2acc62e..411f31e78 100644 --- a/lib/ts/recipe/emailverification/recipe.tsx +++ b/lib/ts/recipe/emailverification/recipe.tsx @@ -22,11 +22,11 @@ import NormalisedURLPath from "supertokens-web-js/utils/normalisedURLPath"; import { PostSuperTokensInitCallbacks } from "supertokens-web-js/utils/postSuperTokensInitCallbacks"; import { SessionClaimValidatorStore } from "supertokens-web-js/utils/sessionClaimValidatorStore"; -import { EmailVerificationClaimClass } from "../../claims/emailVerificationClaim"; import { SSR_ERROR } from "../../constants"; import RecipeModule from "../recipeModule"; import { DEFAULT_VERIFY_EMAIL_PATH } from "./constants"; +import { EmailVerificationClaimClass } from "./emailVerificationClaim"; import { getFunctionOverrides } from "./functionOverrides"; import { normaliseEmailVerificationFeature } from "./utils"; diff --git a/lib/ts/recipe/multifactorauth/index.ts b/lib/ts/recipe/multifactorauth/index.ts index 572c17f70..5161e7145 100644 --- a/lib/ts/recipe/multifactorauth/index.ts +++ b/lib/ts/recipe/multifactorauth/index.ts @@ -16,7 +16,7 @@ /* * Imports. */ -import { RecipeInterface } from "supertokens-web-js/recipe/emailverification"; +import { RecipeInterface } from "supertokens-web-js/recipe/multifactorauth"; import { getNormalisedUserContext } from "../../utils"; @@ -25,8 +25,8 @@ import MultiFactorAuthRecipe from "./recipe"; import { GetRedirectionURLContext, PreAPIHookContext, OnHandleEventContext } from "./types"; import { UserInput } from "./types"; -import type { MFAFactorInfo } from "supertokens-web-js/lib/build/recipe/multifactorauth/types"; -import type { RecipeFunctionOptions } from "supertokens-web-js/recipe/emailverification"; +import type { RecipeFunctionOptions } from "supertokens-web-js/recipe/multifactorauth"; +import type { MFAFactorInfo } from "supertokens-web-js/recipe/multifactorauth/types"; export default class Wrapper { static MultiFactorAuthClaim = MultiFactorAuthRecipe.MultiFactorAuthClaim; diff --git a/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts b/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts new file mode 100644 index 000000000..4e9428f10 --- /dev/null +++ b/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts @@ -0,0 +1,92 @@ +import { MultiFactorAuthClaimClass as MultiFactorAuthClaimClassWebJS } from "supertokens-web-js/recipe/multifactorauth"; + +import type { SessionClaimValidator, ValidationFailureCallback } from "../../types"; +import type { RecipeInterface } from "supertokens-web-js/recipe/multifactorauth"; +import type { MFARequirementList } from "supertokens-web-js/recipe/multifactorauth/types"; + +export class MultiFactorAuthClaimClass { + private webJSClaim: MultiFactorAuthClaimClassWebJS; + public readonly id: string; + public readonly refresh: (userContext: any) => Promise; + public readonly getLastFetchedTime: (payload: any, _userContext?: any) => number | undefined; + public readonly getValueFromPayload: ( + payload: any, + _userContext?: any + ) => { c: Record; n: string[] } | undefined; + public validators: Omit< + MultiFactorAuthClaimClassWebJS["validators"], + "hasCompletedDefaultFactors" | "hasCompletedFactors" + > & { + hasCompletedDefaultFactors: ( + doRedirection?: boolean, + showAccessDeniedOnFailure?: boolean + ) => SessionClaimValidator; + hasCompletedFactors: ( + requirements: MFARequirementList, + doRedirection?: boolean, + showAccessDeniedOnFailure?: boolean + ) => SessionClaimValidator; + }; + + constructor( + getRecipeImpl: () => RecipeInterface, + getRedirectURL: ( + context: { action: "GO_TO_FACTOR"; factorId: string } | { action: "FACTOR_CHOICE_REQUIRED" }, + userContext: any + ) => Promise, + onFailureRedirection?: ValidationFailureCallback + ) { + this.webJSClaim = new MultiFactorAuthClaimClassWebJS(getRecipeImpl); + this.refresh = this.webJSClaim.refresh; + this.getLastFetchedTime = this.webJSClaim.getLastFetchedTime; + this.getValueFromPayload = this.webJSClaim.getValueFromPayload; + this.id = this.webJSClaim.id; + + const defaultOnFailureRedirection = ({ reason, userContext }: any) => { + if (reason.nextFactorOptions) { + if (reason.nextFactorOptions.length === 1) { + return getRedirectURL( + { action: "GO_TO_FACTOR", factorId: reason.nextFactorOptions[0] }, + userContext + ); + } else { + return getRedirectURL({ action: "FACTOR_CHOICE_REQUIRED" }, userContext); + } + } + return getRedirectURL({ action: "GO_TO_FACTOR", factorId: reason.factorId }, userContext); + }; + + this.validators = { + ...this.webJSClaim.validators, + hasCompletedDefaultFactors: (doRedirection = true, showAccessDeniedOnFailure = true) => { + const orig = this.webJSClaim.validators.hasCompletedDefaultFactors(); + return { + ...orig, + showAccessDeniedOnFailure, + onFailureRedirection: + onFailureRedirection ?? + (( + { reason, userContext } // TODO: feels brittle to rely on reason + ) => (doRedirection ? defaultOnFailureRedirection({ reason, userContext }) : undefined)), + }; + }, + + hasCompletedFactors: ( + requirements: MFARequirementList, + doRedirection = true, + showAccessDeniedOnFailure = true + ) => { + const orig = this.webJSClaim.validators.hasCompletedFactors(requirements); + return { + ...orig, + showAccessDeniedOnFailure, + onFailureRedirection: + onFailureRedirection ?? + (( + { reason, userContext } // TODO: feels brittle to rely on reason + ) => (doRedirection ? defaultOnFailureRedirection({ reason, userContext }) : undefined)), + }; + }, + }; + } +} diff --git a/lib/ts/recipe/multifactorauth/recipe.tsx b/lib/ts/recipe/multifactorauth/recipe.tsx index e6a71bb36..051385c43 100644 --- a/lib/ts/recipe/multifactorauth/recipe.tsx +++ b/lib/ts/recipe/multifactorauth/recipe.tsx @@ -18,7 +18,6 @@ */ import MultiFactorAuthWebJS from "supertokens-web-js/recipe/multifactorauth"; -import { MultiFactorAuthClaim } from "supertokens-web-js/recipe/multifactorauth"; import NormalisedURLPath from "supertokens-web-js/utils/normalisedURLPath"; import { PostSuperTokensInitCallbacks } from "supertokens-web-js/utils/postSuperTokensInitCallbacks"; import { SessionClaimValidatorStore } from "supertokens-web-js/utils/sessionClaimValidatorStore"; @@ -28,6 +27,7 @@ import RecipeModule from "../recipeModule"; import { DEFAULT_FACTOR_CHOOSER_PATH } from "./constants"; import { getFunctionOverrides } from "./functionOverrides"; +import { MultiFactorAuthClaimClass } from "./multiFactorAuthClaim"; import { normaliseMultiFactorAuthFeature } from "./utils"; import type { @@ -50,7 +50,10 @@ export default class MultiFactorAuth extends RecipeModule< static instance?: MultiFactorAuth; static RECIPE_ID = "multifactorauth"; - static MultiFactorAuthClaim = MultiFactorAuthClaim; + static MultiFactorAuthClaim = new MultiFactorAuthClaimClass( + () => MultiFactorAuth.getInstanceOrThrow().webJSRecipe, + (context) => this.getInstanceOrThrow().getDefaultRedirectionURL(context) + ); public recipeID = MultiFactorAuth.RECIPE_ID; public firstFactors: string[] = []; diff --git a/lib/ts/recipe/passwordless/recipe.tsx b/lib/ts/recipe/passwordless/recipe.tsx index 6a2fe6ac6..e0075cf5b 100644 --- a/lib/ts/recipe/passwordless/recipe.tsx +++ b/lib/ts/recipe/passwordless/recipe.tsx @@ -18,10 +18,12 @@ */ import PasswordlessWebJS from "supertokens-web-js/recipe/passwordless"; +import { PostSuperTokensInitCallbacks } from "supertokens-web-js/utils/postSuperTokensInitCallbacks"; import { SSR_ERROR } from "../../constants"; import { isTest } from "../../utils"; import AuthRecipe from "../authRecipe"; +import MultiFactorAuth from "../multifactorauth/recipe"; import { getFunctionOverrides } from "./functionOverrides"; import { normalisePasswordlessConfig } from "./utils"; @@ -67,6 +69,23 @@ export default class Passwordless extends AuthRecipe< ): RecipeInitResult { const normalisedConfig = normalisePasswordlessConfig(config); + PostSuperTokensInitCallbacks.addPostInitCallback(() => { + const mfa = MultiFactorAuth.getInstance(); + if (mfa !== undefined) { + mfa.addMFAFactors( + ["otp-phone", "otp-email", "link-phone", "link-email"], + [ + { + id: "otp-phone", + name: "Phone-based OTP", + description: "OTP delivered by a text message", + path: "/check-auth/otp", + }, + ] + ); + } + }); + return { recipeID: Passwordless.RECIPE_ID, authReact: ( diff --git a/test/server/index.js b/test/server/index.js index f001d7fdb..c112eca70 100644 --- a/test/server/index.js +++ b/test/server/index.js @@ -382,6 +382,18 @@ app.post( } ); +app.post("/payload", verifySession(), async (req, res) => { + let session = req.session; + + await session.mergeIntoAccessTokenPayload(req.body); + + res.send({ status: "OK" }); +}); + +app.get("/auth/mfa/info", (req, res) => { + res.send({ status: "OK" }); +}); + app.get("/token", async (_, res) => { res.send({ latestURLWithToken, From 8932a0ef38588e147863c352972f7aa4418b62fa Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Tue, 17 Oct 2023 01:50:01 +0200 Subject: [PATCH 06/35] feat: implement factor chooser screen --- .../for-tests/src/AppWithReactDomRouter.js | 3 +- lib/build/SuperTokensBranding.js | 67 - lib/build/authRecipe-shared2.js | 72 + lib/build/components/assets/linkIcon.d.ts | 2 + lib/build/components/assets/otpIcon.d.ts | 2 + lib/build/emailpassword-shared.js | 33 +- lib/build/emailpassword-shared2.js | 26 +- lib/build/emailpassword-shared3.js | 30 +- lib/build/emailpassword-shared4.js | 509 +++- lib/build/emailpassword-shared5.js | 556 +---- lib/build/emailpassword-shared6.js | 1613 ++++++++++++- lib/build/emailpassword-shared7.js | 2052 +++++------------ lib/build/emailpassword-shared8.js | 774 ------- lib/build/emailpassword.js | 6 +- lib/build/emailpasswordprebuiltui.js | 16 +- lib/build/emailverification-shared2.js | 24 + lib/build/emailverificationprebuiltui.js | 9 +- lib/build/multifactorauth-shared.js | 11 +- lib/build/multifactorauthprebuiltui.js | 263 ++- lib/build/passwordless-shared2.js | 101 +- lib/build/passwordless-shared3.js | 13 +- lib/build/passwordlessprebuiltui.js | 9 +- .../features/factorChooser/index.d.ts | 4 +- .../factorChooser/factorChooserFooter.d.ts | 4 + .../factorChooser/factorChooserHeader.d.ts | 2 + .../themes/factorChooser/factorList.d.ts | 8 + .../themes/factorChooser/factorOption.d.ts | 7 + .../components/themes/themeBase.d.ts | 8 + .../components/themes/translations.d.ts | 20 +- .../recipe/multifactorauth/constants.d.ts | 2 +- lib/build/recipe/multifactorauth/types.d.ts | 7 + .../components/features/mfa/index.d.ts | 38 + lib/build/thirdparty-shared2.js | 7 +- lib/build/thirdpartyemailpassword-shared.js | 2 +- lib/build/thirdpartyemailpassword.js | 4 +- .../thirdpartyemailpasswordprebuiltui.js | 22 +- lib/build/thirdpartypasswordlessprebuiltui.js | 13 +- lib/build/thirdpartyprebuiltui.js | 5 +- lib/ts/components/assets/linkIcon.tsx | 12 + lib/ts/components/assets/otpIcon.tsx | 32 + .../features/factorChooser/index.tsx | 44 +- .../factorChooser/factorChooserFooter.tsx | 33 + .../factorChooser/factorChooserHeader.tsx | 29 + .../themes/factorChooser/factorList.tsx | 47 + .../themes/factorChooser/factorOption.tsx | 49 + .../components/themes/factorChooser/index.tsx | 22 +- .../components/themes/styles.css | 64 + .../components/themes/themeBase.tsx | 41 + .../components/themes/translations.ts | 20 +- lib/ts/recipe/multifactorauth/constants.ts | 2 +- lib/ts/recipe/multifactorauth/prebuiltui.tsx | 6 +- lib/ts/recipe/multifactorauth/recipe.tsx | 4 +- lib/ts/recipe/multifactorauth/types.ts | 8 + .../components/features/mfa/index.tsx | 397 ++++ lib/ts/recipe/passwordless/recipe.tsx | 31 +- test/server/index.js | 20 +- 56 files changed, 4161 insertions(+), 3044 deletions(-) create mode 100644 lib/build/authRecipe-shared2.js create mode 100644 lib/build/components/assets/linkIcon.d.ts create mode 100644 lib/build/components/assets/otpIcon.d.ts delete mode 100644 lib/build/emailpassword-shared8.js create mode 100644 lib/build/recipe/multifactorauth/components/themes/factorChooser/factorChooserFooter.d.ts create mode 100644 lib/build/recipe/multifactorauth/components/themes/factorChooser/factorChooserHeader.d.ts create mode 100644 lib/build/recipe/multifactorauth/components/themes/factorChooser/factorList.d.ts create mode 100644 lib/build/recipe/multifactorauth/components/themes/factorChooser/factorOption.d.ts create mode 100644 lib/build/recipe/multifactorauth/components/themes/themeBase.d.ts create mode 100644 lib/build/recipe/passwordless/components/features/mfa/index.d.ts create mode 100644 lib/ts/components/assets/linkIcon.tsx create mode 100644 lib/ts/components/assets/otpIcon.tsx create mode 100644 lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorChooserFooter.tsx create mode 100644 lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorChooserHeader.tsx create mode 100644 lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorList.tsx create mode 100644 lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorOption.tsx create mode 100644 lib/ts/recipe/multifactorauth/components/themes/styles.css create mode 100644 lib/ts/recipe/multifactorauth/components/themes/themeBase.tsx create mode 100644 lib/ts/recipe/passwordless/components/features/mfa/index.tsx diff --git a/examples/for-tests/src/AppWithReactDomRouter.js b/examples/for-tests/src/AppWithReactDomRouter.js index a00f6c35a..7c007ceb8 100644 --- a/examples/for-tests/src/AppWithReactDomRouter.js +++ b/examples/for-tests/src/AppWithReactDomRouter.js @@ -15,6 +15,7 @@ import { PasswordlessPreBuiltUI } from "supertokens-auth-react/recipe/passwordle import { EmailVerificationPreBuiltUI } from "supertokens-auth-react/recipe/emailverification/prebuiltui"; import { ThirdPartyPreBuiltUI } from "supertokens-auth-react/recipe/thirdparty/prebuiltui"; import { AccessDeniedScreen } from "supertokens-auth-react/recipe/session/prebuiltui"; +import { MultiFactorAuthPreBuiltUI } from "supertokens-auth-react/recipe/multifactorauth/prebuiltui"; import { BaseComponent, Home, Contact, Dashboard, DashboardNoAuthRequired } from "./App"; import { getEnabledRecipes } from "./testContext"; @@ -34,7 +35,7 @@ function AppWithReactDomRouter(props) { const emailVerificationMode = window.localStorage.getItem("mode") || "OFF"; const websiteBasePath = window.localStorage.getItem("websiteBasePath") || undefined; - let recipePreBuiltUIList = []; + let recipePreBuiltUIList = [MultiFactorAuthPreBuiltUI]; if (enabledRecipes.includes("emailpassword")) { recipePreBuiltUIList.push(EmailPasswordPreBuiltUI); } diff --git a/lib/build/SuperTokensBranding.js b/lib/build/SuperTokensBranding.js index fad0aaeab..b236e0fda 100644 --- a/lib/build/SuperTokensBranding.js +++ b/lib/build/SuperTokensBranding.js @@ -2,74 +2,8 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); var jsxRuntime = require("react/jsx-runtime"); -var React = require("react"); -var uiEntry = require("./index2.js"); -var session = require("./session-shared3.js"); -var recipe = require("./session-shared2.js"); var translationContext = require("./translationContext.js"); -/** - * AuthWidgetWrapper shows the children component only if no session exists, - * else it calls onSessionAlreadyExists - */ -var AuthWidgetWrapper = function (props) { - return jsxRuntime.jsx( - session.SessionAuth, - genericComponentOverrideContext.__assign( - { requireAuth: false, doRedirection: false }, - { children: jsxRuntime.jsx(Redirector, genericComponentOverrideContext.__assign({}, props)) } - ) - ); -}; -var Redirector = function (props) { - var sessionContext = React.useContext(uiEntry.SessionContext); - var userContext = uiEntry.useUserContext(); - var _a = React.useState(false), - alwaysShow = _a[0], - updateAlwaysShow = _a[1]; - React.useEffect( - function () { - // we want to do this just once, so we supply it with only the loading state. - // if we supply it with props, sessionContext, then once the user signs in, then this will route the - // user to the dashboard, as opposed to the sign up / sign in functions. - if (sessionContext.loading === false) { - if (sessionContext.doesSessionExist) { - if (props.onSessionAlreadyExists !== undefined) { - props.onSessionAlreadyExists(); - } else { - props.authRecipe.config.onHandleEvent({ - action: "SESSION_ALREADY_EXISTS", - }); - void recipe.Session.getInstanceOrThrow().validateGlobalClaimsAndHandleSuccessRedirection( - { - rid: props.authRecipe.config.recipeId, - successRedirectContext: { - action: "SUCCESS", - isNewRecipeUser: false, - user: undefined, - redirectToPath: genericComponentOverrideContext.getRedirectToPathFromURL(), - }, - }, - userContext, - props.history - ); - } - } else { - // this means even if a session exists, we will still show the children - // cause the child component will take care of redirecting etc.. - updateAlwaysShow(true); - } - } - }, - [sessionContext.loading] - ); - if ((sessionContext.loading === true || sessionContext.doesSessionExist) && !alwaysShow) { - return null; - } else { - return jsxRuntime.jsx(jsxRuntime.Fragment, { children: props.children }); - } -}; - function SuperTokensBranding() { var t = translationContext.useTranslation(); return jsxRuntime.jsxs( @@ -91,5 +25,4 @@ function SuperTokensBranding() { ); } -exports.AuthWidgetWrapper = AuthWidgetWrapper; exports.SuperTokensBranding = SuperTokensBranding; diff --git a/lib/build/authRecipe-shared2.js b/lib/build/authRecipe-shared2.js new file mode 100644 index 000000000..e03259ffa --- /dev/null +++ b/lib/build/authRecipe-shared2.js @@ -0,0 +1,72 @@ +"use strict"; + +var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); +var jsxRuntime = require("react/jsx-runtime"); +var React = require("react"); +var uiEntry = require("./index2.js"); +var session = require("./session-shared3.js"); +var recipe = require("./session-shared2.js"); + +/** + * AuthWidgetWrapper shows the children component only if no session exists, + * else it calls onSessionAlreadyExists + */ +var AuthWidgetWrapper = function (props) { + return jsxRuntime.jsx( + session.SessionAuth, + genericComponentOverrideContext.__assign( + { requireAuth: false, doRedirection: false }, + { children: jsxRuntime.jsx(Redirector, genericComponentOverrideContext.__assign({}, props)) } + ) + ); +}; +var Redirector = function (props) { + var sessionContext = React.useContext(uiEntry.SessionContext); + var userContext = uiEntry.useUserContext(); + var _a = React.useState(false), + alwaysShow = _a[0], + updateAlwaysShow = _a[1]; + React.useEffect( + function () { + // we want to do this just once, so we supply it with only the loading state. + // if we supply it with props, sessionContext, then once the user signs in, then this will route the + // user to the dashboard, as opposed to the sign up / sign in functions. + if (sessionContext.loading === false) { + if (sessionContext.doesSessionExist) { + if (props.onSessionAlreadyExists !== undefined) { + props.onSessionAlreadyExists(); + } else { + props.authRecipe.config.onHandleEvent({ + action: "SESSION_ALREADY_EXISTS", + }); + void recipe.Session.getInstanceOrThrow().validateGlobalClaimsAndHandleSuccessRedirection( + { + rid: props.authRecipe.config.recipeId, + successRedirectContext: { + action: "SUCCESS", + isNewRecipeUser: false, + user: undefined, + redirectToPath: genericComponentOverrideContext.getRedirectToPathFromURL(), + }, + }, + userContext, + props.history + ); + } + } else { + // this means even if a session exists, we will still show the children + // cause the child component will take care of redirecting etc.. + updateAlwaysShow(true); + } + } + }, + [sessionContext.loading] + ); + if ((sessionContext.loading === true || sessionContext.doesSessionExist) && !alwaysShow) { + return null; + } else { + return jsxRuntime.jsx(jsxRuntime.Fragment, { children: props.children }); + } +}; + +exports.AuthWidgetWrapper = AuthWidgetWrapper; diff --git a/lib/build/components/assets/linkIcon.d.ts b/lib/build/components/assets/linkIcon.d.ts new file mode 100644 index 000000000..35d45fe65 --- /dev/null +++ b/lib/build/components/assets/linkIcon.d.ts @@ -0,0 +1,2 @@ +/// +export declare const LinkIcon: () => JSX.Element; diff --git a/lib/build/components/assets/otpIcon.d.ts b/lib/build/components/assets/otpIcon.d.ts new file mode 100644 index 000000000..bcb7b9c12 --- /dev/null +++ b/lib/build/components/assets/otpIcon.d.ts @@ -0,0 +1,2 @@ +/// +export declare const OTPIcon: () => JSX.Element; diff --git a/lib/build/emailpassword-shared.js b/lib/build/emailpassword-shared.js index fd2e82a3d..de43f35f2 100644 --- a/lib/build/emailpassword-shared.js +++ b/lib/build/emailpassword-shared.js @@ -1,27 +1,16 @@ "use strict"; +var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); var jsxRuntime = require("react/jsx-runtime"); -var React = require("react"); +var translationContext = require("./translationContext.js"); -var styles = - '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n\n[data-supertokens~="resetPasswordHeaderTitle"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n'; +function GeneralError(_a) { + var error = _a.error; + var t = translationContext.useTranslation(); + return jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign({ "data-supertokens": "generalError" }, { children: t(error) }) + ); +} -var ThemeBase = function (_a) { - var children = _a.children, - userStyles = _a.userStyles, - loadDefaultFont = _a.loadDefaultFont; - return jsxRuntime.jsxs(React.Fragment, { - children: [ - children, - loadDefaultFont && - jsxRuntime.jsx("link", { - href: "//fonts.googleapis.com/css?family=Rubik:wght@300;400;600;500;700", - rel: "stylesheet", - type: "text/css", - }), - jsxRuntime.jsxs("style", { children: [styles, userStyles.join("\n")] }), - ], - }); -}; - -exports.ThemeBase = ThemeBase; +exports.GeneralError = GeneralError; diff --git a/lib/build/emailpassword-shared2.js b/lib/build/emailpassword-shared2.js index de43f35f2..2cf2045e7 100644 --- a/lib/build/emailpassword-shared2.js +++ b/lib/build/emailpassword-shared2.js @@ -2,15 +2,29 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); var jsxRuntime = require("react/jsx-runtime"); +require("./index2.js"); var translationContext = require("./translationContext.js"); -function GeneralError(_a) { - var error = _a.error; +/* + * Component. + */ +function Button(_a) { + var type = _a.type, + label = _a.label, + disabled = _a.disabled, + isLoading = _a.isLoading, + onClick = _a.onClick; var t = translationContext.useTranslation(); - return jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign({ "data-supertokens": "generalError" }, { children: t(error) }) + if (disabled === undefined) { + disabled = false; + } + return jsxRuntime.jsxs( + "button", + genericComponentOverrideContext.__assign( + { type: type, disabled: disabled, onClick: onClick, "data-supertokens": "button" }, + { children: [t(label), isLoading && "..."] } + ) ); } -exports.GeneralError = GeneralError; +exports.Button = Button; diff --git a/lib/build/emailpassword-shared3.js b/lib/build/emailpassword-shared3.js index 2cf2045e7..bd3b554b5 100644 --- a/lib/build/emailpassword-shared3.js +++ b/lib/build/emailpassword-shared3.js @@ -1,30 +1,10 @@ "use strict"; var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); -var jsxRuntime = require("react/jsx-runtime"); -require("./index2.js"); -var translationContext = require("./translationContext.js"); -/* - * Component. - */ -function Button(_a) { - var type = _a.type, - label = _a.label, - disabled = _a.disabled, - isLoading = _a.isLoading, - onClick = _a.onClick; - var t = translationContext.useTranslation(); - if (disabled === undefined) { - disabled = false; - } - return jsxRuntime.jsxs( - "button", - genericComponentOverrideContext.__assign( - { type: type, disabled: disabled, onClick: onClick, "data-supertokens": "button" }, - { children: [t(label), isLoading && "..."] } - ) - ); -} +var _a = genericComponentOverrideContext.createGenericComponentsOverrideContext(), + useContext = _a[0], + Provider = _a[1]; -exports.Button = Button; +exports.Provider = Provider; +exports.useContext = useContext; diff --git a/lib/build/emailpassword-shared4.js b/lib/build/emailpassword-shared4.js index bd3b554b5..e3070936a 100644 --- a/lib/build/emailpassword-shared4.js +++ b/lib/build/emailpassword-shared4.js @@ -1,10 +1,509 @@ "use strict"; var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); +var EmailPasswordWebJS = require("supertokens-web-js/recipe/emailpassword"); +var NormalisedURLPath = require("supertokens-web-js/utils/normalisedURLPath"); +var utils = require("./authRecipe-shared.js"); +var validators = require("./emailpassword-shared5.js"); -var _a = genericComponentOverrideContext.createGenericComponentsOverrideContext(), - useContext = _a[0], - Provider = _a[1]; +function _interopDefault(e) { + return e && e.__esModule ? e : { default: e }; +} -exports.Provider = Provider; -exports.useContext = useContext; +var EmailPasswordWebJS__default = /*#__PURE__*/ _interopDefault(EmailPasswordWebJS); +var NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath); + +var getFunctionOverrides = function (onHandleEvent) { + return function (originalImp) { + return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, originalImp), { + submitNewPassword: function (input) { + return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { + var response; + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + return [ + 4 /*yield*/, + originalImp.submitNewPassword( + genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, input), + { formFields: [input.formFields[0]] } + ) + ), + ]; + case 1: + response = _a.sent(); + if (response.status === "OK") { + onHandleEvent({ + action: "PASSWORD_RESET_SUCCESSFUL", + userContext: input.userContext, + }); + } + return [2 /*return*/, response]; + } + }); + }); + }, + sendPasswordResetEmail: function (input) { + return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { + var response; + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + return [4 /*yield*/, originalImp.sendPasswordResetEmail(input)]; + case 1: + response = _a.sent(); + if (response.status === "OK") { + onHandleEvent({ + action: "RESET_PASSWORD_EMAIL_SENT", + email: input.formFields.find(function (_a) { + var id = _a.id; + return id === "email"; + }).value, + userContext: input.userContext, + }); + } + return [2 /*return*/, response]; + } + }); + }); + }, + signUp: function (input) { + return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { + var response; + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + return [4 /*yield*/, originalImp.signUp(input)]; + case 1: + response = _a.sent(); + if (response.status === "OK") { + onHandleEvent({ + action: "SUCCESS", + isNewRecipeUser: true, + user: response.user, + userContext: input.userContext, + }); + } + return [2 /*return*/, response]; + } + }); + }); + }, + signIn: function (input) { + return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { + var response; + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + return [4 /*yield*/, originalImp.signIn(input)]; + case 1: + response = _a.sent(); + if (response.status === "OK") { + onHandleEvent({ + action: "SUCCESS", + isNewRecipeUser: false, + user: response.user, + userContext: input.userContext, + }); + } + return [2 /*return*/, response]; + } + }); + }); + }, + }); + }; +}; + +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +function normaliseEmailPasswordConfig(config) { + if (config === undefined) { + config = {}; + } + var signInAndUpFeature = normaliseSignInAndUpFeature(config.signInAndUpFeature); + var signUpPasswordField = signInAndUpFeature.signUpForm.formFields.find(function (field) { + return field.id === "password"; + }); + var signUpEmailField = signInAndUpFeature.signUpForm.formFields.find(function (field) { + return field.id === "email"; + }); + var resetPasswordUsingTokenFeature = normaliseResetPasswordUsingTokenFeature( + signUpPasswordField.validate, + signUpEmailField, + config.resetPasswordUsingTokenFeature + ); + var override = genericComponentOverrideContext.__assign( + { + functions: function (originalImplementation) { + return originalImplementation; + }, + }, + config.override + ); + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, utils.normaliseAuthRecipe(config)), + { + signInAndUpFeature: signInAndUpFeature, + resetPasswordUsingTokenFeature: resetPasswordUsingTokenFeature, + override: override, + } + ); +} +function normaliseSignInAndUpFeature(config) { + if (config === undefined) { + config = {}; + } + var disableDefaultUI = config.disableDefaultUI === true; + var signUpForm = normaliseSignUpFormFeatureConfig(config.signUpForm); + var defaultToSignUp = config.defaultToSignUp !== undefined ? config.defaultToSignUp : false; + /* + * Default Sign In corresponds to computed Sign Up fields filtered by email and password only. + * i.e. If the user overrides sign Up fields, that is propagated to default sign In fields. + * Exception made of the password validator which only verifies that the value is not empty for login + * https://github.com/supertokens/supertokens-auth-react/issues/21 + */ + var defaultSignInFields = signUpForm.formFields.reduce(function (signInFieldsAccumulator, field) { + if (field.id === "email") { + return genericComponentOverrideContext.__spreadArray( + genericComponentOverrideContext.__spreadArray([], signInFieldsAccumulator, true), + [field], + false + ); + } + if (field.id === "password") { + return genericComponentOverrideContext.__spreadArray( + genericComponentOverrideContext.__spreadArray([], signInFieldsAccumulator, true), + [ + genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, field), { + autoComplete: "current-password", + validate: validators.defaultLoginPasswordValidator, + }), + ], + false + ); + } + return signInFieldsAccumulator; + }, []); + var signInForm = normaliseSignInFormFeatureConfig(defaultSignInFields, config.signInForm); + return { + disableDefaultUI: disableDefaultUI, + defaultToSignUp: defaultToSignUp, + signUpForm: signUpForm, + signInForm: signInForm, + }; +} +function normaliseSignUpFormFeatureConfig(config) { + if (config === undefined) { + config = {}; + } + var defaultFormFields = getDefaultFormFields(); + var userFormFields = []; + if (config.formFields !== undefined) { + userFormFields = config.formFields; + } + var formFields = mergeFormFields(defaultFormFields, userFormFields); + var privacyPolicyLink = config.privacyPolicyLink; + var termsOfServiceLink = config.termsOfServiceLink; + var style = config.style !== undefined ? config.style : ""; + return { + style: style, + formFields: formFields, + privacyPolicyLink: privacyPolicyLink, + termsOfServiceLink: termsOfServiceLink, + }; +} +function normaliseSignInFormFeatureConfig(defaultFormFields, config) { + if (config === undefined) { + config = {}; + } + var userFormFields = []; + if (config.formFields !== undefined) { + userFormFields = config.formFields + // Filter on email and password only. + .filter(function (field) { + return validators.MANDATORY_FORM_FIELDS_ID_ARRAY.includes(field.id); + }) + // Sign In fields are never optional. + .map(function (field) { + return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, field), { + optional: false, + }); + }); + } + var formFields = mergeFormFields(defaultFormFields, userFormFields); + var style = config.style !== undefined ? config.style : ""; + return { + style: style, + formFields: formFields, + }; +} +function getDefaultFormFields() { + return [getDefaultEmailFormField(), getDefaultPasswordFormField()]; +} +function getDefaultEmailFormField() { + return { + id: "email", + label: "EMAIL_PASSWORD_EMAIL_LABEL", + placeholder: "EMAIL_PASSWORD_EMAIL_PLACEHOLDER", + validate: validators.defaultEmailValidator, + optional: false, + autoComplete: "email", + }; +} +function getDefaultPasswordFormField() { + return { + id: "password", + label: "EMAIL_PASSWORD_PASSWORD_LABEL", + placeholder: "EMAIL_PASSWORD_PASSWORD_PLACEHOLDER", + validate: validators.defaultPasswordValidator, + optional: false, + autoComplete: "new-password", + }; +} +function normaliseResetPasswordUsingTokenFeature(signUpPasswordFieldValidate, signUpEmailField, config) { + if (config === undefined) { + config = {}; + } + var disableDefaultUI = config.disableDefaultUI === true; + var submitNewPasswordFormStyle = + config.submitNewPasswordForm !== undefined && config.submitNewPasswordForm.style !== undefined + ? config.submitNewPasswordForm.style + : ""; + var submitNewPasswordForm = { + style: submitNewPasswordFormStyle, + formFields: [ + { + id: "password", + label: "EMAIL_PASSWORD_NEW_PASSWORD_LABEL", + placeholder: "EMAIL_PASSWORD_NEW_PASSWORD_PLACEHOLDER", + validate: signUpPasswordFieldValidate, + optional: false, + autoComplete: "new-password", + }, + { + id: "confirm-password", + label: "EMAIL_PASSWORD_CONFIRM_PASSWORD_LABEL", + placeholder: "EMAIL_PASSWORD_CONFIRM_PASSWORD_PLACEHOLDER", + validate: signUpPasswordFieldValidate, + optional: false, + autoComplete: "new-password", + }, + ], + }; + var enterEmailFormStyle = + config.enterEmailForm !== undefined && config.enterEmailForm.style !== undefined + ? config.enterEmailForm.style + : ""; + var enterEmailForm = { + style: enterEmailFormStyle, + formFields: [ + genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, getDefaultEmailFormField()), + { validate: signUpEmailField.validate, placeholder: "", autofocus: true } + ), + ], + }; + return { + disableDefaultUI: disableDefaultUI, + submitNewPasswordForm: submitNewPasswordForm, + enterEmailForm: enterEmailForm, + }; +} +/* + * mergeFormFields by keeping the provided order, defaultFormFields or merged first, and unmerged userFormFields after. + */ +function mergeFormFields(defaultFormFields, userFormFields) { + // Create a new array with default fields. + var mergedFormFields = defaultFormFields; + // Loop through user provided fields. + for (var i = 0; i < userFormFields.length; i++) { + var userField = userFormFields[i]; + var isNewField = true; + // Loop through the merged fields array. + for (var j = 0; j < mergedFormFields.length; j++) { + var mergedField = mergedFormFields[j]; + // If id is equal, merge the fields + if (userField.id === mergedField.id) { + // Make sure that email and password are kept mandatory. + var optional = mergedField.optional; // Init with default value. + // If user provided value, overwrite. + if (userField.optional !== undefined) { + optional = userField.optional; + } + // If "email" or "password", always mandatory. + if (validators.MANDATORY_FORM_FIELDS_ID_ARRAY.includes(userField.id)) { + optional = false; + } + // Merge. + mergedFormFields[j] = genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, mergedFormFields[j]), + userField + ), + { optional: optional } + ); + isNewField = false; + break; + } + } + // If new field, push to mergeFormFields. + if (isNewField) { + mergedFormFields.push( + genericComponentOverrideContext.__assign( + { optional: false, placeholder: userField.label, validate: validators.defaultValidate }, + userField + ) + ); + } + } + return mergedFormFields.map(function (field) { + return getFormattedFormField(field); + }); +} +function getFormattedFormField(field) { + var _this = this; + return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, field), { + validate: function (value) { + return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + // Absent or not optional empty field + if (value === "" && field.optional === false) { + return [2 /*return*/, "ERROR_NON_OPTIONAL"]; + } + return [4 /*yield*/, field.validate(value)]; + case 1: + return [2 /*return*/, _a.sent()]; + } + }); + }); + }, + }); +} + +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +/* + * Class. + */ +var EmailPassword = /** @class */ (function (_super) { + genericComponentOverrideContext.__extends(EmailPassword, _super); + function EmailPassword(config, webJSRecipe) { + if (webJSRecipe === void 0) { + webJSRecipe = EmailPasswordWebJS__default.default; + } + var _this = _super.call(this, config) || this; + _this.webJSRecipe = webJSRecipe; + _this.recipeID = EmailPassword.RECIPE_ID; + _this.getDefaultRedirectionURL = function (context) { + return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { + var resetPasswordPath; + return genericComponentOverrideContext.__generator(this, function (_a) { + if (context.action === "RESET_PASSWORD") { + resetPasswordPath = new NormalisedURLPath__default.default( + validators.DEFAULT_RESET_PASSWORD_PATH + ); + return [ + 2 /*return*/, + "" + .concat( + this.config.appInfo.websiteBasePath + .appendPath(resetPasswordPath) + .getAsStringDangerous(), + "?rid=" + ) + .concat(this.config.recipeId), + ]; + } + return [2 /*return*/, this.getAuthRecipeDefaultRedirectionURL(context)]; + }); + }); + }; + return _this; + } + EmailPassword.init = function (config) { + var normalisedConfig = normaliseEmailPasswordConfig(config); + return { + recipeID: EmailPassword.RECIPE_ID, + authReact: function (appInfo) { + EmailPassword.instance = new EmailPassword( + genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, normalisedConfig), + { appInfo: appInfo, recipeId: EmailPassword.RECIPE_ID } + ) + ); + return EmailPassword.instance; + }, + webJS: EmailPasswordWebJS__default.default.init( + genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, normalisedConfig), + { + override: { + functions: function (originalImpl, builder) { + var functions = getFunctionOverrides(normalisedConfig.onHandleEvent); + builder.override(functions); + builder.override(normalisedConfig.override.functions); + return originalImpl; + }, + }, + } + ) + ), + }; + }; + EmailPassword.getInstanceOrThrow = function () { + if (EmailPassword.instance === undefined) { + var error = + "No instance of EmailPassword found. Make sure to call the EmailPassword.init method." + + "See https://supertokens.io/docs/emailpassword/quick-setup/frontend"; + // eslint-disable-next-line supertokens-auth-react/no-direct-window-object + if (typeof window === "undefined") { + error = error + genericComponentOverrideContext.SSR_ERROR; + } + throw Error(error); + } + return EmailPassword.instance; + }; + /* + * Tests methods. + */ + EmailPassword.reset = function () { + if (!genericComponentOverrideContext.isTest()) { + return; + } + EmailPassword.instance = undefined; + return; + }; + EmailPassword.RECIPE_ID = "emailpassword"; + return EmailPassword; +})(utils.AuthRecipe); + +exports.EmailPassword = EmailPassword; +exports.normaliseEmailPasswordConfig = normaliseEmailPasswordConfig; diff --git a/lib/build/emailpassword-shared5.js b/lib/build/emailpassword-shared5.js index 0fef60a98..2f2d37441 100644 --- a/lib/build/emailpassword-shared5.js +++ b/lib/build/emailpassword-shared5.js @@ -1,120 +1,6 @@ "use strict"; var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); -var EmailPasswordWebJS = require("supertokens-web-js/recipe/emailpassword"); -var NormalisedURLPath = require("supertokens-web-js/utils/normalisedURLPath"); -var utils = require("./authRecipe-shared.js"); -var validators = require("./emailpassword-shared6.js"); - -function _interopDefault(e) { - return e && e.__esModule ? e : { default: e }; -} - -var EmailPasswordWebJS__default = /*#__PURE__*/ _interopDefault(EmailPasswordWebJS); -var NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath); - -var getFunctionOverrides = function (onHandleEvent) { - return function (originalImp) { - return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, originalImp), { - submitNewPassword: function (input) { - return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { - var response; - return genericComponentOverrideContext.__generator(this, function (_a) { - switch (_a.label) { - case 0: - return [ - 4 /*yield*/, - originalImp.submitNewPassword( - genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, input), - { formFields: [input.formFields[0]] } - ) - ), - ]; - case 1: - response = _a.sent(); - if (response.status === "OK") { - onHandleEvent({ - action: "PASSWORD_RESET_SUCCESSFUL", - userContext: input.userContext, - }); - } - return [2 /*return*/, response]; - } - }); - }); - }, - sendPasswordResetEmail: function (input) { - return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { - var response; - return genericComponentOverrideContext.__generator(this, function (_a) { - switch (_a.label) { - case 0: - return [4 /*yield*/, originalImp.sendPasswordResetEmail(input)]; - case 1: - response = _a.sent(); - if (response.status === "OK") { - onHandleEvent({ - action: "RESET_PASSWORD_EMAIL_SENT", - email: input.formFields.find(function (_a) { - var id = _a.id; - return id === "email"; - }).value, - userContext: input.userContext, - }); - } - return [2 /*return*/, response]; - } - }); - }); - }, - signUp: function (input) { - return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { - var response; - return genericComponentOverrideContext.__generator(this, function (_a) { - switch (_a.label) { - case 0: - return [4 /*yield*/, originalImp.signUp(input)]; - case 1: - response = _a.sent(); - if (response.status === "OK") { - onHandleEvent({ - action: "SUCCESS", - isNewRecipeUser: true, - user: response.user, - userContext: input.userContext, - }); - } - return [2 /*return*/, response]; - } - }); - }); - }, - signIn: function (input) { - return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { - var response; - return genericComponentOverrideContext.__generator(this, function (_a) { - switch (_a.label) { - case 0: - return [4 /*yield*/, originalImp.signIn(input)]; - case 1: - response = _a.sent(); - if (response.status === "OK") { - onHandleEvent({ - action: "SUCCESS", - isNewRecipeUser: false, - user: response.user, - userContext: input.userContext, - }); - } - return [2 /*return*/, response]; - } - }); - }); - }, - }); - }; -}; /* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. * @@ -130,271 +16,8 @@ var getFunctionOverrides = function (onHandleEvent) { * License for the specific language governing permissions and limitations * under the License. */ -function normaliseEmailPasswordConfig(config) { - if (config === undefined) { - config = {}; - } - var signInAndUpFeature = normaliseSignInAndUpFeature(config.signInAndUpFeature); - var signUpPasswordField = signInAndUpFeature.signUpForm.formFields.find(function (field) { - return field.id === "password"; - }); - var signUpEmailField = signInAndUpFeature.signUpForm.formFields.find(function (field) { - return field.id === "email"; - }); - var resetPasswordUsingTokenFeature = normaliseResetPasswordUsingTokenFeature( - signUpPasswordField.validate, - signUpEmailField, - config.resetPasswordUsingTokenFeature - ); - var override = genericComponentOverrideContext.__assign( - { - functions: function (originalImplementation) { - return originalImplementation; - }, - }, - config.override - ); - return genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, utils.normaliseAuthRecipe(config)), - { - signInAndUpFeature: signInAndUpFeature, - resetPasswordUsingTokenFeature: resetPasswordUsingTokenFeature, - override: override, - } - ); -} -function normaliseSignInAndUpFeature(config) { - if (config === undefined) { - config = {}; - } - var disableDefaultUI = config.disableDefaultUI === true; - var signUpForm = normaliseSignUpFormFeatureConfig(config.signUpForm); - var defaultToSignUp = config.defaultToSignUp !== undefined ? config.defaultToSignUp : false; - /* - * Default Sign In corresponds to computed Sign Up fields filtered by email and password only. - * i.e. If the user overrides sign Up fields, that is propagated to default sign In fields. - * Exception made of the password validator which only verifies that the value is not empty for login - * https://github.com/supertokens/supertokens-auth-react/issues/21 - */ - var defaultSignInFields = signUpForm.formFields.reduce(function (signInFieldsAccumulator, field) { - if (field.id === "email") { - return genericComponentOverrideContext.__spreadArray( - genericComponentOverrideContext.__spreadArray([], signInFieldsAccumulator, true), - [field], - false - ); - } - if (field.id === "password") { - return genericComponentOverrideContext.__spreadArray( - genericComponentOverrideContext.__spreadArray([], signInFieldsAccumulator, true), - [ - genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, field), { - autoComplete: "current-password", - validate: validators.defaultLoginPasswordValidator, - }), - ], - false - ); - } - return signInFieldsAccumulator; - }, []); - var signInForm = normaliseSignInFormFeatureConfig(defaultSignInFields, config.signInForm); - return { - disableDefaultUI: disableDefaultUI, - defaultToSignUp: defaultToSignUp, - signUpForm: signUpForm, - signInForm: signInForm, - }; -} -function normaliseSignUpFormFeatureConfig(config) { - if (config === undefined) { - config = {}; - } - var defaultFormFields = getDefaultFormFields(); - var userFormFields = []; - if (config.formFields !== undefined) { - userFormFields = config.formFields; - } - var formFields = mergeFormFields(defaultFormFields, userFormFields); - var privacyPolicyLink = config.privacyPolicyLink; - var termsOfServiceLink = config.termsOfServiceLink; - var style = config.style !== undefined ? config.style : ""; - return { - style: style, - formFields: formFields, - privacyPolicyLink: privacyPolicyLink, - termsOfServiceLink: termsOfServiceLink, - }; -} -function normaliseSignInFormFeatureConfig(defaultFormFields, config) { - if (config === undefined) { - config = {}; - } - var userFormFields = []; - if (config.formFields !== undefined) { - userFormFields = config.formFields - // Filter on email and password only. - .filter(function (field) { - return validators.MANDATORY_FORM_FIELDS_ID_ARRAY.includes(field.id); - }) - // Sign In fields are never optional. - .map(function (field) { - return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, field), { - optional: false, - }); - }); - } - var formFields = mergeFormFields(defaultFormFields, userFormFields); - var style = config.style !== undefined ? config.style : ""; - return { - style: style, - formFields: formFields, - }; -} -function getDefaultFormFields() { - return [getDefaultEmailFormField(), getDefaultPasswordFormField()]; -} -function getDefaultEmailFormField() { - return { - id: "email", - label: "EMAIL_PASSWORD_EMAIL_LABEL", - placeholder: "EMAIL_PASSWORD_EMAIL_PLACEHOLDER", - validate: validators.defaultEmailValidator, - optional: false, - autoComplete: "email", - }; -} -function getDefaultPasswordFormField() { - return { - id: "password", - label: "EMAIL_PASSWORD_PASSWORD_LABEL", - placeholder: "EMAIL_PASSWORD_PASSWORD_PLACEHOLDER", - validate: validators.defaultPasswordValidator, - optional: false, - autoComplete: "new-password", - }; -} -function normaliseResetPasswordUsingTokenFeature(signUpPasswordFieldValidate, signUpEmailField, config) { - if (config === undefined) { - config = {}; - } - var disableDefaultUI = config.disableDefaultUI === true; - var submitNewPasswordFormStyle = - config.submitNewPasswordForm !== undefined && config.submitNewPasswordForm.style !== undefined - ? config.submitNewPasswordForm.style - : ""; - var submitNewPasswordForm = { - style: submitNewPasswordFormStyle, - formFields: [ - { - id: "password", - label: "EMAIL_PASSWORD_NEW_PASSWORD_LABEL", - placeholder: "EMAIL_PASSWORD_NEW_PASSWORD_PLACEHOLDER", - validate: signUpPasswordFieldValidate, - optional: false, - autoComplete: "new-password", - }, - { - id: "confirm-password", - label: "EMAIL_PASSWORD_CONFIRM_PASSWORD_LABEL", - placeholder: "EMAIL_PASSWORD_CONFIRM_PASSWORD_PLACEHOLDER", - validate: signUpPasswordFieldValidate, - optional: false, - autoComplete: "new-password", - }, - ], - }; - var enterEmailFormStyle = - config.enterEmailForm !== undefined && config.enterEmailForm.style !== undefined - ? config.enterEmailForm.style - : ""; - var enterEmailForm = { - style: enterEmailFormStyle, - formFields: [ - genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, getDefaultEmailFormField()), - { validate: signUpEmailField.validate, placeholder: "", autofocus: true } - ), - ], - }; - return { - disableDefaultUI: disableDefaultUI, - submitNewPasswordForm: submitNewPasswordForm, - enterEmailForm: enterEmailForm, - }; -} -/* - * mergeFormFields by keeping the provided order, defaultFormFields or merged first, and unmerged userFormFields after. - */ -function mergeFormFields(defaultFormFields, userFormFields) { - // Create a new array with default fields. - var mergedFormFields = defaultFormFields; - // Loop through user provided fields. - for (var i = 0; i < userFormFields.length; i++) { - var userField = userFormFields[i]; - var isNewField = true; - // Loop through the merged fields array. - for (var j = 0; j < mergedFormFields.length; j++) { - var mergedField = mergedFormFields[j]; - // If id is equal, merge the fields - if (userField.id === mergedField.id) { - // Make sure that email and password are kept mandatory. - var optional = mergedField.optional; // Init with default value. - // If user provided value, overwrite. - if (userField.optional !== undefined) { - optional = userField.optional; - } - // If "email" or "password", always mandatory. - if (validators.MANDATORY_FORM_FIELDS_ID_ARRAY.includes(userField.id)) { - optional = false; - } - // Merge. - mergedFormFields[j] = genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, mergedFormFields[j]), - userField - ), - { optional: optional } - ); - isNewField = false; - break; - } - } - // If new field, push to mergeFormFields. - if (isNewField) { - mergedFormFields.push( - genericComponentOverrideContext.__assign( - { optional: false, placeholder: userField.label, validate: validators.defaultValidate }, - userField - ) - ); - } - } - return mergedFormFields.map(function (field) { - return getFormattedFormField(field); - }); -} -function getFormattedFormField(field) { - var _this = this; - return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, field), { - validate: function (value) { - return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { - return genericComponentOverrideContext.__generator(this, function (_a) { - switch (_a.label) { - case 0: - // Absent or not optional empty field - if (value === "" && field.optional === false) { - return [2 /*return*/, "ERROR_NON_OPTIONAL"]; - } - return [4 /*yield*/, field.validate(value)]; - case 1: - return [2 /*return*/, _a.sent()]; - } - }); - }); - }, - }); -} +var MANDATORY_FORM_FIELDS_ID_ARRAY = ["email", "password"]; +var DEFAULT_RESET_PASSWORD_PATH = "/reset-password"; /* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. * @@ -411,99 +34,88 @@ function getFormattedFormField(field) { * under the License. */ /* - * Class. + * defaultEmailValidator. */ -var EmailPassword = /** @class */ (function (_super) { - genericComponentOverrideContext.__extends(EmailPassword, _super); - function EmailPassword(config, webJSRecipe) { - if (webJSRecipe === void 0) { - webJSRecipe = EmailPasswordWebJS__default.default; - } - var _this = _super.call(this, config) || this; - _this.webJSRecipe = webJSRecipe; - _this.recipeID = EmailPassword.RECIPE_ID; - _this.getDefaultRedirectionURL = function (context) { - return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { - var resetPasswordPath; - return genericComponentOverrideContext.__generator(this, function (_a) { - if (context.action === "RESET_PASSWORD") { - resetPasswordPath = new NormalisedURLPath__default.default( - validators.DEFAULT_RESET_PASSWORD_PATH - ); - return [ - 2 /*return*/, - "" - .concat( - this.config.appInfo.websiteBasePath - .appendPath(resetPasswordPath) - .getAsStringDangerous(), - "?rid=" - ) - .concat(this.config.recipeId), - ]; - } - return [2 /*return*/, this.getAuthRecipeDefaultRedirectionURL(context)]; - }); - }); - }; - return _this; - } - EmailPassword.init = function (config) { - var normalisedConfig = normaliseEmailPasswordConfig(config); - return { - recipeID: EmailPassword.RECIPE_ID, - authReact: function (appInfo) { - EmailPassword.instance = new EmailPassword( - genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, normalisedConfig), - { appInfo: appInfo, recipeId: EmailPassword.RECIPE_ID } - ) - ); - return EmailPassword.instance; - }, - webJS: EmailPasswordWebJS__default.default.init( - genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, normalisedConfig), - { - override: { - functions: function (originalImpl, builder) { - var functions = getFunctionOverrides(normalisedConfig.onHandleEvent); - builder.override(functions); - builder.override(normalisedConfig.override.functions); - return originalImpl; - }, - }, - } - ) - ), - }; - }; - EmailPassword.getInstanceOrThrow = function () { - if (EmailPassword.instance === undefined) { - var error = - "No instance of EmailPassword found. Make sure to call the EmailPassword.init method." + - "See https://supertokens.io/docs/emailpassword/quick-setup/frontend"; - // eslint-disable-next-line supertokens-auth-react/no-direct-window-object - if (typeof window === "undefined") { - error = error + genericComponentOverrideContext.SSR_ERROR; +function defaultEmailValidator(value) { + return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { + var defaultEmailValidatorRegexp; + return genericComponentOverrideContext.__generator(this, function (_a) { + if (typeof value !== "string") { + return [2 /*return*/, "ERROR_EMAIL_NON_STRING"]; + } + value = value.trim(); + defaultEmailValidatorRegexp = + // eslint-disable-next-line no-useless-escape + /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; + // We check if the email syntax is correct + // As per https://github.com/supertokens/supertokens-auth-react/issues/5#issuecomment-709512438 + // Regex from https://stackoverflow.com/a/46181/3867175 + if (value.match(defaultEmailValidatorRegexp) === null) { + return [2 /*return*/, "ERROR_EMAIL_INVALID"]; } - throw Error(error); - } - return EmailPassword.instance; - }; - /* - * Tests methods. - */ - EmailPassword.reset = function () { - if (!genericComponentOverrideContext.isTest()) { - return; - } - EmailPassword.instance = undefined; - return; - }; - EmailPassword.RECIPE_ID = "emailpassword"; - return EmailPassword; -})(utils.AuthRecipe); + return [2 /*return*/, undefined]; + }); + }); +} +/* + * defaultPasswordValidator. + * min 8 characters. + * Contains lowercase, uppercase, and numbers. + */ +function defaultPasswordValidator(value) { + return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { + return genericComponentOverrideContext.__generator(this, function (_a) { + if (typeof value !== "string") { + return [2 /*return*/, "ERROR_PASSWORD_NON_STRING"]; + } + // length >= 8 && < 100 + // must have a number and a character + // as per https://github.com/supertokens/supertokens-auth-react/issues/5#issuecomment-709512438 + if (value.length < 8) { + return [2 /*return*/, "ERROR_PASSWORD_TOO_SHORT"]; + } + if (value.length >= 100) { + return [2 /*return*/, "ERROR_PASSWORD_TOO_LONG"]; + } + if (value.match(/^.*[A-Za-z]+.*$/) === null) { + return [2 /*return*/, "ERROR_PASSWORD_NO_ALPHA"]; + } + if (value.match(/^.*[0-9]+.*$/) === null) { + return [2 /*return*/, "ERROR_PASSWORD_NO_NUM"]; + } + return [2 /*return*/, undefined]; + }); + }); +} +/* + * defaultLoginPasswordValidator. + * type string + */ +function defaultLoginPasswordValidator(value) { + return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { + return genericComponentOverrideContext.__generator(this, function (_a) { + if (typeof value !== "string") { + return [2 /*return*/, "ERROR_PASSWORD_NON_STRING"]; + } + return [2 /*return*/, undefined]; + }); + }); +} +/* + * defaultValidate + */ +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function defaultValidate(_) { + return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { + return genericComponentOverrideContext.__generator(this, function (_a) { + return [2 /*return*/, undefined]; + }); + }); +} -exports.EmailPassword = EmailPassword; -exports.normaliseEmailPasswordConfig = normaliseEmailPasswordConfig; +exports.DEFAULT_RESET_PASSWORD_PATH = DEFAULT_RESET_PASSWORD_PATH; +exports.MANDATORY_FORM_FIELDS_ID_ARRAY = MANDATORY_FORM_FIELDS_ID_ARRAY; +exports.defaultEmailValidator = defaultEmailValidator; +exports.defaultLoginPasswordValidator = defaultLoginPasswordValidator; +exports.defaultPasswordValidator = defaultPasswordValidator; +exports.defaultValidate = defaultValidate; diff --git a/lib/build/emailpassword-shared6.js b/lib/build/emailpassword-shared6.js index 2f2d37441..56d214fab 100644 --- a/lib/build/emailpassword-shared6.js +++ b/lib/build/emailpassword-shared6.js @@ -1,23 +1,60 @@ "use strict"; var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); +var jsxRuntime = require("react/jsx-runtime"); +var NormalisedURLPath = require("supertokens-web-js/utils/normalisedURLPath"); +var uiEntry = require("./index2.js"); +var authWidgetWrapper = require("./authRecipe-shared2.js"); +var componentOverrideContext = require("./emailpassword-shared3.js"); +var React = require("react"); +var translations = require("./translations.js"); +var translations$1 = require("./emailverification-shared2.js"); +var translationContext = require("./translationContext.js"); +var arrowLeftIcon = require("./arrowLeftIcon.js"); +var formBase = require("./emailpassword-shared7.js"); +var generalError = require("./emailpassword-shared.js"); +var STGeneralError = require("supertokens-web-js/utils/error"); +var button = require("./emailpassword-shared2.js"); +var recipe = require("./session-shared2.js"); +var SuperTokensBranding = require("./SuperTokensBranding.js"); +var STGeneralError$1 = require("supertokens-web-js/lib/build/error"); +var validators = require("./emailpassword-shared5.js"); +var recipe$1 = require("./emailpassword-shared4.js"); -/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. - * - * This software is licensed under the Apache License, Version 2.0 (the - * "License") as published by the Apache Software Foundation. - * - * You may not use this file except in compliance with the License. You may - * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -var MANDATORY_FORM_FIELDS_ID_ARRAY = ["email", "password"]; -var DEFAULT_RESET_PASSWORD_PATH = "/reset-password"; +function _interopDefault(e) { + return e && e.__esModule ? e : { default: e }; +} + +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + Object.keys(e).forEach(function (k) { + if (k !== "default") { + var d = Object.getOwnPropertyDescriptor(e, k); + Object.defineProperty( + n, + k, + d.get + ? d + : { + enumerable: true, + get: function () { + return e[k]; + }, + } + ); + } + }); + } + n.default = e; + return Object.freeze(n); +} + +var NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath); +var React__namespace = /*#__PURE__*/ _interopNamespace(React); +var STGeneralError__default = /*#__PURE__*/ _interopDefault(STGeneralError); +var STGeneralError__default$1 = /*#__PURE__*/ _interopDefault(STGeneralError$1); /* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. * @@ -34,88 +71,1498 @@ var DEFAULT_RESET_PASSWORD_PATH = "/reset-password"; * under the License. */ /* - * defaultEmailValidator. + * Imports. */ -function defaultEmailValidator(value) { - return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { - var defaultEmailValidatorRegexp; - return genericComponentOverrideContext.__generator(this, function (_a) { - if (typeof value !== "string") { - return [2 /*return*/, "ERROR_EMAIL_NON_STRING"]; - } - value = value.trim(); - defaultEmailValidatorRegexp = - // eslint-disable-next-line no-useless-escape - /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; - // We check if the email syntax is correct - // As per https://github.com/supertokens/supertokens-auth-react/issues/5#issuecomment-709512438 - // Regex from https://stackoverflow.com/a/46181/3867175 - if (value.match(defaultEmailValidatorRegexp) === null) { - return [2 /*return*/, "ERROR_EMAIL_INVALID"]; - } - return [2 /*return*/, undefined]; - }); - }); +/* + * Component. + */ +function HeavyArrowLeftIcon(_a) { + var color = _a.color; + return jsxRuntime.jsx( + "svg", + genericComponentOverrideContext.__assign( + { + xmlns: "http://www.w3.org/2000/svg", + width: "16", + height: "13", + viewBox: "0 0 16 13", + "data-supertokens": "heavyArrowLeftIcon", + }, + { + children: jsxRuntime.jsx("path", { + fill: color, + d: "M13 6.8h.022H3.8l2.9 2.9a.761.761 0 0 1 0 1.07l-.451.451a.754.754 0 0 1-1.064 0L.22 6.254a.759.759 0 0 1 0-1.068L5.186.22a.755.755 0 0 1 1.064 0l.45.451a.746.746 0 0 1 .22.532.724.724 0 0 1-.22.522l-2.93 2.92h9.24a.781.781 0 0 1 .764.773v.638A.766.766 0 0 1 13 6.8z", + transform: "translate(1.182 .708)", + }), + } + ) + ); +} + +/* + * Component. + */ +function BackButton(_a) { + var onClick = _a.onClick; + return jsxRuntime.jsx( + "button", + genericComponentOverrideContext.__assign( + { onClick: onClick, "data-supertokens": "backButton backButtonCommon" }, + { children: jsxRuntime.jsx(HeavyArrowLeftIcon, { color: "rgb(var(--palette-textTitle))" }) } + ) + ); } + /* - * defaultPasswordValidator. - * min 8 characters. - * Contains lowercase, uppercase, and numbers. + * Component. */ -function defaultPasswordValidator(value) { - return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { - return genericComponentOverrideContext.__generator(this, function (_a) { - if (typeof value !== "string") { - return [2 /*return*/, "ERROR_PASSWORD_NON_STRING"]; +function BackToSignInButton(_a) { + var onClick = _a.onClick; + var t = translationContext.useTranslation(); + return jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "secondaryText secondaryLinkWithLeftArrow", onClick: onClick }, + { + children: [ + jsxRuntime.jsx(arrowLeftIcon.ArrowLeftIcon, { color: "rgb(var(--palette-secondaryText))" }), + t("EMAIL_PASSWORD_RESET_SIGN_IN_LINK"), + ], } - // length >= 8 && < 100 - // must have a number and a character - // as per https://github.com/supertokens/supertokens-auth-react/issues/5#issuecomment-709512438 - if (value.length < 8) { - return [2 /*return*/, "ERROR_PASSWORD_TOO_SHORT"]; + ) + ); +} + +var EmailPasswordResetPasswordEmail = function (props) { + var t = translationContext.useTranslation(); + var userContext = uiEntry.useUserContext(); + var _a = React.useState("READY"), + status = _a[0], + setStatus = _a[1]; + var _b = React.useState(""), + emailFieldValue = _b[0], + setEmailFieldValue = _b[1]; + var onSuccess = function () { + setStatus("SENT"); + }; + var resend = function () { + setStatus("READY"); + }; + var formFields = props.formFields; + var emailSuccessText = + t("EMAIL_PASSWORD_RESET_SEND_BEFORE_EMAIL") + + (emailFieldValue !== undefined && emailFieldValue.length > 0 + ? emailFieldValue + : t("EMAIL_PASSWORD_RESET_SEND_FALLBACK_EMAIL")) + + t("EMAIL_PASSWORD_RESET_SEND_AFTER_EMAIL"); + if (status === "SENT") { + return jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "container" }, + { + children: jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "row" }, + { + children: [ + jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "primaryText enterEmailSuccessMessage" }, + { + children: [ + emailSuccessText, + jsxRuntime.jsx( + "span", + genericComponentOverrideContext.__assign( + { + "data-supertokens": "link resendEmailLink", + onClick: resend, + }, + { children: t("EMAIL_PASSWORD_RESET_RESEND_LINK") } + ) + ), + ], + } + ) + ), + jsxRuntime.jsx(BackToSignInButton, { onClick: props.onBackButtonClicked }), + ], + } + ) + ), + } + ) + ); + } + // Otherwise, return Form. + return jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "container" }, + { + children: jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "row" }, + { + children: [ + jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "headerTitle resetPasswordHeaderTitle" }, + { + children: [ + jsxRuntime.jsx(BackButton, { onClick: props.onBackButtonClicked }), + t("EMAIL_PASSWORD_RESET_HEADER_TITLE"), + jsxRuntime.jsx("span", { + "data-supertokens": "backButtonPlaceholder backButtonCommon", + }), + ], + } + ) + ), + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "headerSubtitle" }, + { + children: jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "secondaryText" }, + { children: t("EMAIL_PASSWORD_RESET_HEADER_SUBTITLE") } + ) + ), + } + ) + ), + props.error !== undefined && + jsxRuntime.jsx(generalError.GeneralError, { error: props.error }), + jsxRuntime.jsx(formBase.FormBase, { + clearError: props.clearError, + onError: props.onError, + formFields: formFields, + buttonLabel: "EMAIL_PASSWORD_RESET_SEND_BTN", + onSuccess: onSuccess, + callAPI: function (formFields) { + return genericComponentOverrideContext.__awaiter( + void 0, + void 0, + void 0, + function () { + var validationErrors, emailField, resp; + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + return [ + 4 /*yield*/, + genericComponentOverrideContext.validateForm( + formFields, + props.config.resetPasswordUsingTokenFeature + .enterEmailForm.formFields + ), + ]; + case 1: + validationErrors = _a.sent(); + if (validationErrors.length > 0) { + return [ + 2 /*return*/, + { + status: "FIELD_ERROR", + formFields: validationErrors, + }, + ]; + } + emailField = formFields.find(function (field) { + return field.id === "email"; + }); + if (emailField !== undefined) { + setEmailFieldValue(emailField.value); + } + return [ + 4 /*yield*/, + props.recipeImplementation.sendPasswordResetEmail({ + formFields: formFields, + userContext: userContext, + }), + ]; + case 2: + resp = _a.sent(); + if (resp.status === "PASSWORD_RESET_NOT_ALLOWED") { + return [ + 2 /*return*/, + { + status: "FIELD_ERROR", + formFields: [ + { id: "email", error: resp.reason }, + ], + }, + ]; + } + return [2 /*return*/, resp]; + } + }); + } + ); + }, + showLabels: true, + validateOnBlur: true, + }), + ], + } + ) + ), } - if (value.length >= 100) { - return [2 /*return*/, "ERROR_PASSWORD_TOO_LONG"]; + ) + ); +}; +var ResetPasswordEmail = uiEntry.withOverride("EmailPasswordResetPasswordEmail", EmailPasswordResetPasswordEmail); + +var EmailPasswordSubmitNewPassword = function (props) { + var t = translationContext.useTranslation(); + var userContext = uiEntry.useUserContext(); + var _a = React.useState("READY"), + status = _a[0], + setStatus = _a[1]; + var onSuccess = function () { + setStatus("SUCCESS"); + }; + var formFields = props.formFields, + onSignInClicked = props.onSignInClicked; + if (status === "SUCCESS") { + return jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "container" }, + { + children: jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "row" }, + { + children: [ + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "headerTitle" }, + { children: t("EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_HEADER_TITLE") } + ) + ), + jsxRuntime.jsx( + formBase.FormRow, + { + children: jsxRuntime.jsxs(React.Fragment, { + children: [ + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { + "data-supertokens": + "primaryText submitNewPasswordSuccessMessage", + }, + { + children: t( + "EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_DESC" + ), + } + ) + ), + jsxRuntime.jsx(button.Button, { + disabled: false, + isLoading: false, + type: "button", + onClick: onSignInClicked, + label: "EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_SIGN_IN_BTN", + }), + ], + }), + }, + "form-button" + ), + ], + } + ) + ), + } + ) + ); + } + return jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "container" }, + { + children: jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "row" }, + { + children: [ + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "headerTitle" }, + { children: t("EMAIL_PASSWORD_RESET_SUBMIT_PW_HEADER_TITLE") } + ) + ), + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "headerSubtitle" }, + { + children: jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "secondaryText" }, + { children: t("EMAIL_PASSWORD_RESET_SUBMIT_PW_HEADER_SUBTITLE") } + ) + ), + } + ) + ), + props.error !== undefined && + jsxRuntime.jsx(generalError.GeneralError, { error: props.error }), + jsxRuntime.jsx(formBase.FormBase, { + formFields: formFields, + clearError: props.clearError, + onError: props.onError, + buttonLabel: "EMAIL_PASSWORD_RESET_SUBMIT_PW_CHANGE_PW_BTN", + onSuccess: onSuccess, + validateOnBlur: true, + callAPI: function (fields) { + return genericComponentOverrideContext.__awaiter( + void 0, + void 0, + void 0, + function () { + var validationErrors, response; + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + return [ + 4 /*yield*/, + genericComponentOverrideContext.validateForm( + fields, + props.config.resetPasswordUsingTokenFeature + .submitNewPasswordForm.formFields + ), + ]; + case 1: + validationErrors = _a.sent(); + if (validationErrors.length > 0) { + return [ + 2 /*return*/, + { + status: "FIELD_ERROR", + formFields: validationErrors, + }, + ]; + } + // Verify that both passwords match. + if (fields[0].value !== fields[1].value) { + return [ + 2 /*return*/, + { + status: "FIELD_ERROR", + formFields: [ + { + id: fields[1].id, + error: "ERROR_CONFIRM_PASSWORD_NO_MATCH", + }, + ], + }, + ]; + } + return [ + 4 /*yield*/, + props.recipeImplementation.submitNewPassword({ + formFields: fields, + userContext: userContext, + }), + ]; + case 2: + response = _a.sent(); + if ( + response.status === "RESET_PASSWORD_INVALID_TOKEN_ERROR" + ) { + throw new STGeneralError__default.default( + "EMAIL_PASSWORD_RESET_PASSWORD_INVALID_TOKEN_ERROR" + ); + } + return [ + 2 /*return*/, + response.status === "FIELD_ERROR" + ? response + : { + status: "OK", + }, + ]; + } + }); + } + ); + }, + showLabels: true, + }), + ], + } + ) + ), } - if (value.match(/^.*[A-Za-z]+.*$/) === null) { - return [2 /*return*/, "ERROR_PASSWORD_NO_ALPHA"]; + ) + ); +}; +var SubmitNewPassword = uiEntry.withOverride("EmailPasswordSubmitNewPassword", EmailPasswordSubmitNewPassword); + +/* + * Component. + */ +function ResetPasswordUsingTokenTheme(props) { + /* + * Render. + */ + // If no token, return SubmitNewPassword. + if (props.submitNewPasswordForm !== undefined) { + return jsxRuntime.jsx( + SubmitNewPassword, + genericComponentOverrideContext.__assign({}, props.submitNewPasswordForm) + ); + } + // Otherwise, return EnterEmail. + return jsxRuntime.jsx(ResetPasswordEmail, genericComponentOverrideContext.__assign({}, props.enterEmailForm)); +} +function ResetPasswordUsingTokenThemeWrapper(props) { + var hasFont = translations.hasFontDefined(props.config.rootStyle); + var userStyles = props.submitNewPasswordForm + ? props.config.resetPasswordUsingTokenFeature.submitNewPasswordForm.style + : props.config.resetPasswordUsingTokenFeature.enterEmailForm.style; + return jsxRuntime.jsx( + uiEntry.UserContextWrapper, + genericComponentOverrideContext.__assign( + { userContext: props.userContext }, + { + children: jsxRuntime.jsx( + translations$1.ThemeBase, + genericComponentOverrideContext.__assign( + { loadDefaultFont: !hasFont, userStyles: [props.config.rootStyle, userStyles] }, + { + children: jsxRuntime.jsx( + ResetPasswordUsingTokenTheme, + genericComponentOverrideContext.__assign({}, props) + ), + } + ) + ), } - if (value.match(/^.*[0-9]+.*$/) === null) { - return [2 /*return*/, "ERROR_PASSWORD_NO_NUM"]; + ) + ); +} + +var defaultTranslationsEmailPassword = { + en: genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, translations.defaultTranslationsCommon.en), + translations$1.defaultTranslationsEmailVerification.en + ), + { + EMAIL_PASSWORD_EMAIL_LABEL: "Email", + EMAIL_PASSWORD_EMAIL_PLACEHOLDER: "Email address", + EMAIL_PASSWORD_PASSWORD_LABEL: "Password", + EMAIL_PASSWORD_PASSWORD_PLACEHOLDER: "Password", + EMAIL_PASSWORD_SIGN_IN_HEADER_TITLE: "Sign In", + EMAIL_PASSWORD_SIGN_IN_HEADER_SUBTITLE_START: "Not registered yet?", + EMAIL_PASSWORD_SIGN_IN_HEADER_SUBTITLE_SIGN_UP_LINK: "Sign Up", + EMAIL_PASSWORD_SIGN_IN_HEADER_SUBTITLE_END: "", + EMAIL_PASSWORD_SIGN_IN_FOOTER_FORGOT_PW_LINK: "Forgot password?", + EMAIL_PASSWORD_SIGN_IN_SUBMIT_BTN: "SIGN IN", + EMAIL_PASSWORD_SIGN_IN_WRONG_CREDENTIALS_ERROR: "Incorrect email and password combination", + EMAIL_PASSWORD_SIGN_UP_HEADER_TITLE: "Sign Up", + EMAIL_PASSWORD_SIGN_UP_HEADER_SUBTITLE_START: "Already have an account?", + EMAIL_PASSWORD_SIGN_UP_HEADER_SUBTITLE_SIGN_IN_LINK: "Sign In", + EMAIL_PASSWORD_SIGN_UP_HEADER_SUBTITLE_END: "", + EMAIL_PASSWORD_SIGN_UP_FOOTER_START: "By continuing, you agree to our ", + EMAIL_PASSWORD_SIGN_UP_FOOTER_TOS: "Terms of Service", + EMAIL_PASSWORD_SIGN_UP_FOOTER_AND: " and ", + EMAIL_PASSWORD_SIGN_UP_FOOTER_PP: "Privacy Policy", + EMAIL_PASSWORD_SIGN_UP_FOOTER_END: "", + EMAIL_PASSWORD_SIGN_UP_SUBMIT_BTN: "SIGN UP", + EMAIL_PASSWORD_EMAIL_ALREADY_EXISTS: "This email already exists. Please sign in instead", + EMAIL_PASSWORD_RESET_HEADER_TITLE: "Reset your password", + EMAIL_PASSWORD_RESET_HEADER_SUBTITLE: "We will send you an email to reset your password", + EMAIL_PASSWORD_RESET_SEND_FALLBACK_EMAIL: "your account", + EMAIL_PASSWORD_RESET_SEND_BEFORE_EMAIL: "A password reset email has been sent to ", + EMAIL_PASSWORD_RESET_SEND_AFTER_EMAIL: ", if it exists in our system. ", + EMAIL_PASSWORD_RESET_RESEND_LINK: "Resend or change email", + EMAIL_PASSWORD_RESET_SEND_BTN: "Email me", + EMAIL_PASSWORD_RESET_SIGN_IN_LINK: "Sign In", + EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_HEADER_TITLE: "Success!", + EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_DESC: "Your password has been updated successfully", + EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_SIGN_IN_BTN: "SIGN IN", + EMAIL_PASSWORD_NEW_PASSWORD_LABEL: "New password", + EMAIL_PASSWORD_NEW_PASSWORD_PLACEHOLDER: "New password", + EMAIL_PASSWORD_CONFIRM_PASSWORD_LABEL: "Confirm password", + EMAIL_PASSWORD_CONFIRM_PASSWORD_PLACEHOLDER: "Confirm your password", + EMAIL_PASSWORD_RESET_SUBMIT_PW_HEADER_TITLE: "Change your password", + EMAIL_PASSWORD_RESET_SUBMIT_PW_HEADER_SUBTITLE: "Enter a new password below to change your password", + EMAIL_PASSWORD_RESET_SUBMIT_PW_CHANGE_PW_BTN: "CHANGE PASSWORD", + EMAIL_PASSWORD_RESET_PASSWORD_INVALID_TOKEN_ERROR: "Invalid password reset token", + ERROR_EMAIL_NON_STRING: "Email must be of type string", + ERROR_EMAIL_INVALID: "Email is invalid", + ERROR_PASSWORD_NON_STRING: "Password must be of type string", + ERROR_PASSWORD_TOO_SHORT: "Password must contain at least 8 characters, including a number", + ERROR_PASSWORD_TOO_LONG: "Password's length must be lesser than 100 characters", + ERROR_PASSWORD_NO_ALPHA: "Password must contain at least one alphabet", + ERROR_PASSWORD_NO_NUM: "Password must contain at least one number", + ERROR_CONFIRM_PASSWORD_NO_MATCH: "Confirmation password doesn't match", + ERROR_NON_OPTIONAL: "Field is not optional", + /* + * The following are error messages from our backend SDK. + * These are returned as full messages to preserver compatibilty, but they work just like the keys above. + * They are shown as is by default (setting the value to undefined will display the raw translation key) + */ + "This email already exists. Please sign in instead.": undefined, + "Field is not optional": undefined, + "Password must contain at least 8 characters, including a number": undefined, + "Password's length must be lesser than 100 characters": undefined, + "Password must contain at least one alphabet": undefined, + "Password must contain at least one number": undefined, + "Email is invalid": undefined, + "Reset password link was not created because of account take over risk. Please contact support. (ERR_CODE_001)": + undefined, + "Cannot sign up due to security reasons. Please try logging in, use a different login method or contact support. (ERR_CODE_007)": + undefined, + "Cannot sign in due to security reasons. Please try resetting your password, use a different login method or contact support. (ERR_CODE_008)": + undefined, + } + ), +}; + +var ResetPasswordUsingToken$1 = function (props) { + var token = genericComponentOverrideContext.getQueryParams("token"); + var _a = React__namespace.useState(), + error = _a[0], + setError = _a[1]; + var enterEmailFormFeature = props.recipe.config.resetPasswordUsingTokenFeature.enterEmailForm; + var submitNewPasswordFormFeature = props.recipe.config.resetPasswordUsingTokenFeature.submitNewPasswordForm; + var submitNewPasswordForm = + token === undefined || token === null + ? undefined + : { + error: error, + onError: function (error) { + return setError(error); + }, + clearError: function () { + return setError(undefined); + }, + styleFromInit: submitNewPasswordFormFeature.style, + formFields: submitNewPasswordFormFeature.formFields, + recipeImplementation: props.recipe.webJSRecipe, + config: props.recipe.config, + onSignInClicked: function () { + void genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().redirectToAuth({ + show: "signin", + history: props.history, + redirectBack: false, + }); + }, + token: token, + }; + var enterEmailForm = { + onBackButtonClicked: function () { + return genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().redirectToAuth({ + show: "signin", + history: props.history, + redirectBack: false, + }); + }, + error: error, + onError: function (error) { + return setError(error); + }, + clearError: function () { + return setError(undefined); + }, + styleFromInit: enterEmailFormFeature.style, + formFields: enterEmailFormFeature.formFields, + recipeImplementation: props.recipe.webJSRecipe, + config: props.recipe.config, + }; + var childProps = { + config: props.recipe.config, + submitNewPasswordForm: submitNewPasswordForm, + enterEmailForm: enterEmailForm, + }; + var recipeComponentOverrides = props.useComponentOverrides(); + return jsxRuntime.jsx( + uiEntry.ComponentOverrideContext.Provider, + genericComponentOverrideContext.__assign( + { value: recipeComponentOverrides }, + { + children: jsxRuntime.jsx( + uiEntry.FeatureWrapper, + genericComponentOverrideContext.__assign( + { + useShadowDom: props.recipe.config.useShadowDom, + defaultStore: defaultTranslationsEmailPassword, + }, + { + children: jsxRuntime.jsxs(React.Fragment, { + children: [ + props.children === undefined && + jsxRuntime.jsx( + ResetPasswordUsingTokenThemeWrapper, + genericComponentOverrideContext.__assign({}, childProps) + ), + props.children && + React__namespace.Children.map(props.children, function (child) { + if (React__namespace.isValidElement(child)) { + return React__namespace.cloneElement(child, childProps); + } + return child; + }), + ], + }), + } + ) + ), } - return [2 /*return*/, undefined]; - }); + ) + ); +}; + +var SignInFooter = uiEntry.withOverride("EmailPasswordSignInFooter", function EmailPasswordSignInFooter(_a) { + var onClick = _a.onClick; + var t = translationContext.useTranslation(); + return jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "link secondaryText forgotPasswordLink", onClick: onClick }, + { children: t("EMAIL_PASSWORD_SIGN_IN_FOOTER_FORGOT_PW_LINK") } + ) + ); +}); + +var SignInForm = uiEntry.withOverride("EmailPasswordSignInForm", function EmailPasswordSignInForm(props) { + var _this = this; + var userContext = uiEntry.useUserContext(); + return jsxRuntime.jsx(formBase.FormBase, { + formFields: props.formFields, + clearError: props.clearError, + onError: props.onError, + buttonLabel: "EMAIL_PASSWORD_SIGN_IN_SUBMIT_BTN", + onSuccess: props.onSuccess, + callAPI: function (formFields) { + return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { + var validationErrors, response; + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + return [ + 4 /*yield*/, + genericComponentOverrideContext.validateForm( + formFields, + props.config.signInAndUpFeature.signInForm.formFields + ), + ]; + case 1: + validationErrors = _a.sent(); + if (validationErrors.length > 0) { + return [ + 2 /*return*/, + { + status: "FIELD_ERROR", + formFields: validationErrors, + }, + ]; + } + return [ + 4 /*yield*/, + props.recipeImplementation.signIn({ + formFields: formFields, + userContext: userContext, + }), + ]; + case 2: + response = _a.sent(); + if (response.status === "WRONG_CREDENTIALS_ERROR") { + throw new STGeneralError__default.default( + "EMAIL_PASSWORD_SIGN_IN_WRONG_CREDENTIALS_ERROR" + ); + } else if (response.status === "SIGN_IN_NOT_ALLOWED") { + throw new STGeneralError__default.default(response.reason); + } else { + return [2 /*return*/, response]; + } + } + }); + }); + }, + validateOnBlur: false, + showLabels: true, + footer: props.footer, }); -} +}); + +var SignInHeader = uiEntry.withOverride("EmailPasswordSignInHeader", function EmailPasswordSignInHeader(_a) { + var onClick = _a.onClick; + var t = translationContext.useTranslation(); + return jsxRuntime.jsxs(React.Fragment, { + children: [ + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "headerTitle" }, + { children: t("EMAIL_PASSWORD_SIGN_IN_HEADER_TITLE") } + ) + ), + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "headerSubtitle" }, + { + children: jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "secondaryText" }, + { + children: [ + t("EMAIL_PASSWORD_SIGN_IN_HEADER_SUBTITLE_START"), + jsxRuntime.jsx( + "span", + genericComponentOverrideContext.__assign( + { "data-supertokens": "link", onClick: onClick }, + { children: t("EMAIL_PASSWORD_SIGN_IN_HEADER_SUBTITLE_SIGN_UP_LINK") } + ) + ), + t("EMAIL_PASSWORD_SIGN_IN_HEADER_SUBTITLE_END"), + ], + } + ) + ), + } + ) + ), + jsxRuntime.jsx("div", { "data-supertokens": "divider" }), + ], + }); +}); + +var SignIn = uiEntry.withOverride("EmailPasswordSignIn", function EmailPasswordSignIn(props) { + return jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "container" }, + { + children: [ + jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "row" }, + { + children: [ + jsxRuntime.jsx(SignInHeader, { onClick: props.signUpClicked }), + props.error !== undefined && + jsxRuntime.jsx(generalError.GeneralError, { error: props.error }), + jsxRuntime.jsx( + SignInForm, + genericComponentOverrideContext.__assign({}, props, { + footer: jsxRuntime.jsx(SignInFooter, { + onClick: props.forgotPasswordClick, + }), + }) + ), + ], + } + ) + ), + jsxRuntime.jsx(SuperTokensBranding.SuperTokensBranding, {}), + ], + } + ) + ); +}); + +var SignUpFooter = uiEntry.withOverride("EmailPasswordSignUpFooter", function EmailPasswordSignUpFooter(_a) { + var termsOfServiceLink = _a.termsOfServiceLink, + privacyPolicyLink = _a.privacyPolicyLink; + var t = translationContext.useTranslation(); + if (termsOfServiceLink === undefined && privacyPolicyLink === undefined) { + return null; + } + return jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "secondaryText privacyPolicyAndTermsAndConditions" }, + { + children: [ + t("EMAIL_PASSWORD_SIGN_UP_FOOTER_START"), + termsOfServiceLink !== undefined && + jsxRuntime.jsx( + "a", + genericComponentOverrideContext.__assign( + { + "data-supertokens": "link", + href: termsOfServiceLink, + target: "_blank", + rel: "noopener noreferer", + }, + { children: t("EMAIL_PASSWORD_SIGN_UP_FOOTER_TOS") } + ) + ), + termsOfServiceLink !== undefined && + privacyPolicyLink !== undefined && + t("EMAIL_PASSWORD_SIGN_UP_FOOTER_AND"), + privacyPolicyLink !== undefined && + jsxRuntime.jsx( + "a", + genericComponentOverrideContext.__assign( + { + "data-supertokens": "link", + href: privacyPolicyLink, + target: "_blank", + rel: "noopener noreferer", + }, + { children: t("EMAIL_PASSWORD_SIGN_UP_FOOTER_PP") } + ) + ), + t("EMAIL_PASSWORD_SIGN_UP_FOOTER_END"), + ], + } + ) + ); +}); + /* - * defaultLoginPasswordValidator. - * type string + * Component. */ -function defaultLoginPasswordValidator(value) { - return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { - return genericComponentOverrideContext.__generator(this, function (_a) { - if (typeof value !== "string") { - return [2 /*return*/, "ERROR_PASSWORD_NON_STRING"]; - } - return [2 /*return*/, undefined]; - }); +var SignUpForm = uiEntry.withOverride("EmailPasswordSignUpForm", function EmailPasswordSignUpForm(props) { + var _this = this; + var userContext = uiEntry.useUserContext(); + return jsxRuntime.jsx(formBase.FormBase, { + formFields: props.formFields, + clearError: props.clearError, + onError: props.onError, + buttonLabel: "EMAIL_PASSWORD_SIGN_UP_SUBMIT_BTN", + onSuccess: props.onSuccess, + callAPI: function (formFields) { + return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { + var validationErrors, res; + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + return [ + 4 /*yield*/, + genericComponentOverrideContext.validateForm( + formFields, + props.config.signInAndUpFeature.signUpForm.formFields + ), + ]; + case 1: + validationErrors = _a.sent(); + if (validationErrors.length > 0) { + return [ + 2 /*return*/, + { + status: "FIELD_ERROR", + formFields: validationErrors, + }, + ]; + } + return [ + 4 /*yield*/, + props.recipeImplementation.signUp({ + formFields: formFields, + userContext: userContext, + }), + ]; + case 2: + res = _a.sent(); + if (res.status === "SIGN_UP_NOT_ALLOWED") { + throw new STGeneralError__default$1.default(res.reason); + } + return [2 /*return*/, res]; + } + }); + }); + }, + validateOnBlur: true, + showLabels: true, + footer: props.footer, + }); +}); + +var SignUpHeader = uiEntry.withOverride("EmailPasswordSignUpHeader", function EmailPasswordSignUpHeader(_a) { + var onClick = _a.onClick; + var t = translationContext.useTranslation(); + return jsxRuntime.jsxs(React.Fragment, { + children: [ + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "headerTitle" }, + { children: t("EMAIL_PASSWORD_SIGN_UP_HEADER_TITLE") } + ) + ), + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "headerSubtitle" }, + { + children: jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "secondaryText" }, + { + children: [ + t("EMAIL_PASSWORD_SIGN_UP_HEADER_SUBTITLE_START"), + jsxRuntime.jsx( + "span", + genericComponentOverrideContext.__assign( + { "data-supertokens": "link", onClick: onClick }, + { children: t("EMAIL_PASSWORD_SIGN_UP_HEADER_SUBTITLE_SIGN_IN_LINK") } + ) + ), + t("EMAIL_PASSWORD_SIGN_UP_HEADER_SUBTITLE_END"), + ], + } + ) + ), + } + ) + ), + jsxRuntime.jsx("div", { "data-supertokens": "divider" }), + ], }); +}); + +var SignUp = uiEntry.withOverride("EmailPasswordSignUp", function EmailPasswordSignUp(props) { + return jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "container" }, + { + children: [ + jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "row" }, + { + children: [ + jsxRuntime.jsx(SignUpHeader, { onClick: props.signInClicked }), + props.error !== undefined && + jsxRuntime.jsx(generalError.GeneralError, { error: props.error }), + jsxRuntime.jsx( + SignUpForm, + genericComponentOverrideContext.__assign({}, props, { + footer: jsxRuntime.jsx(SignUpFooter, { + privacyPolicyLink: + props.config.signInAndUpFeature.signUpForm.privacyPolicyLink, + termsOfServiceLink: + props.config.signInAndUpFeature.signUpForm.termsOfServiceLink, + }), + }) + ), + ], + } + ) + ), + jsxRuntime.jsx(SuperTokensBranding.SuperTokensBranding, {}), + ], + } + ) + ); +}); + +var SignInAndUpTheme = function (props) { + // If isSignUp, return signUp. + if (props.featureState.isSignUp) { + return jsxRuntime.jsx( + SignUp, + genericComponentOverrideContext.__assign({}, props.signUpForm, { + signInClicked: function () { + props.dispatch({ type: "setSignIn" }); + }, + }) + ); + } + // Otherwise, return SignIn. + return jsxRuntime.jsx( + SignIn, + genericComponentOverrideContext.__assign({}, props.signInForm, { + signUpClicked: function () { + props.dispatch({ type: "setSignUp" }); + }, + }) + ); +}; +function SignInAndUpThemeWrapper(props) { + var hasFont = translations.hasFontDefined(props.config.rootStyle); + var activeStyle = props.featureState.isSignUp + ? props.config.signInAndUpFeature.signUpForm.style + : props.config.signInAndUpFeature.signInForm.style; + return jsxRuntime.jsx( + uiEntry.UserContextWrapper, + genericComponentOverrideContext.__assign( + { userContext: props.userContext }, + { + children: jsxRuntime.jsx( + translations$1.ThemeBase, + genericComponentOverrideContext.__assign( + { loadDefaultFont: !hasFont, userStyles: [props.config.rootStyle, activeStyle] }, + { + children: jsxRuntime.jsx( + SignInAndUpTheme, + genericComponentOverrideContext.__assign({}, props) + ), + } + ) + ), + } + ) + ); } -/* - * defaultValidate - */ -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function defaultValidate(_) { - return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { - return genericComponentOverrideContext.__generator(this, function (_a) { - return [2 /*return*/, undefined]; + +var useFeatureReducer = function (recipe) { + return React__namespace.useReducer( + function (oldState, action) { + switch (action.type) { + case "setSignIn": + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, oldState), + { error: undefined, isSignUp: false } + ); + case "setSignUp": + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, oldState), + { error: undefined, isSignUp: true } + ); + case "setError": + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, oldState), + { error: action.error } + ); + default: + return oldState; + } + }, + { + isSignUp: recipe === undefined ? false : recipe.config.signInAndUpFeature.defaultToSignUp, + user: undefined, + error: undefined, + }, + function (initArg) { + var show = genericComponentOverrideContext.getQueryParams("show"); + var isSignUp = initArg.isSignUp; + if (show !== null) { + isSignUp = show === "signup"; + } + return { + isSignUp: isSignUp, + user: undefined, + error: undefined, + }; + } + ); +}; +function useChildProps(recipe$1, state, dispatch, history) { + var _this = this; + var recipeImplementation = React.useMemo( + function () { + return recipe$1 && getModifiedRecipeImplementation(recipe$1.webJSRecipe); + }, + [recipe$1] + ); + var userContext = uiEntry.useUserContext(); + var onSignInSuccess = React.useCallback( + function (response) { + return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { + return genericComponentOverrideContext.__generator(this, function (_a) { + return [ + 2 /*return*/, + recipe.Session.getInstanceOrThrow().validateGlobalClaimsAndHandleSuccessRedirection( + { + rid: recipe$1.config.recipeId, + successRedirectContext: { + action: "SUCCESS", + isNewRecipeUser: false, + user: response.user, + redirectToPath: genericComponentOverrideContext.getRedirectToPathFromURL(), + }, + }, + userContext, + history + ), + ]; + }); + }); + }, + [recipe$1, userContext, history] + ); + var onSignUpSuccess = React.useCallback( + function (response) { + return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { + return genericComponentOverrideContext.__generator(this, function (_a) { + return [ + 2 /*return*/, + recipe.Session.getInstanceOrThrow().validateGlobalClaimsAndHandleSuccessRedirection( + { + rid: recipe$1.config.recipeId, + successRedirectContext: { + action: "SUCCESS", + isNewRecipeUser: true, + user: response.user, + redirectToPath: genericComponentOverrideContext.getRedirectToPathFromURL(), + }, + }, + userContext, + history + ), + ]; + }); + }); + }, + [recipe$1, userContext, history] + ); + return React.useMemo( + function () { + if (recipe$1 === undefined || recipeImplementation === undefined) { + return; + } + var signInAndUpFeature = recipe$1.config.signInAndUpFeature; + var signUpFeature = signInAndUpFeature.signUpForm; + var signInFeature = signInAndUpFeature.signInForm; + var signInForm = { + recipeImplementation: recipeImplementation, + config: recipe$1.config, + styleFromInit: signInFeature.style, + formFields: signInFeature.formFields, + error: state.error, + clearError: function () { + return dispatch({ type: "setError", error: undefined }); + }, + onError: function (error) { + return dispatch({ type: "setError", error: error }); + }, + onSuccess: onSignInSuccess, + forgotPasswordClick: function () { + return recipe$1.redirect({ action: "RESET_PASSWORD" }, history); + }, + }; + var signUpForm = { + recipeImplementation: recipeImplementation, + config: recipe$1.config, + styleFromInit: signUpFeature.style, + formFields: getThemeSignUpFeatureFormFields(signUpFeature.formFields, recipe$1, userContext), + error: state.error, + clearError: function () { + return dispatch({ type: "setError", error: undefined }); + }, + onError: function (error) { + return dispatch({ type: "setError", error: error }); + }, + onSuccess: onSignUpSuccess, + }; + return { + config: recipe$1.config, + signInForm: signInForm, + signUpForm: signUpForm, + }; + }, + [recipe$1, state, dispatch] + ); +} +var SignInAndUpFeature = function (props) { + var _a = useFeatureReducer(props.recipe), + state = _a[0], + dispatch = _a[1]; + var childProps = useChildProps(props.recipe, state, dispatch, props.history); + var recipeComponentOverrides = props.useComponentOverrides(); + return jsxRuntime.jsx( + uiEntry.ComponentOverrideContext.Provider, + genericComponentOverrideContext.__assign( + { value: recipeComponentOverrides }, + { + children: jsxRuntime.jsx( + uiEntry.FeatureWrapper, + genericComponentOverrideContext.__assign( + { + useShadowDom: props.recipe.config.useShadowDom, + defaultStore: defaultTranslationsEmailPassword, + }, + { + children: jsxRuntime.jsxs(React.Fragment, { + children: [ + props.children === undefined && + jsxRuntime.jsx( + SignInAndUpThemeWrapper, + genericComponentOverrideContext.__assign({}, childProps, { + featureState: state, + dispatch: dispatch, + }) + ), + props.children && + React__namespace.Children.map(props.children, function (child) { + if (React__namespace.isValidElement(child)) { + return React__namespace.cloneElement( + child, + genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, childProps), + { featureState: state, dispatch: dispatch } + ) + ); + } + return child; + }), + ], + }), + } + ) + ), + } + ) + ); +}; +var getModifiedRecipeImplementation = function (origImpl) { + return genericComponentOverrideContext.__assign({}, origImpl); +}; +function getThemeSignUpFeatureFormFields(formFields, recipe, userContext) { + var _this = this; + var emailPasswordOnly = formFields.length === 2; + return formFields.map(function (field) { + return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, field), { + showIsRequired: (function () { + // If email and password only, do not show required indicator (*). + if (emailPasswordOnly) { + return false; + } + // Otherwise, show for all non optional fields (including email and password). + return field.optional === false; + })(), + validate: (function () { + // If field is not email, return field validate unchanged. + if (field.id !== "email") { + return field.validate; + } + // Otherwise, if email, use syntax validate method and check if email exists. + return function (value) { + return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { + var error, emailExists, err_1; + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + return [4 /*yield*/, field.validate(value)]; + case 1: + error = _a.sent(); + if (error !== undefined) { + return [2 /*return*/, error]; + } + if (typeof value !== "string") { + return [2 /*return*/, "GENERAL_ERROR_EMAIL_NON_STRING"]; + } + _a.label = 2; + case 2: + _a.trys.push([2, 4, , 5]); + return [ + 4 /*yield*/, + recipe.webJSRecipe.doesEmailExist({ + email: value, + userContext: userContext, + }), + ]; + case 3: + emailExists = _a.sent().doesExist; + if (emailExists) { + return [2 /*return*/, "EMAIL_PASSWORD_EMAIL_ALREADY_EXISTS"]; + } + return [3 /*break*/, 5]; + case 4: + err_1 = _a.sent(); + if (STGeneralError__default.default.isThisError(err_1)) { + return [2 /*return*/, err_1.message]; + } + return [3 /*break*/, 5]; + case 5: + return [2 /*return*/, undefined]; + } + }); + }); + }; + })(), }); }); } -exports.DEFAULT_RESET_PASSWORD_PATH = DEFAULT_RESET_PASSWORD_PATH; -exports.MANDATORY_FORM_FIELDS_ID_ARRAY = MANDATORY_FORM_FIELDS_ID_ARRAY; -exports.defaultEmailValidator = defaultEmailValidator; -exports.defaultLoginPasswordValidator = defaultLoginPasswordValidator; -exports.defaultPasswordValidator = defaultPasswordValidator; -exports.defaultValidate = defaultValidate; +var EmailPasswordPreBuiltUI = /** @class */ (function (_super) { + genericComponentOverrideContext.__extends(EmailPasswordPreBuiltUI, _super); + function EmailPasswordPreBuiltUI(recipeInstance) { + var _this = _super.call(this) || this; + _this.recipeInstance = recipeInstance; + // Instance methods + _this.getFeatures = function (useComponentOverrides) { + if (useComponentOverrides === void 0) { + useComponentOverrides = componentOverrideContext.useContext; + } + var features = {}; + if (_this.recipeInstance.config.signInAndUpFeature.disableDefaultUI !== true) { + var normalisedFullPath = _this.recipeInstance.config.appInfo.websiteBasePath.appendPath( + new NormalisedURLPath__default.default("/") + ); + features[normalisedFullPath.getAsStringDangerous()] = { + matches: genericComponentOverrideContext.matchRecipeIdUsingQueryParams( + _this.recipeInstance.config.recipeId + ), + component: function (props) { + return _this.getFeatureComponent("signinup", props, useComponentOverrides); + }, + recipeID: recipe$1.EmailPassword.RECIPE_ID, + }; + } + if (_this.recipeInstance.config.resetPasswordUsingTokenFeature.disableDefaultUI !== true) { + var normalisedFullPath = _this.recipeInstance.config.appInfo.websiteBasePath.appendPath( + new NormalisedURLPath__default.default(validators.DEFAULT_RESET_PASSWORD_PATH) + ); + features[normalisedFullPath.getAsStringDangerous()] = { + matches: genericComponentOverrideContext.matchRecipeIdUsingQueryParams( + _this.recipeInstance.config.recipeId + ), + component: function (props) { + return _this.getFeatureComponent("resetpassword", props, useComponentOverrides); + }, + recipeID: recipe$1.EmailPassword.RECIPE_ID, + }; + } + return features; + }; + _this.getFeatureComponent = function (componentName, props, useComponentOverrides) { + if (useComponentOverrides === void 0) { + useComponentOverrides = componentOverrideContext.useContext; + } + if (componentName === "signinup") { + if (props.redirectOnSessionExists !== false) { + return jsxRuntime.jsx( + uiEntry.UserContextWrapper, + genericComponentOverrideContext.__assign( + { userContext: props.userContext }, + { + children: jsxRuntime.jsx( + authWidgetWrapper.AuthWidgetWrapper, + genericComponentOverrideContext.__assign( + { authRecipe: _this.recipeInstance, history: props.history }, + { + children: jsxRuntime.jsx( + SignInAndUpFeature, + genericComponentOverrideContext.__assign( + { recipe: _this.recipeInstance }, + props, + { useComponentOverrides: useComponentOverrides } + ) + ), + } + ) + ), + } + ) + ); + } else { + return jsxRuntime.jsx( + uiEntry.UserContextWrapper, + genericComponentOverrideContext.__assign( + { userContext: props.userContext }, + { + children: jsxRuntime.jsx( + SignInAndUpFeature, + genericComponentOverrideContext.__assign({ recipe: _this.recipeInstance }, props, { + useComponentOverrides: useComponentOverrides, + }) + ), + } + ) + ); + } + } else if (componentName === "resetpassword") { + return jsxRuntime.jsx( + uiEntry.UserContextWrapper, + genericComponentOverrideContext.__assign( + { userContext: props.userContext }, + { + children: jsxRuntime.jsx( + ResetPasswordUsingToken$1, + genericComponentOverrideContext.__assign({ recipe: _this.recipeInstance }, props, { + useComponentOverrides: useComponentOverrides, + }) + ), + } + ) + ); + } else { + throw new Error("Should never come here."); + } + }; + return _this; + } + // Static methods + EmailPasswordPreBuiltUI.getInstanceOrInitAndGetInstance = function () { + if (EmailPasswordPreBuiltUI.instance === undefined) { + var recipeInstance = recipe$1.EmailPassword.getInstanceOrThrow(); + EmailPasswordPreBuiltUI.instance = new EmailPasswordPreBuiltUI(recipeInstance); + } + return EmailPasswordPreBuiltUI.instance; + }; + EmailPasswordPreBuiltUI.getFeatures = function (useComponentOverrides) { + if (useComponentOverrides === void 0) { + useComponentOverrides = componentOverrideContext.useContext; + } + return EmailPasswordPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatures(useComponentOverrides); + }; + EmailPasswordPreBuiltUI.getFeatureComponent = function (componentName, props, useComponentOverrides) { + if (useComponentOverrides === void 0) { + useComponentOverrides = componentOverrideContext.useContext; + } + return EmailPasswordPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent( + componentName, + props, + useComponentOverrides + ); + }; + // For tests + EmailPasswordPreBuiltUI.reset = function () { + if (!genericComponentOverrideContext.isTest()) { + return; + } + EmailPasswordPreBuiltUI.instance = undefined; + return; + }; + EmailPasswordPreBuiltUI.SignInAndUp = function (prop) { + if (prop === void 0) { + prop = {}; + } + return EmailPasswordPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent("signinup", prop); + }; + EmailPasswordPreBuiltUI.ResetPasswordUsingToken = function (prop) { + return EmailPasswordPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent("resetpassword", prop); + }; + EmailPasswordPreBuiltUI.ResetPasswordUsingTokenTheme = ResetPasswordUsingTokenThemeWrapper; + EmailPasswordPreBuiltUI.SignInAndUpTheme = SignInAndUpThemeWrapper; + return EmailPasswordPreBuiltUI; +})(uiEntry.RecipeRouter); +var SignInAndUp = EmailPasswordPreBuiltUI.SignInAndUp; +var ResetPasswordUsingToken = EmailPasswordPreBuiltUI.ResetPasswordUsingToken; + +exports.EmailPasswordPreBuiltUI = EmailPasswordPreBuiltUI; +exports.ResetPasswordUsingToken = ResetPasswordUsingToken; +exports.ResetPasswordUsingTokenThemeWrapper = ResetPasswordUsingTokenThemeWrapper; +exports.SignInAndUp = SignInAndUp; +exports.SignInAndUpThemeWrapper = SignInAndUpThemeWrapper; +exports.SignInFooter = SignInFooter; +exports.SignInForm = SignInForm; +exports.SignInHeader = SignInHeader; +exports.SignUpFooter = SignUpFooter; +exports.SignUpForm = SignUpForm; +exports.SignUpHeader = SignUpHeader; +exports.defaultTranslationsEmailPassword = defaultTranslationsEmailPassword; +exports.useChildProps = useChildProps; +exports.useFeatureReducer = useFeatureReducer; diff --git a/lib/build/emailpassword-shared7.js b/lib/build/emailpassword-shared7.js index 9f025d0f4..6415dc169 100644 --- a/lib/build/emailpassword-shared7.js +++ b/lib/build/emailpassword-shared7.js @@ -2,59 +2,33 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); var jsxRuntime = require("react/jsx-runtime"); -var NormalisedURLPath = require("supertokens-web-js/utils/normalisedURLPath"); -var uiEntry = require("./index2.js"); -var SuperTokensBranding = require("./SuperTokensBranding.js"); -var componentOverrideContext = require("./emailpassword-shared4.js"); var React = require("react"); -var translations = require("./translations.js"); -var themeBase = require("./emailpassword-shared.js"); -var translationContext = require("./translationContext.js"); -var arrowLeftIcon = require("./arrowLeftIcon.js"); -var formBase = require("./emailpassword-shared8.js"); -var generalError = require("./emailpassword-shared2.js"); var STGeneralError = require("supertokens-web-js/utils/error"); -var button = require("./emailpassword-shared3.js"); -var translations$1 = require("./emailverification-shared2.js"); -var recipe = require("./session-shared2.js"); -var STGeneralError$1 = require("supertokens-web-js/lib/build/error"); -var validators = require("./emailpassword-shared6.js"); -var recipe$1 = require("./emailpassword-shared5.js"); +var validators = require("./emailpassword-shared5.js"); +var button = require("./emailpassword-shared2.js"); +require("./index2.js"); +var translationContext = require("./translationContext.js"); function _interopDefault(e) { return e && e.__esModule ? e : { default: e }; } -function _interopNamespace(e) { - if (e && e.__esModule) return e; - var n = Object.create(null); - if (e) { - Object.keys(e).forEach(function (k) { - if (k !== "default") { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty( - n, - k, - d.get - ? d - : { - enumerable: true, - get: function () { - return e[k]; - }, - } - ); - } - }); - } - n.default = e; - return Object.freeze(n); -} - -var NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath); -var React__namespace = /*#__PURE__*/ _interopNamespace(React); var STGeneralError__default = /*#__PURE__*/ _interopDefault(STGeneralError); -var STGeneralError__default$1 = /*#__PURE__*/ _interopDefault(STGeneralError$1); + +/* + * Component. + */ +function FormRow(_a) { + var children = _a.children, + hasError = _a.hasError; + return jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": ["formRow", hasError ? "hasError" : ""].join(" ") }, + { children: children } + ) + ); +} /* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. * @@ -76,437 +50,364 @@ var STGeneralError__default$1 = /*#__PURE__*/ _interopDefault(STGeneralError$1); /* * Component. */ -function HeavyArrowLeftIcon(_a) { - var color = _a.color; +function CheckedIcon() { return jsxRuntime.jsx( "svg", genericComponentOverrideContext.__assign( { xmlns: "http://www.w3.org/2000/svg", - width: "16", - height: "13", - viewBox: "0 0 16 13", - "data-supertokens": "heavyArrowLeftIcon", + width: "14.862", + height: "12.033", + viewBox: "0 0 14.862 12.033", + "data-supertokens": "checkedIcon", }, { children: jsxRuntime.jsx("path", { - fill: color, - d: "M13 6.8h.022H3.8l2.9 2.9a.761.761 0 0 1 0 1.07l-.451.451a.754.754 0 0 1-1.064 0L.22 6.254a.759.759 0 0 1 0-1.068L5.186.22a.755.755 0 0 1 1.064 0l.45.451a.746.746 0 0 1 .22.532.724.724 0 0 1-.22.522l-2.93 2.92h9.24a.781.781 0 0 1 .764.773v.638A.766.766 0 0 1 13 6.8z", - transform: "translate(1.182 .708)", + fill: "rgb(var(--palette-primary))", + d: "M12.629 49L5.06 56.572l-2.829-2.829L0 55.977l5.057 5.057.654-.651 9.152-9.152z", + transform: "translate(0 -49)", }), } ) ); } +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ /* - * Component. + * Imports. */ -function BackButton(_a) { - var onClick = _a.onClick; - return jsxRuntime.jsx( - "button", - genericComponentOverrideContext.__assign( - { onClick: onClick, "data-supertokens": "backButton backButtonCommon" }, - { children: jsxRuntime.jsx(HeavyArrowLeftIcon, { color: "rgb(var(--palette-textTitle))" }) } - ) - ); -} - /* * Component. */ -function BackToSignInButton(_a) { - var onClick = _a.onClick; - var t = translationContext.useTranslation(); - return jsxRuntime.jsxs( - "div", +function ErrorIcon() { + return jsxRuntime.jsx( + "svg", genericComponentOverrideContext.__assign( - { "data-supertokens": "secondaryText secondaryLinkWithLeftArrow", onClick: onClick }, { - children: [ - jsxRuntime.jsx(arrowLeftIcon.ArrowLeftIcon, { color: "rgb(var(--palette-secondaryText))" }), - t("EMAIL_PASSWORD_RESET_SIGN_IN_LINK"), - ], + xmlns: "http://www.w3.org/2000/svg", + width: "17", + height: "15", + viewBox: "0 0 17 15", + "data-supertokens": "errorIcon", + }, + { + children: jsxRuntime.jsxs("g", { + children: [ + jsxRuntime.jsx( + "g", + genericComponentOverrideContext.__assign( + { className: "Asdf", fill: "rgb(var(--palette-error))" }, + { + children: jsxRuntime.jsx("path", { + d: "M13.568 14.75H3.432c-.63 0-1.195-.325-1.512-.869-.317-.544-.32-1.196-.01-1.744l5.067-8.943c.315-.556.884-.887 1.523-.887.639 0 1.208.331 1.523.887l5.067 8.943c.31.548.307 1.2-.01 1.744s-.882.869-1.512.869z", + transform: "translate(-824.894 -352.829) translate(824.894 352.829)", + }), + } + ) + ), + jsxRuntime.jsx( + "text", + genericComponentOverrideContext.__assign( + { + fill: "#fff", + fontSize: "10px", + fontWeight: "700", + transform: "translate(-824.894 -352.829) translate(832.014 365.198)", + }, + { + children: jsxRuntime.jsx( + "tspan", + genericComponentOverrideContext.__assign({ x: "0", y: "0" }, { children: "!" }) + ), + } + ) + ), + ], + }), } ) ); } -var EmailPasswordResetPasswordEmail = function (props) { - var t = translationContext.useTranslation(); - var userContext = uiEntry.useUserContext(); - var _a = React.useState("READY"), - status = _a[0], - setStatus = _a[1]; - var _b = React.useState(""), - emailFieldValue = _b[0], - setEmailFieldValue = _b[1]; - var onSuccess = function () { - setStatus("SENT"); - }; - var resend = function () { - setStatus("READY"); - }; - var formFields = props.formFields; - var emailSuccessText = - t("EMAIL_PASSWORD_RESET_SEND_BEFORE_EMAIL") + - (emailFieldValue !== undefined && emailFieldValue.length > 0 - ? emailFieldValue - : t("EMAIL_PASSWORD_RESET_SEND_FALLBACK_EMAIL")) + - t("EMAIL_PASSWORD_RESET_SEND_AFTER_EMAIL"); - if (status === "SENT") { - return jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "container" }, - { - children: jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "row" }, - { - children: [ - jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "primaryText enterEmailSuccessMessage" }, - { - children: [ - emailSuccessText, - jsxRuntime.jsx( - "span", - genericComponentOverrideContext.__assign( - { - "data-supertokens": "link resendEmailLink", - onClick: resend, - }, - { children: t("EMAIL_PASSWORD_RESET_RESEND_LINK") } - ) - ), - ], - } - ) - ), - jsxRuntime.jsx(BackToSignInButton, { onClick: props.onBackButtonClicked }), - ], - } - ) - ), - } - ) - ); - } - // Otherwise, return Form. - return jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "container" }, - { - children: jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "row" }, - { +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +/* + * Imports. + */ +/* + * Component. + */ +function ShowPasswordIcon(_a) { + var showPassword = _a.showPassword; + if (showPassword === true) { + return jsxRuntime.jsx("div", { + children: jsxRuntime.jsx( + "svg", + genericComponentOverrideContext.__assign( + { + xmlns: "http://www.w3.org/2000/svg", + width: "18.391", + height: "16.276", + viewBox: "0 0 18.391 16.276", + "data-supertokens": "showPasswordIcon show", + }, + { + children: jsxRuntime.jsxs("g", { children: [ + jsxRuntime.jsx("g", { + children: jsxRuntime.jsx("g", { + children: jsxRuntime.jsx("g", { + children: jsxRuntime.jsx("path", { + fill: "rgb(var(--palette-textPrimary))", + d: "M29.289 100.33c-2.4-3.63-5.619-5.63-9.069-5.63s-6.67 2-9.069 5.63a.767.767 0 0 0 0 .845c2.4 3.63 5.619 5.63 9.069 5.63s6.67-2 9.069-5.63a.767.767 0 0 0 0-.845zm-9.069 4.944c-2.785 0-5.435-1.6-7.5-4.519 2.065-2.92 4.715-4.519 7.5-4.519s5.435 1.6 7.5 4.519c-2.064 2.92-4.711 4.519-7.5 4.519z", + transform: + "translate(-822 -420.048) translate(822 422.035) translate(-11.025 -94.7)", + }), + }), + }), + }), jsxRuntime.jsxs( - "div", + "g", genericComponentOverrideContext.__assign( - { "data-supertokens": "headerTitle resetPasswordHeaderTitle" }, + { + fill: "rgb(var(--palette-textPrimary))", + stroke: "rgb(var(--palette-inputBackground))", + transform: "translate(-822 -420.048) translate(827.164 424.055)", + }, { children: [ - jsxRuntime.jsx(BackButton, { onClick: props.onBackButtonClicked }), - t("EMAIL_PASSWORD_RESET_HEADER_TITLE"), - jsxRuntime.jsx("span", { - "data-supertokens": "backButtonPlaceholder backButtonCommon", + jsxRuntime.jsx("circle", { + cx: "4.036", + cy: "4.036", + r: "4.036", + stroke: "none", + }), + jsxRuntime.jsx("circle", { + cx: "4.036", + cy: "4.036", + r: "3.536", + fill: "none", }), ], } ) ), - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "headerSubtitle" }, - { - children: jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "secondaryText" }, - { children: t("EMAIL_PASSWORD_RESET_HEADER_SUBTITLE") } - ) - ), - } - ) - ), - props.error !== undefined && - jsxRuntime.jsx(generalError.GeneralError, { error: props.error }), - jsxRuntime.jsx(formBase.FormBase, { - clearError: props.clearError, - onError: props.onError, - formFields: formFields, - buttonLabel: "EMAIL_PASSWORD_RESET_SEND_BTN", - onSuccess: onSuccess, - callAPI: function (formFields) { - return genericComponentOverrideContext.__awaiter( - void 0, - void 0, - void 0, - function () { - var validationErrors, emailField, resp; - return genericComponentOverrideContext.__generator(this, function (_a) { - switch (_a.label) { - case 0: - return [ - 4 /*yield*/, - genericComponentOverrideContext.validateForm( - formFields, - props.config.resetPasswordUsingTokenFeature - .enterEmailForm.formFields - ), - ]; - case 1: - validationErrors = _a.sent(); - if (validationErrors.length > 0) { - return [ - 2 /*return*/, - { - status: "FIELD_ERROR", - formFields: validationErrors, - }, - ]; - } - emailField = formFields.find(function (field) { - return field.id === "email"; - }); - if (emailField !== undefined) { - setEmailFieldValue(emailField.value); - } - return [ - 4 /*yield*/, - props.recipeImplementation.sendPasswordResetEmail({ - formFields: formFields, - userContext: userContext, - }), - ]; - case 2: - resp = _a.sent(); - if (resp.status === "PASSWORD_RESET_NOT_ALLOWED") { - return [ - 2 /*return*/, - { - status: "FIELD_ERROR", - formFields: [ - { id: "email", error: resp.reason }, - ], - }, - ]; - } - return [2 /*return*/, resp]; - } - }); - } - ); - }, - showLabels: true, - validateOnBlur: true, + jsxRuntime.jsx("path", { + fill: "none", + stroke: "#707070", + strokeLinecap: "round", + strokeWidth: "2.25px", + d: "M11.981 0L0 11.981", + transform: "translate(-822 -420.048) translate(825.084 421.639)", + }), + jsxRuntime.jsx("path", { + fill: "none", + stroke: "rgb(var(--palette-inputBackground))", + strokeLinecap: "round", + d: "M13.978 0L0 13.978", + transform: "translate(-822 -420.048) translate(825.084 421.639)", }), ], - } - ) - ), - } - ) - ); -}; -var ResetPasswordEmail = uiEntry.withOverride("EmailPasswordResetPasswordEmail", EmailPasswordResetPasswordEmail); - -var EmailPasswordSubmitNewPassword = function (props) { - var t = translationContext.useTranslation(); - var userContext = uiEntry.useUserContext(); - var _a = React.useState("READY"), - status = _a[0], - setStatus = _a[1]; - var onSuccess = function () { - setStatus("SUCCESS"); - }; - var formFields = props.formFields, - onSignInClicked = props.onSignInClicked; - if (status === "SUCCESS") { - return jsxRuntime.jsx( - "div", + }), + } + ) + ), + }); + } + return jsxRuntime.jsx("div", { + children: jsxRuntime.jsx( + "svg", genericComponentOverrideContext.__assign( - { "data-supertokens": "container" }, { - children: jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "row" }, - { - children: [ - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "headerTitle" }, - { children: t("EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_HEADER_TITLE") } - ) - ), - jsxRuntime.jsx( - formBase.FormRow, - { - children: jsxRuntime.jsxs(React.Fragment, { - children: [ - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { - "data-supertokens": - "primaryText submitNewPasswordSuccessMessage", - }, - { - children: t( - "EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_DESC" - ), - } - ) - ), - jsxRuntime.jsx(button.Button, { - disabled: false, - isLoading: false, - type: "button", - onClick: onSignInClicked, - label: "EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_SIGN_IN_BTN", - }), - ], + xmlns: "http://www.w3.org/2000/svg", + width: "18.281", + height: "12.033", + viewBox: "0 0 18.281 12.033", + "data-supertokens": "showPasswordIcon hide", + }, + { + children: jsxRuntime.jsxs("g", { + children: [ + jsxRuntime.jsx("g", { + children: jsxRuntime.jsx("g", { + children: jsxRuntime.jsx("g", { + children: jsxRuntime.jsx("path", { + fill: "rgb(var(--palette-textPrimary))", + d: "M29.18 100.3c-2.384-3.608-5.586-5.6-9.015-5.6s-6.63 1.989-9.015 5.6a.763.763 0 0 0 0 .84c2.384 3.608 5.586 5.6 9.015 5.6s6.63-1.989 9.015-5.6a.763.763 0 0 0 0-.84zm-9.015 4.914c-2.769 0-5.4-1.589-7.459-4.492 2.052-2.9 4.686-4.492 7.459-4.492s5.4 1.589 7.459 4.492c-2.056 2.899-4.686 4.489-7.458 4.489z", + transform: + "translate(-822 -422.088) translate(822 422.088) translate(-11.025 -94.7)", + }), + }), + }), + }), + jsxRuntime.jsxs( + "g", + genericComponentOverrideContext.__assign( + { + fill: "rgb(var(--palette-textPrimary))", + stroke: "rgb(var(--palette-inputBackground))", + transform: "translate(-822 -422.088) translate(827.133 424.096)", + }, + { + children: [ + jsxRuntime.jsx("circle", { + cx: "4.012", + cy: "4.012", + r: "4.012", + stroke: "none", }), - }, - "form-button" - ), - ], - } - ) - ), + jsxRuntime.jsx("circle", { + cx: "4.012", + cy: "4.012", + r: "3.512", + fill: "none", + }), + ], + } + ) + ), + ], + }), } ) - ); + ), + }); +} + +var Input = function (_a) { + var type = _a.type, + name = _a.name, + hasError = _a.hasError, + autoComplete = _a.autoComplete, + onInputFocus = _a.onInputFocus, + onInputBlur = _a.onInputBlur, + onChange = _a.onChange, + value = _a.value, + placeholder = _a.placeholder, + validated = _a.validated, + autofocus = _a.autofocus; + var t = translationContext.useTranslation(); + var _b = React.useState(false), + showPassword = _b[0], + setShowPassword = _b[1]; + /* + * Method. + */ + function handleFocus() { + if (onInputFocus !== undefined) { + onInputFocus({ + id: name, + value: value, + }); + } + } + function handleBlur() { + if (onInputBlur !== undefined) { + onInputBlur({ + id: name, + value: value, + }); + } + } + function handleChange(event) { + if (onChange) { + onChange({ + id: name, + value: event.target.value, + }); + } + } + if (autoComplete === undefined) { + autoComplete = "off"; + } + var inputType = type; + if (type === "password" && showPassword === true) { + inputType = "text"; } return jsxRuntime.jsx( "div", genericComponentOverrideContext.__assign( - { "data-supertokens": "container" }, + { "data-supertokens": "inputContainer" }, { children: jsxRuntime.jsxs( "div", genericComponentOverrideContext.__assign( - { "data-supertokens": "row" }, + { "data-supertokens": ["inputWrapper", hasError ? "inputError" : ""].join(" ") }, { children: [ - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "headerTitle" }, - { children: t("EMAIL_PASSWORD_RESET_SUBMIT_PW_HEADER_TITLE") } - ) - ), - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "headerSubtitle" }, - { - children: jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "secondaryText" }, - { children: t("EMAIL_PASSWORD_RESET_SUBMIT_PW_HEADER_SUBTITLE") } - ) - ), - } - ) - ), - props.error !== undefined && - jsxRuntime.jsx(generalError.GeneralError, { error: props.error }), - jsxRuntime.jsx(formBase.FormBase, { - formFields: formFields, - clearError: props.clearError, - onError: props.onError, - buttonLabel: "EMAIL_PASSWORD_RESET_SUBMIT_PW_CHANGE_PW_BTN", - onSuccess: onSuccess, - validateOnBlur: true, - callAPI: function (fields) { - return genericComponentOverrideContext.__awaiter( - void 0, - void 0, - void 0, - function () { - var validationErrors, response; - return genericComponentOverrideContext.__generator(this, function (_a) { - switch (_a.label) { - case 0: - return [ - 4 /*yield*/, - genericComponentOverrideContext.validateForm( - fields, - props.config.resetPasswordUsingTokenFeature - .submitNewPasswordForm.formFields - ), - ]; - case 1: - validationErrors = _a.sent(); - if (validationErrors.length > 0) { - return [ - 2 /*return*/, - { - status: "FIELD_ERROR", - formFields: validationErrors, - }, - ]; - } - // Verify that both passwords match. - if (fields[0].value !== fields[1].value) { - return [ - 2 /*return*/, - { - status: "FIELD_ERROR", - formFields: [ - { - id: fields[1].id, - error: "ERROR_CONFIRM_PASSWORD_NO_MATCH", - }, - ], - }, - ]; - } - return [ - 4 /*yield*/, - props.recipeImplementation.submitNewPassword({ - formFields: fields, - userContext: userContext, - }), - ]; - case 2: - response = _a.sent(); - if ( - response.status === "RESET_PASSWORD_INVALID_TOKEN_ERROR" - ) { - throw new STGeneralError__default.default( - "EMAIL_PASSWORD_RESET_PASSWORD_INVALID_TOKEN_ERROR" - ); - } - return [ - 2 /*return*/, - response.status === "FIELD_ERROR" - ? response - : { - status: "OK", - }, - ]; - } - }); - } - ); - }, - showLabels: true, + jsxRuntime.jsx("input", { + autoFocus: autofocus, + autoComplete: autoComplete, + "data-supertokens": "input", + className: "supertokens-input", + onFocus: handleFocus, + onBlur: handleBlur, + type: inputType, + name: name, + placeholder: t(placeholder), + onChange: handleChange, + value: value, }), + hasError === true && + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "inputAdornment inputAdornmentError" }, + { children: jsxRuntime.jsx(ErrorIcon, {}) } + ) + ), + validated === true && + hasError === false && + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "inputAdornment inputAdornmentSuccess" }, + { children: jsxRuntime.jsx(CheckedIcon, {}) } + ) + ), + type === "password" && + value.length > 0 && + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { + onClick: function () { + return setShowPassword(showPassword === false); + }, + "data-supertokens": "inputAdornment showPassword", + }, + { + children: jsxRuntime.jsx(ShowPasswordIcon, { + showPassword: showPassword, + }), + } + ) + ), ], } ) @@ -515,1054 +416,359 @@ var EmailPasswordSubmitNewPassword = function (props) { ) ); }; -var SubmitNewPassword = uiEntry.withOverride("EmailPasswordSubmitNewPassword", EmailPasswordSubmitNewPassword); -/* - * Component. - */ -function ResetPasswordUsingTokenTheme(props) { - /* - * Render. - */ - // If no token, return SubmitNewPassword. - if (props.submitNewPasswordForm !== undefined) { - return jsxRuntime.jsx( - SubmitNewPassword, - genericComponentOverrideContext.__assign({}, props.submitNewPasswordForm) - ); - } - // Otherwise, return EnterEmail. - return jsxRuntime.jsx(ResetPasswordEmail, genericComponentOverrideContext.__assign({}, props.enterEmailForm)); -} -function ResetPasswordUsingTokenThemeWrapper(props) { - var hasFont = translations.hasFontDefined(props.config.rootStyle); - var userStyles = props.submitNewPasswordForm - ? props.config.resetPasswordUsingTokenFeature.submitNewPasswordForm.style - : props.config.resetPasswordUsingTokenFeature.enterEmailForm.style; +function InputError(_a) { + var error = _a.error; + var t = translationContext.useTranslation(); return jsxRuntime.jsx( - uiEntry.UserContextWrapper, + "div", + genericComponentOverrideContext.__assign({ "data-supertokens": "inputErrorMessage" }, { children: t(error) }) + ); +} + +function Label(_a) { + var value = _a.value, + showIsRequired = _a.showIsRequired; + var t = translationContext.useTranslation(); + return jsxRuntime.jsxs( + "div", genericComponentOverrideContext.__assign( - { userContext: props.userContext }, - { - children: jsxRuntime.jsx( - themeBase.ThemeBase, - genericComponentOverrideContext.__assign( - { loadDefaultFont: !hasFont, userStyles: [props.config.rootStyle, userStyles] }, - { - children: jsxRuntime.jsx( - ResetPasswordUsingTokenTheme, - genericComponentOverrideContext.__assign({}, props) - ), - } - ) - ), - } + { "data-supertokens": "label" }, + { children: [t(value), showIsRequired && " *"] } ) ); } -var defaultTranslationsEmailPassword = { - en: genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, translations.defaultTranslationsCommon.en), - translations$1.defaultTranslationsEmailVerification.en +var FormBase = function (props) { + var footer = props.footer, + buttonLabel = props.buttonLabel, + showLabels = props.showLabels, + validateOnBlur = props.validateOnBlur, + formFields = props.formFields; + var unmounting = React.useRef(new AbortController()); + React.useEffect( + function () { + // We need this because in some cases this gets called multiple times + unmounting.current = new AbortController(); + return function () { + unmounting.current.abort(); + }; + }, + [unmounting] + ); + var _a = React.useState( + props.formFields.map(function (f) { + return { id: f.id, value: "" }; + }) ), - { - EMAIL_PASSWORD_EMAIL_LABEL: "Email", - EMAIL_PASSWORD_EMAIL_PLACEHOLDER: "Email address", - EMAIL_PASSWORD_PASSWORD_LABEL: "Password", - EMAIL_PASSWORD_PASSWORD_PLACEHOLDER: "Password", - EMAIL_PASSWORD_SIGN_IN_HEADER_TITLE: "Sign In", - EMAIL_PASSWORD_SIGN_IN_HEADER_SUBTITLE_START: "Not registered yet?", - EMAIL_PASSWORD_SIGN_IN_HEADER_SUBTITLE_SIGN_UP_LINK: "Sign Up", - EMAIL_PASSWORD_SIGN_IN_HEADER_SUBTITLE_END: "", - EMAIL_PASSWORD_SIGN_IN_FOOTER_FORGOT_PW_LINK: "Forgot password?", - EMAIL_PASSWORD_SIGN_IN_SUBMIT_BTN: "SIGN IN", - EMAIL_PASSWORD_SIGN_IN_WRONG_CREDENTIALS_ERROR: "Incorrect email and password combination", - EMAIL_PASSWORD_SIGN_UP_HEADER_TITLE: "Sign Up", - EMAIL_PASSWORD_SIGN_UP_HEADER_SUBTITLE_START: "Already have an account?", - EMAIL_PASSWORD_SIGN_UP_HEADER_SUBTITLE_SIGN_IN_LINK: "Sign In", - EMAIL_PASSWORD_SIGN_UP_HEADER_SUBTITLE_END: "", - EMAIL_PASSWORD_SIGN_UP_FOOTER_START: "By continuing, you agree to our ", - EMAIL_PASSWORD_SIGN_UP_FOOTER_TOS: "Terms of Service", - EMAIL_PASSWORD_SIGN_UP_FOOTER_AND: " and ", - EMAIL_PASSWORD_SIGN_UP_FOOTER_PP: "Privacy Policy", - EMAIL_PASSWORD_SIGN_UP_FOOTER_END: "", - EMAIL_PASSWORD_SIGN_UP_SUBMIT_BTN: "SIGN UP", - EMAIL_PASSWORD_EMAIL_ALREADY_EXISTS: "This email already exists. Please sign in instead", - EMAIL_PASSWORD_RESET_HEADER_TITLE: "Reset your password", - EMAIL_PASSWORD_RESET_HEADER_SUBTITLE: "We will send you an email to reset your password", - EMAIL_PASSWORD_RESET_SEND_FALLBACK_EMAIL: "your account", - EMAIL_PASSWORD_RESET_SEND_BEFORE_EMAIL: "A password reset email has been sent to ", - EMAIL_PASSWORD_RESET_SEND_AFTER_EMAIL: ", if it exists in our system. ", - EMAIL_PASSWORD_RESET_RESEND_LINK: "Resend or change email", - EMAIL_PASSWORD_RESET_SEND_BTN: "Email me", - EMAIL_PASSWORD_RESET_SIGN_IN_LINK: "Sign In", - EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_HEADER_TITLE: "Success!", - EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_DESC: "Your password has been updated successfully", - EMAIL_PASSWORD_RESET_SUBMIT_PW_SUCCESS_SIGN_IN_BTN: "SIGN IN", - EMAIL_PASSWORD_NEW_PASSWORD_LABEL: "New password", - EMAIL_PASSWORD_NEW_PASSWORD_PLACEHOLDER: "New password", - EMAIL_PASSWORD_CONFIRM_PASSWORD_LABEL: "Confirm password", - EMAIL_PASSWORD_CONFIRM_PASSWORD_PLACEHOLDER: "Confirm your password", - EMAIL_PASSWORD_RESET_SUBMIT_PW_HEADER_TITLE: "Change your password", - EMAIL_PASSWORD_RESET_SUBMIT_PW_HEADER_SUBTITLE: "Enter a new password below to change your password", - EMAIL_PASSWORD_RESET_SUBMIT_PW_CHANGE_PW_BTN: "CHANGE PASSWORD", - EMAIL_PASSWORD_RESET_PASSWORD_INVALID_TOKEN_ERROR: "Invalid password reset token", - ERROR_EMAIL_NON_STRING: "Email must be of type string", - ERROR_EMAIL_INVALID: "Email is invalid", - ERROR_PASSWORD_NON_STRING: "Password must be of type string", - ERROR_PASSWORD_TOO_SHORT: "Password must contain at least 8 characters, including a number", - ERROR_PASSWORD_TOO_LONG: "Password's length must be lesser than 100 characters", - ERROR_PASSWORD_NO_ALPHA: "Password must contain at least one alphabet", - ERROR_PASSWORD_NO_NUM: "Password must contain at least one number", - ERROR_CONFIRM_PASSWORD_NO_MATCH: "Confirmation password doesn't match", - ERROR_NON_OPTIONAL: "Field is not optional", - /* - * The following are error messages from our backend SDK. - * These are returned as full messages to preserver compatibilty, but they work just like the keys above. - * They are shown as is by default (setting the value to undefined will display the raw translation key) - */ - "This email already exists. Please sign in instead.": undefined, - "Field is not optional": undefined, - "Password must contain at least 8 characters, including a number": undefined, - "Password's length must be lesser than 100 characters": undefined, - "Password must contain at least one alphabet": undefined, - "Password must contain at least one number": undefined, - "Email is invalid": undefined, - "Reset password link was not created because of account take over risk. Please contact support. (ERR_CODE_001)": - undefined, - "Cannot sign up due to security reasons. Please try logging in, use a different login method or contact support. (ERR_CODE_007)": - undefined, - "Cannot sign in due to security reasons. Please try resetting your password, use a different login method or contact support. (ERR_CODE_008)": - undefined, - } - ), -}; - -var ResetPasswordUsingToken$1 = function (props) { - var token = genericComponentOverrideContext.getQueryParams("token"); - var _a = React__namespace.useState(), - error = _a[0], - setError = _a[1]; - var enterEmailFormFeature = props.recipe.config.resetPasswordUsingTokenFeature.enterEmailForm; - var submitNewPasswordFormFeature = props.recipe.config.resetPasswordUsingTokenFeature.submitNewPasswordForm; - var submitNewPasswordForm = - token === undefined || token === null - ? undefined - : { - error: error, - onError: function (error) { - return setError(error); - }, - clearError: function () { - return setError(undefined); - }, - styleFromInit: submitNewPasswordFormFeature.style, - formFields: submitNewPasswordFormFeature.formFields, - recipeImplementation: props.recipe.webJSRecipe, - config: props.recipe.config, - onSignInClicked: function () { - void genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().redirectToAuth({ - show: "signin", - history: props.history, - redirectBack: false, - }); - }, - token: token, - }; - var enterEmailForm = { - onBackButtonClicked: function () { - return genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().redirectToAuth({ - show: "signin", - history: props.history, - redirectBack: false, + fieldStates = _a[0], + setFieldStates = _a[1]; + var _b = React.useState(false), + isLoading = _b[0], + setIsLoading = _b[1]; + var updateFieldState = React.useCallback( + function (id, update) { + setFieldStates(function (os) { + var field = os.find(function (f) { + return f.id === id; + }); + if (field === undefined) { + return genericComponentOverrideContext.__spreadArray( + genericComponentOverrideContext.__spreadArray([], os, true), + [update({ id: id, value: "" })], + false + ); + } + return os + .filter(function (f) { + return f !== field; + }) + .concat(update(field)); }); }, - error: error, - onError: function (error) { - return setError(error); - }, - clearError: function () { - return setError(undefined); + [setFieldStates] + ); + var onInputFocus = React.useCallback( + function (field) { + updateFieldState(field.id, function (os) { + return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, os), { + validated: false, + }); + }); }, - styleFromInit: enterEmailFormFeature.style, - formFields: enterEmailFormFeature.formFields, - recipeImplementation: props.recipe.webJSRecipe, - config: props.recipe.config, - }; - var childProps = { - config: props.recipe.config, - submitNewPasswordForm: submitNewPasswordForm, - enterEmailForm: enterEmailForm, - }; - var recipeComponentOverrides = props.useComponentOverrides(); - return jsxRuntime.jsx( - uiEntry.ComponentOverrideContext.Provider, - genericComponentOverrideContext.__assign( - { value: recipeComponentOverrides }, - { - children: jsxRuntime.jsx( - uiEntry.FeatureWrapper, - genericComponentOverrideContext.__assign( - { - useShadowDom: props.recipe.config.useShadowDom, - defaultStore: defaultTranslationsEmailPassword, - }, - { - children: jsxRuntime.jsxs(React.Fragment, { - children: [ - props.children === undefined && - jsxRuntime.jsx( - ResetPasswordUsingTokenThemeWrapper, - genericComponentOverrideContext.__assign({}, childProps) - ), - props.children && - React__namespace.Children.map(props.children, function (child) { - if (React__namespace.isValidElement(child)) { - return React__namespace.cloneElement(child, childProps); - } - return child; - }), - ], - }), - } - ) - ), - } - ) + [updateFieldState] ); -}; - -var SignInFooter = uiEntry.withOverride("EmailPasswordSignInFooter", function EmailPasswordSignInFooter(_a) { - var onClick = _a.onClick; - var t = translationContext.useTranslation(); - return jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "link secondaryText forgotPasswordLink", onClick: onClick }, - { children: t("EMAIL_PASSWORD_SIGN_IN_FOOTER_FORGOT_PW_LINK") } - ) - ); -}); - -var SignInForm = uiEntry.withOverride("EmailPasswordSignInForm", function EmailPasswordSignInForm(props) { - var _this = this; - var userContext = uiEntry.useUserContext(); - return jsxRuntime.jsx(formBase.FormBase, { - formFields: props.formFields, - clearError: props.clearError, - onError: props.onError, - buttonLabel: "EMAIL_PASSWORD_SIGN_IN_SUBMIT_BTN", - onSuccess: props.onSuccess, - callAPI: function (formFields) { - return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { - var validationErrors, response; - return genericComponentOverrideContext.__generator(this, function (_a) { - switch (_a.label) { + var onInputBlur = React.useCallback( + function (field) { + return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () { + var fieldConfig, error, _a; + return genericComponentOverrideContext.__generator(this, function (_b) { + switch (_b.label) { case 0: - return [ - 4 /*yield*/, - genericComponentOverrideContext.validateForm( - formFields, - props.config.signInAndUpFeature.signInForm.formFields - ), - ]; - case 1: - validationErrors = _a.sent(); - if (validationErrors.length > 0) { - return [ - 2 /*return*/, - { - status: "FIELD_ERROR", - formFields: validationErrors, - }, - ]; + if (!validateOnBlur) { + return [2 /*return*/]; } - return [ - 4 /*yield*/, - props.recipeImplementation.signIn({ - formFields: formFields, - userContext: userContext, - }), - ]; + fieldConfig = props.formFields.find(function (f) { + return f.id === field.id; + }); + if (!(fieldConfig && field.value !== "")) return [3 /*break*/, 2]; + return [4 /*yield*/, fieldConfig.validate(field.value)]; + case 1: + _a = _b.sent(); + return [3 /*break*/, 3]; case 2: - response = _a.sent(); - if (response.status === "WRONG_CREDENTIALS_ERROR") { - throw new STGeneralError__default.default( - "EMAIL_PASSWORD_SIGN_IN_WRONG_CREDENTIALS_ERROR" + _a = undefined; + _b.label = 3; + case 3: + error = _a; + updateFieldState(field.id, function (os) { + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, os), + { error: error, validated: error === undefined && field.value.length !== 0 } ); - } else if (response.status === "SIGN_IN_NOT_ALLOWED") { - throw new STGeneralError__default.default(response.reason); - } else { - return [2 /*return*/, response]; - } + }); + return [2 /*return*/]; } }); }); }, - validateOnBlur: false, - showLabels: true, - footer: props.footer, - }); -}); - -var SignInHeader = uiEntry.withOverride("EmailPasswordSignInHeader", function EmailPasswordSignInHeader(_a) { - var onClick = _a.onClick; - var t = translationContext.useTranslation(); - return jsxRuntime.jsxs(React.Fragment, { - children: [ - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "headerTitle" }, - { children: t("EMAIL_PASSWORD_SIGN_IN_HEADER_TITLE") } - ) - ), - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "headerSubtitle" }, - { - children: jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "secondaryText" }, - { - children: [ - t("EMAIL_PASSWORD_SIGN_IN_HEADER_SUBTITLE_START"), - jsxRuntime.jsx( - "span", - genericComponentOverrideContext.__assign( - { "data-supertokens": "link", onClick: onClick }, - { children: t("EMAIL_PASSWORD_SIGN_IN_HEADER_SUBTITLE_SIGN_UP_LINK") } - ) - ), - t("EMAIL_PASSWORD_SIGN_IN_HEADER_SUBTITLE_END"), - ], - } - ) - ), - } - ) - ), - jsxRuntime.jsx("div", { "data-supertokens": "divider" }), - ], - }); -}); - -var SignIn = uiEntry.withOverride("EmailPasswordSignIn", function EmailPasswordSignIn(props) { - return jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "container" }, - { - children: [ - jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "row" }, - { - children: [ - jsxRuntime.jsx(SignInHeader, { onClick: props.signUpClicked }), - props.error !== undefined && - jsxRuntime.jsx(generalError.GeneralError, { error: props.error }), - jsxRuntime.jsx( - SignInForm, - genericComponentOverrideContext.__assign({}, props, { - footer: jsxRuntime.jsx(SignInFooter, { - onClick: props.forgotPasswordClick, - }), - }) - ), - ], - } - ) - ), - jsxRuntime.jsx(SuperTokensBranding.SuperTokensBranding, {}), - ], - } - ) + [validateOnBlur, updateFieldState, props.formFields] ); -}); - -var SignUpFooter = uiEntry.withOverride("EmailPasswordSignUpFooter", function EmailPasswordSignUpFooter(_a) { - var termsOfServiceLink = _a.termsOfServiceLink, - privacyPolicyLink = _a.privacyPolicyLink; - var t = translationContext.useTranslation(); - if (termsOfServiceLink === undefined && privacyPolicyLink === undefined) { - return null; - } - return jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "secondaryText privacyPolicyAndTermsAndConditions" }, - { - children: [ - t("EMAIL_PASSWORD_SIGN_UP_FOOTER_START"), - termsOfServiceLink !== undefined && - jsxRuntime.jsx( - "a", - genericComponentOverrideContext.__assign( - { - "data-supertokens": "link", - href: termsOfServiceLink, - target: "_blank", - rel: "noopener noreferer", - }, - { children: t("EMAIL_PASSWORD_SIGN_UP_FOOTER_TOS") } - ) - ), - termsOfServiceLink !== undefined && - privacyPolicyLink !== undefined && - t("EMAIL_PASSWORD_SIGN_UP_FOOTER_AND"), - privacyPolicyLink !== undefined && - jsxRuntime.jsx( - "a", - genericComponentOverrideContext.__assign( - { - "data-supertokens": "link", - href: privacyPolicyLink, - target: "_blank", - rel: "noopener noreferer", - }, - { children: t("EMAIL_PASSWORD_SIGN_UP_FOOTER_PP") } - ) - ), - t("EMAIL_PASSWORD_SIGN_UP_FOOTER_END"), - ], - } - ) + var onInputChange = React.useCallback( + function (field) { + updateFieldState(field.id, function (os) { + return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, os), { + value: field.value, + error: undefined, + }); + }); + props.clearError(); + }, + [updateFieldState] ); -}); - -/* - * Component. - */ -var SignUpForm = uiEntry.withOverride("EmailPasswordSignUpForm", function EmailPasswordSignUpForm(props) { - var _this = this; - var userContext = uiEntry.useUserContext(); - return jsxRuntime.jsx(formBase.FormBase, { - formFields: props.formFields, - clearError: props.clearError, - onError: props.onError, - buttonLabel: "EMAIL_PASSWORD_SIGN_UP_SUBMIT_BTN", - onSuccess: props.onSuccess, - callAPI: function (formFields) { - return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { - var validationErrors, res; + var onFormSubmit = React.useCallback( + function (e) { + return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () { + var apiFields, fieldUpdates, result, generalError, e_1, _loop_1, _i, formFields_1, field, errorFields_1; return genericComponentOverrideContext.__generator(this, function (_a) { switch (_a.label) { case 0: - return [ - 4 /*yield*/, - genericComponentOverrideContext.validateForm( - formFields, - props.config.signInAndUpFeature.signUpForm.formFields - ), - ]; + // Prevent default event propagation. + e.preventDefault(); + // Set loading state. + setIsLoading(true); + setFieldStates(function (os) { + return os.map(function (fs) { + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, fs), + { error: undefined } + ); + }); + }); + apiFields = formFields.map(function (field) { + var fieldState = fieldStates.find(function (fs) { + return fs.id === field.id; + }); + return { + id: field.id, + value: fieldState === undefined ? "" : fieldState.value, + }; + }); + fieldUpdates = []; + _a.label = 1; case 1: - validationErrors = _a.sent(); - if (validationErrors.length > 0) { - return [ - 2 /*return*/, - { - status: "FIELD_ERROR", - formFields: validationErrors, - }, - ]; - } + _a.trys.push([1, 6, 7, 8]); + result = void 0; + generalError = void 0; + _a.label = 2; + case 2: + _a.trys.push([2, 4, , 5]); return [ 4 /*yield*/, - props.recipeImplementation.signUp({ - formFields: formFields, - userContext: userContext, + props.callAPI(apiFields, function (id, value) { + return fieldUpdates.push({ id: id, value: value }); }), ]; - case 2: - res = _a.sent(); - if (res.status === "SIGN_UP_NOT_ALLOWED") { - throw new STGeneralError__default$1.default(res.reason); + case 3: + result = _a.sent(); + return [3 /*break*/, 5]; + case 4: + e_1 = _a.sent(); + if (STGeneralError__default.default.isThisError(e_1)) { + generalError = e_1; + } else { + throw e_1; + } + return [3 /*break*/, 5]; + case 5: + if (unmounting.current.signal.aborted) { + return [2 /*return*/]; + } + _loop_1 = function (field) { + var update = fieldUpdates.find(function (f) { + return f.id === field.id; + }); + if (update || field.clearOnSubmit === true) { + // We can do these one by one, it's almost never more than one field + updateFieldState(field.id, function (os) { + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, os), + { value: update ? update.value : "" } + ); + }); + } + }; + for (_i = 0, formFields_1 = formFields; _i < formFields_1.length; _i++) { + field = formFields_1[_i]; + _loop_1(field); + } + if (generalError !== undefined) { + props.onError(generalError.message); + } else { + // If successful + if (result.status === "OK") { + setIsLoading(false); + props.clearError(); + if (props.onSuccess !== undefined) { + props.onSuccess(result); + } + } + if (unmounting.current.signal.aborted) { + return [2 /*return*/]; + } + // If field error. + if (result.status === "FIELD_ERROR") { + errorFields_1 = result.formFields; + setFieldStates(function (os) { + return os.map(function (fs) { + var _a; + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, fs), + { + error: + (_a = errorFields_1.find(function (ef) { + return ef.id === fs.id; + })) === null || _a === void 0 + ? void 0 + : _a.error, + } + ); + }); + }); + } } - return [2 /*return*/, res]; + return [3 /*break*/, 8]; + case 6: + _a.sent(); + props.onError("SOMETHING_WENT_WRONG_ERROR"); + return [3 /*break*/, 8]; + case 7: + setIsLoading(false); + return [7 /*endfinally*/]; + case 8: + return [2 /*return*/]; } }); }); }, - validateOnBlur: true, - showLabels: true, - footer: props.footer, - }); -}); - -var SignUpHeader = uiEntry.withOverride("EmailPasswordSignUpHeader", function EmailPasswordSignUpHeader(_a) { - var onClick = _a.onClick; - var t = translationContext.useTranslation(); - return jsxRuntime.jsxs(React.Fragment, { - children: [ - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "headerTitle" }, - { children: t("EMAIL_PASSWORD_SIGN_UP_HEADER_TITLE") } - ) - ), - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "headerSubtitle" }, - { - children: jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "secondaryText" }, - { - children: [ - t("EMAIL_PASSWORD_SIGN_UP_HEADER_SUBTITLE_START"), - jsxRuntime.jsx( - "span", - genericComponentOverrideContext.__assign( - { "data-supertokens": "link", onClick: onClick }, - { children: t("EMAIL_PASSWORD_SIGN_UP_HEADER_SUBTITLE_SIGN_IN_LINK") } - ) - ), - t("EMAIL_PASSWORD_SIGN_UP_HEADER_SUBTITLE_END"), - ], - } - ) - ), - } - ) - ), - jsxRuntime.jsx("div", { "data-supertokens": "divider" }), - ], - }); -}); - -var SignUp = uiEntry.withOverride("EmailPasswordSignUp", function EmailPasswordSignUp(props) { + [setIsLoading, setFieldStates, props, formFields, fieldStates] + ); return jsxRuntime.jsxs( - "div", + "form", genericComponentOverrideContext.__assign( - { "data-supertokens": "container" }, + { autoComplete: "on", noValidate: true, onSubmit: onFormSubmit }, { children: [ - jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "row" }, - { - children: [ - jsxRuntime.jsx(SignUpHeader, { onClick: props.signInClicked }), - props.error !== undefined && - jsxRuntime.jsx(generalError.GeneralError, { error: props.error }), - jsxRuntime.jsx( - SignUpForm, - genericComponentOverrideContext.__assign({}, props, { - footer: jsxRuntime.jsx(SignUpFooter, { - privacyPolicyLink: - props.config.signInAndUpFeature.signUpForm.privacyPolicyLink, - termsOfServiceLink: - props.config.signInAndUpFeature.signUpForm.termsOfServiceLink, - }), - }) - ), - ], - } - ) - ), - jsxRuntime.jsx(SuperTokensBranding.SuperTokensBranding, {}), - ], - } - ) - ); -}); - -var SignInAndUpTheme = function (props) { - // If isSignUp, return signUp. - if (props.featureState.isSignUp) { - return jsxRuntime.jsx( - SignUp, - genericComponentOverrideContext.__assign({}, props.signUpForm, { - signInClicked: function () { - props.dispatch({ type: "setSignIn" }); - }, - }) - ); - } - // Otherwise, return SignIn. - return jsxRuntime.jsx( - SignIn, - genericComponentOverrideContext.__assign({}, props.signInForm, { - signUpClicked: function () { - props.dispatch({ type: "setSignUp" }); - }, - }) - ); -}; -function SignInAndUpThemeWrapper(props) { - var hasFont = translations.hasFontDefined(props.config.rootStyle); - var activeStyle = props.featureState.isSignUp - ? props.config.signInAndUpFeature.signUpForm.style - : props.config.signInAndUpFeature.signInForm.style; - return jsxRuntime.jsx( - uiEntry.UserContextWrapper, - genericComponentOverrideContext.__assign( - { userContext: props.userContext }, - { - children: jsxRuntime.jsx( - themeBase.ThemeBase, - genericComponentOverrideContext.__assign( - { loadDefaultFont: !hasFont, userStyles: [props.config.rootStyle, activeStyle] }, - { - children: jsxRuntime.jsx( - SignInAndUpTheme, - genericComponentOverrideContext.__assign({}, props) - ), + formFields.map(function (field) { + var type = "text"; + // If email or password, replace field type. + if (validators.MANDATORY_FORM_FIELDS_ID_ARRAY.includes(field.id)) { + type = field.id; } - ) - ), - } - ) - ); -} - -var useFeatureReducer = function (recipe) { - return React__namespace.useReducer( - function (oldState, action) { - switch (action.type) { - case "setSignIn": - return genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, oldState), - { error: undefined, isSignUp: false } - ); - case "setSignUp": - return genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, oldState), - { error: undefined, isSignUp: true } - ); - case "setError": - return genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, oldState), - { error: action.error } - ); - default: - return oldState; - } - }, - { - isSignUp: recipe === undefined ? false : recipe.config.signInAndUpFeature.defaultToSignUp, - user: undefined, - error: undefined, - }, - function (initArg) { - var show = genericComponentOverrideContext.getQueryParams("show"); - var isSignUp = initArg.isSignUp; - if (show !== null) { - isSignUp = show === "signup"; - } - return { - isSignUp: isSignUp, - user: undefined, - error: undefined, - }; - } - ); -}; -function useChildProps(recipe$1, state, dispatch, history) { - var _this = this; - var recipeImplementation = React.useMemo( - function () { - return recipe$1 && getModifiedRecipeImplementation(recipe$1.webJSRecipe); - }, - [recipe$1] - ); - var userContext = uiEntry.useUserContext(); - var onSignInSuccess = React.useCallback( - function (response) { - return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { - return genericComponentOverrideContext.__generator(this, function (_a) { - return [ - 2 /*return*/, - recipe.Session.getInstanceOrThrow().validateGlobalClaimsAndHandleSuccessRedirection( - { - rid: recipe$1.config.recipeId, - successRedirectContext: { - action: "SUCCESS", - isNewRecipeUser: false, - user: response.user, - redirectToPath: genericComponentOverrideContext.getRedirectToPathFromURL(), - }, - }, - userContext, - history - ), - ]; - }); - }); - }, - [recipe$1, userContext, history] - ); - var onSignUpSuccess = React.useCallback( - function (response) { - return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { - return genericComponentOverrideContext.__generator(this, function (_a) { - return [ - 2 /*return*/, - recipe.Session.getInstanceOrThrow().validateGlobalClaimsAndHandleSuccessRedirection( - { - rid: recipe$1.config.recipeId, - successRedirectContext: { - action: "SUCCESS", - isNewRecipeUser: true, - user: response.user, - redirectToPath: genericComponentOverrideContext.getRedirectToPathFromURL(), - }, - }, - userContext, - history - ), - ]; - }); - }); - }, - [recipe$1, userContext, history] - ); - return React.useMemo( - function () { - if (recipe$1 === undefined || recipeImplementation === undefined) { - return; - } - var signInAndUpFeature = recipe$1.config.signInAndUpFeature; - var signUpFeature = signInAndUpFeature.signUpForm; - var signInFeature = signInAndUpFeature.signInForm; - var signInForm = { - recipeImplementation: recipeImplementation, - config: recipe$1.config, - styleFromInit: signInFeature.style, - formFields: signInFeature.formFields, - error: state.error, - clearError: function () { - return dispatch({ type: "setError", error: undefined }); - }, - onError: function (error) { - return dispatch({ type: "setError", error: error }); - }, - onSuccess: onSignInSuccess, - forgotPasswordClick: function () { - return recipe$1.redirect({ action: "RESET_PASSWORD" }, history); - }, - }; - var signUpForm = { - recipeImplementation: recipeImplementation, - config: recipe$1.config, - styleFromInit: signUpFeature.style, - formFields: getThemeSignUpFeatureFormFields(signUpFeature.formFields, recipe$1, userContext), - error: state.error, - clearError: function () { - return dispatch({ type: "setError", error: undefined }); - }, - onError: function (error) { - return dispatch({ type: "setError", error: error }); - }, - onSuccess: onSignUpSuccess, - }; - return { - config: recipe$1.config, - signInForm: signInForm, - signUpForm: signUpForm, - }; - }, - [recipe$1, state, dispatch] - ); -} -var SignInAndUpFeature = function (props) { - var _a = useFeatureReducer(props.recipe), - state = _a[0], - dispatch = _a[1]; - var childProps = useChildProps(props.recipe, state, dispatch, props.history); - var recipeComponentOverrides = props.useComponentOverrides(); - return jsxRuntime.jsx( - uiEntry.ComponentOverrideContext.Provider, - genericComponentOverrideContext.__assign( - { value: recipeComponentOverrides }, - { - children: jsxRuntime.jsx( - uiEntry.FeatureWrapper, - genericComponentOverrideContext.__assign( - { - useShadowDom: props.recipe.config.useShadowDom, - defaultStore: defaultTranslationsEmailPassword, - }, + if (field.id === "confirm-password") { + type = "password"; + } + var fstate = fieldStates.find(function (s) { + return s.id === field.id; + }) || { + id: field.id, + validated: false, + error: undefined, + value: "", + }; + return jsxRuntime.jsx( + FormRow, + genericComponentOverrideContext.__assign( + { hasError: fstate.error !== undefined }, + { + children: jsxRuntime.jsxs(React.Fragment, { + children: [ + showLabels && + (field.labelComponent !== undefined + ? field.labelComponent + : jsxRuntime.jsx(Label, { + value: field.label, + showIsRequired: field.showIsRequired, + })), + field.inputComponent !== undefined + ? jsxRuntime.jsx(field.inputComponent, { + type: type, + name: field.id, + validated: fstate.validated === true, + placeholder: field.placeholder, + value: fstate.value, + autoComplete: field.autoComplete, + autofocus: field.autofocus, + onInputFocus: onInputFocus, + onInputBlur: onInputBlur, + onChange: onInputChange, + hasError: fstate.error !== undefined, + }) + : jsxRuntime.jsx(Input, { + type: type, + name: field.id, + validated: fstate.validated === true, + placeholder: field.placeholder, + value: fstate.value, + autoComplete: field.autoComplete, + onInputFocus: onInputFocus, + onInputBlur: onInputBlur, + onChange: onInputChange, + autofocus: field.autofocus, + hasError: fstate.error !== undefined, + }), + fstate.error && jsxRuntime.jsx(InputError, { error: fstate.error }), + ], + }), + } + ), + field.id + ); + }), + jsxRuntime.jsx( + FormRow, { children: jsxRuntime.jsxs(React.Fragment, { children: [ - props.children === undefined && - jsxRuntime.jsx( - SignInAndUpThemeWrapper, - genericComponentOverrideContext.__assign({}, childProps, { - featureState: state, - dispatch: dispatch, - }) - ), - props.children && - React__namespace.Children.map(props.children, function (child) { - if (React__namespace.isValidElement(child)) { - return React__namespace.cloneElement( - child, - genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, childProps), - { featureState: state, dispatch: dispatch } - ) - ); - } - return child; - }), + jsxRuntime.jsx(button.Button, { + disabled: isLoading, + isLoading: isLoading, + type: "submit", + label: buttonLabel, + }), + footer, ], }), - } - ) - ), + }, + "form-button" + ), + ], } ) ); }; -var getModifiedRecipeImplementation = function (origImpl) { - return genericComponentOverrideContext.__assign({}, origImpl); -}; -function getThemeSignUpFeatureFormFields(formFields, recipe, userContext) { - var _this = this; - var emailPasswordOnly = formFields.length === 2; - return formFields.map(function (field) { - return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, field), { - showIsRequired: (function () { - // If email and password only, do not show required indicator (*). - if (emailPasswordOnly) { - return false; - } - // Otherwise, show for all non optional fields (including email and password). - return field.optional === false; - })(), - validate: (function () { - // If field is not email, return field validate unchanged. - if (field.id !== "email") { - return field.validate; - } - // Otherwise, if email, use syntax validate method and check if email exists. - return function (value) { - return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { - var error, emailExists, err_1; - return genericComponentOverrideContext.__generator(this, function (_a) { - switch (_a.label) { - case 0: - return [4 /*yield*/, field.validate(value)]; - case 1: - error = _a.sent(); - if (error !== undefined) { - return [2 /*return*/, error]; - } - if (typeof value !== "string") { - return [2 /*return*/, "GENERAL_ERROR_EMAIL_NON_STRING"]; - } - _a.label = 2; - case 2: - _a.trys.push([2, 4, , 5]); - return [ - 4 /*yield*/, - recipe.webJSRecipe.doesEmailExist({ - email: value, - userContext: userContext, - }), - ]; - case 3: - emailExists = _a.sent().doesExist; - if (emailExists) { - return [2 /*return*/, "EMAIL_PASSWORD_EMAIL_ALREADY_EXISTS"]; - } - return [3 /*break*/, 5]; - case 4: - err_1 = _a.sent(); - if (STGeneralError__default.default.isThisError(err_1)) { - return [2 /*return*/, err_1.message]; - } - return [3 /*break*/, 5]; - case 5: - return [2 /*return*/, undefined]; - } - }); - }); - }; - })(), - }); - }); -} - -var EmailPasswordPreBuiltUI = /** @class */ (function (_super) { - genericComponentOverrideContext.__extends(EmailPasswordPreBuiltUI, _super); - function EmailPasswordPreBuiltUI(recipeInstance) { - var _this = _super.call(this) || this; - _this.recipeInstance = recipeInstance; - // Instance methods - _this.getFeatures = function (useComponentOverrides) { - if (useComponentOverrides === void 0) { - useComponentOverrides = componentOverrideContext.useContext; - } - var features = {}; - if (_this.recipeInstance.config.signInAndUpFeature.disableDefaultUI !== true) { - var normalisedFullPath = _this.recipeInstance.config.appInfo.websiteBasePath.appendPath( - new NormalisedURLPath__default.default("/") - ); - features[normalisedFullPath.getAsStringDangerous()] = { - matches: genericComponentOverrideContext.matchRecipeIdUsingQueryParams( - _this.recipeInstance.config.recipeId - ), - component: function (props) { - return _this.getFeatureComponent("signinup", props, useComponentOverrides); - }, - recipeID: recipe$1.EmailPassword.RECIPE_ID, - }; - } - if (_this.recipeInstance.config.resetPasswordUsingTokenFeature.disableDefaultUI !== true) { - var normalisedFullPath = _this.recipeInstance.config.appInfo.websiteBasePath.appendPath( - new NormalisedURLPath__default.default(validators.DEFAULT_RESET_PASSWORD_PATH) - ); - features[normalisedFullPath.getAsStringDangerous()] = { - matches: genericComponentOverrideContext.matchRecipeIdUsingQueryParams( - _this.recipeInstance.config.recipeId - ), - component: function (props) { - return _this.getFeatureComponent("resetpassword", props, useComponentOverrides); - }, - recipeID: recipe$1.EmailPassword.RECIPE_ID, - }; - } - return features; - }; - _this.getFeatureComponent = function (componentName, props, useComponentOverrides) { - if (useComponentOverrides === void 0) { - useComponentOverrides = componentOverrideContext.useContext; - } - if (componentName === "signinup") { - if (props.redirectOnSessionExists !== false) { - return jsxRuntime.jsx( - uiEntry.UserContextWrapper, - genericComponentOverrideContext.__assign( - { userContext: props.userContext }, - { - children: jsxRuntime.jsx( - SuperTokensBranding.AuthWidgetWrapper, - genericComponentOverrideContext.__assign( - { authRecipe: _this.recipeInstance, history: props.history }, - { - children: jsxRuntime.jsx( - SignInAndUpFeature, - genericComponentOverrideContext.__assign( - { recipe: _this.recipeInstance }, - props, - { useComponentOverrides: useComponentOverrides } - ) - ), - } - ) - ), - } - ) - ); - } else { - return jsxRuntime.jsx( - uiEntry.UserContextWrapper, - genericComponentOverrideContext.__assign( - { userContext: props.userContext }, - { - children: jsxRuntime.jsx( - SignInAndUpFeature, - genericComponentOverrideContext.__assign({ recipe: _this.recipeInstance }, props, { - useComponentOverrides: useComponentOverrides, - }) - ), - } - ) - ); - } - } else if (componentName === "resetpassword") { - return jsxRuntime.jsx( - uiEntry.UserContextWrapper, - genericComponentOverrideContext.__assign( - { userContext: props.userContext }, - { - children: jsxRuntime.jsx( - ResetPasswordUsingToken$1, - genericComponentOverrideContext.__assign({ recipe: _this.recipeInstance }, props, { - useComponentOverrides: useComponentOverrides, - }) - ), - } - ) - ); - } else { - throw new Error("Should never come here."); - } - }; - return _this; - } - // Static methods - EmailPasswordPreBuiltUI.getInstanceOrInitAndGetInstance = function () { - if (EmailPasswordPreBuiltUI.instance === undefined) { - var recipeInstance = recipe$1.EmailPassword.getInstanceOrThrow(); - EmailPasswordPreBuiltUI.instance = new EmailPasswordPreBuiltUI(recipeInstance); - } - return EmailPasswordPreBuiltUI.instance; - }; - EmailPasswordPreBuiltUI.getFeatures = function (useComponentOverrides) { - if (useComponentOverrides === void 0) { - useComponentOverrides = componentOverrideContext.useContext; - } - return EmailPasswordPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatures(useComponentOverrides); - }; - EmailPasswordPreBuiltUI.getFeatureComponent = function (componentName, props, useComponentOverrides) { - if (useComponentOverrides === void 0) { - useComponentOverrides = componentOverrideContext.useContext; - } - return EmailPasswordPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent( - componentName, - props, - useComponentOverrides - ); - }; - // For tests - EmailPasswordPreBuiltUI.reset = function () { - if (!genericComponentOverrideContext.isTest()) { - return; - } - EmailPasswordPreBuiltUI.instance = undefined; - return; - }; - EmailPasswordPreBuiltUI.SignInAndUp = function (prop) { - if (prop === void 0) { - prop = {}; - } - return EmailPasswordPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent("signinup", prop); - }; - EmailPasswordPreBuiltUI.ResetPasswordUsingToken = function (prop) { - return EmailPasswordPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent("resetpassword", prop); - }; - EmailPasswordPreBuiltUI.ResetPasswordUsingTokenTheme = ResetPasswordUsingTokenThemeWrapper; - EmailPasswordPreBuiltUI.SignInAndUpTheme = SignInAndUpThemeWrapper; - return EmailPasswordPreBuiltUI; -})(uiEntry.RecipeRouter); -var SignInAndUp = EmailPasswordPreBuiltUI.SignInAndUp; -var ResetPasswordUsingToken = EmailPasswordPreBuiltUI.ResetPasswordUsingToken; -exports.EmailPasswordPreBuiltUI = EmailPasswordPreBuiltUI; -exports.ResetPasswordUsingToken = ResetPasswordUsingToken; -exports.ResetPasswordUsingTokenThemeWrapper = ResetPasswordUsingTokenThemeWrapper; -exports.SignInAndUp = SignInAndUp; -exports.SignInAndUpThemeWrapper = SignInAndUpThemeWrapper; -exports.SignInFooter = SignInFooter; -exports.SignInForm = SignInForm; -exports.SignInHeader = SignInHeader; -exports.SignUpFooter = SignUpFooter; -exports.SignUpForm = SignUpForm; -exports.SignUpHeader = SignUpHeader; -exports.defaultTranslationsEmailPassword = defaultTranslationsEmailPassword; -exports.useChildProps = useChildProps; -exports.useFeatureReducer = useFeatureReducer; +exports.ErrorIcon = ErrorIcon; +exports.FormBase = FormBase; +exports.FormRow = FormRow; +exports.Label = Label; diff --git a/lib/build/emailpassword-shared8.js b/lib/build/emailpassword-shared8.js deleted file mode 100644 index 3346c417d..000000000 --- a/lib/build/emailpassword-shared8.js +++ /dev/null @@ -1,774 +0,0 @@ -"use strict"; - -var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); -var jsxRuntime = require("react/jsx-runtime"); -var React = require("react"); -var STGeneralError = require("supertokens-web-js/utils/error"); -var validators = require("./emailpassword-shared6.js"); -var button = require("./emailpassword-shared3.js"); -require("./index2.js"); -var translationContext = require("./translationContext.js"); - -function _interopDefault(e) { - return e && e.__esModule ? e : { default: e }; -} - -var STGeneralError__default = /*#__PURE__*/ _interopDefault(STGeneralError); - -/* - * Component. - */ -function FormRow(_a) { - var children = _a.children, - hasError = _a.hasError; - return jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": ["formRow", hasError ? "hasError" : ""].join(" ") }, - { children: children } - ) - ); -} - -/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. - * - * This software is licensed under the Apache License, Version 2.0 (the - * "License") as published by the Apache Software Foundation. - * - * You may not use this file except in compliance with the License. You may - * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -/* - * Imports. - */ -/* - * Component. - */ -function CheckedIcon() { - return jsxRuntime.jsx( - "svg", - genericComponentOverrideContext.__assign( - { - xmlns: "http://www.w3.org/2000/svg", - width: "14.862", - height: "12.033", - viewBox: "0 0 14.862 12.033", - "data-supertokens": "checkedIcon", - }, - { - children: jsxRuntime.jsx("path", { - fill: "rgb(var(--palette-primary))", - d: "M12.629 49L5.06 56.572l-2.829-2.829L0 55.977l5.057 5.057.654-.651 9.152-9.152z", - transform: "translate(0 -49)", - }), - } - ) - ); -} - -/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. - * - * This software is licensed under the Apache License, Version 2.0 (the - * "License") as published by the Apache Software Foundation. - * - * You may not use this file except in compliance with the License. You may - * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -/* - * Imports. - */ -/* - * Component. - */ -function ErrorIcon() { - return jsxRuntime.jsx( - "svg", - genericComponentOverrideContext.__assign( - { - xmlns: "http://www.w3.org/2000/svg", - width: "17", - height: "15", - viewBox: "0 0 17 15", - "data-supertokens": "errorIcon", - }, - { - children: jsxRuntime.jsxs("g", { - children: [ - jsxRuntime.jsx( - "g", - genericComponentOverrideContext.__assign( - { className: "Asdf", fill: "rgb(var(--palette-error))" }, - { - children: jsxRuntime.jsx("path", { - d: "M13.568 14.75H3.432c-.63 0-1.195-.325-1.512-.869-.317-.544-.32-1.196-.01-1.744l5.067-8.943c.315-.556.884-.887 1.523-.887.639 0 1.208.331 1.523.887l5.067 8.943c.31.548.307 1.2-.01 1.744s-.882.869-1.512.869z", - transform: "translate(-824.894 -352.829) translate(824.894 352.829)", - }), - } - ) - ), - jsxRuntime.jsx( - "text", - genericComponentOverrideContext.__assign( - { - fill: "#fff", - fontSize: "10px", - fontWeight: "700", - transform: "translate(-824.894 -352.829) translate(832.014 365.198)", - }, - { - children: jsxRuntime.jsx( - "tspan", - genericComponentOverrideContext.__assign({ x: "0", y: "0" }, { children: "!" }) - ), - } - ) - ), - ], - }), - } - ) - ); -} - -/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. - * - * This software is licensed under the Apache License, Version 2.0 (the - * "License") as published by the Apache Software Foundation. - * - * You may not use this file except in compliance with the License. You may - * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -/* - * Imports. - */ -/* - * Component. - */ -function ShowPasswordIcon(_a) { - var showPassword = _a.showPassword; - if (showPassword === true) { - return jsxRuntime.jsx("div", { - children: jsxRuntime.jsx( - "svg", - genericComponentOverrideContext.__assign( - { - xmlns: "http://www.w3.org/2000/svg", - width: "18.391", - height: "16.276", - viewBox: "0 0 18.391 16.276", - "data-supertokens": "showPasswordIcon show", - }, - { - children: jsxRuntime.jsxs("g", { - children: [ - jsxRuntime.jsx("g", { - children: jsxRuntime.jsx("g", { - children: jsxRuntime.jsx("g", { - children: jsxRuntime.jsx("path", { - fill: "rgb(var(--palette-textPrimary))", - d: "M29.289 100.33c-2.4-3.63-5.619-5.63-9.069-5.63s-6.67 2-9.069 5.63a.767.767 0 0 0 0 .845c2.4 3.63 5.619 5.63 9.069 5.63s6.67-2 9.069-5.63a.767.767 0 0 0 0-.845zm-9.069 4.944c-2.785 0-5.435-1.6-7.5-4.519 2.065-2.92 4.715-4.519 7.5-4.519s5.435 1.6 7.5 4.519c-2.064 2.92-4.711 4.519-7.5 4.519z", - transform: - "translate(-822 -420.048) translate(822 422.035) translate(-11.025 -94.7)", - }), - }), - }), - }), - jsxRuntime.jsxs( - "g", - genericComponentOverrideContext.__assign( - { - fill: "rgb(var(--palette-textPrimary))", - stroke: "rgb(var(--palette-inputBackground))", - transform: "translate(-822 -420.048) translate(827.164 424.055)", - }, - { - children: [ - jsxRuntime.jsx("circle", { - cx: "4.036", - cy: "4.036", - r: "4.036", - stroke: "none", - }), - jsxRuntime.jsx("circle", { - cx: "4.036", - cy: "4.036", - r: "3.536", - fill: "none", - }), - ], - } - ) - ), - jsxRuntime.jsx("path", { - fill: "none", - stroke: "#707070", - strokeLinecap: "round", - strokeWidth: "2.25px", - d: "M11.981 0L0 11.981", - transform: "translate(-822 -420.048) translate(825.084 421.639)", - }), - jsxRuntime.jsx("path", { - fill: "none", - stroke: "rgb(var(--palette-inputBackground))", - strokeLinecap: "round", - d: "M13.978 0L0 13.978", - transform: "translate(-822 -420.048) translate(825.084 421.639)", - }), - ], - }), - } - ) - ), - }); - } - return jsxRuntime.jsx("div", { - children: jsxRuntime.jsx( - "svg", - genericComponentOverrideContext.__assign( - { - xmlns: "http://www.w3.org/2000/svg", - width: "18.281", - height: "12.033", - viewBox: "0 0 18.281 12.033", - "data-supertokens": "showPasswordIcon hide", - }, - { - children: jsxRuntime.jsxs("g", { - children: [ - jsxRuntime.jsx("g", { - children: jsxRuntime.jsx("g", { - children: jsxRuntime.jsx("g", { - children: jsxRuntime.jsx("path", { - fill: "rgb(var(--palette-textPrimary))", - d: "M29.18 100.3c-2.384-3.608-5.586-5.6-9.015-5.6s-6.63 1.989-9.015 5.6a.763.763 0 0 0 0 .84c2.384 3.608 5.586 5.6 9.015 5.6s6.63-1.989 9.015-5.6a.763.763 0 0 0 0-.84zm-9.015 4.914c-2.769 0-5.4-1.589-7.459-4.492 2.052-2.9 4.686-4.492 7.459-4.492s5.4 1.589 7.459 4.492c-2.056 2.899-4.686 4.489-7.458 4.489z", - transform: - "translate(-822 -422.088) translate(822 422.088) translate(-11.025 -94.7)", - }), - }), - }), - }), - jsxRuntime.jsxs( - "g", - genericComponentOverrideContext.__assign( - { - fill: "rgb(var(--palette-textPrimary))", - stroke: "rgb(var(--palette-inputBackground))", - transform: "translate(-822 -422.088) translate(827.133 424.096)", - }, - { - children: [ - jsxRuntime.jsx("circle", { - cx: "4.012", - cy: "4.012", - r: "4.012", - stroke: "none", - }), - jsxRuntime.jsx("circle", { - cx: "4.012", - cy: "4.012", - r: "3.512", - fill: "none", - }), - ], - } - ) - ), - ], - }), - } - ) - ), - }); -} - -var Input = function (_a) { - var type = _a.type, - name = _a.name, - hasError = _a.hasError, - autoComplete = _a.autoComplete, - onInputFocus = _a.onInputFocus, - onInputBlur = _a.onInputBlur, - onChange = _a.onChange, - value = _a.value, - placeholder = _a.placeholder, - validated = _a.validated, - autofocus = _a.autofocus; - var t = translationContext.useTranslation(); - var _b = React.useState(false), - showPassword = _b[0], - setShowPassword = _b[1]; - /* - * Method. - */ - function handleFocus() { - if (onInputFocus !== undefined) { - onInputFocus({ - id: name, - value: value, - }); - } - } - function handleBlur() { - if (onInputBlur !== undefined) { - onInputBlur({ - id: name, - value: value, - }); - } - } - function handleChange(event) { - if (onChange) { - onChange({ - id: name, - value: event.target.value, - }); - } - } - if (autoComplete === undefined) { - autoComplete = "off"; - } - var inputType = type; - if (type === "password" && showPassword === true) { - inputType = "text"; - } - return jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "inputContainer" }, - { - children: jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": ["inputWrapper", hasError ? "inputError" : ""].join(" ") }, - { - children: [ - jsxRuntime.jsx("input", { - autoFocus: autofocus, - autoComplete: autoComplete, - "data-supertokens": "input", - className: "supertokens-input", - onFocus: handleFocus, - onBlur: handleBlur, - type: inputType, - name: name, - placeholder: t(placeholder), - onChange: handleChange, - value: value, - }), - hasError === true && - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "inputAdornment inputAdornmentError" }, - { children: jsxRuntime.jsx(ErrorIcon, {}) } - ) - ), - validated === true && - hasError === false && - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "inputAdornment inputAdornmentSuccess" }, - { children: jsxRuntime.jsx(CheckedIcon, {}) } - ) - ), - type === "password" && - value.length > 0 && - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { - onClick: function () { - return setShowPassword(showPassword === false); - }, - "data-supertokens": "inputAdornment showPassword", - }, - { - children: jsxRuntime.jsx(ShowPasswordIcon, { - showPassword: showPassword, - }), - } - ) - ), - ], - } - ) - ), - } - ) - ); -}; - -function InputError(_a) { - var error = _a.error; - var t = translationContext.useTranslation(); - return jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign({ "data-supertokens": "inputErrorMessage" }, { children: t(error) }) - ); -} - -function Label(_a) { - var value = _a.value, - showIsRequired = _a.showIsRequired; - var t = translationContext.useTranslation(); - return jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "label" }, - { children: [t(value), showIsRequired && " *"] } - ) - ); -} - -var FormBase = function (props) { - var footer = props.footer, - buttonLabel = props.buttonLabel, - showLabels = props.showLabels, - validateOnBlur = props.validateOnBlur, - formFields = props.formFields; - var unmounting = React.useRef(new AbortController()); - React.useEffect( - function () { - // We need this because in some cases this gets called multiple times - unmounting.current = new AbortController(); - return function () { - unmounting.current.abort(); - }; - }, - [unmounting] - ); - var _a = React.useState( - props.formFields.map(function (f) { - return { id: f.id, value: "" }; - }) - ), - fieldStates = _a[0], - setFieldStates = _a[1]; - var _b = React.useState(false), - isLoading = _b[0], - setIsLoading = _b[1]; - var updateFieldState = React.useCallback( - function (id, update) { - setFieldStates(function (os) { - var field = os.find(function (f) { - return f.id === id; - }); - if (field === undefined) { - return genericComponentOverrideContext.__spreadArray( - genericComponentOverrideContext.__spreadArray([], os, true), - [update({ id: id, value: "" })], - false - ); - } - return os - .filter(function (f) { - return f !== field; - }) - .concat(update(field)); - }); - }, - [setFieldStates] - ); - var onInputFocus = React.useCallback( - function (field) { - updateFieldState(field.id, function (os) { - return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, os), { - validated: false, - }); - }); - }, - [updateFieldState] - ); - var onInputBlur = React.useCallback( - function (field) { - return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () { - var fieldConfig, error, _a; - return genericComponentOverrideContext.__generator(this, function (_b) { - switch (_b.label) { - case 0: - if (!validateOnBlur) { - return [2 /*return*/]; - } - fieldConfig = props.formFields.find(function (f) { - return f.id === field.id; - }); - if (!(fieldConfig && field.value !== "")) return [3 /*break*/, 2]; - return [4 /*yield*/, fieldConfig.validate(field.value)]; - case 1: - _a = _b.sent(); - return [3 /*break*/, 3]; - case 2: - _a = undefined; - _b.label = 3; - case 3: - error = _a; - updateFieldState(field.id, function (os) { - return genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, os), - { error: error, validated: error === undefined && field.value.length !== 0 } - ); - }); - return [2 /*return*/]; - } - }); - }); - }, - [validateOnBlur, updateFieldState, props.formFields] - ); - var onInputChange = React.useCallback( - function (field) { - updateFieldState(field.id, function (os) { - return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, os), { - value: field.value, - error: undefined, - }); - }); - props.clearError(); - }, - [updateFieldState] - ); - var onFormSubmit = React.useCallback( - function (e) { - return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () { - var apiFields, fieldUpdates, result, generalError, e_1, _loop_1, _i, formFields_1, field, errorFields_1; - return genericComponentOverrideContext.__generator(this, function (_a) { - switch (_a.label) { - case 0: - // Prevent default event propagation. - e.preventDefault(); - // Set loading state. - setIsLoading(true); - setFieldStates(function (os) { - return os.map(function (fs) { - return genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, fs), - { error: undefined } - ); - }); - }); - apiFields = formFields.map(function (field) { - var fieldState = fieldStates.find(function (fs) { - return fs.id === field.id; - }); - return { - id: field.id, - value: fieldState === undefined ? "" : fieldState.value, - }; - }); - fieldUpdates = []; - _a.label = 1; - case 1: - _a.trys.push([1, 6, 7, 8]); - result = void 0; - generalError = void 0; - _a.label = 2; - case 2: - _a.trys.push([2, 4, , 5]); - return [ - 4 /*yield*/, - props.callAPI(apiFields, function (id, value) { - return fieldUpdates.push({ id: id, value: value }); - }), - ]; - case 3: - result = _a.sent(); - return [3 /*break*/, 5]; - case 4: - e_1 = _a.sent(); - if (STGeneralError__default.default.isThisError(e_1)) { - generalError = e_1; - } else { - throw e_1; - } - return [3 /*break*/, 5]; - case 5: - if (unmounting.current.signal.aborted) { - return [2 /*return*/]; - } - _loop_1 = function (field) { - var update = fieldUpdates.find(function (f) { - return f.id === field.id; - }); - if (update || field.clearOnSubmit === true) { - // We can do these one by one, it's almost never more than one field - updateFieldState(field.id, function (os) { - return genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, os), - { value: update ? update.value : "" } - ); - }); - } - }; - for (_i = 0, formFields_1 = formFields; _i < formFields_1.length; _i++) { - field = formFields_1[_i]; - _loop_1(field); - } - if (generalError !== undefined) { - props.onError(generalError.message); - } else { - // If successful - if (result.status === "OK") { - setIsLoading(false); - props.clearError(); - if (props.onSuccess !== undefined) { - props.onSuccess(result); - } - } - if (unmounting.current.signal.aborted) { - return [2 /*return*/]; - } - // If field error. - if (result.status === "FIELD_ERROR") { - errorFields_1 = result.formFields; - setFieldStates(function (os) { - return os.map(function (fs) { - var _a; - return genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, fs), - { - error: - (_a = errorFields_1.find(function (ef) { - return ef.id === fs.id; - })) === null || _a === void 0 - ? void 0 - : _a.error, - } - ); - }); - }); - } - } - return [3 /*break*/, 8]; - case 6: - _a.sent(); - props.onError("SOMETHING_WENT_WRONG_ERROR"); - return [3 /*break*/, 8]; - case 7: - setIsLoading(false); - return [7 /*endfinally*/]; - case 8: - return [2 /*return*/]; - } - }); - }); - }, - [setIsLoading, setFieldStates, props, formFields, fieldStates] - ); - return jsxRuntime.jsxs( - "form", - genericComponentOverrideContext.__assign( - { autoComplete: "on", noValidate: true, onSubmit: onFormSubmit }, - { - children: [ - formFields.map(function (field) { - var type = "text"; - // If email or password, replace field type. - if (validators.MANDATORY_FORM_FIELDS_ID_ARRAY.includes(field.id)) { - type = field.id; - } - if (field.id === "confirm-password") { - type = "password"; - } - var fstate = fieldStates.find(function (s) { - return s.id === field.id; - }) || { - id: field.id, - validated: false, - error: undefined, - value: "", - }; - return jsxRuntime.jsx( - FormRow, - genericComponentOverrideContext.__assign( - { hasError: fstate.error !== undefined }, - { - children: jsxRuntime.jsxs(React.Fragment, { - children: [ - showLabels && - (field.labelComponent !== undefined - ? field.labelComponent - : jsxRuntime.jsx(Label, { - value: field.label, - showIsRequired: field.showIsRequired, - })), - field.inputComponent !== undefined - ? jsxRuntime.jsx(field.inputComponent, { - type: type, - name: field.id, - validated: fstate.validated === true, - placeholder: field.placeholder, - value: fstate.value, - autoComplete: field.autoComplete, - autofocus: field.autofocus, - onInputFocus: onInputFocus, - onInputBlur: onInputBlur, - onChange: onInputChange, - hasError: fstate.error !== undefined, - }) - : jsxRuntime.jsx(Input, { - type: type, - name: field.id, - validated: fstate.validated === true, - placeholder: field.placeholder, - value: fstate.value, - autoComplete: field.autoComplete, - onInputFocus: onInputFocus, - onInputBlur: onInputBlur, - onChange: onInputChange, - autofocus: field.autofocus, - hasError: fstate.error !== undefined, - }), - fstate.error && jsxRuntime.jsx(InputError, { error: fstate.error }), - ], - }), - } - ), - field.id - ); - }), - jsxRuntime.jsx( - FormRow, - { - children: jsxRuntime.jsxs(React.Fragment, { - children: [ - jsxRuntime.jsx(button.Button, { - disabled: isLoading, - isLoading: isLoading, - type: "submit", - label: buttonLabel, - }), - footer, - ], - }), - }, - "form-button" - ), - ], - } - ) - ); -}; - -exports.ErrorIcon = ErrorIcon; -exports.FormBase = FormBase; -exports.FormRow = FormRow; -exports.Label = Label; diff --git a/lib/build/emailpassword.js b/lib/build/emailpassword.js index bf30757c0..54ade2cbb 100644 --- a/lib/build/emailpassword.js +++ b/lib/build/emailpassword.js @@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); -var componentOverrideContext = require("./emailpassword-shared4.js"); -var recipe = require("./emailpassword-shared5.js"); +var componentOverrideContext = require("./emailpassword-shared3.js"); +var recipe = require("./emailpassword-shared4.js"); require("supertokens-web-js"); require("supertokens-web-js/utils/cookieHandler"); require("supertokens-web-js/utils/postSuperTokensInitCallbacks"); @@ -20,7 +20,7 @@ require("./authRecipe-shared.js"); require("./recipeModule-shared.js"); require("./session-shared2.js"); require("supertokens-web-js/recipe/session"); -require("./emailpassword-shared6.js"); +require("./emailpassword-shared5.js"); /* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. * diff --git a/lib/build/emailpasswordprebuiltui.js b/lib/build/emailpasswordprebuiltui.js index 3ac657334..c6277a8b2 100644 --- a/lib/build/emailpasswordprebuiltui.js +++ b/lib/build/emailpasswordprebuiltui.js @@ -4,11 +4,11 @@ require("./genericComponentOverrideContext.js"); require("react/jsx-runtime"); require("supertokens-web-js/utils/normalisedURLPath"); require("./index2.js"); -require("./SuperTokensBranding.js"); -require("./emailpassword-shared4.js"); -var emailpasswordprebuiltui = require("./emailpassword-shared7.js"); -require("./emailpassword-shared6.js"); +require("./authRecipe-shared2.js"); +require("./emailpassword-shared3.js"); +var emailpasswordprebuiltui = require("./emailpassword-shared6.js"); require("./emailpassword-shared5.js"); +require("./emailpassword-shared4.js"); require("supertokens-web-js"); require("supertokens-web-js/utils/cookieHandler"); require("supertokens-web-js/utils/postSuperTokensInitCallbacks"); @@ -29,13 +29,13 @@ require("supertokens-web-js/recipe/session"); require("./session-shared3.js"); require("./session-shared.js"); require("./translations.js"); -require("./emailpassword-shared.js"); +require("./emailverification-shared2.js"); require("./arrowLeftIcon.js"); -require("./emailpassword-shared8.js"); +require("./emailpassword-shared7.js"); require("supertokens-web-js/utils/error"); -require("./emailpassword-shared3.js"); require("./emailpassword-shared2.js"); -require("./emailverification-shared2.js"); +require("./emailpassword-shared.js"); +require("./SuperTokensBranding.js"); require("supertokens-web-js/lib/build/error"); require("supertokens-web-js/recipe/emailpassword"); require("./authRecipe-shared.js"); diff --git a/lib/build/emailverification-shared2.js b/lib/build/emailverification-shared2.js index ce5456c45..6db26e977 100644 --- a/lib/build/emailverification-shared2.js +++ b/lib/build/emailverification-shared2.js @@ -1,8 +1,31 @@ "use strict"; +var jsxRuntime = require("react/jsx-runtime"); +var React = require("react"); var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); var translations = require("./translations.js"); +var styles = + '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n\n[data-supertokens~="resetPasswordHeaderTitle"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n'; + +var ThemeBase = function (_a) { + var children = _a.children, + userStyles = _a.userStyles, + loadDefaultFont = _a.loadDefaultFont; + return jsxRuntime.jsxs(React.Fragment, { + children: [ + children, + loadDefaultFont && + jsxRuntime.jsx("link", { + href: "//fonts.googleapis.com/css?family=Rubik:wght@300;400;600;500;700", + rel: "stylesheet", + type: "text/css", + }), + jsxRuntime.jsxs("style", { children: [styles, userStyles.join("\n")] }), + ], + }); +}; + var defaultTranslationsEmailVerification = { en: genericComponentOverrideContext.__assign( genericComponentOverrideContext.__assign({}, translations.defaultTranslationsCommon.en), @@ -27,4 +50,5 @@ var defaultTranslationsEmailVerification = { ), }; +exports.ThemeBase = ThemeBase; exports.defaultTranslationsEmailVerification = defaultTranslationsEmailVerification; diff --git a/lib/build/emailverificationprebuiltui.js b/lib/build/emailverificationprebuiltui.js index 8b3493cba..c35b9f47a 100644 --- a/lib/build/emailverificationprebuiltui.js +++ b/lib/build/emailverificationprebuiltui.js @@ -9,13 +9,12 @@ var recipe$1 = require("./emailverification-shared.js"); var React = require("react"); var recipe = require("./session-shared2.js"); var translations = require("./translations.js"); -var themeBase = require("./emailpassword-shared.js"); +var translations$1 = require("./emailverification-shared2.js"); var STGeneralError = require("supertokens-web-js/utils/error"); var checkedRoundIcon = require("./checkedRoundIcon.js"); var translationContext = require("./translationContext.js"); -var generalError = require("./emailpassword-shared2.js"); -var button = require("./emailpassword-shared3.js"); -var translations$1 = require("./emailverification-shared2.js"); +var generalError = require("./emailpassword-shared.js"); +var button = require("./emailpassword-shared2.js"); require("supertokens-web-js"); require("supertokens-web-js/utils/cookieHandler"); require("supertokens-web-js/utils/postSuperTokensInitCallbacks"); @@ -727,7 +726,7 @@ function EmailVerificationThemeWrapper(props) { { userContext: props.userContext }, { children: jsxRuntime.jsx( - themeBase.ThemeBase, + translations$1.ThemeBase, genericComponentOverrideContext.__assign( { loadDefaultFont: !hasFont, diff --git a/lib/build/multifactorauth-shared.js b/lib/build/multifactorauth-shared.js index 4bec6918c..26a42195b 100644 --- a/lib/build/multifactorauth-shared.js +++ b/lib/build/multifactorauth-shared.js @@ -28,7 +28,7 @@ var NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath * License for the specific language governing permissions and limitations * under the License. */ -var DEFAULT_FACTOR_CHOOSER_PATH = "/verify-email"; +var DEFAULT_FACTOR_CHOOSER_PATH = "/mfa"; var getFunctionOverrides = function ( // eslint-disable-next-line @typescript-eslint/no-unused-vars @@ -213,12 +213,9 @@ var MultiFactorAuth = /** @class */ (function (_super) { chooserPath = new NormalisedURLPath__default.default(DEFAULT_FACTOR_CHOOSER_PATH); return [ 2 /*return*/, - "" - .concat( - this.config.appInfo.websiteBasePath.appendPath(chooserPath).getAsStringDangerous(), - "?rid=" - ) - .concat(this.config.recipeId), + "".concat( + this.config.appInfo.websiteBasePath.appendPath(chooserPath).getAsStringDangerous() + ), ]; } else if (context.action === "GO_TO_FACTOR") { redirectInfo = this.factorRedirectionInfo.find(function (f) { diff --git a/lib/build/multifactorauthprebuiltui.js b/lib/build/multifactorauthprebuiltui.js index 7a562b90c..78969eff7 100644 --- a/lib/build/multifactorauthprebuiltui.js +++ b/lib/build/multifactorauthprebuiltui.js @@ -8,8 +8,10 @@ var session = require("./session-shared3.js"); var componentOverrideContext = require("./multifactorauth-shared2.js"); var React = require("react"); var recipe = require("./session-shared2.js"); +var SuperTokensBranding = require("./SuperTokensBranding.js"); var translations = require("./translations.js"); -var themeBase = require("./emailpassword-shared.js"); +var arrowLeftIcon = require("./arrowLeftIcon.js"); +var translationContext = require("./translationContext.js"); var recipe$1 = require("./multifactorauth-shared.js"); require("supertokens-web-js"); require("supertokens-web-js/utils/cookieHandler"); @@ -18,7 +20,6 @@ require("supertokens-web-js/utils/windowHandler"); require("supertokens-web-js/recipe/multitenancy"); require("supertokens-web-js/utils"); require("supertokens-web-js/utils/normalisedURLDomain"); -require("./translationContext.js"); require("react-dom"); require("./multitenancy-shared.js"); require("supertokens-web-js/recipe/session"); @@ -60,14 +61,178 @@ function _interopNamespace(e) { var NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath); var React__namespace = /*#__PURE__*/ _interopNamespace(React); +var styles = + '[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="container"] {\n padding-top: 24px;\n}\n[data-supertokens~="row"] {\n padding-top: 16px;\n padding-bottom: 8px;\n}\n[data-supertokens~="factorChooserList"] {\n padding-top: 4px;\n}\n[data-supertokens~="factorChooserOption"] {\n display: flex;\n flex-direction: row;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n padding: 16px;\n cursor: pointer;\n margin-top: 12px;\n}\n[data-supertokens~="factorChooserOption"]:hover {\n border: 1px solid rgb(var(--palette-textLink));\n}\n[data-supertokens~="factorOptionText"] {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n align-items: start;\n text-align: left;\n}\n[data-supertokens~="factorLogo"] {\n flex-grow: 0;\n min-width: 30px;\n text-align: left;\n margin-top: 6px;\n}\n[data-supertokens~="factorName"] {\n color: rgb(var(--palette-textPrimary));\n font-size: var(--font-size-1);\n margin: 4px;\n}\n[data-supertokens~="factorChooserOption"]:hover [data-supertokens~="factorName"] {\n color: rgb(var(--palette-textLink));\n}\n[data-supertokens~="factorDescription"] {\n color: rgb(var(--palette-textSecondary));\n font-size: var(--font-size-0);\n margin: 4px;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-bottom: 32px;\n text-align: right;\n}\n'; + +var ThemeBase = function (_a) { + var children = _a.children, + userStyles = _a.userStyles, + loadDefaultFont = _a.loadDefaultFont; + return jsxRuntime.jsxs(React.Fragment, { + children: [ + children, + loadDefaultFont && + jsxRuntime.jsx("link", { + href: "//fonts.googleapis.com/css?family=Rubik:wght@300;400;600;500;700", + rel: "stylesheet", + type: "text/css", + }), + jsxRuntime.jsxs("style", { children: [styles, userStyles.join("\n")] }), + ], + }); +}; + +var FactorChooserFooter = uiEntry.withOverride( + "MultiFactorAuthFactorChooserFooter", + function MultiFactorAuthFactorChooserFooter(_a) { + var logout = _a.logout; + var t = translationContext.useTranslation(); + return jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "row factorChooserFooter" }, + { + children: jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "secondaryText secondaryLinkWithLeftArrow", onClick: logout }, + { + children: [ + jsxRuntime.jsx(arrowLeftIcon.ArrowLeftIcon, { + color: "rgb(var(--palette-textPrimary))", + }), + t("MULTI_FACTOR_AUTH_LOGOUT"), + ], + } + ) + ), + } + ) + ); + } +); + +var FactorChooserHeader = uiEntry.withOverride( + "MultiFactorAuthFactorChooserHeader", + function MultiFactorAuthFactorChooserHeader() { + var t = translationContext.useTranslation(); + return jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "row factorChooserHeader" }, + { + children: jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "headerTitle" }, + { children: t("MULTI_FACTOR_CHOOSER_HEADER_TITLE") } + ) + ), + } + ) + ); + } +); + +var FactorOption = uiEntry.withOverride("MultiFactorAuthFactorOption", function MultiFactorAuthFactorOption(_a) { + var onClick = _a.onClick, + name = _a.name, + description = _a.description, + logo = _a.logo; + var t = translationContext.useTranslation(); + return jsxRuntime.jsxs( + "a", + genericComponentOverrideContext.__assign( + { "data-supertokens": "factorChooserOption", onClick: onClick }, + { + children: [ + jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "factorLogo" }, + { children: [" ", logo({})] } + ) + ), + jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "factorOptionText" }, + { + children: [ + jsxRuntime.jsx( + "h6", + genericComponentOverrideContext.__assign( + { "data-supertokens": "factorName" }, + { children: t(name) } + ) + ), + jsxRuntime.jsx( + "p", + genericComponentOverrideContext.__assign( + { "data-supertokens": "factorDescription" }, + { children: t(description) } + ) + ), + ], + } + ) + ), + ], + } + ) + ); +}); + +var FactorList = uiEntry.withOverride("MultiFactorAuthFactorList", function MultiFactorAuthFactorList(_a) { + var availableFactors = _a.availableFactors, + navigateToFactor = _a.navigateToFactor; + return jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "row factorChooserList" }, + { + children: availableFactors.map(function (factor) { + return jsxRuntime.jsx( + FactorOption, + { + name: factor.name, + description: factor.description, + logo: factor.logo, + onClick: function () { + return navigateToFactor(factor.id); + }, + }, + factor.id + ); + }), + } + ) + ); +}); + function FactorChooserTheme(props) { var sessionContext = session.useSessionContext$1(); if (sessionContext.loading === false && sessionContext.doesSessionExist === true) { - return jsxRuntime.jsx("pre", { - children: JSON.stringify({ props: props, sessionContext: sessionContext }, null, 2), - }); + return jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "container" }, + { + children: [ + jsxRuntime.jsx(FactorChooserHeader, {}), + jsxRuntime.jsx(FactorList, { + availableFactors: props.availableFactors, + mfaInfo: props.mfaInfo, + navigateToFactor: props.navigateToFactor, + }), + jsxRuntime.jsx(FactorChooserFooter, { logout: props.logout }), + jsxRuntime.jsx(SuperTokensBranding.SuperTokensBranding, {}), + ], + } + ) + ); } - // Otherwise, return an empty screen, waiting for the feature component to redirection to complete. + // Otherwise, return an empty screen, waiting for the feature component redirection to complete. return jsxRuntime.jsx(jsxRuntime.Fragment, {}); } function FactorChooserThemeWrapper(props) { @@ -78,7 +243,7 @@ function FactorChooserThemeWrapper(props) { { userContext: props.userContext }, { children: jsxRuntime.jsx( - themeBase.ThemeBase, + ThemeBase, genericComponentOverrideContext.__assign( { loadDefaultFont: !hasFont, @@ -97,35 +262,18 @@ function FactorChooserThemeWrapper(props) { ); } -var defaultTranslationsEmailVerification = { +var defaultTranslationsMultiFactorAuth = { en: genericComponentOverrideContext.__assign( genericComponentOverrideContext.__assign({}, translations.defaultTranslationsCommon.en), - { - EMAIL_VERIFICATION_RESEND_SUCCESS: "Email resent", - EMAIL_VERIFICATION_SEND_TITLE: "Verify your email address", - EMAIL_VERIFICATION_SEND_DESC_START: "", - EMAIL_VERIFICATION_SEND_DESC_STRONG: "Please click on the link", - EMAIL_VERIFICATION_SEND_DESC_END: " in the email we just sent you to confirm your email address.", - EMAIL_VERIFICATION_RESEND_BTN: "Resend Email", - EMAIL_VERIFICATION_LOGOUT: "Logout ", - EMAIL_VERIFICATION_SUCCESS: "Email verification successful!", - EMAIL_VERIFICATION_CONTINUE_BTN: "CONTINUE", - EMAIL_VERIFICATION_CONTINUE_LINK: "Continue", - EMAIL_VERIFICATION_EXPIRED: "The email verification link has expired", - EMAIL_VERIFICATION_ERROR_TITLE: "Something went wrong", - EMAIL_VERIFICATION_ERROR_DESC: "We encountered an unexpected error. Please contact support for assistance", - EMAIL_VERIFICATION_LINK_CLICKED_HEADER: "Verify your email address", - EMAIL_VERIFICATION_LINK_CLICKED_DESC: "Please click on the button below to verify your email address", - EMAIL_VERIFICATION_LINK_CLICKED_CONTINUE_BUTTON: "CONTINUE", - } + { MULTI_FACTOR_CHOOSER_HEADER_TITLE: "Please select a second factor", MULTI_FACTOR_AUTH_LOGOUT: "Logout" } ), }; -var EmailVerification = function (props) { +var FactorChooser$1 = function (props) { var sessionContext = React.useContext(uiEntry.SessionContext); - var _a = React.useState("LOADING"), - status = _a[0], - setStatus = _a[1]; + var _a = React.useState(undefined), + mfaInfo = _a[0], + setMFAInfo = _a[1]; var userContext = uiEntry.useUserContext(); var recipeComponentOverrides = props.useComponentOverrides(); var redirectToAuthWithHistory = React.useCallback( @@ -147,7 +295,7 @@ var EmailVerification = function (props) { }, [props.history] ); - var fetchIsEmailVerified = React.useCallback( + var fetchMFAInfo = React.useCallback( function () { return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () { return genericComponentOverrideContext.__generator(this, function (_a) { @@ -170,12 +318,12 @@ var EmailVerification = function (props) { function (mfaInfo) { return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () { return genericComponentOverrideContext.__generator(this, function (_a) { - setStatus("READY" + mfaInfo.factors.isAllowedToSetup.length); // TODO + setMFAInfo(mfaInfo.factors); return [2 /*return*/]; }); }); }, - [setStatus] + [setMFAInfo] ); var handleError = React.useCallback( function (err) { @@ -204,15 +352,38 @@ var EmailVerification = function (props) { [redirectToAuthWithHistory] ); genericComponentOverrideContext.useOnMountAPICall( - fetchIsEmailVerified, + fetchMFAInfo, checkIsEmailVerified, handleError, sessionContext.loading === false ); - if (status === "LOADING") { + var navigateToFactor = React.useCallback( + function (factorId) { + return props.recipe.redirect({ action: "GO_TO_FACTOR", factorId: factorId }); + }, + [props.recipe] + ); + var signOut = React.useCallback( + function () { + return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () { + var session; + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + session = recipe.Session.getInstanceOrThrow(); + return [4 /*yield*/, session.signOut(props.userContext)]; + case 1: + _a.sent(); + return [2 /*return*/, redirectToAuthWithHistory()]; + } + }); + }); + }, + [props.recipe, redirectToAuthWithHistory] + ); + if (mfaInfo === undefined) { return jsxRuntime.jsx(React.Fragment, {}); } - // const factorChooserScreen = props.recipe.config.factorChooserScreen; var childProps = { config: props.recipe.config, }; @@ -226,7 +397,7 @@ var EmailVerification = function (props) { genericComponentOverrideContext.__assign( { useShadowDom: props.recipe.config.useShadowDom, - defaultStore: defaultTranslationsEmailVerification, + defaultStore: defaultTranslationsMultiFactorAuth, }, { children: jsxRuntime.jsxs(React.Fragment, { @@ -234,7 +405,20 @@ var EmailVerification = function (props) { props.children === undefined && jsxRuntime.jsx( FactorChooserThemeWrapper, - genericComponentOverrideContext.__assign({}, childProps) + genericComponentOverrideContext.__assign({}, childProps, { + mfaInfo: mfaInfo, + availableFactors: props.recipe.factorRedirectionInfo.filter(function ( + _a + ) { + var id = _a.id; + return ( + mfaInfo.isAllowedToSetup.includes(id) || + mfaInfo.isAlreadySetup.includes(id) + ); + }), + logout: signOut, + navigateToFactor: navigateToFactor, + }) ), props.children && React__namespace.Children.map(props.children, function (child) { @@ -298,14 +482,13 @@ var MultiFactorAuthPreBuiltUI = /** @class */ (function (_super) { session.SessionAuth, genericComponentOverrideContext.__assign( { - requireAuth: false, overrideGlobalClaimValidators: function () { return []; }, }, { children: jsxRuntime.jsx( - EmailVerification, + FactorChooser$1, genericComponentOverrideContext.__assign( { recipe: _this.recipeInstance, diff --git a/lib/build/passwordless-shared2.js b/lib/build/passwordless-shared2.js index addc013cf..f352693b5 100644 --- a/lib/build/passwordless-shared2.js +++ b/lib/build/passwordless-shared2.js @@ -3,6 +3,7 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); var PasswordlessWebJS = require("supertokens-web-js/recipe/passwordless"); var postSuperTokensInitCallbacks = require("supertokens-web-js/utils/postSuperTokensInitCallbacks"); +var jsxRuntime = require("react/jsx-runtime"); var utils = require("./authRecipe-shared.js"); var recipe = require("./multifactorauth-shared.js"); var windowHandler = require("supertokens-web-js/utils/windowHandler"); @@ -13,6 +14,77 @@ function _interopDefault(e) { var PasswordlessWebJS__default = /*#__PURE__*/ _interopDefault(PasswordlessWebJS); +var LinkIcon = function () { + return jsxRuntime.jsxs( + "svg", + genericComponentOverrideContext.__assign( + { xmlns: "http://www.w3.org/2000/svg", width: "19", height: "16", viewBox: "0 0 19 16", fill: "none" }, + { + children: [ + jsxRuntime.jsx("path", { + d: "M10.9871 11.7876C10.2967 11.7898 9.61895 11.6022 9.0279 11.2453C8.43684 10.8885 7.95517 10.3762 7.63545 9.76427C7.31574 9.15235 7.17027 8.46436 7.21492 7.7754C7.25958 7.08644 7.49264 6.42298 7.88867 5.85745C7.99951 5.70075 8.16806 5.59449 8.35725 5.56206C8.54643 5.52963 8.74075 5.57368 8.89745 5.68452C9.05416 5.79536 9.16042 5.96391 9.19285 6.15309C9.22528 6.34228 9.18123 6.53659 9.07039 6.6933C8.75488 7.13913 8.60843 7.68273 8.65728 8.22672C8.70614 8.77071 8.9471 9.27952 9.337 9.662C9.55327 9.87943 9.81039 10.052 10.0936 10.1697C10.3767 10.2874 10.6804 10.348 10.9871 10.348C11.2938 10.348 11.5974 10.2874 11.8806 10.1697C12.1638 10.052 12.4209 9.87943 12.6372 9.662L16.9605 5.33865C17.3767 4.89673 17.6045 4.31005 17.5954 3.70303C17.5863 3.09602 17.3411 2.51642 16.9118 2.08715C16.4826 1.65788 15.903 1.4127 15.296 1.40362C14.6889 1.39454 14.1023 1.62226 13.6603 2.03849L11.8229 3.87592C11.7557 3.9431 11.676 3.99639 11.5882 4.03275C11.5004 4.06911 11.4063 4.08782 11.3113 4.08782C11.2163 4.08782 11.1222 4.06911 11.0345 4.03275C10.9467 3.99639 10.8669 3.9431 10.7997 3.87592C10.7325 3.80873 10.6793 3.72897 10.6429 3.64119C10.6065 3.55341 10.5878 3.45933 10.5878 3.36432C10.5878 3.26931 10.6065 3.17522 10.6429 3.08744C10.6793 2.99966 10.7325 2.91991 10.7997 2.85272L12.6372 1.0153C13.3543 0.347081 14.3028 -0.0167022 15.2828 0.000589365C16.2628 0.017881 17.1979 0.414897 17.891 1.108C18.5841 1.80109 18.9811 2.73616 18.9984 3.7162C19.0157 4.69623 18.6519 5.64472 17.9837 6.36184L13.6603 10.6852C13.309 11.0356 12.8921 11.3133 12.4334 11.5025C11.9747 11.6916 11.4832 11.7885 10.9871 11.7876Z", + fill: "#1485FF", + }), + jsxRuntime.jsx("path", { + d: "M3.7826 15.3866C3.03483 15.3879 2.3035 15.1672 1.68132 14.7524C1.05914 14.3376 0.574138 13.7474 0.287796 13.0567C0.00145422 12.3659 -0.0733288 11.6057 0.0729281 10.8723C0.219185 10.139 0.579895 9.46563 1.10933 8.93756L5.43268 4.61421C5.78326 4.26285 6.20004 3.9845 6.65891 3.79526C7.11777 3.60603 7.6096 3.50966 8.10595 3.51175C9.10694 3.5154 10.0666 3.91118 10.7792 4.61421C11.4078 5.23969 11.7952 6.06714 11.873 6.95048C11.9508 7.83382 11.7139 8.71624 11.2043 9.44195C11.0935 9.59865 10.925 9.70491 10.7358 9.73734C10.5466 9.76977 10.3523 9.72572 10.1956 9.61488C10.0389 9.50404 9.93261 9.33549 9.90018 9.14631C9.86774 8.95712 9.91179 8.7628 10.0226 8.6061C10.3381 8.16027 10.4846 7.61667 10.4357 7.07268C10.3869 6.52869 10.1459 6.01988 9.75603 5.6374C9.32308 5.18824 8.72968 4.92911 8.10595 4.91684C7.7967 4.92053 7.49134 4.9862 7.20792 5.10997C6.92449 5.23373 6.66877 5.41308 6.45587 5.6374L2.13252 9.96075C1.71629 10.4027 1.48857 10.9894 1.49765 11.5964C1.50673 12.2034 1.75191 12.783 2.18118 13.2122C2.61045 13.6415 3.19005 13.8867 3.79706 13.8958C4.40407 13.9049 4.99075 13.6771 5.43268 13.2609L7.2701 11.4235C7.33729 11.3563 7.41704 11.303 7.50482 11.2666C7.5926 11.2303 7.68669 11.2116 7.7817 11.2116C7.87671 11.2116 7.97079 11.2303 8.05857 11.2666C8.14635 11.303 8.22611 11.3563 8.29329 11.4235C8.36048 11.4907 8.41377 11.5704 8.45013 11.6582C8.48649 11.746 8.5052 11.8401 8.5052 11.9351C8.5052 12.0301 8.48649 12.1242 8.45013 12.212C8.41377 12.2997 8.36048 12.3795 8.29329 12.4467L6.45587 14.2841C6.10457 14.6345 5.68765 14.9122 5.22896 15.1014C4.77026 15.2906 4.27877 15.3875 3.7826 15.3866Z", + fill: "#1485FF", + }), + ], + } + ) + ); +}; + +var OTPIcon = function () { + return jsxRuntime.jsxs( + "svg", + genericComponentOverrideContext.__assign( + { xmlns: "http://www.w3.org/2000/svg", width: "22", height: "23", viewBox: "0 4 22 23", fill: "none" }, + { + children: [ + jsxRuntime.jsx("path", { + d: "M7.56428 15.8664L5.26639 18.1643C5.11403 18.3167 4.90738 18.4023 4.69192 18.4023C4.47645 18.4023 4.2698 18.3167 4.11744 18.1643C3.96508 18.012 3.87949 17.8053 3.87949 17.5898C3.87949 17.3744 3.96508 17.1677 4.11744 17.0154L6.41533 14.7175C6.56769 14.5651 6.77434 14.4795 6.98981 14.4795C7.20528 14.4795 7.41192 14.5651 7.56428 14.7175C7.71664 14.8698 7.80224 15.0765 7.80224 15.292C7.80224 15.5074 7.71664 15.7141 7.56428 15.8664Z", + fill: "#73B6FF", + }), + jsxRuntime.jsx("path", { + d: "M5.17026 13.4675L1.72342 16.9143C1.57106 17.0667 1.36442 17.1523 1.14895 17.1523C0.933477 17.1523 0.726833 17.0667 0.574473 16.9143C0.422113 16.762 0.336519 16.5553 0.336519 16.3398C0.336519 16.1244 0.422113 15.9177 0.574473 15.7654L4.02131 12.3185C4.17367 12.1662 4.38032 12.0806 4.59579 12.0806C4.81125 12.0806 5.0179 12.1662 5.17026 12.3185C5.32262 12.4709 5.40821 12.6775 5.40821 12.893C5.40821 13.1085 5.32262 13.3151 5.17026 13.4675Z", + fill: "#73B6FF", + }), + jsxRuntime.jsx("path", { + d: "M10.0492 18.1315L6.60233 21.5784C6.44997 21.7307 6.24332 21.8163 6.02785 21.8163C5.81238 21.8163 5.60574 21.7307 5.45338 21.5784C5.30102 21.426 5.21542 21.2194 5.21542 21.0039C5.21542 20.7884 5.30102 20.5818 5.45338 20.4294L8.90022 16.9826C9.05258 16.8302 9.25922 16.7446 9.47469 16.7446C9.69016 16.7446 9.89681 16.8302 10.0492 16.9826C10.2015 17.135 10.2871 17.3416 10.2871 17.5571C10.2871 17.7725 10.2015 17.9792 10.0492 18.1315Z", + fill: "#73B6FF", + }), + jsxRuntime.jsx("path", { + d: "M16.935 4.28797L4.96211 8.24925C4.38349 8.47179 4.29448 9.27295 4.87309 9.49549L8.96789 11.3649L14.8876 7.13653L10.6592 13.0562L12.5286 17.151C12.7956 17.6851 13.5523 17.6406 13.7303 17.0175L17.6916 5.04462C17.8696 4.59953 17.4246 4.15444 16.935 4.28797Z", + fill: "url(#paint0_linear_3828_8733)", + }), + jsxRuntime.jsx("defs", { + children: jsxRuntime.jsxs( + "linearGradient", + genericComponentOverrideContext.__assign( + { + id: "paint0_linear_3828_8733", + x1: "16.9576", + y1: "4.56946", + x2: "9.50502", + y2: "12.0221", + gradientUnits: "userSpaceOnUse", + }, + { + children: [ + jsxRuntime.jsx("stop", { stopColor: "#5FABFF" }), + jsxRuntime.jsx("stop", { offset: "1", stopColor: "#1485FF" }), + ], + } + ) + ), + }), + ], + } + ) + ); +}; + var getFunctionOverrides = function (onHandleEvent) { return function (originalImp) { return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, originalImp), { @@ -503,9 +575,32 @@ var Passwordless = /** @class */ (function (_super) { [ { id: "otp-phone", - name: "Phone-based OTP", - description: "OTP delivered by a text message", - path: "/check-auth/otp", + name: "SMS based OTP", + description: "Get an OTP code on your phone to complete the authentication request", + path: "/check-auth/otp-phone", + logo: OTPIcon, + }, + { + id: "link-phone", + name: "SMS based Magic link", + description: "Get a magic link on your phone to complete the authentication request", + path: "/check-auth/link-phone", + logo: LinkIcon, + }, + { + id: "otp-email", + name: "SMS based OTP", + description: "Get an OTP code on your email address to complete the authentication request", + path: "/check-auth/otp-email", + logo: OTPIcon, + }, + { + id: "link-email", + name: "SMS based Magic link", + description: + "Get a magic link on your email address to complete the authentication request", + path: "/check-auth/link-email", + logo: LinkIcon, }, ] ); diff --git a/lib/build/passwordless-shared3.js b/lib/build/passwordless-shared3.js index 1f2c19d3d..8845ee9f2 100644 --- a/lib/build/passwordless-shared3.js +++ b/lib/build/passwordless-shared3.js @@ -4,20 +4,21 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext var jsxRuntime = require("react/jsx-runtime"); var NormalisedURLPath = require("supertokens-web-js/utils/normalisedURLPath"); var uiEntry = require("./index2.js"); -var SuperTokensBranding = require("./SuperTokensBranding.js"); +var authWidgetWrapper = require("./authRecipe-shared2.js"); var componentOverrideContext = require("./passwordless-shared.js"); var React = require("react"); var STGeneralError = require("supertokens-web-js/utils/error"); var recipe = require("./session-shared2.js"); var translations = require("./translations.js"); var translationContext = require("./translationContext.js"); -var button = require("./emailpassword-shared3.js"); +var button = require("./emailpassword-shared2.js"); var session = require("./session-shared3.js"); var recipe$1 = require("./passwordless-shared2.js"); -var generalError = require("./emailpassword-shared2.js"); +var SuperTokensBranding = require("./SuperTokensBranding.js"); +var generalError = require("./emailpassword-shared.js"); var checkedRoundIcon = require("./checkedRoundIcon.js"); -var formBase = require("./emailpassword-shared8.js"); -var validators = require("./emailpassword-shared6.js"); +var formBase = require("./emailpassword-shared7.js"); +var validators = require("./emailpassword-shared5.js"); var arrowLeftIcon = require("./arrowLeftIcon.js"); function _interopDefault(e) { @@ -4395,7 +4396,7 @@ var PasswordlessPreBuiltUI = /** @class */ (function (_super) { { userContext: props.userContext }, { children: jsxRuntime.jsx( - SuperTokensBranding.AuthWidgetWrapper, + authWidgetWrapper.AuthWidgetWrapper, genericComponentOverrideContext.__assign( { authRecipe: _this.recipeInstance, history: props.history }, { diff --git a/lib/build/passwordlessprebuiltui.js b/lib/build/passwordlessprebuiltui.js index 9fc3e1e3c..a434bb49d 100644 --- a/lib/build/passwordlessprebuiltui.js +++ b/lib/build/passwordlessprebuiltui.js @@ -4,7 +4,7 @@ require("./genericComponentOverrideContext.js"); require("react/jsx-runtime"); require("supertokens-web-js/utils/normalisedURLPath"); require("./index2.js"); -require("./SuperTokensBranding.js"); +require("./authRecipe-shared2.js"); require("./passwordless-shared.js"); var passwordlessprebuiltui = require("./passwordless-shared3.js"); require("./passwordless-shared2.js"); @@ -29,11 +29,12 @@ require("./session-shared3.js"); require("./session-shared.js"); require("supertokens-web-js/utils/error"); require("./translations.js"); -require("./emailpassword-shared3.js"); require("./emailpassword-shared2.js"); +require("./SuperTokensBranding.js"); +require("./emailpassword-shared.js"); require("./checkedRoundIcon.js"); -require("./emailpassword-shared8.js"); -require("./emailpassword-shared6.js"); +require("./emailpassword-shared7.js"); +require("./emailpassword-shared5.js"); require("./arrowLeftIcon.js"); require("supertokens-web-js/recipe/passwordless"); require("./authRecipe-shared.js"); diff --git a/lib/build/recipe/multifactorauth/components/features/factorChooser/index.d.ts b/lib/build/recipe/multifactorauth/components/features/factorChooser/index.d.ts index c7f642081..ce5509d76 100644 --- a/lib/build/recipe/multifactorauth/components/features/factorChooser/index.d.ts +++ b/lib/build/recipe/multifactorauth/components/features/factorChooser/index.d.ts @@ -7,5 +7,5 @@ declare type Prop = FeatureBaseProps & { userContext?: any; useComponentOverrides: () => ComponentOverrideMap; }; -export declare const EmailVerification: React.FC; -export default EmailVerification; +export declare const FactorChooser: React.FC; +export default FactorChooser; diff --git a/lib/build/recipe/multifactorauth/components/themes/factorChooser/factorChooserFooter.d.ts b/lib/build/recipe/multifactorauth/components/themes/factorChooser/factorChooserFooter.d.ts new file mode 100644 index 000000000..16cae8c02 --- /dev/null +++ b/lib/build/recipe/multifactorauth/components/themes/factorChooser/factorChooserFooter.d.ts @@ -0,0 +1,4 @@ +/// +export declare const FactorChooserFooter: import("react").ComponentType<{ + logout: (() => void) | undefined; +}>; diff --git a/lib/build/recipe/multifactorauth/components/themes/factorChooser/factorChooserHeader.d.ts b/lib/build/recipe/multifactorauth/components/themes/factorChooser/factorChooserHeader.d.ts new file mode 100644 index 000000000..3b5dd8a0d --- /dev/null +++ b/lib/build/recipe/multifactorauth/components/themes/factorChooser/factorChooserHeader.d.ts @@ -0,0 +1,2 @@ +/// +export declare const FactorChooserHeader: import("react").ComponentType; diff --git a/lib/build/recipe/multifactorauth/components/themes/factorChooser/factorList.d.ts b/lib/build/recipe/multifactorauth/components/themes/factorChooser/factorList.d.ts new file mode 100644 index 000000000..3aa0a8d57 --- /dev/null +++ b/lib/build/recipe/multifactorauth/components/themes/factorChooser/factorList.d.ts @@ -0,0 +1,8 @@ +/// +import type { SecondaryFactorRedirectionInfo } from "../../../types"; +import type { MFAFactorInfo } from "supertokens-web-js/recipe/multifactorauth/types"; +export declare const FactorList: import("react").ComponentType<{ + availableFactors: SecondaryFactorRedirectionInfo[]; + mfaInfo: MFAFactorInfo; + navigateToFactor: (factorId: string) => void; +}>; diff --git a/lib/build/recipe/multifactorauth/components/themes/factorChooser/factorOption.d.ts b/lib/build/recipe/multifactorauth/components/themes/factorChooser/factorOption.d.ts new file mode 100644 index 000000000..1802621c5 --- /dev/null +++ b/lib/build/recipe/multifactorauth/components/themes/factorChooser/factorOption.d.ts @@ -0,0 +1,7 @@ +import type { FC } from "react"; +export declare const FactorOption: import("react").ComponentType<{ + onClick: (() => void) | undefined; + name: string; + description: string; + logo: FC; +}>; diff --git a/lib/build/recipe/multifactorauth/components/themes/themeBase.d.ts b/lib/build/recipe/multifactorauth/components/themes/themeBase.d.ts new file mode 100644 index 000000000..f95129fbf --- /dev/null +++ b/lib/build/recipe/multifactorauth/components/themes/themeBase.d.ts @@ -0,0 +1,8 @@ +import React from "react"; +import type { PropsWithChildren } from "react"; +export declare const ThemeBase: React.FC< + PropsWithChildren<{ + loadDefaultFont: boolean; + userStyles: Array; + }> +>; diff --git a/lib/build/recipe/multifactorauth/components/themes/translations.d.ts b/lib/build/recipe/multifactorauth/components/themes/translations.d.ts index 69ea4bf00..93a4eab89 100644 --- a/lib/build/recipe/multifactorauth/components/themes/translations.d.ts +++ b/lib/build/recipe/multifactorauth/components/themes/translations.d.ts @@ -1,21 +1,7 @@ -export declare const defaultTranslationsEmailVerification: { +export declare const defaultTranslationsMultiFactorAuth: { en: { - EMAIL_VERIFICATION_RESEND_SUCCESS: string; - EMAIL_VERIFICATION_SEND_TITLE: string; - EMAIL_VERIFICATION_SEND_DESC_START: string; - EMAIL_VERIFICATION_SEND_DESC_STRONG: string; - EMAIL_VERIFICATION_SEND_DESC_END: string; - EMAIL_VERIFICATION_RESEND_BTN: string; - EMAIL_VERIFICATION_LOGOUT: string; - EMAIL_VERIFICATION_SUCCESS: string; - EMAIL_VERIFICATION_CONTINUE_BTN: string; - EMAIL_VERIFICATION_CONTINUE_LINK: string; - EMAIL_VERIFICATION_EXPIRED: string; - EMAIL_VERIFICATION_ERROR_TITLE: string; - EMAIL_VERIFICATION_ERROR_DESC: string; - EMAIL_VERIFICATION_LINK_CLICKED_HEADER: string; - EMAIL_VERIFICATION_LINK_CLICKED_DESC: string; - EMAIL_VERIFICATION_LINK_CLICKED_CONTINUE_BUTTON: string; + MULTI_FACTOR_CHOOSER_HEADER_TITLE: string; + MULTI_FACTOR_AUTH_LOGOUT: string; BRANDING_POWERED_BY_START: string; BRANDING_POWERED_BY_END: string; SOMETHING_WENT_WRONG_ERROR: string; diff --git a/lib/build/recipe/multifactorauth/constants.d.ts b/lib/build/recipe/multifactorauth/constants.d.ts index f809b8826..7f095bea6 100644 --- a/lib/build/recipe/multifactorauth/constants.d.ts +++ b/lib/build/recipe/multifactorauth/constants.d.ts @@ -1 +1 @@ -export declare const DEFAULT_FACTOR_CHOOSER_PATH = "/verify-email"; +export declare const DEFAULT_FACTOR_CHOOSER_PATH = "/mfa"; diff --git a/lib/build/recipe/multifactorauth/types.d.ts b/lib/build/recipe/multifactorauth/types.d.ts index 12f7aefa7..7cf28be90 100644 --- a/lib/build/recipe/multifactorauth/types.d.ts +++ b/lib/build/recipe/multifactorauth/types.d.ts @@ -5,8 +5,10 @@ import type { NormalisedConfig as NormalisedRecipeModuleConfig, UserInput as RecipeModuleUserInput, } from "../recipeModule/types"; +import type { FC } from "react"; import type { OverrideableBuilder } from "supertokens-js-override"; import type { RecipeInterface } from "supertokens-web-js/recipe/multifactorauth"; +import type { MFAFactorInfo } from "supertokens-web-js/recipe/multifactorauth/types"; export declare type ComponentOverrideMap = { FactorChooser_Override?: ComponentOverride; }; @@ -54,6 +56,10 @@ export declare type OnHandleEventContext = { userContext: any; }; export declare type FactorChooserThemeProps = { + mfaInfo: MFAFactorInfo; + availableFactors: SecondaryFactorRedirectionInfo[]; + navigateToFactor: (factorId: string) => void; + logout: () => void; config: NormalisedConfig; userContext?: any; }; @@ -61,5 +67,6 @@ export declare type SecondaryFactorRedirectionInfo = { id: string; name: string; description: string; + logo: FC; path: string; }; diff --git a/lib/build/recipe/passwordless/components/features/mfa/index.d.ts b/lib/build/recipe/passwordless/components/features/mfa/index.d.ts new file mode 100644 index 000000000..02b7a8daa --- /dev/null +++ b/lib/build/recipe/passwordless/components/features/mfa/index.d.ts @@ -0,0 +1,38 @@ +import * as React from "react"; +import type { FeatureBaseProps } from "../../../../../types"; +import type Recipe from "../../../recipe"; +import type { ComponentOverrideMap } from "../../../types"; +import type { PasswordlessSignInUpAction, SignInUpState, SignInUpChildProps } from "../../../types"; +import type { RecipeInterface } from "supertokens-web-js/recipe/passwordless"; +export declare const useSuccessInAnotherTabChecker: ( + state: SignInUpState, + dispatch: React.Dispatch, + userContext: any +) => React.MutableRefObject; +export declare const useFeatureReducer: ( + recipeImpl: RecipeInterface | undefined, + userContext: any +) => [SignInUpState, React.Dispatch]; +export declare function useChildProps( + recipe: Recipe, + dispatch: React.Dispatch, + state: SignInUpState, + callingConsumeCodeRef: React.MutableRefObject, + userContext: any, + history: any +): SignInUpChildProps; +export declare function useChildProps( + recipe: Recipe | undefined, + dispatch: React.Dispatch, + state: SignInUpState, + callingConsumeCodeRef: React.MutableRefObject, + userContext: any, + history: any +): SignInUpChildProps | undefined; +export declare const SignInUpFeature: React.FC< + FeatureBaseProps & { + recipe: Recipe; + useComponentOverrides: () => ComponentOverrideMap; + } +>; +export default SignInUpFeature; diff --git a/lib/build/thirdparty-shared2.js b/lib/build/thirdparty-shared2.js index 6ee399424..0d772b125 100644 --- a/lib/build/thirdparty-shared2.js +++ b/lib/build/thirdparty-shared2.js @@ -4,11 +4,12 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext var jsxRuntime = require("react/jsx-runtime"); var NormalisedURLPath = require("supertokens-web-js/utils/normalisedURLPath"); var uiEntry = require("./index2.js"); -var SuperTokensBranding = require("./SuperTokensBranding.js"); +var authWidgetWrapper = require("./authRecipe-shared2.js"); var recipe = require("./thirdparty-shared.js"); var React = require("react"); +var SuperTokensBranding = require("./SuperTokensBranding.js"); var translations = require("./translations.js"); -var generalError = require("./emailpassword-shared2.js"); +var generalError = require("./emailpassword-shared.js"); var STGeneralError = require("supertokens-web-js/utils/error"); var translationContext = require("./translationContext.js"); var recipe$1 = require("./session-shared2.js"); @@ -660,7 +661,7 @@ var ThirdPartyPreBuiltUI = /** @class */ (function (_super) { { userContext: props.userContext }, { children: jsxRuntime.jsx( - SuperTokensBranding.AuthWidgetWrapper, + authWidgetWrapper.AuthWidgetWrapper, genericComponentOverrideContext.__assign( { authRecipe: _this.recipeInstance, history: props.history }, { diff --git a/lib/build/thirdpartyemailpassword-shared.js b/lib/build/thirdpartyemailpassword-shared.js index d3f87b796..a215a9380 100644 --- a/lib/build/thirdpartyemailpassword-shared.js +++ b/lib/build/thirdpartyemailpassword-shared.js @@ -3,7 +3,7 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); var ThirdPartyEmailPasswordWebJS = require("supertokens-web-js/recipe/thirdpartyemailpassword"); var utils = require("./authRecipe-shared.js"); -var recipe$1 = require("./emailpassword-shared5.js"); +var recipe$1 = require("./emailpassword-shared4.js"); var recipe = require("./thirdparty-shared.js"); function _interopDefault(e) { diff --git a/lib/build/thirdpartyemailpassword.js b/lib/build/thirdpartyemailpassword.js index 8f2c2c5a9..def27b758 100644 --- a/lib/build/thirdpartyemailpassword.js +++ b/lib/build/thirdpartyemailpassword.js @@ -24,9 +24,9 @@ require("supertokens-web-js/recipe/session"); require("./translationContext.js"); require("supertokens-web-js/lib/build/normalisedURLPath"); require("supertokens-web-js/recipe/thirdpartyemailpassword"); -require("./emailpassword-shared5.js"); +require("./emailpassword-shared4.js"); require("supertokens-web-js/recipe/emailpassword"); -require("./emailpassword-shared6.js"); +require("./emailpassword-shared5.js"); var Wrapper = /** @class */ (function () { function Wrapper() {} diff --git a/lib/build/thirdpartyemailpasswordprebuiltui.js b/lib/build/thirdpartyemailpasswordprebuiltui.js index 81d1dc42f..4549fc704 100644 --- a/lib/build/thirdpartyemailpasswordprebuiltui.js +++ b/lib/build/thirdpartyemailpasswordprebuiltui.js @@ -4,14 +4,15 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext var jsxRuntime = require("react/jsx-runtime"); var NormalisedURLPath = require("supertokens-web-js/utils/normalisedURLPath"); var uiEntry = require("./index2.js"); -var SuperTokensBranding = require("./SuperTokensBranding.js"); -var emailpasswordprebuiltui = require("./emailpassword-shared7.js"); +var authWidgetWrapper = require("./authRecipe-shared2.js"); +var emailpasswordprebuiltui = require("./emailpassword-shared6.js"); var thirdpartyprebuiltui = require("./thirdparty-shared2.js"); var recipe = require("./thirdpartyemailpassword-shared.js"); var React = require("react"); +var SuperTokensBranding = require("./SuperTokensBranding.js"); var translations = require("./translations.js"); var translationContext = require("./translationContext.js"); -var generalError = require("./emailpassword-shared2.js"); +var generalError = require("./emailpassword-shared.js"); require("supertokens-web-js"); require("supertokens-web-js/utils/cookieHandler"); require("supertokens-web-js/utils/postSuperTokensInitCallbacks"); @@ -29,16 +30,15 @@ require("./session-shared2.js"); require("supertokens-web-js/recipe/session"); require("./session-shared3.js"); require("./session-shared.js"); -require("./emailpassword-shared4.js"); -require("./emailpassword-shared.js"); -require("./arrowLeftIcon.js"); -require("./emailpassword-shared8.js"); -require("supertokens-web-js/utils/error"); -require("./emailpassword-shared6.js"); require("./emailpassword-shared3.js"); require("./emailverification-shared2.js"); -require("supertokens-web-js/lib/build/error"); +require("./arrowLeftIcon.js"); +require("./emailpassword-shared7.js"); +require("supertokens-web-js/utils/error"); require("./emailpassword-shared5.js"); +require("./emailpassword-shared2.js"); +require("supertokens-web-js/lib/build/error"); +require("./emailpassword-shared4.js"); require("supertokens-web-js/recipe/emailpassword"); require("./authRecipe-shared.js"); require("./thirdparty-shared.js"); @@ -440,7 +440,7 @@ var ThirdPartyEmailPasswordPreBuiltUI = /** @class */ (function (_super) { { userContext: props.userContext }, { children: jsxRuntime.jsx( - SuperTokensBranding.AuthWidgetWrapper, + authWidgetWrapper.AuthWidgetWrapper, genericComponentOverrideContext.__assign( { authRecipe: _this.recipeInstance, history: props.history }, { diff --git a/lib/build/thirdpartypasswordlessprebuiltui.js b/lib/build/thirdpartypasswordlessprebuiltui.js index 7a42a4b29..6ba76b277 100644 --- a/lib/build/thirdpartypasswordlessprebuiltui.js +++ b/lib/build/thirdpartypasswordlessprebuiltui.js @@ -4,13 +4,14 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext var jsxRuntime = require("react/jsx-runtime"); var NormalisedURLPath = require("supertokens-web-js/utils/normalisedURLPath"); var uiEntry = require("./index2.js"); -var SuperTokensBranding = require("./SuperTokensBranding.js"); +var authWidgetWrapper = require("./authRecipe-shared2.js"); var passwordlessprebuiltui = require("./passwordless-shared3.js"); var thirdpartyprebuiltui = require("./thirdparty-shared2.js"); var recipe = require("./thirdpartypasswordless-shared.js"); var React = require("react"); +var SuperTokensBranding = require("./SuperTokensBranding.js"); var translations = require("./translations.js"); -var generalError = require("./emailpassword-shared2.js"); +var generalError = require("./emailpassword-shared.js"); var translationContext = require("./translationContext.js"); require("supertokens-web-js"); require("supertokens-web-js/utils/cookieHandler"); @@ -31,13 +32,13 @@ require("./session-shared3.js"); require("./session-shared.js"); require("./passwordless-shared.js"); require("supertokens-web-js/utils/error"); -require("./emailpassword-shared3.js"); +require("./emailpassword-shared2.js"); require("./passwordless-shared2.js"); require("supertokens-web-js/recipe/passwordless"); require("./authRecipe-shared.js"); require("./checkedRoundIcon.js"); -require("./emailpassword-shared8.js"); -require("./emailpassword-shared6.js"); +require("./emailpassword-shared7.js"); +require("./emailpassword-shared5.js"); require("./arrowLeftIcon.js"); require("./thirdparty-shared.js"); require("supertokens-web-js/recipe/thirdparty"); @@ -508,7 +509,7 @@ var ThirdPartyPasswordlessPreBuiltUI = /** @class */ (function (_super) { { userContext: props.userContext }, { children: jsxRuntime.jsx( - SuperTokensBranding.AuthWidgetWrapper, + authWidgetWrapper.AuthWidgetWrapper, genericComponentOverrideContext.__assign( { authRecipe: _this.recipeInstance, history: props.history }, { diff --git a/lib/build/thirdpartyprebuiltui.js b/lib/build/thirdpartyprebuiltui.js index dca4df3b9..f76dfe0fa 100644 --- a/lib/build/thirdpartyprebuiltui.js +++ b/lib/build/thirdpartyprebuiltui.js @@ -4,7 +4,7 @@ require("./genericComponentOverrideContext.js"); require("react/jsx-runtime"); require("supertokens-web-js/utils/normalisedURLPath"); require("./index2.js"); -require("./SuperTokensBranding.js"); +require("./authRecipe-shared2.js"); require("./thirdparty-shared.js"); var thirdpartyprebuiltui = require("./thirdparty-shared2.js"); require("supertokens-web-js"); @@ -29,8 +29,9 @@ require("./session-shared.js"); require("supertokens-web-js/recipe/thirdparty"); require("./authRecipe-shared.js"); require("supertokens-web-js/lib/build/normalisedURLPath"); +require("./SuperTokensBranding.js"); require("./translations.js"); -require("./emailpassword-shared2.js"); +require("./emailpassword-shared.js"); require("supertokens-web-js/utils/error"); exports.SignInAndUp = thirdpartyprebuiltui.SignInAndUp; diff --git a/lib/ts/components/assets/linkIcon.tsx b/lib/ts/components/assets/linkIcon.tsx new file mode 100644 index 000000000..6815ac02c --- /dev/null +++ b/lib/ts/components/assets/linkIcon.tsx @@ -0,0 +1,12 @@ +export const LinkIcon = () => ( + + + + +); diff --git a/lib/ts/components/assets/otpIcon.tsx b/lib/ts/components/assets/otpIcon.tsx new file mode 100644 index 000000000..5c0e1c977 --- /dev/null +++ b/lib/ts/components/assets/otpIcon.tsx @@ -0,0 +1,32 @@ +export const OTPIcon = () => ( + + + + + + + + + + + + +); diff --git a/lib/ts/recipe/multifactorauth/components/features/factorChooser/index.tsx b/lib/ts/recipe/multifactorauth/components/features/factorChooser/index.tsx index 61632b15e..37dc4ae35 100644 --- a/lib/ts/recipe/multifactorauth/components/features/factorChooser/index.tsx +++ b/lib/ts/recipe/multifactorauth/components/features/factorChooser/index.tsx @@ -27,7 +27,7 @@ import { useOnMountAPICall } from "../../../../../utils"; import { SessionContext } from "../../../../session"; import Session from "../../../../session/recipe"; import FactorChooserTheme from "../../themes/factorChooser"; -import { defaultTranslationsEmailVerification } from "../../themes/translations"; +import { defaultTranslationsMultiFactorAuth } from "../../themes/translations"; import type { FeatureBaseProps } from "../../../../../types"; import type Recipe from "../../../recipe"; @@ -36,9 +36,9 @@ import type { MFAFactorInfo } from "supertokens-web-js/lib/build/recipe/multifac type Prop = FeatureBaseProps & { recipe: Recipe; userContext?: any; useComponentOverrides: () => ComponentOverrideMap }; -export const EmailVerification: React.FC = (props) => { +export const FactorChooser: React.FC = (props) => { const sessionContext = useContext(SessionContext); - const [status, setStatus] = useState("LOADING"); + const [mfaInfo, setMFAInfo] = useState(undefined); const userContext = useUserContext(); const recipeComponentOverrides = props.useComponentOverrides(); @@ -46,7 +46,7 @@ export const EmailVerification: React.FC = (props) => { await redirectToAuth({ redirectBack: false, history: props.history }); }, [props.history]); - const fetchIsEmailVerified = useCallback(async () => { + const fetchMFAInfo = useCallback(async () => { if (sessionContext.loading === true) { // This callback should only be called if the session is already loaded throw new Error("Should never come here"); @@ -56,9 +56,9 @@ export const EmailVerification: React.FC = (props) => { const checkIsEmailVerified = useCallback( async (mfaInfo: { factors: MFAFactorInfo }): Promise => { - setStatus("READY" + mfaInfo.factors.isAllowedToSetup.length); // TODO + setMFAInfo(mfaInfo.factors); }, - [setStatus] + [setMFAInfo] ); const handleError = useCallback( @@ -72,14 +72,22 @@ export const EmailVerification: React.FC = (props) => { [redirectToAuthWithHistory] ); - useOnMountAPICall(fetchIsEmailVerified, checkIsEmailVerified, handleError, sessionContext.loading === false); + useOnMountAPICall(fetchMFAInfo, checkIsEmailVerified, handleError, sessionContext.loading === false); - if (status === "LOADING") { + const navigateToFactor = useCallback( + (factorId) => props.recipe.redirect({ action: "GO_TO_FACTOR", factorId }), + [props.recipe] + ); + const signOut = useCallback(async (): Promise => { + const session = Session.getInstanceOrThrow(); + await session.signOut(props.userContext); + return redirectToAuthWithHistory(); + }, [props.recipe, redirectToAuthWithHistory]); + + if (mfaInfo === undefined) { return ; } - // const factorChooserScreen = props.recipe.config.factorChooserScreen; - const childProps = { config: props.recipe.config, }; @@ -87,10 +95,20 @@ export const EmailVerification: React.FC = (props) => { + defaultStore={defaultTranslationsMultiFactorAuth}> {/* No custom theme, use default. */} - {props.children === undefined && } + {props.children === undefined && ( + mfaInfo.isAllowedToSetup.includes(id) || mfaInfo.isAlreadySetup.includes(id) + )} + logout={signOut} + navigateToFactor={navigateToFactor} + /> + )} {/* Otherwise, custom theme is provided, propagate props. */} {props.children && React.Children.map(props.children, (child) => { @@ -106,4 +124,4 @@ export const EmailVerification: React.FC = (props) => { ); }; -export default EmailVerification; +export default FactorChooser; diff --git a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorChooserFooter.tsx b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorChooserFooter.tsx new file mode 100644 index 000000000..10473fbe1 --- /dev/null +++ b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorChooserFooter.tsx @@ -0,0 +1,33 @@ +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +import ArrowLeftIcon from "../../../../../components/assets/arrowLeftIcon"; +import { withOverride } from "../../../../../components/componentOverride/withOverride"; +import { useTranslation } from "../../../../../translation/translationContext"; + +export const FactorChooserFooter = withOverride( + "MultiFactorAuthFactorChooserFooter", + function MultiFactorAuthFactorChooserFooter({ logout }: { logout: (() => void) | undefined }): JSX.Element { + const t = useTranslation(); + + return ( +
+
+ + {t("MULTI_FACTOR_AUTH_LOGOUT")} +
+
+ ); + } +); diff --git a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorChooserHeader.tsx b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorChooserHeader.tsx new file mode 100644 index 000000000..544582d03 --- /dev/null +++ b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorChooserHeader.tsx @@ -0,0 +1,29 @@ +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +import { withOverride } from "../../../../../components/componentOverride/withOverride"; +import { useTranslation } from "../../../../../translation/translationContext"; + +export const FactorChooserHeader = withOverride( + "MultiFactorAuthFactorChooserHeader", + function MultiFactorAuthFactorChooserHeader(): JSX.Element { + const t = useTranslation(); + + return ( +
+
{t("MULTI_FACTOR_CHOOSER_HEADER_TITLE")}
+
+ ); + } +); diff --git a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorList.tsx b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorList.tsx new file mode 100644 index 000000000..0a06de9f1 --- /dev/null +++ b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorList.tsx @@ -0,0 +1,47 @@ +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +import { withOverride } from "../../../../../components/componentOverride/withOverride"; + +import { FactorOption } from "./factorOption"; + +import type { SecondaryFactorRedirectionInfo } from "../../../types"; +import type { MFAFactorInfo } from "supertokens-web-js/recipe/multifactorauth/types"; + +export const FactorList = withOverride( + "MultiFactorAuthFactorList", + function MultiFactorAuthFactorList({ + availableFactors, + navigateToFactor, + }: { + availableFactors: SecondaryFactorRedirectionInfo[]; + mfaInfo: MFAFactorInfo; + navigateToFactor: (factorId: string) => void; + }): JSX.Element { + return ( +
+ {availableFactors.map((factor) => ( + navigateToFactor(factor.id)} + /> + ))} +
+ ); + } +); diff --git a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorOption.tsx b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorOption.tsx new file mode 100644 index 000000000..365c2bb37 --- /dev/null +++ b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorOption.tsx @@ -0,0 +1,49 @@ +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +// import ArrowRightIcon from "../../../../../components/assets/arrowRightIcon"; +import { withOverride } from "../../../../../components/componentOverride/withOverride"; +import { useTranslation } from "../../../../../translation/translationContext"; + +import type { FC } from "react"; + +export const FactorOption = withOverride( + "MultiFactorAuthFactorOption", + function MultiFactorAuthFactorOption({ + onClick, + name, + description, + logo, + }: { + onClick: (() => void) | undefined; + name: string; + description: string; + logo: FC; + }): JSX.Element { + const t = useTranslation(); + return ( + +
{logo({})}
+
+
{t(name)}
+

{t(description)}

+
+ {/* + + */} +
+ ); + } +); diff --git a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/index.tsx b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/index.tsx index 1a75ed57f..7f099d615 100644 --- a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/index.tsx +++ b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/index.tsx @@ -13,10 +13,15 @@ * under the License. */ +import { SuperTokensBranding } from "../../../../../components/SuperTokensBranding"; import { hasFontDefined } from "../../../../../styles/styles"; import UserContextWrapper from "../../../../../usercontext/userContextWrapper"; -import { ThemeBase } from "../../../../emailpassword/components/themes/themeBase"; import { useSessionContext } from "../../../../session"; +import { ThemeBase } from "../themeBase"; + +import { FactorChooserFooter } from "./factorChooserFooter"; +import { FactorChooserHeader } from "./factorChooserHeader"; +import { FactorList } from "./factorList"; import type { FactorChooserThemeProps } from "../../../types"; @@ -24,10 +29,21 @@ export function FactorChooserTheme(props: FactorChooserThemeProps): JSX.Element const sessionContext = useSessionContext(); if (sessionContext.loading === false && sessionContext.doesSessionExist === true) { - return
{JSON.stringify({ props, sessionContext }, null, 2)}
; + return ( +
+ + + + +
+ ); } - // Otherwise, return an empty screen, waiting for the feature component to redirection to complete. + // Otherwise, return an empty screen, waiting for the feature component redirection to complete. return <>; } diff --git a/lib/ts/recipe/multifactorauth/components/themes/styles.css b/lib/ts/recipe/multifactorauth/components/themes/styles.css new file mode 100644 index 000000000..3e3e2dcf4 --- /dev/null +++ b/lib/ts/recipe/multifactorauth/components/themes/styles.css @@ -0,0 +1,64 @@ +@import "../../../../styles/styles.css"; + +[data-supertokens~="container"] { + padding-top: 24px; +} + +[data-supertokens~="row"] { + padding-top: 16px; + padding-bottom: 8px; +} + +[data-supertokens~="factorChooserList"] { + padding-top: 4px; +} + +[data-supertokens~="factorChooserOption"] { + display: flex; + flex-direction: row; + border-radius: 6px; + border: 1px solid rgb(var(--palette-inputBorder)); + padding: 16px; + cursor: pointer; + margin-top: 12px; +} + +[data-supertokens~="factorChooserOption"]:hover { + border: 1px solid rgb(var(--palette-textLink)); +} + +[data-supertokens~="factorOptionText"] { + flex-grow: 1; + display: flex; + flex-direction: column; + align-items: start; + text-align: left; +} + +[data-supertokens~="factorLogo"] { + flex-grow: 0; + min-width: 30px; + text-align: left; + margin-top: 6px; +} + +[data-supertokens~="factorName"] { + color: rgb(var(--palette-textPrimary)); + font-size: var(--font-size-1); + margin: 4px; +} + +[data-supertokens~="factorChooserOption"]:hover [data-supertokens~="factorName"] { + color: rgb(var(--palette-textLink)); +} + +[data-supertokens~="factorDescription"] { + color: rgb(var(--palette-textSecondary)); + font-size: var(--font-size-0); + margin: 4px; +} + +[data-supertokens~="secondaryLinkWithLeftArrow"] { + margin-bottom: 32px; + text-align: right; +} diff --git a/lib/ts/recipe/multifactorauth/components/themes/themeBase.tsx b/lib/ts/recipe/multifactorauth/components/themes/themeBase.tsx new file mode 100644 index 000000000..cfdf405a4 --- /dev/null +++ b/lib/ts/recipe/multifactorauth/components/themes/themeBase.tsx @@ -0,0 +1,41 @@ +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +import React from "react"; +import { Fragment } from "react"; + +import styles from "./styles.css"; + +import type { PropsWithChildren } from "react"; + +export const ThemeBase: React.FC< + PropsWithChildren<{ loadDefaultFont: boolean; userStyles: Array }> +> = ({ children, userStyles, loadDefaultFont }) => { + return ( + + {children} + {loadDefaultFont && ( + + )} + + + ); +}; diff --git a/lib/ts/recipe/multifactorauth/components/themes/translations.ts b/lib/ts/recipe/multifactorauth/components/themes/translations.ts index 1931f1623..468d3d52e 100644 --- a/lib/ts/recipe/multifactorauth/components/themes/translations.ts +++ b/lib/ts/recipe/multifactorauth/components/themes/translations.ts @@ -1,23 +1,9 @@ import { defaultTranslationsCommon } from "../../../../translation/translations"; -export const defaultTranslationsEmailVerification = { +export const defaultTranslationsMultiFactorAuth = { en: { ...defaultTranslationsCommon.en, - EMAIL_VERIFICATION_RESEND_SUCCESS: "Email resent", - EMAIL_VERIFICATION_SEND_TITLE: "Verify your email address", - EMAIL_VERIFICATION_SEND_DESC_START: "", - EMAIL_VERIFICATION_SEND_DESC_STRONG: "Please click on the link", - EMAIL_VERIFICATION_SEND_DESC_END: " in the email we just sent you to confirm your email address.", - EMAIL_VERIFICATION_RESEND_BTN: "Resend Email", - EMAIL_VERIFICATION_LOGOUT: "Logout ", - EMAIL_VERIFICATION_SUCCESS: "Email verification successful!", - EMAIL_VERIFICATION_CONTINUE_BTN: "CONTINUE", - EMAIL_VERIFICATION_CONTINUE_LINK: "Continue", - EMAIL_VERIFICATION_EXPIRED: "The email verification link has expired", - EMAIL_VERIFICATION_ERROR_TITLE: "Something went wrong", - EMAIL_VERIFICATION_ERROR_DESC: "We encountered an unexpected error. Please contact support for assistance", - EMAIL_VERIFICATION_LINK_CLICKED_HEADER: "Verify your email address", - EMAIL_VERIFICATION_LINK_CLICKED_DESC: "Please click on the button below to verify your email address", - EMAIL_VERIFICATION_LINK_CLICKED_CONTINUE_BUTTON: "CONTINUE", + MULTI_FACTOR_CHOOSER_HEADER_TITLE: "Please select a second factor", + MULTI_FACTOR_AUTH_LOGOUT: "Logout", }, }; diff --git a/lib/ts/recipe/multifactorauth/constants.ts b/lib/ts/recipe/multifactorauth/constants.ts index 045f9d64d..18cada836 100644 --- a/lib/ts/recipe/multifactorauth/constants.ts +++ b/lib/ts/recipe/multifactorauth/constants.ts @@ -12,4 +12,4 @@ * License for the specific language governing permissions and limitations * under the License. */ -export const DEFAULT_FACTOR_CHOOSER_PATH = "/verify-email"; +export const DEFAULT_FACTOR_CHOOSER_PATH = "/mfa"; diff --git a/lib/ts/recipe/multifactorauth/prebuiltui.tsx b/lib/ts/recipe/multifactorauth/prebuiltui.tsx index 872706efd..8f5d87e62 100644 --- a/lib/ts/recipe/multifactorauth/prebuiltui.tsx +++ b/lib/ts/recipe/multifactorauth/prebuiltui.tsx @@ -6,7 +6,7 @@ import { RecipeRouter } from "../recipeRouter"; import { SessionAuth } from "../session"; import { useRecipeComponentOverrideContext } from "./componentOverrideContext"; -import { default as EmailVerificationFeature } from "./components/features/factorChooser"; +import { default as FactorChooserFeature } from "./components/features/factorChooser"; import FactorChooserTheme from "./components/themes/factorChooser"; import { DEFAULT_FACTOR_CHOOSER_PATH } from "./constants"; import MultiFactorAuthRecipe from "./recipe"; @@ -71,8 +71,8 @@ export class MultiFactorAuthPreBuiltUI extends RecipeRouter { ): JSX.Element => { return ( - []}> - []}> + => { if (context.action === "FACTOR_CHOICE_REQUIRED") { const chooserPath = new NormalisedURLPath(DEFAULT_FACTOR_CHOOSER_PATH); - return `${this.config.appInfo.websiteBasePath.appendPath(chooserPath).getAsStringDangerous()}?rid=${ - this.config.recipeId - }`; + return `${this.config.appInfo.websiteBasePath.appendPath(chooserPath).getAsStringDangerous()}`; } else if (context.action === "GO_TO_FACTOR") { const redirectInfo = this.factorRedirectionInfo.find((f) => f.id === context.factorId); if (redirectInfo !== undefined) { diff --git a/lib/ts/recipe/multifactorauth/types.ts b/lib/ts/recipe/multifactorauth/types.ts index 3386a5eb7..94a3a08f9 100644 --- a/lib/ts/recipe/multifactorauth/types.ts +++ b/lib/ts/recipe/multifactorauth/types.ts @@ -12,6 +12,7 @@ * License for the specific language governing permissions and limitations * under the License. */ + import type { ComponentOverride } from "../../components/componentOverride/componentOverride"; import type { FeatureBaseConfig } from "../../types"; import type { @@ -19,8 +20,10 @@ import type { NormalisedConfig as NormalisedRecipeModuleConfig, UserInput as RecipeModuleUserInput, } from "../recipeModule/types"; +import type { FC } from "react"; import type { OverrideableBuilder } from "supertokens-js-override"; import type { RecipeInterface } from "supertokens-web-js/recipe/multifactorauth"; +import type { MFAFactorInfo } from "supertokens-web-js/recipe/multifactorauth/types"; export type ComponentOverrideMap = { FactorChooser_Override?: ComponentOverride; // TODO @@ -81,6 +84,10 @@ export type OnHandleEventContext = { }; export type FactorChooserThemeProps = { + mfaInfo: MFAFactorInfo; + availableFactors: SecondaryFactorRedirectionInfo[]; + navigateToFactor: (factorId: string) => void; + logout: () => void; config: NormalisedConfig; userContext?: any; }; @@ -89,5 +96,6 @@ export type SecondaryFactorRedirectionInfo = { id: string; name: string; description: string; + logo: FC; path: string; }; diff --git a/lib/ts/recipe/passwordless/components/features/mfa/index.tsx b/lib/ts/recipe/passwordless/components/features/mfa/index.tsx new file mode 100644 index 000000000..49eb6f92f --- /dev/null +++ b/lib/ts/recipe/passwordless/components/features/mfa/index.tsx @@ -0,0 +1,397 @@ +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +/* + * Imports. + */ +import * as React from "react"; +import { Fragment } from "react"; +import { useMemo } from "react"; +import { useRef } from "react"; +import { useEffect } from "react"; + +import { ComponentOverrideContext } from "../../../../../components/componentOverride/componentOverrideContext"; +import FeatureWrapper from "../../../../../components/featureWrapper"; +import { useUserContext } from "../../../../../usercontext"; +import { clearErrorQueryParam, getQueryParams, getRedirectToPathFromURL } from "../../../../../utils"; +import Session from "../../../../session"; +import SessionRecipe from "../../../../session/recipe"; +import { getPhoneNumberUtils } from "../../../phoneNumberUtils"; +import SignInUpThemeWrapper from "../../themes/signInUp"; +import { defaultTranslationsPasswordless } from "../../themes/translations"; + +import type { FeatureBaseProps } from "../../../../../types"; +import type Recipe from "../../../recipe"; +import type { AdditionalLoginAttemptInfoProperties, ComponentOverrideMap } from "../../../types"; +import type { PasswordlessSignInUpAction, SignInUpState, SignInUpChildProps, NormalisedConfig } from "../../../types"; +import type { RecipeInterface } from "supertokens-web-js/recipe/passwordless"; +import type { User } from "supertokens-web-js/types"; + +export const useSuccessInAnotherTabChecker = ( + state: SignInUpState, + dispatch: React.Dispatch, + userContext: any +) => { + const callingConsumeCodeRef = useRef(false); + + useEffect(() => { + // We only need to start checking this if we have an active login attempt + if (state.loginAttemptInfo && !state.successInAnotherTab) { + const checkSessionIntervalHandle = setInterval(async () => { + if (callingConsumeCodeRef.current === false) { + const hasSession = await Session.doesSessionExist({ + userContext, + }); + if (hasSession) { + dispatch({ type: "successInAnotherTab" }); + } + } + }, 2000); + + return () => { + clearInterval(checkSessionIntervalHandle); + }; + } + // Nothing to clean up + return; + }, [state.loginAttemptInfo, state.successInAnotherTab]); + + return callingConsumeCodeRef; +}; + +export const useFeatureReducer = ( + recipeImpl: RecipeInterface | undefined, + userContext: any +): [SignInUpState, React.Dispatch] => { + const [state, dispatch] = React.useReducer( + (oldState: SignInUpState, action: PasswordlessSignInUpAction) => { + switch (action.type) { + case "load": + return { + loaded: true, + error: action.error, + loginAttemptInfo: action.loginAttemptInfo, + successInAnotherTab: false, + }; + case "resendCode": + if (!oldState.loginAttemptInfo) { + return oldState; + } + return { + ...oldState, + error: undefined, + loginAttemptInfo: { + ...oldState.loginAttemptInfo, + lastResend: action.timestamp, + }, + }; + case "restartFlow": + return { + ...oldState, + error: action.error, + loginAttemptInfo: undefined, + }; + case "setError": + return { + ...oldState, + error: action.error, + }; + case "startLogin": + return { + ...oldState, + loginAttemptInfo: action.loginAttemptInfo, + error: undefined, + }; + case "successInAnotherTab": + return { + ...oldState, + successInAnotherTab: true, + }; + default: + return oldState; + } + }, + { + error: undefined, + loaded: false, + loginAttemptInfo: undefined, + successInAnotherTab: false, + }, + (initArg) => { + let error: string | undefined = undefined; + const errorQueryParam = getQueryParams("error"); + const messageQueryParam = getQueryParams("message"); + if (errorQueryParam !== null) { + if (errorQueryParam === "signin") { + error = "SOMETHING_WENT_WRONG_ERROR"; + } else if (errorQueryParam === "restart_link") { + error = "ERROR_SIGN_IN_UP_LINK"; + } else if (errorQueryParam === "custom" && messageQueryParam !== null) { + error = messageQueryParam; + } + } + return { + ...initArg, + error, + }; + } + ); + useEffect(() => { + if (recipeImpl === undefined) { + return; + } + async function load() { + let error: string | undefined = undefined; + const errorQueryParam = getQueryParams("error"); + const messageQueryParam = getQueryParams("message"); + if (errorQueryParam !== null) { + if (errorQueryParam === "signin") { + error = "SOMETHING_WENT_WRONG_ERROR"; + } else if (errorQueryParam === "restart_link") { + error = "ERROR_SIGN_IN_UP_LINK"; + } else if (errorQueryParam === "custom" && messageQueryParam !== null) { + error = messageQueryParam; + } + } + const loginAttemptInfo = await recipeImpl?.getLoginAttemptInfo({ + userContext, + }); + // No need to check if the component is unmounting, since this has no effect then. + dispatch({ type: "load", loginAttemptInfo, error }); + } + if (state.loaded === false) { + void load(); + } + }, [state.loaded, recipeImpl, userContext]); + return [state, dispatch]; +}; + +// We are overloading to explicitly state that if recipe is defined then the return value is defined as well. +export function useChildProps( + recipe: Recipe, + dispatch: React.Dispatch, + state: SignInUpState, + callingConsumeCodeRef: React.MutableRefObject, + userContext: any, + history: any +): SignInUpChildProps; +export function useChildProps( + recipe: Recipe | undefined, + dispatch: React.Dispatch, + state: SignInUpState, + callingConsumeCodeRef: React.MutableRefObject, + userContext: any, + history: any +): SignInUpChildProps | undefined; + +export function useChildProps( + recipe: Recipe | undefined, + dispatch: React.Dispatch, + state: SignInUpState, + callingConsumeCodeRef: React.MutableRefObject, + userContext: any, + history: any +): SignInUpChildProps | undefined { + const recipeImplementation = React.useMemo( + () => + recipe && + getModifiedRecipeImplementation(recipe.webJSRecipe, recipe.config, dispatch, callingConsumeCodeRef), + [recipe] + ); + + return useMemo(() => { + if (!recipe || !recipeImplementation) { + return undefined; + } + return { + onSuccess: (result: { createdNewRecipeUser: boolean; user: User }) => { + return SessionRecipe.getInstanceOrThrow().validateGlobalClaimsAndHandleSuccessRedirection( + { + rid: recipe.config.recipeId, + successRedirectContext: { + action: "SUCCESS", + isNewRecipeUser: result.createdNewRecipeUser, + user: result.user, + redirectToPath: getRedirectToPathFromURL(), + }, + }, + userContext, + history + ); + }, + recipeImplementation: recipeImplementation, + config: recipe.config, + }; + }, [state, recipeImplementation]); +} + +export const SignInUpFeature: React.FC< + FeatureBaseProps & { + recipe: Recipe; + useComponentOverrides: () => ComponentOverrideMap; + } +> = (props) => { + const recipeComponentOverrides = props.useComponentOverrides(); + const userContext = useUserContext(); + const [state, dispatch] = useFeatureReducer(props.recipe.webJSRecipe, userContext); + const callingConsumeCodeRef = useSuccessInAnotherTabChecker(state, dispatch, userContext); + const childProps = useChildProps(props.recipe, dispatch, state, callingConsumeCodeRef, userContext, props.history)!; + + return ( + + + + {/* No custom theme, use default. */} + {props.children === undefined && ( + + )} + + {/* Otherwise, custom theme is provided, propagate props. */} + {props.children && + React.Children.map(props.children, (child) => { + if (React.isValidElement(child)) { + return React.cloneElement(child, { + ...childProps, + featureState: state, + dispatch: dispatch, + }); + } + return child; + })} + + + + ); +}; + +export default SignInUpFeature; + +function getModifiedRecipeImplementation( + originalImpl: RecipeInterface, + config: NormalisedConfig, + dispatch: React.Dispatch, + callingConsumeCodeRef: React.MutableRefObject +): RecipeInterface { + return { + ...originalImpl, + createCode: async (input) => { + let contactInfo; + const phoneNumberUtils = await getPhoneNumberUtils(); + if ("email" in input) { + contactInfo = input.email; + } else { + contactInfo = phoneNumberUtils.formatNumber( + input.phoneNumber, + config.signInUpFeature.defaultCountry || "", + phoneNumberUtils.numberFormat.E164 + ); + } + + // This contactMethod refers to the one that was used to deliver the login info + // This can be an important distinction in case both email and phone are allowed + const contactMethod: "EMAIL" | "PHONE" = "email" in input ? "EMAIL" : "PHONE"; + const additionalAttemptInfo = { + lastResend: Date.now(), + contactMethod, + contactInfo, + redirectToPath: getRedirectToPathFromURL(), + }; + + const res = await originalImpl.createCode({ + ...input, + userContext: { ...input.userContext, additionalAttemptInfo }, + }); + if (res.status === "OK") { + const loginAttemptInfo = (await originalImpl.getLoginAttemptInfo({ + userContext: input.userContext, + }))!; + dispatch({ type: "startLogin", loginAttemptInfo }); + } + return res; + }, + resendCode: async (input) => { + /** + * In this case we want the code that is calling resendCode in the + * UI to handle STGeneralError so we let this throw + */ + const res = await originalImpl.resendCode(input); + + if (res.status === "OK") { + const loginAttemptInfo = await originalImpl.getLoginAttemptInfo({ + userContext: input.userContext, + }); + + if (loginAttemptInfo !== undefined) { + const timestamp = Date.now(); + + await originalImpl.setLoginAttemptInfo({ + userContext: input.userContext, + attemptInfo: { + ...loginAttemptInfo, + lastResend: timestamp, + }, + }); + dispatch({ type: "resendCode", timestamp }); + } + } else if (res.status === "RESTART_FLOW_ERROR") { + await originalImpl.clearLoginAttemptInfo({ + userContext: input.userContext, + }); + + dispatch({ type: "restartFlow", error: "ERROR_SIGN_IN_UP_RESEND_RESTART_FLOW" }); + } + return res; + }, + + consumeCode: async (input) => { + // We need to call consume code while callingConsume, so we don't detect + // the session creation too early and go to successInAnotherTab too early + callingConsumeCodeRef.current = true; + + const res = await originalImpl.consumeCode(input); + + if (res.status === "RESTART_FLOW_ERROR") { + await originalImpl.clearLoginAttemptInfo({ + userContext: input.userContext, + }); + + dispatch({ type: "restartFlow", error: "ERROR_SIGN_IN_UP_CODE_CONSUME_RESTART_FLOW" }); + } else if (res.status === "SIGN_IN_UP_NOT_ALLOWED") { + await originalImpl.clearLoginAttemptInfo({ + userContext: input.userContext, + }); + + dispatch({ type: "restartFlow", error: res.reason }); + } else if (res.status === "OK") { + await originalImpl.clearLoginAttemptInfo({ + userContext: input.userContext, + }); + } + + callingConsumeCodeRef.current = false; + + return res; + }, + + clearLoginAttemptInfo: async (input) => { + await originalImpl.clearLoginAttemptInfo({ + userContext: input.userContext, + }); + clearErrorQueryParam(); + dispatch({ type: "restartFlow", error: undefined }); + }, + }; +} diff --git a/lib/ts/recipe/passwordless/recipe.tsx b/lib/ts/recipe/passwordless/recipe.tsx index e0075cf5b..c070bd1ad 100644 --- a/lib/ts/recipe/passwordless/recipe.tsx +++ b/lib/ts/recipe/passwordless/recipe.tsx @@ -20,6 +20,8 @@ import PasswordlessWebJS from "supertokens-web-js/recipe/passwordless"; import { PostSuperTokensInitCallbacks } from "supertokens-web-js/utils/postSuperTokensInitCallbacks"; +import { LinkIcon } from "../../components/assets/linkIcon"; +import { OTPIcon } from "../../components/assets/otpIcon"; import { SSR_ERROR } from "../../constants"; import { isTest } from "../../utils"; import AuthRecipe from "../authRecipe"; @@ -77,9 +79,32 @@ export default class Passwordless extends AuthRecipe< [ { id: "otp-phone", - name: "Phone-based OTP", - description: "OTP delivered by a text message", - path: "/check-auth/otp", + name: "SMS based OTP", + description: "Get an OTP code on your phone to complete the authentication request", + path: "/check-auth/otp-phone", + logo: OTPIcon, + }, + { + id: "link-phone", + name: "SMS based Magic link", + description: "Get a magic link on your phone to complete the authentication request", + path: "/check-auth/link-phone", + logo: LinkIcon, + }, + { + id: "otp-email", + name: "SMS based OTP", + description: "Get an OTP code on your email address to complete the authentication request", + path: "/check-auth/otp-email", + logo: OTPIcon, + }, + { + id: "link-email", + name: "SMS based Magic link", + description: + "Get a magic link on your email address to complete the authentication request", + path: "/check-auth/link-email", + logo: LinkIcon, }, ] ); diff --git a/test/server/index.js b/test/server/index.js index c112eca70..5cc05acdf 100644 --- a/test/server/index.js +++ b/test/server/index.js @@ -382,7 +382,22 @@ app.post( } ); -app.post("/payload", verifySession(), async (req, res) => { +let mfaInfo = { + factors: { + isAlreadySetup: [], + isAllowedToSetup: ["otp-phone", "link-phone"], + }, +}; +app.post("/setMFAInfo", verifySession(), async (req, res) => { + let session = req.session; + + mfaInfo = req.body.mfaInfo; + await session.mergeIntoAccessTokenPayload(req.body.payload); + + res.send({ status: "OK" }); +}); + +app.post("/mergeIntoAccessTokenPayload", verifySession(), async (req, res) => { let session = req.session; await session.mergeIntoAccessTokenPayload(req.body); @@ -390,8 +405,9 @@ app.post("/payload", verifySession(), async (req, res) => { res.send({ status: "OK" }); }); +// TODO: remove this after we get backend SDK support app.get("/auth/mfa/info", (req, res) => { - res.send({ status: "OK" }); + res.send({ status: "OK", ...mfaInfo }); }); app.get("/token", async (_, res) => { From ad99b5f2ab47bb45e9dcc0622a581c4c91d4843e Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Thu, 19 Oct 2023 23:43:56 +0200 Subject: [PATCH 07/35] feat: factor chooser fixes and updates --- lib/build/index2.js | 2 +- lib/build/multifactorauth-shared.js | 57 +++++++++--- lib/build/multifactorauthprebuiltui.js | 64 +++++++------- .../multifactorauth/multiFactorAuthClaim.d.ts | 2 +- lib/build/recipe/multifactorauth/recipe.d.ts | 8 +- lib/build/recipe/multifactorauth/types.d.ts | 6 +- .../features/factorChooser/index.tsx | 35 +++++--- .../multifactorauth/multiFactorAuthClaim.ts | 4 +- lib/ts/recipe/multifactorauth/recipe.tsx | 32 +++++-- lib/ts/recipe/multifactorauth/types.ts | 6 +- lib/ts/recipe/multifactorauth/utils.ts | 8 +- lib/ts/recipe/recipeRouter/index.tsx | 2 +- test/server/index.js | 88 +++++++++++++++++-- 13 files changed, 227 insertions(+), 87 deletions(-) diff --git a/lib/build/index2.js b/lib/build/index2.js index 0b24c118d..44251fa1e 100644 --- a/lib/build/index2.js +++ b/lib/build/index2.js @@ -532,7 +532,7 @@ var RecipeRouter = /** @class */ (function () { return componentMatchingRid; } if (mfaRecipe) { - return chooseComponentBasedOnFirstFactors(mfaRecipe.config.getFirstFactors(), routeComponents); + return chooseComponentBasedOnFirstFactors(mfaRecipe.getFirstFactors(), routeComponents); } else { return defaultComp; } diff --git a/lib/build/multifactorauth-shared.js b/lib/build/multifactorauth-shared.js index 26a42195b..825426998 100644 --- a/lib/build/multifactorauth-shared.js +++ b/lib/build/multifactorauth-shared.js @@ -57,7 +57,7 @@ var MultiFactorAuthClaimClass = /** @class */ (function () { userContext ); } else { - return getRedirectURL({ action: "FACTOR_CHOICE_REQUIRED" }, userContext); + return getRedirectURL({ action: "FACTOR_CHOOSER" }, userContext); } } return getRedirectURL({ action: "GO_TO_FACTOR", factorId: reason.factorId }, userContext); @@ -166,14 +166,10 @@ function normaliseMultiFactorAuthFeature(config) { ), { disableDefaultUI: disableDefaultUI, - getFirstFactors: - (config === null || config === void 0 ? void 0 : config.firstFactors) !== undefined - ? function () { - return config.firstFactors; - } - : function () { - return MultiFactorAuth.getInstanceOrThrow().getDefaultFirstFactors(); - }, + firstFactors: config === null || config === void 0 ? void 0 : config.firstFactors, + getFactorInfo: function (orig) { + return orig; + }, factorChooserScreen: (_a = config.factorChooserScreen) !== null && _a !== void 0 ? _a : {}, override: override, } @@ -204,12 +200,12 @@ var MultiFactorAuth = /** @class */ (function (_super) { _this.webJSRecipe = webJSRecipe; _this.recipeID = MultiFactorAuth.RECIPE_ID; _this.firstFactors = []; - _this.factorRedirectionInfo = []; + _this.secondaryFactors = []; _this.getDefaultRedirectionURL = function (context) { return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { var chooserPath, redirectInfo; return genericComponentOverrideContext.__generator(this, function (_b) { - if (context.action === "FACTOR_CHOICE_REQUIRED") { + if (context.action === "FACTOR_CHOOSER") { chooserPath = new NormalisedURLPath__default.default(DEFAULT_FACTOR_CHOOSER_PATH); return [ 2 /*return*/, @@ -218,7 +214,7 @@ var MultiFactorAuth = /** @class */ (function (_super) { ), ]; } else if (context.action === "GO_TO_FACTOR") { - redirectInfo = this.factorRedirectionInfo.find(function (f) { + redirectInfo = this.getSecondaryFactors().find(function (f) { return f.id === context.factorId; }); if (redirectInfo !== undefined) { @@ -290,7 +286,42 @@ var MultiFactorAuth = /** @class */ (function (_super) { MultiFactorAuth.prototype.addMFAFactors = function (firstFactors, secondaryFactors) { var _b, _c; (_b = this.firstFactors).push.apply(_b, firstFactors); - (_c = this.factorRedirectionInfo).push.apply(_c, secondaryFactors); + (_c = this.secondaryFactors).push.apply(_c, secondaryFactors); + }; + MultiFactorAuth.prototype.getFirstFactors = function () { + var _b; + return (_b = this.config.firstFactors) !== null && _b !== void 0 ? _b : this.firstFactors; + }; + MultiFactorAuth.prototype.getSecondaryFactors = function () { + return this.config.getFactorInfo(this.secondaryFactors); + }; + MultiFactorAuth.prototype.redirectToFactor = function (factorId, history) { + return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { + var _b, _c; + return genericComponentOverrideContext.__generator(this, function (_d) { + switch (_d.label) { + case 0: + _c = (_b = genericComponentOverrideContext.SuperTokens.getInstanceOrThrow()).redirectToUrl; + return [4 /*yield*/, this.getRedirectUrl({ action: "GO_TO_FACTOR", factorId: factorId })]; + case 1: + return [2 /*return*/, _c.apply(_b, [_d.sent(), history])]; + } + }); + }); + }; + MultiFactorAuth.prototype.redirectToFactorChooser = function (history) { + return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { + var _b, _c; + return genericComponentOverrideContext.__generator(this, function (_d) { + switch (_d.label) { + case 0: + _c = (_b = genericComponentOverrideContext.SuperTokens.getInstanceOrThrow()).redirectToUrl; + return [4 /*yield*/, this.getRedirectUrl({ action: "FACTOR_CHOOSER" })]; + case 1: + return [2 /*return*/, _c.apply(_b, [_d.sent(), history])]; + } + }); + }); }; var _a; _a = MultiFactorAuth; diff --git a/lib/build/multifactorauthprebuiltui.js b/lib/build/multifactorauthprebuiltui.js index 78969eff7..59f5baa4c 100644 --- a/lib/build/multifactorauthprebuiltui.js +++ b/lib/build/multifactorauthprebuiltui.js @@ -7,12 +7,12 @@ var uiEntry = require("./index2.js"); var session = require("./session-shared3.js"); var componentOverrideContext = require("./multifactorauth-shared2.js"); var React = require("react"); -var recipe = require("./session-shared2.js"); +var recipe$1 = require("./session-shared2.js"); +var recipe = require("./multifactorauth-shared.js"); var SuperTokensBranding = require("./SuperTokensBranding.js"); var translations = require("./translations.js"); var arrowLeftIcon = require("./arrowLeftIcon.js"); var translationContext = require("./translationContext.js"); -var recipe$1 = require("./multifactorauth-shared.js"); require("supertokens-web-js"); require("supertokens-web-js/utils/cookieHandler"); require("supertokens-web-js/utils/postSuperTokensInitCallbacks"); @@ -299,26 +299,34 @@ var FactorChooser$1 = function (props) { function () { return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () { return genericComponentOverrideContext.__generator(this, function (_a) { - switch (_a.label) { - case 0: - if (sessionContext.loading === true) { - // This callback should only be called if the session is already loaded - throw new Error("Should never come here"); - } - return [4 /*yield*/, props.recipe.webJSRecipe.getMFAInfo({ userContext: userContext })]; - case 1: - return [2 /*return*/, _a.sent()]; - } + return [2 /*return*/, props.recipe.webJSRecipe.getMFAInfo({ userContext: userContext })]; }); }); }, - [props.recipe, sessionContext, redirectToAuthWithHistory, userContext] + [props.recipe, userContext] ); - var checkIsEmailVerified = React.useCallback( + var checkMFAInfo = React.useCallback( function (mfaInfo) { return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () { + var availableFactors; return genericComponentOverrideContext.__generator(this, function (_a) { - setMFAInfo(mfaInfo.factors); + availableFactors = props.recipe.getSecondaryFactors().filter(function (_a) { + var id = _a.id; + return ( + mfaInfo.factors.isAllowedToSetup.includes(id) || mfaInfo.factors.isAlreadySetup.includes(id) + ); + }); + if (availableFactors.length === 1) { + return [ + 2 /*return*/, + recipe.MultiFactorAuth.getInstanceOrThrow().redirectToFactor( + availableFactors[0].id, + props.history + ), + ]; + } else { + setMFAInfo(mfaInfo.factors); + } return [2 /*return*/]; }); }); @@ -333,7 +341,7 @@ var FactorChooser$1 = function (props) { case 0: return [ 4 /*yield*/, - recipe.Session.getInstanceOrThrow().doesSessionExist({ userContext: userContext }), + recipe$1.Session.getInstanceOrThrow().doesSessionExist({ userContext: userContext }), ]; case 1: if (!_a.sent()) return [3 /*break*/, 2]; @@ -353,7 +361,7 @@ var FactorChooser$1 = function (props) { ); genericComponentOverrideContext.useOnMountAPICall( fetchMFAInfo, - checkIsEmailVerified, + checkMFAInfo, handleError, sessionContext.loading === false ); @@ -370,7 +378,7 @@ var FactorChooser$1 = function (props) { return genericComponentOverrideContext.__generator(this, function (_a) { switch (_a.label) { case 0: - session = recipe.Session.getInstanceOrThrow(); + session = recipe$1.Session.getInstanceOrThrow(); return [4 /*yield*/, session.signOut(props.userContext)]; case 1: _a.sent(); @@ -387,6 +395,10 @@ var FactorChooser$1 = function (props) { var childProps = { config: props.recipe.config, }; + var availableFactors = props.recipe.getSecondaryFactors().filter(function (_a) { + var id = _a.id; + return mfaInfo.isAllowedToSetup.includes(id) || mfaInfo.isAlreadySetup.includes(id); + }); return jsxRuntime.jsx( uiEntry.ComponentOverrideContext.Provider, genericComponentOverrideContext.__assign( @@ -407,15 +419,7 @@ var FactorChooser$1 = function (props) { FactorChooserThemeWrapper, genericComponentOverrideContext.__assign({}, childProps, { mfaInfo: mfaInfo, - availableFactors: props.recipe.factorRedirectionInfo.filter(function ( - _a - ) { - var id = _a.id; - return ( - mfaInfo.isAllowedToSetup.includes(id) || - mfaInfo.isAlreadySetup.includes(id) - ); - }), + availableFactors: availableFactors, logout: signOut, navigateToFactor: navigateToFactor, }) @@ -450,7 +454,7 @@ var MultiFactorAuthPreBuiltUI = /** @class */ (function (_super) { var features = {}; if (_this.recipeInstance.config.disableDefaultUI !== true) { var normalisedFullPath = _this.recipeInstance.config.appInfo.websiteBasePath.appendPath( - new NormalisedURLPath__default.default(recipe$1.DEFAULT_FACTOR_CHOOSER_PATH) + new NormalisedURLPath__default.default(recipe.DEFAULT_FACTOR_CHOOSER_PATH) ); features[normalisedFullPath.getAsStringDangerous()] = { matches: genericComponentOverrideContext.matchRecipeIdUsingQueryParams( @@ -459,7 +463,7 @@ var MultiFactorAuthPreBuiltUI = /** @class */ (function (_super) { component: function (props) { return _this.getFeatureComponent("factorchooser", props, useComponentOverrides); }, - recipeID: recipe$1.MultiFactorAuth.RECIPE_ID, + recipeID: recipe.MultiFactorAuth.RECIPE_ID, }; } return features; @@ -509,7 +513,7 @@ var MultiFactorAuthPreBuiltUI = /** @class */ (function (_super) { // Static methods MultiFactorAuthPreBuiltUI.getInstanceOrInitAndGetInstance = function () { if (MultiFactorAuthPreBuiltUI.instance === undefined) { - var recipeInstance = recipe$1.MultiFactorAuth.getInstanceOrThrow(); + var recipeInstance = recipe.MultiFactorAuth.getInstanceOrThrow(); MultiFactorAuthPreBuiltUI.instance = new MultiFactorAuthPreBuiltUI(recipeInstance); } return MultiFactorAuthPreBuiltUI.instance; diff --git a/lib/build/recipe/multifactorauth/multiFactorAuthClaim.d.ts b/lib/build/recipe/multifactorauth/multiFactorAuthClaim.d.ts index 7caac34d3..12dbe9bb2 100644 --- a/lib/build/recipe/multifactorauth/multiFactorAuthClaim.d.ts +++ b/lib/build/recipe/multifactorauth/multiFactorAuthClaim.d.ts @@ -39,7 +39,7 @@ export declare class MultiFactorAuthClaimClass { factorId: string; } | { - action: "FACTOR_CHOICE_REQUIRED"; + action: "FACTOR_CHOOSER"; }, userContext: any ) => Promise, diff --git a/lib/build/recipe/multifactorauth/recipe.d.ts b/lib/build/recipe/multifactorauth/recipe.d.ts index c4aa11fe1..e25e74e95 100644 --- a/lib/build/recipe/multifactorauth/recipe.d.ts +++ b/lib/build/recipe/multifactorauth/recipe.d.ts @@ -21,8 +21,8 @@ export default class MultiFactorAuth extends RecipeModule< static RECIPE_ID: string; static MultiFactorAuthClaim: MultiFactorAuthClaimClass; recipeID: string; - firstFactors: string[]; - factorRedirectionInfo: SecondaryFactorRedirectionInfo[]; + private readonly firstFactors; + private readonly secondaryFactors; constructor( config: NormalisedConfigWithAppInfoAndRecipeID, webJSRecipe?: WebJSRecipeInterface @@ -35,4 +35,8 @@ export default class MultiFactorAuth extends RecipeModule< getDefaultRedirectionURL: (context: GetRedirectionURLContext) => Promise; getDefaultFirstFactors(): string[]; addMFAFactors(firstFactors: string[], secondaryFactors: SecondaryFactorRedirectionInfo[]): void; + getFirstFactors(): string[]; + getSecondaryFactors(): SecondaryFactorRedirectionInfo[]; + redirectToFactor(factorId: string, history?: any): Promise; + redirectToFactorChooser(history?: any): Promise; } diff --git a/lib/build/recipe/multifactorauth/types.d.ts b/lib/build/recipe/multifactorauth/types.d.ts index 7cf28be90..9e7d1f639 100644 --- a/lib/build/recipe/multifactorauth/types.d.ts +++ b/lib/build/recipe/multifactorauth/types.d.ts @@ -14,6 +14,7 @@ export declare type ComponentOverrideMap = { }; export declare type UserInput = { firstFactors?: string[]; + getFactorInfo?: (builtInFactors: SecondaryFactorRedirectionInfo[]) => SecondaryFactorRedirectionInfo[]; disableDefaultUI?: boolean; factorChooserScreen?: FeatureBaseConfig; override?: { @@ -26,7 +27,8 @@ export declare type UserInput = { export declare type Config = UserInput & RecipeModuleConfig; export declare type NormalisedConfig = { - getFirstFactors: () => string[]; + firstFactors?: string[]; + getFactorInfo: (builtInFactors: SecondaryFactorRedirectionInfo[]) => SecondaryFactorRedirectionInfo[]; disableDefaultUI: boolean; factorChooserScreen: FeatureBaseConfig; override: { @@ -38,7 +40,7 @@ export declare type NormalisedConfig = { } & NormalisedRecipeModuleConfig; export declare type GetRedirectionURLContext = | { - action: "FACTOR_CHOICE_REQUIRED"; + action: "FACTOR_CHOOSER"; } | { action: "GO_TO_FACTOR"; diff --git a/lib/ts/recipe/multifactorauth/components/features/factorChooser/index.tsx b/lib/ts/recipe/multifactorauth/components/features/factorChooser/index.tsx index 37dc4ae35..6eb0b33ec 100644 --- a/lib/ts/recipe/multifactorauth/components/features/factorChooser/index.tsx +++ b/lib/ts/recipe/multifactorauth/components/features/factorChooser/index.tsx @@ -26,6 +26,7 @@ import { useUserContext } from "../../../../../usercontext"; import { useOnMountAPICall } from "../../../../../utils"; import { SessionContext } from "../../../../session"; import Session from "../../../../session/recipe"; +import MultiFactorAuth from "../../../recipe"; import FactorChooserTheme from "../../themes/factorChooser"; import { defaultTranslationsMultiFactorAuth } from "../../themes/translations"; @@ -46,17 +47,24 @@ export const FactorChooser: React.FC = (props) => { await redirectToAuth({ redirectBack: false, history: props.history }); }, [props.history]); - const fetchMFAInfo = useCallback(async () => { - if (sessionContext.loading === true) { - // This callback should only be called if the session is already loaded - throw new Error("Should never come here"); - } - return await props.recipe.webJSRecipe.getMFAInfo({ userContext }); - }, [props.recipe, sessionContext, redirectToAuthWithHistory, userContext]); + const fetchMFAInfo = useCallback( + async () => props.recipe.webJSRecipe.getMFAInfo({ userContext }), + [props.recipe, userContext] + ); - const checkIsEmailVerified = useCallback( + const checkMFAInfo = useCallback( async (mfaInfo: { factors: MFAFactorInfo }): Promise => { - setMFAInfo(mfaInfo.factors); + const availableFactors = props.recipe + .getSecondaryFactors() + .filter( + ({ id }) => + mfaInfo.factors.isAllowedToSetup.includes(id) || mfaInfo.factors.isAlreadySetup.includes(id) + ); + if (availableFactors.length === 1) { + return MultiFactorAuth.getInstanceOrThrow().redirectToFactor(availableFactors[0].id, props.history); + } else { + setMFAInfo(mfaInfo.factors); + } }, [setMFAInfo] ); @@ -72,7 +80,7 @@ export const FactorChooser: React.FC = (props) => { [redirectToAuthWithHistory] ); - useOnMountAPICall(fetchMFAInfo, checkIsEmailVerified, handleError, sessionContext.loading === false); + useOnMountAPICall(fetchMFAInfo, checkMFAInfo, handleError, sessionContext.loading === false); const navigateToFactor = useCallback( (factorId) => props.recipe.redirect({ action: "GO_TO_FACTOR", factorId }), @@ -91,6 +99,9 @@ export const FactorChooser: React.FC = (props) => { const childProps = { config: props.recipe.config, }; + const availableFactors = props.recipe + .getSecondaryFactors() + .filter(({ id }) => mfaInfo.isAllowedToSetup.includes(id) || mfaInfo.isAlreadySetup.includes(id)); return ( = (props) => { mfaInfo.isAllowedToSetup.includes(id) || mfaInfo.isAlreadySetup.includes(id) - )} + availableFactors={availableFactors} logout={signOut} navigateToFactor={navigateToFactor} /> diff --git a/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts b/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts index 4e9428f10..347e2e9a4 100644 --- a/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts +++ b/lib/ts/recipe/multifactorauth/multiFactorAuthClaim.ts @@ -31,7 +31,7 @@ export class MultiFactorAuthClaimClass { constructor( getRecipeImpl: () => RecipeInterface, getRedirectURL: ( - context: { action: "GO_TO_FACTOR"; factorId: string } | { action: "FACTOR_CHOICE_REQUIRED" }, + context: { action: "GO_TO_FACTOR"; factorId: string } | { action: "FACTOR_CHOOSER" }, userContext: any ) => Promise, onFailureRedirection?: ValidationFailureCallback @@ -50,7 +50,7 @@ export class MultiFactorAuthClaimClass { userContext ); } else { - return getRedirectURL({ action: "FACTOR_CHOICE_REQUIRED" }, userContext); + return getRedirectURL({ action: "FACTOR_CHOOSER" }, userContext); } } return getRedirectURL({ action: "GO_TO_FACTOR", factorId: reason.factorId }, userContext); diff --git a/lib/ts/recipe/multifactorauth/recipe.tsx b/lib/ts/recipe/multifactorauth/recipe.tsx index 459c598ea..6d4bcd6ed 100644 --- a/lib/ts/recipe/multifactorauth/recipe.tsx +++ b/lib/ts/recipe/multifactorauth/recipe.tsx @@ -23,6 +23,7 @@ import { PostSuperTokensInitCallbacks } from "supertokens-web-js/utils/postSuper import { SessionClaimValidatorStore } from "supertokens-web-js/utils/sessionClaimValidatorStore"; import { SSR_ERROR } from "../../constants"; +import SuperTokens from "../../superTokens"; import RecipeModule from "../recipeModule"; import { DEFAULT_FACTOR_CHOOSER_PATH } from "./constants"; @@ -56,8 +57,8 @@ export default class MultiFactorAuth extends RecipeModule< ); public recipeID = MultiFactorAuth.RECIPE_ID; - public firstFactors: string[] = []; - public factorRedirectionInfo: SecondaryFactorRedirectionInfo[] = []; + private readonly firstFactors: string[] = []; + private readonly secondaryFactors: SecondaryFactorRedirectionInfo[] = []; constructor( config: NormalisedConfigWithAppInfoAndRecipeID, @@ -127,11 +128,11 @@ export default class MultiFactorAuth extends RecipeModule< } getDefaultRedirectionURL = async (context: GetRedirectionURLContext): Promise => { - if (context.action === "FACTOR_CHOICE_REQUIRED") { + if (context.action === "FACTOR_CHOOSER") { const chooserPath = new NormalisedURLPath(DEFAULT_FACTOR_CHOOSER_PATH); return `${this.config.appInfo.websiteBasePath.appendPath(chooserPath).getAsStringDangerous()}`; } else if (context.action === "GO_TO_FACTOR") { - const redirectInfo = this.factorRedirectionInfo.find((f) => f.id === context.factorId); + const redirectInfo = this.getSecondaryFactors().find((f) => f.id === context.factorId); if (redirectInfo !== undefined) { return redirectInfo.path; } @@ -148,6 +149,27 @@ export default class MultiFactorAuth extends RecipeModule< addMFAFactors(firstFactors: string[], secondaryFactors: SecondaryFactorRedirectionInfo[]) { this.firstFactors.push(...firstFactors); - this.factorRedirectionInfo.push(...secondaryFactors); + this.secondaryFactors.push(...secondaryFactors); + } + + getFirstFactors() { + return this.config.firstFactors ?? this.firstFactors; + } + + getSecondaryFactors() { + return this.config.getFactorInfo(this.secondaryFactors); + } + + async redirectToFactor(factorId: string, history?: any) { + return SuperTokens.getInstanceOrThrow().redirectToUrl( + await this.getRedirectUrl({ action: "GO_TO_FACTOR", factorId }), + history + ); + } + async redirectToFactorChooser(history?: any) { + return SuperTokens.getInstanceOrThrow().redirectToUrl( + await this.getRedirectUrl({ action: "FACTOR_CHOOSER" }), + history + ); } } diff --git a/lib/ts/recipe/multifactorauth/types.ts b/lib/ts/recipe/multifactorauth/types.ts index 94a3a08f9..d582cb5cf 100644 --- a/lib/ts/recipe/multifactorauth/types.ts +++ b/lib/ts/recipe/multifactorauth/types.ts @@ -32,6 +32,7 @@ export type ComponentOverrideMap = { // Config is what does in the constructor of the recipe. export type UserInput = { firstFactors?: string[]; + getFactorInfo?: (builtInFactors: SecondaryFactorRedirectionInfo[]) => SecondaryFactorRedirectionInfo[]; disableDefaultUI?: boolean; factorChooserScreen?: FeatureBaseConfig; @@ -48,7 +49,8 @@ export type Config = UserInput & RecipeModuleConfig; export type NormalisedConfig = { - getFirstFactors: () => string[]; + firstFactors?: string[]; + getFactorInfo: (builtInFactors: SecondaryFactorRedirectionInfo[]) => SecondaryFactorRedirectionInfo[]; disableDefaultUI: boolean; factorChooserScreen: FeatureBaseConfig; @@ -62,7 +64,7 @@ export type NormalisedConfig = { export type GetRedirectionURLContext = | { - action: "FACTOR_CHOICE_REQUIRED"; + action: "FACTOR_CHOOSER"; } | { action: "GO_TO_FACTOR"; diff --git a/lib/ts/recipe/multifactorauth/utils.ts b/lib/ts/recipe/multifactorauth/utils.ts index 8a1d9e39e..030216795 100644 --- a/lib/ts/recipe/multifactorauth/utils.ts +++ b/lib/ts/recipe/multifactorauth/utils.ts @@ -15,8 +15,6 @@ import { normaliseRecipeModuleConfig } from "../recipeModule/utils"; -import MultiFactorAuth from "./recipe"; - import type { Config, NormalisedConfig } from "./types"; import type { RecipeInterface } from "supertokens-web-js/recipe/multifactorauth"; @@ -34,10 +32,8 @@ export function normaliseMultiFactorAuthFeature(config?: Config): NormalisedConf return { ...normaliseRecipeModuleConfig(config), disableDefaultUI, - getFirstFactors: - config?.firstFactors !== undefined - ? () => config!.firstFactors! - : () => MultiFactorAuth.getInstanceOrThrow().getDefaultFirstFactors(), + firstFactors: config?.firstFactors, + getFactorInfo: (orig) => orig, factorChooserScreen: config.factorChooserScreen ?? {}, override, }; diff --git a/lib/ts/recipe/recipeRouter/index.tsx b/lib/ts/recipe/recipeRouter/index.tsx index 183468877..c6d43c30c 100644 --- a/lib/ts/recipe/recipeRouter/index.tsx +++ b/lib/ts/recipe/recipeRouter/index.tsx @@ -120,7 +120,7 @@ export abstract class RecipeRouter { } if (mfaRecipe) { - return chooseComponentBasedOnFirstFactors(mfaRecipe.config.getFirstFactors(), routeComponents); + return chooseComponentBasedOnFirstFactors(mfaRecipe.getFirstFactors(), routeComponents); } else { return defaultComp; } diff --git a/test/server/index.js b/test/server/index.js index 5cc05acdf..9959ea3dc 100644 --- a/test/server/index.js +++ b/test/server/index.js @@ -382,12 +382,7 @@ app.post( } ); -let mfaInfo = { - factors: { - isAlreadySetup: [], - isAllowedToSetup: ["otp-phone", "link-phone"], - }, -}; +let mfaInfo = {}; app.post("/setMFAInfo", verifySession(), async (req, res) => { let session = req.session; @@ -406,8 +401,46 @@ app.post("/mergeIntoAccessTokenPayload", verifySession(), async (req, res) => { }); // TODO: remove this after we get backend SDK support -app.get("/auth/mfa/info", (req, res) => { - res.send({ status: "OK", ...mfaInfo }); +app.get("/auth/mfa/info", verifySession(), async (req, res) => { + let session = req.session; + const user = await SuperTokens.getUser(session.getUserId()); + const payload = session.getAccessTokenPayload(); + let isAllowedToSetup = []; + let isAlreadySetup = []; + if (user.phoneNumbers.length > 0) { + isAlreadySetup.push("otp-phone"); + } + if (user.emails.length > 0) { + isAlreadySetup.push("otp-email"); + } + const mfaClaim = payload["st-mfa"]; + if (mfaClaim === undefined) { + await session.mergeIntoAccessTokenPayload({ + "st-mfa": { + c: {}, // Technically the first factor should be in there... but it isn't necessary + n: ["otp-phone", "otp-email"], + }, + }); + } + if ( + isAlreadySetup.length === 0 || + (mfaClaim !== undefined && isAlreadySetup.some((id) => mfaClaim.c[id] !== undefined)) + ) { + isAllowedToSetup = ["otp-phone", "otp-email"].filter((id) => !isAlreadySetup.includes(id)); + // isAllowedToSetup = ["otp-phone", "otp-email"]; + } + // isAllowedToSetup = ["otp-phone", "otp-email"]; + + res.send({ + status: "OK", + email: user.emails[0], + phoneNumber: user.phoneNumbers[0], + factors: { + isAllowedToSetup, + isAlreadySetup, + }, + ...mfaInfo, + }); }); app.get("/token", async (_, res) => { @@ -948,7 +981,44 @@ function initST() { message: "general error from API consume code", }; } - return originalImplementation.consumeCodePOST(input); + const resp = await originalImplementation.consumeCodePOST(input); + + if (resp.status === "OK") { + let session = await Session.getSession(input.options.req, input.options.res, { + overrideGlobalClaimValidators: () => [], + }); + + if (session) { + await AccountLinking.createPrimaryUser(session.getRecipeUserId()); + await AccountLinking.linkAccounts( + resp.session.getRecipeUserId(), + session.getUserId() + ); + const mfaClaim = session.getAccessTokenPayload()["st-mfa"]; + + let factorId; + const loginMethod = resp.user.loginMethods.find( + (lm) => + lm.recipeUserId.getAsString() === + resp.session.getRecipeUserId().getAsString() + ); + if (loginMethod.email !== undefined) { + factorId = "otp-email"; + } else { + factorId = "otp-phone"; + } + await session.mergeIntoAccessTokenPayload({ + "st-mfa": { + c: { + ...mfaClaim?.c, + [factorId]: new Date() / 1000, + }, + n: [], + }, + }); + } + } + return resp; }, }; }, From 083e9086827222540a596182bddf4ae979a3fd89 Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Fri, 20 Oct 2023 00:28:01 +0200 Subject: [PATCH 08/35] feat: update pwless to support otp based mfa --- examples/for-tests/src/App.js | 6 +- lib/build/components/assets/linkIcon.d.ts | 2 - lib/build/emailpassword-shared6.js | 63 +- lib/build/emailpassword-shared7.js | 58 + lib/build/emailpasswordprebuiltui.js | 2 +- lib/build/emailverification-shared2.js | 2 +- lib/build/index2.js | 2 +- lib/build/multifactorauthprebuiltui.js | 2 +- lib/build/passwordless-shared2.js | 58 +- lib/build/passwordless-shared3.js | 2400 ++++++++++++----- lib/build/passwordlessprebuiltui.js | 4 +- .../components/features/mfa/index.d.ts | 40 +- .../components/themes/mfa/index.d.ts | 11 + .../components/themes/mfa/mfaFooter.d.ts | 3 + .../components/themes/mfa/mfaHeader.d.ts | 5 + .../components/themes/mfa/mfaOTPFooter.d.ts | 3 + .../components/themes/mfa/mfaOTPHeader.d.ts | 3 + .../components/themes/signInUp/emailForm.d.ts | 6 +- .../themes/signInUp/emailOrPhoneForm.d.ts | 6 +- .../components/themes/signInUp/index.d.ts | 6 +- .../components/themes/signInUp/phoneForm.d.ts | 6 +- .../themes/signInUp/userInputCodeForm.d.ts | 1 - .../components/themes/translations.d.ts | 5 + lib/build/recipe/passwordless/prebuiltui.d.ts | 2 +- lib/build/recipe/passwordless/types.d.ts | 76 + .../components/themes/translations.d.ts | 5 + lib/build/sessionprebuiltui.js | 2 +- lib/build/thirdparty-shared2.js | 2 +- .../thirdpartyemailpasswordprebuiltui.js | 4 +- lib/build/thirdpartypasswordlessprebuiltui.js | 16 +- lib/ts/components/assets/linkIcon.tsx | 12 - .../components/themes/styles.css | 16 - .../components/features/mfa/index.tsx | 280 +- .../components/themes/mfa/index.tsx | 175 ++ .../components/themes/mfa/mfaFooter.tsx | 46 + .../components/themes/mfa/mfaHeader.tsx | 53 + .../components/themes/mfa/mfaOTPFooter.tsx | 59 + .../components/themes/mfa/mfaOTPHeader.tsx | 61 + .../components/themes/signInUp/emailForm.tsx | 16 +- .../themes/signInUp/emailOrPhoneForm.tsx | 16 +- .../components/themes/signInUp/index.tsx | 46 +- .../components/themes/signInUp/phoneForm.tsx | 16 +- .../themes/signInUp/userInputCodeForm.tsx | 5 +- .../components/themes/translations.ts | 5 + lib/ts/recipe/passwordless/prebuiltui.tsx | 55 +- lib/ts/recipe/passwordless/recipe.tsx | 38 +- lib/ts/recipe/passwordless/types.ts | 80 + lib/ts/recipe/passwordless/utils.ts | 1 + .../components/themes/signInUp/index.tsx | 12 +- lib/ts/styles/styles.css | 16 + 50 files changed, 2863 insertions(+), 946 deletions(-) delete mode 100644 lib/build/components/assets/linkIcon.d.ts create mode 100644 lib/build/recipe/passwordless/components/themes/mfa/index.d.ts create mode 100644 lib/build/recipe/passwordless/components/themes/mfa/mfaFooter.d.ts create mode 100644 lib/build/recipe/passwordless/components/themes/mfa/mfaHeader.d.ts create mode 100644 lib/build/recipe/passwordless/components/themes/mfa/mfaOTPFooter.d.ts create mode 100644 lib/build/recipe/passwordless/components/themes/mfa/mfaOTPHeader.d.ts delete mode 100644 lib/ts/components/assets/linkIcon.tsx create mode 100644 lib/ts/recipe/passwordless/components/themes/mfa/index.tsx create mode 100644 lib/ts/recipe/passwordless/components/themes/mfa/mfaFooter.tsx create mode 100644 lib/ts/recipe/passwordless/components/themes/mfa/mfaHeader.tsx create mode 100644 lib/ts/recipe/passwordless/components/themes/mfa/mfaOTPFooter.tsx create mode 100644 lib/ts/recipe/passwordless/components/themes/mfa/mfaOTPHeader.tsx diff --git a/examples/for-tests/src/App.js b/examples/for-tests/src/App.js index 6273474b2..58b8b2df1 100644 --- a/examples/for-tests/src/App.js +++ b/examples/for-tests/src/App.js @@ -173,7 +173,7 @@ const testContext = getTestContext(); let recipeList = [ MultiFactorAuth.init({ - firstFactors: ["emailpassword", "thirdparty"], + firstFactors: ["otp-phone", "otp-email", "thirdparty"], }), Multitenancy.init({ override: { @@ -871,6 +871,10 @@ function getPasswordlessConfigs({ disableDefaultUI }) { disableDefaultUI, style: theme, }, + mfa: { + disableDefaultUI, + style: theme, + }, }); } diff --git a/lib/build/components/assets/linkIcon.d.ts b/lib/build/components/assets/linkIcon.d.ts deleted file mode 100644 index 35d45fe65..000000000 --- a/lib/build/components/assets/linkIcon.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -/// -export declare const LinkIcon: () => JSX.Element; diff --git a/lib/build/emailpassword-shared6.js b/lib/build/emailpassword-shared6.js index 56d214fab..9a31d6f0a 100644 --- a/lib/build/emailpassword-shared6.js +++ b/lib/build/emailpassword-shared6.js @@ -10,8 +10,8 @@ var React = require("react"); var translations = require("./translations.js"); var translations$1 = require("./emailverification-shared2.js"); var translationContext = require("./translationContext.js"); -var arrowLeftIcon = require("./arrowLeftIcon.js"); var formBase = require("./emailpassword-shared7.js"); +var arrowLeftIcon = require("./arrowLeftIcon.js"); var generalError = require("./emailpassword-shared.js"); var STGeneralError = require("supertokens-web-js/utils/error"); var button = require("./emailpassword-shared2.js"); @@ -56,63 +56,6 @@ var React__namespace = /*#__PURE__*/ _interopNamespace(React); var STGeneralError__default = /*#__PURE__*/ _interopDefault(STGeneralError); var STGeneralError__default$1 = /*#__PURE__*/ _interopDefault(STGeneralError$1); -/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. - * - * This software is licensed under the Apache License, Version 2.0 (the - * "License") as published by the Apache Software Foundation. - * - * You may not use this file except in compliance with the License. You may - * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -/* - * Imports. - */ -/* - * Component. - */ -function HeavyArrowLeftIcon(_a) { - var color = _a.color; - return jsxRuntime.jsx( - "svg", - genericComponentOverrideContext.__assign( - { - xmlns: "http://www.w3.org/2000/svg", - width: "16", - height: "13", - viewBox: "0 0 16 13", - "data-supertokens": "heavyArrowLeftIcon", - }, - { - children: jsxRuntime.jsx("path", { - fill: color, - d: "M13 6.8h.022H3.8l2.9 2.9a.761.761 0 0 1 0 1.07l-.451.451a.754.754 0 0 1-1.064 0L.22 6.254a.759.759 0 0 1 0-1.068L5.186.22a.755.755 0 0 1 1.064 0l.45.451a.746.746 0 0 1 .22.532.724.724 0 0 1-.22.522l-2.93 2.92h9.24a.781.781 0 0 1 .764.773v.638A.766.766 0 0 1 13 6.8z", - transform: "translate(1.182 .708)", - }), - } - ) - ); -} - -/* - * Component. - */ -function BackButton(_a) { - var onClick = _a.onClick; - return jsxRuntime.jsx( - "button", - genericComponentOverrideContext.__assign( - { onClick: onClick, "data-supertokens": "backButton backButtonCommon" }, - { children: jsxRuntime.jsx(HeavyArrowLeftIcon, { color: "rgb(var(--palette-textTitle))" }) } - ) - ); -} - /* * Component. */ @@ -215,7 +158,9 @@ var EmailPasswordResetPasswordEmail = function (props) { { "data-supertokens": "headerTitle resetPasswordHeaderTitle" }, { children: [ - jsxRuntime.jsx(BackButton, { onClick: props.onBackButtonClicked }), + jsxRuntime.jsx(formBase.BackButton, { + onClick: props.onBackButtonClicked, + }), t("EMAIL_PASSWORD_RESET_HEADER_TITLE"), jsxRuntime.jsx("span", { "data-supertokens": "backButtonPlaceholder backButtonCommon", diff --git a/lib/build/emailpassword-shared7.js b/lib/build/emailpassword-shared7.js index 6415dc169..ba3f5e811 100644 --- a/lib/build/emailpassword-shared7.js +++ b/lib/build/emailpassword-shared7.js @@ -439,6 +439,63 @@ function Label(_a) { ); } +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +/* + * Imports. + */ +/* + * Component. + */ +function HeavyArrowLeftIcon(_a) { + var color = _a.color; + return jsxRuntime.jsx( + "svg", + genericComponentOverrideContext.__assign( + { + xmlns: "http://www.w3.org/2000/svg", + width: "16", + height: "13", + viewBox: "0 0 16 13", + "data-supertokens": "heavyArrowLeftIcon", + }, + { + children: jsxRuntime.jsx("path", { + fill: color, + d: "M13 6.8h.022H3.8l2.9 2.9a.761.761 0 0 1 0 1.07l-.451.451a.754.754 0 0 1-1.064 0L.22 6.254a.759.759 0 0 1 0-1.068L5.186.22a.755.755 0 0 1 1.064 0l.45.451a.746.746 0 0 1 .22.532.724.724 0 0 1-.22.522l-2.93 2.92h9.24a.781.781 0 0 1 .764.773v.638A.766.766 0 0 1 13 6.8z", + transform: "translate(1.182 .708)", + }), + } + ) + ); +} + +/* + * Component. + */ +function BackButton(_a) { + var onClick = _a.onClick; + return jsxRuntime.jsx( + "button", + genericComponentOverrideContext.__assign( + { onClick: onClick, "data-supertokens": "backButton backButtonCommon" }, + { children: jsxRuntime.jsx(HeavyArrowLeftIcon, { color: "rgb(var(--palette-textTitle))" }) } + ) + ); +} + var FormBase = function (props) { var footer = props.footer, buttonLabel = props.buttonLabel, @@ -768,6 +825,7 @@ var FormBase = function (props) { ); }; +exports.BackButton = BackButton; exports.ErrorIcon = ErrorIcon; exports.FormBase = FormBase; exports.FormRow = FormRow; diff --git a/lib/build/emailpasswordprebuiltui.js b/lib/build/emailpasswordprebuiltui.js index c6277a8b2..e5494d026 100644 --- a/lib/build/emailpasswordprebuiltui.js +++ b/lib/build/emailpasswordprebuiltui.js @@ -30,10 +30,10 @@ require("./session-shared3.js"); require("./session-shared.js"); require("./translations.js"); require("./emailverification-shared2.js"); -require("./arrowLeftIcon.js"); require("./emailpassword-shared7.js"); require("supertokens-web-js/utils/error"); require("./emailpassword-shared2.js"); +require("./arrowLeftIcon.js"); require("./emailpassword-shared.js"); require("./SuperTokensBranding.js"); require("supertokens-web-js/lib/build/error"); diff --git a/lib/build/emailverification-shared2.js b/lib/build/emailverification-shared2.js index 6db26e977..01a454a4d 100644 --- a/lib/build/emailverification-shared2.js +++ b/lib/build/emailverification-shared2.js @@ -6,7 +6,7 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext var translations = require("./translations.js"); var styles = - '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n\n[data-supertokens~="resetPasswordHeaderTitle"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n'; + '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n\n[data-supertokens~="resetPasswordHeaderTitle"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n'; var ThemeBase = function (_a) { var children = _a.children, diff --git a/lib/build/index2.js b/lib/build/index2.js index 44251fa1e..8a6c1eddd 100644 --- a/lib/build/index2.js +++ b/lib/build/index2.js @@ -303,7 +303,7 @@ var withOverride = function (overrideKey, DefaultComponent) { }; var styles = - '[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="delayedRender"] {\n -webkit-animation-duration: 0.1s;\n animation-duration: 0.1s;\n -webkit-animation-name: animate-fade;\n animation-name: animate-fade;\n -webkit-animation-delay: 0.2s;\n animation-delay: 0.2s;\n -webkit-animation-fill-mode: backwards;\n animation-fill-mode: backwards;\n}\n@-webkit-keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n'; + '[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n[data-supertokens~="delayedRender"] {\n -webkit-animation-duration: 0.1s;\n animation-duration: 0.1s;\n -webkit-animation-name: animate-fade;\n animation-name: animate-fade;\n -webkit-animation-delay: 0.2s;\n animation-delay: 0.2s;\n -webkit-animation-fill-mode: backwards;\n animation-fill-mode: backwards;\n}\n@-webkit-keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n'; var ThemeBase = function (_a) { var children = _a.children, diff --git a/lib/build/multifactorauthprebuiltui.js b/lib/build/multifactorauthprebuiltui.js index 59f5baa4c..ebb0aedd2 100644 --- a/lib/build/multifactorauthprebuiltui.js +++ b/lib/build/multifactorauthprebuiltui.js @@ -62,7 +62,7 @@ var NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath var React__namespace = /*#__PURE__*/ _interopNamespace(React); var styles = - '[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="container"] {\n padding-top: 24px;\n}\n[data-supertokens~="row"] {\n padding-top: 16px;\n padding-bottom: 8px;\n}\n[data-supertokens~="factorChooserList"] {\n padding-top: 4px;\n}\n[data-supertokens~="factorChooserOption"] {\n display: flex;\n flex-direction: row;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n padding: 16px;\n cursor: pointer;\n margin-top: 12px;\n}\n[data-supertokens~="factorChooserOption"]:hover {\n border: 1px solid rgb(var(--palette-textLink));\n}\n[data-supertokens~="factorOptionText"] {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n align-items: start;\n text-align: left;\n}\n[data-supertokens~="factorLogo"] {\n flex-grow: 0;\n min-width: 30px;\n text-align: left;\n margin-top: 6px;\n}\n[data-supertokens~="factorName"] {\n color: rgb(var(--palette-textPrimary));\n font-size: var(--font-size-1);\n margin: 4px;\n}\n[data-supertokens~="factorChooserOption"]:hover [data-supertokens~="factorName"] {\n color: rgb(var(--palette-textLink));\n}\n[data-supertokens~="factorDescription"] {\n color: rgb(var(--palette-textSecondary));\n font-size: var(--font-size-0);\n margin: 4px;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-bottom: 32px;\n text-align: right;\n}\n'; + '[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n[data-supertokens~="container"] {\n padding-top: 24px;\n}\n[data-supertokens~="row"] {\n padding-top: 16px;\n padding-bottom: 8px;\n}\n[data-supertokens~="factorChooserList"] {\n padding-top: 4px;\n}\n[data-supertokens~="factorChooserOption"] {\n display: flex;\n flex-direction: row;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n padding: 16px;\n cursor: pointer;\n margin-top: 12px;\n}\n[data-supertokens~="factorChooserOption"]:hover {\n border: 1px solid rgb(var(--palette-textLink));\n}\n[data-supertokens~="factorOptionText"] {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n align-items: start;\n text-align: left;\n}\n[data-supertokens~="factorLogo"] {\n flex-grow: 0;\n min-width: 30px;\n text-align: left;\n margin-top: 6px;\n}\n[data-supertokens~="factorName"] {\n color: rgb(var(--palette-textPrimary));\n font-size: var(--font-size-1);\n margin: 4px;\n}\n[data-supertokens~="factorChooserOption"]:hover [data-supertokens~="factorName"] {\n color: rgb(var(--palette-textLink));\n}\n[data-supertokens~="factorDescription"] {\n color: rgb(var(--palette-textSecondary));\n font-size: var(--font-size-0);\n margin: 4px;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-bottom: 32px;\n text-align: right;\n}\n'; var ThemeBase = function (_a) { var children = _a.children, diff --git a/lib/build/passwordless-shared2.js b/lib/build/passwordless-shared2.js index f352693b5..d85b31118 100644 --- a/lib/build/passwordless-shared2.js +++ b/lib/build/passwordless-shared2.js @@ -14,27 +14,6 @@ function _interopDefault(e) { var PasswordlessWebJS__default = /*#__PURE__*/ _interopDefault(PasswordlessWebJS); -var LinkIcon = function () { - return jsxRuntime.jsxs( - "svg", - genericComponentOverrideContext.__assign( - { xmlns: "http://www.w3.org/2000/svg", width: "19", height: "16", viewBox: "0 0 19 16", fill: "none" }, - { - children: [ - jsxRuntime.jsx("path", { - d: "M10.9871 11.7876C10.2967 11.7898 9.61895 11.6022 9.0279 11.2453C8.43684 10.8885 7.95517 10.3762 7.63545 9.76427C7.31574 9.15235 7.17027 8.46436 7.21492 7.7754C7.25958 7.08644 7.49264 6.42298 7.88867 5.85745C7.99951 5.70075 8.16806 5.59449 8.35725 5.56206C8.54643 5.52963 8.74075 5.57368 8.89745 5.68452C9.05416 5.79536 9.16042 5.96391 9.19285 6.15309C9.22528 6.34228 9.18123 6.53659 9.07039 6.6933C8.75488 7.13913 8.60843 7.68273 8.65728 8.22672C8.70614 8.77071 8.9471 9.27952 9.337 9.662C9.55327 9.87943 9.81039 10.052 10.0936 10.1697C10.3767 10.2874 10.6804 10.348 10.9871 10.348C11.2938 10.348 11.5974 10.2874 11.8806 10.1697C12.1638 10.052 12.4209 9.87943 12.6372 9.662L16.9605 5.33865C17.3767 4.89673 17.6045 4.31005 17.5954 3.70303C17.5863 3.09602 17.3411 2.51642 16.9118 2.08715C16.4826 1.65788 15.903 1.4127 15.296 1.40362C14.6889 1.39454 14.1023 1.62226 13.6603 2.03849L11.8229 3.87592C11.7557 3.9431 11.676 3.99639 11.5882 4.03275C11.5004 4.06911 11.4063 4.08782 11.3113 4.08782C11.2163 4.08782 11.1222 4.06911 11.0345 4.03275C10.9467 3.99639 10.8669 3.9431 10.7997 3.87592C10.7325 3.80873 10.6793 3.72897 10.6429 3.64119C10.6065 3.55341 10.5878 3.45933 10.5878 3.36432C10.5878 3.26931 10.6065 3.17522 10.6429 3.08744C10.6793 2.99966 10.7325 2.91991 10.7997 2.85272L12.6372 1.0153C13.3543 0.347081 14.3028 -0.0167022 15.2828 0.000589365C16.2628 0.017881 17.1979 0.414897 17.891 1.108C18.5841 1.80109 18.9811 2.73616 18.9984 3.7162C19.0157 4.69623 18.6519 5.64472 17.9837 6.36184L13.6603 10.6852C13.309 11.0356 12.8921 11.3133 12.4334 11.5025C11.9747 11.6916 11.4832 11.7885 10.9871 11.7876Z", - fill: "#1485FF", - }), - jsxRuntime.jsx("path", { - d: "M3.7826 15.3866C3.03483 15.3879 2.3035 15.1672 1.68132 14.7524C1.05914 14.3376 0.574138 13.7474 0.287796 13.0567C0.00145422 12.3659 -0.0733288 11.6057 0.0729281 10.8723C0.219185 10.139 0.579895 9.46563 1.10933 8.93756L5.43268 4.61421C5.78326 4.26285 6.20004 3.9845 6.65891 3.79526C7.11777 3.60603 7.6096 3.50966 8.10595 3.51175C9.10694 3.5154 10.0666 3.91118 10.7792 4.61421C11.4078 5.23969 11.7952 6.06714 11.873 6.95048C11.9508 7.83382 11.7139 8.71624 11.2043 9.44195C11.0935 9.59865 10.925 9.70491 10.7358 9.73734C10.5466 9.76977 10.3523 9.72572 10.1956 9.61488C10.0389 9.50404 9.93261 9.33549 9.90018 9.14631C9.86774 8.95712 9.91179 8.7628 10.0226 8.6061C10.3381 8.16027 10.4846 7.61667 10.4357 7.07268C10.3869 6.52869 10.1459 6.01988 9.75603 5.6374C9.32308 5.18824 8.72968 4.92911 8.10595 4.91684C7.7967 4.92053 7.49134 4.9862 7.20792 5.10997C6.92449 5.23373 6.66877 5.41308 6.45587 5.6374L2.13252 9.96075C1.71629 10.4027 1.48857 10.9894 1.49765 11.5964C1.50673 12.2034 1.75191 12.783 2.18118 13.2122C2.61045 13.6415 3.19005 13.8867 3.79706 13.8958C4.40407 13.9049 4.99075 13.6771 5.43268 13.2609L7.2701 11.4235C7.33729 11.3563 7.41704 11.303 7.50482 11.2666C7.5926 11.2303 7.68669 11.2116 7.7817 11.2116C7.87671 11.2116 7.97079 11.2303 8.05857 11.2666C8.14635 11.303 8.22611 11.3563 8.29329 11.4235C8.36048 11.4907 8.41377 11.5704 8.45013 11.6582C8.48649 11.746 8.5052 11.8401 8.5052 11.9351C8.5052 12.0301 8.48649 12.1242 8.45013 12.212C8.41377 12.2997 8.36048 12.3795 8.29329 12.4467L6.45587 14.2841C6.10457 14.6345 5.68765 14.9122 5.22896 15.1014C4.77026 15.2906 4.27877 15.3875 3.7826 15.3866Z", - fill: "#1485FF", - }), - ], - } - ) - ); -}; - var OTPIcon = function () { return jsxRuntime.jsxs( "svg", @@ -464,6 +443,7 @@ function normalisePasswordlessConfig(config) { validatePhoneNumber: validatePhoneNumber, signInUpFeature: signInUpFeature, linkClickedScreenFeature: normalisePasswordlessBaseConfig(config.linkClickedScreenFeature), + mfaFeature: normalisePasswordlessBaseConfig(config.mfaFeature), contactMethod: config.contactMethod, override: override, } @@ -577,31 +557,31 @@ var Passwordless = /** @class */ (function (_super) { id: "otp-phone", name: "SMS based OTP", description: "Get an OTP code on your phone to complete the authentication request", - path: "/check-auth/otp-phone", + path: "/auth/mfa/otp-phone", logo: OTPIcon, }, - { - id: "link-phone", - name: "SMS based Magic link", - description: "Get a magic link on your phone to complete the authentication request", - path: "/check-auth/link-phone", - logo: LinkIcon, - }, + // { + // id: "link-phone", + // name: "SMS based Magic link", + // description: "Get a magic link on your phone to complete the authentication request", + // path: "/auth/mfa/link-phone", + // logo: LinkIcon, + // }, { id: "otp-email", - name: "SMS based OTP", + name: "Email based OTP", description: "Get an OTP code on your email address to complete the authentication request", - path: "/check-auth/otp-email", + path: "/auth/mfa/otp-email", logo: OTPIcon, }, - { - id: "link-email", - name: "SMS based Magic link", - description: - "Get a magic link on your email address to complete the authentication request", - path: "/check-auth/link-email", - logo: LinkIcon, - }, + // { + // id: "link-email", + // name: "SMS based Magic link", + // description: + // "Get a magic link on your email address to complete the authentication request", + // path: "/auth/mfa/link-email", + // logo: LinkIcon, + // }, ] ); } diff --git a/lib/build/passwordless-shared3.js b/lib/build/passwordless-shared3.js index 8845ee9f2..f89f4c5c4 100644 --- a/lib/build/passwordless-shared3.js +++ b/lib/build/passwordless-shared3.js @@ -5,6 +5,7 @@ var jsxRuntime = require("react/jsx-runtime"); var NormalisedURLPath = require("supertokens-web-js/utils/normalisedURLPath"); var uiEntry = require("./index2.js"); var authWidgetWrapper = require("./authRecipe-shared2.js"); +var session = require("./session-shared3.js"); var componentOverrideContext = require("./passwordless-shared.js"); var React = require("react"); var STGeneralError = require("supertokens-web-js/utils/error"); @@ -12,7 +13,8 @@ var recipe = require("./session-shared2.js"); var translations = require("./translations.js"); var translationContext = require("./translationContext.js"); var button = require("./emailpassword-shared2.js"); -var session = require("./session-shared3.js"); +var windowHandler = require("supertokens-web-js/utils/windowHandler"); +var recipe$2 = require("./multifactorauth-shared.js"); var recipe$1 = require("./passwordless-shared2.js"); var SuperTokensBranding = require("./SuperTokensBranding.js"); var generalError = require("./emailpassword-shared.js"); @@ -20,6 +22,7 @@ var checkedRoundIcon = require("./checkedRoundIcon.js"); var formBase = require("./emailpassword-shared7.js"); var validators = require("./emailpassword-shared5.js"); var arrowLeftIcon = require("./arrowLeftIcon.js"); +var multifactorauth = require("./multifactorauth.js"); function _interopDefault(e) { return e && e.__esModule ? e : { default: e }; @@ -56,7 +59,7 @@ var React__namespace = /*#__PURE__*/ _interopNamespace(React); var STGeneralError__default = /*#__PURE__*/ _interopDefault(STGeneralError); var styles = - '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n\n[data-supertokens~="resetPasswordHeaderTitle"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n\n[data-supertokens~="generalSuccess"] {\n margin-bottom: 20px;\n -webkit-animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n}\n\n[data-supertokens~="codeInputLabelWrapper"] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="headerSubtitle"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n[data-supertokens~="sendCodeText"] {\n margin-top: 15px;\n margin-bottom: 20px;\n}\n\n[data-supertokens~="sendCodeText"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n[data-supertokens~="resendCodeBtn"] {\n width: auto;\n margin-top: 0;\n line-height: 24px;\n}\n\n[data-supertokens~="resendCodeBtn"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="resendCodeBtn"]:disabled {\n color: rgb(var(--palette-textPrimary));\n cursor: default;\n text-decoration: none;\n}\n\n[data-supertokens~="phoneInputLibRoot"] {\n display: flex;\n align-items: center;\n}\n\n[data-supertokens~="phoneInputWrapper"] {\n display: flex;\n align-items: center;\n}\n\n[data-supertokens~="phoneInputWrapper"] .iti [data-supertokens~="input"] {\n padding-left: 15px;\n}\n\n[data-supertokens~="phoneInputWrapper"] .iti {\n flex: 1 1;\n min-width: 0;\n width: 100%;\n background: transparent;\n border: none;\n color: inherit;\n outline: none;\n}\n\n[data-supertokens~="continueButtonWrapper"] {\n margin-top: 10px;\n margin-bottom: 30px;\n}\n\n.iti__country-list {\n border: 0;\n top: 40px;\n width: min(72.2vw, 320px);\n border-radius: 6;\n box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.16);\n}\n\n.iti__country {\n display: flex;\n align-items: center;\n height: 34px;\n cursor: pointer;\n\n padding: 0 8px;\n}\n\n.iti__country-name {\n color: var(--palette-textLabel);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: "0 16px";\n}\n'; + '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n\n[data-supertokens~="resetPasswordHeaderTitle"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n\n[data-supertokens~="generalSuccess"] {\n margin-bottom: 20px;\n -webkit-animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n}\n\n[data-supertokens~="codeInputLabelWrapper"] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="headerSubtitle"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n[data-supertokens~="sendCodeText"] {\n margin-top: 15px;\n margin-bottom: 20px;\n}\n\n[data-supertokens~="sendCodeText"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n[data-supertokens~="resendCodeBtn"] {\n width: auto;\n margin-top: 0;\n line-height: 24px;\n}\n\n[data-supertokens~="resendCodeBtn"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="resendCodeBtn"]:disabled {\n color: rgb(var(--palette-textPrimary));\n cursor: default;\n text-decoration: none;\n}\n\n[data-supertokens~="phoneInputLibRoot"] {\n display: flex;\n align-items: center;\n}\n\n[data-supertokens~="phoneInputWrapper"] {\n display: flex;\n align-items: center;\n}\n\n[data-supertokens~="phoneInputWrapper"] .iti [data-supertokens~="input"] {\n padding-left: 15px;\n}\n\n[data-supertokens~="phoneInputWrapper"] .iti {\n flex: 1 1;\n min-width: 0;\n width: 100%;\n background: transparent;\n border: none;\n color: inherit;\n outline: none;\n}\n\n[data-supertokens~="continueButtonWrapper"] {\n margin-top: 10px;\n margin-bottom: 30px;\n}\n\n.iti__country-list {\n border: 0;\n top: 40px;\n width: min(72.2vw, 320px);\n border-radius: 6;\n box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.16);\n}\n\n.iti__country {\n display: flex;\n align-items: center;\n height: 34px;\n cursor: pointer;\n\n padding: 0 8px;\n}\n\n.iti__country-name {\n color: var(--palette-textLabel);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: "0 16px";\n}\n'; var ThemeBase = function (_a) { var children = _a.children, @@ -222,6 +225,11 @@ var defaultTranslationsPasswordless = { PWLESS_USER_INPUT_CODE_HEADER_SUBTITLE: "An OTP was sent to you at", PWLESS_USER_INPUT_CODE_HEADER_SUBTITLE_LINK: "An OTP and a magic link was sent to you at", PWLESS_USER_INPUT_CODE_INPUT_LABEL: "OTP", + PWLESS_MFA_LOGOUT: "Logout", + PWLESS_MFA_HEADER_TITLE_PHONE: "SMS based OTP", + PWLESS_MFA_HEADER_TITLE_EMAIL: "Email based OTP", + PWLESS_MFA_FOOTER_CHOOSER_ANOTHER: "Choose another factor", + PWLESS_MFA_FOOTER_LOGOUT: "Logout", /* * The following are error messages from our backend SDK. * These are returned as full messages to preserver compatibilty, but they work just like the keys above. @@ -569,6 +577,7 @@ var SignInUpFooter = uiEntry.withOverride("PasswordlessSignInUpFooter", function var EmailForm = uiEntry.withOverride("PasswordlessEmailForm", function PasswordlessEmailForm(props) { var _this = this; + var _a; var userContext = uiEntry.useUserContext(); return jsxRuntime.jsx(formBase.FormBase, { clearError: props.clearError, @@ -628,10 +637,13 @@ var EmailForm = uiEntry.withOverride("PasswordlessEmailForm", function Passwordl }, validateOnBlur: false, showLabels: true, - footer: jsxRuntime.jsx(SignInUpFooter, { - privacyPolicyLink: props.config.signInUpFeature.privacyPolicyLink, - termsOfServiceLink: props.config.signInUpFeature.termsOfServiceLink, - }), + footer: + (_a = props.footer) !== null && _a !== void 0 + ? _a + : jsxRuntime.jsx(SignInUpFooter, { + privacyPolicyLink: props.config.signInUpFeature.privacyPolicyLink, + termsOfServiceLink: props.config.signInUpFeature.termsOfServiceLink, + }), }); }); @@ -2743,79 +2755,1422 @@ var phoneNumberInputWithInjectedProps = function (injectedProps) { }; }; -var EmailOrPhoneForm = uiEntry.withOverride( - "PasswordlessEmailOrPhoneForm", - function PasswordlessEmailOrPhoneForm(props) { +var PhoneForm = uiEntry.withOverride("PasswordlessPhoneForm", function PasswordlessPhoneForm(props) { + var _this = this; + var _a; + var userContext = uiEntry.useUserContext(); + React.useEffect(function () { + // We preload this here, since it will be used almost for sure, but loading it + void recipe$1.preloadPhoneNumberUtils(); + }, []); + var phoneInput = React.useMemo( + function () { + return phoneNumberInputWithInjectedProps({ + defaultCountry: props.config.signInUpFeature.defaultCountry, + }); + }, + [props.config.signInUpFeature.defaultCountry] + ); + return jsxRuntime.jsx(formBase.FormBase, { + clearError: props.clearError, + onError: props.onError, + formFields: [ + { + id: "phoneNumber", + label: "PWLESS_SIGN_IN_UP_PHONE_LABEL", + inputComponent: phoneInput, + optional: false, + autofocus: true, + placeholder: "", + autoComplete: "tel", + validate: validators.defaultValidate, + }, + ], + buttonLabel: "PWLESS_SIGN_IN_UP_CONTINUE_BUTTON", + onSuccess: props.onSuccess, + callAPI: function (formFields) { + return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { + var phoneNumber, validationRes, response; + var _a; + return genericComponentOverrideContext.__generator(this, function (_b) { + switch (_b.label) { + case 0: + phoneNumber = + (_a = formFields.find(function (field) { + return field.id === "phoneNumber"; + })) === null || _a === void 0 + ? void 0 + : _a.value; + if (phoneNumber === undefined) { + throw new STGeneralError__default.default("GENERAL_ERROR_PHONE_UNDEFINED"); + } + return [4 /*yield*/, props.config.validatePhoneNumber(phoneNumber)]; + case 1: + validationRes = _b.sent(); + if (validationRes !== undefined) { + throw new STGeneralError__default.default(validationRes); + } + return [ + 4 /*yield*/, + props.recipeImplementation.createCode({ + phoneNumber: phoneNumber, + userContext: userContext, + }), + ]; + case 2: + response = _b.sent(); + if (response.status === "SIGN_IN_UP_NOT_ALLOWED") { + throw new STGeneralError__default.default(response.reason); + } + return [2 /*return*/, response]; + } + }); + }); + }, + validateOnBlur: false, + showLabels: true, + footer: + (_a = props.footer) !== null && _a !== void 0 + ? _a + : jsxRuntime.jsx(SignInUpFooter, { + privacyPolicyLink: props.config.signInUpFeature.privacyPolicyLink, + termsOfServiceLink: props.config.signInUpFeature.termsOfServiceLink, + }), + }); +}); + +var ResendButton = uiEntry.withOverride("PasswordlessResendButton", function PasswordlessResendButton(_a) { + var loginAttemptInfo = _a.loginAttemptInfo, + resendEmailOrSMSGapInSeconds = _a.resendEmailOrSMSGapInSeconds, + onClick = _a.onClick; + var t = translationContext.useTranslation(); + var getTimeLeft = React.useCallback( + function () { + var timeLeft = loginAttemptInfo.lastResend + resendEmailOrSMSGapInSeconds * 1000 - Date.now(); + return timeLeft < 0 ? undefined : Math.ceil(timeLeft / 1000); + }, + [loginAttemptInfo, resendEmailOrSMSGapInSeconds] + ); + var _b = React.useState(getTimeLeft()), + secsUntilResend = _b[0], + setSecsUntilResend = _b[1]; + React.useEffect( + function () { + // This runs every time the loginAttemptInfo updates, so after every resend + var interval = setInterval(function () { + var timeLeft = getTimeLeft(); + if (timeLeft === undefined) { + clearInterval(interval); + } + setSecsUntilResend(timeLeft); + }, 500); + return function () { + // This can safely run twice + clearInterval(interval); + }; + }, + [getTimeLeft, setSecsUntilResend] + ); + return jsxRuntime.jsx( + "button", + genericComponentOverrideContext.__assign( + { + type: "button", + disabled: secsUntilResend !== undefined, + onClick: onClick, + "data-supertokens": "link linkButton resendCodeBtn", + }, + { + children: + secsUntilResend !== undefined + ? jsxRuntime.jsxs(React__namespace.default.Fragment, { + children: [ + t("PWLESS_RESEND_BTN_DISABLED_START"), + jsxRuntime.jsxs("strong", { + children: [ + Math.floor(secsUntilResend / 60) + .toString() + .padStart(2, "0"), + ":", + (secsUntilResend % 60).toString().padStart(2, "0"), + ], + }), + t("PWLESS_RESEND_BTN_DISABLED_END"), + ], + }) + : loginAttemptInfo.contactMethod === "EMAIL" + ? t("PWLESS_RESEND_BTN_EMAIL") + : t("PWLESS_RESEND_BTN_PHONE"), + } + ) + ); +}); + +var UserInputCodeFormFooter = uiEntry.withOverride( + "PasswordlessUserInputCodeFormFooter", + function PasswordlessUserInputCodeFormFooter(_a) { + var loginAttemptInfo = _a.loginAttemptInfo, + recipeImplementation = _a.recipeImplementation; + var t = translationContext.useTranslation(); + var userContext = uiEntry.useUserContext(); + return jsxRuntime.jsx(React.Fragment, { + children: jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { + "data-supertokens": "secondaryText secondaryLinkWithLeftArrow", + onClick: function () { + return recipeImplementation.clearLoginAttemptInfo({ + userContext: userContext, + }); + }, + }, + { + children: [ + jsxRuntime.jsx(arrowLeftIcon.ArrowLeftIcon, { color: "rgb(var(--palette-textPrimary))" }), + loginAttemptInfo.contactMethod === "EMAIL" + ? t("PWLESS_SIGN_IN_UP_CHANGE_CONTACT_INFO_EMAIL") + : t("PWLESS_SIGN_IN_UP_CHANGE_CONTACT_INFO_PHONE"), + ], + } + ) + ), + }); + } +); + +var UserInputCodeForm = uiEntry.withOverride( + "PasswordlessUserInputCodeForm", + function PasswordlessUserInputCodeForm(props) { var _this = this; - var _a = React.useState(false), - isPhoneNumber = _a[0], - setIsPhoneNumber = _a[1]; + var _a; + var t = translationContext.useTranslation(); var userContext = uiEntry.useUserContext(); - React.useEffect(function () { - // We preload this here, since it will be used almost for sure, but loading it - void recipe$1.preloadPhoneNumberUtils(); - }, []); - var emailOrPhoneInput = React.useMemo( + // We need this any because the node types are also loaded + var _b = React.useState(), + clearResendNotifTimeout = _b[0], + setClearResendNotifTimeout = _b[1]; + React.useEffect( function () { - return isPhoneNumber - ? phoneNumberInputWithInjectedProps({ - defaultCountry: props.config.signInUpFeature.defaultCountry, - }) - : undefined; + // This is just to clean up on unmount and if the clear timeout changes + return function () { + clearTimeout(clearResendNotifTimeout); + }; }, - [props.config.signInUpFeature.defaultCountry, isPhoneNumber] + [clearResendNotifTimeout] ); - return jsxRuntime.jsx(formBase.FormBase, { - clearError: props.clearError, - onError: props.onError, - formFields: [ - { - id: "emailOrPhone", - label: "PWLESS_SIGN_IN_UP_EMAIL_OR_PHONE_LABEL", - inputComponent: emailOrPhoneInput, - optional: false, - autofocus: true, - placeholder: "", - // We do not add an autocomplete prop in this case, since we do not really have any sensible option to set - // Setting them to either "tel" or "email" would give people the wrong impression since this could have either - // AFAIK we can't set them both at the same time - validate: recipe$1.defaultValidate, - }, - ], - buttonLabel: "PWLESS_SIGN_IN_UP_CONTINUE_BUTTON", - onSuccess: props.onSuccess, - callAPI: function (formFields, setValue) { - return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { - var emailOrPhone, - emailValidationRes, - response, - phoneValidationRes, - response, - intPhoneNumber, - phoneValidationResAfterGuess, - response, - ex_1; - var _a; - return genericComponentOverrideContext.__generator(this, function (_b) { - switch (_b.label) { - case 0: - emailOrPhone = - (_a = formFields.find(function (field) { - return field.id === "emailOrPhone"; - })) === null || _a === void 0 - ? void 0 - : _a.value; - if (emailOrPhone === undefined) { - throw new STGeneralError__default.default("GENERAL_ERROR_EMAIL_OR_PHONE_UNDEFINED"); - } - return [4 /*yield*/, recipe$1.defaultEmailValidator(emailOrPhone)]; - case 1: - if (!(_b.sent() === undefined)) return [3 /*break*/, 6]; - return [4 /*yield*/, props.config.validateEmailAddress(emailOrPhone)]; - case 2: - emailValidationRes = _b.sent(); - if (!(emailValidationRes === undefined)) return [3 /*break*/, 4]; - return [ + function resend() { + return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { + var response, generalError, e_1; + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 5, , 6]); + response = void 0; + generalError = void 0; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [ + 4 /*yield*/, + props.recipeImplementation.resendCode({ + userContext: userContext, + }), + ]; + case 2: + response = _a.sent(); + return [3 /*break*/, 4]; + case 3: + e_1 = _a.sent(); + if (STGeneralError__default.default.isThisError(e_1)) { + generalError = e_1; + } else { + throw e_1; + } + return [3 /*break*/, 4]; + case 4: + if (generalError !== undefined) { + props.onError(generalError.message); + } else { + if (response === undefined) { + throw new Error("Should not come here"); + } + if (response.status === "OK") { + setClearResendNotifTimeout( + setTimeout(function () { + setClearResendNotifTimeout(undefined); + }, 2000) + ); + } + } + return [3 /*break*/, 6]; + case 5: + _a.sent(); + props.onError("SOMETHING_WENT_WRONG_ERROR"); + return [3 /*break*/, 6]; + case 6: + return [2 /*return*/]; + } + }); + }); + } + return jsxRuntime.jsxs(React__namespace.default.Fragment, { + children: [ + clearResendNotifTimeout !== undefined && + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "generalSuccess" }, + { + children: + props.loginAttemptInfo.contactMethod === "EMAIL" + ? t("PWLESS_RESEND_SUCCESS_EMAIL") + : t("PWLESS_RESEND_SUCCESS_PHONE"), + } + ) + ), + jsxRuntime.jsx(formBase.FormBase, { + clearError: props.clearError, + onError: props.onError, + formFields: [ + { + id: "userInputCode", + label: "", + labelComponent: jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "codeInputLabelWrapper" }, + { + children: [ + jsxRuntime.jsx(formBase.Label, { + value: "PWLESS_USER_INPUT_CODE_INPUT_LABEL", + "data-supertokens": "codeInputLabel", + }), + jsxRuntime.jsx(ResendButton, { + loginAttemptInfo: props.loginAttemptInfo, + resendEmailOrSMSGapInSeconds: + props.config.signInUpFeature.resendEmailOrSMSGapInSeconds, + onClick: resend, + }), + ], + } + ) + ), + autofocus: true, + optional: false, + clearOnSubmit: true, + autoComplete: "one-time-code", + placeholder: "", + validate: recipe$1.userInputCodeValidate, + }, + ], + onSuccess: props.onSuccess, + buttonLabel: "PWLESS_SIGN_IN_UP_CONTINUE_BUTTON", + callAPI: function (formFields) { + return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { + var userInputCode, response; + var _a; + return genericComponentOverrideContext.__generator(this, function (_b) { + switch (_b.label) { + case 0: + userInputCode = + (_a = formFields.find(function (field) { + return field.id === "userInputCode"; + })) === null || _a === void 0 + ? void 0 + : _a.value; + if (userInputCode === undefined || userInputCode.length === 0) { + throw new STGeneralError__default.default("GENERAL_ERROR_OTP_UNDEFINED"); + } + return [ + 4 /*yield*/, + props.recipeImplementation.consumeCode({ + userInputCode: userInputCode, + userContext: userContext, + }), + ]; + case 1: + response = _b.sent(); + // We can redirect these statuses, since they all cause a redirection + // and we don't really want to show anything + if ( + response.status === "OK" || + response.status === "RESTART_FLOW_ERROR" || + response.status === "SIGN_IN_UP_NOT_ALLOWED" + ) { + return [2 /*return*/, response]; + } + if (response.status === "INCORRECT_USER_INPUT_CODE_ERROR") { + throw new STGeneralError__default.default("GENERAL_ERROR_OTP_INVALID"); + } + if (response.status === "EXPIRED_USER_INPUT_CODE_ERROR") { + throw new STGeneralError__default.default("GENERAL_ERROR_OTP_EXPIRED"); + } + throw new STGeneralError__default.default("SOMETHING_WENT_WRONG_ERROR"); + } + }); + }); + }, + validateOnBlur: false, + showLabels: true, + footer: + (_a = props.footer) !== null && _a !== void 0 + ? _a + : jsxRuntime.jsx( + UserInputCodeFormFooter, + genericComponentOverrideContext.__assign({}, props, { + loginAttemptInfo: props.loginAttemptInfo, + }) + ), + }), + ], + }); + } +); + +var MFAFooter = uiEntry.withOverride("PasswordlessMFAFooter", function PasswordlessMFAFooter(props) { + var _a, _b; + var t = translationContext.useTranslation(); + var claim = session.useClaimValue(multifactorauth.MultiFactorAuthClaim); + return jsxRuntime.jsxs(jsxRuntime.Fragment, { + children: [ + claim.loading === false && + ((_b = (_a = claim.value) === null || _a === void 0 ? void 0 : _a.n.length) !== null && _b !== void 0 + ? _b + : 0) > 1 && + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { + "data-supertokens": "secondaryText secondaryLinkWithLeftArrow", + onClick: function () { + return props.onFactorChooserButtonClicked; + }, + }, + { children: t("PWLESS_MFA_FOOTER_CHOOSER_ANOTHER") } + ) + ), + jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { + "data-supertokens": "secondaryText secondaryLinkWithLeftArrow", + onClick: function () { + return props.onSignOutClicked; + }, + }, + { + children: [ + jsxRuntime.jsx(arrowLeftIcon.ArrowLeftIcon, { color: "rgb(var(--palette-textPrimary))" }), + t("PWLESS_MFA_FOOTER_LOGOUT"), + ], + } + ) + ), + ], + }); +}); + +var MFAHeader = uiEntry.withOverride("PasswordlessMFAHeader", function PasswordlessMFAHeader(props) { + var _a; + var t = translationContext.useTranslation(); + var claim = session.useClaimValue(multifactorauth.MultiFactorAuthClaim); + return jsxRuntime.jsxs(React.Fragment, { + children: [ + jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "headerTitle resetPasswordHeaderTitle" }, + { + children: [ + claim.loading === false && + ((_a = claim.value) === null || _a === void 0 ? void 0 : _a.n.length) === 0 + ? jsxRuntime.jsx(formBase.BackButton, { onClick: props.onBackButtonClicked }) + : jsxRuntime.jsx("span", { + "data-supertokens": "backButtonPlaceholder backButtonCommon", + }), + props.contactMethod === "EMAIL" + ? t("PWLESS_MFA_HEADER_TITLE_EMAIL") + : t("PWLESS_MFA_HEADER_TITLE_PHONE"), + jsxRuntime.jsx("span", { "data-supertokens": "backButtonPlaceholder backButtonCommon" }), + ], + } + ) + ), + jsxRuntime.jsx("div", { "data-supertokens": "divider" }), + ], + }); +}); + +var MFAOTPFooter = uiEntry.withOverride("PasswordlessMFAOTPFooter", function PasswordlessMFAOTPFooter(_a) { + var loginAttemptInfo = _a.loginAttemptInfo, + recipeImplementation = _a.recipeImplementation, + onSignOutClicked = _a.onSignOutClicked, + isSetupAllowed = _a.isSetupAllowed; + var t = translationContext.useTranslation(); + var userContext = uiEntry.useUserContext(); + return jsxRuntime.jsx(React.Fragment, { + children: + (isSetupAllowed && + jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { + "data-supertokens": "secondaryText secondaryLinkWithLeftArrow", + onClick: function () { + return recipeImplementation.clearLoginAttemptInfo({ + userContext: userContext, + }); + }, + }, + { + children: [ + jsxRuntime.jsx(arrowLeftIcon.ArrowLeftIcon, { + color: "rgb(var(--palette-textPrimary))", + }), + loginAttemptInfo.contactMethod === "EMAIL" + ? t("PWLESS_SIGN_IN_UP_CHANGE_CONTACT_INFO_EMAIL") + : t("PWLESS_SIGN_IN_UP_CHANGE_CONTACT_INFO_PHONE"), + ], + } + ) + )) || + jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "secondaryText secondaryLinkWithLeftArrow", onClick: onSignOutClicked }, + { + children: [ + jsxRuntime.jsx(arrowLeftIcon.ArrowLeftIcon, { color: "rgb(var(--palette-textPrimary))" }), + t("PWLESS_MFA_LOGOUT"), + ], + } + ) + ), + }); +}); + +var MFAOTPHeader = uiEntry.withOverride("PasswordlessMFAOTPHeader", function PasswordlessMFAOTPHeader(_a) { + var _b; + var loginAttemptInfo = _a.loginAttemptInfo, + onBackButtonClicked = _a.onBackButtonClicked, + isSetupAllowed = _a.isSetupAllowed; + var t = translationContext.useTranslation(); + var claim = session.useClaimValue(multifactorauth.MultiFactorAuthClaim); + return jsxRuntime.jsxs(React.Fragment, { + children: [ + jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "headerTitle resetPasswordHeaderTitle" }, + { + children: [ + claim.loading === false && + ((_b = claim.value) === null || _b === void 0 ? void 0 : _b.n.length) === 0 && + isSetupAllowed === false + ? jsxRuntime.jsx(formBase.BackButton, { onClick: onBackButtonClicked }) + : jsxRuntime.jsx("span", { + "data-supertokens": "backButtonPlaceholder backButtonCommon", + }), + t("PWLESS_USER_INPUT_CODE_HEADER_TITLE"), + jsxRuntime.jsx("span", { "data-supertokens": "backButtonPlaceholder backButtonCommon" }), + ], + } + ) + ), + jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "headerSubtitle secondaryText" }, + { + children: [ + loginAttemptInfo.flowType === "USER_INPUT_CODE" + ? t("PWLESS_USER_INPUT_CODE_HEADER_SUBTITLE") + : t("PWLESS_USER_INPUT_CODE_HEADER_SUBTITLE_LINK"), + jsxRuntime.jsx("br", {}), + jsxRuntime.jsx("strong", { children: loginAttemptInfo.contactInfo }), + ], + } + ) + ), + jsxRuntime.jsx("div", { "data-supertokens": "divider" }), + ], + }); +}); + +var MFAScreens; +(function (MFAScreens) { + MFAScreens[(MFAScreens["CloseTab"] = 0)] = "CloseTab"; + MFAScreens[(MFAScreens["EmailForm"] = 1)] = "EmailForm"; + MFAScreens[(MFAScreens["PhoneForm"] = 2)] = "PhoneForm"; + MFAScreens[(MFAScreens["UserInputCodeForm"] = 3)] = "UserInputCodeForm"; +})(MFAScreens || (MFAScreens = {})); +/* + * Component. + */ +var MFATheme = function (_a) { + var activeScreen = _a.activeScreen, + featureState = _a.featureState, + onBackButtonClicked = _a.onBackButtonClicked, + props = genericComponentOverrideContext.__rest(_a, ["activeScreen", "featureState", "onBackButtonClicked"]); + var commonProps = { + recipeImplementation: props.recipeImplementation, + config: props.config, + clearError: function () { + return props.dispatch({ type: "setError", error: undefined }); + }, + onError: function (error) { + return props.dispatch({ type: "setError", error: error }); + }, + error: featureState.error, + }; + return activeScreen === MFAScreens.CloseTab + ? jsxRuntime.jsx(CloseTabScreen, genericComponentOverrideContext.__assign({}, commonProps)) + : jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "container" }, + { + children: [ + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "row" }, + { + children: + featureState.loaded && + /* TODO: this doesn't feel great */ (featureState.isSetupAllowed === true || + featureState.loginAttemptInfo !== undefined) && + jsxRuntime.jsxs(React__namespace.default.Fragment, { + children: [ + activeScreen === MFAScreens.UserInputCodeForm + ? jsxRuntime.jsx( + MFAOTPHeader, + genericComponentOverrideContext.__assign({}, commonProps, { + loginAttemptInfo: featureState.loginAttemptInfo, + isSetupAllowed: featureState.isSetupAllowed, + onBackButtonClicked: function () { + return props.recipeImplementation.clearLoginAttemptInfo( + { + userContext: props.userContext, + } + ); + }, + }) + ) + : jsxRuntime.jsx(MFAHeader, { + onBackButtonClicked: onBackButtonClicked, + contactMethod: + activeScreen === MFAScreens.EmailForm + ? "EMAIL" + : "PHONE", + }), + featureState.error !== undefined && + jsxRuntime.jsx(generalError.GeneralError, { + error: featureState.error, + }), + activeScreen === MFAScreens.EmailForm + ? jsxRuntime.jsx( + EmailForm, + genericComponentOverrideContext.__assign({}, commonProps, { + footer: jsxRuntime.jsx( + MFAFooter, + genericComponentOverrideContext.__assign( + {}, + commonProps, + { + onFactorChooserButtonClicked: + props.onFactorChooserButtonClicked, + onSignOutClicked: props.onSignOutClicked, + isSetupAllowed: featureState.isSetupAllowed, + } + ) + ), + }) + ) + : activeScreen === MFAScreens.PhoneForm + ? jsxRuntime.jsx( + PhoneForm, + genericComponentOverrideContext.__assign({}, commonProps, { + footer: jsxRuntime.jsx( + MFAFooter, + genericComponentOverrideContext.__assign( + {}, + commonProps, + { + onFactorChooserButtonClicked: + props.onFactorChooserButtonClicked, + onSignOutClicked: props.onSignOutClicked, + isSetupAllowed: featureState.isSetupAllowed, + } + ) + ), + }) + ) + : activeScreen === MFAScreens.UserInputCodeForm + ? jsxRuntime.jsx( + UserInputCodeForm, + genericComponentOverrideContext.__assign({}, commonProps, { + loginAttemptInfo: featureState.loginAttemptInfo, + onSuccess: props.onSuccess, + footer: jsxRuntime.jsx( + MFAOTPFooter, + genericComponentOverrideContext.__assign( + {}, + commonProps, + { + onFactorChooserButtonClicked: + props.onFactorChooserButtonClicked, + onSignOutClicked: props.onSignOutClicked, + isSetupAllowed: featureState.isSetupAllowed, + loginAttemptInfo: + featureState.loginAttemptInfo, + } + ) + ), + }) + ) + : null, + ], + }), + } + ) + ), + jsxRuntime.jsx(SuperTokensBranding.SuperTokensBranding, {}), + ], + } + ) + ); +}; +function MFAThemeWrapper(props) { + var hasFont = translations.hasFontDefined(props.config.rootStyle); + var activeScreen = getActiveScreen$1(props); + var activeStyle; + if (activeScreen === MFAScreens.CloseTab) { + activeStyle = props.config.signInUpFeature.closeTabScreenStyle; + } else if (activeScreen === MFAScreens.UserInputCodeForm) { + activeStyle = props.config.signInUpFeature.userInputCodeFormStyle; + } else if (activeScreen === MFAScreens.EmailForm) { + activeStyle = props.config.signInUpFeature.emailOrPhoneFormStyle; + } else if (activeScreen === MFAScreens.PhoneForm) { + activeStyle = props.config.signInUpFeature.emailOrPhoneFormStyle; + } + return jsxRuntime.jsx( + uiEntry.UserContextWrapper, + genericComponentOverrideContext.__assign( + { userContext: props.userContext }, + { + children: jsxRuntime.jsx( + ThemeBase, + genericComponentOverrideContext.__assign( + { loadDefaultFont: !hasFont, userStyles: [props.config.rootStyle, activeStyle] }, + { + children: jsxRuntime.jsx( + MFATheme, + genericComponentOverrideContext.__assign({}, props, { activeScreen: activeScreen }) + ), + } + ) + ), + } + ) + ); +} +function getActiveScreen$1(props) { + if (props.featureState.successInAnotherTab) { + return MFAScreens.CloseTab; + } else if (props.featureState.loginAttemptInfo) { + return MFAScreens.UserInputCodeForm; + } else if (props.contactMethod === "EMAIL") { + return MFAScreens.EmailForm; + } else if (props.contactMethod === "PHONE") { + return MFAScreens.PhoneForm; + } + throw new Error("Couldn't choose active screen; Should never happen"); +} + +var useSuccessInAnotherTabChecker$1 = function (callingConsumeCodeRef, recipeImpl, state, dispatch, userContext) { + React.useEffect( + function () { + // We only need to start checking this if we have an active login attempt + if (state.loginAttemptInfo && !state.successInAnotherTab) { + var checkSessionIntervalHandle_1 = setInterval(function () { + return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () { + var currLoginAttempt; + var _a; + return genericComponentOverrideContext.__generator(this, function (_b) { + switch (_b.label) { + case 0: + if (!(callingConsumeCodeRef.current === false)) return [3 /*break*/, 2]; + return [4 /*yield*/, recipeImpl.getLoginAttemptInfo({ userContext: userContext })]; + case 1: + currLoginAttempt = _b.sent(); + if ( + currLoginAttempt === undefined || + currLoginAttempt.deviceId !== + ((_a = state.loginAttemptInfo) === null || _a === void 0 + ? void 0 + : _a.deviceId) + ) { + dispatch({ type: "successInAnotherTab" }); + } + _b.label = 2; + case 2: + return [2 /*return*/]; + } + }); + }); + }, 2000); + return function () { + clearInterval(checkSessionIntervalHandle_1); + }; + } + // Nothing to clean up + return; + }, + [state.loginAttemptInfo, state.successInAnotherTab] + ); +}; +var useFeatureReducer$1 = function () { + return React__namespace.useReducer( + function (oldState, action) { + switch (action.type) { + case "load": + return { + loaded: true, + error: action.error, + loginAttemptInfo: action.loginAttemptInfo, + isSetupAllowed: action.isAllowedToSetup, + successInAnotherTab: false, + }; + case "resendCode": + if (!oldState.loginAttemptInfo) { + return oldState; + } + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, oldState), + { + error: undefined, + loginAttemptInfo: genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, oldState.loginAttemptInfo), + { lastResend: action.timestamp } + ), + } + ); + case "restartFlow": + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, oldState), + { error: action.error, loginAttemptInfo: undefined } + ); + case "setError": + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, oldState), + { error: action.error } + ); + case "startLogin": + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, oldState), + { + loaded: true, + loginAttemptInfo: action.loginAttemptInfo, + error: undefined, + successInAnotherTab: false, + } + ); + case "successInAnotherTab": + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, oldState), + { successInAnotherTab: true } + ); + default: + return oldState; + } + }, + { + error: undefined, + loaded: false, + loginAttemptInfo: undefined, + isSetupAllowed: false, + successInAnotherTab: false, + }, + function (initArg) { + var error = undefined; + var errorQueryParam = genericComponentOverrideContext.getQueryParams("error"); + var messageQueryParam = genericComponentOverrideContext.getQueryParams("message"); + if (errorQueryParam !== null) { + if (errorQueryParam === "signin") { + error = "SOMETHING_WENT_WRONG_ERROR"; + } else if (errorQueryParam === "restart_link") { + error = "ERROR_SIGN_IN_UP_LINK"; + } else if (errorQueryParam === "custom" && messageQueryParam !== null) { + error = messageQueryParam; + } + } + return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, initArg), { + error: error, + }); + } + ); +}; +function useChildProps$1(recipe$1, recipeImplementation, state, contactMethod, userContext, history) { + var _this = this; + return React.useMemo( + function () { + if (!recipe$1 || !recipeImplementation) { + return undefined; + } + return { + onSuccess: function () { + return recipe.Session.getInstanceOrThrow().validateGlobalClaimsAndHandleSuccessRedirection( + undefined, + userContext, + history + ); + }, + onSignOutClicked: function () { + return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + return [ + 4 /*yield*/, + recipe.Session.getInstanceOrThrow().signOut({ userContext: userContext }), + ]; + case 1: + _a.sent(); + return [ + 4 /*yield*/, + recipeImplementation.clearLoginAttemptInfo({ userContext: userContext }), + ]; + case 2: + _a.sent(); + return [ + 4 /*yield*/, + uiEntry.redirectToAuth({ redirectBack: false, history: history }), + ]; + case 3: + _a.sent(); + return [2 /*return*/]; + } + }); + }); + }, + onBackButtonClicked: function () { + // If we don't have history available this would mean we are not using react-router-dom, so we use window's history + if (history === undefined) { + return windowHandler.WindowHandlerReference.getReferenceOrThrow() + .windowHandler.getWindowUnsafe() + .history.back(); + } + // If we do have history and goBack function on it this means we are using react-router-dom v5 or lower + if (history.goBack !== undefined) { + return history.goBack(); + } + // If we reach this code this means we are using react-router-dom v6 + return history(-1); + }, + onFactorChooserButtonClicked: function () { + return recipe$2.MultiFactorAuth.getInstanceOrThrow().redirectToFactorChooser(history); + }, + recipeImplementation: recipeImplementation, + config: recipe$1.config, + contactMethod: contactMethod, + }; + }, + [contactMethod, state, recipeImplementation] + ); +} +var MFAFeature = function (props) { + var recipeComponentOverrides = props.useComponentOverrides(); + var userContext = uiEntry.useUserContext(); + var callingConsumeCodeRef = React.useRef(false); + var _a = useFeatureReducer$1(), + state = _a[0], + dispatch = _a[1]; + var recipeImplementation = React__namespace.useMemo( + function () { + return ( + props.recipe && + getModifiedRecipeImplementation$1( + props.recipe.webJSRecipe, + props.recipe.config, + dispatch, + callingConsumeCodeRef + ) + ); + }, + [props.recipe] + ); + useOnLoad(props, recipeImplementation, dispatch, userContext); + var childProps = useChildProps$1( + props.recipe, + recipeImplementation, + state, + props.contactMethod, + userContext, + props.history + ); + useSuccessInAnotherTabChecker$1(callingConsumeCodeRef, recipeImplementation, state, dispatch, userContext); + React.useEffect( + function () { + if (state.loaded && state.isSetupAllowed === false && state.loginAttemptInfo === undefined) { + void recipe$2.MultiFactorAuth.getInstanceOrThrow().redirectToFactorChooser(); + } + }, + [state.loaded, state.isSetupAllowed, state.loginAttemptInfo] + ); + return jsxRuntime.jsx( + uiEntry.ComponentOverrideContext.Provider, + genericComponentOverrideContext.__assign( + { value: recipeComponentOverrides }, + { + children: jsxRuntime.jsx( + uiEntry.FeatureWrapper, + genericComponentOverrideContext.__assign( + { + useShadowDom: props.recipe.config.useShadowDom, + defaultStore: defaultTranslationsPasswordless, + }, + { + children: jsxRuntime.jsxs(React.Fragment, { + children: [ + props.children === undefined && + jsxRuntime.jsx( + MFAThemeWrapper, + genericComponentOverrideContext.__assign({}, childProps, { + featureState: state, + dispatch: dispatch, + }) + ), + props.children && + React__namespace.Children.map(props.children, function (child) { + if (React__namespace.isValidElement(child)) { + return React__namespace.cloneElement( + child, + genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, childProps), + { featureState: state, dispatch: dispatch } + ) + ); + } + return child; + }), + ], + }), + } + ) + ), + } + ) + ); +}; +function useOnLoad(props, recipeImplementation, dispatch, userContext) { + var _this = this; + var fetchMFAInfo = React__namespace.useCallback( + function () { + return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { + return genericComponentOverrideContext.__generator(this, function (_a) { + return [ + 2 /*return*/, + recipe$2.MultiFactorAuth.getInstanceOrThrow().webJSRecipe.getMFAInfo({ + userContext: userContext, + }), + ]; + }); + }); + }, + [props.recipe, userContext] + ); + var handleLoadError = React__namespace.useCallback( + // Test this, it may show an empty screen in many cases + function () { + return dispatch({ type: "setError", error: "Getting mfaInfo failed!" }); + }, + [dispatch] + ); // TODO: translation/proper error handling) + var onLoad = React__namespace.useCallback( + function (mfaInfo) { + return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { + var error, + errorQueryParam, + messageQueryParam, + doSetup, + loginAttemptInfo, + isAlreadySetup, + isAllowedToSetup; + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + error = undefined; + errorQueryParam = genericComponentOverrideContext.getQueryParams("error"); + messageQueryParam = genericComponentOverrideContext.getQueryParams("message"); + doSetup = genericComponentOverrideContext.getQueryParams("setup"); + if (errorQueryParam !== null) { + if (errorQueryParam === "signin") { + error = "SOMETHING_WENT_WRONG_ERROR"; + } else if (errorQueryParam === "restart_link") { + error = "ERROR_SIGN_IN_UP_LINK"; + } else if (errorQueryParam === "custom" && messageQueryParam !== null) { + error = messageQueryParam; + } + } + return [ + 4 /*yield*/, + recipeImplementation.getLoginAttemptInfo({ + userContext: userContext, + }), + ]; + case 1: + loginAttemptInfo = _a.sent(); + isAlreadySetup = + props.contactMethod === "EMAIL" + ? mfaInfo.factors.isAlreadySetup.includes("otp-email") + : mfaInfo.factors.isAlreadySetup.includes("otp-phone"); + isAllowedToSetup = + props.contactMethod === "EMAIL" + ? mfaInfo.factors.isAllowedToSetup.includes("otp-email") + : mfaInfo.factors.isAllowedToSetup.includes("otp-phone"); + if (!!loginAttemptInfo) return [3 /*break*/, 9]; + if (!(props.contactMethod === "EMAIL")) return [3 /*break*/, 5]; + if (!(isAlreadySetup && doSetup !== "true")) return [3 /*break*/, 3]; + // createCode also dispatches the necessary events + return [ + 4 /*yield*/, + recipeImplementation.createCode({ + email: mfaInfo.email, + userContext: userContext, + }), + ]; + case 2: + // createCode also dispatches the necessary events + _a.sent(); + return [3 /*break*/, 4]; + case 3: + if (!mfaInfo.factors.isAllowedToSetup.includes("otp-email")) { + dispatch({ type: "setError", error: "Factor not enabled" }); // TODO: translation + } else { + dispatch({ + type: "load", + loginAttemptInfo: loginAttemptInfo, + error: error, + isAllowedToSetup: true, + }); // since loginAttemptInfo is undefined, this will ask the user for the email + } + _a.label = 4; + case 4: + return [3 /*break*/, 8]; + case 5: + if (!(isAlreadySetup && doSetup !== "true")) return [3 /*break*/, 7]; + // createCode also dispatches the necessary events + return [ + 4 /*yield*/, + recipeImplementation.createCode({ + phoneNumber: mfaInfo.phoneNumber, + userContext: userContext, + }), + ]; + case 6: + // createCode also dispatches the necessary events + _a.sent(); + return [3 /*break*/, 8]; + case 7: + if (!mfaInfo.factors.isAllowedToSetup.includes("otp-phone")) { + dispatch({ type: "setError", error: "Factor not enabled" }); // TODO: translation + } else { + dispatch({ + type: "load", + loginAttemptInfo: loginAttemptInfo, + error: error, + isAllowedToSetup: true, + }); // since loginAttemptInfo is undefined, this will ask the user for the phone number + } + _a.label = 8; + case 8: + return [3 /*break*/, 10]; + case 9: + // No need to check if the component is unmounting, since this has no effect then. + dispatch({ + type: "load", + loginAttemptInfo: loginAttemptInfo, + error: error, + isAllowedToSetup: isAllowedToSetup, + }); + _a.label = 10; + case 10: + return [2 /*return*/]; + } + }); + }); + }, + [dispatch, recipeImplementation, props.contactMethod, userContext] + ); + genericComponentOverrideContext.useOnMountAPICall(fetchMFAInfo, onLoad, handleLoadError); +} +function getModifiedRecipeImplementation$1(originalImpl, config, dispatch, callingConsumeCodeRef) { + var _this = this; + return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, originalImpl), { + createCode: function (input) { + return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { + var contactInfo, phoneNumberUtils, contactMethod, additionalAttemptInfo, res, loginAttemptInfo; + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + return [4 /*yield*/, recipe$1.getPhoneNumberUtils()]; + case 1: + phoneNumberUtils = _a.sent(); + if ("email" in input) { + contactInfo = input.email; + } else { + contactInfo = phoneNumberUtils.formatNumber( + input.phoneNumber, + config.signInUpFeature.defaultCountry || "", + phoneNumberUtils.numberFormat.E164 + ); + } + contactMethod = "email" in input ? "EMAIL" : "PHONE"; + additionalAttemptInfo = { + lastResend: Date.now(), + contactMethod: contactMethod, + contactInfo: contactInfo, + redirectToPath: genericComponentOverrideContext.getRedirectToPathFromURL(), + }; + return [ + 4 /*yield*/, + originalImpl.createCode( + genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, input), + { + userContext: genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, input.userContext), + { additionalAttemptInfo: additionalAttemptInfo } + ), + } + ) + ), + ]; + case 2: + res = _a.sent(); + if (!(res.status === "OK")) return [3 /*break*/, 4]; + return [ + 4 /*yield*/, + originalImpl.getLoginAttemptInfo({ + userContext: input.userContext, + }), + ]; + case 3: + loginAttemptInfo = _a.sent(); + dispatch({ type: "startLogin", loginAttemptInfo: loginAttemptInfo }); + _a.label = 4; + case 4: + return [2 /*return*/, res]; + } + }); + }); + }, + resendCode: function (input) { + return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { + var res, loginAttemptInfo, timestamp; + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + return [4 /*yield*/, originalImpl.resendCode(input)]; + case 1: + res = _a.sent(); + if (!(res.status === "OK")) return [3 /*break*/, 5]; + return [ + 4 /*yield*/, + originalImpl.getLoginAttemptInfo({ + userContext: input.userContext, + }), + ]; + case 2: + loginAttemptInfo = _a.sent(); + if (!(loginAttemptInfo !== undefined)) return [3 /*break*/, 4]; + timestamp = Date.now(); + return [ + 4 /*yield*/, + originalImpl.setLoginAttemptInfo({ + userContext: input.userContext, + attemptInfo: genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, loginAttemptInfo), + { lastResend: timestamp } + ), + }), + ]; + case 3: + _a.sent(); + dispatch({ type: "resendCode", timestamp: timestamp }); + _a.label = 4; + case 4: + return [3 /*break*/, 7]; + case 5: + if (!(res.status === "RESTART_FLOW_ERROR")) return [3 /*break*/, 7]; + return [ + 4 /*yield*/, + originalImpl.clearLoginAttemptInfo({ + userContext: input.userContext, + }), + ]; + case 6: + _a.sent(); + dispatch({ type: "restartFlow", error: "ERROR_SIGN_IN_UP_RESEND_RESTART_FLOW" }); + _a.label = 7; + case 7: + return [2 /*return*/, res]; + } + }); + }); + }, + consumeCode: function (input) { + return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { + var res; + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + // We need to call consume code while callingConsume, so we don't detect + // the session creation too early and go to successInAnotherTab too early + callingConsumeCodeRef.current = true; + return [4 /*yield*/, originalImpl.consumeCode(input)]; + case 1: + res = _a.sent(); + if (!(res.status === "RESTART_FLOW_ERROR")) return [3 /*break*/, 3]; + return [ + 4 /*yield*/, + originalImpl.clearLoginAttemptInfo({ + userContext: input.userContext, + }), + ]; + case 2: + _a.sent(); + dispatch({ type: "restartFlow", error: "ERROR_SIGN_IN_UP_CODE_CONSUME_RESTART_FLOW" }); + return [3 /*break*/, 7]; + case 3: + if (!(res.status === "SIGN_IN_UP_NOT_ALLOWED")) return [3 /*break*/, 5]; + return [ + 4 /*yield*/, + originalImpl.clearLoginAttemptInfo({ + userContext: input.userContext, + }), + ]; + case 4: + _a.sent(); + dispatch({ type: "restartFlow", error: res.reason }); + return [3 /*break*/, 7]; + case 5: + if (!(res.status === "OK")) return [3 /*break*/, 7]; + return [ + 4 /*yield*/, + originalImpl.clearLoginAttemptInfo({ + userContext: input.userContext, + }), + ]; + case 6: + _a.sent(); + _a.label = 7; + case 7: + callingConsumeCodeRef.current = false; + return [2 /*return*/, res]; + } + }); + }); + }, + clearLoginAttemptInfo: function (input) { + return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + return [ + 4 /*yield*/, + originalImpl.clearLoginAttemptInfo({ + userContext: input.userContext, + }), + ]; + case 1: + _a.sent(); + genericComponentOverrideContext.clearErrorQueryParam(); + dispatch({ type: "restartFlow", error: undefined }); + return [2 /*return*/]; + } + }); + }); + }, + }); +} + +var EmailOrPhoneForm = uiEntry.withOverride( + "PasswordlessEmailOrPhoneForm", + function PasswordlessEmailOrPhoneForm(props) { + var _this = this; + var _a; + var _b = React.useState(false), + isPhoneNumber = _b[0], + setIsPhoneNumber = _b[1]; + var userContext = uiEntry.useUserContext(); + React.useEffect(function () { + // We preload this here, since it will be used almost for sure, but loading it + void recipe$1.preloadPhoneNumberUtils(); + }, []); + var emailOrPhoneInput = React.useMemo( + function () { + return isPhoneNumber + ? phoneNumberInputWithInjectedProps({ + defaultCountry: props.config.signInUpFeature.defaultCountry, + }) + : undefined; + }, + [props.config.signInUpFeature.defaultCountry, isPhoneNumber] + ); + return jsxRuntime.jsx(formBase.FormBase, { + clearError: props.clearError, + onError: props.onError, + formFields: [ + { + id: "emailOrPhone", + label: "PWLESS_SIGN_IN_UP_EMAIL_OR_PHONE_LABEL", + inputComponent: emailOrPhoneInput, + optional: false, + autofocus: true, + placeholder: "", + // We do not add an autocomplete prop in this case, since we do not really have any sensible option to set + // Setting them to either "tel" or "email" would give people the wrong impression since this could have either + // AFAIK we can't set them both at the same time + validate: recipe$1.defaultValidate, + }, + ], + buttonLabel: "PWLESS_SIGN_IN_UP_CONTINUE_BUTTON", + onSuccess: props.onSuccess, + callAPI: function (formFields, setValue) { + return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { + var emailOrPhone, + emailValidationRes, + response, + phoneValidationRes, + response, + intPhoneNumber, + phoneValidationResAfterGuess, + response, + ex_1; + var _a; + return genericComponentOverrideContext.__generator(this, function (_b) { + switch (_b.label) { + case 0: + emailOrPhone = + (_a = formFields.find(function (field) { + return field.id === "emailOrPhone"; + })) === null || _a === void 0 + ? void 0 + : _a.value; + if (emailOrPhone === undefined) { + throw new STGeneralError__default.default("GENERAL_ERROR_EMAIL_OR_PHONE_UNDEFINED"); + } + return [4 /*yield*/, recipe$1.defaultEmailValidator(emailOrPhone)]; + case 1: + if (!(_b.sent() === undefined)) return [3 /*break*/, 6]; + return [4 /*yield*/, props.config.validateEmailAddress(emailOrPhone)]; + case 2: + emailValidationRes = _b.sent(); + if (!(emailValidationRes === undefined)) return [3 /*break*/, 4]; + return [ 4 /*yield*/, props.recipeImplementation.createCode({ email: emailOrPhone, @@ -2909,10 +4264,13 @@ var EmailOrPhoneForm = uiEntry.withOverride( }, validateOnBlur: false, showLabels: true, - footer: jsxRuntime.jsx(SignInUpFooter, { - privacyPolicyLink: props.config.signInUpFeature.privacyPolicyLink, - termsOfServiceLink: props.config.signInUpFeature.termsOfServiceLink, - }), + footer: + (_a = props.footer) !== null && _a !== void 0 + ? _a + : jsxRuntime.jsx(SignInUpFooter, { + privacyPolicyLink: props.config.signInUpFeature.privacyPolicyLink, + termsOfServiceLink: props.config.signInUpFeature.termsOfServiceLink, + }), }); } ); @@ -3085,470 +4443,97 @@ function SMSLargeIcon() { fill: "none", strokeLinecap: "round", stroke: "#000", - transform: "translate(725.5 260.17)", - d: "M0 0h12.461", - }), - jsxRuntime.jsx("path", { - id: "Line_102", - "data-name": "Line 102", - strokeWidth: "1.75px", - fill: "none", - strokeLinecap: "round", - stroke: "#fff", - transform: "translate(725.5 261.92)", - d: "M0 0h12.461", - }), - ], - } - ) - ), - jsxRuntime.jsx("path", { - id: "Path_91918", - "data-name": "Path 91918", - fill: "#8ae7ff", - d: "M599.827 22145.373a1.62 1.62 0 0 0 1.38-1.336c.247-1.234.267 1.752.267 1.752l-1.647-.178z", - transform: "translate(170 -21876)", - }), - jsxRuntime.jsxs( - "g", - genericComponentOverrideContext.__assign( - { id: "Group_10395", "data-name": "Group 10395" }, - { - children: [ - jsxRuntime.jsx("path", { - id: "Line_100", - "data-name": "Line 100", - strokeWidth: "1.75px", - fill: "none", - strokeLinecap: "round", - stroke: "#000", - transform: "translate(725.5 253.5)", - d: "M0 0h9.872", + transform: "translate(725.5 260.17)", + d: "M0 0h12.461", }), jsxRuntime.jsx("path", { - id: "Line_101", - "data-name": "Line 101", + id: "Line_102", + "data-name": "Line 102", strokeWidth: "1.75px", fill: "none", strokeLinecap: "round", stroke: "#fff", - transform: "translate(725.5 255.25)", - d: "M0 0h9.872", + transform: "translate(725.5 261.92)", + d: "M0 0h12.461", }), ], } ) ), - ], - } - ) - ), - } - ) - ), - } - ) - ); -} - -var ResendButton = uiEntry.withOverride("PasswordlessResendButton", function PasswordlessResendButton(_a) { - var loginAttemptInfo = _a.loginAttemptInfo, - resendEmailOrSMSGapInSeconds = _a.resendEmailOrSMSGapInSeconds, - onClick = _a.onClick; - var t = translationContext.useTranslation(); - var getTimeLeft = React.useCallback( - function () { - var timeLeft = loginAttemptInfo.lastResend + resendEmailOrSMSGapInSeconds * 1000 - Date.now(); - return timeLeft < 0 ? undefined : Math.ceil(timeLeft / 1000); - }, - [loginAttemptInfo, resendEmailOrSMSGapInSeconds] - ); - var _b = React.useState(getTimeLeft()), - secsUntilResend = _b[0], - setSecsUntilResend = _b[1]; - React.useEffect( - function () { - // This runs every time the loginAttemptInfo updates, so after every resend - var interval = setInterval(function () { - var timeLeft = getTimeLeft(); - if (timeLeft === undefined) { - clearInterval(interval); - } - setSecsUntilResend(timeLeft); - }, 500); - return function () { - // This can safely run twice - clearInterval(interval); - }; - }, - [getTimeLeft, setSecsUntilResend] - ); - return jsxRuntime.jsx( - "button", - genericComponentOverrideContext.__assign( - { - type: "button", - disabled: secsUntilResend !== undefined, - onClick: onClick, - "data-supertokens": "link linkButton resendCodeBtn", - }, - { - children: - secsUntilResend !== undefined - ? jsxRuntime.jsxs(React__namespace.default.Fragment, { - children: [ - t("PWLESS_RESEND_BTN_DISABLED_START"), - jsxRuntime.jsxs("strong", { - children: [ - Math.floor(secsUntilResend / 60) - .toString() - .padStart(2, "0"), - ":", - (secsUntilResend % 60).toString().padStart(2, "0"), - ], - }), - t("PWLESS_RESEND_BTN_DISABLED_END"), - ], - }) - : loginAttemptInfo.contactMethod === "EMAIL" - ? t("PWLESS_RESEND_BTN_EMAIL") - : t("PWLESS_RESEND_BTN_PHONE"), - } - ) - ); -}); - -var PasswordlessLinkSent = function (props) { - var t = translationContext.useTranslation(); - var userContext = uiEntry.useUserContext(); - var _a = React.useState(props.error !== undefined ? "ERROR" : "READY"), - status = _a[0], - setStatus = _a[1]; - // Any because node types are included here, messing with return type of setTimeout - var resendNotifTimeout = React.useRef(); - React.useEffect(function () { - return function () { - // This can safely run even if it was cleared before - if (resendNotifTimeout.current) { - clearTimeout(resendNotifTimeout.current); - } - }; - }, []); - var resendEmail = React.useCallback( - function () { - return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () { - var response, generalError, e_1; - return genericComponentOverrideContext.__generator(this, function (_a) { - switch (_a.label) { - case 0: - _a.trys.push([0, 5, , 6]); - props.clearError(); - response = void 0; - generalError = void 0; - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [ - 4 /*yield*/, - props.recipeImplementation.resendCode({ - userContext: userContext, - }), - ]; - case 2: - response = _a.sent(); - return [3 /*break*/, 4]; - case 3: - e_1 = _a.sent(); - if (STGeneralError__default.default.isThisError(e_1)) { - generalError = e_1; - } else { - throw e_1; - } - return [3 /*break*/, 4]; - case 4: - if (response !== undefined && response.status === "OK") { - setStatus("LINK_RESENT"); - resendNotifTimeout.current = setTimeout(function () { - setStatus(function (status) { - return status === "LINK_RESENT" ? "READY" : status; - }); - resendNotifTimeout.current = undefined; - }, 2000); - } else { - setStatus("ERROR"); - if (generalError !== undefined) { - props.onError(generalError.message); - } - } - return [3 /*break*/, 6]; - case 5: - _a.sent(); - setStatus("ERROR"); - return [3 /*break*/, 6]; - case 6: - return [2 /*return*/]; - } - }); - }); - }, - [props.recipeImplementation, props.loginAttemptInfo, props.config, setStatus] - ); - var resendActive = status === "LINK_RESENT"; - return jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "container" }, - { - children: jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "row" }, - { - children: [ - status === "ERROR" && - jsxRuntime.jsx(generalError.GeneralError, { - error: props.error === undefined ? "SOMETHING_WENT_WRONG_ERROR" : props.error, - }), - resendActive && - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "generalSuccess" }, - { children: t("PWLESS_LINK_SENT_RESEND_SUCCESS") } - ) - ), - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "sendCodeIcon" }, - { - children: - props.loginAttemptInfo.contactMethod === "EMAIL" - ? jsxRuntime.jsx(checkedRoundIcon.EmailLargeIcon, {}) - : jsxRuntime.jsx(SMSLargeIcon, {}), - } - ) - ), - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "headerTitle headerTinyTitle" }, - { children: t("PWLESS_LINK_SENT_RESEND_TITLE") } - ) - ), - jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "primaryText sendCodeText" }, - { - children: [ - props.loginAttemptInfo.contactMethod === "EMAIL" - ? t("PWLESS_LINK_SENT_RESEND_DESC_START_EMAIL") - : t("PWLESS_LINK_SENT_RESEND_DESC_START_PHONE"), - jsxRuntime.jsx("strong", { - children: props.loginAttemptInfo.contactInfo, - }), - props.loginAttemptInfo.contactMethod === "EMAIL" - ? t("PWLESS_LINK_SENT_RESEND_DESC_END_EMAIL") - : t("PWLESS_LINK_SENT_RESEND_DESC_END_PHONE"), - ], - } - ) - ), - jsxRuntime.jsx(ResendButton, { - loginAttemptInfo: props.loginAttemptInfo, - resendEmailOrSMSGapInSeconds: - props.config.signInUpFeature.resendEmailOrSMSGapInSeconds, - onClick: resendEmail, - }), - jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { - "data-supertokens": "secondaryText secondaryLinkWithLeftArrow", - onClick: function () { - return props.recipeImplementation.clearLoginAttemptInfo({ - userContext: userContext, - }); - }, - }, - { - children: [ - jsxRuntime.jsx(arrowLeftIcon.ArrowLeftIcon, { - color: "rgb(var(--palette-textPrimary))", - }), - props.loginAttemptInfo.contactMethod === "EMAIL" - ? t("PWLESS_SIGN_IN_UP_CHANGE_CONTACT_INFO_EMAIL") - : t("PWLESS_SIGN_IN_UP_CHANGE_CONTACT_INFO_PHONE"), - ], - } - ) - ), - ], + jsxRuntime.jsx("path", { + id: "Path_91918", + "data-name": "Path 91918", + fill: "#8ae7ff", + d: "M599.827 22145.373a1.62 1.62 0 0 0 1.38-1.336c.247-1.234.267 1.752.267 1.752l-1.647-.178z", + transform: "translate(170 -21876)", + }), + jsxRuntime.jsxs( + "g", + genericComponentOverrideContext.__assign( + { id: "Group_10395", "data-name": "Group 10395" }, + { + children: [ + jsxRuntime.jsx("path", { + id: "Line_100", + "data-name": "Line 100", + strokeWidth: "1.75px", + fill: "none", + strokeLinecap: "round", + stroke: "#000", + transform: "translate(725.5 253.5)", + d: "M0 0h9.872", + }), + jsxRuntime.jsx("path", { + id: "Line_101", + "data-name": "Line 101", + strokeWidth: "1.75px", + fill: "none", + strokeLinecap: "round", + stroke: "#fff", + transform: "translate(725.5 255.25)", + d: "M0 0h9.872", + }), + ], + } + ) + ), + ], + } + ) + ), } ) ), } ) ); -}; -var LinkSent = uiEntry.withOverride("PasswordlessLinkSent", PasswordlessLinkSent); +} -var PhoneForm = uiEntry.withOverride("PasswordlessPhoneForm", function PasswordlessPhoneForm(props) { - var _this = this; +var PasswordlessLinkSent = function (props) { + var t = translationContext.useTranslation(); var userContext = uiEntry.useUserContext(); + var _a = React.useState(props.error !== undefined ? "ERROR" : "READY"), + status = _a[0], + setStatus = _a[1]; + // Any because node types are included here, messing with return type of setTimeout + var resendNotifTimeout = React.useRef(); React.useEffect(function () { - // We preload this here, since it will be used almost for sure, but loading it - void recipe$1.preloadPhoneNumberUtils(); + return function () { + // This can safely run even if it was cleared before + if (resendNotifTimeout.current) { + clearTimeout(resendNotifTimeout.current); + } + }; }, []); - var phoneInput = React.useMemo( + var resendEmail = React.useCallback( function () { - return phoneNumberInputWithInjectedProps({ - defaultCountry: props.config.signInUpFeature.defaultCountry, - }); - }, - [props.config.signInUpFeature.defaultCountry] - ); - return jsxRuntime.jsx(formBase.FormBase, { - clearError: props.clearError, - onError: props.onError, - formFields: [ - { - id: "phoneNumber", - label: "PWLESS_SIGN_IN_UP_PHONE_LABEL", - inputComponent: phoneInput, - optional: false, - autofocus: true, - placeholder: "", - autoComplete: "tel", - validate: validators.defaultValidate, - }, - ], - buttonLabel: "PWLESS_SIGN_IN_UP_CONTINUE_BUTTON", - onSuccess: props.onSuccess, - callAPI: function (formFields) { - return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { - var phoneNumber, validationRes, response; - var _a; - return genericComponentOverrideContext.__generator(this, function (_b) { - switch (_b.label) { - case 0: - phoneNumber = - (_a = formFields.find(function (field) { - return field.id === "phoneNumber"; - })) === null || _a === void 0 - ? void 0 - : _a.value; - if (phoneNumber === undefined) { - throw new STGeneralError__default.default("GENERAL_ERROR_PHONE_UNDEFINED"); - } - return [4 /*yield*/, props.config.validatePhoneNumber(phoneNumber)]; - case 1: - validationRes = _b.sent(); - if (validationRes !== undefined) { - throw new STGeneralError__default.default(validationRes); - } - return [ - 4 /*yield*/, - props.recipeImplementation.createCode({ - phoneNumber: phoneNumber, - userContext: userContext, - }), - ]; - case 2: - response = _b.sent(); - if (response.status === "SIGN_IN_UP_NOT_ALLOWED") { - throw new STGeneralError__default.default(response.reason); - } - return [2 /*return*/, response]; - } - }); - }); - }, - validateOnBlur: false, - showLabels: true, - footer: jsxRuntime.jsx(SignInUpFooter, { - privacyPolicyLink: props.config.signInUpFeature.privacyPolicyLink, - termsOfServiceLink: props.config.signInUpFeature.termsOfServiceLink, - }), - }); -}); - -var SignInUpHeader = uiEntry.withOverride("PasswordlessSignInUpHeader", function PasswordlessSignInUpHeader() { - var t = translationContext.useTranslation(); - return jsxRuntime.jsxs(React.Fragment, { - children: [ - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "headerTitle" }, - { children: t("PWLESS_SIGN_IN_UP_HEADER_TITLE") } - ) - ), - jsxRuntime.jsx("div", { "data-supertokens": "divider" }), - ], - }); -}); - -var UserInputCodeFormFooter = uiEntry.withOverride( - "PasswordlessUserInputCodeFormFooter", - function PasswordlessUserInputCodeFormFooter(_a) { - var loginAttemptInfo = _a.loginAttemptInfo, - recipeImplementation = _a.recipeImplementation; - var t = translationContext.useTranslation(); - var userContext = uiEntry.useUserContext(); - return jsxRuntime.jsx(React.Fragment, { - children: jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { - "data-supertokens": "secondaryText secondaryLinkWithLeftArrow", - onClick: function () { - return recipeImplementation.clearLoginAttemptInfo({ - userContext: userContext, - }); - }, - }, - { - children: [ - jsxRuntime.jsx(arrowLeftIcon.ArrowLeftIcon, { color: "rgb(var(--palette-textPrimary))" }), - loginAttemptInfo.contactMethod === "EMAIL" - ? t("PWLESS_SIGN_IN_UP_CHANGE_CONTACT_INFO_EMAIL") - : t("PWLESS_SIGN_IN_UP_CHANGE_CONTACT_INFO_PHONE"), - ], - } - ) - ), - }); - } -); - -var UserInputCodeForm = uiEntry.withOverride( - "PasswordlessUserInputCodeForm", - function PasswordlessUserInputCodeForm(props) { - var _this = this; - var t = translationContext.useTranslation(); - var userContext = uiEntry.useUserContext(); - // We need this any because the node types are also loaded - var _a = React.useState(), - clearResendNotifTimeout = _a[0], - setClearResendNotifTimeout = _a[1]; - React.useEffect( - function () { - // This is just to clean up on unmount and if the clear timeout changes - return function () { - clearTimeout(clearResendNotifTimeout); - }; - }, - [clearResendNotifTimeout] - ); - function resend() { - return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { + return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () { var response, generalError, e_1; return genericComponentOverrideContext.__generator(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 5, , 6]); + props.clearError(); response = void 0; generalError = void 0; _a.label = 1; @@ -3572,141 +4557,149 @@ var UserInputCodeForm = uiEntry.withOverride( } return [3 /*break*/, 4]; case 4: - if (generalError !== undefined) { - props.onError(generalError.message); + if (response !== undefined && response.status === "OK") { + setStatus("LINK_RESENT"); + resendNotifTimeout.current = setTimeout(function () { + setStatus(function (status) { + return status === "LINK_RESENT" ? "READY" : status; + }); + resendNotifTimeout.current = undefined; + }, 2000); } else { - if (response === undefined) { - throw new Error("Should not come here"); - } - if (response.status === "OK") { - setClearResendNotifTimeout( - setTimeout(function () { - setClearResendNotifTimeout(undefined); - }, 2000) - ); + setStatus("ERROR"); + if (generalError !== undefined) { + props.onError(generalError.message); } } return [3 /*break*/, 6]; case 5: _a.sent(); - props.onError("SOMETHING_WENT_WRONG_ERROR"); + setStatus("ERROR"); return [3 /*break*/, 6]; case 6: return [2 /*return*/]; } }); }); - } - return jsxRuntime.jsxs(React__namespace.default.Fragment, { - children: [ - clearResendNotifTimeout !== undefined && - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "generalSuccess" }, - { - children: - props.loginAttemptInfo.contactMethod === "EMAIL" - ? t("PWLESS_RESEND_SUCCESS_EMAIL") - : t("PWLESS_RESEND_SUCCESS_PHONE"), - } - ) - ), - jsxRuntime.jsx(formBase.FormBase, { - clearError: props.clearError, - onError: props.onError, - formFields: [ + }, + [props.recipeImplementation, props.loginAttemptInfo, props.config, setStatus] + ); + var resendActive = status === "LINK_RESENT"; + return jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "container" }, + { + children: jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "row" }, { - id: "userInputCode", - label: "", - labelComponent: jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "codeInputLabelWrapper" }, - { - children: [ - jsxRuntime.jsx(formBase.Label, { - value: "PWLESS_USER_INPUT_CODE_INPUT_LABEL", - "data-supertokens": "codeInputLabel", - }), - jsxRuntime.jsx(ResendButton, { - loginAttemptInfo: props.loginAttemptInfo, - resendEmailOrSMSGapInSeconds: - props.config.signInUpFeature.resendEmailOrSMSGapInSeconds, - onClick: resend, - }), - ], - } - ) - ), - autofocus: true, - optional: false, - clearOnSubmit: true, - autoComplete: "one-time-code", - placeholder: "", - validate: recipe$1.userInputCodeValidate, - }, - ], - onSuccess: props.onSuccess, - buttonLabel: "PWLESS_SIGN_IN_UP_CONTINUE_BUTTON", - callAPI: function (formFields) { - return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { - var userInputCode, response; - var _a; - return genericComponentOverrideContext.__generator(this, function (_b) { - switch (_b.label) { - case 0: - userInputCode = - (_a = formFields.find(function (field) { - return field.id === "userInputCode"; - })) === null || _a === void 0 - ? void 0 - : _a.value; - if (userInputCode === undefined || userInputCode.length === 0) { - throw new STGeneralError__default.default("GENERAL_ERROR_OTP_UNDEFINED"); - } - return [ - 4 /*yield*/, - props.recipeImplementation.consumeCode({ - userInputCode: userInputCode, - userContext: userContext, - }), - ]; - case 1: - response = _b.sent(); - // We can redirect these statuses, since they all cause a redirection - // and we don't really want to show anything - if ( - response.status === "OK" || - response.status === "RESTART_FLOW_ERROR" || - response.status === "SIGN_IN_UP_NOT_ALLOWED" - ) { - return [2 /*return*/, response]; + children: [ + status === "ERROR" && + jsxRuntime.jsx(generalError.GeneralError, { + error: props.error === undefined ? "SOMETHING_WENT_WRONG_ERROR" : props.error, + }), + resendActive && + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "generalSuccess" }, + { children: t("PWLESS_LINK_SENT_RESEND_SUCCESS") } + ) + ), + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "sendCodeIcon" }, + { + children: + props.loginAttemptInfo.contactMethod === "EMAIL" + ? jsxRuntime.jsx(checkedRoundIcon.EmailLargeIcon, {}) + : jsxRuntime.jsx(SMSLargeIcon, {}), } - if (response.status === "INCORRECT_USER_INPUT_CODE_ERROR") { - throw new STGeneralError__default.default("GENERAL_ERROR_OTP_INVALID"); + ) + ), + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "headerTitle headerTinyTitle" }, + { children: t("PWLESS_LINK_SENT_RESEND_TITLE") } + ) + ), + jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "primaryText sendCodeText" }, + { + children: [ + props.loginAttemptInfo.contactMethod === "EMAIL" + ? t("PWLESS_LINK_SENT_RESEND_DESC_START_EMAIL") + : t("PWLESS_LINK_SENT_RESEND_DESC_START_PHONE"), + jsxRuntime.jsx("strong", { + children: props.loginAttemptInfo.contactInfo, + }), + props.loginAttemptInfo.contactMethod === "EMAIL" + ? t("PWLESS_LINK_SENT_RESEND_DESC_END_EMAIL") + : t("PWLESS_LINK_SENT_RESEND_DESC_END_PHONE"), + ], } - if (response.status === "EXPIRED_USER_INPUT_CODE_ERROR") { - throw new STGeneralError__default.default("GENERAL_ERROR_OTP_EXPIRED"); + ) + ), + jsxRuntime.jsx(ResendButton, { + loginAttemptInfo: props.loginAttemptInfo, + resendEmailOrSMSGapInSeconds: + props.config.signInUpFeature.resendEmailOrSMSGapInSeconds, + onClick: resendEmail, + }), + jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { + "data-supertokens": "secondaryText secondaryLinkWithLeftArrow", + onClick: function () { + return props.recipeImplementation.clearLoginAttemptInfo({ + userContext: userContext, + }); + }, + }, + { + children: [ + jsxRuntime.jsx(arrowLeftIcon.ArrowLeftIcon, { + color: "rgb(var(--palette-textPrimary))", + }), + props.loginAttemptInfo.contactMethod === "EMAIL" + ? t("PWLESS_SIGN_IN_UP_CHANGE_CONTACT_INFO_EMAIL") + : t("PWLESS_SIGN_IN_UP_CHANGE_CONTACT_INFO_PHONE"), + ], } - throw new STGeneralError__default.default("SOMETHING_WENT_WRONG_ERROR"); - } - }); - }); - }, - validateOnBlur: false, - showLabels: true, - footer: jsxRuntime.jsx( - UserInputCodeFormFooter, - genericComponentOverrideContext.__assign({}, props, { - loginAttemptInfo: props.loginAttemptInfo, - }) - ), - }), - ], - }); - } -); + ) + ), + ], + } + ) + ), + } + ) + ); +}; +var LinkSent = uiEntry.withOverride("PasswordlessLinkSent", PasswordlessLinkSent); + +var SignInUpHeader = uiEntry.withOverride("PasswordlessSignInUpHeader", function PasswordlessSignInUpHeader() { + var t = translationContext.useTranslation(); + return jsxRuntime.jsxs(React.Fragment, { + children: [ + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "headerTitle" }, + { children: t("PWLESS_SIGN_IN_UP_HEADER_TITLE") } + ) + ), + jsxRuntime.jsx("div", { "data-supertokens": "divider" }), + ], + }); +}); var UserInputCodeFormHeader = uiEntry.withOverride( "PasswordlessUserInputCodeFormHeader", @@ -3843,7 +4836,8 @@ var SignInUpTheme = function (_a) { }; function SignInUpThemeWrapper(props) { var hasFont = translations.hasFontDefined(props.config.rootStyle); - var activeScreen = getActiveScreen(props); + var currentDynamicLoginMethods = uiEntry.useDynamicLoginMethods(); + var activeScreen = getActiveScreen(props, currentDynamicLoginMethods); var activeStyle; if (activeScreen === exports.SignInUpScreens.CloseTab) { activeStyle = props.config.signInUpFeature.closeTabScreenStyle; @@ -3879,19 +4873,48 @@ function SignInUpThemeWrapper(props) { ) ); } -function getActiveScreen(props) { +function getActiveScreen(props, currentDynamicLoginMethods) { + var _a; + var contactMethod = props.config.contactMethod; + var enabledContactMethods = contactMethod === "EMAIL_OR_PHONE" ? ["EMAIL", "PHONE"] : [contactMethod]; + var firstFactors; + if (currentDynamicLoginMethods.loaded && currentDynamicLoginMethods.loginMethods.firstFactors) { + firstFactors = currentDynamicLoginMethods.loginMethods.firstFactors; + } else { + firstFactors = + (_a = recipe$2.MultiFactorAuth.getInstance()) === null || _a === void 0 ? void 0 : _a.getFirstFactors(); + } + if (firstFactors !== undefined) { + if (enabledContactMethods.includes("PHONE")) { + if (!firstFactors.includes("otp-phone") && !firstFactors.includes("link-phone")) { + enabledContactMethods = enabledContactMethods.filter(function (c) { + return c !== "PHONE"; + }); + } + } + if (enabledContactMethods.includes("EMAIL")) { + if (!firstFactors.includes("otp-email") && !firstFactors.includes("link-email")) { + enabledContactMethods = enabledContactMethods.filter(function (c) { + return c !== "EMAIL"; + }); + } + } + } + if (enabledContactMethods.length === 0) { + throw new Error("No overlap between first factors and enabled contact methods"); // redirect to access denied? + } if (props.featureState.successInAnotherTab) { return exports.SignInUpScreens.CloseTab; } else if (props.featureState.loginAttemptInfo && props.featureState.loginAttemptInfo.flowType === "MAGIC_LINK") { return exports.SignInUpScreens.LinkSent; } else if (props.featureState.loginAttemptInfo) { return exports.SignInUpScreens.UserInputCodeForm; - } else if (props.config.contactMethod === "EMAIL") { + } else if (enabledContactMethods.length > 1) { + return exports.SignInUpScreens.EmailOrPhoneForm; + } else if (enabledContactMethods[0] === "EMAIL") { return exports.SignInUpScreens.EmailForm; - } else if (props.config.contactMethod === "PHONE") { + } else if (enabledContactMethods[0] === "PHONE") { return exports.SignInUpScreens.PhoneForm; - } else if (props.config.contactMethod === "EMAIL_OR_PHONE") { - return exports.SignInUpScreens.EmailOrPhoneForm; } throw new Error("Couldn't choose active screen; Should never happen"); } @@ -4382,6 +5405,32 @@ var PasswordlessPreBuiltUI = /** @class */ (function (_super) { recipeID: recipe$1.Passwordless.RECIPE_ID, }; } + if (_this.recipeInstance.config.mfaFeature.disableDefaultUI !== true) { + var normalisedFullPathPhone = _this.recipeInstance.config.appInfo.websiteBasePath.appendPath( + new NormalisedURLPath__default.default("/mfa/otp-phone") + ); + features[normalisedFullPathPhone.getAsStringDangerous()] = { + matches: genericComponentOverrideContext.matchRecipeIdUsingQueryParams( + _this.recipeInstance.config.recipeId + ), + component: function (props) { + return _this.getFeatureComponent("otp-phone", props, useComponentOverrides); + }, + recipeID: recipe$1.Passwordless.RECIPE_ID, + }; + var normalisedFullPathEmail = _this.recipeInstance.config.appInfo.websiteBasePath.appendPath( + new NormalisedURLPath__default.default("/mfa/otp-email") + ); + features[normalisedFullPathEmail.getAsStringDangerous()] = { + matches: genericComponentOverrideContext.matchRecipeIdUsingQueryParams( + _this.recipeInstance.config.recipeId + ), + component: function (props) { + return _this.getFeatureComponent("otp-email", props, useComponentOverrides); + }, + recipeID: recipe$1.Passwordless.RECIPE_ID, + }; + } return features; }; _this.getFeatureComponent = function (componentName, props, useComponentOverrides) { @@ -4449,9 +5498,76 @@ var PasswordlessPreBuiltUI = /** @class */ (function (_super) { } ) ); - } else { - throw new Error("Should never come here."); } + if (componentName === "otp-email") { + return jsxRuntime.jsx( + uiEntry.UserContextWrapper, + genericComponentOverrideContext.__assign( + { userContext: props.userContext }, + { + children: jsxRuntime.jsx( + session.SessionAuth, + genericComponentOverrideContext.__assign( + { + overrideGlobalClaimValidators: function () { + return []; + }, + }, + { + children: jsxRuntime.jsx( + MFAFeature, + genericComponentOverrideContext.__assign( + { + recipe: _this.recipeInstance, + useComponentOverrides: useComponentOverrides, + contactMethod: "EMAIL", + flowType: "USER_INPUT_CODE", + }, + props + ) + ), + } + ) + ), + } + ) + ); + } + if (componentName === "otp-phone") { + return jsxRuntime.jsx( + uiEntry.UserContextWrapper, + genericComponentOverrideContext.__assign( + { userContext: props.userContext }, + { + children: jsxRuntime.jsx( + session.SessionAuth, + genericComponentOverrideContext.__assign( + { + overrideGlobalClaimValidators: function () { + return []; + }, + }, + { + children: jsxRuntime.jsx( + MFAFeature, + genericComponentOverrideContext.__assign( + { + recipe: _this.recipeInstance, + useComponentOverrides: useComponentOverrides, + contactMethod: "PHONE", + flowType: "USER_INPUT_CODE", + }, + props + ) + ), + } + ) + ), + } + ) + ); + } + throw new Error("Should never come here."); }; return _this; } diff --git a/lib/build/passwordlessprebuiltui.js b/lib/build/passwordlessprebuiltui.js index a434bb49d..c37865774 100644 --- a/lib/build/passwordlessprebuiltui.js +++ b/lib/build/passwordlessprebuiltui.js @@ -5,6 +5,7 @@ require("react/jsx-runtime"); require("supertokens-web-js/utils/normalisedURLPath"); require("./index2.js"); require("./authRecipe-shared2.js"); +require("./session-shared3.js"); require("./passwordless-shared.js"); var passwordlessprebuiltui = require("./passwordless-shared3.js"); require("./passwordless-shared2.js"); @@ -25,7 +26,6 @@ require("supertokens-web-js/utils/sessionClaimValidatorStore"); require("./recipeModule-shared.js"); require("./session-shared2.js"); require("supertokens-web-js/recipe/session"); -require("./session-shared3.js"); require("./session-shared.js"); require("supertokens-web-js/utils/error"); require("./translations.js"); @@ -36,6 +36,8 @@ require("./checkedRoundIcon.js"); require("./emailpassword-shared7.js"); require("./emailpassword-shared5.js"); require("./arrowLeftIcon.js"); +require("./multifactorauth.js"); +require("./multifactorauth-shared2.js"); require("supertokens-web-js/recipe/passwordless"); require("./authRecipe-shared.js"); diff --git a/lib/build/recipe/passwordless/components/features/mfa/index.d.ts b/lib/build/recipe/passwordless/components/features/mfa/index.d.ts index 02b7a8daa..a408f8cad 100644 --- a/lib/build/recipe/passwordless/components/features/mfa/index.d.ts +++ b/lib/build/recipe/passwordless/components/features/mfa/index.d.ts @@ -1,38 +1,40 @@ import * as React from "react"; import type { FeatureBaseProps } from "../../../../../types"; import type Recipe from "../../../recipe"; -import type { ComponentOverrideMap } from "../../../types"; -import type { PasswordlessSignInUpAction, SignInUpState, SignInUpChildProps } from "../../../types"; +import type { ComponentOverrideMap, MFAChildProps } from "../../../types"; +import type { MFAAction, MFAState } from "../../../types"; import type { RecipeInterface } from "supertokens-web-js/recipe/passwordless"; +import type { PasswordlessFlowType } from "supertokens-web-js/recipe/thirdpartypasswordless"; export declare const useSuccessInAnotherTabChecker: ( - state: SignInUpState, - dispatch: React.Dispatch, - userContext: any -) => React.MutableRefObject; -export declare const useFeatureReducer: ( - recipeImpl: RecipeInterface | undefined, + callingConsumeCodeRef: React.MutableRefObject, + recipeImpl: RecipeInterface, + state: MFAState, + dispatch: React.Dispatch, userContext: any -) => [SignInUpState, React.Dispatch]; +) => void; +export declare const useFeatureReducer: () => [MFAState, React.Dispatch]; export declare function useChildProps( recipe: Recipe, - dispatch: React.Dispatch, - state: SignInUpState, - callingConsumeCodeRef: React.MutableRefObject, + recipeImplementation: RecipeInterface, + state: MFAState, + contactMethod: "PHONE" | "EMAIL", userContext: any, history: any -): SignInUpChildProps; +): MFAChildProps; export declare function useChildProps( recipe: Recipe | undefined, - dispatch: React.Dispatch, - state: SignInUpState, - callingConsumeCodeRef: React.MutableRefObject, + recipeImplementation: RecipeInterface, + state: MFAState, + contactMethod: "PHONE" | "EMAIL", userContext: any, history: any -): SignInUpChildProps | undefined; -export declare const SignInUpFeature: React.FC< +): MFAChildProps | undefined; +export declare const MFAFeature: React.FC< FeatureBaseProps & { + contactMethod: "PHONE" | "EMAIL"; + flowType: PasswordlessFlowType; recipe: Recipe; useComponentOverrides: () => ComponentOverrideMap; } >; -export default SignInUpFeature; +export default MFAFeature; diff --git a/lib/build/recipe/passwordless/components/themes/mfa/index.d.ts b/lib/build/recipe/passwordless/components/themes/mfa/index.d.ts new file mode 100644 index 000000000..78c70fdbf --- /dev/null +++ b/lib/build/recipe/passwordless/components/themes/mfa/index.d.ts @@ -0,0 +1,11 @@ +/// +import type { MFAProps } from "../../../types"; +export declare enum MFAScreens { + CloseTab = 0, + EmailForm = 1, + PhoneForm = 2, + UserInputCodeForm = 3, +} +declare function MFAThemeWrapper(props: MFAProps): JSX.Element; +export default MFAThemeWrapper; +export declare function getActiveScreen(props: Pick): MFAScreens; diff --git a/lib/build/recipe/passwordless/components/themes/mfa/mfaFooter.d.ts b/lib/build/recipe/passwordless/components/themes/mfa/mfaFooter.d.ts new file mode 100644 index 000000000..400242689 --- /dev/null +++ b/lib/build/recipe/passwordless/components/themes/mfa/mfaFooter.d.ts @@ -0,0 +1,3 @@ +/// +import type { MFAFooterProps } from "../../../types"; +export declare const MFAFooter: import("react").ComponentType; diff --git a/lib/build/recipe/passwordless/components/themes/mfa/mfaHeader.d.ts b/lib/build/recipe/passwordless/components/themes/mfa/mfaHeader.d.ts new file mode 100644 index 000000000..20436f4ba --- /dev/null +++ b/lib/build/recipe/passwordless/components/themes/mfa/mfaHeader.d.ts @@ -0,0 +1,5 @@ +/// +export declare const MFAHeader: import("react").ComponentType<{ + contactMethod: "EMAIL" | "PHONE"; + onBackButtonClicked: () => void; +}>; diff --git a/lib/build/recipe/passwordless/components/themes/mfa/mfaOTPFooter.d.ts b/lib/build/recipe/passwordless/components/themes/mfa/mfaOTPFooter.d.ts new file mode 100644 index 000000000..f71b639fc --- /dev/null +++ b/lib/build/recipe/passwordless/components/themes/mfa/mfaOTPFooter.d.ts @@ -0,0 +1,3 @@ +/// +import type { MFAOTPFooterProps } from "../../../types"; +export declare const MFAOTPFooter: import("react").ComponentType; diff --git a/lib/build/recipe/passwordless/components/themes/mfa/mfaOTPHeader.d.ts b/lib/build/recipe/passwordless/components/themes/mfa/mfaOTPHeader.d.ts new file mode 100644 index 000000000..f95966180 --- /dev/null +++ b/lib/build/recipe/passwordless/components/themes/mfa/mfaOTPHeader.d.ts @@ -0,0 +1,3 @@ +/// +import type { MFAOTPHeaderProps } from "../../../types"; +export declare const MFAOTPHeader: import("react").ComponentType; diff --git a/lib/build/recipe/passwordless/components/themes/signInUp/emailForm.d.ts b/lib/build/recipe/passwordless/components/themes/signInUp/emailForm.d.ts index ecf6f7a4d..41ef958b1 100644 --- a/lib/build/recipe/passwordless/components/themes/signInUp/emailForm.d.ts +++ b/lib/build/recipe/passwordless/components/themes/signInUp/emailForm.d.ts @@ -1,3 +1,7 @@ /// import type { SignInUpEmailFormProps } from "../../../types"; -export declare const EmailForm: import("react").ComponentType; +export declare const EmailForm: import("react").ComponentType< + SignInUpEmailFormProps & { + footer?: JSX.Element | undefined; + } +>; diff --git a/lib/build/recipe/passwordless/components/themes/signInUp/emailOrPhoneForm.d.ts b/lib/build/recipe/passwordless/components/themes/signInUp/emailOrPhoneForm.d.ts index 944b6e423..9db710975 100644 --- a/lib/build/recipe/passwordless/components/themes/signInUp/emailOrPhoneForm.d.ts +++ b/lib/build/recipe/passwordless/components/themes/signInUp/emailOrPhoneForm.d.ts @@ -1,3 +1,7 @@ /// import type { SignInUpEmailOrPhoneFormProps } from "../../../types"; -export declare const EmailOrPhoneForm: import("react").ComponentType; +export declare const EmailOrPhoneForm: import("react").ComponentType< + SignInUpEmailOrPhoneFormProps & { + footer?: JSX.Element | undefined; + } +>; diff --git a/lib/build/recipe/passwordless/components/themes/signInUp/index.d.ts b/lib/build/recipe/passwordless/components/themes/signInUp/index.d.ts index db29249a5..e7b8a7537 100644 --- a/lib/build/recipe/passwordless/components/themes/signInUp/index.d.ts +++ b/lib/build/recipe/passwordless/components/themes/signInUp/index.d.ts @@ -1,4 +1,5 @@ /// +import type { DynamicLoginMethodsContextValue } from "../../../../multitenancy/dynamicLoginMethodsContext"; import type { SignInUpProps } from "../../../types"; export declare enum SignInUpScreens { CloseTab = 0, @@ -10,4 +11,7 @@ export declare enum SignInUpScreens { } declare function SignInUpThemeWrapper(props: SignInUpProps): JSX.Element; export default SignInUpThemeWrapper; -export declare function getActiveScreen(props: Pick): SignInUpScreens; +export declare function getActiveScreen( + props: Pick, + currentDynamicLoginMethods: DynamicLoginMethodsContextValue +): SignInUpScreens; diff --git a/lib/build/recipe/passwordless/components/themes/signInUp/phoneForm.d.ts b/lib/build/recipe/passwordless/components/themes/signInUp/phoneForm.d.ts index d19b4dbe1..cced54acb 100644 --- a/lib/build/recipe/passwordless/components/themes/signInUp/phoneForm.d.ts +++ b/lib/build/recipe/passwordless/components/themes/signInUp/phoneForm.d.ts @@ -1,3 +1,7 @@ /// import type { SignInUpPhoneFormProps } from "../../../types"; -export declare const PhoneForm: import("react").ComponentType; +export declare const PhoneForm: import("react").ComponentType< + SignInUpPhoneFormProps & { + footer?: JSX.Element | undefined; + } +>; diff --git a/lib/build/recipe/passwordless/components/themes/signInUp/userInputCodeForm.d.ts b/lib/build/recipe/passwordless/components/themes/signInUp/userInputCodeForm.d.ts index 52d820aba..c2abc87e7 100644 --- a/lib/build/recipe/passwordless/components/themes/signInUp/userInputCodeForm.d.ts +++ b/lib/build/recipe/passwordless/components/themes/signInUp/userInputCodeForm.d.ts @@ -2,7 +2,6 @@ import React from "react"; import type { SignInUpUserInputCodeFormProps } from "../../../types"; export declare const UserInputCodeForm: React.ComponentType< SignInUpUserInputCodeFormProps & { - header?: JSX.Element | undefined; footer?: JSX.Element | undefined; } >; diff --git a/lib/build/recipe/passwordless/components/themes/translations.d.ts b/lib/build/recipe/passwordless/components/themes/translations.d.ts index 0fed6a0d3..68e12c3a3 100644 --- a/lib/build/recipe/passwordless/components/themes/translations.d.ts +++ b/lib/build/recipe/passwordless/components/themes/translations.d.ts @@ -52,6 +52,11 @@ export declare const defaultTranslationsPasswordless: { PWLESS_USER_INPUT_CODE_HEADER_SUBTITLE: string; PWLESS_USER_INPUT_CODE_HEADER_SUBTITLE_LINK: string; PWLESS_USER_INPUT_CODE_INPUT_LABEL: string; + PWLESS_MFA_LOGOUT: string; + PWLESS_MFA_HEADER_TITLE_PHONE: string; + PWLESS_MFA_HEADER_TITLE_EMAIL: string; + PWLESS_MFA_FOOTER_CHOOSER_ANOTHER: string; + PWLESS_MFA_FOOTER_LOGOUT: string; "Failed to generate a one time code. Please try again": undefined; "Phone number is invalid": undefined; "Email is invalid": undefined; diff --git a/lib/build/recipe/passwordless/prebuiltui.d.ts b/lib/build/recipe/passwordless/prebuiltui.d.ts index 68c945509..d278feb79 100644 --- a/lib/build/recipe/passwordless/prebuiltui.d.ts +++ b/lib/build/recipe/passwordless/prebuiltui.d.ts @@ -20,7 +20,7 @@ export declare class PasswordlessPreBuiltUI extends RecipeRouter { ): JSX.Element; getFeatures: (useComponentOverrides?: () => GenericComponentOverrideMap) => RecipeFeatureComponentMap; getFeatureComponent: ( - componentName: "signInUp" | "linkClickedScreen", + componentName: "signInUp" | "linkClickedScreen" | "otp-phone" | "otp-email", props: FeatureBaseProps & { redirectOnSessionExists?: boolean; userContext?: any; diff --git a/lib/build/recipe/passwordless/types.d.ts b/lib/build/recipe/passwordless/types.d.ts index 617b38663..e8e91a30f 100644 --- a/lib/build/recipe/passwordless/types.d.ts +++ b/lib/build/recipe/passwordless/types.d.ts @@ -70,6 +70,7 @@ export declare type NormalisedConfig = { disableDefaultUI?: boolean; }; linkClickedScreenFeature: PasswordlessNormalisedBaseConfig; + mfaFeature: PasswordlessNormalisedBaseConfig; contactMethod: "PHONE" | "EMAIL" | "EMAIL_OR_PHONE"; override: { functions: (originalImplementation: RecipeInterface) => RecipeInterface; @@ -120,7 +121,26 @@ export declare type UserInput = ( functions?: (originalImplementation: RecipeInterface) => RecipeInterface; }; linkClickedScreenFeature?: PasswordlessFeatureBaseConfig; + mfaFeature?: PasswordlessFeatureBaseConfig; } & AuthRecipeModuleUserInput; +export declare type MFAProps = { + recipeImplementation: RecipeImplementation; + config: NormalisedConfig; + contactMethod: "EMAIL" | "PHONE"; + onBackButtonClicked: () => void; + onSignOutClicked: () => void; + onFactorChooserButtonClicked: () => void; + onSuccess?: () => void; + dispatch: Dispatch; + featureState: { + isSetupAllowed: boolean; + loginAttemptInfo?: LoginAttemptInfo; + loaded: boolean; + successInAnotherTab: boolean; + error: string | undefined; + }; + userContext?: any; +}; export declare type SignInUpProps = { recipeImplementation: RecipeImplementation; config: NormalisedConfig; @@ -232,7 +252,41 @@ export declare type SignInUpState = { loginAttemptInfo: LoginAttemptInfo | undefined; successInAnotherTab: boolean; }; +export declare type MFAAction = + | { + type: "load"; + loginAttemptInfo: LoginAttemptInfo | undefined; + isAllowedToSetup: boolean; + error: string | undefined; + } + | { + type: "startLogin"; + loginAttemptInfo: LoginAttemptInfo; + } + | { + type: "resendCode"; + timestamp: number; + } + | { + type: "restartFlow"; + error: string | undefined; + } + | { + type: "setError"; + error: string | undefined; + } + | { + type: "successInAnotherTab"; + }; +export declare type MFAState = { + error: string | undefined; + loaded: boolean; + loginAttemptInfo: LoginAttemptInfo | undefined; + isSetupAllowed: boolean; + successInAnotherTab: boolean; +}; export declare type SignInUpChildProps = Omit; +export declare type MFAChildProps = Omit; export declare type LinkSentThemeProps = { clearError: () => void; onError: (error: string) => void; @@ -251,6 +305,28 @@ export declare type UserInputCodeFormHeaderProps = { recipeImplementation: RecipeImplementation; config: NormalisedConfig; }; +export declare type MFAFooterProps = { + isSetupAllowed: boolean; + onSignOutClicked: () => void; + onFactorChooserButtonClicked: () => void; + recipeImplementation: RecipeImplementation; + config: NormalisedConfig; +}; +export declare type MFAOTPFooterProps = { + isSetupAllowed: boolean; + onSignOutClicked: () => void; + onFactorChooserButtonClicked: () => void; + loginAttemptInfo: LoginAttemptInfo; + recipeImplementation: RecipeImplementation; + config: NormalisedConfig; +}; +export declare type MFAOTPHeaderProps = { + isSetupAllowed: boolean; + onBackButtonClicked: () => void; + loginAttemptInfo: LoginAttemptInfo; + recipeImplementation: RecipeImplementation; + config: NormalisedConfig; +}; export declare type ComponentOverrideMap = { PasswordlessSignInUpHeader_Override?: ComponentOverride; PasswordlessSignInUpFooter_Override?: ComponentOverride; diff --git a/lib/build/recipe/thirdpartypasswordless/components/themes/translations.d.ts b/lib/build/recipe/thirdpartypasswordless/components/themes/translations.d.ts index b24b59e60..8afcc48ec 100644 --- a/lib/build/recipe/thirdpartypasswordless/components/themes/translations.d.ts +++ b/lib/build/recipe/thirdpartypasswordless/components/themes/translations.d.ts @@ -54,6 +54,11 @@ export declare const defaultTranslationsThirdPartyPasswordless: { PWLESS_USER_INPUT_CODE_HEADER_SUBTITLE: string; PWLESS_USER_INPUT_CODE_HEADER_SUBTITLE_LINK: string; PWLESS_USER_INPUT_CODE_INPUT_LABEL: string; + PWLESS_MFA_LOGOUT: string; + PWLESS_MFA_HEADER_TITLE_PHONE: string; + PWLESS_MFA_HEADER_TITLE_EMAIL: string; + PWLESS_MFA_FOOTER_CHOOSER_ANOTHER: string; + PWLESS_MFA_FOOTER_LOGOUT: string; "Failed to generate a one time code. Please try again": undefined; "Phone number is invalid": undefined; "Email is invalid": undefined; diff --git a/lib/build/sessionprebuiltui.js b/lib/build/sessionprebuiltui.js index 229b076ee..f5a76e021 100644 --- a/lib/build/sessionprebuiltui.js +++ b/lib/build/sessionprebuiltui.js @@ -82,7 +82,7 @@ function LogoutButton(_a) { } var styles = - '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n/* Override */\n\n[data-supertokens~="row"] {\n padding-top: 32px;\n padding-bottom: 32px;\n}\n\n[data-supertokens~="divider"] {\n padding: 0;\n margin: 24px 0;\n}\n\n[data-supertokens~="headerTitle"] {\n padding-top: 24px;\n font-style: normal;\n font-weight: 700;\n font-size: 20px;\n line-height: 30px;\n}\n\n/* Override end */\n\n[data-supertokens~="center"] {\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n flex: 1 1 auto;\n}\n\n[data-supertokens~="buttonsGroup"] {\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n\n[data-supertokens~="buttonBase"] {\n font-size: var(--font-size-1);\n line-height: 21px;\n font-weight: 500;\n background: transparent;\n outline: none;\n border: none;\n cursor: pointer;\n}\n\n[data-supertokens~="backButton"] {\n color: rgb(var(--palette-textLink));\n}\n\n[data-supertokens~="logoutButton"] {\n display: flex;\n align-items: center;\n gap: 6px;\n color: rgb(var(--palette-textGray));\n}\n'; + '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n\n/* Override */\n\n[data-supertokens~="row"] {\n padding-top: 32px;\n padding-bottom: 32px;\n}\n\n[data-supertokens~="divider"] {\n padding: 0;\n margin: 24px 0;\n}\n\n[data-supertokens~="headerTitle"] {\n padding-top: 24px;\n font-style: normal;\n font-weight: 700;\n font-size: 20px;\n line-height: 30px;\n}\n\n/* Override end */\n\n[data-supertokens~="center"] {\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n flex: 1 1 auto;\n}\n\n[data-supertokens~="buttonsGroup"] {\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n\n[data-supertokens~="buttonBase"] {\n font-size: var(--font-size-1);\n line-height: 21px;\n font-weight: 500;\n background: transparent;\n outline: none;\n border: none;\n cursor: pointer;\n}\n\n[data-supertokens~="backButton"] {\n color: rgb(var(--palette-textLink));\n}\n\n[data-supertokens~="logoutButton"] {\n display: flex;\n align-items: center;\n gap: 6px;\n color: rgb(var(--palette-textGray));\n}\n'; var ThemeBase = function (_a) { var children = _a.children, diff --git a/lib/build/thirdparty-shared2.js b/lib/build/thirdparty-shared2.js index 0d772b125..5be91439b 100644 --- a/lib/build/thirdparty-shared2.js +++ b/lib/build/thirdparty-shared2.js @@ -49,7 +49,7 @@ var React__namespace = /*#__PURE__*/ _interopNamespace(React); var STGeneralError__default = /*#__PURE__*/ _interopDefault(STGeneralError); var styles = - '[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="row"] {\n padding-bottom: 30px;\n}\n[data-supertokens~="providerContainer"] {\n padding-top: 9px;\n padding-bottom: 9px;\n}\n[data-supertokens~="providerButton"] {\n border-color: rgb(221, 221, 221) !important;\n}\n[data-supertokens~="providerButton"] {\n min-height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 2px 8px;\n\n background-color: white;\n color: black;\n}\n[data-supertokens~="providerButton"]:hover {\n -webkit-filter: none !important;\n filter: none !important;\n}\n[data-supertokens~="providerButton"]:hover {\n background-color: #fafafa;\n}\n[data-supertokens~="providerButtonLeft"] {\n min-width: 34px;\n margin-left: 66px;\n}\n[data-supertokens~="providerButtonLogo"] {\n height: 30px;\n display: flex;\n}\n[data-supertokens~="providerButtonLogoCenter"] {\n display: flex;\n margin: auto;\n}\n[data-supertokens~="providerButtonText"] {\n font-weight: 400;\n text-align: center;\n justify-content: center;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n display: inline-block;\n}\n[data-supertokens~="providerButtonText"]:only-child {\n margin: 0 auto;\n}\n'; + '[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n[data-supertokens~="row"] {\n padding-bottom: 30px;\n}\n[data-supertokens~="providerContainer"] {\n padding-top: 9px;\n padding-bottom: 9px;\n}\n[data-supertokens~="providerButton"] {\n border-color: rgb(221, 221, 221) !important;\n}\n[data-supertokens~="providerButton"] {\n min-height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 2px 8px;\n\n background-color: white;\n color: black;\n}\n[data-supertokens~="providerButton"]:hover {\n -webkit-filter: none !important;\n filter: none !important;\n}\n[data-supertokens~="providerButton"]:hover {\n background-color: #fafafa;\n}\n[data-supertokens~="providerButtonLeft"] {\n min-width: 34px;\n margin-left: 66px;\n}\n[data-supertokens~="providerButtonLogo"] {\n height: 30px;\n display: flex;\n}\n[data-supertokens~="providerButtonLogoCenter"] {\n display: flex;\n margin: auto;\n}\n[data-supertokens~="providerButtonText"] {\n font-weight: 400;\n text-align: center;\n justify-content: center;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n display: inline-block;\n}\n[data-supertokens~="providerButtonText"]:only-child {\n margin: 0 auto;\n}\n'; var ThemeBase = function (_a) { var children = _a.children, diff --git a/lib/build/thirdpartyemailpasswordprebuiltui.js b/lib/build/thirdpartyemailpasswordprebuiltui.js index 4549fc704..21f6ef4ff 100644 --- a/lib/build/thirdpartyemailpasswordprebuiltui.js +++ b/lib/build/thirdpartyemailpasswordprebuiltui.js @@ -32,11 +32,11 @@ require("./session-shared3.js"); require("./session-shared.js"); require("./emailpassword-shared3.js"); require("./emailverification-shared2.js"); -require("./arrowLeftIcon.js"); require("./emailpassword-shared7.js"); require("supertokens-web-js/utils/error"); require("./emailpassword-shared5.js"); require("./emailpassword-shared2.js"); +require("./arrowLeftIcon.js"); require("supertokens-web-js/lib/build/error"); require("./emailpassword-shared4.js"); require("supertokens-web-js/recipe/emailpassword"); @@ -80,7 +80,7 @@ var NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath var React__namespace = /*#__PURE__*/ _interopNamespace(React); var styles = - '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n[data-supertokens~="resetPasswordHeaderTitle"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n[data-supertokens~="row"] {\n padding-bottom: 30px;\n}\n[data-supertokens~="providerContainer"] {\n padding-top: 9px;\n padding-bottom: 9px;\n}\n[data-supertokens~="providerButton"] {\n border-color: rgb(221, 221, 221) !important;\n}\n[data-supertokens~="providerButton"] {\n min-height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 2px 8px;\n\n background-color: white;\n color: black;\n}\n[data-supertokens~="providerButton"]:hover {\n -webkit-filter: none !important;\n filter: none !important;\n}\n[data-supertokens~="providerButton"]:hover {\n background-color: #fafafa;\n}\n[data-supertokens~="providerButtonLeft"] {\n min-width: 34px;\n margin-left: 66px;\n}\n[data-supertokens~="providerButtonLogo"] {\n height: 30px;\n display: flex;\n}\n[data-supertokens~="providerButtonLogoCenter"] {\n display: flex;\n margin: auto;\n}\n[data-supertokens~="providerButtonText"] {\n font-weight: 400;\n text-align: center;\n justify-content: center;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n display: inline-block;\n}\n[data-supertokens~="providerButtonText"]:only-child {\n margin: 0 auto;\n}\n[data-supertokens~="thirdPartyEmailPasswordDivider"] {\n padding-top: 5px;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="thirdPartyEmailPasswordDividerOr"] {\n flex: 1 1;\n margin-top: 0.75em;\n}\n[data-supertokens~="divider"] {\n flex: 3 3;\n}\n[data-supertokens~="providerButton"] {\n margin: auto !important;\n max-width: 240px !important;\n}\n[data-supertokens~="providerButtonLeft"] {\n margin-left: 30px !important;\n}\n'; + '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n[data-supertokens~="resetPasswordHeaderTitle"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n[data-supertokens~="row"] {\n padding-bottom: 30px;\n}\n[data-supertokens~="providerContainer"] {\n padding-top: 9px;\n padding-bottom: 9px;\n}\n[data-supertokens~="providerButton"] {\n border-color: rgb(221, 221, 221) !important;\n}\n[data-supertokens~="providerButton"] {\n min-height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 2px 8px;\n\n background-color: white;\n color: black;\n}\n[data-supertokens~="providerButton"]:hover {\n -webkit-filter: none !important;\n filter: none !important;\n}\n[data-supertokens~="providerButton"]:hover {\n background-color: #fafafa;\n}\n[data-supertokens~="providerButtonLeft"] {\n min-width: 34px;\n margin-left: 66px;\n}\n[data-supertokens~="providerButtonLogo"] {\n height: 30px;\n display: flex;\n}\n[data-supertokens~="providerButtonLogoCenter"] {\n display: flex;\n margin: auto;\n}\n[data-supertokens~="providerButtonText"] {\n font-weight: 400;\n text-align: center;\n justify-content: center;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n display: inline-block;\n}\n[data-supertokens~="providerButtonText"]:only-child {\n margin: 0 auto;\n}\n[data-supertokens~="thirdPartyEmailPasswordDivider"] {\n padding-top: 5px;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="thirdPartyEmailPasswordDividerOr"] {\n flex: 1 1;\n margin-top: 0.75em;\n}\n[data-supertokens~="divider"] {\n flex: 3 3;\n}\n[data-supertokens~="providerButton"] {\n margin: auto !important;\n max-width: 240px !important;\n}\n[data-supertokens~="providerButtonLeft"] {\n margin-left: 30px !important;\n}\n'; var ThemeBase = function (_a) { var children = _a.children, diff --git a/lib/build/thirdpartypasswordlessprebuiltui.js b/lib/build/thirdpartypasswordlessprebuiltui.js index 6ba76b277..82c6ed35e 100644 --- a/lib/build/thirdpartypasswordlessprebuiltui.js +++ b/lib/build/thirdpartypasswordlessprebuiltui.js @@ -40,6 +40,8 @@ require("./checkedRoundIcon.js"); require("./emailpassword-shared7.js"); require("./emailpassword-shared5.js"); require("./arrowLeftIcon.js"); +require("./multifactorauth.js"); +require("./multifactorauth-shared2.js"); require("./thirdparty-shared.js"); require("supertokens-web-js/recipe/thirdparty"); require("supertokens-web-js/lib/build/normalisedURLPath"); @@ -79,7 +81,7 @@ var NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath var React__namespace = /*#__PURE__*/ _interopNamespace(React); var styles = - '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n[data-supertokens~="resetPasswordHeaderTitle"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n[data-supertokens~="generalSuccess"] {\n margin-bottom: 20px;\n -webkit-animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n}\n[data-supertokens~="codeInputLabelWrapper"] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="headerSubtitle"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n[data-supertokens~="sendCodeText"] {\n margin-top: 15px;\n margin-bottom: 20px;\n}\n[data-supertokens~="sendCodeText"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n[data-supertokens~="resendCodeBtn"] {\n width: auto;\n margin-top: 0;\n line-height: 24px;\n}\n[data-supertokens~="resendCodeBtn"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="resendCodeBtn"]:disabled {\n color: rgb(var(--palette-textPrimary));\n cursor: default;\n text-decoration: none;\n}\n[data-supertokens~="phoneInputLibRoot"] {\n display: flex;\n align-items: center;\n}\n[data-supertokens~="phoneInputWrapper"] {\n display: flex;\n align-items: center;\n}\n[data-supertokens~="phoneInputWrapper"] .iti [data-supertokens~="input"] {\n padding-left: 15px;\n}\n[data-supertokens~="phoneInputWrapper"] .iti {\n flex: 1 1;\n min-width: 0;\n width: 100%;\n background: transparent;\n border: none;\n color: inherit;\n outline: none;\n}\n[data-supertokens~="continueButtonWrapper"] {\n margin-top: 10px;\n margin-bottom: 30px;\n}\n.iti__country-list {\n border: 0;\n top: 40px;\n width: min(72.2vw, 320px);\n border-radius: 6;\n box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.16);\n}\n.iti__country {\n display: flex;\n align-items: center;\n height: 34px;\n cursor: pointer;\n\n padding: 0 8px;\n}\n.iti__country-name {\n color: var(--palette-textLabel);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: "0 16px";\n}\n[data-supertokens~="row"] {\n padding-bottom: 30px;\n}\n[data-supertokens~="providerContainer"] {\n padding-top: 9px;\n padding-bottom: 9px;\n}\n[data-supertokens~="providerButton"] {\n border-color: rgb(221, 221, 221) !important;\n}\n[data-supertokens~="providerButton"] {\n min-height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 2px 8px;\n\n background-color: white;\n color: black;\n}\n[data-supertokens~="providerButton"]:hover {\n -webkit-filter: none !important;\n filter: none !important;\n}\n[data-supertokens~="providerButton"]:hover {\n background-color: #fafafa;\n}\n[data-supertokens~="providerButtonLeft"] {\n min-width: 34px;\n margin-left: 66px;\n}\n[data-supertokens~="providerButtonLogo"] {\n height: 30px;\n display: flex;\n}\n[data-supertokens~="providerButtonLogoCenter"] {\n display: flex;\n margin: auto;\n}\n[data-supertokens~="providerButtonText"] {\n font-weight: 400;\n text-align: center;\n justify-content: center;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n display: inline-block;\n}\n[data-supertokens~="providerButtonText"]:only-child {\n margin: 0 auto;\n}\n[data-supertokens~="thirdPartyPasswordlessDivider"] {\n padding-top: 5px;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="thirdPartyPasswordlessDividerText"] {\n flex: 1 1;\n margin-top: 0.75em;\n}\n[data-supertokens~="divider"] {\n flex: 3 3;\n}\n[data-supertokens~="providerButton"] {\n margin: auto !important;\n max-width: 240px !important;\n}\n[data-supertokens~="providerButtonLeft"] {\n margin-left: 30px !important;\n}\n'; + '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n[data-supertokens~="resetPasswordHeaderTitle"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n[data-supertokens~="generalSuccess"] {\n margin-bottom: 20px;\n -webkit-animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n}\n[data-supertokens~="codeInputLabelWrapper"] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="headerSubtitle"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n[data-supertokens~="sendCodeText"] {\n margin-top: 15px;\n margin-bottom: 20px;\n}\n[data-supertokens~="sendCodeText"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n[data-supertokens~="resendCodeBtn"] {\n width: auto;\n margin-top: 0;\n line-height: 24px;\n}\n[data-supertokens~="resendCodeBtn"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="resendCodeBtn"]:disabled {\n color: rgb(var(--palette-textPrimary));\n cursor: default;\n text-decoration: none;\n}\n[data-supertokens~="phoneInputLibRoot"] {\n display: flex;\n align-items: center;\n}\n[data-supertokens~="phoneInputWrapper"] {\n display: flex;\n align-items: center;\n}\n[data-supertokens~="phoneInputWrapper"] .iti [data-supertokens~="input"] {\n padding-left: 15px;\n}\n[data-supertokens~="phoneInputWrapper"] .iti {\n flex: 1 1;\n min-width: 0;\n width: 100%;\n background: transparent;\n border: none;\n color: inherit;\n outline: none;\n}\n[data-supertokens~="continueButtonWrapper"] {\n margin-top: 10px;\n margin-bottom: 30px;\n}\n.iti__country-list {\n border: 0;\n top: 40px;\n width: min(72.2vw, 320px);\n border-radius: 6;\n box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.16);\n}\n.iti__country {\n display: flex;\n align-items: center;\n height: 34px;\n cursor: pointer;\n\n padding: 0 8px;\n}\n.iti__country-name {\n color: var(--palette-textLabel);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: "0 16px";\n}\n[data-supertokens~="row"] {\n padding-bottom: 30px;\n}\n[data-supertokens~="providerContainer"] {\n padding-top: 9px;\n padding-bottom: 9px;\n}\n[data-supertokens~="providerButton"] {\n border-color: rgb(221, 221, 221) !important;\n}\n[data-supertokens~="providerButton"] {\n min-height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 2px 8px;\n\n background-color: white;\n color: black;\n}\n[data-supertokens~="providerButton"]:hover {\n -webkit-filter: none !important;\n filter: none !important;\n}\n[data-supertokens~="providerButton"]:hover {\n background-color: #fafafa;\n}\n[data-supertokens~="providerButtonLeft"] {\n min-width: 34px;\n margin-left: 66px;\n}\n[data-supertokens~="providerButtonLogo"] {\n height: 30px;\n display: flex;\n}\n[data-supertokens~="providerButtonLogoCenter"] {\n display: flex;\n margin: auto;\n}\n[data-supertokens~="providerButtonText"] {\n font-weight: 400;\n text-align: center;\n justify-content: center;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n display: inline-block;\n}\n[data-supertokens~="providerButtonText"]:only-child {\n margin: 0 auto;\n}\n[data-supertokens~="thirdPartyPasswordlessDivider"] {\n padding-top: 5px;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="thirdPartyPasswordlessDividerText"] {\n flex: 1 1;\n margin-top: 0.75em;\n}\n[data-supertokens~="divider"] {\n flex: 3 3;\n}\n[data-supertokens~="providerButton"] {\n margin: auto !important;\n max-width: 240px !important;\n}\n[data-supertokens~="providerButtonLeft"] {\n margin-left: 30px !important;\n}\n'; var ThemeBase = function (_a) { var children = _a.children, @@ -287,14 +289,18 @@ var SignInUpTheme = function (props) { }; function SignInUpThemeWrapper(props) { var hasFont = translations.hasFontDefined(props.config.rootStyle); + var currentDynamicLoginMethods = uiEntry.useDynamicLoginMethods(); // By defining it in a single object here TSC can deduce the connection between props var childProps = props.passwordlessRecipe !== undefined && props.pwlessChildProps !== undefined ? genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, props), { - activeScreen: passwordlessprebuiltui.getActiveScreen({ - config: props.pwlessChildProps.config, - featureState: props.pwlessState, - }), + activeScreen: passwordlessprebuiltui.getActiveScreen( + { + config: props.pwlessChildProps.config, + featureState: props.pwlessState, + }, + currentDynamicLoginMethods + ), pwlessChildProps: props.pwlessChildProps, passwordlessRecipe: props.passwordlessRecipe, }) diff --git a/lib/ts/components/assets/linkIcon.tsx b/lib/ts/components/assets/linkIcon.tsx deleted file mode 100644 index 6815ac02c..000000000 --- a/lib/ts/components/assets/linkIcon.tsx +++ /dev/null @@ -1,12 +0,0 @@ -export const LinkIcon = () => ( - - - - -); diff --git a/lib/ts/recipe/emailpassword/components/themes/styles.css b/lib/ts/recipe/emailpassword/components/themes/styles.css index 3e617c4bf..d53e036d8 100644 --- a/lib/ts/recipe/emailpassword/components/themes/styles.css +++ b/lib/ts/recipe/emailpassword/components/themes/styles.css @@ -201,22 +201,6 @@ align-items: center; } -[data-supertokens~="backButtonCommon"] { - width: 16px; - height: 13px; -} - -[data-supertokens~="backButton"] { - cursor: pointer; - border: none; - background-color: transparent; - padding: 0px; -} - -[data-supertokens~="backButtonPlaceholder"] { - display: block; -} - [data-supertokens~="resendEmailLink"] { display: inline-block; } diff --git a/lib/ts/recipe/passwordless/components/features/mfa/index.tsx b/lib/ts/recipe/passwordless/components/features/mfa/index.tsx index 49eb6f92f..7c2d9504d 100644 --- a/lib/ts/recipe/passwordless/components/features/mfa/index.tsx +++ b/lib/ts/recipe/passwordless/components/features/mfa/index.tsx @@ -20,40 +20,49 @@ import { Fragment } from "react"; import { useMemo } from "react"; import { useRef } from "react"; import { useEffect } from "react"; +import { WindowHandlerReference } from "supertokens-web-js/utils/windowHandler"; +import { redirectToAuth } from "../../../../.."; import { ComponentOverrideContext } from "../../../../../components/componentOverride/componentOverrideContext"; import FeatureWrapper from "../../../../../components/featureWrapper"; import { useUserContext } from "../../../../../usercontext"; -import { clearErrorQueryParam, getQueryParams, getRedirectToPathFromURL } from "../../../../../utils"; -import Session from "../../../../session"; +import { + clearErrorQueryParam, + getQueryParams, + getRedirectToPathFromURL, + useOnMountAPICall, +} from "../../../../../utils"; +import MultiFactorAuth from "../../../../multifactorauth/recipe"; import SessionRecipe from "../../../../session/recipe"; import { getPhoneNumberUtils } from "../../../phoneNumberUtils"; -import SignInUpThemeWrapper from "../../themes/signInUp"; +import MFAThemeWrapper from "../../themes/mfa"; import { defaultTranslationsPasswordless } from "../../themes/translations"; import type { FeatureBaseProps } from "../../../../../types"; import type Recipe from "../../../recipe"; -import type { AdditionalLoginAttemptInfoProperties, ComponentOverrideMap } from "../../../types"; -import type { PasswordlessSignInUpAction, SignInUpState, SignInUpChildProps, NormalisedConfig } from "../../../types"; +import type { AdditionalLoginAttemptInfoProperties, ComponentOverrideMap, MFAChildProps } from "../../../types"; +import type { MFAAction, MFAState, NormalisedConfig } from "../../../types"; +import type { MFAFactorInfo } from "supertokens-web-js/recipe/multifactorauth/types"; import type { RecipeInterface } from "supertokens-web-js/recipe/passwordless"; -import type { User } from "supertokens-web-js/types"; +import type { PasswordlessFlowType } from "supertokens-web-js/recipe/thirdpartypasswordless"; export const useSuccessInAnotherTabChecker = ( - state: SignInUpState, - dispatch: React.Dispatch, + callingConsumeCodeRef: React.MutableRefObject, + recipeImpl: RecipeInterface, + state: MFAState, + dispatch: React.Dispatch, userContext: any ) => { - const callingConsumeCodeRef = useRef(false); - useEffect(() => { // We only need to start checking this if we have an active login attempt if (state.loginAttemptInfo && !state.successInAnotherTab) { const checkSessionIntervalHandle = setInterval(async () => { if (callingConsumeCodeRef.current === false) { - const hasSession = await Session.doesSessionExist({ - userContext, - }); - if (hasSession) { + const currLoginAttempt = await recipeImpl.getLoginAttemptInfo({ userContext }); + if ( + currLoginAttempt === undefined || + currLoginAttempt.deviceId !== state.loginAttemptInfo?.deviceId + ) { dispatch({ type: "successInAnotherTab" }); } } @@ -66,22 +75,18 @@ export const useSuccessInAnotherTabChecker = ( // Nothing to clean up return; }, [state.loginAttemptInfo, state.successInAnotherTab]); - - return callingConsumeCodeRef; }; -export const useFeatureReducer = ( - recipeImpl: RecipeInterface | undefined, - userContext: any -): [SignInUpState, React.Dispatch] => { - const [state, dispatch] = React.useReducer( - (oldState: SignInUpState, action: PasswordlessSignInUpAction) => { +export const useFeatureReducer = (): [MFAState, React.Dispatch] => { + return React.useReducer( + (oldState: MFAState, action: MFAAction): MFAState => { switch (action.type) { case "load": return { loaded: true, error: action.error, loginAttemptInfo: action.loginAttemptInfo, + isSetupAllowed: action.isAllowedToSetup, successInAnotherTab: false, }; case "resendCode": @@ -110,8 +115,10 @@ export const useFeatureReducer = ( case "startLogin": return { ...oldState, + loaded: true, loginAttemptInfo: action.loginAttemptInfo, error: undefined, + successInAnotherTab: false, }; case "successInAnotherTab": return { @@ -126,6 +133,7 @@ export const useFeatureReducer = ( error: undefined, loaded: false, loginAttemptInfo: undefined, + isSetupAllowed: false, successInAnotherTab: false, }, (initArg) => { @@ -147,106 +155,115 @@ export const useFeatureReducer = ( }; } ); - useEffect(() => { - if (recipeImpl === undefined) { - return; - } - async function load() { - let error: string | undefined = undefined; - const errorQueryParam = getQueryParams("error"); - const messageQueryParam = getQueryParams("message"); - if (errorQueryParam !== null) { - if (errorQueryParam === "signin") { - error = "SOMETHING_WENT_WRONG_ERROR"; - } else if (errorQueryParam === "restart_link") { - error = "ERROR_SIGN_IN_UP_LINK"; - } else if (errorQueryParam === "custom" && messageQueryParam !== null) { - error = messageQueryParam; - } - } - const loginAttemptInfo = await recipeImpl?.getLoginAttemptInfo({ - userContext, - }); - // No need to check if the component is unmounting, since this has no effect then. - dispatch({ type: "load", loginAttemptInfo, error }); - } - if (state.loaded === false) { - void load(); - } - }, [state.loaded, recipeImpl, userContext]); - return [state, dispatch]; }; // We are overloading to explicitly state that if recipe is defined then the return value is defined as well. export function useChildProps( recipe: Recipe, - dispatch: React.Dispatch, - state: SignInUpState, - callingConsumeCodeRef: React.MutableRefObject, + recipeImplementation: RecipeInterface, + state: MFAState, + contactMethod: "PHONE" | "EMAIL", userContext: any, history: any -): SignInUpChildProps; +): MFAChildProps; export function useChildProps( recipe: Recipe | undefined, - dispatch: React.Dispatch, - state: SignInUpState, - callingConsumeCodeRef: React.MutableRefObject, + recipeImplementation: RecipeInterface, + state: MFAState, + contactMethod: "PHONE" | "EMAIL", userContext: any, history: any -): SignInUpChildProps | undefined; +): MFAChildProps | undefined; export function useChildProps( recipe: Recipe | undefined, - dispatch: React.Dispatch, - state: SignInUpState, - callingConsumeCodeRef: React.MutableRefObject, + recipeImplementation: RecipeInterface, + state: MFAState, + contactMethod: "PHONE" | "EMAIL", userContext: any, history: any -): SignInUpChildProps | undefined { - const recipeImplementation = React.useMemo( - () => - recipe && - getModifiedRecipeImplementation(recipe.webJSRecipe, recipe.config, dispatch, callingConsumeCodeRef), - [recipe] - ); - +): MFAChildProps | undefined { return useMemo(() => { if (!recipe || !recipeImplementation) { return undefined; } return { - onSuccess: (result: { createdNewRecipeUser: boolean; user: User }) => { + onSuccess: () => { return SessionRecipe.getInstanceOrThrow().validateGlobalClaimsAndHandleSuccessRedirection( - { - rid: recipe.config.recipeId, - successRedirectContext: { - action: "SUCCESS", - isNewRecipeUser: result.createdNewRecipeUser, - user: result.user, - redirectToPath: getRedirectToPathFromURL(), - }, - }, + undefined, userContext, history ); }, + onSignOutClicked: async () => { + await SessionRecipe.getInstanceOrThrow().signOut({ userContext }); + await recipeImplementation.clearLoginAttemptInfo({ userContext }); + await redirectToAuth({ redirectBack: false, history: history }); + }, + onBackButtonClicked: () => { + // If we don't have history available this would mean we are not using react-router-dom, so we use window's history + if (history === undefined) { + return WindowHandlerReference.getReferenceOrThrow().windowHandler.getWindowUnsafe().history.back(); + } + // If we do have history and goBack function on it this means we are using react-router-dom v5 or lower + if (history.goBack !== undefined) { + return history.goBack(); + } + // If we reach this code this means we are using react-router-dom v6 + return history(-1); + }, + onFactorChooserButtonClicked: () => { + return MultiFactorAuth.getInstanceOrThrow().redirectToFactorChooser(history); + }, recipeImplementation: recipeImplementation, config: recipe.config, + contactMethod, }; - }, [state, recipeImplementation]); + }, [contactMethod, state, recipeImplementation]); } -export const SignInUpFeature: React.FC< +export const MFAFeature: React.FC< FeatureBaseProps & { + contactMethod: "PHONE" | "EMAIL"; + flowType: PasswordlessFlowType; recipe: Recipe; useComponentOverrides: () => ComponentOverrideMap; } > = (props) => { const recipeComponentOverrides = props.useComponentOverrides(); const userContext = useUserContext(); - const [state, dispatch] = useFeatureReducer(props.recipe.webJSRecipe, userContext); - const callingConsumeCodeRef = useSuccessInAnotherTabChecker(state, dispatch, userContext); - const childProps = useChildProps(props.recipe, dispatch, state, callingConsumeCodeRef, userContext, props.history)!; + + const callingConsumeCodeRef = useRef(false); + const [state, dispatch] = useFeatureReducer(); + const recipeImplementation = React.useMemo( + () => + props.recipe && + getModifiedRecipeImplementation( + props.recipe.webJSRecipe, + props.recipe.config, + dispatch, + callingConsumeCodeRef + ), + [props.recipe] + ); + + useOnLoad(props, recipeImplementation, dispatch, userContext); + + const childProps = useChildProps( + props.recipe, + recipeImplementation, + state, + props.contactMethod, + userContext, + props.history + )!; + useSuccessInAnotherTabChecker(callingConsumeCodeRef, recipeImplementation, state, dispatch, userContext); + + useEffect(() => { + if (state.loaded && state.isSetupAllowed === false && state.loginAttemptInfo === undefined) { + void MultiFactorAuth.getInstanceOrThrow().redirectToFactorChooser(); + } + }, [state.loaded, state.isSetupAllowed, state.loginAttemptInfo]); return ( @@ -256,7 +273,7 @@ export const SignInUpFeature: React.FC< {/* No custom theme, use default. */} {props.children === undefined && ( - + )} {/* Otherwise, custom theme is provided, propagate props. */} @@ -277,12 +294,100 @@ export const SignInUpFeature: React.FC< ); }; -export default SignInUpFeature; +export default MFAFeature; + +function useOnLoad( + props: React.PropsWithChildren< + { history?: any } & { children?: React.ReactNode } & { + contactMethod: "PHONE" | "EMAIL"; + flowType: PasswordlessFlowType; + recipe: Recipe; + useComponentOverrides: () => ComponentOverrideMap; + } + >, + recipeImplementation: RecipeInterface, + dispatch: React.Dispatch, + userContext: any +) { + const fetchMFAInfo = React.useCallback( + async () => MultiFactorAuth.getInstanceOrThrow().webJSRecipe.getMFAInfo({ userContext }), + [props.recipe, userContext] + ); + const handleLoadError = React.useCallback( + // Test this, it may show an empty screen in many cases + () => dispatch({ type: "setError", error: "Getting mfaInfo failed!" }), + [dispatch] + ); // TODO: translation/proper error handling) + const onLoad = React.useCallback( + async (mfaInfo: { factors: MFAFactorInfo; email?: string; phoneNumber?: string }) => { + let error: string | undefined = undefined; + const errorQueryParam = getQueryParams("error"); + const messageQueryParam = getQueryParams("message"); + const doSetup = getQueryParams("setup"); + if (errorQueryParam !== null) { + if (errorQueryParam === "signin") { + error = "SOMETHING_WENT_WRONG_ERROR"; + } else if (errorQueryParam === "restart_link") { + error = "ERROR_SIGN_IN_UP_LINK"; + } else if (errorQueryParam === "custom" && messageQueryParam !== null) { + error = messageQueryParam; + } + } + const loginAttemptInfo = + await recipeImplementation.getLoginAttemptInfo({ + userContext, + }); + + const isAlreadySetup = + props.contactMethod === "EMAIL" + ? mfaInfo.factors.isAlreadySetup.includes("otp-email") + : mfaInfo.factors.isAlreadySetup.includes("otp-phone"); + const isAllowedToSetup = + props.contactMethod === "EMAIL" + ? mfaInfo.factors.isAllowedToSetup.includes("otp-email") + : mfaInfo.factors.isAllowedToSetup.includes("otp-phone"); + + if (!loginAttemptInfo) { + if (props.contactMethod === "EMAIL") { + if (isAlreadySetup && doSetup !== "true") { + // createCode also dispatches the necessary events + await recipeImplementation!.createCode({ + email: mfaInfo.email!, // We can assume this is set here, since the mfaInfo states that otp-email has been set up + userContext, + }); + } else if (!mfaInfo.factors.isAllowedToSetup.includes("otp-email")) { + dispatch({ type: "setError", error: "Factor not enabled" }); // TODO: translation + } else { + dispatch({ type: "load", loginAttemptInfo, error, isAllowedToSetup: true }); // since loginAttemptInfo is undefined, this will ask the user for the email + } + } else { + if (isAlreadySetup && doSetup !== "true") { + // createCode also dispatches the necessary events + await recipeImplementation!.createCode({ + phoneNumber: mfaInfo.phoneNumber!, // We can assume this is set here, since the mfaInfo states that otp-phone has been set up + userContext, + }); + } else if (!mfaInfo.factors.isAllowedToSetup.includes("otp-phone")) { + dispatch({ type: "setError", error: "Factor not enabled" }); // TODO: translation + } else { + dispatch({ type: "load", loginAttemptInfo, error, isAllowedToSetup: true }); // since loginAttemptInfo is undefined, this will ask the user for the phone number + } + } + } else { + // No need to check if the component is unmounting, since this has no effect then. + dispatch({ type: "load", loginAttemptInfo, error, isAllowedToSetup }); + } + }, + [dispatch, recipeImplementation, props.contactMethod, userContext] + ); + + useOnMountAPICall(fetchMFAInfo, onLoad, handleLoadError); +} function getModifiedRecipeImplementation( originalImpl: RecipeInterface, config: NormalisedConfig, - dispatch: React.Dispatch, + dispatch: React.Dispatch, callingConsumeCodeRef: React.MutableRefObject ): RecipeInterface { return { @@ -314,6 +419,7 @@ function getModifiedRecipeImplementation( ...input, userContext: { ...input.userContext, additionalAttemptInfo }, }); + if (res.status === "OK") { const loginAttemptInfo = (await originalImpl.getLoginAttemptInfo({ userContext: input.userContext, diff --git a/lib/ts/recipe/passwordless/components/themes/mfa/index.tsx b/lib/ts/recipe/passwordless/components/themes/mfa/index.tsx new file mode 100644 index 000000000..66ef03637 --- /dev/null +++ b/lib/ts/recipe/passwordless/components/themes/mfa/index.tsx @@ -0,0 +1,175 @@ +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +/* + * Imports. + */ +import React from "react"; + +import { SuperTokensBranding } from "../../../../../components/SuperTokensBranding"; +import { hasFontDefined } from "../../../../../styles/styles"; +import UserContextWrapper from "../../../../../usercontext/userContextWrapper"; +import GeneralError from "../../../../emailpassword/components/library/generalError"; +import { CloseTabScreen } from "../signInUp/closeTabScreen"; +import { EmailForm } from "../signInUp/emailForm"; +import { PhoneForm } from "../signInUp/phoneForm"; +import { UserInputCodeForm } from "../signInUp/userInputCodeForm"; +import { ThemeBase } from "../themeBase"; + +import { MFAFooter } from "./mfaFooter"; +import { MFAHeader } from "./mfaHeader"; +import { MFAOTPFooter } from "./mfaOTPFooter"; +import { MFAOTPHeader } from "./mfaOTPHeader"; + +import type { MFAProps } from "../../../types"; + +export enum MFAScreens { + CloseTab, + EmailForm, + PhoneForm, + UserInputCodeForm, +} + +/* + * Component. + */ +const MFATheme: React.FC = ({ + activeScreen, + featureState, + onBackButtonClicked, + ...props +}) => { + const commonProps = { + recipeImplementation: props.recipeImplementation, + config: props.config, + clearError: () => props.dispatch({ type: "setError", error: undefined }), + onError: (error: string) => props.dispatch({ type: "setError", error }), + error: featureState.error, + }; + + return activeScreen === MFAScreens.CloseTab ? ( + + ) : ( +
+
+ {featureState.loaded && + /* TODO: this doesn't feel great */ (featureState.isSetupAllowed === true || + featureState.loginAttemptInfo !== undefined) && ( + + {activeScreen === MFAScreens.UserInputCodeForm ? ( + + props.recipeImplementation.clearLoginAttemptInfo({ + userContext: props.userContext, + }) + } + /> + ) : ( + + )} + {featureState.error !== undefined && } + {activeScreen === MFAScreens.EmailForm ? ( + + } + /> + ) : activeScreen === MFAScreens.PhoneForm ? ( + + } + /> + ) : activeScreen === MFAScreens.UserInputCodeForm ? ( + + } + /> + ) : null} + + )} +
+ +
+ ); +}; + +function MFAThemeWrapper(props: MFAProps): JSX.Element { + const hasFont = hasFontDefined(props.config.rootStyle); + + const activeScreen = getActiveScreen(props); + + let activeStyle; + if (activeScreen === MFAScreens.CloseTab) { + activeStyle = props.config.signInUpFeature.closeTabScreenStyle; + } else if (activeScreen === MFAScreens.UserInputCodeForm) { + activeStyle = props.config.signInUpFeature.userInputCodeFormStyle; + } else if (activeScreen === MFAScreens.EmailForm) { + activeStyle = props.config.signInUpFeature.emailOrPhoneFormStyle; + } else if (activeScreen === MFAScreens.PhoneForm) { + activeStyle = props.config.signInUpFeature.emailOrPhoneFormStyle; + } + + return ( + + + + + + ); +} + +export default MFAThemeWrapper; + +export function getActiveScreen(props: Pick) { + if (props.featureState.successInAnotherTab) { + return MFAScreens.CloseTab; + } else if (props.featureState.loginAttemptInfo) { + return MFAScreens.UserInputCodeForm; + } else if (props.contactMethod === "EMAIL") { + return MFAScreens.EmailForm; + } else if (props.contactMethod === "PHONE") { + return MFAScreens.PhoneForm; + } + + throw new Error("Couldn't choose active screen; Should never happen"); +} diff --git a/lib/ts/recipe/passwordless/components/themes/mfa/mfaFooter.tsx b/lib/ts/recipe/passwordless/components/themes/mfa/mfaFooter.tsx new file mode 100644 index 000000000..a575a021d --- /dev/null +++ b/lib/ts/recipe/passwordless/components/themes/mfa/mfaFooter.tsx @@ -0,0 +1,46 @@ +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +import ArrowLeftIcon from "../../../../../components/assets/arrowLeftIcon"; +import { withOverride } from "../../../../../components/componentOverride/withOverride"; +import { useTranslation } from "../../../../../translation/translationContext"; +import { MultiFactorAuthClaim } from "../../../../multifactorauth"; +import { useClaimValue } from "../../../../session"; + +import type { MFAFooterProps } from "../../../types"; + +export const MFAFooter = withOverride( + "PasswordlessMFAFooter", + function PasswordlessMFAFooter(props: MFAFooterProps): JSX.Element | null { + const t = useTranslation(); + const claim = useClaimValue(MultiFactorAuthClaim); + + return ( + <> + {claim.loading === false && (claim.value?.n.length ?? 0) > 1 && ( +
props.onFactorChooserButtonClicked}> + {t("PWLESS_MFA_FOOTER_CHOOSER_ANOTHER")} +
+ )} +
props.onSignOutClicked}> + + {t("PWLESS_MFA_FOOTER_LOGOUT")} +
+ + ); + } +); diff --git a/lib/ts/recipe/passwordless/components/themes/mfa/mfaHeader.tsx b/lib/ts/recipe/passwordless/components/themes/mfa/mfaHeader.tsx new file mode 100644 index 000000000..5156fc3be --- /dev/null +++ b/lib/ts/recipe/passwordless/components/themes/mfa/mfaHeader.tsx @@ -0,0 +1,53 @@ +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +import { Fragment } from "react"; + +import { withOverride } from "../../../../../components/componentOverride/withOverride"; +import { useTranslation } from "../../../../../translation/translationContext"; +import BackButton from "../../../../emailpassword/components/library/backButton"; +import { MultiFactorAuthClaim } from "../../../../multifactorauth"; +import { useClaimValue } from "../../../../session"; + +export const MFAHeader = withOverride( + "PasswordlessMFAHeader", + function PasswordlessMFAHeader(props: { + contactMethod: "EMAIL" | "PHONE"; + onBackButtonClicked: () => void; + }): JSX.Element { + const t = useTranslation(); + const claim = useClaimValue(MultiFactorAuthClaim); + + return ( + +
+ {claim.loading === false && claim.value?.n.length === 0 ? ( + + ) : ( + + {/* empty span for spacing the back button */} + + )} + {props.contactMethod === "EMAIL" + ? t("PWLESS_MFA_HEADER_TITLE_EMAIL") + : t("PWLESS_MFA_HEADER_TITLE_PHONE")} + + {/* empty span for spacing the back button */} + +
+
+
+ ); + } +); diff --git a/lib/ts/recipe/passwordless/components/themes/mfa/mfaOTPFooter.tsx b/lib/ts/recipe/passwordless/components/themes/mfa/mfaOTPFooter.tsx new file mode 100644 index 000000000..dcf63a9b3 --- /dev/null +++ b/lib/ts/recipe/passwordless/components/themes/mfa/mfaOTPFooter.tsx @@ -0,0 +1,59 @@ +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +import { Fragment } from "react"; + +import ArrowLeftIcon from "../../../../../components/assets/arrowLeftIcon"; +import { withOverride } from "../../../../../components/componentOverride/withOverride"; +import { useTranslation } from "../../../../../translation/translationContext"; +import { useUserContext } from "../../../../../usercontext"; + +import type { MFAOTPFooterProps } from "../../../types"; + +export const MFAOTPFooter = withOverride( + "PasswordlessMFAOTPFooter", + function PasswordlessMFAOTPFooter({ + loginAttemptInfo, + recipeImplementation, + onSignOutClicked, + isSetupAllowed, + }: MFAOTPFooterProps): JSX.Element { + const t = useTranslation(); + const userContext = useUserContext(); + + return ( + + {(isSetupAllowed && ( +
+ recipeImplementation.clearLoginAttemptInfo({ + userContext, + }) + }> + + {loginAttemptInfo.contactMethod === "EMAIL" + ? t("PWLESS_SIGN_IN_UP_CHANGE_CONTACT_INFO_EMAIL") + : t("PWLESS_SIGN_IN_UP_CHANGE_CONTACT_INFO_PHONE")} +
+ )) || ( +
+ + {t("PWLESS_MFA_LOGOUT")} +
+ )} +
+ ); + } +); diff --git a/lib/ts/recipe/passwordless/components/themes/mfa/mfaOTPHeader.tsx b/lib/ts/recipe/passwordless/components/themes/mfa/mfaOTPHeader.tsx new file mode 100644 index 000000000..baac35657 --- /dev/null +++ b/lib/ts/recipe/passwordless/components/themes/mfa/mfaOTPHeader.tsx @@ -0,0 +1,61 @@ +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +import { Fragment } from "react"; + +import { withOverride } from "../../../../../components/componentOverride/withOverride"; +import { useTranslation } from "../../../../../translation/translationContext"; +import BackButton from "../../../../emailpassword/components/library/backButton"; +import { MultiFactorAuthClaim } from "../../../../multifactorauth"; +import { useClaimValue } from "../../../../session"; + +import type { MFAOTPHeaderProps } from "../../../types"; + +export const MFAOTPHeader = withOverride( + "PasswordlessMFAOTPHeader", + function PasswordlessMFAOTPHeader({ + loginAttemptInfo, + onBackButtonClicked, + isSetupAllowed, + }: MFAOTPHeaderProps): JSX.Element { + const t = useTranslation(); + const claim = useClaimValue(MultiFactorAuthClaim); + + return ( + +
+ {claim.loading === false && claim.value?.n.length === 0 && isSetupAllowed === false ? ( + + ) : ( + + {/* empty span for spacing the back button */} + + )} + {t("PWLESS_USER_INPUT_CODE_HEADER_TITLE")} + + {/* empty span for spacing the back button */} + +
+
+ {loginAttemptInfo.flowType === "USER_INPUT_CODE" + ? t("PWLESS_USER_INPUT_CODE_HEADER_SUBTITLE") + : t("PWLESS_USER_INPUT_CODE_HEADER_SUBTITLE_LINK")} +
+ {loginAttemptInfo.contactInfo} +
+
+
+ ); + } +); diff --git a/lib/ts/recipe/passwordless/components/themes/signInUp/emailForm.tsx b/lib/ts/recipe/passwordless/components/themes/signInUp/emailForm.tsx index 97159f306..3a582cdf3 100644 --- a/lib/ts/recipe/passwordless/components/themes/signInUp/emailForm.tsx +++ b/lib/ts/recipe/passwordless/components/themes/signInUp/emailForm.tsx @@ -26,7 +26,11 @@ import type { SignInUpEmailFormProps } from "../../../types"; export const EmailForm = withOverride( "PasswordlessEmailForm", - function PasswordlessEmailForm(props: SignInUpEmailFormProps): JSX.Element { + function PasswordlessEmailForm( + props: SignInUpEmailFormProps & { + footer?: JSX.Element; + } + ): JSX.Element { const userContext = useUserContext(); return ( @@ -71,10 +75,12 @@ export const EmailForm = withOverride( validateOnBlur={false} showLabels={true} footer={ - + props.footer ?? ( + + ) } /> ); diff --git a/lib/ts/recipe/passwordless/components/themes/signInUp/emailOrPhoneForm.tsx b/lib/ts/recipe/passwordless/components/themes/signInUp/emailOrPhoneForm.tsx index 54d2f0295..6cfaa4247 100644 --- a/lib/ts/recipe/passwordless/components/themes/signInUp/emailOrPhoneForm.tsx +++ b/lib/ts/recipe/passwordless/components/themes/signInUp/emailOrPhoneForm.tsx @@ -30,7 +30,11 @@ import type { SignInUpEmailOrPhoneFormProps } from "../../../types"; export const EmailOrPhoneForm = withOverride( "PasswordlessEmailOrPhoneForm", - function PasswordlessEmailOrPhoneForm(props: SignInUpEmailOrPhoneFormProps): JSX.Element { + function PasswordlessEmailOrPhoneForm( + props: SignInUpEmailOrPhoneFormProps & { + footer?: JSX.Element; + } + ): JSX.Element { const [isPhoneNumber, setIsPhoneNumber] = useState(false); const userContext = useUserContext(); @@ -149,10 +153,12 @@ export const EmailOrPhoneForm = withOverride( validateOnBlur={false} showLabels={true} footer={ - + props.footer ?? ( + + ) } /> ); diff --git a/lib/ts/recipe/passwordless/components/themes/signInUp/index.tsx b/lib/ts/recipe/passwordless/components/themes/signInUp/index.tsx index 289f2c251..deaf38515 100644 --- a/lib/ts/recipe/passwordless/components/themes/signInUp/index.tsx +++ b/lib/ts/recipe/passwordless/components/themes/signInUp/index.tsx @@ -21,6 +21,8 @@ import { SuperTokensBranding } from "../../../../../components/SuperTokensBrandi import { hasFontDefined } from "../../../../../styles/styles"; import UserContextWrapper from "../../../../../usercontext/userContextWrapper"; import GeneralError from "../../../../emailpassword/components/library/generalError"; +import MultiFactorAuth from "../../../../multifactorauth/recipe"; +import { useDynamicLoginMethods } from "../../../../multitenancy/dynamicLoginMethodsContext"; import { ThemeBase } from "../themeBase"; import { CloseTabScreen } from "./closeTabScreen"; @@ -32,6 +34,7 @@ import { SignInUpHeader } from "./signInUpHeader"; import { UserInputCodeForm } from "./userInputCodeForm"; import { UserInputCodeFormHeader } from "./userInputCodeFormHeader"; +import type { DynamicLoginMethodsContextValue } from "../../../../multitenancy/dynamicLoginMethodsContext"; import type { SignInUpProps } from "../../../types"; export enum SignInUpScreens { @@ -101,7 +104,8 @@ const SignInUpTheme: React.FC function SignInUpThemeWrapper(props: SignInUpProps): JSX.Element { const hasFont = hasFontDefined(props.config.rootStyle); - const activeScreen = getActiveScreen(props); + const currentDynamicLoginMethods = useDynamicLoginMethods(); + const activeScreen = getActiveScreen(props, currentDynamicLoginMethods); let activeStyle; if (activeScreen === SignInUpScreens.CloseTab) { @@ -129,19 +133,49 @@ function SignInUpThemeWrapper(props: SignInUpProps): JSX.Element { export default SignInUpThemeWrapper; -export function getActiveScreen(props: Pick) { +export function getActiveScreen( + props: Pick, + currentDynamicLoginMethods: DynamicLoginMethodsContextValue +) { + const contactMethod = props.config.contactMethod; + let enabledContactMethods = contactMethod === "EMAIL_OR_PHONE" ? ["EMAIL", "PHONE"] : [contactMethod]; + + let firstFactors; + if (currentDynamicLoginMethods.loaded && currentDynamicLoginMethods.loginMethods.firstFactors) { + firstFactors = currentDynamicLoginMethods.loginMethods.firstFactors; + } else { + firstFactors = MultiFactorAuth.getInstance()?.getFirstFactors(); + } + + if (firstFactors !== undefined) { + if (enabledContactMethods.includes("PHONE")) { + if (!firstFactors.includes("otp-phone") && !firstFactors.includes("link-phone")) { + enabledContactMethods = enabledContactMethods.filter((c) => c !== "PHONE"); + } + } + if (enabledContactMethods.includes("EMAIL")) { + if (!firstFactors.includes("otp-email") && !firstFactors.includes("link-email")) { + enabledContactMethods = enabledContactMethods.filter((c) => c !== "EMAIL"); + } + } + } + + if (enabledContactMethods.length === 0) { + throw new Error("No overlap between first factors and enabled contact methods"); // redirect to access denied? + } + if (props.featureState.successInAnotherTab) { return SignInUpScreens.CloseTab; } else if (props.featureState.loginAttemptInfo && props.featureState.loginAttemptInfo.flowType === "MAGIC_LINK") { return SignInUpScreens.LinkSent; } else if (props.featureState.loginAttemptInfo) { return SignInUpScreens.UserInputCodeForm; - } else if (props.config.contactMethod === "EMAIL") { + } else if (enabledContactMethods.length > 1) { + return SignInUpScreens.EmailOrPhoneForm; + } else if (enabledContactMethods[0] === "EMAIL") { return SignInUpScreens.EmailForm; - } else if (props.config.contactMethod === "PHONE") { + } else if (enabledContactMethods[0] === "PHONE") { return SignInUpScreens.PhoneForm; - } else if (props.config.contactMethod === "EMAIL_OR_PHONE") { - return SignInUpScreens.EmailOrPhoneForm; } throw new Error("Couldn't choose active screen; Should never happen"); } diff --git a/lib/ts/recipe/passwordless/components/themes/signInUp/phoneForm.tsx b/lib/ts/recipe/passwordless/components/themes/signInUp/phoneForm.tsx index fb2b8805f..a978bc138 100644 --- a/lib/ts/recipe/passwordless/components/themes/signInUp/phoneForm.tsx +++ b/lib/ts/recipe/passwordless/components/themes/signInUp/phoneForm.tsx @@ -29,7 +29,11 @@ import type { SignInUpPhoneFormProps } from "../../../types"; export const PhoneForm = withOverride( "PasswordlessPhoneForm", - function PasswordlessPhoneForm(props: SignInUpPhoneFormProps): JSX.Element { + function PasswordlessPhoneForm( + props: SignInUpPhoneFormProps & { + footer?: JSX.Element; + } + ): JSX.Element { const userContext = useUserContext(); useEffect(() => { @@ -87,10 +91,12 @@ export const PhoneForm = withOverride( validateOnBlur={false} showLabels={true} footer={ - + props.footer ?? ( + + ) } /> ); diff --git a/lib/ts/recipe/passwordless/components/themes/signInUp/userInputCodeForm.tsx b/lib/ts/recipe/passwordless/components/themes/signInUp/userInputCodeForm.tsx index d237ed0e6..fb8203bc5 100644 --- a/lib/ts/recipe/passwordless/components/themes/signInUp/userInputCodeForm.tsx +++ b/lib/ts/recipe/passwordless/components/themes/signInUp/userInputCodeForm.tsx @@ -32,7 +32,6 @@ export const UserInputCodeForm = withOverride( "PasswordlessUserInputCodeForm", function PasswordlessUserInputCodeForm( props: SignInUpUserInputCodeFormProps & { - header?: JSX.Element; footer?: JSX.Element; } ): JSX.Element { @@ -160,7 +159,9 @@ export const UserInputCodeForm = withOverride( }} validateOnBlur={false} showLabels={true} - footer={} + footer={ + props.footer ?? + } /> ); diff --git a/lib/ts/recipe/passwordless/components/themes/translations.ts b/lib/ts/recipe/passwordless/components/themes/translations.ts index 0fa66ae81..b57509954 100644 --- a/lib/ts/recipe/passwordless/components/themes/translations.ts +++ b/lib/ts/recipe/passwordless/components/themes/translations.ts @@ -71,6 +71,11 @@ export const defaultTranslationsPasswordless = { PWLESS_USER_INPUT_CODE_HEADER_SUBTITLE_LINK: "An OTP and a magic link was sent to you at", PWLESS_USER_INPUT_CODE_INPUT_LABEL: "OTP", + PWLESS_MFA_LOGOUT: "Logout", + PWLESS_MFA_HEADER_TITLE_PHONE: "SMS based OTP", + PWLESS_MFA_HEADER_TITLE_EMAIL: "Email based OTP", + PWLESS_MFA_FOOTER_CHOOSER_ANOTHER: "Choose another factor", + PWLESS_MFA_FOOTER_LOGOUT: "Logout", /* * The following are error messages from our backend SDK. * These are returned as full messages to preserver compatibilty, but they work just like the keys above. diff --git a/lib/ts/recipe/passwordless/prebuiltui.tsx b/lib/ts/recipe/passwordless/prebuiltui.tsx index 06e7315b9..e76afb17d 100644 --- a/lib/ts/recipe/passwordless/prebuiltui.tsx +++ b/lib/ts/recipe/passwordless/prebuiltui.tsx @@ -4,9 +4,11 @@ import UserContextWrapper from "../../usercontext/userContextWrapper"; import { isTest, matchRecipeIdUsingQueryParams } from "../../utils"; import AuthWidgetWrapper from "../authRecipe/authWidgetWrapper"; import { RecipeRouter } from "../recipeRouter"; +import { SessionAuth } from "../session"; import { useRecipeComponentOverrideContext } from "./componentOverrideContext"; import LinkClickedScreen from "./components/features/linkClickedScreen"; +import MFAFeature from "./components/features/mfa"; import SignInUpFeature from "./components/features/signInAndUp"; import SignInUpTheme from "./components/themes/signInUp"; import Passwordless from "./recipe"; @@ -79,11 +81,29 @@ export class PasswordlessPreBuiltUI extends RecipeRouter { recipeID: Passwordless.RECIPE_ID, }; } + if (this.recipeInstance.config.mfaFeature.disableDefaultUI !== true) { + const normalisedFullPathPhone = this.recipeInstance.config.appInfo.websiteBasePath.appendPath( + new NormalisedURLPath("/mfa/otp-phone") + ); + features[normalisedFullPathPhone.getAsStringDangerous()] = { + matches: matchRecipeIdUsingQueryParams(this.recipeInstance.config.recipeId), + component: (props) => this.getFeatureComponent("otp-phone", props as any, useComponentOverrides), + recipeID: Passwordless.RECIPE_ID, + }; + const normalisedFullPathEmail = this.recipeInstance.config.appInfo.websiteBasePath.appendPath( + new NormalisedURLPath("/mfa/otp-email") + ); + features[normalisedFullPathEmail.getAsStringDangerous()] = { + matches: matchRecipeIdUsingQueryParams(this.recipeInstance.config.recipeId), + component: (props) => this.getFeatureComponent("otp-email", props as any, useComponentOverrides), + recipeID: Passwordless.RECIPE_ID, + }; + } return features; }; getFeatureComponent = ( - componentName: "signInUp" | "linkClickedScreen", + componentName: "signInUp" | "linkClickedScreen" | "otp-phone" | "otp-email", props: FeatureBaseProps & { redirectOnSessionExists?: boolean; userContext?: any }, useComponentOverrides: () => GenericComponentOverrideMap = useRecipeComponentOverrideContext ): JSX.Element => { @@ -129,9 +149,38 @@ export class PasswordlessPreBuiltUI extends RecipeRouter { />
); - } else { - throw new Error("Should never come here."); } + if (componentName === "otp-email") { + return ( + + []}> + + + + ); + } + if (componentName === "otp-phone") { + return ( + + []}> + + + + ); + } + throw new Error("Should never come here."); }; // For tests diff --git a/lib/ts/recipe/passwordless/recipe.tsx b/lib/ts/recipe/passwordless/recipe.tsx index c070bd1ad..613c27ec4 100644 --- a/lib/ts/recipe/passwordless/recipe.tsx +++ b/lib/ts/recipe/passwordless/recipe.tsx @@ -20,7 +20,7 @@ import PasswordlessWebJS from "supertokens-web-js/recipe/passwordless"; import { PostSuperTokensInitCallbacks } from "supertokens-web-js/utils/postSuperTokensInitCallbacks"; -import { LinkIcon } from "../../components/assets/linkIcon"; +// import { LinkIcon } from "../../components/assets/linkIcon"; import { OTPIcon } from "../../components/assets/otpIcon"; import { SSR_ERROR } from "../../constants"; import { isTest } from "../../utils"; @@ -81,31 +81,31 @@ export default class Passwordless extends AuthRecipe< id: "otp-phone", name: "SMS based OTP", description: "Get an OTP code on your phone to complete the authentication request", - path: "/check-auth/otp-phone", + path: "/auth/mfa/otp-phone", // TODO: websitebasepath logo: OTPIcon, }, - { - id: "link-phone", - name: "SMS based Magic link", - description: "Get a magic link on your phone to complete the authentication request", - path: "/check-auth/link-phone", - logo: LinkIcon, - }, + // { + // id: "link-phone", + // name: "SMS based Magic link", + // description: "Get a magic link on your phone to complete the authentication request", + // path: "/auth/mfa/link-phone", + // logo: LinkIcon, + // }, { id: "otp-email", - name: "SMS based OTP", + name: "Email based OTP", description: "Get an OTP code on your email address to complete the authentication request", - path: "/check-auth/otp-email", + path: "/auth/mfa/otp-email", // TODO: websitebasepath logo: OTPIcon, }, - { - id: "link-email", - name: "SMS based Magic link", - description: - "Get a magic link on your email address to complete the authentication request", - path: "/check-auth/link-email", - logo: LinkIcon, - }, + // { + // id: "link-email", + // name: "SMS based Magic link", + // description: + // "Get a magic link on your email address to complete the authentication request", + // path: "/auth/mfa/link-email", + // logo: LinkIcon, + // }, ] ); } diff --git a/lib/ts/recipe/passwordless/types.ts b/lib/ts/recipe/passwordless/types.ts index bd78c63ce..69c547ac7 100644 --- a/lib/ts/recipe/passwordless/types.ts +++ b/lib/ts/recipe/passwordless/types.ts @@ -106,6 +106,7 @@ export type NormalisedConfig = { disableDefaultUI?: boolean; }; linkClickedScreenFeature: PasswordlessNormalisedBaseConfig; + mfaFeature: PasswordlessNormalisedBaseConfig; contactMethod: "PHONE" | "EMAIL" | "EMAIL_OR_PHONE"; @@ -183,8 +184,27 @@ export type UserInput = ( functions?: (originalImplementation: RecipeInterface) => RecipeInterface; }; linkClickedScreenFeature?: PasswordlessFeatureBaseConfig; + mfaFeature?: PasswordlessFeatureBaseConfig; } & AuthRecipeModuleUserInput; +export type MFAProps = { + recipeImplementation: RecipeImplementation; + config: NormalisedConfig; + contactMethod: "EMAIL" | "PHONE"; + onBackButtonClicked: () => void; + onSignOutClicked: () => void; + onFactorChooserButtonClicked: () => void; + onSuccess?: () => void; + dispatch: Dispatch; + featureState: { + isSetupAllowed: boolean; + loginAttemptInfo?: LoginAttemptInfo; + loaded: boolean; + successInAnotherTab: boolean; + error: string | undefined; + }; + userContext?: any; +}; export type SignInUpProps = { recipeImplementation: RecipeImplementation; config: NormalisedConfig; @@ -307,7 +327,42 @@ export type SignInUpState = { successInAnotherTab: boolean; }; +export type MFAAction = + | { + type: "load"; + loginAttemptInfo: LoginAttemptInfo | undefined; + isAllowedToSetup: boolean; + error: string | undefined; + } + | { + type: "startLogin"; + loginAttemptInfo: LoginAttemptInfo; + } + | { + type: "resendCode"; + timestamp: number; + } + | { + type: "restartFlow"; + error: string | undefined; + } + | { + type: "setError"; + error: string | undefined; + } + | { + type: "successInAnotherTab"; + }; +export type MFAState = { + error: string | undefined; + loaded: boolean; + loginAttemptInfo: LoginAttemptInfo | undefined; + isSetupAllowed: boolean; + successInAnotherTab: boolean; +}; + export type SignInUpChildProps = Omit; +export type MFAChildProps = Omit; export type LinkSentThemeProps = { clearError: () => void; @@ -330,6 +385,31 @@ export type UserInputCodeFormHeaderProps = { config: NormalisedConfig; }; +export type MFAFooterProps = { + isSetupAllowed: boolean; + onSignOutClicked: () => void; + onFactorChooserButtonClicked: () => void; + recipeImplementation: RecipeImplementation; + config: NormalisedConfig; +}; + +export type MFAOTPFooterProps = { + isSetupAllowed: boolean; + onSignOutClicked: () => void; + onFactorChooserButtonClicked: () => void; + loginAttemptInfo: LoginAttemptInfo; + recipeImplementation: RecipeImplementation; + config: NormalisedConfig; +}; + +export type MFAOTPHeaderProps = { + isSetupAllowed: boolean; + onBackButtonClicked: () => void; + loginAttemptInfo: LoginAttemptInfo; + recipeImplementation: RecipeImplementation; + config: NormalisedConfig; +}; + export type ComponentOverrideMap = { PasswordlessSignInUpHeader_Override?: ComponentOverride; PasswordlessSignInUpFooter_Override?: ComponentOverride; diff --git a/lib/ts/recipe/passwordless/utils.ts b/lib/ts/recipe/passwordless/utils.ts index d1bc38892..cc5d40eeb 100644 --- a/lib/ts/recipe/passwordless/utils.ts +++ b/lib/ts/recipe/passwordless/utils.ts @@ -71,6 +71,7 @@ export function normalisePasswordlessConfig(config: Config): NormalisedConfig { signInUpFeature, linkClickedScreenFeature: normalisePasswordlessBaseConfig(config.linkClickedScreenFeature), + mfaFeature: normalisePasswordlessBaseConfig(config.mfaFeature), contactMethod: config.contactMethod, diff --git a/lib/ts/recipe/thirdpartypasswordless/components/themes/signInUp/index.tsx b/lib/ts/recipe/thirdpartypasswordless/components/themes/signInUp/index.tsx index 0a926ee3c..e637fca7e 100644 --- a/lib/ts/recipe/thirdpartypasswordless/components/themes/signInUp/index.tsx +++ b/lib/ts/recipe/thirdpartypasswordless/components/themes/signInUp/index.tsx @@ -136,15 +136,19 @@ const SignInUpTheme: React.FC Date: Mon, 30 Oct 2023 13:35:59 +0100 Subject: [PATCH 09/35] feat: add back button to factor chooser and filter the options --- lib/build/emailpassword-shared6.js | 66 +- lib/build/emailpassword-shared7.js | 741 +---------------- lib/build/emailpassword-shared8.js | 774 ++++++++++++++++++ lib/build/emailpasswordprebuiltui.js | 3 +- lib/build/emailverification-shared2.js | 2 +- lib/build/multifactorauth-shared2.js | 44 +- lib/build/multifactorauth.js | 53 +- lib/build/multifactorauthprebuiltui.js | 157 ++-- lib/build/passwordless-shared3.js | 4 +- lib/build/passwordlessprebuiltui.js | 2 +- .../factorChooser/factorChooserHeader.d.ts | 5 +- lib/build/recipe/multifactorauth/types.d.ts | 2 + .../thirdpartyemailpasswordprebuiltui.js | 5 +- lib/build/thirdpartypasswordlessprebuiltui.js | 4 +- .../resetPasswordEmail.tsx | 2 +- .../components/themes/styles.css | 2 +- .../features/factorChooser/index.tsx | 51 +- .../factorChooser/factorChooserHeader.tsx | 20 +- .../components/themes/factorChooser/index.tsx | 35 +- lib/ts/recipe/multifactorauth/types.ts | 2 + 20 files changed, 1040 insertions(+), 934 deletions(-) create mode 100644 lib/build/emailpassword-shared8.js diff --git a/lib/build/emailpassword-shared6.js b/lib/build/emailpassword-shared6.js index 56d214fab..2916a01a4 100644 --- a/lib/build/emailpassword-shared6.js +++ b/lib/build/emailpassword-shared6.js @@ -10,8 +10,9 @@ var React = require("react"); var translations = require("./translations.js"); var translations$1 = require("./emailverification-shared2.js"); var translationContext = require("./translationContext.js"); +var backButton = require("./emailpassword-shared7.js"); var arrowLeftIcon = require("./arrowLeftIcon.js"); -var formBase = require("./emailpassword-shared7.js"); +var formBase = require("./emailpassword-shared8.js"); var generalError = require("./emailpassword-shared.js"); var STGeneralError = require("supertokens-web-js/utils/error"); var button = require("./emailpassword-shared2.js"); @@ -56,63 +57,6 @@ var React__namespace = /*#__PURE__*/ _interopNamespace(React); var STGeneralError__default = /*#__PURE__*/ _interopDefault(STGeneralError); var STGeneralError__default$1 = /*#__PURE__*/ _interopDefault(STGeneralError$1); -/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. - * - * This software is licensed under the Apache License, Version 2.0 (the - * "License") as published by the Apache Software Foundation. - * - * You may not use this file except in compliance with the License. You may - * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -/* - * Imports. - */ -/* - * Component. - */ -function HeavyArrowLeftIcon(_a) { - var color = _a.color; - return jsxRuntime.jsx( - "svg", - genericComponentOverrideContext.__assign( - { - xmlns: "http://www.w3.org/2000/svg", - width: "16", - height: "13", - viewBox: "0 0 16 13", - "data-supertokens": "heavyArrowLeftIcon", - }, - { - children: jsxRuntime.jsx("path", { - fill: color, - d: "M13 6.8h.022H3.8l2.9 2.9a.761.761 0 0 1 0 1.07l-.451.451a.754.754 0 0 1-1.064 0L.22 6.254a.759.759 0 0 1 0-1.068L5.186.22a.755.755 0 0 1 1.064 0l.45.451a.746.746 0 0 1 .22.532.724.724 0 0 1-.22.522l-2.93 2.92h9.24a.781.781 0 0 1 .764.773v.638A.766.766 0 0 1 13 6.8z", - transform: "translate(1.182 .708)", - }), - } - ) - ); -} - -/* - * Component. - */ -function BackButton(_a) { - var onClick = _a.onClick; - return jsxRuntime.jsx( - "button", - genericComponentOverrideContext.__assign( - { onClick: onClick, "data-supertokens": "backButton backButtonCommon" }, - { children: jsxRuntime.jsx(HeavyArrowLeftIcon, { color: "rgb(var(--palette-textTitle))" }) } - ) - ); -} - /* * Component. */ @@ -212,10 +156,12 @@ var EmailPasswordResetPasswordEmail = function (props) { jsxRuntime.jsxs( "div", genericComponentOverrideContext.__assign( - { "data-supertokens": "headerTitle resetPasswordHeaderTitle" }, + { "data-supertokens": "headerTitle withBackButton" }, { children: [ - jsxRuntime.jsx(BackButton, { onClick: props.onBackButtonClicked }), + jsxRuntime.jsx(backButton.BackButton, { + onClick: props.onBackButtonClicked, + }), t("EMAIL_PASSWORD_RESET_HEADER_TITLE"), jsxRuntime.jsx("span", { "data-supertokens": "backButtonPlaceholder backButtonCommon", diff --git a/lib/build/emailpassword-shared7.js b/lib/build/emailpassword-shared7.js index 6415dc169..d2336cadd 100644 --- a/lib/build/emailpassword-shared7.js +++ b/lib/build/emailpassword-shared7.js @@ -2,33 +2,6 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); var jsxRuntime = require("react/jsx-runtime"); -var React = require("react"); -var STGeneralError = require("supertokens-web-js/utils/error"); -var validators = require("./emailpassword-shared5.js"); -var button = require("./emailpassword-shared2.js"); -require("./index2.js"); -var translationContext = require("./translationContext.js"); - -function _interopDefault(e) { - return e && e.__esModule ? e : { default: e }; -} - -var STGeneralError__default = /*#__PURE__*/ _interopDefault(STGeneralError); - -/* - * Component. - */ -function FormRow(_a) { - var children = _a.children, - hasError = _a.hasError; - return jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": ["formRow", hasError ? "hasError" : ""].join(" ") }, - { children: children } - ) - ); -} /* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. * @@ -50,725 +23,41 @@ function FormRow(_a) { /* * Component. */ -function CheckedIcon() { +function HeavyArrowLeftIcon(_a) { + var color = _a.color; return jsxRuntime.jsx( "svg", genericComponentOverrideContext.__assign( { xmlns: "http://www.w3.org/2000/svg", - width: "14.862", - height: "12.033", - viewBox: "0 0 14.862 12.033", - "data-supertokens": "checkedIcon", + width: "16", + height: "13", + viewBox: "0 0 16 13", + "data-supertokens": "heavyArrowLeftIcon", }, { children: jsxRuntime.jsx("path", { - fill: "rgb(var(--palette-primary))", - d: "M12.629 49L5.06 56.572l-2.829-2.829L0 55.977l5.057 5.057.654-.651 9.152-9.152z", - transform: "translate(0 -49)", - }), - } - ) - ); -} - -/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. - * - * This software is licensed under the Apache License, Version 2.0 (the - * "License") as published by the Apache Software Foundation. - * - * You may not use this file except in compliance with the License. You may - * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -/* - * Imports. - */ -/* - * Component. - */ -function ErrorIcon() { - return jsxRuntime.jsx( - "svg", - genericComponentOverrideContext.__assign( - { - xmlns: "http://www.w3.org/2000/svg", - width: "17", - height: "15", - viewBox: "0 0 17 15", - "data-supertokens": "errorIcon", - }, - { - children: jsxRuntime.jsxs("g", { - children: [ - jsxRuntime.jsx( - "g", - genericComponentOverrideContext.__assign( - { className: "Asdf", fill: "rgb(var(--palette-error))" }, - { - children: jsxRuntime.jsx("path", { - d: "M13.568 14.75H3.432c-.63 0-1.195-.325-1.512-.869-.317-.544-.32-1.196-.01-1.744l5.067-8.943c.315-.556.884-.887 1.523-.887.639 0 1.208.331 1.523.887l5.067 8.943c.31.548.307 1.2-.01 1.744s-.882.869-1.512.869z", - transform: "translate(-824.894 -352.829) translate(824.894 352.829)", - }), - } - ) - ), - jsxRuntime.jsx( - "text", - genericComponentOverrideContext.__assign( - { - fill: "#fff", - fontSize: "10px", - fontWeight: "700", - transform: "translate(-824.894 -352.829) translate(832.014 365.198)", - }, - { - children: jsxRuntime.jsx( - "tspan", - genericComponentOverrideContext.__assign({ x: "0", y: "0" }, { children: "!" }) - ), - } - ) - ), - ], + fill: color, + d: "M13 6.8h.022H3.8l2.9 2.9a.761.761 0 0 1 0 1.07l-.451.451a.754.754 0 0 1-1.064 0L.22 6.254a.759.759 0 0 1 0-1.068L5.186.22a.755.755 0 0 1 1.064 0l.45.451a.746.746 0 0 1 .22.532.724.724 0 0 1-.22.522l-2.93 2.92h9.24a.781.781 0 0 1 .764.773v.638A.766.766 0 0 1 13 6.8z", + transform: "translate(1.182 .708)", }), } ) ); } -/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. - * - * This software is licensed under the Apache License, Version 2.0 (the - * "License") as published by the Apache Software Foundation. - * - * You may not use this file except in compliance with the License. You may - * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -/* - * Imports. - */ /* * Component. */ -function ShowPasswordIcon(_a) { - var showPassword = _a.showPassword; - if (showPassword === true) { - return jsxRuntime.jsx("div", { - children: jsxRuntime.jsx( - "svg", - genericComponentOverrideContext.__assign( - { - xmlns: "http://www.w3.org/2000/svg", - width: "18.391", - height: "16.276", - viewBox: "0 0 18.391 16.276", - "data-supertokens": "showPasswordIcon show", - }, - { - children: jsxRuntime.jsxs("g", { - children: [ - jsxRuntime.jsx("g", { - children: jsxRuntime.jsx("g", { - children: jsxRuntime.jsx("g", { - children: jsxRuntime.jsx("path", { - fill: "rgb(var(--palette-textPrimary))", - d: "M29.289 100.33c-2.4-3.63-5.619-5.63-9.069-5.63s-6.67 2-9.069 5.63a.767.767 0 0 0 0 .845c2.4 3.63 5.619 5.63 9.069 5.63s6.67-2 9.069-5.63a.767.767 0 0 0 0-.845zm-9.069 4.944c-2.785 0-5.435-1.6-7.5-4.519 2.065-2.92 4.715-4.519 7.5-4.519s5.435 1.6 7.5 4.519c-2.064 2.92-4.711 4.519-7.5 4.519z", - transform: - "translate(-822 -420.048) translate(822 422.035) translate(-11.025 -94.7)", - }), - }), - }), - }), - jsxRuntime.jsxs( - "g", - genericComponentOverrideContext.__assign( - { - fill: "rgb(var(--palette-textPrimary))", - stroke: "rgb(var(--palette-inputBackground))", - transform: "translate(-822 -420.048) translate(827.164 424.055)", - }, - { - children: [ - jsxRuntime.jsx("circle", { - cx: "4.036", - cy: "4.036", - r: "4.036", - stroke: "none", - }), - jsxRuntime.jsx("circle", { - cx: "4.036", - cy: "4.036", - r: "3.536", - fill: "none", - }), - ], - } - ) - ), - jsxRuntime.jsx("path", { - fill: "none", - stroke: "#707070", - strokeLinecap: "round", - strokeWidth: "2.25px", - d: "M11.981 0L0 11.981", - transform: "translate(-822 -420.048) translate(825.084 421.639)", - }), - jsxRuntime.jsx("path", { - fill: "none", - stroke: "rgb(var(--palette-inputBackground))", - strokeLinecap: "round", - d: "M13.978 0L0 13.978", - transform: "translate(-822 -420.048) translate(825.084 421.639)", - }), - ], - }), - } - ) - ), - }); - } - return jsxRuntime.jsx("div", { - children: jsxRuntime.jsx( - "svg", - genericComponentOverrideContext.__assign( - { - xmlns: "http://www.w3.org/2000/svg", - width: "18.281", - height: "12.033", - viewBox: "0 0 18.281 12.033", - "data-supertokens": "showPasswordIcon hide", - }, - { - children: jsxRuntime.jsxs("g", { - children: [ - jsxRuntime.jsx("g", { - children: jsxRuntime.jsx("g", { - children: jsxRuntime.jsx("g", { - children: jsxRuntime.jsx("path", { - fill: "rgb(var(--palette-textPrimary))", - d: "M29.18 100.3c-2.384-3.608-5.586-5.6-9.015-5.6s-6.63 1.989-9.015 5.6a.763.763 0 0 0 0 .84c2.384 3.608 5.586 5.6 9.015 5.6s6.63-1.989 9.015-5.6a.763.763 0 0 0 0-.84zm-9.015 4.914c-2.769 0-5.4-1.589-7.459-4.492 2.052-2.9 4.686-4.492 7.459-4.492s5.4 1.589 7.459 4.492c-2.056 2.899-4.686 4.489-7.458 4.489z", - transform: - "translate(-822 -422.088) translate(822 422.088) translate(-11.025 -94.7)", - }), - }), - }), - }), - jsxRuntime.jsxs( - "g", - genericComponentOverrideContext.__assign( - { - fill: "rgb(var(--palette-textPrimary))", - stroke: "rgb(var(--palette-inputBackground))", - transform: "translate(-822 -422.088) translate(827.133 424.096)", - }, - { - children: [ - jsxRuntime.jsx("circle", { - cx: "4.012", - cy: "4.012", - r: "4.012", - stroke: "none", - }), - jsxRuntime.jsx("circle", { - cx: "4.012", - cy: "4.012", - r: "3.512", - fill: "none", - }), - ], - } - ) - ), - ], - }), - } - ) - ), - }); -} - -var Input = function (_a) { - var type = _a.type, - name = _a.name, - hasError = _a.hasError, - autoComplete = _a.autoComplete, - onInputFocus = _a.onInputFocus, - onInputBlur = _a.onInputBlur, - onChange = _a.onChange, - value = _a.value, - placeholder = _a.placeholder, - validated = _a.validated, - autofocus = _a.autofocus; - var t = translationContext.useTranslation(); - var _b = React.useState(false), - showPassword = _b[0], - setShowPassword = _b[1]; - /* - * Method. - */ - function handleFocus() { - if (onInputFocus !== undefined) { - onInputFocus({ - id: name, - value: value, - }); - } - } - function handleBlur() { - if (onInputBlur !== undefined) { - onInputBlur({ - id: name, - value: value, - }); - } - } - function handleChange(event) { - if (onChange) { - onChange({ - id: name, - value: event.target.value, - }); - } - } - if (autoComplete === undefined) { - autoComplete = "off"; - } - var inputType = type; - if (type === "password" && showPassword === true) { - inputType = "text"; - } +function BackButton(_a) { + var onClick = _a.onClick; return jsxRuntime.jsx( - "div", + "button", genericComponentOverrideContext.__assign( - { "data-supertokens": "inputContainer" }, - { - children: jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": ["inputWrapper", hasError ? "inputError" : ""].join(" ") }, - { - children: [ - jsxRuntime.jsx("input", { - autoFocus: autofocus, - autoComplete: autoComplete, - "data-supertokens": "input", - className: "supertokens-input", - onFocus: handleFocus, - onBlur: handleBlur, - type: inputType, - name: name, - placeholder: t(placeholder), - onChange: handleChange, - value: value, - }), - hasError === true && - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "inputAdornment inputAdornmentError" }, - { children: jsxRuntime.jsx(ErrorIcon, {}) } - ) - ), - validated === true && - hasError === false && - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "inputAdornment inputAdornmentSuccess" }, - { children: jsxRuntime.jsx(CheckedIcon, {}) } - ) - ), - type === "password" && - value.length > 0 && - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { - onClick: function () { - return setShowPassword(showPassword === false); - }, - "data-supertokens": "inputAdornment showPassword", - }, - { - children: jsxRuntime.jsx(ShowPasswordIcon, { - showPassword: showPassword, - }), - } - ) - ), - ], - } - ) - ), - } + { onClick: onClick, "data-supertokens": "backButton backButtonCommon" }, + { children: jsxRuntime.jsx(HeavyArrowLeftIcon, { color: "rgb(var(--palette-textTitle))" }) } ) ); -}; - -function InputError(_a) { - var error = _a.error; - var t = translationContext.useTranslation(); - return jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign({ "data-supertokens": "inputErrorMessage" }, { children: t(error) }) - ); } -function Label(_a) { - var value = _a.value, - showIsRequired = _a.showIsRequired; - var t = translationContext.useTranslation(); - return jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "label" }, - { children: [t(value), showIsRequired && " *"] } - ) - ); -} - -var FormBase = function (props) { - var footer = props.footer, - buttonLabel = props.buttonLabel, - showLabels = props.showLabels, - validateOnBlur = props.validateOnBlur, - formFields = props.formFields; - var unmounting = React.useRef(new AbortController()); - React.useEffect( - function () { - // We need this because in some cases this gets called multiple times - unmounting.current = new AbortController(); - return function () { - unmounting.current.abort(); - }; - }, - [unmounting] - ); - var _a = React.useState( - props.formFields.map(function (f) { - return { id: f.id, value: "" }; - }) - ), - fieldStates = _a[0], - setFieldStates = _a[1]; - var _b = React.useState(false), - isLoading = _b[0], - setIsLoading = _b[1]; - var updateFieldState = React.useCallback( - function (id, update) { - setFieldStates(function (os) { - var field = os.find(function (f) { - return f.id === id; - }); - if (field === undefined) { - return genericComponentOverrideContext.__spreadArray( - genericComponentOverrideContext.__spreadArray([], os, true), - [update({ id: id, value: "" })], - false - ); - } - return os - .filter(function (f) { - return f !== field; - }) - .concat(update(field)); - }); - }, - [setFieldStates] - ); - var onInputFocus = React.useCallback( - function (field) { - updateFieldState(field.id, function (os) { - return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, os), { - validated: false, - }); - }); - }, - [updateFieldState] - ); - var onInputBlur = React.useCallback( - function (field) { - return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () { - var fieldConfig, error, _a; - return genericComponentOverrideContext.__generator(this, function (_b) { - switch (_b.label) { - case 0: - if (!validateOnBlur) { - return [2 /*return*/]; - } - fieldConfig = props.formFields.find(function (f) { - return f.id === field.id; - }); - if (!(fieldConfig && field.value !== "")) return [3 /*break*/, 2]; - return [4 /*yield*/, fieldConfig.validate(field.value)]; - case 1: - _a = _b.sent(); - return [3 /*break*/, 3]; - case 2: - _a = undefined; - _b.label = 3; - case 3: - error = _a; - updateFieldState(field.id, function (os) { - return genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, os), - { error: error, validated: error === undefined && field.value.length !== 0 } - ); - }); - return [2 /*return*/]; - } - }); - }); - }, - [validateOnBlur, updateFieldState, props.formFields] - ); - var onInputChange = React.useCallback( - function (field) { - updateFieldState(field.id, function (os) { - return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, os), { - value: field.value, - error: undefined, - }); - }); - props.clearError(); - }, - [updateFieldState] - ); - var onFormSubmit = React.useCallback( - function (e) { - return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () { - var apiFields, fieldUpdates, result, generalError, e_1, _loop_1, _i, formFields_1, field, errorFields_1; - return genericComponentOverrideContext.__generator(this, function (_a) { - switch (_a.label) { - case 0: - // Prevent default event propagation. - e.preventDefault(); - // Set loading state. - setIsLoading(true); - setFieldStates(function (os) { - return os.map(function (fs) { - return genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, fs), - { error: undefined } - ); - }); - }); - apiFields = formFields.map(function (field) { - var fieldState = fieldStates.find(function (fs) { - return fs.id === field.id; - }); - return { - id: field.id, - value: fieldState === undefined ? "" : fieldState.value, - }; - }); - fieldUpdates = []; - _a.label = 1; - case 1: - _a.trys.push([1, 6, 7, 8]); - result = void 0; - generalError = void 0; - _a.label = 2; - case 2: - _a.trys.push([2, 4, , 5]); - return [ - 4 /*yield*/, - props.callAPI(apiFields, function (id, value) { - return fieldUpdates.push({ id: id, value: value }); - }), - ]; - case 3: - result = _a.sent(); - return [3 /*break*/, 5]; - case 4: - e_1 = _a.sent(); - if (STGeneralError__default.default.isThisError(e_1)) { - generalError = e_1; - } else { - throw e_1; - } - return [3 /*break*/, 5]; - case 5: - if (unmounting.current.signal.aborted) { - return [2 /*return*/]; - } - _loop_1 = function (field) { - var update = fieldUpdates.find(function (f) { - return f.id === field.id; - }); - if (update || field.clearOnSubmit === true) { - // We can do these one by one, it's almost never more than one field - updateFieldState(field.id, function (os) { - return genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, os), - { value: update ? update.value : "" } - ); - }); - } - }; - for (_i = 0, formFields_1 = formFields; _i < formFields_1.length; _i++) { - field = formFields_1[_i]; - _loop_1(field); - } - if (generalError !== undefined) { - props.onError(generalError.message); - } else { - // If successful - if (result.status === "OK") { - setIsLoading(false); - props.clearError(); - if (props.onSuccess !== undefined) { - props.onSuccess(result); - } - } - if (unmounting.current.signal.aborted) { - return [2 /*return*/]; - } - // If field error. - if (result.status === "FIELD_ERROR") { - errorFields_1 = result.formFields; - setFieldStates(function (os) { - return os.map(function (fs) { - var _a; - return genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, fs), - { - error: - (_a = errorFields_1.find(function (ef) { - return ef.id === fs.id; - })) === null || _a === void 0 - ? void 0 - : _a.error, - } - ); - }); - }); - } - } - return [3 /*break*/, 8]; - case 6: - _a.sent(); - props.onError("SOMETHING_WENT_WRONG_ERROR"); - return [3 /*break*/, 8]; - case 7: - setIsLoading(false); - return [7 /*endfinally*/]; - case 8: - return [2 /*return*/]; - } - }); - }); - }, - [setIsLoading, setFieldStates, props, formFields, fieldStates] - ); - return jsxRuntime.jsxs( - "form", - genericComponentOverrideContext.__assign( - { autoComplete: "on", noValidate: true, onSubmit: onFormSubmit }, - { - children: [ - formFields.map(function (field) { - var type = "text"; - // If email or password, replace field type. - if (validators.MANDATORY_FORM_FIELDS_ID_ARRAY.includes(field.id)) { - type = field.id; - } - if (field.id === "confirm-password") { - type = "password"; - } - var fstate = fieldStates.find(function (s) { - return s.id === field.id; - }) || { - id: field.id, - validated: false, - error: undefined, - value: "", - }; - return jsxRuntime.jsx( - FormRow, - genericComponentOverrideContext.__assign( - { hasError: fstate.error !== undefined }, - { - children: jsxRuntime.jsxs(React.Fragment, { - children: [ - showLabels && - (field.labelComponent !== undefined - ? field.labelComponent - : jsxRuntime.jsx(Label, { - value: field.label, - showIsRequired: field.showIsRequired, - })), - field.inputComponent !== undefined - ? jsxRuntime.jsx(field.inputComponent, { - type: type, - name: field.id, - validated: fstate.validated === true, - placeholder: field.placeholder, - value: fstate.value, - autoComplete: field.autoComplete, - autofocus: field.autofocus, - onInputFocus: onInputFocus, - onInputBlur: onInputBlur, - onChange: onInputChange, - hasError: fstate.error !== undefined, - }) - : jsxRuntime.jsx(Input, { - type: type, - name: field.id, - validated: fstate.validated === true, - placeholder: field.placeholder, - value: fstate.value, - autoComplete: field.autoComplete, - onInputFocus: onInputFocus, - onInputBlur: onInputBlur, - onChange: onInputChange, - autofocus: field.autofocus, - hasError: fstate.error !== undefined, - }), - fstate.error && jsxRuntime.jsx(InputError, { error: fstate.error }), - ], - }), - } - ), - field.id - ); - }), - jsxRuntime.jsx( - FormRow, - { - children: jsxRuntime.jsxs(React.Fragment, { - children: [ - jsxRuntime.jsx(button.Button, { - disabled: isLoading, - isLoading: isLoading, - type: "submit", - label: buttonLabel, - }), - footer, - ], - }), - }, - "form-button" - ), - ], - } - ) - ); -}; - -exports.ErrorIcon = ErrorIcon; -exports.FormBase = FormBase; -exports.FormRow = FormRow; -exports.Label = Label; +exports.BackButton = BackButton; diff --git a/lib/build/emailpassword-shared8.js b/lib/build/emailpassword-shared8.js new file mode 100644 index 000000000..6415dc169 --- /dev/null +++ b/lib/build/emailpassword-shared8.js @@ -0,0 +1,774 @@ +"use strict"; + +var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); +var jsxRuntime = require("react/jsx-runtime"); +var React = require("react"); +var STGeneralError = require("supertokens-web-js/utils/error"); +var validators = require("./emailpassword-shared5.js"); +var button = require("./emailpassword-shared2.js"); +require("./index2.js"); +var translationContext = require("./translationContext.js"); + +function _interopDefault(e) { + return e && e.__esModule ? e : { default: e }; +} + +var STGeneralError__default = /*#__PURE__*/ _interopDefault(STGeneralError); + +/* + * Component. + */ +function FormRow(_a) { + var children = _a.children, + hasError = _a.hasError; + return jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": ["formRow", hasError ? "hasError" : ""].join(" ") }, + { children: children } + ) + ); +} + +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +/* + * Imports. + */ +/* + * Component. + */ +function CheckedIcon() { + return jsxRuntime.jsx( + "svg", + genericComponentOverrideContext.__assign( + { + xmlns: "http://www.w3.org/2000/svg", + width: "14.862", + height: "12.033", + viewBox: "0 0 14.862 12.033", + "data-supertokens": "checkedIcon", + }, + { + children: jsxRuntime.jsx("path", { + fill: "rgb(var(--palette-primary))", + d: "M12.629 49L5.06 56.572l-2.829-2.829L0 55.977l5.057 5.057.654-.651 9.152-9.152z", + transform: "translate(0 -49)", + }), + } + ) + ); +} + +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +/* + * Imports. + */ +/* + * Component. + */ +function ErrorIcon() { + return jsxRuntime.jsx( + "svg", + genericComponentOverrideContext.__assign( + { + xmlns: "http://www.w3.org/2000/svg", + width: "17", + height: "15", + viewBox: "0 0 17 15", + "data-supertokens": "errorIcon", + }, + { + children: jsxRuntime.jsxs("g", { + children: [ + jsxRuntime.jsx( + "g", + genericComponentOverrideContext.__assign( + { className: "Asdf", fill: "rgb(var(--palette-error))" }, + { + children: jsxRuntime.jsx("path", { + d: "M13.568 14.75H3.432c-.63 0-1.195-.325-1.512-.869-.317-.544-.32-1.196-.01-1.744l5.067-8.943c.315-.556.884-.887 1.523-.887.639 0 1.208.331 1.523.887l5.067 8.943c.31.548.307 1.2-.01 1.744s-.882.869-1.512.869z", + transform: "translate(-824.894 -352.829) translate(824.894 352.829)", + }), + } + ) + ), + jsxRuntime.jsx( + "text", + genericComponentOverrideContext.__assign( + { + fill: "#fff", + fontSize: "10px", + fontWeight: "700", + transform: "translate(-824.894 -352.829) translate(832.014 365.198)", + }, + { + children: jsxRuntime.jsx( + "tspan", + genericComponentOverrideContext.__assign({ x: "0", y: "0" }, { children: "!" }) + ), + } + ) + ), + ], + }), + } + ) + ); +} + +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +/* + * Imports. + */ +/* + * Component. + */ +function ShowPasswordIcon(_a) { + var showPassword = _a.showPassword; + if (showPassword === true) { + return jsxRuntime.jsx("div", { + children: jsxRuntime.jsx( + "svg", + genericComponentOverrideContext.__assign( + { + xmlns: "http://www.w3.org/2000/svg", + width: "18.391", + height: "16.276", + viewBox: "0 0 18.391 16.276", + "data-supertokens": "showPasswordIcon show", + }, + { + children: jsxRuntime.jsxs("g", { + children: [ + jsxRuntime.jsx("g", { + children: jsxRuntime.jsx("g", { + children: jsxRuntime.jsx("g", { + children: jsxRuntime.jsx("path", { + fill: "rgb(var(--palette-textPrimary))", + d: "M29.289 100.33c-2.4-3.63-5.619-5.63-9.069-5.63s-6.67 2-9.069 5.63a.767.767 0 0 0 0 .845c2.4 3.63 5.619 5.63 9.069 5.63s6.67-2 9.069-5.63a.767.767 0 0 0 0-.845zm-9.069 4.944c-2.785 0-5.435-1.6-7.5-4.519 2.065-2.92 4.715-4.519 7.5-4.519s5.435 1.6 7.5 4.519c-2.064 2.92-4.711 4.519-7.5 4.519z", + transform: + "translate(-822 -420.048) translate(822 422.035) translate(-11.025 -94.7)", + }), + }), + }), + }), + jsxRuntime.jsxs( + "g", + genericComponentOverrideContext.__assign( + { + fill: "rgb(var(--palette-textPrimary))", + stroke: "rgb(var(--palette-inputBackground))", + transform: "translate(-822 -420.048) translate(827.164 424.055)", + }, + { + children: [ + jsxRuntime.jsx("circle", { + cx: "4.036", + cy: "4.036", + r: "4.036", + stroke: "none", + }), + jsxRuntime.jsx("circle", { + cx: "4.036", + cy: "4.036", + r: "3.536", + fill: "none", + }), + ], + } + ) + ), + jsxRuntime.jsx("path", { + fill: "none", + stroke: "#707070", + strokeLinecap: "round", + strokeWidth: "2.25px", + d: "M11.981 0L0 11.981", + transform: "translate(-822 -420.048) translate(825.084 421.639)", + }), + jsxRuntime.jsx("path", { + fill: "none", + stroke: "rgb(var(--palette-inputBackground))", + strokeLinecap: "round", + d: "M13.978 0L0 13.978", + transform: "translate(-822 -420.048) translate(825.084 421.639)", + }), + ], + }), + } + ) + ), + }); + } + return jsxRuntime.jsx("div", { + children: jsxRuntime.jsx( + "svg", + genericComponentOverrideContext.__assign( + { + xmlns: "http://www.w3.org/2000/svg", + width: "18.281", + height: "12.033", + viewBox: "0 0 18.281 12.033", + "data-supertokens": "showPasswordIcon hide", + }, + { + children: jsxRuntime.jsxs("g", { + children: [ + jsxRuntime.jsx("g", { + children: jsxRuntime.jsx("g", { + children: jsxRuntime.jsx("g", { + children: jsxRuntime.jsx("path", { + fill: "rgb(var(--palette-textPrimary))", + d: "M29.18 100.3c-2.384-3.608-5.586-5.6-9.015-5.6s-6.63 1.989-9.015 5.6a.763.763 0 0 0 0 .84c2.384 3.608 5.586 5.6 9.015 5.6s6.63-1.989 9.015-5.6a.763.763 0 0 0 0-.84zm-9.015 4.914c-2.769 0-5.4-1.589-7.459-4.492 2.052-2.9 4.686-4.492 7.459-4.492s5.4 1.589 7.459 4.492c-2.056 2.899-4.686 4.489-7.458 4.489z", + transform: + "translate(-822 -422.088) translate(822 422.088) translate(-11.025 -94.7)", + }), + }), + }), + }), + jsxRuntime.jsxs( + "g", + genericComponentOverrideContext.__assign( + { + fill: "rgb(var(--palette-textPrimary))", + stroke: "rgb(var(--palette-inputBackground))", + transform: "translate(-822 -422.088) translate(827.133 424.096)", + }, + { + children: [ + jsxRuntime.jsx("circle", { + cx: "4.012", + cy: "4.012", + r: "4.012", + stroke: "none", + }), + jsxRuntime.jsx("circle", { + cx: "4.012", + cy: "4.012", + r: "3.512", + fill: "none", + }), + ], + } + ) + ), + ], + }), + } + ) + ), + }); +} + +var Input = function (_a) { + var type = _a.type, + name = _a.name, + hasError = _a.hasError, + autoComplete = _a.autoComplete, + onInputFocus = _a.onInputFocus, + onInputBlur = _a.onInputBlur, + onChange = _a.onChange, + value = _a.value, + placeholder = _a.placeholder, + validated = _a.validated, + autofocus = _a.autofocus; + var t = translationContext.useTranslation(); + var _b = React.useState(false), + showPassword = _b[0], + setShowPassword = _b[1]; + /* + * Method. + */ + function handleFocus() { + if (onInputFocus !== undefined) { + onInputFocus({ + id: name, + value: value, + }); + } + } + function handleBlur() { + if (onInputBlur !== undefined) { + onInputBlur({ + id: name, + value: value, + }); + } + } + function handleChange(event) { + if (onChange) { + onChange({ + id: name, + value: event.target.value, + }); + } + } + if (autoComplete === undefined) { + autoComplete = "off"; + } + var inputType = type; + if (type === "password" && showPassword === true) { + inputType = "text"; + } + return jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "inputContainer" }, + { + children: jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": ["inputWrapper", hasError ? "inputError" : ""].join(" ") }, + { + children: [ + jsxRuntime.jsx("input", { + autoFocus: autofocus, + autoComplete: autoComplete, + "data-supertokens": "input", + className: "supertokens-input", + onFocus: handleFocus, + onBlur: handleBlur, + type: inputType, + name: name, + placeholder: t(placeholder), + onChange: handleChange, + value: value, + }), + hasError === true && + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "inputAdornment inputAdornmentError" }, + { children: jsxRuntime.jsx(ErrorIcon, {}) } + ) + ), + validated === true && + hasError === false && + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "inputAdornment inputAdornmentSuccess" }, + { children: jsxRuntime.jsx(CheckedIcon, {}) } + ) + ), + type === "password" && + value.length > 0 && + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { + onClick: function () { + return setShowPassword(showPassword === false); + }, + "data-supertokens": "inputAdornment showPassword", + }, + { + children: jsxRuntime.jsx(ShowPasswordIcon, { + showPassword: showPassword, + }), + } + ) + ), + ], + } + ) + ), + } + ) + ); +}; + +function InputError(_a) { + var error = _a.error; + var t = translationContext.useTranslation(); + return jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign({ "data-supertokens": "inputErrorMessage" }, { children: t(error) }) + ); +} + +function Label(_a) { + var value = _a.value, + showIsRequired = _a.showIsRequired; + var t = translationContext.useTranslation(); + return jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "label" }, + { children: [t(value), showIsRequired && " *"] } + ) + ); +} + +var FormBase = function (props) { + var footer = props.footer, + buttonLabel = props.buttonLabel, + showLabels = props.showLabels, + validateOnBlur = props.validateOnBlur, + formFields = props.formFields; + var unmounting = React.useRef(new AbortController()); + React.useEffect( + function () { + // We need this because in some cases this gets called multiple times + unmounting.current = new AbortController(); + return function () { + unmounting.current.abort(); + }; + }, + [unmounting] + ); + var _a = React.useState( + props.formFields.map(function (f) { + return { id: f.id, value: "" }; + }) + ), + fieldStates = _a[0], + setFieldStates = _a[1]; + var _b = React.useState(false), + isLoading = _b[0], + setIsLoading = _b[1]; + var updateFieldState = React.useCallback( + function (id, update) { + setFieldStates(function (os) { + var field = os.find(function (f) { + return f.id === id; + }); + if (field === undefined) { + return genericComponentOverrideContext.__spreadArray( + genericComponentOverrideContext.__spreadArray([], os, true), + [update({ id: id, value: "" })], + false + ); + } + return os + .filter(function (f) { + return f !== field; + }) + .concat(update(field)); + }); + }, + [setFieldStates] + ); + var onInputFocus = React.useCallback( + function (field) { + updateFieldState(field.id, function (os) { + return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, os), { + validated: false, + }); + }); + }, + [updateFieldState] + ); + var onInputBlur = React.useCallback( + function (field) { + return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () { + var fieldConfig, error, _a; + return genericComponentOverrideContext.__generator(this, function (_b) { + switch (_b.label) { + case 0: + if (!validateOnBlur) { + return [2 /*return*/]; + } + fieldConfig = props.formFields.find(function (f) { + return f.id === field.id; + }); + if (!(fieldConfig && field.value !== "")) return [3 /*break*/, 2]; + return [4 /*yield*/, fieldConfig.validate(field.value)]; + case 1: + _a = _b.sent(); + return [3 /*break*/, 3]; + case 2: + _a = undefined; + _b.label = 3; + case 3: + error = _a; + updateFieldState(field.id, function (os) { + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, os), + { error: error, validated: error === undefined && field.value.length !== 0 } + ); + }); + return [2 /*return*/]; + } + }); + }); + }, + [validateOnBlur, updateFieldState, props.formFields] + ); + var onInputChange = React.useCallback( + function (field) { + updateFieldState(field.id, function (os) { + return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, os), { + value: field.value, + error: undefined, + }); + }); + props.clearError(); + }, + [updateFieldState] + ); + var onFormSubmit = React.useCallback( + function (e) { + return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () { + var apiFields, fieldUpdates, result, generalError, e_1, _loop_1, _i, formFields_1, field, errorFields_1; + return genericComponentOverrideContext.__generator(this, function (_a) { + switch (_a.label) { + case 0: + // Prevent default event propagation. + e.preventDefault(); + // Set loading state. + setIsLoading(true); + setFieldStates(function (os) { + return os.map(function (fs) { + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, fs), + { error: undefined } + ); + }); + }); + apiFields = formFields.map(function (field) { + var fieldState = fieldStates.find(function (fs) { + return fs.id === field.id; + }); + return { + id: field.id, + value: fieldState === undefined ? "" : fieldState.value, + }; + }); + fieldUpdates = []; + _a.label = 1; + case 1: + _a.trys.push([1, 6, 7, 8]); + result = void 0; + generalError = void 0; + _a.label = 2; + case 2: + _a.trys.push([2, 4, , 5]); + return [ + 4 /*yield*/, + props.callAPI(apiFields, function (id, value) { + return fieldUpdates.push({ id: id, value: value }); + }), + ]; + case 3: + result = _a.sent(); + return [3 /*break*/, 5]; + case 4: + e_1 = _a.sent(); + if (STGeneralError__default.default.isThisError(e_1)) { + generalError = e_1; + } else { + throw e_1; + } + return [3 /*break*/, 5]; + case 5: + if (unmounting.current.signal.aborted) { + return [2 /*return*/]; + } + _loop_1 = function (field) { + var update = fieldUpdates.find(function (f) { + return f.id === field.id; + }); + if (update || field.clearOnSubmit === true) { + // We can do these one by one, it's almost never more than one field + updateFieldState(field.id, function (os) { + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, os), + { value: update ? update.value : "" } + ); + }); + } + }; + for (_i = 0, formFields_1 = formFields; _i < formFields_1.length; _i++) { + field = formFields_1[_i]; + _loop_1(field); + } + if (generalError !== undefined) { + props.onError(generalError.message); + } else { + // If successful + if (result.status === "OK") { + setIsLoading(false); + props.clearError(); + if (props.onSuccess !== undefined) { + props.onSuccess(result); + } + } + if (unmounting.current.signal.aborted) { + return [2 /*return*/]; + } + // If field error. + if (result.status === "FIELD_ERROR") { + errorFields_1 = result.formFields; + setFieldStates(function (os) { + return os.map(function (fs) { + var _a; + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, fs), + { + error: + (_a = errorFields_1.find(function (ef) { + return ef.id === fs.id; + })) === null || _a === void 0 + ? void 0 + : _a.error, + } + ); + }); + }); + } + } + return [3 /*break*/, 8]; + case 6: + _a.sent(); + props.onError("SOMETHING_WENT_WRONG_ERROR"); + return [3 /*break*/, 8]; + case 7: + setIsLoading(false); + return [7 /*endfinally*/]; + case 8: + return [2 /*return*/]; + } + }); + }); + }, + [setIsLoading, setFieldStates, props, formFields, fieldStates] + ); + return jsxRuntime.jsxs( + "form", + genericComponentOverrideContext.__assign( + { autoComplete: "on", noValidate: true, onSubmit: onFormSubmit }, + { + children: [ + formFields.map(function (field) { + var type = "text"; + // If email or password, replace field type. + if (validators.MANDATORY_FORM_FIELDS_ID_ARRAY.includes(field.id)) { + type = field.id; + } + if (field.id === "confirm-password") { + type = "password"; + } + var fstate = fieldStates.find(function (s) { + return s.id === field.id; + }) || { + id: field.id, + validated: false, + error: undefined, + value: "", + }; + return jsxRuntime.jsx( + FormRow, + genericComponentOverrideContext.__assign( + { hasError: fstate.error !== undefined }, + { + children: jsxRuntime.jsxs(React.Fragment, { + children: [ + showLabels && + (field.labelComponent !== undefined + ? field.labelComponent + : jsxRuntime.jsx(Label, { + value: field.label, + showIsRequired: field.showIsRequired, + })), + field.inputComponent !== undefined + ? jsxRuntime.jsx(field.inputComponent, { + type: type, + name: field.id, + validated: fstate.validated === true, + placeholder: field.placeholder, + value: fstate.value, + autoComplete: field.autoComplete, + autofocus: field.autofocus, + onInputFocus: onInputFocus, + onInputBlur: onInputBlur, + onChange: onInputChange, + hasError: fstate.error !== undefined, + }) + : jsxRuntime.jsx(Input, { + type: type, + name: field.id, + validated: fstate.validated === true, + placeholder: field.placeholder, + value: fstate.value, + autoComplete: field.autoComplete, + onInputFocus: onInputFocus, + onInputBlur: onInputBlur, + onChange: onInputChange, + autofocus: field.autofocus, + hasError: fstate.error !== undefined, + }), + fstate.error && jsxRuntime.jsx(InputError, { error: fstate.error }), + ], + }), + } + ), + field.id + ); + }), + jsxRuntime.jsx( + FormRow, + { + children: jsxRuntime.jsxs(React.Fragment, { + children: [ + jsxRuntime.jsx(button.Button, { + disabled: isLoading, + isLoading: isLoading, + type: "submit", + label: buttonLabel, + }), + footer, + ], + }), + }, + "form-button" + ), + ], + } + ) + ); +}; + +exports.ErrorIcon = ErrorIcon; +exports.FormBase = FormBase; +exports.FormRow = FormRow; +exports.Label = Label; diff --git a/lib/build/emailpasswordprebuiltui.js b/lib/build/emailpasswordprebuiltui.js index c6277a8b2..d973d6318 100644 --- a/lib/build/emailpasswordprebuiltui.js +++ b/lib/build/emailpasswordprebuiltui.js @@ -30,8 +30,9 @@ require("./session-shared3.js"); require("./session-shared.js"); require("./translations.js"); require("./emailverification-shared2.js"); -require("./arrowLeftIcon.js"); require("./emailpassword-shared7.js"); +require("./arrowLeftIcon.js"); +require("./emailpassword-shared8.js"); require("supertokens-web-js/utils/error"); require("./emailpassword-shared2.js"); require("./emailpassword-shared.js"); diff --git a/lib/build/emailverification-shared2.js b/lib/build/emailverification-shared2.js index 6db26e977..53e262aae 100644 --- a/lib/build/emailverification-shared2.js +++ b/lib/build/emailverification-shared2.js @@ -6,7 +6,7 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext var translations = require("./translations.js"); var styles = - '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n\n[data-supertokens~="resetPasswordHeaderTitle"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n'; + '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n\n[data-supertokens~="withBackButton"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n'; var ThemeBase = function (_a) { var children = _a.children, diff --git a/lib/build/multifactorauth-shared2.js b/lib/build/multifactorauth-shared2.js index bd3b554b5..1f8eafe1c 100644 --- a/lib/build/multifactorauth-shared2.js +++ b/lib/build/multifactorauth-shared2.js @@ -1,10 +1,52 @@ "use strict"; var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); +var recipe = require("./multifactorauth-shared.js"); var _a = genericComponentOverrideContext.createGenericComponentsOverrideContext(), useContext = _a[0], Provider = _a[1]; -exports.Provider = Provider; +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +var Wrapper = /** @class */ (function () { + function Wrapper() {} + Wrapper.init = function (config) { + return recipe.MultiFactorAuth.init(config); + }; + Wrapper.getMFAInfo = function (input) { + return recipe.MultiFactorAuth.getInstanceOrThrow().webJSRecipe.getMFAInfo( + genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, input), { + userContext: genericComponentOverrideContext.getNormalisedUserContext( + input === null || input === void 0 ? void 0 : input.userContext + ), + }) + ); + }; + Wrapper.MultiFactorAuthClaim = recipe.MultiFactorAuth.MultiFactorAuthClaim; + Wrapper.ComponentsOverrideProvider = Provider; + return Wrapper; +})(); +var init = Wrapper.init; +var getMFAInfo = Wrapper.getMFAInfo; +var MultiFactorAuthComponentsOverrideProvider = Wrapper.ComponentsOverrideProvider; +var MultiFactorAuthClaim = recipe.MultiFactorAuth.MultiFactorAuthClaim; + +exports.MultiFactorAuthClaim = MultiFactorAuthClaim; +exports.MultiFactorAuthComponentsOverrideProvider = MultiFactorAuthComponentsOverrideProvider; +exports.Wrapper = Wrapper; +exports.getMFAInfo = getMFAInfo; +exports.init = init; exports.useContext = useContext; diff --git a/lib/build/multifactorauth.js b/lib/build/multifactorauth.js index e024655e5..20275f881 100644 --- a/lib/build/multifactorauth.js +++ b/lib/build/multifactorauth.js @@ -2,9 +2,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); -var componentOverrideContext = require("./multifactorauth-shared2.js"); -var recipe = require("./multifactorauth-shared.js"); +require("./genericComponentOverrideContext.js"); +var multifactorauth = require("./multifactorauth-shared2.js"); +require("./multifactorauth-shared.js"); require("supertokens-web-js"); require("supertokens-web-js/utils/cookieHandler"); require("supertokens-web-js/utils/postSuperTokensInitCallbacks"); @@ -19,45 +19,8 @@ require("supertokens-web-js/recipe/multifactorauth"); require("supertokens-web-js/utils/sessionClaimValidatorStore"); require("./recipeModule-shared.js"); -/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. - * - * This software is licensed under the Apache License, Version 2.0 (the - * "License") as published by the Apache Software Foundation. - * - * You may not use this file except in compliance with the License. You may - * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -var Wrapper = /** @class */ (function () { - function Wrapper() {} - Wrapper.init = function (config) { - return recipe.MultiFactorAuth.init(config); - }; - Wrapper.getMFAInfo = function (input) { - return recipe.MultiFactorAuth.getInstanceOrThrow().webJSRecipe.getMFAInfo( - genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, input), { - userContext: genericComponentOverrideContext.getNormalisedUserContext( - input === null || input === void 0 ? void 0 : input.userContext - ), - }) - ); - }; - Wrapper.MultiFactorAuthClaim = recipe.MultiFactorAuth.MultiFactorAuthClaim; - Wrapper.ComponentsOverrideProvider = componentOverrideContext.Provider; - return Wrapper; -})(); -var init = Wrapper.init; -var getMFAInfo = Wrapper.getMFAInfo; -var MultiFactorAuthComponentsOverrideProvider = Wrapper.ComponentsOverrideProvider; -var MultiFactorAuthClaim = recipe.MultiFactorAuth.MultiFactorAuthClaim; - -exports.MultiFactorAuthClaim = MultiFactorAuthClaim; -exports.MultiFactorAuthComponentsOverrideProvider = MultiFactorAuthComponentsOverrideProvider; -exports.default = Wrapper; -exports.getMFAInfo = getMFAInfo; -exports.init = init; +exports.MultiFactorAuthClaim = multifactorauth.MultiFactorAuthClaim; +exports.MultiFactorAuthComponentsOverrideProvider = multifactorauth.MultiFactorAuthComponentsOverrideProvider; +exports.default = multifactorauth.Wrapper; +exports.getMFAInfo = multifactorauth.getMFAInfo; +exports.init = multifactorauth.init; diff --git a/lib/build/multifactorauthprebuiltui.js b/lib/build/multifactorauthprebuiltui.js index 59f5baa4c..afe5e1bc6 100644 --- a/lib/build/multifactorauthprebuiltui.js +++ b/lib/build/multifactorauthprebuiltui.js @@ -5,7 +5,7 @@ var jsxRuntime = require("react/jsx-runtime"); var NormalisedURLPath = require("supertokens-web-js/utils/normalisedURLPath"); var uiEntry = require("./index2.js"); var session = require("./session-shared3.js"); -var componentOverrideContext = require("./multifactorauth-shared2.js"); +var multifactorauth = require("./multifactorauth-shared2.js"); var React = require("react"); var recipe$1 = require("./session-shared2.js"); var recipe = require("./multifactorauth-shared.js"); @@ -13,10 +13,11 @@ var SuperTokensBranding = require("./SuperTokensBranding.js"); var translations = require("./translations.js"); var arrowLeftIcon = require("./arrowLeftIcon.js"); var translationContext = require("./translationContext.js"); +var backButton = require("./emailpassword-shared7.js"); +var windowHandler = require("supertokens-web-js/utils/windowHandler"); require("supertokens-web-js"); require("supertokens-web-js/utils/cookieHandler"); require("supertokens-web-js/utils/postSuperTokensInitCallbacks"); -require("supertokens-web-js/utils/windowHandler"); require("supertokens-web-js/recipe/multitenancy"); require("supertokens-web-js/utils"); require("supertokens-web-js/utils/normalisedURLDomain"); @@ -114,18 +115,30 @@ var FactorChooserFooter = uiEntry.withOverride( var FactorChooserHeader = uiEntry.withOverride( "MultiFactorAuthFactorChooserHeader", - function MultiFactorAuthFactorChooserHeader() { + function MultiFactorAuthFactorChooserHeader(props) { var t = translationContext.useTranslation(); return jsxRuntime.jsx( "div", genericComponentOverrideContext.__assign( { "data-supertokens": "row factorChooserHeader" }, { - children: jsxRuntime.jsx( + children: jsxRuntime.jsxs( "div", genericComponentOverrideContext.__assign( - { "data-supertokens": "headerTitle" }, - { children: t("MULTI_FACTOR_CHOOSER_HEADER_TITLE") } + { "data-supertokens": "headerTitle withBackButton" }, + { + children: [ + props.showBackButton + ? jsxRuntime.jsx(backButton.BackButton, { onClick: props.onBackButtonClicked }) + : jsxRuntime.jsx("span", { + "data-supertokens": "backButtonPlaceholder backButtonCommon", + }), + t("MULTI_FACTOR_CHOOSER_HEADER_TITLE"), + jsxRuntime.jsx("span", { + "data-supertokens": "backButtonPlaceholder backButtonCommon", + }), + ], + } ) ), } @@ -211,29 +224,27 @@ var FactorList = uiEntry.withOverride("MultiFactorAuthFactorList", function Mult }); function FactorChooserTheme(props) { - var sessionContext = session.useSessionContext$1(); - if (sessionContext.loading === false && sessionContext.doesSessionExist === true) { - return jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "container" }, - { - children: [ - jsxRuntime.jsx(FactorChooserHeader, {}), - jsxRuntime.jsx(FactorList, { - availableFactors: props.availableFactors, - mfaInfo: props.mfaInfo, - navigateToFactor: props.navigateToFactor, - }), - jsxRuntime.jsx(FactorChooserFooter, { logout: props.logout }), - jsxRuntime.jsx(SuperTokensBranding.SuperTokensBranding, {}), - ], - } - ) - ); - } - // Otherwise, return an empty screen, waiting for the feature component redirection to complete. - return jsxRuntime.jsx(jsxRuntime.Fragment, {}); + return jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "container" }, + { + children: [ + jsxRuntime.jsx(FactorChooserHeader, { + onBackButtonClicked: props.onBackButtonClicked, + showBackButton: props.showBackButton, + }), + jsxRuntime.jsx(FactorList, { + availableFactors: props.availableFactors, + mfaInfo: props.mfaInfo, + navigateToFactor: props.navigateToFactor, + }), + jsxRuntime.jsx(FactorChooserFooter, { logout: props.logout }), + jsxRuntime.jsx(SuperTokensBranding.SuperTokensBranding, {}), + ], + } + ) + ); } function FactorChooserThemeWrapper(props) { var hasFont = translations.hasFontDefined(props.config.rootStyle); @@ -270,10 +281,12 @@ var defaultTranslationsMultiFactorAuth = { }; var FactorChooser$1 = function (props) { + var _a; var sessionContext = React.useContext(uiEntry.SessionContext); - var _a = React.useState(undefined), - mfaInfo = _a[0], - setMFAInfo = _a[1]; + var _b = React.useState(undefined), + mfaInfo = _b[0], + setMFAInfo = _b[1]; + var mfaClaimValue = session.useClaimValue(multifactorauth.MultiFactorAuthClaim); var userContext = uiEntry.useUserContext(); var recipeComponentOverrides = props.useComponentOverrides(); var redirectToAuthWithHistory = React.useCallback( @@ -310,12 +323,22 @@ var FactorChooser$1 = function (props) { return genericComponentOverrideContext.__awaiter(void 0, void 0, void 0, function () { var availableFactors; return genericComponentOverrideContext.__generator(this, function (_a) { - availableFactors = props.recipe.getSecondaryFactors().filter(function (_a) { - var id = _a.id; - return ( - mfaInfo.factors.isAllowedToSetup.includes(id) || mfaInfo.factors.isAlreadySetup.includes(id) - ); - }); + if (mfaClaimValue.loading === true) { + throw new Error("This should never happen: session context loaded but claim value loading"); + } + availableFactors = props.recipe + .getSecondaryFactors() + .filter(function (_a) { + var id = _a.id; + return ( + mfaInfo.factors.isAllowedToSetup.includes(id) || + mfaInfo.factors.isAlreadySetup.includes(id) + ); + }) + .filter(function (_a) { + var id = _a.id; + return mfaClaimValue.value.n.length === 0 || mfaClaimValue.value.n.includes(id); + }); if (availableFactors.length === 1) { return [ 2 /*return*/, @@ -389,16 +412,49 @@ var FactorChooser$1 = function (props) { }, [props.recipe, redirectToAuthWithHistory] ); - if (mfaInfo === undefined) { + var onBackButtonClicked = React.useCallback( + function () { + // If we don't have history available this would mean we are not using react-router-dom, so we use window's history + if (props.history === undefined) { + return windowHandler.WindowHandlerReference.getReferenceOrThrow() + .windowHandler.getWindowUnsafe() + .history.back(); + } + // If we do have history and goBack function on it this means we are using react-router-dom v5 or lower + if (props.history.goBack !== undefined) { + return props.history.goBack(); + } + // If we reach this code this means we are using react-router-dom v6 + return props.history(-1); + }, + [props.history] + ); + if (mfaInfo === undefined || mfaClaimValue.loading) { return jsxRuntime.jsx(React.Fragment, {}); } + var availableFactors = props.recipe + .getSecondaryFactors() + .filter(function (_a) { + var id = _a.id; + return mfaInfo.isAllowedToSetup.includes(id) || mfaInfo.isAlreadySetup.includes(id); + }) + .filter(function (_a) { + var _b, _c; + var id = _a.id; + return ( + ((_b = mfaClaimValue.value) === null || _b === void 0 ? void 0 : _b.n.length) === 0 || + ((_c = mfaClaimValue.value) === null || _c === void 0 ? void 0 : _c.n.includes(id)) + ); + }); var childProps = { config: props.recipe.config, + onBackButtonClicked: onBackButtonClicked, + showBackButton: ((_a = mfaClaimValue.value) === null || _a === void 0 ? void 0 : _a.n.length) === 0, + mfaInfo: mfaInfo, + availableFactors: availableFactors, + logout: signOut, + navigateToFactor: navigateToFactor, }; - var availableFactors = props.recipe.getSecondaryFactors().filter(function (_a) { - var id = _a.id; - return mfaInfo.isAllowedToSetup.includes(id) || mfaInfo.isAlreadySetup.includes(id); - }); return jsxRuntime.jsx( uiEntry.ComponentOverrideContext.Provider, genericComponentOverrideContext.__assign( @@ -417,12 +473,7 @@ var FactorChooser$1 = function (props) { props.children === undefined && jsxRuntime.jsx( FactorChooserThemeWrapper, - genericComponentOverrideContext.__assign({}, childProps, { - mfaInfo: mfaInfo, - availableFactors: availableFactors, - logout: signOut, - navigateToFactor: navigateToFactor, - }) + genericComponentOverrideContext.__assign({}, childProps) ), props.children && React__namespace.Children.map(props.children, function (child) { @@ -449,7 +500,7 @@ var MultiFactorAuthPreBuiltUI = /** @class */ (function (_super) { // Instance methods _this.getFeatures = function (useComponentOverrides) { if (useComponentOverrides === void 0) { - useComponentOverrides = componentOverrideContext.useContext; + useComponentOverrides = multifactorauth.useContext; } var features = {}; if (_this.recipeInstance.config.disableDefaultUI !== true) { @@ -475,7 +526,7 @@ var MultiFactorAuthPreBuiltUI = /** @class */ (function (_super) { useComponentOverrides ) { if (useComponentOverrides === void 0) { - useComponentOverrides = componentOverrideContext.useContext; + useComponentOverrides = multifactorauth.useContext; } return jsxRuntime.jsx( uiEntry.UserContextWrapper, @@ -520,13 +571,13 @@ var MultiFactorAuthPreBuiltUI = /** @class */ (function (_super) { }; MultiFactorAuthPreBuiltUI.getFeatures = function (useComponentOverrides) { if (useComponentOverrides === void 0) { - useComponentOverrides = componentOverrideContext.useContext; + useComponentOverrides = multifactorauth.useContext; } return MultiFactorAuthPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatures(useComponentOverrides); }; MultiFactorAuthPreBuiltUI.getFeatureComponent = function (componentName, props, useComponentOverrides) { if (useComponentOverrides === void 0) { - useComponentOverrides = componentOverrideContext.useContext; + useComponentOverrides = multifactorauth.useContext; } return MultiFactorAuthPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent( componentName, diff --git a/lib/build/passwordless-shared3.js b/lib/build/passwordless-shared3.js index 8845ee9f2..f712fa3a7 100644 --- a/lib/build/passwordless-shared3.js +++ b/lib/build/passwordless-shared3.js @@ -17,7 +17,7 @@ var recipe$1 = require("./passwordless-shared2.js"); var SuperTokensBranding = require("./SuperTokensBranding.js"); var generalError = require("./emailpassword-shared.js"); var checkedRoundIcon = require("./checkedRoundIcon.js"); -var formBase = require("./emailpassword-shared7.js"); +var formBase = require("./emailpassword-shared8.js"); var validators = require("./emailpassword-shared5.js"); var arrowLeftIcon = require("./arrowLeftIcon.js"); @@ -56,7 +56,7 @@ var React__namespace = /*#__PURE__*/ _interopNamespace(React); var STGeneralError__default = /*#__PURE__*/ _interopDefault(STGeneralError); var styles = - '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n\n[data-supertokens~="resetPasswordHeaderTitle"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n\n[data-supertokens~="generalSuccess"] {\n margin-bottom: 20px;\n -webkit-animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n}\n\n[data-supertokens~="codeInputLabelWrapper"] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="headerSubtitle"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n[data-supertokens~="sendCodeText"] {\n margin-top: 15px;\n margin-bottom: 20px;\n}\n\n[data-supertokens~="sendCodeText"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n[data-supertokens~="resendCodeBtn"] {\n width: auto;\n margin-top: 0;\n line-height: 24px;\n}\n\n[data-supertokens~="resendCodeBtn"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="resendCodeBtn"]:disabled {\n color: rgb(var(--palette-textPrimary));\n cursor: default;\n text-decoration: none;\n}\n\n[data-supertokens~="phoneInputLibRoot"] {\n display: flex;\n align-items: center;\n}\n\n[data-supertokens~="phoneInputWrapper"] {\n display: flex;\n align-items: center;\n}\n\n[data-supertokens~="phoneInputWrapper"] .iti [data-supertokens~="input"] {\n padding-left: 15px;\n}\n\n[data-supertokens~="phoneInputWrapper"] .iti {\n flex: 1 1;\n min-width: 0;\n width: 100%;\n background: transparent;\n border: none;\n color: inherit;\n outline: none;\n}\n\n[data-supertokens~="continueButtonWrapper"] {\n margin-top: 10px;\n margin-bottom: 30px;\n}\n\n.iti__country-list {\n border: 0;\n top: 40px;\n width: min(72.2vw, 320px);\n border-radius: 6;\n box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.16);\n}\n\n.iti__country {\n display: flex;\n align-items: center;\n height: 34px;\n cursor: pointer;\n\n padding: 0 8px;\n}\n\n.iti__country-name {\n color: var(--palette-textLabel);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: "0 16px";\n}\n'; + '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n\n[data-supertokens~="withBackButton"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n\n[data-supertokens~="generalSuccess"] {\n margin-bottom: 20px;\n -webkit-animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n}\n\n[data-supertokens~="codeInputLabelWrapper"] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="headerSubtitle"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n[data-supertokens~="sendCodeText"] {\n margin-top: 15px;\n margin-bottom: 20px;\n}\n\n[data-supertokens~="sendCodeText"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n[data-supertokens~="resendCodeBtn"] {\n width: auto;\n margin-top: 0;\n line-height: 24px;\n}\n\n[data-supertokens~="resendCodeBtn"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="resendCodeBtn"]:disabled {\n color: rgb(var(--palette-textPrimary));\n cursor: default;\n text-decoration: none;\n}\n\n[data-supertokens~="phoneInputLibRoot"] {\n display: flex;\n align-items: center;\n}\n\n[data-supertokens~="phoneInputWrapper"] {\n display: flex;\n align-items: center;\n}\n\n[data-supertokens~="phoneInputWrapper"] .iti [data-supertokens~="input"] {\n padding-left: 15px;\n}\n\n[data-supertokens~="phoneInputWrapper"] .iti {\n flex: 1 1;\n min-width: 0;\n width: 100%;\n background: transparent;\n border: none;\n color: inherit;\n outline: none;\n}\n\n[data-supertokens~="continueButtonWrapper"] {\n margin-top: 10px;\n margin-bottom: 30px;\n}\n\n.iti__country-list {\n border: 0;\n top: 40px;\n width: min(72.2vw, 320px);\n border-radius: 6;\n box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.16);\n}\n\n.iti__country {\n display: flex;\n align-items: center;\n height: 34px;\n cursor: pointer;\n\n padding: 0 8px;\n}\n\n.iti__country-name {\n color: var(--palette-textLabel);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: "0 16px";\n}\n'; var ThemeBase = function (_a) { var children = _a.children, diff --git a/lib/build/passwordlessprebuiltui.js b/lib/build/passwordlessprebuiltui.js index a434bb49d..2b277bca2 100644 --- a/lib/build/passwordlessprebuiltui.js +++ b/lib/build/passwordlessprebuiltui.js @@ -33,7 +33,7 @@ require("./emailpassword-shared2.js"); require("./SuperTokensBranding.js"); require("./emailpassword-shared.js"); require("./checkedRoundIcon.js"); -require("./emailpassword-shared7.js"); +require("./emailpassword-shared8.js"); require("./emailpassword-shared5.js"); require("./arrowLeftIcon.js"); require("supertokens-web-js/recipe/passwordless"); diff --git a/lib/build/recipe/multifactorauth/components/themes/factorChooser/factorChooserHeader.d.ts b/lib/build/recipe/multifactorauth/components/themes/factorChooser/factorChooserHeader.d.ts index 3b5dd8a0d..d7bc118b0 100644 --- a/lib/build/recipe/multifactorauth/components/themes/factorChooser/factorChooserHeader.d.ts +++ b/lib/build/recipe/multifactorauth/components/themes/factorChooser/factorChooserHeader.d.ts @@ -1,2 +1,5 @@ /// -export declare const FactorChooserHeader: import("react").ComponentType; +export declare const FactorChooserHeader: import("react").ComponentType<{ + showBackButton: boolean; + onBackButtonClicked: () => void; +}>; diff --git a/lib/build/recipe/multifactorauth/types.d.ts b/lib/build/recipe/multifactorauth/types.d.ts index 9e7d1f639..9f9b9b027 100644 --- a/lib/build/recipe/multifactorauth/types.d.ts +++ b/lib/build/recipe/multifactorauth/types.d.ts @@ -60,6 +60,8 @@ export declare type OnHandleEventContext = { export declare type FactorChooserThemeProps = { mfaInfo: MFAFactorInfo; availableFactors: SecondaryFactorRedirectionInfo[]; + showBackButton: boolean; + onBackButtonClicked: () => void; navigateToFactor: (factorId: string) => void; logout: () => void; config: NormalisedConfig; diff --git a/lib/build/thirdpartyemailpasswordprebuiltui.js b/lib/build/thirdpartyemailpasswordprebuiltui.js index 4549fc704..4a7ef2e2e 100644 --- a/lib/build/thirdpartyemailpasswordprebuiltui.js +++ b/lib/build/thirdpartyemailpasswordprebuiltui.js @@ -32,8 +32,9 @@ require("./session-shared3.js"); require("./session-shared.js"); require("./emailpassword-shared3.js"); require("./emailverification-shared2.js"); -require("./arrowLeftIcon.js"); require("./emailpassword-shared7.js"); +require("./arrowLeftIcon.js"); +require("./emailpassword-shared8.js"); require("supertokens-web-js/utils/error"); require("./emailpassword-shared5.js"); require("./emailpassword-shared2.js"); @@ -80,7 +81,7 @@ var NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath var React__namespace = /*#__PURE__*/ _interopNamespace(React); var styles = - '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n[data-supertokens~="resetPasswordHeaderTitle"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n[data-supertokens~="row"] {\n padding-bottom: 30px;\n}\n[data-supertokens~="providerContainer"] {\n padding-top: 9px;\n padding-bottom: 9px;\n}\n[data-supertokens~="providerButton"] {\n border-color: rgb(221, 221, 221) !important;\n}\n[data-supertokens~="providerButton"] {\n min-height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 2px 8px;\n\n background-color: white;\n color: black;\n}\n[data-supertokens~="providerButton"]:hover {\n -webkit-filter: none !important;\n filter: none !important;\n}\n[data-supertokens~="providerButton"]:hover {\n background-color: #fafafa;\n}\n[data-supertokens~="providerButtonLeft"] {\n min-width: 34px;\n margin-left: 66px;\n}\n[data-supertokens~="providerButtonLogo"] {\n height: 30px;\n display: flex;\n}\n[data-supertokens~="providerButtonLogoCenter"] {\n display: flex;\n margin: auto;\n}\n[data-supertokens~="providerButtonText"] {\n font-weight: 400;\n text-align: center;\n justify-content: center;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n display: inline-block;\n}\n[data-supertokens~="providerButtonText"]:only-child {\n margin: 0 auto;\n}\n[data-supertokens~="thirdPartyEmailPasswordDivider"] {\n padding-top: 5px;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="thirdPartyEmailPasswordDividerOr"] {\n flex: 1 1;\n margin-top: 0.75em;\n}\n[data-supertokens~="divider"] {\n flex: 3 3;\n}\n[data-supertokens~="providerButton"] {\n margin: auto !important;\n max-width: 240px !important;\n}\n[data-supertokens~="providerButtonLeft"] {\n margin-left: 30px !important;\n}\n'; + '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n[data-supertokens~="withBackButton"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n[data-supertokens~="row"] {\n padding-bottom: 30px;\n}\n[data-supertokens~="providerContainer"] {\n padding-top: 9px;\n padding-bottom: 9px;\n}\n[data-supertokens~="providerButton"] {\n border-color: rgb(221, 221, 221) !important;\n}\n[data-supertokens~="providerButton"] {\n min-height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 2px 8px;\n\n background-color: white;\n color: black;\n}\n[data-supertokens~="providerButton"]:hover {\n -webkit-filter: none !important;\n filter: none !important;\n}\n[data-supertokens~="providerButton"]:hover {\n background-color: #fafafa;\n}\n[data-supertokens~="providerButtonLeft"] {\n min-width: 34px;\n margin-left: 66px;\n}\n[data-supertokens~="providerButtonLogo"] {\n height: 30px;\n display: flex;\n}\n[data-supertokens~="providerButtonLogoCenter"] {\n display: flex;\n margin: auto;\n}\n[data-supertokens~="providerButtonText"] {\n font-weight: 400;\n text-align: center;\n justify-content: center;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n display: inline-block;\n}\n[data-supertokens~="providerButtonText"]:only-child {\n margin: 0 auto;\n}\n[data-supertokens~="thirdPartyEmailPasswordDivider"] {\n padding-top: 5px;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="thirdPartyEmailPasswordDividerOr"] {\n flex: 1 1;\n margin-top: 0.75em;\n}\n[data-supertokens~="divider"] {\n flex: 3 3;\n}\n[data-supertokens~="providerButton"] {\n margin: auto !important;\n max-width: 240px !important;\n}\n[data-supertokens~="providerButtonLeft"] {\n margin-left: 30px !important;\n}\n'; var ThemeBase = function (_a) { var children = _a.children, diff --git a/lib/build/thirdpartypasswordlessprebuiltui.js b/lib/build/thirdpartypasswordlessprebuiltui.js index 6ba76b277..84e521e1c 100644 --- a/lib/build/thirdpartypasswordlessprebuiltui.js +++ b/lib/build/thirdpartypasswordlessprebuiltui.js @@ -37,7 +37,7 @@ require("./passwordless-shared2.js"); require("supertokens-web-js/recipe/passwordless"); require("./authRecipe-shared.js"); require("./checkedRoundIcon.js"); -require("./emailpassword-shared7.js"); +require("./emailpassword-shared8.js"); require("./emailpassword-shared5.js"); require("./arrowLeftIcon.js"); require("./thirdparty-shared.js"); @@ -79,7 +79,7 @@ var NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath var React__namespace = /*#__PURE__*/ _interopNamespace(React); var styles = - '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n[data-supertokens~="resetPasswordHeaderTitle"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n[data-supertokens~="generalSuccess"] {\n margin-bottom: 20px;\n -webkit-animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n}\n[data-supertokens~="codeInputLabelWrapper"] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="headerSubtitle"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n[data-supertokens~="sendCodeText"] {\n margin-top: 15px;\n margin-bottom: 20px;\n}\n[data-supertokens~="sendCodeText"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n[data-supertokens~="resendCodeBtn"] {\n width: auto;\n margin-top: 0;\n line-height: 24px;\n}\n[data-supertokens~="resendCodeBtn"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="resendCodeBtn"]:disabled {\n color: rgb(var(--palette-textPrimary));\n cursor: default;\n text-decoration: none;\n}\n[data-supertokens~="phoneInputLibRoot"] {\n display: flex;\n align-items: center;\n}\n[data-supertokens~="phoneInputWrapper"] {\n display: flex;\n align-items: center;\n}\n[data-supertokens~="phoneInputWrapper"] .iti [data-supertokens~="input"] {\n padding-left: 15px;\n}\n[data-supertokens~="phoneInputWrapper"] .iti {\n flex: 1 1;\n min-width: 0;\n width: 100%;\n background: transparent;\n border: none;\n color: inherit;\n outline: none;\n}\n[data-supertokens~="continueButtonWrapper"] {\n margin-top: 10px;\n margin-bottom: 30px;\n}\n.iti__country-list {\n border: 0;\n top: 40px;\n width: min(72.2vw, 320px);\n border-radius: 6;\n box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.16);\n}\n.iti__country {\n display: flex;\n align-items: center;\n height: 34px;\n cursor: pointer;\n\n padding: 0 8px;\n}\n.iti__country-name {\n color: var(--palette-textLabel);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: "0 16px";\n}\n[data-supertokens~="row"] {\n padding-bottom: 30px;\n}\n[data-supertokens~="providerContainer"] {\n padding-top: 9px;\n padding-bottom: 9px;\n}\n[data-supertokens~="providerButton"] {\n border-color: rgb(221, 221, 221) !important;\n}\n[data-supertokens~="providerButton"] {\n min-height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 2px 8px;\n\n background-color: white;\n color: black;\n}\n[data-supertokens~="providerButton"]:hover {\n -webkit-filter: none !important;\n filter: none !important;\n}\n[data-supertokens~="providerButton"]:hover {\n background-color: #fafafa;\n}\n[data-supertokens~="providerButtonLeft"] {\n min-width: 34px;\n margin-left: 66px;\n}\n[data-supertokens~="providerButtonLogo"] {\n height: 30px;\n display: flex;\n}\n[data-supertokens~="providerButtonLogoCenter"] {\n display: flex;\n margin: auto;\n}\n[data-supertokens~="providerButtonText"] {\n font-weight: 400;\n text-align: center;\n justify-content: center;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n display: inline-block;\n}\n[data-supertokens~="providerButtonText"]:only-child {\n margin: 0 auto;\n}\n[data-supertokens~="thirdPartyPasswordlessDivider"] {\n padding-top: 5px;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="thirdPartyPasswordlessDividerText"] {\n flex: 1 1;\n margin-top: 0.75em;\n}\n[data-supertokens~="divider"] {\n flex: 3 3;\n}\n[data-supertokens~="providerButton"] {\n margin: auto !important;\n max-width: 240px !important;\n}\n[data-supertokens~="providerButtonLeft"] {\n margin-left: 30px !important;\n}\n'; + '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n[data-supertokens~="withBackButton"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n[data-supertokens~="generalSuccess"] {\n margin-bottom: 20px;\n -webkit-animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n}\n[data-supertokens~="codeInputLabelWrapper"] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="headerSubtitle"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n[data-supertokens~="sendCodeText"] {\n margin-top: 15px;\n margin-bottom: 20px;\n}\n[data-supertokens~="sendCodeText"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n[data-supertokens~="resendCodeBtn"] {\n width: auto;\n margin-top: 0;\n line-height: 24px;\n}\n[data-supertokens~="resendCodeBtn"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="resendCodeBtn"]:disabled {\n color: rgb(var(--palette-textPrimary));\n cursor: default;\n text-decoration: none;\n}\n[data-supertokens~="phoneInputLibRoot"] {\n display: flex;\n align-items: center;\n}\n[data-supertokens~="phoneInputWrapper"] {\n display: flex;\n align-items: center;\n}\n[data-supertokens~="phoneInputWrapper"] .iti [data-supertokens~="input"] {\n padding-left: 15px;\n}\n[data-supertokens~="phoneInputWrapper"] .iti {\n flex: 1 1;\n min-width: 0;\n width: 100%;\n background: transparent;\n border: none;\n color: inherit;\n outline: none;\n}\n[data-supertokens~="continueButtonWrapper"] {\n margin-top: 10px;\n margin-bottom: 30px;\n}\n.iti__country-list {\n border: 0;\n top: 40px;\n width: min(72.2vw, 320px);\n border-radius: 6;\n box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.16);\n}\n.iti__country {\n display: flex;\n align-items: center;\n height: 34px;\n cursor: pointer;\n\n padding: 0 8px;\n}\n.iti__country-name {\n color: var(--palette-textLabel);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: "0 16px";\n}\n[data-supertokens~="row"] {\n padding-bottom: 30px;\n}\n[data-supertokens~="providerContainer"] {\n padding-top: 9px;\n padding-bottom: 9px;\n}\n[data-supertokens~="providerButton"] {\n border-color: rgb(221, 221, 221) !important;\n}\n[data-supertokens~="providerButton"] {\n min-height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 2px 8px;\n\n background-color: white;\n color: black;\n}\n[data-supertokens~="providerButton"]:hover {\n -webkit-filter: none !important;\n filter: none !important;\n}\n[data-supertokens~="providerButton"]:hover {\n background-color: #fafafa;\n}\n[data-supertokens~="providerButtonLeft"] {\n min-width: 34px;\n margin-left: 66px;\n}\n[data-supertokens~="providerButtonLogo"] {\n height: 30px;\n display: flex;\n}\n[data-supertokens~="providerButtonLogoCenter"] {\n display: flex;\n margin: auto;\n}\n[data-supertokens~="providerButtonText"] {\n font-weight: 400;\n text-align: center;\n justify-content: center;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n display: inline-block;\n}\n[data-supertokens~="providerButtonText"]:only-child {\n margin: 0 auto;\n}\n[data-supertokens~="thirdPartyPasswordlessDivider"] {\n padding-top: 5px;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="thirdPartyPasswordlessDividerText"] {\n flex: 1 1;\n margin-top: 0.75em;\n}\n[data-supertokens~="divider"] {\n flex: 3 3;\n}\n[data-supertokens~="providerButton"] {\n margin: auto !important;\n max-width: 240px !important;\n}\n[data-supertokens~="providerButtonLeft"] {\n margin-left: 30px !important;\n}\n'; var ThemeBase = function (_a) { var children = _a.children, diff --git a/lib/ts/recipe/emailpassword/components/themes/resetPasswordUsingToken/resetPasswordEmail.tsx b/lib/ts/recipe/emailpassword/components/themes/resetPasswordUsingToken/resetPasswordEmail.tsx index 75451f204..7628b1e20 100644 --- a/lib/ts/recipe/emailpassword/components/themes/resetPasswordUsingToken/resetPasswordEmail.tsx +++ b/lib/ts/recipe/emailpassword/components/themes/resetPasswordUsingToken/resetPasswordEmail.tsx @@ -67,7 +67,7 @@ const EmailPasswordResetPasswordEmail: React.FC = (props) => { return (
-
+
{t("EMAIL_PASSWORD_RESET_HEADER_TITLE")} diff --git a/lib/ts/recipe/emailpassword/components/themes/styles.css b/lib/ts/recipe/emailpassword/components/themes/styles.css index 3e617c4bf..bcaaa11be 100644 --- a/lib/ts/recipe/emailpassword/components/themes/styles.css +++ b/lib/ts/recipe/emailpassword/components/themes/styles.css @@ -194,7 +194,7 @@ margin: 0 auto; } -[data-supertokens~="resetPasswordHeaderTitle"] { +[data-supertokens~="withBackButton"] { position: relative; display: flex; justify-content: space-between; diff --git a/lib/ts/recipe/multifactorauth/components/features/factorChooser/index.tsx b/lib/ts/recipe/multifactorauth/components/features/factorChooser/index.tsx index 6eb0b33ec..0f9f51c3e 100644 --- a/lib/ts/recipe/multifactorauth/components/features/factorChooser/index.tsx +++ b/lib/ts/recipe/multifactorauth/components/features/factorChooser/index.tsx @@ -18,13 +18,15 @@ */ import * as React from "react"; import { useContext, useState, useCallback, Fragment } from "react"; +import { WindowHandlerReference } from "supertokens-web-js/utils/windowHandler"; +import { MultiFactorAuthClaim } from "../../.."; import { redirectToAuth } from "../../../../.."; import { ComponentOverrideContext } from "../../../../../components/componentOverride/componentOverrideContext"; import FeatureWrapper from "../../../../../components/featureWrapper"; import { useUserContext } from "../../../../../usercontext"; import { useOnMountAPICall } from "../../../../../utils"; -import { SessionContext } from "../../../../session"; +import { SessionContext, useClaimValue } from "../../../../session"; import Session from "../../../../session/recipe"; import MultiFactorAuth from "../../../recipe"; import FactorChooserTheme from "../../themes/factorChooser"; @@ -40,6 +42,7 @@ type Prop = FeatureBaseProps & { recipe: Recipe; userContext?: any; useComponent export const FactorChooser: React.FC = (props) => { const sessionContext = useContext(SessionContext); const [mfaInfo, setMFAInfo] = useState(undefined); + const mfaClaimValue = useClaimValue(MultiFactorAuthClaim); const userContext = useUserContext(); const recipeComponentOverrides = props.useComponentOverrides(); @@ -54,12 +57,16 @@ export const FactorChooser: React.FC = (props) => { const checkMFAInfo = useCallback( async (mfaInfo: { factors: MFAFactorInfo }): Promise => { + if (mfaClaimValue.loading === true) { + throw new Error("This should never happen: session context loaded but claim value loading"); + } const availableFactors = props.recipe .getSecondaryFactors() .filter( ({ id }) => mfaInfo.factors.isAllowedToSetup.includes(id) || mfaInfo.factors.isAlreadySetup.includes(id) - ); + ) + .filter(({ id }) => mfaClaimValue.value!.n.length === 0 || mfaClaimValue.value!.n.includes(id)); if (availableFactors.length === 1) { return MultiFactorAuth.getInstanceOrThrow().redirectToFactor(availableFactors[0].id, props.history); } else { @@ -92,16 +99,38 @@ export const FactorChooser: React.FC = (props) => { return redirectToAuthWithHistory(); }, [props.recipe, redirectToAuthWithHistory]); - if (mfaInfo === undefined) { + const onBackButtonClicked = useCallback(() => { + // If we don't have history available this would mean we are not using react-router-dom, so we use window's history + if (props.history === undefined) { + return WindowHandlerReference.getReferenceOrThrow().windowHandler.getWindowUnsafe().history.back(); + } + // If we do have history and goBack function on it this means we are using react-router-dom v5 or lower + if (props.history.goBack !== undefined) { + return props.history.goBack(); + } + // If we reach this code this means we are using react-router-dom v6 + return props.history(-1); + }, [props.history]); + + if (mfaInfo === undefined || mfaClaimValue.loading) { return ; } + const availableFactors = props.recipe + .getSecondaryFactors() + .filter(({ id }) => mfaInfo.isAllowedToSetup.includes(id) || mfaInfo.isAlreadySetup.includes(id)) + .filter(({ id }) => mfaClaimValue.value?.n.length === 0 || mfaClaimValue.value?.n.includes(id)); + const childProps = { config: props.recipe.config, + onBackButtonClicked, + showBackButton: mfaClaimValue.value?.n.length === 0, + mfaInfo: mfaInfo, + availableFactors: availableFactors, + logout: signOut, + navigateToFactor: navigateToFactor, }; - const availableFactors = props.recipe - .getSecondaryFactors() - .filter(({ id }) => mfaInfo.isAllowedToSetup.includes(id) || mfaInfo.isAlreadySetup.includes(id)); + return ( = (props) => { defaultStore={defaultTranslationsMultiFactorAuth}> {/* No custom theme, use default. */} - {props.children === undefined && ( - - )} + {props.children === undefined && } {/* Otherwise, custom theme is provided, propagate props. */} {props.children && React.Children.map(props.children, (child) => { diff --git a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorChooserHeader.tsx b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorChooserHeader.tsx index 544582d03..00b62158b 100644 --- a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorChooserHeader.tsx +++ b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorChooserHeader.tsx @@ -14,15 +14,31 @@ */ import { withOverride } from "../../../../../components/componentOverride/withOverride"; import { useTranslation } from "../../../../../translation/translationContext"; +import BackButton from "../../../../emailpassword/components/library/backButton"; export const FactorChooserHeader = withOverride( "MultiFactorAuthFactorChooserHeader", - function MultiFactorAuthFactorChooserHeader(): JSX.Element { + function MultiFactorAuthFactorChooserHeader(props: { + showBackButton: boolean; + onBackButtonClicked: () => void; + }): JSX.Element { const t = useTranslation(); return (
-
{t("MULTI_FACTOR_CHOOSER_HEADER_TITLE")}
+
+ {props.showBackButton ? ( + + ) : ( + + {/* empty span for spacing the back button */} + + )} + {t("MULTI_FACTOR_CHOOSER_HEADER_TITLE")} + + {/* empty span for spacing the back button */} + +
); } diff --git a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/index.tsx b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/index.tsx index 7f099d615..682b89e39 100644 --- a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/index.tsx +++ b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/index.tsx @@ -16,7 +16,6 @@ import { SuperTokensBranding } from "../../../../../components/SuperTokensBranding"; import { hasFontDefined } from "../../../../../styles/styles"; import UserContextWrapper from "../../../../../usercontext/userContextWrapper"; -import { useSessionContext } from "../../../../session"; import { ThemeBase } from "../themeBase"; import { FactorChooserFooter } from "./factorChooserFooter"; @@ -26,25 +25,21 @@ import { FactorList } from "./factorList"; import type { FactorChooserThemeProps } from "../../../types"; export function FactorChooserTheme(props: FactorChooserThemeProps): JSX.Element { - const sessionContext = useSessionContext(); - - if (sessionContext.loading === false && sessionContext.doesSessionExist === true) { - return ( -
- - - - -
- ); - } - - // Otherwise, return an empty screen, waiting for the feature component redirection to complete. - return <>; + return ( +
+ + + + +
+ ); } function FactorChooserThemeWrapper(props: FactorChooserThemeProps): JSX.Element { diff --git a/lib/ts/recipe/multifactorauth/types.ts b/lib/ts/recipe/multifactorauth/types.ts index d582cb5cf..1449f6859 100644 --- a/lib/ts/recipe/multifactorauth/types.ts +++ b/lib/ts/recipe/multifactorauth/types.ts @@ -88,6 +88,8 @@ export type OnHandleEventContext = { export type FactorChooserThemeProps = { mfaInfo: MFAFactorInfo; availableFactors: SecondaryFactorRedirectionInfo[]; + showBackButton: boolean; + onBackButtonClicked: () => void; navigateToFactor: (factorId: string) => void; logout: () => void; config: NormalisedConfig; From b589515e65fc82e652039a746a6b2137511384d1 Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Mon, 30 Oct 2023 13:48:38 +0100 Subject: [PATCH 10/35] feat: update how back buttons are styled --- lib/build/passwordless-shared3.js | 4 ++-- .../recipe/passwordless/components/themes/mfa/mfaHeader.tsx | 2 +- .../passwordless/components/themes/mfa/mfaOTPHeader.tsx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/build/passwordless-shared3.js b/lib/build/passwordless-shared3.js index 7c8d784e1..4ec0dabed 100644 --- a/lib/build/passwordless-shared3.js +++ b/lib/build/passwordless-shared3.js @@ -3181,7 +3181,7 @@ var MFAHeader = uiEntry.withOverride("PasswordlessMFAHeader", function Passwordl jsxRuntime.jsxs( "div", genericComponentOverrideContext.__assign( - { "data-supertokens": "headerTitle resetPasswordHeaderTitle" }, + { "data-supertokens": "headerTitle withBackButton" }, { children: [ claim.loading === false && @@ -3263,7 +3263,7 @@ var MFAOTPHeader = uiEntry.withOverride("PasswordlessMFAOTPHeader", function Pas jsxRuntime.jsxs( "div", genericComponentOverrideContext.__assign( - { "data-supertokens": "headerTitle resetPasswordHeaderTitle" }, + { "data-supertokens": "headerTitle withBackButton" }, { children: [ claim.loading === false && diff --git a/lib/ts/recipe/passwordless/components/themes/mfa/mfaHeader.tsx b/lib/ts/recipe/passwordless/components/themes/mfa/mfaHeader.tsx index 5156fc3be..c2ac7399b 100644 --- a/lib/ts/recipe/passwordless/components/themes/mfa/mfaHeader.tsx +++ b/lib/ts/recipe/passwordless/components/themes/mfa/mfaHeader.tsx @@ -31,7 +31,7 @@ export const MFAHeader = withOverride( return ( -
+
{claim.loading === false && claim.value?.n.length === 0 ? ( ) : ( diff --git a/lib/ts/recipe/passwordless/components/themes/mfa/mfaOTPHeader.tsx b/lib/ts/recipe/passwordless/components/themes/mfa/mfaOTPHeader.tsx index baac35657..60837edac 100644 --- a/lib/ts/recipe/passwordless/components/themes/mfa/mfaOTPHeader.tsx +++ b/lib/ts/recipe/passwordless/components/themes/mfa/mfaOTPHeader.tsx @@ -34,7 +34,7 @@ export const MFAOTPHeader = withOverride( return ( -
+
{claim.loading === false && claim.value?.n.length === 0 && isSetupAllowed === false ? ( ) : ( From 85b1c4dec35de1da59d83c503fec0a833d990d63 Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Mon, 30 Oct 2023 13:51:20 +0100 Subject: [PATCH 11/35] test: update how back button is selected in tests --- test/end-to-end/resetpasswordusingtoken.test.js | 4 ++-- test/helpers.js | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/test/end-to-end/resetpasswordusingtoken.test.js b/test/end-to-end/resetpasswordusingtoken.test.js index 2fa553178..815b665fb 100644 --- a/test/end-to-end/resetpasswordusingtoken.test.js +++ b/test/end-to-end/resetpasswordusingtoken.test.js @@ -49,7 +49,7 @@ import { defaultSignUp, screenshotOnFailure, getAuthPageHeaderText, - getResetPasswordFormBackButton, + getTitleBackButton, waitForSTElement, getResetPasswordSuccessBackToSignInButton, backendBeforeEach, @@ -117,7 +117,7 @@ describe("SuperTokens Reset password", function () { }); it("Should redirect to Sign In screen when back button is clicked", async function () { - const backButton = await getResetPasswordFormBackButton(page); + const backButton = await getTitleBackButton(page); await backButton.click(); diff --git a/test/helpers.js b/test/helpers.js index bc7138534..c1d6c9f0b 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -786,9 +786,8 @@ export function isReact16() { return process.env.IS_REACT_16 === "true"; } -export async function getResetPasswordFormBackButton(page) { - const backButtonSelector = - "[data-supertokens='headerTitle resetPasswordHeaderTitle'] > [data-supertokens='backButton backButtonCommon']"; +export async function getTitleBackButton(page) { + const backButtonSelector = "[data-supertokens='headerTitle'] > [data-supertokens='backButton backButtonCommon']"; return await waitForSTElement(page, backButtonSelector); } From a9ce3b5c097fba9062659d06b011a1deaa9709bd Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Wed, 1 Nov 2023 00:16:46 +0100 Subject: [PATCH 12/35] feat: self-review fixes & updates --- examples/for-tests/src/App.js | 6 +- examples/for-tests/src/testContext.js | 1 + lib/build/authRecipe-shared2.js | 2 +- lib/build/components/assets/linkIcon.d.ts | 2 - lib/build/emailpasswordprebuiltui.js | 2 +- lib/build/emailverificationprebuiltui.js | 4 +- lib/build/index2.js | 22 +- lib/build/multifactorauth-shared.js | 106 ++++-- lib/build/multifactorauth-shared2.js | 16 + lib/build/multifactorauth.js | 2 + lib/build/multifactorauthprebuiltui.js | 33 +- lib/build/passwordless-shared2.js | 42 +-- lib/build/passwordless-shared3.js | 2 +- lib/build/passwordlessprebuiltui.js | 2 +- .../components/themes/translations.d.ts | 2 + lib/build/recipe/multifactorauth/index.d.ts | 6 + lib/build/recipe/multifactorauth/recipe.d.ts | 7 +- lib/build/recipe/multifactorauth/types.d.ts | 5 +- .../features/accessDeniedScreen/index.d.ts | 2 + lib/build/recipe/session/prebuiltui.d.ts | 8 +- lib/build/recipe/session/types.d.ts | 3 + lib/build/session-shared.js | 304 +++++++++++++++++- lib/build/session-shared3.js | 304 +----------------- lib/build/session.js | 4 +- lib/build/sessionprebuiltui.js | 25 +- .../thirdpartyemailpasswordprebuiltui.js | 2 +- lib/build/thirdpartypasswordlessprebuiltui.js | 2 +- lib/build/thirdpartyprebuiltui.js | 2 +- lib/build/ui-entry.js | 2 +- lib/ts/components/assets/linkIcon.tsx | 12 - .../features/factorChooser/index.tsx | 13 +- .../components/themes/factorChooser/index.tsx | 13 +- .../components/themes/translations.ts | 4 + lib/ts/recipe/multifactorauth/index.ts | 12 + lib/ts/recipe/multifactorauth/recipe.tsx | 69 ++-- lib/ts/recipe/multifactorauth/types.ts | 5 +- lib/ts/recipe/passwordless/recipe.tsx | 21 +- lib/ts/recipe/recipeRouter/index.tsx | 9 +- .../features/accessDeniedScreen/index.tsx | 13 +- .../themes/accessDeniedScreenTheme/index.tsx | 1 + .../session/components/themes/styles.css | 1 + lib/ts/recipe/session/prebuiltui.tsx | 11 +- lib/ts/recipe/session/types.ts | 3 + 43 files changed, 629 insertions(+), 478 deletions(-) delete mode 100644 lib/build/components/assets/linkIcon.d.ts delete mode 100644 lib/ts/components/assets/linkIcon.tsx diff --git a/examples/for-tests/src/App.js b/examples/for-tests/src/App.js index 6273474b2..3efe4f4e5 100644 --- a/examples/for-tests/src/App.js +++ b/examples/for-tests/src/App.js @@ -173,7 +173,7 @@ const testContext = getTestContext(); let recipeList = [ MultiFactorAuth.init({ - firstFactors: ["emailpassword", "thirdparty"], + firstFactors: testContext.firstFactors, }), Multitenancy.init({ override: { @@ -484,6 +484,10 @@ export function DashboardHelper({ redirectOnLogout, ...props } = {}) {
session context userID: {sessionContext.userId}
{JSON.stringify(sessionContext.invalidClaims, undefined, 2)}
+ MultiFactorAuth.redirectToFactorChooser(true, props.history)}>MFA chooser + MultiFactorAuth.redirectToFactor("totp", true, props.history)}>TOTP + MultiFactorAuth.redirectToFactor("otp-email", true, props.history)}>OTP-Email + MultiFactorAuth.redirectToFactor("otp-phone", true, props.history)}>OTP-Phone
); } diff --git a/examples/for-tests/src/testContext.js b/examples/for-tests/src/testContext.js index ab1e6e3c5..21c43c304 100644 --- a/examples/for-tests/src/testContext.js +++ b/examples/for-tests/src/testContext.js @@ -14,6 +14,7 @@ export function getTestContext() { staticProviderList: localStorage.getItem("staticProviderList"), mockTenantId: localStorage.getItem("mockTenantId"), clientType: localStorage.getItem("clientType") || undefined, + firstFactors: localStorage.getItem("firstFactors")?.split(", "), }; return ret; } diff --git a/lib/build/authRecipe-shared2.js b/lib/build/authRecipe-shared2.js index e03259ffa..25c539965 100644 --- a/lib/build/authRecipe-shared2.js +++ b/lib/build/authRecipe-shared2.js @@ -4,7 +4,7 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext var jsxRuntime = require("react/jsx-runtime"); var React = require("react"); var uiEntry = require("./index2.js"); -var session = require("./session-shared3.js"); +var session = require("./session-shared.js"); var recipe = require("./session-shared2.js"); /** diff --git a/lib/build/components/assets/linkIcon.d.ts b/lib/build/components/assets/linkIcon.d.ts deleted file mode 100644 index 35d45fe65..000000000 --- a/lib/build/components/assets/linkIcon.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -/// -export declare const LinkIcon: () => JSX.Element; diff --git a/lib/build/emailpasswordprebuiltui.js b/lib/build/emailpasswordprebuiltui.js index d973d6318..58e98cf2d 100644 --- a/lib/build/emailpasswordprebuiltui.js +++ b/lib/build/emailpasswordprebuiltui.js @@ -26,8 +26,8 @@ require("supertokens-web-js/utils/sessionClaimValidatorStore"); require("./recipeModule-shared.js"); require("./session-shared2.js"); require("supertokens-web-js/recipe/session"); -require("./session-shared3.js"); require("./session-shared.js"); +require("./session-shared3.js"); require("./translations.js"); require("./emailverification-shared2.js"); require("./emailpassword-shared7.js"); diff --git a/lib/build/emailverificationprebuiltui.js b/lib/build/emailverificationprebuiltui.js index c35b9f47a..c5be31f23 100644 --- a/lib/build/emailverificationprebuiltui.js +++ b/lib/build/emailverificationprebuiltui.js @@ -4,7 +4,7 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext var jsxRuntime = require("react/jsx-runtime"); var NormalisedURLPath = require("supertokens-web-js/utils/normalisedURLPath"); var uiEntry = require("./index2.js"); -var session = require("./session-shared3.js"); +var session = require("./session-shared.js"); var recipe$1 = require("./emailverification-shared.js"); var React = require("react"); var recipe = require("./session-shared2.js"); @@ -29,7 +29,7 @@ require("supertokens-web-js/recipe/multifactorauth"); require("supertokens-web-js/utils/sessionClaimValidatorStore"); require("./recipeModule-shared.js"); require("supertokens-web-js/recipe/session"); -require("./session-shared.js"); +require("./session-shared3.js"); require("supertokens-web-js/recipe/emailverification"); function _interopDefault(e) { diff --git a/lib/build/index2.js b/lib/build/index2.js index 44251fa1e..0bcc45e78 100644 --- a/lib/build/index2.js +++ b/lib/build/index2.js @@ -388,6 +388,7 @@ var DynamicLoginMethodsSpinner = function () { }; // The related ADR: https://supertokens.com/docs/contribute/decisions/multitenancy/0006 +// TODO: This could be by the recipes registering what factors they provide (at least partially) var priorityOrder = [ { rid: "thirdpartyemailpassword", @@ -437,7 +438,7 @@ function chooseComponentBasedOnFirstFactors(firstFactors, routeComponents) { var providedByCurrent = factorsProvided.filter(function (id) { return firstFactors.includes(id); }).length; - if (providedByCurrent >= maxProvided) { + if (providedByCurrent > maxProvided) { var matchingComp = routeComponents.find(function (comp) { return comp.recipeID === rid; }); @@ -448,12 +449,15 @@ function chooseComponentBasedOnFirstFactors(firstFactors, routeComponents) { } }; // We find the component that provides the most factors - for (var _b = 0, _c = priorityOrder.reverse(); _b < _c.length; _b++) { - var _d = _c[_b], - rid = _d.rid, - factorsProvided = _d.factorsProvided; + for (var _b = 0, priorityOrder_2 = priorityOrder; _b < priorityOrder_2.length; _b++) { + var _c = priorityOrder_2[_b], + rid = _c.rid, + factorsProvided = _c.factorsProvided; _loop_2(rid, factorsProvided); } + if (component === undefined) { + throw new Error("No enabled recipes overlap with the requested firstFactors: " + firstFactors); + } return component; } var RecipeRouter = /** @class */ (function () { @@ -578,8 +582,8 @@ var RecipeRouter = /** @class */ (function () { } }; // We first try to find an exact match - for (var _i = 0, priorityOrder_2 = priorityOrder; _i < priorityOrder_2.length; _i++) { - var _b = priorityOrder_2[_i], + for (var _i = 0, priorityOrder_3 = priorityOrder; _i < priorityOrder_3.length; _i++) { + var _b = priorityOrder_3[_i], rid = _b.rid, includes = _b.includes; var state_2 = _loop_3(rid, includes); @@ -600,8 +604,8 @@ var RecipeRouter = /** @class */ (function () { } }; // We try to find a partial match - for (var _c = 0, priorityOrder_3 = priorityOrder; _c < priorityOrder_3.length; _c++) { - var _d = priorityOrder_3[_c], + for (var _c = 0, priorityOrder_4 = priorityOrder; _c < priorityOrder_4.length; _c++) { + var _d = priorityOrder_4[_c], rid = _d.rid, includes = _d.includes; var state_3 = _loop_4(rid, includes); diff --git a/lib/build/multifactorauth-shared.js b/lib/build/multifactorauth-shared.js index 825426998..4058003e0 100644 --- a/lib/build/multifactorauth-shared.js +++ b/lib/build/multifactorauth-shared.js @@ -2,6 +2,7 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); var MultiFactorAuthWebJS = require("supertokens-web-js/recipe/multifactorauth"); +var utils = require("supertokens-web-js/utils"); var NormalisedURLPath = require("supertokens-web-js/utils/normalisedURLPath"); var postSuperTokensInitCallbacks = require("supertokens-web-js/utils/postSuperTokensInitCallbacks"); var sessionClaimValidatorStore = require("supertokens-web-js/utils/sessionClaimValidatorStore"); @@ -199,7 +200,7 @@ var MultiFactorAuth = /** @class */ (function (_super) { var _this = _super.call(this, config) || this; _this.webJSRecipe = webJSRecipe; _this.recipeID = MultiFactorAuth.RECIPE_ID; - _this.firstFactors = []; + _this.firstFactors = new Set(); _this.secondaryFactors = []; _this.getDefaultRedirectionURL = function (context) { return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { @@ -209,19 +210,21 @@ var MultiFactorAuth = /** @class */ (function (_super) { chooserPath = new NormalisedURLPath__default.default(DEFAULT_FACTOR_CHOOSER_PATH); return [ 2 /*return*/, - "".concat( - this.config.appInfo.websiteBasePath.appendPath(chooserPath).getAsStringDangerous() - ), + this.config.appInfo.websiteBasePath.appendPath(chooserPath).getAsStringDangerous(), ]; } else if (context.action === "GO_TO_FACTOR") { redirectInfo = this.getSecondaryFactors().find(function (f) { return f.id === context.factorId; }); if (redirectInfo !== undefined) { - return [2 /*return*/, redirectInfo.path]; + return [ + 2 /*return*/, + this.config.appInfo.websiteBasePath + .appendPath(redirectInfo.path) + .getAsStringDangerous(), + ]; } - // TODO: access denied screen if not defined? - return [2 /*return*/, "/"]; + throw new Error("Requested redirect to unknown factor id"); } else { return [2 /*return*/, "/"]; } @@ -280,45 +283,96 @@ var MultiFactorAuth = /** @class */ (function (_super) { } return MultiFactorAuth.instance; }; - MultiFactorAuth.prototype.getDefaultFirstFactors = function () { - return this.firstFactors; - }; MultiFactorAuth.prototype.addMFAFactors = function (firstFactors, secondaryFactors) { - var _b, _c; - (_b = this.firstFactors).push.apply(_b, firstFactors); - (_c = this.secondaryFactors).push.apply(_c, secondaryFactors); + for (var _i = 0, firstFactors_1 = firstFactors; _i < firstFactors_1.length; _i++) { + var fact = firstFactors_1[_i]; + this.firstFactors.add(fact); + } + this.secondaryFactors = genericComponentOverrideContext.__spreadArray( + genericComponentOverrideContext.__spreadArray( + [], + this.secondaryFactors.filter(function (factor) { + return secondaryFactors.every(function (newFactor) { + return factor.id !== newFactor.id; + }); + }), + true + ), + secondaryFactors, + true + ); }; MultiFactorAuth.prototype.getFirstFactors = function () { var _b; - return (_b = this.config.firstFactors) !== null && _b !== void 0 ? _b : this.firstFactors; + return (_b = this.config.firstFactors) !== null && _b !== void 0 ? _b : Array.from(this.firstFactors); }; MultiFactorAuth.prototype.getSecondaryFactors = function () { return this.config.getFactorInfo(this.secondaryFactors); }; - MultiFactorAuth.prototype.redirectToFactor = function (factorId, history) { + MultiFactorAuth.prototype.redirectToFactor = function (factorId, redirectBack, history) { + if (redirectBack === void 0) { + redirectBack = false; + } return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { - var _b, _c; - return genericComponentOverrideContext.__generator(this, function (_d) { - switch (_d.label) { + var url, redirectUrl, redirectUrl; + return genericComponentOverrideContext.__generator(this, function (_b) { + switch (_b.label) { case 0: - _c = (_b = genericComponentOverrideContext.SuperTokens.getInstanceOrThrow()).redirectToUrl; return [4 /*yield*/, this.getRedirectUrl({ action: "GO_TO_FACTOR", factorId: factorId })]; case 1: - return [2 /*return*/, _c.apply(_b, [_d.sent(), history])]; + url = _b.sent(); + if (redirectBack) { + redirectUrl = genericComponentOverrideContext + .getCurrentNormalisedUrlPath() + .getAsStringDangerous(); + url = utils.appendQueryParamsToURL(url, { redirectToPath: redirectUrl }); + } else { + redirectUrl = genericComponentOverrideContext.getRedirectToPathFromURL(); + if (redirectUrl) { + url = utils.appendQueryParamsToURL(url, { redirectToPath: redirectUrl }); + } + } + return [ + 2 /*return*/, + genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().redirectToUrl( + url, + history + ), + ]; } }); }); }; - MultiFactorAuth.prototype.redirectToFactorChooser = function (history) { + MultiFactorAuth.prototype.redirectToFactorChooser = function (redirectBack, history) { + if (redirectBack === void 0) { + redirectBack = false; + } return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { - var _b, _c; - return genericComponentOverrideContext.__generator(this, function (_d) { - switch (_d.label) { + var url, redirectUrl, redirectUrl; + return genericComponentOverrideContext.__generator(this, function (_b) { + switch (_b.label) { case 0: - _c = (_b = genericComponentOverrideContext.SuperTokens.getInstanceOrThrow()).redirectToUrl; return [4 /*yield*/, this.getRedirectUrl({ action: "FACTOR_CHOOSER" })]; case 1: - return [2 /*return*/, _c.apply(_b, [_d.sent(), history])]; + url = _b.sent(); + if (redirectBack) { + redirectUrl = genericComponentOverrideContext + .getCurrentNormalisedUrlPath() + .getAsStringDangerous(); + url = utils.appendQueryParamsToURL(url, { redirectToPath: redirectUrl }); + } else { + redirectUrl = genericComponentOverrideContext.getRedirectToPathFromURL(); + if (redirectUrl) { + url = utils.appendQueryParamsToURL(url, { redirectToPath: redirectUrl }); + } + } + return [ + 2 /*return*/, + genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().redirectToUrl( + url, + history + ), + ]; } }); }); diff --git a/lib/build/multifactorauth-shared2.js b/lib/build/multifactorauth-shared2.js index 1f8eafe1c..26dfa980a 100644 --- a/lib/build/multifactorauth-shared2.js +++ b/lib/build/multifactorauth-shared2.js @@ -35,12 +35,26 @@ var Wrapper = /** @class */ (function () { }) ); }; + Wrapper.redirectToFactor = function (factorId, redirectBack, history) { + if (redirectBack === void 0) { + redirectBack = true; + } + return recipe.MultiFactorAuth.getInstanceOrThrow().redirectToFactor(factorId, redirectBack, history); + }; + Wrapper.redirectToFactorChooser = function (redirectBack, history) { + if (redirectBack === void 0) { + redirectBack = true; + } + return recipe.MultiFactorAuth.getInstanceOrThrow().redirectToFactorChooser(redirectBack, history); + }; Wrapper.MultiFactorAuthClaim = recipe.MultiFactorAuth.MultiFactorAuthClaim; Wrapper.ComponentsOverrideProvider = Provider; return Wrapper; })(); var init = Wrapper.init; var getMFAInfo = Wrapper.getMFAInfo; +var redirectToFactor = Wrapper.redirectToFactor; +var redirectToFactorChooser = Wrapper.redirectToFactorChooser; var MultiFactorAuthComponentsOverrideProvider = Wrapper.ComponentsOverrideProvider; var MultiFactorAuthClaim = recipe.MultiFactorAuth.MultiFactorAuthClaim; @@ -49,4 +63,6 @@ exports.MultiFactorAuthComponentsOverrideProvider = MultiFactorAuthComponentsOve exports.Wrapper = Wrapper; exports.getMFAInfo = getMFAInfo; exports.init = init; +exports.redirectToFactor = redirectToFactor; +exports.redirectToFactorChooser = redirectToFactorChooser; exports.useContext = useContext; diff --git a/lib/build/multifactorauth.js b/lib/build/multifactorauth.js index 20275f881..222349531 100644 --- a/lib/build/multifactorauth.js +++ b/lib/build/multifactorauth.js @@ -24,3 +24,5 @@ exports.MultiFactorAuthComponentsOverrideProvider = multifactorauth.MultiFactorA exports.default = multifactorauth.Wrapper; exports.getMFAInfo = multifactorauth.getMFAInfo; exports.init = multifactorauth.init; +exports.redirectToFactor = multifactorauth.redirectToFactor; +exports.redirectToFactorChooser = multifactorauth.redirectToFactorChooser; diff --git a/lib/build/multifactorauthprebuiltui.js b/lib/build/multifactorauthprebuiltui.js index afe5e1bc6..753794946 100644 --- a/lib/build/multifactorauthprebuiltui.js +++ b/lib/build/multifactorauthprebuiltui.js @@ -4,17 +4,18 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext var jsxRuntime = require("react/jsx-runtime"); var NormalisedURLPath = require("supertokens-web-js/utils/normalisedURLPath"); var uiEntry = require("./index2.js"); -var session = require("./session-shared3.js"); +var session = require("./session-shared.js"); var multifactorauth = require("./multifactorauth-shared2.js"); var React = require("react"); +var windowHandler = require("supertokens-web-js/utils/windowHandler"); var recipe$1 = require("./session-shared2.js"); var recipe = require("./multifactorauth-shared.js"); var SuperTokensBranding = require("./SuperTokensBranding.js"); var translations = require("./translations.js"); -var arrowLeftIcon = require("./arrowLeftIcon.js"); var translationContext = require("./translationContext.js"); +var sessionprebuiltui = require("./sessionprebuiltui.js"); +var arrowLeftIcon = require("./arrowLeftIcon.js"); var backButton = require("./emailpassword-shared7.js"); -var windowHandler = require("supertokens-web-js/utils/windowHandler"); require("supertokens-web-js"); require("supertokens-web-js/utils/cookieHandler"); require("supertokens-web-js/utils/postSuperTokensInitCallbacks"); @@ -24,7 +25,7 @@ require("supertokens-web-js/utils/normalisedURLDomain"); require("react-dom"); require("./multitenancy-shared.js"); require("supertokens-web-js/recipe/session"); -require("./session-shared.js"); +require("./session-shared3.js"); require("./recipeModule-shared.js"); require("supertokens-web-js/recipe/multifactorauth"); require("supertokens-web-js/utils/sessionClaimValidatorStore"); @@ -224,6 +225,13 @@ var FactorList = uiEntry.withOverride("MultiFactorAuthFactorList", function Mult }); function FactorChooserTheme(props) { + var t = translationContext.useTranslation(); + if (props.availableFactors.length === 0) { + return jsxRuntime.jsx(sessionprebuiltui.AccessDeniedScreen, { + useShadowDom: props.config.useShadowDom, + error: props.showBackButton ? t("MFA_NO_AVAILABLE_OPTIONS") : t("MFA_NO_AVAILABLE_OPTIONS_LOGIN"), + }); + } return jsxRuntime.jsxs( "div", genericComponentOverrideContext.__assign( @@ -239,7 +247,7 @@ function FactorChooserTheme(props) { mfaInfo: props.mfaInfo, navigateToFactor: props.navigateToFactor, }), - jsxRuntime.jsx(FactorChooserFooter, { logout: props.logout }), + jsxRuntime.jsx(FactorChooserFooter, { logout: props.onLogoutClicked }), jsxRuntime.jsx(SuperTokensBranding.SuperTokensBranding, {}), ], } @@ -276,7 +284,13 @@ function FactorChooserThemeWrapper(props) { var defaultTranslationsMultiFactorAuth = { en: genericComponentOverrideContext.__assign( genericComponentOverrideContext.__assign({}, translations.defaultTranslationsCommon.en), - { MULTI_FACTOR_CHOOSER_HEADER_TITLE: "Please select a second factor", MULTI_FACTOR_AUTH_LOGOUT: "Logout" } + { + MULTI_FACTOR_CHOOSER_HEADER_TITLE: "Please select a second factor", + MULTI_FACTOR_AUTH_LOGOUT: "Logout", + MFA_NO_AVAILABLE_OPTIONS: "You have no available secondary factors.", + MFA_NO_AVAILABLE_OPTIONS_LOGIN: + "You have no available secondary factors and cannot complete the sign-in process. Please contact support.", + } ), }; @@ -339,11 +353,14 @@ var FactorChooser$1 = function (props) { var id = _a.id; return mfaClaimValue.value.n.length === 0 || mfaClaimValue.value.n.includes(id); }); - if (availableFactors.length === 1) { + // If we got here when the next array is not empty, that means that the user redirected here intentionally + // In this case we do not want to automatically redirect away but show the chooser screen. + if (mfaClaimValue.value.n.length !== 0 && availableFactors.length === 1) { return [ 2 /*return*/, recipe.MultiFactorAuth.getInstanceOrThrow().redirectToFactor( availableFactors[0].id, + false, props.history ), ]; @@ -452,7 +469,7 @@ var FactorChooser$1 = function (props) { showBackButton: ((_a = mfaClaimValue.value) === null || _a === void 0 ? void 0 : _a.n.length) === 0, mfaInfo: mfaInfo, availableFactors: availableFactors, - logout: signOut, + onLogoutClicked: signOut, navigateToFactor: navigateToFactor, }; return jsxRuntime.jsx( diff --git a/lib/build/passwordless-shared2.js b/lib/build/passwordless-shared2.js index f352693b5..3c030b493 100644 --- a/lib/build/passwordless-shared2.js +++ b/lib/build/passwordless-shared2.js @@ -2,6 +2,7 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); var PasswordlessWebJS = require("supertokens-web-js/recipe/passwordless"); +var NormalisedURLPath = require("supertokens-web-js/utils/normalisedURLPath"); var postSuperTokensInitCallbacks = require("supertokens-web-js/utils/postSuperTokensInitCallbacks"); var jsxRuntime = require("react/jsx-runtime"); var utils = require("./authRecipe-shared.js"); @@ -13,27 +14,7 @@ function _interopDefault(e) { } var PasswordlessWebJS__default = /*#__PURE__*/ _interopDefault(PasswordlessWebJS); - -var LinkIcon = function () { - return jsxRuntime.jsxs( - "svg", - genericComponentOverrideContext.__assign( - { xmlns: "http://www.w3.org/2000/svg", width: "19", height: "16", viewBox: "0 0 19 16", fill: "none" }, - { - children: [ - jsxRuntime.jsx("path", { - d: "M10.9871 11.7876C10.2967 11.7898 9.61895 11.6022 9.0279 11.2453C8.43684 10.8885 7.95517 10.3762 7.63545 9.76427C7.31574 9.15235 7.17027 8.46436 7.21492 7.7754C7.25958 7.08644 7.49264 6.42298 7.88867 5.85745C7.99951 5.70075 8.16806 5.59449 8.35725 5.56206C8.54643 5.52963 8.74075 5.57368 8.89745 5.68452C9.05416 5.79536 9.16042 5.96391 9.19285 6.15309C9.22528 6.34228 9.18123 6.53659 9.07039 6.6933C8.75488 7.13913 8.60843 7.68273 8.65728 8.22672C8.70614 8.77071 8.9471 9.27952 9.337 9.662C9.55327 9.87943 9.81039 10.052 10.0936 10.1697C10.3767 10.2874 10.6804 10.348 10.9871 10.348C11.2938 10.348 11.5974 10.2874 11.8806 10.1697C12.1638 10.052 12.4209 9.87943 12.6372 9.662L16.9605 5.33865C17.3767 4.89673 17.6045 4.31005 17.5954 3.70303C17.5863 3.09602 17.3411 2.51642 16.9118 2.08715C16.4826 1.65788 15.903 1.4127 15.296 1.40362C14.6889 1.39454 14.1023 1.62226 13.6603 2.03849L11.8229 3.87592C11.7557 3.9431 11.676 3.99639 11.5882 4.03275C11.5004 4.06911 11.4063 4.08782 11.3113 4.08782C11.2163 4.08782 11.1222 4.06911 11.0345 4.03275C10.9467 3.99639 10.8669 3.9431 10.7997 3.87592C10.7325 3.80873 10.6793 3.72897 10.6429 3.64119C10.6065 3.55341 10.5878 3.45933 10.5878 3.36432C10.5878 3.26931 10.6065 3.17522 10.6429 3.08744C10.6793 2.99966 10.7325 2.91991 10.7997 2.85272L12.6372 1.0153C13.3543 0.347081 14.3028 -0.0167022 15.2828 0.000589365C16.2628 0.017881 17.1979 0.414897 17.891 1.108C18.5841 1.80109 18.9811 2.73616 18.9984 3.7162C19.0157 4.69623 18.6519 5.64472 17.9837 6.36184L13.6603 10.6852C13.309 11.0356 12.8921 11.3133 12.4334 11.5025C11.9747 11.6916 11.4832 11.7885 10.9871 11.7876Z", - fill: "#1485FF", - }), - jsxRuntime.jsx("path", { - d: "M3.7826 15.3866C3.03483 15.3879 2.3035 15.1672 1.68132 14.7524C1.05914 14.3376 0.574138 13.7474 0.287796 13.0567C0.00145422 12.3659 -0.0733288 11.6057 0.0729281 10.8723C0.219185 10.139 0.579895 9.46563 1.10933 8.93756L5.43268 4.61421C5.78326 4.26285 6.20004 3.9845 6.65891 3.79526C7.11777 3.60603 7.6096 3.50966 8.10595 3.51175C9.10694 3.5154 10.0666 3.91118 10.7792 4.61421C11.4078 5.23969 11.7952 6.06714 11.873 6.95048C11.9508 7.83382 11.7139 8.71624 11.2043 9.44195C11.0935 9.59865 10.925 9.70491 10.7358 9.73734C10.5466 9.76977 10.3523 9.72572 10.1956 9.61488C10.0389 9.50404 9.93261 9.33549 9.90018 9.14631C9.86774 8.95712 9.91179 8.7628 10.0226 8.6061C10.3381 8.16027 10.4846 7.61667 10.4357 7.07268C10.3869 6.52869 10.1459 6.01988 9.75603 5.6374C9.32308 5.18824 8.72968 4.92911 8.10595 4.91684C7.7967 4.92053 7.49134 4.9862 7.20792 5.10997C6.92449 5.23373 6.66877 5.41308 6.45587 5.6374L2.13252 9.96075C1.71629 10.4027 1.48857 10.9894 1.49765 11.5964C1.50673 12.2034 1.75191 12.783 2.18118 13.2122C2.61045 13.6415 3.19005 13.8867 3.79706 13.8958C4.40407 13.9049 4.99075 13.6771 5.43268 13.2609L7.2701 11.4235C7.33729 11.3563 7.41704 11.303 7.50482 11.2666C7.5926 11.2303 7.68669 11.2116 7.7817 11.2116C7.87671 11.2116 7.97079 11.2303 8.05857 11.2666C8.14635 11.303 8.22611 11.3563 8.29329 11.4235C8.36048 11.4907 8.41377 11.5704 8.45013 11.6582C8.48649 11.746 8.5052 11.8401 8.5052 11.9351C8.5052 12.0301 8.48649 12.1242 8.45013 12.212C8.41377 12.2997 8.36048 12.3795 8.29329 12.4467L6.45587 14.2841C6.10457 14.6345 5.68765 14.9122 5.22896 15.1014C4.77026 15.2906 4.27877 15.3875 3.7826 15.3866Z", - fill: "#1485FF", - }), - ], - } - ) - ); -}; +var NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath); var OTPIcon = function () { return jsxRuntime.jsxs( @@ -577,31 +558,16 @@ var Passwordless = /** @class */ (function (_super) { id: "otp-phone", name: "SMS based OTP", description: "Get an OTP code on your phone to complete the authentication request", - path: "/check-auth/otp-phone", + path: new NormalisedURLPath__default.default("/check-auth/otp-phone"), logo: OTPIcon, }, - { - id: "link-phone", - name: "SMS based Magic link", - description: "Get a magic link on your phone to complete the authentication request", - path: "/check-auth/link-phone", - logo: LinkIcon, - }, { id: "otp-email", name: "SMS based OTP", description: "Get an OTP code on your email address to complete the authentication request", - path: "/check-auth/otp-email", + path: new NormalisedURLPath__default.default("/check-auth/otp-email"), logo: OTPIcon, }, - { - id: "link-email", - name: "SMS based Magic link", - description: - "Get a magic link on your email address to complete the authentication request", - path: "/check-auth/link-email", - logo: LinkIcon, - }, ] ); } diff --git a/lib/build/passwordless-shared3.js b/lib/build/passwordless-shared3.js index f712fa3a7..9ab228bb6 100644 --- a/lib/build/passwordless-shared3.js +++ b/lib/build/passwordless-shared3.js @@ -12,7 +12,7 @@ var recipe = require("./session-shared2.js"); var translations = require("./translations.js"); var translationContext = require("./translationContext.js"); var button = require("./emailpassword-shared2.js"); -var session = require("./session-shared3.js"); +var session = require("./session-shared.js"); var recipe$1 = require("./passwordless-shared2.js"); var SuperTokensBranding = require("./SuperTokensBranding.js"); var generalError = require("./emailpassword-shared.js"); diff --git a/lib/build/passwordlessprebuiltui.js b/lib/build/passwordlessprebuiltui.js index 2b277bca2..68f6309d0 100644 --- a/lib/build/passwordlessprebuiltui.js +++ b/lib/build/passwordlessprebuiltui.js @@ -25,8 +25,8 @@ require("supertokens-web-js/utils/sessionClaimValidatorStore"); require("./recipeModule-shared.js"); require("./session-shared2.js"); require("supertokens-web-js/recipe/session"); -require("./session-shared3.js"); require("./session-shared.js"); +require("./session-shared3.js"); require("supertokens-web-js/utils/error"); require("./translations.js"); require("./emailpassword-shared2.js"); diff --git a/lib/build/recipe/multifactorauth/components/themes/translations.d.ts b/lib/build/recipe/multifactorauth/components/themes/translations.d.ts index 93a4eab89..0979f7608 100644 --- a/lib/build/recipe/multifactorauth/components/themes/translations.d.ts +++ b/lib/build/recipe/multifactorauth/components/themes/translations.d.ts @@ -2,6 +2,8 @@ export declare const defaultTranslationsMultiFactorAuth: { en: { MULTI_FACTOR_CHOOSER_HEADER_TITLE: string; MULTI_FACTOR_AUTH_LOGOUT: string; + MFA_NO_AVAILABLE_OPTIONS: string; + MFA_NO_AVAILABLE_OPTIONS_LOGIN: string; BRANDING_POWERED_BY_START: string; BRANDING_POWERED_BY_END: string; SOMETHING_WENT_WRONG_ERROR: string; diff --git a/lib/build/recipe/multifactorauth/index.d.ts b/lib/build/recipe/multifactorauth/index.d.ts index 3b28cd3c9..02c7496be 100644 --- a/lib/build/recipe/multifactorauth/index.d.ts +++ b/lib/build/recipe/multifactorauth/index.d.ts @@ -19,6 +19,8 @@ export default class Wrapper { factors: MFAFactorInfo; fetchResponse: Response; }>; + static redirectToFactor(factorId: string, redirectBack?: boolean, history?: any): Promise; + static redirectToFactorChooser(redirectBack?: boolean, history?: any): Promise; static ComponentsOverrideProvider: import("react").FC< import("react").PropsWithChildren<{ components: import("./types").ComponentOverrideMap; @@ -27,6 +29,8 @@ export default class Wrapper { } declare const init: typeof Wrapper.init; declare const getMFAInfo: typeof Wrapper.getMFAInfo; +declare const redirectToFactor: typeof Wrapper.redirectToFactor; +declare const redirectToFactorChooser: typeof Wrapper.redirectToFactorChooser; declare const MultiFactorAuthComponentsOverrideProvider: import("react").FC< import("react").PropsWithChildren<{ components: import("./types").ComponentOverrideMap; @@ -36,6 +40,8 @@ declare const MultiFactorAuthClaim: import("./multiFactorAuthClaim").MultiFactor export { init, getMFAInfo, + redirectToFactor, + redirectToFactorChooser, MultiFactorAuthComponentsOverrideProvider, GetRedirectionURLContext, PreAPIHookContext as PreAPIHookContext, diff --git a/lib/build/recipe/multifactorauth/recipe.d.ts b/lib/build/recipe/multifactorauth/recipe.d.ts index e25e74e95..bc4f9cc8e 100644 --- a/lib/build/recipe/multifactorauth/recipe.d.ts +++ b/lib/build/recipe/multifactorauth/recipe.d.ts @@ -22,7 +22,7 @@ export default class MultiFactorAuth extends RecipeModule< static MultiFactorAuthClaim: MultiFactorAuthClaimClass; recipeID: string; private readonly firstFactors; - private readonly secondaryFactors; + private secondaryFactors; constructor( config: NormalisedConfigWithAppInfoAndRecipeID, webJSRecipe?: WebJSRecipeInterface @@ -33,10 +33,9 @@ export default class MultiFactorAuth extends RecipeModule< static getInstance(): MultiFactorAuth | undefined; static getInstanceOrThrow(): MultiFactorAuth; getDefaultRedirectionURL: (context: GetRedirectionURLContext) => Promise; - getDefaultFirstFactors(): string[]; addMFAFactors(firstFactors: string[], secondaryFactors: SecondaryFactorRedirectionInfo[]): void; getFirstFactors(): string[]; getSecondaryFactors(): SecondaryFactorRedirectionInfo[]; - redirectToFactor(factorId: string, history?: any): Promise; - redirectToFactorChooser(history?: any): Promise; + redirectToFactor(factorId: string, redirectBack?: boolean, history?: any): Promise; + redirectToFactorChooser(redirectBack?: boolean, history?: any): Promise; } diff --git a/lib/build/recipe/multifactorauth/types.d.ts b/lib/build/recipe/multifactorauth/types.d.ts index 9f9b9b027..93d7086d8 100644 --- a/lib/build/recipe/multifactorauth/types.d.ts +++ b/lib/build/recipe/multifactorauth/types.d.ts @@ -7,6 +7,7 @@ import type { } from "../recipeModule/types"; import type { FC } from "react"; import type { OverrideableBuilder } from "supertokens-js-override"; +import type NormalisedURLPath from "supertokens-web-js/lib/build/normalisedURLPath"; import type { RecipeInterface } from "supertokens-web-js/recipe/multifactorauth"; import type { MFAFactorInfo } from "supertokens-web-js/recipe/multifactorauth/types"; export declare type ComponentOverrideMap = { @@ -63,7 +64,7 @@ export declare type FactorChooserThemeProps = { showBackButton: boolean; onBackButtonClicked: () => void; navigateToFactor: (factorId: string) => void; - logout: () => void; + onLogoutClicked: () => void; config: NormalisedConfig; userContext?: any; }; @@ -72,5 +73,5 @@ export declare type SecondaryFactorRedirectionInfo = { name: string; description: string; logo: FC; - path: string; + path: NormalisedURLPath; }; diff --git a/lib/build/recipe/session/components/features/accessDeniedScreen/index.d.ts b/lib/build/recipe/session/components/features/accessDeniedScreen/index.d.ts index 8e9166177..98add6532 100644 --- a/lib/build/recipe/session/components/features/accessDeniedScreen/index.d.ts +++ b/lib/build/recipe/session/components/features/accessDeniedScreen/index.d.ts @@ -6,6 +6,8 @@ declare const AccessDeniedScreen: React.FC< FeatureBaseProps & { recipe: Recipe; useComponentOverrides: () => ComponentOverrideMap; + useShadowDom?: boolean; + error?: string; } >; export default AccessDeniedScreen; diff --git a/lib/build/recipe/session/prebuiltui.d.ts b/lib/build/recipe/session/prebuiltui.d.ts index 01aacb148..cc68f20d5 100644 --- a/lib/build/recipe/session/prebuiltui.d.ts +++ b/lib/build/recipe/session/prebuiltui.d.ts @@ -13,7 +13,7 @@ export declare class SessionPreBuiltUI extends RecipeRouter { static getFeatureComponent( componentName: "accessDenied", props: FeatureBaseProps & { - redirectOnSessionExists?: boolean; + error?: string; userContext?: any; }, useComponentOverrides?: () => GenericComponentOverrideMap @@ -22,6 +22,8 @@ export declare class SessionPreBuiltUI extends RecipeRouter { getFeatureComponent: ( componentName: "accessDenied", props: FeatureBaseProps & { + useShadowDom?: boolean; + error?: string; userContext?: any; }, useComponentOverrides?: () => GenericComponentOverrideMap @@ -29,6 +31,8 @@ export declare class SessionPreBuiltUI extends RecipeRouter { static reset(): void; static AccessDeniedScreen: ( prop?: PropsWithChildren<{ + useShadowDom?: boolean; + error?: string; userContext?: any; }> ) => ReactElement; @@ -36,6 +40,8 @@ export declare class SessionPreBuiltUI extends RecipeRouter { } declare const AccessDeniedScreen: ( prop?: PropsWithChildren<{ + useShadowDom?: boolean; + error?: string; userContext?: any; }> ) => ReactElement; diff --git a/lib/build/recipe/session/types.d.ts b/lib/build/recipe/session/types.d.ts index f244200f8..409bfce83 100644 --- a/lib/build/recipe/session/types.d.ts +++ b/lib/build/recipe/session/types.d.ts @@ -11,11 +11,13 @@ export declare type RecipeEventWithSessionContext = RecipeEvent & { sessionContext: SessionContextUpdate; }; export declare type InputType = WebJSInputType & { + useShadowDom?: boolean; style?: string; accessDeniedScreen?: SessionFeatureBaseConfig; onHandleEvent?: (event: RecipeEventWithSessionContext) => void; }; export declare type NormalisedSessionConfig = NormalisedConfig & { + useShadowDom: boolean; accessDeniedScreen: NormalisedBaseConfig; override: { functions: ( @@ -43,6 +45,7 @@ export declare type SessionContextType = export declare type AccessDeniedThemeProps = { recipe: Session; history: any; + error?: string; config: NormalisedSessionConfig; }; export declare type ComponentOverrideMap = { diff --git a/lib/build/session-shared.js b/lib/build/session-shared.js index bd3b554b5..e19b2d6c0 100644 --- a/lib/build/session-shared.js +++ b/lib/build/session-shared.js @@ -1,10 +1,304 @@ "use strict"; var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); +var WebJSSessionRecipe = require("supertokens-web-js/recipe/session"); +var componentOverrideContext = require("./session-shared3.js"); +var recipe = require("./session-shared2.js"); +var uiEntry = require("./index2.js"); +var React = require("react"); -var _a = genericComponentOverrideContext.createGenericComponentsOverrideContext(), - useContext = _a[0], - Provider = _a[1]; +function _interopDefault(e) { + return e && e.__esModule ? e : { default: e }; +} -exports.Provider = Provider; -exports.useContext = useContext; +var React__default = /*#__PURE__*/ _interopDefault(React); + +var BooleanClaim = /** @class */ (function (_super) { + genericComponentOverrideContext.__extends(BooleanClaim, _super); + function BooleanClaim(config) { + var _this = _super.call(this, config) || this; + var validatorsWithCallbacks = genericComponentOverrideContext.__assign({}, _this.validators); + var _loop_1 = function (key) { + var validator = validatorsWithCallbacks[key]; + validatorsWithCallbacks[key] = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, validator.apply(void 0, args)), + { + onFailureRedirection: config.onFailureRedirection, + showAccessDeniedOnFailure: config.showAccessDeniedOnFailure, + } + ); + }; + }; + for (var key in validatorsWithCallbacks) { + _loop_1(key); + } + _this.validators = validatorsWithCallbacks; + return _this; + } + return BooleanClaim; +})(WebJSSessionRecipe.BooleanClaim); + +var PrimitiveArrayClaim = /** @class */ (function (_super) { + genericComponentOverrideContext.__extends(PrimitiveArrayClaim, _super); + function PrimitiveArrayClaim(config) { + var _this = _super.call(this, config) || this; + var validatorsWithCallbacks = genericComponentOverrideContext.__assign({}, _this.validators); + var _loop_1 = function (key) { + var validator = validatorsWithCallbacks[key]; + validatorsWithCallbacks[key] = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, validator.apply(void 0, args)), + { + onFailureRedirection: config.onFailureRedirection, + showAccessDeniedOnFailure: config.showAccessDeniedOnFailure, + } + ); + }; + }; + for (var key in validatorsWithCallbacks) { + _loop_1(key); + } + _this.validators = validatorsWithCallbacks; + return _this; + } + return PrimitiveArrayClaim; +})(WebJSSessionRecipe.PrimitiveArrayClaim); + +var PrimitiveClaim = /** @class */ (function (_super) { + genericComponentOverrideContext.__extends(PrimitiveClaim, _super); + function PrimitiveClaim(config) { + var _this = _super.call(this, config) || this; + var validatorsWithCallbacks = genericComponentOverrideContext.__assign({}, _this.validators); + var _loop_1 = function (key) { + var validator = validatorsWithCallbacks[key]; + validatorsWithCallbacks[key] = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, validator.apply(void 0, args)), + { + onFailureRedirection: config.onFailureRedirection, + showAccessDeniedOnFailure: config.showAccessDeniedOnFailure, + } + ); + }; + }; + for (var key in validatorsWithCallbacks) { + _loop_1(key); + } + _this.validators = validatorsWithCallbacks; + return _this; + } + return PrimitiveClaim; +})(WebJSSessionRecipe.PrimitiveClaim); + +var useSessionContext$1 = function () { + var ctx = React__default.default.useContext(uiEntry.SessionContext); + if (ctx.isDefault === true) { + throw new Error("Cannot use useSessionContext outside auth wrapper components."); + } + return ctx; +}; + +var useClaimValue$1 = function (claim) { + var ctx = useSessionContext$1(); + if (ctx.loading) { + return { + loading: true, + }; + } + if (ctx.doesSessionExist === false) { + return { + loading: false, + doesSessionExist: false, + value: undefined, + }; + } + return { + loading: false, + doesSessionExist: true, + value: claim.getValueFromPayload(ctx.accessTokenPayload), + }; +}; + +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +var SessionAPIWrapper = /** @class */ (function () { + function SessionAPIWrapper() {} + SessionAPIWrapper.init = function (config) { + return recipe.Session.init(config); + }; + SessionAPIWrapper.getUserId = function (input) { + return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { + return genericComponentOverrideContext.__generator(this, function (_a) { + return [ + 2 /*return*/, + recipe.Session.getInstanceOrThrow().getUserId({ + userContext: genericComponentOverrideContext.getNormalisedUserContext( + input === null || input === void 0 ? void 0 : input.userContext + ), + }), + ]; + }); + }); + }; + SessionAPIWrapper.getAccessToken = function (input) { + return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { + return genericComponentOverrideContext.__generator(this, function (_a) { + return [ + 2 /*return*/, + recipe.Session.getInstanceOrThrow().getAccessToken({ + userContext: genericComponentOverrideContext.getNormalisedUserContext( + input === null || input === void 0 ? void 0 : input.userContext + ), + }), + ]; + }); + }); + }; + SessionAPIWrapper.getAccessTokenPayloadSecurely = function (input) { + return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { + return genericComponentOverrideContext.__generator(this, function (_a) { + return [ + 2 /*return*/, + recipe.Session.getInstanceOrThrow().getAccessTokenPayloadSecurely({ + userContext: genericComponentOverrideContext.getNormalisedUserContext( + input === null || input === void 0 ? void 0 : input.userContext + ), + }), + ]; + }); + }); + }; + SessionAPIWrapper.attemptRefreshingSession = function () { + return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { + return genericComponentOverrideContext.__generator(this, function (_a) { + return [2 /*return*/, recipe.Session.getInstanceOrThrow().attemptRefreshingSession()]; + }); + }); + }; + SessionAPIWrapper.doesSessionExist = function (input) { + return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { + return genericComponentOverrideContext.__generator(this, function (_a) { + return [ + 2 /*return*/, + recipe.Session.getInstanceOrThrow().doesSessionExist({ + userContext: genericComponentOverrideContext.getNormalisedUserContext( + input === null || input === void 0 ? void 0 : input.userContext + ), + }), + ]; + }); + }); + }; + /** + * @deprecated + */ + SessionAPIWrapper.addAxiosInterceptors = function (axiosInstance, userContext) { + return recipe.Session.addAxiosInterceptors( + axiosInstance, + genericComponentOverrideContext.getNormalisedUserContext(userContext) + ); + }; + SessionAPIWrapper.signOut = function (input) { + return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { + return genericComponentOverrideContext.__generator(this, function (_a) { + return [ + 2 /*return*/, + recipe.Session.getInstanceOrThrow().signOut({ + userContext: genericComponentOverrideContext.getNormalisedUserContext( + input === null || input === void 0 ? void 0 : input.userContext + ), + }), + ]; + }); + }); + }; + SessionAPIWrapper.validateClaims = function (input) { + return recipe.Session.getInstanceOrThrow().validateClaims({ + overrideGlobalClaimValidators: + input === null || input === void 0 ? void 0 : input.overrideGlobalClaimValidators, + userContext: genericComponentOverrideContext.getNormalisedUserContext( + input === null || input === void 0 ? void 0 : input.userContext + ), + }); + }; + SessionAPIWrapper.getInvalidClaimsFromResponse = function (input) { + return recipe.Session.getInstanceOrThrow().getInvalidClaimsFromResponse(input); + }; + SessionAPIWrapper.getClaimValue = function (input) { + return recipe.Session.getInstanceOrThrow().getClaimValue({ + claim: input.claim, + userContext: genericComponentOverrideContext.getNormalisedUserContext( + input === null || input === void 0 ? void 0 : input.userContext + ), + }); + }; + SessionAPIWrapper.useSessionContext = useSessionContext$1; + SessionAPIWrapper.useClaimValue = useClaimValue$1; + SessionAPIWrapper.SessionAuth = uiEntry.SessionAuthWrapper; + SessionAPIWrapper.ComponentsOverrideProvider = componentOverrideContext.Provider; + return SessionAPIWrapper; +})(); +var useSessionContext = SessionAPIWrapper.useSessionContext; +var useClaimValue = SessionAPIWrapper.useClaimValue; +var SessionAuth = SessionAPIWrapper.SessionAuth; +var init = SessionAPIWrapper.init; +var getUserId = SessionAPIWrapper.getUserId; +var getAccessToken = SessionAPIWrapper.getAccessToken; +var getAccessTokenPayloadSecurely = SessionAPIWrapper.getAccessTokenPayloadSecurely; +var attemptRefreshingSession = SessionAPIWrapper.attemptRefreshingSession; +var doesSessionExist = SessionAPIWrapper.doesSessionExist; +/** + * @deprecated + */ +var addAxiosInterceptors = SessionAPIWrapper.addAxiosInterceptors; +var signOut = SessionAPIWrapper.signOut; +var validateClaims = SessionAPIWrapper.validateClaims; +var getInvalidClaimsFromResponse = SessionAPIWrapper.getInvalidClaimsFromResponse; +var getClaimValue = SessionAPIWrapper.getClaimValue; +var SessionComponentsOverrideProvider = SessionAPIWrapper.ComponentsOverrideProvider; + +exports.BooleanClaim = BooleanClaim; +exports.PrimitiveArrayClaim = PrimitiveArrayClaim; +exports.PrimitiveClaim = PrimitiveClaim; +exports.SessionAPIWrapper = SessionAPIWrapper; +exports.SessionAuth = SessionAuth; +exports.SessionComponentsOverrideProvider = SessionComponentsOverrideProvider; +exports.addAxiosInterceptors = addAxiosInterceptors; +exports.attemptRefreshingSession = attemptRefreshingSession; +exports.doesSessionExist = doesSessionExist; +exports.getAccessToken = getAccessToken; +exports.getAccessTokenPayloadSecurely = getAccessTokenPayloadSecurely; +exports.getClaimValue = getClaimValue; +exports.getInvalidClaimsFromResponse = getInvalidClaimsFromResponse; +exports.getUserId = getUserId; +exports.init = init; +exports.signOut = signOut; +exports.useClaimValue = useClaimValue; +exports.useSessionContext = useSessionContext$1; +exports.useSessionContext$1 = useSessionContext; +exports.validateClaims = validateClaims; diff --git a/lib/build/session-shared3.js b/lib/build/session-shared3.js index c9e7ddfa8..bd3b554b5 100644 --- a/lib/build/session-shared3.js +++ b/lib/build/session-shared3.js @@ -1,304 +1,10 @@ "use strict"; var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); -var WebJSSessionRecipe = require("supertokens-web-js/recipe/session"); -var componentOverrideContext = require("./session-shared.js"); -var recipe = require("./session-shared2.js"); -var uiEntry = require("./index2.js"); -var React = require("react"); -function _interopDefault(e) { - return e && e.__esModule ? e : { default: e }; -} +var _a = genericComponentOverrideContext.createGenericComponentsOverrideContext(), + useContext = _a[0], + Provider = _a[1]; -var React__default = /*#__PURE__*/ _interopDefault(React); - -var BooleanClaim = /** @class */ (function (_super) { - genericComponentOverrideContext.__extends(BooleanClaim, _super); - function BooleanClaim(config) { - var _this = _super.call(this, config) || this; - var validatorsWithCallbacks = genericComponentOverrideContext.__assign({}, _this.validators); - var _loop_1 = function (key) { - var validator = validatorsWithCallbacks[key]; - validatorsWithCallbacks[key] = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, validator.apply(void 0, args)), - { - onFailureRedirection: config.onFailureRedirection, - showAccessDeniedOnFailure: config.showAccessDeniedOnFailure, - } - ); - }; - }; - for (var key in validatorsWithCallbacks) { - _loop_1(key); - } - _this.validators = validatorsWithCallbacks; - return _this; - } - return BooleanClaim; -})(WebJSSessionRecipe.BooleanClaim); - -var PrimitiveArrayClaim = /** @class */ (function (_super) { - genericComponentOverrideContext.__extends(PrimitiveArrayClaim, _super); - function PrimitiveArrayClaim(config) { - var _this = _super.call(this, config) || this; - var validatorsWithCallbacks = genericComponentOverrideContext.__assign({}, _this.validators); - var _loop_1 = function (key) { - var validator = validatorsWithCallbacks[key]; - validatorsWithCallbacks[key] = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, validator.apply(void 0, args)), - { - onFailureRedirection: config.onFailureRedirection, - showAccessDeniedOnFailure: config.showAccessDeniedOnFailure, - } - ); - }; - }; - for (var key in validatorsWithCallbacks) { - _loop_1(key); - } - _this.validators = validatorsWithCallbacks; - return _this; - } - return PrimitiveArrayClaim; -})(WebJSSessionRecipe.PrimitiveArrayClaim); - -var PrimitiveClaim = /** @class */ (function (_super) { - genericComponentOverrideContext.__extends(PrimitiveClaim, _super); - function PrimitiveClaim(config) { - var _this = _super.call(this, config) || this; - var validatorsWithCallbacks = genericComponentOverrideContext.__assign({}, _this.validators); - var _loop_1 = function (key) { - var validator = validatorsWithCallbacks[key]; - validatorsWithCallbacks[key] = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return genericComponentOverrideContext.__assign( - genericComponentOverrideContext.__assign({}, validator.apply(void 0, args)), - { - onFailureRedirection: config.onFailureRedirection, - showAccessDeniedOnFailure: config.showAccessDeniedOnFailure, - } - ); - }; - }; - for (var key in validatorsWithCallbacks) { - _loop_1(key); - } - _this.validators = validatorsWithCallbacks; - return _this; - } - return PrimitiveClaim; -})(WebJSSessionRecipe.PrimitiveClaim); - -var useSessionContext$1 = function () { - var ctx = React__default.default.useContext(uiEntry.SessionContext); - if (ctx.isDefault === true) { - throw new Error("Cannot use useSessionContext outside auth wrapper components."); - } - return ctx; -}; - -var useClaimValue$1 = function (claim) { - var ctx = useSessionContext$1(); - if (ctx.loading) { - return { - loading: true, - }; - } - if (ctx.doesSessionExist === false) { - return { - loading: false, - doesSessionExist: false, - value: undefined, - }; - } - return { - loading: false, - doesSessionExist: true, - value: claim.getValueFromPayload(ctx.accessTokenPayload), - }; -}; - -/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. - * - * This software is licensed under the Apache License, Version 2.0 (the - * "License") as published by the Apache Software Foundation. - * - * You may not use this file except in compliance with the License. You may - * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -var SessionAPIWrapper = /** @class */ (function () { - function SessionAPIWrapper() {} - SessionAPIWrapper.init = function (config) { - return recipe.Session.init(config); - }; - SessionAPIWrapper.getUserId = function (input) { - return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { - return genericComponentOverrideContext.__generator(this, function (_a) { - return [ - 2 /*return*/, - recipe.Session.getInstanceOrThrow().getUserId({ - userContext: genericComponentOverrideContext.getNormalisedUserContext( - input === null || input === void 0 ? void 0 : input.userContext - ), - }), - ]; - }); - }); - }; - SessionAPIWrapper.getAccessToken = function (input) { - return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { - return genericComponentOverrideContext.__generator(this, function (_a) { - return [ - 2 /*return*/, - recipe.Session.getInstanceOrThrow().getAccessToken({ - userContext: genericComponentOverrideContext.getNormalisedUserContext( - input === null || input === void 0 ? void 0 : input.userContext - ), - }), - ]; - }); - }); - }; - SessionAPIWrapper.getAccessTokenPayloadSecurely = function (input) { - return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { - return genericComponentOverrideContext.__generator(this, function (_a) { - return [ - 2 /*return*/, - recipe.Session.getInstanceOrThrow().getAccessTokenPayloadSecurely({ - userContext: genericComponentOverrideContext.getNormalisedUserContext( - input === null || input === void 0 ? void 0 : input.userContext - ), - }), - ]; - }); - }); - }; - SessionAPIWrapper.attemptRefreshingSession = function () { - return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { - return genericComponentOverrideContext.__generator(this, function (_a) { - return [2 /*return*/, recipe.Session.getInstanceOrThrow().attemptRefreshingSession()]; - }); - }); - }; - SessionAPIWrapper.doesSessionExist = function (input) { - return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { - return genericComponentOverrideContext.__generator(this, function (_a) { - return [ - 2 /*return*/, - recipe.Session.getInstanceOrThrow().doesSessionExist({ - userContext: genericComponentOverrideContext.getNormalisedUserContext( - input === null || input === void 0 ? void 0 : input.userContext - ), - }), - ]; - }); - }); - }; - /** - * @deprecated - */ - SessionAPIWrapper.addAxiosInterceptors = function (axiosInstance, userContext) { - return recipe.Session.addAxiosInterceptors( - axiosInstance, - genericComponentOverrideContext.getNormalisedUserContext(userContext) - ); - }; - SessionAPIWrapper.signOut = function (input) { - return genericComponentOverrideContext.__awaiter(this, void 0, void 0, function () { - return genericComponentOverrideContext.__generator(this, function (_a) { - return [ - 2 /*return*/, - recipe.Session.getInstanceOrThrow().signOut({ - userContext: genericComponentOverrideContext.getNormalisedUserContext( - input === null || input === void 0 ? void 0 : input.userContext - ), - }), - ]; - }); - }); - }; - SessionAPIWrapper.validateClaims = function (input) { - return recipe.Session.getInstanceOrThrow().validateClaims({ - overrideGlobalClaimValidators: - input === null || input === void 0 ? void 0 : input.overrideGlobalClaimValidators, - userContext: genericComponentOverrideContext.getNormalisedUserContext( - input === null || input === void 0 ? void 0 : input.userContext - ), - }); - }; - SessionAPIWrapper.getInvalidClaimsFromResponse = function (input) { - return recipe.Session.getInstanceOrThrow().getInvalidClaimsFromResponse(input); - }; - SessionAPIWrapper.getClaimValue = function (input) { - return recipe.Session.getInstanceOrThrow().getClaimValue({ - claim: input.claim, - userContext: genericComponentOverrideContext.getNormalisedUserContext( - input === null || input === void 0 ? void 0 : input.userContext - ), - }); - }; - SessionAPIWrapper.useSessionContext = useSessionContext$1; - SessionAPIWrapper.useClaimValue = useClaimValue$1; - SessionAPIWrapper.SessionAuth = uiEntry.SessionAuthWrapper; - SessionAPIWrapper.ComponentsOverrideProvider = componentOverrideContext.Provider; - return SessionAPIWrapper; -})(); -var useSessionContext = SessionAPIWrapper.useSessionContext; -var useClaimValue = SessionAPIWrapper.useClaimValue; -var SessionAuth = SessionAPIWrapper.SessionAuth; -var init = SessionAPIWrapper.init; -var getUserId = SessionAPIWrapper.getUserId; -var getAccessToken = SessionAPIWrapper.getAccessToken; -var getAccessTokenPayloadSecurely = SessionAPIWrapper.getAccessTokenPayloadSecurely; -var attemptRefreshingSession = SessionAPIWrapper.attemptRefreshingSession; -var doesSessionExist = SessionAPIWrapper.doesSessionExist; -/** - * @deprecated - */ -var addAxiosInterceptors = SessionAPIWrapper.addAxiosInterceptors; -var signOut = SessionAPIWrapper.signOut; -var validateClaims = SessionAPIWrapper.validateClaims; -var getInvalidClaimsFromResponse = SessionAPIWrapper.getInvalidClaimsFromResponse; -var getClaimValue = SessionAPIWrapper.getClaimValue; -var SessionComponentsOverrideProvider = SessionAPIWrapper.ComponentsOverrideProvider; - -exports.BooleanClaim = BooleanClaim; -exports.PrimitiveArrayClaim = PrimitiveArrayClaim; -exports.PrimitiveClaim = PrimitiveClaim; -exports.SessionAPIWrapper = SessionAPIWrapper; -exports.SessionAuth = SessionAuth; -exports.SessionComponentsOverrideProvider = SessionComponentsOverrideProvider; -exports.addAxiosInterceptors = addAxiosInterceptors; -exports.attemptRefreshingSession = attemptRefreshingSession; -exports.doesSessionExist = doesSessionExist; -exports.getAccessToken = getAccessToken; -exports.getAccessTokenPayloadSecurely = getAccessTokenPayloadSecurely; -exports.getClaimValue = getClaimValue; -exports.getInvalidClaimsFromResponse = getInvalidClaimsFromResponse; -exports.getUserId = getUserId; -exports.init = init; -exports.signOut = signOut; -exports.useClaimValue = useClaimValue; -exports.useSessionContext = useSessionContext$1; -exports.useSessionContext$1 = useSessionContext; -exports.validateClaims = validateClaims; +exports.Provider = Provider; +exports.useContext = useContext; diff --git a/lib/build/session.js b/lib/build/session.js index c109ea077..1b65118a2 100644 --- a/lib/build/session.js +++ b/lib/build/session.js @@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); require("./genericComponentOverrideContext.js"); -var session = require("./session-shared3.js"); -require("./session-shared.js"); +var session = require("./session-shared.js"); +require("./session-shared3.js"); require("./session-shared2.js"); var uiEntry = require("./index2.js"); require("supertokens-web-js"); diff --git a/lib/build/sessionprebuiltui.js b/lib/build/sessionprebuiltui.js index 229b076ee..ed1aac330 100644 --- a/lib/build/sessionprebuiltui.js +++ b/lib/build/sessionprebuiltui.js @@ -3,7 +3,7 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); var jsxRuntime = require("react/jsx-runtime"); var uiEntry = require("./index2.js"); -var componentOverrideContext = require("./session-shared.js"); +var componentOverrideContext = require("./session-shared3.js"); var windowHandler = require("supertokens-web-js/utils/windowHandler"); var translations = require("./translations.js"); var translationContext = require("./translationContext.js"); @@ -82,7 +82,7 @@ function LogoutButton(_a) { } var styles = - '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n/* Override */\n\n[data-supertokens~="row"] {\n padding-top: 32px;\n padding-bottom: 32px;\n}\n\n[data-supertokens~="divider"] {\n padding: 0;\n margin: 24px 0;\n}\n\n[data-supertokens~="headerTitle"] {\n padding-top: 24px;\n font-style: normal;\n font-weight: 700;\n font-size: 20px;\n line-height: 30px;\n}\n\n/* Override end */\n\n[data-supertokens~="center"] {\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n flex: 1 1 auto;\n}\n\n[data-supertokens~="buttonsGroup"] {\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n\n[data-supertokens~="buttonBase"] {\n font-size: var(--font-size-1);\n line-height: 21px;\n font-weight: 500;\n background: transparent;\n outline: none;\n border: none;\n cursor: pointer;\n}\n\n[data-supertokens~="backButton"] {\n color: rgb(var(--palette-textLink));\n}\n\n[data-supertokens~="logoutButton"] {\n display: flex;\n align-items: center;\n gap: 6px;\n color: rgb(var(--palette-textGray));\n}\n'; + '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n/* Override */\n\n[data-supertokens~="row"] {\n padding-top: 32px;\n padding-bottom: 32px;\n}\n\n[data-supertokens~="divider"] {\n padding: 0;\n margin: 24px 0;\n}\n\n[data-supertokens~="headerTitle"] {\n padding-top: 24px;\n font-style: normal;\n font-weight: 700;\n font-size: 20px;\n line-height: 30px;\n}\n\n/* Override end */\n\n[data-supertokens~="center"] {\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n flex: 1 1 auto;\n}\n\n[data-supertokens~="buttonsGroup"] {\n margin-top: 24px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n\n[data-supertokens~="buttonBase"] {\n font-size: var(--font-size-1);\n line-height: 21px;\n font-weight: 500;\n background: transparent;\n outline: none;\n border: none;\n cursor: pointer;\n}\n\n[data-supertokens~="backButton"] {\n color: rgb(var(--palette-textLink));\n}\n\n[data-supertokens~="logoutButton"] {\n display: flex;\n align-items: center;\n gap: 6px;\n color: rgb(var(--palette-textGray));\n}\n'; var ThemeBase = function (_a) { var children = _a.children, @@ -166,6 +166,14 @@ var AccessDeniedScreen$2 = function (props) { ) ), jsxRuntime.jsx("div", { "data-supertokens": "divider" }), + props.error && + jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "primaryText accessDeniedError" }, + { children: [" ", props.error] } + ) + ), jsxRuntime.jsxs( "div", genericComponentOverrideContext.__assign( @@ -216,7 +224,7 @@ var defaultTranslationsSession = { }; var AccessDeniedScreen$1 = function (props) { - var _a; + var _a, _b; var recipeComponentOverrides = props.useComponentOverrides(); var history = (_a = uiEntry.UI.getReactRouterDomWithCustomHistory()) === null || _a === void 0 @@ -230,12 +238,19 @@ var AccessDeniedScreen$1 = function (props) { children: jsxRuntime.jsx( uiEntry.FeatureWrapper, genericComponentOverrideContext.__assign( - { defaultStore: defaultTranslationsSession }, + { + defaultStore: defaultTranslationsSession, + useShadowDom: + (_b = props.useShadowDom) !== null && _b !== void 0 + ? _b + : props.recipe.config.useShadowDom, + }, { children: jsxRuntime.jsx(AccessDeniedScreenTheme, { config: props.recipe.config, history: history, recipe: props.recipe, + error: props.error, }), } ) @@ -270,6 +285,8 @@ var SessionPreBuiltUI = /** @class */ (function (_super) { children: jsxRuntime.jsx(AccessDeniedScreen$1, { recipe: _this.recipeInstance, useComponentOverrides: useComponentOverrides, + error: props.error, + useShadowDom: props.useShadowDom, }), } ) diff --git a/lib/build/thirdpartyemailpasswordprebuiltui.js b/lib/build/thirdpartyemailpasswordprebuiltui.js index 4a7ef2e2e..b4ef92441 100644 --- a/lib/build/thirdpartyemailpasswordprebuiltui.js +++ b/lib/build/thirdpartyemailpasswordprebuiltui.js @@ -28,8 +28,8 @@ require("supertokens-web-js/utils/sessionClaimValidatorStore"); require("./recipeModule-shared.js"); require("./session-shared2.js"); require("supertokens-web-js/recipe/session"); -require("./session-shared3.js"); require("./session-shared.js"); +require("./session-shared3.js"); require("./emailpassword-shared3.js"); require("./emailverification-shared2.js"); require("./emailpassword-shared7.js"); diff --git a/lib/build/thirdpartypasswordlessprebuiltui.js b/lib/build/thirdpartypasswordlessprebuiltui.js index 84e521e1c..8162a42f8 100644 --- a/lib/build/thirdpartypasswordlessprebuiltui.js +++ b/lib/build/thirdpartypasswordlessprebuiltui.js @@ -28,8 +28,8 @@ require("supertokens-web-js/utils/sessionClaimValidatorStore"); require("./recipeModule-shared.js"); require("./session-shared2.js"); require("supertokens-web-js/recipe/session"); -require("./session-shared3.js"); require("./session-shared.js"); +require("./session-shared3.js"); require("./passwordless-shared.js"); require("supertokens-web-js/utils/error"); require("./emailpassword-shared2.js"); diff --git a/lib/build/thirdpartyprebuiltui.js b/lib/build/thirdpartyprebuiltui.js index f76dfe0fa..15e20a138 100644 --- a/lib/build/thirdpartyprebuiltui.js +++ b/lib/build/thirdpartyprebuiltui.js @@ -24,8 +24,8 @@ require("supertokens-web-js/utils/sessionClaimValidatorStore"); require("./recipeModule-shared.js"); require("./session-shared2.js"); require("supertokens-web-js/recipe/session"); -require("./session-shared3.js"); require("./session-shared.js"); +require("./session-shared3.js"); require("supertokens-web-js/recipe/thirdparty"); require("./authRecipe-shared.js"); require("supertokens-web-js/lib/build/normalisedURLPath"); diff --git a/lib/build/ui-entry.js b/lib/build/ui-entry.js index 5a2e95d9f..af7d68c58 100644 --- a/lib/build/ui-entry.js +++ b/lib/build/ui-entry.js @@ -12,12 +12,12 @@ require("react-dom"); require("./multitenancy-shared.js"); require("./multifactorauth-shared.js"); require("supertokens-web-js/recipe/multifactorauth"); +require("supertokens-web-js/utils"); require("supertokens-web-js/utils/postSuperTokensInitCallbacks"); require("supertokens-web-js/utils/sessionClaimValidatorStore"); require("./recipeModule-shared.js"); require("./session-shared2.js"); require("supertokens-web-js/recipe/session"); -require("supertokens-web-js/utils"); require("supertokens-web-js"); require("supertokens-web-js/utils/cookieHandler"); require("supertokens-web-js/utils/windowHandler"); diff --git a/lib/ts/components/assets/linkIcon.tsx b/lib/ts/components/assets/linkIcon.tsx deleted file mode 100644 index 6815ac02c..000000000 --- a/lib/ts/components/assets/linkIcon.tsx +++ /dev/null @@ -1,12 +0,0 @@ -export const LinkIcon = () => ( - - - - -); diff --git a/lib/ts/recipe/multifactorauth/components/features/factorChooser/index.tsx b/lib/ts/recipe/multifactorauth/components/features/factorChooser/index.tsx index 0f9f51c3e..0d68173a3 100644 --- a/lib/ts/recipe/multifactorauth/components/features/factorChooser/index.tsx +++ b/lib/ts/recipe/multifactorauth/components/features/factorChooser/index.tsx @@ -67,8 +67,15 @@ export const FactorChooser: React.FC = (props) => { mfaInfo.factors.isAllowedToSetup.includes(id) || mfaInfo.factors.isAlreadySetup.includes(id) ) .filter(({ id }) => mfaClaimValue.value!.n.length === 0 || mfaClaimValue.value!.n.includes(id)); - if (availableFactors.length === 1) { - return MultiFactorAuth.getInstanceOrThrow().redirectToFactor(availableFactors[0].id, props.history); + + // If we got here when the next array is not empty, that means that the user redirected here intentionally + // In this case we do not want to automatically redirect away but show the chooser screen. + if (mfaClaimValue.value!.n.length !== 0 && availableFactors.length === 1) { + return MultiFactorAuth.getInstanceOrThrow().redirectToFactor( + availableFactors[0].id, + false, + props.history + ); } else { setMFAInfo(mfaInfo.factors); } @@ -127,7 +134,7 @@ export const FactorChooser: React.FC = (props) => { showBackButton: mfaClaimValue.value?.n.length === 0, mfaInfo: mfaInfo, availableFactors: availableFactors, - logout: signOut, + onLogoutClicked: signOut, navigateToFactor: navigateToFactor, }; diff --git a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/index.tsx b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/index.tsx index 682b89e39..5e8483b52 100644 --- a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/index.tsx +++ b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/index.tsx @@ -15,7 +15,9 @@ import { SuperTokensBranding } from "../../../../../components/SuperTokensBranding"; import { hasFontDefined } from "../../../../../styles/styles"; +import { useTranslation } from "../../../../../translation/translationContext"; import UserContextWrapper from "../../../../../usercontext/userContextWrapper"; +import { AccessDeniedScreen } from "../../../../session/prebuiltui"; import { ThemeBase } from "../themeBase"; import { FactorChooserFooter } from "./factorChooserFooter"; @@ -25,6 +27,15 @@ import { FactorList } from "./factorList"; import type { FactorChooserThemeProps } from "../../../types"; export function FactorChooserTheme(props: FactorChooserThemeProps): JSX.Element { + const t = useTranslation(); + if (props.availableFactors.length === 0) { + return ( + + ); + } return (
- +
); diff --git a/lib/ts/recipe/multifactorauth/components/themes/translations.ts b/lib/ts/recipe/multifactorauth/components/themes/translations.ts index 468d3d52e..f5300cb9f 100644 --- a/lib/ts/recipe/multifactorauth/components/themes/translations.ts +++ b/lib/ts/recipe/multifactorauth/components/themes/translations.ts @@ -5,5 +5,9 @@ export const defaultTranslationsMultiFactorAuth = { ...defaultTranslationsCommon.en, MULTI_FACTOR_CHOOSER_HEADER_TITLE: "Please select a second factor", MULTI_FACTOR_AUTH_LOGOUT: "Logout", + + MFA_NO_AVAILABLE_OPTIONS: "You have no available secondary factors.", + MFA_NO_AVAILABLE_OPTIONS_LOGIN: + "You have no available secondary factors and cannot complete the sign-in process. Please contact support.", }, }; diff --git a/lib/ts/recipe/multifactorauth/index.ts b/lib/ts/recipe/multifactorauth/index.ts index 5161e7145..856a79f39 100644 --- a/lib/ts/recipe/multifactorauth/index.ts +++ b/lib/ts/recipe/multifactorauth/index.ts @@ -46,17 +46,29 @@ export default class Wrapper { }); } + static redirectToFactor(factorId: string, redirectBack = true, history?: any) { + return MultiFactorAuthRecipe.getInstanceOrThrow().redirectToFactor(factorId, redirectBack, history); + } + + static redirectToFactorChooser(redirectBack = true, history?: any) { + return MultiFactorAuthRecipe.getInstanceOrThrow().redirectToFactorChooser(redirectBack, history); + } + static ComponentsOverrideProvider = RecipeComponentsOverrideContextProvider; } const init = Wrapper.init; const getMFAInfo = Wrapper.getMFAInfo; +const redirectToFactor = Wrapper.redirectToFactor; +const redirectToFactorChooser = Wrapper.redirectToFactorChooser; const MultiFactorAuthComponentsOverrideProvider = Wrapper.ComponentsOverrideProvider; const MultiFactorAuthClaim = MultiFactorAuthRecipe.MultiFactorAuthClaim; export { init, getMFAInfo, + redirectToFactor, + redirectToFactorChooser, MultiFactorAuthComponentsOverrideProvider, GetRedirectionURLContext, PreAPIHookContext as PreAPIHookContext, diff --git a/lib/ts/recipe/multifactorauth/recipe.tsx b/lib/ts/recipe/multifactorauth/recipe.tsx index 6d4bcd6ed..82655ee96 100644 --- a/lib/ts/recipe/multifactorauth/recipe.tsx +++ b/lib/ts/recipe/multifactorauth/recipe.tsx @@ -18,12 +18,14 @@ */ import MultiFactorAuthWebJS from "supertokens-web-js/recipe/multifactorauth"; +import { appendQueryParamsToURL } from "supertokens-web-js/utils"; import NormalisedURLPath from "supertokens-web-js/utils/normalisedURLPath"; import { PostSuperTokensInitCallbacks } from "supertokens-web-js/utils/postSuperTokensInitCallbacks"; import { SessionClaimValidatorStore } from "supertokens-web-js/utils/sessionClaimValidatorStore"; import { SSR_ERROR } from "../../constants"; import SuperTokens from "../../superTokens"; +import { getCurrentNormalisedUrlPath, getRedirectToPathFromURL } from "../../utils"; import RecipeModule from "../recipeModule"; import { DEFAULT_FACTOR_CHOOSER_PATH } from "./constants"; @@ -57,8 +59,8 @@ export default class MultiFactorAuth extends RecipeModule< ); public recipeID = MultiFactorAuth.RECIPE_ID; - private readonly firstFactors: string[] = []; - private readonly secondaryFactors: SecondaryFactorRedirectionInfo[] = []; + private readonly firstFactors: Set = new Set(); + private secondaryFactors: SecondaryFactorRedirectionInfo[] = []; constructor( config: NormalisedConfigWithAppInfoAndRecipeID, @@ -130,46 +132,67 @@ export default class MultiFactorAuth extends RecipeModule< getDefaultRedirectionURL = async (context: GetRedirectionURLContext): Promise => { if (context.action === "FACTOR_CHOOSER") { const chooserPath = new NormalisedURLPath(DEFAULT_FACTOR_CHOOSER_PATH); - return `${this.config.appInfo.websiteBasePath.appendPath(chooserPath).getAsStringDangerous()}`; + return this.config.appInfo.websiteBasePath.appendPath(chooserPath).getAsStringDangerous(); } else if (context.action === "GO_TO_FACTOR") { const redirectInfo = this.getSecondaryFactors().find((f) => f.id === context.factorId); if (redirectInfo !== undefined) { - return redirectInfo.path; + return this.config.appInfo.websiteBasePath.appendPath(redirectInfo.path).getAsStringDangerous(); } - // TODO: access denied screen if not defined? - return "/"; + throw new Error("Requested redirect to unknown factor id"); } else { return "/"; } }; - getDefaultFirstFactors(): string[] { - return this.firstFactors; - } - addMFAFactors(firstFactors: string[], secondaryFactors: SecondaryFactorRedirectionInfo[]) { - this.firstFactors.push(...firstFactors); - this.secondaryFactors.push(...secondaryFactors); + for (const fact of firstFactors) { + this.firstFactors.add(fact); + } + this.secondaryFactors = [ + ...this.secondaryFactors.filter((factor) => + secondaryFactors.every((newFactor) => factor.id !== newFactor.id) + ), + ...secondaryFactors, + ]; } getFirstFactors() { - return this.config.firstFactors ?? this.firstFactors; + return this.config.firstFactors ?? Array.from(this.firstFactors); } getSecondaryFactors() { return this.config.getFactorInfo(this.secondaryFactors); } - async redirectToFactor(factorId: string, history?: any) { - return SuperTokens.getInstanceOrThrow().redirectToUrl( - await this.getRedirectUrl({ action: "GO_TO_FACTOR", factorId }), - history - ); + async redirectToFactor(factorId: string, redirectBack = false, history?: any) { + let url = await this.getRedirectUrl({ action: "GO_TO_FACTOR", factorId }); + + if (redirectBack) { + const redirectUrl = getCurrentNormalisedUrlPath().getAsStringDangerous(); + url = appendQueryParamsToURL(url, { redirectToPath: redirectUrl }); + } else { + const redirectUrl = getRedirectToPathFromURL(); + if (redirectUrl) { + url = appendQueryParamsToURL(url, { redirectToPath: redirectUrl }); + } + } + + return SuperTokens.getInstanceOrThrow().redirectToUrl(url, history); } - async redirectToFactorChooser(history?: any) { - return SuperTokens.getInstanceOrThrow().redirectToUrl( - await this.getRedirectUrl({ action: "FACTOR_CHOOSER" }), - history - ); + + async redirectToFactorChooser(redirectBack = false, history?: any) { + let url = await this.getRedirectUrl({ action: "FACTOR_CHOOSER" }); + + if (redirectBack) { + const redirectUrl = getCurrentNormalisedUrlPath().getAsStringDangerous(); + url = appendQueryParamsToURL(url, { redirectToPath: redirectUrl }); + } else { + const redirectUrl = getRedirectToPathFromURL(); + if (redirectUrl) { + url = appendQueryParamsToURL(url, { redirectToPath: redirectUrl }); + } + } + + return SuperTokens.getInstanceOrThrow().redirectToUrl(url, history); } } diff --git a/lib/ts/recipe/multifactorauth/types.ts b/lib/ts/recipe/multifactorauth/types.ts index 1449f6859..08b22e940 100644 --- a/lib/ts/recipe/multifactorauth/types.ts +++ b/lib/ts/recipe/multifactorauth/types.ts @@ -22,6 +22,7 @@ import type { } from "../recipeModule/types"; import type { FC } from "react"; import type { OverrideableBuilder } from "supertokens-js-override"; +import type NormalisedURLPath from "supertokens-web-js/lib/build/normalisedURLPath"; import type { RecipeInterface } from "supertokens-web-js/recipe/multifactorauth"; import type { MFAFactorInfo } from "supertokens-web-js/recipe/multifactorauth/types"; @@ -91,7 +92,7 @@ export type FactorChooserThemeProps = { showBackButton: boolean; onBackButtonClicked: () => void; navigateToFactor: (factorId: string) => void; - logout: () => void; + onLogoutClicked: () => void; config: NormalisedConfig; userContext?: any; }; @@ -101,5 +102,5 @@ export type SecondaryFactorRedirectionInfo = { name: string; description: string; logo: FC; - path: string; + path: NormalisedURLPath; }; diff --git a/lib/ts/recipe/passwordless/recipe.tsx b/lib/ts/recipe/passwordless/recipe.tsx index c070bd1ad..2348937f6 100644 --- a/lib/ts/recipe/passwordless/recipe.tsx +++ b/lib/ts/recipe/passwordless/recipe.tsx @@ -18,9 +18,9 @@ */ import PasswordlessWebJS from "supertokens-web-js/recipe/passwordless"; +import NormalisedURLPath from "supertokens-web-js/utils/normalisedURLPath"; import { PostSuperTokensInitCallbacks } from "supertokens-web-js/utils/postSuperTokensInitCallbacks"; -import { LinkIcon } from "../../components/assets/linkIcon"; import { OTPIcon } from "../../components/assets/otpIcon"; import { SSR_ERROR } from "../../constants"; import { isTest } from "../../utils"; @@ -81,31 +81,16 @@ export default class Passwordless extends AuthRecipe< id: "otp-phone", name: "SMS based OTP", description: "Get an OTP code on your phone to complete the authentication request", - path: "/check-auth/otp-phone", + path: new NormalisedURLPath("/check-auth/otp-phone"), logo: OTPIcon, }, - { - id: "link-phone", - name: "SMS based Magic link", - description: "Get a magic link on your phone to complete the authentication request", - path: "/check-auth/link-phone", - logo: LinkIcon, - }, { id: "otp-email", name: "SMS based OTP", description: "Get an OTP code on your email address to complete the authentication request", - path: "/check-auth/otp-email", + path: new NormalisedURLPath("/check-auth/otp-email"), logo: OTPIcon, }, - { - id: "link-email", - name: "SMS based Magic link", - description: - "Get a magic link on your email address to complete the authentication request", - path: "/check-auth/link-email", - logo: LinkIcon, - }, ] ); } diff --git a/lib/ts/recipe/recipeRouter/index.tsx b/lib/ts/recipe/recipeRouter/index.tsx index c6d43c30c..9ece4880b 100644 --- a/lib/ts/recipe/recipeRouter/index.tsx +++ b/lib/ts/recipe/recipeRouter/index.tsx @@ -8,6 +8,7 @@ import type RecipeModule from "../recipeModule"; import type NormalisedURLPath from "supertokens-web-js/lib/build/normalisedURLPath"; // The related ADR: https://supertokens.com/docs/contribute/decisions/multitenancy/0006 +// TODO: This could be by the recipes registering what factors they provide (at least partially) const priorityOrder: { rid: string; includes: ("thirdparty" | "emailpassword" | "passwordless")[]; @@ -52,9 +53,9 @@ function chooseComponentBasedOnFirstFactors( let maxProvided = 0; let component = undefined; // We find the component that provides the most factors - for (const { rid, factorsProvided } of priorityOrder.reverse()) { + for (const { rid, factorsProvided } of priorityOrder) { const providedByCurrent = factorsProvided.filter((id) => firstFactors.includes(id)).length; - if (providedByCurrent >= maxProvided) { + if (providedByCurrent > maxProvided) { const matchingComp = routeComponents.find((comp) => comp.recipeID === rid); if (matchingComp) { maxProvided = providedByCurrent; @@ -63,6 +64,10 @@ function chooseComponentBasedOnFirstFactors( } } + if (component === undefined) { + throw new Error("No enabled recipes overlap with the requested firstFactors: " + firstFactors); + } + return component; } diff --git a/lib/ts/recipe/session/components/features/accessDeniedScreen/index.tsx b/lib/ts/recipe/session/components/features/accessDeniedScreen/index.tsx index 3da527c3c..d7a66ff73 100644 --- a/lib/ts/recipe/session/components/features/accessDeniedScreen/index.tsx +++ b/lib/ts/recipe/session/components/features/accessDeniedScreen/index.tsx @@ -14,6 +14,8 @@ const AccessDeniedScreen: React.FC< FeatureBaseProps & { recipe: Recipe; useComponentOverrides: () => ComponentOverrideMap; + useShadowDom?: boolean; + error?: string; } > = (props) => { const recipeComponentOverrides = props.useComponentOverrides(); @@ -21,8 +23,15 @@ const AccessDeniedScreen: React.FC< return ( - - + + ); diff --git a/lib/ts/recipe/session/components/themes/accessDeniedScreenTheme/index.tsx b/lib/ts/recipe/session/components/themes/accessDeniedScreenTheme/index.tsx index 13d904618..fa3ceb5e3 100644 --- a/lib/ts/recipe/session/components/themes/accessDeniedScreenTheme/index.tsx +++ b/lib/ts/recipe/session/components/themes/accessDeniedScreenTheme/index.tsx @@ -47,6 +47,7 @@ const AccessDeniedScreen: FC = (props) => {
{t("ACCESS_DENIED")}
+ {props.error &&
{props.error}
}
diff --git a/lib/ts/recipe/session/components/themes/styles.css b/lib/ts/recipe/session/components/themes/styles.css index 053a63e9a..624b6a843 100644 --- a/lib/ts/recipe/session/components/themes/styles.css +++ b/lib/ts/recipe/session/components/themes/styles.css @@ -45,6 +45,7 @@ } [data-supertokens~="buttonsGroup"] { + margin-top: 24px; display: flex; align-items: center; justify-content: space-between; diff --git a/lib/ts/recipe/session/prebuiltui.tsx b/lib/ts/recipe/session/prebuiltui.tsx index 3adff1e5a..217cafa7f 100644 --- a/lib/ts/recipe/session/prebuiltui.tsx +++ b/lib/ts/recipe/session/prebuiltui.tsx @@ -33,7 +33,7 @@ export class SessionPreBuiltUI extends RecipeRouter { } static getFeatureComponent( componentName: "accessDenied", - props: FeatureBaseProps & { redirectOnSessionExists?: boolean; userContext?: any }, + props: FeatureBaseProps & { error?: string; userContext?: any }, useComponentOverrides: () => GenericComponentOverrideMap = useRecipeComponentOverrideContext ): JSX.Element { return SessionPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent( @@ -52,7 +52,7 @@ export class SessionPreBuiltUI extends RecipeRouter { }; getFeatureComponent = ( componentName: "accessDenied", - props: FeatureBaseProps & { userContext?: any }, + props: FeatureBaseProps & { useShadowDom?: boolean; error?: string; userContext?: any }, useComponentOverrides: () => GenericComponentOverrideMap = useRecipeComponentOverrideContext ): JSX.Element => { if (componentName === "accessDenied") { @@ -61,6 +61,8 @@ export class SessionPreBuiltUI extends RecipeRouter { ); @@ -78,8 +80,9 @@ export class SessionPreBuiltUI extends RecipeRouter { return; } - static AccessDeniedScreen = (prop: PropsWithChildren<{ userContext?: any }> = {}): ReactElement => - this.getFeatureComponent("accessDenied", prop); + static AccessDeniedScreen = ( + prop: PropsWithChildren<{ useShadowDom?: boolean; error?: string; userContext?: any }> = {} + ): ReactElement => this.getFeatureComponent("accessDenied", prop); static AccessDeniedScreenTheme = AccessDeniedScreenTheme; } diff --git a/lib/ts/recipe/session/types.ts b/lib/ts/recipe/session/types.ts index 6aae78bc3..92c7bdfa6 100644 --- a/lib/ts/recipe/session/types.ts +++ b/lib/ts/recipe/session/types.ts @@ -26,12 +26,14 @@ import type { UserInput as WebJSInputType, RecipeEvent } from "supertokens-web-j export type RecipeEventWithSessionContext = RecipeEvent & { sessionContext: SessionContextUpdate }; export type InputType = WebJSInputType & { + useShadowDom?: boolean; style?: string; accessDeniedScreen?: SessionFeatureBaseConfig; onHandleEvent?: (event: RecipeEventWithSessionContext) => void; }; export type NormalisedSessionConfig = NormalisedConfig & { + useShadowDom: boolean; accessDeniedScreen: NormalisedBaseConfig; override: { functions: ( @@ -64,6 +66,7 @@ export type SessionContextType = export type AccessDeniedThemeProps = { recipe: Session; history: any; + error?: string; config: NormalisedSessionConfig; }; From fa3d6d5a4a5642123aa1fd87bfeabde6f27520a0 Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Wed, 1 Nov 2023 00:28:55 +0100 Subject: [PATCH 13/35] feat: self-review fixes&cleanup --- lib/build/passwordless-shared2.js | 42 ++-- lib/build/passwordless-shared3.js | 233 +++++++++++------- lib/build/passwordlessprebuiltui.js | 3 +- .../components/themes/mfa/index.d.ts | 1 + .../components/themes/translations.d.ts | 1 + lib/build/recipe/passwordless/recipe.d.ts | 16 ++ .../components/themes/translations.d.ts | 1 + lib/build/thirdpartypasswordlessprebuiltui.js | 5 +- .../components/features/mfa/index.tsx | 20 +- .../components/themes/mfa/index.tsx | 143 ++++++----- .../components/themes/mfa/mfaFooter.tsx | 4 +- .../components/themes/mfa/mfaOTPFooter.tsx | 30 ++- .../passwordless/components/themes/styles.css | 25 ++ .../components/themes/translations.ts | 2 + lib/ts/recipe/passwordless/recipe.tsx | 53 ++-- 15 files changed, 360 insertions(+), 219 deletions(-) diff --git a/lib/build/passwordless-shared2.js b/lib/build/passwordless-shared2.js index 65ce53dd3..b694a3096 100644 --- a/lib/build/passwordless-shared2.js +++ b/lib/build/passwordless-shared2.js @@ -526,9 +526,20 @@ function normalisePasswordlessBaseConfig(config) { * License for the specific language governing permissions and limitations * under the License. */ -/* - * Class. - */ +var otpPhoneFactor = { + id: "otp-phone", + name: "SMS based OTP", + description: "Get an OTP code on your phone to complete the authentication request", + path: new NormalisedURLPath__default.default("/mfa/otp-phone"), + logo: OTPIcon, +}; +var otpEmailFactor = { + id: "otp-email", + name: "Email based OTP", + description: "Get an OTP code on your email address to complete the authentication request", + path: new NormalisedURLPath__default.default("/mfa/otp-email"), + logo: OTPIcon, +}; var Passwordless = /** @class */ (function (_super) { genericComponentOverrideContext.__extends(Passwordless, _super); function Passwordless(config, webJSRecipe) { @@ -545,34 +556,19 @@ var Passwordless = /** @class */ (function (_super) { }); }); }; - return _this; - } - Passwordless.init = function (config) { - var normalisedConfig = normalisePasswordlessConfig(config); postSuperTokensInitCallbacks.PostSuperTokensInitCallbacks.addPostInitCallback(function () { var mfa = recipe.MultiFactorAuth.getInstance(); if (mfa !== undefined) { mfa.addMFAFactors( ["otp-phone", "otp-email", "link-phone", "link-email"], - [ - { - id: "otp-phone", - name: "SMS based OTP", - description: "Get an OTP code on your phone to complete the authentication request", - path: new NormalisedURLPath__default.default("/check-auth/otp-phone"), - logo: OTPIcon, - }, - { - id: "otp-email", - name: "Email based OTP", - description: "Get an OTP code on your email address to complete the authentication request", - path: new NormalisedURLPath__default.default("/check-auth/otp-email"), - logo: OTPIcon, - }, - ] + [otpPhoneFactor, otpEmailFactor] ); } }); + return _this; + } + Passwordless.init = function (config) { + var normalisedConfig = normalisePasswordlessConfig(config); return { recipeID: Passwordless.RECIPE_ID, authReact: function (appInfo) { diff --git a/lib/build/passwordless-shared3.js b/lib/build/passwordless-shared3.js index 5b574b913..ceecf13f8 100644 --- a/lib/build/passwordless-shared3.js +++ b/lib/build/passwordless-shared3.js @@ -18,6 +18,7 @@ var recipe$2 = require("./multifactorauth-shared.js"); var recipe$1 = require("./passwordless-shared2.js"); var SuperTokensBranding = require("./SuperTokensBranding.js"); var generalError = require("./emailpassword-shared.js"); +var sessionprebuiltui = require("./sessionprebuiltui.js"); var checkedRoundIcon = require("./checkedRoundIcon.js"); var formBase = require("./emailpassword-shared8.js"); var validators = require("./emailpassword-shared5.js"); @@ -60,7 +61,7 @@ var React__namespace = /*#__PURE__*/ _interopNamespace(React); var STGeneralError__default = /*#__PURE__*/ _interopDefault(STGeneralError); var styles = - '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n\n[data-supertokens~="withBackButton"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n\n[data-supertokens~="generalSuccess"] {\n margin-bottom: 20px;\n -webkit-animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n}\n\n[data-supertokens~="codeInputLabelWrapper"] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="headerSubtitle"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n[data-supertokens~="sendCodeText"] {\n margin-top: 15px;\n margin-bottom: 20px;\n}\n\n[data-supertokens~="sendCodeText"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n[data-supertokens~="resendCodeBtn"] {\n width: auto;\n margin-top: 0;\n line-height: 24px;\n}\n\n[data-supertokens~="resendCodeBtn"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="resendCodeBtn"]:disabled {\n color: rgb(var(--palette-textPrimary));\n cursor: default;\n text-decoration: none;\n}\n\n[data-supertokens~="phoneInputLibRoot"] {\n display: flex;\n align-items: center;\n}\n\n[data-supertokens~="phoneInputWrapper"] {\n display: flex;\n align-items: center;\n}\n\n[data-supertokens~="phoneInputWrapper"] .iti [data-supertokens~="input"] {\n padding-left: 15px;\n}\n\n[data-supertokens~="phoneInputWrapper"] .iti {\n flex: 1 1;\n min-width: 0;\n width: 100%;\n background: transparent;\n border: none;\n color: inherit;\n outline: none;\n}\n\n[data-supertokens~="continueButtonWrapper"] {\n margin-top: 10px;\n margin-bottom: 30px;\n}\n\n.iti__country-list {\n border: 0;\n top: 40px;\n width: min(72.2vw, 320px);\n border-radius: 6;\n box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.16);\n}\n\n.iti__country {\n display: flex;\n align-items: center;\n height: 34px;\n cursor: pointer;\n\n padding: 0 8px;\n}\n\n.iti__country-name {\n color: var(--palette-textLabel);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: "0 16px";\n}\n'; + '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n\n[data-supertokens~="withBackButton"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n\n[data-supertokens~="generalSuccess"] {\n margin-bottom: 20px;\n -webkit-animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n}\n\n[data-supertokens~="codeInputLabelWrapper"] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="headerSubtitle"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n[data-supertokens~="sendCodeText"] {\n margin-top: 15px;\n margin-bottom: 20px;\n}\n\n[data-supertokens~="sendCodeText"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n[data-supertokens~="resendCodeBtn"] {\n width: auto;\n margin-top: 0;\n line-height: 24px;\n}\n\n[data-supertokens~="resendCodeBtn"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="resendCodeBtn"]:disabled {\n color: rgb(var(--palette-textPrimary));\n cursor: default;\n text-decoration: none;\n}\n\n[data-supertokens~="phoneInputLibRoot"] {\n display: flex;\n align-items: center;\n}\n\n[data-supertokens~="phoneInputWrapper"] {\n display: flex;\n align-items: center;\n}\n\n[data-supertokens~="phoneInputWrapper"] .iti [data-supertokens~="input"] {\n padding-left: 15px;\n}\n\n[data-supertokens~="phoneInputWrapper"] .iti {\n flex: 1 1;\n min-width: 0;\n width: 100%;\n background: transparent;\n border: none;\n color: inherit;\n outline: none;\n}\n\n[data-supertokens~="continueButtonWrapper"] {\n margin-top: 10px;\n margin-bottom: 30px;\n}\n\n[data-supertokens~="footerLinkGroup"] {\n display: flex;\n justify-content: space-between;\n margin-top: 20px;\n gap: 8px;\n}\n\n[data-supertokens~="footerLinkGroup"] > div {\n margin: 0;\n}\n\n@media (max-width: 360px) {\n [data-supertokens~="footerLinkGroup"] {\n flex-direction: column;\n }\n [data-supertokens~="footerLinkGroup"] > div {\n margin: 0 auto;\n }\n}\n\n[data-supertokens~="footerLinkGroup"] div:only-child {\n margin-left: auto;\n margin-right: auto;\n}\n\n.iti__country-list {\n border: 0;\n top: 40px;\n width: min(72.2vw, 320px);\n border-radius: 6;\n box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.16);\n}\n\n.iti__country {\n display: flex;\n align-items: center;\n height: 34px;\n cursor: pointer;\n\n padding: 0 8px;\n}\n\n.iti__country-name {\n color: var(--palette-textLabel);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: "0 16px";\n}\n'; var ThemeBase = function (_a) { var children = _a.children, @@ -231,6 +232,7 @@ var defaultTranslationsPasswordless = { PWLESS_MFA_HEADER_TITLE_EMAIL: "Email based OTP", PWLESS_MFA_FOOTER_CHOOSER_ANOTHER: "Choose another factor", PWLESS_MFA_FOOTER_LOGOUT: "Logout", + PWLESS_MFA_OTP_NOT_ALLOWED_TO_SETUP: "You are not allowed to set up OTP.", /* * The following are error messages from our backend SDK. * These are returned as full messages to preserver compatibilty, but they work just like the keys above. @@ -3133,43 +3135,52 @@ var MFAFooter = uiEntry.withOverride("PasswordlessMFAFooter", function Passwordl var _a, _b; var t = translationContext.useTranslation(); var claim = session.useClaimValue(multifactorauth.MultiFactorAuthClaim); - return jsxRuntime.jsxs(jsxRuntime.Fragment, { - children: [ - claim.loading === false && - ((_b = (_a = claim.value) === null || _a === void 0 ? void 0 : _a.n.length) !== null && _b !== void 0 - ? _b - : 0) > 1 && - jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { - "data-supertokens": "secondaryText secondaryLinkWithLeftArrow", - onClick: function () { - return props.onFactorChooserButtonClicked; + return jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "footerLinkGroup pwlessMFAFooter" }, + { + children: [ + claim.loading === false && + ((_b = (_a = claim.value) === null || _a === void 0 ? void 0 : _a.n.length) !== null && + _b !== void 0 + ? _b + : 0) > 1 && + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { + "data-supertokens": "secondaryText secondaryLinkWithLeftArrow", + onClick: function () { + return props.onFactorChooserButtonClicked; + }, + }, + { children: t("PWLESS_MFA_FOOTER_CHOOSER_ANOTHER") } + ) + ), + jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { + "data-supertokens": "secondaryText secondaryLinkWithLeftArrow", + onClick: function () { + return props.onSignOutClicked; + }, }, - }, - { children: t("PWLESS_MFA_FOOTER_CHOOSER_ANOTHER") } - ) - ), - jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { - "data-supertokens": "secondaryText secondaryLinkWithLeftArrow", - onClick: function () { - return props.onSignOutClicked; - }, - }, - { - children: [ - jsxRuntime.jsx(arrowLeftIcon.ArrowLeftIcon, { color: "rgb(var(--palette-textPrimary))" }), - t("PWLESS_MFA_FOOTER_LOGOUT"), - ], - } - ) - ), - ], - }); + { + children: [ + jsxRuntime.jsx(arrowLeftIcon.ArrowLeftIcon, { + color: "rgb(var(--palette-textPrimary))", + }), + t("PWLESS_MFA_FOOTER_LOGOUT"), + ], + } + ) + ), + ], + } + ) + ); }); var MFAHeader = uiEntry.withOverride("PasswordlessMFAHeader", function PasswordlessMFAHeader(props) { @@ -3204,51 +3215,83 @@ var MFAHeader = uiEntry.withOverride("PasswordlessMFAHeader", function Passwordl }); var MFAOTPFooter = uiEntry.withOverride("PasswordlessMFAOTPFooter", function PasswordlessMFAOTPFooter(_a) { + var _b, _c; var loginAttemptInfo = _a.loginAttemptInfo, recipeImplementation = _a.recipeImplementation, onSignOutClicked = _a.onSignOutClicked, + onFactorChooserButtonClicked = _a.onFactorChooserButtonClicked, isSetupAllowed = _a.isSetupAllowed; var t = translationContext.useTranslation(); + var claim = session.useClaimValue(multifactorauth.MultiFactorAuthClaim); var userContext = uiEntry.useUserContext(); - return jsxRuntime.jsx(React.Fragment, { - children: - (isSetupAllowed && - jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { - "data-supertokens": "secondaryText secondaryLinkWithLeftArrow", - onClick: function () { - return recipeImplementation.clearLoginAttemptInfo({ - userContext: userContext, - }); + return jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "footerLinkGroup pwlessMFAOTPFooter" }, + { + children: [ + isSetupAllowed + ? jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { + "data-supertokens": "secondaryText secondaryLinkWithLeftArrow", + onClick: function () { + return recipeImplementation.clearLoginAttemptInfo({ + userContext: userContext, + }); + }, + }, + { + children: [ + jsxRuntime.jsx(arrowLeftIcon.ArrowLeftIcon, { + color: "rgb(var(--palette-textPrimary))", + }), + loginAttemptInfo.contactMethod === "EMAIL" + ? t("PWLESS_SIGN_IN_UP_CHANGE_CONTACT_INFO_EMAIL") + : t("PWLESS_SIGN_IN_UP_CHANGE_CONTACT_INFO_PHONE"), + ], + } + ) + ) + : claim.loading === false && + ((_c = (_b = claim.value) === null || _b === void 0 ? void 0 : _b.n.length) !== null && + _c !== void 0 + ? _c + : 0) > 1 && + jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { + "data-supertokens": "secondaryText secondaryLinkWithLeftArrow", + onClick: function () { + return onFactorChooserButtonClicked; + }, + }, + { children: t("PWLESS_MFA_FOOTER_CHOOSER_ANOTHER") } + ) + ), + jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { + "data-supertokens": "secondaryText secondaryLinkWithLeftArrow", + onClick: onSignOutClicked, }, - }, - { - children: [ - jsxRuntime.jsx(arrowLeftIcon.ArrowLeftIcon, { - color: "rgb(var(--palette-textPrimary))", - }), - loginAttemptInfo.contactMethod === "EMAIL" - ? t("PWLESS_SIGN_IN_UP_CHANGE_CONTACT_INFO_EMAIL") - : t("PWLESS_SIGN_IN_UP_CHANGE_CONTACT_INFO_PHONE"), - ], - } - ) - )) || - jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "secondaryText secondaryLinkWithLeftArrow", onClick: onSignOutClicked }, - { - children: [ - jsxRuntime.jsx(arrowLeftIcon.ArrowLeftIcon, { color: "rgb(var(--palette-textPrimary))" }), - t("PWLESS_MFA_LOGOUT"), - ], - } - ) - ), - }); + { + children: [ + jsxRuntime.jsx(arrowLeftIcon.ArrowLeftIcon, { + color: "rgb(var(--palette-textPrimary))", + }), + t("PWLESS_MFA_LOGOUT"), + ], + } + ) + ), + ], + } + ) + ); }); var MFAOTPHeader = uiEntry.withOverride("PasswordlessMFAOTPHeader", function PasswordlessMFAOTPHeader(_a) { @@ -3305,6 +3348,7 @@ var MFAScreens; MFAScreens[(MFAScreens["EmailForm"] = 1)] = "EmailForm"; MFAScreens[(MFAScreens["PhoneForm"] = 2)] = "PhoneForm"; MFAScreens[(MFAScreens["UserInputCodeForm"] = 3)] = "UserInputCodeForm"; + MFAScreens[(MFAScreens["AccessDenied"] = 4)] = "AccessDenied"; })(MFAScreens || (MFAScreens = {})); /* * Component. @@ -3314,6 +3358,7 @@ var MFATheme = function (_a) { featureState = _a.featureState, onBackButtonClicked = _a.onBackButtonClicked, props = genericComponentOverrideContext.__rest(_a, ["activeScreen", "featureState", "onBackButtonClicked"]); + var t = translationContext.useTranslation(); var commonProps = { recipeImplementation: props.recipeImplementation, config: props.config, @@ -3327,6 +3372,11 @@ var MFATheme = function (_a) { }; return activeScreen === MFAScreens.CloseTab ? jsxRuntime.jsx(CloseTabScreen, genericComponentOverrideContext.__assign({}, commonProps)) + : activeScreen === MFAScreens.AccessDenied + ? jsxRuntime.jsx(sessionprebuiltui.AccessDeniedScreen, { + useShadowDom: props.config.useShadowDom, + error: t(featureState.error), + }) : jsxRuntime.jsxs( "div", genericComponentOverrideContext.__assign( @@ -3340,8 +3390,6 @@ var MFATheme = function (_a) { { children: featureState.loaded && - /* TODO: this doesn't feel great */ (featureState.isSetupAllowed === true || - featureState.loginAttemptInfo !== undefined) && jsxRuntime.jsxs(React__namespace.default.Fragment, { children: [ activeScreen === MFAScreens.UserInputCodeForm @@ -3455,6 +3503,9 @@ function MFAThemeWrapper(props) { activeStyle = props.config.signInUpFeature.emailOrPhoneFormStyle; } else if (activeScreen === MFAScreens.PhoneForm) { activeStyle = props.config.signInUpFeature.emailOrPhoneFormStyle; + } else { + // TODO: test + activeStyle = ""; // styling the access denied screen is handled through the session recipe } return jsxRuntime.jsx( uiEntry.UserContextWrapper, @@ -3480,7 +3531,13 @@ function MFAThemeWrapper(props) { function getActiveScreen$1(props) { if (props.featureState.successInAnotherTab) { return MFAScreens.CloseTab; - } else if (props.featureState.loginAttemptInfo) { + } else if ( + props.featureState.error === "PWLESS_MFA_OTP_NOT_ALLOWED_TO_SETUP" || + (props.featureState.isSetupAllowed === false && props.featureState.loginAttemptInfo === undefined) + // The first condition should always be true if the second one is true, this is here as a "fallback" + ) { + return MFAScreens.AccessDenied; + } else if (props.featureState.isSetupAllowed !== true && props.featureState.loginAttemptInfo) { return MFAScreens.UserInputCodeForm; } else if (props.contactMethod === "EMAIL") { return MFAScreens.EmailForm; @@ -3783,12 +3840,12 @@ function useOnLoad(props, recipeImplementation, dispatch, userContext) { [props.recipe, userContext] ); var handleLoadError = React__namespace.useCallback( - // Test this, it may show an empty screen in many cases + // TODO: Test this, it may show an empty screen in many cases function () { - return dispatch({ type: "setError", error: "Getting mfaInfo failed!" }); + return dispatch({ type: "setError", error: "SOMETHING_WENT_WRONG_ERROR" }); }, [dispatch] - ); // TODO: translation/proper error handling) + ); var onLoad = React__namespace.useCallback( function (mfaInfo) { return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { @@ -3848,7 +3905,12 @@ function useOnLoad(props, recipeImplementation, dispatch, userContext) { return [3 /*break*/, 4]; case 3: if (!mfaInfo.factors.isAllowedToSetup.includes("otp-email")) { - dispatch({ type: "setError", error: "Factor not enabled" }); // TODO: translation + dispatch({ + type: "load", + loginAttemptInfo: loginAttemptInfo, + isAllowedToSetup: false, + error: "PWLESS_MFA_OTP_NOT_ALLOWED_TO_SETUP", + }); } else { dispatch({ type: "load", @@ -3876,7 +3938,12 @@ function useOnLoad(props, recipeImplementation, dispatch, userContext) { return [3 /*break*/, 8]; case 7: if (!mfaInfo.factors.isAllowedToSetup.includes("otp-phone")) { - dispatch({ type: "setError", error: "Factor not enabled" }); // TODO: translation + dispatch({ + type: "load", + loginAttemptInfo: loginAttemptInfo, + isAllowedToSetup: false, + error: "PWLESS_MFA_OTP_NOT_ALLOWED_TO_SETUP", + }); } else { dispatch({ type: "load", diff --git a/lib/build/passwordlessprebuiltui.js b/lib/build/passwordlessprebuiltui.js index 86d6b0a67..ce3dbc180 100644 --- a/lib/build/passwordlessprebuiltui.js +++ b/lib/build/passwordlessprebuiltui.js @@ -32,10 +32,11 @@ require("./translations.js"); require("./emailpassword-shared2.js"); require("./SuperTokensBranding.js"); require("./emailpassword-shared.js"); +require("./sessionprebuiltui.js"); +require("./arrowLeftIcon.js"); require("./checkedRoundIcon.js"); require("./emailpassword-shared8.js"); require("./emailpassword-shared5.js"); -require("./arrowLeftIcon.js"); require("./multifactorauth-shared2.js"); require("./emailpassword-shared7.js"); require("supertokens-web-js/recipe/passwordless"); diff --git a/lib/build/recipe/passwordless/components/themes/mfa/index.d.ts b/lib/build/recipe/passwordless/components/themes/mfa/index.d.ts index 78c70fdbf..bdc60d2d1 100644 --- a/lib/build/recipe/passwordless/components/themes/mfa/index.d.ts +++ b/lib/build/recipe/passwordless/components/themes/mfa/index.d.ts @@ -5,6 +5,7 @@ export declare enum MFAScreens { EmailForm = 1, PhoneForm = 2, UserInputCodeForm = 3, + AccessDenied = 4, } declare function MFAThemeWrapper(props: MFAProps): JSX.Element; export default MFAThemeWrapper; diff --git a/lib/build/recipe/passwordless/components/themes/translations.d.ts b/lib/build/recipe/passwordless/components/themes/translations.d.ts index 68e12c3a3..78ccc297c 100644 --- a/lib/build/recipe/passwordless/components/themes/translations.d.ts +++ b/lib/build/recipe/passwordless/components/themes/translations.d.ts @@ -57,6 +57,7 @@ export declare const defaultTranslationsPasswordless: { PWLESS_MFA_HEADER_TITLE_EMAIL: string; PWLESS_MFA_FOOTER_CHOOSER_ANOTHER: string; PWLESS_MFA_FOOTER_LOGOUT: string; + PWLESS_MFA_OTP_NOT_ALLOWED_TO_SETUP: string; "Failed to generate a one time code. Please try again": undefined; "Phone number is invalid": undefined; "Email is invalid": undefined; diff --git a/lib/build/recipe/passwordless/recipe.d.ts b/lib/build/recipe/passwordless/recipe.d.ts index b3f88bc60..ef693e2a5 100644 --- a/lib/build/recipe/passwordless/recipe.d.ts +++ b/lib/build/recipe/passwordless/recipe.d.ts @@ -1,4 +1,6 @@ +/// import PasswordlessWebJS from "supertokens-web-js/recipe/passwordless"; +import NormalisedURLPath from "supertokens-web-js/utils/normalisedURLPath"; import AuthRecipe from "../authRecipe"; import type { GetRedirectionURLContext, @@ -8,6 +10,20 @@ import type { UserInput, } from "./types"; import type { RecipeInitResult, NormalisedConfigWithAppInfoAndRecipeID, WebJSRecipeInterface } from "../../types"; +export declare const otpPhoneFactor: { + id: string; + name: string; + description: string; + path: NormalisedURLPath; + logo: () => JSX.Element; +}; +export declare const otpEmailFactor: { + id: string; + name: string; + description: string; + path: NormalisedURLPath; + logo: () => JSX.Element; +}; export default class Passwordless extends AuthRecipe< GetRedirectionURLContext, PreAndPostAPIHookAction, diff --git a/lib/build/recipe/thirdpartypasswordless/components/themes/translations.d.ts b/lib/build/recipe/thirdpartypasswordless/components/themes/translations.d.ts index 8afcc48ec..14113e5ca 100644 --- a/lib/build/recipe/thirdpartypasswordless/components/themes/translations.d.ts +++ b/lib/build/recipe/thirdpartypasswordless/components/themes/translations.d.ts @@ -59,6 +59,7 @@ export declare const defaultTranslationsThirdPartyPasswordless: { PWLESS_MFA_HEADER_TITLE_EMAIL: string; PWLESS_MFA_FOOTER_CHOOSER_ANOTHER: string; PWLESS_MFA_FOOTER_LOGOUT: string; + PWLESS_MFA_OTP_NOT_ALLOWED_TO_SETUP: string; "Failed to generate a one time code. Please try again": undefined; "Phone number is invalid": undefined; "Email is invalid": undefined; diff --git a/lib/build/thirdpartypasswordlessprebuiltui.js b/lib/build/thirdpartypasswordlessprebuiltui.js index 8c61dc76c..b2709e7a6 100644 --- a/lib/build/thirdpartypasswordlessprebuiltui.js +++ b/lib/build/thirdpartypasswordlessprebuiltui.js @@ -36,10 +36,11 @@ require("./emailpassword-shared2.js"); require("./passwordless-shared2.js"); require("supertokens-web-js/recipe/passwordless"); require("./authRecipe-shared.js"); +require("./sessionprebuiltui.js"); +require("./arrowLeftIcon.js"); require("./checkedRoundIcon.js"); require("./emailpassword-shared8.js"); require("./emailpassword-shared5.js"); -require("./arrowLeftIcon.js"); require("./multifactorauth-shared2.js"); require("./emailpassword-shared7.js"); require("./thirdparty-shared.js"); @@ -81,7 +82,7 @@ var NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath var React__namespace = /*#__PURE__*/ _interopNamespace(React); var styles = - '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n[data-supertokens~="withBackButton"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n[data-supertokens~="generalSuccess"] {\n margin-bottom: 20px;\n -webkit-animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n}\n[data-supertokens~="codeInputLabelWrapper"] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="headerSubtitle"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n[data-supertokens~="sendCodeText"] {\n margin-top: 15px;\n margin-bottom: 20px;\n}\n[data-supertokens~="sendCodeText"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n[data-supertokens~="resendCodeBtn"] {\n width: auto;\n margin-top: 0;\n line-height: 24px;\n}\n[data-supertokens~="resendCodeBtn"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="resendCodeBtn"]:disabled {\n color: rgb(var(--palette-textPrimary));\n cursor: default;\n text-decoration: none;\n}\n[data-supertokens~="phoneInputLibRoot"] {\n display: flex;\n align-items: center;\n}\n[data-supertokens~="phoneInputWrapper"] {\n display: flex;\n align-items: center;\n}\n[data-supertokens~="phoneInputWrapper"] .iti [data-supertokens~="input"] {\n padding-left: 15px;\n}\n[data-supertokens~="phoneInputWrapper"] .iti {\n flex: 1 1;\n min-width: 0;\n width: 100%;\n background: transparent;\n border: none;\n color: inherit;\n outline: none;\n}\n[data-supertokens~="continueButtonWrapper"] {\n margin-top: 10px;\n margin-bottom: 30px;\n}\n.iti__country-list {\n border: 0;\n top: 40px;\n width: min(72.2vw, 320px);\n border-radius: 6;\n box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.16);\n}\n.iti__country {\n display: flex;\n align-items: center;\n height: 34px;\n cursor: pointer;\n\n padding: 0 8px;\n}\n.iti__country-name {\n color: var(--palette-textLabel);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: "0 16px";\n}\n[data-supertokens~="row"] {\n padding-bottom: 30px;\n}\n[data-supertokens~="providerContainer"] {\n padding-top: 9px;\n padding-bottom: 9px;\n}\n[data-supertokens~="providerButton"] {\n border-color: rgb(221, 221, 221) !important;\n}\n[data-supertokens~="providerButton"] {\n min-height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 2px 8px;\n\n background-color: white;\n color: black;\n}\n[data-supertokens~="providerButton"]:hover {\n -webkit-filter: none !important;\n filter: none !important;\n}\n[data-supertokens~="providerButton"]:hover {\n background-color: #fafafa;\n}\n[data-supertokens~="providerButtonLeft"] {\n min-width: 34px;\n margin-left: 66px;\n}\n[data-supertokens~="providerButtonLogo"] {\n height: 30px;\n display: flex;\n}\n[data-supertokens~="providerButtonLogoCenter"] {\n display: flex;\n margin: auto;\n}\n[data-supertokens~="providerButtonText"] {\n font-weight: 400;\n text-align: center;\n justify-content: center;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n display: inline-block;\n}\n[data-supertokens~="providerButtonText"]:only-child {\n margin: 0 auto;\n}\n[data-supertokens~="thirdPartyPasswordlessDivider"] {\n padding-top: 5px;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="thirdPartyPasswordlessDividerText"] {\n flex: 1 1;\n margin-top: 0.75em;\n}\n[data-supertokens~="divider"] {\n flex: 3 3;\n}\n[data-supertokens~="providerButton"] {\n margin: auto !important;\n max-width: 240px !important;\n}\n[data-supertokens~="providerButtonLeft"] {\n margin-left: 30px !important;\n}\n'; + '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n[data-supertokens~="withBackButton"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n[data-supertokens~="generalSuccess"] {\n margin-bottom: 20px;\n -webkit-animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n}\n[data-supertokens~="codeInputLabelWrapper"] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="headerSubtitle"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n[data-supertokens~="sendCodeText"] {\n margin-top: 15px;\n margin-bottom: 20px;\n}\n[data-supertokens~="sendCodeText"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n[data-supertokens~="resendCodeBtn"] {\n width: auto;\n margin-top: 0;\n line-height: 24px;\n}\n[data-supertokens~="resendCodeBtn"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="resendCodeBtn"]:disabled {\n color: rgb(var(--palette-textPrimary));\n cursor: default;\n text-decoration: none;\n}\n[data-supertokens~="phoneInputLibRoot"] {\n display: flex;\n align-items: center;\n}\n[data-supertokens~="phoneInputWrapper"] {\n display: flex;\n align-items: center;\n}\n[data-supertokens~="phoneInputWrapper"] .iti [data-supertokens~="input"] {\n padding-left: 15px;\n}\n[data-supertokens~="phoneInputWrapper"] .iti {\n flex: 1 1;\n min-width: 0;\n width: 100%;\n background: transparent;\n border: none;\n color: inherit;\n outline: none;\n}\n[data-supertokens~="continueButtonWrapper"] {\n margin-top: 10px;\n margin-bottom: 30px;\n}\n[data-supertokens~="footerLinkGroup"] {\n display: flex;\n justify-content: space-between;\n margin-top: 20px;\n gap: 8px;\n}\n[data-supertokens~="footerLinkGroup"] > div {\n margin: 0;\n}\n@media (max-width: 360px) {\n [data-supertokens~="footerLinkGroup"] {\n flex-direction: column;\n }\n [data-supertokens~="footerLinkGroup"] > div {\n margin: 0 auto;\n }\n}\n[data-supertokens~="footerLinkGroup"] div:only-child {\n margin-left: auto;\n margin-right: auto;\n}\n.iti__country-list {\n border: 0;\n top: 40px;\n width: min(72.2vw, 320px);\n border-radius: 6;\n box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.16);\n}\n.iti__country {\n display: flex;\n align-items: center;\n height: 34px;\n cursor: pointer;\n\n padding: 0 8px;\n}\n.iti__country-name {\n color: var(--palette-textLabel);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: "0 16px";\n}\n[data-supertokens~="row"] {\n padding-bottom: 30px;\n}\n[data-supertokens~="providerContainer"] {\n padding-top: 9px;\n padding-bottom: 9px;\n}\n[data-supertokens~="providerButton"] {\n border-color: rgb(221, 221, 221) !important;\n}\n[data-supertokens~="providerButton"] {\n min-height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 2px 8px;\n\n background-color: white;\n color: black;\n}\n[data-supertokens~="providerButton"]:hover {\n -webkit-filter: none !important;\n filter: none !important;\n}\n[data-supertokens~="providerButton"]:hover {\n background-color: #fafafa;\n}\n[data-supertokens~="providerButtonLeft"] {\n min-width: 34px;\n margin-left: 66px;\n}\n[data-supertokens~="providerButtonLogo"] {\n height: 30px;\n display: flex;\n}\n[data-supertokens~="providerButtonLogoCenter"] {\n display: flex;\n margin: auto;\n}\n[data-supertokens~="providerButtonText"] {\n font-weight: 400;\n text-align: center;\n justify-content: center;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n display: inline-block;\n}\n[data-supertokens~="providerButtonText"]:only-child {\n margin: 0 auto;\n}\n[data-supertokens~="thirdPartyPasswordlessDivider"] {\n padding-top: 5px;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="thirdPartyPasswordlessDividerText"] {\n flex: 1 1;\n margin-top: 0.75em;\n}\n[data-supertokens~="divider"] {\n flex: 3 3;\n}\n[data-supertokens~="providerButton"] {\n margin: auto !important;\n max-width: 240px !important;\n}\n[data-supertokens~="providerButtonLeft"] {\n margin-left: 30px !important;\n}\n'; var ThemeBase = function (_a) { var children = _a.children, diff --git a/lib/ts/recipe/passwordless/components/features/mfa/index.tsx b/lib/ts/recipe/passwordless/components/features/mfa/index.tsx index 7c2d9504d..f81b4ef98 100644 --- a/lib/ts/recipe/passwordless/components/features/mfa/index.tsx +++ b/lib/ts/recipe/passwordless/components/features/mfa/index.tsx @@ -314,10 +314,10 @@ function useOnLoad( [props.recipe, userContext] ); const handleLoadError = React.useCallback( - // Test this, it may show an empty screen in many cases - () => dispatch({ type: "setError", error: "Getting mfaInfo failed!" }), + // TODO: Test this, it may show an empty screen in many cases + () => dispatch({ type: "setError", error: "SOMETHING_WENT_WRONG_ERROR" }), [dispatch] - ); // TODO: translation/proper error handling) + ); const onLoad = React.useCallback( async (mfaInfo: { factors: MFAFactorInfo; email?: string; phoneNumber?: string }) => { let error: string | undefined = undefined; @@ -356,7 +356,12 @@ function useOnLoad( userContext, }); } else if (!mfaInfo.factors.isAllowedToSetup.includes("otp-email")) { - dispatch({ type: "setError", error: "Factor not enabled" }); // TODO: translation + dispatch({ + type: "load", + loginAttemptInfo, + isAllowedToSetup: false, + error: "PWLESS_MFA_OTP_NOT_ALLOWED_TO_SETUP", + }); } else { dispatch({ type: "load", loginAttemptInfo, error, isAllowedToSetup: true }); // since loginAttemptInfo is undefined, this will ask the user for the email } @@ -368,7 +373,12 @@ function useOnLoad( userContext, }); } else if (!mfaInfo.factors.isAllowedToSetup.includes("otp-phone")) { - dispatch({ type: "setError", error: "Factor not enabled" }); // TODO: translation + dispatch({ + type: "load", + loginAttemptInfo, + isAllowedToSetup: false, + error: "PWLESS_MFA_OTP_NOT_ALLOWED_TO_SETUP", + }); } else { dispatch({ type: "load", loginAttemptInfo, error, isAllowedToSetup: true }); // since loginAttemptInfo is undefined, this will ask the user for the phone number } diff --git a/lib/ts/recipe/passwordless/components/themes/mfa/index.tsx b/lib/ts/recipe/passwordless/components/themes/mfa/index.tsx index 66ef03637..395241fb5 100644 --- a/lib/ts/recipe/passwordless/components/themes/mfa/index.tsx +++ b/lib/ts/recipe/passwordless/components/themes/mfa/index.tsx @@ -19,8 +19,10 @@ import React from "react"; import { SuperTokensBranding } from "../../../../../components/SuperTokensBranding"; import { hasFontDefined } from "../../../../../styles/styles"; +import { useTranslation } from "../../../../../translation/translationContext"; import UserContextWrapper from "../../../../../usercontext/userContextWrapper"; import GeneralError from "../../../../emailpassword/components/library/generalError"; +import { AccessDeniedScreen } from "../../../../session/prebuiltui"; import { CloseTabScreen } from "../signInUp/closeTabScreen"; import { EmailForm } from "../signInUp/emailForm"; import { PhoneForm } from "../signInUp/phoneForm"; @@ -39,6 +41,7 @@ export enum MFAScreens { EmailForm, PhoneForm, UserInputCodeForm, + AccessDenied, } /* @@ -50,6 +53,7 @@ const MFATheme: React.FC = ({ onBackButtonClicked, ...props }) => { + const t = useTranslation(); const commonProps = { recipeImplementation: props.recipeImplementation, config: props.config, @@ -60,73 +64,73 @@ const MFATheme: React.FC = ({ return activeScreen === MFAScreens.CloseTab ? ( + ) : activeScreen === MFAScreens.AccessDenied ? ( + ) : (
- {featureState.loaded && - /* TODO: this doesn't feel great */ (featureState.isSetupAllowed === true || - featureState.loginAttemptInfo !== undefined) && ( - - {activeScreen === MFAScreens.UserInputCodeForm ? ( - - props.recipeImplementation.clearLoginAttemptInfo({ - userContext: props.userContext, - }) - } - /> - ) : ( - - )} - {featureState.error !== undefined && } - {activeScreen === MFAScreens.EmailForm ? ( - - } - /> - ) : activeScreen === MFAScreens.PhoneForm ? ( - - } - /> - ) : activeScreen === MFAScreens.UserInputCodeForm ? ( - - } - /> - ) : null} - - )} + {featureState.loaded && ( + + {activeScreen === MFAScreens.UserInputCodeForm ? ( + + props.recipeImplementation.clearLoginAttemptInfo({ + userContext: props.userContext, + }) + } + /> + ) : ( + + )} + {featureState.error !== undefined && } + {activeScreen === MFAScreens.EmailForm ? ( + + } + /> + ) : activeScreen === MFAScreens.PhoneForm ? ( + + } + /> + ) : activeScreen === MFAScreens.UserInputCodeForm ? ( + + } + /> + ) : null} + + )}
@@ -147,6 +151,9 @@ function MFAThemeWrapper(props: MFAProps): JSX.Element { activeStyle = props.config.signInUpFeature.emailOrPhoneFormStyle; } else if (activeScreen === MFAScreens.PhoneForm) { activeStyle = props.config.signInUpFeature.emailOrPhoneFormStyle; + } else { + // TODO: test + activeStyle = ""; // styling the access denied screen is handled through the session recipe } return ( @@ -163,7 +170,13 @@ export default MFAThemeWrapper; export function getActiveScreen(props: Pick) { if (props.featureState.successInAnotherTab) { return MFAScreens.CloseTab; - } else if (props.featureState.loginAttemptInfo) { + } else if ( + props.featureState.error === "PWLESS_MFA_OTP_NOT_ALLOWED_TO_SETUP" || + (props.featureState.isSetupAllowed === false && props.featureState.loginAttemptInfo === undefined) + // The first condition should always be true if the second one is true, this is here as a "fallback" + ) { + return MFAScreens.AccessDenied; + } else if (props.featureState.isSetupAllowed !== true && props.featureState.loginAttemptInfo) { return MFAScreens.UserInputCodeForm; } else if (props.contactMethod === "EMAIL") { return MFAScreens.EmailForm; diff --git a/lib/ts/recipe/passwordless/components/themes/mfa/mfaFooter.tsx b/lib/ts/recipe/passwordless/components/themes/mfa/mfaFooter.tsx index a575a021d..851df151b 100644 --- a/lib/ts/recipe/passwordless/components/themes/mfa/mfaFooter.tsx +++ b/lib/ts/recipe/passwordless/components/themes/mfa/mfaFooter.tsx @@ -28,7 +28,7 @@ export const MFAFooter = withOverride( const claim = useClaimValue(MultiFactorAuthClaim); return ( - <> +
{claim.loading === false && (claim.value?.n.length ?? 0) > 1 && (
{t("PWLESS_MFA_FOOTER_LOGOUT")}
- +
); } ); diff --git a/lib/ts/recipe/passwordless/components/themes/mfa/mfaOTPFooter.tsx b/lib/ts/recipe/passwordless/components/themes/mfa/mfaOTPFooter.tsx index dcf63a9b3..1a8036146 100644 --- a/lib/ts/recipe/passwordless/components/themes/mfa/mfaOTPFooter.tsx +++ b/lib/ts/recipe/passwordless/components/themes/mfa/mfaOTPFooter.tsx @@ -12,12 +12,12 @@ * License for the specific language governing permissions and limitations * under the License. */ -import { Fragment } from "react"; - import ArrowLeftIcon from "../../../../../components/assets/arrowLeftIcon"; import { withOverride } from "../../../../../components/componentOverride/withOverride"; import { useTranslation } from "../../../../../translation/translationContext"; import { useUserContext } from "../../../../../usercontext"; +import { MultiFactorAuthClaim } from "../../../../multifactorauth"; +import { useClaimValue } from "../../../../session"; import type { MFAOTPFooterProps } from "../../../types"; @@ -27,14 +27,16 @@ export const MFAOTPFooter = withOverride( loginAttemptInfo, recipeImplementation, onSignOutClicked, + onFactorChooserButtonClicked, isSetupAllowed, }: MFAOTPFooterProps): JSX.Element { const t = useTranslation(); + const claim = useClaimValue(MultiFactorAuthClaim); const userContext = useUserContext(); return ( - - {(isSetupAllowed && ( +
+ {isSetupAllowed ? (
@@ -47,13 +49,21 @@ export const MFAOTPFooter = withOverride( ? t("PWLESS_SIGN_IN_UP_CHANGE_CONTACT_INFO_EMAIL") : t("PWLESS_SIGN_IN_UP_CHANGE_CONTACT_INFO_PHONE")}
- )) || ( -
- - {t("PWLESS_MFA_LOGOUT")} -
+ ) : ( + claim.loading === false && + (claim.value?.n.length ?? 0) > 1 && ( +
onFactorChooserButtonClicked}> + {t("PWLESS_MFA_FOOTER_CHOOSER_ANOTHER")} +
+ ) )} - +
+ + {t("PWLESS_MFA_LOGOUT")} +
+
); } ); diff --git a/lib/ts/recipe/passwordless/components/themes/styles.css b/lib/ts/recipe/passwordless/components/themes/styles.css index 379a9e767..b4a6f02c6 100644 --- a/lib/ts/recipe/passwordless/components/themes/styles.css +++ b/lib/ts/recipe/passwordless/components/themes/styles.css @@ -94,6 +94,31 @@ margin-bottom: 30px; } +[data-supertokens~="footerLinkGroup"] { + display: flex; + justify-content: space-between; + margin-top: 20px; + gap: 8px; +} + +[data-supertokens~="footerLinkGroup"] > div { + margin: 0; +} + +@media (max-width: 360px) { + [data-supertokens~="footerLinkGroup"] { + flex-direction: column; + } + [data-supertokens~="footerLinkGroup"] > div { + margin: 0 auto; + } +} + +[data-supertokens~="footerLinkGroup"] div:only-child { + margin-left: auto; + margin-right: auto; +} + .iti__country-list { border: 0; top: 40px; diff --git a/lib/ts/recipe/passwordless/components/themes/translations.ts b/lib/ts/recipe/passwordless/components/themes/translations.ts index b57509954..3885a07ba 100644 --- a/lib/ts/recipe/passwordless/components/themes/translations.ts +++ b/lib/ts/recipe/passwordless/components/themes/translations.ts @@ -76,6 +76,8 @@ export const defaultTranslationsPasswordless = { PWLESS_MFA_HEADER_TITLE_EMAIL: "Email based OTP", PWLESS_MFA_FOOTER_CHOOSER_ANOTHER: "Choose another factor", PWLESS_MFA_FOOTER_LOGOUT: "Logout", + + PWLESS_MFA_OTP_NOT_ALLOWED_TO_SETUP: "You are not allowed to set up OTP.", /* * The following are error messages from our backend SDK. * These are returned as full messages to preserver compatibilty, but they work just like the keys above. diff --git a/lib/ts/recipe/passwordless/recipe.tsx b/lib/ts/recipe/passwordless/recipe.tsx index a820d2855..0fee1d726 100644 --- a/lib/ts/recipe/passwordless/recipe.tsx +++ b/lib/ts/recipe/passwordless/recipe.tsx @@ -41,9 +41,21 @@ import type { RecipeInitResult, NormalisedConfigWithAppInfoAndRecipeID, WebJSRec import type { NormalisedAppInfo } from "../../types"; import type RecipeModule from "../recipeModule"; -/* - * Class. - */ +export const otpPhoneFactor = { + id: "otp-phone", + name: "SMS based OTP", + description: "Get an OTP code on your phone to complete the authentication request", + path: new NormalisedURLPath("/mfa/otp-phone"), + logo: OTPIcon, +}; +export const otpEmailFactor = { + id: "otp-email", + name: "Email based OTP", + description: "Get an OTP code on your email address to complete the authentication request", + path: new NormalisedURLPath("/mfa/otp-email"), + logo: OTPIcon, +}; + export default class Passwordless extends AuthRecipe< GetRedirectionURLContext, PreAndPostAPIHookAction, @@ -60,6 +72,16 @@ export default class Passwordless extends AuthRecipe< public readonly webJSRecipe: WebJSRecipeInterface = PasswordlessWebJS ) { super(config); + + PostSuperTokensInitCallbacks.addPostInitCallback(() => { + const mfa = MultiFactorAuth.getInstance(); + if (mfa !== undefined) { + mfa.addMFAFactors( + ["otp-phone", "otp-email", "link-phone", "link-email"], + [otpPhoneFactor, otpEmailFactor] + ); + } + }); } getDefaultRedirectionURL = async (context: GetRedirectionURLContext): Promise => { @@ -71,31 +93,6 @@ export default class Passwordless extends AuthRecipe< ): RecipeInitResult { const normalisedConfig = normalisePasswordlessConfig(config); - PostSuperTokensInitCallbacks.addPostInitCallback(() => { - const mfa = MultiFactorAuth.getInstance(); - if (mfa !== undefined) { - mfa.addMFAFactors( - ["otp-phone", "otp-email", "link-phone", "link-email"], - [ - { - id: "otp-phone", - name: "SMS based OTP", - description: "Get an OTP code on your phone to complete the authentication request", - path: new NormalisedURLPath("/check-auth/otp-phone"), - logo: OTPIcon, - }, - { - id: "otp-email", - name: "Email based OTP", - description: "Get an OTP code on your email address to complete the authentication request", - path: new NormalisedURLPath("/check-auth/otp-email"), - logo: OTPIcon, - }, - ] - ); - } - }); - return { recipeID: Passwordless.RECIPE_ID, authReact: ( From 3deb3cdda623256a59b299899a9c8bc2ce76d685 Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Mon, 6 Nov 2023 17:27:30 +0100 Subject: [PATCH 14/35] fix: firstFactors + test helpers --- lib/build/emailpassword-shared4.js | 8 ++++++++ lib/build/emailpassword.js | 3 +++ lib/build/index2.js | 3 ++- lib/build/multifactorauthprebuiltui.js | 6 ++++-- .../components/themes/factorChooser/factorOption.d.ts | 1 + lib/build/thirdparty-shared.js | 8 ++++++++ lib/build/thirdparty.js | 3 +++ lib/build/thirdpartyemailpassword.js | 3 +++ lib/build/thirdpartypasswordless.js | 6 +++--- lib/ts/recipe/emailpassword/recipe.tsx | 9 +++++++++ .../components/themes/factorChooser/factorList.tsx | 1 + .../components/themes/factorChooser/factorOption.tsx | 4 +++- .../components/themes/factorChooser/index.tsx | 2 +- lib/ts/recipe/recipeRouter/index.tsx | 3 ++- lib/ts/recipe/thirdparty/recipe.tsx | 10 ++++++++++ 15 files changed, 61 insertions(+), 9 deletions(-) diff --git a/lib/build/emailpassword-shared4.js b/lib/build/emailpassword-shared4.js index e3070936a..86c050580 100644 --- a/lib/build/emailpassword-shared4.js +++ b/lib/build/emailpassword-shared4.js @@ -3,7 +3,9 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); var EmailPasswordWebJS = require("supertokens-web-js/recipe/emailpassword"); var NormalisedURLPath = require("supertokens-web-js/utils/normalisedURLPath"); +var postSuperTokensInitCallbacks = require("supertokens-web-js/utils/postSuperTokensInitCallbacks"); var utils = require("./authRecipe-shared.js"); +var recipe = require("./multifactorauth-shared.js"); var validators = require("./emailpassword-shared5.js"); function _interopDefault(e) { @@ -446,6 +448,12 @@ var EmailPassword = /** @class */ (function (_super) { }); }); }; + postSuperTokensInitCallbacks.PostSuperTokensInitCallbacks.addPostInitCallback(function () { + var mfa = recipe.MultiFactorAuth.getInstance(); + if (mfa !== undefined) { + mfa.addMFAFactors(["emailpassword"], []); + } + }); return _this; } EmailPassword.init = function (config) { diff --git a/lib/build/emailpassword.js b/lib/build/emailpassword.js index 54ade2cbb..efd4da4be 100644 --- a/lib/build/emailpassword.js +++ b/lib/build/emailpassword.js @@ -20,6 +20,9 @@ require("./authRecipe-shared.js"); require("./recipeModule-shared.js"); require("./session-shared2.js"); require("supertokens-web-js/recipe/session"); +require("./multifactorauth-shared.js"); +require("supertokens-web-js/recipe/multifactorauth"); +require("supertokens-web-js/utils/sessionClaimValidatorStore"); require("./emailpassword-shared5.js"); /* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. diff --git a/lib/build/index2.js b/lib/build/index2.js index 0bcc45e78..0f4076127 100644 --- a/lib/build/index2.js +++ b/lib/build/index2.js @@ -535,7 +535,8 @@ var RecipeRouter = /** @class */ (function () { if (componentMatchingRid) { return componentMatchingRid; } - if (mfaRecipe) { + // TODO: check if we need this whole defaultFirstFactors thing. + if (mfaRecipe && mfaRecipe.config.firstFactors !== undefined) { return chooseComponentBasedOnFirstFactors(mfaRecipe.getFirstFactors(), routeComponents); } else { return defaultComp; diff --git a/lib/build/multifactorauthprebuiltui.js b/lib/build/multifactorauthprebuiltui.js index 753794946..2cb2a2c3c 100644 --- a/lib/build/multifactorauthprebuiltui.js +++ b/lib/build/multifactorauthprebuiltui.js @@ -150,6 +150,7 @@ var FactorChooserHeader = uiEntry.withOverride( var FactorOption = uiEntry.withOverride("MultiFactorAuthFactorOption", function MultiFactorAuthFactorOption(_a) { var onClick = _a.onClick, + id = _a.id, name = _a.name, description = _a.description, logo = _a.logo; @@ -157,7 +158,7 @@ var FactorOption = uiEntry.withOverride("MultiFactorAuthFactorOption", function return jsxRuntime.jsxs( "a", genericComponentOverrideContext.__assign( - { "data-supertokens": "factorChooserOption", onClick: onClick }, + { "data-supertokens": "factorChooserOption ".concat(id), onClick: onClick }, { children: [ jsxRuntime.jsxs( @@ -209,6 +210,7 @@ var FactorList = uiEntry.withOverride("MultiFactorAuthFactorList", function Mult return jsxRuntime.jsx( FactorOption, { + id: factor.id, name: factor.name, description: factor.description, logo: factor.logo, @@ -228,7 +230,7 @@ function FactorChooserTheme(props) { var t = translationContext.useTranslation(); if (props.availableFactors.length === 0) { return jsxRuntime.jsx(sessionprebuiltui.AccessDeniedScreen, { - useShadowDom: props.config.useShadowDom, + useShadowDom: false, error: props.showBackButton ? t("MFA_NO_AVAILABLE_OPTIONS") : t("MFA_NO_AVAILABLE_OPTIONS_LOGIN"), }); } diff --git a/lib/build/recipe/multifactorauth/components/themes/factorChooser/factorOption.d.ts b/lib/build/recipe/multifactorauth/components/themes/factorChooser/factorOption.d.ts index 1802621c5..a22f99c92 100644 --- a/lib/build/recipe/multifactorauth/components/themes/factorChooser/factorOption.d.ts +++ b/lib/build/recipe/multifactorauth/components/themes/factorChooser/factorOption.d.ts @@ -1,6 +1,7 @@ import type { FC } from "react"; export declare const FactorOption: import("react").ComponentType<{ onClick: (() => void) | undefined; + id: string; name: string; description: string; logo: FC; diff --git a/lib/build/thirdparty-shared.js b/lib/build/thirdparty-shared.js index d88cf5dee..702b79231 100644 --- a/lib/build/thirdparty-shared.js +++ b/lib/build/thirdparty-shared.js @@ -2,7 +2,9 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); var ThirdpartyWebJS = require("supertokens-web-js/recipe/thirdparty"); +var postSuperTokensInitCallbacks = require("supertokens-web-js/utils/postSuperTokensInitCallbacks"); var utils = require("./authRecipe-shared.js"); +var recipe = require("./multifactorauth-shared.js"); var jsxRuntime = require("react/jsx-runtime"); var NormalisedURLPath = require("supertokens-web-js/utils/normalisedURLPath"); var translationContext = require("./translationContext.js"); @@ -1407,6 +1409,12 @@ var ThirdParty = /** @class */ (function (_super) { ) { throw new Error("ThirdParty signInAndUpFeature providers array cannot be empty."); } + postSuperTokensInitCallbacks.PostSuperTokensInitCallbacks.addPostInitCallback(function () { + var mfa = recipe.MultiFactorAuth.getInstance(); + if (mfa !== undefined) { + mfa.addMFAFactors(["thirdparty"], []); + } + }); _this = _super.call(this, config) || this; _this.webJSRecipe = webJSRecipe; _this.recipeID = ThirdParty.RECIPE_ID; diff --git a/lib/build/thirdparty.js b/lib/build/thirdparty.js index 39d78aa94..ab560710f 100644 --- a/lib/build/thirdparty.js +++ b/lib/build/thirdparty.js @@ -19,6 +19,9 @@ require("./authRecipe-shared.js"); require("./recipeModule-shared.js"); require("./session-shared2.js"); require("supertokens-web-js/recipe/session"); +require("./multifactorauth-shared.js"); +require("supertokens-web-js/recipe/multifactorauth"); +require("supertokens-web-js/utils/sessionClaimValidatorStore"); require("./translationContext.js"); require("supertokens-web-js/lib/build/normalisedURLPath"); diff --git a/lib/build/thirdpartyemailpassword.js b/lib/build/thirdpartyemailpassword.js index def27b758..b1816806f 100644 --- a/lib/build/thirdpartyemailpassword.js +++ b/lib/build/thirdpartyemailpassword.js @@ -21,6 +21,9 @@ require("./authRecipe-shared.js"); require("./recipeModule-shared.js"); require("./session-shared2.js"); require("supertokens-web-js/recipe/session"); +require("./multifactorauth-shared.js"); +require("supertokens-web-js/recipe/multifactorauth"); +require("supertokens-web-js/utils/sessionClaimValidatorStore"); require("./translationContext.js"); require("supertokens-web-js/lib/build/normalisedURLPath"); require("supertokens-web-js/recipe/thirdpartyemailpassword"); diff --git a/lib/build/thirdpartypasswordless.js b/lib/build/thirdpartypasswordless.js index 796cbe40c..db87e7729 100644 --- a/lib/build/thirdpartypasswordless.js +++ b/lib/build/thirdpartypasswordless.js @@ -21,14 +21,14 @@ require("./authRecipe-shared.js"); require("./recipeModule-shared.js"); require("./session-shared2.js"); require("supertokens-web-js/recipe/session"); +require("./multifactorauth-shared.js"); +require("supertokens-web-js/recipe/multifactorauth"); +require("supertokens-web-js/utils/sessionClaimValidatorStore"); require("./translationContext.js"); require("supertokens-web-js/lib/build/normalisedURLPath"); require("supertokens-web-js/recipe/thirdpartypasswordless"); require("./passwordless-shared2.js"); require("supertokens-web-js/recipe/passwordless"); -require("./multifactorauth-shared.js"); -require("supertokens-web-js/recipe/multifactorauth"); -require("supertokens-web-js/utils/sessionClaimValidatorStore"); var Wrapper = /** @class */ (function () { function Wrapper() {} diff --git a/lib/ts/recipe/emailpassword/recipe.tsx b/lib/ts/recipe/emailpassword/recipe.tsx index e48caf6d1..267ad67f3 100644 --- a/lib/ts/recipe/emailpassword/recipe.tsx +++ b/lib/ts/recipe/emailpassword/recipe.tsx @@ -19,10 +19,12 @@ import EmailPasswordWebJS from "supertokens-web-js/recipe/emailpassword"; import NormalisedURLPath from "supertokens-web-js/utils/normalisedURLPath"; +import { PostSuperTokensInitCallbacks } from "supertokens-web-js/utils/postSuperTokensInitCallbacks"; import { SSR_ERROR } from "../../constants"; import { isTest } from "../../utils"; import AuthRecipe from "../authRecipe"; +import MultiFactorAuth from "../multifactorauth/recipe"; import { DEFAULT_RESET_PASSWORD_PATH } from "./constants"; import { getFunctionOverrides } from "./functionOverrides"; @@ -58,6 +60,13 @@ export default class EmailPassword extends AuthRecipe< public readonly webJSRecipe: WebJSRecipeInterface = EmailPasswordWebJS ) { super(config); + + PostSuperTokensInitCallbacks.addPostInitCallback(() => { + const mfa = MultiFactorAuth.getInstance(); + if (mfa !== undefined) { + mfa.addMFAFactors(["emailpassword"], []); + } + }); } getDefaultRedirectionURL = async (context: GetRedirectionURLContext): Promise => { diff --git a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorList.tsx b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorList.tsx index 0a06de9f1..cbce96903 100644 --- a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorList.tsx +++ b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorList.tsx @@ -35,6 +35,7 @@ export const FactorList = withOverride( {availableFactors.map((factor) => ( void) | undefined; + id: string; name: string; description: string; logo: FC; }): JSX.Element { const t = useTranslation(); return ( - +
{logo({})}
{t(name)}
diff --git a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/index.tsx b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/index.tsx index 5e8483b52..8c1e7174e 100644 --- a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/index.tsx +++ b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/index.tsx @@ -31,7 +31,7 @@ export function FactorChooserTheme(props: FactorChooserThemeProps): JSX.Element if (props.availableFactors.length === 0) { return ( ); diff --git a/lib/ts/recipe/recipeRouter/index.tsx b/lib/ts/recipe/recipeRouter/index.tsx index 9ece4880b..b9065329b 100644 --- a/lib/ts/recipe/recipeRouter/index.tsx +++ b/lib/ts/recipe/recipeRouter/index.tsx @@ -124,7 +124,8 @@ export abstract class RecipeRouter { return componentMatchingRid; } - if (mfaRecipe) { + // TODO: check if we need this whole defaultFirstFactors thing. + if (mfaRecipe && mfaRecipe.config.firstFactors !== undefined) { return chooseComponentBasedOnFirstFactors(mfaRecipe.getFirstFactors(), routeComponents); } else { return defaultComp; diff --git a/lib/ts/recipe/thirdparty/recipe.tsx b/lib/ts/recipe/thirdparty/recipe.tsx index 556700003..bc31e6114 100644 --- a/lib/ts/recipe/thirdparty/recipe.tsx +++ b/lib/ts/recipe/thirdparty/recipe.tsx @@ -18,11 +18,13 @@ */ import ThirdpartyWebJS from "supertokens-web-js/recipe/thirdparty"; +import { PostSuperTokensInitCallbacks } from "supertokens-web-js/utils/postSuperTokensInitCallbacks"; import { SSR_ERROR } from "../../constants"; import SuperTokens from "../../superTokens"; import { isTest } from "../../utils"; import AuthRecipe from "../authRecipe"; +import MultiFactorAuth from "../multifactorauth/recipe"; import { getFunctionOverrides } from "./functionOverrides"; import { normaliseThirdPartyConfig } from "./utils"; @@ -58,6 +60,14 @@ export default class ThirdParty extends AuthRecipe< if (SuperTokens.usesDynamicLoginMethods === false && config.signInAndUpFeature.providers.length === 0) { throw new Error("ThirdParty signInAndUpFeature providers array cannot be empty."); } + + PostSuperTokensInitCallbacks.addPostInitCallback(() => { + const mfa = MultiFactorAuth.getInstance(); + if (mfa !== undefined) { + mfa.addMFAFactors(["thirdparty"], []); + } + }); + super(config); } From 6b843404b02bbd963cc7c76566669e50cc931fa3 Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Mon, 6 Nov 2023 17:34:17 +0100 Subject: [PATCH 15/35] fix: small test based fixes --- .../components/features/mfa/index.tsx | 36 ++++++++++--------- .../components/themes/mfa/index.tsx | 19 +++++----- .../components/themes/mfa/mfaFooter.tsx | 4 +-- .../components/themes/mfa/mfaOTPFooter.tsx | 2 +- 4 files changed, 31 insertions(+), 30 deletions(-) diff --git a/lib/ts/recipe/passwordless/components/features/mfa/index.tsx b/lib/ts/recipe/passwordless/components/features/mfa/index.tsx index f81b4ef98..6c0b3f9c3 100644 --- a/lib/ts/recipe/passwordless/components/features/mfa/index.tsx +++ b/lib/ts/recipe/passwordless/components/features/mfa/index.tsx @@ -110,6 +110,7 @@ export const useFeatureReducer = (): [MFAState, React.Dispatch] => { case "setError": return { ...oldState, + loaded: true, error: action.error, }; case "startLogin": @@ -259,12 +260,6 @@ export const MFAFeature: React.FC< )!; useSuccessInAnotherTabChecker(callingConsumeCodeRef, recipeImplementation, state, dispatch, userContext); - useEffect(() => { - if (state.loaded && state.isSetupAllowed === false && state.loginAttemptInfo === undefined) { - void MultiFactorAuth.getInstanceOrThrow().redirectToFactorChooser(); - } - }, [state.loaded, state.isSetupAllowed, state.loginAttemptInfo]); - return ( dispatch({ type: "setError", error: "SOMETHING_WENT_WRONG_ERROR" }), [dispatch] ); @@ -350,11 +344,15 @@ function useOnLoad( if (!loginAttemptInfo) { if (props.contactMethod === "EMAIL") { if (isAlreadySetup && doSetup !== "true") { - // createCode also dispatches the necessary events - await recipeImplementation!.createCode({ - email: mfaInfo.email!, // We can assume this is set here, since the mfaInfo states that otp-email has been set up - userContext, - }); + try { + // createCode also dispatches the necessary events + await recipeImplementation!.createCode({ + email: mfaInfo.email!, // We can assume this is set here, since the mfaInfo states that otp-email has been set up + userContext, + }); + } catch (err) { + dispatch({ type: "setError", error: "SOMETHING_WENT_WRONG_ERROR" }); + } } else if (!mfaInfo.factors.isAllowedToSetup.includes("otp-email")) { dispatch({ type: "load", @@ -367,11 +365,15 @@ function useOnLoad( } } else { if (isAlreadySetup && doSetup !== "true") { - // createCode also dispatches the necessary events - await recipeImplementation!.createCode({ - phoneNumber: mfaInfo.phoneNumber!, // We can assume this is set here, since the mfaInfo states that otp-phone has been set up - userContext, - }); + try { + // createCode also dispatches the necessary events + await recipeImplementation!.createCode({ + phoneNumber: mfaInfo.phoneNumber!, // We can assume this is set here, since the mfaInfo states that otp-phone has been set up + userContext, + }); + } catch (err) { + dispatch({ type: "setError", error: "SOMETHING_WENT_WRONG_ERROR" }); + } } else if (!mfaInfo.factors.isAllowedToSetup.includes("otp-phone")) { dispatch({ type: "load", diff --git a/lib/ts/recipe/passwordless/components/themes/mfa/index.tsx b/lib/ts/recipe/passwordless/components/themes/mfa/index.tsx index 395241fb5..21ceec163 100644 --- a/lib/ts/recipe/passwordless/components/themes/mfa/index.tsx +++ b/lib/ts/recipe/passwordless/components/themes/mfa/index.tsx @@ -62,25 +62,25 @@ const MFATheme: React.FC = ({ error: featureState.error, }; + if (!featureState.loaded) { + return null; + } + return activeScreen === MFAScreens.CloseTab ? ( ) : activeScreen === MFAScreens.AccessDenied ? ( - + ) : (
- {featureState.loaded && ( + { {activeScreen === MFAScreens.UserInputCodeForm ? ( - props.recipeImplementation.clearLoginAttemptInfo({ - userContext: props.userContext, - }) - } + onBackButtonClicked={onBackButtonClicked} /> ) : ( = ({ /> ) : null} - )} + }
@@ -173,10 +173,9 @@ export function getActiveScreen(props: Pick 1 && (
props.onFactorChooserButtonClicked}> + onClick={props.onFactorChooserButtonClicked}> {t("PWLESS_MFA_FOOTER_CHOOSER_ANOTHER")}
)} -
props.onSignOutClicked}> +
{t("PWLESS_MFA_FOOTER_LOGOUT")}
diff --git a/lib/ts/recipe/passwordless/components/themes/mfa/mfaOTPFooter.tsx b/lib/ts/recipe/passwordless/components/themes/mfa/mfaOTPFooter.tsx index 1a8036146..7a0d25d1e 100644 --- a/lib/ts/recipe/passwordless/components/themes/mfa/mfaOTPFooter.tsx +++ b/lib/ts/recipe/passwordless/components/themes/mfa/mfaOTPFooter.tsx @@ -54,7 +54,7 @@ export const MFAOTPFooter = withOverride( (claim.value?.n.length ?? 0) > 1 && (
onFactorChooserButtonClicked}> + onClick={onFactorChooserButtonClicked}> {t("PWLESS_MFA_FOOTER_CHOOSER_ANOTHER")}
) From 7355f50a67588f311816d3750047b259741b5858 Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Tue, 7 Nov 2023 15:56:34 +0100 Subject: [PATCH 16/35] feat: clean up first factor handling --- lib/build/emailpassword-shared4.js | 8 --- lib/build/emailpassword.js | 3 - lib/build/genericComponentOverrideContext.js | 57 +++++++++++++++ lib/build/index2.js | 69 ++++++++----------- lib/build/logging.d.ts | 3 + lib/build/multifactorauth-shared.js | 12 +--- lib/build/passwordless-shared2.js | 37 +++++----- lib/build/recipe/multifactorauth/recipe.d.ts | 5 +- lib/build/recipe/passwordless/recipe.d.ts | 1 + lib/build/thirdparty-shared.js | 8 --- lib/build/thirdparty.js | 3 - lib/build/thirdpartyemailpassword.js | 3 - .../thirdpartyemailpasswordprebuiltui.js | 44 +++++++----- lib/build/thirdpartypasswordless.js | 6 +- lib/build/thirdpartypasswordlessprebuiltui.js | 52 ++++++++------ lib/ts/logging.ts | 36 ++++++++++ lib/ts/recipe/emailpassword/recipe.tsx | 9 --- lib/ts/recipe/multifactorauth/recipe.tsx | 10 +-- lib/ts/recipe/passwordless/recipe.tsx | 37 +++++----- lib/ts/recipe/recipeRouter/index.tsx | 41 +++++------ lib/ts/recipe/thirdparty/recipe.tsx | 9 --- .../components/themes/signInAndUp/index.tsx | 26 +++++-- .../components/themes/signInUp/index.tsx | 23 +++++-- lib/ts/superTokens.tsx | 6 ++ 24 files changed, 292 insertions(+), 216 deletions(-) create mode 100644 lib/build/logging.d.ts create mode 100644 lib/ts/logging.ts diff --git a/lib/build/emailpassword-shared4.js b/lib/build/emailpassword-shared4.js index 86c050580..e3070936a 100644 --- a/lib/build/emailpassword-shared4.js +++ b/lib/build/emailpassword-shared4.js @@ -3,9 +3,7 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); var EmailPasswordWebJS = require("supertokens-web-js/recipe/emailpassword"); var NormalisedURLPath = require("supertokens-web-js/utils/normalisedURLPath"); -var postSuperTokensInitCallbacks = require("supertokens-web-js/utils/postSuperTokensInitCallbacks"); var utils = require("./authRecipe-shared.js"); -var recipe = require("./multifactorauth-shared.js"); var validators = require("./emailpassword-shared5.js"); function _interopDefault(e) { @@ -448,12 +446,6 @@ var EmailPassword = /** @class */ (function (_super) { }); }); }; - postSuperTokensInitCallbacks.PostSuperTokensInitCallbacks.addPostInitCallback(function () { - var mfa = recipe.MultiFactorAuth.getInstance(); - if (mfa !== undefined) { - mfa.addMFAFactors(["emailpassword"], []); - } - }); return _this; } EmailPassword.init = function (config) { diff --git a/lib/build/emailpassword.js b/lib/build/emailpassword.js index efd4da4be..54ade2cbb 100644 --- a/lib/build/emailpassword.js +++ b/lib/build/emailpassword.js @@ -20,9 +20,6 @@ require("./authRecipe-shared.js"); require("./recipeModule-shared.js"); require("./session-shared2.js"); require("supertokens-web-js/recipe/session"); -require("./multifactorauth-shared.js"); -require("supertokens-web-js/recipe/multifactorauth"); -require("supertokens-web-js/utils/sessionClaimValidatorStore"); require("./emailpassword-shared5.js"); /* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. diff --git a/lib/build/genericComponentOverrideContext.js b/lib/build/genericComponentOverrideContext.js index 6ac26e707..48e7f0db5 100644 --- a/lib/build/genericComponentOverrideContext.js +++ b/lib/build/genericComponentOverrideContext.js @@ -251,6 +251,57 @@ var ST_ROOT_ID = "supertokens-root"; var SSR_ERROR = "\nIf you are trying to use this method doing server-side-rendering, please make sure you move this method inside a componentDidMount method or useEffect hook."; +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +var package_version = "0.35.5"; + +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +var SUPERTOKENS_DEBUG_NAMESPACE = "com.supertokens.auth-react"; +var doDebugLogs = false; +function enableLogging() { + doDebugLogs = true; +} +function disableLogging() { + doDebugLogs = false; +} +function logDebugMessage(message) { + if (doDebugLogs) { + // eslint-disable-next-line no-console + console.log( + "" + .concat(SUPERTOKENS_DEBUG_NAMESPACE, ' {t: "') + .concat(new Date().toISOString(), '", message: "') + .concat(message, '", supertokens-auth-react-ver: "') + .concat(package_version, '"}') + ); + } +} + /* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. * * This software is licensed under the Apache License, Version 2.0 (the @@ -1172,6 +1223,11 @@ var SuperTokens = /** @class */ (function () { if (config.enableDebugLogs !== undefined) { enableDebugLogs = config.enableDebugLogs; } + if (enableDebugLogs) { + enableLogging(); + } else { + disableLogging(); + } this.userGetRedirectionURL = config.getRedirectionURL; this.recipeList = config.recipeList.map(function (_a) { var authReact = _a.authReact; @@ -1327,6 +1383,7 @@ exports.getQueryParams = getQueryParams; exports.getRedirectToPathFromURL = getRedirectToPathFromURL; exports.getURLHash = getURLHash; exports.isTest = isTest; +exports.logDebugMessage = logDebugMessage; exports.matchRecipeIdUsingQueryParams = matchRecipeIdUsingQueryParams; exports.mergeObjects = mergeObjects; exports.normaliseRecipeModuleConfig = normaliseRecipeModuleConfig; diff --git a/lib/build/index2.js b/lib/build/index2.js index 0f4076127..edf0789be 100644 --- a/lib/build/index2.js +++ b/lib/build/index2.js @@ -409,22 +409,32 @@ var priorityOrder = [ { rid: "thirdparty", includes: ["thirdparty"], factorsProvided: ["thirdparty"] }, ]; function chooseComponentBasedOnFirstFactors(firstFactors, routeComponents) { + var fallbackRid; + var fallbackComponent; var _loop_1 = function (rid, factorsProvided) { if ( - firstFactors.length === factorsProvided.length && - factorsProvided.every(function (factor) { - return firstFactors.includes(factor); + firstFactors.every(function (factor) { + return factorsProvided.includes(factor); }) ) { var matchingComp = routeComponents.find(function (comp) { return comp.recipeID === rid; }); if (matchingComp) { - return { value: matchingComp }; + // This means that this gets overwritten by items lower in the prios list. + // This is intentional since this way we end up with the most specific recipe that covers all required factrors (pwless instead of tppwless) + fallbackRid = rid; + fallbackComponent = matchingComp; + if (firstFactors.length === factorsProvided.length) { + genericComponentOverrideContext.logDebugMessage( + "Rendering ".concat(rid, " because it matches factors: ").concat(firstFactors, " exactly") + ); + return { value: matchingComp }; + } } } }; - // We first try to find an exact match + // We first try to find an exact match, and fall back on something that covers all factors (but maybe more) for (var _i = 0, priorityOrder_1 = priorityOrder; _i < priorityOrder_1.length; _i++) { var _a = priorityOrder_1[_i], rid = _a.rid, @@ -432,33 +442,13 @@ function chooseComponentBasedOnFirstFactors(firstFactors, routeComponents) { var state_1 = _loop_1(rid, factorsProvided); if (typeof state_1 === "object") return state_1.value; } - var maxProvided = 0; - var component = undefined; - var _loop_2 = function (rid, factorsProvided) { - var providedByCurrent = factorsProvided.filter(function (id) { - return firstFactors.includes(id); - }).length; - if (providedByCurrent > maxProvided) { - var matchingComp = routeComponents.find(function (comp) { - return comp.recipeID === rid; - }); - if (matchingComp) { - maxProvided = providedByCurrent; - component = matchingComp; - } - } - }; - // We find the component that provides the most factors - for (var _b = 0, priorityOrder_2 = priorityOrder; _b < priorityOrder_2.length; _b++) { - var _c = priorityOrder_2[_b], - rid = _c.rid, - factorsProvided = _c.factorsProvided; - _loop_2(rid, factorsProvided); - } - if (component === undefined) { + if (fallbackComponent === undefined) { throw new Error("No enabled recipes overlap with the requested firstFactors: " + firstFactors); } - return component; + genericComponentOverrideContext.logDebugMessage( + "Rendering ".concat(fallbackRid, " to cover ").concat(firstFactors) + ); + return fallbackComponent; } var RecipeRouter = /** @class */ (function () { function RecipeRouter() { @@ -535,9 +525,8 @@ var RecipeRouter = /** @class */ (function () { if (componentMatchingRid) { return componentMatchingRid; } - // TODO: check if we need this whole defaultFirstFactors thing. if (mfaRecipe && mfaRecipe.config.firstFactors !== undefined) { - return chooseComponentBasedOnFirstFactors(mfaRecipe.getFirstFactors(), routeComponents); + return chooseComponentBasedOnFirstFactors(mfaRecipe.config.firstFactors, routeComponents); } else { return defaultComp; } @@ -567,7 +556,7 @@ var RecipeRouter = /** @class */ (function () { var enabledRecipeCount = Object.keys(dynamicLoginMethods).filter(function (key) { return dynamicLoginMethods[key].enabled; }).length; - var _loop_3 = function (rid, includes) { + var _loop_2 = function (rid, includes) { if ( enabledRecipeCount === includes.length && includes.every(function (subRId) { @@ -583,14 +572,14 @@ var RecipeRouter = /** @class */ (function () { } }; // We first try to find an exact match - for (var _i = 0, priorityOrder_3 = priorityOrder; _i < priorityOrder_3.length; _i++) { - var _b = priorityOrder_3[_i], + for (var _i = 0, priorityOrder_2 = priorityOrder; _i < priorityOrder_2.length; _i++) { + var _b = priorityOrder_2[_i], rid = _b.rid, includes = _b.includes; - var state_2 = _loop_3(rid, includes); + var state_2 = _loop_2(rid, includes); if (typeof state_2 === "object") return state_2.value; } - var _loop_4 = function (rid, includes) { + var _loop_3 = function (rid, includes) { if ( includes.some(function (subRId) { return dynamicLoginMethods[subRId].enabled; @@ -605,11 +594,11 @@ var RecipeRouter = /** @class */ (function () { } }; // We try to find a partial match - for (var _c = 0, priorityOrder_4 = priorityOrder; _c < priorityOrder_4.length; _c++) { - var _d = priorityOrder_4[_c], + for (var _c = 0, priorityOrder_3 = priorityOrder; _c < priorityOrder_3.length; _c++) { + var _d = priorityOrder_3[_c], rid = _d.rid, includes = _d.includes; - var state_3 = _loop_4(rid, includes); + var state_3 = _loop_3(rid, includes); if (typeof state_3 === "object") return state_3.value; } return undefined; diff --git a/lib/build/logging.d.ts b/lib/build/logging.d.ts new file mode 100644 index 000000000..fc6306f6a --- /dev/null +++ b/lib/build/logging.d.ts @@ -0,0 +1,3 @@ +export declare function enableLogging(): void; +export declare function disableLogging(): void; +export declare function logDebugMessage(message: string): void; diff --git a/lib/build/multifactorauth-shared.js b/lib/build/multifactorauth-shared.js index 4058003e0..a0a27c28d 100644 --- a/lib/build/multifactorauth-shared.js +++ b/lib/build/multifactorauth-shared.js @@ -200,7 +200,6 @@ var MultiFactorAuth = /** @class */ (function (_super) { var _this = _super.call(this, config) || this; _this.webJSRecipe = webJSRecipe; _this.recipeID = MultiFactorAuth.RECIPE_ID; - _this.firstFactors = new Set(); _this.secondaryFactors = []; _this.getDefaultRedirectionURL = function (context) { return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { @@ -283,11 +282,7 @@ var MultiFactorAuth = /** @class */ (function (_super) { } return MultiFactorAuth.instance; }; - MultiFactorAuth.prototype.addMFAFactors = function (firstFactors, secondaryFactors) { - for (var _i = 0, firstFactors_1 = firstFactors; _i < firstFactors_1.length; _i++) { - var fact = firstFactors_1[_i]; - this.firstFactors.add(fact); - } + MultiFactorAuth.prototype.addMFAFactors = function (secondaryFactors) { this.secondaryFactors = genericComponentOverrideContext.__spreadArray( genericComponentOverrideContext.__spreadArray( [], @@ -302,9 +297,8 @@ var MultiFactorAuth = /** @class */ (function (_super) { true ); }; - MultiFactorAuth.prototype.getFirstFactors = function () { - var _b; - return (_b = this.config.firstFactors) !== null && _b !== void 0 ? _b : Array.from(this.firstFactors); + MultiFactorAuth.prototype.isFirstFactorEnabledOnClient = function (factorId) { + return this.config.firstFactors === undefined || this.config.firstFactors.includes(factorId); }; MultiFactorAuth.prototype.getSecondaryFactors = function () { return this.config.getFactorInfo(this.secondaryFactors); diff --git a/lib/build/passwordless-shared2.js b/lib/build/passwordless-shared2.js index 3c030b493..bd9595f66 100644 --- a/lib/build/passwordless-shared2.js +++ b/lib/build/passwordless-shared2.js @@ -525,6 +525,7 @@ function normalisePasswordlessBaseConfig(config) { * License for the specific language governing permissions and limitations * under the License. */ +var passwordlessFirstFactors = ["otp-phone", "otp-email", "link-phone", "link-email"]; /* * Class. */ @@ -551,25 +552,22 @@ var Passwordless = /** @class */ (function (_super) { postSuperTokensInitCallbacks.PostSuperTokensInitCallbacks.addPostInitCallback(function () { var mfa = recipe.MultiFactorAuth.getInstance(); if (mfa !== undefined) { - mfa.addMFAFactors( - ["otp-phone", "otp-email", "link-phone", "link-email"], - [ - { - id: "otp-phone", - name: "SMS based OTP", - description: "Get an OTP code on your phone to complete the authentication request", - path: new NormalisedURLPath__default.default("/check-auth/otp-phone"), - logo: OTPIcon, - }, - { - id: "otp-email", - name: "SMS based OTP", - description: "Get an OTP code on your email address to complete the authentication request", - path: new NormalisedURLPath__default.default("/check-auth/otp-email"), - logo: OTPIcon, - }, - ] - ); + mfa.addMFAFactors([ + { + id: "otp-phone", + name: "SMS based OTP", + description: "Get an OTP code on your phone to complete the authentication request", + path: new NormalisedURLPath__default.default("/check-auth/otp-phone"), + logo: OTPIcon, + }, + { + id: "otp-email", + name: "SMS based OTP", + description: "Get an OTP code on your email address to complete the authentication request", + path: new NormalisedURLPath__default.default("/check-auth/otp-email"), + logo: OTPIcon, + }, + ]); } }); return { @@ -632,5 +630,6 @@ exports.defaultEmailValidator = defaultEmailValidator; exports.defaultValidate = defaultValidate; exports.getPhoneNumberUtils = getPhoneNumberUtils; exports.normalisePasswordlessConfig = normalisePasswordlessConfig; +exports.passwordlessFirstFactors = passwordlessFirstFactors; exports.preloadPhoneNumberUtils = preloadPhoneNumberUtils; exports.userInputCodeValidate = userInputCodeValidate; diff --git a/lib/build/recipe/multifactorauth/recipe.d.ts b/lib/build/recipe/multifactorauth/recipe.d.ts index bc4f9cc8e..55556b1dd 100644 --- a/lib/build/recipe/multifactorauth/recipe.d.ts +++ b/lib/build/recipe/multifactorauth/recipe.d.ts @@ -21,7 +21,6 @@ export default class MultiFactorAuth extends RecipeModule< static RECIPE_ID: string; static MultiFactorAuthClaim: MultiFactorAuthClaimClass; recipeID: string; - private readonly firstFactors; private secondaryFactors; constructor( config: NormalisedConfigWithAppInfoAndRecipeID, @@ -33,8 +32,8 @@ export default class MultiFactorAuth extends RecipeModule< static getInstance(): MultiFactorAuth | undefined; static getInstanceOrThrow(): MultiFactorAuth; getDefaultRedirectionURL: (context: GetRedirectionURLContext) => Promise; - addMFAFactors(firstFactors: string[], secondaryFactors: SecondaryFactorRedirectionInfo[]): void; - getFirstFactors(): string[]; + addMFAFactors(secondaryFactors: SecondaryFactorRedirectionInfo[]): void; + isFirstFactorEnabledOnClient(factorId: string): boolean; getSecondaryFactors(): SecondaryFactorRedirectionInfo[]; redirectToFactor(factorId: string, redirectBack?: boolean, history?: any): Promise; redirectToFactorChooser(redirectBack?: boolean, history?: any): Promise; diff --git a/lib/build/recipe/passwordless/recipe.d.ts b/lib/build/recipe/passwordless/recipe.d.ts index b3f88bc60..b3532f13e 100644 --- a/lib/build/recipe/passwordless/recipe.d.ts +++ b/lib/build/recipe/passwordless/recipe.d.ts @@ -8,6 +8,7 @@ import type { UserInput, } from "./types"; import type { RecipeInitResult, NormalisedConfigWithAppInfoAndRecipeID, WebJSRecipeInterface } from "../../types"; +export declare const passwordlessFirstFactors: readonly ["otp-phone", "otp-email", "link-phone", "link-email"]; export default class Passwordless extends AuthRecipe< GetRedirectionURLContext, PreAndPostAPIHookAction, diff --git a/lib/build/thirdparty-shared.js b/lib/build/thirdparty-shared.js index 702b79231..d88cf5dee 100644 --- a/lib/build/thirdparty-shared.js +++ b/lib/build/thirdparty-shared.js @@ -2,9 +2,7 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); var ThirdpartyWebJS = require("supertokens-web-js/recipe/thirdparty"); -var postSuperTokensInitCallbacks = require("supertokens-web-js/utils/postSuperTokensInitCallbacks"); var utils = require("./authRecipe-shared.js"); -var recipe = require("./multifactorauth-shared.js"); var jsxRuntime = require("react/jsx-runtime"); var NormalisedURLPath = require("supertokens-web-js/utils/normalisedURLPath"); var translationContext = require("./translationContext.js"); @@ -1409,12 +1407,6 @@ var ThirdParty = /** @class */ (function (_super) { ) { throw new Error("ThirdParty signInAndUpFeature providers array cannot be empty."); } - postSuperTokensInitCallbacks.PostSuperTokensInitCallbacks.addPostInitCallback(function () { - var mfa = recipe.MultiFactorAuth.getInstance(); - if (mfa !== undefined) { - mfa.addMFAFactors(["thirdparty"], []); - } - }); _this = _super.call(this, config) || this; _this.webJSRecipe = webJSRecipe; _this.recipeID = ThirdParty.RECIPE_ID; diff --git a/lib/build/thirdparty.js b/lib/build/thirdparty.js index ab560710f..39d78aa94 100644 --- a/lib/build/thirdparty.js +++ b/lib/build/thirdparty.js @@ -19,9 +19,6 @@ require("./authRecipe-shared.js"); require("./recipeModule-shared.js"); require("./session-shared2.js"); require("supertokens-web-js/recipe/session"); -require("./multifactorauth-shared.js"); -require("supertokens-web-js/recipe/multifactorauth"); -require("supertokens-web-js/utils/sessionClaimValidatorStore"); require("./translationContext.js"); require("supertokens-web-js/lib/build/normalisedURLPath"); diff --git a/lib/build/thirdpartyemailpassword.js b/lib/build/thirdpartyemailpassword.js index b1816806f..def27b758 100644 --- a/lib/build/thirdpartyemailpassword.js +++ b/lib/build/thirdpartyemailpassword.js @@ -21,9 +21,6 @@ require("./authRecipe-shared.js"); require("./recipeModule-shared.js"); require("./session-shared2.js"); require("supertokens-web-js/recipe/session"); -require("./multifactorauth-shared.js"); -require("supertokens-web-js/recipe/multifactorauth"); -require("supertokens-web-js/utils/sessionClaimValidatorStore"); require("./translationContext.js"); require("supertokens-web-js/lib/build/normalisedURLPath"); require("supertokens-web-js/recipe/thirdpartyemailpassword"); diff --git a/lib/build/thirdpartyemailpasswordprebuiltui.js b/lib/build/thirdpartyemailpasswordprebuiltui.js index b4ef92441..c405c3bd4 100644 --- a/lib/build/thirdpartyemailpasswordprebuiltui.js +++ b/lib/build/thirdpartyemailpasswordprebuiltui.js @@ -7,12 +7,13 @@ var uiEntry = require("./index2.js"); var authWidgetWrapper = require("./authRecipe-shared2.js"); var emailpasswordprebuiltui = require("./emailpassword-shared6.js"); var thirdpartyprebuiltui = require("./thirdparty-shared2.js"); -var recipe = require("./thirdpartyemailpassword-shared.js"); +var recipe$1 = require("./thirdpartyemailpassword-shared.js"); var React = require("react"); var SuperTokensBranding = require("./SuperTokensBranding.js"); var translations = require("./translations.js"); var translationContext = require("./translationContext.js"); var generalError = require("./emailpassword-shared.js"); +var recipe = require("./multifactorauth-shared.js"); require("supertokens-web-js"); require("supertokens-web-js/utils/cookieHandler"); require("supertokens-web-js/utils/postSuperTokensInitCallbacks"); @@ -22,12 +23,9 @@ require("supertokens-web-js/utils"); require("supertokens-web-js/utils/normalisedURLDomain"); require("react-dom"); require("./multitenancy-shared.js"); -require("./multifactorauth-shared.js"); -require("supertokens-web-js/recipe/multifactorauth"); -require("supertokens-web-js/utils/sessionClaimValidatorStore"); -require("./recipeModule-shared.js"); require("./session-shared2.js"); require("supertokens-web-js/recipe/session"); +require("./recipeModule-shared.js"); require("./session-shared.js"); require("./session-shared3.js"); require("./emailpassword-shared3.js"); @@ -46,6 +44,8 @@ require("./thirdparty-shared.js"); require("supertokens-web-js/recipe/thirdparty"); require("supertokens-web-js/lib/build/normalisedURLPath"); require("supertokens-web-js/recipe/thirdpartyemailpassword"); +require("supertokens-web-js/recipe/multifactorauth"); +require("supertokens-web-js/utils/sessionClaimValidatorStore"); function _interopDefault(e) { return e && e.__esModule ? e : { default: e }; @@ -141,12 +141,22 @@ var SignInAndUpTheme = function (props) { var hasProviders = ((_a = props.tpChildProps) === null || _a === void 0 ? void 0 : _a.providers) !== undefined && props.tpChildProps.providers.length > 0; - var thirdPartyEnabled = - (usesDynamicLoginMethods === false && hasProviders) || - ((loginMethods === null || loginMethods === void 0 ? void 0 : loginMethods.thirdparty.enabled) && hasProviders); - var emailPasswordEnabled = - (props.emailPasswordRecipe !== undefined && usesDynamicLoginMethods === false) || - (loginMethods === null || loginMethods === void 0 ? void 0 : loginMethods.emailpassword.enabled); + var mfa = recipe.MultiFactorAuth.getInstance(); + var thirdPartyEnabled = hasProviders; + var emailPasswordEnabled = props.emailPasswordRecipe !== undefined; + if (usesDynamicLoginMethods) { + thirdPartyEnabled = thirdPartyEnabled && loginMethods.firstFactors.includes("thirdparty") && hasProviders; + emailPasswordEnabled = + emailPasswordEnabled && + loginMethods.firstFactors.includes("emailpassword") && + props.emailPasswordRecipe !== undefined; + } else if (mfa !== undefined) { + thirdPartyEnabled = thirdPartyEnabled && mfa.isFirstFactorEnabledOnClient("thirdparty") && hasProviders; + emailPasswordEnabled = + emailPasswordEnabled && + mfa.isFirstFactorEnabledOnClient("emailpassword") && + props.emailPasswordRecipe !== undefined; + } if (thirdPartyEnabled === false && emailPasswordEnabled === false) { return null; } @@ -398,7 +408,7 @@ var ThirdPartyEmailPasswordPreBuiltUI = /** @class */ (function (_super) { // Instance methods _this.getFeatures = function (useComponentOverrides) { if (useComponentOverrides === void 0) { - useComponentOverrides = recipe.useContext; + useComponentOverrides = recipe$1.useContext; } var features = {}; if (_this.emailPasswordPreBuiltUI !== undefined) { @@ -424,14 +434,14 @@ var ThirdPartyEmailPasswordPreBuiltUI = /** @class */ (function (_super) { component: function (prop) { return _this.getFeatureComponent("signinup", prop, useComponentOverrides); }, - recipeID: recipe.ThirdPartyEmailPassword.RECIPE_ID, + recipeID: recipe$1.ThirdPartyEmailPassword.RECIPE_ID, }; } return features; }; _this.getFeatureComponent = function (componentName, props, useComponentOverrides) { if (useComponentOverrides === void 0) { - useComponentOverrides = recipe.useContext; + useComponentOverrides = recipe$1.useContext; } if (componentName === "signinup") { if (props.redirectOnSessionExists !== false) { @@ -504,20 +514,20 @@ var ThirdPartyEmailPasswordPreBuiltUI = /** @class */ (function (_super) { // Static methods ThirdPartyEmailPasswordPreBuiltUI.getInstanceOrInitAndGetInstance = function () { if (ThirdPartyEmailPasswordPreBuiltUI.instance === undefined) { - var recipeInstance = recipe.ThirdPartyEmailPassword.getInstanceOrThrow(); + var recipeInstance = recipe$1.ThirdPartyEmailPassword.getInstanceOrThrow(); ThirdPartyEmailPasswordPreBuiltUI.instance = new ThirdPartyEmailPasswordPreBuiltUI(recipeInstance); } return ThirdPartyEmailPasswordPreBuiltUI.instance; }; ThirdPartyEmailPasswordPreBuiltUI.getFeatures = function (useComponentOverrides) { if (useComponentOverrides === void 0) { - useComponentOverrides = recipe.useContext; + useComponentOverrides = recipe$1.useContext; } return ThirdPartyEmailPasswordPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatures(useComponentOverrides); }; ThirdPartyEmailPasswordPreBuiltUI.getFeatureComponent = function (componentName, props, useComponentOverrides) { if (useComponentOverrides === void 0) { - useComponentOverrides = recipe.useContext; + useComponentOverrides = recipe$1.useContext; } return ThirdPartyEmailPasswordPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent( componentName, diff --git a/lib/build/thirdpartypasswordless.js b/lib/build/thirdpartypasswordless.js index db87e7729..796cbe40c 100644 --- a/lib/build/thirdpartypasswordless.js +++ b/lib/build/thirdpartypasswordless.js @@ -21,14 +21,14 @@ require("./authRecipe-shared.js"); require("./recipeModule-shared.js"); require("./session-shared2.js"); require("supertokens-web-js/recipe/session"); -require("./multifactorauth-shared.js"); -require("supertokens-web-js/recipe/multifactorauth"); -require("supertokens-web-js/utils/sessionClaimValidatorStore"); require("./translationContext.js"); require("supertokens-web-js/lib/build/normalisedURLPath"); require("supertokens-web-js/recipe/thirdpartypasswordless"); require("./passwordless-shared2.js"); require("supertokens-web-js/recipe/passwordless"); +require("./multifactorauth-shared.js"); +require("supertokens-web-js/recipe/multifactorauth"); +require("supertokens-web-js/utils/sessionClaimValidatorStore"); var Wrapper = /** @class */ (function () { function Wrapper() {} diff --git a/lib/build/thirdpartypasswordlessprebuiltui.js b/lib/build/thirdpartypasswordlessprebuiltui.js index 8162a42f8..d8b87f2fc 100644 --- a/lib/build/thirdpartypasswordlessprebuiltui.js +++ b/lib/build/thirdpartypasswordlessprebuiltui.js @@ -7,11 +7,13 @@ var uiEntry = require("./index2.js"); var authWidgetWrapper = require("./authRecipe-shared2.js"); var passwordlessprebuiltui = require("./passwordless-shared3.js"); var thirdpartyprebuiltui = require("./thirdparty-shared2.js"); -var recipe = require("./thirdpartypasswordless-shared.js"); +var recipe$2 = require("./thirdpartypasswordless-shared.js"); var React = require("react"); var SuperTokensBranding = require("./SuperTokensBranding.js"); var translations = require("./translations.js"); var generalError = require("./emailpassword-shared.js"); +var recipe = require("./multifactorauth-shared.js"); +var recipe$1 = require("./passwordless-shared2.js"); var translationContext = require("./translationContext.js"); require("supertokens-web-js"); require("supertokens-web-js/utils/cookieHandler"); @@ -22,28 +24,26 @@ require("supertokens-web-js/utils"); require("supertokens-web-js/utils/normalisedURLDomain"); require("react-dom"); require("./multitenancy-shared.js"); -require("./multifactorauth-shared.js"); -require("supertokens-web-js/recipe/multifactorauth"); -require("supertokens-web-js/utils/sessionClaimValidatorStore"); -require("./recipeModule-shared.js"); require("./session-shared2.js"); require("supertokens-web-js/recipe/session"); +require("./recipeModule-shared.js"); require("./session-shared.js"); require("./session-shared3.js"); require("./passwordless-shared.js"); require("supertokens-web-js/utils/error"); require("./emailpassword-shared2.js"); -require("./passwordless-shared2.js"); -require("supertokens-web-js/recipe/passwordless"); -require("./authRecipe-shared.js"); require("./checkedRoundIcon.js"); require("./emailpassword-shared8.js"); require("./emailpassword-shared5.js"); require("./arrowLeftIcon.js"); require("./thirdparty-shared.js"); require("supertokens-web-js/recipe/thirdparty"); +require("./authRecipe-shared.js"); require("supertokens-web-js/lib/build/normalisedURLPath"); require("supertokens-web-js/recipe/thirdpartypasswordless"); +require("supertokens-web-js/recipe/multifactorauth"); +require("supertokens-web-js/utils/sessionClaimValidatorStore"); +require("supertokens-web-js/recipe/passwordless"); function _interopDefault(e) { return e && e.__esModule ? e : { default: e }; @@ -134,12 +134,24 @@ var SignInUpTheme = function (props) { var hasProviders = ((_a = props.tpChildProps) === null || _a === void 0 ? void 0 : _a.providers) !== undefined && props.tpChildProps.providers.length > 0; - var thirdPartyEnabled = - (usesDynamicLoginMethods === false && hasProviders) || - ((loginMethods === null || loginMethods === void 0 ? void 0 : loginMethods.thirdparty.enabled) && hasProviders); - var passwordlessEnabled = - (props.passwordlessRecipe !== undefined && usesDynamicLoginMethods === false) || - (loginMethods === null || loginMethods === void 0 ? void 0 : loginMethods.passwordless.enabled); + var mfa = recipe.MultiFactorAuth.getInstance(); + var thirdPartyEnabled = hasProviders; + var passwordlessEnabled = props.passwordlessRecipe !== undefined; + if (usesDynamicLoginMethods) { + thirdPartyEnabled = thirdPartyEnabled && loginMethods.firstFactors.includes("thirdparty") && hasProviders; + passwordlessEnabled = + passwordlessEnabled && + recipe$1.passwordlessFirstFactors.some(function (id) { + return loginMethods.firstFactors.includes(id); + }); + } else if (mfa !== undefined) { + thirdPartyEnabled = thirdPartyEnabled && mfa.isFirstFactorEnabledOnClient("thirdparty"); + passwordlessEnabled = + passwordlessEnabled && + recipe$1.passwordlessFirstFactors.some(function (id) { + return mfa.isFirstFactorEnabledOnClient(id); + }); + } if (thirdPartyEnabled === false && passwordlessEnabled === false) { return null; } @@ -499,7 +511,7 @@ var ThirdPartyPasswordlessPreBuiltUI = /** @class */ (function (_super) { // Instance methods _this.getFeatureComponent = function (componentName, props, useComponentOverrides) { if (useComponentOverrides === void 0) { - useComponentOverrides = recipe.useContext; + useComponentOverrides = recipe$2.useContext; } if (componentName === "signInUp") { if (props.redirectOnSessionExists !== false) { @@ -564,7 +576,7 @@ var ThirdPartyPasswordlessPreBuiltUI = /** @class */ (function (_super) { _this.getFeatures = function (useComponentOverrides) { var _b, _c; if (useComponentOverrides === void 0) { - useComponentOverrides = recipe.useContext; + useComponentOverrides = recipe$2.useContext; } var features = {}; if (_this.passwordlessPreBuiltUI !== undefined) { @@ -599,7 +611,7 @@ var ThirdPartyPasswordlessPreBuiltUI = /** @class */ (function (_super) { component: function (prop) { return _this.getFeatureComponent("signInUp", prop, useComponentOverrides); }, - recipeID: recipe.ThirdPartyPasswordless.RECIPE_ID, + recipeID: recipe$2.ThirdPartyPasswordless.RECIPE_ID, }; } return genericComponentOverrideContext.__assign({}, features); @@ -617,20 +629,20 @@ var ThirdPartyPasswordlessPreBuiltUI = /** @class */ (function (_super) { // Static methods ThirdPartyPasswordlessPreBuiltUI.getInstanceOrInitAndGetInstance = function () { if (ThirdPartyPasswordlessPreBuiltUI.instance === undefined) { - var recipeInstance = recipe.ThirdPartyPasswordless.getInstanceOrThrow(); + var recipeInstance = recipe$2.ThirdPartyPasswordless.getInstanceOrThrow(); ThirdPartyPasswordlessPreBuiltUI.instance = new ThirdPartyPasswordlessPreBuiltUI(recipeInstance); } return ThirdPartyPasswordlessPreBuiltUI.instance; }; ThirdPartyPasswordlessPreBuiltUI.getFeatures = function (useComponentOverrides) { if (useComponentOverrides === void 0) { - useComponentOverrides = recipe.useContext; + useComponentOverrides = recipe$2.useContext; } return ThirdPartyPasswordlessPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatures(useComponentOverrides); }; ThirdPartyPasswordlessPreBuiltUI.getFeatureComponent = function (componentName, props, useComponentOverrides) { if (useComponentOverrides === void 0) { - useComponentOverrides = recipe.useContext; + useComponentOverrides = recipe$2.useContext; } return ThirdPartyPasswordlessPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatureComponent( componentName, diff --git a/lib/ts/logging.ts b/lib/ts/logging.ts new file mode 100644 index 000000000..ede00fe43 --- /dev/null +++ b/lib/ts/logging.ts @@ -0,0 +1,36 @@ +/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. + * + * This software is licensed under the Apache License, Version 2.0 (the + * "License") as published by the Apache Software Foundation. + * + * You may not use this file except in compliance with the License. You may + * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +import { package_version as version } from "./version"; + +const SUPERTOKENS_DEBUG_NAMESPACE = "com.supertokens.auth-react"; + +let doDebugLogs = false; + +export function enableLogging() { + doDebugLogs = true; +} +export function disableLogging() { + doDebugLogs = false; +} + +export function logDebugMessage(message: string) { + if (doDebugLogs) { + // eslint-disable-next-line no-console + console.log( + `${SUPERTOKENS_DEBUG_NAMESPACE} {t: "${new Date().toISOString()}", message: "${message}", supertokens-auth-react-ver: "${version}"}` + ); + } +} diff --git a/lib/ts/recipe/emailpassword/recipe.tsx b/lib/ts/recipe/emailpassword/recipe.tsx index 267ad67f3..e48caf6d1 100644 --- a/lib/ts/recipe/emailpassword/recipe.tsx +++ b/lib/ts/recipe/emailpassword/recipe.tsx @@ -19,12 +19,10 @@ import EmailPasswordWebJS from "supertokens-web-js/recipe/emailpassword"; import NormalisedURLPath from "supertokens-web-js/utils/normalisedURLPath"; -import { PostSuperTokensInitCallbacks } from "supertokens-web-js/utils/postSuperTokensInitCallbacks"; import { SSR_ERROR } from "../../constants"; import { isTest } from "../../utils"; import AuthRecipe from "../authRecipe"; -import MultiFactorAuth from "../multifactorauth/recipe"; import { DEFAULT_RESET_PASSWORD_PATH } from "./constants"; import { getFunctionOverrides } from "./functionOverrides"; @@ -60,13 +58,6 @@ export default class EmailPassword extends AuthRecipe< public readonly webJSRecipe: WebJSRecipeInterface = EmailPasswordWebJS ) { super(config); - - PostSuperTokensInitCallbacks.addPostInitCallback(() => { - const mfa = MultiFactorAuth.getInstance(); - if (mfa !== undefined) { - mfa.addMFAFactors(["emailpassword"], []); - } - }); } getDefaultRedirectionURL = async (context: GetRedirectionURLContext): Promise => { diff --git a/lib/ts/recipe/multifactorauth/recipe.tsx b/lib/ts/recipe/multifactorauth/recipe.tsx index 82655ee96..ba7e88b10 100644 --- a/lib/ts/recipe/multifactorauth/recipe.tsx +++ b/lib/ts/recipe/multifactorauth/recipe.tsx @@ -59,7 +59,6 @@ export default class MultiFactorAuth extends RecipeModule< ); public recipeID = MultiFactorAuth.RECIPE_ID; - private readonly firstFactors: Set = new Set(); private secondaryFactors: SecondaryFactorRedirectionInfo[] = []; constructor( @@ -144,10 +143,7 @@ export default class MultiFactorAuth extends RecipeModule< } }; - addMFAFactors(firstFactors: string[], secondaryFactors: SecondaryFactorRedirectionInfo[]) { - for (const fact of firstFactors) { - this.firstFactors.add(fact); - } + addMFAFactors(secondaryFactors: SecondaryFactorRedirectionInfo[]) { this.secondaryFactors = [ ...this.secondaryFactors.filter((factor) => secondaryFactors.every((newFactor) => factor.id !== newFactor.id) @@ -156,8 +152,8 @@ export default class MultiFactorAuth extends RecipeModule< ]; } - getFirstFactors() { - return this.config.firstFactors ?? Array.from(this.firstFactors); + isFirstFactorEnabledOnClient(factorId: string) { + return this.config.firstFactors === undefined || this.config.firstFactors.includes(factorId); } getSecondaryFactors() { diff --git a/lib/ts/recipe/passwordless/recipe.tsx b/lib/ts/recipe/passwordless/recipe.tsx index 2348937f6..0f33eb395 100644 --- a/lib/ts/recipe/passwordless/recipe.tsx +++ b/lib/ts/recipe/passwordless/recipe.tsx @@ -41,6 +41,8 @@ import type { RecipeInitResult, NormalisedConfigWithAppInfoAndRecipeID, WebJSRec import type { NormalisedAppInfo } from "../../types"; import type RecipeModule from "../recipeModule"; +export const passwordlessFirstFactors = ["otp-phone", "otp-email", "link-phone", "link-email"] as const; + /* * Class. */ @@ -74,25 +76,22 @@ export default class Passwordless extends AuthRecipe< PostSuperTokensInitCallbacks.addPostInitCallback(() => { const mfa = MultiFactorAuth.getInstance(); if (mfa !== undefined) { - mfa.addMFAFactors( - ["otp-phone", "otp-email", "link-phone", "link-email"], - [ - { - id: "otp-phone", - name: "SMS based OTP", - description: "Get an OTP code on your phone to complete the authentication request", - path: new NormalisedURLPath("/check-auth/otp-phone"), - logo: OTPIcon, - }, - { - id: "otp-email", - name: "SMS based OTP", - description: "Get an OTP code on your email address to complete the authentication request", - path: new NormalisedURLPath("/check-auth/otp-email"), - logo: OTPIcon, - }, - ] - ); + mfa.addMFAFactors([ + { + id: "otp-phone", + name: "SMS based OTP", + description: "Get an OTP code on your phone to complete the authentication request", + path: new NormalisedURLPath("/check-auth/otp-phone"), + logo: OTPIcon, + }, + { + id: "otp-email", + name: "SMS based OTP", + description: "Get an OTP code on your email address to complete the authentication request", + path: new NormalisedURLPath("/check-auth/otp-email"), + logo: OTPIcon, + }, + ]); } }); diff --git a/lib/ts/recipe/recipeRouter/index.tsx b/lib/ts/recipe/recipeRouter/index.tsx index b9065329b..8a5d5fe18 100644 --- a/lib/ts/recipe/recipeRouter/index.tsx +++ b/lib/ts/recipe/recipeRouter/index.tsx @@ -1,3 +1,4 @@ +import { logDebugMessage } from "../../logging"; import SuperTokens from "../../superTokens"; import MultiFactorAuth from "../multifactorauth/recipe"; @@ -37,38 +38,31 @@ function chooseComponentBasedOnFirstFactors( firstFactors: string[], routeComponents: ComponentWithRecipeAndMatchingMethod[] ) { - // We first try to find an exact match + let fallbackRid; + let fallbackComponent; + // We first try to find an exact match, and fall back on something that covers all factors (but maybe more) for (const { rid, factorsProvided } of priorityOrder) { - if ( - firstFactors.length === factorsProvided.length && - factorsProvided.every((factor) => firstFactors.includes(factor)) - ) { + if (firstFactors.every((factor) => factorsProvided.includes(factor))) { const matchingComp = routeComponents.find((comp) => comp.recipeID === rid); if (matchingComp) { - return matchingComp; - } - } - } - - let maxProvided = 0; - let component = undefined; - // We find the component that provides the most factors - for (const { rid, factorsProvided } of priorityOrder) { - const providedByCurrent = factorsProvided.filter((id) => firstFactors.includes(id)).length; - if (providedByCurrent > maxProvided) { - const matchingComp = routeComponents.find((comp) => comp.recipeID === rid); - if (matchingComp) { - maxProvided = providedByCurrent; - component = matchingComp; + // This means that this gets overwritten by items lower in the prios list. + // This is intentional since this way we end up with the most specific recipe that covers all required factrors (pwless instead of tppwless) + fallbackRid = rid; + fallbackComponent = matchingComp; + if (firstFactors.length === factorsProvided.length) { + logDebugMessage(`Rendering ${rid} because it matches factors: ${firstFactors} exactly`); + return matchingComp; + } } } } - if (component === undefined) { + if (fallbackComponent === undefined) { throw new Error("No enabled recipes overlap with the requested firstFactors: " + firstFactors); } - return component; + logDebugMessage(`Rendering ${fallbackRid} to cover ${firstFactors}`); + return fallbackComponent; } export abstract class RecipeRouter { @@ -124,9 +118,8 @@ export abstract class RecipeRouter { return componentMatchingRid; } - // TODO: check if we need this whole defaultFirstFactors thing. if (mfaRecipe && mfaRecipe.config.firstFactors !== undefined) { - return chooseComponentBasedOnFirstFactors(mfaRecipe.getFirstFactors(), routeComponents); + return chooseComponentBasedOnFirstFactors(mfaRecipe.config.firstFactors, routeComponents); } else { return defaultComp; } diff --git a/lib/ts/recipe/thirdparty/recipe.tsx b/lib/ts/recipe/thirdparty/recipe.tsx index bc31e6114..6af8f015d 100644 --- a/lib/ts/recipe/thirdparty/recipe.tsx +++ b/lib/ts/recipe/thirdparty/recipe.tsx @@ -18,13 +18,11 @@ */ import ThirdpartyWebJS from "supertokens-web-js/recipe/thirdparty"; -import { PostSuperTokensInitCallbacks } from "supertokens-web-js/utils/postSuperTokensInitCallbacks"; import { SSR_ERROR } from "../../constants"; import SuperTokens from "../../superTokens"; import { isTest } from "../../utils"; import AuthRecipe from "../authRecipe"; -import MultiFactorAuth from "../multifactorauth/recipe"; import { getFunctionOverrides } from "./functionOverrides"; import { normaliseThirdPartyConfig } from "./utils"; @@ -61,13 +59,6 @@ export default class ThirdParty extends AuthRecipe< throw new Error("ThirdParty signInAndUpFeature providers array cannot be empty."); } - PostSuperTokensInitCallbacks.addPostInitCallback(() => { - const mfa = MultiFactorAuth.getInstance(); - if (mfa !== undefined) { - mfa.addMFAFactors(["thirdparty"], []); - } - }); - super(config); } diff --git a/lib/ts/recipe/thirdpartyemailpassword/components/themes/signInAndUp/index.tsx b/lib/ts/recipe/thirdpartyemailpassword/components/themes/signInAndUp/index.tsx index 8b6c23339..b0aeb68ef 100644 --- a/lib/ts/recipe/thirdpartyemailpassword/components/themes/signInAndUp/index.tsx +++ b/lib/ts/recipe/thirdpartyemailpassword/components/themes/signInAndUp/index.tsx @@ -28,19 +28,21 @@ import { SignInFooter } from "../../../../emailpassword/components/themes/signIn import { SignInForm } from "../../../../emailpassword/components/themes/signInAndUp/signInForm"; import { SignUpFooter } from "../../../../emailpassword/components/themes/signInAndUp/signUpFooter"; import { SignUpForm } from "../../../../emailpassword/components/themes/signInAndUp/signUpForm"; +import MultiFactorAuth from "../../../../multifactorauth/recipe"; import { useDynamicLoginMethods } from "../../../../multitenancy/dynamicLoginMethodsContext"; import { ProvidersForm } from "../../../../thirdparty/components/themes/signInAndUp/providersForm"; import { ThemeBase } from "../themeBase"; import { Header } from "./header"; +import type { GetLoginMethodsResponseNormalized } from "../../../../multitenancy/types"; import type { ThirdPartyEmailPasswordSignInAndUpThemeProps } from "../../../types"; const SignInAndUpTheme: React.FC = (props) => { const t = useTranslation(); const usesDynamicLoginMethods = SuperTokens.usesDynamicLoginMethods; const dynamicLoginMethods = useDynamicLoginMethods(); - let loginMethods; + let loginMethods: GetLoginMethodsResponseNormalized | undefined; if (usesDynamicLoginMethods) { if (dynamicLoginMethods.loaded === false) { throw new Error("Component requiring dynamicLoginMethods rendered without FeatureWrapper."); @@ -49,11 +51,23 @@ const SignInAndUpTheme: React.FC = } } const hasProviders = props.tpChildProps?.providers !== undefined && props.tpChildProps.providers.length > 0; - const thirdPartyEnabled = - (usesDynamicLoginMethods === false && hasProviders) || (loginMethods?.thirdparty.enabled && hasProviders); - const emailPasswordEnabled = - (props.emailPasswordRecipe !== undefined && usesDynamicLoginMethods === false) || - loginMethods?.emailpassword.enabled; + const mfa = MultiFactorAuth.getInstance(); + let thirdPartyEnabled: boolean = hasProviders; + let emailPasswordEnabled: boolean = props.emailPasswordRecipe !== undefined; + + if (usesDynamicLoginMethods) { + thirdPartyEnabled = thirdPartyEnabled && loginMethods!.firstFactors.includes("thirdparty") && hasProviders; + emailPasswordEnabled = + emailPasswordEnabled && + loginMethods!.firstFactors.includes("emailpassword") && + props.emailPasswordRecipe !== undefined; + } else if (mfa !== undefined) { + thirdPartyEnabled = thirdPartyEnabled && mfa.isFirstFactorEnabledOnClient("thirdparty") && hasProviders; + emailPasswordEnabled = + emailPasswordEnabled && + mfa.isFirstFactorEnabledOnClient("emailpassword") && + props.emailPasswordRecipe !== undefined; + } if (thirdPartyEnabled === false && emailPasswordEnabled === false) { return null; diff --git a/lib/ts/recipe/thirdpartypasswordless/components/themes/signInUp/index.tsx b/lib/ts/recipe/thirdpartypasswordless/components/themes/signInUp/index.tsx index 0a926ee3c..870771d8f 100644 --- a/lib/ts/recipe/thirdpartypasswordless/components/themes/signInUp/index.tsx +++ b/lib/ts/recipe/thirdpartypasswordless/components/themes/signInUp/index.tsx @@ -23,6 +23,7 @@ import { SuperTokensBranding } from "../../../../../components/SuperTokensBrandi import { hasFontDefined } from "../../../../../styles/styles"; import SuperTokens from "../../../../../superTokens"; import GeneralError from "../../../../emailpassword/components/library/generalError"; +import MultiFactorAuth from "../../../../multifactorauth/recipe"; import { useDynamicLoginMethods } from "../../../../multitenancy/dynamicLoginMethodsContext"; import { getActiveScreen, SignInUpScreens } from "../../../../passwordless/components/themes/signInUp"; import { CloseTabScreen } from "../../../../passwordless/components/themes/signInUp/closeTabScreen"; @@ -32,11 +33,13 @@ import { LinkSent } from "../../../../passwordless/components/themes/signInUp/li import { PhoneForm } from "../../../../passwordless/components/themes/signInUp/phoneForm"; import { UserInputCodeForm } from "../../../../passwordless/components/themes/signInUp/userInputCodeForm"; import { UserInputCodeFormHeader } from "../../../../passwordless/components/themes/signInUp/userInputCodeFormHeader"; +import { passwordlessFirstFactors } from "../../../../passwordless/recipe"; import { ProvidersForm } from "../../../../thirdparty/components/themes/signInAndUp/providersForm"; import { ThemeBase } from "../themeBase"; import { Header } from "./header"; +import type { GetLoginMethodsResponseNormalized } from "../../../../multitenancy/types"; import type { SignInUpChildProps as PwlessSignInUpChildProps } from "../../../../passwordless/types"; import type { ThirdPartyPasswordlessSignInAndUpThemeProps, @@ -47,7 +50,7 @@ const SignInUpTheme: React.FC 0; - const thirdPartyEnabled = - (usesDynamicLoginMethods === false && hasProviders) || (loginMethods?.thirdparty.enabled && hasProviders); - const passwordlessEnabled = - (props.passwordlessRecipe !== undefined && usesDynamicLoginMethods === false) || - loginMethods?.passwordless.enabled; + const mfa = MultiFactorAuth.getInstance(); + let thirdPartyEnabled: boolean = hasProviders; + let passwordlessEnabled: boolean = props.passwordlessRecipe !== undefined; + + if (usesDynamicLoginMethods) { + thirdPartyEnabled = thirdPartyEnabled && loginMethods!.firstFactors.includes("thirdparty") && hasProviders; + passwordlessEnabled = + passwordlessEnabled && passwordlessFirstFactors.some((id) => loginMethods!.firstFactors.includes(id)); + } else if (mfa !== undefined) { + thirdPartyEnabled = thirdPartyEnabled && mfa.isFirstFactorEnabledOnClient("thirdparty"); + passwordlessEnabled = + passwordlessEnabled && passwordlessFirstFactors.some((id) => mfa.isFirstFactorEnabledOnClient(id)); + } if (thirdPartyEnabled === false && passwordlessEnabled === false) { return null; diff --git a/lib/ts/superTokens.tsx b/lib/ts/superTokens.tsx index 3449197cc..5618dfea7 100644 --- a/lib/ts/superTokens.tsx +++ b/lib/ts/superTokens.tsx @@ -22,6 +22,7 @@ import { PostSuperTokensInitCallbacks } from "supertokens-web-js/utils/postSuper import { WindowHandlerReference } from "supertokens-web-js/utils/windowHandler"; import { SSR_ERROR } from "./constants"; +import { disableLogging, enableLogging } from "./logging"; import Multitenancy from "./recipe/multitenancy/recipe"; import { saveCurrentLanguage, TranslationController } from "./translation/translationHelpers"; import { @@ -94,6 +95,11 @@ export default class SuperTokens { if (config.enableDebugLogs !== undefined) { enableDebugLogs = config.enableDebugLogs; } + if (enableDebugLogs) { + enableLogging(); + } else { + disableLogging(); + } this.userGetRedirectionURL = config.getRedirectionURL; this.recipeList = config.recipeList.map(({ authReact }) => { From fb89c1836270f2b787fc8b4f7c863c8919783a5d Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Thu, 9 Nov 2023 12:33:05 +0100 Subject: [PATCH 17/35] refactor: rename passwordlessFirstFactors since it's not only first factors --- lib/build/passwordless-shared2.js | 4 ++-- lib/build/recipe/passwordless/recipe.d.ts | 2 +- lib/build/thirdpartypasswordlessprebuiltui.js | 4 ++-- lib/ts/recipe/passwordless/recipe.tsx | 2 +- .../components/themes/signInUp/index.tsx | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/build/passwordless-shared2.js b/lib/build/passwordless-shared2.js index d4db0c750..735f5b8e4 100644 --- a/lib/build/passwordless-shared2.js +++ b/lib/build/passwordless-shared2.js @@ -540,7 +540,7 @@ var otpEmailFactor = { path: new NormalisedURLPath__default.default("/mfa/otp-email"), logo: OTPIcon, }; -var passwordlessFirstFactors = ["otp-phone", "otp-email", "link-phone", "link-email"]; +var passwordlessFactors = ["otp-phone", "otp-email", "link-phone", "link-email"]; var Passwordless = /** @class */ (function (_super) { genericComponentOverrideContext.__extends(Passwordless, _super); function Passwordless(config, webJSRecipe) { @@ -627,6 +627,6 @@ exports.defaultEmailValidator = defaultEmailValidator; exports.defaultValidate = defaultValidate; exports.getPhoneNumberUtils = getPhoneNumberUtils; exports.normalisePasswordlessConfig = normalisePasswordlessConfig; -exports.passwordlessFirstFactors = passwordlessFirstFactors; +exports.passwordlessFactors = passwordlessFactors; exports.preloadPhoneNumberUtils = preloadPhoneNumberUtils; exports.userInputCodeValidate = userInputCodeValidate; diff --git a/lib/build/recipe/passwordless/recipe.d.ts b/lib/build/recipe/passwordless/recipe.d.ts index 47bdf8aed..02441c73c 100644 --- a/lib/build/recipe/passwordless/recipe.d.ts +++ b/lib/build/recipe/passwordless/recipe.d.ts @@ -24,7 +24,7 @@ export declare const otpEmailFactor: { path: NormalisedURLPath; logo: () => JSX.Element; }; -export declare const passwordlessFirstFactors: readonly ["otp-phone", "otp-email", "link-phone", "link-email"]; +export declare const passwordlessFactors: readonly ["otp-phone", "otp-email", "link-phone", "link-email"]; export default class Passwordless extends AuthRecipe< GetRedirectionURLContext, PreAndPostAPIHookAction, diff --git a/lib/build/thirdpartypasswordlessprebuiltui.js b/lib/build/thirdpartypasswordlessprebuiltui.js index 37442ef2e..4c2c54afe 100644 --- a/lib/build/thirdpartypasswordlessprebuiltui.js +++ b/lib/build/thirdpartypasswordlessprebuiltui.js @@ -144,14 +144,14 @@ var SignInUpTheme = function (props) { thirdPartyEnabled = thirdPartyEnabled && loginMethods.firstFactors.includes("thirdparty") && hasProviders; passwordlessEnabled = passwordlessEnabled && - recipe$1.passwordlessFirstFactors.some(function (id) { + recipe$1.passwordlessFactors.some(function (id) { return loginMethods.firstFactors.includes(id); }); } else if (mfa !== undefined) { thirdPartyEnabled = thirdPartyEnabled && mfa.isFirstFactorEnabledOnClient("thirdparty"); passwordlessEnabled = passwordlessEnabled && - recipe$1.passwordlessFirstFactors.some(function (id) { + recipe$1.passwordlessFactors.some(function (id) { return mfa.isFirstFactorEnabledOnClient(id); }); } diff --git a/lib/ts/recipe/passwordless/recipe.tsx b/lib/ts/recipe/passwordless/recipe.tsx index 4a0e2c2a7..5418de349 100644 --- a/lib/ts/recipe/passwordless/recipe.tsx +++ b/lib/ts/recipe/passwordless/recipe.tsx @@ -56,7 +56,7 @@ export const otpEmailFactor = { logo: OTPIcon, }; -export const passwordlessFirstFactors = ["otp-phone", "otp-email", "link-phone", "link-email"] as const; +export const passwordlessFactors = ["otp-phone", "otp-email", "link-phone", "link-email"] as const; export default class Passwordless extends AuthRecipe< GetRedirectionURLContext, diff --git a/lib/ts/recipe/thirdpartypasswordless/components/themes/signInUp/index.tsx b/lib/ts/recipe/thirdpartypasswordless/components/themes/signInUp/index.tsx index 5614798db..54e8e1603 100644 --- a/lib/ts/recipe/thirdpartypasswordless/components/themes/signInUp/index.tsx +++ b/lib/ts/recipe/thirdpartypasswordless/components/themes/signInUp/index.tsx @@ -33,7 +33,7 @@ import { LinkSent } from "../../../../passwordless/components/themes/signInUp/li import { PhoneForm } from "../../../../passwordless/components/themes/signInUp/phoneForm"; import { UserInputCodeForm } from "../../../../passwordless/components/themes/signInUp/userInputCodeForm"; import { UserInputCodeFormHeader } from "../../../../passwordless/components/themes/signInUp/userInputCodeFormHeader"; -import { passwordlessFirstFactors } from "../../../../passwordless/recipe"; +import { passwordlessFactors } from "../../../../passwordless/recipe"; import { ProvidersForm } from "../../../../thirdparty/components/themes/signInAndUp/providersForm"; import { ThemeBase } from "../themeBase"; @@ -67,11 +67,11 @@ const SignInUpTheme: React.FC loginMethods!.firstFactors.includes(id)); + passwordlessEnabled && passwordlessFactors.some((id) => loginMethods!.firstFactors.includes(id)); } else if (mfa !== undefined) { thirdPartyEnabled = thirdPartyEnabled && mfa.isFirstFactorEnabledOnClient("thirdparty"); passwordlessEnabled = - passwordlessEnabled && passwordlessFirstFactors.some((id) => mfa.isFirstFactorEnabledOnClient(id)); + passwordlessEnabled && passwordlessFactors.some((id) => mfa.isFirstFactorEnabledOnClient(id)); } if (thirdPartyEnabled === false && passwordlessEnabled === false) { From 792316b5b7c463a47a62af1b195bc356fcf5c94f Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Thu, 9 Nov 2023 16:11:36 +0100 Subject: [PATCH 18/35] feat: self-review fixes --- CHANGELOG.md | 31 +++++++++++++++++++ examples/for-tests-react-16/src/App.js | 4 +++ .../src/AppWithReactDomRouter.js | 3 +- .../for-tests-react-16/src/testContext.js | 1 + examples/for-tests/src/App.js | 3 -- examples/for-tests/src/testContext.js | 2 +- frontendDriverInterfaceSupported.json | 2 +- lib/build/genericComponentOverrideContext.js | 2 +- lib/build/index2.js | 2 +- lib/build/recipe/multitenancy/types.d.ts | 2 +- .../thirdpartyemailpasswordprebuiltui.js | 17 +++++----- lib/build/thirdpartypasswordlessprebuiltui.js | 14 ++++++--- lib/build/version.d.ts | 2 +- lib/ts/recipe/multitenancy/types.ts | 2 +- lib/ts/recipe/recipeRouter/index.tsx | 2 +- .../components/themes/signInAndUp/index.tsx | 17 +++++----- .../components/themes/signInUp/index.tsx | 9 ++++-- lib/ts/version.ts | 2 +- package-lock.json | 10 +++--- package.json | 2 +- webJsInterfaceSupported.json | 2 +- 21 files changed, 88 insertions(+), 43 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 88a44c77e..811b4d3d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,37 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) +## [0.36.0] - 2023-11-XX + +### Overview + +#### Introducing MFA + +With this release, we are introducing MultiFactorAuthentication and TOTP, this will let you: + +- require (2FA or MFA) during sign in +- make use of our TOTP + +Check our [guide](https://supertokens.com/docs/thirdpartyemailpassword/common-customizations/multi-factor-auth/overview) for more information. + +To use this you'll need compatible versions: + +- Core>=8.0.0 +- supertokens-node>=17.0.0 (support is pending in other backend SDKs) +- supertokens-website>=17.0.3 +- supertokens-web-js>=0.9.0 +- supertokens-auth-react>=0.36.0 + +### Changes + +- Added support for FDI 1.19 (Node SDK>= 17.0.0), but keeping support FDI version 1.17 and 1.18 (node >= 15.0.0, golang>=0.13, python>=0.15.0) +- Added `firstFactors` into the return type of `getLoginMethods` +- Added the `MultiFactorAuth` recipe +- Updated how we select which login UI to show to take the `firstFactors` config value into account (defined in the `MultiFactorAuth` recipe or in the tenant information) +- Refactored/renamed some styling options (`resetPasswordHeaderTitle` -> `headerTitle withBackButton`) +- Added a `useShadowDom` prop to the `AccessDeniedScreen` +- Added an `error` prop to the `AccessDeniedScreen` that can be used to describe the reason access is denied. + ## [0.35.5] - 2023-10-06 ### Changes diff --git a/examples/for-tests-react-16/src/App.js b/examples/for-tests-react-16/src/App.js index 10330bef8..63b2e0aad 100644 --- a/examples/for-tests-react-16/src/App.js +++ b/examples/for-tests-react-16/src/App.js @@ -178,6 +178,9 @@ const formFields = [ const testContext = getTestContext(); let recipeList = [ + MultiFactorAuth.init({ + firstFactors: testContext.firstFactors, + }), Multitenancy.init({ override: { functions: (oI) => ({ @@ -491,6 +494,7 @@ export function DashboardHelper({ redirectOnLogout, ...props } = {}) {
session context userID: {sessionContext.userId}
{JSON.stringify(sessionContext.invalidClaims, undefined, 2)}
+
MultiFactorAuth.redirectToFactorChooser(true, props.history)}>MFA chooser
); } diff --git a/examples/for-tests-react-16/src/AppWithReactDomRouter.js b/examples/for-tests-react-16/src/AppWithReactDomRouter.js index a17b09c67..118b79baf 100644 --- a/examples/for-tests-react-16/src/AppWithReactDomRouter.js +++ b/examples/for-tests-react-16/src/AppWithReactDomRouter.js @@ -15,6 +15,7 @@ import { EmailVerificationPreBuiltUI } from "supertokens-auth-react/recipe/email import { EmailPasswordPreBuiltUI } from "supertokens-auth-react/recipe/emailpassword/prebuiltui"; import { PasswordlessPreBuiltUI } from "supertokens-auth-react/recipe/passwordless/prebuiltui"; import { ThirdPartyPreBuiltUI } from "supertokens-auth-react/recipe/thirdparty/prebuiltui"; +import { MultiFactorAuthPreBuiltUI } from "supertokens-auth-react/recipe/multifactorauth/prebuiltui"; import { AccessDeniedScreen } from "supertokens-auth-react/recipe/session/prebuiltui"; import { getEnabledRecipes } from "./testContext"; @@ -22,7 +23,7 @@ function AppWithReactDomRouter(props) { const enabledRecipes = getEnabledRecipes(); const emailVerificationMode = window.localStorage.getItem("mode") || "OFF"; - let recipePreBuiltUIList = []; + let recipePreBuiltUIList = [MultiFactorAuthPreBuiltUI]; if (enabledRecipes.includes("emailpassword")) { recipePreBuiltUIList.push(EmailPasswordPreBuiltUI); } diff --git a/examples/for-tests-react-16/src/testContext.js b/examples/for-tests-react-16/src/testContext.js index 618e990ba..d0f1ea989 100644 --- a/examples/for-tests-react-16/src/testContext.js +++ b/examples/for-tests-react-16/src/testContext.js @@ -14,6 +14,7 @@ export function getTestContext() { staticProviderList: localStorage.getItem("staticProviderList"), mockTenantId: localStorage.getItem("mockTenantId"), clientType: localStorage.getItem("clientType") || undefined, + firstFactors: localStorage.getItem("firstFactors")?.split(", "), }; return ret; } diff --git a/examples/for-tests/src/App.js b/examples/for-tests/src/App.js index 3efe4f4e5..9b478170a 100644 --- a/examples/for-tests/src/App.js +++ b/examples/for-tests/src/App.js @@ -485,9 +485,6 @@ export function DashboardHelper({ redirectOnLogout, ...props } = {}) {
session context userID: {sessionContext.userId}
{JSON.stringify(sessionContext.invalidClaims, undefined, 2)}
MultiFactorAuth.redirectToFactorChooser(true, props.history)}>MFA chooser - MultiFactorAuth.redirectToFactor("totp", true, props.history)}>TOTP - MultiFactorAuth.redirectToFactor("otp-email", true, props.history)}>OTP-Email - MultiFactorAuth.redirectToFactor("otp-phone", true, props.history)}>OTP-Phone
); } diff --git a/examples/for-tests/src/testContext.js b/examples/for-tests/src/testContext.js index 21c43c304..d0f1ea989 100644 --- a/examples/for-tests/src/testContext.js +++ b/examples/for-tests/src/testContext.js @@ -24,7 +24,7 @@ export function getEnabledRecipes() { let enabledRecipes = []; - if (true) { + if (testContext.usesDynamicLoginMethods) { if (testContext.clientRecipeListForDynamicLogin) { enabledRecipes = JSON.parse(testContext.clientRecipeListForDynamicLogin); } else { diff --git a/frontendDriverInterfaceSupported.json b/frontendDriverInterfaceSupported.json index 0e254b7bb..9e7a9eeea 100644 --- a/frontendDriverInterfaceSupported.json +++ b/frontendDriverInterfaceSupported.json @@ -1,4 +1,4 @@ { "_comment": "contains a list of frontend-backend interface versions that this package supports", - "versions": ["1.17", "1.18"] + "versions": ["1.17", "1.18", "1.19"] } diff --git a/lib/build/genericComponentOverrideContext.js b/lib/build/genericComponentOverrideContext.js index 48e7f0db5..d8ad564ec 100644 --- a/lib/build/genericComponentOverrideContext.js +++ b/lib/build/genericComponentOverrideContext.js @@ -265,7 +265,7 @@ var SSR_ERROR = * License for the specific language governing permissions and limitations * under the License. */ -var package_version = "0.35.5"; +var package_version = "0.36.0"; /* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. * diff --git a/lib/build/index2.js b/lib/build/index2.js index edf0789be..c15b8d336 100644 --- a/lib/build/index2.js +++ b/lib/build/index2.js @@ -552,7 +552,7 @@ var RecipeRouter = /** @class */ (function () { if (dynamicLoginMethods.firstFactors !== undefined) { return chooseComponentBasedOnFirstFactors(dynamicLoginMethods.firstFactors, routeComponents); } - // TODO: do we even need the else branch? (maybe for backwards comp.) + // We may get here if the app is using an older BE that doesn't support MFA var enabledRecipeCount = Object.keys(dynamicLoginMethods).filter(function (key) { return dynamicLoginMethods[key].enabled; }).length; diff --git a/lib/build/recipe/multitenancy/types.d.ts b/lib/build/recipe/multitenancy/types.d.ts index b65184946..5589f3ffa 100644 --- a/lib/build/recipe/multitenancy/types.d.ts +++ b/lib/build/recipe/multitenancy/types.d.ts @@ -37,7 +37,7 @@ export declare type GetLoginMethodsResponseNormalized = { name: string; }[]; }; - firstFactors: string[]; + firstFactors?: string[]; }; export declare type ComponentOverrideMap = { MultitenancyDynamicLoginMethodsSpinnerTheme_Override?: ComponentOverride; diff --git a/lib/build/thirdpartyemailpasswordprebuiltui.js b/lib/build/thirdpartyemailpasswordprebuiltui.js index c405c3bd4..78900f73c 100644 --- a/lib/build/thirdpartyemailpasswordprebuiltui.js +++ b/lib/build/thirdpartyemailpasswordprebuiltui.js @@ -145,17 +145,18 @@ var SignInAndUpTheme = function (props) { var thirdPartyEnabled = hasProviders; var emailPasswordEnabled = props.emailPasswordRecipe !== undefined; if (usesDynamicLoginMethods) { - thirdPartyEnabled = thirdPartyEnabled && loginMethods.firstFactors.includes("thirdparty") && hasProviders; + thirdPartyEnabled = + (loginMethods.firstFactors === undefined + ? loginMethods.thirdparty.enabled + : loginMethods.firstFactors.includes("thirdparty")) && hasProviders; emailPasswordEnabled = - emailPasswordEnabled && - loginMethods.firstFactors.includes("emailpassword") && - props.emailPasswordRecipe !== undefined; + (loginMethods.firstFactors === undefined + ? loginMethods.emailpassword.enabled + : loginMethods.firstFactors.includes("emailpassword")) && props.emailPasswordRecipe !== undefined; } else if (mfa !== undefined) { - thirdPartyEnabled = thirdPartyEnabled && mfa.isFirstFactorEnabledOnClient("thirdparty") && hasProviders; + thirdPartyEnabled = mfa.isFirstFactorEnabledOnClient("thirdparty") && hasProviders; emailPasswordEnabled = - emailPasswordEnabled && - mfa.isFirstFactorEnabledOnClient("emailpassword") && - props.emailPasswordRecipe !== undefined; + mfa.isFirstFactorEnabledOnClient("emailpassword") && props.emailPasswordRecipe !== undefined; } if (thirdPartyEnabled === false && emailPasswordEnabled === false) { return null; diff --git a/lib/build/thirdpartypasswordlessprebuiltui.js b/lib/build/thirdpartypasswordlessprebuiltui.js index d8b87f2fc..ae98805d2 100644 --- a/lib/build/thirdpartypasswordlessprebuiltui.js +++ b/lib/build/thirdpartypasswordlessprebuiltui.js @@ -138,12 +138,16 @@ var SignInUpTheme = function (props) { var thirdPartyEnabled = hasProviders; var passwordlessEnabled = props.passwordlessRecipe !== undefined; if (usesDynamicLoginMethods) { - thirdPartyEnabled = thirdPartyEnabled && loginMethods.firstFactors.includes("thirdparty") && hasProviders; + thirdPartyEnabled = + (loginMethods.firstFactors === undefined + ? loginMethods.thirdparty.enabled + : loginMethods.firstFactors.includes("thirdparty")) && hasProviders; passwordlessEnabled = - passwordlessEnabled && - recipe$1.passwordlessFirstFactors.some(function (id) { - return loginMethods.firstFactors.includes(id); - }); + loginMethods.firstFactors === undefined + ? loginMethods.passwordless.enabled + : recipe$1.passwordlessFirstFactors.some(function (id) { + return loginMethods.firstFactors.includes(id); + }); } else if (mfa !== undefined) { thirdPartyEnabled = thirdPartyEnabled && mfa.isFirstFactorEnabledOnClient("thirdparty"); passwordlessEnabled = diff --git a/lib/build/version.d.ts b/lib/build/version.d.ts index a27549731..e85100a93 100644 --- a/lib/build/version.d.ts +++ b/lib/build/version.d.ts @@ -1 +1 @@ -export declare const package_version = "0.35.5"; +export declare const package_version = "0.36.0"; diff --git a/lib/ts/recipe/multitenancy/types.ts b/lib/ts/recipe/multitenancy/types.ts index 37e99a15c..ea7dc1252 100644 --- a/lib/ts/recipe/multitenancy/types.ts +++ b/lib/ts/recipe/multitenancy/types.ts @@ -41,7 +41,7 @@ export type GetLoginMethodsResponseNormalized = { name: string; }[]; }; - firstFactors: string[]; + firstFactors?: string[]; }; export type ComponentOverrideMap = { diff --git a/lib/ts/recipe/recipeRouter/index.tsx b/lib/ts/recipe/recipeRouter/index.tsx index 8a5d5fe18..14d2c063a 100644 --- a/lib/ts/recipe/recipeRouter/index.tsx +++ b/lib/ts/recipe/recipeRouter/index.tsx @@ -144,7 +144,7 @@ export abstract class RecipeRouter { return chooseComponentBasedOnFirstFactors(dynamicLoginMethods.firstFactors, routeComponents); } - // TODO: do we even need the else branch? (maybe for backwards comp.) + // We may get here if the app is using an older BE that doesn't support MFA const enabledRecipeCount = Object.keys(dynamicLoginMethods).filter( (key) => (dynamicLoginMethods as any)[key].enabled ).length; diff --git a/lib/ts/recipe/thirdpartyemailpassword/components/themes/signInAndUp/index.tsx b/lib/ts/recipe/thirdpartyemailpassword/components/themes/signInAndUp/index.tsx index b0aeb68ef..f23e81bad 100644 --- a/lib/ts/recipe/thirdpartyemailpassword/components/themes/signInAndUp/index.tsx +++ b/lib/ts/recipe/thirdpartyemailpassword/components/themes/signInAndUp/index.tsx @@ -56,17 +56,18 @@ const SignInAndUpTheme: React.FC = let emailPasswordEnabled: boolean = props.emailPasswordRecipe !== undefined; if (usesDynamicLoginMethods) { - thirdPartyEnabled = thirdPartyEnabled && loginMethods!.firstFactors.includes("thirdparty") && hasProviders; + thirdPartyEnabled = + (loginMethods!.firstFactors === undefined + ? loginMethods!.thirdparty.enabled + : loginMethods!.firstFactors.includes("thirdparty")) && hasProviders; emailPasswordEnabled = - emailPasswordEnabled && - loginMethods!.firstFactors.includes("emailpassword") && - props.emailPasswordRecipe !== undefined; + (loginMethods!.firstFactors === undefined + ? loginMethods!.emailpassword.enabled + : loginMethods!.firstFactors.includes("emailpassword")) && props.emailPasswordRecipe !== undefined; } else if (mfa !== undefined) { - thirdPartyEnabled = thirdPartyEnabled && mfa.isFirstFactorEnabledOnClient("thirdparty") && hasProviders; + thirdPartyEnabled = mfa.isFirstFactorEnabledOnClient("thirdparty") && hasProviders; emailPasswordEnabled = - emailPasswordEnabled && - mfa.isFirstFactorEnabledOnClient("emailpassword") && - props.emailPasswordRecipe !== undefined; + mfa.isFirstFactorEnabledOnClient("emailpassword") && props.emailPasswordRecipe !== undefined; } if (thirdPartyEnabled === false && emailPasswordEnabled === false) { diff --git a/lib/ts/recipe/thirdpartypasswordless/components/themes/signInUp/index.tsx b/lib/ts/recipe/thirdpartypasswordless/components/themes/signInUp/index.tsx index 870771d8f..8aefd9417 100644 --- a/lib/ts/recipe/thirdpartypasswordless/components/themes/signInUp/index.tsx +++ b/lib/ts/recipe/thirdpartypasswordless/components/themes/signInUp/index.tsx @@ -65,9 +65,14 @@ const SignInUpTheme: React.FC loginMethods!.firstFactors.includes(id)); + loginMethods!.firstFactors === undefined + ? loginMethods!.passwordless.enabled + : passwordlessFirstFactors.some((id) => loginMethods!.firstFactors!.includes(id)); } else if (mfa !== undefined) { thirdPartyEnabled = thirdPartyEnabled && mfa.isFirstFactorEnabledOnClient("thirdparty"); passwordlessEnabled = diff --git a/lib/ts/version.ts b/lib/ts/version.ts index c769c2bf4..1fd0f9cc7 100644 --- a/lib/ts/version.ts +++ b/lib/ts/version.ts @@ -12,4 +12,4 @@ * License for the specific language governing permissions and limitations * under the License. */ -export const package_version = "0.35.5"; +export const package_version = "0.36.0"; diff --git a/package-lock.json b/package-lock.json index 5fa17dd82..8f3d19ca6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "supertokens-auth-react", - "version": "0.35.5", + "version": "0.36.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "supertokens-auth-react", - "version": "0.35.5", + "version": "0.36.0", "license": "Apache-2.0", "dependencies": { "intl-tel-input": "^17.0.19", @@ -16243,8 +16243,8 @@ "integrity": "sha512-r0JFBjkMIdep3Lbk3JA+MpnpuOtw4RSyrlRAbrzMcxwiYco3GFWl/daimQZ5b1forOiUODpOlXbSOljP/oyurg==" }, "node_modules/supertokens-web-js": { - "version": "0.8.0", - "resolved": "git+ssh://git@github.com/supertokens/supertokens-web-js.git#f6aa50d8b92dff7d86221ecc03eb1cc808ac2273", + "version": "0.9.0", + "resolved": "git+ssh://git@github.com/supertokens/supertokens-web-js.git#eeb37fb37e402bf329b0b6ae6e72b20c228b747a", "license": "Apache-2.0", "peer": true, "dependencies": { @@ -29414,7 +29414,7 @@ "integrity": "sha512-r0JFBjkMIdep3Lbk3JA+MpnpuOtw4RSyrlRAbrzMcxwiYco3GFWl/daimQZ5b1forOiUODpOlXbSOljP/oyurg==" }, "supertokens-web-js": { - "version": "git+ssh://git@github.com/supertokens/supertokens-web-js.git#f6aa50d8b92dff7d86221ecc03eb1cc808ac2273", + "version": "git+ssh://git@github.com/supertokens/supertokens-web-js.git#eeb37fb37e402bf329b0b6ae6e72b20c228b747a", "from": "supertokens-web-js@github:supertokens/supertokens-web-js#feat/mfa", "peer": true, "requires": { diff --git a/package.json b/package.json index e1a2eb98a..959cb36cd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "supertokens-auth-react", - "version": "0.35.5", + "version": "0.36.0", "description": "ReactJS SDK that provides login functionality with SuperTokens.", "main": "./index.js", "engines": { diff --git a/webJsInterfaceSupported.json b/webJsInterfaceSupported.json index 8d49c5c48..aeb27d921 100644 --- a/webJsInterfaceSupported.json +++ b/webJsInterfaceSupported.json @@ -1,4 +1,4 @@ { "_comment": "contains the web js interface version that this package supports", - "version": "0.7" + "version": "0.8" } From f45271c7e3ebc08e13a21df368494cb9e5cbe95d Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Thu, 9 Nov 2023 16:14:00 +0100 Subject: [PATCH 19/35] chore: add mfa ui to size limits --- package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package.json b/package.json index 959cb36cd..6a54dd31b 100644 --- a/package.json +++ b/package.json @@ -184,6 +184,10 @@ { "path": "recipe/multifactorauth/index.js", "limit": "10kb" + }, + { + "path": "recipe/multifactorauth/prebuiltui.js", + "limit": "30kb" } ], "browserslist": { From 1990358493f800e38c93d286d788be4bbbfd1a6b Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Thu, 9 Nov 2023 21:42:59 +0100 Subject: [PATCH 20/35] refactor: remove updates that will be added in other PRs + simplifications --- CHANGELOG.md | 2 +- lib/build/components/assets/otpIcon.d.ts | 2 - lib/build/multifactorauth-shared.js | 2 +- lib/build/passwordless-shared2.js | 76 ---- lib/build/passwordless.js | 3 - lib/build/recipe/multifactorauth/index.d.ts | 2 +- lib/build/recipe/multifactorauth/types.d.ts | 8 +- .../components/features/mfa/index.d.ts | 38 -- lib/build/thirdpartypasswordless.js | 3 - lib/ts/components/assets/otpIcon.tsx | 32 -- lib/ts/recipe/multifactorauth/recipe.tsx | 4 +- lib/ts/recipe/multifactorauth/types.ts | 8 +- .../components/features/mfa/index.tsx | 397 ------------------ lib/ts/recipe/passwordless/recipe.tsx | 26 -- test/with-typescript/src/App.tsx | 13 + 15 files changed, 23 insertions(+), 593 deletions(-) delete mode 100644 lib/build/components/assets/otpIcon.d.ts delete mode 100644 lib/build/recipe/passwordless/components/features/mfa/index.d.ts delete mode 100644 lib/ts/components/assets/otpIcon.tsx delete mode 100644 lib/ts/recipe/passwordless/components/features/mfa/index.tsx diff --git a/CHANGELOG.md b/CHANGELOG.md index 811b4d3d6..872d9af09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 #### Introducing MFA -With this release, we are introducing MultiFactorAuthentication and TOTP, this will let you: +With this release, we are introducing MultiFactorAuth and TOTP, this will let you: - require (2FA or MFA) during sign in - make use of our TOTP diff --git a/lib/build/components/assets/otpIcon.d.ts b/lib/build/components/assets/otpIcon.d.ts deleted file mode 100644 index bcb7b9c12..000000000 --- a/lib/build/components/assets/otpIcon.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -/// -export declare const OTPIcon: () => JSX.Element; diff --git a/lib/build/multifactorauth-shared.js b/lib/build/multifactorauth-shared.js index a0a27c28d..b81459a84 100644 --- a/lib/build/multifactorauth-shared.js +++ b/lib/build/multifactorauth-shared.js @@ -219,7 +219,7 @@ var MultiFactorAuth = /** @class */ (function (_super) { return [ 2 /*return*/, this.config.appInfo.websiteBasePath - .appendPath(redirectInfo.path) + .appendPath(new NormalisedURLPath__default.default(redirectInfo.path)) .getAsStringDangerous(), ]; } diff --git a/lib/build/passwordless-shared2.js b/lib/build/passwordless-shared2.js index bd9595f66..90bcc72d8 100644 --- a/lib/build/passwordless-shared2.js +++ b/lib/build/passwordless-shared2.js @@ -2,11 +2,7 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext.js"); var PasswordlessWebJS = require("supertokens-web-js/recipe/passwordless"); -var NormalisedURLPath = require("supertokens-web-js/utils/normalisedURLPath"); -var postSuperTokensInitCallbacks = require("supertokens-web-js/utils/postSuperTokensInitCallbacks"); -var jsxRuntime = require("react/jsx-runtime"); var utils = require("./authRecipe-shared.js"); -var recipe = require("./multifactorauth-shared.js"); var windowHandler = require("supertokens-web-js/utils/windowHandler"); function _interopDefault(e) { @@ -14,57 +10,6 @@ function _interopDefault(e) { } var PasswordlessWebJS__default = /*#__PURE__*/ _interopDefault(PasswordlessWebJS); -var NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath); - -var OTPIcon = function () { - return jsxRuntime.jsxs( - "svg", - genericComponentOverrideContext.__assign( - { xmlns: "http://www.w3.org/2000/svg", width: "22", height: "23", viewBox: "0 4 22 23", fill: "none" }, - { - children: [ - jsxRuntime.jsx("path", { - d: "M7.56428 15.8664L5.26639 18.1643C5.11403 18.3167 4.90738 18.4023 4.69192 18.4023C4.47645 18.4023 4.2698 18.3167 4.11744 18.1643C3.96508 18.012 3.87949 17.8053 3.87949 17.5898C3.87949 17.3744 3.96508 17.1677 4.11744 17.0154L6.41533 14.7175C6.56769 14.5651 6.77434 14.4795 6.98981 14.4795C7.20528 14.4795 7.41192 14.5651 7.56428 14.7175C7.71664 14.8698 7.80224 15.0765 7.80224 15.292C7.80224 15.5074 7.71664 15.7141 7.56428 15.8664Z", - fill: "#73B6FF", - }), - jsxRuntime.jsx("path", { - d: "M5.17026 13.4675L1.72342 16.9143C1.57106 17.0667 1.36442 17.1523 1.14895 17.1523C0.933477 17.1523 0.726833 17.0667 0.574473 16.9143C0.422113 16.762 0.336519 16.5553 0.336519 16.3398C0.336519 16.1244 0.422113 15.9177 0.574473 15.7654L4.02131 12.3185C4.17367 12.1662 4.38032 12.0806 4.59579 12.0806C4.81125 12.0806 5.0179 12.1662 5.17026 12.3185C5.32262 12.4709 5.40821 12.6775 5.40821 12.893C5.40821 13.1085 5.32262 13.3151 5.17026 13.4675Z", - fill: "#73B6FF", - }), - jsxRuntime.jsx("path", { - d: "M10.0492 18.1315L6.60233 21.5784C6.44997 21.7307 6.24332 21.8163 6.02785 21.8163C5.81238 21.8163 5.60574 21.7307 5.45338 21.5784C5.30102 21.426 5.21542 21.2194 5.21542 21.0039C5.21542 20.7884 5.30102 20.5818 5.45338 20.4294L8.90022 16.9826C9.05258 16.8302 9.25922 16.7446 9.47469 16.7446C9.69016 16.7446 9.89681 16.8302 10.0492 16.9826C10.2015 17.135 10.2871 17.3416 10.2871 17.5571C10.2871 17.7725 10.2015 17.9792 10.0492 18.1315Z", - fill: "#73B6FF", - }), - jsxRuntime.jsx("path", { - d: "M16.935 4.28797L4.96211 8.24925C4.38349 8.47179 4.29448 9.27295 4.87309 9.49549L8.96789 11.3649L14.8876 7.13653L10.6592 13.0562L12.5286 17.151C12.7956 17.6851 13.5523 17.6406 13.7303 17.0175L17.6916 5.04462C17.8696 4.59953 17.4246 4.15444 16.935 4.28797Z", - fill: "url(#paint0_linear_3828_8733)", - }), - jsxRuntime.jsx("defs", { - children: jsxRuntime.jsxs( - "linearGradient", - genericComponentOverrideContext.__assign( - { - id: "paint0_linear_3828_8733", - x1: "16.9576", - y1: "4.56946", - x2: "9.50502", - y2: "12.0221", - gradientUnits: "userSpaceOnUse", - }, - { - children: [ - jsxRuntime.jsx("stop", { stopColor: "#5FABFF" }), - jsxRuntime.jsx("stop", { offset: "1", stopColor: "#1485FF" }), - ], - } - ) - ), - }), - ], - } - ) - ); -}; var getFunctionOverrides = function (onHandleEvent) { return function (originalImp) { @@ -549,27 +494,6 @@ var Passwordless = /** @class */ (function (_super) { } Passwordless.init = function (config) { var normalisedConfig = normalisePasswordlessConfig(config); - postSuperTokensInitCallbacks.PostSuperTokensInitCallbacks.addPostInitCallback(function () { - var mfa = recipe.MultiFactorAuth.getInstance(); - if (mfa !== undefined) { - mfa.addMFAFactors([ - { - id: "otp-phone", - name: "SMS based OTP", - description: "Get an OTP code on your phone to complete the authentication request", - path: new NormalisedURLPath__default.default("/check-auth/otp-phone"), - logo: OTPIcon, - }, - { - id: "otp-email", - name: "SMS based OTP", - description: "Get an OTP code on your email address to complete the authentication request", - path: new NormalisedURLPath__default.default("/check-auth/otp-email"), - logo: OTPIcon, - }, - ]); - } - }); return { recipeID: Passwordless.RECIPE_ID, authReact: function (appInfo) { diff --git a/lib/build/passwordless.js b/lib/build/passwordless.js index ce950e342..f8cba3862 100644 --- a/lib/build/passwordless.js +++ b/lib/build/passwordless.js @@ -20,9 +20,6 @@ require("./authRecipe-shared.js"); require("./recipeModule-shared.js"); require("./session-shared2.js"); require("supertokens-web-js/recipe/session"); -require("./multifactorauth-shared.js"); -require("supertokens-web-js/recipe/multifactorauth"); -require("supertokens-web-js/utils/sessionClaimValidatorStore"); /* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. * diff --git a/lib/build/recipe/multifactorauth/index.d.ts b/lib/build/recipe/multifactorauth/index.d.ts index 02c7496be..c04d19aaa 100644 --- a/lib/build/recipe/multifactorauth/index.d.ts +++ b/lib/build/recipe/multifactorauth/index.d.ts @@ -11,7 +11,7 @@ export default class Wrapper { ): import("../../types").RecipeInitResult< GetRedirectionURLContext, "GET_MFA_INFO", - OnHandleEventContext, + never, import("./types").NormalisedConfig >; static getMFAInfo(input?: { userContext?: any; options?: RecipeFunctionOptions }): Promise<{ diff --git a/lib/build/recipe/multifactorauth/types.d.ts b/lib/build/recipe/multifactorauth/types.d.ts index 93d7086d8..e861b76c0 100644 --- a/lib/build/recipe/multifactorauth/types.d.ts +++ b/lib/build/recipe/multifactorauth/types.d.ts @@ -7,7 +7,6 @@ import type { } from "../recipeModule/types"; import type { FC } from "react"; import type { OverrideableBuilder } from "supertokens-js-override"; -import type NormalisedURLPath from "supertokens-web-js/lib/build/normalisedURLPath"; import type { RecipeInterface } from "supertokens-web-js/recipe/multifactorauth"; import type { MFAFactorInfo } from "supertokens-web-js/recipe/multifactorauth/types"; export declare type ComponentOverrideMap = { @@ -54,10 +53,7 @@ export declare type PreAPIHookContext = { url: string; userContext: any; }; -export declare type OnHandleEventContext = { - action: "FACTOR_CHOSEN"; - userContext: any; -}; +export declare type OnHandleEventContext = never; export declare type FactorChooserThemeProps = { mfaInfo: MFAFactorInfo; availableFactors: SecondaryFactorRedirectionInfo[]; @@ -73,5 +69,5 @@ export declare type SecondaryFactorRedirectionInfo = { name: string; description: string; logo: FC; - path: NormalisedURLPath; + path: string; }; diff --git a/lib/build/recipe/passwordless/components/features/mfa/index.d.ts b/lib/build/recipe/passwordless/components/features/mfa/index.d.ts deleted file mode 100644 index 02b7a8daa..000000000 --- a/lib/build/recipe/passwordless/components/features/mfa/index.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -import * as React from "react"; -import type { FeatureBaseProps } from "../../../../../types"; -import type Recipe from "../../../recipe"; -import type { ComponentOverrideMap } from "../../../types"; -import type { PasswordlessSignInUpAction, SignInUpState, SignInUpChildProps } from "../../../types"; -import type { RecipeInterface } from "supertokens-web-js/recipe/passwordless"; -export declare const useSuccessInAnotherTabChecker: ( - state: SignInUpState, - dispatch: React.Dispatch, - userContext: any -) => React.MutableRefObject; -export declare const useFeatureReducer: ( - recipeImpl: RecipeInterface | undefined, - userContext: any -) => [SignInUpState, React.Dispatch]; -export declare function useChildProps( - recipe: Recipe, - dispatch: React.Dispatch, - state: SignInUpState, - callingConsumeCodeRef: React.MutableRefObject, - userContext: any, - history: any -): SignInUpChildProps; -export declare function useChildProps( - recipe: Recipe | undefined, - dispatch: React.Dispatch, - state: SignInUpState, - callingConsumeCodeRef: React.MutableRefObject, - userContext: any, - history: any -): SignInUpChildProps | undefined; -export declare const SignInUpFeature: React.FC< - FeatureBaseProps & { - recipe: Recipe; - useComponentOverrides: () => ComponentOverrideMap; - } ->; -export default SignInUpFeature; diff --git a/lib/build/thirdpartypasswordless.js b/lib/build/thirdpartypasswordless.js index 796cbe40c..7de9631c9 100644 --- a/lib/build/thirdpartypasswordless.js +++ b/lib/build/thirdpartypasswordless.js @@ -26,9 +26,6 @@ require("supertokens-web-js/lib/build/normalisedURLPath"); require("supertokens-web-js/recipe/thirdpartypasswordless"); require("./passwordless-shared2.js"); require("supertokens-web-js/recipe/passwordless"); -require("./multifactorauth-shared.js"); -require("supertokens-web-js/recipe/multifactorauth"); -require("supertokens-web-js/utils/sessionClaimValidatorStore"); var Wrapper = /** @class */ (function () { function Wrapper() {} diff --git a/lib/ts/components/assets/otpIcon.tsx b/lib/ts/components/assets/otpIcon.tsx deleted file mode 100644 index 5c0e1c977..000000000 --- a/lib/ts/components/assets/otpIcon.tsx +++ /dev/null @@ -1,32 +0,0 @@ -export const OTPIcon = () => ( - - - - - - - - - - - - -); diff --git a/lib/ts/recipe/multifactorauth/recipe.tsx b/lib/ts/recipe/multifactorauth/recipe.tsx index ba7e88b10..5caab85c9 100644 --- a/lib/ts/recipe/multifactorauth/recipe.tsx +++ b/lib/ts/recipe/multifactorauth/recipe.tsx @@ -135,7 +135,9 @@ export default class MultiFactorAuth extends RecipeModule< } else if (context.action === "GO_TO_FACTOR") { const redirectInfo = this.getSecondaryFactors().find((f) => f.id === context.factorId); if (redirectInfo !== undefined) { - return this.config.appInfo.websiteBasePath.appendPath(redirectInfo.path).getAsStringDangerous(); + return this.config.appInfo.websiteBasePath + .appendPath(new NormalisedURLPath(redirectInfo.path)) + .getAsStringDangerous(); } throw new Error("Requested redirect to unknown factor id"); } else { diff --git a/lib/ts/recipe/multifactorauth/types.ts b/lib/ts/recipe/multifactorauth/types.ts index 08b22e940..a47873af0 100644 --- a/lib/ts/recipe/multifactorauth/types.ts +++ b/lib/ts/recipe/multifactorauth/types.ts @@ -22,7 +22,6 @@ import type { } from "../recipeModule/types"; import type { FC } from "react"; import type { OverrideableBuilder } from "supertokens-js-override"; -import type NormalisedURLPath from "supertokens-web-js/lib/build/normalisedURLPath"; import type { RecipeInterface } from "supertokens-web-js/recipe/multifactorauth"; import type { MFAFactorInfo } from "supertokens-web-js/recipe/multifactorauth/types"; @@ -81,10 +80,7 @@ export type PreAPIHookContext = { userContext: any; }; -export type OnHandleEventContext = { - action: "FACTOR_CHOSEN"; - userContext: any; -}; +export type OnHandleEventContext = never; export type FactorChooserThemeProps = { mfaInfo: MFAFactorInfo; @@ -102,5 +98,5 @@ export type SecondaryFactorRedirectionInfo = { name: string; description: string; logo: FC; - path: NormalisedURLPath; + path: string; }; diff --git a/lib/ts/recipe/passwordless/components/features/mfa/index.tsx b/lib/ts/recipe/passwordless/components/features/mfa/index.tsx deleted file mode 100644 index 49eb6f92f..000000000 --- a/lib/ts/recipe/passwordless/components/features/mfa/index.tsx +++ /dev/null @@ -1,397 +0,0 @@ -/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. - * - * This software is licensed under the Apache License, Version 2.0 (the - * "License") as published by the Apache Software Foundation. - * - * You may not use this file except in compliance with the License. You may - * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -/* - * Imports. - */ -import * as React from "react"; -import { Fragment } from "react"; -import { useMemo } from "react"; -import { useRef } from "react"; -import { useEffect } from "react"; - -import { ComponentOverrideContext } from "../../../../../components/componentOverride/componentOverrideContext"; -import FeatureWrapper from "../../../../../components/featureWrapper"; -import { useUserContext } from "../../../../../usercontext"; -import { clearErrorQueryParam, getQueryParams, getRedirectToPathFromURL } from "../../../../../utils"; -import Session from "../../../../session"; -import SessionRecipe from "../../../../session/recipe"; -import { getPhoneNumberUtils } from "../../../phoneNumberUtils"; -import SignInUpThemeWrapper from "../../themes/signInUp"; -import { defaultTranslationsPasswordless } from "../../themes/translations"; - -import type { FeatureBaseProps } from "../../../../../types"; -import type Recipe from "../../../recipe"; -import type { AdditionalLoginAttemptInfoProperties, ComponentOverrideMap } from "../../../types"; -import type { PasswordlessSignInUpAction, SignInUpState, SignInUpChildProps, NormalisedConfig } from "../../../types"; -import type { RecipeInterface } from "supertokens-web-js/recipe/passwordless"; -import type { User } from "supertokens-web-js/types"; - -export const useSuccessInAnotherTabChecker = ( - state: SignInUpState, - dispatch: React.Dispatch, - userContext: any -) => { - const callingConsumeCodeRef = useRef(false); - - useEffect(() => { - // We only need to start checking this if we have an active login attempt - if (state.loginAttemptInfo && !state.successInAnotherTab) { - const checkSessionIntervalHandle = setInterval(async () => { - if (callingConsumeCodeRef.current === false) { - const hasSession = await Session.doesSessionExist({ - userContext, - }); - if (hasSession) { - dispatch({ type: "successInAnotherTab" }); - } - } - }, 2000); - - return () => { - clearInterval(checkSessionIntervalHandle); - }; - } - // Nothing to clean up - return; - }, [state.loginAttemptInfo, state.successInAnotherTab]); - - return callingConsumeCodeRef; -}; - -export const useFeatureReducer = ( - recipeImpl: RecipeInterface | undefined, - userContext: any -): [SignInUpState, React.Dispatch] => { - const [state, dispatch] = React.useReducer( - (oldState: SignInUpState, action: PasswordlessSignInUpAction) => { - switch (action.type) { - case "load": - return { - loaded: true, - error: action.error, - loginAttemptInfo: action.loginAttemptInfo, - successInAnotherTab: false, - }; - case "resendCode": - if (!oldState.loginAttemptInfo) { - return oldState; - } - return { - ...oldState, - error: undefined, - loginAttemptInfo: { - ...oldState.loginAttemptInfo, - lastResend: action.timestamp, - }, - }; - case "restartFlow": - return { - ...oldState, - error: action.error, - loginAttemptInfo: undefined, - }; - case "setError": - return { - ...oldState, - error: action.error, - }; - case "startLogin": - return { - ...oldState, - loginAttemptInfo: action.loginAttemptInfo, - error: undefined, - }; - case "successInAnotherTab": - return { - ...oldState, - successInAnotherTab: true, - }; - default: - return oldState; - } - }, - { - error: undefined, - loaded: false, - loginAttemptInfo: undefined, - successInAnotherTab: false, - }, - (initArg) => { - let error: string | undefined = undefined; - const errorQueryParam = getQueryParams("error"); - const messageQueryParam = getQueryParams("message"); - if (errorQueryParam !== null) { - if (errorQueryParam === "signin") { - error = "SOMETHING_WENT_WRONG_ERROR"; - } else if (errorQueryParam === "restart_link") { - error = "ERROR_SIGN_IN_UP_LINK"; - } else if (errorQueryParam === "custom" && messageQueryParam !== null) { - error = messageQueryParam; - } - } - return { - ...initArg, - error, - }; - } - ); - useEffect(() => { - if (recipeImpl === undefined) { - return; - } - async function load() { - let error: string | undefined = undefined; - const errorQueryParam = getQueryParams("error"); - const messageQueryParam = getQueryParams("message"); - if (errorQueryParam !== null) { - if (errorQueryParam === "signin") { - error = "SOMETHING_WENT_WRONG_ERROR"; - } else if (errorQueryParam === "restart_link") { - error = "ERROR_SIGN_IN_UP_LINK"; - } else if (errorQueryParam === "custom" && messageQueryParam !== null) { - error = messageQueryParam; - } - } - const loginAttemptInfo = await recipeImpl?.getLoginAttemptInfo({ - userContext, - }); - // No need to check if the component is unmounting, since this has no effect then. - dispatch({ type: "load", loginAttemptInfo, error }); - } - if (state.loaded === false) { - void load(); - } - }, [state.loaded, recipeImpl, userContext]); - return [state, dispatch]; -}; - -// We are overloading to explicitly state that if recipe is defined then the return value is defined as well. -export function useChildProps( - recipe: Recipe, - dispatch: React.Dispatch, - state: SignInUpState, - callingConsumeCodeRef: React.MutableRefObject, - userContext: any, - history: any -): SignInUpChildProps; -export function useChildProps( - recipe: Recipe | undefined, - dispatch: React.Dispatch, - state: SignInUpState, - callingConsumeCodeRef: React.MutableRefObject, - userContext: any, - history: any -): SignInUpChildProps | undefined; - -export function useChildProps( - recipe: Recipe | undefined, - dispatch: React.Dispatch, - state: SignInUpState, - callingConsumeCodeRef: React.MutableRefObject, - userContext: any, - history: any -): SignInUpChildProps | undefined { - const recipeImplementation = React.useMemo( - () => - recipe && - getModifiedRecipeImplementation(recipe.webJSRecipe, recipe.config, dispatch, callingConsumeCodeRef), - [recipe] - ); - - return useMemo(() => { - if (!recipe || !recipeImplementation) { - return undefined; - } - return { - onSuccess: (result: { createdNewRecipeUser: boolean; user: User }) => { - return SessionRecipe.getInstanceOrThrow().validateGlobalClaimsAndHandleSuccessRedirection( - { - rid: recipe.config.recipeId, - successRedirectContext: { - action: "SUCCESS", - isNewRecipeUser: result.createdNewRecipeUser, - user: result.user, - redirectToPath: getRedirectToPathFromURL(), - }, - }, - userContext, - history - ); - }, - recipeImplementation: recipeImplementation, - config: recipe.config, - }; - }, [state, recipeImplementation]); -} - -export const SignInUpFeature: React.FC< - FeatureBaseProps & { - recipe: Recipe; - useComponentOverrides: () => ComponentOverrideMap; - } -> = (props) => { - const recipeComponentOverrides = props.useComponentOverrides(); - const userContext = useUserContext(); - const [state, dispatch] = useFeatureReducer(props.recipe.webJSRecipe, userContext); - const callingConsumeCodeRef = useSuccessInAnotherTabChecker(state, dispatch, userContext); - const childProps = useChildProps(props.recipe, dispatch, state, callingConsumeCodeRef, userContext, props.history)!; - - return ( - - - - {/* No custom theme, use default. */} - {props.children === undefined && ( - - )} - - {/* Otherwise, custom theme is provided, propagate props. */} - {props.children && - React.Children.map(props.children, (child) => { - if (React.isValidElement(child)) { - return React.cloneElement(child, { - ...childProps, - featureState: state, - dispatch: dispatch, - }); - } - return child; - })} - - - - ); -}; - -export default SignInUpFeature; - -function getModifiedRecipeImplementation( - originalImpl: RecipeInterface, - config: NormalisedConfig, - dispatch: React.Dispatch, - callingConsumeCodeRef: React.MutableRefObject -): RecipeInterface { - return { - ...originalImpl, - createCode: async (input) => { - let contactInfo; - const phoneNumberUtils = await getPhoneNumberUtils(); - if ("email" in input) { - contactInfo = input.email; - } else { - contactInfo = phoneNumberUtils.formatNumber( - input.phoneNumber, - config.signInUpFeature.defaultCountry || "", - phoneNumberUtils.numberFormat.E164 - ); - } - - // This contactMethod refers to the one that was used to deliver the login info - // This can be an important distinction in case both email and phone are allowed - const contactMethod: "EMAIL" | "PHONE" = "email" in input ? "EMAIL" : "PHONE"; - const additionalAttemptInfo = { - lastResend: Date.now(), - contactMethod, - contactInfo, - redirectToPath: getRedirectToPathFromURL(), - }; - - const res = await originalImpl.createCode({ - ...input, - userContext: { ...input.userContext, additionalAttemptInfo }, - }); - if (res.status === "OK") { - const loginAttemptInfo = (await originalImpl.getLoginAttemptInfo({ - userContext: input.userContext, - }))!; - dispatch({ type: "startLogin", loginAttemptInfo }); - } - return res; - }, - resendCode: async (input) => { - /** - * In this case we want the code that is calling resendCode in the - * UI to handle STGeneralError so we let this throw - */ - const res = await originalImpl.resendCode(input); - - if (res.status === "OK") { - const loginAttemptInfo = await originalImpl.getLoginAttemptInfo({ - userContext: input.userContext, - }); - - if (loginAttemptInfo !== undefined) { - const timestamp = Date.now(); - - await originalImpl.setLoginAttemptInfo({ - userContext: input.userContext, - attemptInfo: { - ...loginAttemptInfo, - lastResend: timestamp, - }, - }); - dispatch({ type: "resendCode", timestamp }); - } - } else if (res.status === "RESTART_FLOW_ERROR") { - await originalImpl.clearLoginAttemptInfo({ - userContext: input.userContext, - }); - - dispatch({ type: "restartFlow", error: "ERROR_SIGN_IN_UP_RESEND_RESTART_FLOW" }); - } - return res; - }, - - consumeCode: async (input) => { - // We need to call consume code while callingConsume, so we don't detect - // the session creation too early and go to successInAnotherTab too early - callingConsumeCodeRef.current = true; - - const res = await originalImpl.consumeCode(input); - - if (res.status === "RESTART_FLOW_ERROR") { - await originalImpl.clearLoginAttemptInfo({ - userContext: input.userContext, - }); - - dispatch({ type: "restartFlow", error: "ERROR_SIGN_IN_UP_CODE_CONSUME_RESTART_FLOW" }); - } else if (res.status === "SIGN_IN_UP_NOT_ALLOWED") { - await originalImpl.clearLoginAttemptInfo({ - userContext: input.userContext, - }); - - dispatch({ type: "restartFlow", error: res.reason }); - } else if (res.status === "OK") { - await originalImpl.clearLoginAttemptInfo({ - userContext: input.userContext, - }); - } - - callingConsumeCodeRef.current = false; - - return res; - }, - - clearLoginAttemptInfo: async (input) => { - await originalImpl.clearLoginAttemptInfo({ - userContext: input.userContext, - }); - clearErrorQueryParam(); - dispatch({ type: "restartFlow", error: undefined }); - }, - }; -} diff --git a/lib/ts/recipe/passwordless/recipe.tsx b/lib/ts/recipe/passwordless/recipe.tsx index 0f33eb395..7974b587d 100644 --- a/lib/ts/recipe/passwordless/recipe.tsx +++ b/lib/ts/recipe/passwordless/recipe.tsx @@ -18,14 +18,10 @@ */ import PasswordlessWebJS from "supertokens-web-js/recipe/passwordless"; -import NormalisedURLPath from "supertokens-web-js/utils/normalisedURLPath"; -import { PostSuperTokensInitCallbacks } from "supertokens-web-js/utils/postSuperTokensInitCallbacks"; -import { OTPIcon } from "../../components/assets/otpIcon"; import { SSR_ERROR } from "../../constants"; import { isTest } from "../../utils"; import AuthRecipe from "../authRecipe"; -import MultiFactorAuth from "../multifactorauth/recipe"; import { getFunctionOverrides } from "./functionOverrides"; import { normalisePasswordlessConfig } from "./utils"; @@ -73,28 +69,6 @@ export default class Passwordless extends AuthRecipe< ): RecipeInitResult { const normalisedConfig = normalisePasswordlessConfig(config); - PostSuperTokensInitCallbacks.addPostInitCallback(() => { - const mfa = MultiFactorAuth.getInstance(); - if (mfa !== undefined) { - mfa.addMFAFactors([ - { - id: "otp-phone", - name: "SMS based OTP", - description: "Get an OTP code on your phone to complete the authentication request", - path: new NormalisedURLPath("/check-auth/otp-phone"), - logo: OTPIcon, - }, - { - id: "otp-email", - name: "SMS based OTP", - description: "Get an OTP code on your email address to complete the authentication request", - path: new NormalisedURLPath("/check-auth/otp-email"), - logo: OTPIcon, - }, - ]); - } - }); - return { recipeID: Passwordless.RECIPE_ID, authReact: ( diff --git a/test/with-typescript/src/App.tsx b/test/with-typescript/src/App.tsx index 65b0a3a5d..5ee482b75 100644 --- a/test/with-typescript/src/App.tsx +++ b/test/with-typescript/src/App.tsx @@ -37,6 +37,7 @@ import { ThirdPartyEmailPasswordPreBuiltUI } from "../../../recipe/thirdpartyema import { EmailPasswordPreBuiltUI } from "../../../recipe/emailpassword/prebuiltui"; import { AccessDeniedScreen } from "../../../recipe/session/prebuiltui"; import EmailVerification from "../../../recipe/emailverification"; +import MultiFactorAuth from "../../../recipe/multifactorauth"; /* * This application is used with the purpose of illustrating Supertokens with typescript. @@ -1280,3 +1281,15 @@ Multitenancy.init({ }), }, }); + +MultiFactorAuth.init(); +MultiFactorAuth.init({ + firstFactors: ["emailpassword", "unknown"], + factorChooserScreen: { + style: "[data-supertokens~=container] { background-color: red; }", + }, + getFactorInfo: (factors) => [ + ...factors, + { id: "asfd", logo: () =>
A
, description: "test", name: "asdf", path: "/mfa/asdf" }, + ], +}); From 46ae327aa85a62658b08e9c419115d80ba229d96 Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Thu, 9 Nov 2023 22:43:07 +0100 Subject: [PATCH 21/35] chore: increase size limits --- package.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 6a54dd31b..6b7dc6478 100644 --- a/package.json +++ b/package.json @@ -119,15 +119,15 @@ "size-limit": [ { "path": "lib/build/index.js", - "limit": "15kb" + "limit": "17kb" }, { "path": "recipe/session/index.js", - "limit": "16kb" + "limit": "18kb" }, { "path": "recipe/session/prebuiltui.js", - "limit": "20kb" + "limit": "21kb" }, { "path": "recipe/thirdpartyemailpassword/index.js", @@ -155,27 +155,27 @@ }, { "path": "recipe/emailverification/prebuiltui.js", - "limit": "25kb" + "limit": "27kb" }, { "path": "recipe/thirdpartyemailpassword/prebuiltui.js", - "limit": "56kb" + "limit": "58kb" }, { "path": "recipe/thirdparty/prebuiltui.js", - "limit": "40kb" + "limit": "42kb" }, { "path": "recipe/emailpassword/prebuiltui.js", - "limit": "30kb" + "limit": "32kb" }, { "path": "recipe/passwordless/prebuiltui.js", - "limit": "107kb" + "limit": "110kb" }, { "path": "recipe/thirdpartypasswordless/prebuiltui.js", - "limit": "135kb" + "limit": "140kb" }, { "path": "recipe/multitenancy/index.js", From 150c9ad221ec88535c3a48335dfe5bd4617cf9cf Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Thu, 9 Nov 2023 23:11:52 +0100 Subject: [PATCH 22/35] test: add reset method to mfa recipe --- lib/build/multifactorauth-shared.js | 10 ++++++++++ lib/build/recipe/multifactorauth/recipe.d.ts | 1 + lib/ts/recipe/multifactorauth/recipe.tsx | 14 +++++++++++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/lib/build/multifactorauth-shared.js b/lib/build/multifactorauth-shared.js index b81459a84..23669ebb0 100644 --- a/lib/build/multifactorauth-shared.js +++ b/lib/build/multifactorauth-shared.js @@ -371,6 +371,16 @@ var MultiFactorAuth = /** @class */ (function (_super) { }); }); }; + /* + * Tests methods. + */ + MultiFactorAuth.reset = function () { + if (!genericComponentOverrideContext.isTest()) { + return; + } + MultiFactorAuth.instance = undefined; + return; + }; var _a; _a = MultiFactorAuth; MultiFactorAuth.RECIPE_ID = "multifactorauth"; diff --git a/lib/build/recipe/multifactorauth/recipe.d.ts b/lib/build/recipe/multifactorauth/recipe.d.ts index 55556b1dd..14b5a0bba 100644 --- a/lib/build/recipe/multifactorauth/recipe.d.ts +++ b/lib/build/recipe/multifactorauth/recipe.d.ts @@ -37,4 +37,5 @@ export default class MultiFactorAuth extends RecipeModule< getSecondaryFactors(): SecondaryFactorRedirectionInfo[]; redirectToFactor(factorId: string, redirectBack?: boolean, history?: any): Promise; redirectToFactorChooser(redirectBack?: boolean, history?: any): Promise; + static reset(): void; } diff --git a/lib/ts/recipe/multifactorauth/recipe.tsx b/lib/ts/recipe/multifactorauth/recipe.tsx index 5caab85c9..d1f402779 100644 --- a/lib/ts/recipe/multifactorauth/recipe.tsx +++ b/lib/ts/recipe/multifactorauth/recipe.tsx @@ -25,7 +25,7 @@ import { SessionClaimValidatorStore } from "supertokens-web-js/utils/sessionClai import { SSR_ERROR } from "../../constants"; import SuperTokens from "../../superTokens"; -import { getCurrentNormalisedUrlPath, getRedirectToPathFromURL } from "../../utils"; +import { getCurrentNormalisedUrlPath, getRedirectToPathFromURL, isTest } from "../../utils"; import RecipeModule from "../recipeModule"; import { DEFAULT_FACTOR_CHOOSER_PATH } from "./constants"; @@ -193,4 +193,16 @@ export default class MultiFactorAuth extends RecipeModule< return SuperTokens.getInstanceOrThrow().redirectToUrl(url, history); } + + /* + * Tests methods. + */ + static reset(): void { + if (!isTest()) { + return; + } + + MultiFactorAuth.instance = undefined; + return; + } } From 907930e91173c186878e4c06f690ed07037ad82b Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Mon, 13 Nov 2023 09:02:45 +0100 Subject: [PATCH 23/35] feat: make sure firstFactor conflicts hit user error boundaries --- lib/build/components/errorBoundary.d.ts | 12 --- lib/build/index2.js | 89 +++++++------------ lib/build/passwordless-shared2.js | 41 +++++++++ lib/build/passwordless-shared3.js | 33 +------ lib/build/recipe/multifactorauth/index.d.ts | 2 +- lib/build/recipe/passwordless/utils.d.ts | 5 ++ lib/ts/components/errorBoundary.tsx | 49 ---------- lib/ts/components/featureWrapper.tsx | 18 ++-- .../dynamicLoginMethodsSpinner/index.tsx | 9 +- .../components/themes/signInUp/index.tsx | 30 +------ lib/ts/recipe/passwordless/utils.ts | 44 +++++++++ 11 files changed, 138 insertions(+), 194 deletions(-) delete mode 100644 lib/build/components/errorBoundary.d.ts delete mode 100644 lib/ts/components/errorBoundary.tsx diff --git a/lib/build/components/errorBoundary.d.ts b/lib/build/components/errorBoundary.d.ts deleted file mode 100644 index 2b672d624..000000000 --- a/lib/build/components/errorBoundary.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import React from "react"; -import type { ErrorInfo, ReactNode } from "react"; -declare type ErrorBoundaryState = { - hasError: boolean; -}; -export default class ErrorBoundary extends React.Component { - constructor(props: { hasError: boolean }); - static getDerivedStateFromError(): ErrorBoundaryState; - componentDidCatch(error: Error, errorInfo: ErrorInfo): void; - render(): JSX.Element | ReactNode | undefined; -} -export {}; diff --git a/lib/build/index2.js b/lib/build/index2.js index 97fe6705f..1cf728995 100644 --- a/lib/build/index2.js +++ b/lib/build/index2.js @@ -19,31 +19,6 @@ var NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath var ComponentOverrideContext = React__default.default.createContext("IS_DEFAULT"); -/* - * Component. - */ -var ErrorBoundary = /** @class */ (function (_super) { - genericComponentOverrideContext.__extends(ErrorBoundary, _super); - function ErrorBoundary(props) { - var _this = _super.call(this, props) || this; - _this.state = { hasError: false }; - return _this; - } - ErrorBoundary.getDerivedStateFromError = function () { - return { hasError: true }; - }; - ErrorBoundary.prototype.componentDidCatch = function (error, errorInfo) { - console.info(error, errorInfo); - }; - ErrorBoundary.prototype.render = function () { - if (this.state.hasError) { - return jsxRuntime.jsx(React.Fragment, {}); - } - return this.props.children; - }; - return ErrorBoundary; -})(React__default.default.Component); - var dynamicLoginMethodsContext = React__default.default.createContext(undefined); var useDynamicLoginMethods = function () { var value = React__default.default.useContext(dynamicLoginMethodsContext); @@ -117,31 +92,29 @@ function FeatureWrapper(_a) { genericComponentOverrideContext.__assign( { value: loadedDynamicLoginMethods }, { - children: jsxRuntime.jsx(ErrorBoundary, { - children: jsxRuntime.jsx( - translationContext.TranslationContextProvider, - genericComponentOverrideContext.__assign( - { - defaultLanguage: st.languageTranslations.defaultLanguage, - defaultStore: genericComponentOverrideContext.mergeObjects( - defaultStore, - st.languageTranslations.userTranslationStore - ), - translationControlEventSource: st.languageTranslations.translationEventSource, - userTranslationFunc: st.languageTranslations.userTranslationFunc, - }, - { - children: jsxRuntime.jsx( - WithOrWithoutShadowDom, - genericComponentOverrideContext.__assign( - { useShadowDom: useShadowDom }, - { children: children } - ) - ), - } - ) - ), - }), + children: jsxRuntime.jsx( + translationContext.TranslationContextProvider, + genericComponentOverrideContext.__assign( + { + defaultLanguage: st.languageTranslations.defaultLanguage, + defaultStore: genericComponentOverrideContext.mergeObjects( + defaultStore, + st.languageTranslations.userTranslationStore + ), + translationControlEventSource: st.languageTranslations.translationEventSource, + userTranslationFunc: st.languageTranslations.userTranslationFunc, + }, + { + children: jsxRuntime.jsx( + WithOrWithoutShadowDom, + genericComponentOverrideContext.__assign( + { useShadowDom: useShadowDom }, + { children: children } + ) + ), + } + ) + ), } ) ); @@ -373,15 +346,13 @@ var DynamicLoginMethodsSpinner = function () { genericComponentOverrideContext.__assign( { value: recipeComponentOverrides }, { - children: jsxRuntime.jsx(ErrorBoundary, { - children: jsxRuntime.jsx( - WithOrWithoutShadowDom, - genericComponentOverrideContext.__assign( - { useShadowDom: recipe.config.useShadowDom }, - { children: jsxRuntime.jsx(DynamicLoginMethodsSpinnerTheme, { config: recipe.config }) } - ) - ), - }), + children: jsxRuntime.jsx( + WithOrWithoutShadowDom, + genericComponentOverrideContext.__assign( + { useShadowDom: recipe.config.useShadowDom }, + { children: jsxRuntime.jsx(DynamicLoginMethodsSpinnerTheme, { config: recipe.config }) } + ) + ), } ) ); diff --git a/lib/build/passwordless-shared2.js b/lib/build/passwordless-shared2.js index 72ed3f849..187fd424e 100644 --- a/lib/build/passwordless-shared2.js +++ b/lib/build/passwordless-shared2.js @@ -509,6 +509,46 @@ function normalisePasswordlessBaseConfig(config) { style: style, }); } +function getEnabledContactMethods(contactMethod, currentDynamicLoginMethods) { + var _a; + var enabledContactMethods = contactMethod === "EMAIL_OR_PHONE" ? ["EMAIL", "PHONE"] : [contactMethod]; + var firstFactors; + if (currentDynamicLoginMethods.loaded && currentDynamicLoginMethods.loginMethods.firstFactors) { + firstFactors = currentDynamicLoginMethods.loginMethods.firstFactors; + } else { + firstFactors = + (_a = recipe.MultiFactorAuth.getInstance()) === null || _a === void 0 ? void 0 : _a.config.firstFactors; + } + if (firstFactors !== undefined) { + if (enabledContactMethods.includes("PHONE")) { + if (!firstFactors.includes("otp-phone") && !firstFactors.includes("link-phone")) { + enabledContactMethods = enabledContactMethods.filter(function (c) { + return c !== "PHONE"; + }); + } + } else { + if (firstFactors.includes("otp-phone") || firstFactors.includes("link-phone")) { + throw new Error("The enabled contact method is not a superset of the requested first factors"); + } + } + if (enabledContactMethods.includes("EMAIL")) { + if (!firstFactors.includes("otp-email") && !firstFactors.includes("link-email")) { + enabledContactMethods = enabledContactMethods.filter(function (c) { + return c !== "EMAIL"; + }); + } + } else { + if (firstFactors.includes("otp-email") || firstFactors.includes("link-email")) { + throw new Error("The enabled contact method is not a superset of the requested first factors"); + } + } + } + if (enabledContactMethods.length === 0) { + // It should never get here, but as a sanity check this is fine + throw new Error("The enabled contact method is not a superset of the requested first factors"); + } + return enabledContactMethods; +} /* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. * @@ -623,6 +663,7 @@ var Passwordless = /** @class */ (function (_super) { exports.Passwordless = Passwordless; exports.defaultEmailValidator = defaultEmailValidator; exports.defaultValidate = defaultValidate; +exports.getEnabledContactMethods = getEnabledContactMethods; exports.getPhoneNumberUtils = getPhoneNumberUtils; exports.normalisePasswordlessConfig = normalisePasswordlessConfig; exports.passwordlessFactors = passwordlessFactors; diff --git a/lib/build/passwordless-shared3.js b/lib/build/passwordless-shared3.js index a6b51bc42..1619d8784 100644 --- a/lib/build/passwordless-shared3.js +++ b/lib/build/passwordless-shared3.js @@ -4933,35 +4933,10 @@ function SignInUpThemeWrapper(props) { ); } function getActiveScreen(props, currentDynamicLoginMethods) { - var _a; - var contactMethod = props.config.contactMethod; - var enabledContactMethods = contactMethod === "EMAIL_OR_PHONE" ? ["EMAIL", "PHONE"] : [contactMethod]; - var firstFactors; - if (currentDynamicLoginMethods.loaded && currentDynamicLoginMethods.loginMethods.firstFactors) { - firstFactors = currentDynamicLoginMethods.loginMethods.firstFactors; - } else { - firstFactors = - (_a = recipe$2.MultiFactorAuth.getInstance()) === null || _a === void 0 ? void 0 : _a.config.firstFactors; - } - if (firstFactors !== undefined) { - if (enabledContactMethods.includes("PHONE")) { - if (!firstFactors.includes("otp-phone") && !firstFactors.includes("link-phone")) { - enabledContactMethods = enabledContactMethods.filter(function (c) { - return c !== "PHONE"; - }); - } - } - if (enabledContactMethods.includes("EMAIL")) { - if (!firstFactors.includes("otp-email") && !firstFactors.includes("link-email")) { - enabledContactMethods = enabledContactMethods.filter(function (c) { - return c !== "EMAIL"; - }); - } - } - } - if (enabledContactMethods.length === 0) { - throw new Error("No overlap between first factors and enabled contact methods"); // redirect to access denied? - } + var enabledContactMethods = recipe$1.getEnabledContactMethods( + props.config.contactMethod, + currentDynamicLoginMethods + ); if (props.featureState.successInAnotherTab) { return exports.SignInUpScreens.CloseTab; } else if (props.featureState.loginAttemptInfo && props.featureState.loginAttemptInfo.flowType === "MAGIC_LINK") { diff --git a/lib/build/recipe/multifactorauth/index.d.ts b/lib/build/recipe/multifactorauth/index.d.ts index 02c7496be..c04d19aaa 100644 --- a/lib/build/recipe/multifactorauth/index.d.ts +++ b/lib/build/recipe/multifactorauth/index.d.ts @@ -11,7 +11,7 @@ export default class Wrapper { ): import("../../types").RecipeInitResult< GetRedirectionURLContext, "GET_MFA_INFO", - OnHandleEventContext, + never, import("./types").NormalisedConfig >; static getMFAInfo(input?: { userContext?: any; options?: RecipeFunctionOptions }): Promise<{ diff --git a/lib/build/recipe/passwordless/utils.d.ts b/lib/build/recipe/passwordless/utils.d.ts index a5b28e889..c6762d875 100644 --- a/lib/build/recipe/passwordless/utils.d.ts +++ b/lib/build/recipe/passwordless/utils.d.ts @@ -1,2 +1,7 @@ import type { Config, NormalisedConfig } from "./types"; +import type { DynamicLoginMethodsContextValue } from "../multitenancy/dynamicLoginMethodsContext"; export declare function normalisePasswordlessConfig(config: Config): NormalisedConfig; +export declare function getEnabledContactMethods( + contactMethod: "PHONE" | "EMAIL" | "EMAIL_OR_PHONE", + currentDynamicLoginMethods: DynamicLoginMethodsContextValue +): string[]; diff --git a/lib/ts/components/errorBoundary.tsx b/lib/ts/components/errorBoundary.tsx deleted file mode 100644 index 0cab7dbbf..000000000 --- a/lib/ts/components/errorBoundary.tsx +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved. - * - * This software is licensed under the Apache License, Version 2.0 (the - * "License") as published by the Apache Software Foundation. - * - * You may not use this file except in compliance with the License. You may - * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ - -/* - * Imports. - */ -import React from "react"; -import { Fragment } from "react"; - -import type { ErrorInfo, ReactNode } from "react"; - -type ErrorBoundaryState = { hasError: boolean }; -/* - * Component. - */ -export default class ErrorBoundary extends React.Component { - constructor(props: { hasError: boolean }) { - super(props); - this.state = { hasError: false }; - } - - static getDerivedStateFromError(): ErrorBoundaryState { - return { hasError: true }; - } - - componentDidCatch(error: Error, errorInfo: ErrorInfo): void { - console.info(error, errorInfo); - } - - render(): JSX.Element | ReactNode | undefined { - if (this.state.hasError) { - return ; - } - - return this.props.children; - } -} diff --git a/lib/ts/components/featureWrapper.tsx b/lib/ts/components/featureWrapper.tsx index 6a4366767..dea33ce57 100644 --- a/lib/ts/components/featureWrapper.tsx +++ b/lib/ts/components/featureWrapper.tsx @@ -29,8 +29,6 @@ import { TranslationContextProvider } from "../translation/translationContext"; import { useUserContext } from "../usercontext"; import { mergeObjects } from "../utils"; -import ErrorBoundary from "./errorBoundary"; - import type { GetLoginMethodsResponseNormalized } from "../recipe/multitenancy/types"; import type { TranslationStore } from "../translation/translationHelpers"; import type { PropsWithChildren } from "react"; @@ -74,15 +72,13 @@ export default function FeatureWrapper({ return ( - - - {children} - - + + {children} + ); } diff --git a/lib/ts/recipe/multitenancy/components/features/dynamicLoginMethodsSpinner/index.tsx b/lib/ts/recipe/multitenancy/components/features/dynamicLoginMethodsSpinner/index.tsx index 2680f8c70..b801a5328 100644 --- a/lib/ts/recipe/multitenancy/components/features/dynamicLoginMethodsSpinner/index.tsx +++ b/lib/ts/recipe/multitenancy/components/features/dynamicLoginMethodsSpinner/index.tsx @@ -13,7 +13,6 @@ * under the License. */ import { ComponentOverrideContext } from "../../../../../components/componentOverride/componentOverrideContext"; -import ErrorBoundary from "../../../../../components/errorBoundary"; import { WithOrWithoutShadowDom } from "../../../../../components/featureWrapper"; import { useRecipeComponentOverrideContext } from "../../../componentOverrideContext"; import Multitenancy from "../../../recipe"; @@ -28,11 +27,9 @@ const DynamicLoginMethodsSpinner: React.FC = () => { return ( - - - - - + + + ); }; diff --git a/lib/ts/recipe/passwordless/components/themes/signInUp/index.tsx b/lib/ts/recipe/passwordless/components/themes/signInUp/index.tsx index eeb94226c..b2ddd22c8 100644 --- a/lib/ts/recipe/passwordless/components/themes/signInUp/index.tsx +++ b/lib/ts/recipe/passwordless/components/themes/signInUp/index.tsx @@ -21,8 +21,8 @@ import { SuperTokensBranding } from "../../../../../components/SuperTokensBrandi import { hasFontDefined } from "../../../../../styles/styles"; import UserContextWrapper from "../../../../../usercontext/userContextWrapper"; import GeneralError from "../../../../emailpassword/components/library/generalError"; -import MultiFactorAuth from "../../../../multifactorauth/recipe"; import { useDynamicLoginMethods } from "../../../../multitenancy/dynamicLoginMethodsContext"; +import { getEnabledContactMethods } from "../../../utils"; import { ThemeBase } from "../themeBase"; import { CloseTabScreen } from "./closeTabScreen"; @@ -137,32 +137,7 @@ export function getActiveScreen( props: Pick, currentDynamicLoginMethods: DynamicLoginMethodsContextValue ) { - const contactMethod = props.config.contactMethod; - let enabledContactMethods = contactMethod === "EMAIL_OR_PHONE" ? ["EMAIL", "PHONE"] : [contactMethod]; - - let firstFactors; - if (currentDynamicLoginMethods.loaded && currentDynamicLoginMethods.loginMethods.firstFactors) { - firstFactors = currentDynamicLoginMethods.loginMethods.firstFactors; - } else { - firstFactors = MultiFactorAuth.getInstance()?.config.firstFactors; - } - - if (firstFactors !== undefined) { - if (enabledContactMethods.includes("PHONE")) { - if (!firstFactors.includes("otp-phone") && !firstFactors.includes("link-phone")) { - enabledContactMethods = enabledContactMethods.filter((c) => c !== "PHONE"); - } - } - if (enabledContactMethods.includes("EMAIL")) { - if (!firstFactors.includes("otp-email") && !firstFactors.includes("link-email")) { - enabledContactMethods = enabledContactMethods.filter((c) => c !== "EMAIL"); - } - } - } - - if (enabledContactMethods.length === 0) { - throw new Error("No overlap between first factors and enabled contact methods"); // redirect to access denied? - } + const enabledContactMethods = getEnabledContactMethods(props.config.contactMethod, currentDynamicLoginMethods); if (props.featureState.successInAnotherTab) { return SignInUpScreens.CloseTab; @@ -177,5 +152,6 @@ export function getActiveScreen( } else if (enabledContactMethods[0] === "PHONE") { return SignInUpScreens.PhoneForm; } + throw new Error("Couldn't choose active screen; Should never happen"); } diff --git a/lib/ts/recipe/passwordless/utils.ts b/lib/ts/recipe/passwordless/utils.ts index cc5d40eeb..8906e7af6 100644 --- a/lib/ts/recipe/passwordless/utils.ts +++ b/lib/ts/recipe/passwordless/utils.ts @@ -14,6 +14,7 @@ */ import { normaliseAuthRecipe } from "../authRecipe/utils"; +import MultiFactorAuth from "../multifactorauth/recipe"; import { defaultPhoneNumberValidator, @@ -25,6 +26,7 @@ import { import type { Config, NormalisedConfig, SignInUpFeatureConfigInput } from "./types"; import type { FeatureBaseConfig, NormalisedBaseConfig } from "../../types"; +import type { DynamicLoginMethodsContextValue } from "../multitenancy/dynamicLoginMethodsContext"; import type { RecipeInterface } from "supertokens-web-js/recipe/passwordless"; export function normalisePasswordlessConfig(config: Config): NormalisedConfig { @@ -137,3 +139,45 @@ function normalisePasswordlessBaseConfig(config?: T & FeatureBaseConfig): T & style, }; } + +export function getEnabledContactMethods( + contactMethod: "PHONE" | "EMAIL" | "EMAIL_OR_PHONE", + currentDynamicLoginMethods: DynamicLoginMethodsContextValue +) { + let enabledContactMethods = contactMethod === "EMAIL_OR_PHONE" ? ["EMAIL", "PHONE"] : [contactMethod]; + + let firstFactors; + if (currentDynamicLoginMethods.loaded && currentDynamicLoginMethods.loginMethods.firstFactors) { + firstFactors = currentDynamicLoginMethods.loginMethods.firstFactors; + } else { + firstFactors = MultiFactorAuth.getInstance()?.config.firstFactors; + } + + if (firstFactors !== undefined) { + if (enabledContactMethods.includes("PHONE")) { + if (!firstFactors.includes("otp-phone") && !firstFactors.includes("link-phone")) { + enabledContactMethods = enabledContactMethods.filter((c) => c !== "PHONE"); + } + } else { + if (firstFactors.includes("otp-phone") || firstFactors.includes("link-phone")) { + throw new Error("The enabled contact method is not a superset of the requested first factors"); + } + } + + if (enabledContactMethods.includes("EMAIL")) { + if (!firstFactors.includes("otp-email") && !firstFactors.includes("link-email")) { + enabledContactMethods = enabledContactMethods.filter((c) => c !== "EMAIL"); + } + } else { + if (firstFactors.includes("otp-email") || firstFactors.includes("link-email")) { + throw new Error("The enabled contact method is not a superset of the requested first factors"); + } + } + } + + if (enabledContactMethods.length === 0) { + // It should never get here, but as a sanity check this is fine + throw new Error("The enabled contact method is not a superset of the requested first factors"); + } + return enabledContactMethods; +} From f84d9b8c6ff44a46cfc7395d7d0ed365db86bc69 Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Wed, 15 Nov 2023 23:54:41 +0100 Subject: [PATCH 24/35] feat: update design and fix font-weight issues --- lib/build/emailverification-shared2.js | 2 +- lib/build/index2.js | 4 +-- lib/build/multifactorauthprebuiltui.js | 10 +++---- lib/build/passwordless-shared3.js | 4 +-- lib/build/sessionprebuiltui.js | 8 ++--- lib/build/thirdparty-shared2.js | 4 +-- .../thirdpartyemailpasswordprebuiltui.js | 4 +-- lib/build/thirdpartypasswordlessprebuiltui.js | 4 +-- .../components/themes/factorChooser/index.tsx | 2 +- .../components/themes/styles.css | 29 ++++++++++++------- .../components/themes/themeBase.tsx | 2 +- .../components/themes/translations.ts | 4 +-- .../components/themes/themeBase.tsx | 2 +- .../components/themes/themeBase.tsx | 2 +- .../themes/accessDeniedScreenTheme/index.tsx | 4 +-- .../session/components/themes/styles.css | 20 ++++++++----- .../session/components/themes/themeBase.tsx | 2 +- .../components/themes/themeBase.tsx | 2 +- .../components/themes/themeBase.tsx | 2 +- .../components/themes/themeBase.tsx | 2 +- lib/ts/styles/styles.css | 12 ++++++-- 21 files changed, 72 insertions(+), 53 deletions(-) diff --git a/lib/build/emailverification-shared2.js b/lib/build/emailverification-shared2.js index 53e262aae..74b25374b 100644 --- a/lib/build/emailverification-shared2.js +++ b/lib/build/emailverification-shared2.js @@ -6,7 +6,7 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext var translations = require("./translations.js"); var styles = - '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n\n[data-supertokens~="withBackButton"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n'; + '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 400;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 600;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n font-weight: 400;\n margin-bottom: 21px;\n}\n\n[data-supertokens~="headerSubtitle"][data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n font-family: "Rubik", sans-serif;\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n font-family: "Rubik", sans-serif;\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n\n[data-supertokens~="withBackButton"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n'; var ThemeBase = function (_a) { var children = _a.children, diff --git a/lib/build/index2.js b/lib/build/index2.js index c15b8d336..a4b33b1cb 100644 --- a/lib/build/index2.js +++ b/lib/build/index2.js @@ -303,7 +303,7 @@ var withOverride = function (overrideKey, DefaultComponent) { }; var styles = - '[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="delayedRender"] {\n -webkit-animation-duration: 0.1s;\n animation-duration: 0.1s;\n -webkit-animation-name: animate-fade;\n animation-name: animate-fade;\n -webkit-animation-delay: 0.2s;\n animation-delay: 0.2s;\n -webkit-animation-fill-mode: backwards;\n animation-fill-mode: backwards;\n}\n@-webkit-keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n'; + '[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 400;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 600;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n font-weight: 400;\n margin-bottom: 21px;\n}\n[data-supertokens~="headerSubtitle"][data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n font-family: "Rubik", sans-serif;\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n font-family: "Rubik", sans-serif;\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="delayedRender"] {\n -webkit-animation-duration: 0.1s;\n animation-duration: 0.1s;\n -webkit-animation-name: animate-fade;\n animation-name: animate-fade;\n -webkit-animation-delay: 0.2s;\n animation-delay: 0.2s;\n -webkit-animation-fill-mode: backwards;\n animation-fill-mode: backwards;\n}\n@-webkit-keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n'; var ThemeBase = function (_a) { var children = _a.children, @@ -314,7 +314,7 @@ var ThemeBase = function (_a) { children, loadDefaultFont && jsxRuntime.jsx("link", { - href: "//fonts.googleapis.com/css?family=Rubik:wght@300;400;600;500;700", + href: "//fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600;700", rel: "stylesheet", type: "text/css", }), diff --git a/lib/build/multifactorauthprebuiltui.js b/lib/build/multifactorauthprebuiltui.js index 2cb2a2c3c..f91cdf660 100644 --- a/lib/build/multifactorauthprebuiltui.js +++ b/lib/build/multifactorauthprebuiltui.js @@ -64,7 +64,7 @@ var NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath var React__namespace = /*#__PURE__*/ _interopNamespace(React); var styles = - '[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="container"] {\n padding-top: 24px;\n}\n[data-supertokens~="row"] {\n padding-top: 16px;\n padding-bottom: 8px;\n}\n[data-supertokens~="factorChooserList"] {\n padding-top: 4px;\n}\n[data-supertokens~="factorChooserOption"] {\n display: flex;\n flex-direction: row;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n padding: 16px;\n cursor: pointer;\n margin-top: 12px;\n}\n[data-supertokens~="factorChooserOption"]:hover {\n border: 1px solid rgb(var(--palette-textLink));\n}\n[data-supertokens~="factorOptionText"] {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n align-items: start;\n text-align: left;\n}\n[data-supertokens~="factorLogo"] {\n flex-grow: 0;\n min-width: 30px;\n text-align: left;\n margin-top: 6px;\n}\n[data-supertokens~="factorName"] {\n color: rgb(var(--palette-textPrimary));\n font-size: var(--font-size-1);\n margin: 4px;\n}\n[data-supertokens~="factorChooserOption"]:hover [data-supertokens~="factorName"] {\n color: rgb(var(--palette-textLink));\n}\n[data-supertokens~="factorDescription"] {\n color: rgb(var(--palette-textSecondary));\n font-size: var(--font-size-0);\n margin: 4px;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-bottom: 32px;\n text-align: right;\n}\n'; + '[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 400;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 600;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n font-weight: 400;\n margin-bottom: 21px;\n}\n[data-supertokens~="headerSubtitle"][data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n font-family: "Rubik", sans-serif;\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n font-family: "Rubik", sans-serif;\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="mfa"][data-supertokens~="container"] {\n padding-top: 34px;\n}\n[data-supertokens~="mfa"] [data-supertokens~="row"] {\n padding-top: 6px;\n padding-bottom: 6px;\n}\n[data-supertokens~="mfa"] [data-supertokens~="headerTitle"] {\n font-size: var(--font-size-3);\n font-weight: 600;\n line-height: 30px;\n}\n[data-supertokens~="mfa"] [data-supertokens~="factorChooserList"] {\n margin-bottom: 12px;\n}\n[data-supertokens~="factorChooserOption"] {\n display: flex;\n flex-direction: row;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n padding: 20px 16px;\n cursor: pointer;\n margin-top: 12px;\n}\n[data-supertokens~="factorChooserOption"]:hover {\n border: 1px solid rgb(var(--palette-textLink));\n}\n[data-supertokens~="factorOptionText"] {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n align-items: start;\n text-align: left;\n}\n[data-supertokens~="factorLogo"] {\n flex-grow: 0;\n min-width: 30px;\n text-align: left;\n margin-top: 6px;\n}\n[data-supertokens~="factorName"] {\n color: rgb(var(--palette-textPrimary));\n font-size: var(--font-size-1);\n font-weight: 500;\n margin: 4px;\n}\n[data-supertokens~="factorChooserOption"]:hover [data-supertokens~="factorName"] {\n color: rgb(var(--palette-textLink));\n}\n[data-supertokens~="factorDescription"] {\n color: rgb(var(--palette-textGray));\n font-size: var(--font-size-0);\n margin: 4px;\n}\n[data-supertokens~="mfa"] [data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-bottom: 26px;\n text-align: right;\n}\n'; var ThemeBase = function (_a) { var children = _a.children, @@ -75,7 +75,7 @@ var ThemeBase = function (_a) { children, loadDefaultFont && jsxRuntime.jsx("link", { - href: "//fonts.googleapis.com/css?family=Rubik:wght@300;400;600;500;700", + href: "//fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600;700", rel: "stylesheet", type: "text/css", }), @@ -237,7 +237,7 @@ function FactorChooserTheme(props) { return jsxRuntime.jsxs( "div", genericComponentOverrideContext.__assign( - { "data-supertokens": "container" }, + { "data-supertokens": "container mfa" }, { children: [ jsxRuntime.jsx(FactorChooserHeader, { @@ -287,8 +287,8 @@ var defaultTranslationsMultiFactorAuth = { en: genericComponentOverrideContext.__assign( genericComponentOverrideContext.__assign({}, translations.defaultTranslationsCommon.en), { - MULTI_FACTOR_CHOOSER_HEADER_TITLE: "Please select a second factor", - MULTI_FACTOR_AUTH_LOGOUT: "Logout", + MULTI_FACTOR_CHOOSER_HEADER_TITLE: "Please select another factor", + MULTI_FACTOR_AUTH_LOGOUT: "Log out", MFA_NO_AVAILABLE_OPTIONS: "You have no available secondary factors.", MFA_NO_AVAILABLE_OPTIONS_LOGIN: "You have no available secondary factors and cannot complete the sign-in process. Please contact support.", diff --git a/lib/build/passwordless-shared3.js b/lib/build/passwordless-shared3.js index 9ab228bb6..73c5aa860 100644 --- a/lib/build/passwordless-shared3.js +++ b/lib/build/passwordless-shared3.js @@ -56,7 +56,7 @@ var React__namespace = /*#__PURE__*/ _interopNamespace(React); var STGeneralError__default = /*#__PURE__*/ _interopDefault(STGeneralError); var styles = - '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n\n[data-supertokens~="withBackButton"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n\n[data-supertokens~="generalSuccess"] {\n margin-bottom: 20px;\n -webkit-animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n}\n\n[data-supertokens~="codeInputLabelWrapper"] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="headerSubtitle"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n[data-supertokens~="sendCodeText"] {\n margin-top: 15px;\n margin-bottom: 20px;\n}\n\n[data-supertokens~="sendCodeText"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n[data-supertokens~="resendCodeBtn"] {\n width: auto;\n margin-top: 0;\n line-height: 24px;\n}\n\n[data-supertokens~="resendCodeBtn"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="resendCodeBtn"]:disabled {\n color: rgb(var(--palette-textPrimary));\n cursor: default;\n text-decoration: none;\n}\n\n[data-supertokens~="phoneInputLibRoot"] {\n display: flex;\n align-items: center;\n}\n\n[data-supertokens~="phoneInputWrapper"] {\n display: flex;\n align-items: center;\n}\n\n[data-supertokens~="phoneInputWrapper"] .iti [data-supertokens~="input"] {\n padding-left: 15px;\n}\n\n[data-supertokens~="phoneInputWrapper"] .iti {\n flex: 1 1;\n min-width: 0;\n width: 100%;\n background: transparent;\n border: none;\n color: inherit;\n outline: none;\n}\n\n[data-supertokens~="continueButtonWrapper"] {\n margin-top: 10px;\n margin-bottom: 30px;\n}\n\n.iti__country-list {\n border: 0;\n top: 40px;\n width: min(72.2vw, 320px);\n border-radius: 6;\n box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.16);\n}\n\n.iti__country {\n display: flex;\n align-items: center;\n height: 34px;\n cursor: pointer;\n\n padding: 0 8px;\n}\n\n.iti__country-name {\n color: var(--palette-textLabel);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: "0 16px";\n}\n'; + '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 400;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 600;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n font-weight: 400;\n margin-bottom: 21px;\n}\n\n[data-supertokens~="headerSubtitle"][data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n font-family: "Rubik", sans-serif;\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n font-family: "Rubik", sans-serif;\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n\n[data-supertokens~="withBackButton"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n\n[data-supertokens~="generalSuccess"] {\n margin-bottom: 20px;\n -webkit-animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n}\n\n[data-supertokens~="codeInputLabelWrapper"] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="headerSubtitle"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n[data-supertokens~="sendCodeText"] {\n margin-top: 15px;\n margin-bottom: 20px;\n}\n\n[data-supertokens~="sendCodeText"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n[data-supertokens~="resendCodeBtn"] {\n width: auto;\n margin-top: 0;\n line-height: 24px;\n}\n\n[data-supertokens~="resendCodeBtn"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="resendCodeBtn"]:disabled {\n color: rgb(var(--palette-textPrimary));\n cursor: default;\n text-decoration: none;\n}\n\n[data-supertokens~="phoneInputLibRoot"] {\n display: flex;\n align-items: center;\n}\n\n[data-supertokens~="phoneInputWrapper"] {\n display: flex;\n align-items: center;\n}\n\n[data-supertokens~="phoneInputWrapper"] .iti [data-supertokens~="input"] {\n padding-left: 15px;\n}\n\n[data-supertokens~="phoneInputWrapper"] .iti {\n flex: 1 1;\n min-width: 0;\n width: 100%;\n background: transparent;\n border: none;\n color: inherit;\n outline: none;\n}\n\n[data-supertokens~="continueButtonWrapper"] {\n margin-top: 10px;\n margin-bottom: 30px;\n}\n\n.iti__country-list {\n border: 0;\n top: 40px;\n width: min(72.2vw, 320px);\n border-radius: 6;\n box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.16);\n}\n\n.iti__country {\n display: flex;\n align-items: center;\n height: 34px;\n cursor: pointer;\n\n padding: 0 8px;\n}\n\n.iti__country-name {\n color: var(--palette-textLabel);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: "0 16px";\n}\n'; var ThemeBase = function (_a) { var children = _a.children, @@ -67,7 +67,7 @@ var ThemeBase = function (_a) { children, loadDefaultFont && jsxRuntime.jsx("link", { - href: "//fonts.googleapis.com/css?family=Rubik:wght@300;400;600;500;700", + href: "//fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600;700", rel: "stylesheet", type: "text/css", }), diff --git a/lib/build/sessionprebuiltui.js b/lib/build/sessionprebuiltui.js index ed1aac330..e4cd239bf 100644 --- a/lib/build/sessionprebuiltui.js +++ b/lib/build/sessionprebuiltui.js @@ -82,7 +82,7 @@ function LogoutButton(_a) { } var styles = - '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n/* Override */\n\n[data-supertokens~="row"] {\n padding-top: 32px;\n padding-bottom: 32px;\n}\n\n[data-supertokens~="divider"] {\n padding: 0;\n margin: 24px 0;\n}\n\n[data-supertokens~="headerTitle"] {\n padding-top: 24px;\n font-style: normal;\n font-weight: 700;\n font-size: 20px;\n line-height: 30px;\n}\n\n/* Override end */\n\n[data-supertokens~="center"] {\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n flex: 1 1 auto;\n}\n\n[data-supertokens~="buttonsGroup"] {\n margin-top: 24px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n\n[data-supertokens~="buttonBase"] {\n font-size: var(--font-size-1);\n line-height: 21px;\n font-weight: 500;\n background: transparent;\n outline: none;\n border: none;\n cursor: pointer;\n}\n\n[data-supertokens~="backButton"] {\n color: rgb(var(--palette-textLink));\n}\n\n[data-supertokens~="logoutButton"] {\n display: flex;\n align-items: center;\n gap: 6px;\n color: rgb(var(--palette-textGray));\n}\n'; + '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 400;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 600;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n font-weight: 400;\n margin-bottom: 21px;\n}\n\n[data-supertokens~="headerSubtitle"][data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n font-family: "Rubik", sans-serif;\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n font-family: "Rubik", sans-serif;\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n/* Override */\n\n[data-supertokens~="accessDenied"] [data-supertokens~="row"] {\n padding-bottom: 24px;\n}\n\n[data-supertokens~="accessDenied"] [data-supertokens~="divider"] {\n padding: 0;\n margin: 34px 0 18px 0;\n}\n\n[data-supertokens~="accessDenied"] [data-supertokens~="headerTitle"] {\n margin: 10px 0 0 0;\n font-style: normal;\n font-weight: 700;\n font-size: 20px;\n line-height: 30px;\n}\n\n/* Override end */\n\n[data-supertokens~="center"] {\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n flex: 1 1 auto;\n}\n\n[data-supertokens~="buttonsGroup"] {\n margin-top: 34px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n\n[data-supertokens~="buttonBase"] {\n font-family: "Rubik", sans-serif;\n font-size: var(--font-size-1);\n line-height: 21px;\n font-weight: 500;\n background: transparent;\n outline: none;\n border: none;\n cursor: pointer;\n}\n\n[data-supertokens~="backButton"] {\n color: rgb(var(--palette-textLink));\n}\n\n[data-supertokens~="logoutButton"] {\n display: flex;\n align-items: center;\n gap: 6px;\n color: rgb(var(--palette-textGray));\n}\n\n[data-supertokens~="primaryText"][data-supertokens~="accessDeniedError"] {\n font-weight: 400;\n}\n'; var ThemeBase = function (_a) { var children = _a.children, @@ -93,7 +93,7 @@ var ThemeBase = function (_a) { children, loadDefaultFont && jsxRuntime.jsx("link", { - href: "//fonts.googleapis.com/css?family=Rubik:wght@300;400;600;500;700", + href: "//fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600;700", rel: "stylesheet", type: "text/css", }), @@ -144,7 +144,7 @@ var AccessDeniedScreen$2 = function (props) { return jsxRuntime.jsx( "div", genericComponentOverrideContext.__assign( - { "data-supertokens": "center" }, + { "data-supertokens": "center accessDenied" }, { children: jsxRuntime.jsx( "div", @@ -180,10 +180,10 @@ var AccessDeniedScreen$2 = function (props) { { "data-supertokens": "buttonsGroup" }, { children: [ - jsxRuntime.jsx(LogoutButton, { onClick: onLogout }), jsxRuntime.jsx(BackButton, { onClick: onBackButtonClicked, }), + jsxRuntime.jsx(LogoutButton, { onClick: onLogout }), ], } ) diff --git a/lib/build/thirdparty-shared2.js b/lib/build/thirdparty-shared2.js index 0d772b125..bd1328460 100644 --- a/lib/build/thirdparty-shared2.js +++ b/lib/build/thirdparty-shared2.js @@ -49,7 +49,7 @@ var React__namespace = /*#__PURE__*/ _interopNamespace(React); var STGeneralError__default = /*#__PURE__*/ _interopDefault(STGeneralError); var styles = - '[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="row"] {\n padding-bottom: 30px;\n}\n[data-supertokens~="providerContainer"] {\n padding-top: 9px;\n padding-bottom: 9px;\n}\n[data-supertokens~="providerButton"] {\n border-color: rgb(221, 221, 221) !important;\n}\n[data-supertokens~="providerButton"] {\n min-height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 2px 8px;\n\n background-color: white;\n color: black;\n}\n[data-supertokens~="providerButton"]:hover {\n -webkit-filter: none !important;\n filter: none !important;\n}\n[data-supertokens~="providerButton"]:hover {\n background-color: #fafafa;\n}\n[data-supertokens~="providerButtonLeft"] {\n min-width: 34px;\n margin-left: 66px;\n}\n[data-supertokens~="providerButtonLogo"] {\n height: 30px;\n display: flex;\n}\n[data-supertokens~="providerButtonLogoCenter"] {\n display: flex;\n margin: auto;\n}\n[data-supertokens~="providerButtonText"] {\n font-weight: 400;\n text-align: center;\n justify-content: center;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n display: inline-block;\n}\n[data-supertokens~="providerButtonText"]:only-child {\n margin: 0 auto;\n}\n'; + '[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 400;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 600;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n font-weight: 400;\n margin-bottom: 21px;\n}\n[data-supertokens~="headerSubtitle"][data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n font-family: "Rubik", sans-serif;\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n font-family: "Rubik", sans-serif;\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="row"] {\n padding-bottom: 30px;\n}\n[data-supertokens~="providerContainer"] {\n padding-top: 9px;\n padding-bottom: 9px;\n}\n[data-supertokens~="providerButton"] {\n border-color: rgb(221, 221, 221) !important;\n}\n[data-supertokens~="providerButton"] {\n min-height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 2px 8px;\n\n background-color: white;\n color: black;\n}\n[data-supertokens~="providerButton"]:hover {\n -webkit-filter: none !important;\n filter: none !important;\n}\n[data-supertokens~="providerButton"]:hover {\n background-color: #fafafa;\n}\n[data-supertokens~="providerButtonLeft"] {\n min-width: 34px;\n margin-left: 66px;\n}\n[data-supertokens~="providerButtonLogo"] {\n height: 30px;\n display: flex;\n}\n[data-supertokens~="providerButtonLogoCenter"] {\n display: flex;\n margin: auto;\n}\n[data-supertokens~="providerButtonText"] {\n font-weight: 400;\n text-align: center;\n justify-content: center;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n display: inline-block;\n}\n[data-supertokens~="providerButtonText"]:only-child {\n margin: 0 auto;\n}\n'; var ThemeBase = function (_a) { var children = _a.children, @@ -60,7 +60,7 @@ var ThemeBase = function (_a) { children, loadDefaultFont && jsxRuntime.jsx("link", { - href: "//fonts.googleapis.com/css?family=Rubik:wght@300;400;600;500;700", + href: "//fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600;700", rel: "stylesheet", type: "text/css", }), diff --git a/lib/build/thirdpartyemailpasswordprebuiltui.js b/lib/build/thirdpartyemailpasswordprebuiltui.js index 78900f73c..cdc47c533 100644 --- a/lib/build/thirdpartyemailpasswordprebuiltui.js +++ b/lib/build/thirdpartyemailpasswordprebuiltui.js @@ -81,7 +81,7 @@ var NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath var React__namespace = /*#__PURE__*/ _interopNamespace(React); var styles = - '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n[data-supertokens~="withBackButton"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n[data-supertokens~="row"] {\n padding-bottom: 30px;\n}\n[data-supertokens~="providerContainer"] {\n padding-top: 9px;\n padding-bottom: 9px;\n}\n[data-supertokens~="providerButton"] {\n border-color: rgb(221, 221, 221) !important;\n}\n[data-supertokens~="providerButton"] {\n min-height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 2px 8px;\n\n background-color: white;\n color: black;\n}\n[data-supertokens~="providerButton"]:hover {\n -webkit-filter: none !important;\n filter: none !important;\n}\n[data-supertokens~="providerButton"]:hover {\n background-color: #fafafa;\n}\n[data-supertokens~="providerButtonLeft"] {\n min-width: 34px;\n margin-left: 66px;\n}\n[data-supertokens~="providerButtonLogo"] {\n height: 30px;\n display: flex;\n}\n[data-supertokens~="providerButtonLogoCenter"] {\n display: flex;\n margin: auto;\n}\n[data-supertokens~="providerButtonText"] {\n font-weight: 400;\n text-align: center;\n justify-content: center;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n display: inline-block;\n}\n[data-supertokens~="providerButtonText"]:only-child {\n margin: 0 auto;\n}\n[data-supertokens~="thirdPartyEmailPasswordDivider"] {\n padding-top: 5px;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="thirdPartyEmailPasswordDividerOr"] {\n flex: 1 1;\n margin-top: 0.75em;\n}\n[data-supertokens~="divider"] {\n flex: 3 3;\n}\n[data-supertokens~="providerButton"] {\n margin: auto !important;\n max-width: 240px !important;\n}\n[data-supertokens~="providerButtonLeft"] {\n margin-left: 30px !important;\n}\n'; + '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 400;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 600;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n font-weight: 400;\n margin-bottom: 21px;\n}\n[data-supertokens~="headerSubtitle"][data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n font-family: "Rubik", sans-serif;\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n font-family: "Rubik", sans-serif;\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n[data-supertokens~="withBackButton"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n[data-supertokens~="row"] {\n padding-bottom: 30px;\n}\n[data-supertokens~="providerContainer"] {\n padding-top: 9px;\n padding-bottom: 9px;\n}\n[data-supertokens~="providerButton"] {\n border-color: rgb(221, 221, 221) !important;\n}\n[data-supertokens~="providerButton"] {\n min-height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 2px 8px;\n\n background-color: white;\n color: black;\n}\n[data-supertokens~="providerButton"]:hover {\n -webkit-filter: none !important;\n filter: none !important;\n}\n[data-supertokens~="providerButton"]:hover {\n background-color: #fafafa;\n}\n[data-supertokens~="providerButtonLeft"] {\n min-width: 34px;\n margin-left: 66px;\n}\n[data-supertokens~="providerButtonLogo"] {\n height: 30px;\n display: flex;\n}\n[data-supertokens~="providerButtonLogoCenter"] {\n display: flex;\n margin: auto;\n}\n[data-supertokens~="providerButtonText"] {\n font-weight: 400;\n text-align: center;\n justify-content: center;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n display: inline-block;\n}\n[data-supertokens~="providerButtonText"]:only-child {\n margin: 0 auto;\n}\n[data-supertokens~="thirdPartyEmailPasswordDivider"] {\n padding-top: 5px;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="thirdPartyEmailPasswordDividerOr"] {\n flex: 1 1;\n margin-top: 0.75em;\n}\n[data-supertokens~="divider"] {\n flex: 3 3;\n}\n[data-supertokens~="providerButton"] {\n margin: auto !important;\n max-width: 240px !important;\n}\n[data-supertokens~="providerButtonLeft"] {\n margin-left: 30px !important;\n}\n'; var ThemeBase = function (_a) { var children = _a.children, @@ -92,7 +92,7 @@ var ThemeBase = function (_a) { children, loadDefaultFont && jsxRuntime.jsx("link", { - href: "//fonts.googleapis.com/css?family=Rubik:wght@300;400;600;500;700", + href: "//fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600;700", rel: "stylesheet", type: "text/css", }), diff --git a/lib/build/thirdpartypasswordlessprebuiltui.js b/lib/build/thirdpartypasswordlessprebuiltui.js index ae98805d2..4dfaa4fb7 100644 --- a/lib/build/thirdpartypasswordlessprebuiltui.js +++ b/lib/build/thirdpartypasswordlessprebuiltui.js @@ -79,7 +79,7 @@ var NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath var React__namespace = /*#__PURE__*/ _interopNamespace(React); var styles = - '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 300;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 800;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n margin-bottom: 21px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n[data-supertokens~="withBackButton"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n[data-supertokens~="generalSuccess"] {\n margin-bottom: 20px;\n -webkit-animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n}\n[data-supertokens~="codeInputLabelWrapper"] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="headerSubtitle"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n[data-supertokens~="sendCodeText"] {\n margin-top: 15px;\n margin-bottom: 20px;\n}\n[data-supertokens~="sendCodeText"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n[data-supertokens~="resendCodeBtn"] {\n width: auto;\n margin-top: 0;\n line-height: 24px;\n}\n[data-supertokens~="resendCodeBtn"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="resendCodeBtn"]:disabled {\n color: rgb(var(--palette-textPrimary));\n cursor: default;\n text-decoration: none;\n}\n[data-supertokens~="phoneInputLibRoot"] {\n display: flex;\n align-items: center;\n}\n[data-supertokens~="phoneInputWrapper"] {\n display: flex;\n align-items: center;\n}\n[data-supertokens~="phoneInputWrapper"] .iti [data-supertokens~="input"] {\n padding-left: 15px;\n}\n[data-supertokens~="phoneInputWrapper"] .iti {\n flex: 1 1;\n min-width: 0;\n width: 100%;\n background: transparent;\n border: none;\n color: inherit;\n outline: none;\n}\n[data-supertokens~="continueButtonWrapper"] {\n margin-top: 10px;\n margin-bottom: 30px;\n}\n.iti__country-list {\n border: 0;\n top: 40px;\n width: min(72.2vw, 320px);\n border-radius: 6;\n box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.16);\n}\n.iti__country {\n display: flex;\n align-items: center;\n height: 34px;\n cursor: pointer;\n\n padding: 0 8px;\n}\n.iti__country-name {\n color: var(--palette-textLabel);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: "0 16px";\n}\n[data-supertokens~="row"] {\n padding-bottom: 30px;\n}\n[data-supertokens~="providerContainer"] {\n padding-top: 9px;\n padding-bottom: 9px;\n}\n[data-supertokens~="providerButton"] {\n border-color: rgb(221, 221, 221) !important;\n}\n[data-supertokens~="providerButton"] {\n min-height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 2px 8px;\n\n background-color: white;\n color: black;\n}\n[data-supertokens~="providerButton"]:hover {\n -webkit-filter: none !important;\n filter: none !important;\n}\n[data-supertokens~="providerButton"]:hover {\n background-color: #fafafa;\n}\n[data-supertokens~="providerButtonLeft"] {\n min-width: 34px;\n margin-left: 66px;\n}\n[data-supertokens~="providerButtonLogo"] {\n height: 30px;\n display: flex;\n}\n[data-supertokens~="providerButtonLogoCenter"] {\n display: flex;\n margin: auto;\n}\n[data-supertokens~="providerButtonText"] {\n font-weight: 400;\n text-align: center;\n justify-content: center;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n display: inline-block;\n}\n[data-supertokens~="providerButtonText"]:only-child {\n margin: 0 auto;\n}\n[data-supertokens~="thirdPartyPasswordlessDivider"] {\n padding-top: 5px;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="thirdPartyPasswordlessDividerText"] {\n flex: 1 1;\n margin-top: 0.75em;\n}\n[data-supertokens~="divider"] {\n flex: 3 3;\n}\n[data-supertokens~="providerButton"] {\n margin: auto !important;\n max-width: 240px !important;\n}\n[data-supertokens~="providerButtonLeft"] {\n margin-left: 30px !important;\n}\n'; + '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 400;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 600;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n font-weight: 400;\n margin-bottom: 21px;\n}\n[data-supertokens~="headerSubtitle"][data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n font-family: "Rubik", sans-serif;\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n font-family: "Rubik", sans-serif;\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n[data-supertokens~="withBackButton"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n[data-supertokens~="generalSuccess"] {\n margin-bottom: 20px;\n -webkit-animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n}\n[data-supertokens~="codeInputLabelWrapper"] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="headerSubtitle"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n[data-supertokens~="sendCodeText"] {\n margin-top: 15px;\n margin-bottom: 20px;\n}\n[data-supertokens~="sendCodeText"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n[data-supertokens~="resendCodeBtn"] {\n width: auto;\n margin-top: 0;\n line-height: 24px;\n}\n[data-supertokens~="resendCodeBtn"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="resendCodeBtn"]:disabled {\n color: rgb(var(--palette-textPrimary));\n cursor: default;\n text-decoration: none;\n}\n[data-supertokens~="phoneInputLibRoot"] {\n display: flex;\n align-items: center;\n}\n[data-supertokens~="phoneInputWrapper"] {\n display: flex;\n align-items: center;\n}\n[data-supertokens~="phoneInputWrapper"] .iti [data-supertokens~="input"] {\n padding-left: 15px;\n}\n[data-supertokens~="phoneInputWrapper"] .iti {\n flex: 1 1;\n min-width: 0;\n width: 100%;\n background: transparent;\n border: none;\n color: inherit;\n outline: none;\n}\n[data-supertokens~="continueButtonWrapper"] {\n margin-top: 10px;\n margin-bottom: 30px;\n}\n.iti__country-list {\n border: 0;\n top: 40px;\n width: min(72.2vw, 320px);\n border-radius: 6;\n box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.16);\n}\n.iti__country {\n display: flex;\n align-items: center;\n height: 34px;\n cursor: pointer;\n\n padding: 0 8px;\n}\n.iti__country-name {\n color: var(--palette-textLabel);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: "0 16px";\n}\n[data-supertokens~="row"] {\n padding-bottom: 30px;\n}\n[data-supertokens~="providerContainer"] {\n padding-top: 9px;\n padding-bottom: 9px;\n}\n[data-supertokens~="providerButton"] {\n border-color: rgb(221, 221, 221) !important;\n}\n[data-supertokens~="providerButton"] {\n min-height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 2px 8px;\n\n background-color: white;\n color: black;\n}\n[data-supertokens~="providerButton"]:hover {\n -webkit-filter: none !important;\n filter: none !important;\n}\n[data-supertokens~="providerButton"]:hover {\n background-color: #fafafa;\n}\n[data-supertokens~="providerButtonLeft"] {\n min-width: 34px;\n margin-left: 66px;\n}\n[data-supertokens~="providerButtonLogo"] {\n height: 30px;\n display: flex;\n}\n[data-supertokens~="providerButtonLogoCenter"] {\n display: flex;\n margin: auto;\n}\n[data-supertokens~="providerButtonText"] {\n font-weight: 400;\n text-align: center;\n justify-content: center;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n display: inline-block;\n}\n[data-supertokens~="providerButtonText"]:only-child {\n margin: 0 auto;\n}\n[data-supertokens~="thirdPartyPasswordlessDivider"] {\n padding-top: 5px;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="thirdPartyPasswordlessDividerText"] {\n flex: 1 1;\n margin-top: 0.75em;\n}\n[data-supertokens~="divider"] {\n flex: 3 3;\n}\n[data-supertokens~="providerButton"] {\n margin: auto !important;\n max-width: 240px !important;\n}\n[data-supertokens~="providerButtonLeft"] {\n margin-left: 30px !important;\n}\n'; var ThemeBase = function (_a) { var children = _a.children, @@ -90,7 +90,7 @@ var ThemeBase = function (_a) { children, loadDefaultFont && jsxRuntime.jsx("link", { - href: "//fonts.googleapis.com/css?family=Rubik:wght@300;400;600;500;700", + href: "//fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600;700", rel: "stylesheet", type: "text/css", }), diff --git a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/index.tsx b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/index.tsx index 8c1e7174e..538502fab 100644 --- a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/index.tsx +++ b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/index.tsx @@ -37,7 +37,7 @@ export function FactorChooserTheme(props: FactorChooserThemeProps): JSX.Element ); } return ( -
+
)} diff --git a/lib/ts/recipe/multifactorauth/components/themes/translations.ts b/lib/ts/recipe/multifactorauth/components/themes/translations.ts index f5300cb9f..62ab0fa3c 100644 --- a/lib/ts/recipe/multifactorauth/components/themes/translations.ts +++ b/lib/ts/recipe/multifactorauth/components/themes/translations.ts @@ -3,8 +3,8 @@ import { defaultTranslationsCommon } from "../../../../translation/translations" export const defaultTranslationsMultiFactorAuth = { en: { ...defaultTranslationsCommon.en, - MULTI_FACTOR_CHOOSER_HEADER_TITLE: "Please select a second factor", - MULTI_FACTOR_AUTH_LOGOUT: "Logout", + MULTI_FACTOR_CHOOSER_HEADER_TITLE: "Please select another factor", + MULTI_FACTOR_AUTH_LOGOUT: "Log out", MFA_NO_AVAILABLE_OPTIONS: "You have no available secondary factors.", MFA_NO_AVAILABLE_OPTIONS_LOGIN: diff --git a/lib/ts/recipe/multitenancy/components/themes/themeBase.tsx b/lib/ts/recipe/multitenancy/components/themes/themeBase.tsx index cfdf405a4..4dc8cad23 100644 --- a/lib/ts/recipe/multitenancy/components/themes/themeBase.tsx +++ b/lib/ts/recipe/multitenancy/components/themes/themeBase.tsx @@ -28,7 +28,7 @@ export const ThemeBase: React.FC< {children} {loadDefaultFont && ( )} diff --git a/lib/ts/recipe/passwordless/components/themes/themeBase.tsx b/lib/ts/recipe/passwordless/components/themes/themeBase.tsx index cfdf405a4..4dc8cad23 100644 --- a/lib/ts/recipe/passwordless/components/themes/themeBase.tsx +++ b/lib/ts/recipe/passwordless/components/themes/themeBase.tsx @@ -28,7 +28,7 @@ export const ThemeBase: React.FC< {children} {loadDefaultFont && ( )} diff --git a/lib/ts/recipe/session/components/themes/accessDeniedScreenTheme/index.tsx b/lib/ts/recipe/session/components/themes/accessDeniedScreenTheme/index.tsx index fa3ceb5e3..c4d78accd 100644 --- a/lib/ts/recipe/session/components/themes/accessDeniedScreenTheme/index.tsx +++ b/lib/ts/recipe/session/components/themes/accessDeniedScreenTheme/index.tsx @@ -41,7 +41,7 @@ const AccessDeniedScreen: FC = (props) => { }; return ( -
+
@@ -49,8 +49,8 @@ const AccessDeniedScreen: FC = (props) => {
{props.error &&
{props.error}
}
- +
diff --git a/lib/ts/recipe/session/components/themes/styles.css b/lib/ts/recipe/session/components/themes/styles.css index 624b6a843..e6e9143cb 100644 --- a/lib/ts/recipe/session/components/themes/styles.css +++ b/lib/ts/recipe/session/components/themes/styles.css @@ -16,18 +16,17 @@ @import "../../../../styles/styles.css"; /* Override */ -[data-supertokens~="row"] { - padding-top: 32px; - padding-bottom: 32px; +[data-supertokens~="accessDenied"] [data-supertokens~="row"] { + padding-bottom: 24px; } -[data-supertokens~="divider"] { +[data-supertokens~="accessDenied"] [data-supertokens~="divider"] { padding: 0; - margin: 24px 0; + margin: 34px 0 18px 0; } -[data-supertokens~="headerTitle"] { - padding-top: 24px; +[data-supertokens~="accessDenied"] [data-supertokens~="headerTitle"] { + margin: 10px 0 0 0; font-style: normal; font-weight: 700; font-size: 20px; @@ -45,13 +44,14 @@ } [data-supertokens~="buttonsGroup"] { - margin-top: 24px; + margin-top: 34px; display: flex; align-items: center; justify-content: space-between; } [data-supertokens~="buttonBase"] { + font-family: "Rubik", sans-serif; font-size: var(--font-size-1); line-height: 21px; font-weight: 500; @@ -71,3 +71,7 @@ gap: 6px; color: rgb(var(--palette-textGray)); } + +[data-supertokens~="primaryText"][data-supertokens~="accessDeniedError"] { + font-weight: 400; +} diff --git a/lib/ts/recipe/session/components/themes/themeBase.tsx b/lib/ts/recipe/session/components/themes/themeBase.tsx index cfdf405a4..4dc8cad23 100644 --- a/lib/ts/recipe/session/components/themes/themeBase.tsx +++ b/lib/ts/recipe/session/components/themes/themeBase.tsx @@ -28,7 +28,7 @@ export const ThemeBase: React.FC< {children} {loadDefaultFont && ( )} diff --git a/lib/ts/recipe/thirdparty/components/themes/themeBase.tsx b/lib/ts/recipe/thirdparty/components/themes/themeBase.tsx index cfdf405a4..4dc8cad23 100644 --- a/lib/ts/recipe/thirdparty/components/themes/themeBase.tsx +++ b/lib/ts/recipe/thirdparty/components/themes/themeBase.tsx @@ -28,7 +28,7 @@ export const ThemeBase: React.FC< {children} {loadDefaultFont && ( )} diff --git a/lib/ts/recipe/thirdpartyemailpassword/components/themes/themeBase.tsx b/lib/ts/recipe/thirdpartyemailpassword/components/themes/themeBase.tsx index cfdf405a4..4dc8cad23 100644 --- a/lib/ts/recipe/thirdpartyemailpassword/components/themes/themeBase.tsx +++ b/lib/ts/recipe/thirdpartyemailpassword/components/themes/themeBase.tsx @@ -28,7 +28,7 @@ export const ThemeBase: React.FC< {children} {loadDefaultFont && ( )} diff --git a/lib/ts/recipe/thirdpartypasswordless/components/themes/themeBase.tsx b/lib/ts/recipe/thirdpartypasswordless/components/themes/themeBase.tsx index cfdf405a4..4dc8cad23 100644 --- a/lib/ts/recipe/thirdpartypasswordless/components/themes/themeBase.tsx +++ b/lib/ts/recipe/thirdpartypasswordless/components/themes/themeBase.tsx @@ -28,7 +28,7 @@ export const ThemeBase: React.FC< {children} {loadDefaultFont && ( )} diff --git a/lib/ts/styles/styles.css b/lib/ts/styles/styles.css index 94f5058b8..ccb25636e 100644 --- a/lib/ts/styles/styles.css +++ b/lib/ts/styles/styles.css @@ -86,7 +86,7 @@ width: fit-content; border-radius: 6px 6px 0 0; padding: 4px 9px; - font-weight: 300; + font-weight: 400; font-size: var(--font-size-0); letter-spacing: 0.4px; } @@ -110,15 +110,20 @@ font-size: var(--font-size-4); line-height: 40px; letter-spacing: 0.58px; - font-weight: 800; + font-weight: 600; margin-bottom: 2px; color: rgb(var(--palette-textTitle)); } [data-supertokens~="headerSubtitle"] { + font-weight: 400; margin-bottom: 21px; } +[data-supertokens~="headerSubtitle"][data-supertokens~="secondaryText"] { + font-weight: 400; +} + [data-supertokens~="privacyPolicyAndTermsAndConditions"] { max-width: 300px; margin-top: 10px; @@ -205,11 +210,13 @@ } [data-supertokens~="linkButton"] { + font-family: "Rubik", sans-serif; background-color: transparent; border: 0; } [data-supertokens~="secondaryLinkWithLeftArrow"] { + font-weight: 500; margin-top: 10px; margin-bottom: 40px; cursor: pointer; @@ -223,6 +230,7 @@ } [data-supertokens~="button"] { + font-family: "Rubik", sans-serif; background-color: rgb(var(--palette-primary)); color: rgb(var(--palette-buttonText)); width: 100%; From ea768d1c3c4ce3316115af786d7fe62fe946cdad Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Wed, 15 Nov 2023 23:59:02 +0100 Subject: [PATCH 25/35] chore: update web-js dep --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8f3d19ca6..2809adab6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16244,7 +16244,7 @@ }, "node_modules/supertokens-web-js": { "version": "0.9.0", - "resolved": "git+ssh://git@github.com/supertokens/supertokens-web-js.git#eeb37fb37e402bf329b0b6ae6e72b20c228b747a", + "resolved": "git+ssh://git@github.com/supertokens/supertokens-web-js.git#25eecd8401378b762fce0a9f29826910936c4984", "license": "Apache-2.0", "peer": true, "dependencies": { @@ -29414,7 +29414,7 @@ "integrity": "sha512-r0JFBjkMIdep3Lbk3JA+MpnpuOtw4RSyrlRAbrzMcxwiYco3GFWl/daimQZ5b1forOiUODpOlXbSOljP/oyurg==" }, "supertokens-web-js": { - "version": "git+ssh://git@github.com/supertokens/supertokens-web-js.git#eeb37fb37e402bf329b0b6ae6e72b20c228b747a", + "version": "git+ssh://git@github.com/supertokens/supertokens-web-js.git#25eecd8401378b762fce0a9f29826910936c4984", "from": "supertokens-web-js@github:supertokens/supertokens-web-js#feat/mfa", "peer": true, "requires": { From 598be732cb3f47ffe42c32883b9650e143e98537 Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Thu, 16 Nov 2023 00:34:35 +0100 Subject: [PATCH 26/35] feat: update design --- lib/build/components/assets/otpEmailIcon.d.ts | 2 + lib/build/components/assets/otpIcon.d.ts | 2 - lib/build/components/assets/otpSMSIcon.d.ts | 2 + lib/build/emailverification-shared2.js | 2 +- lib/build/index2.js | 2 +- lib/build/multifactorauthprebuiltui.js | 2 +- lib/build/passwordless-shared2.js | 76 +++++++++++++------ lib/build/passwordless-shared3.js | 28 +++---- lib/build/sessionprebuiltui.js | 2 +- lib/build/thirdparty-shared2.js | 2 +- .../thirdpartyemailpasswordprebuiltui.js | 2 +- lib/build/thirdpartypasswordlessprebuiltui.js | 2 +- lib/ts/components/assets/otpEmailIcon.tsx | 17 +++++ lib/ts/components/assets/otpIcon.tsx | 32 -------- lib/ts/components/assets/otpSMSIcon.tsx | 17 +++++ .../components/themes/mfa/index.tsx | 2 +- .../components/themes/mfa/mfaFooter.tsx | 6 +- .../components/themes/mfa/mfaOTPFooter.tsx | 9 +-- lib/ts/recipe/passwordless/recipe.tsx | 7 +- lib/ts/styles/styles.css | 52 +++++++++++++ package-lock.json | 1 + package.json | 1 + 22 files changed, 172 insertions(+), 96 deletions(-) create mode 100644 lib/build/components/assets/otpEmailIcon.d.ts delete mode 100644 lib/build/components/assets/otpIcon.d.ts create mode 100644 lib/build/components/assets/otpSMSIcon.d.ts create mode 100644 lib/ts/components/assets/otpEmailIcon.tsx delete mode 100644 lib/ts/components/assets/otpIcon.tsx create mode 100644 lib/ts/components/assets/otpSMSIcon.tsx diff --git a/lib/build/components/assets/otpEmailIcon.d.ts b/lib/build/components/assets/otpEmailIcon.d.ts new file mode 100644 index 000000000..1de53f103 --- /dev/null +++ b/lib/build/components/assets/otpEmailIcon.d.ts @@ -0,0 +1,2 @@ +/// +export declare const OTPEmailIcon: () => JSX.Element; diff --git a/lib/build/components/assets/otpIcon.d.ts b/lib/build/components/assets/otpIcon.d.ts deleted file mode 100644 index bcb7b9c12..000000000 --- a/lib/build/components/assets/otpIcon.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -/// -export declare const OTPIcon: () => JSX.Element; diff --git a/lib/build/components/assets/otpSMSIcon.d.ts b/lib/build/components/assets/otpSMSIcon.d.ts new file mode 100644 index 000000000..5e409d35a --- /dev/null +++ b/lib/build/components/assets/otpSMSIcon.d.ts @@ -0,0 +1,2 @@ +/// +export declare const OTPSMSIcon: () => JSX.Element; diff --git a/lib/build/emailverification-shared2.js b/lib/build/emailverification-shared2.js index 40f16d2dd..ec7512b09 100644 --- a/lib/build/emailverification-shared2.js +++ b/lib/build/emailverification-shared2.js @@ -6,7 +6,7 @@ var genericComponentOverrideContext = require("./genericComponentOverrideContext var translations = require("./translations.js"); var styles = - '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 400;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 600;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n font-weight: 400;\n margin-bottom: 21px;\n}\n\n[data-supertokens~="headerSubtitle"][data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n font-family: "Rubik", sans-serif;\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n font-family: "Rubik", sans-serif;\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n\n[data-supertokens~="withBackButton"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n'; + '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 400;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 600;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n font-weight: 400;\n margin-bottom: 21px;\n}\n\n[data-supertokens~="headerSubtitle"][data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n font-family: "Rubik", sans-serif;\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n font-family: "Rubik", sans-serif;\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n\n[data-supertokens~="delayedRender"] {\n -webkit-animation-duration: 0.1s;\n animation-duration: 0.1s;\n -webkit-animation-name: animate-fade;\n animation-name: animate-fade;\n -webkit-animation-delay: 0.2s;\n animation-delay: 0.2s;\n -webkit-animation-fill-mode: backwards;\n animation-fill-mode: backwards;\n}\n\n@-webkit-keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n\n@keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n\n[data-supertokens~="footerLinkGroupVert"] {\n display: flex;\n flex-direction: column;\n margin-top: 10px;\n gap: 24px;\n}\n\n[data-supertokens~="footerLinkGroupVert"] > div {\n margin: 0;\n}\n\n[data-supertokens~="footerLinkGroupVert"] [data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n\n[data-supertokens~="footerLinkGroupVert"] [data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n position: relative;\n left: -6px; /* half the width of the left arrow */\n}\n\n@media (max-width: 360px) {\n [data-supertokens~="footerLinkGroupVert"] {\n flex-direction: column;\n }\n [data-supertokens~="footerLinkGroupVert"] > div {\n margin: 0 auto;\n }\n}\n\n[data-supertokens~="footerLinkGroupVert"] div:only-child {\n margin-left: auto;\n margin-right: auto;\n margin-top: 14px;\n}\n\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n\n[data-supertokens~="withBackButton"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n'; var ThemeBase = function (_a) { var children = _a.children, diff --git a/lib/build/index2.js b/lib/build/index2.js index c9288f41e..9d1c4e84e 100644 --- a/lib/build/index2.js +++ b/lib/build/index2.js @@ -276,7 +276,7 @@ var withOverride = function (overrideKey, DefaultComponent) { }; var styles = - '[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 400;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 600;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n font-weight: 400;\n margin-bottom: 21px;\n}\n[data-supertokens~="headerSubtitle"][data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n font-family: "Rubik", sans-serif;\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n font-family: "Rubik", sans-serif;\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n[data-supertokens~="delayedRender"] {\n -webkit-animation-duration: 0.1s;\n animation-duration: 0.1s;\n -webkit-animation-name: animate-fade;\n animation-name: animate-fade;\n -webkit-animation-delay: 0.2s;\n animation-delay: 0.2s;\n -webkit-animation-fill-mode: backwards;\n animation-fill-mode: backwards;\n}\n@-webkit-keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n'; + '[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 400;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 600;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n font-weight: 400;\n margin-bottom: 21px;\n}\n[data-supertokens~="headerSubtitle"][data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n font-family: "Rubik", sans-serif;\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n font-family: "Rubik", sans-serif;\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n[data-supertokens~="delayedRender"] {\n -webkit-animation-duration: 0.1s;\n animation-duration: 0.1s;\n -webkit-animation-name: animate-fade;\n animation-name: animate-fade;\n -webkit-animation-delay: 0.2s;\n animation-delay: 0.2s;\n -webkit-animation-fill-mode: backwards;\n animation-fill-mode: backwards;\n}\n@-webkit-keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n[data-supertokens~="footerLinkGroupVert"] {\n display: flex;\n flex-direction: column;\n margin-top: 10px;\n gap: 24px;\n}\n[data-supertokens~="footerLinkGroupVert"] > div {\n margin: 0;\n}\n[data-supertokens~="footerLinkGroupVert"] [data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n[data-supertokens~="footerLinkGroupVert"] [data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n position: relative;\n left: -6px; /* half the width of the left arrow */\n}\n@media (max-width: 360px) {\n [data-supertokens~="footerLinkGroupVert"] {\n flex-direction: column;\n }\n [data-supertokens~="footerLinkGroupVert"] > div {\n margin: 0 auto;\n }\n}\n[data-supertokens~="footerLinkGroupVert"] div:only-child {\n margin-left: auto;\n margin-right: auto;\n margin-top: 14px;\n}\n[data-supertokens~="delayedRender"] {\n -webkit-animation-duration: 0.1s;\n animation-duration: 0.1s;\n -webkit-animation-name: animate-fade;\n animation-name: animate-fade;\n -webkit-animation-delay: 0.2s;\n animation-delay: 0.2s;\n -webkit-animation-fill-mode: backwards;\n animation-fill-mode: backwards;\n}\n@keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n'; var ThemeBase = function (_a) { var children = _a.children, diff --git a/lib/build/multifactorauthprebuiltui.js b/lib/build/multifactorauthprebuiltui.js index c01d75a36..4be5f4a48 100644 --- a/lib/build/multifactorauthprebuiltui.js +++ b/lib/build/multifactorauthprebuiltui.js @@ -64,7 +64,7 @@ var NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath var React__namespace = /*#__PURE__*/ _interopNamespace(React); var styles = - '[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 400;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 600;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n font-weight: 400;\n margin-bottom: 21px;\n}\n[data-supertokens~="headerSubtitle"][data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n font-family: "Rubik", sans-serif;\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n font-family: "Rubik", sans-serif;\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n[data-supertokens~="mfa"][data-supertokens~="container"] {\n padding-top: 34px;\n}\n[data-supertokens~="mfa"] [data-supertokens~="row"] {\n padding-top: 6px;\n padding-bottom: 6px;\n}\n[data-supertokens~="mfa"] [data-supertokens~="headerTitle"] {\n font-size: var(--font-size-3);\n font-weight: 600;\n line-height: 30px;\n}\n[data-supertokens~="mfa"] [data-supertokens~="factorChooserList"] {\n margin-bottom: 12px;\n}\n[data-supertokens~="factorChooserOption"] {\n display: flex;\n flex-direction: row;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n padding: 20px 16px;\n cursor: pointer;\n margin-top: 12px;\n}\n[data-supertokens~="factorChooserOption"]:hover {\n border: 1px solid rgb(var(--palette-textLink));\n}\n[data-supertokens~="factorOptionText"] {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n align-items: start;\n text-align: left;\n}\n[data-supertokens~="factorLogo"] {\n flex-grow: 0;\n min-width: 30px;\n text-align: left;\n margin-top: 6px;\n}\n[data-supertokens~="factorName"] {\n color: rgb(var(--palette-textPrimary));\n font-size: var(--font-size-1);\n font-weight: 500;\n margin: 4px;\n}\n[data-supertokens~="factorChooserOption"]:hover [data-supertokens~="factorName"] {\n color: rgb(var(--palette-textLink));\n}\n[data-supertokens~="factorDescription"] {\n color: rgb(var(--palette-textGray));\n font-size: var(--font-size-0);\n margin: 4px;\n}\n[data-supertokens~="mfa"] [data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-bottom: 26px;\n text-align: right;\n}\n'; + '[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 400;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 600;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n font-weight: 400;\n margin-bottom: 21px;\n}\n[data-supertokens~="headerSubtitle"][data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n font-family: "Rubik", sans-serif;\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n font-family: "Rubik", sans-serif;\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n[data-supertokens~="delayedRender"] {\n -webkit-animation-duration: 0.1s;\n animation-duration: 0.1s;\n -webkit-animation-name: animate-fade;\n animation-name: animate-fade;\n -webkit-animation-delay: 0.2s;\n animation-delay: 0.2s;\n -webkit-animation-fill-mode: backwards;\n animation-fill-mode: backwards;\n}\n@-webkit-keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n[data-supertokens~="footerLinkGroupVert"] {\n display: flex;\n flex-direction: column;\n margin-top: 10px;\n gap: 24px;\n}\n[data-supertokens~="footerLinkGroupVert"] > div {\n margin: 0;\n}\n[data-supertokens~="footerLinkGroupVert"] [data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n[data-supertokens~="footerLinkGroupVert"] [data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n position: relative;\n left: -6px; /* half the width of the left arrow */\n}\n@media (max-width: 360px) {\n [data-supertokens~="footerLinkGroupVert"] {\n flex-direction: column;\n }\n [data-supertokens~="footerLinkGroupVert"] > div {\n margin: 0 auto;\n }\n}\n[data-supertokens~="footerLinkGroupVert"] div:only-child {\n margin-left: auto;\n margin-right: auto;\n margin-top: 14px;\n}\n[data-supertokens~="mfa"][data-supertokens~="container"] {\n padding-top: 34px;\n}\n[data-supertokens~="mfa"] [data-supertokens~="row"] {\n padding-top: 6px;\n padding-bottom: 6px;\n}\n[data-supertokens~="mfa"] [data-supertokens~="headerTitle"] {\n font-size: var(--font-size-3);\n font-weight: 600;\n line-height: 30px;\n}\n[data-supertokens~="mfa"] [data-supertokens~="factorChooserList"] {\n margin-bottom: 12px;\n}\n[data-supertokens~="factorChooserOption"] {\n display: flex;\n flex-direction: row;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n padding: 20px 16px;\n cursor: pointer;\n margin-top: 12px;\n}\n[data-supertokens~="factorChooserOption"]:hover {\n border: 1px solid rgb(var(--palette-textLink));\n}\n[data-supertokens~="factorOptionText"] {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n align-items: start;\n text-align: left;\n}\n[data-supertokens~="factorLogo"] {\n flex-grow: 0;\n min-width: 30px;\n text-align: left;\n margin-top: 6px;\n}\n[data-supertokens~="factorName"] {\n color: rgb(var(--palette-textPrimary));\n font-size: var(--font-size-1);\n font-weight: 500;\n margin: 4px;\n}\n[data-supertokens~="factorChooserOption"]:hover [data-supertokens~="factorName"] {\n color: rgb(var(--palette-textLink));\n}\n[data-supertokens~="factorDescription"] {\n color: rgb(var(--palette-textGray));\n font-size: var(--font-size-0);\n margin: 4px;\n}\n[data-supertokens~="mfa"] [data-supertokens~="secondaryLinkWithLeftArrow"] {\n margin-bottom: 26px;\n text-align: right;\n}\n'; var ThemeBase = function (_a) { var children = _a.children, diff --git a/lib/build/passwordless-shared2.js b/lib/build/passwordless-shared2.js index 187fd424e..51f2020a3 100644 --- a/lib/build/passwordless-shared2.js +++ b/lib/build/passwordless-shared2.js @@ -14,45 +14,77 @@ function _interopDefault(e) { var PasswordlessWebJS__default = /*#__PURE__*/ _interopDefault(PasswordlessWebJS); -var OTPIcon = function () { +var OTPEmailIcon = function () { return jsxRuntime.jsxs( "svg", genericComponentOverrideContext.__assign( - { xmlns: "http://www.w3.org/2000/svg", width: "22", height: "23", viewBox: "0 4 22 23", fill: "none" }, + { width: "17", height: "15", viewBox: "0 0 17 15", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [ jsxRuntime.jsx("path", { - d: "M7.56428 15.8664L5.26639 18.1643C5.11403 18.3167 4.90738 18.4023 4.69192 18.4023C4.47645 18.4023 4.2698 18.3167 4.11744 18.1643C3.96508 18.012 3.87949 17.8053 3.87949 17.5898C3.87949 17.3744 3.96508 17.1677 4.11744 17.0154L6.41533 14.7175C6.56769 14.5651 6.77434 14.4795 6.98981 14.4795C7.20528 14.4795 7.41192 14.5651 7.56428 14.7175C7.71664 14.8698 7.80224 15.0765 7.80224 15.292C7.80224 15.5074 7.71664 15.7141 7.56428 15.8664Z", - fill: "#73B6FF", + id: "image 414 (Traced)", + "fill-rule": "evenodd", + "clip-rule": "evenodd", + d: "M2.01513 0.0546421C1.19571 0.195435 0.393224 0.877322 0.143564 1.64496C0.0564841 1.9127 -0.00197242 1.84636 0.659082 2.22993C0.91105 2.37612 1.64082 2.80042 2.28084 3.17276C2.92086 3.54514 3.96809 4.1544 4.60811 4.52674C5.24813 4.89905 6.37321 5.55428 7.10833 5.98278C7.84346 6.41131 8.46401 6.7689 8.48736 6.77743C8.52111 6.78982 10.4367 5.69077 12.6253 4.40341C12.7865 4.30852 13.8173 3.70613 14.9159 3.06475L16.9133 1.89856L16.903 1.78079C16.8974 1.71603 16.8178 1.51568 16.7262 1.3356C16.3776 0.650318 15.6775 0.156143 14.8905 0.039982C14.4716 -0.0218423 2.38016 -0.00809191 2.01513 0.0546421ZM6.60933e-06 6.62054C0.000739608 10.251 -0.00834948 10.1158 0.27063 10.655C0.659815 11.4073 1.39721 11.8833 2.30408 11.9675C2.77169 12.0109 14.2345 12.0108 14.7024 11.9673C15.3604 11.9062 15.8152 11.7008 16.2911 11.2498C16.5236 11.0295 16.619 10.9066 16.7395 10.6725C17.0173 10.133 17.0065 10.3025 16.996 6.65494L16.9866 3.40211L15.8322 4.07294C15.1972 4.44186 13.9767 5.15156 13.1201 5.65004C11.2459 6.74049 10.2603 7.31342 9.46206 7.77628C8.76656 8.17962 8.59368 8.23389 8.2745 8.14908C8.14446 8.11454 7.64668 7.84559 6.81451 7.36034C4.15032 5.80665 0.097862 3.44588 0.0268711 3.40617C0.0117346 3.39774 -0.00032324 4.84419 6.60933e-06 6.62054Z", + fill: "url(#paint0_linear_4445_310)", }), - jsxRuntime.jsx("path", { - d: "M5.17026 13.4675L1.72342 16.9143C1.57106 17.0667 1.36442 17.1523 1.14895 17.1523C0.933477 17.1523 0.726833 17.0667 0.574473 16.9143C0.422113 16.762 0.336519 16.5553 0.336519 16.3398C0.336519 16.1244 0.422113 15.9177 0.574473 15.7654L4.02131 12.3185C4.17367 12.1662 4.38032 12.0806 4.59579 12.0806C4.81125 12.0806 5.0179 12.1662 5.17026 12.3185C5.32262 12.4709 5.40821 12.6775 5.40821 12.893C5.40821 13.1085 5.32262 13.3151 5.17026 13.4675Z", - fill: "#73B6FF", - }), - jsxRuntime.jsx("path", { - d: "M10.0492 18.1315L6.60233 21.5784C6.44997 21.7307 6.24332 21.8163 6.02785 21.8163C5.81238 21.8163 5.60574 21.7307 5.45338 21.5784C5.30102 21.426 5.21542 21.2194 5.21542 21.0039C5.21542 20.7884 5.30102 20.5818 5.45338 20.4294L8.90022 16.9826C9.05258 16.8302 9.25922 16.7446 9.47469 16.7446C9.69016 16.7446 9.89681 16.8302 10.0492 16.9826C10.2015 17.135 10.2871 17.3416 10.2871 17.5571C10.2871 17.7725 10.2015 17.9792 10.0492 18.1315Z", - fill: "#73B6FF", + jsxRuntime.jsx("defs", { + children: jsxRuntime.jsxs( + "linearGradient", + genericComponentOverrideContext.__assign( + { + id: "paint0_linear_4445_310", + x1: "8.5", + y1: "0", + x2: "8.5", + y2: "12", + gradientUnits: "userSpaceOnUse", + }, + { + children: [ + jsxRuntime.jsx("stop", { "stop-color": "#5FACFF" }), + jsxRuntime.jsx("stop", { offset: "1", "stop-color": "#1686FF" }), + ], + } + ) + ), }), + ], + } + ) + ); +}; + +var OTPSMSIcon = function () { + return jsxRuntime.jsxs( + "svg", + genericComponentOverrideContext.__assign( + { width: "17", height: "15", viewBox: "0 0 17 15", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, + { + children: [ jsxRuntime.jsx("path", { - d: "M16.935 4.28797L4.96211 8.24925C4.38349 8.47179 4.29448 9.27295 4.87309 9.49549L8.96789 11.3649L14.8876 7.13653L10.6592 13.0562L12.5286 17.151C12.7956 17.6851 13.5523 17.6406 13.7303 17.0175L17.6916 5.04462C17.8696 4.59953 17.4246 4.15444 16.935 4.28797Z", - fill: "url(#paint0_linear_3828_8733)", + id: "image 412 (Traced)", + "fill-rule": "evenodd", + "clip-rule": "evenodd", + d: "M2.23143 0.0484105C1.11677 0.26606 0.230705 1.14148 0.0548812 2.19882C0.0207171 2.40417 -0.000319148 3.89779 3.66265e-06 6.09367C0.000595481 10.0175 0.00446909 10.0713 0.330507 10.706C0.544477 11.1223 1.03692 11.597 1.49058 11.8243C1.9253 12.042 2.4213 12.1389 3.10571 12.14L3.65718 12.1409L3.65739 13.3581C3.65755 14.4585 3.66729 14.5903 3.75859 14.733C3.88347 14.9281 4.1338 15.0332 4.37209 14.9906C4.50192 14.9674 5.03536 14.5737 6.32332 13.5507L8.09582 12.1427L11.2701 12.1409C14.8062 12.1389 14.8922 12.1322 15.5441 11.8059C15.9514 11.602 16.4058 11.1868 16.6406 10.8041C16.7198 10.6748 16.8331 10.3886 16.8923 10.1681C16.9951 9.78536 17 9.6 17 6.0949C17 3.67866 16.98 2.31864 16.9417 2.11857C16.7993 1.37604 16.1965 0.620747 15.4792 0.286303C15.2652 0.186472 14.9464 0.0801328 14.7708 0.049999C14.3886 -0.0156495 2.5671 -0.0171356 2.23143 0.0484105ZM5.24433 4.97226C5.37743 5.00736 5.55471 5.1197 5.70901 5.26668C6.20818 5.74216 6.20834 6.40218 5.70933 6.86336C5.19445 7.3393 4.53167 7.33945 4.03228 6.86382C3.54451 6.3992 3.53069 5.75907 3.99822 5.28943C4.33561 4.95053 4.75602 4.84352 5.24433 4.97226ZM8.87594 4.96544C9.55686 5.14589 9.9071 5.95945 9.57246 6.58313C9.13161 7.40469 7.91806 7.41591 7.45342 6.60271C7.32215 6.37302 7.3066 6.29861 7.32494 5.98907C7.34211 5.69977 7.37455 5.59794 7.50653 5.41904C7.804 5.01592 8.36509 4.83005 8.87594 4.96544ZM12.7023 5.05815C13.4409 5.4257 13.5612 6.36097 12.94 6.90635C12.6706 7.14291 12.3468 7.24567 12.0095 7.20164C11.0115 7.07132 10.59 5.99614 11.2623 5.29563C11.6485 4.89313 12.1909 4.80365 12.7023 5.05815Z", + fill: "url(#paint0_linear_4445_316)", }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsxs( "linearGradient", genericComponentOverrideContext.__assign( { - id: "paint0_linear_3828_8733", - x1: "16.9576", - y1: "4.56946", - x2: "9.50502", - y2: "12.0221", + id: "paint0_linear_4445_316", + x1: "8.5", + y1: "0", + x2: "8.5", + y2: "15", gradientUnits: "userSpaceOnUse", }, { children: [ - jsxRuntime.jsx("stop", { stopColor: "#5FABFF" }), - jsxRuntime.jsx("stop", { offset: "1", stopColor: "#1485FF" }), + jsxRuntime.jsx("stop", { "stop-color": "#5FACFF" }), + jsxRuntime.jsx("stop", { offset: "1", "stop-color": "#1585FF" }), ], } ) @@ -569,14 +601,14 @@ var otpPhoneFactor = { name: "SMS based OTP", description: "Get an OTP code on your phone to complete the authentication request", path: "/mfa/otp-phone", - logo: OTPIcon, + logo: OTPSMSIcon, }; var otpEmailFactor = { id: "otp-email", name: "Email based OTP", description: "Get an OTP code on your email address to complete the authentication request", path: "/mfa/otp-email", - logo: OTPIcon, + logo: OTPEmailIcon, }; var passwordlessFactors = ["otp-phone", "otp-email", "link-phone", "link-email"]; var Passwordless = /** @class */ (function (_super) { diff --git a/lib/build/passwordless-shared3.js b/lib/build/passwordless-shared3.js index fd2726ae3..9f3637650 100644 --- a/lib/build/passwordless-shared3.js +++ b/lib/build/passwordless-shared3.js @@ -61,7 +61,7 @@ var React__namespace = /*#__PURE__*/ _interopNamespace(React); var STGeneralError__default = /*#__PURE__*/ _interopDefault(STGeneralError); var styles = - '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 400;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 600;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n font-weight: 400;\n margin-bottom: 21px;\n}\n\n[data-supertokens~="headerSubtitle"][data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n font-family: "Rubik", sans-serif;\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n font-family: "Rubik", sans-serif;\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n\n[data-supertokens~="withBackButton"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n\n[data-supertokens~="generalSuccess"] {\n margin-bottom: 20px;\n -webkit-animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n}\n\n[data-supertokens~="codeInputLabelWrapper"] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="headerSubtitle"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n[data-supertokens~="sendCodeText"] {\n margin-top: 15px;\n margin-bottom: 20px;\n}\n\n[data-supertokens~="sendCodeText"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n[data-supertokens~="resendCodeBtn"] {\n width: auto;\n margin-top: 0;\n line-height: 24px;\n}\n\n[data-supertokens~="resendCodeBtn"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="resendCodeBtn"]:disabled {\n color: rgb(var(--palette-textPrimary));\n cursor: default;\n text-decoration: none;\n}\n\n[data-supertokens~="phoneInputLibRoot"] {\n display: flex;\n align-items: center;\n}\n\n[data-supertokens~="phoneInputWrapper"] {\n display: flex;\n align-items: center;\n}\n\n[data-supertokens~="phoneInputWrapper"] .iti [data-supertokens~="input"] {\n padding-left: 15px;\n}\n\n[data-supertokens~="phoneInputWrapper"] .iti {\n flex: 1 1;\n min-width: 0;\n width: 100%;\n background: transparent;\n border: none;\n color: inherit;\n outline: none;\n}\n\n[data-supertokens~="continueButtonWrapper"] {\n margin-top: 10px;\n margin-bottom: 30px;\n}\n\n[data-supertokens~="footerLinkGroup"] {\n display: flex;\n justify-content: space-between;\n margin-top: 20px;\n gap: 8px;\n}\n\n[data-supertokens~="footerLinkGroup"] > div {\n margin: 0;\n}\n\n@media (max-width: 360px) {\n [data-supertokens~="footerLinkGroup"] {\n flex-direction: column;\n }\n [data-supertokens~="footerLinkGroup"] > div {\n margin: 0 auto;\n }\n}\n\n[data-supertokens~="footerLinkGroup"] div:only-child {\n margin-left: auto;\n margin-right: auto;\n}\n\n.iti__country-list {\n border: 0;\n top: 40px;\n width: min(72.2vw, 320px);\n border-radius: 6;\n box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.16);\n}\n\n.iti__country {\n display: flex;\n align-items: center;\n height: 34px;\n cursor: pointer;\n\n padding: 0 8px;\n}\n\n.iti__country-name {\n color: var(--palette-textLabel);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: "0 16px";\n}\n'; + '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 400;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 600;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n font-weight: 400;\n margin-bottom: 21px;\n}\n\n[data-supertokens~="headerSubtitle"][data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n font-family: "Rubik", sans-serif;\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n font-family: "Rubik", sans-serif;\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n\n[data-supertokens~="delayedRender"] {\n -webkit-animation-duration: 0.1s;\n animation-duration: 0.1s;\n -webkit-animation-name: animate-fade;\n animation-name: animate-fade;\n -webkit-animation-delay: 0.2s;\n animation-delay: 0.2s;\n -webkit-animation-fill-mode: backwards;\n animation-fill-mode: backwards;\n}\n\n@-webkit-keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n\n@keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n\n[data-supertokens~="footerLinkGroupVert"] {\n display: flex;\n flex-direction: column;\n margin-top: 10px;\n gap: 24px;\n}\n\n[data-supertokens~="footerLinkGroupVert"] > div {\n margin: 0;\n}\n\n[data-supertokens~="footerLinkGroupVert"] [data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n\n[data-supertokens~="footerLinkGroupVert"] [data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n position: relative;\n left: -6px; /* half the width of the left arrow */\n}\n\n@media (max-width: 360px) {\n [data-supertokens~="footerLinkGroupVert"] {\n flex-direction: column;\n }\n [data-supertokens~="footerLinkGroupVert"] > div {\n margin: 0 auto;\n }\n}\n\n[data-supertokens~="footerLinkGroupVert"] div:only-child {\n margin-left: auto;\n margin-right: auto;\n margin-top: 14px;\n}\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n\n[data-supertokens~="withBackButton"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n\n[data-supertokens~="generalSuccess"] {\n margin-bottom: 20px;\n -webkit-animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n}\n\n[data-supertokens~="codeInputLabelWrapper"] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="headerSubtitle"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n[data-supertokens~="sendCodeText"] {\n margin-top: 15px;\n margin-bottom: 20px;\n}\n\n[data-supertokens~="sendCodeText"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n[data-supertokens~="resendCodeBtn"] {\n width: auto;\n margin-top: 0;\n line-height: 24px;\n}\n\n[data-supertokens~="resendCodeBtn"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="resendCodeBtn"]:disabled {\n color: rgb(var(--palette-textPrimary));\n cursor: default;\n text-decoration: none;\n}\n\n[data-supertokens~="phoneInputLibRoot"] {\n display: flex;\n align-items: center;\n}\n\n[data-supertokens~="phoneInputWrapper"] {\n display: flex;\n align-items: center;\n}\n\n[data-supertokens~="phoneInputWrapper"] .iti [data-supertokens~="input"] {\n padding-left: 15px;\n}\n\n[data-supertokens~="phoneInputWrapper"] .iti {\n flex: 1 1;\n min-width: 0;\n width: 100%;\n background: transparent;\n border: none;\n color: inherit;\n outline: none;\n}\n\n[data-supertokens~="continueButtonWrapper"] {\n margin-top: 10px;\n margin-bottom: 30px;\n}\n\n[data-supertokens~="footerLinkGroup"] {\n display: flex;\n justify-content: space-between;\n margin-top: 20px;\n gap: 8px;\n}\n\n[data-supertokens~="footerLinkGroup"] > div {\n margin: 0;\n}\n\n@media (max-width: 360px) {\n [data-supertokens~="footerLinkGroup"] {\n flex-direction: column;\n }\n [data-supertokens~="footerLinkGroup"] > div {\n margin: 0 auto;\n }\n}\n\n[data-supertokens~="footerLinkGroup"] div:only-child {\n margin-left: auto;\n margin-right: auto;\n}\n\n.iti__country-list {\n border: 0;\n top: 40px;\n width: min(72.2vw, 320px);\n border-radius: 6;\n box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.16);\n}\n\n.iti__country {\n display: flex;\n align-items: center;\n height: 34px;\n cursor: pointer;\n\n padding: 0 8px;\n}\n\n.iti__country-name {\n color: var(--palette-textLabel);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: "0 16px";\n}\n'; var ThemeBase = function (_a) { var children = _a.children, @@ -3138,7 +3138,7 @@ var MFAFooter = uiEntry.withOverride("PasswordlessMFAFooter", function Passwordl return jsxRuntime.jsxs( "div", genericComponentOverrideContext.__assign( - { "data-supertokens": "footerLinkGroup pwlessMFAFooter" }, + { "data-supertokens": "footerLinkGroupVert pwlessMFAFooter" }, { children: [ claim.loading === false && @@ -3149,10 +3149,7 @@ var MFAFooter = uiEntry.withOverride("PasswordlessMFAFooter", function Passwordl jsxRuntime.jsx( "div", genericComponentOverrideContext.__assign( - { - "data-supertokens": "secondaryText secondaryLinkWithLeftArrow", - onClick: props.onFactorChooserButtonClicked, - }, + { "data-supertokens": "secondaryText", onClick: props.onFactorChooserButtonClicked }, { children: t("PWLESS_MFA_FOOTER_CHOOSER_ANOTHER") } ) ), @@ -3223,15 +3220,15 @@ var MFAOTPFooter = uiEntry.withOverride("PasswordlessMFAOTPFooter", function Pas return jsxRuntime.jsxs( "div", genericComponentOverrideContext.__assign( - { "data-supertokens": "footerLinkGroup pwlessMFAOTPFooter" }, + { "data-supertokens": "footerLinkGroupVert pwlessMFAOTPFooter" }, { children: [ isSetupAllowed - ? jsxRuntime.jsxs( + ? jsxRuntime.jsx( "div", genericComponentOverrideContext.__assign( { - "data-supertokens": "secondaryText secondaryLinkWithLeftArrow", + "data-supertokens": "secondaryText", onClick: function () { return recipeImplementation.clearLoginAttemptInfo({ userContext: userContext, @@ -3239,14 +3236,10 @@ var MFAOTPFooter = uiEntry.withOverride("PasswordlessMFAOTPFooter", function Pas }, }, { - children: [ - jsxRuntime.jsx(arrowLeftIcon.ArrowLeftIcon, { - color: "rgb(var(--palette-textPrimary))", - }), + children: loginAttemptInfo.contactMethod === "EMAIL" ? t("PWLESS_SIGN_IN_UP_CHANGE_CONTACT_INFO_EMAIL") : t("PWLESS_SIGN_IN_UP_CHANGE_CONTACT_INFO_PHONE"), - ], } ) ) @@ -3258,10 +3251,7 @@ var MFAOTPFooter = uiEntry.withOverride("PasswordlessMFAOTPFooter", function Pas jsxRuntime.jsx( "div", genericComponentOverrideContext.__assign( - { - "data-supertokens": "secondaryText secondaryLinkWithLeftArrow", - onClick: onFactorChooserButtonClicked, - }, + { "data-supertokens": "secondaryText", onClick: onFactorChooserButtonClicked }, { children: t("PWLESS_MFA_FOOTER_CHOOSER_ANOTHER") } ) ), @@ -3374,7 +3364,7 @@ var MFATheme = function (_a) { : jsxRuntime.jsxs( "div", genericComponentOverrideContext.__assign( - { "data-supertokens": "container" }, + { "data-supertokens": "container pwlessMFA" }, { children: [ jsxRuntime.jsx( diff --git a/lib/build/sessionprebuiltui.js b/lib/build/sessionprebuiltui.js index f54e35b29..60f00c8a6 100644 --- a/lib/build/sessionprebuiltui.js +++ b/lib/build/sessionprebuiltui.js @@ -82,7 +82,7 @@ function LogoutButton(_a) { } var styles = - '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 400;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 600;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n font-weight: 400;\n margin-bottom: 21px;\n}\n\n[data-supertokens~="headerSubtitle"][data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n font-family: "Rubik", sans-serif;\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n font-family: "Rubik", sans-serif;\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n\n/* Override */\n\n[data-supertokens~="accessDenied"] [data-supertokens~="row"] {\n padding-bottom: 24px;\n}\n\n[data-supertokens~="accessDenied"] [data-supertokens~="divider"] {\n padding: 0;\n margin: 34px 0 18px 0;\n}\n\n[data-supertokens~="accessDenied"] [data-supertokens~="headerTitle"] {\n margin: 10px 0 0 0;\n font-style: normal;\n font-weight: 700;\n font-size: 20px;\n line-height: 30px;\n}\n\n/* Override end */\n\n[data-supertokens~="center"] {\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n flex: 1 1 auto;\n}\n\n[data-supertokens~="buttonsGroup"] {\n margin-top: 34px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n\n[data-supertokens~="buttonBase"] {\n font-family: "Rubik", sans-serif;\n font-size: var(--font-size-1);\n line-height: 21px;\n font-weight: 500;\n background: transparent;\n outline: none;\n border: none;\n cursor: pointer;\n}\n\n[data-supertokens~="backButton"] {\n color: rgb(var(--palette-textLink));\n}\n\n[data-supertokens~="logoutButton"] {\n display: flex;\n align-items: center;\n gap: 6px;\n color: rgb(var(--palette-textGray));\n}\n\n[data-supertokens~="primaryText"][data-supertokens~="accessDeniedError"] {\n font-weight: 400;\n}\n'; + '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 400;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 600;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n font-weight: 400;\n margin-bottom: 21px;\n}\n\n[data-supertokens~="headerSubtitle"][data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n font-family: "Rubik", sans-serif;\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n font-family: "Rubik", sans-serif;\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n\n[data-supertokens~="delayedRender"] {\n -webkit-animation-duration: 0.1s;\n animation-duration: 0.1s;\n -webkit-animation-name: animate-fade;\n animation-name: animate-fade;\n -webkit-animation-delay: 0.2s;\n animation-delay: 0.2s;\n -webkit-animation-fill-mode: backwards;\n animation-fill-mode: backwards;\n}\n\n@-webkit-keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n\n@keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n\n[data-supertokens~="footerLinkGroupVert"] {\n display: flex;\n flex-direction: column;\n margin-top: 10px;\n gap: 24px;\n}\n\n[data-supertokens~="footerLinkGroupVert"] > div {\n margin: 0;\n}\n\n[data-supertokens~="footerLinkGroupVert"] [data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n\n[data-supertokens~="footerLinkGroupVert"] [data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n position: relative;\n left: -6px; /* half the width of the left arrow */\n}\n\n@media (max-width: 360px) {\n [data-supertokens~="footerLinkGroupVert"] {\n flex-direction: column;\n }\n [data-supertokens~="footerLinkGroupVert"] > div {\n margin: 0 auto;\n }\n}\n\n[data-supertokens~="footerLinkGroupVert"] div:only-child {\n margin-left: auto;\n margin-right: auto;\n margin-top: 14px;\n}\n\n/* Override */\n\n[data-supertokens~="accessDenied"] [data-supertokens~="row"] {\n padding-bottom: 24px;\n}\n\n[data-supertokens~="accessDenied"] [data-supertokens~="divider"] {\n padding: 0;\n margin: 34px 0 18px 0;\n}\n\n[data-supertokens~="accessDenied"] [data-supertokens~="headerTitle"] {\n margin: 10px 0 0 0;\n font-style: normal;\n font-weight: 700;\n font-size: 20px;\n line-height: 30px;\n}\n\n/* Override end */\n\n[data-supertokens~="center"] {\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n flex: 1 1 auto;\n}\n\n[data-supertokens~="buttonsGroup"] {\n margin-top: 34px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n\n[data-supertokens~="buttonBase"] {\n font-family: "Rubik", sans-serif;\n font-size: var(--font-size-1);\n line-height: 21px;\n font-weight: 500;\n background: transparent;\n outline: none;\n border: none;\n cursor: pointer;\n}\n\n[data-supertokens~="backButton"] {\n color: rgb(var(--palette-textLink));\n}\n\n[data-supertokens~="logoutButton"] {\n display: flex;\n align-items: center;\n gap: 6px;\n color: rgb(var(--palette-textGray));\n}\n\n[data-supertokens~="primaryText"][data-supertokens~="accessDeniedError"] {\n font-weight: 400;\n}\n'; var ThemeBase = function (_a) { var children = _a.children, diff --git a/lib/build/thirdparty-shared2.js b/lib/build/thirdparty-shared2.js index 120dee25f..854029f67 100644 --- a/lib/build/thirdparty-shared2.js +++ b/lib/build/thirdparty-shared2.js @@ -49,7 +49,7 @@ var React__namespace = /*#__PURE__*/ _interopNamespace(React); var STGeneralError__default = /*#__PURE__*/ _interopDefault(STGeneralError); var styles = - '[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 400;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 600;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n font-weight: 400;\n margin-bottom: 21px;\n}\n[data-supertokens~="headerSubtitle"][data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n font-family: "Rubik", sans-serif;\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n font-family: "Rubik", sans-serif;\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n[data-supertokens~="row"] {\n padding-bottom: 30px;\n}\n[data-supertokens~="providerContainer"] {\n padding-top: 9px;\n padding-bottom: 9px;\n}\n[data-supertokens~="providerButton"] {\n border-color: rgb(221, 221, 221) !important;\n}\n[data-supertokens~="providerButton"] {\n min-height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 2px 8px;\n\n background-color: white;\n color: black;\n}\n[data-supertokens~="providerButton"]:hover {\n -webkit-filter: none !important;\n filter: none !important;\n}\n[data-supertokens~="providerButton"]:hover {\n background-color: #fafafa;\n}\n[data-supertokens~="providerButtonLeft"] {\n min-width: 34px;\n margin-left: 66px;\n}\n[data-supertokens~="providerButtonLogo"] {\n height: 30px;\n display: flex;\n}\n[data-supertokens~="providerButtonLogoCenter"] {\n display: flex;\n margin: auto;\n}\n[data-supertokens~="providerButtonText"] {\n font-weight: 400;\n text-align: center;\n justify-content: center;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n display: inline-block;\n}\n[data-supertokens~="providerButtonText"]:only-child {\n margin: 0 auto;\n}\n'; + '[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 400;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 600;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n font-weight: 400;\n margin-bottom: 21px;\n}\n[data-supertokens~="headerSubtitle"][data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n font-family: "Rubik", sans-serif;\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n font-family: "Rubik", sans-serif;\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n[data-supertokens~="delayedRender"] {\n -webkit-animation-duration: 0.1s;\n animation-duration: 0.1s;\n -webkit-animation-name: animate-fade;\n animation-name: animate-fade;\n -webkit-animation-delay: 0.2s;\n animation-delay: 0.2s;\n -webkit-animation-fill-mode: backwards;\n animation-fill-mode: backwards;\n}\n@-webkit-keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n[data-supertokens~="footerLinkGroupVert"] {\n display: flex;\n flex-direction: column;\n margin-top: 10px;\n gap: 24px;\n}\n[data-supertokens~="footerLinkGroupVert"] > div {\n margin: 0;\n}\n[data-supertokens~="footerLinkGroupVert"] [data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n[data-supertokens~="footerLinkGroupVert"] [data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n position: relative;\n left: -6px; /* half the width of the left arrow */\n}\n@media (max-width: 360px) {\n [data-supertokens~="footerLinkGroupVert"] {\n flex-direction: column;\n }\n [data-supertokens~="footerLinkGroupVert"] > div {\n margin: 0 auto;\n }\n}\n[data-supertokens~="footerLinkGroupVert"] div:only-child {\n margin-left: auto;\n margin-right: auto;\n margin-top: 14px;\n}\n[data-supertokens~="row"] {\n padding-bottom: 30px;\n}\n[data-supertokens~="providerContainer"] {\n padding-top: 9px;\n padding-bottom: 9px;\n}\n[data-supertokens~="providerButton"] {\n border-color: rgb(221, 221, 221) !important;\n}\n[data-supertokens~="providerButton"] {\n min-height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 2px 8px;\n\n background-color: white;\n color: black;\n}\n[data-supertokens~="providerButton"]:hover {\n -webkit-filter: none !important;\n filter: none !important;\n}\n[data-supertokens~="providerButton"]:hover {\n background-color: #fafafa;\n}\n[data-supertokens~="providerButtonLeft"] {\n min-width: 34px;\n margin-left: 66px;\n}\n[data-supertokens~="providerButtonLogo"] {\n height: 30px;\n display: flex;\n}\n[data-supertokens~="providerButtonLogoCenter"] {\n display: flex;\n margin: auto;\n}\n[data-supertokens~="providerButtonText"] {\n font-weight: 400;\n text-align: center;\n justify-content: center;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n display: inline-block;\n}\n[data-supertokens~="providerButtonText"]:only-child {\n margin: 0 auto;\n}\n'; var ThemeBase = function (_a) { var children = _a.children, diff --git a/lib/build/thirdpartyemailpasswordprebuiltui.js b/lib/build/thirdpartyemailpasswordprebuiltui.js index fc77f6be1..a316435b8 100644 --- a/lib/build/thirdpartyemailpasswordprebuiltui.js +++ b/lib/build/thirdpartyemailpasswordprebuiltui.js @@ -81,7 +81,7 @@ var NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath var React__namespace = /*#__PURE__*/ _interopNamespace(React); var styles = - '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 400;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 600;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n font-weight: 400;\n margin-bottom: 21px;\n}\n[data-supertokens~="headerSubtitle"][data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n font-family: "Rubik", sans-serif;\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n font-family: "Rubik", sans-serif;\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n[data-supertokens~="withBackButton"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n[data-supertokens~="row"] {\n padding-bottom: 30px;\n}\n[data-supertokens~="providerContainer"] {\n padding-top: 9px;\n padding-bottom: 9px;\n}\n[data-supertokens~="providerButton"] {\n border-color: rgb(221, 221, 221) !important;\n}\n[data-supertokens~="providerButton"] {\n min-height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 2px 8px;\n\n background-color: white;\n color: black;\n}\n[data-supertokens~="providerButton"]:hover {\n -webkit-filter: none !important;\n filter: none !important;\n}\n[data-supertokens~="providerButton"]:hover {\n background-color: #fafafa;\n}\n[data-supertokens~="providerButtonLeft"] {\n min-width: 34px;\n margin-left: 66px;\n}\n[data-supertokens~="providerButtonLogo"] {\n height: 30px;\n display: flex;\n}\n[data-supertokens~="providerButtonLogoCenter"] {\n display: flex;\n margin: auto;\n}\n[data-supertokens~="providerButtonText"] {\n font-weight: 400;\n text-align: center;\n justify-content: center;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n display: inline-block;\n}\n[data-supertokens~="providerButtonText"]:only-child {\n margin: 0 auto;\n}\n[data-supertokens~="thirdPartyEmailPasswordDivider"] {\n padding-top: 5px;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="thirdPartyEmailPasswordDividerOr"] {\n flex: 1 1;\n margin-top: 0.75em;\n}\n[data-supertokens~="divider"] {\n flex: 3 3;\n}\n[data-supertokens~="providerButton"] {\n margin: auto !important;\n max-width: 240px !important;\n}\n[data-supertokens~="providerButtonLeft"] {\n margin-left: 30px !important;\n}\n'; + '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 400;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 600;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n font-weight: 400;\n margin-bottom: 21px;\n}\n[data-supertokens~="headerSubtitle"][data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n font-family: "Rubik", sans-serif;\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n font-family: "Rubik", sans-serif;\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n[data-supertokens~="delayedRender"] {\n -webkit-animation-duration: 0.1s;\n animation-duration: 0.1s;\n -webkit-animation-name: animate-fade;\n animation-name: animate-fade;\n -webkit-animation-delay: 0.2s;\n animation-delay: 0.2s;\n -webkit-animation-fill-mode: backwards;\n animation-fill-mode: backwards;\n}\n@-webkit-keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n[data-supertokens~="footerLinkGroupVert"] {\n display: flex;\n flex-direction: column;\n margin-top: 10px;\n gap: 24px;\n}\n[data-supertokens~="footerLinkGroupVert"] > div {\n margin: 0;\n}\n[data-supertokens~="footerLinkGroupVert"] [data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n[data-supertokens~="footerLinkGroupVert"] [data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n position: relative;\n left: -6px; /* half the width of the left arrow */\n}\n@media (max-width: 360px) {\n [data-supertokens~="footerLinkGroupVert"] {\n flex-direction: column;\n }\n [data-supertokens~="footerLinkGroupVert"] > div {\n margin: 0 auto;\n }\n}\n[data-supertokens~="footerLinkGroupVert"] div:only-child {\n margin-left: auto;\n margin-right: auto;\n margin-top: 14px;\n}\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n[data-supertokens~="withBackButton"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n[data-supertokens~="row"] {\n padding-bottom: 30px;\n}\n[data-supertokens~="providerContainer"] {\n padding-top: 9px;\n padding-bottom: 9px;\n}\n[data-supertokens~="providerButton"] {\n border-color: rgb(221, 221, 221) !important;\n}\n[data-supertokens~="providerButton"] {\n min-height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 2px 8px;\n\n background-color: white;\n color: black;\n}\n[data-supertokens~="providerButton"]:hover {\n -webkit-filter: none !important;\n filter: none !important;\n}\n[data-supertokens~="providerButton"]:hover {\n background-color: #fafafa;\n}\n[data-supertokens~="providerButtonLeft"] {\n min-width: 34px;\n margin-left: 66px;\n}\n[data-supertokens~="providerButtonLogo"] {\n height: 30px;\n display: flex;\n}\n[data-supertokens~="providerButtonLogoCenter"] {\n display: flex;\n margin: auto;\n}\n[data-supertokens~="providerButtonText"] {\n font-weight: 400;\n text-align: center;\n justify-content: center;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n display: inline-block;\n}\n[data-supertokens~="providerButtonText"]:only-child {\n margin: 0 auto;\n}\n[data-supertokens~="thirdPartyEmailPasswordDivider"] {\n padding-top: 5px;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="thirdPartyEmailPasswordDividerOr"] {\n flex: 1 1;\n margin-top: 0.75em;\n}\n[data-supertokens~="divider"] {\n flex: 3 3;\n}\n[data-supertokens~="providerButton"] {\n margin: auto !important;\n max-width: 240px !important;\n}\n[data-supertokens~="providerButtonLeft"] {\n margin-left: 30px !important;\n}\n'; var ThemeBase = function (_a) { var children = _a.children, diff --git a/lib/build/thirdpartypasswordlessprebuiltui.js b/lib/build/thirdpartypasswordlessprebuiltui.js index 1da5b7e9d..8e599455d 100644 --- a/lib/build/thirdpartypasswordlessprebuiltui.js +++ b/lib/build/thirdpartypasswordlessprebuiltui.js @@ -82,7 +82,7 @@ var NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath var React__namespace = /*#__PURE__*/ _interopNamespace(React); var styles = - '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 400;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 600;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n font-weight: 400;\n margin-bottom: 21px;\n}\n[data-supertokens~="headerSubtitle"][data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n font-family: "Rubik", sans-serif;\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n font-family: "Rubik", sans-serif;\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n[data-supertokens~="withBackButton"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n[data-supertokens~="generalSuccess"] {\n margin-bottom: 20px;\n -webkit-animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n}\n[data-supertokens~="codeInputLabelWrapper"] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="headerSubtitle"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n[data-supertokens~="sendCodeText"] {\n margin-top: 15px;\n margin-bottom: 20px;\n}\n[data-supertokens~="sendCodeText"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n[data-supertokens~="resendCodeBtn"] {\n width: auto;\n margin-top: 0;\n line-height: 24px;\n}\n[data-supertokens~="resendCodeBtn"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="resendCodeBtn"]:disabled {\n color: rgb(var(--palette-textPrimary));\n cursor: default;\n text-decoration: none;\n}\n[data-supertokens~="phoneInputLibRoot"] {\n display: flex;\n align-items: center;\n}\n[data-supertokens~="phoneInputWrapper"] {\n display: flex;\n align-items: center;\n}\n[data-supertokens~="phoneInputWrapper"] .iti [data-supertokens~="input"] {\n padding-left: 15px;\n}\n[data-supertokens~="phoneInputWrapper"] .iti {\n flex: 1 1;\n min-width: 0;\n width: 100%;\n background: transparent;\n border: none;\n color: inherit;\n outline: none;\n}\n[data-supertokens~="continueButtonWrapper"] {\n margin-top: 10px;\n margin-bottom: 30px;\n}\n[data-supertokens~="footerLinkGroup"] {\n display: flex;\n justify-content: space-between;\n margin-top: 20px;\n gap: 8px;\n}\n[data-supertokens~="footerLinkGroup"] > div {\n margin: 0;\n}\n@media (max-width: 360px) {\n [data-supertokens~="footerLinkGroup"] {\n flex-direction: column;\n }\n [data-supertokens~="footerLinkGroup"] > div {\n margin: 0 auto;\n }\n}\n[data-supertokens~="footerLinkGroup"] div:only-child {\n margin-left: auto;\n margin-right: auto;\n}\n.iti__country-list {\n border: 0;\n top: 40px;\n width: min(72.2vw, 320px);\n border-radius: 6;\n box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.16);\n}\n.iti__country {\n display: flex;\n align-items: center;\n height: 34px;\n cursor: pointer;\n\n padding: 0 8px;\n}\n.iti__country-name {\n color: var(--palette-textLabel);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: "0 16px";\n}\n[data-supertokens~="row"] {\n padding-bottom: 30px;\n}\n[data-supertokens~="providerContainer"] {\n padding-top: 9px;\n padding-bottom: 9px;\n}\n[data-supertokens~="providerButton"] {\n border-color: rgb(221, 221, 221) !important;\n}\n[data-supertokens~="providerButton"] {\n min-height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 2px 8px;\n\n background-color: white;\n color: black;\n}\n[data-supertokens~="providerButton"]:hover {\n -webkit-filter: none !important;\n filter: none !important;\n}\n[data-supertokens~="providerButton"]:hover {\n background-color: #fafafa;\n}\n[data-supertokens~="providerButtonLeft"] {\n min-width: 34px;\n margin-left: 66px;\n}\n[data-supertokens~="providerButtonLogo"] {\n height: 30px;\n display: flex;\n}\n[data-supertokens~="providerButtonLogoCenter"] {\n display: flex;\n margin: auto;\n}\n[data-supertokens~="providerButtonText"] {\n font-weight: 400;\n text-align: center;\n justify-content: center;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n display: inline-block;\n}\n[data-supertokens~="providerButtonText"]:only-child {\n margin: 0 auto;\n}\n[data-supertokens~="thirdPartyPasswordlessDivider"] {\n padding-top: 5px;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="thirdPartyPasswordlessDividerText"] {\n flex: 1 1;\n margin-top: 0.75em;\n}\n[data-supertokens~="divider"] {\n flex: 3 3;\n}\n[data-supertokens~="providerButton"] {\n margin: auto !important;\n max-width: 240px !important;\n}\n[data-supertokens~="providerButtonLeft"] {\n margin-left: 30px !important;\n}\n'; + '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 400;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 600;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n font-weight: 400;\n margin-bottom: 21px;\n}\n[data-supertokens~="headerSubtitle"][data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n font-family: "Rubik", sans-serif;\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n font-family: "Rubik", sans-serif;\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n[data-supertokens~="delayedRender"] {\n -webkit-animation-duration: 0.1s;\n animation-duration: 0.1s;\n -webkit-animation-name: animate-fade;\n animation-name: animate-fade;\n -webkit-animation-delay: 0.2s;\n animation-delay: 0.2s;\n -webkit-animation-fill-mode: backwards;\n animation-fill-mode: backwards;\n}\n@-webkit-keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n[data-supertokens~="footerLinkGroupVert"] {\n display: flex;\n flex-direction: column;\n margin-top: 10px;\n gap: 24px;\n}\n[data-supertokens~="footerLinkGroupVert"] > div {\n margin: 0;\n}\n[data-supertokens~="footerLinkGroupVert"] [data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n[data-supertokens~="footerLinkGroupVert"] [data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n position: relative;\n left: -6px; /* half the width of the left arrow */\n}\n@media (max-width: 360px) {\n [data-supertokens~="footerLinkGroupVert"] {\n flex-direction: column;\n }\n [data-supertokens~="footerLinkGroupVert"] > div {\n margin: 0 auto;\n }\n}\n[data-supertokens~="footerLinkGroupVert"] div:only-child {\n margin-left: auto;\n margin-right: auto;\n margin-top: 14px;\n}\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n[data-supertokens~="withBackButton"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n[data-supertokens~="generalSuccess"] {\n margin-bottom: 20px;\n -webkit-animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n}\n[data-supertokens~="codeInputLabelWrapper"] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="headerSubtitle"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n[data-supertokens~="sendCodeText"] {\n margin-top: 15px;\n margin-bottom: 20px;\n}\n[data-supertokens~="sendCodeText"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n[data-supertokens~="resendCodeBtn"] {\n width: auto;\n margin-top: 0;\n line-height: 24px;\n}\n[data-supertokens~="resendCodeBtn"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="resendCodeBtn"]:disabled {\n color: rgb(var(--palette-textPrimary));\n cursor: default;\n text-decoration: none;\n}\n[data-supertokens~="phoneInputLibRoot"] {\n display: flex;\n align-items: center;\n}\n[data-supertokens~="phoneInputWrapper"] {\n display: flex;\n align-items: center;\n}\n[data-supertokens~="phoneInputWrapper"] .iti [data-supertokens~="input"] {\n padding-left: 15px;\n}\n[data-supertokens~="phoneInputWrapper"] .iti {\n flex: 1 1;\n min-width: 0;\n width: 100%;\n background: transparent;\n border: none;\n color: inherit;\n outline: none;\n}\n[data-supertokens~="continueButtonWrapper"] {\n margin-top: 10px;\n margin-bottom: 30px;\n}\n[data-supertokens~="footerLinkGroup"] {\n display: flex;\n justify-content: space-between;\n margin-top: 20px;\n gap: 8px;\n}\n[data-supertokens~="footerLinkGroup"] > div {\n margin: 0;\n}\n@media (max-width: 360px) {\n [data-supertokens~="footerLinkGroup"] {\n flex-direction: column;\n }\n [data-supertokens~="footerLinkGroup"] > div {\n margin: 0 auto;\n }\n}\n[data-supertokens~="footerLinkGroup"] div:only-child {\n margin-left: auto;\n margin-right: auto;\n}\n.iti__country-list {\n border: 0;\n top: 40px;\n width: min(72.2vw, 320px);\n border-radius: 6;\n box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.16);\n}\n.iti__country {\n display: flex;\n align-items: center;\n height: 34px;\n cursor: pointer;\n\n padding: 0 8px;\n}\n.iti__country-name {\n color: var(--palette-textLabel);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: "0 16px";\n}\n[data-supertokens~="row"] {\n padding-bottom: 30px;\n}\n[data-supertokens~="providerContainer"] {\n padding-top: 9px;\n padding-bottom: 9px;\n}\n[data-supertokens~="providerButton"] {\n border-color: rgb(221, 221, 221) !important;\n}\n[data-supertokens~="providerButton"] {\n min-height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 2px 8px;\n\n background-color: white;\n color: black;\n}\n[data-supertokens~="providerButton"]:hover {\n -webkit-filter: none !important;\n filter: none !important;\n}\n[data-supertokens~="providerButton"]:hover {\n background-color: #fafafa;\n}\n[data-supertokens~="providerButtonLeft"] {\n min-width: 34px;\n margin-left: 66px;\n}\n[data-supertokens~="providerButtonLogo"] {\n height: 30px;\n display: flex;\n}\n[data-supertokens~="providerButtonLogoCenter"] {\n display: flex;\n margin: auto;\n}\n[data-supertokens~="providerButtonText"] {\n font-weight: 400;\n text-align: center;\n justify-content: center;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n display: inline-block;\n}\n[data-supertokens~="providerButtonText"]:only-child {\n margin: 0 auto;\n}\n[data-supertokens~="thirdPartyPasswordlessDivider"] {\n padding-top: 5px;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="thirdPartyPasswordlessDividerText"] {\n flex: 1 1;\n margin-top: 0.75em;\n}\n[data-supertokens~="divider"] {\n flex: 3 3;\n}\n[data-supertokens~="providerButton"] {\n margin: auto !important;\n max-width: 240px !important;\n}\n[data-supertokens~="providerButtonLeft"] {\n margin-left: 30px !important;\n}\n'; var ThemeBase = function (_a) { var children = _a.children, diff --git a/lib/ts/components/assets/otpEmailIcon.tsx b/lib/ts/components/assets/otpEmailIcon.tsx new file mode 100644 index 000000000..665747f81 --- /dev/null +++ b/lib/ts/components/assets/otpEmailIcon.tsx @@ -0,0 +1,17 @@ +export const OTPEmailIcon = () => ( + + + + + + + + + +); diff --git a/lib/ts/components/assets/otpIcon.tsx b/lib/ts/components/assets/otpIcon.tsx deleted file mode 100644 index 5c0e1c977..000000000 --- a/lib/ts/components/assets/otpIcon.tsx +++ /dev/null @@ -1,32 +0,0 @@ -export const OTPIcon = () => ( - - - - - - - - - - - - -); diff --git a/lib/ts/components/assets/otpSMSIcon.tsx b/lib/ts/components/assets/otpSMSIcon.tsx new file mode 100644 index 000000000..8e0864e81 --- /dev/null +++ b/lib/ts/components/assets/otpSMSIcon.tsx @@ -0,0 +1,17 @@ +export const OTPSMSIcon = () => ( + + + + + + + + + +); diff --git a/lib/ts/recipe/passwordless/components/themes/mfa/index.tsx b/lib/ts/recipe/passwordless/components/themes/mfa/index.tsx index 21ceec163..0b2639ed5 100644 --- a/lib/ts/recipe/passwordless/components/themes/mfa/index.tsx +++ b/lib/ts/recipe/passwordless/components/themes/mfa/index.tsx @@ -71,7 +71,7 @@ const MFATheme: React.FC = ({ ) : activeScreen === MFAScreens.AccessDenied ? ( ) : ( -
+
{ diff --git a/lib/ts/recipe/passwordless/components/themes/mfa/mfaFooter.tsx b/lib/ts/recipe/passwordless/components/themes/mfa/mfaFooter.tsx index fa900ae8d..8d9f9636e 100644 --- a/lib/ts/recipe/passwordless/components/themes/mfa/mfaFooter.tsx +++ b/lib/ts/recipe/passwordless/components/themes/mfa/mfaFooter.tsx @@ -28,11 +28,9 @@ export const MFAFooter = withOverride( const claim = useClaimValue(MultiFactorAuthClaim); return ( -
+
{claim.loading === false && (claim.value?.n.length ?? 0) > 1 && ( -
+
{t("PWLESS_MFA_FOOTER_CHOOSER_ANOTHER")}
)} diff --git a/lib/ts/recipe/passwordless/components/themes/mfa/mfaOTPFooter.tsx b/lib/ts/recipe/passwordless/components/themes/mfa/mfaOTPFooter.tsx index 7a0d25d1e..0a04ddc6e 100644 --- a/lib/ts/recipe/passwordless/components/themes/mfa/mfaOTPFooter.tsx +++ b/lib/ts/recipe/passwordless/components/themes/mfa/mfaOTPFooter.tsx @@ -35,16 +35,15 @@ export const MFAOTPFooter = withOverride( const userContext = useUserContext(); return ( -
+
{isSetupAllowed ? (
recipeImplementation.clearLoginAttemptInfo({ userContext, }) }> - {loginAttemptInfo.contactMethod === "EMAIL" ? t("PWLESS_SIGN_IN_UP_CHANGE_CONTACT_INFO_EMAIL") : t("PWLESS_SIGN_IN_UP_CHANGE_CONTACT_INFO_PHONE")} @@ -52,9 +51,7 @@ export const MFAOTPFooter = withOverride( ) : ( claim.loading === false && (claim.value?.n.length ?? 0) > 1 && ( -
+
{t("PWLESS_MFA_FOOTER_CHOOSER_ANOTHER")}
) diff --git a/lib/ts/recipe/passwordless/recipe.tsx b/lib/ts/recipe/passwordless/recipe.tsx index c8036547a..983171615 100644 --- a/lib/ts/recipe/passwordless/recipe.tsx +++ b/lib/ts/recipe/passwordless/recipe.tsx @@ -20,7 +20,8 @@ import PasswordlessWebJS from "supertokens-web-js/recipe/passwordless"; import { PostSuperTokensInitCallbacks } from "supertokens-web-js/utils/postSuperTokensInitCallbacks"; -import { OTPIcon } from "../../components/assets/otpIcon"; +import { OTPEmailIcon } from "../../components/assets/otpEmailIcon"; +import { OTPSMSIcon } from "../../components/assets/otpSMSIcon"; import { SSR_ERROR } from "../../constants"; import { isTest } from "../../utils"; import AuthRecipe from "../authRecipe"; @@ -45,14 +46,14 @@ export const otpPhoneFactor = { name: "SMS based OTP", description: "Get an OTP code on your phone to complete the authentication request", path: "/mfa/otp-phone", - logo: OTPIcon, + logo: OTPSMSIcon, }; export const otpEmailFactor = { id: "otp-email", name: "Email based OTP", description: "Get an OTP code on your email address to complete the authentication request", path: "/mfa/otp-email", - logo: OTPIcon, + logo: OTPEmailIcon, }; export const passwordlessFactors = ["otp-phone", "otp-email", "link-phone", "link-email"] as const; diff --git a/lib/ts/styles/styles.css b/lib/ts/styles/styles.css index effc1138b..69ccc2bd0 100644 --- a/lib/ts/styles/styles.css +++ b/lib/ts/styles/styles.css @@ -276,3 +276,55 @@ [data-supertokens~="backButtonPlaceholder"] { display: block; } + +[data-supertokens~="delayedRender"] { + animation-duration: 0.1s; + animation-name: animate-fade; + animation-delay: 0.2s; + animation-fill-mode: backwards; +} + +@keyframes animate-fade { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} + +[data-supertokens~="footerLinkGroupVert"] { + display: flex; + flex-direction: column; + margin-top: 10px; + gap: 24px; +} + +[data-supertokens~="footerLinkGroupVert"] > div { + margin: 0; +} + +[data-supertokens~="footerLinkGroupVert"] [data-supertokens~="secondaryText"] { + font-weight: 400; +} + +[data-supertokens~="footerLinkGroupVert"] [data-supertokens~="secondaryLinkWithLeftArrow"] { + font-weight: 500; + position: relative; + left: -6px; /* half the width of the left arrow */ +} + +@media (max-width: 360px) { + [data-supertokens~="footerLinkGroupVert"] { + flex-direction: column; + } + [data-supertokens~="footerLinkGroupVert"] > div { + margin: 0 auto; + } +} + +[data-supertokens~="footerLinkGroupVert"] div:only-child { + margin-left: auto; + margin-right: auto; + margin-top: 14px; +} diff --git a/package-lock.json b/package-lock.json index 2809adab6..1b2553f7a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,6 +40,7 @@ "@typescript-eslint/parser": "4.6.0", "babel-jest": "^29.3.1", "chokidar-cli": "^3.0.0", + "chromatic": "^9.0.0", "eslint": "^6.8.0", "eslint-plugin-import": "^2.27.5", "eslint-plugin-react": "^7.28.0", diff --git a/package.json b/package.json index 6b7dc6478..5eaa622df 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "@typescript-eslint/parser": "4.6.0", "babel-jest": "^29.3.1", "chokidar-cli": "^3.0.0", + "chromatic": "^9.0.0", "eslint": "^6.8.0", "eslint-plugin-import": "^2.27.5", "eslint-plugin-react": "^7.28.0", From a4c0095e5c7d7af01ea68a141bdd552d6185897b Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Thu, 16 Nov 2023 21:53:42 +0100 Subject: [PATCH 27/35] refactor: self-review fixes --- lib/build/passwordless-shared2.js | 1 - lib/build/passwordless-shared3.js | 56 ++++++++----------- lib/build/passwordlessprebuiltui.js | 2 + .../components/features/mfa/index.d.ts | 8 --- lib/build/recipe/passwordless/prebuiltui.d.ts | 8 ++- lib/build/recipe/passwordless/types.d.ts | 2 +- .../components/features/mfa/index.tsx | 54 ++++-------------- .../components/themes/mfa/index.tsx | 7 --- lib/ts/recipe/passwordless/prebuiltui.tsx | 8 ++- lib/ts/recipe/passwordless/types.ts | 2 +- lib/ts/recipe/passwordless/utils.ts | 1 - package-lock.json | 1 - package.json | 1 - 13 files changed, 49 insertions(+), 102 deletions(-) diff --git a/lib/build/passwordless-shared2.js b/lib/build/passwordless-shared2.js index 51f2020a3..587ae52dd 100644 --- a/lib/build/passwordless-shared2.js +++ b/lib/build/passwordless-shared2.js @@ -576,7 +576,6 @@ function getEnabledContactMethods(contactMethod, currentDynamicLoginMethods) { } } if (enabledContactMethods.length === 0) { - // It should never get here, but as a sanity check this is fine throw new Error("The enabled contact method is not a superset of the requested first factors"); } return enabledContactMethods; diff --git a/lib/build/passwordless-shared3.js b/lib/build/passwordless-shared3.js index 9f3637650..570f15976 100644 --- a/lib/build/passwordless-shared3.js +++ b/lib/build/passwordless-shared3.js @@ -3334,9 +3334,6 @@ var MFAScreens; MFAScreens[(MFAScreens["UserInputCodeForm"] = 3)] = "UserInputCodeForm"; MFAScreens[(MFAScreens["AccessDenied"] = 4)] = "AccessDenied"; })(MFAScreens || (MFAScreens = {})); -/* - * Component. - */ var MFATheme = function (_a) { var activeScreen = _a.activeScreen, featureState = _a.featureState, @@ -3477,7 +3474,6 @@ function MFAThemeWrapper(props) { } else if (activeScreen === MFAScreens.PhoneForm) { activeStyle = props.config.signInUpFeature.emailOrPhoneFormStyle; } else { - // TODO: test activeStyle = ""; // styling the access denied screen is handled through the session recipe } return jsxRuntime.jsx( @@ -3597,7 +3593,7 @@ var useFeatureReducer$1 = function () { genericComponentOverrideContext.__assign({}, oldState), { loaded: true, error: action.error } ); - case "startLogin": + case "startVerify": return genericComponentOverrideContext.__assign( genericComponentOverrideContext.__assign({}, oldState), { @@ -3626,15 +3622,8 @@ var useFeatureReducer$1 = function () { function (initArg) { var error = undefined; var errorQueryParam = genericComponentOverrideContext.getQueryParams("error"); - var messageQueryParam = genericComponentOverrideContext.getQueryParams("message"); if (errorQueryParam !== null) { - if (errorQueryParam === "signin") { - error = "SOMETHING_WENT_WRONG_ERROR"; - } else if (errorQueryParam === "restart_link") { - error = "ERROR_SIGN_IN_UP_LINK"; - } else if (errorQueryParam === "custom" && messageQueryParam !== null) { - error = messageQueryParam; - } + error = "SOMETHING_WENT_WRONG_ERROR"; } return genericComponentOverrideContext.__assign(genericComponentOverrideContext.__assign({}, initArg), { error: error, @@ -3646,9 +3635,6 @@ function useChildProps$1(recipe$1, recipeImplementation, state, contactMethod, u var _this = this; return React.useMemo( function () { - if (!recipe$1 || !recipeImplementation) { - return undefined; - } return { onSuccess: function () { return recipe.Session.getInstanceOrThrow().validateGlobalClaimsAndHandleSuccessRedirection( @@ -3812,28 +3798,15 @@ function useOnLoad(props, recipeImplementation, dispatch, userContext) { var onLoad = React__namespace.useCallback( function (mfaInfo) { return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { - var error, - errorQueryParam, - messageQueryParam, - doSetup, - loginAttemptInfo, - isAlreadySetup, - isAllowedToSetup; + var error, errorQueryParam, doSetup, loginAttemptInfo, isAlreadySetup, isAllowedToSetup; return genericComponentOverrideContext.__generator(this, function (_a) { switch (_a.label) { case 0: error = undefined; errorQueryParam = genericComponentOverrideContext.getQueryParams("error"); - messageQueryParam = genericComponentOverrideContext.getQueryParams("message"); doSetup = genericComponentOverrideContext.getQueryParams("setup"); if (errorQueryParam !== null) { - if (errorQueryParam === "signin") { - error = "SOMETHING_WENT_WRONG_ERROR"; - } else if (errorQueryParam === "restart_link") { - error = "ERROR_SIGN_IN_UP_LINK"; - } else if (errorQueryParam === "custom" && messageQueryParam !== null) { - error = messageQueryParam; - } + error = "SOMETHING_WENT_WRONG_ERROR"; } return [ 4 /*yield*/, @@ -4008,7 +3981,7 @@ function getModifiedRecipeImplementation$1(originalImpl, config, dispatch, calli ]; case 3: loginAttemptInfo = _a.sent(); - dispatch({ type: "startLogin", loginAttemptInfo: loginAttemptInfo }); + dispatch({ type: "startVerify", loginAttemptInfo: loginAttemptInfo }); _a.label = 4; case 4: return [2 /*return*/, res]; @@ -4076,8 +4049,9 @@ function getModifiedRecipeImplementation$1(originalImpl, config, dispatch, calli return genericComponentOverrideContext.__generator(this, function (_a) { switch (_a.label) { case 0: - // We need to call consume code while callingConsume, so we don't detect - // the session creation too early and go to successInAnotherTab too early + // We need to set call callingConsumeCodeRef to true while consumeCode is running, + // so we don't detect the login attempt disappearing too early and + // go to successInAnotherTab too early callingConsumeCodeRef.current = true; return [4 /*yield*/, originalImpl.consumeCode(input)]; case 1: @@ -4095,6 +4069,8 @@ function getModifiedRecipeImplementation$1(originalImpl, config, dispatch, calli return [3 /*break*/, 7]; case 3: if (!(res.status === "SIGN_IN_UP_NOT_ALLOWED")) return [3 /*break*/, 5]; + // This should never happen, but technically possible based on the API specs + // so we keep this here to cover all cases return [ 4 /*yield*/, originalImpl.clearLoginAttemptInfo({ @@ -4102,6 +4078,8 @@ function getModifiedRecipeImplementation$1(originalImpl, config, dispatch, calli }), ]; case 4: + // This should never happen, but technically possible based on the API specs + // so we keep this here to cover all cases _a.sent(); dispatch({ type: "restartFlow", error: res.reason }); return [3 /*break*/, 7]; @@ -5638,17 +5616,27 @@ var PasswordlessPreBuiltUI = /** @class */ (function (_super) { PasswordlessPreBuiltUI.LinkClicked = function (prop) { return _a.getFeatureComponent("linkClickedScreen", prop); }; + PasswordlessPreBuiltUI.MfaOtpPhone = function (prop) { + return _a.getFeatureComponent("otp-phone", prop); + }; + PasswordlessPreBuiltUI.MfaOtpEmail = function (prop) { + return _a.getFeatureComponent("otp-email", prop); + }; PasswordlessPreBuiltUI.SignInUpTheme = SignInUpThemeWrapper; return PasswordlessPreBuiltUI; })(uiEntry.RecipeRouter); var SignInUp = PasswordlessPreBuiltUI.SignInUp; var LinkClicked = PasswordlessPreBuiltUI.LinkClicked; +var MfaOtpPhone = PasswordlessPreBuiltUI.MfaOtpPhone; +var MfaOtpEmail = PasswordlessPreBuiltUI.MfaOtpEmail; exports.CloseTabScreen = CloseTabScreen; exports.EmailForm = EmailForm; exports.EmailOrPhoneForm = EmailOrPhoneForm; exports.LinkClicked = LinkClicked; exports.LinkSent = LinkSent; +exports.MfaOtpEmail = MfaOtpEmail; +exports.MfaOtpPhone = MfaOtpPhone; exports.PasswordlessPreBuiltUI = PasswordlessPreBuiltUI; exports.PhoneForm = PhoneForm; exports.SignInUp = SignInUp; diff --git a/lib/build/passwordlessprebuiltui.js b/lib/build/passwordlessprebuiltui.js index ce3dbc180..b360b58e7 100644 --- a/lib/build/passwordlessprebuiltui.js +++ b/lib/build/passwordlessprebuiltui.js @@ -43,6 +43,8 @@ require("supertokens-web-js/recipe/passwordless"); require("./authRecipe-shared.js"); exports.LinkClicked = passwordlessprebuiltui.LinkClicked; +exports.MfaOtpEmail = passwordlessprebuiltui.MfaOtpEmail; +exports.MfaOtpPhone = passwordlessprebuiltui.MfaOtpPhone; exports.PasswordlessPreBuiltUI = passwordlessprebuiltui.PasswordlessPreBuiltUI; exports.SignInUp = passwordlessprebuiltui.SignInUp; exports.SignInUpTheme = passwordlessprebuiltui.SignInUpThemeWrapper; diff --git a/lib/build/recipe/passwordless/components/features/mfa/index.d.ts b/lib/build/recipe/passwordless/components/features/mfa/index.d.ts index a408f8cad..2b32343e7 100644 --- a/lib/build/recipe/passwordless/components/features/mfa/index.d.ts +++ b/lib/build/recipe/passwordless/components/features/mfa/index.d.ts @@ -21,14 +21,6 @@ export declare function useChildProps( userContext: any, history: any ): MFAChildProps; -export declare function useChildProps( - recipe: Recipe | undefined, - recipeImplementation: RecipeInterface, - state: MFAState, - contactMethod: "PHONE" | "EMAIL", - userContext: any, - history: any -): MFAChildProps | undefined; export declare const MFAFeature: React.FC< FeatureBaseProps & { contactMethod: "PHONE" | "EMAIL"; diff --git a/lib/build/recipe/passwordless/prebuiltui.d.ts b/lib/build/recipe/passwordless/prebuiltui.d.ts index d278feb79..a68abcdc8 100644 --- a/lib/build/recipe/passwordless/prebuiltui.d.ts +++ b/lib/build/recipe/passwordless/prebuiltui.d.ts @@ -11,7 +11,7 @@ export declare class PasswordlessPreBuiltUI extends RecipeRouter { static getInstanceOrInitAndGetInstance(): PasswordlessPreBuiltUI; static getFeatures(useComponentOverrides?: () => GenericComponentOverrideMap): RecipeFeatureComponentMap; static getFeatureComponent( - componentName: "signInUp" | "linkClickedScreen", + componentName: "signInUp" | "linkClickedScreen" | "otp-phone" | "otp-email", props: FeatureBaseProps & { redirectOnSessionExists?: boolean; userContext?: any; @@ -35,6 +35,8 @@ export declare class PasswordlessPreBuiltUI extends RecipeRouter { }> ) => JSX.Element; static LinkClicked: (prop?: any) => JSX.Element; + static MfaOtpPhone: (prop?: any) => JSX.Element; + static MfaOtpEmail: (prop?: any) => JSX.Element; static SignInUpTheme: typeof SignInUpTheme; } declare const SignInUp: ( @@ -44,4 +46,6 @@ declare const SignInUp: ( }> ) => JSX.Element; declare const LinkClicked: (prop?: any) => JSX.Element; -export { SignInUp, LinkClicked, SignInUpTheme }; +declare const MfaOtpPhone: (prop?: any) => JSX.Element; +declare const MfaOtpEmail: (prop?: any) => JSX.Element; +export { SignInUp, LinkClicked, SignInUpTheme, MfaOtpPhone, MfaOtpEmail }; diff --git a/lib/build/recipe/passwordless/types.d.ts b/lib/build/recipe/passwordless/types.d.ts index e8e91a30f..789f073f9 100644 --- a/lib/build/recipe/passwordless/types.d.ts +++ b/lib/build/recipe/passwordless/types.d.ts @@ -260,7 +260,7 @@ export declare type MFAAction = error: string | undefined; } | { - type: "startLogin"; + type: "startVerify"; loginAttemptInfo: LoginAttemptInfo; } | { diff --git a/lib/ts/recipe/passwordless/components/features/mfa/index.tsx b/lib/ts/recipe/passwordless/components/features/mfa/index.tsx index 6c0b3f9c3..060f974ed 100644 --- a/lib/ts/recipe/passwordless/components/features/mfa/index.tsx +++ b/lib/ts/recipe/passwordless/components/features/mfa/index.tsx @@ -113,7 +113,7 @@ export const useFeatureReducer = (): [MFAState, React.Dispatch] => { loaded: true, error: action.error, }; - case "startLogin": + case "startVerify": return { ...oldState, loaded: true, @@ -140,15 +140,8 @@ export const useFeatureReducer = (): [MFAState, React.Dispatch] => { (initArg) => { let error: string | undefined = undefined; const errorQueryParam = getQueryParams("error"); - const messageQueryParam = getQueryParams("message"); if (errorQueryParam !== null) { - if (errorQueryParam === "signin") { - error = "SOMETHING_WENT_WRONG_ERROR"; - } else if (errorQueryParam === "restart_link") { - error = "ERROR_SIGN_IN_UP_LINK"; - } else if (errorQueryParam === "custom" && messageQueryParam !== null) { - error = messageQueryParam; - } + error = "SOMETHING_WENT_WRONG_ERROR"; } return { ...initArg, @@ -158,7 +151,6 @@ export const useFeatureReducer = (): [MFAState, React.Dispatch] => { ); }; -// We are overloading to explicitly state that if recipe is defined then the return value is defined as well. export function useChildProps( recipe: Recipe, recipeImplementation: RecipeInterface, @@ -166,28 +158,8 @@ export function useChildProps( contactMethod: "PHONE" | "EMAIL", userContext: any, history: any -): MFAChildProps; -export function useChildProps( - recipe: Recipe | undefined, - recipeImplementation: RecipeInterface, - state: MFAState, - contactMethod: "PHONE" | "EMAIL", - userContext: any, - history: any -): MFAChildProps | undefined; - -export function useChildProps( - recipe: Recipe | undefined, - recipeImplementation: RecipeInterface, - state: MFAState, - contactMethod: "PHONE" | "EMAIL", - userContext: any, - history: any -): MFAChildProps | undefined { +): MFAChildProps { return useMemo(() => { - if (!recipe || !recipeImplementation) { - return undefined; - } return { onSuccess: () => { return SessionRecipe.getInstanceOrThrow().validateGlobalClaimsAndHandleSuccessRedirection( @@ -316,16 +288,9 @@ function useOnLoad( async (mfaInfo: { factors: MFAFactorInfo; email?: string; phoneNumber?: string }) => { let error: string | undefined = undefined; const errorQueryParam = getQueryParams("error"); - const messageQueryParam = getQueryParams("message"); const doSetup = getQueryParams("setup"); if (errorQueryParam !== null) { - if (errorQueryParam === "signin") { - error = "SOMETHING_WENT_WRONG_ERROR"; - } else if (errorQueryParam === "restart_link") { - error = "ERROR_SIGN_IN_UP_LINK"; - } else if (errorQueryParam === "custom" && messageQueryParam !== null) { - error = messageQueryParam; - } + error = "SOMETHING_WENT_WRONG_ERROR"; } const loginAttemptInfo = await recipeImplementation.getLoginAttemptInfo({ @@ -418,7 +383,6 @@ function getModifiedRecipeImplementation( } // This contactMethod refers to the one that was used to deliver the login info - // This can be an important distinction in case both email and phone are allowed const contactMethod: "EMAIL" | "PHONE" = "email" in input ? "EMAIL" : "PHONE"; const additionalAttemptInfo = { lastResend: Date.now(), @@ -436,7 +400,7 @@ function getModifiedRecipeImplementation( const loginAttemptInfo = (await originalImpl.getLoginAttemptInfo({ userContext: input.userContext, }))!; - dispatch({ type: "startLogin", loginAttemptInfo }); + dispatch({ type: "startVerify", loginAttemptInfo }); } return res; }, @@ -475,8 +439,9 @@ function getModifiedRecipeImplementation( }, consumeCode: async (input) => { - // We need to call consume code while callingConsume, so we don't detect - // the session creation too early and go to successInAnotherTab too early + // We need to set call callingConsumeCodeRef to true while consumeCode is running, + // so we don't detect the login attempt disappearing too early and + // go to successInAnotherTab too early callingConsumeCodeRef.current = true; const res = await originalImpl.consumeCode(input); @@ -488,6 +453,8 @@ function getModifiedRecipeImplementation( dispatch({ type: "restartFlow", error: "ERROR_SIGN_IN_UP_CODE_CONSUME_RESTART_FLOW" }); } else if (res.status === "SIGN_IN_UP_NOT_ALLOWED") { + // This should never happen, but technically possible based on the API specs + // so we keep this here to cover all cases await originalImpl.clearLoginAttemptInfo({ userContext: input.userContext, }); @@ -497,6 +464,7 @@ function getModifiedRecipeImplementation( await originalImpl.clearLoginAttemptInfo({ userContext: input.userContext, }); + // we wait for the redirection to happen in this case. } callingConsumeCodeRef.current = false; diff --git a/lib/ts/recipe/passwordless/components/themes/mfa/index.tsx b/lib/ts/recipe/passwordless/components/themes/mfa/index.tsx index 0b2639ed5..a5be8e141 100644 --- a/lib/ts/recipe/passwordless/components/themes/mfa/index.tsx +++ b/lib/ts/recipe/passwordless/components/themes/mfa/index.tsx @@ -12,9 +12,6 @@ * License for the specific language governing permissions and limitations * under the License. */ -/* - * Imports. - */ import React from "react"; import { SuperTokensBranding } from "../../../../../components/SuperTokensBranding"; @@ -44,9 +41,6 @@ export enum MFAScreens { AccessDenied, } -/* - * Component. - */ const MFATheme: React.FC = ({ activeScreen, featureState, @@ -152,7 +146,6 @@ function MFAThemeWrapper(props: MFAProps): JSX.Element { } else if (activeScreen === MFAScreens.PhoneForm) { activeStyle = props.config.signInUpFeature.emailOrPhoneFormStyle; } else { - // TODO: test activeStyle = ""; // styling the access denied screen is handled through the session recipe } diff --git a/lib/ts/recipe/passwordless/prebuiltui.tsx b/lib/ts/recipe/passwordless/prebuiltui.tsx index e76afb17d..9248b54e4 100644 --- a/lib/ts/recipe/passwordless/prebuiltui.tsx +++ b/lib/ts/recipe/passwordless/prebuiltui.tsx @@ -44,7 +44,7 @@ export class PasswordlessPreBuiltUI extends RecipeRouter { return PasswordlessPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatures(useComponentOverrides); } static getFeatureComponent( - componentName: "signInUp" | "linkClickedScreen", + componentName: "signInUp" | "linkClickedScreen" | "otp-phone" | "otp-email", props: FeatureBaseProps & { redirectOnSessionExists?: boolean; userContext?: any }, useComponentOverrides: () => GenericComponentOverrideMap = useRecipeComponentOverrideContext ): JSX.Element { @@ -197,11 +197,15 @@ export class PasswordlessPreBuiltUI extends RecipeRouter { this.getFeatureComponent("signInUp", prop); static LinkClicked = (prop?: any) => this.getFeatureComponent("linkClickedScreen", prop); + static MfaOtpPhone = (prop?: any) => this.getFeatureComponent("otp-phone", prop); + static MfaOtpEmail = (prop?: any) => this.getFeatureComponent("otp-email", prop); static SignInUpTheme = SignInUpTheme; } const SignInUp = PasswordlessPreBuiltUI.SignInUp; const LinkClicked = PasswordlessPreBuiltUI.LinkClicked; +const MfaOtpPhone = PasswordlessPreBuiltUI.MfaOtpPhone; +const MfaOtpEmail = PasswordlessPreBuiltUI.MfaOtpEmail; -export { SignInUp, LinkClicked, SignInUpTheme }; +export { SignInUp, LinkClicked, SignInUpTheme, MfaOtpPhone, MfaOtpEmail }; diff --git a/lib/ts/recipe/passwordless/types.ts b/lib/ts/recipe/passwordless/types.ts index 69c547ac7..4c076f720 100644 --- a/lib/ts/recipe/passwordless/types.ts +++ b/lib/ts/recipe/passwordless/types.ts @@ -335,7 +335,7 @@ export type MFAAction = error: string | undefined; } | { - type: "startLogin"; + type: "startVerify"; loginAttemptInfo: LoginAttemptInfo; } | { diff --git a/lib/ts/recipe/passwordless/utils.ts b/lib/ts/recipe/passwordless/utils.ts index 8906e7af6..bd459381a 100644 --- a/lib/ts/recipe/passwordless/utils.ts +++ b/lib/ts/recipe/passwordless/utils.ts @@ -176,7 +176,6 @@ export function getEnabledContactMethods( } if (enabledContactMethods.length === 0) { - // It should never get here, but as a sanity check this is fine throw new Error("The enabled contact method is not a superset of the requested first factors"); } return enabledContactMethods; diff --git a/package-lock.json b/package-lock.json index 1b2553f7a..2809adab6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,7 +40,6 @@ "@typescript-eslint/parser": "4.6.0", "babel-jest": "^29.3.1", "chokidar-cli": "^3.0.0", - "chromatic": "^9.0.0", "eslint": "^6.8.0", "eslint-plugin-import": "^2.27.5", "eslint-plugin-react": "^7.28.0", diff --git a/package.json b/package.json index 5eaa622df..6b7dc6478 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,6 @@ "@typescript-eslint/parser": "4.6.0", "babel-jest": "^29.3.1", "chokidar-cli": "^3.0.0", - "chromatic": "^9.0.0", "eslint": "^6.8.0", "eslint-plugin-import": "^2.27.5", "eslint-plugin-react": "^7.28.0", From b397c6741a92201051a36aba03889672541e6458 Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Thu, 16 Nov 2023 22:46:15 +0100 Subject: [PATCH 28/35] refactor: self-review fixes --- lib/build/passwordless-shared3.js | 7 ++++-- lib/build/recipe/passwordless/types.d.ts | 8 ++++++ lib/build/thirdpartypasswordlessprebuiltui.js | 2 +- .../components/themes/mfa/index.tsx | 4 ++- .../passwordless/components/themes/styles.css | 25 ------------------- lib/ts/recipe/passwordless/types.ts | 9 +++++++ 6 files changed, 26 insertions(+), 29 deletions(-) diff --git a/lib/build/passwordless-shared3.js b/lib/build/passwordless-shared3.js index 570f15976..3e905ff13 100644 --- a/lib/build/passwordless-shared3.js +++ b/lib/build/passwordless-shared3.js @@ -61,7 +61,7 @@ var React__namespace = /*#__PURE__*/ _interopNamespace(React); var STGeneralError__default = /*#__PURE__*/ _interopDefault(STGeneralError); var styles = - '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 400;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 600;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n font-weight: 400;\n margin-bottom: 21px;\n}\n\n[data-supertokens~="headerSubtitle"][data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n font-family: "Rubik", sans-serif;\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n font-family: "Rubik", sans-serif;\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n\n[data-supertokens~="delayedRender"] {\n -webkit-animation-duration: 0.1s;\n animation-duration: 0.1s;\n -webkit-animation-name: animate-fade;\n animation-name: animate-fade;\n -webkit-animation-delay: 0.2s;\n animation-delay: 0.2s;\n -webkit-animation-fill-mode: backwards;\n animation-fill-mode: backwards;\n}\n\n@-webkit-keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n\n@keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n\n[data-supertokens~="footerLinkGroupVert"] {\n display: flex;\n flex-direction: column;\n margin-top: 10px;\n gap: 24px;\n}\n\n[data-supertokens~="footerLinkGroupVert"] > div {\n margin: 0;\n}\n\n[data-supertokens~="footerLinkGroupVert"] [data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n\n[data-supertokens~="footerLinkGroupVert"] [data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n position: relative;\n left: -6px; /* half the width of the left arrow */\n}\n\n@media (max-width: 360px) {\n [data-supertokens~="footerLinkGroupVert"] {\n flex-direction: column;\n }\n [data-supertokens~="footerLinkGroupVert"] > div {\n margin: 0 auto;\n }\n}\n\n[data-supertokens~="footerLinkGroupVert"] div:only-child {\n margin-left: auto;\n margin-right: auto;\n margin-top: 14px;\n}\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n\n[data-supertokens~="withBackButton"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n\n[data-supertokens~="generalSuccess"] {\n margin-bottom: 20px;\n -webkit-animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n}\n\n[data-supertokens~="codeInputLabelWrapper"] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="headerSubtitle"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n[data-supertokens~="sendCodeText"] {\n margin-top: 15px;\n margin-bottom: 20px;\n}\n\n[data-supertokens~="sendCodeText"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n[data-supertokens~="resendCodeBtn"] {\n width: auto;\n margin-top: 0;\n line-height: 24px;\n}\n\n[data-supertokens~="resendCodeBtn"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="resendCodeBtn"]:disabled {\n color: rgb(var(--palette-textPrimary));\n cursor: default;\n text-decoration: none;\n}\n\n[data-supertokens~="phoneInputLibRoot"] {\n display: flex;\n align-items: center;\n}\n\n[data-supertokens~="phoneInputWrapper"] {\n display: flex;\n align-items: center;\n}\n\n[data-supertokens~="phoneInputWrapper"] .iti [data-supertokens~="input"] {\n padding-left: 15px;\n}\n\n[data-supertokens~="phoneInputWrapper"] .iti {\n flex: 1 1;\n min-width: 0;\n width: 100%;\n background: transparent;\n border: none;\n color: inherit;\n outline: none;\n}\n\n[data-supertokens~="continueButtonWrapper"] {\n margin-top: 10px;\n margin-bottom: 30px;\n}\n\n[data-supertokens~="footerLinkGroup"] {\n display: flex;\n justify-content: space-between;\n margin-top: 20px;\n gap: 8px;\n}\n\n[data-supertokens~="footerLinkGroup"] > div {\n margin: 0;\n}\n\n@media (max-width: 360px) {\n [data-supertokens~="footerLinkGroup"] {\n flex-direction: column;\n }\n [data-supertokens~="footerLinkGroup"] > div {\n margin: 0 auto;\n }\n}\n\n[data-supertokens~="footerLinkGroup"] div:only-child {\n margin-left: auto;\n margin-right: auto;\n}\n\n.iti__country-list {\n border: 0;\n top: 40px;\n width: min(72.2vw, 320px);\n border-radius: 6;\n box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.16);\n}\n\n.iti__country {\n display: flex;\n align-items: center;\n height: 34px;\n cursor: pointer;\n\n padding: 0 8px;\n}\n\n.iti__country-name {\n color: var(--palette-textLabel);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: "0 16px";\n}\n'; + '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n\n/*\n * Default styles.\n */\n\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 400;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 600;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n\n[data-supertokens~="headerSubtitle"] {\n font-weight: 400;\n margin-bottom: 21px;\n}\n\n[data-supertokens~="headerSubtitle"][data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n\n/* TODO: split the link style into separate things*/\n\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n\n[data-supertokens~="linkButton"] {\n font-family: "Rubik", sans-serif;\n background-color: transparent;\n border: 0;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n\n[data-supertokens~="button"] {\n font-family: "Rubik", sans-serif;\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n\n[data-supertokens~="delayedRender"] {\n -webkit-animation-duration: 0.1s;\n animation-duration: 0.1s;\n -webkit-animation-name: animate-fade;\n animation-name: animate-fade;\n -webkit-animation-delay: 0.2s;\n animation-delay: 0.2s;\n -webkit-animation-fill-mode: backwards;\n animation-fill-mode: backwards;\n}\n\n@-webkit-keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n\n@keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n\n[data-supertokens~="footerLinkGroupVert"] {\n display: flex;\n flex-direction: column;\n margin-top: 10px;\n gap: 24px;\n}\n\n[data-supertokens~="footerLinkGroupVert"] > div {\n margin: 0;\n}\n\n[data-supertokens~="footerLinkGroupVert"] [data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n\n[data-supertokens~="footerLinkGroupVert"] [data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n position: relative;\n left: -6px; /* half the width of the left arrow */\n}\n\n@media (max-width: 360px) {\n [data-supertokens~="footerLinkGroupVert"] {\n flex-direction: column;\n }\n [data-supertokens~="footerLinkGroupVert"] > div {\n margin: 0 auto;\n }\n}\n\n[data-supertokens~="footerLinkGroupVert"] div:only-child {\n margin-left: auto;\n margin-right: auto;\n margin-top: 14px;\n}\n\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n\n[data-supertokens~="withBackButton"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n\n[data-supertokens~="generalSuccess"] {\n margin-bottom: 20px;\n -webkit-animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n}\n\n[data-supertokens~="codeInputLabelWrapper"] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n[data-supertokens~="headerSubtitle"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n[data-supertokens~="sendCodeText"] {\n margin-top: 15px;\n margin-bottom: 20px;\n}\n\n[data-supertokens~="sendCodeText"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n[data-supertokens~="resendCodeBtn"] {\n width: auto;\n margin-top: 0;\n line-height: 24px;\n}\n\n[data-supertokens~="resendCodeBtn"]:hover {\n text-decoration: underline;\n}\n\n[data-supertokens~="resendCodeBtn"]:disabled {\n color: rgb(var(--palette-textPrimary));\n cursor: default;\n text-decoration: none;\n}\n\n[data-supertokens~="phoneInputLibRoot"] {\n display: flex;\n align-items: center;\n}\n\n[data-supertokens~="phoneInputWrapper"] {\n display: flex;\n align-items: center;\n}\n\n[data-supertokens~="phoneInputWrapper"] .iti [data-supertokens~="input"] {\n padding-left: 15px;\n}\n\n[data-supertokens~="phoneInputWrapper"] .iti {\n flex: 1 1;\n min-width: 0;\n width: 100%;\n background: transparent;\n border: none;\n color: inherit;\n outline: none;\n}\n\n[data-supertokens~="continueButtonWrapper"] {\n margin-top: 10px;\n margin-bottom: 30px;\n}\n\n.iti__country-list {\n border: 0;\n top: 40px;\n width: min(72.2vw, 320px);\n border-radius: 6;\n box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.16);\n}\n\n.iti__country {\n display: flex;\n align-items: center;\n height: 34px;\n cursor: pointer;\n\n padding: 0 8px;\n}\n\n.iti__country-name {\n color: var(--palette-textLabel);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: "0 16px";\n}\n'; var ThemeBase = function (_a) { var children = _a.children, @@ -3484,7 +3484,10 @@ function MFAThemeWrapper(props) { children: jsxRuntime.jsx( ThemeBase, genericComponentOverrideContext.__assign( - { loadDefaultFont: !hasFont, userStyles: [props.config.rootStyle, activeStyle] }, + { + loadDefaultFont: !hasFont, + userStyles: [props.config.rootStyle, activeStyle, props.config.mfaFeature.style], + }, { children: jsxRuntime.jsx( MFATheme, diff --git a/lib/build/recipe/passwordless/types.d.ts b/lib/build/recipe/passwordless/types.d.ts index 789f073f9..4859c2c99 100644 --- a/lib/build/recipe/passwordless/types.d.ts +++ b/lib/build/recipe/passwordless/types.d.ts @@ -1,4 +1,8 @@ import type { LinkClickedScreen } from "./components/themes/linkClickedScreen"; +import type { MFAFooter } from "./components/themes/mfa/mfaFooter"; +import type { MFAHeader } from "./components/themes/mfa/mfaHeader"; +import type { MFAOTPFooter } from "./components/themes/mfa/mfaOTPFooter"; +import type { MFAOTPHeader } from "./components/themes/mfa/mfaOTPHeader"; import type { CloseTabScreen } from "./components/themes/signInUp/closeTabScreen"; import type { EmailForm } from "./components/themes/signInUp/emailForm"; import type { EmailOrPhoneForm } from "./components/themes/signInUp/emailOrPhoneForm"; @@ -339,4 +343,8 @@ export declare type ComponentOverrideMap = { PasswordlessLinkSent_Override?: ComponentOverride; PasswordlessLinkClickedScreen_Override?: ComponentOverride; PasswordlessCloseTabScreen_Override?: ComponentOverride; + PasswordlessMFAHeader_Override?: ComponentOverride; + PasswordlessMFAFooter_Override?: ComponentOverride; + PasswordlessMFAOTPHeader_Override?: ComponentOverride; + PasswordlessMFAOTPFooter_Override?: ComponentOverride; }; diff --git a/lib/build/thirdpartypasswordlessprebuiltui.js b/lib/build/thirdpartypasswordlessprebuiltui.js index 8e599455d..74fca479b 100644 --- a/lib/build/thirdpartypasswordlessprebuiltui.js +++ b/lib/build/thirdpartypasswordlessprebuiltui.js @@ -82,7 +82,7 @@ var NormalisedURLPath__default = /*#__PURE__*/ _interopDefault(NormalisedURLPath var React__namespace = /*#__PURE__*/ _interopNamespace(React); var styles = - '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 400;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 600;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n font-weight: 400;\n margin-bottom: 21px;\n}\n[data-supertokens~="headerSubtitle"][data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n font-family: "Rubik", sans-serif;\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n font-family: "Rubik", sans-serif;\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n[data-supertokens~="delayedRender"] {\n -webkit-animation-duration: 0.1s;\n animation-duration: 0.1s;\n -webkit-animation-name: animate-fade;\n animation-name: animate-fade;\n -webkit-animation-delay: 0.2s;\n animation-delay: 0.2s;\n -webkit-animation-fill-mode: backwards;\n animation-fill-mode: backwards;\n}\n@-webkit-keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n[data-supertokens~="footerLinkGroupVert"] {\n display: flex;\n flex-direction: column;\n margin-top: 10px;\n gap: 24px;\n}\n[data-supertokens~="footerLinkGroupVert"] > div {\n margin: 0;\n}\n[data-supertokens~="footerLinkGroupVert"] [data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n[data-supertokens~="footerLinkGroupVert"] [data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n position: relative;\n left: -6px; /* half the width of the left arrow */\n}\n@media (max-width: 360px) {\n [data-supertokens~="footerLinkGroupVert"] {\n flex-direction: column;\n }\n [data-supertokens~="footerLinkGroupVert"] > div {\n margin: 0 auto;\n }\n}\n[data-supertokens~="footerLinkGroupVert"] div:only-child {\n margin-left: auto;\n margin-right: auto;\n margin-top: 14px;\n}\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n[data-supertokens~="withBackButton"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n[data-supertokens~="generalSuccess"] {\n margin-bottom: 20px;\n -webkit-animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n}\n[data-supertokens~="codeInputLabelWrapper"] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="headerSubtitle"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n[data-supertokens~="sendCodeText"] {\n margin-top: 15px;\n margin-bottom: 20px;\n}\n[data-supertokens~="sendCodeText"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n[data-supertokens~="resendCodeBtn"] {\n width: auto;\n margin-top: 0;\n line-height: 24px;\n}\n[data-supertokens~="resendCodeBtn"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="resendCodeBtn"]:disabled {\n color: rgb(var(--palette-textPrimary));\n cursor: default;\n text-decoration: none;\n}\n[data-supertokens~="phoneInputLibRoot"] {\n display: flex;\n align-items: center;\n}\n[data-supertokens~="phoneInputWrapper"] {\n display: flex;\n align-items: center;\n}\n[data-supertokens~="phoneInputWrapper"] .iti [data-supertokens~="input"] {\n padding-left: 15px;\n}\n[data-supertokens~="phoneInputWrapper"] .iti {\n flex: 1 1;\n min-width: 0;\n width: 100%;\n background: transparent;\n border: none;\n color: inherit;\n outline: none;\n}\n[data-supertokens~="continueButtonWrapper"] {\n margin-top: 10px;\n margin-bottom: 30px;\n}\n[data-supertokens~="footerLinkGroup"] {\n display: flex;\n justify-content: space-between;\n margin-top: 20px;\n gap: 8px;\n}\n[data-supertokens~="footerLinkGroup"] > div {\n margin: 0;\n}\n@media (max-width: 360px) {\n [data-supertokens~="footerLinkGroup"] {\n flex-direction: column;\n }\n [data-supertokens~="footerLinkGroup"] > div {\n margin: 0 auto;\n }\n}\n[data-supertokens~="footerLinkGroup"] div:only-child {\n margin-left: auto;\n margin-right: auto;\n}\n.iti__country-list {\n border: 0;\n top: 40px;\n width: min(72.2vw, 320px);\n border-radius: 6;\n box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.16);\n}\n.iti__country {\n display: flex;\n align-items: center;\n height: 34px;\n cursor: pointer;\n\n padding: 0 8px;\n}\n.iti__country-name {\n color: var(--palette-textLabel);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: "0 16px";\n}\n[data-supertokens~="row"] {\n padding-bottom: 30px;\n}\n[data-supertokens~="providerContainer"] {\n padding-top: 9px;\n padding-bottom: 9px;\n}\n[data-supertokens~="providerButton"] {\n border-color: rgb(221, 221, 221) !important;\n}\n[data-supertokens~="providerButton"] {\n min-height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 2px 8px;\n\n background-color: white;\n color: black;\n}\n[data-supertokens~="providerButton"]:hover {\n -webkit-filter: none !important;\n filter: none !important;\n}\n[data-supertokens~="providerButton"]:hover {\n background-color: #fafafa;\n}\n[data-supertokens~="providerButtonLeft"] {\n min-width: 34px;\n margin-left: 66px;\n}\n[data-supertokens~="providerButtonLogo"] {\n height: 30px;\n display: flex;\n}\n[data-supertokens~="providerButtonLogoCenter"] {\n display: flex;\n margin: auto;\n}\n[data-supertokens~="providerButtonText"] {\n font-weight: 400;\n text-align: center;\n justify-content: center;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n display: inline-block;\n}\n[data-supertokens~="providerButtonText"]:only-child {\n margin: 0 auto;\n}\n[data-supertokens~="thirdPartyPasswordlessDivider"] {\n padding-top: 5px;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="thirdPartyPasswordlessDividerText"] {\n flex: 1 1;\n margin-top: 0.75em;\n}\n[data-supertokens~="divider"] {\n flex: 3 3;\n}\n[data-supertokens~="providerButton"] {\n margin: auto !important;\n max-width: 240px !important;\n}\n[data-supertokens~="providerButtonLeft"] {\n margin-left: 30px !important;\n}\n'; + '/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="container"] {\n --palette-background: 255, 255, 255;\n --palette-inputBackground: 250, 250, 250;\n --palette-inputBorder: 224, 224, 224;\n --palette-primary: 255, 155, 51;\n --palette-primaryBorder: 238, 141, 35;\n --palette-success: 65, 167, 0;\n --palette-successBackground: 217, 255, 191;\n --palette-error: 255, 23, 23;\n --palette-errorBackground: 255, 241, 235;\n --palette-textTitle: 34, 34, 34;\n --palette-textLabel: 34, 34, 34;\n --palette-textInput: 34, 34, 34;\n --palette-textPrimary: 101, 101, 101;\n --palette-textLink: 0, 118, 255;\n --palette-buttonText: 255, 255, 255;\n --palette-textGray: 128, 128, 128;\n --palette-superTokensBrandingBackground: 242, 245, 246;\n --palette-superTokensBrandingText: 173, 189, 196;\n\n --font-size-0: 12px;\n --font-size-1: 14px;\n --font-size-2: 16px;\n --font-size-3: 19px;\n --font-size-4: 24px;\n}\n/*\n * Default styles.\n */\n@-webkit-keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@keyframes slideTop {\n 0% {\n -webkit-transform: translateY(-5px);\n transform: translateY(-5px);\n }\n 100% {\n -webkit-transform: translateY(0px);\n transform: translateY(0px);\n }\n}\n@-webkit-keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n@keyframes swing-in-top-fwd {\n 0% {\n -webkit-transform: rotateX(-100deg);\n transform: rotateX(-100deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 0;\n }\n 100% {\n -webkit-transform: rotateX(0deg);\n transform: rotateX(0deg);\n -webkit-transform-origin: top;\n transform-origin: top;\n opacity: 1;\n }\n}\n[data-supertokens~="container"] {\n font-family: "Rubik", sans-serif;\n margin: 12px auto;\n margin-top: 26px;\n margin-bottom: 26px;\n width: 420px;\n text-align: center;\n border-radius: 8px;\n box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.16);\n background-color: rgb(var(--palette-background));\n}\n@media (max-width: 440px) {\n [data-supertokens~="container"] {\n width: 95vw;\n }\n}\n[data-supertokens~="row"] {\n margin: 0 auto;\n width: 76%;\n padding-top: 30px;\n padding-bottom: 10px;\n}\n[data-supertokens~="superTokensBranding"] {\n display: block;\n margin: 0 auto;\n background: rgb(var(--palette-superTokensBrandingBackground));\n color: rgb(var(--palette-superTokensBrandingText));\n text-decoration: none;\n width: -webkit-fit-content;\n width: -moz-fit-content;\n width: fit-content;\n border-radius: 6px 6px 0 0;\n padding: 4px 9px;\n font-weight: 400;\n font-size: var(--font-size-0);\n letter-spacing: 0.4px;\n}\n[data-supertokens~="generalError"] {\n background: rgb(var(--palette-errorBackground));\n padding-top: 10px;\n padding-bottom: 10px;\n margin-bottom: 15px;\n padding-left: 18px;\n padding-right: 18px;\n letter-spacing: 0.2px;\n font-size: var(--font-size-1);\n border-radius: 8px;\n color: rgb(var(--palette-error));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n word-wrap: break-word;\n}\n[data-supertokens~="headerTitle"] {\n font-size: var(--font-size-4);\n line-height: 40px;\n letter-spacing: 0.58px;\n font-weight: 600;\n margin-bottom: 2px;\n color: rgb(var(--palette-textTitle));\n}\n[data-supertokens~="headerSubtitle"] {\n font-weight: 400;\n margin-bottom: 21px;\n}\n[data-supertokens~="headerSubtitle"][data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] {\n max-width: 300px;\n margin-top: 10px;\n}\n[data-supertokens~="privacyPolicyAndTermsAndConditions"] a {\n line-height: 21px;\n}\n/* TODO: split the link style into separate things*/\n/* We add this before primary and secondary text, because if they are applied to the same element the other ones take priority */\n[data-supertokens~="link"] {\n padding-left: 3px;\n padding-right: 3px;\n color: rgb(var(--palette-textLink));\n font-size: var(--font-size-1);\n cursor: pointer;\n letter-spacing: 0.16px;\n line-height: 26px;\n}\n[data-supertokens~="primaryText"] {\n font-size: var(--font-size-1);\n font-weight: 500;\n letter-spacing: 0.4px;\n line-height: 21px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="secondaryText"] {\n font-size: var(--font-size-1);\n font-weight: 300;\n letter-spacing: 0.4px;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="divider"] {\n margin-top: 1em;\n margin-bottom: 1em;\n border-bottom: 0.3px solid #dddddd;\n align-items: center;\n padding-bottom: 5px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="generalSuccess"] {\n color: rgb(var(--palette-success));\n font-size: var(--font-size-1);\n background: rgb(var(--palette-successBackground));\n -webkit-animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n animation: swing-in-top-fwd 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;\n padding: 9px 15px 9px 15px;\n border-radius: 6px;\n display: inline-block;\n}\n[data-supertokens~="spinner"] {\n width: 80px;\n height: auto;\n padding-top: 20px;\n padding-bottom: 40px;\n margin: 0 auto;\n}\n[data-supertokens~="error"] {\n color: rgb(var(--palette-error));\n}\n[data-supertokens~="linkButton"] {\n font-family: "Rubik", sans-serif;\n background-color: transparent;\n border: 0;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n margin-top: 10px;\n margin-bottom: 40px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"] svg {\n margin-right: 0.3em;\n}\n[data-supertokens~="secondaryLinkWithLeftArrow"]:hover svg {\n position: relative;\n left: -4px;\n}\n[data-supertokens~="button"] {\n font-family: "Rubik", sans-serif;\n background-color: rgb(var(--palette-primary));\n color: rgb(var(--palette-buttonText));\n width: 100%;\n height: 34px;\n font-weight: 700;\n border-width: 1px;\n border-style: solid;\n border-radius: 6px;\n border-color: rgb(var(--palette-primaryBorder));\n background-position: center;\n transition: all 0.4s;\n background-size: 12000%;\n cursor: pointer;\n}\n[data-supertokens~="button"]:disabled {\n border: none;\n cursor: no-drop;\n}\n[data-supertokens~="button"]:active {\n outline: none;\n transition: all 0s;\n background-size: 100%;\n -webkit-filter: brightness(0.85);\n filter: brightness(0.85);\n}\n[data-supertokens~="button"]:focus {\n outline: none;\n}\n[data-supertokens~="backButtonCommon"] {\n width: 16px;\n height: 13px;\n}\n[data-supertokens~="backButton"] {\n cursor: pointer;\n border: none;\n background-color: transparent;\n padding: 0px;\n}\n[data-supertokens~="backButtonPlaceholder"] {\n display: block;\n}\n[data-supertokens~="delayedRender"] {\n -webkit-animation-duration: 0.1s;\n animation-duration: 0.1s;\n -webkit-animation-name: animate-fade;\n animation-name: animate-fade;\n -webkit-animation-delay: 0.2s;\n animation-delay: 0.2s;\n -webkit-animation-fill-mode: backwards;\n animation-fill-mode: backwards;\n}\n@-webkit-keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes animate-fade {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n[data-supertokens~="footerLinkGroupVert"] {\n display: flex;\n flex-direction: column;\n margin-top: 10px;\n gap: 24px;\n}\n[data-supertokens~="footerLinkGroupVert"] > div {\n margin: 0;\n}\n[data-supertokens~="footerLinkGroupVert"] [data-supertokens~="secondaryText"] {\n font-weight: 400;\n}\n[data-supertokens~="footerLinkGroupVert"] [data-supertokens~="secondaryLinkWithLeftArrow"] {\n font-weight: 500;\n position: relative;\n left: -6px; /* half the width of the left arrow */\n}\n@media (max-width: 360px) {\n [data-supertokens~="footerLinkGroupVert"] {\n flex-direction: column;\n }\n [data-supertokens~="footerLinkGroupVert"] > div {\n margin: 0 auto;\n }\n}\n[data-supertokens~="footerLinkGroupVert"] div:only-child {\n margin-left: auto;\n margin-right: auto;\n margin-top: 14px;\n}\n/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.\n *\n * This software is licensed under the Apache License, Version 2.0 (the\n * "License") as published by the Apache Software Foundation.\n *\n * You may not use this file except in compliance with the License. You may\n * obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n[data-supertokens~="inputContainer"] {\n margin-top: 6px;\n}\n[data-supertokens~="inputWrapper"] {\n box-sizing: border-box;\n width: 100%;\n display: flex;\n align-items: center;\n background-color: rgb(var(--palette-inputBackground));\n height: 34px;\n border-radius: 6px;\n border: 1px solid rgb(var(--palette-inputBorder));\n}\n[data-supertokens~="inputWrapper"][focus-within] {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputWrapper"]:focus-within {\n background-color: rgba(var(--palette-inputBackground), 0.25);\n border: 1px solid rgb(var(--palette-primary));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-primary), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"][focus-within] {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="inputError"]:focus-within {\n border: 1px solid rgb(var(--palette-error));\n box-shadow: 0 0 0 0.2rem rgba(var(--palette-error), 0.25);\n outline: none;\n}\n[data-supertokens~="input"] {\n box-sizing: border-box;\n padding-left: 15px;\n -webkit-filter: none;\n filter: none;\n color: rgb(var(--palette-textInput));\n background-color: transparent;\n border-radius: 6px;\n font-size: var(--font-size-1);\n border: none;\n padding-right: 25px;\n letter-spacing: 1.2px;\n flex: 9 1 75%;\n width: 75%;\n height: 32px;\n}\n[data-supertokens~="input"]:focus {\n border: none;\n outline: none;\n}\n[data-supertokens~="input"]:-webkit-autofill,\n[data-supertokens~="input"]:-webkit-autofill:hover,\n[data-supertokens~="input"]:-webkit-autofill:focus,\n[data-supertokens~="input"]:-webkit-autofill:active {\n -webkit-text-fill-color: rgb(var(--palette-textInput));\n box-shadow: 0 0 0 30px rgb(var(--palette-inputBackground)) inset;\n}\n[data-supertokens~="inputAdornment"] {\n justify-content: center;\n margin-right: 5px;\n}\n[data-supertokens~="showPassword"] {\n cursor: pointer;\n}\n[data-supertokens~="forgotPasswordLink"] {\n margin-top: 10px;\n}\n[data-supertokens~="enterEmailSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n word-break: break-word;\n}\n[data-supertokens~="submitNewPasswordSuccessMessage"] {\n margin-top: 15px;\n margin-bottom: 15px;\n}\n[data-supertokens~="inputErrorMessage"] {\n padding-top: 5px;\n padding-bottom: 5px;\n color: rgb(var(--palette-error));\n line-height: 24px;\n font-weight: 400;\n font-size: var(--font-size-1);\n text-align: left;\n -webkit-animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n animation: slideTop 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;\n max-width: 330px;\n}\n@media (max-width: 440px) {\n [data-supertokens~="inputErrorMessage"] {\n max-width: 250px;\n }\n}\n[data-supertokens~="inputErrorSymbol"] {\n margin-right: 5px;\n top: 1px;\n position: relative;\n left: 2px;\n}\n[data-supertokens~="label"] {\n text-align: left;\n font-weight: 600;\n font-size: var(--font-size-1);\n line-height: 24px;\n color: rgb(var(--palette-textLabel));\n}\n[data-supertokens~="formRow"] {\n display: flex;\n flex-direction: column;\n padding-top: 0px;\n padding-bottom: 34px;\n}\n[data-supertokens~="formRow"][data-supertokens~="hasError"] {\n padding-bottom: 0;\n}\n[data-supertokens~="sendVerifyEmailIcon"] {\n margin-top: 11px;\n}\n[data-supertokens~="headerTinyTitle"] {\n margin-top: 13px;\n font-size: var(--font-size-3);\n letter-spacing: 1.1px;\n font-weight: 500;\n line-height: 28px;\n}\n[data-supertokens~="sendVerifyEmailText"] {\n line-height: 21px;\n font-size: var(--font-size-1);\n text-align: center;\n font-weight: 300;\n letter-spacing: 0.8px;\n}\n[data-supertokens~="secondaryLinkWithArrow"] {\n margin-top: 10px;\n margin-bottom: 30px;\n cursor: pointer;\n}\n[data-supertokens~="secondaryLinkWithArrow"]:hover {\n position: relative;\n left: 2px;\n word-spacing: 4px;\n}\n[data-supertokens~="sendVerifyEmailResend"] {\n margin-top: 13px;\n font-weight: 300;\n}\n[data-supertokens~="sendVerifyEmailResend"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="noFormRow"] {\n padding-bottom: 25px;\n}\n[data-supertokens~="emailVerificationButtonWrapper"] {\n padding-top: 25px;\n max-width: 96px;\n margin: 0 auto;\n}\n[data-supertokens~="withBackButton"] {\n position: relative;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="resendEmailLink"] {\n display: inline-block;\n}\n[data-supertokens~="generalSuccess"] {\n margin-bottom: 20px;\n -webkit-animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n animation: swingIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) alternate 2 both;\n}\n[data-supertokens~="codeInputLabelWrapper"] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n[data-supertokens~="headerSubtitle"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n[data-supertokens~="sendCodeText"] {\n margin-top: 15px;\n margin-bottom: 20px;\n}\n[data-supertokens~="sendCodeText"] strong {\n max-width: 100%;\n display: inline-block;\n vertical-align: bottom;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n[data-supertokens~="resendCodeBtn"] {\n width: auto;\n margin-top: 0;\n line-height: 24px;\n}\n[data-supertokens~="resendCodeBtn"]:hover {\n text-decoration: underline;\n}\n[data-supertokens~="resendCodeBtn"]:disabled {\n color: rgb(var(--palette-textPrimary));\n cursor: default;\n text-decoration: none;\n}\n[data-supertokens~="phoneInputLibRoot"] {\n display: flex;\n align-items: center;\n}\n[data-supertokens~="phoneInputWrapper"] {\n display: flex;\n align-items: center;\n}\n[data-supertokens~="phoneInputWrapper"] .iti [data-supertokens~="input"] {\n padding-left: 15px;\n}\n[data-supertokens~="phoneInputWrapper"] .iti {\n flex: 1 1;\n min-width: 0;\n width: 100%;\n background: transparent;\n border: none;\n color: inherit;\n outline: none;\n}\n[data-supertokens~="continueButtonWrapper"] {\n margin-top: 10px;\n margin-bottom: 30px;\n}\n.iti__country-list {\n border: 0;\n top: 40px;\n width: min(72.2vw, 320px);\n border-radius: 6;\n box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.16);\n}\n.iti__country {\n display: flex;\n align-items: center;\n height: 34px;\n cursor: pointer;\n\n padding: 0 8px;\n}\n.iti__country-name {\n color: var(--palette-textLabel);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: "0 16px";\n}\n[data-supertokens~="row"] {\n padding-bottom: 30px;\n}\n[data-supertokens~="providerContainer"] {\n padding-top: 9px;\n padding-bottom: 9px;\n}\n[data-supertokens~="providerButton"] {\n border-color: rgb(221, 221, 221) !important;\n}\n[data-supertokens~="providerButton"] {\n min-height: 32px;\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 2px 8px;\n\n background-color: white;\n color: black;\n}\n[data-supertokens~="providerButton"]:hover {\n -webkit-filter: none !important;\n filter: none !important;\n}\n[data-supertokens~="providerButton"]:hover {\n background-color: #fafafa;\n}\n[data-supertokens~="providerButtonLeft"] {\n min-width: 34px;\n margin-left: 66px;\n}\n[data-supertokens~="providerButtonLogo"] {\n height: 30px;\n display: flex;\n}\n[data-supertokens~="providerButtonLogoCenter"] {\n display: flex;\n margin: auto;\n}\n[data-supertokens~="providerButtonText"] {\n font-weight: 400;\n text-align: center;\n justify-content: center;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n display: inline-block;\n}\n[data-supertokens~="providerButtonText"]:only-child {\n margin: 0 auto;\n}\n[data-supertokens~="thirdPartyPasswordlessDivider"] {\n padding-top: 5px;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: rgb(var(--palette-textPrimary));\n}\n[data-supertokens~="thirdPartyPasswordlessDividerText"] {\n flex: 1 1;\n margin-top: 0.75em;\n}\n[data-supertokens~="divider"] {\n flex: 3 3;\n}\n[data-supertokens~="providerButton"] {\n margin: auto !important;\n max-width: 240px !important;\n}\n[data-supertokens~="providerButtonLeft"] {\n margin-left: 30px !important;\n}\n'; var ThemeBase = function (_a) { var children = _a.children, diff --git a/lib/ts/recipe/passwordless/components/themes/mfa/index.tsx b/lib/ts/recipe/passwordless/components/themes/mfa/index.tsx index a5be8e141..75c608b97 100644 --- a/lib/ts/recipe/passwordless/components/themes/mfa/index.tsx +++ b/lib/ts/recipe/passwordless/components/themes/mfa/index.tsx @@ -151,7 +151,9 @@ function MFAThemeWrapper(props: MFAProps): JSX.Element { return ( - + diff --git a/lib/ts/recipe/passwordless/components/themes/styles.css b/lib/ts/recipe/passwordless/components/themes/styles.css index b4a6f02c6..379a9e767 100644 --- a/lib/ts/recipe/passwordless/components/themes/styles.css +++ b/lib/ts/recipe/passwordless/components/themes/styles.css @@ -94,31 +94,6 @@ margin-bottom: 30px; } -[data-supertokens~="footerLinkGroup"] { - display: flex; - justify-content: space-between; - margin-top: 20px; - gap: 8px; -} - -[data-supertokens~="footerLinkGroup"] > div { - margin: 0; -} - -@media (max-width: 360px) { - [data-supertokens~="footerLinkGroup"] { - flex-direction: column; - } - [data-supertokens~="footerLinkGroup"] > div { - margin: 0 auto; - } -} - -[data-supertokens~="footerLinkGroup"] div:only-child { - margin-left: auto; - margin-right: auto; -} - .iti__country-list { border: 0; top: 40px; diff --git a/lib/ts/recipe/passwordless/types.ts b/lib/ts/recipe/passwordless/types.ts index 4c076f720..3992c9111 100644 --- a/lib/ts/recipe/passwordless/types.ts +++ b/lib/ts/recipe/passwordless/types.ts @@ -14,6 +14,10 @@ */ import type { LinkClickedScreen } from "./components/themes/linkClickedScreen"; +import type { MFAFooter } from "./components/themes/mfa/mfaFooter"; +import type { MFAHeader } from "./components/themes/mfa/mfaHeader"; +import type { MFAOTPFooter } from "./components/themes/mfa/mfaOTPFooter"; +import type { MFAOTPHeader } from "./components/themes/mfa/mfaOTPHeader"; import type { CloseTabScreen } from "./components/themes/signInUp/closeTabScreen"; import type { EmailForm } from "./components/themes/signInUp/emailForm"; import type { EmailOrPhoneForm } from "./components/themes/signInUp/emailOrPhoneForm"; @@ -425,4 +429,9 @@ export type ComponentOverrideMap = { PasswordlessLinkClickedScreen_Override?: ComponentOverride; PasswordlessCloseTabScreen_Override?: ComponentOverride; + + PasswordlessMFAHeader_Override?: ComponentOverride; + PasswordlessMFAFooter_Override?: ComponentOverride; + PasswordlessMFAOTPHeader_Override?: ComponentOverride; + PasswordlessMFAOTPFooter_Override?: ComponentOverride; }; From 69a2110b289d59810b0ee85b56a5016d0e1d05e7 Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Thu, 16 Nov 2023 22:49:04 +0100 Subject: [PATCH 29/35] chore: update changelog --- CHANGELOG.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 872d9af09..b8016b170 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,25 @@ To use this you'll need compatible versions: - Refactored/renamed some styling options (`resetPasswordHeaderTitle` -> `headerTitle withBackButton`) - Added a `useShadowDom` prop to the `AccessDeniedScreen` - Added an `error` prop to the `AccessDeniedScreen` that can be used to describe the reason access is denied. +- Added new MFA related components to Passwordless + - Added new prop `mfaFeature` to recipe config + - `disableDefaultUI`: can be used to disable paths: `${websiteBasePath}/mfa/otp-phone`, `${websiteBasePath}/mfa/otp-email` + - `style`: is applied on top of normal sign in/up styles on the MFA paths + - New embeddable components: + - `MfaOtpPhone` (by default handling path `${websiteBasePath}/mfa/otp-phone`) + - `MfaOtpEmail` (by default handling path `${websiteBasePath}/mfa/otp-email`) + - New overrideable components: + - `PasswordlessMFAHeader_Override` + - `PasswordlessMFAFooter_Override` + - `PasswordlessMFAOTPHeader_Override` + - `PasswordlessMFAOTPFooter_Override` + - Please note, that during MFA we re-use the existing overrideable comps for the form section: + - `PasswordlessEmailForm_Override` + - `PasswordlessPhoneForm_Override` + - `PasswordlessEmailOrPhoneForm_Override` +- Removed an `ErrorBoundary` wrapping all our feature components to make sure all errors are properly catchable by the app +- Added a `footer` prop to `EmailOrPhoneForm`, `EmailForm` and `PhoneForm` which is used to override the default sign in/up footers in case the component is for MFA +- The passwordless and thirdpartypasswordless sign in/up screens now respect the first configuration (defined in the `MultiFactorAuth` recipe or in the tenant information) when selecting the available contact methods. ## [0.35.5] - 2023-10-06 From abce472f9e548cb072c326bc296b4ab64ef8bc00 Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Thu, 16 Nov 2023 23:51:10 +0100 Subject: [PATCH 30/35] feat: use redirect info if available on mfa success --- lib/build/passwordless-shared3.js | 15 ++++++++++++++- .../components/features/mfa/index.tsx | 16 +++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/lib/build/passwordless-shared3.js b/lib/build/passwordless-shared3.js index 3e905ff13..e52c29a1a 100644 --- a/lib/build/passwordless-shared3.js +++ b/lib/build/passwordless-shared3.js @@ -3640,8 +3640,21 @@ function useChildProps$1(recipe$1, recipeImplementation, state, contactMethod, u function () { return { onSuccess: function () { + var redirectToPath = genericComponentOverrideContext.getRedirectToPathFromURL(); + var redirectInfo = + redirectToPath === undefined + ? undefined + : { + rid: "passwordless", + successRedirectContext: { + action: "SUCCESS", + isNewRecipeUser: false, + user: undefined, + redirectToPath: redirectToPath, + }, + }; return recipe.Session.getInstanceOrThrow().validateGlobalClaimsAndHandleSuccessRedirection( - undefined, + redirectInfo, userContext, history ); diff --git a/lib/ts/recipe/passwordless/components/features/mfa/index.tsx b/lib/ts/recipe/passwordless/components/features/mfa/index.tsx index 060f974ed..70d90ccd0 100644 --- a/lib/ts/recipe/passwordless/components/features/mfa/index.tsx +++ b/lib/ts/recipe/passwordless/components/features/mfa/index.tsx @@ -162,8 +162,22 @@ export function useChildProps( return useMemo(() => { return { onSuccess: () => { + const redirectToPath = getRedirectToPathFromURL(); + const redirectInfo = + redirectToPath === undefined + ? undefined + : { + rid: "passwordless", + successRedirectContext: { + action: "SUCCESS", + isNewRecipeUser: false, + user: undefined, + redirectToPath, + }, + }; + return SessionRecipe.getInstanceOrThrow().validateGlobalClaimsAndHandleSuccessRedirection( - undefined, + redirectInfo, userContext, history ); From 00ee185b7cd11dcaf75339ab956574a84af26a12 Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Fri, 17 Nov 2023 00:01:08 +0100 Subject: [PATCH 31/35] refactor: use redirectToFactor instead of re-implementing --- lib/build/multifactorauthprebuiltui.js | 2 +- .../multifactorauth/components/features/factorChooser/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/build/multifactorauthprebuiltui.js b/lib/build/multifactorauthprebuiltui.js index f91cdf660..2da79b44b 100644 --- a/lib/build/multifactorauthprebuiltui.js +++ b/lib/build/multifactorauthprebuiltui.js @@ -409,7 +409,7 @@ var FactorChooser$1 = function (props) { ); var navigateToFactor = React.useCallback( function (factorId) { - return props.recipe.redirect({ action: "GO_TO_FACTOR", factorId: factorId }); + return props.recipe.redirectToFactor(factorId, false, props.history); }, [props.recipe] ); diff --git a/lib/ts/recipe/multifactorauth/components/features/factorChooser/index.tsx b/lib/ts/recipe/multifactorauth/components/features/factorChooser/index.tsx index 0d68173a3..ea2b792a7 100644 --- a/lib/ts/recipe/multifactorauth/components/features/factorChooser/index.tsx +++ b/lib/ts/recipe/multifactorauth/components/features/factorChooser/index.tsx @@ -97,7 +97,7 @@ export const FactorChooser: React.FC = (props) => { useOnMountAPICall(fetchMFAInfo, checkMFAInfo, handleError, sessionContext.loading === false); const navigateToFactor = useCallback( - (factorId) => props.recipe.redirect({ action: "GO_TO_FACTOR", factorId }), + (factorId) => props.recipe.redirectToFactor(factorId, false, props.history), [props.recipe] ); const signOut = useCallback(async (): Promise => { From 21dee6ba306699b4664fb7ffc8dd1382ef7b4537 Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Fri, 17 Nov 2023 00:12:22 +0100 Subject: [PATCH 32/35] fix: add missing param into redirectToFactorChooser call --- lib/build/passwordless-shared3.js | 4 ++-- lib/ts/recipe/passwordless/components/features/mfa/index.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/build/passwordless-shared3.js b/lib/build/passwordless-shared3.js index e52c29a1a..0cd63d619 100644 --- a/lib/build/passwordless-shared3.js +++ b/lib/build/passwordless-shared3.js @@ -3702,7 +3702,7 @@ function useChildProps$1(recipe$1, recipeImplementation, state, contactMethod, u return history(-1); }, onFactorChooserButtonClicked: function () { - return recipe$2.MultiFactorAuth.getInstanceOrThrow().redirectToFactorChooser(history); + return recipe$2.MultiFactorAuth.getInstanceOrThrow().redirectToFactorChooser(false, history); }, recipeImplementation: recipeImplementation, config: recipe$1.config, @@ -3803,7 +3803,7 @@ function useOnLoad(props, recipeImplementation, dispatch, userContext) { }); }); }, - [props.recipe, userContext] + [userContext] ); var handleLoadError = React__namespace.useCallback( function () { diff --git a/lib/ts/recipe/passwordless/components/features/mfa/index.tsx b/lib/ts/recipe/passwordless/components/features/mfa/index.tsx index 70d90ccd0..000a8e2eb 100644 --- a/lib/ts/recipe/passwordless/components/features/mfa/index.tsx +++ b/lib/ts/recipe/passwordless/components/features/mfa/index.tsx @@ -200,7 +200,7 @@ export function useChildProps( return history(-1); }, onFactorChooserButtonClicked: () => { - return MultiFactorAuth.getInstanceOrThrow().redirectToFactorChooser(history); + return MultiFactorAuth.getInstanceOrThrow().redirectToFactorChooser(false, history); }, recipeImplementation: recipeImplementation, config: recipe.config, @@ -292,7 +292,7 @@ function useOnLoad( ) { const fetchMFAInfo = React.useCallback( async () => MultiFactorAuth.getInstanceOrThrow().webJSRecipe.getMFAInfo({ userContext }), - [props.recipe, userContext] + [userContext] ); const handleLoadError = React.useCallback( () => dispatch({ type: "setError", error: "SOMETHING_WENT_WRONG_ERROR" }), From 7891b73b3da52e2983379f2bd3402e062414e356 Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Tue, 21 Nov 2023 02:12:52 +0100 Subject: [PATCH 33/35] fix: override and routing fixes --- lib/build/index2.js | 3 +- lib/build/multifactorauthprebuiltui.js | 122 +++++++++--------- lib/build/recipe/multifactorauth/types.d.ts | 9 +- .../factorChooser/factorChooserFooter.tsx | 4 +- .../factorChooser/factorChooserHeader.tsx | 7 +- .../themes/factorChooser/factorList.tsx | 4 +- .../themes/factorChooser/factorOption.tsx | 7 +- lib/ts/recipe/multifactorauth/types.ts | 9 +- lib/ts/recipe/recipeRouter/index.tsx | 2 +- 9 files changed, 85 insertions(+), 82 deletions(-) diff --git a/lib/build/index2.js b/lib/build/index2.js index a4b33b1cb..0a37217c1 100644 --- a/lib/build/index2.js +++ b/lib/build/index2.js @@ -554,7 +554,8 @@ var RecipeRouter = /** @class */ (function () { } // We may get here if the app is using an older BE that doesn't support MFA var enabledRecipeCount = Object.keys(dynamicLoginMethods).filter(function (key) { - return dynamicLoginMethods[key].enabled; + var _a; + return ((_a = dynamicLoginMethods[key]) === null || _a === void 0 ? void 0 : _a.enabled) === true; }).length; var _loop_2 = function (rid, includes) { if ( diff --git a/lib/build/multifactorauthprebuiltui.js b/lib/build/multifactorauthprebuiltui.js index 2da79b44b..176bf6f58 100644 --- a/lib/build/multifactorauthprebuiltui.js +++ b/lib/build/multifactorauthprebuiltui.js @@ -84,71 +84,65 @@ var ThemeBase = function (_a) { }); }; -var FactorChooserFooter = uiEntry.withOverride( - "MultiFactorAuthFactorChooserFooter", - function MultiFactorAuthFactorChooserFooter(_a) { - var logout = _a.logout; - var t = translationContext.useTranslation(); - return jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "row factorChooserFooter" }, - { - children: jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "secondaryText secondaryLinkWithLeftArrow", onClick: logout }, - { - children: [ - jsxRuntime.jsx(arrowLeftIcon.ArrowLeftIcon, { - color: "rgb(var(--palette-textPrimary))", - }), - t("MULTI_FACTOR_AUTH_LOGOUT"), - ], - } - ) - ), - } - ) - ); - } -); +var FactorChooserFooter = uiEntry.withOverride("MFAFactorChooserFooter", function MFAChooserFooter(_a) { + var logout = _a.logout; + var t = translationContext.useTranslation(); + return jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "row factorChooserFooter" }, + { + children: jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "secondaryText secondaryLinkWithLeftArrow", onClick: logout }, + { + children: [ + jsxRuntime.jsx(arrowLeftIcon.ArrowLeftIcon, { + color: "rgb(var(--palette-textPrimary))", + }), + t("MULTI_FACTOR_AUTH_LOGOUT"), + ], + } + ) + ), + } + ) + ); +}); -var FactorChooserHeader = uiEntry.withOverride( - "MultiFactorAuthFactorChooserHeader", - function MultiFactorAuthFactorChooserHeader(props) { - var t = translationContext.useTranslation(); - return jsxRuntime.jsx( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "row factorChooserHeader" }, - { - children: jsxRuntime.jsxs( - "div", - genericComponentOverrideContext.__assign( - { "data-supertokens": "headerTitle withBackButton" }, - { - children: [ - props.showBackButton - ? jsxRuntime.jsx(backButton.BackButton, { onClick: props.onBackButtonClicked }) - : jsxRuntime.jsx("span", { - "data-supertokens": "backButtonPlaceholder backButtonCommon", - }), - t("MULTI_FACTOR_CHOOSER_HEADER_TITLE"), - jsxRuntime.jsx("span", { - "data-supertokens": "backButtonPlaceholder backButtonCommon", - }), - ], - } - ) - ), - } - ) - ); - } -); +var FactorChooserHeader = uiEntry.withOverride("MFAFactorChooserHeader", function MFAFactorChooserHeader(props) { + var t = translationContext.useTranslation(); + return jsxRuntime.jsx( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "row factorChooserHeader" }, + { + children: jsxRuntime.jsxs( + "div", + genericComponentOverrideContext.__assign( + { "data-supertokens": "headerTitle withBackButton" }, + { + children: [ + props.showBackButton + ? jsxRuntime.jsx(backButton.BackButton, { onClick: props.onBackButtonClicked }) + : jsxRuntime.jsx("span", { + "data-supertokens": "backButtonPlaceholder backButtonCommon", + }), + t("MULTI_FACTOR_CHOOSER_HEADER_TITLE"), + jsxRuntime.jsx("span", { + "data-supertokens": "backButtonPlaceholder backButtonCommon", + }), + ], + } + ) + ), + } + ) + ); +}); -var FactorOption = uiEntry.withOverride("MultiFactorAuthFactorOption", function MultiFactorAuthFactorOption(_a) { +var FactorOption = uiEntry.withOverride("MFAFactorOption", function MFAFactorOption(_a) { var onClick = _a.onClick, id = _a.id, name = _a.name, @@ -198,7 +192,7 @@ var FactorOption = uiEntry.withOverride("MultiFactorAuthFactorOption", function ); }); -var FactorList = uiEntry.withOverride("MultiFactorAuthFactorList", function MultiFactorAuthFactorList(_a) { +var FactorList = uiEntry.withOverride("MFAFactorList", function MFAFactorList(_a) { var availableFactors = _a.availableFactors, navigateToFactor = _a.navigateToFactor; return jsxRuntime.jsx( diff --git a/lib/build/recipe/multifactorauth/types.d.ts b/lib/build/recipe/multifactorauth/types.d.ts index e861b76c0..c1a225140 100644 --- a/lib/build/recipe/multifactorauth/types.d.ts +++ b/lib/build/recipe/multifactorauth/types.d.ts @@ -1,3 +1,7 @@ +import type { FactorChooserFooter } from "./components/themes/factorChooser/factorChooserFooter"; +import type { FactorChooserHeader } from "./components/themes/factorChooser/factorChooserHeader"; +import type { FactorList } from "./components/themes/factorChooser/factorList"; +import type { FactorOption } from "./components/themes/factorChooser/factorOption"; import type { ComponentOverride } from "../../components/componentOverride/componentOverride"; import type { FeatureBaseConfig } from "../../types"; import type { @@ -10,7 +14,10 @@ import type { OverrideableBuilder } from "supertokens-js-override"; import type { RecipeInterface } from "supertokens-web-js/recipe/multifactorauth"; import type { MFAFactorInfo } from "supertokens-web-js/recipe/multifactorauth/types"; export declare type ComponentOverrideMap = { - FactorChooser_Override?: ComponentOverride; + MFAFactorChooserFooter_Override?: ComponentOverride; + MFAFactorChooserHeader_Override?: ComponentOverride; + MFAFactorList_Override?: ComponentOverride; + MFAFactorOption_Override?: ComponentOverride; }; export declare type UserInput = { firstFactors?: string[]; diff --git a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorChooserFooter.tsx b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorChooserFooter.tsx index 10473fbe1..f70658036 100644 --- a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorChooserFooter.tsx +++ b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorChooserFooter.tsx @@ -17,8 +17,8 @@ import { withOverride } from "../../../../../components/componentOverride/withOv import { useTranslation } from "../../../../../translation/translationContext"; export const FactorChooserFooter = withOverride( - "MultiFactorAuthFactorChooserFooter", - function MultiFactorAuthFactorChooserFooter({ logout }: { logout: (() => void) | undefined }): JSX.Element { + "MFAFactorChooserFooter", + function MFAChooserFooter({ logout }: { logout: (() => void) | undefined }): JSX.Element { const t = useTranslation(); return ( diff --git a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorChooserHeader.tsx b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorChooserHeader.tsx index 00b62158b..d45d3a355 100644 --- a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorChooserHeader.tsx +++ b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorChooserHeader.tsx @@ -17,11 +17,8 @@ import { useTranslation } from "../../../../../translation/translationContext"; import BackButton from "../../../../emailpassword/components/library/backButton"; export const FactorChooserHeader = withOverride( - "MultiFactorAuthFactorChooserHeader", - function MultiFactorAuthFactorChooserHeader(props: { - showBackButton: boolean; - onBackButtonClicked: () => void; - }): JSX.Element { + "MFAFactorChooserHeader", + function MFAFactorChooserHeader(props: { showBackButton: boolean; onBackButtonClicked: () => void }): JSX.Element { const t = useTranslation(); return ( diff --git a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorList.tsx b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorList.tsx index cbce96903..d0f5ed569 100644 --- a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorList.tsx +++ b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorList.tsx @@ -21,8 +21,8 @@ import type { SecondaryFactorRedirectionInfo } from "../../../types"; import type { MFAFactorInfo } from "supertokens-web-js/recipe/multifactorauth/types"; export const FactorList = withOverride( - "MultiFactorAuthFactorList", - function MultiFactorAuthFactorList({ + "MFAFactorList", + function MFAFactorList({ availableFactors, navigateToFactor, }: { diff --git a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorOption.tsx b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorOption.tsx index a0eb374d0..9df6edda1 100644 --- a/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorOption.tsx +++ b/lib/ts/recipe/multifactorauth/components/themes/factorChooser/factorOption.tsx @@ -20,8 +20,8 @@ import { useTranslation } from "../../../../../translation/translationContext"; import type { FC } from "react"; export const FactorOption = withOverride( - "MultiFactorAuthFactorOption", - function MultiFactorAuthFactorOption({ + "MFAFactorOption", + function MFAFactorOption({ onClick, id, name, @@ -42,9 +42,6 @@ export const FactorOption = withOverride(
{t(name)}

{t(description)}

- {/* - - */} ); } diff --git a/lib/ts/recipe/multifactorauth/types.ts b/lib/ts/recipe/multifactorauth/types.ts index a47873af0..c819c9258 100644 --- a/lib/ts/recipe/multifactorauth/types.ts +++ b/lib/ts/recipe/multifactorauth/types.ts @@ -13,6 +13,10 @@ * under the License. */ +import type { FactorChooserFooter } from "./components/themes/factorChooser/factorChooserFooter"; +import type { FactorChooserHeader } from "./components/themes/factorChooser/factorChooserHeader"; +import type { FactorList } from "./components/themes/factorChooser/factorList"; +import type { FactorOption } from "./components/themes/factorChooser/factorOption"; import type { ComponentOverride } from "../../components/componentOverride/componentOverride"; import type { FeatureBaseConfig } from "../../types"; import type { @@ -26,7 +30,10 @@ import type { RecipeInterface } from "supertokens-web-js/recipe/multifactorauth" import type { MFAFactorInfo } from "supertokens-web-js/recipe/multifactorauth/types"; export type ComponentOverrideMap = { - FactorChooser_Override?: ComponentOverride; // TODO + MFAFactorChooserFooter_Override?: ComponentOverride; + MFAFactorChooserHeader_Override?: ComponentOverride; + MFAFactorList_Override?: ComponentOverride; + MFAFactorOption_Override?: ComponentOverride; }; // Config is what does in the constructor of the recipe. diff --git a/lib/ts/recipe/recipeRouter/index.tsx b/lib/ts/recipe/recipeRouter/index.tsx index 14d2c063a..a29c3fee5 100644 --- a/lib/ts/recipe/recipeRouter/index.tsx +++ b/lib/ts/recipe/recipeRouter/index.tsx @@ -146,7 +146,7 @@ export abstract class RecipeRouter { // We may get here if the app is using an older BE that doesn't support MFA const enabledRecipeCount = Object.keys(dynamicLoginMethods).filter( - (key) => (dynamicLoginMethods as any)[key].enabled + (key) => (dynamicLoginMethods as any)[key]?.enabled === true ).length; // We first try to find an exact match for (const { rid, includes } of priorityOrder) { From 9d8fae13a43b2e230645430af284189fc4e4ac0c Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Wed, 6 Dec 2023 10:46:49 +0100 Subject: [PATCH 34/35] feat: allow showing matching sub-recipe components if not on websitebasepath --- lib/build/index2.js | 38 ++++++++++++++++++++++++---- lib/ts/recipe/recipeRouter/index.tsx | 29 +++++++++++++++++---- 2 files changed, 57 insertions(+), 10 deletions(-) diff --git a/lib/build/index2.js b/lib/build/index2.js index 0a37217c1..31d5e4906 100644 --- a/lib/build/index2.js +++ b/lib/build/index2.js @@ -408,9 +408,11 @@ var priorityOrder = [ }, { rid: "thirdparty", includes: ["thirdparty"], factorsProvided: ["thirdparty"] }, ]; -function chooseComponentBasedOnFirstFactors(firstFactors, routeComponents) { +function chooseComponentBasedOnFirstFactors(firstFactors, routeComponents, allowSubRecipeComp) { var fallbackRid; var fallbackComponent; + var subRecipeRid; + var subRecipeComponent; var _loop_1 = function (rid, factorsProvided) { if ( firstFactors.every(function (factor) { @@ -421,8 +423,6 @@ function chooseComponentBasedOnFirstFactors(firstFactors, routeComponents) { return comp.recipeID === rid; }); if (matchingComp) { - // This means that this gets overwritten by items lower in the prios list. - // This is intentional since this way we end up with the most specific recipe that covers all required factrors (pwless instead of tppwless) fallbackRid = rid; fallbackComponent = matchingComp; if (firstFactors.length === factorsProvided.length) { @@ -432,6 +432,19 @@ function chooseComponentBasedOnFirstFactors(firstFactors, routeComponents) { return { value: matchingComp }; } } + } else if ( + allowSubRecipeComp && + factorsProvided.some(function (factor) { + return firstFactors.includes(factor); + }) + ) { + var matchingComp = routeComponents.find(function (comp) { + return comp.recipeID === rid; + }); + if (matchingComp) { + subRecipeRid = rid; + subRecipeComponent = matchingComp; + } } }; // We first try to find an exact match, and fall back on something that covers all factors (but maybe more) @@ -443,6 +456,14 @@ function chooseComponentBasedOnFirstFactors(firstFactors, routeComponents) { if (typeof state_1 === "object") return state_1.value; } if (fallbackComponent === undefined) { + if (subRecipeComponent) { + genericComponentOverrideContext.logDebugMessage( + "Rendering " + .concat(subRecipeRid, " because it overlaps factors: ") + .concat(firstFactors, " and we are not rendering the auth page") + ); + return subRecipeComponent; + } throw new Error("No enabled recipes overlap with the requested firstFactors: " + firstFactors); } genericComponentOverrideContext.logDebugMessage( @@ -481,6 +502,9 @@ var RecipeRouter = /** @class */ (function () { ) { var _a; var path = normalisedUrl.getAsStringDangerous(); + var isNonAuthPage = + path !== + genericComponentOverrideContext.SuperTokens.getInstanceOrThrow().appInfo.websiteBasePath.getAsStringDangerous(); var routeComponents = preBuiltUIList.reduce(function (components, c) { var routes = c.getPathsToFeatureComponentWithRecipeIdMap(); for (var _i = 0, _a = Object.entries(routes); _i < _a.length; _i++) { @@ -526,7 +550,11 @@ var RecipeRouter = /** @class */ (function () { return componentMatchingRid; } if (mfaRecipe && mfaRecipe.config.firstFactors !== undefined) { - return chooseComponentBasedOnFirstFactors(mfaRecipe.config.firstFactors, routeComponents); + return chooseComponentBasedOnFirstFactors( + mfaRecipe.config.firstFactors, + routeComponents, + isNonAuthPage + ); } else { return defaultComp; } @@ -550,7 +578,7 @@ var RecipeRouter = /** @class */ (function () { return componentMatchingRid; } if (dynamicLoginMethods.firstFactors !== undefined) { - return chooseComponentBasedOnFirstFactors(dynamicLoginMethods.firstFactors, routeComponents); + return chooseComponentBasedOnFirstFactors(dynamicLoginMethods.firstFactors, routeComponents, isNonAuthPage); } // We may get here if the app is using an older BE that doesn't support MFA var enabledRecipeCount = Object.keys(dynamicLoginMethods).filter(function (key) { diff --git a/lib/ts/recipe/recipeRouter/index.tsx b/lib/ts/recipe/recipeRouter/index.tsx index a29c3fee5..a4cc5b70d 100644 --- a/lib/ts/recipe/recipeRouter/index.tsx +++ b/lib/ts/recipe/recipeRouter/index.tsx @@ -36,17 +36,18 @@ const priorityOrder: { function chooseComponentBasedOnFirstFactors( firstFactors: string[], - routeComponents: ComponentWithRecipeAndMatchingMethod[] + routeComponents: ComponentWithRecipeAndMatchingMethod[], + allowSubRecipeComp: boolean ) { let fallbackRid; let fallbackComponent; + let subRecipeRid; + let subRecipeComponent; // We first try to find an exact match, and fall back on something that covers all factors (but maybe more) for (const { rid, factorsProvided } of priorityOrder) { if (firstFactors.every((factor) => factorsProvided.includes(factor))) { const matchingComp = routeComponents.find((comp) => comp.recipeID === rid); if (matchingComp) { - // This means that this gets overwritten by items lower in the prios list. - // This is intentional since this way we end up with the most specific recipe that covers all required factrors (pwless instead of tppwless) fallbackRid = rid; fallbackComponent = matchingComp; if (firstFactors.length === factorsProvided.length) { @@ -54,10 +55,23 @@ function chooseComponentBasedOnFirstFactors( return matchingComp; } } + } else if (allowSubRecipeComp && factorsProvided.some((factor) => firstFactors.includes(factor))) { + const matchingComp = routeComponents.find((comp) => comp.recipeID === rid); + if (matchingComp) { + subRecipeRid = rid; + subRecipeComponent = matchingComp; + } } } if (fallbackComponent === undefined) { + if (subRecipeComponent) { + logDebugMessage( + `Rendering ${subRecipeRid} because it overlaps factors: ${firstFactors} and we are not rendering the auth page` + ); + return subRecipeComponent; + } + throw new Error("No enabled recipes overlap with the requested firstFactors: " + firstFactors); } @@ -75,6 +89,7 @@ export abstract class RecipeRouter { dynamicLoginMethods?: GetLoginMethodsResponseNormalized ): ComponentWithRecipeAndMatchingMethod | undefined { const path = normalisedUrl.getAsStringDangerous(); + const isNonAuthPage = path !== SuperTokens.getInstanceOrThrow().appInfo.websiteBasePath.getAsStringDangerous(); const routeComponents = preBuiltUIList.reduce((components, c) => { const routes = c.getPathsToFeatureComponentWithRecipeIdMap(); @@ -119,7 +134,11 @@ export abstract class RecipeRouter { } if (mfaRecipe && mfaRecipe.config.firstFactors !== undefined) { - return chooseComponentBasedOnFirstFactors(mfaRecipe.config.firstFactors, routeComponents); + return chooseComponentBasedOnFirstFactors( + mfaRecipe.config.firstFactors, + routeComponents, + isNonAuthPage + ); } else { return defaultComp; } @@ -141,7 +160,7 @@ export abstract class RecipeRouter { } if (dynamicLoginMethods.firstFactors !== undefined) { - return chooseComponentBasedOnFirstFactors(dynamicLoginMethods.firstFactors, routeComponents); + return chooseComponentBasedOnFirstFactors(dynamicLoginMethods.firstFactors, routeComponents, isNonAuthPage); } // We may get here if the app is using an older BE that doesn't support MFA From ec913fb2006cedde3ccbc3b053a8a67e51734d0c Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Sun, 10 Dec 2023 20:25:07 +0100 Subject: [PATCH 35/35] fix: exposing mfa in tppwless + cleanup/refactor --- examples/for-tests-react-16/src/App.js | 8 ++ examples/for-tests/src/App.js | 6 +- lib/build/passwordless-shared3.js | 82 ++++++------------- .../thirdpartypasswordless/prebuiltui.d.ts | 10 ++- .../recipe/thirdpartypasswordless/types.d.ts | 1 + lib/build/thirdpartypasswordless-shared.js | 1 + lib/build/thirdpartypasswordlessprebuiltui.js | 16 +++- .../components/features/mfa/index.tsx | 61 +++++--------- .../thirdpartypasswordless/prebuiltui.tsx | 16 +++- lib/ts/recipe/thirdpartypasswordless/types.ts | 1 + lib/ts/recipe/thirdpartypasswordless/utils.ts | 1 + test/with-typescript/src/App.tsx | 18 ++++ 12 files changed, 118 insertions(+), 103 deletions(-) diff --git a/examples/for-tests-react-16/src/App.js b/examples/for-tests-react-16/src/App.js index 63b2e0aad..ef83fa06d 100644 --- a/examples/for-tests-react-16/src/App.js +++ b/examples/for-tests-react-16/src/App.js @@ -767,6 +767,10 @@ function getThirdPartyPasswordlessConfigs({ staticProviderList, disableDefaultUI disableDefaultUI, style: theme.style, }, + mfaFeature: { + disableDefaultUI, + style: theme, + }, }); } @@ -845,6 +849,10 @@ function getPasswordlessConfigs({ disableDefaultUI }) { disableDefaultUI, style: theme.style, }, + mfaFeature: { + disableDefaultUI, + style: theme, + }, }); } diff --git a/examples/for-tests/src/App.js b/examples/for-tests/src/App.js index e2f3bbbeb..29611c0c3 100644 --- a/examples/for-tests/src/App.js +++ b/examples/for-tests/src/App.js @@ -991,6 +991,10 @@ function getThirdPartyPasswordlessConfigs({ staticProviderList, disableDefaultUI disableDefaultUI, style: theme, }, + mfaFeature: { + disableDefaultUI, + style: theme, + }, }); } @@ -1078,7 +1082,7 @@ function getPasswordlessConfigs({ disableDefaultUI }) { disableDefaultUI, style: theme, }, - mfa: { + mfaFeature: { disableDefaultUI, style: theme, }, diff --git a/lib/build/passwordless-shared3.js b/lib/build/passwordless-shared3.js index cacce2685..62f455661 100644 --- a/lib/build/passwordless-shared3.js +++ b/lib/build/passwordless-shared3.js @@ -3802,7 +3802,14 @@ function useOnLoad(props, recipeImplementation, dispatch, userContext) { var onLoad = React__namespace.useCallback( function (mfaInfo) { return genericComponentOverrideContext.__awaiter(_this, void 0, void 0, function () { - var error, errorQueryParam, doSetup, loginAttemptInfo, isAlreadySetup, isAllowedToSetup; + var error, + errorQueryParam, + doSetup, + loginAttemptInfo, + isAlreadySetup, + isAllowedToSetup, + createCodeInfo, + factorId; return genericComponentOverrideContext.__generator(this, function (_a) { switch (_a.label) { case 0: @@ -3828,8 +3835,12 @@ function useOnLoad(props, recipeImplementation, dispatch, userContext) { props.contactMethod === "EMAIL" ? mfaInfo.factors.isAllowedToSetup.includes("otp-email") : mfaInfo.factors.isAllowedToSetup.includes("otp-phone"); - if (!!loginAttemptInfo) return [3 /*break*/, 15]; - if (!(props.contactMethod === "EMAIL")) return [3 /*break*/, 8]; + if (!!loginAttemptInfo) return [3 /*break*/, 8]; + createCodeInfo = + props.contactMethod === "EMAIL" + ? { email: mfaInfo.email } + : { phoneNumber: mfaInfo.phoneNumber }; + factorId = props.contactMethod === "EMAIL" ? "otp-email" : "otp-phone"; if (!(isAlreadySetup && doSetup !== "true")) return [3 /*break*/, 6]; _a.label = 2; case 2: @@ -3837,10 +3848,12 @@ function useOnLoad(props, recipeImplementation, dispatch, userContext) { // createCode also dispatches the necessary events return [ 4 /*yield*/, - recipeImplementation.createCode({ - email: mfaInfo.email, - userContext: userContext, - }), + recipeImplementation.createCode( + genericComponentOverrideContext.__assign( + genericComponentOverrideContext.__assign({}, createCodeInfo), + { userContext: userContext } + ) + ), ]; case 3: // createCode also dispatches the necessary events @@ -3853,67 +3866,26 @@ function useOnLoad(props, recipeImplementation, dispatch, userContext) { case 5: return [3 /*break*/, 7]; case 6: - if (!mfaInfo.factors.isAllowedToSetup.includes("otp-email")) { + if (!mfaInfo.factors.isAllowedToSetup.includes(factorId)) { dispatch({ type: "load", - loginAttemptInfo: loginAttemptInfo, + loginAttemptInfo: undefined, isAllowedToSetup: false, error: "PWLESS_MFA_OTP_NOT_ALLOWED_TO_SETUP", }); } else { + // since loginAttemptInfo is undefined, this will ask the user for the email/phone dispatch({ type: "load", loginAttemptInfo: loginAttemptInfo, error: error, isAllowedToSetup: true, - }); // since loginAttemptInfo is undefined, this will ask the user for the email + }); } _a.label = 7; case 7: - return [3 /*break*/, 14]; + return [3 /*break*/, 9]; case 8: - if (!(isAlreadySetup && doSetup !== "true")) return [3 /*break*/, 13]; - _a.label = 9; - case 9: - _a.trys.push([9, 11, , 12]); - // createCode also dispatches the necessary events - return [ - 4 /*yield*/, - recipeImplementation.createCode({ - phoneNumber: mfaInfo.phoneNumber, - userContext: userContext, - }), - ]; - case 10: - // createCode also dispatches the necessary events - _a.sent(); - return [3 /*break*/, 12]; - case 11: - _a.sent(); - dispatch({ type: "setError", error: "SOMETHING_WENT_WRONG_ERROR" }); - return [3 /*break*/, 12]; - case 12: - return [3 /*break*/, 14]; - case 13: - if (!mfaInfo.factors.isAllowedToSetup.includes("otp-phone")) { - dispatch({ - type: "load", - loginAttemptInfo: loginAttemptInfo, - isAllowedToSetup: false, - error: "PWLESS_MFA_OTP_NOT_ALLOWED_TO_SETUP", - }); - } else { - dispatch({ - type: "load", - loginAttemptInfo: loginAttemptInfo, - error: error, - isAllowedToSetup: true, - }); // since loginAttemptInfo is undefined, this will ask the user for the phone number - } - _a.label = 14; - case 14: - return [3 /*break*/, 16]; - case 15: // No need to check if the component is unmounting, since this has no effect then. dispatch({ type: "load", @@ -3921,8 +3893,8 @@ function useOnLoad(props, recipeImplementation, dispatch, userContext) { error: error, isAllowedToSetup: isAllowedToSetup, }); - _a.label = 16; - case 16: + _a.label = 9; + case 9: return [2 /*return*/]; } }); diff --git a/lib/build/recipe/thirdpartypasswordless/prebuiltui.d.ts b/lib/build/recipe/thirdpartypasswordless/prebuiltui.d.ts index 773b9b4cd..cdf4b0d10 100644 --- a/lib/build/recipe/thirdpartypasswordless/prebuiltui.d.ts +++ b/lib/build/recipe/thirdpartypasswordless/prebuiltui.d.ts @@ -13,7 +13,7 @@ export declare class ThirdPartyPasswordlessPreBuiltUI extends RecipeRouter { static getInstanceOrInitAndGetInstance(): ThirdPartyPasswordlessPreBuiltUI; static getFeatures(useComponentOverrides?: () => GenericComponentOverrideMap): RecipeFeatureComponentMap; static getFeatureComponent( - componentName: "signInUp" | "linkClickedScreen" | "signinupcallback", + componentName: "signInUp" | "linkClickedScreen" | "signinupcallback" | "otp-phone" | "otp-email", props: FeatureBaseProps & { redirectOnSessionExists?: boolean; userContext?: any; @@ -21,7 +21,7 @@ export declare class ThirdPartyPasswordlessPreBuiltUI extends RecipeRouter { useComponentOverrides?: () => GenericComponentOverrideMap ): JSX.Element; getFeatureComponent: ( - componentName: "signInUp" | "linkClickedScreen" | "signinupcallback", + componentName: "signInUp" | "linkClickedScreen" | "signinupcallback" | "otp-phone" | "otp-email", props: FeatureBaseProps & { redirectOnSessionExists?: boolean; userContext?: any; @@ -39,6 +39,8 @@ export declare class ThirdPartyPasswordlessPreBuiltUI extends RecipeRouter { static ThirdPartySignInAndUpCallback: (prop?: any) => JSX.Element; static SignInUpTheme: typeof SignInUpTheme; static PasswordlessLinkClicked: (prop?: any) => JSX.Element; + static MfaOtpPhone: (prop?: any) => JSX.Element; + static MfaOtpEmail: (prop?: any) => JSX.Element; } declare const SignInAndUp: ( prop?: PropsWithChildren<{ @@ -48,4 +50,6 @@ declare const SignInAndUp: ( ) => JSX.Element; declare const ThirdPartySignInAndUpCallback: (prop?: any) => JSX.Element; declare const PasswordlessLinkClicked: (prop?: any) => JSX.Element; -export { SignInAndUp, ThirdPartySignInAndUpCallback, PasswordlessLinkClicked, SignInUpTheme }; +declare const MfaOtpPhone: (prop?: any) => JSX.Element; +declare const MfaOtpEmail: (prop?: any) => JSX.Element; +export { SignInAndUp, ThirdPartySignInAndUpCallback, PasswordlessLinkClicked, SignInUpTheme, MfaOtpPhone, MfaOtpEmail }; diff --git a/lib/build/recipe/thirdpartypasswordless/types.d.ts b/lib/build/recipe/thirdpartypasswordless/types.d.ts index b328d24f2..0fa2fc39b 100644 --- a/lib/build/recipe/thirdpartypasswordless/types.d.ts +++ b/lib/build/recipe/thirdpartypasswordless/types.d.ts @@ -89,6 +89,7 @@ export declare type UserInput = ( ) => RecipeInterface; }; linkClickedScreenFeature?: PasswordlessFeatureBaseConfig; + mfaFeature?: PasswordlessFeatureBaseConfig; oAuthCallbackScreen?: FeatureBaseConfig; disablePasswordless?: boolean; } & AuthRecipeModuleUserInput; diff --git a/lib/build/thirdpartypasswordless-shared.js b/lib/build/thirdpartypasswordless-shared.js index ef7d96ef0..47576003b 100644 --- a/lib/build/thirdpartypasswordless-shared.js +++ b/lib/build/thirdpartypasswordless-shared.js @@ -236,6 +236,7 @@ function normaliseThirdPartyPasswordlessConfig(config) { { emailOrPhoneFormStyle: thirdPartyProviderAndEmailOrPhoneFormStyle } ), linkClickedScreenFeature: config.linkClickedScreenFeature, + mfaFeature: config.mfaFeature, override: {}, }), disablePasswordless: config.disablePasswordless === true, diff --git a/lib/build/thirdpartypasswordlessprebuiltui.js b/lib/build/thirdpartypasswordlessprebuiltui.js index b17e4eb70..fdef202cd 100644 --- a/lib/build/thirdpartypasswordlessprebuiltui.js +++ b/lib/build/thirdpartypasswordlessprebuiltui.js @@ -566,7 +566,11 @@ var ThirdPartyPasswordlessPreBuiltUI = /** @class */ (function (_super) { ) ); } - } else if (componentName === "linkClickedScreen") { + } else if ( + "linkClickedScreen" === componentName || + "otp-phone" === componentName || + "otp-email" === componentName + ) { if (_this.passwordlessPreBuiltUI === undefined) { throw new Error( "Embedding this component requires the passwordless recipe to be enabled. Please check the value of disablePasswordless in the configuration." @@ -684,12 +688,22 @@ var ThirdPartyPasswordlessPreBuiltUI = /** @class */ (function (_super) { ThirdPartyPasswordlessPreBuiltUI.PasswordlessLinkClicked = function (prop) { return _a.getFeatureComponent("linkClickedScreen", prop); }; + ThirdPartyPasswordlessPreBuiltUI.MfaOtpPhone = function (prop) { + return _a.getFeatureComponent("otp-phone", prop); + }; + ThirdPartyPasswordlessPreBuiltUI.MfaOtpEmail = function (prop) { + return _a.getFeatureComponent("otp-email", prop); + }; return ThirdPartyPasswordlessPreBuiltUI; })(uiEntry.RecipeRouter); var SignInAndUp = ThirdPartyPasswordlessPreBuiltUI.SignInAndUp; var ThirdPartySignInAndUpCallback = ThirdPartyPasswordlessPreBuiltUI.ThirdPartySignInAndUpCallback; var PasswordlessLinkClicked = ThirdPartyPasswordlessPreBuiltUI.PasswordlessLinkClicked; +var MfaOtpPhone = passwordlessprebuiltui.PasswordlessPreBuiltUI.MfaOtpPhone; +var MfaOtpEmail = passwordlessprebuiltui.PasswordlessPreBuiltUI.MfaOtpEmail; +exports.MfaOtpEmail = MfaOtpEmail; +exports.MfaOtpPhone = MfaOtpPhone; exports.PasswordlessLinkClicked = PasswordlessLinkClicked; exports.SignInAndUp = SignInAndUp; exports.SignInUpTheme = SignInUpThemeWrapper; diff --git a/lib/ts/recipe/passwordless/components/features/mfa/index.tsx b/lib/ts/recipe/passwordless/components/features/mfa/index.tsx index 000a8e2eb..2f533420f 100644 --- a/lib/ts/recipe/passwordless/components/features/mfa/index.tsx +++ b/lib/ts/recipe/passwordless/components/features/mfa/index.tsx @@ -321,48 +321,31 @@ function useOnLoad( : mfaInfo.factors.isAllowedToSetup.includes("otp-phone"); if (!loginAttemptInfo) { - if (props.contactMethod === "EMAIL") { - if (isAlreadySetup && doSetup !== "true") { - try { - // createCode also dispatches the necessary events - await recipeImplementation!.createCode({ - email: mfaInfo.email!, // We can assume this is set here, since the mfaInfo states that otp-email has been set up - userContext, - }); - } catch (err) { - dispatch({ type: "setError", error: "SOMETHING_WENT_WRONG_ERROR" }); - } - } else if (!mfaInfo.factors.isAllowedToSetup.includes("otp-email")) { - dispatch({ - type: "load", - loginAttemptInfo, - isAllowedToSetup: false, - error: "PWLESS_MFA_OTP_NOT_ALLOWED_TO_SETUP", + // We can assume these are defined if we use these, we check that the mfaInfo states that the related factor has been set up + const createCodeInfo = + props.contactMethod === "EMAIL" ? { email: mfaInfo.email! } : { phoneNumber: mfaInfo.phoneNumber! }; + const factorId = props.contactMethod === "EMAIL" ? "otp-email" : "otp-phone"; + + if (isAlreadySetup && doSetup !== "true") { + try { + // createCode also dispatches the necessary events + await recipeImplementation!.createCode({ + ...createCodeInfo, + userContext, }); - } else { - dispatch({ type: "load", loginAttemptInfo, error, isAllowedToSetup: true }); // since loginAttemptInfo is undefined, this will ask the user for the email + } catch (err) { + dispatch({ type: "setError", error: "SOMETHING_WENT_WRONG_ERROR" }); } + } else if (!mfaInfo.factors.isAllowedToSetup.includes(factorId)) { + dispatch({ + type: "load", + loginAttemptInfo: undefined, + isAllowedToSetup: false, + error: "PWLESS_MFA_OTP_NOT_ALLOWED_TO_SETUP", + }); } else { - if (isAlreadySetup && doSetup !== "true") { - try { - // createCode also dispatches the necessary events - await recipeImplementation!.createCode({ - phoneNumber: mfaInfo.phoneNumber!, // We can assume this is set here, since the mfaInfo states that otp-phone has been set up - userContext, - }); - } catch (err) { - dispatch({ type: "setError", error: "SOMETHING_WENT_WRONG_ERROR" }); - } - } else if (!mfaInfo.factors.isAllowedToSetup.includes("otp-phone")) { - dispatch({ - type: "load", - loginAttemptInfo, - isAllowedToSetup: false, - error: "PWLESS_MFA_OTP_NOT_ALLOWED_TO_SETUP", - }); - } else { - dispatch({ type: "load", loginAttemptInfo, error, isAllowedToSetup: true }); // since loginAttemptInfo is undefined, this will ask the user for the phone number - } + // since loginAttemptInfo is undefined, this will ask the user for the email/phone + dispatch({ type: "load", loginAttemptInfo, error, isAllowedToSetup: true }); } } else { // No need to check if the component is unmounting, since this has no effect then. diff --git a/lib/ts/recipe/thirdpartypasswordless/prebuiltui.tsx b/lib/ts/recipe/thirdpartypasswordless/prebuiltui.tsx index c711fd757..8776876ee 100644 --- a/lib/ts/recipe/thirdpartypasswordless/prebuiltui.tsx +++ b/lib/ts/recipe/thirdpartypasswordless/prebuiltui.tsx @@ -54,7 +54,7 @@ export class ThirdPartyPasswordlessPreBuiltUI extends RecipeRouter { return ThirdPartyPasswordlessPreBuiltUI.getInstanceOrInitAndGetInstance().getFeatures(useComponentOverrides); } static getFeatureComponent( - componentName: "signInUp" | "linkClickedScreen" | "signinupcallback", + componentName: "signInUp" | "linkClickedScreen" | "signinupcallback" | "otp-phone" | "otp-email", props: FeatureBaseProps & { redirectOnSessionExists?: boolean; userContext?: any }, useComponentOverrides: () => GenericComponentOverrideMap = useRecipeComponentOverrideContext ): JSX.Element { @@ -67,7 +67,7 @@ export class ThirdPartyPasswordlessPreBuiltUI extends RecipeRouter { // Instance methods getFeatureComponent = ( - componentName: "signInUp" | "linkClickedScreen" | "signinupcallback", + componentName: "signInUp" | "linkClickedScreen" | "signinupcallback" | "otp-phone" | "otp-email", props: FeatureBaseProps & { redirectOnSessionExists?: boolean; userContext?: any }, useComponentOverrides: () => GenericComponentOverrideMap = useRecipeComponentOverrideContext ): JSX.Element => { @@ -102,7 +102,11 @@ export class ThirdPartyPasswordlessPreBuiltUI extends RecipeRouter { ); } - } else if (componentName === "linkClickedScreen") { + } else if ( + "linkClickedScreen" === componentName || + "otp-phone" === componentName || + "otp-email" === componentName + ) { if (this.passwordlessPreBuiltUI === undefined) { throw new Error( "Embedding this component requires the passwordless recipe to be enabled. Please check the value of disablePasswordless in the configuration." @@ -176,10 +180,14 @@ export class ThirdPartyPasswordlessPreBuiltUI extends RecipeRouter { static SignInUpTheme = SignInUpTheme; static PasswordlessLinkClicked = (prop?: any) => this.getFeatureComponent("linkClickedScreen", prop); + static MfaOtpPhone = (prop?: any) => this.getFeatureComponent("otp-phone", prop); + static MfaOtpEmail = (prop?: any) => this.getFeatureComponent("otp-email", prop); } const SignInAndUp = ThirdPartyPasswordlessPreBuiltUI.SignInAndUp; const ThirdPartySignInAndUpCallback = ThirdPartyPasswordlessPreBuiltUI.ThirdPartySignInAndUpCallback; const PasswordlessLinkClicked = ThirdPartyPasswordlessPreBuiltUI.PasswordlessLinkClicked; +const MfaOtpPhone = PasswordlessPreBuiltUI.MfaOtpPhone; +const MfaOtpEmail = PasswordlessPreBuiltUI.MfaOtpEmail; -export { SignInAndUp, ThirdPartySignInAndUpCallback, PasswordlessLinkClicked, SignInUpTheme }; +export { SignInAndUp, ThirdPartySignInAndUpCallback, PasswordlessLinkClicked, SignInUpTheme, MfaOtpPhone, MfaOtpEmail }; diff --git a/lib/ts/recipe/thirdpartypasswordless/types.ts b/lib/ts/recipe/thirdpartypasswordless/types.ts index 4c0bc8e98..0fa42cfec 100644 --- a/lib/ts/recipe/thirdpartypasswordless/types.ts +++ b/lib/ts/recipe/thirdpartypasswordless/types.ts @@ -123,6 +123,7 @@ export type UserInput = ( ) => RecipeInterface; }; linkClickedScreenFeature?: PasswordlessFeatureBaseConfig; + mfaFeature?: PasswordlessFeatureBaseConfig; oAuthCallbackScreen?: FeatureBaseConfig; disablePasswordless?: boolean; } & AuthRecipeModuleUserInput; diff --git a/lib/ts/recipe/thirdpartypasswordless/utils.ts b/lib/ts/recipe/thirdpartypasswordless/utils.ts index 9a0e74eeb..48ef02ba0 100644 --- a/lib/ts/recipe/thirdpartypasswordless/utils.ts +++ b/lib/ts/recipe/thirdpartypasswordless/utils.ts @@ -68,6 +68,7 @@ export function normaliseThirdPartyPasswordlessConfig(config?: Config): Normalis emailOrPhoneFormStyle: thirdPartyProviderAndEmailOrPhoneFormStyle, }, linkClickedScreenFeature: config.linkClickedScreenFeature, + mfaFeature: config.mfaFeature, override: {}, }), disablePasswordless: config.disablePasswordless === true, diff --git a/test/with-typescript/src/App.tsx b/test/with-typescript/src/App.tsx index b47daecf6..ebcd3bd1b 100644 --- a/test/with-typescript/src/App.tsx +++ b/test/with-typescript/src/App.tsx @@ -1465,3 +1465,21 @@ MultiFactorAuth.init({ { id: "asfd", logo: () =>
A
, description: "test", name: "asdf", path: "/mfa/asdf" }, ], }); + +Passwordless.init({ + contactMethod: "EMAIL", + mfaFeature: { + style: "", + }, +}); + +ThirdPartyPasswordless.init({ + contactMethod: "EMAIL", + mfaFeature: { + style: "", + }, +}); + +ThirdPartyPasswordless.init({ + contactMethod: "EMAIL", +});