diff --git a/.gitignore b/.gitignore
index 069d8bc67..8240e729b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
.DS_Store
/.history
.vscode
+.idea
coverage
apiPassword
releasePassword
diff --git a/.npmignore b/.npmignore
index f41ff5237..c48041a04 100644
--- a/.npmignore
+++ b/.npmignore
@@ -20,4 +20,5 @@ frontendDriverInterfaceSupported.json
.babelrc
.gitattributes
examples/
-.prettierignore
\ No newline at end of file
+.prettierignore
+other/
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 738211040..ad7ab77dc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,30 @@ 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.14.0] - 2021-05-24
+
+### Added:
+
+- Ability to override recipe functions to customize the behavior of feature components.
+- Refactors code to:
+ - Make types simpler.
+ - Remove components folder from AuthRecipeModule, and puts them in the themes of the respective recipes.
+ - Uses redirectToAuth everywhere instead of calling redirect manually.
+ - Adds additional props / config to Session and EmailVerification recipe to make them more isolated
+ - Passes recipe to feature components directly, as opposed to recipeId
+- In session recipe, we remove `setAuth0API` and `getAuth0API`
+- Removes `GET_REDIRECTION_URL` from the possible action types for `getRedirectionURL`.
+- Changes `redirectToAuth` to take an object and adds `redirectBack` param, which can be used to indicate if the user should be redirected to the current page.
+- Removes `getRefreshURLDomain` function from session recipe.
+- Moves `SIGN_OUT` even and pre API hook into the Session recipe.
+- Change to type of `preAPIHook` function
+- Uses supertokens-website version >= 8.0
+- Changed `SIGN_IN`, `SIGN_UP` Pre API hook action to `EMAIL_PASSWORD_SIGN_IN`, `EMAIL_PASSWORD_SIGN_UP` or `THIRD_PARTY_SIGN_IN_UP`
+
+### Fixed:
+
+- State update post unmounting when using EmailVerification wrapper.
+
## [0.13.2] - 2021-06-05
### Added:
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 3dea6954f..9a5fd84cf 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -85,8 +85,6 @@ We're so excited you're interested in helping with SuperTokens! We are happy to
npm run test
```
- VSCode User snippets to use with puppeteer: https://gist.github.com/NkxxkN/ae6c0ba190c0a1fda7a4a11f9d59235c
-
## Run the test application.
1. `npm run start`
diff --git a/examples/for-tests/src/App.js b/examples/for-tests/src/App.js
index 8500e4cfc..5099e83df 100644
--- a/examples/for-tests/src/App.js
+++ b/examples/for-tests/src/App.js
@@ -17,6 +17,7 @@ import Button from "./Button";
import DarkTheme from "./Themes/Dark";
import HeliumTheme from "./Themes/Helium";
import HydrogenTheme from "./Themes/Hydrogen";
+import { logWithPrefix } from "./logWithPrefix";
Session.addAxiosInterceptors(axios);
@@ -124,16 +125,66 @@ const formFields = [
},
];
-let recipeList = [Session.init()];
+let recipeList = [
+ Session.init({
+ override: {
+ functions: (implementation) => {
+ const log = logWithPrefix(`ST_LOGS SESSION OVERRIDE`);
+
+ return {
+ addAxiosInterceptors(...args) {
+ log(`ADD_AXIOS_INTERCEPTORS`);
+ return implementation.addAxiosInterceptors(...args);
+ },
+ addFetchInterceptorsAndReturnModifiedFetch(...args) {
+ log(`ADD_FETCH_INTERCEPTORS_AND_RETURN_MODIFIED_FETCH`);
+ return implementation.addFetchInterceptorsAndReturnModifiedFetch(...args);
+ },
+ doesSessionExist(...args) {
+ log(`DOES_SESSION_EXIST`);
+ return implementation.doesSessionExist(...args);
+ },
+ getJWTPayloadSecurely(...args) {
+ log(`GET_JWT_PAYLOAD_SECURELY`);
+ return implementation.getJWTPayloadSecurely(...args);
+ },
+ getUserId(...args) {
+ log(`GET_USER_ID`);
+ return implementation.getUserId(...args);
+ },
+ signOut(...args) {
+ log(`SIGN_OUT`);
+ return implementation.signOut(...args);
+ },
+ };
+ },
+ },
+ preAPIHook: (ctx) => {
+ // See https://github.com/supertokens/supertokens-auth-react/issues/267
+ if (ctx.action !== "REFRESH_SESSION") {
+ console.log(`ST_LOGS SESSION PRE_API_HOOKS ${ctx.action}`);
+ }
+
+ return ctx;
+ },
+ onHandleEvent: (ctx) => {
+ console.log(`ST_LOGS SESSION ON_HANDLE_EVENT ${ctx.action}`);
+ },
+ }),
+];
+
+const testContext = {
+ disableDefaultImplementation: getQueryParams("disableDefaultImplementation") === "true",
+};
if (authRecipe === "thirdparty") {
- recipeList = [getThirdPartyConfigs(), ...recipeList];
+ recipeList = [getThirdPartyConfigs(testContext), ...recipeList];
} else if (authRecipe === "emailpassword") {
- recipeList = [getEmailPasswordConfigs(), ...recipeList];
+ recipeList = [getEmailPasswordConfigs(testContext), ...recipeList];
} else if (authRecipe === "both") {
- recipeList = [getEmailPasswordConfigs(), getThirdPartyConfigs(), ...recipeList];
+ recipeList = [getEmailPasswordConfigs(testContext), getThirdPartyConfigs(testContext), ...recipeList];
} else if (authRecipe === "thirdpartyemailpassword") {
- recipeList = [getThirdPartyEmailPasswordConfigs(), ...recipeList];
+ recipeList = [getThirdPartyEmailPasswordConfigs(testContext), ...recipeList];
}
SuperTokens.init({
@@ -146,10 +197,12 @@ SuperTokens.init({
recipeList,
});
+let doNotUseReactRouterDom = localStorage.getItem("useReactRouterDom") === "false";
+
/* App */
function App() {
const router = getQueryParams("router");
- if (router === "no-router") {
+ if (router === "no-router" || doNotUseReactRouterDom) {
return ;
}
@@ -298,12 +351,60 @@ function SessionInfoTable({ sessionInfo }) {
);
}
-function getEmailPasswordConfigs() {
+function getEmailPasswordConfigs({ disableDefaultImplementation }) {
return EmailPassword.init({
+ override: {
+ emailVerification: {
+ functions: (implementation) => {
+ const log = logWithPrefix(`ST_LOGS EMAIL_PASSWORD OVERRIDE EMAIL_VERIFICATION`);
+
+ return {
+ sendVerificationEmail(...args) {
+ log(`SEND_VERIFICATION_EMAIL`);
+ return implementation.sendVerificationEmail(...args);
+ },
+ isEmailVerified(...args) {
+ log(`IS_EMAIL_VERIFIED`);
+ return implementation.isEmailVerified(...args);
+ },
+ verifyEmail(...args) {
+ log(`VERIFY_EMAIL`);
+ return implementation.verifyEmail(...args);
+ },
+ };
+ },
+ },
+ functions: (implementation) => {
+ const log = logWithPrefix(`ST_LOGS EMAIL_PASSWORD OVERRIDE`);
+
+ return {
+ doesEmailExist(...args) {
+ log(`DOES_EMAIL_EXIST`);
+ return implementation.doesEmailExist(...args);
+ },
+ sendPasswordResetEmail(...args) {
+ log(`SEND_PASSWORD_RESET_EMAIL`);
+ return implementation.sendPasswordResetEmail(...args);
+ },
+ signIn(...args) {
+ log(`SIGN_IN`);
+ return implementation.signIn(...args);
+ },
+ signUp(...args) {
+ log(`SIGN_UP`);
+ return implementation.signUp(...args);
+ },
+ submitNewPassword(...args) {
+ log(`SUBMIT_NEW_PASSWORD`);
+ return implementation.submitNewPassword(...args);
+ },
+ };
+ },
+ },
palette: theme.colors,
preAPIHook: async (context) => {
console.log(`ST_LOGS EMAIL_PASSWORD PRE_API_HOOKS ${context.action}`);
- return context.requestInit;
+ return context;
},
getRedirectionURL: async (context) => {
console.log(`ST_LOGS EMAIL_PASSWORD GET_REDIRECTION_URL ${context.action}`);
@@ -316,6 +417,7 @@ function getEmailPasswordConfigs() {
},
useShadowDom,
emailVerificationFeature: {
+ disableDefaultImplementation,
sendVerifyEmailScreen: {
style: theme.style,
},
@@ -325,6 +427,7 @@ function getEmailPasswordConfigs() {
mode: emailVerificationMode,
},
resetPasswordUsingTokenFeature: {
+ disableDefaultImplementation,
enterEmailForm: {
style: theme.style,
},
@@ -333,6 +436,7 @@ function getEmailPasswordConfigs() {
},
},
signInAndUpFeature: {
+ disableDefaultImplementation,
defaultToSignUp,
signInForm: {
style: theme.style,
@@ -347,11 +451,11 @@ function getEmailPasswordConfigs() {
});
}
-function getThirdPartyConfigs() {
+function getThirdPartyConfigs({ disableDefaultImplementation }) {
return ThirdParty.init({
preAPIHook: async (context) => {
console.log(`ST_LOGS THIRD_PARTY PRE_API_HOOKS ${context.action}`);
- return context.requestInit;
+ return context;
},
getRedirectionURL: async (context) => {
console.log(`ST_LOGS THIRD_PARTY GET_REDIRECTION_URL ${context.action}`);
@@ -362,13 +466,62 @@ function getThirdPartyConfigs() {
onHandleEvent: async (context) => {
console.log(`ST_LOGS THIRD_PARTY ON_HANDLE_EVENT ${context.action}`);
},
-
+ override: {
+ emailVerification: {
+ functions: (implementation) => {
+ const log = logWithPrefix(`ST_LOGS THIRD_PARTY OVERRIDE EMAIL_VERIFICATION`);
+
+ return {
+ sendVerificationEmail(...args) {
+ log(`SEND_VERIFICATION_EMAIL`);
+ return implementation.sendVerificationEmail(...args);
+ },
+ isEmailVerified(...args) {
+ log(`IS_EMAIL_VERIFIED`);
+ return implementation.isEmailVerified(...args);
+ },
+ verifyEmail(...args) {
+ log(`VERIFY_EMAIL`);
+ return implementation.verifyEmail(...args);
+ },
+ };
+ },
+ },
+ functions: (implementation) => {
+ const log = logWithPrefix(`ST_LOGS THIRD_PARTY OVERRIDE`);
+
+ return {
+ getOAuthAuthorisationURL(...args) {
+ log(`GET_OAUTH_AUTHORISATION_URL`);
+ return implementation.getOAuthAuthorisationURL(...args);
+ },
+ getOAuthState(...args) {
+ log(`GET_OAUTH_STATE`);
+ return implementation.getOAuthState(...args);
+ },
+ redirectToThirdPartyLogin(...args) {
+ log(`REDIRECT_TO_THIRD_PARTY_LOGIN`);
+ return implementation.redirectToThirdPartyLogin(...args);
+ },
+ setOAuthState(...args) {
+ log(`SET_OAUTH_STATE`);
+ return implementation.setOAuthState(...args);
+ },
+ signInAndUp(...args) {
+ log(`SIGN_IN_AND_UP`);
+ return implementation.signInAndUp(...args);
+ },
+ };
+ },
+ },
useShadowDom,
palette: theme.colors,
emailVerificationFeature: {
+ disableDefaultImplementation,
mode: emailVerificationMode,
},
signInAndUpFeature: {
+ disableDefaultImplementation,
style: theme.style,
privacyPolicyLink: "https://supertokens.io/legal/privacy-policy",
termsOfServiceLink: "https://supertokens.io/legal/terms-and-conditions",
@@ -386,11 +539,11 @@ function getThirdPartyConfigs() {
});
}
-function getThirdPartyEmailPasswordConfigs() {
+function getThirdPartyEmailPasswordConfigs({ disableDefaultImplementation }) {
return ThirdPartyEmailPassword.init({
preAPIHook: async (context) => {
console.log(`ST_LOGS THIRD_PARTY_EMAIL_PASSWORD PRE_API_HOOKS ${context.action}`);
- return context.requestInit;
+ return context;
},
getRedirectionURL: async (context) => {
console.log(`ST_LOGS THIRD_PARTY_EMAIL_PASSWORD GET_REDIRECTION_URL ${context.action}`);
@@ -401,14 +554,77 @@ function getThirdPartyEmailPasswordConfigs() {
onHandleEvent: async (context) => {
console.log(`ST_LOGS THIRD_PARTY_EMAIL_PASSWORD ON_HANDLE_EVENT ${context.action}`);
},
-
+ override: {
+ emailVerification: {
+ functions: (implementation) => {
+ const log = logWithPrefix(`ST_LOGS THIRD_PARTY_EMAIL_PASSWORD OVERRIDE EMAIL_VERIFICATION`);
+
+ return {
+ sendVerificationEmail(...args) {
+ log(`SEND_VERIFICATION_EMAIL`);
+ return implementation.sendVerificationEmail(...args);
+ },
+ isEmailVerified(...args) {
+ log(`IS_EMAIL_VERIFIED`);
+ return implementation.isEmailVerified(...args);
+ },
+ verifyEmail(...args) {
+ log(`VERIFY_EMAIL`);
+ return implementation.verifyEmail(...args);
+ },
+ };
+ },
+ },
+ functions: (implementation) => {
+ const log = logWithPrefix(`ST_LOGS THIRD_PARTY_EMAIL_PASSWORD OVERRIDE`);
+
+ return {
+ signInAndUp(...args) {
+ log(`SIGN_IN_AND_UP`);
+ return implementation.signInAndUp(...args);
+ },
+ setOAuthState(...args) {
+ log(`SET_OAUTH_STATE`);
+ return implementation.setOAuthState(...args);
+ },
+ redirectToThirdPartyLogin(...args) {
+ log(`REDIRECT_TO_THIRD_PARTY_LOGIN`);
+ return implementation.redirectToThirdPartyLogin(...args);
+ },
+ getOAuthState(...args) {
+ log(`GET_OAUTH_STATE`);
+ return implementation.getOAuthState(...args);
+ },
+ getOAuthAuthorisationURL(...args) {
+ log(`GET_OAUTH_AUTHORISATION_URL`);
+ return implementation.getOAuthAuthorisationURL(...args);
+ },
+ submitNewPassword(...args) {
+ log(`SUBMIT_NEW_PASSWORD`);
+ return implementation.submitNewPassword(...args);
+ },
+ sendPasswordResetEmail(...args) {
+ log(`SEND_PASSWORD_RESET_EMAIL`);
+ return implementation.sendPasswordResetEmail(...args);
+ },
+ doesEmailExist(...args) {
+ log(`DOES_EMAIL_EXIST`);
+ return implementation.doesEmailExist(...args);
+ },
+ };
+ },
+ },
useShadowDom,
palette: theme.colors,
emailVerificationFeature: {
+ disableDefaultImplementation,
mode: emailVerificationMode,
},
- resetPasswordUsingTokenFeature: {},
+ resetPasswordUsingTokenFeature: {
+ disableDefaultImplementation,
+ },
signInAndUpFeature: {
+ disableDefaultImplementation,
signInForm: {},
signUpForm: {
formFields,
diff --git a/examples/for-tests/src/logWithPrefix.js b/examples/for-tests/src/logWithPrefix.js
new file mode 100644
index 000000000..08fc23355
--- /dev/null
+++ b/examples/for-tests/src/logWithPrefix.js
@@ -0,0 +1 @@
+export const logWithPrefix = (prefix) => (postfix) => console.log(`${prefix} ${postfix}`);
diff --git a/examples/with-next-iframe/README.md b/examples/with-next-iframe/README.md
index 687fe5a3c..2304d1ccb 100644
--- a/examples/with-next-iframe/README.md
+++ b/examples/with-next-iframe/README.md
@@ -8,4 +8,4 @@
- In chrome > settings > privacy > cookies > check block third party cookies in incognito
- Open chrome incognito on `http://localhost:3000`
-## This example currently doesn't work on incognito chrome and safari.
\ No newline at end of file
+## This example currently doesn't work on incognito chrome and safari.
diff --git a/hooks/pre-commit.sh b/hooks/pre-commit.sh
index b7be19b4e..9875be279 100755
--- a/hooks/pre-commit.sh
+++ b/hooks/pre-commit.sh
@@ -77,7 +77,7 @@ else
fi
echo "$(tput setaf 3)* Does not cntain .only in tests?$(tput sgr 0)"
-grep -ri "\.only" ./test
+grep -ri --exclude-dir=with-typescript "\.only" ./test
dotOnly=$?
if [ $dotOnly -eq 1 ]
diff --git a/index.ts b/index.ts
deleted file mode 100644
index c20ce2623..000000000
--- a/index.ts
+++ /dev/null
@@ -1,17 +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.
- */
-
-export * from "./lib/ts/";
-export { default } from "./lib/ts/";
diff --git a/lib/build/components/componentOverride/componentOverride.d.ts b/lib/build/components/componentOverride/componentOverride.d.ts
new file mode 100644
index 000000000..cca19bc9c
--- /dev/null
+++ b/lib/build/components/componentOverride/componentOverride.d.ts
@@ -0,0 +1,4 @@
+import React from "react";
+export interface ComponentOverride> {
+ (Component: TComponent): React.FunctionComponent>;
+}
diff --git a/lib/build/components/componentOverride/componentOverride.js b/lib/build/components/componentOverride/componentOverride.js
new file mode 100644
index 000000000..edfee986b
--- /dev/null
+++ b/lib/build/components/componentOverride/componentOverride.js
@@ -0,0 +1,3 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+//# sourceMappingURL=componentOverride.js.map
diff --git a/lib/build/components/componentOverride/componentOverride.js.map b/lib/build/components/componentOverride/componentOverride.js.map
new file mode 100644
index 000000000..01afaf86d
--- /dev/null
+++ b/lib/build/components/componentOverride/componentOverride.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"componentOverride.js","sourceRoot":"","sources":["../../../ts/components/componentOverride/componentOverride.ts"],"names":[],"mappings":""}
\ No newline at end of file
diff --git a/lib/build/components/componentOverride/componentOverrideContext.d.ts b/lib/build/components/componentOverride/componentOverrideContext.d.ts
new file mode 100644
index 000000000..7851ac3e9
--- /dev/null
+++ b/lib/build/components/componentOverride/componentOverrideContext.d.ts
@@ -0,0 +1,9 @@
+import React from "react";
+import { ComponentOverride } from "./componentOverride";
+declare type ContextType =
+ | {
+ [K in keyof T]?: ComponentOverride;
+ }
+ | "IS_DEFAULT";
+export declare const ComponentOverrideContext: React.Context>;
+export {};
diff --git a/lib/build/components/componentOverride/componentOverrideContext.js b/lib/build/components/componentOverride/componentOverrideContext.js
new file mode 100644
index 000000000..8335c61cd
--- /dev/null
+++ b/lib/build/components/componentOverride/componentOverrideContext.js
@@ -0,0 +1,10 @@
+"use strict";
+var __importDefault =
+ (this && this.__importDefault) ||
+ function (mod) {
+ return mod && mod.__esModule ? mod : { default: mod };
+ };
+Object.defineProperty(exports, "__esModule", { value: true });
+var react_1 = __importDefault(require("react"));
+exports.ComponentOverrideContext = react_1.default.createContext("IS_DEFAULT");
+//# sourceMappingURL=componentOverrideContext.js.map
diff --git a/lib/build/components/componentOverride/componentOverrideContext.js.map b/lib/build/components/componentOverride/componentOverrideContext.js.map
new file mode 100644
index 000000000..ce61938e0
--- /dev/null
+++ b/lib/build/components/componentOverride/componentOverrideContext.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"componentOverrideContext.js","sourceRoot":"","sources":["../../../ts/components/componentOverride/componentOverrideContext.ts"],"names":[],"mappings":";;;;;AAAA,gDAA0B;AASb,QAAA,wBAAwB,GAAG,eAAK,CAAC,aAAa,CAAmB,YAAY,CAAC,CAAC"}
\ No newline at end of file
diff --git a/lib/build/components/componentOverride/withOverride.d.ts b/lib/build/components/componentOverride/withOverride.d.ts
new file mode 100644
index 000000000..780122fe0
--- /dev/null
+++ b/lib/build/components/componentOverride/withOverride.d.ts
@@ -0,0 +1,7 @@
+/** @jsx jsx */
+import { jsx } from "@emotion/react";
+import React from "react";
+export declare const withOverride: >(
+ overrideKey: string,
+ DefaultComponent: TComponent
+) => (props: React.ComponentProps) => jsx.JSX.Element;
diff --git a/lib/build/components/componentOverride/withOverride.js b/lib/build/components/componentOverride/withOverride.js
new file mode 100644
index 000000000..7bb746210
--- /dev/null
+++ b/lib/build/components/componentOverride/withOverride.js
@@ -0,0 +1,33 @@
+"use strict";
+var __assign =
+ (this && this.__assign) ||
+ function () {
+ __assign =
+ Object.assign ||
+ function (t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
+ }
+ return t;
+ };
+ return __assign.apply(this, arguments);
+ };
+Object.defineProperty(exports, "__esModule", { value: true });
+/** @jsx jsx */
+var react_1 = require("@emotion/react");
+var react_2 = require("react");
+var componentOverrideContext_1 = require("./componentOverrideContext");
+exports.withOverride = function (overrideKey, DefaultComponent) {
+ return function (props) {
+ var ctx = react_2.useContext(componentOverrideContext_1.ComponentOverrideContext);
+ if (ctx === "IS_DEFAULT") {
+ throw new Error("Using withOverride HOC without a parent Provider");
+ }
+ var OverrideComponent = ctx[overrideKey];
+ var EffectiveComponent =
+ OverrideComponent === undefined ? DefaultComponent : OverrideComponent(DefaultComponent);
+ return react_1.jsx(EffectiveComponent, __assign({}, props));
+ };
+};
+//# sourceMappingURL=withOverride.js.map
diff --git a/lib/build/components/componentOverride/withOverride.js.map b/lib/build/components/componentOverride/withOverride.js.map
new file mode 100644
index 000000000..a1e0f2e3c
--- /dev/null
+++ b/lib/build/components/componentOverride/withOverride.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"withOverride.js","sourceRoot":"","sources":["../../../ts/components/componentOverride/withOverride.tsx"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,eAAe;AACf,wCAAqC;AACrC,+BAA0C;AAC1C,uEAAsE;AAEzD,QAAA,YAAY,GAAG,UACxB,WAAmB,EACnB,gBAA4B;IAE5B,OAAO,UAAC,KAAuC;QAC3C,IAAM,GAAG,GAAG,kBAAU,CAAC,mDAAwB,CAAC,CAAC;QAEjD,IAAI,GAAG,KAAK,YAAY,EAAE;YACtB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;SACvE;QAED,IAAM,iBAAiB,GAAG,GAAG,CAAC,WAAW,CAAC,CAAC;QAE3C,IAAM,kBAAkB,GACpB,iBAAiB,KAAK,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;QAE7F,OAAO,YAAC,kBAAkB,eAAK,KAAK,EAAI,CAAC;IAC7C,CAAC,CAAC;AACN,CAAC,CAAC"}
\ No newline at end of file
diff --git a/lib/build/components/superTokensRoute.js b/lib/build/components/superTokensRoute.js
index 098d3cd28..22db7a6bb 100644
--- a/lib/build/components/superTokensRoute.js
+++ b/lib/build/components/superTokensRoute.js
@@ -48,6 +48,7 @@ function getSuperTokensRoutesForReactRouterDom() {
.getInstanceOrThrow()
.getPathsToFeatureComponentWithRecipeIdMap();
return Object.keys(pathsToFeatureComponentWithRecipeIdMap).map(function (path) {
+ path = path === "" ? "/" : path;
return React.createElement(
Route,
{ exact: true, key: "st-" + path, path: path },
@@ -67,6 +68,6 @@ function SuperTokensRouteWithRecipeId(_a) {
return null;
}
var WithRouterComponent = withRouter(featureComponentWithRecipeId.component);
- return React.createElement(WithRouterComponent, { recipeId: featureComponentWithRecipeId.rid });
+ return React.createElement(WithRouterComponent, null);
}
//# sourceMappingURL=superTokensRoute.js.map
diff --git a/lib/build/components/superTokensRoute.js.map b/lib/build/components/superTokensRoute.js.map
index c723f8f89..d0ad6a5e5 100644
--- a/lib/build/components/superTokensRoute.js.map
+++ b/lib/build/components/superTokensRoute.js.map
@@ -1 +1 @@
-{"version":3,"file":"superTokensRoute.js","sourceRoot":"","sources":["../../ts/components/superTokensRoute.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;AAEH;;GAEG;AAEH,2CAA+B;AAC/B,2EAAqD;AACrD,+DAAyC;AAGzC;;GAEG;AAEH,SAAgB,qCAAqC;IACjD,IAAM,cAAc,GAAG,qBAAW,CAAC,kBAAkB,EAAE,CAAC,iBAAiB,EAAE,CAAC;IAC5E,IAAI,cAAc,KAAK,SAAS,EAAE;QAC9B,OAAO,EAAE,CAAC;KACb;IAED,IAAM,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC;IACnC,IAAM,UAAU,GAAmB,cAAc,CAAC,UAAU,CAAC;IAC7D,IAAM,sCAAsC,GAAG,qBAAW,CAAC,kBAAkB,EAAE,CAAC,yCAAyC,EAAE,CAAC;IAC5H,OAAO,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC,GAAG,CAAC,UAAC,IAAI;QAChE,OAAO,CACH,oBAAC,KAAK,IAAC,KAAK,QAAC,GAAG,EAAE,QAAM,IAAM,EAAE,IAAI,EAAE,IAAI;YACtC,oBAAC,4BAA4B,IAAC,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,GAAI,CAChE,CACX,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC;AAhBD,sFAgBC;AAED,SAAS,4BAA4B,CAAC,EAMrC;QALG,cAAI,EACJ,0BAAU;IAKV,IAAM,cAAc,GAAG,IAAI,2BAAiB,CAAC,IAAI,CAAC,CAAC;IACnD,IAAM,4BAA4B,GAAG,qBAAW,CAAC,kBAAkB,EAAE,CAAC,uCAAuC,CACzG,cAAc,CACjB,CAAC;IAEF,IAAI,4BAA4B,KAAK,SAAS,EAAE;QAC5C,OAAO,IAAI,CAAC;KACf;IAED,IAAM,mBAAmB,GAAG,UAAU,CAAC,4BAA4B,CAAC,SAAS,CAAC,CAAC;IAC/E,OAAO,oBAAC,mBAAmB,IAAC,QAAQ,EAAE,4BAA4B,CAAC,GAAG,GAAI,CAAC;AAC/E,CAAC"}
\ No newline at end of file
+{"version":3,"file":"superTokensRoute.js","sourceRoot":"","sources":["../../ts/components/superTokensRoute.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;AAEH;;GAEG;AAEH,2CAA+B;AAC/B,2EAAqD;AACrD,+DAAyC;AAGzC;;GAEG;AAEH,SAAgB,qCAAqC;IACjD,IAA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/build/constants.d.ts
@@ -3,7 +3,7 @@ export declare const DEFAULT_API_BASE_PATH = "/auth";
export declare const DEFAULT_WEBSITE_BASE_PATH = "/auth";
export declare const ST_ROOT_ID = "supertokens-root";
export declare const SOMETHING_WENT_WRONG_ERROR = "Something went wrong. Please try again";
-export declare const RESET_PASSWORD_INVALID_TOKEN_ERROR = "Invalid password reset token";
-export declare const INCORRECT_EMAIL_PASSWORD_COMBINATION_ERROR = "Incorrect email and password combination";
-export declare const 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.";
-export declare const WINDOW_UNDEFINED_ERROR = "If you are using this package with server-side rendering, please make sure that you are checking if the window object is defined.";
+export declare const 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.";
+export declare const WINDOW_UNDEFINED_ERROR =
+ "If you are using this package with server-side rendering, please make sure that you are checking if the window object is defined.";
diff --git a/lib/build/constants.js b/lib/build/constants.js
index 88c773cd9..57fab4cba 100644
--- a/lib/build/constants.js
+++ b/lib/build/constants.js
@@ -22,8 +22,6 @@ exports.DEFAULT_API_BASE_PATH = "/auth";
exports.DEFAULT_WEBSITE_BASE_PATH = "/auth";
exports.ST_ROOT_ID = "supertokens-root";
exports.SOMETHING_WENT_WRONG_ERROR = "Something went wrong. Please try again";
-exports.RESET_PASSWORD_INVALID_TOKEN_ERROR = "Invalid password reset token";
-exports.INCORRECT_EMAIL_PASSWORD_COMBINATION_ERROR = "Incorrect email and password combination";
exports.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.";
exports.WINDOW_UNDEFINED_ERROR =
diff --git a/lib/build/constants.js.map b/lib/build/constants.js.map
index 652d24efa..766440f55 100644
--- a/lib/build/constants.js.map
+++ b/lib/build/constants.js.map
@@ -1 +1 @@
-{"version":3,"file":"constants.js","sourceRoot":"","sources":["../ts/constants.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;AAEH;;GAEG;AACU,QAAA,qBAAqB,GAAG,KAAK,CAAC;AAE9B,QAAA,qBAAqB,GAAG,OAAO,CAAC;AAEhC,QAAA,yBAAyB,GAAG,OAAO,CAAC;AAEpC,QAAA,UAAU,GAAG,kBAAkB,CAAC;AAEhC,QAAA,0BAA0B,GAAG,wCAAwC,CAAC;AAEtE,QAAA,kCAAkC,GAAG,8BAA8B,CAAC;AAEpE,QAAA,0CAA0C,GAAG,0CAA0C,CAAC;AAExF,QAAA,SAAS,GAClB,gKAAgK,CAAC;AAExJ,QAAA,sBAAsB,GAC/B,mIAAmI,CAAC"}
\ No newline at end of file
+{"version":3,"file":"constants.js","sourceRoot":"","sources":["../ts/constants.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;AAEH;;GAEG;AACU,QAAA,qBAAqB,GAAG,KAAK,CAAC;AAE9B,QAAA,qBAAqB,GAAG,OAAO,CAAC;AAEhC,QAAA,yBAAyB,GAAG,OAAO,CAAC;AAEpC,QAAA,UAAU,GAAG,kBAAkB,CAAC;AAEhC,QAAA,0BAA0B,GAAG,wCAAwC,CAAC;AAEtE,QAAA,SAAS,GAClB,gKAAgK,CAAC;AAExJ,QAAA,sBAAsB,GAC/B,mIAAmI,CAAC"}
\ No newline at end of file
diff --git a/lib/build/httpRequest.d.ts b/lib/build/httpRequest.d.ts
deleted file mode 100644
index a1e04d97f..000000000
--- a/lib/build/httpRequest.d.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import RecipeModule from "./recipe/recipeModule";
-export default class HttpRequest {
- private recipe;
- constructor(recipe: RecipeModule);
- get: (path: string, config: RequestInit, action: string, queryParams?: Record | undefined) => Promise;
- post: (path: string, config: RequestInit, action: string) => Promise;
- delete: (path: string, action: string, config: RequestInit) => Promise;
- put: (path: string, action: string, config: RequestInit) => Promise;
- fetch: (baseUrl: string, config: RequestInit, action: string) => Promise;
- preAPIHook: ({ action, url, requestInit, }: {
- action: string;
- url: string;
- requestInit: RequestInit;
- }) => Promise<{
- url: string;
- requestInit: RequestInit;
- }>;
- fetchResponseJsonOrThrowAbove300: (url: string, config: RequestInit, action: string) => Promise;
- getFullUrl: (pathStr: string, queryParams?: Record | undefined) => string;
-}
diff --git a/lib/build/httpRequest.js.map b/lib/build/httpRequest.js.map
deleted file mode 100644
index 217d157eb..000000000
--- a/lib/build/httpRequest.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"httpRequest.js","sourceRoot":"","sources":["../ts/httpRequest.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;GAaG;AACH,yCAAyD;AACzD,0EAAoD;AAEpD,iCAAwC;AACxC,qCAA0C;AAE1C;IAMI;;OAEG;IACH,qBAAY,MAA6B;QAAzC,iBAEC;QAED;;WAEG;QACH,QAAG,GAAG,UACF,IAAY,EACZ,MAAmB,EACnB,MAAc,EACd,WAAoC;;;4BAE7B,qBAAM,IAAI,CAAC,gCAAgC,CAC9C,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,WAAW,CAAC,aAE9B,MAAM,EAAE,KAAK,IACV,MAAM,GAEb,MAAM,CACT,EAAA;4BAPD,sBAAO,SAON,EAAC;;;aACL,CAAC;QAEF,SAAI,GAAG,UAAU,IAAY,EAAE,MAAmB,EAAE,MAAc;;;4BACvD,qBAAM,IAAI,CAAC,gCAAgC,CAC9C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,aAEjB,MAAM,EAAE,MAAM,IACX,MAAM,GAEb,MAAM,CACT,EAAA;4BAPD,sBAAO,SAON,EAAC;;;aACL,CAAC;QAEF,WAAM,GAAG,UAAU,IAAY,EAAE,MAAc,EAAE,MAAmB;;;4BACzD,qBAAM,IAAI,CAAC,gCAAgC,CAC9C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,aAEjB,MAAM,EAAE,QAAQ,IACb,MAAM,GAEb,MA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AO;wCACH,GAAG,KAAA;wCACH,WAAW,EAAE,MAAqB;qCACrC,EAAC;6BACL;iCAAM;gCACH,iCACI,GAAG,KAAA,IACA,MAAM,GACX;6BACL;;;;;SACJ,CAAC;QAEF,qCAAgC,GAAG,UAAU,GAAW,EAAE,MAAmB,EAAE,MAAc;;;;4BAC1E,qBAAM,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAA;;wBAA9C,MAAM,GAAG,SAAqC;wBACpD,IAAI,MAAM,CAAC,MAAM,IAAI,GAAG,EAAE;4BACtB,MAAM,KAAK,CAAC,sCAA0B,CAAC,CAAC;yBAC3C;wBAEM,qBAAM,MAAM,CAAC,IAAI,EAAE,EAAA;4BAA1B,sBAAO,SAAmB,EAAC;;;aAC9B,CAAC;QAEF,eAAU,GAAG,UAAC,OAAe,EAAE,WAAoC;YAC/D,IAAM,IAAI,GAAG,IAAI,2BAAiB,CAAC,OAAO,CAAC,CAAC;YAC5C,IAAM,OAAO,GAAG,KAAG,KAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,oBAAoB,EAAE,GAAG,KAAI,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,oBAAoB,EAAE,GAAG,IAAI,CAAC,oBAAoB,EAAI,CAAC;YAEjK,IAAI,WAAW,KAAK,SAAS,EAAE;gBAC3B,OAAO,OAAO,CAAC;aAClB;YAED,wBAAwB;YACxB,OAAO,OAAO,GAAG,GAAG,GAAG,IAAI,eAAe,CAAC,WAAW,CAAC,CAAC;QAC5D,CAAC,CAAC;QA7HE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IA6HL,kBAAC;AAAD,CAAC,AAxID,IAwIC"}
\ No newline at end of file
diff --git a/lib/build/normalisedURLDomain.d.ts b/lib/build/normalisedURLDomain.d.ts
index 6680006d4..a5ad011c6 100644
--- a/lib/build/normalisedURLDomain.d.ts
+++ b/lib/build/normalisedURLDomain.d.ts
@@ -3,4 +3,3 @@ export default class NormalisedURLDomain {
constructor(url: string);
getAsStringDangerous: () => string;
}
-export declare function normaliseURLDomainOrThrowError(input: string, ignoreProtocol?: boolean): string;
diff --git a/lib/build/normalisedURLDomain.js b/lib/build/normalisedURLDomain.js
index bf8d8c537..dcb18eb80 100644
--- a/lib/build/normalisedURLDomain.js
+++ b/lib/build/normalisedURLDomain.js
@@ -76,5 +76,4 @@ function normaliseURLDomainOrThrowError(input, ignoreProtocol) {
}
throw new Error("Please provide a valid domain name");
}
-exports.normaliseURLDomainOrThrowError = normaliseURLDomainOrThrowError;
//# sourceMappingURL=normalisedURLDomain.js.map
diff --git a/lib/build/normalisedURLDomain.js.map b/lib/build/normalisedURLDomain.js.map
index a641dc5b5..72e3d844d 100644
--- a/lib/build/normalisedURLDomain.js.map
+++ b/lib/build/normalisedURLDomain.js.map
@@ -1 +1 @@
-{"version":3,"file":"normalisedURLDomain.js","sourceRoot":"","sources":["../ts/normalisedURLDomain.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;AAEH;IAGI,6BAAY,GAAW;QAAvB,iBAEC;QAED,yBAAoB,GAAG;YACnB,OAAO,KAAI,CAAC,KAAK,CAAC;QACtB,CAAC,CAAC;QALE,IAAI,CAAC,KAAK,GAAG,8BAA8B,CAAC,GAAG,CAAC,CAAC;IACrD,CAAC;IAKL,0BAAC;AAAD,CAAC,AAVD,IAUC;;AAED,SAAgB,8BAA8B,CAAC,KAAa,EAAE,cAAsB;IAAtB,+BAAA,EAAA,sBAAsB;IAChF,SAAS,aAAa,CAAC,SAAiB;QACpC,OAAO,kKAAkK,CAAC,IAAI,CAC1K,SAAS,CACZ,CAAC;IACN,CAAC;IACD,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IACrB,IAAI;QACA,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;YAC/D,MAAM,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AQ,GAAG,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;SAChD;QACD,OAAO,KAAK,CAAC;QACb,oCAAoC;KACvC;IAAC,OAAO,GAAG,EAAE,GAAE;IAEhB,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QACvB,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;KACzD;IAED,kBAAkB;IAClB,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;QAC1B,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;KAC3B;IACD,oEAAoE;IACpE,wDAAwD;IACxD,IACI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAC5D,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC;QAC5B,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,EAC/B;QACE,KAAK,GAAG,UAAU,GAAG,KAAK,CAAC;QAC3B,yFAAyF;QACzF,IAAI;YACA,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;YACf,OAAO,8BAA8B,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YAEnD,oCAAoC;SACvC;QAAC,OAAO,GAAG,EAAE,GAAE;KACnB;IACD,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;AAC1D,CAAC"}
\ No newline at end of file
diff --git a/lib/build/normalisedURLPath.d.ts b/lib/build/normalisedURLPath.d.ts
index 91652cd9c..6e801d80b 100644
--- a/lib/build/normalisedURLPath.d.ts
+++ b/lib/build/normalisedURLPath.d.ts
@@ -5,4 +5,3 @@ export default class NormalisedURLPath {
appendPath: (other: NormalisedURLPath) => NormalisedURLPath;
getAsStringDangerous: () => string;
}
-export declare function normaliseURLPathOrThrowError(input: string): string;
diff --git a/lib/build/normalisedURLPath.js b/lib/build/normalisedURLPath.js
index 28506233e..5d7a26e2d 100644
--- a/lib/build/normalisedURLPath.js
+++ b/lib/build/normalisedURLPath.js
@@ -24,10 +24,6 @@ var NormalisedURLPath = /** @class */ (function () {
return new NormalisedURLPath(_this.value + other.value);
};
this.getAsStringDangerous = function () {
- // In case path is empty, add slash.
- if (_this.value.length === 0) {
- return "/";
- }
// Otherwise, return value.
return _this.value;
};
@@ -73,7 +69,6 @@ function normaliseURLPathOrThrowError(input) {
throw new Error("Please provide a valid URL path");
}
}
-exports.normaliseURLPathOrThrowError = normaliseURLPathOrThrowError;
function domainGiven(input) {
// If no dot, return false.
if (input.indexOf(".") === -1 || input.startsWith("/")) {
diff --git a/lib/build/normalisedURLPath.js.map b/lib/build/normalisedURLPath.js.map
index 811dd5d2d..540b17d4f 100644
--- a/lib/build/normalisedURLPath.js.map
+++ b/lib/build/normalisedURLPath.js.map
@@ -1 +1 @@
-{"version":3,"file":"normalisedURLPath.js","sourceRoot":"","sources":["../ts/normalisedURLPath.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;AAEH;IAGI,2BAAY,GAAW;QAAvB,iBAEC;QAED,eAAU,GAAG,UAAC,KAAwB;YAClC,OAAO,KAAI,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC9C,CAAC,CAAC;QAEF,eAAU,GAAG,UAAC,KAAwB;YAClC,OAAO,IAAI,iBAAiB,CAAC,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QAC3D,CAAC,CAAC;QAEF,yBAAoB,GAAG;YACnB,oCAAoC;YACpC,IAAI,KAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;gBACzB,OAAO,GAAG,CAAC;aACd;YAED,2BAA2B;YAC3B,OAAO,KAAI,CAAC,KAAK,CAAC;QACtB,CAAC,CAAC;QAnBE,IAAI,CAAC,KAAK,GAAG,4BAA4B,CAAC,GAAG,CAAC,CAAC;IACnD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C;KACvB;IAED,qGAAqG;IACrG,IAAI;QACA,4DAA4D;QAC5D,IAAI,GAAG,CAAC,oBAAoB,GAAG,KAAK,CAAC,CAAC;QACtC,OAAO,4BAA4B,CAAC,oBAAoB,GAAG,KAAK,CAAC,CAAC;KACrE;IAAC,OAAO,GAAG,EAAE;QACV,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;KACtD;AACL,CAAC;AAED,SAAS,WAAW,CAAC,KAAa;IAC9B,2BAA2B;IAC3B,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QACpD,OAAO,KAAK,CAAC;KAChB;IAED,IAAI;QACA,IAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;QAC3B,OAAO,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;KAC3C;IAAC,OAAO,CAAC,EAAE,GAAE;IAEd,IAAI;QACA,IAAM,GAAG,GAAG,IAAI,GAAG,CAAC,SAAS,GAAG,KAAK,CAAC,CAAC;QACvC,OAAO,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;KAC3C;IAAC,OAAO,CAAC,EAAE,GAAE;IAEd,OAAO,KAAK,CAAC;AACjB,CAAC"}
\ No newline at end of file
diff --git a/lib/build/querier.d.ts b/lib/build/querier.d.ts
new file mode 100644
index 000000000..b73eb2031
--- /dev/null
+++ b/lib/build/querier.d.ts
@@ -0,0 +1,46 @@
+import { NormalisedAppInfo, PostAPIHookFunction, PreAPIHookFunction } from "./types";
+export default class Querier {
+ recipeId: string;
+ appInfo: NormalisedAppInfo;
+ constructor(recipeId: string, appInfo: NormalisedAppInfo);
+ get: (
+ path: string,
+ config: RequestInit,
+ queryParams?: Record | undefined,
+ preAPIHook?: PreAPIHookFunction | undefined,
+ postAPIHook?: PostAPIHookFunction | undefined
+ ) => Promise;
+ post: (
+ path: string,
+ config: RequestInit,
+ preAPIHook?: PreAPIHookFunction | undefined,
+ postAPIHook?: PostAPIHookFunction | undefined
+ ) => Promise;
+ delete: (
+ path: string,
+ config: RequestInit,
+ preAPIHook?: PreAPIHookFunction | undefined,
+ postAPIHook?: PostAPIHookFunction | undefined
+ ) => Promise;
+ put: (
+ path: string,
+ config: RequestInit,
+ preAPIHook?: PreAPIHookFunction | undefined,
+ postAPIHook?: PostAPIHookFunction | undefined
+ ) => Promise;
+ fetch: (
+ url: string,
+ config: RequestInit,
+ preAPIHook?: PreAPIHookFunction | undefined,
+ postAPIHook?: PostAPIHookFunction | undefined
+ ) => Promise;
+ callPreAPIHook: (context: {
+ preAPIHook?: PreAPIHookFunction | undefined;
+ requestInit: RequestInit;
+ url: string;
+ }) => Promise<{
+ url: string;
+ requestInit: RequestInit;
+ }>;
+ getFullUrl: (pathStr: string, queryParams?: Record | undefined) => string;
+}
diff --git a/lib/build/httpRequest.js b/lib/build/querier.js
similarity index 74%
rename from lib/build/httpRequest.js
rename to lib/build/querier.js
index 1c3019eed..661d8e305 100644
--- a/lib/build/httpRequest.js
+++ b/lib/build/querier.js
@@ -161,100 +161,112 @@ Object.defineProperty(exports, "__esModule", { value: true });
* License for the specific language governing permissions and limitations
* under the License.
*/
-var constants_1 = require("./constants");
var normalisedURLPath_1 = __importDefault(require("./normalisedURLPath"));
-var utils_1 = require("./utils");
var version_1 = require("./version");
-var HttpRequest = /** @class */ (function () {
- /*
- * Constructor.
- */
- function HttpRequest(recipe) {
+var Querier = /** @class */ (function () {
+ function Querier(recipeId, appInfo) {
var _this = this;
- /*
- * Instance Methods.
- */
- this.get = function (path, config, action, queryParams) {
+ this.get = function (path, config, queryParams, preAPIHook, postAPIHook) {
return __awaiter(_this, void 0, void 0, function () {
+ var result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
return [
4 /*yield*/,
- this.fetchResponseJsonOrThrowAbove300(
+ this.fetch(
this.getFullUrl(path, queryParams),
__assign({ method: "GET" }, config),
- action
+ preAPIHook,
+ postAPIHook
),
];
case 1:
+ result = _a.sent();
+ return [4 /*yield*/, result.json()];
+ case 2:
return [2 /*return*/, _a.sent()];
}
});
});
};
- this.post = function (path, config, action) {
+ this.post = function (path, config, preAPIHook, postAPIHook) {
return __awaiter(_this, void 0, void 0, function () {
+ var result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
return [
4 /*yield*/,
- this.fetchResponseJsonOrThrowAbove300(
+ this.fetch(
this.getFullUrl(path),
__assign({ method: "POST" }, config),
- action
+ preAPIHook,
+ postAPIHook
),
];
case 1:
+ result = _a.sent();
+ return [4 /*yield*/, result.json()];
+ case 2:
return [2 /*return*/, _a.sent()];
}
});
});
};
- this.delete = function (path, action, config) {
+ this.delete = function (path, config, preAPIHook, postAPIHook) {
return __awaiter(_this, void 0, void 0, function () {
+ var result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
return [
4 /*yield*/,
- this.fetchResponseJsonOrThrowAbove300(
+ this.fetch(
this.getFullUrl(path),
__assign({ method: "DELETE" }, config),
- action
+ preAPIHook,
+ postAPIHook
),
];
case 1:
+ result = _a.sent();
+ return [4 /*yield*/, result.json()];
+ case 2:
return [2 /*return*/, _a.sent()];
}
});
});
};
- this.put = function (path, action, config) {
+ this.put = function (path, config, preAPIHook, postAPIHook) {
return __awaiter(_this, void 0, void 0, function () {
+ var result;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
return [
4 /*yield*/,
- this.fetchResponseJsonOrThrowAbove300(
+ this.fetch(
this.getFullUrl(path),
__assign({ method: "PUT" }, config),
- action
+ preAPIHook,
+ postAPIHook
),
];
case 1:
+ result = _a.sent();
+ return [4 /*yield*/, result.json()];
+ case 2:
return [2 /*return*/, _a.sent()];
}
});
});
};
- this.fetch = function (baseUrl, config, action) {
+ this.fetch = function (url, config, preAPIHook, postAPIHook) {
return __awaiter(_this, void 0, void 0, function () {
- var headers, _a, requestInit, url;
- return __generator(this, function (_b) {
- switch (_b.label) {
+ var headers, _a, requestInit, modifiedUrl, result, _b;
+ return __generator(this, function (_c) {
+ switch (_c.label) {
case 0:
if (config === undefined) {
headers = {};
@@ -263,23 +275,43 @@ var HttpRequest = /** @class */ (function () {
}
return [
4 /*yield*/,
- this.preAPIHook({
- action: action,
+ this.callPreAPIHook({
+ preAPIHook: preAPIHook,
+ url: url,
requestInit: __assign({}, config, {
headers: __assign({}, headers, {
"fdi-version": version_1.supported_fdi.join(","),
"Content-Type": "application/json",
- rid: this.recipe.recipeId,
+ rid: this.recipeId,
}),
}),
- url: baseUrl,
}),
];
case 1:
- (_a = _b.sent()), (requestInit = _a.requestInit), (url = _a.url);
- return [4 /*yield*/, fetch(url, requestInit)];
+ (_a = _c.sent()), (requestInit = _a.requestInit), (modifiedUrl = _a.url);
+ return [4 /*yield*/, fetch(modifiedUrl, requestInit)];
case 2:
- return [2 /*return*/, _b.sent()];
+ result = _c.sent();
+ if (result.status >= 300) {
+ throw result;
+ }
+ if (!(postAPIHook === undefined)) return [3 /*break*/, 3];
+ _b = result;
+ return [3 /*break*/, 5];
+ case 3:
+ return [
+ 4 /*yield*/,
+ postAPIHook({
+ requestInit: requestInit,
+ url: modifiedUrl,
+ response: result,
+ }),
+ ];
+ case 4:
+ _b = _c.sent();
+ _c.label = 5;
+ case 5:
+ return [2 /*return*/, _b];
}
});
});
@@ -287,52 +319,28 @@ var HttpRequest = /** @class */ (function () {
/*
* For backward compatibility
*/
- this.preAPIHook = function (_a) {
- var action = _a.action,
- url = _a.url,
- requestInit = _a.requestInit;
+ this.callPreAPIHook = function (context) {
return __awaiter(_this, void 0, void 0, function () {
var result;
- return __generator(this, function (_b) {
- switch (_b.label) {
+ return __generator(this, function (_a) {
+ switch (_a.label) {
case 0:
- return [
- 4 /*yield*/,
- this.recipe.hooks.preAPIHook({ action: action, url: url, requestInit: requestInit }),
- ];
- case 1:
- result = _b.sent();
- if (utils_1.isRequestInit(result)) {
+ if (context.preAPIHook === undefined) {
return [
2 /*return*/,
{
- url: url,
- requestInit: result,
+ url: context.url,
+ requestInit: context.requestInit,
},
];
- } else {
- return [2 /*return*/, __assign({ url: url }, result)];
}
- return [2 /*return*/];
- }
- });
- });
- };
- this.fetchResponseJsonOrThrowAbove300 = function (url, config, action) {
- return __awaiter(_this, void 0, void 0, function () {
- var result;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- return [4 /*yield*/, this.fetch(url, config, action)];
+ return [
+ 4 /*yield*/,
+ context.preAPIHook({ url: context.url, requestInit: context.requestInit }),
+ ];
case 1:
result = _a.sent();
- if (result.status >= 300) {
- throw Error(constants_1.SOMETHING_WENT_WRONG_ERROR);
- }
- return [4 /*yield*/, result.json()];
- case 2:
- return [2 /*return*/, _a.sent()];
+ return [2 /*return*/, result];
}
});
});
@@ -341,8 +349,8 @@ var HttpRequest = /** @class */ (function () {
var path = new normalisedURLPath_1.default(pathStr);
var fullUrl =
"" +
- _this.recipe.appInfo.apiDomain.getAsStringDangerous() +
- _this.recipe.appInfo.apiBasePath.getAsStringDangerous() +
+ _this.appInfo.apiDomain.getAsStringDangerous() +
+ _this.appInfo.apiBasePath.getAsStringDangerous() +
path.getAsStringDangerous();
if (queryParams === undefined) {
return fullUrl;
@@ -350,9 +358,10 @@ var HttpRequest = /** @class */ (function () {
// If query params, add.
return fullUrl + "?" + new URLSearchParams(queryParams);
};
- this.recipe = recipe;
+ this.recipeId = recipeId;
+ this.appInfo = appInfo;
}
- return HttpRequest;
+ return Querier;
})();
-exports.default = HttpRequest;
-//# sourceMappingURL=httpRequest.js.map
+exports.default = Querier;
+//# sourceMappingURL=querier.js.map
diff --git a/lib/build/querier.js.map b/lib/build/querier.js.map
new file mode 100644
index 000000000..1fa118a67
--- /dev/null
+++ b/lib/build/querier.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"querier.js","sourceRoot":"","sources":["../ts/querier.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;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ACH,mBAAc,GAAG,UAAO,OAIvB;;;;;wBACG,IAAI,OAAO,CAAC,UAAU,KAAK,SAAS,EAAE;4BAClC,sBAAO;oCACH,GAAG,EAAE,OAAO,CAAC,GAAG;oCAChB,WAAW,EAAE,OAAO,CAAC,WAAW;iCACnC,EAAC;yBACL;wBACc,qBAAM,OAAO,CAAC,UAAU,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC,EAAA;;wBAAzF,MAAM,GAAG,SAAgF;wBAC/F,sBAAO,MAAM,EAAC;;;aACjB,CAAC;QAEF,eAAU,GAAG,UAAC,OAAe,EAAE,WAAoC;YAC/D,IAAM,IAAI,GAAG,IAAI,2BAAiB,CAAC,OAAO,CAAC,CAAC;YAC5C,IAAM,OAAO,GAAG,KAAG,KAAI,CAAC,OAAO,CAAC,SAAS,CAAC,oBAAoB,EAAE,GAAG,KAAI,CAAC,OAAO,CAAC,WAAW,CAAC,oBAAoB,EAAE,GAAG,IAAI,CAAC,oBAAoB,EAAI,CAAC;YAEnJ,IAAI,WAAW,KAAK,SAAS,EAAE;gBAC3B,OAAO,OAAO,CAAC;aAClB;YAED,wBAAwB;YACxB,OAAO,OAAO,GAAG,GAAG,GAAG,IAAI,eAAe,CAAC,WAAW,CAAC,CAAC;QAC5D,CAAC,CAAC;QApJE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAmJL,cAAC;AAAD,CAAC,AA3JD,IA2JC"}
\ No newline at end of file
diff --git a/lib/build/recipe/authRecipeModule/api.d.ts b/lib/build/recipe/authRecipeModule/api.d.ts
deleted file mode 100644
index f7c5b49b3..000000000
--- a/lib/build/recipe/authRecipeModule/api.d.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import AuthRecipeModule from ".";
-import { SuccessAPIResponse } from "../../types";
-export declare function signOut(recipe: AuthRecipeModule): Promise;
diff --git a/lib/build/recipe/authRecipeModule/api.js.map b/lib/build/recipe/authRecipeModule/api.js.map
deleted file mode 100644
index af5048c18..000000000
--- a/lib/build/recipe/authRecipeModule/api.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../ts/recipe/authRecipeModule/api.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH,8EAA6D;AAE7D,6CAA6D;AAG7D;;GAEG;AAEH,SAAsB,OAAO,CAAa,MAAoC;;;;;;oBACpE,wBAAwB,GAAG,eAAU,CAAC,wBAAwB,CAAC;oBAEtD,qBAAM,MAAM,CAAC,WAAW,CAAC,KAAK,CACzC,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,UAAU,CAAC,EACzC;4BACI,MAAM,EAAE,MAAM;yBACjB,EACD,UAAU,CACb,EAAA;;oBANK,MAAM,GAAG,SAMd;oBAED,IAAI,MAAM,CAAC,MAAM,KAAK,wBAAwB,EAAE;wBAC5C,sBAAO;gCACH,MAAM,EAAE,IAAI;6BACf,EAAC;qBACL;oBACD,IAAI,MAAM,CAAC,MAAM,IAAI,GAAG,EAAE;wBACtB,MAAM,KAAK,CAAC,sCAA0B,CAAC,CAAC;qBAC3C;oBAEM,qBAAM,MAAM,CAAC,IAAI,EAAE,EAAA;wBAA1B,sBAAO,SAAmB,EAAC;;;;CAC9B;AArBD,0BAqBC"}
\ No newline at end of file
diff --git a/lib/build/recipe/authRecipeModule/components/themes/signInAndUp/signUpFooter.d.ts b/lib/build/recipe/authRecipeModule/components/themes/signInAndUp/signUpFooter.d.ts
deleted file mode 100644
index c9ab353bc..000000000
--- a/lib/build/recipe/authRecipeModule/components/themes/signInAndUp/signUpFooter.d.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-///
-export default function SignUpFooter({ termsOfServiceLink, privacyPolicyLink, }: {
- privacyPolicyLink?: string;
- termsOfServiceLink?: string;
-}): JSX.Element | null;
diff --git a/lib/build/recipe/authRecipeModule/components/themes/signInAndUp/signUpFooter.js.map b/lib/build/recipe/authRecipeModule/components/themes/signInAndUp/signUpFooter.js.map
deleted file mode 100644
index b765d5b7d..000000000
--- a/lib/build/recipe/authRecipeModule/components/themes/signInAndUp/signUpFooter.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"signUpFooter.js","sourceRoot":"","sources":["../../../../../../ts/recipe/authRecipeModule/components/themes/signInAndUp/signUpFooter.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;AAEH;;GAEG;AACH,eAAe;AACf,wCAAqC;AAErC,+BAAmC;AACnC,oFAA8D;AAE9D,SAAwB,YAAY,CAAC,EAMpC;QALG,0CAAkB,EAClB,wCAAiB;IAKjB,IAAM,MAAM,GAAG,kBAAU,CAAC,sBAAY,CAAC,CAAC;IAExC,IAAI,kBAAkB,KAAK,SAAS,IAAI,iBAAiB,KAAK,SAAS,EAAE;QACrE,OAAO,IAAI,CAAC;KACf;IAED,OAAO,CACH,yCACqB,kDAAkD,EACnE,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,kCAAkC,CAAC;;QAErE,kBAAkB,KAAK,SAAS,IAAI,CACjC,uCACqB,MAAM,EACvB,GAAG,EAAE,MAAM,CAAC,IAAI,EAChB,IAAI,EAAE,kBAAkB,EACxB,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,oBAAoB,uBAExB,CACP;QACA,kBAAkB,KAAK,SAAS,IAAI,iBAAiB,KAAK,SAAS,IAAI,KAAK;QAC5E,iBAAiB,KAAK,SAAS,IAAI,CAChC,uCACqB,MAAM,EACvB,GAAG,EAAE,MAAM,CAAC,IAAI,EAChB,IAAI,EAAE,iBAAiB,EACvB,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,oBAAoB,qBAExB,CACP,CACC,CACT,CAAC;AACN,CAAC;AAzCD,+BAyCC"}
\ No newline at end of file
diff --git a/lib/build/recipe/authRecipeModule/index.d.ts b/lib/build/recipe/authRecipeModule/index.d.ts
index 2b01edecd..042af3b7c 100644
--- a/lib/build/recipe/authRecipeModule/index.d.ts
+++ b/lib/build/recipe/authRecipeModule/index.d.ts
@@ -1,17 +1,33 @@
+///
import RecipeModule from "../recipeModule";
-import { NormalisedAuthRecipeConfig, AuthRecipeModuleConfig, AuthRecipeModuleGetRedirectionURLContext } from "./types";
-import { SuccessAPIResponse } from "../../types";
-import EmailVerification from "../emailverification";
-export default abstract class AuthRecipeModule extends RecipeModule {
- config: NormalisedAuthRecipeConfig & N;
- emailVerification?: EmailVerification;
- constructor(config: AuthRecipeModuleConfig, normalisedChildClassConfig: N);
- getAuthRecipeModuleDefaultRedirectionURL: (context: AuthRecipeModuleGetRedirectionURLContext) => Promise;
+import { NormalisedConfig, GetRedirectionURLContext, PreAPIHookContext, OnHandleEventContext } from "./types";
+import EmailVerification from "../emailverification/recipe";
+export default abstract class AuthRecipeModule<
+ T,
+ S,
+ R,
+ N extends NormalisedConfig
+> extends RecipeModule {
+ emailVerification: EmailVerification;
+ constructor(
+ config: N,
+ recipes: {
+ emailVerificationInstance: EmailVerification | undefined;
+ }
+ );
+ getAuthRecipeModuleDefaultRedirectionURL: (context: GetRedirectionURLContext) => Promise;
+ getAuthRecipeModuleFeatureComponent: (componentName: "emailverification", props: any) => JSX.Element;
getAuthRecipeModuleFeatures: () => Record;
- getConfig: () => T_1;
- signOut: () => Promise;
- isEmailVerified(): Promise;
- isEmailVerificationRequired(): boolean;
+ signOut: () => Promise;
doesSessionExist: () => Promise;
- abstract redirectToAuth(show?: "signin" | "signup"): void;
+ redirectToAuthWithRedirectToPath: (
+ show?: "signin" | "signup" | undefined,
+ history?: any,
+ queryParams?: any
+ ) => void;
+ redirectToAuthWithoutRedirectToPath: (
+ show?: "signin" | "signup" | undefined,
+ history?: any,
+ queryParams?: any
+ ) => void;
}
diff --git a/lib/build/recipe/authRecipeModule/index.js b/lib/build/recipe/authRecipeModule/index.js
index 7670246a8..291a8fa20 100644
--- a/lib/build/recipe/authRecipeModule/index.js
+++ b/lib/build/recipe/authRecipeModule/index.js
@@ -187,115 +187,127 @@ Object.defineProperty(exports, "__esModule", { value: true });
/*
* Imports.
*/
-var session_1 = __importDefault(require("../session/session"));
+var recipe_1 = __importDefault(require("../session/recipe"));
var recipeModule_1 = __importDefault(require("../recipeModule"));
-var api_1 = require("./api");
-var utils_1 = require("./utils");
-var emailverification_1 = __importDefault(require("../emailverification"));
-/*
- * Class.
- */
+var recipe_2 = __importDefault(require("../emailverification/recipe"));
+var utils_1 = require("../../utils");
var AuthRecipeModule = /** @class */ (function (_super) {
__extends(AuthRecipeModule, _super);
- /*
- * Constructor.
- */
- function AuthRecipeModule(config, normalisedChildClassConfig) {
+ function AuthRecipeModule(config, recipes) {
var _this = _super.call(this, config) || this;
_this.getAuthRecipeModuleDefaultRedirectionURL = function (context) {
return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
- switch (context.action) {
- case "SIGN_IN_AND_UP":
- return [
- 2 /*return*/,
- this.appInfo.websiteBasePath.getAsStringDangerous() + "?rid=" + this.recipeId,
- ];
- case "SUCCESS":
- return [2 /*return*/, context.redirectToPath === undefined ? "/" : context.redirectToPath];
- case "VERIFY_EMAIL": {
- if (this.emailVerification === undefined) {
- return [2 /*return*/, "/"];
- }
- return [2 /*return*/, this.emailVerification.getEmailVerificationDefaultURL(context)];
- }
+ if (context.action === "SIGN_IN_AND_UP") {
+ return [
+ 2 /*return*/,
+ this.config.appInfo.websiteBasePath.getAsStringDangerous() + "?rid=" + this.config.recipeId,
+ ];
+ } else if (context.action === "SUCCESS") {
+ return [2 /*return*/, context.redirectToPath === undefined ? "/" : context.redirectToPath];
+ } else {
+ throw new Error("Should never come here");
}
return [2 /*return*/];
});
});
};
- _this.getAuthRecipeModuleFeatures = function () {
- var features = {};
- if (_this.emailVerification !== undefined) {
- features = _this.emailVerification.getFeatures();
- }
- return features;
+ _this.getAuthRecipeModuleFeatureComponent = function (componentName, props) {
+ return _this.emailVerification.getFeatureComponent(componentName, props);
};
- /*
- * getConfig
- */
- _this.getConfig = function () {
- return _this.config;
+ _this.getAuthRecipeModuleFeatures = function () {
+ return _this.emailVerification.getFeatures();
};
- /*
- * SignOut.
- */
_this.signOut = function () {
return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
- return [4 /*yield*/, api_1.signOut(this)];
+ return [4 /*yield*/, recipe_1.default.getInstanceOrThrow().signOut()];
case 1:
return [2 /*return*/, _a.sent()];
}
});
});
};
- /*
- * Session
- */
_this.doesSessionExist = function () {
- return session_1.default.getInstanceOrThrow().doesSessionExist();
+ return __awaiter(_this, void 0, void 0, function () {
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ return [4 /*yield*/, recipe_1.default.getInstanceOrThrow().doesSessionExist()];
+ case 1:
+ return [2 /*return*/, _a.sent()];
+ }
+ });
+ });
+ };
+ _this.redirectToAuthWithRedirectToPath = function (show, history, queryParams) {
+ var redirectToPath = utils_1.getWindowOrThrow().location.pathname;
+ if (queryParams === undefined) {
+ queryParams = {};
+ }
+ queryParams = __assign({}, queryParams, { redirectToPath: redirectToPath });
+ _this.redirectToAuthWithoutRedirectToPath(show, history, queryParams);
};
- _this.config = __assign({}, utils_1.normaliseAuthRecipeModuleConfig(config), normalisedChildClassConfig);
- if (_this.config.emailVerificationFeature.mode === "REQUIRED") {
- _this.emailVerification = new emailverification_1.default(
- __assign(
- {},
- _this.config.emailVerificationFeature,
- { palette: _this.config.palette, useShadowDom: _this.config.useShadowDom },
- _this.hooks,
- { appInfo: _this.appInfo, recipeId: _this.recipeId, signOut: _this.signOut }
- )
+ _this.redirectToAuthWithoutRedirectToPath = function (show, history, queryParams) {
+ if (queryParams === undefined) {
+ queryParams = {};
+ }
+ if (show !== undefined) {
+ queryParams = __assign({}, queryParams, { show: show });
+ }
+ _this.redirect(
+ {
+ action: "SIGN_IN_AND_UP",
+ },
+ history,
+ queryParams
);
- }
+ };
+ _this.emailVerification =
+ recipes.emailVerificationInstance === undefined
+ ? new recipe_2.default(
+ __assign(
+ {
+ appInfo: config.appInfo,
+ recipeId: config.recipeId,
+ signOut: _this.signOut,
+ postVerificationRedirect: function (history) {
+ return __awaiter(_this, void 0, void 0, function () {
+ return __generator(this, function (_a) {
+ this.redirect(
+ {
+ action: "SUCCESS",
+ isNewUser: false,
+ },
+ history
+ );
+ return [2 /*return*/];
+ });
+ });
+ },
+ redirectToSignIn: function (history) {
+ return __awaiter(_this, void 0, void 0, function () {
+ return __generator(this, function (_a) {
+ this.redirectToAuthWithoutRedirectToPath(undefined, history);
+ return [2 /*return*/];
+ });
+ });
+ },
+ getRedirectionURL: config.getRedirectionURL,
+ onHandleEvent: config.onHandleEvent,
+ palette: config.palette,
+ preAPIHook: config.preAPIHook,
+ useShadowDom: config.useShadowDom,
+ },
+ config.emailVerificationFeature,
+ { override: config.override === undefined ? undefined : config.override.emailVerification }
+ )
+ )
+ : recipes.emailVerificationInstance;
return _this;
}
- /*
- * Email Verification
- */
- AuthRecipeModule.prototype.isEmailVerified = function () {
- return __awaiter(this, void 0, void 0, function () {
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- if (this.emailVerification === undefined) {
- throw new Error(
- "You need to set emailVerificationFeature mode to required to use this method."
- );
- return [2 /*return*/, false];
- }
- return [4 /*yield*/, this.emailVerification.isEmailVerified()];
- case 1:
- return [2 /*return*/, _a.sent()];
- }
- });
- });
- };
- AuthRecipeModule.prototype.isEmailVerificationRequired = function () {
- return this.emailVerification !== undefined && this.emailVerification.config.mode === "REQUIRED";
- };
return AuthRecipeModule;
})(recipeModule_1.default);
exports.default = AuthRecipeModule;
diff --git a/lib/build/recipe/authRecipeModule/index.js.map b/lib/build/recipe/authRecipeModule/index.js.map
index 80f459ce5..a3aa0ffbc 100644
--- a/lib/build/recipe/authRecipeModule/index.js.map
+++ b/lib/build/recipe/authRecipeModule/index.js.map
@@ -1 +1 @@
-{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/recipe/authRecipeModule/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AAEH,+DAAyC;AACzC,iEAA2C;AAG3C,6BAAgC;AAChC,iCAA0D;AAC1D,2EAAqD;AAErD;;GAEG;AACH;IAAmE,oCAAqB;IAQpF;;OAEG;IACH,0BAAY,MAAuC,EAAE,0BAA6B;QAAlF,YACI,kBAAM,MAAM,CAAC,SAiBhB;QAED,8CAAwC,GAAG,UACvC,OAAiD;;gBAEjD,QAAQ,OAAO,CAAC,MAAM,EAAE;oBACpB,KAAK,gBAAgB;wBACjB,sBAAU,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,oBAAoB,EAAE,aAAQ,IAAI,CAAC,QAAU,EAAC;oBAEzF,KAAK,SAAS;wBACV,sBAAO,OAAO,CAAC,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,EAAC;oBAE/E,KAAK,cAAc,CAAC,CAAC;wBACjB,IAAI,IAAI,CAAC,iBAAiB,KAAK,SAAS,EAAE;4BACtC,sBAAO,GAAG,EAAC;yBACd;wBACD,sBAAO,IAAI,CAAC,iBAAiB,CAAC,8BAA8B,CAAC,OAAO,CAAC,EAAC;qBACzE;iBACJ;;;aACJ,CAAC;QAEF,iCAA2B,GAAG;YAC1B,IAAI,QAAQ,GAA8B,EAAE,CAAC;YAC7C,IAAI,KAAI,CAAC,iBAAiB,KAAK,SAAS,EAAE;gBACtC,QAAQ,GAAG,KAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,CAAC;aACnD;YAED,OAAO,QAAQ,CAAC;QACpB,CAAC,CAAC;QAEF;;WAEG;QACH,eAAS,GAAG;YACR,OAAQ,KA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C,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;;;yBAChE,EACD,iBAAiB,EAAE,MAAM,CAAC,iBAAiB,EAC3C,aAAa,EAAE,MAAM,CAAC,aAAa,EACnC,OAAO,EAAE,MAAM,CAAC,OAAO,EACvB,UAAU,EAAE,MAAM,CAAC,UAAU,EAC7B,YAAY,EAAE,MAAM,CAAC,YAAY,IAC9B,MAAM,CAAC,wBAAwB,IAClC,QAAQ,EAAE,MAAM,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,IACzF;gBACJ,CAAC,CAAC,OAAO,CAAC,yBAAyB,CAAC;;IAChD,CAAC;IA0DL,uBAAC;AAAD,CAAC,AApGD,CAKU,sBAAY,GA+FrB"}
\ No newline at end of file
diff --git a/lib/build/recipe/authRecipeModule/types.d.ts b/lib/build/recipe/authRecipeModule/types.d.ts
index 72197644c..3f6878b67 100644
--- a/lib/build/recipe/authRecipeModule/types.d.ts
+++ b/lib/build/recipe/authRecipeModule/types.d.ts
@@ -1,45 +1,60 @@
-import { EmailVerificationUserInput, NormalisedEmailVerificationConfig } from "../emailverification/types";
-import { RecipeModuleConfig, RecipeModuleHooks } from "../recipeModule/types";
+import {
+ UserInputForAuthRecipeModule as EmailVerificationUserInput,
+ GetRedirectionURLContext as EmailVerificationGetRedirectionURLContext,
+ OnHandleEventContext as EmailVerificationOnHandleEventContext,
+ PreAPIHookContext as EmailVerificationPreAPIHookContext,
+ ComponentOverrideMap as EmailVerificationComponentOverrideMap,
+ RecipeInterface,
+} from "../emailverification/types";
+import {
+ Config as RecipeModuleConfig,
+ NormalisedConfig as NormalisedRecipeModuleConfig,
+ UserInput as UserInputRecipeModule,
+} from "../recipeModule/types";
export declare type User = {
id: string;
email: string;
};
-export declare type AuthRecipeModuleConfig = AuthRecipeModuleUserInput & RecipeModuleConfig;
-export declare type AuthRecipeModuleUserInput = RecipeModuleHooks & {
- useShadowDom?: boolean;
- palette?: Record;
- emailVerificationFeature?: EmailVerificationUserInput;
-};
-export declare type NormalisedAuthRecipeConfig = {
- useShadowDom: boolean;
- palette: Record;
- emailVerificationFeature: NormalisedEmailVerificationConfig;
-};
-export declare type AuthRecipeModuleGetRedirectionURLContext = {
- action: "SUCCESS";
- isNewUser: boolean;
- redirectToPath?: string;
-} | {
- action: "SIGN_IN_AND_UP" | "VERIFY_EMAIL";
-};
-export declare type AuthRecipeModulePreAPIHookContext = {
- action: "VERIFY_EMAIL" | "SEND_VERIFY_EMAIL" | "IS_EMAIL_VERIFIED" | "SIGN_OUT" | "SIGN_IN";
- requestInit: RequestInit;
- url: string;
-};
-export declare type AuthRecipeModuleOnHandleEventContext = {
- action: "SESSION_ALREADY_EXISTS" | "VERIFY_EMAIL_SENT" | "EMAIL_VERIFIED_SUCCESSFUL";
-} | {
- action: "SUCCESS";
- isNewUser: boolean;
- user: {
- id: string;
- email: string;
+export declare type UserInputOverride = {
+ emailVerification?: {
+ functions?: (originalImplementation: RecipeInterface) => RecipeInterface;
+ components?: EmailVerificationComponentOverrideMap;
};
};
-export declare type SignInAndUpState = {
- status: "LOADING" | "READY";
-} | {
- status: "SUCCESSFUL";
- user: User;
-};
+export declare type UserInput = {
+ emailVerificationFeature?: EmailVerificationUserInput;
+} & UserInputRecipeModule;
+export declare type Config = UserInput & RecipeModuleConfig;
+export declare type NormalisedConfig = {
+ emailVerificationFeature?: EmailVerificationUserInput;
+ override?: {
+ emailVerification?: {
+ functions?: (originalImplementation: RecipeInterface) => RecipeInterface;
+ components?: EmailVerificationComponentOverrideMap;
+ };
+ };
+} & NormalisedRecipeModuleConfig;
+export declare type GetRedirectionURLContext =
+ | {
+ action: "SUCCESS";
+ isNewUser: boolean;
+ redirectToPath?: string;
+ }
+ | {
+ action: "SIGN_IN_AND_UP";
+ }
+ | EmailVerificationGetRedirectionURLContext;
+export declare type PreAPIHookContext = EmailVerificationPreAPIHookContext;
+export declare type OnHandleEventContext =
+ | {
+ action: "SESSION_ALREADY_EXISTS";
+ }
+ | {
+ action: "SUCCESS";
+ isNewUser: boolean;
+ user: {
+ id: string;
+ email: string;
+ };
+ }
+ | EmailVerificationOnHandleEventContext;
diff --git a/lib/build/recipe/authRecipeModule/utils.d.ts b/lib/build/recipe/authRecipeModule/utils.d.ts
index 28228ab2a..3af94dd8b 100644
--- a/lib/build/recipe/authRecipeModule/utils.d.ts
+++ b/lib/build/recipe/authRecipeModule/utils.d.ts
@@ -1,4 +1,2 @@
-import AuthRecipeModule from ".";
-import { AuthRecipeModuleConfig, NormalisedAuthRecipeConfig } from "./types";
-export declare function isAuthRecipeModule(x: unknown): x is AuthRecipeModule;
-export declare function normaliseAuthRecipeModuleConfig(config: AuthRecipeModuleConfig): NormalisedAuthRecipeConfig;
+import { Config, NormalisedConfig } from "./types";
+export declare function normaliseAuthRecipeModuleConfig(config: Config): NormalisedConfig;
diff --git a/lib/build/recipe/authRecipeModule/utils.js b/lib/build/recipe/authRecipeModule/utils.js
index 13167c5a3..a25c8f66f 100644
--- a/lib/build/recipe/authRecipeModule/utils.js
+++ b/lib/build/recipe/authRecipeModule/utils.js
@@ -13,34 +13,26 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
-var __importDefault =
- (this && this.__importDefault) ||
- function (mod) {
- return mod && mod.__esModule ? mod : { default: mod };
+var __assign =
+ (this && this.__assign) ||
+ function () {
+ __assign =
+ Object.assign ||
+ function (t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
+ }
+ return t;
+ };
+ return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
-/*
- * Imports.
- */
-var _1 = __importDefault(require("."));
-var utils_1 = require("../../utils");
-var utils_2 = require("../emailverification/utils");
-function isAuthRecipeModule(x) {
- return x instanceof _1.default;
-}
-exports.isAuthRecipeModule = isAuthRecipeModule;
-/*
- * normaliseAuthRecipeModuleConfig
- */
+var utils_1 = require("../recipeModule/utils");
function normaliseAuthRecipeModuleConfig(config) {
- var useShadowDom = config.useShadowDom === undefined ? true : config.useShadowDom;
- var palette = config.palette === undefined ? {} : config.palette;
- var emailVerificationFeature = utils_2.normaliseEmailVerificationFeature(config.emailVerificationFeature);
- return {
- useShadowDom: utils_1.getShouldUseShadowDom(useShadowDom),
- palette: palette,
- emailVerificationFeature: emailVerificationFeature,
- };
+ return __assign({}, utils_1.normaliseRecipeModuleConfig(config), {
+ emailVerificationFeature: config.emailVerificationFeature,
+ });
}
exports.normaliseAuthRecipeModuleConfig = normaliseAuthRecipeModuleConfig;
//# sourceMappingURL=utils.js.map
diff --git a/lib/build/recipe/authRecipeModule/utils.js.map b/lib/build/recipe/authRecipeModule/utils.js.map
index 4791ac7c0..f23593706 100644
--- a/lib/build/recipe/authRecipeModule/utils.js.map
+++ b/lib/build/recipe/authRecipeModule/utils.js.map
@@ -1 +1 @@
-{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../ts/recipe/authRecipeModule/utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;AAEH;;GAEG;AACH,uCAAiC;AACjC,qCAAoD;AACpD,oDAA+E;AAG/E,SAAgB,kBAAkB,CAAa,CAAU;IACrD,OAAO,CAAC,YAAY,UAAgB,CAAC;AACzC,CAAC;AAFD,gDAEC;AAED;;GAEG;AACH,SAAgB,+BAA+B,CAC3C,MAAuC;IAEvC,IAAM,YAAY,GAAG,MAAM,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC;IACpF,IAAM,OAAO,GAAG,MAAM,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;IACnE,IAAM,wBAAwB,GAAG,yCAAiC,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC;IACpG,OAAO;QACH,YAAY,EAAE,6BAAqB,CAAC,YAAY,CAAC;QACjD,OAAO,SAAA;QACP,wBAAwB,0BAAA;KAC3B,CAAC;AACN,CAAC;AAXD,0EAWC"}
\ No newline at end of file
+{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../ts/recipe/authRecipeModule/utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;AAGH,+CAAoE;AAEpE,SAAgB,+BAA+B,CAAU,MAAuB;IAC5E,oBACO,mCAA2B,CAAC,MAAM,CAAC,IACtC,wBAAwB,EAAE,MAAM,CAAC,wBAAwB,IAC3D;AACN,CAAC;AALD,0EAKC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailpassword/components/emailPasswordAuth.js.map b/lib/build/recipe/emailpassword/components/emailPasswordAuth.js.map
deleted file mode 100644
index 26fe74994..000000000
--- a/lib/build/recipe/emailpassword/components/emailPasswordAuth.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"emailPasswordAuth.js","sourceRoot":"","sources":["../../../../ts/recipe/emailpassword/components/emailPasswordAuth.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH,2CAA+B;AAC/B,+BAAsC;AAEtC,mEAA6C;AAE7C,0EAAoD;AACpD,wGAAkF;AAClF,qEAA+C;AAE/C;;GAEG;AAEH;IAAgC,qCAA2D;IAA3F;QAAA,qEAkBC;QAjBG;;WAEG;QACH,YAAM,GAAG;YACL,OAAO,CACH,oBAAC,qBAAW,IACR,WAAW,EAAE,KAAI,CAAC,KAAK,CAAC,WAAW,KAAK,SAAS,IAAI,KAAI,CAAC,KAAK,CAAC,WAAW,EAC3E,QAAQ,EAAE,uBAAa,CAAC,kBAAkB,EAAE,CAAC,QAAQ,EACrD,OAAO,EAAE,KAAI,CAAC,KAAK,CAAC,OAAO;gBAC3B,oBAAC,+BAAqB,IAClB,QAAQ,EAAE,uBAAa,CAAC,kBAAkB,EAAE,CAAC,QAAQ,EACrD,OAAO,EAAE,KAAI,CAAC,KAAK,CAAC,OAAO,IAC1B,KAAI,CAAC,KAAK,CAAC,QAAQ,CACA,CACd,CACjB,CAAC;QACN,CAAC,CAAC;;IACN,CAAC;IAAD,wBAAC;AAAD,CAAC,AAlBD,CAAgC,qBAAa,GAkB5C;AAED,SAAwB,wBAAwB,CAAC,EAMhD;QALG,sBAAQ,EACR,4BAAW;IAKX,IAAM,cAAc,GAAG,qBAAW,CAAC,kBAAkB,EAAE,CAAC,iBAAiB,EAAE,CAAC;IAC5E,IAAI,cAAc,KAAK,SAAS,EAAE;QAC9B,OAAO,CACH,oBAAC,iBAAiB,IAAC,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,uBAAa,CAAC,kBAAkB,EAAE,CAAC,QAAQ,IAC7F,QAAQ,CACO,CACvB,CAAC;KACL;IAED,IAAM,SAAS,GAAG,cAAc,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAC/D,OAAO,CACH,oBAAC,SAAS,IAAC,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,uBAAa,CAAC,kBAAkB,EAAE,CAAC,QAAQ,IACrF,QAAQ,CACD,CACf,CAAC;AACN,CAAC;AAtBD,2CAsBC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailpassword/components/features/emailVerification/wrapper.d.ts b/lib/build/recipe/emailpassword/components/features/emailVerification/wrapper.d.ts
deleted file mode 100644
index 74c7f865b..000000000
--- a/lib/build/recipe/emailpassword/components/features/emailVerification/wrapper.d.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-///
-export default function EmailVerification(props: any): JSX.Element;
diff --git a/lib/build/recipe/emailpassword/components/features/emailVerification/wrapper.js b/lib/build/recipe/emailpassword/components/features/emailVerification/wrapper.js
deleted file mode 100644
index 6895b42b3..000000000
--- a/lib/build/recipe/emailpassword/components/features/emailVerification/wrapper.js
+++ /dev/null
@@ -1,52 +0,0 @@
-"use strict";
-/* 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 __assign =
- (this && this.__assign) ||
- function () {
- __assign =
- Object.assign ||
- function (t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
- s = arguments[i];
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
- }
- return t;
- };
- return __assign.apply(this, arguments);
- };
-var __importDefault =
- (this && this.__importDefault) ||
- function (mod) {
- return mod && mod.__esModule ? mod : { default: mod };
- };
-Object.defineProperty(exports, "__esModule", { value: true });
-/*
- * Imports.
- */
-var react_1 = __importDefault(require("react"));
-var emailVerification_1 = __importDefault(
- require("../../../../emailverification/components/features/emailVerification")
-);
-var emailPassword_1 = __importDefault(require("../../../emailPassword"));
-// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
-function EmailVerification(props) {
- return react_1.default.createElement(
- emailVerification_1.default,
- __assign({ recipeId: emailPassword_1.default.getInstanceOrThrow().recipeId }, props)
- );
-}
-exports.default = EmailVerification;
-//# sourceMappingURL=wrapper.js.map
diff --git a/lib/build/recipe/emailpassword/components/features/emailVerification/wrapper.js.map b/lib/build/recipe/emailpassword/components/features/emailVerification/wrapper.js.map
deleted file mode 100644
index 04851d5ce..000000000
--- a/lib/build/recipe/emailpassword/components/features/emailVerification/wrapper.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"wrapper.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/features/emailVerification/wrapper.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH,gDAA0B;AAC1B,0HAAuH;AACvH,yEAAmD;AAEnD,6EAA6E;AAC7E,SAAwB,iBAAiB,CAAC,KAAU;IAChD,OAAO,8BAAC,2BAAqB,aAAC,QAAQ,EAAE,uBAAa,CAAC,kBAAkB,EAAE,CAAC,QAAQ,IAAM,KAAK,EAAI,CAAC;AACvG,CAAC;AAFD,oCAEC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/api.d.ts b/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/api.d.ts
deleted file mode 100644
index d29270e9d..000000000
--- a/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/api.d.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import { APIFormField } from "../../../../../types";
-import RecipeModule from "../../../../recipeModule";
-import { FormBaseAPIResponse } from "../../../types";
-export declare function handleSubmitNewPasswordAPI(formFields: APIFormField[], recipe: RecipeModule, token: string): Promise;
-export declare function enterEmailAPI(formFields: APIFormField[], recipe: RecipeModule): Promise;
diff --git a/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/api.js b/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/api.js
deleted file mode 100644
index 557aa6c6e..000000000
--- a/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/api.js
+++ /dev/null
@@ -1,245 +0,0 @@
-"use strict";
-/* 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 __awaiter =
- (this && this.__awaiter) ||
- function (thisArg, _arguments, P, generator) {
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) {
- try {
- step(generator.next(value));
- } catch (e) {
- reject(e);
- }
- }
- function rejected(value) {
- try {
- step(generator["throw"](value));
- } catch (e) {
- reject(e);
- }
- }
- function step(result) {
- result.done
- ? resolve(result.value)
- : new P(function (resolve) {
- resolve(result.value);
- }).then(fulfilled, rejected);
- }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
- };
-var __generator =
- (this && this.__generator) ||
- function (thisArg, body) {
- var _ = {
- label: 0,
- sent: function () {
- if (t[0] & 1) throw t[1];
- return t[1];
- },
- trys: [],
- ops: [],
- },
- f,
- y,
- t,
- g;
- return (
- (g = { next: verb(0), throw: verb(1), return: verb(2) }),
- typeof Symbol === "function" &&
- (g[Symbol.iterator] = function () {
- return this;
- }),
- g
- );
- function verb(n) {
- return function (v) {
- return step([n, v]);
- };
- }
- function step(op) {
- if (f) throw new TypeError("Generator is already executing.");
- while (_)
- try {
- if (
- ((f = 1),
- y &&
- (t =
- op[0] & 2
- ? y["return"]
- : op[0]
- ? y["throw"] || ((t = y["return"]) && t.call(y), 0)
- : y.next) &&
- !(t = t.call(y, op[1])).done)
- )
- return t;
- if (((y = 0), t)) op = [op[0] & 2, t.value];
- switch (op[0]) {
- case 0:
- case 1:
- t = op;
- break;
- case 4:
- _.label++;
- return { value: op[1], done: false };
- case 5:
- _.label++;
- y = op[1];
- op = [0];
- continue;
- case 7:
- op = _.ops.pop();
- _.trys.pop();
- continue;
- default:
- if (
- !((t = _.trys), (t = t.length > 0 && t[t.length - 1])) &&
- (op[0] === 6 || op[0] === 2)
- ) {
- _ = 0;
- continue;
- }
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
- _.label = op[1];
- break;
- }
- if (op[0] === 6 && _.label < t[1]) {
- _.label = t[1];
- t = op;
- break;
- }
- if (t && _.label < t[2]) {
- _.label = t[2];
- _.ops.push(op);
- break;
- }
- if (t[2]) _.ops.pop();
- _.trys.pop();
- continue;
- }
- op = body.call(thisArg, _);
- } catch (e) {
- op = [6, e];
- y = 0;
- } finally {
- f = t = 0;
- }
- if (op[0] & 5) throw op[1];
- return { value: op[0] ? op[1] : void 0, done: true };
- }
- };
-Object.defineProperty(exports, "__esModule", { value: true });
-var constants_1 = require("../../../../../constants");
-/*
- * Imports.
- */
-function handleSubmitNewPasswordAPI(formFields, recipe, token) {
- return __awaiter(this, void 0, void 0, function () {
- var response;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- return [
- 4 /*yield*/,
- recipe.httpRequest.post(
- "/user/password/reset",
- {
- body: JSON.stringify({ formFields: formFields, token: token }),
- },
- "SUBMIT_NEW_PASSWORD"
- ),
- ];
- case 1:
- response = _a.sent();
- // Otherwise, if field errors.
- if (response.status === "FIELD_ERROR") {
- return [
- 2 /*return*/,
- {
- status: "FIELD_ERROR",
- formFields: response.formFields,
- },
- ];
- }
- // Otherwise, if reset password invalid token error.
- if (response.status === "RESET_PASSWORD_INVALID_TOKEN_ERROR") {
- return [
- 2 /*return*/,
- {
- status: "GENERAL_ERROR",
- message: constants_1.RESET_PASSWORD_INVALID_TOKEN_ERROR,
- },
- ];
- }
- // Otherwise, status === OK
- if (response.status === "OK") {
- return [
- 2 /*return*/,
- {
- status: "OK",
- },
- ];
- }
- throw Error(constants_1.SOMETHING_WENT_WRONG_ERROR);
- }
- });
- });
-}
-exports.handleSubmitNewPasswordAPI = handleSubmitNewPasswordAPI;
-function enterEmailAPI(formFields, recipe) {
- return __awaiter(this, void 0, void 0, function () {
- var response;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- return [
- 4 /*yield*/,
- recipe.httpRequest.post(
- "/user/password/reset/token",
- {
- body: JSON.stringify({ formFields: formFields }),
- },
- "SEND_RESET_PASSWORD_EMAIL"
- ),
- ];
- case 1:
- response = _a.sent();
- // Otherwise, if field errors.
- if (response.status === "FIELD_ERROR") {
- return [
- 2 /*return*/,
- {
- status: "FIELD_ERROR",
- formFields: response.formFields,
- },
- ];
- }
- // Otherwise, success.
- if (response.status === "OK") {
- return [
- 2 /*return*/,
- {
- status: "OK",
- },
- ];
- }
- throw Error(constants_1.SOMETHING_WENT_WRONG_ERROR);
- }
- });
- });
-}
-exports.enterEmailAPI = enterEmailAPI;
-//# sourceMappingURL=api.js.map
diff --git a/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/api.js.map b/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/api.js.map
deleted file mode 100644
index a517c02dc..000000000
--- a/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/api.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/features/resetPasswordUsingToken/api.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,sDAA0G;AAK1G;;GAEG;AAEH,SAAsB,0BAA0B,CAC5C,UAA0B,EAC1B,MAA+C,EAC/C,KAAa;;;;;wBAEkC,qBAAM,MAAM,CAAC,WAAW,CAAC,IAAI,CACxE,sBAAsB,EACtB;wBACI,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,UAAU,YAAA,EAAE,KAAK,OAAA,EAAE,CAAC;qBAC9C,EACD,qBAAqB,CACxB,EAAA;;oBANK,QAAQ,GAAiC,SAM9C;oBAED,8BAA8B;oBAC9B,IAAI,QAAQ,CAAC,MAAM,KAAK,aAAa,EAAE;wBACnC,sBAAO;gCACH,MAAM,EAAE,aAAa;gCACrB,UAAU,EAAE,QAAQ,CAAC,UAAU;6BAClC,EAAC;qBACL;oBAED,oDAAoD;oBACpD,IAAI,QAAQ,CAAC,MAAM,KAAK,oCAAoC,EAAE;wBAC1D,sBAAO;gCACH,MAAM,EAAE,eAAe;gCACvB,OAAO,EAAE,8CAAkC;6BAC9C,EAAC;qBACL;oBAED,2BAA2B;oBAC3B,IAAI,QAAQ,CAAC,MAAM,KAAK,IAAI,EAAE;wBAC1B,sBAAO;gCACH,MAAM,EAAE,IAAI;6BACf,EAAC;qBACL;oBAED,MAAM,KAAK,CAAC,sCAA0B,CAAC,CAAC;;;;CAC3C;AArCD,gEAqCC;AAED,SAAsB,aAAa,CAC/B,UAA0B,EAC1B,MAA+C;;;;;wBAEP,qBAAM,MAAM,CAAC,WAAW,CAAC,IAAI,CACjE,4BAA4B,EAC5B;wBACI,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,UAAU,YAAA,EAAE,CAAC;qBACvC,EACD,2BAA2B,CAC9B,EAAA;;oBANK,QAAQ,GAA0B,SAMvC;oBAED,8BAA8B;oBAC9B,IAAI,QAAQ,CAAC,MAAM,KAAK,aAAa,EAAE;wBACnC,sBAAO;gCACH,MAAM,EAAE,aAAa;gCACrB,UAAU,EAAE,QAAQ,CAAC,UAAU;6BAClC,EAAC;qBACL;oBAED,sBAAsB;oBACtB,IAAI,QAAQ,CAAC,MAAM,KAAK,IAAI,EAAE;wBAC1B,sBAAO;gCACH,MAAM,EAAE,IAAI;6BACf,EAAC;qBACL;oBAED,MAAM,KAAK,CAAC,sCAA0B,CAAC,CAAC;;;;CAC3C;AA5BD,sCA4BC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/index.d.ts b/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/index.d.ts
index 3ff51f72e..4abeaa79b 100644
--- a/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/index.d.ts
+++ b/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/index.d.ts
@@ -1,17 +1,17 @@
import { PureComponent } from "react";
-import { EmailPasswordGetRedirectionURLContext, EmailPasswordOnHandleEventContext, EmailPasswordPreAPIHookContext, FormBaseAPIResponse, NormalisedEmailPasswordConfig } from "../../../types";
-import { APIFormField, FeatureBaseProps } from "../../../../../types";
-import AuthRecipeModule from "../../../../authRecipeModule";
-import { NormalisedAuthRecipeConfig } from "../../../../authRecipeModule/types";
-declare class ResetPasswordUsingToken extends PureComponent {
- constructor(props: FeatureBaseProps);
- getRecipeInstanceOrThrow: () => AuthRecipeModule;
- getRecipeConfigOrThrow: () => NormalisedEmailPasswordConfig & NormalisedAuthRecipeConfig;
+import { FeatureBaseProps } from "../../../../../types";
+import Recipe from "../../../recipe";
+declare type PropType = FeatureBaseProps & {
+ recipe: Recipe;
+};
+declare class ResetPasswordUsingToken extends PureComponent<
+ PropType,
+ {
+ token: string | undefined;
+ }
+> {
+ constructor(props: PropType);
getIsEmbedded: () => boolean;
- submitNewPassword: (formFields: APIFormField[]) => Promise;
- enterEmail: (formFields: APIFormField[]) => Promise;
render: () => JSX.Element;
}
export default ResetPasswordUsingToken;
diff --git a/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/index.js b/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/index.js
index aac626b95..c9b44fb2a 100644
--- a/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/index.js
+++ b/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/index.js
@@ -36,133 +36,19 @@ var __extends =
d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
};
})();
-var __awaiter =
- (this && this.__awaiter) ||
- function (thisArg, _arguments, P, generator) {
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) {
- try {
- step(generator.next(value));
- } catch (e) {
- reject(e);
+var __assign =
+ (this && this.__assign) ||
+ function () {
+ __assign =
+ Object.assign ||
+ function (t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
- }
- function rejected(value) {
- try {
- step(generator["throw"](value));
- } catch (e) {
- reject(e);
- }
- }
- function step(result) {
- result.done
- ? resolve(result.value)
- : new P(function (resolve) {
- resolve(result.value);
- }).then(fulfilled, rejected);
- }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
- };
-var __generator =
- (this && this.__generator) ||
- function (thisArg, body) {
- var _ = {
- label: 0,
- sent: function () {
- if (t[0] & 1) throw t[1];
- return t[1];
- },
- trys: [],
- ops: [],
- },
- f,
- y,
- t,
- g;
- return (
- (g = { next: verb(0), throw: verb(1), return: verb(2) }),
- typeof Symbol === "function" &&
- (g[Symbol.iterator] = function () {
- return this;
- }),
- g
- );
- function verb(n) {
- return function (v) {
- return step([n, v]);
+ return t;
};
- }
- function step(op) {
- if (f) throw new TypeError("Generator is already executing.");
- while (_)
- try {
- if (
- ((f = 1),
- y &&
- (t =
- op[0] & 2
- ? y["return"]
- : op[0]
- ? y["throw"] || ((t = y["return"]) && t.call(y), 0)
- : y.next) &&
- !(t = t.call(y, op[1])).done)
- )
- return t;
- if (((y = 0), t)) op = [op[0] & 2, t.value];
- switch (op[0]) {
- case 0:
- case 1:
- t = op;
- break;
- case 4:
- _.label++;
- return { value: op[1], done: false };
- case 5:
- _.label++;
- y = op[1];
- op = [0];
- continue;
- case 7:
- op = _.ops.pop();
- _.trys.pop();
- continue;
- default:
- if (
- !((t = _.trys), (t = t.length > 0 && t[t.length - 1])) &&
- (op[0] === 6 || op[0] === 2)
- ) {
- _ = 0;
- continue;
- }
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
- _.label = op[1];
- break;
- }
- if (op[0] === 6 && _.label < t[1]) {
- _.label = t[1];
- t = op;
- break;
- }
- if (t && _.label < t[2]) {
- _.label = t[2];
- _.ops.push(op);
- break;
- }
- if (t[2]) _.ops.pop();
- _.trys.pop();
- continue;
- }
- op = body.call(thisArg, _);
- } catch (e) {
- op = [6, e];
- y = 0;
- } finally {
- f = t = 0;
- }
- if (op[0] & 5) throw op[1];
- return { value: op[0] ? op[1] : void 0, done: true };
- }
+ return __assign.apply(this, arguments);
};
var __importStar =
(this && this.__importStar) ||
@@ -188,13 +74,8 @@ var React = __importStar(require("react"));
var react_2 = require("react");
var __1 = require("../../..");
var utils_1 = require("../../../../../utils");
-var api_1 = require("./api");
var featureWrapper_1 = __importDefault(require("../../../../../components/featureWrapper"));
-var authRecipeModule_1 = __importDefault(require("../../../../authRecipeModule"));
-var superTokens_1 = __importDefault(require("../../../../../superTokens"));
-/*
- * Component.
- */
+var componentOverrideContext_1 = require("../../../../../components/componentOverride/componentOverrideContext");
var ResetPasswordUsingToken = /** @class */ (function (_super) {
__extends(ResetPasswordUsingToken, _super);
/*
@@ -202,181 +83,66 @@ var ResetPasswordUsingToken = /** @class */ (function (_super) {
*/
function ResetPasswordUsingToken(props) {
var _this = _super.call(this, props) || this;
- _this.getRecipeInstanceOrThrow = function () {
- if (_this.props.recipeId === undefined) {
- throw new Error("No recipeId props given to SignInAndUp component");
- }
- var recipe = superTokens_1.default.getInstanceOrThrow().getRecipeOrThrow(_this.props.recipeId);
- if (recipe instanceof authRecipeModule_1.default === false) {
- throw new Error(
- recipe.recipeId + " must be an instance of AuthRecipeModule to use SignInAndUp component."
- );
- }
- return recipe;
- };
- _this.getRecipeConfigOrThrow = function () {
- return _this.getRecipeInstanceOrThrow().getConfig();
- };
_this.getIsEmbedded = function () {
if (_this.props.isEmbedded !== undefined) {
return _this.props.isEmbedded;
}
return false;
};
- /*
- * Methods.
- */
- _this.submitNewPassword = function (formFields) {
- return __awaiter(_this, void 0, void 0, function () {
- var validationErrors;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- return [
- 4 /*yield*/,
- utils_1.validateForm(
- formFields,
- this.getRecipeConfigOrThrow().resetPasswordUsingTokenFeature.submitNewPasswordForm
- .formFields
- ),
- ];
- case 1:
- validationErrors = _a.sent();
- // If errors, return.
- if (validationErrors.length > 0) {
- return [
- 2 /*return*/,
- {
- status: "FIELD_ERROR",
- formFields: validationErrors,
- },
- ];
- }
- // Verify that both passwords match.
- if (formFields[0].value !== formFields[1].value) {
- return [
- 2 /*return*/,
- {
- status: "FIELD_ERROR",
- formFields: [
- {
- id: "confirm-password",
- error: "Confirmation password doesn't match",
- },
- ],
- },
- ];
- }
- return [
- 4 /*yield*/,
- api_1.handleSubmitNewPasswordAPI(
- [formFields[0]],
- this.getRecipeInstanceOrThrow(),
- this.state.token
- ),
- ];
- case 2:
- // Call API, only send first password.
- return [2 /*return*/, _a.sent()];
- }
- });
- });
- };
- _this.enterEmail = function (formFields) {
- return __awaiter(_this, void 0, void 0, function () {
- var validationErrors;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- return [
- 4 /*yield*/,
- utils_1.validateForm(
- formFields,
- this.getRecipeConfigOrThrow().resetPasswordUsingTokenFeature.enterEmailForm
- .formFields
- ),
- ];
- case 1:
- validationErrors = _a.sent();
- // If errors, return.
- if (validationErrors.length > 0) {
- return [
- 2 /*return*/,
- {
- status: "FIELD_ERROR",
- formFields: validationErrors,
- },
- ];
- }
- return [4 /*yield*/, api_1.enterEmailAPI(formFields, this.getRecipeInstanceOrThrow())];
- case 2:
- return [2 /*return*/, _a.sent()];
- }
- });
- });
- };
_this.render = function () {
- var enterEmailFormFeature = _this.getRecipeConfigOrThrow().resetPasswordUsingTokenFeature.enterEmailForm;
+ var enterEmailFormFeature = _this.props.recipe.config.resetPasswordUsingTokenFeature.enterEmailForm;
+ var componentOverrides = _this.props.recipe.config.override.components;
var submitNewPasswordFormFeature =
- _this.getRecipeConfigOrThrow().resetPasswordUsingTokenFeature.submitNewPasswordForm;
- var submitNewPasswordForm = {
- styleFromInit: submitNewPasswordFormFeature.style,
- formFields: submitNewPasswordFormFeature.formFields,
- submitNewPasswordAPI: _this.submitNewPassword,
- onSuccess: function () {
- _this.getRecipeInstanceOrThrow().hooks.onHandleEvent({
- action: "PASSWORD_RESET_SUCCESSFUL",
- });
- },
- onSignInClicked: function () {
- _this.getRecipeInstanceOrThrow().redirect({ action: "SIGN_IN_AND_UP" }, _this.props.history);
- },
- };
+ _this.props.recipe.config.resetPasswordUsingTokenFeature.submitNewPasswordForm;
+ var submitNewPasswordForm =
+ _this.state.token === undefined
+ ? undefined
+ : {
+ styleFromInit: submitNewPasswordFormFeature.style,
+ formFields: submitNewPasswordFormFeature.formFields,
+ recipeImplementation: _this.props.recipe.recipeImpl,
+ config: _this.props.recipe.config,
+ onSignInClicked: function () {
+ _this.props.recipe.redirectToAuthWithoutRedirectToPath("signin", _this.props.history);
+ },
+ token: _this.state.token,
+ };
var enterEmailForm = {
styleFromInit: enterEmailFormFeature.style,
formFields: enterEmailFormFeature.formFields,
- onSuccess: function () {
- _this.getRecipeInstanceOrThrow().hooks.onHandleEvent({
- action: "RESET_PASSWORD_EMAIL_SENT",
- });
- },
- enterEmailAPI: _this.enterEmail,
+ recipeImplementation: _this.props.recipe.recipeImpl,
+ config: _this.props.recipe.config,
+ };
+ var props = {
+ config: _this.props.recipe.config,
+ submitNewPasswordForm: submitNewPasswordForm,
+ enterEmailForm: enterEmailForm,
};
- var hasToken = _this.state.token.length !== 0;
- /*
- * Render.
- */
return react_1.jsx(
- featureWrapper_1.default,
- { isEmbedded: _this.getIsEmbedded(), useShadowDom: _this.getRecipeConfigOrThrow().useShadowDom },
+ componentOverrideContext_1.ComponentOverrideContext.Provider,
+ { value: componentOverrides },
react_1.jsx(
- react_2.Fragment,
- null,
- _this.props.children === undefined &&
- react_1.jsx(__1.ResetPasswordUsingTokenTheme, {
- rawPalette: _this.getRecipeConfigOrThrow().palette,
- submitNewPasswordForm: submitNewPasswordForm,
- enterEmailForm: enterEmailForm,
- hasToken: hasToken,
- }),
- _this.props.children &&
- React.cloneElement(_this.props.children, {
- rawPalette: _this.getRecipeConfigOrThrow().palette,
- submitNewPasswordForm: submitNewPasswordForm,
- enterEmailForm: enterEmailForm,
- hasToken: hasToken,
- })
+ featureWrapper_1.default,
+ { isEmbedded: _this.getIsEmbedded(), useShadowDom: _this.props.recipe.config.useShadowDom },
+ react_1.jsx(
+ react_2.Fragment,
+ null,
+ _this.props.children === undefined &&
+ react_1.jsx(__1.ResetPasswordUsingTokenTheme, __assign({}, props)),
+ _this.props.children && React.cloneElement(_this.props.children, props)
+ )
)
);
};
var urlParams = new URLSearchParams(utils_1.getWindowOrThrow().location.search);
var token = urlParams.get("token");
if (token === null) {
- token = "";
+ _this.state = { token: undefined };
+ } else {
+ _this.state = {
+ token: token,
+ };
}
- _this.state = {
- token: token,
- };
return _this;
}
return ResetPasswordUsingToken;
diff --git a/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/index.js.map b/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/index.js.map
index c6d882d47..54ba7ec64 100644
--- a/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/index.js.map
+++ b/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/index.js.map
@@ -1 +1 @@
-{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/features/resetPasswordUsingToken/index.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH,eAAe;AACf,wCAAqC;AACrC,2CAA+B;AAC/B,+BAAgD;AAShD,8BAAwD;AAGxD,8CAAsE;AACtE,6BAAkE;AAClE,4FAAsE;AACtE,kFAA4D;AAE5D,2EAAqD;AAGrD;;GAEG;AAEH;IAAsC,2CAAkD;IACpF;;OAEG;IACH,iCAAY,KAAuB;QAAnC,YACI,kBAAM,KAAK,CAAC,SAWf;QAED,8BAAwB,GAAG;YAMvB,IAAI,KAAI,CAAC,KAAK,CAAC,QAAQ,KAAK,SAAS,EAAE;gBACnC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;aACvE;YAED,IAAM,MAAM,GAAG,qBAAW,CAAC,kBAAkB,EAAE,CAAC,gBAAgB,CAAC,KAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YACtF,IAAI,MAAM,YAAY,0BAAgB,KAAK,KAAK,EAAE;gBAC9C,MAAM,IAAI,KAAK,CAAI,MA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Aa,GA6KlD;AAED,kBAAe,uBAAuB,CAAC"}
\ No newline at end of file
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/features/resetPasswordUsingToken/index.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH,eAAe;AACf,wCAAqC;AACrC,2CAA+B;AAC/B,+BAAgD;AAChD,8BAAwD;AAGxD,8CAAwD;AACxD,4FAAsE;AAEtE,iHAAgH;AAMhH;IAAsC,2CAAsD;IACxF;;OAEG;IACH,iCAAY,KAAe;QAA3B,YACI,kBAAM,KAAK,CAAC,SAWf;QAED,mBAAa,GAAG;YACZ,IAAI,KAAI,CAAC,KAAK,CAAC,UAAU,KAAK,SAAS,EAAE;gBACrC,OAAO,KAAI,CAAC,KAAK,CAAC,UAAU,CAAC;aAChC;YACD,OAAO,KAAK,CAAC;QACjB,CAAC,CAAC;QAEF,YAAM,GAAG;YACL,IAAM,qBAAqB,GAAG,KAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,8BAA8B,CAAC,cAAc,CAAC;YAErG,IAAM,kBAAkB,GAAG,KAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC;YAExE,IAAM,4BAA4B,GAC9B,KAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,8BAA8B,CAAC,qBAAqB,CAAC;YAElF,IAAM,qBAAqB,GACvB,KAAI,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS;gBAC1B,CAAC,CAAC,SAAS;gBACX,CAAC,CAAC;oBACI,aAAa,EAAE,4BAA4B,CAAC,KAAK;oBACjD,UAAU,EAAE,4BAA4B,CAAC,UAAU;oBACnD,oBAAoB,EAAE,KAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU;oBAClD,MAAM,EAAE,KAAI,CAAC,KAAK,CAAC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CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACrC,IAAI,KAAK,KAAK,IAAI,EAAE;YAChB,KAAI,CAAC,KAAK,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;SACrC;aAAM;YACH,KAAI,CAAC,KAAK,GAAG;gBACT,KAAK,OAAA;aACR,CAAC;SACL;;IACL,CAAC;IAyDL,8BAAC;AAAD,CAAC,AAzED,CAAsC,qBAAa,GAyElD;AAED,kBAAe,uBAAuB,CAAC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/wrapper.d.ts b/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/wrapper.d.ts
deleted file mode 100644
index 3f330712e..000000000
--- a/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/wrapper.d.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-///
-export default function ResetPasswordUsingToken(props: any): JSX.Element;
diff --git a/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/wrapper.js b/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/wrapper.js
deleted file mode 100644
index 7b66a183e..000000000
--- a/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/wrapper.js
+++ /dev/null
@@ -1,53 +0,0 @@
-"use strict";
-/* 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 __assign =
- (this && this.__assign) ||
- function () {
- __assign =
- Object.assign ||
- function (t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
- s = arguments[i];
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
- }
- return t;
- };
- return __assign.apply(this, arguments);
- };
-var __importDefault =
- (this && this.__importDefault) ||
- function (mod) {
- return mod && mod.__esModule ? mod : { default: mod };
- };
-Object.defineProperty(exports, "__esModule", { value: true });
-/*
- * Imports.
- */
-var react_1 = __importDefault(require("react"));
-var _1 = __importDefault(require("."));
-var emailPassword_1 = __importDefault(require("../../../emailPassword"));
-/*
- * Used for embedding in page.
- */
-// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
-function ResetPasswordUsingToken(props) {
- return react_1.default.createElement(
- _1.default,
- __assign({ recipeId: emailPassword_1.default.getInstanceOrThrow().recipeId }, props)
- );
-}
-exports.default = ResetPasswordUsingToken;
-//# sourceMappingURL=wrapper.js.map
diff --git a/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/wrapper.js.map b/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/wrapper.js.map
deleted file mode 100644
index 24ff2e446..000000000
--- a/lib/build/recipe/emailpassword/components/features/resetPasswordUsingToken/wrapper.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"wrapper.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/features/resetPasswordUsingToken/wrapper.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH,gDAA0B;AAC1B,uCAA2D;AAC3D,yEAAmD;AAEnD;;GAEG;AACH,6EAA6E;AAC7E,SAAwB,uBAAuB,CAAC,KAAU;IACtD,OAAO,8BAAC,UAA2B,aAAC,QAAQ,EAAE,uBAAa,CAAC,kBAAkB,EAAE,CAAC,QAAQ,IAAM,KAAK,EAAI,CAAC;AAC7G,CAAC;AAFD,0CAEC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailpassword/components/features/signInAndUp/api.d.ts b/lib/build/recipe/emailpassword/components/features/signInAndUp/api.d.ts
deleted file mode 100644
index 3ad0066b7..000000000
--- a/lib/build/recipe/emailpassword/components/features/signInAndUp/api.d.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { APIFormField } from "../../../../../types";
-import RecipeModule from "../../../../recipeModule";
-import { FormBaseAPIResponse } from "../../../types";
-export declare function signUpAPI(formFields: APIFormField[], recipe: RecipeModule): Promise;
-export declare function signInAPI(formFields: APIFormField[], recipe: RecipeModule): Promise;
-export declare function emailExistsAPI(email: string, recipe: RecipeModule): Promise;
diff --git a/lib/build/recipe/emailpassword/components/features/signInAndUp/api.js b/lib/build/recipe/emailpassword/components/features/signInAndUp/api.js
deleted file mode 100644
index f85e5e393..000000000
--- a/lib/build/recipe/emailpassword/components/features/signInAndUp/api.js
+++ /dev/null
@@ -1,280 +0,0 @@
-"use strict";
-/* 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 __awaiter =
- (this && this.__awaiter) ||
- function (thisArg, _arguments, P, generator) {
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) {
- try {
- step(generator.next(value));
- } catch (e) {
- reject(e);
- }
- }
- function rejected(value) {
- try {
- step(generator["throw"](value));
- } catch (e) {
- reject(e);
- }
- }
- function step(result) {
- result.done
- ? resolve(result.value)
- : new P(function (resolve) {
- resolve(result.value);
- }).then(fulfilled, rejected);
- }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
- };
-var __generator =
- (this && this.__generator) ||
- function (thisArg, body) {
- var _ = {
- label: 0,
- sent: function () {
- if (t[0] & 1) throw t[1];
- return t[1];
- },
- trys: [],
- ops: [],
- },
- f,
- y,
- t,
- g;
- return (
- (g = { next: verb(0), throw: verb(1), return: verb(2) }),
- typeof Symbol === "function" &&
- (g[Symbol.iterator] = function () {
- return this;
- }),
- g
- );
- function verb(n) {
- return function (v) {
- return step([n, v]);
- };
- }
- function step(op) {
- if (f) throw new TypeError("Generator is already executing.");
- while (_)
- try {
- if (
- ((f = 1),
- y &&
- (t =
- op[0] & 2
- ? y["return"]
- : op[0]
- ? y["throw"] || ((t = y["return"]) && t.call(y), 0)
- : y.next) &&
- !(t = t.call(y, op[1])).done)
- )
- return t;
- if (((y = 0), t)) op = [op[0] & 2, t.value];
- switch (op[0]) {
- case 0:
- case 1:
- t = op;
- break;
- case 4:
- _.label++;
- return { value: op[1], done: false };
- case 5:
- _.label++;
- y = op[1];
- op = [0];
- continue;
- case 7:
- op = _.ops.pop();
- _.trys.pop();
- continue;
- default:
- if (
- !((t = _.trys), (t = t.length > 0 && t[t.length - 1])) &&
- (op[0] === 6 || op[0] === 2)
- ) {
- _ = 0;
- continue;
- }
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
- _.label = op[1];
- break;
- }
- if (op[0] === 6 && _.label < t[1]) {
- _.label = t[1];
- t = op;
- break;
- }
- if (t && _.label < t[2]) {
- _.label = t[2];
- _.ops.push(op);
- break;
- }
- if (t[2]) _.ops.pop();
- _.trys.pop();
- continue;
- }
- op = body.call(thisArg, _);
- } catch (e) {
- op = [6, e];
- y = 0;
- } finally {
- f = t = 0;
- }
- if (op[0] & 5) throw op[1];
- return { value: op[0] ? op[1] : void 0, done: true };
- }
- };
-Object.defineProperty(exports, "__esModule", { value: true });
-/*
- * Imports.
- */
-var constants_1 = require("../../../../../constants");
-/*
- * Methods.
- */
-function signUpAPI(formFields, recipe) {
- return __awaiter(this, void 0, void 0, function () {
- var response;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- return [
- 4 /*yield*/,
- recipe.httpRequest.post(
- "/signup",
- {
- body: JSON.stringify({ formFields: formFields }),
- },
- "SIGN_UP"
- ),
- ];
- case 1:
- response = _a.sent();
- // If success.
- if (response.status === "OK") {
- return [
- 2 /*return*/,
- {
- status: "OK",
- user: response.user,
- },
- ];
- }
- // Otherwise, if field errors.
- if (response.status === "FIELD_ERROR") {
- return [
- 2 /*return*/,
- {
- status: "FIELD_ERROR",
- formFields: response.formFields,
- },
- ];
- }
- throw new Error(constants_1.SOMETHING_WENT_WRONG_ERROR);
- }
- });
- });
-}
-exports.signUpAPI = signUpAPI;
-function signInAPI(formFields, recipe) {
- return __awaiter(this, void 0, void 0, function () {
- var response;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- return [
- 4 /*yield*/,
- recipe.httpRequest.post(
- "/signin",
- {
- body: JSON.stringify({ formFields: formFields }),
- },
- "SIGN_IN"
- ),
- ];
- case 1:
- response = _a.sent();
- // If success.
- if (response.status === "OK") {
- return [
- 2 /*return*/,
- {
- status: "OK",
- user: response.user,
- },
- ];
- }
- // Otherwise, if field errors.
- if (response.status === "FIELD_ERROR") {
- return [
- 2 /*return*/,
- {
- status: "FIELD_ERROR",
- formFields: response.formFields,
- },
- ];
- }
- // Otherwise, if wrong credentials error.
- if (response.status === "WRONG_CREDENTIALS_ERROR") {
- return [
- 2 /*return*/,
- {
- status: "GENERAL_ERROR",
- message: constants_1.INCORRECT_EMAIL_PASSWORD_COMBINATION_ERROR,
- },
- ];
- }
- throw new Error(constants_1.SOMETHING_WENT_WRONG_ERROR);
- }
- });
- });
-}
-exports.signInAPI = signInAPI;
-function emailExistsAPI(email, recipe) {
- return __awaiter(this, void 0, void 0, function () {
- var response;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- return [
- 4 /*yield*/,
- recipe.httpRequest.get("/signup/email/exists", {}, "EMAIL_EXISTS", {
- email: email,
- }),
- ];
- case 1:
- response = _a.sent();
- // If email already exists.
- if (response.status === "OK") {
- // If email exists.
- if (response.exists === true) {
- return [2 /*return*/, "This email already exists. Please sign in instead"];
- }
- // Otherwise, no errors.
- return [2 /*return*/, undefined];
- }
- // Fail silently.
- return [2 /*return*/, undefined];
- }
- });
- });
-}
-exports.emailExistsAPI = emailExistsAPI;
-//# sourceMappingURL=api.js.map
diff --git a/lib/build/recipe/emailpassword/components/features/signInAndUp/api.js.map b/lib/build/recipe/emailpassword/components/features/signInAndUp/api.js.map
deleted file mode 100644
index 365367888..000000000
--- a/lib/build/recipe/emailpassword/components/features/signInAndUp/api.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/features/signInAndUp/api.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH,sDAAkH;AAKlH;;GAEG;AAEH,SAAsB,SAAS,CAC3B,UAA0B,EAC1B,MAA+C;;;;;wBAEX,qBAAM,MAAM,CAAC,WAAW,CAAC,IAAI,CAC7D,SAAS,EACT;wBACI,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,UAAU,YAAA,EAAE,CAAC;qBACvC,EACD,SAAS,CACZ,EAAA;;oBANK,QAAQ,GAAsB,SAMnC;oBAED,cAAc;oBACd,IAAI,QAAQ,CAAC,MAAM,KAAK,IAAI,EAAE;wBAC1B,sBAAO;gCACH,MAAM,EAAE,IAAI;gCACZ,IAAI,EAAE,QAAQ,CAAC,IAAI;6BACtB,EAAC;qBACL;oBAED,8BAA8B;oBAC9B,IAAI,QAAQ,CAAC,MAAM,KAAK,aAAa,EAAE;wBACnC,sBAAO;gCACH,MAAM,EAAE,aAAa;gCACrB,UAAU,EAAE,QAAQ,CAAC,UAAU;6BAClC,EAAC;qBACL;oBAED,MAAM,IAAI,KAAK,CAAC,sCAA0B,CAAC,CAAC;;;;CAC/C;AA7BD,8BA6BC;AAED,SAAsB,SAAS,CAC3B,UAA0B,EAC1B,MAA+C;;;;;wBAEX,qBAAM,MAAM,CAAC,WAA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/recipe/emailpassword/components/features/signInAndUp/index.d.ts b/lib/build/recipe/emailpassword/components/features/signInAndUp/index.d.ts
index ec0b62aec..e17411013 100644
--- a/lib/build/recipe/emailpassword/components/features/signInAndUp/index.d.ts
+++ b/lib/build/recipe/emailpassword/components/features/signInAndUp/index.d.ts
@@ -1,20 +1,19 @@
import { PureComponent } from "react";
-import { FormFieldThemeProps, FormBaseAPIResponse, EmailPasswordGetRedirectionURLContext, EmailPasswordPreAPIHookContext, EmailPasswordOnHandleEventContext, NormalisedEmailPasswordConfig } from "../../../types";
-import { APIFormField, FeatureBaseProps, NormalisedFormField } from "../../../../../types";
-import { NormalisedAuthRecipeConfig, SignInAndUpState } from "../../../../authRecipeModule/types";
-import AuthRecipeModule from "../../../../authRecipeModule";
-declare class SignInAndUp extends PureComponent {
- constructor(props: FeatureBaseProps);
- getRecipeInstanceOrThrow: () => AuthRecipeModule;
- getRecipeConfigOrThrow: () => NormalisedEmailPasswordConfig & NormalisedAuthRecipeConfig;
+import { FormFieldThemeProps } from "../../../types";
+import { FeatureBaseProps, NormalisedFormField } from "../../../../../types";
+import { SignInAndUpState, RecipeInterface } from "../../../types";
+import Recipe from "../../../recipe";
+declare type PropType = FeatureBaseProps & {
+ recipe: Recipe;
+};
+declare class SignInAndUp extends PureComponent {
+ constructor(props: PropType);
getIsEmbedded: () => boolean;
- signIn: (formFields: APIFormField[]) => Promise;
onSignInSuccess: () => Promise;
- signUp: (formFields: APIFormField[]) => Promise;
- setStateOnSuccessfulAPICall(normalisedAPIResponse: FormBaseAPIResponse): void;
onSignUpSuccess: () => Promise;
getThemeSignUpFeatureFormFields(formFields: NormalisedFormField[]): FormFieldThemeProps[];
componentDidMount: () => Promise;
+ getModifiedRecipeImplementation: () => RecipeInterface;
render: () => JSX.Element;
}
export default SignInAndUp;
diff --git a/lib/build/recipe/emailpassword/components/features/signInAndUp/index.js b/lib/build/recipe/emailpassword/components/features/signInAndUp/index.js
index f5c3df543..dfe895d92 100644
--- a/lib/build/recipe/emailpassword/components/features/signInAndUp/index.js
+++ b/lib/build/recipe/emailpassword/components/features/signInAndUp/index.js
@@ -200,15 +200,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = require("@emotion/react");
var React = __importStar(require("react"));
var react_2 = require("react");
-var api_1 = require("./api");
var __1 = require("../../..");
var utils_1 = require("../../../../../utils");
var featureWrapper_1 = __importDefault(require("../../../../../components/featureWrapper"));
-var authRecipeModule_1 = __importDefault(require("../../../../authRecipeModule"));
-var superTokens_1 = __importDefault(require("../../../../../superTokens"));
-/*
- * Component.
- */
+var componentOverrideContext_1 = require("../../../../../components/componentOverride/componentOverrideContext");
var SignInAndUp = /** @class */ (function (_super) {
__extends(SignInAndUp, _super);
/*
@@ -216,64 +211,12 @@ var SignInAndUp = /** @class */ (function (_super) {
*/
function SignInAndUp(props) {
var _this = _super.call(this, props) || this;
- _this.getRecipeInstanceOrThrow = function () {
- if (_this.props.recipeId === undefined) {
- throw new Error("No recipeId props given to SignInAndUp component");
- }
- var recipe = superTokens_1.default.getInstanceOrThrow().getRecipeOrThrow(_this.props.recipeId);
- if (recipe instanceof authRecipeModule_1.default === false) {
- throw new Error(
- recipe.recipeId + " must be an instance of AuthRecipeModule to use SignInAndUp component."
- );
- }
- return recipe;
- };
- _this.getRecipeConfigOrThrow = function () {
- return _this.getRecipeInstanceOrThrow().getConfig();
- };
_this.getIsEmbedded = function () {
if (_this.props.isEmbedded !== undefined) {
return _this.props.isEmbedded;
}
return false;
};
- /*
- * Methods.
- */
- _this.signIn = function (formFields) {
- return __awaiter(_this, void 0, void 0, function () {
- var validationErrors, normalisedAPIResponse;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- return [
- 4 /*yield*/,
- utils_1.validateForm(
- formFields,
- this.getRecipeConfigOrThrow().signInAndUpFeature.signInForm.formFields
- ),
- ];
- case 1:
- validationErrors = _a.sent();
- // If errors, return.
- if (validationErrors.length > 0) {
- return [
- 2 /*return*/,
- {
- status: "FIELD_ERROR",
- formFields: validationErrors,
- },
- ];
- }
- return [4 /*yield*/, api_1.signInAPI(formFields, this.getRecipeInstanceOrThrow())];
- case 2:
- normalisedAPIResponse = _a.sent();
- this.setStateOnSuccessfulAPICall(normalisedAPIResponse);
- return [2 /*return*/, normalisedAPIResponse];
- }
- });
- });
- };
_this.onSignInSuccess = function () {
return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
@@ -282,14 +225,9 @@ var SignInAndUp = /** @class */ (function (_super) {
if (this.state.status !== "SUCCESSFUL") {
return [2 /*return*/];
}
- this.getRecipeInstanceOrThrow().hooks.onHandleEvent({
- action: "SUCCESS",
- isNewUser: false,
- user: this.state.user,
- });
return [
4 /*yield*/,
- this.getRecipeInstanceOrThrow().redirect(
+ this.props.recipe.redirect(
{
action: "SUCCESS",
isNewUser: false,
@@ -304,94 +242,61 @@ var SignInAndUp = /** @class */ (function (_super) {
});
});
};
- _this.signUp = function (formFields) {
+ _this.onSignUpSuccess = function () {
return __awaiter(_this, void 0, void 0, function () {
- var validationErrors, normalisedAPIResponse;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
+ if (this.state.status !== "SUCCESSFUL") {
+ return [2 /*return*/];
+ }
+ if (!(this.props.recipe.emailVerification.config.mode === "REQUIRED"))
+ return [3 /*break*/, 2];
return [
4 /*yield*/,
- utils_1.validateForm(
- formFields,
- this.getRecipeConfigOrThrow().signInAndUpFeature.signUpForm.formFields
+ this.props.recipe.emailVerification.redirect(
+ {
+ action: "VERIFY_EMAIL",
+ },
+ this.props.history
),
];
case 1:
- validationErrors = _a.sent();
- // If errors, return.
- if (validationErrors.length > 0) {
- return [
- 2 /*return*/,
+ return [2 /*return*/, _a.sent()];
+ case 2:
+ return [
+ 4 /*yield*/,
+ this.props.recipe.redirect(
{
- status: "FIELD_ERROR",
- formFields: validationErrors,
+ redirectToPath: utils_1.getRedirectToPathFromURL(),
+ isNewUser: true,
+ action: "SUCCESS",
},
- ];
- }
- return [4 /*yield*/, api_1.signUpAPI(formFields, this.getRecipeInstanceOrThrow())];
- case 2:
- normalisedAPIResponse = _a.sent();
- this.setStateOnSuccessfulAPICall(normalisedAPIResponse);
- return [2 /*return*/, normalisedAPIResponse];
- }
- });
- });
- };
- _this.onSignUpSuccess = function () {
- return __awaiter(_this, void 0, void 0, function () {
- var context;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- if (this.state.status !== "SUCCESSFUL") {
- return [2 /*return*/];
- }
- this.getRecipeInstanceOrThrow().hooks.onHandleEvent({
- action: "SUCCESS",
- isNewUser: false,
- user: this.state.user,
- });
- context = {
- redirectToPath: utils_1.getRedirectToPathFromURL(),
- isNewUser: true,
- action: "SUCCESS",
- };
- if (this.getRecipeInstanceOrThrow().isEmailVerificationRequired() === true) {
- // Or if sign up and email verification mode is not required, redirect to success screen.
- context = {
- action: "VERIFY_EMAIL",
- };
- }
- return [4 /*yield*/, this.getRecipeInstanceOrThrow().redirect(context, this.props.history)];
- case 1:
+ this.props.history
+ ),
+ ];
+ case 3:
return [2 /*return*/, _a.sent()];
}
});
});
};
- /*
- * Init.
- */
_this.componentDidMount = function () {
return __awaiter(_this, void 0, void 0, function () {
var sessionExists;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
- return [4 /*yield*/, this.getRecipeInstanceOrThrow().doesSessionExist()];
+ return [4 /*yield*/, this.props.recipe.doesSessionExist()];
case 1:
sessionExists = _a.sent();
if (!sessionExists) return [3 /*break*/, 3];
- this.getRecipeInstanceOrThrow().hooks.onHandleEvent({
+ this.props.recipe.config.onHandleEvent({
action: "SESSION_ALREADY_EXISTS",
});
return [
4 /*yield*/,
- this.getRecipeInstanceOrThrow().redirect(
- { action: "SUCCESS", isNewUser: false },
- this.props.history
- ),
+ this.props.recipe.redirect({ action: "SUCCESS", isNewUser: false }, this.props.history),
];
case 2:
return [2 /*return*/, _a.sent()];
@@ -407,54 +312,97 @@ var SignInAndUp = /** @class */ (function (_super) {
});
});
};
+ _this.getModifiedRecipeImplementation = function () {
+ return __assign({}, _this.props.recipe.recipeImpl, {
+ signIn: function (input) {
+ return __awaiter(_this, void 0, void 0, function () {
+ var response;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ return [4 /*yield*/, this.props.recipe.recipeImpl.signIn(input)];
+ case 1:
+ response = _a.sent();
+ this.setState(function (oldState) {
+ return oldState.status !== "READY" || response.status !== "OK"
+ ? oldState
+ : {
+ status: "SUCCESSFUL",
+ user: response.user,
+ };
+ });
+ return [2 /*return*/, response];
+ }
+ });
+ });
+ },
+ signUp: function (input) {
+ return __awaiter(_this, void 0, void 0, function () {
+ var response;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ return [4 /*yield*/, this.props.recipe.recipeImpl.signUp(input)];
+ case 1:
+ response = _a.sent();
+ this.setState(function (oldState) {
+ return oldState.status !== "READY" || response.status !== "OK"
+ ? oldState
+ : {
+ status: "SUCCESSFUL",
+ user: response.user,
+ };
+ });
+ return [2 /*return*/, response];
+ }
+ });
+ });
+ },
+ });
+ };
_this.render = function () {
- var signInAndUpFeature = _this.getRecipeConfigOrThrow().signInAndUpFeature;
+ // Before session is verified, return empty fragment, prevent UI glitch.
+ if (_this.state.status === "LOADING") {
+ return react_1.jsx(react_2.Fragment, null);
+ }
+ var componentOverrides = _this.props.recipe.config.override.components;
+ var signInAndUpFeature = _this.props.recipe.config.signInAndUpFeature;
var signUpFeature = signInAndUpFeature.signUpForm;
var signInFeature = signInAndUpFeature.signInForm;
var signInForm = {
+ recipeImplementation: _this.getModifiedRecipeImplementation(),
+ config: _this.props.recipe.config,
styleFromInit: signInFeature.style,
formFields: signInFeature.formFields,
- signInAPI: _this.signIn,
onSuccess: _this.onSignInSuccess,
forgotPasswordClick: function () {
- return _this.getRecipeInstanceOrThrow().redirect({ action: "RESET_PASSWORD" }, _this.props.history);
+ return _this.props.recipe.redirect({ action: "RESET_PASSWORD" }, _this.props.history);
},
};
var signUpForm = {
+ recipeImplementation: _this.getModifiedRecipeImplementation(),
+ config: _this.props.recipe.config,
styleFromInit: signUpFeature.style,
formFields: _this.getThemeSignUpFeatureFormFields(signUpFeature.formFields),
- privacyPolicyLink: signUpFeature.privacyPolicyLink,
- termsOfServiceLink: signUpFeature.termsOfServiceLink,
onSuccess: _this.onSignUpSuccess,
- signUpAPI: _this.signUp,
};
- // Before session is verified, return empty fragment, prevent UI glitch.
- if (_this.state.status === "LOADING") {
- return react_1.jsx(react_2.Fragment, null);
- }
- /*
- * Render.
- */
+ var props = {
+ config: _this.props.recipe.config,
+ signInForm: signInForm,
+ signUpForm: signUpForm,
+ };
return react_1.jsx(
- featureWrapper_1.default,
- { useShadowDom: _this.getRecipeConfigOrThrow().useShadowDom, isEmbedded: _this.getIsEmbedded() },
+ componentOverrideContext_1.ComponentOverrideContext.Provider,
+ { value: componentOverrides },
react_1.jsx(
- react_2.Fragment,
- null,
- _this.props.children === undefined &&
- react_1.jsx(__1.SignInAndUpTheme, {
- rawPalette: _this.getRecipeInstanceOrThrow().config.palette,
- defaultToSignUp: signInAndUpFeature.defaultToSignUp,
- signInForm: signInForm,
- signUpForm: signUpForm,
- }),
- _this.props.children &&
- React.cloneElement(_this.props.children, {
- rawPalette: _this.getRecipeInstanceOrThrow().config.palette,
- defaultToSignUp: signInAndUpFeature.defaultToSignUp,
- signInForm: signInForm,
- signUpForm: signUpForm,
- })
+ featureWrapper_1.default,
+ { useShadowDom: _this.props.recipe.config.useShadowDom, isEmbedded: _this.getIsEmbedded() },
+ react_1.jsx(
+ react_2.Fragment,
+ null,
+ _this.props.children === undefined && react_1.jsx(__1.SignInAndUpTheme, __assign({}, props)),
+ _this.props.children && React.cloneElement(_this.props.children, props)
+ )
)
);
};
@@ -463,24 +411,6 @@ var SignInAndUp = /** @class */ (function (_super) {
};
return _this;
}
- SignInAndUp.prototype.setStateOnSuccessfulAPICall = function (normalisedAPIResponse) {
- this.setState(function (oldState) {
- if (
- oldState.status !== "READY" ||
- normalisedAPIResponse.status !== "OK" ||
- normalisedAPIResponse.user === undefined
- ) {
- return oldState;
- }
- return {
- status: "SUCCESSFUL",
- user: {
- id: normalisedAPIResponse.user.id,
- email: normalisedAPIResponse.user.email,
- },
- };
- });
- };
SignInAndUp.prototype.getThemeSignUpFeatureFormFields = function (formFields) {
var _this = this;
var emailPasswordOnly = formFields.length === 2;
@@ -502,15 +432,15 @@ var SignInAndUp = /** @class */ (function (_super) {
// Otherwise, if email, use syntax validate method and check if email exists.
return function (value) {
return __awaiter(_this, void 0, void 0, function () {
- var syntaxError, e_1;
+ var error, emailExists, _1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
return [4 /*yield*/, field.validate(value)];
case 1:
- syntaxError = _a.sent();
- if (syntaxError !== undefined) {
- return [2 /*return*/, syntaxError];
+ error = _a.sent();
+ if (error !== undefined) {
+ return [2 /*return*/, error];
}
if (typeof value !== "string") {
return [2 /*return*/, "Email must be of type string"];
@@ -520,16 +450,22 @@ var SignInAndUp = /** @class */ (function (_super) {
_a.trys.push([2, 4, , 5]);
return [
4 /*yield*/,
- api_1.emailExistsAPI(value, this.getRecipeInstanceOrThrow()),
+ this.props.recipe.recipeImpl.doesEmailExist({
+ email: value,
+ config: this.props.recipe.config,
+ }),
];
case 3:
- return [2 /*return*/, _a.sent()];
+ emailExists = _a.sent();
+ if (emailExists) {
+ return [2 /*return*/, "This email already exists. Please sign in instead"];
+ }
+ return [3 /*break*/, 5];
case 4:
- e_1 = _a.sent();
- // Fail silently.
- return [2 /*return*/, undefined];
+ _1 = _a.sent();
+ return [3 /*break*/, 5];
case 5:
- return [2 /*return*/];
+ return [2 /*return*/, undefined];
}
});
});
diff --git a/lib/build/recipe/emailpassword/components/features/signInAndUp/index.js.map b/lib/build/recipe/emailpassword/components/features/signInAndUp/index.js.map
index 09ef8d0a2..f8a0ccb08 100644
--- a/lib/build/recipe/emailpassword/components/features/signInAndUp/index.js.map
+++ b/lib/build/recipe/emailpassword/components/features/signInAndUp/index.js.map
@@ -1 +1 @@
-{"version":3,"file":"index.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/B,CAAC,CAAC;IACR,CAAC;IAoFL,kBAAC;AAAD,CAAC,AArSD,CAA0B,qBAAa,GAqStC;AAED,kBAAe,WAAW,CAAC"}
\ No newline at end of file
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/features/signInAndUp/index.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH,eAAe;AACf,wCAAqC;AACrC,2CAA+B;AAC/B,+BAAgD;AAGhD,8BAA4C;AAE5C,8CAAgE;AAChE,4FAAsE;AAGtE,iHAAgH;AAMhH;IAA0B,+BAAyC;IAC/D;;OAEG;IACH,qBAAY,KAAe;QAA3B,YACI,kBAAM,KAAK,CAAC,SAKf;QAED,mBAAa,GAAG;YACZ,IAAI,KAAI,CAAC,KAAK,CAAC,UAAU,KAAK,SAAS,EAAE;gBACrC,OAAO,KAAI,CAAC,KAAK,CAAC,UAAU,CAAC;aAChC;YACD,OAAO,KAAK,CAAC;QACjB,CAAC,CAAC;QAEF,qBAAe,GAAG;;;;wBACd,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,YAAY,EAAE;4BACpC,sBAAO;yBACV;wBAEM,qBAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CACnC;gCACI,MAAM,EAAE,SAAS;gCACjB,SAAS,EAAE,KAAK;gCAChB,cAAc,EAAE,gCAAwB,EAAE;6BAC7C,EACD,IAAI,CAAC,KAAK,CAAC,OAAO,CACrB,EAAA;4BAPD,sBAAO,SAON,EAAC;;;aACL,CAAC;QAEF,qBAAe,GAAG;;;;wBACd,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,YAAY,EAAE;4BACpC,sBAAO;yBACV;6BAEG,CAAA,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAA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,KAAK;wCACZ,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM;qCACnC,CAAC,EAAA;;gCAHI,WAAW,GAAG,SAGlB;gCACF,IAAI,WAAW,EAAE;oCACb,sBAAO,mDAAmD,EAAC;iCAC9D;;;;;oCAEL,sBAAO,SAAS,EAAC;;;qBACpB,CAAC;YACN,CAAC,CAAC,EAAE,IACN,EAtC+B,CAsC/B,CAAC,CAAC;IACR,CAAC;IAyGL,kBAAC;AAAD,CAAC,AA5MD,CAA0B,qBAAa,GA4MtC;AAED,kBAAe,WAAW,CAAC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailpassword/components/features/signInAndUp/wrapper.d.ts b/lib/build/recipe/emailpassword/components/features/signInAndUp/wrapper.d.ts
deleted file mode 100644
index ee7006782..000000000
--- a/lib/build/recipe/emailpassword/components/features/signInAndUp/wrapper.d.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-///
-export default function SignInAndUp(props: any): JSX.Element;
diff --git a/lib/build/recipe/emailpassword/components/features/signInAndUp/wrapper.js b/lib/build/recipe/emailpassword/components/features/signInAndUp/wrapper.js
deleted file mode 100644
index e7c54da14..000000000
--- a/lib/build/recipe/emailpassword/components/features/signInAndUp/wrapper.js
+++ /dev/null
@@ -1,53 +0,0 @@
-"use strict";
-/* 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 __assign =
- (this && this.__assign) ||
- function () {
- __assign =
- Object.assign ||
- function (t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
- s = arguments[i];
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
- }
- return t;
- };
- return __assign.apply(this, arguments);
- };
-var __importDefault =
- (this && this.__importDefault) ||
- function (mod) {
- return mod && mod.__esModule ? mod : { default: mod };
- };
-Object.defineProperty(exports, "__esModule", { value: true });
-/*
- * Imports.
- */
-var react_1 = __importDefault(require("react"));
-var _1 = __importDefault(require("."));
-var emailPassword_1 = __importDefault(require("../../../emailPassword"));
-/*
- * Used for embedding in page.
- */
-// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
-function SignInAndUp(props) {
- return react_1.default.createElement(
- _1.default,
- __assign({ recipeId: emailPassword_1.default.getInstanceOrThrow().recipeId }, props)
- );
-}
-exports.default = SignInAndUp;
-//# sourceMappingURL=wrapper.js.map
diff --git a/lib/build/recipe/emailpassword/components/features/signInAndUp/wrapper.js.map b/lib/build/recipe/emailpassword/components/features/signInAndUp/wrapper.js.map
deleted file mode 100644
index 79e4e3ff8..000000000
--- a/lib/build/recipe/emailpassword/components/features/signInAndUp/wrapper.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"wrapper.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/features/signInAndUp/wrapper.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH,gDAA0B;AAC1B,uCAA+C;AAC/C,yEAAmD;AAEnD;;GAEG;AACH,6EAA6E;AAC7E,SAAwB,WAAW,CAAC,KAAU;IAC1C,OAAO,8BAAC,UAAe,aAAC,QAAQ,EAAE,uBAAa,CAAC,kBAAkB,EAAE,CAAC,QAAQ,IAAM,KAAK,EAAI,CAAC;AACjG,CAAC;AAFD,8BAEC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/enterEmail.d.ts b/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/enterEmail.d.ts
index 7f9915c88..3de39fab0 100644
--- a/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/enterEmail.d.ts
+++ b/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/enterEmail.d.ts
@@ -1,13 +1,4 @@
-///
-import { PureComponent } from "react";
-import { EnterEmailThemeProps, EnterEmailThemeState } from "../../../types";
-export default class EnterEmailTheme extends PureComponent {
- static contextType: import("react").Context<{
- [x: string]: import("@emotion/serialize").CSSObject;
- palette: import("../../../../../types").NormalisedPalette;
- }>;
- constructor(props: EnterEmailThemeProps);
- onSuccess: () => void;
- resend: () => void;
- render(): JSX.Element;
-}
+/** @jsx jsx */
+import { jsx } from "@emotion/react";
+import { EnterEmailProps } from "../../../types";
+export declare const EnterEmail: (props: EnterEmailProps) => jsx.JSX.Element;
diff --git a/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/enterEmail.js b/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/enterEmail.js
index 897f89aea..e40bd62d5 100644
--- a/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/enterEmail.js
+++ b/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/enterEmail.js
@@ -22,6 +22,134 @@ var __extends =
d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
};
})();
+var __awaiter =
+ (this && this.__awaiter) ||
+ function (thisArg, _arguments, P, generator) {
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) {
+ try {
+ step(generator.next(value));
+ } catch (e) {
+ reject(e);
+ }
+ }
+ function rejected(value) {
+ try {
+ step(generator["throw"](value));
+ } catch (e) {
+ reject(e);
+ }
+ }
+ function step(result) {
+ result.done
+ ? resolve(result.value)
+ : new P(function (resolve) {
+ resolve(result.value);
+ }).then(fulfilled, rejected);
+ }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+ };
+var __generator =
+ (this && this.__generator) ||
+ function (thisArg, body) {
+ var _ = {
+ label: 0,
+ sent: function () {
+ if (t[0] & 1) throw t[1];
+ return t[1];
+ },
+ trys: [],
+ ops: [],
+ },
+ f,
+ y,
+ t,
+ g;
+ return (
+ (g = { next: verb(0), throw: verb(1), return: verb(2) }),
+ typeof Symbol === "function" &&
+ (g[Symbol.iterator] = function () {
+ return this;
+ }),
+ g
+ );
+ function verb(n) {
+ return function (v) {
+ return step([n, v]);
+ };
+ }
+ function step(op) {
+ if (f) throw new TypeError("Generator is already executing.");
+ while (_)
+ try {
+ if (
+ ((f = 1),
+ y &&
+ (t =
+ op[0] & 2
+ ? y["return"]
+ : op[0]
+ ? y["throw"] || ((t = y["return"]) && t.call(y), 0)
+ : y.next) &&
+ !(t = t.call(y, op[1])).done)
+ )
+ return t;
+ if (((y = 0), t)) op = [op[0] & 2, t.value];
+ switch (op[0]) {
+ case 0:
+ case 1:
+ t = op;
+ break;
+ case 4:
+ _.label++;
+ return { value: op[1], done: false };
+ case 5:
+ _.label++;
+ y = op[1];
+ op = [0];
+ continue;
+ case 7:
+ op = _.ops.pop();
+ _.trys.pop();
+ continue;
+ default:
+ if (
+ !((t = _.trys), (t = t.length > 0 && t[t.length - 1])) &&
+ (op[0] === 6 || op[0] === 2)
+ ) {
+ _ = 0;
+ continue;
+ }
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
+ _.label = op[1];
+ break;
+ }
+ if (op[0] === 6 && _.label < t[1]) {
+ _.label = t[1];
+ t = op;
+ break;
+ }
+ if (t && _.label < t[2]) {
+ _.label = t[2];
+ _.ops.push(op);
+ break;
+ }
+ if (t[2]) _.ops.pop();
+ _.trys.pop();
+ continue;
+ }
+ op = body.call(thisArg, _);
+ } catch (e) {
+ op = [6, e];
+ y = 0;
+ } finally {
+ f = t = 0;
+ }
+ if (op[0] & 5) throw op[1];
+ return { value: op[0] ? op[1] : void 0, done: true };
+ }
+ };
var __importDefault =
(this && this.__importDefault) ||
function (mod) {
@@ -50,15 +178,13 @@ var react_1 = require("@emotion/react");
var react_2 = require("react");
var styleContext_1 = __importDefault(require("../../../../../styles/styleContext"));
var formBase_1 = __importDefault(require("../../library/formBase"));
-/*
- * Component.
- */
-var EnterEmailTheme = /** @class */ (function (_super) {
- __extends(EnterEmailTheme, _super);
+var withOverride_1 = require("../../../../../components/componentOverride/withOverride");
+var EmailPasswordEnterEmail = /** @class */ (function (_super) {
+ __extends(EmailPasswordEnterEmail, _super);
/*
* Constructor.
*/
- function EnterEmailTheme(props) {
+ function EmailPasswordEnterEmail(props) {
var _this = _super.call(this, props) || this;
/*
* Methods.
@@ -69,7 +195,6 @@ var EnterEmailTheme = /** @class */ (function (_super) {
status: "SENT",
};
});
- _this.props.onSuccess();
};
_this.resend = function () {
_this.setState(function () {
@@ -86,11 +211,10 @@ var EnterEmailTheme = /** @class */ (function (_super) {
/*
* Render.
*/
- EnterEmailTheme.prototype.render = function () {
+ EmailPasswordEnterEmail.prototype.render = function () {
+ var _this = this;
var styles = this.context;
- var _a = this.props,
- formFields = _a.formFields,
- enterEmailAPI = _a.enterEmailAPI;
+ var formFields = this.props.formFields;
var status = this.state.status;
if (status === "SENT") {
return react_1.jsx(
@@ -127,7 +251,24 @@ var EnterEmailTheme = /** @class */ (function (_super) {
formFields: formFields,
buttonLabel: "Email me",
onSuccess: this.onSuccess,
- callAPI: enterEmailAPI,
+ callAPI: function (formFields) {
+ return __awaiter(_this, void 0, void 0, function () {
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ return [
+ 4 /*yield*/,
+ this.props.recipeImplementation.sendPasswordResetEmail({
+ formFields: formFields,
+ config: this.props.config,
+ }),
+ ];
+ case 1:
+ return [2 /*return*/, _a.sent()];
+ }
+ });
+ });
+ },
showLabels: false,
validateOnBlur: true,
header: react_1.jsx(
@@ -152,8 +293,8 @@ var EnterEmailTheme = /** @class */ (function (_super) {
)
);
};
- EnterEmailTheme.contextType = styleContext_1.default;
- return EnterEmailTheme;
+ EmailPasswordEnterEmail.contextType = styleContext_1.default;
+ return EmailPasswordEnterEmail;
})(react_2.PureComponent);
-exports.default = EnterEmailTheme;
+exports.EnterEmail = withOverride_1.withOverride("EmailPasswordEnterEmail", EmailPasswordEnterEmail);
//# sourceMappingURL=enterEmail.js.map
diff --git a/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/enterEmail.js.map b/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/enterEmail.js.map
index 3a16ea5a4..41843d8eb 100644
--- a/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/enterEmail.js.map
+++ b/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/enterEmail.js.map
@@ -1 +1 @@
-{"version":3,"file":"enterEmail.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/themes/resetPasswordUsingToken/enterEmail.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;GAaG;AACH;;GAEG;AACH,eAAe;AACf,wCAAqC;AACrC,+BAAgD;AAChD,oFAA8D;AAI9D,oEAA8C;AAE9C;;GAEG;AAEH;IAA6C,mCAAyD;IAElG;;OAEG;IACH,yBAAY,KAA2B;QAAvC,YACI,kBAAM,KAAK,CAAC,SAIf;QAED;;WAEG;QAEH,eAAS,GAAG;YACR,KAAI,CAAC,QAAQ,CAAC,cAAM,OAAA,CAAC;gBACjB,MAAM,EAAE,MAAM;aACjB,CAAC,EAFkB,CAElB,CAAC,CAAC;YACJ,KAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;QAC3B,CAAC,CAAC;QAEF,YAAM,GAAG;YACL,KAAI,CAAC,QAAQ,CAAC,cAAM,OAAA,CAAC;gBACjB,MAAM,EAAE,OAAO;aAClB,CAAC,EAFkB,CAElB,CAAC,CAAC;QACR,CAAC,CAAC;QApBE,KAAI,CAAC,KAAK,GAAG;YACT,MAAM,EAAE,OAAO;SAClB,CAAC;;IACN,CAAC;IAmBD;;OAEG;IACH,gCAAM,GAAN;QACI,IAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;QACtB,IAAA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,aAE7D,CACL,CACJ,CACJ,CACT,CAAC;SACL;QAED,0BAA0B;QAC1B,OAAO,CACH,yCAAsB,WAAW,EAAC,GAAG,EAAE,MAAM,CAAC,SAAS;YACnD,yCAAsB,KAAK,EAAC,GAAG,EAAE,MAAM,CAAC,GAAG;gBACvC,YAAC,kBAAQ,IACL,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,UAAU,EACvB,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,OAAO,EAAE,UAAO,UAAU;;;wCACtB,qBAAM,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,sBAAsB,CAAC;wCACzD,UAAU,YAAA;wCACV,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;qCAC5B,CAAC,EAAA;wCAHF,sBAAA,SAGE,EAAA;;;yBAAA,EAEN,UAAU,EAAE,KAAK,EACjB,cAAc,EAAE,IAAI,EACpB,MAAM,EACF,YAAC,gBAAQ;wBACL,yCAAsB,aAAa,EAAC,GAAG,EAAE,MAAM,CAAC,WAAW,0BAErD;wBACN,yCAAsB,gBAAgB,EAAC,GAAG,EAAE,MAAM,CAAC,cAAc;4BAC7D,yCAAsB,eAAe,EAAC,GAAG,EAAE,MAAM,CAAC,aAAa,uDAEzD,CACJ,CACC,GAEjB,CACA,CACJ,CACT,CAAC;IACN,CAAC;IApFM,mCAAW,GAAG,sBAAY,CAAC;IAqFtC,8BAAC;CAAA,AAtFD,CAAsC,qBAAa,GAsFlD;AAEY,QAAA,UAAU,GAAG,2BAAY,CAAC,yBAAyB,EAAE,uBAAuB,CAAC,CAAC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/index.js b/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/index.js
index 5eeeeff7c..c8be07c98 100644
--- a/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/index.js
+++ b/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/index.js
@@ -36,19 +36,14 @@ var __importStar =
result["default"] = mod;
return result;
};
-var __importDefault =
- (this && this.__importDefault) ||
- function (mod) {
- return mod && mod.__esModule ? mod : { default: mod };
- };
Object.defineProperty(exports, "__esModule", { value: true });
/*
* Imports.
*/
var React = __importStar(require("react"));
var themeBase_1 = require("../themeBase");
-var enterEmail_1 = __importDefault(require("./enterEmail"));
-var submitNewPassword_1 = __importDefault(require("./submitNewPassword"));
+var enterEmail_1 = require("./enterEmail");
+var submitNewPassword_1 = require("./submitNewPassword");
var styles_1 = require("../styles/styles");
var styleContext_1 = require("../../../../../styles/styleContext");
var styles_2 = require("../../../../../styles/styles");
@@ -60,28 +55,28 @@ function ResetPasswordUsingTokenTheme(props) {
* Render.
*/
// If no token, return SubmitNewPassword.
- if (props.hasToken === true) {
+ if (props.submitNewPasswordForm !== undefined) {
return React.createElement(
styleContext_1.StyleProvider,
{
- rawPalette: props.rawPalette,
+ rawPalette: props.config.palette,
defaultPalette: styles_2.defaultPalette,
styleFromInit: props.submitNewPasswordForm.styleFromInit,
getDefaultStyles: styles_1.getStyles,
},
- React.createElement(submitNewPassword_1.default, __assign({}, props.submitNewPasswordForm))
+ React.createElement(submitNewPassword_1.SubmitNewPassword, __assign({}, props.submitNewPasswordForm))
);
}
// Otherwise, return EnterEmail.
return React.createElement(
styleContext_1.StyleProvider,
{
- rawPalette: props.rawPalette,
+ rawPalette: props.config.palette,
defaultPalette: styles_2.defaultPalette,
styleFromInit: props.enterEmailForm.styleFromInit,
getDefaultStyles: styles_1.getStyles,
},
- React.createElement(enterEmail_1.default, __assign({}, props.enterEmailForm))
+ React.createElement(enterEmail_1.EnterEmail, __assign({}, props.enterEmailForm))
);
}
exports.ResetPasswordUsingTokenTheme = ResetPasswordUsingTokenTheme;
diff --git a/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/index.js.map b/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/index.js.map
index 74976487e..bf30ec4e9 100644
--- a/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/index.js.map
+++ b/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/index.js.map
@@ -1 +1 @@
-{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/themes/resetPasswordUsingToken/index.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH,2CAA+B;AAE/B,0CAAyC;AAEzC,4DAAsC;AACtC,0EAAoD;AACpD,2CAA6C;AAC7C,mEAAmE;AACnE,uDAA8D;AAE9D;;GAEG;AAEH,SAAgB,4BAA4B,CAAC,KAAwC;IACjF;;OAEG;IAEH,yCAAyC;IACzC,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,EAAE;QACzB,OAAO,CACH,oBAAC,4BAAa,IACV,UAAU,EAAE,KAAK,CAAC,UAAU,EAC5B,cAAc,EAAE,uBAAc,EAC9B,aAAa,EAAE,KAAK,CAAC,qBAAqB,CAAC,aAAa,EACxD,gBAAgB,EAAE,kBAAS;YAC3B,oBAAC,2BAAiB,eAAK,KAAK,CAAC,qBAAqB,EAAI,CAC1C,CACnB,CAAC;KACL;IAED,gCAAgC;IAChC,OAAO,CACH,oBAAC,4BAAa,IACV,UAAU,EAAE,KAAK,CAAC,UAAU,EAC5B,cAAc,EAAE,uBAAc,EAC9B,aAAa,EAAE,KAAK,CAAC,cAAc,CAAC,aAAa,EACjD,gBAAgB,EAAE,kBAAS;QAC3B,oBAAC,oBAAU,eAAK,KAAK,CAAC,cAAc,EAAI,CAC5B,CACnB,CAAC;AACN,CAAC;AA5BD,oEA4BC;AAED,SAAS,mCAAmC,CAAC,KAAwC;IACjF,OAAO,CACH,oBAAC,qBAAS;QACN,oBAAC,4BAA4B,eAAK,KAAK,EAAI,CACnC,CACf,CAAC;AACN,CAAC;AAED,kBAAe,mCAAmC,CAAC"}
\ No newline at end of file
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/themes/resetPasswordUsingToken/index.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH,2CAA+B;AAE/B,0CAAyC;AAEzC,2CAA0C;AAC1C,yDAAwD;AACxD,2CAA6C;AAC7C,mEAAmE;AACnE,uDAA8D;AAE9D;;GAEG;AAEH,SAAgB,4BAA4B,CAAC,KAAwC;IACjF;;OAEG;IAEH,yCAAyC;IACzC,IAAI,KAAK,CAAC,qBAAqB,KAAK,SAAS,EAAE;QAC3C,OAAO,CACH,oBAAC,4BAAa,IACV,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,EAChC,cAAc,EAAE,uBAAc,EAC9B,aAAa,EAAE,KAAK,CAAC,qBAAqB,CAAC,aAAa,EACxD,gBAAgB,EAAE,kBAAS;YAC3B,oBAAC,qCAAiB,eAAK,KAAK,CAAC,qBAAqB,EAAI,CAC1C,CACnB,CAAC;KACL;IAED,gCAAgC;IAChC,OAAO,CACH,oBAAC,4BAAa,IACV,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,EAChC,cAAc,EAAE,uBAAc,EAC9B,aAAa,EAAE,KAAK,CAAC,cAAc,CAAC,aAAa,EACjD,gBAAgB,EAAE,kBAAS;QAC3B,oBAAC,uBAAU,eAAK,KAAK,CAAC,cAAc,EAAI,CAC5B,CACnB,CAAC;AACN,CAAC;AA5BD,oEA4BC;AAED,SAAS,mCAAmC,CAAC,KAAwC;IACjF,OAAO,CACH,oBAAC,qBAAS;QACN,oBAAC,4BAA4B,eAAK,KAAK,EAAI,CACnC,CACf,CAAC;AACN,CAAC;AAED,kBAAe,mCAAmC,CAAC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/submitNewPassword.d.ts b/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/submitNewPassword.d.ts
index 22de9e2e9..54f6a613f 100644
--- a/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/submitNewPassword.d.ts
+++ b/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/submitNewPassword.d.ts
@@ -1,12 +1,4 @@
-///
-import { PureComponent } from "react";
-import { SubmitNewPasswordThemeProps, SubmitNewPasswordThemeState } from "../../../types";
-export default class SubmitNewPasswordTheme extends PureComponent {
- static contextType: import("react").Context<{
- [x: string]: import("@emotion/serialize").CSSObject;
- palette: import("../../../../../types").NormalisedPalette;
- }>;
- constructor(props: SubmitNewPasswordThemeProps);
- onSuccess: () => void;
- render(): JSX.Element;
-}
+/** @jsx jsx */
+import { jsx } from "@emotion/react";
+import { SubmitNewPasswordProps } from "../../../types";
+export declare const SubmitNewPassword: (props: SubmitNewPasswordProps) => jsx.JSX.Element;
diff --git a/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/submitNewPassword.js b/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/submitNewPassword.js
index 6bd47bd88..2f23297dc 100644
--- a/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/submitNewPassword.js
+++ b/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/submitNewPassword.js
@@ -36,6 +36,134 @@ var __extends =
d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
};
})();
+var __awaiter =
+ (this && this.__awaiter) ||
+ function (thisArg, _arguments, P, generator) {
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) {
+ try {
+ step(generator.next(value));
+ } catch (e) {
+ reject(e);
+ }
+ }
+ function rejected(value) {
+ try {
+ step(generator["throw"](value));
+ } catch (e) {
+ reject(e);
+ }
+ }
+ function step(result) {
+ result.done
+ ? resolve(result.value)
+ : new P(function (resolve) {
+ resolve(result.value);
+ }).then(fulfilled, rejected);
+ }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+ };
+var __generator =
+ (this && this.__generator) ||
+ function (thisArg, body) {
+ var _ = {
+ label: 0,
+ sent: function () {
+ if (t[0] & 1) throw t[1];
+ return t[1];
+ },
+ trys: [],
+ ops: [],
+ },
+ f,
+ y,
+ t,
+ g;
+ return (
+ (g = { next: verb(0), throw: verb(1), return: verb(2) }),
+ typeof Symbol === "function" &&
+ (g[Symbol.iterator] = function () {
+ return this;
+ }),
+ g
+ );
+ function verb(n) {
+ return function (v) {
+ return step([n, v]);
+ };
+ }
+ function step(op) {
+ if (f) throw new TypeError("Generator is already executing.");
+ while (_)
+ try {
+ if (
+ ((f = 1),
+ y &&
+ (t =
+ op[0] & 2
+ ? y["return"]
+ : op[0]
+ ? y["throw"] || ((t = y["return"]) && t.call(y), 0)
+ : y.next) &&
+ !(t = t.call(y, op[1])).done)
+ )
+ return t;
+ if (((y = 0), t)) op = [op[0] & 2, t.value];
+ switch (op[0]) {
+ case 0:
+ case 1:
+ t = op;
+ break;
+ case 4:
+ _.label++;
+ return { value: op[1], done: false };
+ case 5:
+ _.label++;
+ y = op[1];
+ op = [0];
+ continue;
+ case 7:
+ op = _.ops.pop();
+ _.trys.pop();
+ continue;
+ default:
+ if (
+ !((t = _.trys), (t = t.length > 0 && t[t.length - 1])) &&
+ (op[0] === 6 || op[0] === 2)
+ ) {
+ _ = 0;
+ continue;
+ }
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
+ _.label = op[1];
+ break;
+ }
+ if (op[0] === 6 && _.label < t[1]) {
+ _.label = t[1];
+ t = op;
+ break;
+ }
+ if (t && _.label < t[2]) {
+ _.label = t[2];
+ _.ops.push(op);
+ break;
+ }
+ if (t[2]) _.ops.pop();
+ _.trys.pop();
+ continue;
+ }
+ op = body.call(thisArg, _);
+ } catch (e) {
+ op = [6, e];
+ y = 0;
+ } finally {
+ f = t = 0;
+ }
+ if (op[0] & 5) throw op[1];
+ return { value: op[0] ? op[1] : void 0, done: true };
+ }
+ };
var __importDefault =
(this && this.__importDefault) ||
function (mod) {
@@ -51,15 +179,13 @@ var react_2 = require("react");
var styleContext_1 = __importDefault(require("../../../../../styles/styleContext"));
var library_1 = require("../../library");
var formBase_1 = __importDefault(require("../../library/formBase"));
-/*
- * Component.
- */
-var SubmitNewPasswordTheme = /** @class */ (function (_super) {
- __extends(SubmitNewPasswordTheme, _super);
+var withOverride_1 = require("../../../../../components/componentOverride/withOverride");
+var EmailPasswordSubmitNewPassword = /** @class */ (function (_super) {
+ __extends(EmailPasswordSubmitNewPassword, _super);
/*
* Constructor.
*/
- function SubmitNewPasswordTheme(props) {
+ function EmailPasswordSubmitNewPassword(props) {
var _this = _super.call(this, props) || this;
_this.onSuccess = function () {
_this.setState(function () {
@@ -67,7 +193,6 @@ var SubmitNewPasswordTheme = /** @class */ (function (_super) {
status: "SUCCESS",
};
});
- _this.props.onSuccess();
};
_this.state = {
status: "READY",
@@ -77,10 +202,10 @@ var SubmitNewPasswordTheme = /** @class */ (function (_super) {
/*
* Render.
*/
- SubmitNewPasswordTheme.prototype.render = function () {
+ EmailPasswordSubmitNewPassword.prototype.render = function () {
+ var _this = this;
var styles = this.context;
var _a = this.props,
- submitNewPasswordAPI = _a.submitNewPasswordAPI,
formFields = _a.formFields,
onSignInClicked = _a.onSignInClicked;
var status = this.state.status;
@@ -129,7 +254,43 @@ var SubmitNewPasswordTheme = /** @class */ (function (_super) {
buttonLabel: "Change password",
onSuccess: this.onSuccess,
validateOnBlur: true,
- callAPI: submitNewPasswordAPI,
+ callAPI: function (fields) {
+ return __awaiter(_this, void 0, void 0, function () {
+ var response;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ return [
+ 4 /*yield*/,
+ this.props.recipeImplementation.submitNewPassword({
+ formFields: fields,
+ token: this.props.token,
+ config: this.props.config,
+ }),
+ ];
+ case 1:
+ response = _a.sent();
+ if (response.status === "RESET_PASSWORD_INVALID_TOKEN_ERROR") {
+ return [
+ 2 /*return*/,
+ {
+ status: "GENERAL_ERROR",
+ message: "Invalid password reset token",
+ },
+ ];
+ }
+ return [
+ 2 /*return*/,
+ response.status === "FIELD_ERROR"
+ ? response
+ : {
+ status: "OK",
+ },
+ ];
+ }
+ });
+ });
+ },
showLabels: true,
header: react_1.jsx(
react_2.Fragment,
@@ -153,8 +314,11 @@ var SubmitNewPasswordTheme = /** @class */ (function (_super) {
)
);
};
- SubmitNewPasswordTheme.contextType = styleContext_1.default;
- return SubmitNewPasswordTheme;
+ EmailPasswordSubmitNewPassword.contextType = styleContext_1.default;
+ return EmailPasswordSubmitNewPassword;
})(react_2.PureComponent);
-exports.default = SubmitNewPasswordTheme;
+exports.SubmitNewPassword = withOverride_1.withOverride(
+ "EmailPasswordSubmitNewPassword",
+ EmailPasswordSubmitNewPassword
+);
//# sourceMappingURL=submitNewPassword.js.map
diff --git a/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/submitNewPassword.js.map b/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/submitNewPassword.js.map
index daa9c2957..bf9887e07 100644
--- a/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/submitNewPassword.js.map
+++ b/lib/build/recipe/emailpassword/components/themes/resetPasswordUsingToken/submitNewPassword.js.map
@@ -1 +1 @@
-{"version":3,"file":"submitNewPassword.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/themes/resetPasswordUsingToken/submitNewPassword.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH,eAAe;AACf,wCAAqC;AACrC,+BAAgD;AAChD,oFAA8D;AAG9D,yCAAgD;AAChD,oEAA8C;AAE9C;;GAEG;AAEH;IAAoD,0CAGnD;IAGG;;OAEG;IACH,gCAAY,KAAkC;QAA9C,YACI,kBAAM,KAAK,CAAC,SAIf;QAED,eAAS,GAAG;YACR,KAAI,CAAC,QAAQ,CAAC,cAAM,OAAA,CAAC;gBACjB,MAAM,EAAE,SAAS;aACpB,CAAC,EAFkB,CAElB,CAAC,CAAC;YACJ,KAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;QA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,WAAW,2BAErD;wBACN,yCAAsB,gBAAgB,EAAC,GAAG,EAAE,MAAM,CAAC,cAAc;4BAC7D,yCAAsB,eAAe,EAAC,GAAG,EAAE,MAAM,CAAC,aAAa,yDAEzD,CACJ,CACC,GAEjB,CACA,CACJ,CACT,CAAC;IACN,CAAC;IAlFM,kCAAW,GAAG,sBAAY,CAAC;IAmFtC,6BAAC;CAAA,AAvFD,CAAoD,qBAAa,GAuFhE;kBAvFoB,sBAAsB"}
\ No newline at end of file
+{"version":3,"file":"submitNewPassword.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/themes/resetPasswordUsingToken/submitNewPassword.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH,eAAe;AACf,wCAAqC;AACrC,+BAAgD;AAChD,oFAA8D;AAG9D,yCAAgD;AAChD,oEAA8C;AAC9C,yFAAwF;AAExF;IAA6C,kDAA6D;IAGtG;;OAEG;IACH,wCAAY,KAA6B;QAAzC,YACI,kBAAM,KAAK,CAAC,SAIf;QAED,eAAS,GAAG;YACR,KAAI,CAAC,QAAQ,CAAC,cAAM,OAAA,CAAC;gBACjB,MAAM,EAAE,SAAS;aACpB,CAAC,EAFkB,CAElB,CAAC,CAAC;QACR,CAAC,CAAC;QATE,KAAI,CAAC,KAAK,GAAG;YACT,MAAM,EAAE,OAAO;SAClB,CAAC;;IACN,CAAC;IAQD;;OAEG;IAEH,+CAAM,GAAN;QAAA,iBA4EC;QA3EG,IAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;QACtB,IAAA,eAA4C,EAA1C,0BAAU,EAAE,oCAA8B,CAAC;QAC3C,IAAA,0BAAM,CAAgB;QAE9B,IAAI,MAAM,KAAK,SAAS,EAAE;YACtB,OAAO,CACH,yCAAsB,WAAW,EAAC,GAAG,EAAE,MAAM,CAAC,SAAS;gBACnD,yCAAs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,IAAI;6CACf,EAAC;;;yBACX,EACD,UAAU,EAAE,IAAI,EAChB,MAAM,EACF,YAAC,gBAAQ;wBACL,yCAAsB,aAAa,EAAC,GAAG,EAAE,MAAM,CAAC,WAAW,2BAErD;wBACN,yCAAsB,gBAAgB,EAAC,GAAG,EAAE,MAAM,CAAC,cAAc;4BAC7D,yCAAsB,eAAe,EAAC,GAAG,EAAE,MAAM,CAAC,aAAa,yDAEzD,CACJ,CACC,GAEjB,CACA,CACJ,CACT,CAAC;IACN,CAAC;IAlGM,0CAAW,GAAG,sBAAY,CAAC;IAmGtC,qCAAC;CAAA,AApGD,CAA6C,qBAAa,GAoGzD;AAEY,QAAA,iBAAiB,GAAG,2BAAY,CAAC,gCAAgC,EAAE,8BAA8B,CAAC,CAAC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailpassword/components/themes/signInAndUp/index.js b/lib/build/recipe/emailpassword/components/themes/signInAndUp/index.js
index ecbb939a6..343ebd266 100644
--- a/lib/build/recipe/emailpassword/components/themes/signInAndUp/index.js
+++ b/lib/build/recipe/emailpassword/components/themes/signInAndUp/index.js
@@ -59,18 +59,13 @@ var __importStar =
result["default"] = mod;
return result;
};
-var __importDefault =
- (this && this.__importDefault) ||
- function (mod) {
- return mod && mod.__esModule ? mod : { default: mod };
- };
Object.defineProperty(exports, "__esModule", { value: true });
/*
* Imports.
*/
var React = __importStar(require("react"));
-var signUp_1 = __importDefault(require("./signUp"));
-var signIn_1 = __importDefault(require("./signIn"));
+var signUp_1 = require("./signUp");
+var signIn_1 = require("./signIn");
var themeBase_1 = require("../themeBase");
var styleContext_1 = require("../../../../../styles/styleContext");
var styles_1 = require("../../../../../styles/styles");
@@ -85,7 +80,7 @@ var SignInAndUpTheme = /** @class */ (function (_super) {
var _this = _super.call(this, props) || this;
var urlParams = new URLSearchParams(utils_1.getWindowOrThrow().location.search);
var show = urlParams.get("show");
- var isSignUp = props.defaultToSignUp;
+ var isSignUp = props.config.signInAndUpFeature.defaultToSignUp;
if (show !== null) {
isSignUp = show === "signup";
}
@@ -101,13 +96,13 @@ var SignInAndUpTheme = /** @class */ (function (_super) {
return React.createElement(
styleContext_1.StyleProvider,
{
- rawPalette: this.props.rawPalette,
+ rawPalette: this.props.config.palette,
defaultPalette: styles_1.defaultPalette,
styleFromInit: this.props.signUpForm.styleFromInit,
getDefaultStyles: styles_2.getStyles,
},
React.createElement(
- signUp_1.default,
+ signUp_1.SignUp,
__assign({}, this.props.signUpForm, {
signInClicked: function () {
_this.setState(function (oldState) {
@@ -122,13 +117,13 @@ var SignInAndUpTheme = /** @class */ (function (_super) {
return React.createElement(
styleContext_1.StyleProvider,
{
- rawPalette: this.props.rawPalette,
+ rawPalette: this.props.config.palette,
defaultPalette: styles_1.defaultPalette,
styleFromInit: this.props.signInForm.styleFromInit,
getDefaultStyles: styles_2.getStyles,
},
React.createElement(
- signIn_1.default,
+ signIn_1.SignIn,
__assign({}, this.props.signInForm, {
signUpClicked: function () {
_this.setState(function (oldState) {
diff --git a/lib/build/recipe/emailpassword/components/themes/signInAndUp/index.js.map b/lib/build/recipe/emailpassword/components/themes/signInAndUp/index.js.map
index 17ac8f614..f105b0a2d 100644
--- a/lib/build/recipe/emailpassword/components/themes/signInAndUp/index.js.map
+++ b/lib/build/recipe/emailpassword/components/themes/signInAndUp/index.js.map
@@ -1 +1 @@
-{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/themes/signInAndUp/index.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH,2CAA+B;AAG/B,oDAA8B;AAC9B,oDAA8B;AAC9B,0CAAyC;AACzC,mEAAmE;AACnE,uDAA8D;AAC9D,2CAA6C;AAC7C,8CAAwD;AAExD;;GAEG;AACH;IAAsC,oCAKrC;IACG,0BAAY,KAA4B;QAAxC,YACI,kBAAM,KAAK,CAAC,SAYf;QAVG,IAAM,SAAS,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AAE,IAAI,IAChB;oBACN,CAAC,CAAC,CAAC;gBACP,CAAC,IACH,CACU,CACnB,CAAC;IACN,CAAC;IACL,uBAAC;AAAD,CAAC,AAlED,CAAsC,KAAK,CAAC,aAAa,GAkExD;AAlEY,4CAAgB;AAoE7B,SAAS,uBAAuB,CAAC,KAA4B;IACzD,OAAO,CACH,oBAAC,qBAAS;QACN,oBAAC,gBAAgB,eAAK,KAAK,EAAI,CACvB,CACf,CAAC;AACN,CAAC;AAED,kBAAe,uBAAuB,CAAC"}
\ No newline at end of file
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/themes/signInAndUp/index.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH,2CAA+B;AAG/B,mCAAkC;AAClC,mCAAkC;AAClC,0CAAyC;AACzC,mEAAmE;AACnE,uDAA8D;AAC9D,2CAA6C;AAC7C,8CAAwD;AAExD;;GAEG;AACH;IAAsC,oCAKrC;IACG,0BAAY,KAA4B;QAAxC,YACI,kBAAM,KAAK,CAAC,SAYf;QAVG,IAAM,SAAS,GAAG,IAAI,eAAe,CAAC,wBAAgB,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC1E,IAAM,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACnC,IAAI,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,eAAe,CAAC;QAC/D,IAAI,IAAI,KAAK,IAAI,EAAE;YACf,QAAQ,GAAG,IAAI,KAAK,QAAQ,CAAC;SAChC;QAED,KAAI,CAAC,KAAK,GAAG;YACT,QAAQ,UAAA;SACX,CAAC;;IACN,CAAC;IAED,iCAAM,GAAN;QAAA,iBA4CC;QA3CG,8BAA8B;QAC9B,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;YACrB,OAAO,CACH,oBAAC,4BAAa,IACV,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EACrC,cAAc,EAAE,uBAAc,EAC9B,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,EAClD,gBAAgB,EAAE,kBAAS;gBAC3B,oBAAC,eAAM,eACC,IAAI,CAAC,KAAK,CAAC,UAAU,IACzB,aAAa,EAAE;wBACX,KAAI,CAAC,QAAQ,CAAC,UAAC,QAAQ;4BACnB,oBACO,QAAQ,IACX,QAAQ,EAAE,KAAK,IACjB;wBACN,CAAC,CAAC,CAAC;oBACP,CAAC,IACH,CACU,CACnB,CAAC;SACL;QAED,4BAA4B;QAC5B,OAAO,CACH,oBAAC,4BAAa,IACV,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EACrC,cAAc,EAAE,uBAAc,EAC9B,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,EAClD,gBAAgB,EAAE,kBAAS;YAC3B,oBAAC,eAAM,eACC,IAAI,CAAC,KAAK,CAAC,UAAU,IACzB,aAAa,EAAE;oBACX,KAAI,CAAC,QAAQ,CAAC,UAAC,QAAQ;wBACnB,oBACO,QAAQ,IACX,QAAQ,EAAE,IAAI,IAChB;oBACN,CAAC,CAAC,CAAC;gBACP,CAAC,IACH,CACU,CACnB,CAAC;IACN,CAAC;IACL,uBAAC;AAAD,CAAC,AAlED,CAAsC,KAAK,CAAC,aAAa,GAkExD;AAlEY,4CAAgB;AAoE7B,SAAS,uBAAuB,CAAC,KAA4B;IACzD,OAAO,CACH,oBAAC,qBAAS;QACN,oBAAC,gBAAgB,eAAK,KAAK,EAAI,CACvB,CACf,CAAC;AACN,CAAC;AAED,kBAAe,uBAAuB,CAAC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signIn.d.ts b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signIn.d.ts
index 69e058745..6e10f5990 100644
--- a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signIn.d.ts
+++ b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signIn.d.ts
@@ -1,10 +1,4 @@
-///
-import { PureComponent } from "react";
+/** @jsx jsx */
+import { jsx } from "@emotion/react";
import { SignInThemeProps } from "../../../types";
-export default class SignIn extends PureComponent {
- static contextType: import("react").Context<{
- [x: string]: import("@emotion/serialize").CSSObject;
- palette: import("../../../../../types").NormalisedPalette;
- }>;
- render(): JSX.Element;
-}
+export declare const SignIn: (props: SignInThemeProps) => jsx.JSX.Element;
diff --git a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signIn.js b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signIn.js
index 14e4a86c2..28836b65d 100644
--- a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signIn.js
+++ b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signIn.js
@@ -13,29 +13,6 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
-var __extends =
- (this && this.__extends) ||
- (function () {
- var extendStatics = function (d, b) {
- extendStatics =
- Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array &&
- function (d, b) {
- d.__proto__ = b;
- }) ||
- function (d, b) {
- for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
- };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
- };
- })();
var __assign =
(this && this.__assign) ||
function () {
@@ -63,40 +40,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = require("@emotion/react");
var react_2 = require("react");
var styleContext_1 = __importDefault(require("../../../../../styles/styleContext"));
-var signInFooter_1 = __importDefault(require("./signInFooter"));
-var signInForm_1 = __importDefault(require("./signInForm"));
-var signInHeader_1 = __importDefault(require("./signInHeader"));
-/*
- * Component.
- */
-var SignIn = /** @class */ (function (_super) {
- __extends(SignIn, _super);
- function SignIn() {
- return (_super !== null && _super.apply(this, arguments)) || this;
- }
- /*
- * Render.
- */
- SignIn.prototype.render = function () {
- var styles = this.context;
- return react_1.jsx(
+var signInFooter_1 = require("./signInFooter");
+var signInForm_1 = require("./signInForm");
+var signInHeader_1 = require("./signInHeader");
+var withOverride_1 = require("../../../../../components/componentOverride/withOverride");
+exports.SignIn = withOverride_1.withOverride("EmailPasswordSignIn", function EmailPasswordSignIn(props) {
+ var styles = react_2.useContext(styleContext_1.default);
+ return react_1.jsx(
+ "div",
+ { "data-supertokens": "container", css: styles.container },
+ react_1.jsx(
"div",
- { "data-supertokens": "container", css: styles.container },
+ { "data-supertokens": "row", css: styles.row },
react_1.jsx(
- "div",
- { "data-supertokens": "row", css: styles.row },
- react_1.jsx(
- signInForm_1.default,
- __assign({}, this.props, {
- header: react_1.jsx(signInHeader_1.default, { onClick: this.props.signUpClicked }),
- footer: react_1.jsx(signInFooter_1.default, { onClick: this.props.forgotPasswordClick }),
- })
- )
+ signInForm_1.SignInForm,
+ __assign({}, props, {
+ header: react_1.jsx(signInHeader_1.SignInHeader, { onClick: props.signUpClicked }),
+ footer: react_1.jsx(signInFooter_1.SignInFooter, { onClick: props.forgotPasswordClick }),
+ })
)
- );
- };
- SignIn.contextType = styleContext_1.default;
- return SignIn;
-})(react_2.PureComponent);
-exports.default = SignIn;
+ )
+ );
+});
//# sourceMappingURL=signIn.js.map
diff --git a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signIn.js.map b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signIn.js.map
index 070b95991..9ccc7ba97 100644
--- a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signIn.js.map
+++ b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signIn.js.map
@@ -1 +1 @@
-{"version":3,"file":"signIn.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/themes/signInAndUp/signIn.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH,eAAe;AACf,wCAAqC;AACrC,+BAAsC;AACtC,oFAA8D;AAI9D,gEAA0C;AAC1C,4DAAsC;AACtC,gEAA0C;AAE1C;;GAEG;AAEH;IAAoC,0BAA+B;IAAnE;;IAsBA,CAAC;IAnBG;;OAEG;IAEH,uBAAM,GAAN;QACI,IAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;QAE5B,OAAO,CACH,yCAAsB,WAAW,EAAC,GAAG,EAAE,MAAM,CAAC,SAAS;YACnD,yCAAsB,KAAK,EAAC,GAAG,EAAE,MAAM,CAAC,GAAG;gBACvC,YAAC,oBAAU,eACH,IAAI,CAAC,KAAK,IACd,MAAM,EAAE,YAAC,sBAAY,IAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa,GAAI,EAC3D,MAAM,EAAE,YAAC,sBAAY,IAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,mBAAmB,GAAI,IACnE,CACA,CACJ,CACT,CAAC;IACN,CAAC;IApBM,kBAAW,GAAG,sBAAY,CAAC;IAqBtC,aAAC;CAAA,AAtBD,CAAoC,qBAAa,GAsBhD;kBAtBoB,MAAM"}
\ No newline at end of file
+{"version":3,"file":"signIn.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/themes/signInAndUp/signIn.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH,eAAe;AACf,wCAAqC;AACrC,+BAAmC;AACnC,oFAA8D;AAI9D,+CAA8C;AAC9C,2CAA0C;AAC1C,+CAA8C;AAC9C,yFAAwF;AAE3E,QAAA,MAAM,GAAG,2BAAY,CAAC,qBAAqB,EAAE,SAAS,mBAAmB,CAAC,KAAuB;IAC1G,IAAM,MAAM,GAAG,kBAAU,CAAC,sBAAY,CAAC,CAAC;IAExC,OAAO,CACH,yCAAsB,WAAW,EAAC,GAAG,EAAE,MAAM,CAAC,SAAS;QACnD,yCAAsB,KAAK,EAAC,GAAG,EAAE,MAAM,CAAC,GAAG;YACvC,YAAC,uBAAU,eACH,KAAK,IACT,MAAM,EAAE,YAAC,2BAAY,IAAC,OAAO,EAAE,KAAK,CAAC,aAAa,GAAI,EACtD,MAAM,EAAE,YAAC,2BAAY,IAAC,OAAO,EAAE,KAAK,CAAC,mBAAmB,GAAI,IAC9D,CACA,CACJ,CACT,CAAC;AACN,CAAC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInFooter.d.ts b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInFooter.d.ts
index d686e0bcc..6221e82c6 100644
--- a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInFooter.d.ts
+++ b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInFooter.d.ts
@@ -1,4 +1,3 @@
-///
-export default function SignInFooter({ onClick }: {
- onClick: (() => void) | undefined;
-}): JSX.Element;
+/** @jsx jsx */
+import { jsx } from "@emotion/react";
+export declare const SignInFooter: (props: { onClick: (() => void) | undefined }) => jsx.JSX.Element;
diff --git a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInFooter.js b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInFooter.js
index ce54423d8..5be82f225 100644
--- a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInFooter.js
+++ b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInFooter.js
@@ -1,4 +1,10 @@
"use strict";
+var __importDefault =
+ (this && this.__importDefault) ||
+ function (mod) {
+ return mod && mod.__esModule ? mod : { default: mod };
+ };
+Object.defineProperty(exports, "__esModule", { value: true });
/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.
*
* This software is licensed under the Apache License, Version 2.0 (the
@@ -13,26 +19,12 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
-var __importDefault =
- (this && this.__importDefault) ||
- function (mod) {
- return mod && mod.__esModule ? mod : { default: mod };
- };
-Object.defineProperty(exports, "__esModule", { value: true });
-/*
- * Imports
- */
/** @jsx jsx */
var react_1 = require("@emotion/react");
var react_2 = require("react");
var styleContext_1 = __importDefault(require("../../../../../styles/styleContext"));
-/*
- * Component
- */
-function SignInFooter(_a) {
- /*
- * Render.
- */
+var withOverride_1 = require("../../../../../components/componentOverride/withOverride");
+exports.SignInFooter = withOverride_1.withOverride("EmailPasswordSignInFooter", function EmailPasswordSignInFooter(_a) {
var onClick = _a.onClick;
var styles = react_2.useContext(styleContext_1.default);
return react_1.jsx(
@@ -44,6 +36,5 @@ function SignInFooter(_a) {
},
"Forgot password?"
);
-}
-exports.default = SignInFooter;
+});
//# sourceMappingURL=signInFooter.js.map
diff --git a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInFooter.js.map b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInFooter.js.map
index c7143cd28..fa8ec414b 100644
--- a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInFooter.js.map
+++ b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInFooter.js.map
@@ -1 +1 @@
-{"version":3,"file":"signInFooter.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/themes/signInAndUp/signInFooter.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;AAEH;;GAEG;AACH,eAAe;AACf,wCAAqC;AACrC,+BAAmC;AACnC,oFAA8D;AAE9D;;GAEG;AACH,SAAwB,YAAY,CAAC,EAAkD;IACnF;;OAEG;QAHgC,oBAAO;IAK1C,IAAM,MAAM,GAAG,kBAAU,CAAC,sBAAY,CAAC,CAAC;IACxC,OAAO,CACH,yCACqB,uCAAuC,EACxD,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,kBAAkB,CAAC,EACnE,OAAO,EAAE,OAAO,uBAEd,CACT,CAAC;AACN,CAAC;AAdD,+BAcC"}
\ No newline at end of file
+{"version":3,"file":"signInFooter.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/themes/signInAndUp/signInFooter.tsx"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;;;;GAaG;AACH,eAAe;AACf,wCAAqC;AACrC,+BAAmC;AACnC,oFAA8D;AAC9D,yFAAwF;AAE3E,QAAA,YAAY,GAAG,2BAAY,CACpC,2BAA2B,EAC3B,SAAS,yBAAyB,CAAC,EAAkD;QAAhD,oBAAO;IACxC,IAAM,MAAM,GAAG,kBAAU,CAAC,sBAAY,CAAC,CAAC;IAExC,OAAO,CACH,yCACqB,uCAAuC,EACxD,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,kBAAkB,CAAC,EACnE,OAAO,EAAE,OAAO,uBAEd,CACT,CAAC;AACN,CAAC,CACJ,CAAC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInForm.d.ts b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInForm.d.ts
index e287e42ee..4f0f3245d 100644
--- a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInForm.d.ts
+++ b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInForm.d.ts
@@ -1,6 +1,17 @@
///
-import { SignInThemeProps } from "../../../types";
-export default function SignInForm(props: SignInThemeProps & {
- header?: JSX.Element;
- footer?: JSX.Element;
-}): JSX.Element;
+/** @jsx jsx */
+import { jsx } from "@emotion/react";
+export declare const SignInForm: (
+ props: import("../../../../../types").ThemeBaseProps & {
+ formFields: import("../../../types").FormFieldThemeProps[];
+ } & {
+ recipeImplementation: import("../../../types").RecipeInterface;
+ config: import("../../../types").NormalisedConfig;
+ signUpClicked?: (() => void) | undefined;
+ forgotPasswordClick: () => void;
+ onSuccess: () => void;
+ } & {
+ header?: JSX.Element | undefined;
+ footer?: JSX.Element | undefined;
+ }
+) => jsx.JSX.Element;
diff --git a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInForm.js b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInForm.js
index 933c4196b..eab2652b4 100644
--- a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInForm.js
+++ b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInForm.js
@@ -13,6 +13,134 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
+var __awaiter =
+ (this && this.__awaiter) ||
+ function (thisArg, _arguments, P, generator) {
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) {
+ try {
+ step(generator.next(value));
+ } catch (e) {
+ reject(e);
+ }
+ }
+ function rejected(value) {
+ try {
+ step(generator["throw"](value));
+ } catch (e) {
+ reject(e);
+ }
+ }
+ function step(result) {
+ result.done
+ ? resolve(result.value)
+ : new P(function (resolve) {
+ resolve(result.value);
+ }).then(fulfilled, rejected);
+ }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+ };
+var __generator =
+ (this && this.__generator) ||
+ function (thisArg, body) {
+ var _ = {
+ label: 0,
+ sent: function () {
+ if (t[0] & 1) throw t[1];
+ return t[1];
+ },
+ trys: [],
+ ops: [],
+ },
+ f,
+ y,
+ t,
+ g;
+ return (
+ (g = { next: verb(0), throw: verb(1), return: verb(2) }),
+ typeof Symbol === "function" &&
+ (g[Symbol.iterator] = function () {
+ return this;
+ }),
+ g
+ );
+ function verb(n) {
+ return function (v) {
+ return step([n, v]);
+ };
+ }
+ function step(op) {
+ if (f) throw new TypeError("Generator is already executing.");
+ while (_)
+ try {
+ if (
+ ((f = 1),
+ y &&
+ (t =
+ op[0] & 2
+ ? y["return"]
+ : op[0]
+ ? y["throw"] || ((t = y["return"]) && t.call(y), 0)
+ : y.next) &&
+ !(t = t.call(y, op[1])).done)
+ )
+ return t;
+ if (((y = 0), t)) op = [op[0] & 2, t.value];
+ switch (op[0]) {
+ case 0:
+ case 1:
+ t = op;
+ break;
+ case 4:
+ _.label++;
+ return { value: op[1], done: false };
+ case 5:
+ _.label++;
+ y = op[1];
+ op = [0];
+ continue;
+ case 7:
+ op = _.ops.pop();
+ _.trys.pop();
+ continue;
+ default:
+ if (
+ !((t = _.trys), (t = t.length > 0 && t[t.length - 1])) &&
+ (op[0] === 6 || op[0] === 2)
+ ) {
+ _ = 0;
+ continue;
+ }
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
+ _.label = op[1];
+ break;
+ }
+ if (op[0] === 6 && _.label < t[1]) {
+ _.label = t[1];
+ t = op;
+ break;
+ }
+ if (t && _.label < t[2]) {
+ _.label = t[2];
+ _.ops.push(op);
+ break;
+ }
+ if (t[2]) _.ops.pop();
+ _.trys.pop();
+ continue;
+ }
+ op = body.call(thisArg, _);
+ } catch (e) {
+ op = [6, e];
+ y = 0;
+ } finally {
+ f = t = 0;
+ }
+ if (op[0] & 5) throw op[1];
+ return { value: op[0] ? op[1] : void 0, done: true };
+ }
+ };
var __importDefault =
(this && this.__importDefault) ||
function (mod) {
@@ -25,20 +153,51 @@ Object.defineProperty(exports, "__esModule", { value: true });
/** @jsx jsx */
var react_1 = require("@emotion/react");
var formBase_1 = __importDefault(require("../../library/formBase"));
+var withOverride_1 = require("../../../../../components/componentOverride/withOverride");
/*
* Component.
*/
-function SignInForm(props) {
+exports.SignInForm = withOverride_1.withOverride("EmailPasswordSignInForm", function EmailPasswordSignInForm(props) {
+ var _this = this;
return react_1.jsx(formBase_1.default, {
formFields: props.formFields,
buttonLabel: "SIGN IN",
onSuccess: props.onSuccess,
- callAPI: props.signInAPI,
+ callAPI: function (formFields) {
+ return __awaiter(_this, void 0, void 0, function () {
+ var response;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ return [
+ 4 /*yield*/,
+ props.recipeImplementation.signIn({
+ formFields: formFields,
+ config: props.config,
+ }),
+ ];
+ case 1:
+ response = _a.sent();
+ if (response.status === "WRONG_CREDENTIALS_ERROR") {
+ return [
+ 2 /*return*/,
+ {
+ status: "GENERAL_ERROR",
+ message: "Incorrect email and password combination",
+ },
+ ];
+ } else {
+ return [2 /*return*/, response];
+ }
+ return [2 /*return*/];
+ }
+ });
+ });
+ },
validateOnBlur: false,
showLabels: true,
header: props.header,
footer: props.footer,
});
-}
-exports.default = SignInForm;
+});
//# sourceMappingURL=signInForm.js.map
diff --git a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInForm.js.map b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInForm.js.map
index 395a9fd21..b9537a4ad 100644
--- a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInForm.js.map
+++ b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInForm.js.map
@@ -1 +1 @@
-{"version":3,"file":"signInForm.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/themes/signInAndUp/signInForm.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;AAEH;;GAEG;AACH,eAAe;AACf,wCAAqC;AAIrC,oEAA8C;AAE9C;;GAEG;AAEH,SAAwB,UAAU,CAC9B,KAGC;IAED,OAAO,CACH,YAAC,kBAAQ,IACL,UAAU,EAAE,KAAK,CAAC,UAAU,EAC5B,WAAW,EAAE,SAAS,EACtB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,OAAO,EAAE,KAAK,CAAC,SAAS,EACxB,cAAc,EAAE,KAAK,EACrB,UAAU,EAAE,IAAI,EAChB,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,MAAM,EAAE,KAAK,CAAC,MAAM,GACtB,CACL,CAAC;AACN,CAAC;AAlBD,6BAkBC"}
\ No newline at end of file
+{"version":3,"file":"signInForm.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/themes/signInAndUp/signInForm.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH,eAAe;AACf,wCAAqC;AAIrC,oEAA8C;AAC9C,yFAAwF;AAExF;;GAEG;AAEU,QAAA,UAAU,GAAG,2BAAY,CAClC,yBAAyB,EACzB,SAAS,uBAAuB,CAC5B,KAGC;IAJL,iBA+BC;IAzBG,OAAO,CACH,YAAC,kBAAQ,IACL,UAAU,EAAE,KAAK,CAAC,UAAU,EAC5B,WAAW,EAAE,SAAS,EACtB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,OAAO,EAAE,UAAO,UAAU;;;;4BACL,qBAAM,KAAK,CAAC,oBAAoB,CAAC,MAAM,CAAC;4BACrD,UAAU,YAAA;4BACV,MAAM,EAAE,KAAK,CAAC,MAAM;yBACvB,CAAC,EAAA;;wBAHI,QAAQ,GAAG,SAGf;wBACF,IAAI,QAAQ,CAAC,MAAM,KAAK,yBAAyB,EAAE;4BAC/C,sBAAO;oCACH,MAAM,EAAE,eAAe;oCACvB,OAAO,EAAE,0CAA0C;iCACtD,EAAC;yBACL;6BAAM;4BACH,sBAAO,QAAQ,EAAC;yBACnB;;;;aACJ,EACD,cAAc,EAAE,KAAK,EACrB,UAAU,EAAE,IAAI,EAChB,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,MAAM,EAAE,KAAK,CAAC,MAAM,GACtB,CACL,CAAC;AACN,CAAC,CACJ,CAAC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInHeader.d.ts b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInHeader.d.ts
index 454472260..543642f99 100644
--- a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInHeader.d.ts
+++ b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInHeader.d.ts
@@ -1,4 +1,3 @@
-///
-export default function SignInHeader({ onClick }: {
- onClick: (() => void) | undefined;
-}): JSX.Element;
+/** @jsx jsx */
+import { jsx } from "@emotion/react";
+export declare const SignInHeader: (props: { onClick: (() => void) | undefined }) => jsx.JSX.Element;
diff --git a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInHeader.js b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInHeader.js
index 39098c2a9..2a470202c 100644
--- a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInHeader.js
+++ b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInHeader.js
@@ -1,4 +1,10 @@
"use strict";
+var __importDefault =
+ (this && this.__importDefault) ||
+ function (mod) {
+ return mod && mod.__esModule ? mod : { default: mod };
+ };
+Object.defineProperty(exports, "__esModule", { value: true });
/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.
*
* This software is licensed under the Apache License, Version 2.0 (the
@@ -13,26 +19,12 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
-var __importDefault =
- (this && this.__importDefault) ||
- function (mod) {
- return mod && mod.__esModule ? mod : { default: mod };
- };
-Object.defineProperty(exports, "__esModule", { value: true });
-/*
- * Imports
- */
/** @jsx jsx */
var react_1 = require("@emotion/react");
var react_2 = require("react");
var styleContext_1 = __importDefault(require("../../../../../styles/styleContext"));
-/*
- * Component
- */
-function SignInHeader(_a) {
- /*
- * Render.
- */
+var withOverride_1 = require("../../../../../components/componentOverride/withOverride");
+exports.SignInHeader = withOverride_1.withOverride("EmailPasswordSignInHeader", function EmailPasswordSignInHeader(_a) {
var onClick = _a.onClick;
var styles = react_2.useContext(styleContext_1.default);
return react_1.jsx(
@@ -51,6 +43,5 @@ function SignInHeader(_a) {
),
react_1.jsx("div", { "data-supertokens": "divider", css: styles.divider })
);
-}
-exports.default = SignInHeader;
+});
//# sourceMappingURL=signInHeader.js.map
diff --git a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInHeader.js.map b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInHeader.js.map
index 95da62bec..fefcb8a83 100644
--- a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInHeader.js.map
+++ b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signInHeader.js.map
@@ -1 +1 @@
-{"version":3,"file":"signInHeader.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/themes/signInAndUp/signInHeader.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;AAEH;;GAEG;AACH,eAAe;AACf,wCAAqC;AACrC,+BAA6C;AAC7C,oFAA8D;AAE9D;;GAEG;AACH,SAAwB,YAAY,CAAC,EAAkD;IACnF;;OAEG;QAHgC,oBAAO;IAK1C,IAAM,MAAM,GAAG,kBAAU,CAAC,sBAAY,CAAC,CAAC;IACxC,OAAO,CACH,YAAC,gBAAQ;QACL,yCAAsB,aAAa,EAAC,GAAG,EAAE,MAAM,CAAC,WAAW,cAErD;QACN,yCAAsB,gBAAgB,EAAC,GAAG,EAAE,MAAM,CAAC,cAAc;YAC7D,yCAAsB,eAAe,EAAC,GAAG,EAAE,MAAM,CAAC,aAAa;;gBAE3D,0CAAuB,MAAM,EAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,IAAI,cAEzD,CACL,CACJ;QACN,yCAAsB,SAAS,EAAC,GAAG,EAAE,MAAM,CAAC,OAAO,GAAQ,CACpD,CACd,CAAC;AACN,CAAC;AAtBD,+BAsBC"}
\ No newline at end of file
+{"version":3,"file":"signInHeader.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/themes/signInAndUp/signInHeader.tsx"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;;;;GAaG;AACH,eAAe;AACf,wCAAqC;AACrC,+BAA6C;AAC7C,oFAA8D;AAC9D,yFAAwF;AAE3E,QAAA,YAAY,GAAG,2BAAY,CACpC,2BAA2B,EAC3B,SAAS,yBAAyB,CAAC,EAAkD;QAAhD,oBAAO;IACxC,IAAM,MAAM,GAAG,kBAAU,CAAC,sBAAY,CAAC,CAAC;IAExC,OAAO,CACH,YAAC,gBAAQ;QACL,yCAAsB,aAAa,EAAC,GAAG,EAAE,MAAM,CAAC,WAAW,cAErD;QACN,yCAAsB,gBAAgB,EAAC,GAAG,EAAE,MAAM,CAAC,cAAc;YAC7D,yCAAsB,eAAe,EAAC,GAAG,EAAE,MAAM,CAAC,aAAa;;gBAE3D,0CAAuB,MAAM,EAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,IAAI,cAEzD,CACL,CACJ;QACN,yCAAsB,SAAS,EAAC,GAAG,EAAE,MAAM,CAAC,OAAO,GAAQ,CACpD,CACd,CAAC;AACN,CAAC,CACJ,CAAC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUp.d.ts b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUp.d.ts
index 09a38bd2b..4313bc18a 100644
--- a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUp.d.ts
+++ b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUp.d.ts
@@ -1,10 +1,4 @@
-///
-import { PureComponent } from "react";
+/** @jsx jsx */
+import { jsx } from "@emotion/react";
import { SignUpThemeProps } from "../../../types";
-export default class SignUp extends PureComponent {
- static contextType: import("react").Context<{
- [x: string]: import("@emotion/serialize").CSSObject;
- palette: import("../../../../../types").NormalisedPalette;
- }>;
- render(): JSX.Element;
-}
+export declare const SignUp: (props: SignUpThemeProps) => jsx.JSX.Element;
diff --git a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUp.js b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUp.js
index 2cfdaffa1..bcdcae170 100644
--- a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUp.js
+++ b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUp.js
@@ -1,27 +1,4 @@
"use strict";
-var __extends =
- (this && this.__extends) ||
- (function () {
- var extendStatics = function (d, b) {
- extendStatics =
- Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array &&
- function (d, b) {
- d.__proto__ = b;
- }) ||
- function (d, b) {
- for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
- };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
- };
- })();
var __assign =
(this && this.__assign) ||
function () {
@@ -56,52 +33,33 @@ Object.defineProperty(exports, "__esModule", { value: true });
* License for the specific language governing permissions and limitations
* under the License.
*/
-/*
- * Imports.
- */
/** @jsx jsx */
var react_1 = require("@emotion/react");
var react_2 = require("react");
-var signUpFooter_1 = __importDefault(
- require("../../../../authRecipeModule/components/themes/signInAndUp/signUpFooter")
-);
-var signUpHeader_1 = __importDefault(require("./signUpHeader"));
+var signUpFooter_1 = require("./signUpFooter");
+var signUpHeader_1 = require("./signUpHeader");
var styleContext_1 = __importDefault(require("../../../../../styles/styleContext"));
-var signUpForm_1 = __importDefault(require("./signUpForm"));
-/*
- * Component.
- */
-var SignUp = /** @class */ (function (_super) {
- __extends(SignUp, _super);
- function SignUp() {
- return (_super !== null && _super.apply(this, arguments)) || this;
- }
- /*
- * Render.
- */
- SignUp.prototype.render = function () {
- var styles = this.context;
- return react_1.jsx(
+var signUpForm_1 = require("./signUpForm");
+var withOverride_1 = require("../../../../../components/componentOverride/withOverride");
+exports.SignUp = withOverride_1.withOverride("EmailPasswordSignUp", function EmailPasswordSignUp(props) {
+ var styles = react_2.useContext(styleContext_1.default);
+ return react_1.jsx(
+ "div",
+ { "data-supertokens": "container", css: styles.container },
+ react_1.jsx(
"div",
- { "data-supertokens": "container", css: styles.container },
+ { "data-supertokens": "row", css: styles.row },
react_1.jsx(
- "div",
- { "data-supertokens": "row", css: styles.row },
- react_1.jsx(
- signUpForm_1.default,
- __assign({}, this.props, {
- header: react_1.jsx(signUpHeader_1.default, { onClick: this.props.signInClicked }),
- footer: react_1.jsx(signUpFooter_1.default, {
- privacyPolicyLink: this.props.privacyPolicyLink,
- termsOfServiceLink: this.props.termsOfServiceLink,
- }),
- })
- )
+ signUpForm_1.SignUpForm,
+ __assign({}, props, {
+ header: react_1.jsx(signUpHeader_1.SignUpHeader, { onClick: props.signInClicked }),
+ footer: react_1.jsx(signUpFooter_1.SignUpFooter, {
+ privacyPolicyLink: props.config.signInAndUpFeature.signUpForm.privacyPolicyLink,
+ termsOfServiceLink: props.config.signInAndUpFeature.signUpForm.termsOfServiceLink,
+ }),
+ })
)
- );
- };
- SignUp.contextType = styleContext_1.default;
- return SignUp;
-})(react_2.PureComponent);
-exports.default = SignUp;
+ )
+ );
+});
//# sourceMappingURL=signUp.js.map
diff --git a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUp.js.map b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUp.js.map
index 9104a2912..852b9779a 100644
--- a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUp.js.map
+++ b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUp.js.map
@@ -1 +1 @@
-{"version":3,"file":"signUp.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/themes/signInAndUp/signUp.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;GAaG;AACH;;GAEG;AACH,eAAe;AACf,wCAAqC;AACrC,+BAAsC;AAGtC,yHAAmG;AACnG,gEAA0C;AAC1C,oFAA8D;AAC9D,4DAAsC;AAEtC;;GAEG;AAEH;IAAoC,0BAA+B;IAAnE;;IAyBA,CAAC;IAtBG;;OAEG;IACH,uBAAM,GAAN;QACI,IAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,OAAO,CACH,yCAAsB,WAAW,EAAC,GAAG,EAAE,MAAM,CAAC,SAAS;YACnD,yCAAsB,KAAK,EAAC,GAAG,EAAE,MAAM,CAAC,GAAG;gBACvC,YAAC,oBAAU,eACH,IAAI,CAAC,KAAK,IACd,MAAM,EAAE,YAAC,sBAAY,IAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa,GAAI,EAC3D,MAAM,EACF,YAAC,sBAAY,IACT,iBAAiB,EAAE,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAC/C,kBAAkB,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB,GACnD,IAER,CACA,CACJ,CACT,CAAC;IACN,CAAC;IAvBM,kBAAW,GAAG,sBAAY,CAAC;IAwBtC,aAAC;CAAA,AAzBD,CAAoC,qBAAa,GAyBhD;kBAzBoB,MAAM"}
\ No newline at end of file
+{"version":3,"file":"signUp.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/themes/signInAndUp/signUp.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;GAaG;AACH,eAAe;AACf,wCAAqC;AACrC,+BAAmC;AAGnC,+CAA8C;AAC9C,+CAA8C;AAC9C,oFAA8D;AAC9D,2CAA0C;AAC1C,yFAAwF;AAE3E,QAAA,MAAM,GAAG,2BAAY,CAAC,qBAAqB,EAAE,SAAS,mBAAmB,CAAC,KAAuB;IAC1G,IAAM,MAAM,GAAG,kBAAU,CAAC,sBAAY,CAAC,CAAC;IAExC,OAAO,CACH,yCAAsB,WAAW,EAAC,GAAG,EAAE,MAAM,CAAC,SAAS;QACnD,yCAAsB,KAAK,EAAC,GAAG,EAAE,MAAM,CAAC,GAAG;YACvC,YAAC,uBAAU,eACH,KAAK,IACT,MAAM,EAAE,YAAC,2BAAY,IAAC,OAAO,EAAE,KAAK,CAAC,aAAa,GAAI,EACtD,MAAM,EACF,YAAC,2BAAY,IACT,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,UAAU,CAAC,iBAAiB,EAC/E,kBAAkB,EAAE,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,UAAU,CAAC,kBAAkB,GACnF,IAER,CACA,CACJ,CACT,CAAC;AACN,CAAC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpFooter.d.ts b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpFooter.d.ts
new file mode 100644
index 000000000..7148bd8d3
--- /dev/null
+++ b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpFooter.d.ts
@@ -0,0 +1,6 @@
+/** @jsx jsx */
+import { jsx } from "@emotion/react";
+export declare const SignUpFooter: (props: {
+ privacyPolicyLink?: string | undefined;
+ termsOfServiceLink?: string | undefined;
+}) => jsx.JSX.Element;
diff --git a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpFooter.js b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpFooter.js
new file mode 100644
index 000000000..9ee8e1780
--- /dev/null
+++ b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpFooter.js
@@ -0,0 +1,71 @@
+"use strict";
+/* 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 __importDefault =
+ (this && this.__importDefault) ||
+ function (mod) {
+ return mod && mod.__esModule ? mod : { default: mod };
+ };
+Object.defineProperty(exports, "__esModule", { value: true });
+/*
+ * Imports.
+ */
+/** @jsx jsx */
+var react_1 = require("@emotion/react");
+var react_2 = require("react");
+var styleContext_1 = __importDefault(require("../../../../../styles/styleContext"));
+var withOverride_1 = require("../../../../../components/componentOverride/withOverride");
+exports.SignUpFooter = withOverride_1.withOverride("EmailPasswordSignUpFooter", function EmailPasswordSignUpFooter(_a) {
+ var termsOfServiceLink = _a.termsOfServiceLink,
+ privacyPolicyLink = _a.privacyPolicyLink;
+ var styles = react_2.useContext(styleContext_1.default);
+ if (termsOfServiceLink === undefined && privacyPolicyLink === undefined) {
+ return null;
+ }
+ return react_1.jsx(
+ "div",
+ {
+ "data-supertokens": "secondaryText privacyPolicyAndTermsAndConditions",
+ css: [styles.secondaryText, styles.privacyPolicyAndTermsAndConditions],
+ },
+ "By continuing, you agree to our",
+ termsOfServiceLink !== undefined &&
+ react_1.jsx(
+ "a",
+ {
+ "data-supertokens": "link",
+ css: styles.link,
+ href: termsOfServiceLink,
+ target: "_blank",
+ rel: "noopener noreferer",
+ },
+ "Terms of Service"
+ ),
+ termsOfServiceLink !== undefined && privacyPolicyLink !== undefined && "and",
+ privacyPolicyLink !== undefined &&
+ react_1.jsx(
+ "a",
+ {
+ "data-supertokens": "link",
+ css: styles.link,
+ href: privacyPolicyLink,
+ target: "_blank",
+ rel: "noopener noreferer",
+ },
+ "Privacy Policy"
+ )
+ );
+});
+//# sourceMappingURL=signUpFooter.js.map
diff --git a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpFooter.js.map b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpFooter.js.map
new file mode 100644
index 000000000..d507136a0
--- /dev/null
+++ b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpFooter.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"signUpFooter.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/themes/signInAndUp/signUpFooter.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;AAEH;;GAEG;AACH,eAAe;AACf,wCAAqC;AAErC,+BAAmC;AACnC,oFAA8D;AAC9D,yFAAwF;AAE3E,QAAA,YAAY,GAAG,2BAAY,CACpC,2BAA2B,EAC3B,SAAS,yBAAyB,CAAC,EAMlC;QALG,0CAAkB,EAClB,wCAAiB;IAKjB,IAAM,MAAM,GAAG,kBAAU,CAAC,sBAAY,CAAC,CAAC;IAExC,IAAI,kBAAkB,KAAK,SAAS,IAAI,iBAAiB,KAAK,SAAS,EAAE;QACrE,OAAO,IAAI,CAAC;KACf;IAED,OAAO,CACH,yCACqB,kDAAkD,EACnE,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,kCAAkC,CAAC;;QAErE,kBAAkB,KAAK,SAAS,IAAI,CACjC,uCACqB,MAAM,EACvB,GAAG,EAAE,MAAM,CAAC,IAAI,EAChB,IAAI,EAAE,kBAAkB,EACxB,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,oBAAoB,uBAExB,CACP;QACA,kBAAkB,KAAK,SAAS,IAAI,iBAAiB,KAAK,SAAS,IAAI,KAAK;QAC5E,iBAAiB,KAAK,SAAS,IAAI,CAChC,uCACqB,MAAM,EACvB,GAAG,EAAE,MAAM,CAAC,IAAI,EAChB,IAAI,EAAE,iBAAiB,EACvB,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,oBAAoB,qBAExB,CACP,CACC,CACT,CAAC;AACN,CAAC,CACJ,CAAC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpForm.d.ts b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpForm.d.ts
index 3879835a2..096ce6764 100644
--- a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpForm.d.ts
+++ b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpForm.d.ts
@@ -1,6 +1,16 @@
///
-import { SignUpThemeProps } from "../../../types";
-export default function SignUpForm(props: SignUpThemeProps & {
- header?: JSX.Element;
- footer?: JSX.Element;
-}): JSX.Element;
+/** @jsx jsx */
+import { jsx } from "@emotion/react";
+export declare const SignUpForm: (
+ props: import("../../../../../types").ThemeBaseProps & {
+ formFields: import("../../../types").FormFieldThemeProps[];
+ } & {
+ recipeImplementation: import("../../../types").RecipeInterface;
+ config: import("../../../types").NormalisedConfig;
+ signInClicked?: (() => void) | undefined;
+ onSuccess: () => void;
+ } & {
+ header?: JSX.Element | undefined;
+ footer?: JSX.Element | undefined;
+ }
+) => jsx.JSX.Element;
diff --git a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpForm.js b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpForm.js
index 2b9623036..1eeb7844f 100644
--- a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpForm.js
+++ b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpForm.js
@@ -25,20 +25,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
/** @jsx jsx */
var react_1 = require("@emotion/react");
var formBase_1 = __importDefault(require("../../library/formBase"));
+var withOverride_1 = require("../../../../../components/componentOverride/withOverride");
/*
* Component.
*/
-function SignUpForm(props) {
+exports.SignUpForm = withOverride_1.withOverride("EmailPasswordSignUpForm", function EmailPasswordSignUpForm(props) {
return react_1.jsx(formBase_1.default, {
formFields: props.formFields,
buttonLabel: "SIGN UP",
onSuccess: props.onSuccess,
- callAPI: props.signUpAPI,
+ callAPI: function (formFields) {
+ return props.recipeImplementation.signUp({
+ formFields: formFields,
+ config: props.config,
+ });
+ },
validateOnBlur: true,
showLabels: true,
header: props.header,
footer: props.footer,
});
-}
-exports.default = SignUpForm;
+});
//# sourceMappingURL=signUpForm.js.map
diff --git a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpForm.js.map b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpForm.js.map
index aa9a90d55..b08049340 100644
--- a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpForm.js.map
+++ b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpForm.js.map
@@ -1 +1 @@
-{"version":3,"file":"signUpForm.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/themes/signInAndUp/signUpForm.tsx"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;;;;GAaG;AACH;;GAEG;AACH,eAAe;AACf,wCAAqC;AAGrC,oEAA8C;AAE9C;;GAEG;AAEH,SAAwB,UAAU,CAC9B,KAGC;IAED,OAAO,CACH,YAAC,kBAAQ,IACL,UAAU,EAAE,KAAK,CAAC,UAAU,EAC5B,WAAW,EAAE,SAAS,EACtB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,OAAO,EAAE,KAAK,CAAC,SAAS,EACxB,cAAc,EAAE,IAAI,EACpB,UAAU,EAAE,IAAI,EAChB,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,MAAM,EAAE,KAAK,CAAC,MAAM,GACtB,CACL,CAAC;AACN,CAAC;AAlBD,6BAkBC"}
\ No newline at end of file
+{"version":3,"file":"signUpForm.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/themes/signInAndUp/signUpForm.tsx"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;;;;GAaG;AACH;;GAEG;AACH,eAAe;AACf,wCAAqC;AAGrC,oEAA8C;AAC9C,yFAAwF;AAExF;;GAEG;AAEU,QAAA,UAAU,GAAG,2BAAY,CAClC,yBAAyB,EACzB,SAAS,uBAAuB,CAC5B,KAGC;IAED,OAAO,CACH,YAAC,kBAAQ,IACL,UAAU,EAAE,KAAK,CAAC,UAAU,EAC5B,WAAW,EAAE,SAAS,EACtB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,OAAO,EAAE,UAAC,UAAU;YAChB,OAAA,KAAK,CAAC,oBAAoB,CAAC,MAAM,CAAC;gBAC9B,UAAU,YAAA;gBACV,MAAM,EAAE,KAAK,CAAC,MAAM;aACvB,CAAC;QAHF,CAGE,EAEN,cAAc,EAAE,IAAI,EACpB,UAAU,EAAE,IAAI,EAChB,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,MAAM,EAAE,KAAK,CAAC,MAAM,GACtB,CACL,CAAC;AACN,CAAC,CACJ,CAAC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpHeader.d.ts b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpHeader.d.ts
index 22345719e..4c53beb04 100644
--- a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpHeader.d.ts
+++ b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpHeader.d.ts
@@ -1,4 +1,3 @@
-///
-export default function SignUpHeader({ onClick }: {
- onClick: (() => void) | undefined;
-}): JSX.Element;
+/** @jsx jsx */
+import { jsx } from "@emotion/react";
+export declare const SignUpHeader: (props: { onClick: (() => void) | undefined }) => jsx.JSX.Element;
diff --git a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpHeader.js b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpHeader.js
index 00c38c3d5..576c31a9f 100644
--- a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpHeader.js
+++ b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpHeader.js
@@ -26,10 +26,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = require("@emotion/react");
var react_2 = require("react");
var styleContext_1 = __importDefault(require("../../../../../styles/styleContext"));
+var withOverride_1 = require("../../../../../components/componentOverride/withOverride");
/*
* Component
*/
-function SignUpHeader(_a) {
+exports.SignUpHeader = withOverride_1.withOverride("EmailPasswordSignUpHeader", function EmailPasswordSignUpHeader(_a) {
/*
* Render.
*/
@@ -51,6 +52,5 @@ function SignUpHeader(_a) {
),
react_1.jsx("div", { "data-supertokens": "divider", css: styles.divider })
);
-}
-exports.default = SignUpHeader;
+});
//# sourceMappingURL=signUpHeader.js.map
diff --git a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpHeader.js.map b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpHeader.js.map
index 0837b6116..14cf2f282 100644
--- a/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpHeader.js.map
+++ b/lib/build/recipe/emailpassword/components/themes/signInAndUp/signUpHeader.js.map
@@ -1 +1 @@
-{"version":3,"file":"signUpHeader.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/themes/signInAndUp/signUpHeader.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;AAEH;;GAEG;AACH,eAAe;AACf,wCAAqC;AACrC,+BAA6C;AAC7C,oFAA8D;AAE9D;;GAEG;AACH,SAAwB,YAAY,CAAC,EAAkD;IACnF;;OAEG;QAHgC,oBAAO;IAK1C,IAAM,MAAM,GAAG,kBAAU,CAAC,sBAAY,CAAC,CAAC;IACxC,OAAO,CACH,YAAC,gBAAQ;QACL,yCAAsB,aAAa,EAAC,GAAG,EAAE,MAAM,CAAC,WAAW,cAErD;QACN,yCAAsB,gBAAgB,EAAC,GAAG,EAAE,MAAM,CAAC,cAAc;YAC7D,yCAAsB,eAAe,EAAC,GAAG,EAAE,MAAM,CAAC,aAAa;;gBAE3D,0CAAuB,MAAM,EAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,IAAI,cAEzD,CACL,CACJ;QACN,yCAAsB,SAAS,EAAC,GAAG,EAAE,MAAM,CAAC,OAAO,GAAQ,CACpD,CACd,CAAC;AACN,CAAC;AAtBD,+BAsBC"}
\ No newline at end of file
+{"version":3,"file":"signUpHeader.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailpassword/components/themes/signInAndUp/signUpHeader.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;AAEH;;GAEG;AACH,eAAe;AACf,wCAAqC;AACrC,+BAA6C;AAC7C,oFAA8D;AAC9D,yFAAwF;AAExF;;GAEG;AACU,QAAA,YAAY,GAAG,2BAAY,CACpC,2BAA2B,EAC3B,SAAS,yBAAyB,CAAC,EAAkD;IACjF;;OAEG;QAH8B,oBAAO;IAKxC,IAAM,MAAM,GAAG,kBAAU,CAAC,sBAAY,CAAC,CAAC;IACxC,OAAO,CACH,YAAC,gBAAQ;QACL,yCAAsB,aAAa,EAAC,GAAG,EAAE,MAAM,CAAC,WAAW,cAErD;QACN,yCAAsB,gBAAgB,EAAC,GAAG,EAAE,MAAM,CAAC,cAAc;YAC7D,yCAAsB,eAAe,EAAC,GAAG,EAAE,MAAM,CAAC,aAAa;;gBAE3D,0CAAuB,MAAM,EAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,IAAI,cAEzD,CACL,CACJ;QACN,yCAAsB,SAAS,EAAC,GAAG,EAAE,MAAM,CAAC,OAAO,GAAQ,CACpD,CACd,CAAC;AACN,CAAC,CACJ,CAAC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailpassword/emailPassword.d.ts b/lib/build/recipe/emailpassword/emailPassword.d.ts
deleted file mode 100644
index bf7868261..000000000
--- a/lib/build/recipe/emailpassword/emailPassword.d.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import AuthRecipeModule from "../authRecipeModule";
-import { CreateRecipeFunction, SuccessAPIResponse } from "../../types";
-import { EmailPasswordConfig, EmailPasswordGetRedirectionURLContext, EmailPasswordOnHandleEventContext, EmailPasswordPreAPIHookContext, EmailPasswordUserInput, NormalisedEmailPasswordConfig } from "./types";
-export default class EmailPassword extends AuthRecipeModule {
- static instance?: EmailPassword;
- static RECIPE_ID: string;
- constructor(config: EmailPasswordConfig);
- getFeatures: () => Record;
- getDefaultRedirectionURL: (context: EmailPasswordGetRedirectionURLContext) => Promise;
- redirectToAuth: (show?: "signin" | "signup" | undefined) => void;
- static init(config?: EmailPasswordUserInput): CreateRecipeFunction;
- static signOut(): Promise;
- static isEmailVerified(): Promise;
- static getInstanceOrThrow(): EmailPassword;
- static redirectToAuth(show?: "signin" | "signup"): void;
- static reset(): void;
-}
diff --git a/lib/build/recipe/emailpassword/emailPassword.js.map b/lib/build/recipe/emailpassword/emailPassword.js.map
deleted file mode 100644
index 88cc4e3e8..000000000
--- a/lib/build/recipe/emailpassword/emailPassword.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"emailPassword.js","sourceRoot":"","sources":["../../../ts/recipe/emailpassword/emailPassword.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AAEH,yEAAmD;AAUnD,qCAAoE;AACpE,iCAAuD;AACvD,8EAAwD;AACxD,yCAA0D;AAC1D,6CAA4C;AAE5C,sFAAoE;AACpE,kGAA4F;AAE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CAAC;IAClC,CAAC;IAEM,4BAAc,GAArB,UAAsB,IAA0B;QAC5C,OAAO,aAAa,CAAC,kBAAkB,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IACnE,CAAC;IAED;;OAEG;IACI,mBAAK,GAAZ;QACI,IAAI,CAAC,cAAM,EAAE,EAAE;YACX,OAAO;SACV;QAED,aAAa,CAAC,QAAQ,GAAG,SAAS,CAAC;QACnC,OAAO;IACX,CAAC;IAnIM,uBAAS,GAAG,eAAe,CAAC;IAoIvC,oBAAC;CAAA,AA9ID,CAA2C,0BAAgB,GA8I1D;kBA9IoB,aAAa"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailpassword/components/emailPasswordAuth.d.ts b/lib/build/recipe/emailpassword/emailPasswordAuth.d.ts
similarity index 54%
rename from lib/build/recipe/emailpassword/components/emailPasswordAuth.d.ts
rename to lib/build/recipe/emailpassword/emailPasswordAuth.d.ts
index c15554221..cd078e6be 100644
--- a/lib/build/recipe/emailpassword/components/emailPasswordAuth.d.ts
+++ b/lib/build/recipe/emailpassword/emailPasswordAuth.d.ts
@@ -1,5 +1,8 @@
///
-export default function EmailPasswordAuthWrapper({ children, requireAuth, }: {
+export default function EmailPasswordAuthWrapper({
+ children,
+ requireAuth,
+}: {
children: JSX.Element;
requireAuth?: boolean;
}): JSX.Element;
diff --git a/lib/build/recipe/emailpassword/components/emailPasswordAuth.js b/lib/build/recipe/emailpassword/emailPasswordAuth.js
similarity index 80%
rename from lib/build/recipe/emailpassword/components/emailPasswordAuth.js
rename to lib/build/recipe/emailpassword/emailPasswordAuth.js
index 6f37dc808..794e27649 100644
--- a/lib/build/recipe/emailpassword/components/emailPasswordAuth.js
+++ b/lib/build/recipe/emailpassword/emailPasswordAuth.js
@@ -56,13 +56,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
*/
var React = __importStar(require("react"));
var react_1 = require("react");
-var emailPassword_1 = __importDefault(require("../emailPassword"));
-var sessionAuth_1 = __importDefault(require("../../session/sessionAuth"));
-var emailVerificationAuth_1 = __importDefault(require("../../emailverification/emailVerificationAuth"));
-var superTokens_1 = __importDefault(require("../../../superTokens"));
-/*
- * Component.
- */
+var recipe_1 = __importDefault(require("./recipe"));
+var sessionAuth_1 = __importDefault(require("../session/sessionAuth"));
+var emailVerificationAuth_1 = __importDefault(require("../emailverification/emailVerificationAuth"));
+var superTokens_1 = __importDefault(require("../../superTokens"));
var EmailPasswordAuth = /** @class */ (function (_super) {
__extends(EmailPasswordAuth, _super);
function EmailPasswordAuth() {
@@ -74,13 +71,16 @@ var EmailPasswordAuth = /** @class */ (function (_super) {
return React.createElement(
sessionAuth_1.default,
{
+ redirectToLogin: function () {
+ recipe_1.default
+ .getInstanceOrThrow()
+ .redirectToAuthWithRedirectToPath(undefined, _this.props.history);
+ },
requireAuth: _this.props.requireAuth === undefined || _this.props.requireAuth,
- recipeId: emailPassword_1.default.getInstanceOrThrow().recipeId,
- history: _this.props.history,
},
React.createElement(
emailVerificationAuth_1.default,
- { recipeId: emailPassword_1.default.getInstanceOrThrow().recipeId, history: _this.props.history },
+ { recipe: _this.props.recipe.emailVerification, history: _this.props.history },
_this.props.children
)
);
@@ -96,14 +96,14 @@ function EmailPasswordAuthWrapper(_a) {
if (reactRouterDom === undefined) {
return React.createElement(
EmailPasswordAuth,
- { requireAuth: requireAuth, recipeId: emailPassword_1.default.getInstanceOrThrow().recipeId },
+ { requireAuth: requireAuth, recipe: recipe_1.default.getInstanceOrThrow() },
children
);
}
var Component = reactRouterDom.withRouter(EmailPasswordAuth);
return React.createElement(
Component,
- { requireAuth: requireAuth, recipeId: emailPassword_1.default.getInstanceOrThrow().recipeId },
+ { requireAuth: requireAuth, recipe: recipe_1.default.getInstanceOrThrow() },
children
);
}
diff --git a/lib/build/recipe/emailpassword/emailPasswordAuth.js.map b/lib/build/recipe/emailpassword/emailPasswordAuth.js.map
new file mode 100644
index 000000000..f40c71388
--- /dev/null
+++ b/lib/build/recipe/emailpassword/emailPasswordAuth.js.map
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C,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAC/D,OAAO,CACH,oBAAC,SAAS,IAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,gBAAa,CAAC,kBAAkB,EAAE,IAC1E,QAAQ,CACD,CACf,CAAC;AACN,CAAC;AAtBD,2CAsBC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailpassword/index.d.ts b/lib/build/recipe/emailpassword/index.d.ts
index 4b538e8d7..54d3e16d3 100644
--- a/lib/build/recipe/emailpassword/index.d.ts
+++ b/lib/build/recipe/emailpassword/index.d.ts
@@ -1,28 +1,59 @@
-import { CreateRecipeFunction, SuccessAPIResponse } from "../../types";
-import { EmailPasswordUserInput } from "./types";
-import EmailPasswordAuth from "./components/emailPasswordAuth";
-import SignInAndUp from "./components/features/signInAndUp/wrapper";
+///
+import { UserInput } from "./types";
+import EmailPasswordAuth from "./emailPasswordAuth";
import SignInAndUpTheme from "./components/themes/signInAndUp";
-import ResetPasswordUsingToken from "./components/features/resetPasswordUsingToken/wrapper";
import ResetPasswordUsingTokenTheme from "./components/themes/resetPasswordUsingToken";
import EmailVerificationTheme from "../emailverification/components/themes/emailVerification";
-import EmailVerification from "./components/features/emailVerification/wrapper";
-import { EmailPasswordGetRedirectionURLContext, EmailPasswordPreAPIHookContext, EmailPasswordOnHandleEventContext } from "./types";
-export default class EmailPasswordAPIWrapper {
+import { GetRedirectionURLContext, PreAPIHookContext, OnHandleEventContext, RecipeInterface } from "./types";
+export default class Wrapper {
+ static init(
+ config?: UserInput
+ ): import("../../types").CreateRecipeFunction<
+ GetRedirectionURLContext,
+ PreAPIHookContext,
+ OnHandleEventContext,
+ import("./types").NormalisedConfig
+ >;
+ static signOut(): Promise;
+ static isEmailVerified(): Promise;
+ static redirectToAuth(
+ input?:
+ | ("signin" | "signup")
+ | {
+ show?: "signin" | "signup";
+ redirectBack?: boolean;
+ }
+ ): void;
static EmailPasswordAuth: typeof EmailPasswordAuth;
- static SignInAndUp: typeof SignInAndUp;
+ static SignInAndUp: (prop?: any) => JSX.Element;
static SignInAndUpTheme: typeof SignInAndUpTheme;
- static ResetPasswordUsingToken: typeof ResetPasswordUsingToken;
+ static ResetPasswordUsingToken: (prop?: any) => JSX.Element;
static ResetPasswordUsingTokenTheme: typeof ResetPasswordUsingTokenTheme;
- static EmailVerification: typeof EmailVerification;
+ static EmailVerification: (prop?: any) => JSX.Element;
static EmailVerificationTheme: typeof EmailVerificationTheme;
- static init(config?: EmailPasswordUserInput): CreateRecipeFunction;
- static signOut(): Promise;
- static isEmailVerified(): Promise;
- static redirectToAuth(show?: "signin" | "signup"): void;
}
-declare const init: typeof EmailPasswordAPIWrapper.init;
-declare const signOut: typeof EmailPasswordAPIWrapper.signOut;
-declare const isEmailVerified: typeof EmailPasswordAPIWrapper.isEmailVerified;
-declare const redirectToAuth: typeof EmailPasswordAPIWrapper.redirectToAuth;
-export { EmailPasswordAuth, EmailPasswordAPIWrapper, init, isEmailVerified, SignInAndUp, SignInAndUpTheme, signOut, redirectToAuth, ResetPasswordUsingToken, ResetPasswordUsingTokenTheme, EmailVerification, EmailVerificationTheme, EmailPasswordGetRedirectionURLContext, EmailPasswordPreAPIHookContext, EmailPasswordOnHandleEventContext, };
+declare const init: typeof Wrapper.init;
+declare const signOut: typeof Wrapper.signOut;
+declare const isEmailVerified: typeof Wrapper.isEmailVerified;
+declare const redirectToAuth: typeof Wrapper.redirectToAuth;
+declare const SignInAndUp: (prop?: any) => JSX.Element;
+declare const ResetPasswordUsingToken: (prop?: any) => JSX.Element;
+declare const EmailVerification: (prop?: any) => JSX.Element;
+export {
+ EmailPasswordAuth,
+ init,
+ isEmailVerified,
+ SignInAndUp,
+ SignInAndUpTheme,
+ signOut,
+ redirectToAuth,
+ ResetPasswordUsingToken,
+ ResetPasswordUsingTokenTheme,
+ EmailVerification,
+ EmailVerificationTheme,
+ GetRedirectionURLContext,
+ PreAPIHookContext,
+ OnHandleEventContext,
+ UserInput,
+ RecipeInterface,
+};
diff --git a/lib/build/recipe/emailpassword/index.js b/lib/build/recipe/emailpassword/index.js
index 38f44c7c5..39806003f 100644
--- a/lib/build/recipe/emailpassword/index.js
+++ b/lib/build/recipe/emailpassword/index.js
@@ -147,69 +147,74 @@ var __importDefault =
return mod && mod.__esModule ? mod : { default: mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
-var emailPassword_1 = __importDefault(require("./emailPassword"));
-var emailPasswordAuth_1 = __importDefault(require("./components/emailPasswordAuth"));
+var recipe_1 = __importDefault(require("./recipe"));
+var emailPasswordAuth_1 = __importDefault(require("./emailPasswordAuth"));
exports.EmailPasswordAuth = emailPasswordAuth_1.default;
-var wrapper_1 = __importDefault(require("./components/features/signInAndUp/wrapper"));
-exports.SignInAndUp = wrapper_1.default;
var signInAndUp_1 = __importDefault(require("./components/themes/signInAndUp"));
exports.SignInAndUpTheme = signInAndUp_1.default;
-var wrapper_2 = __importDefault(require("./components/features/resetPasswordUsingToken/wrapper"));
-exports.ResetPasswordUsingToken = wrapper_2.default;
var resetPasswordUsingToken_1 = __importDefault(require("./components/themes/resetPasswordUsingToken"));
exports.ResetPasswordUsingTokenTheme = resetPasswordUsingToken_1.default;
var emailVerification_1 = __importDefault(require("../emailverification/components/themes/emailVerification"));
exports.EmailVerificationTheme = emailVerification_1.default;
-var wrapper_3 = __importDefault(require("./components/features/emailVerification/wrapper"));
-exports.EmailVerification = wrapper_3.default;
-/*
- * Class.
- */
-var EmailPasswordAPIWrapper = /** @class */ (function () {
- function EmailPasswordAPIWrapper() {}
- /*
- * Methods.
- */
- EmailPasswordAPIWrapper.init = function (config) {
- return emailPassword_1.default.init(config);
+var Wrapper = /** @class */ (function () {
+ function Wrapper() {}
+ Wrapper.init = function (config) {
+ return recipe_1.default.init(config);
};
- EmailPasswordAPIWrapper.signOut = function () {
+ Wrapper.signOut = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
- return [2 /*return*/, emailPassword_1.default.signOut()];
+ return [2 /*return*/, recipe_1.default.getInstanceOrThrow().signOut()];
});
});
};
- EmailPasswordAPIWrapper.isEmailVerified = function () {
+ Wrapper.isEmailVerified = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
- return [2 /*return*/, emailPassword_1.default.isEmailVerified()];
+ return [2 /*return*/, recipe_1.default.getInstanceOrThrow().emailVerification.isEmailVerified()];
});
});
};
- EmailPasswordAPIWrapper.redirectToAuth = function (show) {
- return emailPassword_1.default.redirectToAuth(show);
+ // have backwards compatibility to allow input as "signin" | "signup"
+ Wrapper.redirectToAuth = function (input) {
+ if (input === undefined || typeof input === "string") {
+ return recipe_1.default.getInstanceOrThrow().redirectToAuthWithoutRedirectToPath(input);
+ } else {
+ if (input.redirectBack === false || input.redirectBack === undefined) {
+ return recipe_1.default.getInstanceOrThrow().redirectToAuthWithoutRedirectToPath(input.show);
+ } else {
+ return recipe_1.default.getInstanceOrThrow().redirectToAuthWithRedirectToPath(input.show);
+ }
+ }
+ };
+ Wrapper.EmailPasswordAuth = emailPasswordAuth_1.default;
+ Wrapper.SignInAndUp = function (prop) {
+ return recipe_1.default.getInstanceOrThrow().getFeatureComponent("signinup", prop);
+ };
+ Wrapper.SignInAndUpTheme = signInAndUp_1.default;
+ Wrapper.ResetPasswordUsingToken = function (prop) {
+ return recipe_1.default.getInstanceOrThrow().getFeatureComponent("resetpassword", prop);
+ };
+ Wrapper.ResetPasswordUsingTokenTheme = resetPasswordUsingToken_1.default;
+ Wrapper.EmailVerification = function (prop) {
+ return recipe_1.default.getInstanceOrThrow().getFeatureComponent("emailverification", prop);
};
- /*
- * Static attributes.
- */
- EmailPasswordAPIWrapper.EmailPasswordAuth = emailPasswordAuth_1.default;
- EmailPasswordAPIWrapper.SignInAndUp = wrapper_1.default;
- EmailPasswordAPIWrapper.SignInAndUpTheme = signInAndUp_1.default;
- EmailPasswordAPIWrapper.ResetPasswordUsingToken = wrapper_2.default;
- EmailPasswordAPIWrapper.ResetPasswordUsingTokenTheme = resetPasswordUsingToken_1.default;
- EmailPasswordAPIWrapper.EmailVerification = wrapper_3.default;
- EmailPasswordAPIWrapper.EmailVerificationTheme = emailVerification_1.default;
- return EmailPasswordAPIWrapper;
+ Wrapper.EmailVerificationTheme = emailVerification_1.default;
+ return Wrapper;
})();
-exports.EmailPasswordAPIWrapper = EmailPasswordAPIWrapper;
-exports.default = EmailPasswordAPIWrapper;
-var init = EmailPasswordAPIWrapper.init;
+exports.default = Wrapper;
+var init = Wrapper.init;
exports.init = init;
-var signOut = EmailPasswordAPIWrapper.signOut;
+var signOut = Wrapper.signOut;
exports.signOut = signOut;
-var isEmailVerified = EmailPasswordAPIWrapper.isEmailVerified;
+var isEmailVerified = Wrapper.isEmailVerified;
exports.isEmailVerified = isEmailVerified;
-var redirectToAuth = EmailPasswordAPIWrapper.redirectToAuth;
+var redirectToAuth = Wrapper.redirectToAuth;
exports.redirectToAuth = redirectToAuth;
+var SignInAndUp = Wrapper.SignInAndUp;
+exports.SignInAndUp = SignInAndUp;
+var ResetPasswordUsingToken = Wrapper.ResetPasswordUsingToken;
+exports.ResetPasswordUsingToken = ResetPasswordUsingToken;
+var EmailVerification = Wrapper.EmailVerification;
+exports.EmailVerification = EmailVerification;
//# sourceMappingURL=index.js.map
diff --git a/lib/build/recipe/emailpassword/index.js.map b/lib/build/recipe/emailpassword/index.js.map
index 08c404a32..459c93385 100644
--- a/lib/build/recipe/emailpassword/index.js.map
+++ b/lib/build/recipe/emailpassword/index.js.map
@@ -1 +1 @@
-{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/recipe/emailpassword/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQH,kEAA4C;AAC5C,qFAA+D;AA+D3D,4BA/DG,2BAAiB,CA+DH;AA9DrB,sFAAoE;AAkEhE,sBAlEG,iBAAW,CAkEH;AAjEf,gFAA+D;AAkE3D,2BAlEG,qBAAgB,CAkEH;AAjEpB,kGAA4F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Aa,CAAC,kBAAkB,EAAE,CAAC,mBAAmB,CAAC,UAAU,EAAE,IAAI,CAAC,EAAxE,CAAwE,CAAC;IACvG,wBAAgB,GAAG,qBAAgB,CAAC;IACpC,+BAAuB,GAAG,UAAC,IAAU;QACxC,OAAA,gBAAa,CAAC,kBAAkB,EAAE,CAAC,mBAAmB,CAAC,eAAe,EAAE,IAAI,CAAC;IAA7E,CAA6E,CAAC;IAC3E,oCAA4B,GAAG,iCAA4B,CAAC;IAC5D,yBAAiB,GAAG,UAAC,IAAU;QAClC,OAAA,gBAAa,CAAC,kBAAkB,EAAE,CAAC,mBAAmB,CAAC,mBAAmB,EAAE,IAAI,CAAC;IAAjF,CAAiF,CAAC;IAC/E,8BAAsB,GAAG,2BAAsB,CAAC;IAC3D,cAAC;CAAA,AA1CD,IA0CC;kBA1CoB,OAAO;AA4C5B,IAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;AAUtB,oBAAI;AATR,IAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;AAa5B,0BAAO;AAZX,IAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;AAS5C,0CAAe;AARnB,IAAM,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;AAY1C,wCAAc;AAXlB,IAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;AAQpC,kCAAW;AAPf,IAAM,uBAAuB,GAAG,OAAO,CAAC,uBAAuB,CAAC;AAW5D,0DAAuB;AAV3B,IAAM,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;AAYhD,8CAAiB"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailpassword/recipe.d.ts b/lib/build/recipe/emailpassword/recipe.d.ts
new file mode 100644
index 000000000..93deee820
--- /dev/null
+++ b/lib/build/recipe/emailpassword/recipe.d.ts
@@ -0,0 +1,37 @@
+///
+import AuthRecipeModule from "../authRecipeModule";
+import { CreateRecipeFunction } from "../../types";
+import {
+ GetRedirectionURLContext,
+ OnHandleEventContext,
+ PreAPIHookContext,
+ Config,
+ NormalisedConfig,
+ UserInput,
+ RecipeInterface,
+} from "./types";
+import EmailVerification from "../emailverification/recipe";
+export default class EmailPassword extends AuthRecipeModule<
+ GetRedirectionURLContext,
+ PreAPIHookContext,
+ OnHandleEventContext,
+ NormalisedConfig
+> {
+ static instance?: EmailPassword;
+ static RECIPE_ID: string;
+ recipeImpl: RecipeInterface;
+ constructor(
+ config: Config,
+ recipes: {
+ emailVerificationInstance: EmailVerification | undefined;
+ }
+ );
+ getFeatures: () => Record;
+ getDefaultRedirectionURL: (context: GetRedirectionURLContext) => Promise;
+ getFeatureComponent: (componentName: "emailverification" | "signinup" | "resetpassword", props: any) => JSX.Element;
+ static init(
+ config?: UserInput
+ ): CreateRecipeFunction;
+ static getInstanceOrThrow(): EmailPassword;
+ static reset(): void;
+}
diff --git a/lib/build/recipe/emailpassword/emailPassword.js b/lib/build/recipe/emailpassword/recipe.js
similarity index 81%
rename from lib/build/recipe/emailpassword/emailPassword.js
rename to lib/build/recipe/emailpassword/recipe.js
index e241ce4a9..f8eafe329 100644
--- a/lib/build/recipe/emailpassword/emailPassword.js
+++ b/lib/build/recipe/emailpassword/recipe.js
@@ -187,45 +187,48 @@ Object.defineProperty(exports, "__esModule", { value: true });
/*
* Imports.
*/
+var react_1 = __importDefault(require("react"));
var authRecipeModule_1 = __importDefault(require("../authRecipeModule"));
var utils_1 = require("../../utils");
var utils_2 = require("./utils");
var normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath"));
var constants_1 = require("./constants");
var constants_2 = require("../../constants");
-var wrapper_1 = __importDefault(require("./components/features/signInAndUp/wrapper"));
-var wrapper_2 = __importDefault(require("./components/features/resetPasswordUsingToken/wrapper"));
+var signInAndUp_1 = __importDefault(require("./components/features/signInAndUp"));
+var resetPasswordUsingToken_1 = __importDefault(require("./components/features/resetPasswordUsingToken"));
+var recipeImplementation_1 = __importDefault(require("./recipeImplementation"));
/*
* Class.
*/
var EmailPassword = /** @class */ (function (_super) {
__extends(EmailPassword, _super);
- /*
- * Constructor.
- */
- function EmailPassword(config) {
- var _this = _super.call(this, config, utils_2.normaliseEmailPasswordConfig(config)) || this;
- /*
- * Instance methods.
- */
+ function EmailPassword(config, recipes) {
+ var _this =
+ _super.call(this, utils_2.normaliseEmailPasswordConfig(config), {
+ emailVerificationInstance: recipes.emailVerificationInstance,
+ }) || this;
_this.getFeatures = function () {
var features = {};
if (_this.config.signInAndUpFeature.disableDefaultImplementation !== true) {
- var normalisedFullPath = _this.appInfo.websiteBasePath.appendPath(new normalisedURLPath_1.default("/"));
+ var normalisedFullPath = _this.config.appInfo.websiteBasePath.appendPath(
+ new normalisedURLPath_1.default("/")
+ );
features[normalisedFullPath.getAsStringDangerous()] = {
- matches: utils_1.matchRecipeIdUsingQueryParams(_this.recipeId),
- rid: _this.recipeId,
- component: wrapper_1.default,
+ matches: utils_1.matchRecipeIdUsingQueryParams(_this.config.recipeId),
+ component: function (props) {
+ return _this.getFeatureComponent("signinup", props);
+ },
};
}
if (_this.config.resetPasswordUsingTokenFeature.disableDefaultImplementation !== true) {
- var normalisedFullPath = _this.appInfo.websiteBasePath.appendPath(
+ var normalisedFullPath = _this.config.appInfo.websiteBasePath.appendPath(
new normalisedURLPath_1.default(constants_1.DEFAULT_RESET_PASSWORD_PATH)
);
features[normalisedFullPath.getAsStringDangerous()] = {
- matches: utils_1.matchRecipeIdUsingQueryParams(_this.recipeId),
- rid: _this.recipeId,
- component: wrapper_2.default,
+ matches: utils_1.matchRecipeIdUsingQueryParams(_this.config.recipeId),
+ component: function (props) {
+ return _this.getFeatureComponent("resetpassword", props);
+ },
};
}
return __assign({}, features, _this.getAuthRecipeModuleFeatures());
@@ -238,56 +241,43 @@ var EmailPassword = /** @class */ (function (_super) {
resetPasswordPath = new normalisedURLPath_1.default(constants_1.DEFAULT_RESET_PASSWORD_PATH);
return [
2 /*return*/,
- this.appInfo.websiteBasePath.appendPath(resetPasswordPath).getAsStringDangerous() +
+ this.config.appInfo.websiteBasePath.appendPath(resetPasswordPath).getAsStringDangerous() +
"?rid=" +
- this.recipeId,
+ this.config.recipeId,
];
}
return [2 /*return*/, this.getAuthRecipeModuleDefaultRedirectionURL(context)];
});
});
};
- _this.redirectToAuth = function (show) {
- _this.redirect(
- {
- action: "SIGN_IN_AND_UP",
- },
- undefined,
- show === undefined
- ? undefined
- : {
- show: show,
- }
- );
+ _this.getFeatureComponent = function (componentName, props) {
+ if (componentName === "signinup") {
+ return react_1.default.createElement(signInAndUp_1.default, __assign({ recipe: _this }, props));
+ } else if (componentName === "resetpassword") {
+ return react_1.default.createElement(
+ resetPasswordUsingToken_1.default,
+ __assign({ recipe: _this }, props)
+ );
+ } else {
+ return _this.getAuthRecipeModuleFeatureComponent(componentName, props);
+ }
};
+ _this.recipeImpl = _this.config.override.functions(
+ new recipeImplementation_1.default(_this.config.recipeId, _this.config.appInfo)
+ );
return _this;
}
- /*
- * Static methods.
- */
EmailPassword.init = function (config) {
return function (appInfo) {
EmailPassword.instance = new EmailPassword(
- __assign({}, config, { appInfo: appInfo, recipeId: EmailPassword.RECIPE_ID })
+ __assign({}, config, { appInfo: appInfo, recipeId: EmailPassword.RECIPE_ID }),
+ {
+ emailVerificationInstance: undefined,
+ }
);
return EmailPassword.instance;
};
};
- EmailPassword.signOut = function () {
- return EmailPassword.getInstanceOrThrow().signOut();
- };
- EmailPassword.isEmailVerified = function () {
- return __awaiter(this, void 0, void 0, function () {
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- return [4 /*yield*/, EmailPassword.getInstanceOrThrow().isEmailVerified()];
- case 1:
- return [2 /*return*/, _a.sent()];
- }
- });
- });
- };
EmailPassword.getInstanceOrThrow = function () {
if (EmailPassword.instance === undefined) {
var error =
@@ -301,9 +291,6 @@ var EmailPassword = /** @class */ (function (_super) {
}
return EmailPassword.instance;
};
- EmailPassword.redirectToAuth = function (show) {
- return EmailPassword.getInstanceOrThrow().redirectToAuth(show);
- };
/*
* Tests methods.
*/
@@ -318,4 +305,4 @@ var EmailPassword = /** @class */ (function (_super) {
return EmailPassword;
})(authRecipeModule_1.default);
exports.default = EmailPassword;
-//# sourceMappingURL=emailPassword.js.map
+//# sourceMappingURL=recipe.js.map
diff --git a/lib/build/recipe/emailpassword/recipe.js.map b/lib/build/recipe/emailpassword/recipe.js.map
new file mode 100644
index 000000000..77d73d068
--- /dev/null
+++ b/lib/build/recipe/emailpassword/recipe.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"recipe.js","sourceRoot":"","sources":["../../../ts/recipe/emailpassword/recipe.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AAEH,gDAA0B;AAC1B,yEAAmD;AAWnD,qCAAoE;AACpE,iCAAuD;AACvD,8EAAwD;AACxD,yCAA0D;AAC1D,6CAA4C;AAE5C,kFAA4D;AAC5D,0GAAoF;AACpF,gFAA0D;AAG1D;;GAEG;AACH;IAA2C,iCAK1C;IAMG,uBACI,MAAc,EACd,OAEC;QAJL,YAMI,kBAAM,oCAA4B,CAAC,MAAM,CAAC,EAAE;YACxC,yBAAyB,EAAE,OAAO,CAAC,yBAAyB;SAC/D,CAAC,SAIL;QAED,iBAAW,GAAG;YACV,IAAM,QAAQ,GAA8B,EAAE,CAAC;YAC/C,IAAI,KAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,4BAA4B,KAAK,IAAI,EAAE;gBACtE,IAAM,kBAAkB,GAAG,KAAI,CAAC,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,UAAU,CAAC,IAAI,2BAAiB,CAAC,GAAG,CAAC,CAAC,CAAC;gBACtG,QAAQ,CAAC,kBAAkB,CAAC,oBAAoB,EAAE,CAAC,GAAG;oBAClD,OAAO,EAAE,qCAA6B,CAAC,KAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;oBAC5D,SAAS,EAAE,UAAC,KA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aAAa"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailpassword/recipeImplementation.d.ts b/lib/build/recipe/emailpassword/recipeImplementation.d.ts
new file mode 100644
index 000000000..4dec7cd3f
--- /dev/null
+++ b/lib/build/recipe/emailpassword/recipeImplementation.d.ts
@@ -0,0 +1,88 @@
+import { RecipeInterface, NormalisedConfig } from "./types";
+import { User } from "../authRecipeModule/types";
+import { NormalisedAppInfo } from "../../types";
+import Querier from "../../querier";
+export default class RecipeImplementation implements RecipeInterface {
+ querier: Querier;
+ constructor(recipeId: string, appInfo: NormalisedAppInfo);
+ submitNewPassword: (input: {
+ formFields: {
+ id: string;
+ value: string;
+ }[];
+ token: string;
+ config: NormalisedConfig;
+ }) => Promise;
+ sendPasswordResetEmail: (input: {
+ formFields: {
+ id: string;
+ value: string;
+ }[];
+ config: NormalisedConfig;
+ }) => Promise;
+ signUp: (input: {
+ formFields: {
+ id: string;
+ value: string;
+ }[];
+ config: NormalisedConfig;
+ }) => Promise;
+ signIn: (input: {
+ formFields: {
+ id: string;
+ value: string;
+ }[];
+ config: NormalisedConfig;
+ }) => Promise;
+ doesEmailExist: (input: { email: string; config: NormalisedConfig }) => Promise;
+}
+declare type SubmitNewPasswordAPIResponse =
+ | {
+ status: "OK" | "RESET_PASSWORD_INVALID_TOKEN_ERROR";
+ }
+ | {
+ status: "FIELD_ERROR";
+ formFields: {
+ id: string;
+ error: string;
+ }[];
+ };
+declare type SendPasswordResetEmailAPIResponse =
+ | {
+ status: "OK";
+ }
+ | {
+ status: "FIELD_ERROR";
+ formFields: {
+ id: string;
+ error: string;
+ }[];
+ };
+declare type SignUpAPIResponse =
+ | {
+ status: "OK";
+ user: User;
+ }
+ | {
+ status: "FIELD_ERROR";
+ formFields: {
+ id: string;
+ error: string;
+ }[];
+ };
+declare type SignInAPIResponse =
+ | {
+ status: "OK";
+ user: User;
+ }
+ | {
+ status: "FIELD_ERROR";
+ formFields: {
+ id: string;
+ error: string;
+ }[];
+ }
+ | {
+ status: "WRONG_CREDENTIALS_ERROR";
+ };
+export {};
diff --git a/lib/build/recipe/emailpassword/recipeImplementation.js b/lib/build/recipe/emailpassword/recipeImplementation.js
new file mode 100644
index 000000000..d471804c9
--- /dev/null
+++ b/lib/build/recipe/emailpassword/recipeImplementation.js
@@ -0,0 +1,403 @@
+"use strict";
+var __assign =
+ (this && this.__assign) ||
+ function () {
+ __assign =
+ Object.assign ||
+ function (t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
+ }
+ return t;
+ };
+ return __assign.apply(this, arguments);
+ };
+var __awaiter =
+ (this && this.__awaiter) ||
+ function (thisArg, _arguments, P, generator) {
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) {
+ try {
+ step(generator.next(value));
+ } catch (e) {
+ reject(e);
+ }
+ }
+ function rejected(value) {
+ try {
+ step(generator["throw"](value));
+ } catch (e) {
+ reject(e);
+ }
+ }
+ function step(result) {
+ result.done
+ ? resolve(result.value)
+ : new P(function (resolve) {
+ resolve(result.value);
+ }).then(fulfilled, rejected);
+ }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+ };
+var __generator =
+ (this && this.__generator) ||
+ function (thisArg, body) {
+ var _ = {
+ label: 0,
+ sent: function () {
+ if (t[0] & 1) throw t[1];
+ return t[1];
+ },
+ trys: [],
+ ops: [],
+ },
+ f,
+ y,
+ t,
+ g;
+ return (
+ (g = { next: verb(0), throw: verb(1), return: verb(2) }),
+ typeof Symbol === "function" &&
+ (g[Symbol.iterator] = function () {
+ return this;
+ }),
+ g
+ );
+ function verb(n) {
+ return function (v) {
+ return step([n, v]);
+ };
+ }
+ function step(op) {
+ if (f) throw new TypeError("Generator is already executing.");
+ while (_)
+ try {
+ if (
+ ((f = 1),
+ y &&
+ (t =
+ op[0] & 2
+ ? y["return"]
+ : op[0]
+ ? y["throw"] || ((t = y["return"]) && t.call(y), 0)
+ : y.next) &&
+ !(t = t.call(y, op[1])).done)
+ )
+ return t;
+ if (((y = 0), t)) op = [op[0] & 2, t.value];
+ switch (op[0]) {
+ case 0:
+ case 1:
+ t = op;
+ break;
+ case 4:
+ _.label++;
+ return { value: op[1], done: false };
+ case 5:
+ _.label++;
+ y = op[1];
+ op = [0];
+ continue;
+ case 7:
+ op = _.ops.pop();
+ _.trys.pop();
+ continue;
+ default:
+ if (
+ !((t = _.trys), (t = t.length > 0 && t[t.length - 1])) &&
+ (op[0] === 6 || op[0] === 2)
+ ) {
+ _ = 0;
+ continue;
+ }
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
+ _.label = op[1];
+ break;
+ }
+ if (op[0] === 6 && _.label < t[1]) {
+ _.label = t[1];
+ t = op;
+ break;
+ }
+ if (t && _.label < t[2]) {
+ _.label = t[2];
+ _.ops.push(op);
+ break;
+ }
+ if (t[2]) _.ops.pop();
+ _.trys.pop();
+ continue;
+ }
+ op = body.call(thisArg, _);
+ } catch (e) {
+ op = [6, e];
+ y = 0;
+ } finally {
+ f = t = 0;
+ }
+ if (op[0] & 5) throw op[1];
+ return { value: op[0] ? op[1] : void 0, done: true };
+ }
+ };
+var __importDefault =
+ (this && this.__importDefault) ||
+ function (mod) {
+ return mod && mod.__esModule ? mod : { default: mod };
+ };
+Object.defineProperty(exports, "__esModule", { value: true });
+var querier_1 = __importDefault(require("../../querier"));
+var utils_1 = require("../../utils");
+var RecipeImplementation = /** @class */ (function () {
+ function RecipeImplementation(recipeId, appInfo) {
+ var _this = this;
+ this.submitNewPassword = function (input) {
+ return __awaiter(_this, void 0, void 0, function () {
+ var validationErrors, response;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ return [
+ 4 /*yield*/,
+ utils_1.validateForm(
+ input.formFields,
+ input.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 (input.formFields[0].value !== input.formFields[1].value) {
+ return [
+ 2 /*return*/,
+ {
+ status: "FIELD_ERROR",
+ formFields: [
+ {
+ id: input.formFields[1].id,
+ error: "Confirmation password doesn't match",
+ },
+ ],
+ },
+ ];
+ }
+ return [
+ 4 /*yield*/,
+ this.querier.post(
+ "/user/password/reset",
+ {
+ body: JSON.stringify({
+ formFields: [input.formFields[0]],
+ token: input.token,
+ method: "token",
+ }),
+ },
+ function (context) {
+ return input.config.preAPIHook(
+ __assign({}, context, { action: "SUBMIT_NEW_PASSWORD" })
+ );
+ }
+ ),
+ ];
+ case 2:
+ response = _a.sent();
+ if (response.status === "OK") {
+ input.config.onHandleEvent({
+ action: "PASSWORD_RESET_SUCCESSFUL",
+ });
+ }
+ return [2 /*return*/, response];
+ }
+ });
+ });
+ };
+ this.sendPasswordResetEmail = function (input) {
+ return __awaiter(_this, void 0, void 0, function () {
+ var validationErrors, response;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ return [
+ 4 /*yield*/,
+ utils_1.validateForm(
+ input.formFields,
+ input.config.resetPasswordUsingTokenFeature.enterEmailForm.formFields
+ ),
+ ];
+ case 1:
+ validationErrors = _a.sent();
+ if (validationErrors.length > 0) {
+ return [
+ 2 /*return*/,
+ {
+ status: "FIELD_ERROR",
+ formFields: validationErrors,
+ },
+ ];
+ }
+ return [
+ 4 /*yield*/,
+ this.querier.post(
+ "/user/password/reset/token",
+ { body: JSON.stringify({ formFields: input.formFields }) },
+ function (context) {
+ return input.config.preAPIHook(
+ __assign({}, context, { action: "SEND_RESET_PASSWORD_EMAIL" })
+ );
+ }
+ ),
+ ];
+ case 2:
+ response = _a.sent();
+ if (response.status === "OK") {
+ input.config.onHandleEvent({
+ action: "RESET_PASSWORD_EMAIL_SENT",
+ });
+ }
+ return [2 /*return*/, response];
+ }
+ });
+ });
+ };
+ this.signUp = function (input) {
+ return __awaiter(_this, void 0, void 0, function () {
+ var validationErrors, response;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ return [
+ 4 /*yield*/,
+ utils_1.validateForm(
+ input.formFields,
+ input.config.signInAndUpFeature.signUpForm.formFields
+ ),
+ ];
+ case 1:
+ validationErrors = _a.sent();
+ if (validationErrors.length > 0) {
+ return [
+ 2 /*return*/,
+ {
+ status: "FIELD_ERROR",
+ formFields: validationErrors,
+ },
+ ];
+ }
+ return [
+ 4 /*yield*/,
+ this.querier.post(
+ "/signup",
+ { body: JSON.stringify({ formFields: input.formFields }) },
+ function (context) {
+ return input.config.preAPIHook(
+ __assign({}, context, { action: "EMAIL_PASSWORD_SIGN_UP" })
+ );
+ }
+ ),
+ ];
+ case 2:
+ response = _a.sent();
+ if (response.status === "OK") {
+ input.config.onHandleEvent({
+ action: "SUCCESS",
+ isNewUser: true,
+ user: response.user,
+ });
+ }
+ return [2 /*return*/, response];
+ }
+ });
+ });
+ };
+ this.signIn = function (input) {
+ return __awaiter(_this, void 0, void 0, function () {
+ var validationErrors, response;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ return [
+ 4 /*yield*/,
+ utils_1.validateForm(
+ input.formFields,
+ input.config.signInAndUpFeature.signInForm.formFields
+ ),
+ ];
+ case 1:
+ validationErrors = _a.sent();
+ if (validationErrors.length > 0) {
+ return [
+ 2 /*return*/,
+ {
+ status: "FIELD_ERROR",
+ formFields: validationErrors,
+ },
+ ];
+ }
+ return [
+ 4 /*yield*/,
+ this.querier.post(
+ "/signin",
+ { body: JSON.stringify({ formFields: input.formFields }) },
+ function (context) {
+ return input.config.preAPIHook(
+ __assign({}, context, { action: "EMAIL_PASSWORD_SIGN_IN" })
+ );
+ }
+ ),
+ ];
+ case 2:
+ response = _a.sent();
+ if (response.status === "OK") {
+ input.config.onHandleEvent({
+ action: "SUCCESS",
+ isNewUser: false,
+ user: response.user,
+ });
+ }
+ return [2 /*return*/, response];
+ }
+ });
+ });
+ };
+ this.doesEmailExist = function (input) {
+ return __awaiter(_this, void 0, void 0, function () {
+ var response;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ return [
+ 4 /*yield*/,
+ this.querier.get(
+ "/signup/email/exists",
+ {},
+ { email: input.email },
+ function (context) {
+ return input.config.preAPIHook(
+ __assign({}, context, { action: "EMAIL_EXISTS" })
+ );
+ }
+ ),
+ ];
+ case 1:
+ response = _a.sent();
+ return [2 /*return*/, response.exists];
+ }
+ });
+ });
+ };
+ this.querier = new querier_1.default(recipeId, appInfo);
+ }
+ return RecipeImplementation;
+})();
+exports.default = RecipeImplementation;
+//# sourceMappingURL=recipeImplementation.js.map
diff --git a/lib/build/recipe/emailpassword/recipeImplementation.js.map b/lib/build/recipe/emailpassword/recipeImplementation.js.map
new file mode 100644
index 000000000..669c3c932
--- /dev/null
+++ b/lib/build/recipe/emailpassword/recipeImplementation.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"recipeImplementation.js","sourceRoot":"","sources":["../../../ts/recipe/emailpassword/recipeImplementation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,0DAAoC;AACpC,qCAA2C;AAE3C;IAGI,8BAAY,QAAgB,EAAE,OAA0B;QAAxD,iBAEC;QAED,sBAAiB,GAAG,UAAO,KAO1B;;;;4BAE4B,qBAAM,oBAAY,CACvC,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,MAAM,CAAC,8BAA8B,CAAC,qBAAqB,CAAC,UAAU,CAC/E,EAAA;;wBAHK,gBAAgB,GAAG,SAGxB;wBAED,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;4BAC7B,sBAAO;oCACH,MAAM,EAAE,aAAa;oCACrB,UAAU,EAAE,gBAAgB;iCAC/B,EAAC;yBACL;wBAED,oCAAoC;wBACpC,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC,C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AAK,CAAC,MAAM,CAAC,UAAU,cACvB,OAAO,IACV,MAAM,EAAE,cAAc,IACxB,CAAC;wBACP,CAAC,CACJ,EAAA;;wBAVK,QAAQ,GAA2B,SAUxC;wBAED,sBAAO,QAAQ,CAAC,MAAM,EAAC;;;aAC1B,CAAC;QArME,IAAI,CAAC,OAAO,GAAG,IAAI,iBAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;IAqML,2BAAC;AAAD,CAAC,AA1MD,IA0MC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailpassword/types.d.ts b/lib/build/recipe/emailpassword/types.d.ts
index a74b7b72a..8411846b9 100644
--- a/lib/build/recipe/emailpassword/types.d.ts
+++ b/lib/build/recipe/emailpassword/types.d.ts
@@ -1,18 +1,64 @@
-import { APIFormField, FeatureBaseConfig, FormField, FormFieldBaseConfig, NormalisedBaseConfig, NormalisedFormField, ThemeBaseProps } from "../../types";
+import {
+ APIFormField,
+ FeatureBaseConfig,
+ FormField,
+ FormFieldBaseConfig,
+ NormalisedBaseConfig,
+ NormalisedFormField,
+ ThemeBaseProps,
+} from "../../types";
import { RefObject } from "react";
-import { RecipeModuleConfig } from "../recipeModule/types";
-import { AuthRecipeModuleGetRedirectionURLContext, AuthRecipeModuleOnHandleEventContext, AuthRecipeModulePreAPIHookContext, AuthRecipeModuleUserInput, User } from "../authRecipeModule/types";
-export declare type EmailPasswordUserInput = AuthRecipeModuleUserInput & {
- palette?: Record;
- useShadowDom?: boolean;
+import {
+ GetRedirectionURLContext as AuthRecipeModuleGetRedirectionURLContext,
+ OnHandleEventContext as AuthRecipeModuleOnHandleEventContext,
+ PreAPIHookContext as AuthRecipeModulePreAPIHookContext,
+ User,
+ Config as AuthRecipeModuleConfig,
+ NormalisedConfig as NormalisedAuthRecipeModuleConfig,
+ UserInput as AuthRecipeModuleUserInput,
+ UserInputOverride as AuthRecipeUserInputOverride,
+} from "../authRecipeModule/types";
+import { ComponentOverride } from "../../components/componentOverride/componentOverride";
+import { SignInHeader } from "./components/themes/signInAndUp/signInHeader";
+import { SignIn } from "./components/themes/signInAndUp/signIn";
+import { SignInFooter } from "./components/themes/signInAndUp/signInFooter";
+import { SignInForm } from "./components/themes/signInAndUp/signInForm";
+import { SignUp } from "./components/themes/signInAndUp/signUp";
+import { SignUpFooter } from "./components/themes/signInAndUp/signUpFooter";
+import { SignUpForm } from "./components/themes/signInAndUp/signUpForm";
+import { SignUpHeader } from "./components/themes/signInAndUp/signUpHeader";
+import { EnterEmail } from "./components/themes/resetPasswordUsingToken/enterEmail";
+import { SubmitNewPassword } from "./components/themes/resetPasswordUsingToken/submitNewPassword";
+export declare type ComponentOverrideMap = {
+ EmailPasswordSignIn?: ComponentOverride;
+ EmailPasswordSignInFooter?: ComponentOverride;
+ EmailPasswordSignInForm?: ComponentOverride;
+ EmailPasswordSignInHeader?: ComponentOverride;
+ EmailPasswordSignUp?: ComponentOverride;
+ EmailPasswordSignUpFooter?: ComponentOverride;
+ EmailPasswordSignUpForm?: ComponentOverride;
+ EmailPasswordSignUpHeader?: ComponentOverride;
+ EmailPasswordEnterEmail?: ComponentOverride;
+ EmailPasswordSubmitNewPassword?: ComponentOverride;
+};
+export declare type UserInput = {
signInAndUpFeature?: SignInAndUpFeatureUserInput;
resetPasswordUsingTokenFeature?: ResetPasswordUsingTokenUserInput;
-};
-export declare type EmailPasswordConfig = EmailPasswordUserInput & RecipeModuleConfig;
-export declare type NormalisedEmailPasswordConfig = {
+ override?: {
+ functions?: (originalImplementation: RecipeInterface) => RecipeInterface;
+ components?: ComponentOverrideMap;
+ } & AuthRecipeUserInputOverride;
+} & AuthRecipeModuleUserInput;
+export declare type Config = UserInput &
+ AuthRecipeModuleConfig;
+export declare type NormalisedConfig = {
signInAndUpFeature: NormalisedSignInAndUpFeatureConfig;
resetPasswordUsingTokenFeature: NormalisedResetPasswordUsingTokenFeatureConfig;
-};
+ override: {
+ functions: (originalImplementation: RecipeInterface) => RecipeInterface;
+ components: ComponentOverrideMap;
+ };
+} & NormalisedAuthRecipeModuleConfig;
export declare type SignInAndUpFeatureUserInput = {
disableDefaultImplementation?: boolean;
defaultToSignUp?: boolean;
@@ -63,21 +109,22 @@ declare type FormThemeBaseProps = ThemeBaseProps & {
formFields: FormFieldThemeProps[];
};
export declare type SignInThemeProps = FormThemeBaseProps & {
+ recipeImplementation: RecipeInterface;
+ config: NormalisedConfig;
signUpClicked?: () => void;
forgotPasswordClick: () => void;
- signInAPI: (fields: APIFormField[]) => Promise;
+ onSuccess: () => void;
};
export declare type SignUpThemeProps = FormThemeBaseProps & {
+ recipeImplementation: RecipeInterface;
+ config: NormalisedConfig;
signInClicked?: () => void;
- privacyPolicyLink?: string;
- termsOfServiceLink?: string;
- signUpAPI: (fields: APIFormField[]) => Promise;
+ onSuccess: () => void;
};
export declare type SignInAndUpThemeProps = {
- defaultToSignUp: boolean;
signInForm: SignInThemeProps;
signUpForm: SignUpThemeProps;
- rawPalette: Record;
+ config: NormalisedConfig;
};
export declare type NormalisedFormFieldWithError = NormalisedFormField & {
error?: string;
@@ -97,75 +144,59 @@ export declare type FormFieldError = {
id: string;
error: string;
};
-export declare type EmailExistsAPIResponse = {
- status: "OK";
- exists: boolean;
-};
-export declare type FormFieldAPIResponse = {
- status: "FIELD_ERROR";
- formFields: FormFieldError[];
-};
-export declare type BaseSignInUpAPIResponse = {
- status: "OK";
- user: User;
-} | FormFieldAPIResponse;
-export declare type BaseResetPasswordAPIResponse = {
- status: "OK";
-} | FormFieldAPIResponse;
-export declare type ThemeResponseGeneralError = {
- status: "GENERAL_ERROR";
- message: string;
-};
-export declare type SignUpAPIResponse = BaseSignInUpAPIResponse;
-export declare type SignInAPIResponse = BaseSignInUpAPIResponse | {
- status: "WRONG_CREDENTIALS_ERROR";
- message: string;
-};
-export declare type EnterEmailAPIResponse = BaseResetPasswordAPIResponse;
-export declare type SubmitNewPasswordAPIResponse = BaseResetPasswordAPIResponse | {
- status: "RESET_PASSWORD_INVALID_TOKEN_ERROR";
-};
-export declare type EmailPasswordPreAPIHookContext = AuthRecipeModulePreAPIHookContext | {
- action: "SIGN_UP" | "SEND_RESET_PASSWORD_EMAIL" | "SUBMIT_NEW_PASSWORD";
- requestInit: RequestInit;
- url: string;
-};
-export declare type EmailPasswordGetRedirectionURLContext = AuthRecipeModuleGetRedirectionURLContext | {
- action: "RESET_PASSWORD";
-};
-export declare type EmailPasswordOnHandleEventContext = AuthRecipeModuleOnHandleEventContext | {
- action: "RESET_PASSWORD_EMAIL_SENT" | "PASSWORD_RESET_SUCCESSFUL";
-};
+export declare type PreAPIHookContext =
+ | AuthRecipeModulePreAPIHookContext
+ | {
+ action:
+ | "EMAIL_PASSWORD_SIGN_UP"
+ | "EMAIL_PASSWORD_SIGN_IN"
+ | "SEND_RESET_PASSWORD_EMAIL"
+ | "SUBMIT_NEW_PASSWORD"
+ | "EMAIL_EXISTS";
+ requestInit: RequestInit;
+ url: string;
+ };
+export declare type GetRedirectionURLContext =
+ | AuthRecipeModuleGetRedirectionURLContext
+ | {
+ action: "RESET_PASSWORD";
+ };
+export declare type OnHandleEventContext =
+ | AuthRecipeModuleOnHandleEventContext
+ | {
+ action: "RESET_PASSWORD_EMAIL_SENT" | "PASSWORD_RESET_SUCCESSFUL";
+ };
export declare type ResetPasswordUsingTokenThemeProps = {
- enterEmailForm: EnterEmailThemeProps;
- submitNewPasswordForm: SubmitNewPasswordThemeProps;
- hasToken: boolean;
- rawPalette: Record;
+ enterEmailForm: EnterEmailProps;
+ submitNewPasswordForm: SubmitNewPasswordProps | undefined;
+ config: NormalisedConfig;
};
-export declare type EnterEmailThemeProps = FormThemeBaseProps & {
- enterEmailAPI: (fields: APIFormField[]) => Promise;
+export declare type EnterEmailProps = FormThemeBaseProps & {
+ recipeImplementation: RecipeInterface;
+ config: NormalisedConfig;
};
-export declare type SubmitNewPasswordThemeProps = FormThemeBaseProps & {
- submitNewPasswordAPI: (fields: APIFormField[]) => Promise;
+export declare type SubmitNewPasswordProps = FormThemeBaseProps & {
+ recipeImplementation: RecipeInterface;
+ config: NormalisedConfig;
onSignInClicked: () => void;
+ token: string;
};
-export declare type EnterEmailThemeState = {
+export declare type EnterEmailState = {
status: "READY" | "SENT";
};
-export declare type SubmitNewPasswordThemeState = {
+export declare type SubmitNewPasswordState = {
status: "READY" | "SUCCESS";
};
-export declare type SendVerifyEmailThemeState = {
- status: "READY" | "SUCCESS" | "ERROR";
-};
-export declare type FormBaseState = {
- formFields: FormFieldState[];
- status: "IN_PROGRESS" | "READY" | "LOADING" | "FIELD_ERRORS" | "SUCCESS";
-} | {
- formFields: FormFieldState[];
- status: "GENERAL_ERROR";
- generalError: string;
-};
+export declare type FormBaseState =
+ | {
+ formFields: FormFieldState[];
+ status: "IN_PROGRESS" | "READY" | "LOADING" | "FIELD_ERRORS" | "SUCCESS";
+ }
+ | {
+ formFields: FormFieldState[];
+ status: "GENERAL_ERROR";
+ generalError: string;
+ };
export declare type FormBaseProps = {
header?: JSX.Element;
footer?: JSX.Element;
@@ -176,19 +207,111 @@ export declare type FormBaseProps = {
onSuccess?: () => void;
callAPI: (fields: APIFormField[]) => Promise;
};
-export declare type FormBaseAPIResponse = {
- status: "OK";
- user?: User;
-} | {
- status: "GENERAL_ERROR";
- message: string;
-} | {
- status: "FIELD_ERROR";
- formFields: FormFieldError[];
-};
+export declare type FormBaseAPIResponse =
+ | {
+ status: "OK";
+ user?: User;
+ }
+ | {
+ status: "GENERAL_ERROR";
+ message: string;
+ }
+ | {
+ status: "FIELD_ERROR";
+ formFields: FormFieldError[];
+ };
declare global {
interface Document {
documentMode?: any;
}
}
+export declare type SignInAndUpState =
+ | {
+ status: "LOADING" | "READY";
+ }
+ | {
+ status: "SUCCESSFUL";
+ user: User;
+ };
+export interface RecipeInterface {
+ submitNewPassword: (input: {
+ formFields: {
+ id: string;
+ value: string;
+ }[];
+ token: string;
+ config: NormalisedConfig;
+ }) => Promise<
+ | {
+ status: "OK" | "RESET_PASSWORD_INVALID_TOKEN_ERROR";
+ }
+ | {
+ status: "FIELD_ERROR";
+ formFields: {
+ id: string;
+ error: string;
+ }[];
+ }
+ >;
+ sendPasswordResetEmail: (input: {
+ formFields: {
+ id: string;
+ value: string;
+ }[];
+ config: NormalisedConfig;
+ }) => Promise<
+ | {
+ status: "OK";
+ }
+ | {
+ status: "FIELD_ERROR";
+ formFields: {
+ id: string;
+ error: string;
+ }[];
+ }
+ >;
+ signUp: (input: {
+ formFields: {
+ id: string;
+ value: string;
+ }[];
+ config: NormalisedConfig;
+ }) => Promise<
+ | {
+ status: "OK";
+ user: User;
+ }
+ | {
+ status: "FIELD_ERROR";
+ formFields: {
+ id: string;
+ error: string;
+ }[];
+ }
+ >;
+ signIn: (input: {
+ formFields: {
+ id: string;
+ value: string;
+ }[];
+ config: NormalisedConfig;
+ }) => Promise<
+ | {
+ status: "OK";
+ user: User;
+ }
+ | {
+ status: "FIELD_ERROR";
+ formFields: {
+ id: string;
+ error: string;
+ }[];
+ }
+ | {
+ status: "WRONG_CREDENTIALS_ERROR";
+ }
+ >;
+ doesEmailExist: (input: { email: string; config: NormalisedConfig }) => Promise;
+}
export {};
diff --git a/lib/build/recipe/emailpassword/utils.d.ts b/lib/build/recipe/emailpassword/utils.d.ts
index c9c4bc87a..8f3e766dd 100644
--- a/lib/build/recipe/emailpassword/utils.d.ts
+++ b/lib/build/recipe/emailpassword/utils.d.ts
@@ -1,10 +1,35 @@
import { FormField, NormalisedFormField } from "../../types";
-import { EmailPasswordConfig, NormalisedEmailPasswordConfig, NormalisedResetPasswordUsingTokenFeatureConfig, NormalisedSignInAndUpFeatureConfig, NormalisedSignInFormFeatureConfig, NormalisedSignUpFormFeatureConfig, ResetPasswordUsingTokenUserInput, SignInAndUpFeatureUserInput, SignInFormFeatureUserInput, SignUpFormFeatureUserInput } from "./types";
-export declare function normaliseEmailPasswordConfig(config: EmailPasswordConfig): NormalisedEmailPasswordConfig;
-export declare function normaliseSignInAndUpFeature(config?: SignInAndUpFeatureUserInput): NormalisedSignInAndUpFeatureConfig;
-export declare function normaliseSignUpFormFeatureConfig(config?: SignUpFormFeatureUserInput): NormalisedSignUpFormFeatureConfig;
-export declare function normaliseSignInFormFeatureConfig(defaultFormFields: NormalisedFormField[], config?: SignInFormFeatureUserInput): NormalisedSignInFormFeatureConfig;
+import {
+ Config,
+ NormalisedConfig,
+ NormalisedResetPasswordUsingTokenFeatureConfig,
+ NormalisedSignInAndUpFeatureConfig,
+ NormalisedSignInFormFeatureConfig,
+ NormalisedSignUpFormFeatureConfig,
+ ResetPasswordUsingTokenUserInput,
+ SignInAndUpFeatureUserInput,
+ SignInFormFeatureUserInput,
+ SignUpFormFeatureUserInput,
+} from "./types";
+export declare function normaliseEmailPasswordConfig(config: Config): NormalisedConfig;
+export declare function normaliseSignInAndUpFeature(
+ config?: SignInAndUpFeatureUserInput
+): NormalisedSignInAndUpFeatureConfig;
+export declare function normaliseSignUpFormFeatureConfig(
+ config?: SignUpFormFeatureUserInput
+): NormalisedSignUpFormFeatureConfig;
+export declare function normaliseSignInFormFeatureConfig(
+ defaultFormFields: NormalisedFormField[],
+ config?: SignInFormFeatureUserInput
+): NormalisedSignInFormFeatureConfig;
export declare function getDefaultFormFields(): NormalisedFormField[];
-export declare function normaliseResetPasswordUsingTokenFeature(signUpPasswordFieldValidate: (value: any) => Promise, signUpEmailField: NormalisedFormField, config?: ResetPasswordUsingTokenUserInput): NormalisedResetPasswordUsingTokenFeatureConfig;
-export declare function mergeFormFields(defaultFormFields: NormalisedFormField[], userFormFields: FormField[]): NormalisedFormField[];
+export declare function normaliseResetPasswordUsingTokenFeature(
+ signUpPasswordFieldValidate: (value: any) => Promise,
+ signUpEmailField: NormalisedFormField,
+ config?: ResetPasswordUsingTokenUserInput
+): NormalisedResetPasswordUsingTokenFeatureConfig;
+export declare function mergeFormFields(
+ defaultFormFields: NormalisedFormField[],
+ userFormFields: FormField[]
+): NormalisedFormField[];
export declare function getFormattedFormField(field: NormalisedFormField): NormalisedFormField;
diff --git a/lib/build/recipe/emailpassword/utils.js b/lib/build/recipe/emailpassword/utils.js
index bb5f52438..4f5e4edfd 100644
--- a/lib/build/recipe/emailpassword/utils.js
+++ b/lib/build/recipe/emailpassword/utils.js
@@ -158,6 +158,7 @@ var __generator =
Object.defineProperty(exports, "__esModule", { value: true });
var constants_1 = require("./constants");
var validators_1 = require("./validators");
+var utils_1 = require("../authRecipeModule/utils");
function normaliseEmailPasswordConfig(config) {
var signInAndUpFeature = normaliseSignInAndUpFeature(config.signInAndUpFeature);
var signUpPasswordField = signInAndUpFeature.signUpForm.formFields.find(function (field) {
@@ -171,10 +172,20 @@ function normaliseEmailPasswordConfig(config) {
signUpEmailField,
config.resetPasswordUsingTokenFeature
);
- return {
+ var override = __assign(
+ {
+ functions: function (originalImplementation) {
+ return originalImplementation;
+ },
+ components: {},
+ },
+ config.override
+ );
+ return __assign({}, utils_1.normaliseAuthRecipeModuleConfig(config), {
signInAndUpFeature: signInAndUpFeature,
resetPasswordUsingTokenFeature: resetPasswordUsingTokenFeature,
- };
+ override: override,
+ });
}
exports.normaliseEmailPasswordConfig = normaliseEmailPasswordConfig;
function normaliseSignInAndUpFeature(config) {
diff --git a/lib/build/recipe/emailpassword/utils.js.map b/lib/build/recipe/emailpassword/utils.js.map
index 59338aecc..56e40efc8 100644
--- a/lib/build/recipe/emailpassword/utils.js.map
+++ b/lib/build/recipe/emailpassword/utils.js.map
@@ -1 +1 @@
-{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../ts/recipe/emailpassword/utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,yCAA6D;AAe7D,2CAKsB;AAEtB,SAAgB,4BAA4B,CAAC,MAA2B;IACpE,IAAM,kBAAkB,GAAuC,2BAA2B,CACtF,MAAM,CAAC,kBAAkB,CAC5B,CAAC;IAEF,IAAM,mBAAmB,GAA6C,kBAAkB,CAAC,UAAU,CAAC,UAAU,CAA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C,CAAC,2BAA2B;gBACzE,qCAAqC;gBACrC,IAAI,SAAS,CAAC,QAAQ,KAAK,SAAS,EAAE;oBAClC,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC;iBACjC;gBAED,8CAA8C;gBAC9C,IAAI,0CAA8B,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE;oBACvD,QAAQ,GAAG,KAAK,CAAC;iBACpB;gBAED,SAAS;gBACT,gBAAgB,CAAC,CAAC,CAAC,gBACZ,gBAAgB,CAAC,CAAC,CAAC,EACnB,SAAS,IACZ,QAAQ,UAAA,GACX,CAAC;gBAEF,UAAU,GAAG,KAAK,CAAC;gBACnB,MAAM;aACT;SACJ;QAED,yCAAyC;QACzC,IAAI,UAAU,EAAE;YACZ,gBAAgB,CAAC,IAAI,YACjB,QAAQ,EAAE,KAAK,EACf,WAAW,EAAE,SAAS,CAAC,KAAK,EAC5B,QAAQ,EAAE,4BAAe,IACtB,SAAS,EACd,CAAC;SACN;KACJ;IAED,OAAO,gBAAgB,CAAC,GAAG,CAAC,UAAC,KAAK,IAAK,OAAA,qBAAqB,CAAC,KAAK,CAAC,EAA5B,CAA4B,CAAC,CAAC;AACzE,CAAC;AAtDD,0CAsDC;AAED,SAAgB,qBAAqB,CAAC,KAA0B;IAAhE,iBAYC;IAXG,oBACO,KAAK,IACR,QAAQ,EAAE,UAAO,KAAU;;;;wBACvB,qCAAqC;wBACrC,IAAI,KAAK,KAAK,EAAE,IAAI,KAAK,CAAC,QAAQ,KAAK,KAAK,EAAE;4BAC1C,sBAAO,uBAAuB,EAAC;yBAClC;wBAEM,qBAAM,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAA;4BAAlC,sBAAO,SAA2B,EAAC;;;aACtC,IACH;AACN,CAAC;AAZD,sDAYC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailpassword/validators.js b/lib/build/recipe/emailpassword/validators.js
index c326ba0c4..ad7d8ed16 100644
--- a/lib/build/recipe/emailpassword/validators.js
+++ b/lib/build/recipe/emailpassword/validators.js
@@ -153,6 +153,7 @@ function defaultEmailValidator(value) {
return [2 /*return*/, "Email must be of type string"];
}
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
diff --git a/lib/build/recipe/emailpassword/validators.js.map b/lib/build/recipe/emailpassword/validators.js.map
index faddccab1..cf2ad12b3 100644
--- a/lib/build/recipe/emailpassword/validators.js.map
+++ b/lib/build/recipe/emailpassword/validators.js.map
@@ -1 +1 @@
-{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../ts/recipe/emailpassword/validators.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AAEH,SAAsB,qBAAqB,CAAC,KAAU;;;;YAClD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;gBAC3B,sBAAO,8BAA8B,EAAC;aACzC;YAGK,2BAA2B,GAAG,yJAAyJ,CAAC;YAC9L,0CAA0C;YAC1C,+FAA+F;YAC/F,uDAAuD;YAEvD,IAAI,KAAK,CAAC,KAAK,CAAC,2BAA2B,CAAC,KAAK,IAAI,EAAE;gBACnD,sBAAO,kBAAkB,EAAC;aAC7B;YAED,sBAAO,SAAS,EAAC;;;CACpB;AAhBD,sDAgBC;AAED;;;;GAIG;AAEH,SAAsB,wBAAwB,CAAC,KAAU;;;YACrD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;gBAC3B,sBAAO,iCAAiC,EAAC;aAC5C;YAED,uBAAuB;YACvB,qCAAqC;YACrC,+FAA+F;YAE/F,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;gBAClB,sBAAO,iEAAiE,EAAC;aAC5E;YAED,IAAI,KAAK,CAAC,MAAM,IAAI,GAAG,EAAE;gBACrB,sBAAO,sDAAsD,EAAC;aACjE;YAED,IAAI,KAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,IAAI,EAAE;gBACzC,sBAAO,6CAA6C,EAAC;aACxD;YAED,IAAI,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,IAAI,EAAE;gBACtC,sBAAO,2CAA2C,EAAC;aACtD;YAED,sBAAO,SAAS,EAAC;;;CACpB;AA1BD,4DA0BC;AAED;;;GAGG;AAEH,SAAsB,6BAA6B,CAAC,KAAU;;;YAC1D,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;gBAC3B,sBAAO,iCAAiC,EAAC;aAC5C;YAED,sBAAO,SAAS,EAAC;;;CACpB;AAND,sEAMC;AAED;;GAEG;AACH,6DAA6D;AAC7D,SAAsB,eAAe,CAAC,CAAM;;;YACxC,sBAAO,SAAS,EAAC;;;CACpB;AAFD,0CAEC"}
\ No newline at end of file
+{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../ts/recipe/emailpassword/validators.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AAEH,SAAsB,qBAAqB,CAAC,KAAU;;;;YAClD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;gBAC3B,sBAAO,8BAA8B,EAAC;aACzC;YAEK,2BAA2B;YAC7B,6CAA6C;YAC7C,yJAAyJ,CAAC;YAC9J,0CAA0C;YAC1C,+FAA+F;YAC/F,uDAAuD;YAEvD,IAAI,KAAK,CAAC,KAAK,CAAC,2BAA2B,CAAC,KAAK,IAAI,EAAE;gBACnD,sBAAO,kBAAkB,EAAC;aAC7B;YAED,sBAAO,SAAS,EAAC;;;CACpB;AAjBD,sDAiBC;AAED;;;;GAIG;AAEH,SAAsB,wBAAwB,CAAC,KAAU;;;YACrD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;gBAC3B,sBAAO,iCAAiC,EAAC;aAC5C;YAED,uBAAuB;YACvB,qCAAqC;YACrC,+FAA+F;YAE/F,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;gBAClB,sBAAO,iEAAiE,EAAC;aAC5E;YAED,IAAI,KAAK,CAAC,MAAM,IAAI,GAAG,EAAE;gBACrB,sBAAO,sDAAsD,EAAC;aACjE;YAED,IAAI,KAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,IAAI,EAAE;gBACzC,sBAAO,6CAA6C,EAAC;aACxD;YAED,IAAI,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,IAAI,EAAE;gBACtC,sBAAO,2CAA2C,EAAC;aACtD;YAED,sBAAO,SAAS,EAAC;;;CACpB;AA1BD,4DA0BC;AAED;;;GAGG;AAEH,SAAsB,6BAA6B,CAAC,KAAU;;;YAC1D,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;gBAC3B,sBAAO,iCAAiC,EAAC;aAC5C;YAED,sBAAO,SAAS,EAAC;;;CACpB;AAND,sEAMC;AAED;;GAEG;AACH,6DAA6D;AAC7D,SAAsB,eAAe,CAAC,CAAM;;;YACxC,sBAAO,SAAS,EAAC;;;CACpB;AAFD,0CAEC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailverification/components/features/emailVerification/api.d.ts b/lib/build/recipe/emailverification/components/features/emailVerification/api.d.ts
deleted file mode 100644
index 6ea95fa1d..000000000
--- a/lib/build/recipe/emailverification/components/features/emailVerification/api.d.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import RecipeModule from "../../../../recipeModule";
-import { VerifyEmailThemeResponse, SendVerifyEmailThemeResponse } from "../../../types";
-export declare function verifyEmailAPI(recipe: RecipeModule, token: string): Promise;
-export declare function sendVerifyEmailAPI(recipe: RecipeModule): Promise;
-export declare function isEmailVerifiedAPI(recipe: RecipeModule): Promise;
diff --git a/lib/build/recipe/emailverification/components/features/emailVerification/api.js b/lib/build/recipe/emailverification/components/features/emailVerification/api.js
deleted file mode 100644
index daebc06f6..000000000
--- a/lib/build/recipe/emailverification/components/features/emailVerification/api.js
+++ /dev/null
@@ -1,242 +0,0 @@
-"use strict";
-/* 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 __awaiter =
- (this && this.__awaiter) ||
- function (thisArg, _arguments, P, generator) {
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) {
- try {
- step(generator.next(value));
- } catch (e) {
- reject(e);
- }
- }
- function rejected(value) {
- try {
- step(generator["throw"](value));
- } catch (e) {
- reject(e);
- }
- }
- function step(result) {
- result.done
- ? resolve(result.value)
- : new P(function (resolve) {
- resolve(result.value);
- }).then(fulfilled, rejected);
- }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
- };
-var __generator =
- (this && this.__generator) ||
- function (thisArg, body) {
- var _ = {
- label: 0,
- sent: function () {
- if (t[0] & 1) throw t[1];
- return t[1];
- },
- trys: [],
- ops: [],
- },
- f,
- y,
- t,
- g;
- return (
- (g = { next: verb(0), throw: verb(1), return: verb(2) }),
- typeof Symbol === "function" &&
- (g[Symbol.iterator] = function () {
- return this;
- }),
- g
- );
- function verb(n) {
- return function (v) {
- return step([n, v]);
- };
- }
- function step(op) {
- if (f) throw new TypeError("Generator is already executing.");
- while (_)
- try {
- if (
- ((f = 1),
- y &&
- (t =
- op[0] & 2
- ? y["return"]
- : op[0]
- ? y["throw"] || ((t = y["return"]) && t.call(y), 0)
- : y.next) &&
- !(t = t.call(y, op[1])).done)
- )
- return t;
- if (((y = 0), t)) op = [op[0] & 2, t.value];
- switch (op[0]) {
- case 0:
- case 1:
- t = op;
- break;
- case 4:
- _.label++;
- return { value: op[1], done: false };
- case 5:
- _.label++;
- y = op[1];
- op = [0];
- continue;
- case 7:
- op = _.ops.pop();
- _.trys.pop();
- continue;
- default:
- if (
- !((t = _.trys), (t = t.length > 0 && t[t.length - 1])) &&
- (op[0] === 6 || op[0] === 2)
- ) {
- _ = 0;
- continue;
- }
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
- _.label = op[1];
- break;
- }
- if (op[0] === 6 && _.label < t[1]) {
- _.label = t[1];
- t = op;
- break;
- }
- if (t && _.label < t[2]) {
- _.label = t[2];
- _.ops.push(op);
- break;
- }
- if (t[2]) _.ops.pop();
- _.trys.pop();
- continue;
- }
- op = body.call(thisArg, _);
- } catch (e) {
- op = [6, e];
- y = 0;
- } finally {
- f = t = 0;
- }
- if (op[0] & 5) throw op[1];
- return { value: op[0] ? op[1] : void 0, done: true };
- }
- };
-Object.defineProperty(exports, "__esModule", { value: true });
-var constants_1 = require("../../../../../constants");
-/*
- * Imports.
- */
-function verifyEmailAPI(recipe, token) {
- return __awaiter(this, void 0, void 0, function () {
- var response;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- return [
- 4 /*yield*/,
- recipe.httpRequest.post(
- "/user/email/verify",
- {
- body: JSON.stringify({
- method: "token",
- token: token,
- }),
- },
- "VERIFY_EMAIL"
- ),
- ];
- case 1:
- response = _a.sent();
- // Otherwise, if email verification invalid token error.
- if (response.status === "EMAIL_VERIFICATION_INVALID_TOKEN_ERROR") {
- return [
- 2 /*return*/,
- {
- status: "INVALID",
- },
- ];
- }
- // Otherwise, status === OK
- if (response.status === "OK") {
- return [
- 2 /*return*/,
- {
- status: "SUCCESSFUL",
- },
- ];
- }
- throw Error(constants_1.SOMETHING_WENT_WRONG_ERROR);
- }
- });
- });
-}
-exports.verifyEmailAPI = verifyEmailAPI;
-function sendVerifyEmailAPI(recipe) {
- return __awaiter(this, void 0, void 0, function () {
- var response;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- return [4 /*yield*/, recipe.httpRequest.post("/user/email/verify/token", {}, "SEND_VERIFY_EMAIL")];
- case 1:
- response = _a.sent();
- // If email already verified.
- if (response.status === "EMAIL_ALREADY_VERIFIED_ERROR") {
- return [
- 2 /*return*/,
- {
- status: "EMAIL_ALREADY_VERIFIED_ERROR",
- },
- ];
- }
- // Otherwise, success.
- if (response.status === "OK") {
- return [
- 2 /*return*/,
- {
- status: "OK",
- },
- ];
- }
- throw Error(constants_1.SOMETHING_WENT_WRONG_ERROR);
- }
- });
- });
-}
-exports.sendVerifyEmailAPI = sendVerifyEmailAPI;
-function isEmailVerifiedAPI(recipe) {
- return __awaiter(this, void 0, void 0, function () {
- var response;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- return [4 /*yield*/, recipe.httpRequest.get("/user/email/verify", {}, "IS_EMAIL_VERIFIED")];
- case 1:
- response = _a.sent();
- return [2 /*return*/, response.isVerified];
- }
- });
- });
-}
-exports.isEmailVerifiedAPI = isEmailVerifiedAPI;
-//# sourceMappingURL=api.js.map
diff --git a/lib/build/recipe/emailverification/components/features/emailVerification/api.js.map b/lib/build/recipe/emailverification/components/features/emailVerification/api.js.map
deleted file mode 100644
index 3d5ee5e5a..000000000
--- a/lib/build/recipe/emailverification/components/features/emailVerification/api.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailverification/components/features/emailVerification/api.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,sDAAsE;AAUtE;;GAEG;AAEH,SAAsB,cAAc,CACh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BAAO,QAAQ,CAAC,UAAU,EAAC;;;;CAC9B;AAPD,gDAOC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailverification/components/features/emailVerification/index.d.ts b/lib/build/recipe/emailverification/components/features/emailVerification/index.d.ts
index 4d5b660fd..80b6e5461 100644
--- a/lib/build/recipe/emailverification/components/features/emailVerification/index.d.ts
+++ b/lib/build/recipe/emailverification/components/features/emailVerification/index.d.ts
@@ -1,15 +1,20 @@
import { PureComponent } from "react";
-import EmailVerificationRecipe from "../../../";
+import { RecipeInterface } from "../../../types";
import { FeatureBaseProps } from "../../../../../types";
-import AuthRecipeModule from "../../../../authRecipeModule";
-declare class EmailVerification extends PureComponent {
- constructor(props: FeatureBaseProps);
- getAuthRecipeOrThrow: () => AuthRecipeModule;
- getRecipeInstanceOrThrow: () => EmailVerificationRecipe;
+import Recipe from "../../../recipe";
+declare type Prop = FeatureBaseProps & {
+ recipe: Recipe;
+};
+declare class EmailVerification extends PureComponent<
+ Prop,
+ {
+ status: "READY" | "LOADING";
+ token: string | undefined;
+ }
+> {
+ constructor(props: Prop);
signOut: () => Promise;
- onTokenInvalidRedirect: () => Promise;
+ getModifiedRecipeInterface: () => RecipeInterface;
componentDidMount(): Promise;
render: () => JSX.Element;
}
diff --git a/lib/build/recipe/emailverification/components/features/emailVerification/index.js b/lib/build/recipe/emailverification/components/features/emailVerification/index.js
index 0a7b4481f..1393fdffe 100644
--- a/lib/build/recipe/emailverification/components/features/emailVerification/index.js
+++ b/lib/build/recipe/emailverification/components/features/emailVerification/index.js
@@ -36,6 +36,20 @@ var __extends =
d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
};
})();
+var __assign =
+ (this && this.__assign) ||
+ function () {
+ __assign =
+ Object.assign ||
+ function (t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
+ }
+ return t;
+ };
+ return __assign.apply(this, arguments);
+ };
var __awaiter =
(this && this.__awaiter) ||
function (thisArg, _arguments, P, generator) {
@@ -187,16 +201,10 @@ var react_1 = require("@emotion/react");
var React = __importStar(require("react"));
var react_2 = require("react");
var utils_1 = require("../../../../../utils");
-var api_1 = require("./api");
var session_1 = __importDefault(require("../../../../session"));
-var superTokens_1 = __importDefault(require("../../../../../superTokens"));
var emailVerification_1 = require("../../themes/emailVerification");
-var utils_2 = require("../../../../authRecipeModule/utils");
var featureWrapper_1 = __importDefault(require("../../../../../components/featureWrapper"));
-var authRecipeModule_1 = __importDefault(require("../../../../authRecipeModule"));
-/*
- * Component.
- */
+var componentOverrideContext_1 = require("../../../../../components/componentOverride/componentOverrideContext");
var EmailVerification = /** @class */ (function (_super) {
__extends(EmailVerification, _super);
/*
@@ -204,35 +212,6 @@ var EmailVerification = /** @class */ (function (_super) {
*/
function EmailVerification(props) {
var _this = _super.call(this, props) || this;
- /*
- * Methods.
- */
- _this.getAuthRecipeOrThrow = function () {
- if (_this.props.recipeId === undefined) {
- throw new Error("No recipeId props given to EmailVerification component");
- }
- var recipe = superTokens_1.default.getInstanceOrThrow().getRecipeOrThrow(_this.props.recipeId);
- if (recipe instanceof authRecipeModule_1.default === false) {
- throw new Error(
- recipe.recipeId + " must be an instance of AuthRecipeModule to use EmailVerification component."
- );
- }
- return recipe;
- };
- _this.getRecipeInstanceOrThrow = function () {
- var recipe = _this.getAuthRecipeOrThrow();
- if (utils_2.isAuthRecipeModule(recipe)) {
- if (recipe.emailVerification === undefined) {
- throw new Error(
- recipe.recipeId + " must have EmailVerification enabled to use the EmailVerification component."
- );
- }
- return recipe.emailVerification;
- }
- throw new Error(
- _this.props.recipeId + " must be an instance of AuthRecipeModule to use EmailVerification component."
- );
- };
_this.signOut = function () {
return __awaiter(_this, void 0, void 0, function () {
var e_1;
@@ -240,16 +219,10 @@ var EmailVerification = /** @class */ (function (_super) {
switch (_a.label) {
case 0:
_a.trys.push([0, 3, , 4]);
- return [4 /*yield*/, this.getRecipeInstanceOrThrow().signOut()];
+ return [4 /*yield*/, this.props.recipe.config.signOut()];
case 1:
_a.sent();
- return [
- 4 /*yield*/,
- this.getRecipeInstanceOrThrow().redirect(
- { action: "SIGN_IN_AND_UP" },
- this.props.history
- ),
- ];
+ return [4 /*yield*/, this.props.recipe.config.redirectToSignIn(this.props.history)];
case 2:
return [2 /*return*/, _a.sent()];
case 3:
@@ -261,188 +234,127 @@ var EmailVerification = /** @class */ (function (_super) {
});
});
};
- _this.onTokenInvalidRedirect = function () {
- return __awaiter(_this, void 0, void 0, function () {
- var response, e_2;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- return [4 /*yield*/, session_1.default.doesSessionExist()];
- case 1:
- if (!(_a.sent() !== true)) return [3 /*break*/, 3];
- return [
- 4 /*yield*/,
- this.getRecipeInstanceOrThrow().redirect(
- { action: "SIGN_IN_AND_UP" },
- this.props.history
- ),
- ];
- case 2:
- return [2 /*return*/, _a.sent()];
- case 3:
- _a.trys.push([3, 7, , 8]);
- return [4 /*yield*/, api_1.sendVerifyEmailAPI(this.getRecipeInstanceOrThrow())];
- case 4:
- response = _a.sent();
- if (!(response.status === "EMAIL_ALREADY_VERIFIED_ERROR")) return [3 /*break*/, 6];
- return [
- 4 /*yield*/,
- this.getRecipeInstanceOrThrow().redirect(
- { action: "SUCCESS", isNewUser: false },
- this.props.history
- ),
- ];
- case 5:
- return [2 /*return*/, _a.sent()];
- case 6:
- return [3 /*break*/, 8];
- case 7:
- e_2 = _a.sent();
- return [3 /*break*/, 8];
- case 8:
- this.setState(function () {
- return {
- token: "",
- };
- });
- return [2 /*return*/];
- }
- });
- });
- };
- _this.render = function () {
- var sendVerifyEmailScreenFeature = _this.getRecipeInstanceOrThrow().config.sendVerifyEmailScreen;
- var sendVerifyEmailScreen = {
- styleFromInit: sendVerifyEmailScreenFeature.style,
- sendVerifyEmailAPI: function () {
+ _this.getModifiedRecipeInterface = function () {
+ return __assign({}, _this.props.recipe.recipeImpl, {
+ sendVerificationEmail: function (input) {
return __awaiter(_this, void 0, void 0, function () {
+ var response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
- return [4 /*yield*/, api_1.sendVerifyEmailAPI(this.getRecipeInstanceOrThrow())];
+ return [4 /*yield*/, this.props.recipe.recipeImpl.sendVerificationEmail(input)];
case 1:
- return [2 /*return*/, _a.sent()];
+ response = _a.sent();
+ this.setState(function () {
+ return {
+ token: undefined,
+ };
+ });
+ return [2 /*return*/, response];
}
});
});
},
+ });
+ };
+ _this.render = function () {
+ if (_this.state.status === "LOADING") {
+ return react_1.jsx(react_2.Fragment, null);
+ }
+ var componentOverrides = _this.props.recipe.config.override.components;
+ var sendVerifyEmailScreenFeature = _this.props.recipe.config.sendVerifyEmailScreen;
+ var sendVerifyEmailScreen = {
+ styleFromInit: sendVerifyEmailScreenFeature.style,
+ recipeImplementation: _this.getModifiedRecipeInterface(),
+ config: _this.props.recipe.config,
signOut: _this.signOut,
- onSuccess: function () {
- return _this.getRecipeInstanceOrThrow().hooks.onHandleEvent({
- action: "VERIFY_EMAIL_SENT",
- });
- },
onEmailAlreadyVerified: function () {
- return _this
- .getRecipeInstanceOrThrow()
- .redirect({ action: "SUCCESS", isNewUser: false }, _this.props.history);
- },
- };
- var verifyEmailLinkClickedScreenFeature =
- _this.getRecipeInstanceOrThrow().config.verifyEmailLinkClickedScreen;
- var verifyEmailLinkClickedScreen = {
- styleFromInit: verifyEmailLinkClickedScreenFeature.style,
- onTokenInvalidRedirect: _this.onTokenInvalidRedirect,
- onSuccess: function () {
- return _this.getRecipeInstanceOrThrow().hooks.onHandleEvent({
- action: "EMAIL_VERIFIED_SUCCESSFUL",
- });
- },
- onContinueClicked: function () {
- return _this.getRecipeInstanceOrThrow().redirect({ action: "SUCCESS" }, _this.props.history);
- },
- verifyEmailAPI: function () {
return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- return [
- 4 /*yield*/,
- api_1.verifyEmailAPI(this.getRecipeInstanceOrThrow(), this.state.token),
- ];
- case 1:
- return [2 /*return*/, _a.sent()];
- }
+ return [
+ 2 /*return*/,
+ this.props.recipe.config.postVerificationRedirect(this.props.history),
+ ];
});
});
},
};
- var hasToken = _this.state.token.length !== 0;
- /*
- * Render.
- */
+ var verifyEmailLinkClickedScreenFeature = _this.props.recipe.config.verifyEmailLinkClickedScreen;
+ var verifyEmailLinkClickedScreen =
+ _this.state.token === undefined
+ ? undefined
+ : {
+ styleFromInit: verifyEmailLinkClickedScreenFeature.style,
+ onTokenInvalidRedirect: function () {
+ return __awaiter(_this, void 0, void 0, function () {
+ return __generator(this, function (_a) {
+ this.props.recipe.config.redirectToSignIn(this.props.history);
+ return [2 /*return*/];
+ });
+ });
+ },
+ onContinueClicked: function () {
+ return _this.props.recipe.config.postVerificationRedirect(_this.props.history);
+ },
+ recipeImplementation: _this.getModifiedRecipeInterface(),
+ config: _this.props.recipe.config,
+ token: _this.state.token,
+ };
+ var props = {
+ config: _this.props.recipe.config,
+ sendVerifyEmailScreen: sendVerifyEmailScreen,
+ verifyEmailLinkClickedScreen: verifyEmailLinkClickedScreen,
+ hasToken: _this.state.token !== undefined,
+ };
return react_1.jsx(
- featureWrapper_1.default,
- { useShadowDom: _this.getAuthRecipeOrThrow().config.useShadowDom },
+ componentOverrideContext_1.ComponentOverrideContext.Provider,
+ { value: componentOverrides },
react_1.jsx(
- react_2.Fragment,
- null,
- _this.props.children === undefined &&
- react_1.jsx(emailVerification_1.EmailVerificationTheme, {
- rawPalette: _this.getRecipeInstanceOrThrow().config.palette,
- sendVerifyEmailScreen: sendVerifyEmailScreen,
- verifyEmailLinkClickedScreen: verifyEmailLinkClickedScreen,
- hasToken: hasToken,
- }),
- _this.props.children &&
- React.cloneElement(_this.props.children, {
- rawPalette: _this.getRecipeInstanceOrThrow().config.palette,
- sendVerifyEmailScreen: sendVerifyEmailScreen,
- verifyEmailLinkClickedScreen: verifyEmailLinkClickedScreen,
- hasToken: hasToken,
- })
+ featureWrapper_1.default,
+ { useShadowDom: _this.props.recipe.config.useShadowDom },
+ react_1.jsx(
+ react_2.Fragment,
+ null,
+ _this.props.children === undefined &&
+ react_1.jsx(emailVerification_1.EmailVerificationTheme, __assign({}, props)),
+ _this.props.children && React.cloneElement(_this.props.children, props)
+ )
)
);
};
var urlParams = new URLSearchParams(utils_1.getWindowOrThrow().location.search);
var token = urlParams.get("token");
if (token === null) {
- token = "";
+ _this.state = {
+ status: "LOADING",
+ token: undefined,
+ };
+ } else {
+ _this.state = {
+ status: "LOADING",
+ token: token,
+ };
}
- _this.state = {
- token: token,
- };
return _this;
}
EmailVerification.prototype.componentDidMount = function () {
return __awaiter(this, void 0, void 0, function () {
- var hasToken, sessionExists, response, e_3;
+ var sessionExists;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
- hasToken = this.state.token.length !== 0;
+ if (!(this.state.token === undefined)) return [3 /*break*/, 3];
return [4 /*yield*/, session_1.default.doesSessionExist()];
case 1:
sessionExists = _a.sent();
- if (!(sessionExists === false && hasToken === false)) return [3 /*break*/, 3];
- return [
- 4 /*yield*/,
- this.getRecipeInstanceOrThrow().redirect({ action: "SIGN_IN_AND_UP" }, this.props.history),
- ];
+ if (!(sessionExists === false)) return [3 /*break*/, 3];
+ return [4 /*yield*/, this.props.recipe.config.redirectToSignIn(this.props.history)];
case 2:
return [2 /*return*/, _a.sent()];
case 3:
- _a.trys.push([3, 7, , 8]);
- if (!(hasToken === false)) return [3 /*break*/, 6];
- return [4 /*yield*/, api_1.sendVerifyEmailAPI(this.getRecipeInstanceOrThrow())];
- case 4:
- response = _a.sent();
- if (!(response.status === "EMAIL_ALREADY_VERIFIED_ERROR")) return [3 /*break*/, 6];
- return [
- 4 /*yield*/,
- this.getRecipeInstanceOrThrow().redirect(
- { action: "SUCCESS", isNewUser: false },
- this.props.history
- ),
- ];
- case 5:
- return [2 /*return*/, _a.sent()];
- case 6:
- return [3 /*break*/, 8];
- case 7:
- e_3 = _a.sent();
- return [3 /*break*/, 8];
- case 8:
+ this.setState(function (oldState) {
+ return __assign({}, oldState, { status: "READY" });
+ });
return [2 /*return*/];
}
});
diff --git a/lib/build/recipe/emailverification/components/features/emailVerification/index.js.map b/lib/build/recipe/emailverification/components/features/emailVerification/index.js.map
index f789899b4..a9bd9e8c1 100644
--- a/lib/build/recipe/emailverification/components/features/emailVerification/index.js.map
+++ b/lib/build/recipe/emailverification/components/features/emailVerification/index.js.map
@@ -1 +1 @@
-{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailverification/components/features/emailVerification/index.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH,eAAe;AACf,wCAAqC;AACrC,2CAA+B;AAC/B,+BAAgD;AAEhD,8CAAwD;AACxD,6BAA2D;AAC3D,gEAA0C;AAC1C,2EAAqD;AAErD,oEAAwE;AAExE,4DAAwE;AACxE,4FAAsE;AACtE,kFAA4D;AAE5D;;GAEG;AAEH;IAA4C,qCAAkD;IAC1F;;OAEG;IACH,2BAAY,KAAuB;QAAnC,YACI,kBAAM,KAAK,CAAC,SAWf;QAED;;WAEG;QAEH,0BAAoB,GAAG;YACnB,IAAI,KAAI,CAAC,KAAK,CAAC,QAAQ,KAAK,SAAS,EAAE;gBACnC,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;aAC7E;YAED,IAAM,MAAM,GAAG,qBAAW,CAAC,kBAAkB,EAAE,CAAC,gBAAgB,CAAC,KAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YACtF,IAAI,MAAM,YAAY,0BAAgB,KAAK,KAAK,EAAE;gBAC9C,MAAM,IAAI,KAAK,CACR,MAAM,CAAC,QAAQ,iFAA8E,CACnG,CAAC;aACL;YAED,OAAO,MAAsC,CAAC;QAClD,CAAC,CAAC;QAEF,8BAAwB,GAAG;YACvB,IAAM,MAAM,GAAG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AS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACnC,IAAI,KAAK,KAAK,IAAI,EAAE;YAChB,KAAK,GAAG,EAAE,CAAC;SACd;QAED,KAAI,CAAC,KAAK,GAAG;YACT,KAAK,OAAA;SACR,CAAC;;IACN,CAAC;IAgEK,6CAAiB,GAAvB;;;;;;wBACU,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;wBAGzB,qBAAM,iBAAO,CAAC,gBAAgB,EAAE,EAAA;;wBAAhD,aAAa,GAAG,SAAgC;6BAClD,CAAA,aAAa,KAAK,KAAK,IAAI,QAAQ,KAAK,KAAK,CAAA,EAA7C,wBAA6C;wBACtC,qBAAM,IAAI,CAAC,wBAAwB,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,gBAAgB,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAA;4BAAvG,sBAAO,SAAgG,EAAC;;;6BAIpG,CAAA,QAAQ,KAAK,KAAK,CAAA,EAAlB,wBAAkB;wBACD,qBAAM,wBAAkB,CAAC,IAAI,CAAC,wBAAwB,EAAE,CAAC,EAAA;;wBAApE,QAAQ,GAAG,SAAyD;6BACtE,CAAA,QAAQ,CAAC,MAAM,KAAK,8BAA8B,CAAA,EAAlD,wBAAkD;wBAC3C,qBAAM,IAAI,CAAC,wBAAwB,EAAE,CAAC,QAAQ,CACjD,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,EACvC,IAAI,CAAC,KAAK,CAAC,OAAO,CACrB,EAAA;4BAHD,sBAAO,SAGN,EAAC;;;;;;;;;KAIjB;IA4DL,wBAAC;AAAD,CAAC,AAhKD,CAA4C,qBAAa,GAgKxD;AAED,kBAAe,iBAAiB,CAAC"}
\ No newline at end of file
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailverification/components/features/emailVerification/index.tsx"],"names":[],"mappings":";AAA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a,KAAK,KAAK,CAAA,EAAvB,wBAAuB;wBAChB,qBAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAA;4BAA1E,sBAAO,SAAmE,EAAC;;wBAInF,IAAI,CAAC,QAAQ,CAAC,UAAC,QAAQ;4BACnB,oBACO,QAAQ,IACX,MAAM,EAAE,OAAO,IACjB;wBACN,CAAC,CAAC,CAAC;;;;;KACN;IAuDL,wBAAC;AAAD,CAAC,AAlHD,CAAgC,qBAAa,GAkH5C;AAED,kBAAe,iBAAiB,CAAC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailverification/components/themes/emailVerification/index.js b/lib/build/recipe/emailverification/components/themes/emailVerification/index.js
index 91acc742f..f3b5c441e 100644
--- a/lib/build/recipe/emailverification/components/themes/emailVerification/index.js
+++ b/lib/build/recipe/emailverification/components/themes/emailVerification/index.js
@@ -36,11 +36,6 @@ var __importStar =
result["default"] = mod;
return result;
};
-var __importDefault =
- (this && this.__importDefault) ||
- function (mod) {
- return mod && mod.__esModule ? mod : { default: mod };
- };
Object.defineProperty(exports, "__esModule", { value: true });
/*
* Imports.
@@ -50,8 +45,8 @@ var styleContext_1 = require("../../../../../styles/styleContext");
var styles_1 = require("../../../../../styles/styles");
var styles_2 = require("../../../../emailpassword/components/themes/styles/styles");
var themeBase_1 = require("../../../../emailpassword/components/themes/themeBase");
-var sendVerifyEmail_1 = __importDefault(require("./sendVerifyEmail"));
-var verifyEmailLinkClicked_1 = __importDefault(require("./verifyEmailLinkClicked"));
+var sendVerifyEmail_1 = require("./sendVerifyEmail");
+var verifyEmailLinkClicked_1 = require("./verifyEmailLinkClicked");
/*
* Component.
*/
@@ -60,28 +55,31 @@ function EmailVerificationTheme(props) {
* Render.
*/
// If no token, return SendVerifyEmail.
- if (props.hasToken === false) {
+ if (props.verifyEmailLinkClickedScreen === undefined) {
return React.createElement(
styleContext_1.StyleProvider,
{
- rawPalette: props.rawPalette,
+ rawPalette: props.config.palette,
defaultPalette: styles_1.defaultPalette,
styleFromInit: props.sendVerifyEmailScreen.styleFromInit,
getDefaultStyles: styles_2.getStyles,
},
- React.createElement(sendVerifyEmail_1.default, __assign({}, props.sendVerifyEmailScreen))
+ React.createElement(sendVerifyEmail_1.SendVerifyEmail, __assign({}, props.sendVerifyEmailScreen))
);
}
// Otherwise, return VerifyEmailLinkClicked.
return React.createElement(
styleContext_1.StyleProvider,
{
- rawPalette: props.rawPalette,
+ rawPalette: props.config.palette,
defaultPalette: styles_1.defaultPalette,
styleFromInit: props.verifyEmailLinkClickedScreen.styleFromInit,
getDefaultStyles: styles_2.getStyles,
},
- React.createElement(verifyEmailLinkClicked_1.default, __assign({}, props.verifyEmailLinkClickedScreen))
+ React.createElement(
+ verifyEmailLinkClicked_1.VerifyEmailLinkClicked,
+ __assign({}, props.verifyEmailLinkClickedScreen)
+ )
);
}
exports.EmailVerificationTheme = EmailVerificationTheme;
diff --git a/lib/build/recipe/emailverification/components/themes/emailVerification/index.js.map b/lib/build/recipe/emailverification/components/themes/emailVerification/index.js.map
index dd4f3bc4f..ed43fafce 100644
--- a/lib/build/recipe/emailverification/components/themes/emailVerification/index.js.map
+++ b/lib/build/recipe/emailverification/components/themes/emailVerification/index.js.map
@@ -1 +1 @@
-{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailverification/components/themes/emailVerification/index.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH,2CAA+B;AAC/B,mEAAmE;AACnE,uDAA8D;AAC9D,oFAAsF;AACtF,mFAAkF;AAElF,sEAAgD;AAChD,oFAA8D;AAE9D;;GAEG;AAEH,SAAgB,sBAAsB,CAAC,KAAkC;IACrE;;OAEG;IAEH,uCAAuC;IACvC,IAAI,KAAK,CAAC,QAAQ,KAAK,KAAK,EAAE;QAC1B,OAAO,CACH,oBAAC,4BAAa,IACV,UAAU,EAAE,KAAK,CAAC,UAAU,EAC5B,cAAc,EAAE,uBAAc,EAC9B,aAAa,EAAE,KAAK,CAAC,qBAAqB,CAAC,aAAa,EACxD,gBAAgB,EAAE,kBAAS;YAC3B,oBAAC,yBAAe,eAAK,KAAK,CAAC,qBAAqB,EAAI,CACxC,CACnB,CAAC;KACL;IAED,4CAA4C;IAC5C,OAAO,CACH,oBAAC,4BAAa,IACV,UAAU,EAAE,KAAK,CAAC,UAAU,EAC5B,cAAc,EAAE,uBAAc,EAC9B,aAAa,EAAE,KAAK,CAAC,4BAA4B,CAAC,aAAa,EAC/D,gBAAgB,EAAE,kBAAS;QAC3B,oBAAC,gCAAsB,eAAK,KAAK,CAAC,4BAA4B,EAAI,CACtD,CACnB,CAAC;AACN,CAAC;AA5BD,wDA4BC;AAED,SAAS,6BAA6B,CAAC,KAAkC;IACrE,OAAO,CACH,oBAAC,qBAAS;QACN,oBAAC,sBAAsB,eAAK,KAAK,EAAI,CAC7B,CACf,CAAC;AACN,CAAC;AAED,kBAAe,6BAA6B,CAAC"}
\ No newline at end of file
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailverification/components/themes/emailVerification/index.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH,2CAA+B;AAC/B,mEAAmE;AACnE,uDAA8D;AAC9D,oFAAsF;AACtF,mFAAkF;AAElF,qDAAoD;AACpD,mEAAkE;AAElE;;GAEG;AAEH,SAAgB,sBAAsB,CAAC,KAAkC;IACrE;;OAEG;IAEH,uCAAuC;IACvC,IAAI,KAAK,CAAC,4BAA4B,KAAK,SAAS,EAAE;QAClD,OAAO,CACH,oBAAC,4BAAa,IACV,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,EAChC,cAAc,EAAE,uBAAc,EAC9B,aAAa,EAAE,KAAK,CAAC,qBAAqB,CAAC,aAAa,EACxD,gBAAgB,EAAE,kBAAS;YAC3B,oBAAC,iCAAe,eAAK,KAAK,CAAC,qBAAqB,EAAI,CACxC,CACnB,CAAC;KACL;IAED,4CAA4C;IAC5C,OAAO,CACH,oBAAC,4BAAa,IACV,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,EAChC,cAAc,EAAE,uBAAc,EAC9B,aAAa,EAAE,KAAK,CAAC,4BAA4B,CAAC,aAAa,EAC/D,gBAAgB,EAAE,kBAAS;QAC3B,oBAAC,+CAAsB,eAAK,KAAK,CAAC,4BAA4B,EAAI,CACtD,CACnB,CAAC;AACN,CAAC;AA5BD,wDA4BC;AAED,SAAS,6BAA6B,CAAC,KAAkC;IACrE,OAAO,CACH,oBAAC,qBAAS;QACN,oBAAC,sBAAsB,eAAK,KAAK,EAAI,CAC7B,CACf,CAAC;AACN,CAAC;AAED,kBAAe,6BAA6B,CAAC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailverification/components/themes/emailVerification/sendVerifyEmail.d.ts b/lib/build/recipe/emailverification/components/themes/emailVerification/sendVerifyEmail.d.ts
index 63d5de7ae..c5ab62af2 100644
--- a/lib/build/recipe/emailverification/components/themes/emailVerification/sendVerifyEmail.d.ts
+++ b/lib/build/recipe/emailverification/components/themes/emailVerification/sendVerifyEmail.d.ts
@@ -1,14 +1,4 @@
-///
-import { PureComponent } from "react";
-import { SendVerifyEmailThemeState } from "../../../../emailpassword/types";
+/** @jsx jsx */
+import { jsx } from "@emotion/react";
import { SendVerifyEmailThemeProps } from "../../../types";
-export default class SendVerifyEmail extends PureComponent {
- static contextType: import("react").Context<{
- [x: string]: import("@emotion/serialize").CSSObject;
- palette: import("../../../../../types").NormalisedPalette;
- }>;
- constructor(props: SendVerifyEmailThemeProps);
- onSuccess: () => void;
- sendEmail: () => Promise;
- render(): JSX.Element;
-}
+export declare const SendVerifyEmail: (props: SendVerifyEmailThemeProps) => jsx.JSX.Element;
diff --git a/lib/build/recipe/emailverification/components/themes/emailVerification/sendVerifyEmail.js b/lib/build/recipe/emailverification/components/themes/emailVerification/sendVerifyEmail.js
index cd27e334a..cf1469ed7 100644
--- a/lib/build/recipe/emailverification/components/themes/emailVerification/sendVerifyEmail.js
+++ b/lib/build/recipe/emailverification/components/themes/emailVerification/sendVerifyEmail.js
@@ -180,59 +180,46 @@ var constants_1 = require("../../../../../constants");
var styleContext_1 = __importDefault(require("../../../../../styles/styleContext"));
var arrowRightIcon_1 = __importDefault(require("../../../../../components/assets/arrowRightIcon"));
var emailLargeIcon_1 = __importDefault(require("../../../../../components/assets/emailLargeIcon"));
+var withOverride_1 = require("../../../../../components/componentOverride/withOverride");
/*
* Component.
*/
-var SendVerifyEmail = /** @class */ (function (_super) {
- __extends(SendVerifyEmail, _super);
- /*
- * Constructor.
- */
- function SendVerifyEmail(props) {
+var EmailVerificationSendVerifyEmail = /** @class */ (function (_super) {
+ __extends(EmailVerificationSendVerifyEmail, _super);
+ function EmailVerificationSendVerifyEmail(props) {
var _this = _super.call(this, props) || this;
- /*
- * Methods.
- */
- _this.onSuccess = function () {
- _this.setState(function () {
- return {
- status: "SUCCESS",
- };
- });
- _this.props.onSuccess();
- };
- _this.sendEmail = function () {
+ _this.resendEmail = function () {
return __awaiter(_this, void 0, void 0, function () {
- var _a, sendVerifyEmailAPI, onEmailAlreadyVerified, response, e_1;
- return __generator(this, function (_b) {
- switch (_b.label) {
+ var response, e_1;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
case 0:
- (_a = this.props),
- (sendVerifyEmailAPI = _a.sendVerifyEmailAPI),
- (onEmailAlreadyVerified = _a.onEmailAlreadyVerified);
- _b.label = 1;
+ _a.trys.push([0, 2, , 3]);
+ return [
+ 4 /*yield*/,
+ this.props.recipeImplementation.sendVerificationEmail({
+ config: this.props.config,
+ }),
+ ];
case 1:
- _b.trys.push([1, 3, , 4]);
- return [4 /*yield*/, sendVerifyEmailAPI()];
- case 2:
- response = _b.sent();
+ response = _a.sent();
if (response.status === "EMAIL_ALREADY_VERIFIED_ERROR") {
- return [2 /*return*/, onEmailAlreadyVerified()];
- }
- if (response.status === "OK") {
- this.setState({
- status: "SUCCESS",
+ this.props.onEmailAlreadyVerified();
+ } else if (response.status === "OK") {
+ this.setState(function () {
+ return {
+ status: "EMAIL_RESENT",
+ };
});
- return [2 /*return*/];
}
- return [3 /*break*/, 4];
- case 3:
- e_1 = _b.sent();
+ return [3 /*break*/, 3];
+ case 2:
+ e_1 = _a.sent();
this.setState({
status: "ERROR",
});
- return [3 /*break*/, 4];
- case 4:
+ return [3 /*break*/, 3];
+ case 3:
return [2 /*return*/];
}
});
@@ -243,10 +230,29 @@ var SendVerifyEmail = /** @class */ (function (_super) {
};
return _this;
}
- /*
- * Render.
- */
- SendVerifyEmail.prototype.render = function () {
+ EmailVerificationSendVerifyEmail.prototype.componentDidMount = function () {
+ return __awaiter(this, void 0, void 0, function () {
+ var response;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ return [
+ 4 /*yield*/,
+ this.props.recipeImplementation.sendVerificationEmail({
+ config: this.props.config,
+ }),
+ ];
+ case 1:
+ response = _a.sent();
+ if (response.status === "EMAIL_ALREADY_VERIFIED_ERROR") {
+ this.props.onEmailAlreadyVerified();
+ }
+ return [2 /*return*/];
+ }
+ });
+ });
+ };
+ EmailVerificationSendVerifyEmail.prototype.render = function () {
var styles = this.context;
var signOut = this.props.signOut;
var status = this.state.status;
@@ -262,7 +268,7 @@ var SendVerifyEmail = /** @class */ (function (_super) {
{ "data-supertokens": "generalError", css: styles.generalError },
constants_1.SOMETHING_WENT_WRONG_ERROR
),
- status === "SUCCESS" &&
+ status === "EMAIL_RESENT" &&
react_1.jsx(
"div",
{ "data-supertokens": "generalSuccess", css: styles.generalSuccess },
@@ -290,13 +296,13 @@ var SendVerifyEmail = /** @class */ (function (_super) {
react_1.jsx("strong", null, "Please click on the link"),
" in the email we just sent you to confirm your email address."
),
- status !== "SUCCESS" &&
+ status !== "EMAIL_RESENT" &&
react_1.jsx(
"div",
{
"data-supertokens": "link sendVerifyEmailResend",
css: [styles.link, styles.sendVerifyEmailResend],
- onClick: this.sendEmail,
+ onClick: this.resendEmail,
},
"Resend Email"
),
@@ -315,8 +321,11 @@ var SendVerifyEmail = /** @class */ (function (_super) {
)
);
};
- SendVerifyEmail.contextType = styleContext_1.default;
- return SendVerifyEmail;
+ EmailVerificationSendVerifyEmail.contextType = styleContext_1.default;
+ return EmailVerificationSendVerifyEmail;
})(react_2.PureComponent);
-exports.default = SendVerifyEmail;
+exports.SendVerifyEmail = withOverride_1.withOverride(
+ "EmailVerificationSendVerifyEmail",
+ EmailVerificationSendVerifyEmail
+);
//# sourceMappingURL=sendVerifyEmail.js.map
diff --git a/lib/build/recipe/emailverification/components/themes/emailVerification/sendVerifyEmail.js.map b/lib/build/recipe/emailverification/components/themes/emailVerification/sendVerifyEmail.js.map
index a4a776334..a5abb49e3 100644
--- a/lib/build/recipe/emailverification/components/themes/emailVerification/sendVerifyEmail.js.map
+++ b/lib/build/recipe/emailverification/components/themes/emailVerification/sendVerifyEmail.js.map
@@ -1 +1 @@
-{"version":3,"file":"sendVerifyEmail.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailverification/components/themes/emailVerification/sendVerifyEmail.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;AACH;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,eAAe;AACf,wCAAqC;AACrC,+BAAsC;AACtC,sDAAsE;AAEtE,oFAA8D;AAC9D,mGAA6E;AAC7E,mGAA6E;AAI7E;;GAEG;AAEH;IAA6C,mCAAmE;IAE5G;;OAEG;IACH,yBAAY,KAAgC;QAA5C,YACI,kBAAM,KAAK,CAAC,SAIf;QAED;;WAEG;QAEH,eAAS,GAAG;YACR,KAAI,CAAC,QAAQ,CAAC,cAAM,OAAA,CAAC;gBACjB,MAAM,EAAE,SAAS;aACpB,CAAC,EAFkB,CAElB,CAAC,CAAC;YACJ,KA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6B,EAC9C,GAAG,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,eAAe,CAAC,gCAE/C;gBACN,yCACqB,iCAAiC,EAClD,GAAG,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,mBAAmB,CAAC;oBACrD,uDAAyC;oFAEvC;gBACL,MAAM,KAAK,SAAS,IAAI,CACrB,yCACqB,4BAA4B,EAC7C,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,qBAAqB,CAAC,EAChD,OAAO,EAAE,IAAI,CAAC,SAAS,mBAErB,CACT;gBAEG,yCACqB,sCAAsC,EACvD,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,sBAAsB,CAAC,EAC1D,OAAO,EAAE,cAAM,OAAA,OAAO,EAAE,EAAT,CAAS;;oBACjB,YAAC,wBAAc,IAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,GAAI,CACjE,CAER,CACJ,CACT,CAAC;IACN,CAAC;IAlGM,2BAAW,GAAG,sBAAY,CAAC;IAmGtC,sBAAC;CAAA,AApGD,CAA6C,qBAAa,GAoGzD;kBApGoB,eAAe"}
\ No newline at end of file
+{"version":3,"file":"sendVerifyEmail.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailverification/components/themes/emailVerification/sendVerifyEmail.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;AACH;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,eAAe;AACf,wCAAqC;AACrC,+BAAsC;AACtC,sDAAsE;AAEtE,oFAA8D;AAC9D,mGAA6E;AAC7E,mGAA6E;AAE7E,yFAAwF;AAExF;;GAEG;AAEH;IAA+C,oDAG9C;IAGG,0CAAY,KAAgC;QAA5C,YACI,kBAAM,KAAK,CAAC,SAIf;QAED,iBAAW,GAAG;;;;;;wBAEW,qBAAM,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AE,MAAM,CAAC,YAAY,IACxD,sCAA0B,CACzB,CACT;gBACA,MAAM,KAAK,cAAc,IAAI,CAC1B,yCAAsB,gBAAgB,EAAC,GAAG,EAAE,MAAM,CAAC,cAAc,mBAE3D,CACT;gBACD,yCAAsB,qBAAqB,EAAC,GAAG,EAAE,MAAM,CAAC,mBAAmB;oBACvE,YAAC,wBAAc,OAAG,CAChB;gBACN,yCACqB,6BAA6B,EAC9C,GAAG,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,eAAe,CAAC,gCAE/C;gBACN,yCACqB,iCAAiC,EAClD,GAAG,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,mBAAmB,CAAC;oBACrD,uDAAyC;oFAEvC;gBACL,MAAM,KAAK,cAAc,IAAI,CAC1B,yCACqB,4BAA4B,EAC7C,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,qBAAqB,CAAC,EAChD,OAAO,EAAE,IAAI,CAAC,WAAW,mBAEvB,CACT;gBAEG,yCACqB,sCAAsC,EACvD,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,sBAAsB,CAAC,EAC1D,OAAO,EAAE,cAAM,OAAA,OAAO,EAAE,EAAT,CAAS;;oBACjB,YAAC,wBAAc,IAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,GAAI,CACjE,CAER,CACJ,CACT,CAAC;IACN,CAAC;IA3FM,4CAAW,GAAG,sBAAY,CAAC;IA4FtC,uCAAC;CAAA,AAhGD,CAA+C,qBAAa,GAgG3D;AAEY,QAAA,eAAe,GAAG,2BAAY,CAAC,kCAAkC,EAAE,gCAAgC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailverification/components/themes/emailVerification/verifyEmailLinkClicked.d.ts b/lib/build/recipe/emailverification/components/themes/emailVerification/verifyEmailLinkClicked.d.ts
index 82ba114a3..e4a54d785 100644
--- a/lib/build/recipe/emailverification/components/themes/emailVerification/verifyEmailLinkClicked.d.ts
+++ b/lib/build/recipe/emailverification/components/themes/emailVerification/verifyEmailLinkClicked.d.ts
@@ -1,13 +1,4 @@
-///
-import { PureComponent } from "react";
-import { VerifyEmailLinkClickedThemeProps, VerifyEmailLinkClickedThemeState } from "../../../types";
-export default class VerifyEmailLinkClicked extends PureComponent {
- static contextType: import("react").Context<{
- [x: string]: import("@emotion/serialize").CSSObject;
- palette: import("../../../../../types").NormalisedPalette;
- }>;
- constructor(props: VerifyEmailLinkClickedThemeProps);
- onSuccess: () => void;
- componentDidMount: () => Promise;
- render(): JSX.Element;
-}
+/** @jsx jsx */
+import { jsx } from "@emotion/react";
+import { VerifyEmailLinkClickedThemeProps } from "../../../types";
+export declare const VerifyEmailLinkClicked: (props: VerifyEmailLinkClickedThemeProps) => jsx.JSX.Element;
diff --git a/lib/build/recipe/emailverification/components/themes/emailVerification/verifyEmailLinkClicked.js b/lib/build/recipe/emailverification/components/themes/emailVerification/verifyEmailLinkClicked.js
index 38252be6e..eacfc22f3 100644
--- a/lib/build/recipe/emailverification/components/themes/emailVerification/verifyEmailLinkClicked.js
+++ b/lib/build/recipe/emailverification/components/themes/emailVerification/verifyEmailLinkClicked.js
@@ -182,63 +182,64 @@ var errorLargeIcon_1 = __importDefault(require("../../../../../components/assets
var spinnerIcon_1 = __importDefault(require("../../../../../components/assets/spinnerIcon"));
var styleContext_1 = __importDefault(require("../../../../../styles/styleContext"));
var library_1 = require("../../../../emailpassword/components/library");
+var withOverride_1 = require("../../../../../components/componentOverride/withOverride");
/*
* Component.
*/
-var VerifyEmailLinkClicked = /** @class */ (function (_super) {
- __extends(VerifyEmailLinkClicked, _super);
- /*
- * Constructor.
- */
- function VerifyEmailLinkClicked(props) {
+var EmailVerificationVerifyEmailLinkClicked = /** @class */ (function (_super) {
+ __extends(EmailVerificationVerifyEmailLinkClicked, _super);
+ function EmailVerificationVerifyEmailLinkClicked(props) {
var _this = _super.call(this, props) || this;
- _this.onSuccess = function () {
- _this.setState(function () {
- return {
- status: "SUCCESSFUL",
- };
- });
- _this.props.onSuccess();
+ _this.state = {
+ status: "LOADING",
};
- _this.componentDidMount = function () {
- return __awaiter(_this, void 0, void 0, function () {
- var response_1, e_1;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- _a.trys.push([0, 2, , 3]);
- return [4 /*yield*/, this.props.verifyEmailAPI()];
- case 1:
- response_1 = _a.sent();
+ return _this;
+ }
+ EmailVerificationVerifyEmailLinkClicked.prototype.componentDidMount = function () {
+ return __awaiter(this, void 0, void 0, function () {
+ var response, e_1;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ _a.trys.push([0, 2, , 3]);
+ return [
+ 4 /*yield*/,
+ this.props.recipeImplementation.verifyEmail({
+ config: this.props.config,
+ token: this.props.token,
+ }),
+ ];
+ case 1:
+ response = _a.sent();
+ if (response.status === "EMAIL_VERIFICATION_INVALID_TOKEN_ERROR") {
this.setState(function () {
return {
- status: response_1.status,
+ status: "INVALID",
};
});
- return [3 /*break*/, 3];
- case 2:
- e_1 = _a.sent();
+ } else {
this.setState(function () {
return {
- status: "GENERAL_ERROR",
+ status: "SUCCESSFUL",
};
});
- return [3 /*break*/, 3];
- case 3:
- return [2 /*return*/];
- }
- });
+ }
+ return [3 /*break*/, 3];
+ case 2:
+ e_1 = _a.sent();
+ this.setState(function () {
+ return {
+ status: "GENERAL_ERROR",
+ };
+ });
+ return [3 /*break*/, 3];
+ case 3:
+ return [2 /*return*/];
+ }
});
- };
- _this.state = {
- status: "LOADING",
- };
- return _this;
- }
- /*
- * Render.
- */
- VerifyEmailLinkClicked.prototype.render = function () {
+ });
+ };
+ EmailVerificationVerifyEmailLinkClicked.prototype.render = function () {
var styles = this.context;
var status = this.state.status;
var _a = this.props,
@@ -339,8 +340,11 @@ var VerifyEmailLinkClicked = /** @class */ (function (_super) {
)
);
};
- VerifyEmailLinkClicked.contextType = styleContext_1.default;
- return VerifyEmailLinkClicked;
+ EmailVerificationVerifyEmailLinkClicked.contextType = styleContext_1.default;
+ return EmailVerificationVerifyEmailLinkClicked;
})(react_2.PureComponent);
-exports.default = VerifyEmailLinkClicked;
+exports.VerifyEmailLinkClicked = withOverride_1.withOverride(
+ "EmailVerificationVerifyEmailLinkClicked",
+ EmailVerificationVerifyEmailLinkClicked
+);
//# sourceMappingURL=verifyEmailLinkClicked.js.map
diff --git a/lib/build/recipe/emailverification/components/themes/emailVerification/verifyEmailLinkClicked.js.map b/lib/build/recipe/emailverification/components/themes/emailVerification/verifyEmailLinkClicked.js.map
index 76a2a5a1f..98ae80731 100644
--- a/lib/build/recipe/emailverification/components/themes/emailVerification/verifyEmailLinkClicked.js.map
+++ b/lib/build/recipe/emailverification/components/themes/emailVerification/verifyEmailLinkClicked.js.map
@@ -1 +1 @@
-{"version":3,"file":"verifyEmailLinkClicked.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailverification/components/themes/emailVerification/verifyEmailLinkClicked.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH,eAAe;AACf,wCAAqC;AAErC,+BAAsC;AACtC,mGAA6E;AAC7E,uGAAiF;AACjF,mGAA6E;AAC7E,6FAAuE;AACvE,oFAA8D;AAC9D,wEAAsE;AAItE;;GAEG;AAEH;IAAoD,0CAGnD;IAGG;;OAEG;IACH,gCAAY,KAAuC;QAAnD,YACI,kBAAM,KAAK,CAAC,SAIf;QAED,eAAS,GAAG;YACR,KAAI,CAAC,QAAQ,CAAC,cAAM,OAAA,CAAC;gBACjB,MAAM,EAAE,YAAY;aACvB,CAAC,EAFkB,CAElB,CAAC,CAAC;YAEJ,KAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;QAC3B,CAAC,CAAC;QAEF,uBAAiB,GAAG;;;;;;wBAEK,qBAAM,IAAI,CAAC,KAAK,CAA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,CACJ,CACT,CAAC;IACN,CAAC;IA1GM,kCAAW,GAAG,sBAAY,CAAC;IA2GtC,6BAAC;CAAA,AA/GD,CAAoD,qBAAa,GA+GhE;kBA/GoB,sBAAsB"}
\ No newline at end of file
+{"version":3,"file":"verifyEmailLinkClicked.js","sourceRoot":"","sources":["../../../../../../ts/recipe/emailverification/components/themes/emailVerification/verifyEmailLinkClicked.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH,eAAe;AACf,wCAAqC;AAErC,+BAAsC;AACtC,mGAA6E;AAC7E,uGAAiF;AACjF,mGAA6E;AAC7E,6FAAuE;AACvE,oFAA8D;AAC9D,wEAAsE;AAGtE,yFAAwF;AAExF;;GAEG;AAEH;IAAsD,2DAGrD;IAGG,iDAAY,KAAuC;QAAnD,YACI,kBAAM,KAAK,CAAC,SAIf;QAHG,KAAI,CAAC,KAAK,GAAG;YACT,MAAM,EAAE,SAAS;SACpB,CAAC;;IACN,CAAC;IAEK,mEAAiB,GAAvB;;;;;;;wBAEyB,qBAAM,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,WAAW,CAAC;gCAC/D,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;gCACzB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK;6BAC1B,CAAC,EAAA;;wBAHI,QAAQ,GAAG,SAGf;wBAEF,IAAI,QAAQ,CAAC,MAAM,KAAK,wCAAwC,EAAE;4BAC9D,IAAI,CAAC,QAAQ,CAAC,cAAM,OAAA,CAAC;gCACjB,MAAM,EAAE,SAAS;6BACpB,CAAC,EAFkB,CAElB,CAAC,CAAC;yBACP;6BAAM;4BACH,IAAI,CAAC,QAAQ,CAAC,cAAM,OAAA,CAAC;gCACjB,MAAM,EAAE,YAAY;6BACvB,CAAC,EAFkB,CAElB,CAAC,CAAC;yBACP;;;;wBA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,MAAM,KAAK,SAAS,EAAE;YACtB,OAAO,CACH,yCAAsB,WAAW,EAAC,GAAG,EAAE,MAAM,CAAC,SAAS;gBACnD,yCAAsB,eAAe,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,SAAS,CAAC;oBACrE,yCACqB,6BAA6B,EAC9C,GAAG,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,eAAe,CAAC,8CAE/C;oBACN,qBACI,OAAO,EAAE,sBAAsB,sBACd,sCAAsC,EACvD,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,sBAAsB,CAAC;;wBACjD,YAAC,wBAAc,IAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,GAAI,CACnE,CACJ,CACJ,CACT,CAAC;SACL;QAED,OAAO,CACH,yCAAsB,WAAW,EAAC,GAAG,EAAE,MAAM,CAAC,SAAS;YACnD,yCAAsB,eAAe,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,SAAS,CAAC;gBACrE,yCAAsB,mBAAmB,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,KAAK,CAAC;oBAC7E,YAAC,wBAAc,IAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,GAAI;4CACpD;gBACN,yCAAsB,aAAa,EAAC,GAAG,EAAE,MAAM,CAAC,WAAW,gFAErD,CACJ,CACJ,CACT,CAAC;IACN,CAAC;IArGM,mDAAW,GAAG,sBAAY,CAAC;IAsGtC,8CAAC;CAAA,AA1GD,CAAsD,qBAAa,GA0GlE;AAEY,QAAA,sBAAsB,GAAG,2BAAY,CAC9C,yCAAyC,EACzC,uCAAuC,CAC1C,CAAC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailverification/emailVerificationAuth.d.ts b/lib/build/recipe/emailverification/emailVerificationAuth.d.ts
index 93c93e71c..60800a79f 100644
--- a/lib/build/recipe/emailverification/emailVerificationAuth.d.ts
+++ b/lib/build/recipe/emailverification/emailVerificationAuth.d.ts
@@ -1,9 +1,17 @@
import { PureComponent } from "react";
import { FeatureBaseProps } from "../../types";
-import AuthRecipeModule from "../authRecipeModule";
-export default class EmailVerificationAuth extends PureComponent {
- getRecipeInstanceOrThrow: () => AuthRecipeModule;
- isEmailVerifiedAPI: () => Promise;
+import Recipe from "./recipe";
+declare type Prop = FeatureBaseProps & {
+ recipe: Recipe;
+};
+export default class EmailVerificationAuth extends PureComponent<
+ Prop,
+ {
+ status: "LOADING" | "READY";
+ }
+> {
+ constructor(props: Prop);
componentDidMount(): Promise;
render: () => JSX.Element | null;
}
+export {};
diff --git a/lib/build/recipe/emailverification/emailVerificationAuth.js b/lib/build/recipe/emailverification/emailVerificationAuth.js
index 5bcfab0b0..4948853b4 100644
--- a/lib/build/recipe/emailverification/emailVerificationAuth.js
+++ b/lib/build/recipe/emailverification/emailVerificationAuth.js
@@ -36,6 +36,20 @@ var __extends =
d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
};
})();
+var __assign =
+ (this && this.__assign) ||
+ function () {
+ __assign =
+ Object.assign ||
+ function (t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
+ }
+ return t;
+ };
+ return __assign.apply(this, arguments);
+ };
var __awaiter =
(this && this.__awaiter) ||
function (thisArg, _arguments, P, generator) {
@@ -164,66 +178,24 @@ var __generator =
return { value: op[0] ? op[1] : void 0, done: true };
}
};
-var __importDefault =
- (this && this.__importDefault) ||
- function (mod) {
- return mod && mod.__esModule ? mod : { default: mod };
- };
Object.defineProperty(exports, "__esModule", { value: true });
/*
* Imports.
*/
var react_1 = require("react");
-var authRecipeModule_1 = __importDefault(require("../authRecipeModule"));
-var superTokens_1 = __importDefault(require("../../superTokens"));
-/*
- * Component.
- */
var EmailVerificationAuth = /** @class */ (function (_super) {
__extends(EmailVerificationAuth, _super);
- function EmailVerificationAuth() {
- var _this = (_super !== null && _super.apply(this, arguments)) || this;
- /*
- * Methods.
- */
- _this.getRecipeInstanceOrThrow = function () {
- if (_this.props.recipeId === undefined) {
- throw new Error("No recipeId props given to EmailVerificationAuth component");
- }
- var recipe = superTokens_1.default.getInstanceOrThrow().getRecipeOrThrow(_this.props.recipeId);
- if (recipe instanceof authRecipeModule_1.default === false) {
- throw new Error(
- recipe.recipeId + " must be an instance of AuthRecipeModule to use EmailVerificationAuth component."
- );
- }
- return recipe;
- };
- _this.isEmailVerifiedAPI = function () {
- return __awaiter(_this, void 0, void 0, function () {
- var e_1;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- _a.trys.push([0, 2, , 3]);
- return [4 /*yield*/, this.getRecipeInstanceOrThrow().isEmailVerified()];
- case 1:
- return [2 /*return*/, _a.sent()];
- case 2:
- e_1 = _a.sent();
- // In case of API failure, continue, do not break the application.
- return [2 /*return*/, true];
- case 3:
- return [2 /*return*/];
- }
- });
- });
- };
- /*
- * Render.
- */
+ function EmailVerificationAuth(props) {
+ var _this = _super.call(this, props) || this;
_this.render = function () {
+ if (_this.state.status === "LOADING") {
+ return null;
+ }
return _this.props.children;
};
+ _this.state = {
+ status: "LOADING",
+ };
return _this;
}
EmailVerificationAuth.prototype.componentDidMount = function () {
@@ -233,20 +205,28 @@ var EmailVerificationAuth = /** @class */ (function (_super) {
switch (_a.label) {
case 0:
// If email verification mode is off or optional, return.
- if (this.getRecipeInstanceOrThrow().isEmailVerificationRequired() === false) {
+ if (this.props.recipe.config.mode !== "REQUIRED") {
+ this.setState(function (oldState) {
+ return __assign({}, oldState, { status: "READY" });
+ });
return [2 /*return*/];
}
- return [4 /*yield*/, this.isEmailVerifiedAPI()];
+ return [4 /*yield*/, this.props.recipe.isEmailVerified()];
case 1:
isEmailVerified = _a.sent();
if (!(isEmailVerified === false)) return [3 /*break*/, 3];
return [
4 /*yield*/,
- this.getRecipeInstanceOrThrow().redirect({ action: "VERIFY_EMAIL" }, this.props.history),
+ this.props.recipe.redirect({ action: "VERIFY_EMAIL" }, this.props.history),
];
case 2:
return [2 /*return*/, _a.sent()];
case 3:
+ this.setState(function (oldState) {
+ return __assign({}, oldState, { status: "READY" });
+ });
+ _a.label = 4;
+ case 4:
return [2 /*return*/];
}
});
diff --git a/lib/build/recipe/emailverification/emailVerificationAuth.js.map b/lib/build/recipe/emailverification/emailVerificationAuth.js.map
index a7cbdff7e..6c11d5ffd 100644
--- a/lib/build/recipe/emailverification/emailVerificationAuth.js.map
+++ b/lib/build/recipe/emailverification/emailVerificationAuth.js.map
@@ -1 +1 @@
-{"version":3,"file":"emailVerificationAuth.js","sourceRoot":"","sources":["../../../ts/recipe/emailverification/emailVerificationAuth.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH,+BAAoD;AAGpD,yEAAmD;AACnD,kEAA4C;AAE5C;;GAEG;AAEH;IAA+D,yCAA+B;IAA9F;QAAA,qEAiDC;QAhDG;;WAEG;QACH,8BAAwB,GAAG;YACvB,IAAI,KAAI,CAAC,KAAK,CAAC,QAAQ,KAAK,SAAS,EAAE;gBACnC,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;aACjF;YAED,IAAM,MAAM,GAAG,qBAAW,CAAC,kBAAkB,EAAE,CAAC,gBAAgB,CAAU,KAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YAC/F,IAAI,MAAM,YAAY,0BAAgB,KAAK,KAAK,EAAE;gBAC9C,MAAM,IAAI,KAAK,CACR,MAAM,CAAC,QAAQ,qFAAkF,CACvG,CAAC;aACL;YAED,OAAO,MAAsC,CAAC;QAClD,CAAC,CAAC;QAEF,wBAAkB,GAAG;;;;;;wBAEN,qBAAM,IAAI,CAAC,wBAAwB,EAAE,CAAC,eAAe,EAAE,EAAA;4BAA9D,sBAAO,SAAuD,EAAC;;;wBAE/D,kEAAkE;wBAClE,sBAAO,IAAI,EAAC;;;;aAEnB,CAAC;QAiBF;;WAEG;QACH,YAAM,GAAG;YACL,OAAO,KAAI,CAAC,KAAK,CAAC,QAA6B,CAAC;QACpD,CAAC,CAAC;;IACN,CAAC;IArBS,iDAAiB,GAAvB;;;;;;wBACI,yDAAyD;wBACzD,IAAI,IAAI,CAAC,wBAAwB,EAAE,CAAC,2BAA2B,EAAE,KAAK,KAAK,EAAE;4BACzE,sBAAO;yBACV;wBAEuB,qBAAM,IAAI,CAAC,kBAAkB,EAAE,EAAA;;wBAAjD,eAAe,GAAG,SAA+B;6BACnD,CAAA,eAAe,KAAK,KAAK,CAAA,EAAzB,wBAAyB;wBAClB,qBAAM,IAAI,CAAC,wBAAwB,EAAE,CAAC,QAAQ,CAChD,EAAE,MAAM,EAAE,cAAc,EAAmB,EAC5C,IAAI,CAAC,KAAK,CAAC,OAAO,CACrB,EAAA;4BAHD,sBAAO,SAGN,EAAC;;;;;KAET;IAQL,4BAAC;AAAD,CAAC,AAjDD,CAA+D,qBAAa,GAiD3E"}
\ No newline at end of file
+{"version":3,"file":"emailVerificationAuth.js","sourceRoot":"","sources":["../../../ts/recipe/emailverification/emailVerificationAuth.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH,+BAAoD;AAOpD;IAAmD,yCAAoD;IACnG,+BAAY,KAAW;QAAvB,YACI,kBAAM,KAAK,CAAC,SAIf;QA2BD,YAAM,GAAG;YACL,IAAI,KAAI,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,EAAE;gBACjC,OAAO,IAAI,CAAC;aACf;YACD,OAAO,KAAI,CAAC,KAAK,CAAC,QAA6B,CAAC;QACpD,CAAC,CAAC;QAnCE,KAAI,CAAC,KAAK,GAAG;YACT,MAAM,EAAE,SAAS;SACpB,CAAC;;IACN,CAAC;IAEK,iDAAiB,GAAvB;;;;;;wBACI,yDAAyD;wBACzD,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,UAAU,EAAE;4BAC9C,IAAI,CAAC,QAAQ,CAAC,UAAC,QAAQ;gCACnB,oBACO,QAAQ,IACX,MAAM,EAAE,OAAO,IACjB;4BACN,CAAC,CAAC,CAAC;4BACH,sBAAO;yBACV;wBAEuB,qBAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,EAAE,EAAA;;wBAA3D,eAAe,GAAG,SAAyC;6BAC7D,CAAA,eAAe,KAAK,KAAK,CAAA,EAAzB,wBAAyB;wBAClB,qBAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAA;4BAAvF,sBAAO,SAAgF,EAAC;;wBAExF,IAAI,CAAC,QAAQ,CAAC,UAAC,QAAQ;4BACnB,oBACO,QAAQ,IACX,MAAM,EAAE,OAAO,IACjB;wBACN,CAAC,CAAC,CAAC;;;;;;KAEV;IAQL,4BAAC;AAAD,CAAC,AAvCD,CAAmD,qBAAa,GAuC/D"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailverification/index.d.ts b/lib/build/recipe/emailverification/index.d.ts
index 756a1613b..e0be101fc 100644
--- a/lib/build/recipe/emailverification/index.d.ts
+++ b/lib/build/recipe/emailverification/index.d.ts
@@ -1,14 +1,31 @@
-import RecipeModule from "../recipeModule";
-import { SuccessAPIResponse } from "../../types";
-import { EmailVerificationConfig } from "./types";
-export default class EmailVerification extends RecipeModule {
- config: EmailVerificationConfig;
- constructor(config: EmailVerificationConfig);
- getFeatures: () => Record;
- isEmailVerified(): Promise;
- signOut(): Promise;
- getDefaultRedirectionURL(context: unknown): Promise;
- getEmailVerificationDefaultURL(context: {
- action: string;
- }): Promise;
+///
+import { UserInput } from "./types";
+import EmailVerificationTheme from "./components/themes/emailVerification";
+import { GetRedirectionURLContext, PreAPIHookContext, OnHandleEventContext, RecipeInterface } from "./types";
+export default class Wrapper {
+ static EmailVerification: (prop?: any) => JSX.Element;
+ static EmailVerificationTheme: typeof EmailVerificationTheme;
+ static init(
+ config: UserInput
+ ): import("../../types").CreateRecipeFunction<
+ GetRedirectionURLContext,
+ PreAPIHookContext,
+ OnHandleEventContext,
+ import("./types").NormalisedConfig
+ >;
+ static isEmailVerified(): Promise;
}
+declare const init: typeof Wrapper.init;
+declare const isEmailVerified: typeof Wrapper.isEmailVerified;
+declare const EmailVerification: (prop?: any) => JSX.Element;
+export {
+ init,
+ isEmailVerified,
+ EmailVerification,
+ EmailVerificationTheme,
+ GetRedirectionURLContext,
+ PreAPIHookContext,
+ OnHandleEventContext,
+ UserInput,
+ RecipeInterface,
+};
diff --git a/lib/build/recipe/emailverification/index.js b/lib/build/recipe/emailverification/index.js
index 5745a4529..fa1f7e8e2 100644
--- a/lib/build/recipe/emailverification/index.js
+++ b/lib/build/recipe/emailverification/index.js
@@ -13,29 +13,6 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
-var __extends =
- (this && this.__extends) ||
- (function () {
- var extendStatics = function (d, b) {
- extendStatics =
- Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array &&
- function (d, b) {
- d.__proto__ = b;
- }) ||
- function (d, b) {
- for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
- };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
- };
- })();
var __awaiter =
(this && this.__awaiter) ||
function (thisArg, _arguments, P, generator) {
@@ -170,109 +147,32 @@ var __importDefault =
return mod && mod.__esModule ? mod : { default: mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
-/*
- * Imports.
- */
-var recipeModule_1 = __importDefault(require("../recipeModule"));
-var emailVerification_1 = __importDefault(require("./components/features/emailVerification"));
-var normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath"));
-var constants_1 = require("./constants");
-var api_1 = require("./components/features/emailVerification/api");
-var superTokens_1 = __importDefault(require("../../superTokens"));
-var utils_1 = require("../../utils");
-/*
- * Class.
- */
-var EmailVerification = /** @class */ (function (_super) {
- __extends(EmailVerification, _super);
- /*
- * Constructor.
- */
- function EmailVerification(config) {
- var _this = _super.call(this, config) || this;
- /*
- * Instance methods.
- */
- _this.getFeatures = function () {
- var features = {};
- if (_this.config.mode !== "OFF" && _this.config.disableDefaultImplementation !== true) {
- var normalisedFullPath = _this.appInfo.websiteBasePath.appendPath(
- new normalisedURLPath_1.default(constants_1.DEFAULT_VERIFY_EMAIL_PATH)
- );
- features[normalisedFullPath.getAsStringDangerous()] = {
- matches: utils_1.matchRecipeIdUsingQueryParams(_this.recipeId),
- rid: _this.recipeId,
- component: emailVerification_1.default,
- };
- }
- return features;
- };
- _this.config = config;
- return _this;
- }
- /*
- * Email Verification
- */
- EmailVerification.prototype.isEmailVerified = function () {
- return __awaiter(this, void 0, void 0, function () {
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- return [4 /*yield*/, api_1.isEmailVerifiedAPI(this)];
- case 1:
- return [2 /*return*/, _a.sent()];
- }
- });
- });
+var recipe_1 = __importDefault(require("./recipe"));
+var emailVerification_1 = __importDefault(require("./components/themes/emailVerification"));
+exports.EmailVerificationTheme = emailVerification_1.default;
+var Wrapper = /** @class */ (function () {
+ function Wrapper() {}
+ Wrapper.init = function (config) {
+ return recipe_1.default.init(config);
};
- EmailVerification.prototype.signOut = function () {
+ Wrapper.isEmailVerified = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- return [4 /*yield*/, this.config.signOut()];
- case 1:
- return [2 /*return*/, _a.sent()];
- }
+ return [2 /*return*/, recipe_1.default.getInstanceOrThrow().isEmailVerified()];
});
});
};
- EmailVerification.prototype.getDefaultRedirectionURL = function (context) {
- return __awaiter(this, void 0, void 0, function () {
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- return [
- 4 /*yield*/,
- superTokens_1.default
- .getInstanceOrThrow()
- .getRecipeOrThrow(this.recipeId)
- .getDefaultRedirectionURL(context),
- ];
- case 1:
- return [2 /*return*/, _a.sent()];
- }
- });
- });
- };
- EmailVerification.prototype.getEmailVerificationDefaultURL = function (context) {
- return __awaiter(this, void 0, void 0, function () {
- var verifyEmailPath;
- return __generator(this, function (_a) {
- if (context.action !== "VERIFY_EMAIL") {
- return [2 /*return*/, "/"];
- }
- verifyEmailPath = new normalisedURLPath_1.default(constants_1.DEFAULT_VERIFY_EMAIL_PATH);
- return [
- 2 /*return*/,
- this.appInfo.websiteBasePath.appendPath(verifyEmailPath).getAsStringDangerous() +
- "?rid=" +
- this.recipeId,
- ];
- });
- });
+ Wrapper.EmailVerification = function (prop) {
+ return recipe_1.default.getInstanceOrThrow().getFeatureComponent("emailverification", prop);
};
- return EmailVerification;
-})(recipeModule_1.default);
-exports.default = EmailVerification;
+ Wrapper.EmailVerificationTheme = emailVerification_1.default;
+ return Wrapper;
+})();
+exports.default = Wrapper;
+var init = Wrapper.init;
+exports.init = init;
+var isEmailVerified = Wrapper.isEmailVerified;
+exports.isEmailVerified = isEmailVerified;
+var EmailVerification = Wrapper.EmailVerification;
+exports.EmailVerification = EmailVerification;
//# sourceMappingURL=index.js.map
diff --git a/lib/build/recipe/emailverification/index.js.map b/lib/build/recipe/emailverification/index.js.map
index efb464d2e..b8c42dc3d 100644
--- a/lib/build/recipe/emailverification/index.js.map
+++ b/lib/build/recipe/emailverification/index.js.map
@@ -1 +1 @@
-{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/recipe/emailverification/index.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;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C,wBAAwB,CAAC,OAAO,CAAC,EAAA;4BAA/G,sBAAO,SAAwG,EAAC;;;;KACnH;IAEK,0DAA8B,GAApC,UAAqC,OAA2B;;;;gBAC5D,IAAI,OAAO,CAAC,MAAM,KAAK,cAAc,EAAE;oBACnC,sBAAO,GAAG,EAAC;iBACd;gBAEK,eAAe,GAAG,IAAI,2BAAiB,CAAC,qCAAyB,CAAC,CAAC;gBACzE,sBAAU,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,oBAAoB,EAAE,aACrF,IAAI,CAAC,QACP,EAAC;;;KACN;IACL,wBAAC;AAAD,CAAC,AA3DD,CAAwD,sBAAY,GA2DnE"}
\ No newline at end of file
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/recipe/emailverification/index.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMH,oDAA+C;AAC/C,4FAA2E;AAyBvE,iCAzBG,2BAAsB,CAyBH;AAtB1B;IAAA;IAYA,CAAC;IAPU,YAAI,GAAX,UAAY,MAAiB;QACzB,OAAO,gBAAuB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAChD,CAAC;IAEY,uBAAe,GAA5B;;;gBACI,sBAAO,gBAAuB,CAAC,kBAAkB,EAAE,CAAC,eAAe,EAAE,EAAC;;;KACzE;IAVM,yBAAiB,GAAG,UAAC,IAAU;QAClC,OAAA,gBAAuB,CAAC,kBAAkB,EAAE,CAAC,mBAAmB,CAAC,mBAAmB,EAAE,IAAI,CAAC;IAA3F,CAA2F,CAAC;IACzF,8BAAsB,GAAG,2BAAsB,CAAC;IAS3D,cAAC;CAAA,AAZD,IAYC;kBAZoB,OAAO;AAc5B,IAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;AAKtB,oBAAI;AAJR,IAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;AAK5C,0CAAe;AAJnB,IAAM,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;AAKhD,8CAAiB"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailverification/recipe.d.ts b/lib/build/recipe/emailverification/recipe.d.ts
new file mode 100644
index 000000000..bf801a2f2
--- /dev/null
+++ b/lib/build/recipe/emailverification/recipe.d.ts
@@ -0,0 +1,31 @@
+///
+import RecipeModule from "../recipeModule";
+import {
+ Config,
+ NormalisedConfig,
+ GetRedirectionURLContext,
+ PreAPIHookContext,
+ OnHandleEventContext,
+ UserInput,
+ RecipeInterface,
+} from "./types";
+import { CreateRecipeFunction } from "../../types";
+export default class EmailVerification extends RecipeModule<
+ GetRedirectionURLContext,
+ PreAPIHookContext,
+ OnHandleEventContext,
+ NormalisedConfig
+> {
+ static instance?: EmailVerification;
+ static RECIPE_ID: string;
+ recipeImpl: RecipeInterface;
+ constructor(config: Config);
+ static init(
+ config: UserInput
+ ): CreateRecipeFunction;
+ static getInstanceOrThrow(): EmailVerification;
+ getFeatures: () => Record;
+ getFeatureComponent: (_: "emailverification", props: any) => JSX.Element;
+ isEmailVerified(): Promise;
+ getDefaultRedirectionURL: (context: GetRedirectionURLContext) => Promise;
+}
diff --git a/lib/build/recipe/emailverification/recipe.js b/lib/build/recipe/emailverification/recipe.js
new file mode 100644
index 000000000..397a61313
--- /dev/null
+++ b/lib/build/recipe/emailverification/recipe.js
@@ -0,0 +1,286 @@
+"use strict";
+/* 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 __extends =
+ (this && this.__extends) ||
+ (function () {
+ var extendStatics = function (d, b) {
+ extendStatics =
+ Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array &&
+ function (d, b) {
+ d.__proto__ = b;
+ }) ||
+ function (d, b) {
+ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
+ };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() {
+ this.constructor = d;
+ }
+ d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
+ };
+ })();
+var __assign =
+ (this && this.__assign) ||
+ function () {
+ __assign =
+ Object.assign ||
+ function (t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
+ }
+ return t;
+ };
+ return __assign.apply(this, arguments);
+ };
+var __awaiter =
+ (this && this.__awaiter) ||
+ function (thisArg, _arguments, P, generator) {
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) {
+ try {
+ step(generator.next(value));
+ } catch (e) {
+ reject(e);
+ }
+ }
+ function rejected(value) {
+ try {
+ step(generator["throw"](value));
+ } catch (e) {
+ reject(e);
+ }
+ }
+ function step(result) {
+ result.done
+ ? resolve(result.value)
+ : new P(function (resolve) {
+ resolve(result.value);
+ }).then(fulfilled, rejected);
+ }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+ };
+var __generator =
+ (this && this.__generator) ||
+ function (thisArg, body) {
+ var _ = {
+ label: 0,
+ sent: function () {
+ if (t[0] & 1) throw t[1];
+ return t[1];
+ },
+ trys: [],
+ ops: [],
+ },
+ f,
+ y,
+ t,
+ g;
+ return (
+ (g = { next: verb(0), throw: verb(1), return: verb(2) }),
+ typeof Symbol === "function" &&
+ (g[Symbol.iterator] = function () {
+ return this;
+ }),
+ g
+ );
+ function verb(n) {
+ return function (v) {
+ return step([n, v]);
+ };
+ }
+ function step(op) {
+ if (f) throw new TypeError("Generator is already executing.");
+ while (_)
+ try {
+ if (
+ ((f = 1),
+ y &&
+ (t =
+ op[0] & 2
+ ? y["return"]
+ : op[0]
+ ? y["throw"] || ((t = y["return"]) && t.call(y), 0)
+ : y.next) &&
+ !(t = t.call(y, op[1])).done)
+ )
+ return t;
+ if (((y = 0), t)) op = [op[0] & 2, t.value];
+ switch (op[0]) {
+ case 0:
+ case 1:
+ t = op;
+ break;
+ case 4:
+ _.label++;
+ return { value: op[1], done: false };
+ case 5:
+ _.label++;
+ y = op[1];
+ op = [0];
+ continue;
+ case 7:
+ op = _.ops.pop();
+ _.trys.pop();
+ continue;
+ default:
+ if (
+ !((t = _.trys), (t = t.length > 0 && t[t.length - 1])) &&
+ (op[0] === 6 || op[0] === 2)
+ ) {
+ _ = 0;
+ continue;
+ }
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
+ _.label = op[1];
+ break;
+ }
+ if (op[0] === 6 && _.label < t[1]) {
+ _.label = t[1];
+ t = op;
+ break;
+ }
+ if (t && _.label < t[2]) {
+ _.label = t[2];
+ _.ops.push(op);
+ break;
+ }
+ if (t[2]) _.ops.pop();
+ _.trys.pop();
+ continue;
+ }
+ op = body.call(thisArg, _);
+ } catch (e) {
+ op = [6, e];
+ y = 0;
+ } finally {
+ f = t = 0;
+ }
+ if (op[0] & 5) throw op[1];
+ return { value: op[0] ? op[1] : void 0, done: true };
+ }
+ };
+var __importDefault =
+ (this && this.__importDefault) ||
+ function (mod) {
+ return mod && mod.__esModule ? mod : { default: mod };
+ };
+Object.defineProperty(exports, "__esModule", { value: true });
+/*
+ * Imports.
+ */
+var react_1 = __importDefault(require("react"));
+var recipeModule_1 = __importDefault(require("../recipeModule"));
+var emailVerification_1 = __importDefault(require("./components/features/emailVerification"));
+var normalisedURLPath_1 = __importDefault(require("../../normalisedURLPath"));
+var constants_1 = require("./constants");
+var utils_1 = require("../../utils");
+var utils_2 = require("./utils");
+var constants_2 = require("../../constants");
+var recipeImplementation_1 = __importDefault(require("./recipeImplementation"));
+var EmailVerification = /** @class */ (function (_super) {
+ __extends(EmailVerification, _super);
+ function EmailVerification(config) {
+ var _this = _super.call(this, utils_2.normaliseEmailVerificationFeature(config)) || this;
+ _this.getFeatures = function () {
+ var features = {};
+ if (_this.config.mode !== "OFF" && _this.config.disableDefaultImplementation !== true) {
+ var normalisedFullPath = _this.config.appInfo.websiteBasePath.appendPath(
+ new normalisedURLPath_1.default(constants_1.DEFAULT_VERIFY_EMAIL_PATH)
+ );
+ features[normalisedFullPath.getAsStringDangerous()] = {
+ matches: utils_1.matchRecipeIdUsingQueryParams(_this.config.recipeId),
+ component: function (props) {
+ return _this.getFeatureComponent("emailverification", props);
+ },
+ };
+ }
+ return features;
+ };
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ _this.getFeatureComponent = function (_, props) {
+ return react_1.default.createElement(emailVerification_1.default, __assign({ recipe: _this }, props));
+ };
+ _this.getDefaultRedirectionURL = function (context) {
+ return __awaiter(_this, void 0, void 0, function () {
+ var verifyEmailPath;
+ return __generator(this, function (_a) {
+ if (context.action === "VERIFY_EMAIL") {
+ verifyEmailPath = new normalisedURLPath_1.default(constants_1.DEFAULT_VERIFY_EMAIL_PATH);
+ return [
+ 2 /*return*/,
+ this.config.appInfo.websiteBasePath.appendPath(verifyEmailPath).getAsStringDangerous() +
+ "?rid=" +
+ this.config.recipeId,
+ ];
+ } else {
+ return [2 /*return*/, "/"];
+ }
+ return [2 /*return*/];
+ });
+ });
+ };
+ _this.recipeImpl = _this.config.override.functions(
+ new recipeImplementation_1.default(_this.config.recipeId, _this.config.appInfo)
+ );
+ return _this;
+ }
+ EmailVerification.init = function (config) {
+ return function (appInfo) {
+ EmailVerification.instance = new EmailVerification(
+ __assign({}, config, { appInfo: appInfo, recipeId: EmailVerification.RECIPE_ID })
+ );
+ return EmailVerification.instance;
+ };
+ };
+ EmailVerification.getInstanceOrThrow = function () {
+ if (EmailVerification.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 + constants_2.SSR_ERROR;
+ }
+ throw Error(error);
+ }
+ return EmailVerification.instance;
+ };
+ EmailVerification.prototype.isEmailVerified = function () {
+ return __awaiter(this, void 0, void 0, function () {
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ return [
+ 4 /*yield*/,
+ this.recipeImpl.isEmailVerified({
+ config: this.config,
+ }),
+ ];
+ case 1:
+ return [2 /*return*/, _a.sent()];
+ }
+ });
+ });
+ };
+ EmailVerification.RECIPE_ID = "emailverification";
+ return EmailVerification;
+})(recipeModule_1.default);
+exports.default = EmailVerification;
+//# sourceMappingURL=recipe.js.map
diff --git a/lib/build/recipe/emailverification/recipe.js.map b/lib/build/recipe/emailverification/recipe.js.map
new file mode 100644
index 000000000..d942a3a43
--- /dev/null
+++ b/lib/build/recipe/emailverification/recipe.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"recipe.js","sourceRoot":"","sources":["../../../ts/recipe/emailverification/recipe.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AAEH,gDAA0B;AAC1B,iEAA2C;AAW3C,8FAA8F;AAC9F,8EAAwD;AACxD,yCAAwD;AACxD,qCAA4D;AAC5D,iCAA4D;AAE5D,6CAA4C;AAC5C,gFAA0D;AAE1D;IAA+C,qCAK9C;IAMG,2BAAY,MAAc;QAA1B,YACI,kBAAM,yCAAiC,CAAC,MAAM,CAAC,CAAC,SAInD;QA+BD,iBAAW,GAAG;YACV,IAAM,QAAQ,GAA8B,EAAE,CAAC;YAC/C,IAAI,KAAI,CAAC,MAAM,CAAC,IAAI,KAAK,KAAK,IAAI,KAAI,CAAC,MAAM,CAAC,4BAA4B,KAAK,IAAI,EAAE;gBACjF,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AAI,iBAAiB,cAC3C,MAAM,IACT,OAAO,SAAA,EACP,QAAQ,EAAE,iBAAiB,CAAC,SAAS,IACvC,CAAC;YACH,OAAO,iBAAiB,CAAC,QAAQ,CAAC;QACtC,CAAC,CAAC;IACN,CAAC;IAEM,oCAAkB,GAAzB;QACI,IAAI,iBAAiB,CAAC,QAAQ,KAAK,SAAS,EAAE;YAC1C,IAAI,KAAK,GAAG,8FAA8F,CAAC;YAE3G,0EAA0E;YAC1E,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;gBAC/B,KAAK,GAAG,KAAK,GAAG,qBAAS,CAAC;aAC7B;YACD,MAAM,KAAK,CAAC,KAAK,CAAC,CAAC;SACtB;QAED,OAAO,iBAAiB,CAAC,QAAQ,CAAC;IACtC,CAAC;IAqBK,2CAAe,GAArB;;;;4BACW,qBAAM,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC;4BACzC,MAAM,EAAE,IAAI,CAAC,MAAM;yBACtB,CAAC,EAAA;4BAFF,sBAAO,SAEL,EAAC;;;;KACN;IA/DM,2BAAS,GAAG,mBAAmB,CAAC;IA2E3C,wBAAC;CAAA,AAlFD,CAA+C,sBAAY,GAkF1D;kBAlFoB,iBAAiB"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailverification/recipeImplementation.d.ts b/lib/build/recipe/emailverification/recipeImplementation.d.ts
new file mode 100644
index 000000000..fedcc9aa5
--- /dev/null
+++ b/lib/build/recipe/emailverification/recipeImplementation.d.ts
@@ -0,0 +1,14 @@
+import { RecipeInterface, NormalisedConfig } from "./types";
+import { NormalisedAppInfo } from "../../types";
+import Querier from "../../querier";
+export default class RecipeImplementation implements RecipeInterface {
+ querier: Querier;
+ constructor(recipeId: string, appInfo: NormalisedAppInfo);
+ verifyEmail: (input: { token: string; config: NormalisedConfig }) => Promise<{
+ status: "OK" | "EMAIL_VERIFICATION_INVALID_TOKEN_ERROR";
+ }>;
+ sendVerificationEmail: (input: { config: NormalisedConfig }) => Promise<{
+ status: "EMAIL_ALREADY_VERIFIED_ERROR" | "OK";
+ }>;
+ isEmailVerified: (input: { config: NormalisedConfig }) => Promise;
+}
diff --git a/lib/build/recipe/emailverification/recipeImplementation.js b/lib/build/recipe/emailverification/recipeImplementation.js
new file mode 100644
index 000000000..45d46774b
--- /dev/null
+++ b/lib/build/recipe/emailverification/recipeImplementation.js
@@ -0,0 +1,257 @@
+"use strict";
+var __assign =
+ (this && this.__assign) ||
+ function () {
+ __assign =
+ Object.assign ||
+ function (t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
+ }
+ return t;
+ };
+ return __assign.apply(this, arguments);
+ };
+var __awaiter =
+ (this && this.__awaiter) ||
+ function (thisArg, _arguments, P, generator) {
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) {
+ try {
+ step(generator.next(value));
+ } catch (e) {
+ reject(e);
+ }
+ }
+ function rejected(value) {
+ try {
+ step(generator["throw"](value));
+ } catch (e) {
+ reject(e);
+ }
+ }
+ function step(result) {
+ result.done
+ ? resolve(result.value)
+ : new P(function (resolve) {
+ resolve(result.value);
+ }).then(fulfilled, rejected);
+ }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+ };
+var __generator =
+ (this && this.__generator) ||
+ function (thisArg, body) {
+ var _ = {
+ label: 0,
+ sent: function () {
+ if (t[0] & 1) throw t[1];
+ return t[1];
+ },
+ trys: [],
+ ops: [],
+ },
+ f,
+ y,
+ t,
+ g;
+ return (
+ (g = { next: verb(0), throw: verb(1), return: verb(2) }),
+ typeof Symbol === "function" &&
+ (g[Symbol.iterator] = function () {
+ return this;
+ }),
+ g
+ );
+ function verb(n) {
+ return function (v) {
+ return step([n, v]);
+ };
+ }
+ function step(op) {
+ if (f) throw new TypeError("Generator is already executing.");
+ while (_)
+ try {
+ if (
+ ((f = 1),
+ y &&
+ (t =
+ op[0] & 2
+ ? y["return"]
+ : op[0]
+ ? y["throw"] || ((t = y["return"]) && t.call(y), 0)
+ : y.next) &&
+ !(t = t.call(y, op[1])).done)
+ )
+ return t;
+ if (((y = 0), t)) op = [op[0] & 2, t.value];
+ switch (op[0]) {
+ case 0:
+ case 1:
+ t = op;
+ break;
+ case 4:
+ _.label++;
+ return { value: op[1], done: false };
+ case 5:
+ _.label++;
+ y = op[1];
+ op = [0];
+ continue;
+ case 7:
+ op = _.ops.pop();
+ _.trys.pop();
+ continue;
+ default:
+ if (
+ !((t = _.trys), (t = t.length > 0 && t[t.length - 1])) &&
+ (op[0] === 6 || op[0] === 2)
+ ) {
+ _ = 0;
+ continue;
+ }
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
+ _.label = op[1];
+ break;
+ }
+ if (op[0] === 6 && _.label < t[1]) {
+ _.label = t[1];
+ t = op;
+ break;
+ }
+ if (t && _.label < t[2]) {
+ _.label = t[2];
+ _.ops.push(op);
+ break;
+ }
+ if (t[2]) _.ops.pop();
+ _.trys.pop();
+ continue;
+ }
+ op = body.call(thisArg, _);
+ } catch (e) {
+ op = [6, e];
+ y = 0;
+ } finally {
+ f = t = 0;
+ }
+ if (op[0] & 5) throw op[1];
+ return { value: op[0] ? op[1] : void 0, done: true };
+ }
+ };
+var __importDefault =
+ (this && this.__importDefault) ||
+ function (mod) {
+ return mod && mod.__esModule ? mod : { default: mod };
+ };
+Object.defineProperty(exports, "__esModule", { value: true });
+var querier_1 = __importDefault(require("../../querier"));
+var RecipeImplementation = /** @class */ (function () {
+ function RecipeImplementation(recipeId, appInfo) {
+ var _this = this;
+ this.verifyEmail = function (input) {
+ return __awaiter(_this, void 0, void 0, function () {
+ var response;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ return [
+ 4 /*yield*/,
+ this.querier.post(
+ "/user/email/verify",
+ {
+ body: JSON.stringify({
+ method: "token",
+ token: input.token,
+ }),
+ },
+ function (context) {
+ return input.config.preAPIHook(
+ __assign({}, context, { action: "VERIFY_EMAIL" })
+ );
+ }
+ ),
+ ];
+ case 1:
+ response = _a.sent();
+ if (response.status === "OK") {
+ input.config.onHandleEvent({
+ action: "EMAIL_VERIFIED_SUCCESSFUL",
+ });
+ }
+ return [2 /*return*/, response];
+ }
+ });
+ });
+ };
+ this.sendVerificationEmail = function (input) {
+ return __awaiter(_this, void 0, void 0, function () {
+ var response;
+ var _this = this;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ return [
+ 4 /*yield*/,
+ this.querier.post("/user/email/verify/token", {}, function (context) {
+ return __awaiter(_this, void 0, void 0, function () {
+ return __generator(this, function (_a) {
+ return [
+ 2 /*return*/,
+ input.config.preAPIHook(
+ __assign({}, context, { action: "SEND_VERIFY_EMAIL" })
+ ),
+ ];
+ });
+ });
+ }),
+ ];
+ case 1:
+ response = _a.sent();
+ if (response.status === "OK") {
+ input.config.onHandleEvent({
+ action: "VERIFY_EMAIL_SENT",
+ });
+ }
+ return [2 /*return*/, response];
+ }
+ });
+ });
+ };
+ this.isEmailVerified = function (input) {
+ return __awaiter(_this, void 0, void 0, function () {
+ var response;
+ var _this = this;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ return [
+ 4 /*yield*/,
+ this.querier.get("/user/email/verify", {}, undefined, function (context) {
+ return __awaiter(_this, void 0, void 0, function () {
+ return __generator(this, function (_a) {
+ return [
+ 2 /*return*/,
+ input.config.preAPIHook(
+ __assign({}, context, { action: "IS_EMAIL_VERIFIED" })
+ ),
+ ];
+ });
+ });
+ }),
+ ];
+ case 1:
+ response = _a.sent();
+ return [2 /*return*/, response.isVerified];
+ }
+ });
+ });
+ };
+ this.querier = new querier_1.default(recipeId, appInfo);
+ }
+ return RecipeImplementation;
+})();
+exports.default = RecipeImplementation;
+//# sourceMappingURL=recipeImplementation.js.map
diff --git a/lib/build/recipe/emailverification/recipeImplementation.js.map b/lib/build/recipe/emailverification/recipeImplementation.js.map
new file mode 100644
index 000000000..526aa6d48
--- /dev/null
+++ b/lib/build/recipe/emailverification/recipeImplementation.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"recipeImplementation.js","sourceRoot":"","sources":["../../../ts/recipe/emailverification/recipeImplementation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,0DAAoC;AAEpC;IAGI,8BAAY,QAAgB,EAAE,OAA0B;QAAxD,iBAEC;QAED,gBAAW,GAAG,UAAO,KAGpB;;;;4BAC4C,qBAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAC5D,oBAAoB,EACpB;4BACI,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gCACjB,MAAM,EAAE,OAAO;gCACf,KAAK,EAAE,KAAK,CAAC,KAAK;6BACrB,CAAC;yBACL,EACD,UAAC,OAAO;4BACJ,OAAO,KAAK,CAAC,MAAM,CAAC,UAAU,cACvB,OAAO,IACV,MAAM,EAAE,cAAc,IACxB,CAAC;wBACP,CAAC,CACJ,EAAA;;wBAdK,QAAQ,GAA2B,SAcxC;wBAED,IAAI,QAAQ,CAAC,MAAM,KAAK,IAAI,EAAE;4BAC1B,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC;gCACvB,MAAM,EAAE,2BAA2B;6BACtC,CAAC,CAAC;yBACN;wBAED,sBAAO,QAAQ,EAAC;;;aACnB,CAAC;QAEF,0BAAqB,GAAG,UAAO,KAE9B;;;;;4BACgD,qBAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAChE,0BAA0B,EAC1B,EAAE,EACF,UAAO,OAAO;;gCACV,sBAAO,KAAK,CAAC,MAAM,CAAC,UAAU,cACvB,OAAO,IACV,MAAM,EAAE,mBAAmB,IAC7B,EAAC;;6BACN,CACJ,EAAA;;wBATK,QAAQ,GAA+B,SAS5C;wBAED,IAAI,QAAQ,CAAC,MAAM,KAAK,IAAI,EAAE;4BAC1B,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC;gCACvB,MAAM,EAAE,mBAAmB;6BAC9B,CAAC,CAAC;yBACN;wBAED,sBAAO,QAAQ,EAAC;;;aACnB,CAAC;QAEF,oBAAe,GAAG,UAAO,KAAmC;;;;;4BACX,qBAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAC/D,oBAAoB,EACpB,EAAE,EACF,SAAS,EACT,UAAO,OAAO;;gCACV,sBAAO,KAAK,CAAC,MAAM,CAAC,UAAU,cACvB,OAAO,IACV,MAAM,EAAE,mBAAmB,IAC7B,EAAC;;6BACN,CACJ,EAAA;;wBAVK,QAAQ,GAA+B,SAU5C;wBACD,sBAAO,QAAQ,CAAC,UAAU,EAAC;;;aAC9B,CAAC;QApEE,IAAI,CAAC,OAAO,GAAG,IAAI,iBAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;IAoEL,2BAAC;AAAD,CAAC,AAzED,IAyEC"}
\ No newline at end of file
diff --git a/lib/build/recipe/emailverification/types.d.ts b/lib/build/recipe/emailverification/types.d.ts
index 0a4c74f5f..27c47e6ae 100644
--- a/lib/build/recipe/emailverification/types.d.ts
+++ b/lib/build/recipe/emailverification/types.d.ts
@@ -1,53 +1,77 @@
-import { FeatureBaseConfig, SuccessAPIResponse, ThemeBaseProps } from "../../types";
-import { ThemeResponseGeneralError } from "../emailpassword/types";
-import { RecipeModuleConfig } from "../recipeModule/types";
-export declare type EmailVerificationUserInput = {
+import { FeatureBaseConfig, ThemeBaseProps } from "../../types";
+import { Config as RecipeModuleConfig, NormalisedConfig as NormalisedRecipeModuleConfig } from "../recipeModule/types";
+import { ComponentOverride } from "../../components/componentOverride/componentOverride";
+import { SendVerifyEmail } from "./components/themes/emailVerification/sendVerifyEmail";
+import { VerifyEmailLinkClicked } from "./components/themes/emailVerification/verifyEmailLinkClicked";
+export declare type UserInputForAuthRecipeModule = {
mode?: "OFF" | "REQUIRED";
disableDefaultImplementation?: boolean;
sendVerifyEmailScreen?: FeatureBaseConfig;
verifyEmailLinkClickedScreen?: FeatureBaseConfig;
};
-export declare type NormalisedEmailVerificationConfig = {
+export declare type ComponentOverrideMap = {
+ EmailVerificationSendVerifyEmail?: ComponentOverride;
+ EmailVerificationVerifyEmailLinkClicked?: ComponentOverride;
+};
+export declare type UserInput = UserInputForAuthRecipeModule & {
+ signOut(): Promise;
+ redirectToSignIn(history?: any): Promise;
+ postVerificationRedirect(history?: any): Promise;
+ override?: {
+ functions?: (originalImplementation: RecipeInterface) => RecipeInterface;
+ components?: ComponentOverrideMap;
+ };
+};
+export declare type Config = UserInput &
+ RecipeModuleConfig;
+export declare type NormalisedConfig = {
mode: "OFF" | "REQUIRED";
disableDefaultImplementation: boolean;
sendVerifyEmailScreen: FeatureBaseConfig;
verifyEmailLinkClickedScreen: FeatureBaseConfig;
+ signOut(): Promise;
+ redirectToSignIn(history?: any): Promise;
+ postVerificationRedirect(history?: any): Promise;
+ override: {
+ functions: (originalImplementation: RecipeInterface) => RecipeInterface;
+ components: ComponentOverrideMap;
+ };
+} & NormalisedRecipeModuleConfig;
+export declare type GetRedirectionURLContext = {
+ action: "VERIFY_EMAIL";
};
-export declare type EmailVerificationConfig = RecipeModuleConfig & NormalisedEmailVerificationConfig & {
- signOut(): Promise;
- useShadowDom: boolean;
- palette: Record;
+export declare type PreAPIHookContext = {
+ action: "VERIFY_EMAIL" | "SEND_VERIFY_EMAIL" | "IS_EMAIL_VERIFIED";
+ requestInit: RequestInit;
+ url: string;
};
-export declare type IsEmailVerifiedAPIResponse = {
- status: "OK";
- isVerified: boolean;
-};
-export declare type VerifyEmailAPIResponse = {
- status: "OK" | "EMAIL_VERIFICATION_INVALID_TOKEN_ERROR";
+export declare type OnHandleEventContext = {
+ action: "VERIFY_EMAIL_SENT" | "EMAIL_VERIFIED_SUCCESSFUL";
};
export declare type EmailVerificationThemeProps = {
sendVerifyEmailScreen: SendVerifyEmailThemeProps;
- verifyEmailLinkClickedScreen: VerifyEmailLinkClickedThemeProps;
- hasToken: boolean;
- rawPalette: Record;
+ verifyEmailLinkClickedScreen?: VerifyEmailLinkClickedThemeProps;
+ config: NormalisedConfig;
};
export declare type SendVerifyEmailThemeProps = ThemeBaseProps & {
- sendVerifyEmailAPI: () => Promise;
+ recipeImplementation: RecipeInterface;
+ config: NormalisedConfig;
signOut: () => Promise;
onEmailAlreadyVerified: () => Promise;
};
export declare type VerifyEmailLinkClickedThemeProps = ThemeBaseProps & {
- verifyEmailAPI: () => Promise;
- onTokenInvalidRedirect: () => Promise;
+ recipeImplementation: RecipeInterface;
+ config: NormalisedConfig;
onContinueClicked: () => Promise;
+ onTokenInvalidRedirect: () => Promise;
+ token: string;
};
-export declare type SendVerifyEmailAPIResponse = {
- status: "OK" | "EMAIL_ALREADY_VERIFIED_ERROR";
-};
-export declare type SendVerifyEmailThemeResponse = SendVerifyEmailAPIResponse | ThemeResponseGeneralError;
-export declare type VerifyEmailThemeResponse = {
- status: "LOADING" | "INVALID" | "GENERAL_ERROR" | "SUCCESSFUL";
-};
-export declare type VerifyEmailLinkClickedThemeState = {
- status: "LOADING" | "INVALID" | "GENERAL_ERROR" | "SUCCESSFUL";
-};
+export interface RecipeInterface {
+ verifyEmail: (input: { token: string; config: NormalisedConfig }) => Promise<{
+ status: "EMAIL_VERIFICATION_INVALID_TOKEN_ERROR" | "OK";
+ }>;
+ sendVerificationEmail: (input: { config: NormalisedConfig }) => Promise<{
+ status: "EMAIL_ALREADY_VERIFIED_ERROR" | "OK";
+ }>;
+ isEmailVerified: (input: { config: NormalisedConfig }) => Promise;
+}
diff --git a/lib/build/recipe/emailverification/utils.d.ts b/lib/build/recipe/emailverification/utils.d.ts
index dc433005b..fe6cba67d 100644
--- a/lib/build/recipe/emailverification/utils.d.ts
+++ b/lib/build/recipe/emailverification/utils.d.ts
@@ -1,2 +1,2 @@
-import { EmailVerificationUserInput, NormalisedEmailVerificationConfig } from "./types";
-export declare function normaliseEmailVerificationFeature(config?: EmailVerificationUserInput): NormalisedEmailVerificationConfig;
+import { Config, NormalisedConfig } from "./types";
+export declare function normaliseEmailVerificationFeature(config: Config): NormalisedConfig;
diff --git a/lib/build/recipe/emailverification/utils.js b/lib/build/recipe/emailverification/utils.js
index 82df38104..00b92786d 100644
--- a/lib/build/recipe/emailverification/utils.js
+++ b/lib/build/recipe/emailverification/utils.js
@@ -13,11 +13,23 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
+var __assign =
+ (this && this.__assign) ||
+ function () {
+ __assign =
+ Object.assign ||
+ function (t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
+ }
+ return t;
+ };
+ return __assign.apply(this, arguments);
+ };
Object.defineProperty(exports, "__esModule", { value: true });
+var utils_1 = require("../recipeModule/utils");
function normaliseEmailVerificationFeature(config) {
- if (config === undefined) {
- config = {};
- }
var disableDefaultImplementation = config.disableDefaultImplementation === true;
var mode = config.mode === undefined ? "OFF" : config.mode;
var sendVerifyEmailScreenStyle =
@@ -34,12 +46,25 @@ function normaliseEmailVerificationFeature(config) {
var verifyEmailLinkClickedScreen = {
style: verifyEmailLinkClickedScreenStyle,
};
- return {
+ var override = __assign(
+ {
+ functions: function (originalImplementation) {
+ return originalImplementation;
+ },
+ components: {},
+ },
+ config.override
+ );
+ return __assign({}, utils_1.normaliseRecipeModuleConfig(config), {
disableDefaultImplementation: disableDefaultImplementation,
mode: mode,
sendVerifyEmailScreen: sendVerifyEmailScreen,
verifyEmailLinkClickedScreen: verifyEmailLinkClickedScreen,
- };
+ signOut: config.signOut,
+ postVerificationRedirect: config.postVerificationRedirect,
+ redirectToSignIn: config.redirectToSignIn,
+ override: override,
+ });
}
exports.normaliseEmailVerificationFeature = normaliseEmailVerificationFeature;
//# sourceMappingURL=utils.js.map
diff --git a/lib/build/recipe/emailverification/utils.js.map b/lib/build/recipe/emailverification/utils.js.map
index 8efb4c553..53e95dc47 100644
--- a/lib/build/recipe/emailverification/utils.js.map
+++ b/lib/build/recipe/emailverification/utils.js.map
@@ -1 +1 @@
-{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../ts/recipe/emailverification/utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;AAKH,SAAgB,iCAAiC,CAC7C,MAAmC;IAEnC,IAAI,MAAM,KAAK,SAAS,EAAE;QACtB,MAAM,GAAG,EAAE,CAAC;KACf;IACD,IAAM,4BAA4B,GAAG,MAAM,CAAC,4BAA4B,KAAK,IAAI,CAAC;IAClF,IAAM,IAAI,GAAG,MAAM,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;IAE7D,IAAM,0BAA0B,GAC5B,MAAM,CAAC,qBAAqB,KAAK,SAAS,IAAI,MAAM,CAAC,qBAAqB,CAAC,KAAK,KAAK,SAAS;QAC1F,CAAC,CAAC,MAAM,CAAC,qBAAqB,CAAC,KAAK;QACpC,CAAC,CAAC,EAAE,CAAC;IAEb,IAAM,qBAAqB,GAAyB;QAChD,KAAK,EAAE,0BAA0B;KACpC,CAAC;IAEF,IAAM,iCAAiC,GACnC,MAAM,CAAC,4BAA4B,KAAK,SAAS,IAAI,MAAM,CAAC,4BAA4B,CAAC,KAAK,KAAK,SAAS;QACxG,CAAC,CAAC,MAAM,CAAC,4BAA4B,CAAC,KAAK;QAC3C,CAAC,CAAC,EAAE,CAAC;IAEb,IAAM,4BAA4B,GAAyB;QACvD,KAAK,EAAE,iCAAiC;KAC3C,CAAC;IAEF,OAAO;QACH,4BAA4B,8BAAA;QAC5B,IAAI,MAAA;QACJ,qBAAqB,uBAAA;QACrB,4BAA4B,8BAAA;KAC/B,CAAC;AACN,CAAC;AAjCD,8EAiCC"}
\ No newline at end of file
+{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../ts/recipe/emailverification/utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;AAIH,+CAAoE;AAEpE,SAAgB,iCAAiC,CAA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c250ddb..38a83fb7d 100644
--- a/lib/build/recipe/recipeModule/index.d.ts
+++ b/lib/build/recipe/recipeModule/index.d.ts
@@ -1,14 +1,12 @@
-import HttpRequest from "../../httpRequest";
-import { NormalisedAppInfo, RecipeFeatureComponentMap } from "../../types";
-import { NormalisedRecipeModuleHooks, RecipeModuleConfig } from "./types";
-export default abstract class RecipeModule {
- recipeId: string;
- appInfo: NormalisedAppInfo;
- httpRequest: HttpRequest;
- hooks: NormalisedRecipeModuleHooks;
- constructor(config: RecipeModuleConfig);
+///
+import { RecipeFeatureComponentMap } from "../../types";
+import { NormalisedConfig } from "./types";
+export default abstract class RecipeModule> {
+ config: N;
+ constructor(config: N);
redirect: (context: T, history?: any, queryParams?: Record | undefined) => Promise;
getRedirectUrl: (context: T) => Promise;
getDefaultRedirectionURL(_: T): Promise;
abstract getFeatures(): RecipeFeatureComponentMap;
+ abstract getFeatureComponent(componentName: string, props: any): JSX.Element;
}
diff --git a/lib/build/recipe/recipeModule/index.js b/lib/build/recipe/recipeModule/index.js
index a106c0f4f..afadfbd68 100644
--- a/lib/build/recipe/recipeModule/index.js
+++ b/lib/build/recipe/recipeModule/index.js
@@ -147,10 +147,6 @@ var __importDefault =
return mod && mod.__esModule ? mod : { default: mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
-/*
- * Imports.
- */
-var httpRequest_1 = __importDefault(require("../../httpRequest"));
var utils_1 = require("../../utils");
var normalisedURLDomain_1 = __importDefault(require("../../normalisedURLDomain"));
/*
@@ -178,8 +174,9 @@ var RecipeModule = /** @class */ (function () {
origin_1 = new normalisedURLDomain_1.default(
utils_1.getWindowOrThrow().location.origin
).getAsStringDangerous();
- if (origin_1 !== this.appInfo.websiteDomain.getAsStringDangerous()) {
- redirectUrl = "" + this.appInfo.websiteDomain.getAsStringDangerous() + redirectUrl;
+ if (origin_1 !== this.config.appInfo.websiteDomain.getAsStringDangerous()) {
+ redirectUrl =
+ "" + this.config.appInfo.websiteDomain.getAsStringDangerous() + redirectUrl;
utils_1.getWindowOrThrow().location.href = redirectUrl;
return [2 /*return*/];
}
@@ -203,7 +200,7 @@ var RecipeModule = /** @class */ (function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
- return [4 /*yield*/, this.hooks.getRedirectionURL(context)];
+ return [4 /*yield*/, this.config.getRedirectionURL(context)];
case 1:
redirectUrl = _a.sent();
if (redirectUrl !== undefined) {
@@ -217,10 +214,7 @@ var RecipeModule = /** @class */ (function () {
});
});
};
- this.recipeId = config.recipeId;
- this.appInfo = config.appInfo;
- this.httpRequest = new httpRequest_1.default(this);
- this.hooks = utils_1.normalisedRecipeModuleHooks(config);
+ this.config = config;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
RecipeModule.prototype.getDefaultRedirectionURL = function (_) {
diff --git a/lib/build/recipe/recipeModule/index.js.map b/lib/build/recipe/recipeModule/index.js.map
index 7d0ba521e..04b3efb17 100644
--- a/lib/build/recipe/recipeModule/index.js.map
+++ b/lib/build/recipe/recipeModule/index.js.map
@@ -1 +1 @@
-{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/recipe/recipeModule/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH,kEAA4C;AAG5C,qCAAoG;AAEpG,kFAA4D;AAE5D;;GAEG;AACH;IAUI;;OAEG;IACH,sBAAY,MAAmC;QAA/C,iBAKC;QAED,aAAQ,GAAG,UAAO,OAAU,EAAE,OAAa,EAAE,WAAoC;;;;4BAC3D,qBAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAA;;wBAAhD,WAAW,GAAG,SAAkC;wBACpD,WAAW,GAAG,8BAAsB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;wBAE/D,IAAI;4BACA,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,yDAAyD;yBAClF;wBAAC,OAAO,CAAC,EAAE;4BAEF,WA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AAE,CAAC,QAAQ,CAAC,IAAI,GAAG,WAAW,CAAC;;;;aAClD,CAAC;QAEF,6EAA6E;QAC7E,mBAAc,GAAG,UAAO,OAAU;;;;4BAEV,qBAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAA;;wBAA1D,WAAW,GAAG,SAA4C;wBAChE,IAAI,WAAW,KAAK,SAAS,EAAE;4BAC3B,sBAAO,WAAW,EAAC;yBACtB;wBAGM,qBAAM,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,EAAA;;oBADnD,0BAA0B;oBAC1B,sBAAO,SAA4C,EAAC;;;aACvD,CAAC;QAtCE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAuCD,6DAA6D;IACvD,+CAAwB,GAA9B,UAA+B,CAAI;;;gBAC/B,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;;;KACnE;IAKL,mBAAC;AAAD,CAAC,AAvDD,IAuDC"}
\ No newline at end of file
diff --git a/lib/build/recipe/recipeModule/types.d.ts b/lib/build/recipe/recipeModule/types.d.ts
index a0af61ca3..a1fdb0cb0 100644
--- a/lib/build/recipe/recipeModule/types.d.ts
+++ b/lib/build/recipe/recipeModule/types.d.ts
@@ -1,25 +1,27 @@
import { NormalisedAppInfo } from "../../types";
-export declare type RecipeModuleConfig = RecipeModuleHooks & {
- recipeId: string;
- /**
- *
- * AppInfo as present in the recipe module manager
- */
- appInfo: NormalisedAppInfo;
-};
-export declare type RecipeModuleHooks = {
- getRedirectionURL?: (context: RecipeModuleGetRedirectionURLContext) => Promise;
- preAPIHook?: (context: RecipeModulePreAPIHookContext) => Promise = {
+ getRedirectionURL?: (context: GetRedirectionURLContextType) => Promise;
+ preAPIHook?: (context: PreAPIHookContextType) => Promise<{
+ url: string;
requestInit: RequestInit;
}>;
- onHandleEvent?: (context: RecipeModuleOnHandleEventContext) => void;
+ onHandleEvent?: (context: OnHandleEventContextType) => void;
+ useShadowDom?: boolean;
+ palette?: Record;
};
-export declare type NormalisedRecipeModuleHooks = {
- getRedirectionURL: (context: RecipeModuleGetRedirectionURLContext) => Promise;
- preAPIHook: (context: RecipeModulePreAPIHookContext) => Promise = {
+ recipeId: string;
+ appInfo: NormalisedAppInfo;
+} & UserInput;
+export declare type NormalisedConfig = {
+ recipeId: string;
+ appInfo: NormalisedAppInfo;
+ getRedirectionURL: (context: GetRedirectionURLContextType) => Promise;
+ preAPIHook: (context: PreAPIHookContextType) => Promise<{
+ url: string;
requestInit: RequestInit;
}>;
- onHandleEvent: (context: RecipeModuleOnHandleEventContext) => void;
+ onHandleEvent: (context: OnHandleEventContextType) => void;
+ useShadowDom: boolean;
+ palette: Record;
};
diff --git a/lib/build/recipe/recipeModule/utils.d.ts b/lib/build/recipe/recipeModule/utils.d.ts
new file mode 100644
index 000000000..1a1c9384a
--- /dev/null
+++ b/lib/build/recipe/recipeModule/utils.d.ts
@@ -0,0 +1,2 @@
+import { Config, NormalisedConfig } from "./types";
+export declare function normaliseRecipeModuleConfig(config: Config): NormalisedConfig;
diff --git a/lib/build/recipe/thirdparty/components/features/signInAndUp/api.js b/lib/build/recipe/recipeModule/utils.js
similarity index 66%
rename from lib/build/recipe/thirdparty/components/features/signInAndUp/api.js
rename to lib/build/recipe/recipeModule/utils.js
index f7257491e..65766086d 100644
--- a/lib/build/recipe/thirdparty/components/features/signInAndUp/api.js
+++ b/lib/build/recipe/recipeModule/utils.js
@@ -1,18 +1,4 @@
"use strict";
-/* 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 __awaiter =
(this && this.__awaiter) ||
function (thisArg, _arguments, P, generator) {
@@ -142,41 +128,62 @@ var __generator =
}
};
Object.defineProperty(exports, "__esModule", { value: true });
-/*
- * Imports.
- */
-var constants_1 = require("../../../../../constants");
-/*
- * Methods.
- */
-function getOAuthAuthorisationURLAPI(thirdPartyId, recipe) {
- return __awaiter(this, void 0, void 0, function () {
- var response;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- return [
- 4 /*yield*/,
- recipe.httpRequest.get("/authorisationurl", {}, "GET_AUTHORISATION_URL", {
- thirdPartyId: thirdPartyId,
- }),
- ];
- case 1:
- response = _a.sent();
- // If success.
- if (response.status === "OK") {
- return [
- 2 /*return*/,
- {
- status: "OK",
- url: response.url,
- },
- ];
- }
- throw new Error(constants_1.SOMETHING_WENT_WRONG_ERROR);
- }
- });
- });
+var utils_1 = require("../../utils");
+function normaliseRecipeModuleConfig(config) {
+ var _this = this;
+ var preAPIHook = config.preAPIHook,
+ onHandleEvent = config.onHandleEvent,
+ getRedirectionURL = config.getRedirectionURL;
+ if (preAPIHook === undefined) {
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ preAPIHook = function (context) {
+ return __awaiter(_this, void 0, void 0, function () {
+ return __generator(this, function (_a) {
+ return [2 /*return*/, context];
+ });
+ });
+ };
+ }
+ if (onHandleEvent === undefined) {
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
+ onHandleEvent = function (_) {};
+ }
+ if (getRedirectionURL === undefined) {
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ getRedirectionURL = function (_) {
+ return __awaiter(_this, void 0, void 0, function () {
+ return __generator(this, function (_a) {
+ return [2 /*return*/, undefined];
+ });
+ });
+ };
+ }
+ var useShadowDom = config.useShadowDom === undefined ? true : config.useShadowDom;
+ useShadowDom = getShouldUseShadowDomBasedOnBrowser(useShadowDom);
+ var palette = config.palette === undefined ? {} : config.palette;
+ return {
+ preAPIHook: preAPIHook,
+ getRedirectionURL: getRedirectionURL,
+ onHandleEvent: onHandleEvent,
+ useShadowDom: useShadowDom,
+ palette: palette,
+ recipeId: config.recipeId,
+ appInfo: config.appInfo,
+ };
+}
+exports.normaliseRecipeModuleConfig = normaliseRecipeModuleConfig;
+function getShouldUseShadowDomBasedOnBrowser(useShadowDom) {
+ /*
+ * Detect if browser is IE
+ * In order to disable unsupported shadowDom
+ * https://github.com/supertokens/supertokens-auth-react/issues/99
+ */
+ var isIE = utils_1.getWindowOrThrow().document.documentMode !== undefined;
+ // If browser is Internet Explorer, always disable shadow dom.
+ if (isIE === true) {
+ return false;
+ }
+ // Otherwise, use provided config or default to true.
+ return useShadowDom !== undefined ? useShadowDom : true;
}
-exports.getOAuthAuthorisationURLAPI = getOAuthAuthorisationURLAPI;
-//# sourceMappingURL=api.js.map
+//# sourceMappingURL=utils.js.map
diff --git a/lib/build/recipe/recipeModule/utils.js.map b/lib/build/recipe/recipeModule/utils.js.map
new file mode 100644
index 000000000..2555057ab
--- /dev/null
+++ b/lib/build/recipe/recipeModule/utils.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../ts/recipe/recipeModule/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qCAA+C;AAE/C,SAAgB,2BAA2B,CAAU,MAAuB;IAA5E,iBA8BC;IA7BS,IAAA,8BAAU,EAAE,oCAAa,EAAE,4CAAiB,CAAY;IAC9D,IAAI,UAAU,KAAK,SAAS,EAAE;QAC1B,6DAA6D;QAC7D,UAAU,GAAG,UAAO,OAAY;YAAK,sBAAA,OAAO,EAAA;iBAAA,CAAC;KAChD;IAED,IAAI,aAAa,KAAK,SAAS,EAAE;QAC7B,mGAAmG;QACnG,aAAa,GAAG,UAAC,CAAU,IAAY,CAAC,CAAC;KAC5C;IAED,IAAI,iBAAiB,KAAK,SAAS,EAAE;QACjC,6DAA6D;QAC7D,iBAAiB,GAAG,UAAO,CAAU;YAAkC,sBAAA,SAAS,EAAA;iBAAA,CAAC;KACpF;IAED,IAAI,YAAY,GAAG,MAAM,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC;IAClF,YAAY,GAAG,mCAAmC,CAAC,YAAY,CAAC,CAAC;IACjE,IAAM,OAAO,GAAG,MAAM,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;IAEnE,OAAO;QACH,UAAU,YAAA;QACV,iBAAiB,mBAAA;QACjB,aAAa,eAAA;QACb,YAAY,cAAA;QACZ,OAAO,SAAA;QACP,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,OAAO,EAAE,MAAM,CAAC,OAAO;KAC1B,CAAC;AACN,CAAC;AA9BD,kEA8BC;AAED,SAAS,mCAAmC,CAAC,YAAsB;IAC/D;;;;OAIG;IACH,IAAM,IAAI,GAAG,wBAAgB,EAAE,CAAC,QAAQ,CAAC,YAAY,KAAK,SAAS,CAAC;IACpE,8DAA8D;IAC9D,IAAI,IAAI,KAAK,IAAI,EAAE;QACf,OAAO,KAAK,CAAC;KAChB;IAED,qDAAqD;IACrD,OAAO,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5D,CAAC"}
\ No newline at end of file
diff --git a/lib/build/recipe/session/index.d.ts b/lib/build/recipe/session/index.d.ts
index 5c329b7ac..c11257b7c 100644
--- a/lib/build/recipe/session/index.d.ts
+++ b/lib/build/recipe/session/index.d.ts
@@ -1,33 +1,36 @@
-import { CreateRecipeFunction } from "../../types";
-import { SessionUserInput } from "./types";
+import { RecipeInterface } from "supertokens-website";
import SessionAuthComponent from "./sessionAuth";
+import { InputType } from "./types";
export default class SessionAPIWrapper {
static useSessionContext: () => import("./types").SessionContextType;
static SessionAuth: typeof SessionAuthComponent;
- static init(config?: SessionUserInput): CreateRecipeFunction;
- static getRefreshURLDomain(): string | undefined;
+ static init(config?: InputType): import("../../types").CreateRecipeFunction;
static getUserId(): Promise;
static getJWTPayloadSecurely(): Promise;
static attemptRefreshingSession(): Promise;
static doesSessionExist(): Promise;
- static addAxiosInterceptors: (axiosInstance: any) => void;
- static setAuth0API: (apiPath: string) => void;
- static getAuth0API: () => {
- apiPath: string | undefined;
- };
- static signOut: () => Promise;
+ static addAxiosInterceptors(axiosInstance: any): void;
+ static signOut(): Promise;
}
-export declare const useSessionContext: () => import("./types").SessionContextType;
-export declare const SessionAuth: typeof SessionAuthComponent;
-export declare const init: typeof SessionAPIWrapper.init;
-export declare const getRefreshURLDomain: typeof SessionAPIWrapper.getRefreshURLDomain;
-export declare const getUserId: typeof SessionAPIWrapper.getUserId;
-export declare const getJWTPayloadSecurely: typeof SessionAPIWrapper.getJWTPayloadSecurely;
-export declare const attemptRefreshingSession: typeof SessionAPIWrapper.attemptRefreshingSession;
-export declare const doesSessionExist: typeof SessionAPIWrapper.doesSessionExist;
-export declare const addAxiosInterceptors: (axiosInstance: any) => void;
-export declare const setAuth0API: (apiPath: string) => void;
-export declare const getAuth0API: () => {
- apiPath: string | undefined;
+declare const useSessionContext: () => import("./types").SessionContextType;
+declare const SessionAuth: typeof SessionAuthComponent;
+declare const init: typeof SessionAPIWrapper.init;
+declare const getUserId: typeof SessionAPIWrapper.getUserId;
+declare const getJWTPayloadSecurely: typeof SessionAPIWrapper.getJWTPayloadSecurely;
+declare const attemptRefreshingSession: typeof SessionAPIWrapper.attemptRefreshingSession;
+declare const doesSessionExist: typeof SessionAPIWrapper.doesSessionExist;
+declare const addAxiosInterceptors: typeof SessionAPIWrapper.addAxiosInterceptors;
+declare const signOut: typeof SessionAPIWrapper.signOut;
+export {
+ useSessionContext,
+ SessionAuth,
+ init,
+ getUserId,
+ getJWTPayloadSecurely,
+ attemptRefreshingSession,
+ doesSessionExist,
+ addAxiosInterceptors,
+ signOut,
+ RecipeInterface,
+ InputType,
};
-export declare const signOut: () => Promise;
diff --git a/lib/build/recipe/session/index.js b/lib/build/recipe/session/index.js
index 0e1006498..8495eda30 100644
--- a/lib/build/recipe/session/index.js
+++ b/lib/build/recipe/session/index.js
@@ -147,68 +147,62 @@ var __importDefault =
return mod && mod.__esModule ? mod : { default: mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
-var session_1 = __importDefault(require("./session"));
+var recipe_1 = __importDefault(require("./recipe"));
var sessionAuth_1 = __importDefault(require("./sessionAuth"));
var useSessionContext_1 = __importDefault(require("./useSessionContext"));
-/*
- * Class.
- */
var SessionAPIWrapper = /** @class */ (function () {
function SessionAPIWrapper() {}
SessionAPIWrapper.init = function (config) {
- return session_1.default.init(config);
- };
- SessionAPIWrapper.getRefreshURLDomain = function () {
- return session_1.default.getRefreshURLDomain();
+ return recipe_1.default.init(config);
};
SessionAPIWrapper.getUserId = function () {
- return session_1.default.getUserId();
+ return recipe_1.default.getInstanceOrThrow().getUserId();
};
SessionAPIWrapper.getJWTPayloadSecurely = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
- return [2 /*return*/, session_1.default.getJWTPayloadSecurely()];
+ return [2 /*return*/, recipe_1.default.getInstanceOrThrow().getJWTPayloadSecurely()];
});
});
};
SessionAPIWrapper.attemptRefreshingSession = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
- return [2 /*return*/, session_1.default.attemptRefreshingSession()];
+ return [2 /*return*/, recipe_1.default.getInstanceOrThrow().attemptRefreshingSession()];
});
});
};
SessionAPIWrapper.doesSessionExist = function () {
- return session_1.default.doesSessionExist();
+ return recipe_1.default.getInstanceOrThrow().doesSessionExist();
};
- SessionAPIWrapper.useSessionContext = useSessionContext_1.default;
- SessionAPIWrapper.SessionAuth = sessionAuth_1.default;
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
SessionAPIWrapper.addAxiosInterceptors = function (axiosInstance) {
- return session_1.default.addAxiosInterceptors(axiosInstance);
- };
- SessionAPIWrapper.setAuth0API = function (apiPath) {
- return session_1.default.setAuth0API(apiPath);
- };
- SessionAPIWrapper.getAuth0API = function () {
- return session_1.default.getAuth0API();
+ return recipe_1.default.addAxiosInterceptors(axiosInstance);
};
SessionAPIWrapper.signOut = function () {
- return session_1.default.signOut();
+ return recipe_1.default.getInstanceOrThrow().signOut();
};
+ SessionAPIWrapper.useSessionContext = useSessionContext_1.default;
+ SessionAPIWrapper.SessionAuth = sessionAuth_1.default;
return SessionAPIWrapper;
})();
exports.default = SessionAPIWrapper;
-exports.useSessionContext = SessionAPIWrapper.useSessionContext;
-exports.SessionAuth = SessionAPIWrapper.SessionAuth;
-exports.init = SessionAPIWrapper.init;
-exports.getRefreshURLDomain = SessionAPIWrapper.getRefreshURLDomain;
-exports.getUserId = SessionAPIWrapper.getUserId;
-exports.getJWTPayloadSecurely = SessionAPIWrapper.getJWTPayloadSecurely;
-exports.attemptRefreshingSession = SessionAPIWrapper.attemptRefreshingSession;
-exports.doesSessionExist = SessionAPIWrapper.doesSessionExist;
-exports.addAxiosInterceptors = SessionAPIWrapper.addAxiosInterceptors;
-exports.setAuth0API = SessionAPIWrapper.setAuth0API;
-exports.getAuth0API = SessionAPIWrapper.getAuth0API;
-exports.signOut = SessionAPIWrapper.signOut;
+var useSessionContext = SessionAPIWrapper.useSessionContext;
+exports.useSessionContext = useSessionContext;
+var SessionAuth = SessionAPIWrapper.SessionAuth;
+exports.SessionAuth = SessionAuth;
+var init = SessionAPIWrapper.init;
+exports.init = init;
+var getUserId = SessionAPIWrapper.getUserId;
+exports.getUserId = getUserId;
+var getJWTPayloadSecurely = SessionAPIWrapper.getJWTPayloadSecurely;
+exports.getJWTPayloadSecurely = getJWTPayloadSecurely;
+var attemptRefreshingSession = SessionAPIWrapper.attemptRefreshingSession;
+exports.attemptRefreshingSession = attemptRefreshingSession;
+var doesSessionExist = SessionAPIWrapper.doesSessionExist;
+exports.doesSessionExist = doesSessionExist;
+var addAxiosInterceptors = SessionAPIWrapper.addAxiosInterceptors;
+exports.addAxiosInterceptors = addAxiosInterceptors;
+var signOut = SessionAPIWrapper.signOut;
+exports.signOut = signOut;
//# sourceMappingURL=index.js.map
diff --git a/lib/build/recipe/session/index.js.map b/lib/build/recipe/session/index.js.map
index 1875497b9..e065262db 100644
--- a/lib/build/recipe/session/index.js.map
+++ b/lib/build/recipe/session/index.js.map
@@ -1 +1 @@
-{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../ts/recipe/session/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOH,sDAAgC;AAEhC,8DAAiD;AACjD,0EAAwD;AAExD;;GAEG;AACH;IAAA;IA6CA,CAAC;IAxCU,sBAAI,GAAX,UAAY,MAAyB;QACjC,OAAO,iBAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IAEM,qCAAmB,GAA1B;QACI,OAAO,iBAAO,CAAC,mBAAmB,EAAE,CAAC;IACzC,CAAC;IAEM,2BAAS,GAAhB;QACI,OAAO,iBAAO,CAAC,SAAS,EAAE,CAAC;IAC/B,CAAC;IAEY,uCAAqB,GAAlC;;;gBACI,sBAAO,iBAAO,CAAC,qBAAqB,EAAE,EAAC;;;KAC1C;IAEY,0CAAwB,GAArC;;;gBACI,sBAAO,iBAAO,CAAC,wBAAwB,EAAE,EAAC;;;KAC7C;IAEM,kCAAgB,GAAvB;QACI,OAAO,iBAAO,CAAC,gBAAgB,EAAE,CAAC;IACtC,CAAC;IA1BM,mCAAiB,GAAG,2BAAqB,CAAC;IAE1C,6BAAW,GAAG,qBAAoB,CAAC;IA0B1C,6EAA6E;IACtE,sCAAoB,GAAG,UAAC,aAAkB;QAC7C,OAAO,iBAAO,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAC;IACvD,CAAC,CAAC;IAEK,6BAAW,GAAG,UAAC,OAAe;QACjC,OAAO,iBAAO,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B,IAAM,oBAAoB,GAAG,iBAAiB,CAAC,oBAAoB,CAAC;AAWhE,oDAAoB;AAVxB,IAAM,OAAO,GAAG,iBAAiB,CAAC,OAAO,CAAC;AAWtC,0BAAO"}
\ No newline at end of file
diff --git a/lib/build/recipe/session/recipe.d.ts b/lib/build/recipe/session/recipe.d.ts
new file mode 100644
index 000000000..218743a96
--- /dev/null
+++ b/lib/build/recipe/session/recipe.d.ts
@@ -0,0 +1,25 @@
+///
+import RecipeModule from "../recipeModule";
+import { CreateRecipeFunction, NormalisedAppInfo } from "../../types";
+import { InputType } from "./types";
+export default class Session extends RecipeModule {
+ static instance?: Session;
+ static RECIPE_ID: string;
+ constructor(
+ config: InputType & {
+ recipeId: string;
+ appInfo: NormalisedAppInfo;
+ }
+ );
+ getFeatureComponent: (_: string) => JSX.Element;
+ getFeatures: () => Record;
+ getUserId: () => Promise;
+ getJWTPayloadSecurely: () => Promise;
+ doesSessionExist: () => Promise;
+ signOut: () => Promise;
+ attemptRefreshingSession: () => Promise;
+ static addAxiosInterceptors(axiosInstance: any): void;
+ static init(config?: InputType): CreateRecipeFunction;
+ static getInstanceOrThrow(): Session;
+ static reset(): void;
+}
diff --git a/lib/build/recipe/session/session.js b/lib/build/recipe/session/recipe.js
similarity index 74%
rename from lib/build/recipe/session/session.js
rename to lib/build/recipe/session/recipe.js
index 1d81755e3..e415d395e 100644
--- a/lib/build/recipe/session/session.js
+++ b/lib/build/recipe/session/recipe.js
@@ -190,25 +190,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
var recipeModule_1 = __importDefault(require("../recipeModule"));
var utils_1 = require("../../utils");
var supertokens_website_1 = __importDefault(require("supertokens-website"));
-/*
- * Class.
- */
var Session = /** @class */ (function (_super) {
__extends(Session, _super);
- /*
- * Constructor.
- */
function Session(config) {
var _this = _super.call(this, config) || this;
- /*
- * Instance methods.
- */
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ _this.getFeatureComponent = function (_) {
+ throw new Error("should never come here");
+ };
_this.getFeatures = function () {
return {};
};
- _this.getRefreshURLDomain = function () {
- return supertokens_website_1.default.getRefreshURLDomain();
- };
_this.getUserId = function () {
return supertokens_website_1.default.getUserId();
};
@@ -219,6 +211,12 @@ var Session = /** @class */ (function (_super) {
});
});
};
+ _this.doesSessionExist = function () {
+ return supertokens_website_1.default.doesSessionExist();
+ };
+ _this.signOut = function () {
+ return supertokens_website_1.default.signOut();
+ };
_this.attemptRefreshingSession = function () {
return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
@@ -226,48 +224,36 @@ var Session = /** @class */ (function (_super) {
});
});
};
- _this.doesSessionExist = function () {
- return supertokens_website_1.default.doesSessionExist();
- };
- _this.setAuth0API = function (apiPath) {
- return supertokens_website_1.default.setAuth0API(apiPath);
- };
- _this.getAuth0API = function () {
- return supertokens_website_1.default.getAuth0API();
- };
- _this.signOut = function () {
- return supertokens_website_1.default.signOut();
- };
- var usersHeadersForRefreshAPI = {};
- if (config.refreshAPICustomHeaders !== undefined) {
- usersHeadersForRefreshAPI = config.refreshAPICustomHeaders;
- }
- var usersHeadersForSignoutAPI = {};
- if (config.signoutAPICustomHeaders !== undefined) {
- usersHeadersForSignoutAPI = config.signoutAPICustomHeaders;
- }
- supertokens_website_1.default.init({
- sessionScope:
- config.sessionScope === undefined
- ? undefined
- : {
- scope: config.sessionScope,
- authDomain: config.appInfo.websiteDomain.getAsStringDangerous(),
- },
- refreshAPICustomHeaders: __assign({ rid: _this.recipeId }, usersHeadersForRefreshAPI),
- signoutAPICustomHeaders: __assign({ rid: _this.recipeId }, usersHeadersForSignoutAPI),
- autoAddCredentials: config.autoAddCredentials,
- sessionExpiredStatusCode: config.sessionExpiredStatusCode,
- apiDomain: config.appInfo.apiDomain.getAsStringDangerous(),
- apiBasePath: config.appInfo.apiBasePath.getAsStringDangerous(),
- isInIframe: config.isInIframe,
- cookieDomain: config.cookieDomain,
- });
+ supertokens_website_1.default.init(
+ __assign({}, config, {
+ preAPIHook: function (context) {
+ return __awaiter(_this, void 0, void 0, function () {
+ var response;
+ return __generator(this, function (_a) {
+ response = __assign({}, context, {
+ requestInit: __assign({}, context.requestInit, {
+ headers: __assign({}, context.requestInit.headers, { rid: config.recipeId }),
+ }),
+ });
+ if (config.preAPIHook === undefined) {
+ return [2 /*return*/, response];
+ } else {
+ return [2 /*return*/, config.preAPIHook(context)];
+ }
+ return [2 /*return*/];
+ });
+ });
+ },
+ apiDomain: config.appInfo.apiDomain.getAsStringDangerous(),
+ apiBasePath: config.appInfo.apiBasePath.getAsStringDangerous(),
+ })
+ );
return _this;
}
- /*
- * Static methods.
- */
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
+ Session.addAxiosInterceptors = function (axiosInstance) {
+ return supertokens_website_1.default.addAxiosInterceptors(axiosInstance);
+ };
Session.init = function (config) {
return function (appInfo) {
Session.instance = new Session(__assign({}, config, { appInfo: appInfo, recipeId: Session.RECIPE_ID }));
@@ -282,45 +268,6 @@ var Session = /** @class */ (function (_super) {
}
return Session.instance;
};
- Session.getRefreshURLDomain = function () {
- return Session.getInstanceOrThrow().getRefreshURLDomain();
- };
- Session.getUserId = function () {
- return Session.getInstanceOrThrow().getUserId();
- };
- Session.getJWTPayloadSecurely = function () {
- return __awaiter(this, void 0, void 0, function () {
- return __generator(this, function (_a) {
- return [2 /*return*/, Session.getInstanceOrThrow().getJWTPayloadSecurely()];
- });
- });
- };
- Session.attemptRefreshingSession = function () {
- return __awaiter(this, void 0, void 0, function () {
- return __generator(this, function (_a) {
- return [2 /*return*/, Session.getInstanceOrThrow().attemptRefreshingSession()];
- });
- });
- };
- Session.doesSessionExist = function () {
- return Session.getInstanceOrThrow().doesSessionExist();
- };
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
- Session.addAxiosInterceptors = function (axiosInstance) {
- return supertokens_website_1.default.addAxiosInterceptors(axiosInstance);
- };
- Session.setAuth0API = function (apiPath) {
- return Session.getInstanceOrThrow().setAuth0API(apiPath);
- };
- Session.getAuth0API = function () {
- return Session.getInstanceOrThrow().getAuth0API();
- };
- Session.signOut = function () {
- return Session.getInstanceOrThrow().signOut();
- };
- /*
- * Tests methods.
- */
Session.reset = function () {
if (!utils_1.isTest()) {
return;
@@ -332,4 +279,4 @@ var Session = /** @class */ (function (_super) {
return Session;
})(recipeModule_1.default);
exports.default = Session;
-//# sourceMappingURL=session.js.map
+//# sourceMappingURL=recipe.js.map
diff --git a/lib/build/recipe/session/recipe.js.map b/lib/build/recipe/session/recipe.js.map
new file mode 100644
index 000000000..b8d39a8ad
--- /dev/null
+++ b/lib/build/recipe/session/recipe.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"recipe.js","sourceRoot":"","sources":["../../../ts/recipe/session/recipe.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH;;GAEG;AACH,iEAA2C;AAE3C,qCAAqC;AAErC,4EAA6C;AAE7C;IAAqC,2BAA4C;IAI7E,iBAAY,MAAoE;QAAhF,YACI,kBAAM,MAAM,CAAC,SAwBhB;QAED,6DAA6D;QAC7D,yBAAmB,GAAG,UAAC,CAAS;YAC5B,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC9C,CAAC,CAAC;QAEF,iBAAW,GAAG;YACV,OAAO,EAAE,CAAC;QACd,CAAC,CAAC;QAEF,eAAS,GAAG;YACR,OAAO,6BAAU,CAAC,SAAS,EAAE,CAAC;QAClC,CAAC,CAAC;QAEF,2BAAqB,GAAG;;gBACpB,sBAAO,6BAAU,CAAC,qBAAqB,EAAE,EAAC;;aAC7C,CAAC;QAEF,sBAAgB,GAAG;YACf,OAAO,6BAAU,CAAC,gBAAgB,EAAE,CAAC;QACzC,CAAC,CAAC;QAEF,aAAO,GAAG;YACN,OAAO,6BAAU,CAAC,OAAO,EAAE,CAAC;QAChC,CAAC,CAAC;QAEF,8BAAwB,GAAG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AO,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC7B,OAAO;IACX,CAAC;IA3FM,iBAAS,GAAG,SAAS,CAAC;IA4FjC,cAAC;CAAA,AA9FD,CAAqC,sBAAY,GA8FhD;kBA9FoB,OAAO"}
\ No newline at end of file
diff --git a/lib/build/recipe/session/session.d.ts b/lib/build/recipe/session/session.d.ts
deleted file mode 100644
index d61262113..000000000
--- a/lib/build/recipe/session/session.d.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import RecipeModule from "../recipeModule";
-import { CreateRecipeFunction } from "../../types";
-import { SessionUserInput, SessionConfig } from "./types";
-export default class Session extends RecipeModule {
- static instance?: Session;
- static RECIPE_ID: string;
- constructor(config: SessionConfig);
- getFeatures: () => Record;
- getRefreshURLDomain: () => string | undefined;
- getUserId: () => Promise;
- getJWTPayloadSecurely: () => Promise;
- attemptRefreshingSession: () => Promise;
- doesSessionExist: () => Promise;
- setAuth0API: (apiPath: string) => void;
- getAuth0API: () => {
- apiPath: string | undefined;
- };
- signOut: () => Promise;
- static init(config?: SessionUserInput): CreateRecipeFunction;
- static getInstanceOrThrow(): Session;
- static getRefreshURLDomain(): string | undefined;
- static getUserId(): Promise