-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #448 from ForgeRock/davinci-client
chore: initial-setup-for-davinci-client
- Loading branch information
Showing
69 changed files
with
3,590 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
link-workspace-packages=false | ||
strict-peer-dependencies=false | ||
save-workspace-protocol=rolling | ||
save-prefix="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
node_modules | ||
*.md | ||
LICENSE | ||
.babelrc | ||
.env* | ||
.bin | ||
dist | ||
.eslintignore | ||
*.html | ||
*.svg | ||
*.css | ||
public | ||
*.json | ||
*.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { ActionCollector } from '@forgerock/davinci-client/types'; | ||
|
||
export default function flowLinkComponent( | ||
formEl: HTMLFormElement, | ||
collector: ActionCollector, | ||
flow: (action: string) => void, | ||
renderForm: () => void, | ||
) { | ||
const button = document.createElement('button'); | ||
|
||
button.classList.add('flow-link'); | ||
button.type = 'button'; | ||
button.innerText = collector.output.label; | ||
|
||
formEl?.appendChild(button); | ||
|
||
button.addEventListener('click', async () => { | ||
await flow(collector.output.key); | ||
renderForm(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { SingleValueCollector } from '@forgerock/davinci-client/types'; | ||
|
||
export default function passwordComponent( | ||
formEl: HTMLFormElement, | ||
collector: SingleValueCollector, | ||
updater: (value: string, index?: number) => void, | ||
) { | ||
const label = document.createElement('label'); | ||
const input = document.createElement('input'); | ||
|
||
label.htmlFor = collector.output.key; | ||
label.innerText = collector.output.label; | ||
input.type = 'password'; | ||
input.id = collector.output.key; | ||
input.name = collector.output.key; | ||
|
||
formEl?.appendChild(label); | ||
formEl?.appendChild(input); | ||
|
||
formEl?.querySelector(`#${collector.output.key}`)?.addEventListener('blur', (event: Event) => { | ||
updater((event.target as HTMLInputElement).value); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { SingleValueCollector } from '@forgerock/davinci-client/types'; | ||
|
||
export default function ( | ||
formEl: HTMLFormElement, | ||
collector: SingleValueCollector, | ||
updater: (value: string, index?: number) => void, | ||
) { | ||
// create paragraph element with text of "Loading ... " | ||
const p = document.createElement('p'); | ||
|
||
p.innerText = collector.output.label; | ||
formEl?.appendChild(p); | ||
|
||
updater('fakeprofile'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { ActionCollector } from '@forgerock/davinci-client/types'; | ||
|
||
export default function submitButtonComponent(formEl: HTMLFormElement, collector: ActionCollector) { | ||
const link = document.createElement('a'); | ||
|
||
link.innerText = collector.output.label; | ||
link.href = collector.output?.url || ''; | ||
|
||
formEl?.appendChild(link); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { ActionCollector } from '@forgerock/davinci-client/types'; | ||
|
||
export default function submitButtonComponent(formEl: HTMLFormElement, collector: ActionCollector) { | ||
const button = document.createElement('button'); | ||
|
||
button.type = 'submit'; | ||
button.innerText = collector.output.label; | ||
|
||
formEl?.appendChild(button); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { SingleValueCollector } from '@forgerock/davinci-client/types'; | ||
|
||
export default function usernameComponent( | ||
formEl: HTMLFormElement, | ||
collector: SingleValueCollector, | ||
updater: (value: string, index?: number) => void, | ||
) { | ||
const collectorKey = collector.output.key; | ||
const label = document.createElement('label'); | ||
const input = document.createElement('input'); | ||
|
||
label.htmlFor = collectorKey; | ||
label.innerText = collector.output.label; | ||
input.type = 'text'; | ||
input.id = collectorKey; | ||
input.name = collectorKey; | ||
|
||
formEl?.appendChild(label); | ||
formEl?.appendChild(input); | ||
|
||
formEl?.querySelector(`#${collectorKey}`)?.addEventListener('input', (event) => { | ||
updater((event.target as HTMLInputElement).value); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Vite + TS</title> | ||
</head> | ||
<body> | ||
<div id="app"> | ||
<div id="section"> | ||
<a href="https://vitejs.dev" target="_blank"> | ||
<img src="./public/vite.svg" class="logo" alt="Vite logo" /> | ||
</a> | ||
<a href="https://www.typescriptlang.org/" target="_blank"> | ||
<img src="./public/typescript.svg" class="logo vanilla" alt="TypeScript logo" /> | ||
</a> | ||
<form id="form"></form> | ||
</div> | ||
</div> | ||
<script type="module" src="main.ts"></script> | ||
</body> | ||
</html> |
Oops, something went wrong.