Skip to content

Commit efb7787

Browse files
authored
fix: propagate overrides into sub-recipe only components (#652)
* fix: propagate overrides into sub-recipe only components * test: fix exmple tests + changelog * test: example test fixing
1 parent 838d488 commit efb7787

File tree

60 files changed

+565
-527
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+565
-527
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
### Fixes
1616

1717
- Fixed all buttons to have pointer cursor on hover.
18+
- Fixed component override propagation into sub-recipe only feature components (i.e., ThirdPartySignInAndUpCallbackTheme_Override in thirdpartyemailpassword)
1819

1920
## [0.31.0] - 2023-02-01
2021

examples/with-emailverification-then-password-thirdpartyemailpassword/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
"@testing-library/jest-dom": "^5.14.1",
2323
"@testing-library/react": "^11.2.7",
2424
"@testing-library/user-event": "^12.1.10",
25+
"@types/react": "^18.0.10",
26+
"@types/react-dom": "^18.0.5",
2527
"nodemon": "^2.0.6"
2628
},
2729
"scripts": {

examples/with-emailverification-then-password-thirdpartyemailpassword/src/CustomSignUp/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default function CustomSignUp({ DefaultComponent, ...props }) {
1313
// we use useLayoutEffect instead of useEffect because that prevent the UI glitch that
1414
// happens cause of the JS manipulation
1515
React.useLayoutEffect(() => {
16-
if (window.location.pathname === "/auth") {
16+
if (window.location.pathname.startsWith("/auth")) {
1717
// here we hide the password field..
1818
document
1919
.querySelector("#supertokens-root")

examples/with-jwt-localstorage/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
"@testing-library/jest-dom": "^5.12.0",
2828
"@testing-library/react": "^11.1.0",
2929
"@testing-library/user-event": "^12.6.2",
30+
"@types/react": "^18.0.10",
31+
"@types/react-dom": "^18.0.5",
3032
"nodemon": "^2.0.12"
3133
},
3234
"scripts": {

examples/with-multiple-email-sign-in/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
"@testing-library/jest-dom": "^5.14.1",
2626
"@testing-library/react": "^11.2.7",
2727
"@testing-library/user-event": "^12.1.10",
28+
"@types/react": "^18.0.10",
29+
"@types/react-dom": "^18.0.5",
2830
"nodemon": "^2.0.6"
2931
},
3032
"scripts": {

examples/with-one-login-per-subdomain/test/basic.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ describe("SuperTokens Example Basic tests", function () {
7777
it("Successful signup with credentials", async function () {
7878
await Promise.all([page.goto(websiteDomain), page.waitForNavigation({ waitUntil: "networkidle0" })]);
7979

80-
assert.strictEqual(page.url(), "http://a.example.com:3000/auth?redirectToPath=");
80+
assert.strictEqual(page.url(), "http://a.example.com:3000/auth/?redirectToPath=");
8181
// redirected to /auth
8282
await toggleSignInSignUp(page);
8383
await setInputValues(page, [

examples/with-sign-in-up-split-emailpassword/test/basic.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ describe("SuperTokens Example Basic tests", function () {
7575

7676
// redirected to /auth
7777
await waitForSTElement(page);
78-
assert.strictEqual(page.url(), websiteDomain + "/auth?redirectToPath=");
78+
assert.strictEqual(page.url(), websiteDomain + "/auth/?redirectToPath=");
7979

8080
// Go to separate sign up page
8181
const link = await waitForSTElement(page, "#signupLink");

examples/with-supabase/test/basic.test.js

Lines changed: 0 additions & 119 deletions
This file was deleted.

examples/with-thirdpartyemailpassword-2fa-passwordless/test/basic.test.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const {
3131
const SuperTokensNode = require("supertokens-node");
3232
const Session = require("supertokens-node/recipe/session");
3333
const Passwordless = require("supertokens-node/recipe/passwordless");
34+
const EmailVerification = require("supertokens-node/recipe/emailverification");
3435
const ThirdPartyEmailPassword = require("supertokens-node/recipe/thirdpartyemailpassword");
3536

3637
// Run the tests in a DOM environment.
@@ -54,6 +55,9 @@ SuperTokensNode.init({
5455
contactMethod: "EMAIL_OR_PHONE",
5556
flowType: "USER_INPUT_CODE_AND_MAGIC_LINK",
5657
}),
58+
EmailVerification.init({
59+
mode: "OPTIONAL",
60+
}),
5761
ThirdPartyEmailPassword.init(),
5862
Session.init(),
5963
],
@@ -125,10 +129,21 @@ describe("SuperTokens Example Basic tests", function () {
125129
await setInputValues(page, [{ name: "userInputCode", value: testOTP }]);
126130
await submitForm(page);
127131

128-
const callApiBtn = await page.waitForSelector(".sessionButton");
129-
130132
const [user] = await ThirdPartyEmailPassword.getUsersByEmail(email);
131133

134+
// We get to the email verification screen
135+
await waitForSTElement(page, "[data-supertokens~='sendVerifyEmailIcon']");
136+
// Attempt reloading Home
137+
await Promise.all([page.goto(websiteDomain), page.waitForNavigation({ waitUntil: "networkidle0" })]);
138+
await waitForSTElement(page, "[data-supertokens~='sendVerifyEmailIcon']");
139+
140+
// Create a new token and use it (we don't have access to the originally sent one)
141+
const tokenInfo = await EmailVerification.createEmailVerificationToken(user.id, user.email);
142+
await page.goto(`${websiteDomain}/auth/verify-email?token=${tokenInfo.token}`);
143+
await submitForm(page);
144+
145+
const callApiBtn = await page.waitForSelector(".sessionButton");
146+
132147
let setAlertContent;
133148
let alertContent = new Promise((res) => (setAlertContent = res));
134149
page.on("dialog", async (dialog) => {

lib/build/components/componentOverride/componentOverrideContext.d.ts

Lines changed: 4 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)