Skip to content

Commit 6c244ad

Browse files
Merge pull request #106 from auth0/feat/add-one-trust
feat: add auth0-docs-ui package for mintlify customizations
2 parents 493074e + 238f6ce commit 6c244ad

Some content is hidden

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

71 files changed

+7900
-208
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ temp/
33

44
# macOS
55
.DS_Store
6-
*.py
6+
*.py
7+
8+
.vite

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"tailwindCSS.experimental.classRegex": [
3+
["cva\\(([^)]*)\\)", "[`'\"`]([^`'\"`]*)[`'\"`]"],
4+
["cn\\(([^)]*)\\)", "[`'\"`]([^`'\"`]*)[`'\"`]"]
5+
]
6+
}

main/docs.json

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
"canonical": "https://auth0.com"
1212
}
1313
},
14-
"banner": {
15-
"content": "🚀 We've rolled out a new docs experience - faster, cleaner, and a better developer experience. [Switch to old version](https://auth0.com/docs).",
16-
"dismissible": true
17-
},
1814
"colors": {
1915
"primary": "#000",
2016
"dark": "#fff",
@@ -7256,23 +7252,6 @@
72567252
}
72577253
]
72587254
},
7259-
"navbar": {
7260-
"links": [
7261-
{
7262-
"label": "Log In",
7263-
"href": "https://auth0.auth0.com/u/login/"
7264-
},
7265-
{
7266-
"label": "Contact Sales",
7267-
"href": "https://auth0.com/get-started?place=header&type=button&text=talk%20to%20sales"
7268-
}
7269-
],
7270-
"primary": {
7271-
"type": "button",
7272-
"label": "Sign Up",
7273-
"href": "https://auth0.com/signup"
7274-
}
7275-
},
72767255
"logo": {
72777256
"light": "/docs/logo/light.svg",
72787257
"dark": "/docs/logo/dark.svg",

main/docs/scripts/appendRelatedPages.js

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

main/snippets/AuthCodeBlock.jsx

Lines changed: 42 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,51 @@
1-
export const AuthCodeBlock = ({ filename, icon, language, highlight, children }) => {
2-
const [user, setUser] = useState(null);
3-
const [isLoading, setIsLoading] = useState(true);
4-
const [isAuthenticated, setIsAuthenticated] = useState(false);
5-
6-
const userDomainPlaceholder = /{yourDomain}/g;
7-
const userClientIdPlaceholder = /{yourClientId}/g;
8-
const userClientSecretPlaceholder = /{yourClientSecret}/g;
9-
const userSecretPlaceholder = /{yourSecret}/g;
10-
const userRedirectUriPlaceholder = /{redirectUri}/g;
11-
const yourAudiencePlaceholder = /{yourAudience}/g;
12-
13-
const processedChildren = children
14-
.replace(userDomainPlaceholder, user?.userdomain || "{yourDomain}")
15-
.replace(userClientIdPlaceholder, user?.userClientId || "{yourClientId}")
16-
.replace(userClientSecretPlaceholder, user?.userClientSecret || "{yourClientSecret}")
17-
.replace(userSecretPlaceholder, user?.userSecret || "{yourSecret}")
18-
.replace(yourAudiencePlaceholder, user?.yourAudience || "{yourAudience}")
19-
.replace(userRedirectUriPlaceholder, user?.userRedirectUri || "{redirectUri}");
1+
export const AuthCodeBlock = ({
2+
filename,
3+
icon,
4+
language,
5+
highlight,
6+
children,
7+
}) => {
8+
const [processedChildren, setProcessedChildren] = useState(children);
209

2110
useEffect(() => {
22-
const initUser = async () => {
23-
try {
24-
await window.authService.getAuthStatus();
25-
const user = window.authService.user;
26-
if (!user) {
27-
throw new Error("User not found");
11+
let unsubscribe = null;
12+
13+
function init() {
14+
unsubscribe = window.autorun(() => {
15+
let processedChildren = children;
16+
for (const [
17+
key,
18+
value,
19+
] of window.rootStore.variableStore.values.entries()) {
20+
processedChildren = processedChildren.replace(
21+
new RegExp(key, "g"),
22+
value
23+
);
2824
}
29-
console.log("User fetched:", user);
30-
setUser(user);
31-
setIsAuthenticated(true);
32-
} catch (error) {
33-
console.error("Failed to initialize user:", error);
34-
} finally {
35-
setIsLoading(false);
36-
}
37-
};
25+
setProcessedChildren(processedChildren);
26+
});
27+
}
28+
29+
if (window.rootStore) {
30+
init();
31+
} else {
32+
window.addEventListener("adu:storeReady", init);
33+
}
3834

39-
initUser();
40-
}, []);
35+
return () => {
36+
window.removeEventListener("adu:storeReady", init);
37+
unsubscribe?.();
38+
};
39+
}, [children]);
4140

4241
return (
43-
<CodeBlock filename={filename} icon={icon} language={language} lines highlight={highlight}>
42+
<CodeBlock
43+
filename={filename}
44+
icon={icon}
45+
language={language}
46+
lines
47+
highlight={highlight}
48+
>
4449
{processedChildren}
4550
</CodeBlock>
4651
);

main/snippets/AuthCodeGroup.jsx

Lines changed: 47 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,53 @@
11
export const AuthCodeGroup = ({ children, dropdown }) => {
2-
const [user, setUser] = useState(null);
2+
const [processedChildren, setProcessedChildren] = useState(children);
33

4-
const userDomainPlaceholder = /{yourDomain}/g;
5-
const userClientIdPlaceholder = /{yourClientId}/g;
6-
const userClientSecretPlaceholder = /{yourClientSecret}/g;
7-
const userSecretPlaceholder = /{yourSecret}/g;
8-
const userRedirectUriPlaceholder = /{redirectUri}/g;
9-
const yourAudiencePlaceholder = /{yourAudience}/g;
4+
useEffect(() => {
5+
let unsubscribe = null;
106

11-
const processChildren = (node) => {
12-
if (typeof node === "string") {
13-
return node
14-
.replace(userDomainPlaceholder, user?.userdomain || "{yourDomain}")
15-
.replace(userClientIdPlaceholder, user?.userClientId || "{yourClientId}")
16-
.replace(userClientSecretPlaceholder, user?.userClientSecret || "{yourClientSecret}")
17-
.replace(userSecretPlaceholder, user?.userSecret || "{yourSecret}")
18-
.replace(yourAudiencePlaceholder, user?.yourAudience || "{yourAudience}")
19-
.replace(userRedirectUriPlaceholder, user?.userRedirectUri || "{redirectUri}");
20-
} else if (Array.isArray(node)) {
21-
return node.map(processChildren);
22-
} else if (node && node.props && node.props.children) {
23-
return {
24-
...node,
25-
props: {
26-
...node.props,
27-
children: processChildren(node.props.children),
28-
},
29-
};
7+
function init() {
8+
unsubscribe = window.autorun(() => {
9+
const processChildren = (node) => {
10+
if (typeof node === "string") {
11+
let processedNode = node;
12+
for (const [
13+
key,
14+
value,
15+
] of window.rootStore.variableStore.values.entries()) {
16+
processedNode = processedNode.replace(
17+
new RegExp(key, "g"),
18+
value
19+
);
20+
}
21+
return processedNode;
22+
} else if (Array.isArray(node)) {
23+
return node.map(processChildren);
24+
} else if (node && node.props && node.props.children) {
25+
return {
26+
...node,
27+
props: {
28+
...node.props,
29+
children: processChildren(node.props.children),
30+
},
31+
};
32+
}
33+
return node;
34+
};
35+
36+
setProcessedChildren(processChildren(children));
37+
});
38+
}
39+
40+
if (window.rootStore) {
41+
init();
42+
} else {
43+
window.addEventListener("adu:storeReady", init);
3044
}
31-
return node;
32-
};
3345

34-
return <CodeGroup dropdown={dropdown}>{processChildren(children)}</CodeGroup>;
46+
return () => {
47+
window.removeEventListener("adu:storeReady", init);
48+
unsubscribe?.();
49+
};
50+
}, [children]);
51+
52+
return <CodeGroup dropdown={dropdown}>{processedChildren}</CodeGroup>;
3553
};

main/ui/auth0-docs-ui-1.0.0.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)