-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: terms of service / privacy policy checkbox #3207
Merged
Merged
Changes from 11 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
5bf3f6a
feat: terms of policy checkbox
magiziz 73c50f7
refactor: wui-checkbox component
magiziz 4aedf3c
chore: setup checkbox for all terms of policy views
magiziz a8bc01a
chore: add graident effect
magiziz ae12324
chore: add enableLegalCheckbox in OptionsController
magiziz 3eea4ab
chore: improve interpolate
magiziz f4fb694
Merge branch 'main' into chore/terms-checkbox
magiziz ab92b61
chore: tweak styles
magiziz 170f460
chore: add e2e tests
magiziz 4b1de07
chore: add more properties to w3m-legal-checkbox component
magiziz b5a863f
chore: tweak
magiziz 1703b1b
chore: prettify
magiziz 4767409
Merge branch 'main' into chore/terms-checkbox
magiziz 8dfc760
chore: changeset
magiziz 7f37c88
fix: danger rules
magiziz 253d3cb
chore: add tab index property to email and socia login flow
magiziz bfce081
chore: add tab index for all necessary components that is associated …
magiziz ff62220
Merge branch 'main' into chore/terms-checkbox
magiziz dd2a048
chore: tweak
magiziz f479837
chore: format code
magiziz 9c40843
chore: rename enableLegalCheckbox to legalCheckbox and add changeset
magiziz da4ff26
chore: remove spacing
magiziz 6f6b3bb
Merge branch 'main' into chore/terms-checkbox
magiziz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,24 @@ | ||
import type { Meta } from '@storybook/web-components' | ||
import '@reown/appkit-ui/src/composites/wui-checkbox' | ||
import '@reown/appkit-ui/src/components/wui-icon' | ||
import '@reown/appkit-ui/src/components/wui-text' | ||
import type { WuiCheckBox } from '@reown/appkit-ui/src/composites/wui-checkbox' | ||
import { html } from 'lit' | ||
|
||
type Component = Meta<WuiCheckBox> | ||
|
||
export default { | ||
title: 'Composites/wui-checkbox', | ||
args: { | ||
checked: false | ||
}, | ||
argTypes: { | ||
checked: { | ||
control: { type: 'boolean' } | ||
} | ||
} | ||
} as Component | ||
|
||
export const Default: Component = { | ||
render: (args) => html`<wui-checkbox ?checked=${args.checked}></wui-checkbox>` | ||
} |
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 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 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 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
63 changes: 63 additions & 0 deletions
63
packages/scaffold-ui/src/partials/w3m-legal-checkbox/index.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,63 @@ | ||
import { OptionsController } from '@reown/appkit-core' | ||
import { customElement } from '@reown/appkit-ui' | ||
import { LitElement, html } from 'lit' | ||
import styles from './styles.js' | ||
|
||
@customElement('w3m-legal-checkbox') | ||
export class W3mLegalCheckbox extends LitElement { | ||
public static override styles = [styles] | ||
|
||
// -- Render -------------------------------------------- // | ||
public override render() { | ||
const { termsConditionsUrl, privacyPolicyUrl, enableLegalCheckbox } = OptionsController.state | ||
|
||
if (!termsConditionsUrl && !privacyPolicyUrl) { | ||
return null | ||
} | ||
|
||
if (!enableLegalCheckbox) { | ||
return null | ||
} | ||
|
||
return html` | ||
<wui-checkbox data-testid="wui-checkbox"> | ||
<wui-text color="fg-250" variant="small-400" align="left"> | ||
I agree to our ${this.termsTemplate()} ${this.andTemplate()} ${this.privacyTemplate()} | ||
</wui-text> | ||
</wui-checkbox> | ||
` | ||
} | ||
|
||
// -- Private ------------------------------------------- // | ||
private andTemplate() { | ||
const { termsConditionsUrl, privacyPolicyUrl } = OptionsController.state | ||
|
||
return termsConditionsUrl && privacyPolicyUrl ? 'and' : '' | ||
} | ||
|
||
private termsTemplate() { | ||
const { termsConditionsUrl } = OptionsController.state | ||
|
||
if (!termsConditionsUrl) { | ||
return null | ||
} | ||
|
||
return html`<a rel="noreferrer" target="_blank" href=${termsConditionsUrl}>terms of service</a>` | ||
} | ||
|
||
private privacyTemplate() { | ||
const { privacyPolicyUrl } = OptionsController.state | ||
|
||
if (!privacyPolicyUrl) { | ||
return null | ||
} | ||
|
||
return html`<a rel="noreferrer" target="_blank" href=${privacyPolicyUrl}>privacy policy</a>` | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
'w3m-legal-checkbox': W3mLegalCheckbox | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
packages/scaffold-ui/src/partials/w3m-legal-checkbox/styles.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,17 @@ | ||
import { css } from 'lit' | ||
|
||
export default css` | ||
:host { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
wui-checkbox { | ||
padding: var(--wui-spacing-s); | ||
} | ||
a { | ||
text-decoration: none; | ||
color: var(--wui-color-fg-150); | ||
font-weight: 500; | ||
} | ||
` |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could move this flag to
options.features
object. Likefeatures.legalCheckbox
? We want to collect all features under this flag