-
Notifications
You must be signed in to change notification settings - Fork 8
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 #98 from ASU/asu-cookie-consent
ASU Cookie Consent Package added, and alterLoginUrl helper added for initHeader function
- Loading branch information
Showing
21 changed files
with
974 additions
and
91 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
import {HydratePreact, RenderPreact, initHeader} from "./helpers"; | ||
|
||
export * from "./components"; | ||
|
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 @@ | ||
node_modules | ||
/*.log | ||
*.lock | ||
package-lock.json |
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,12 @@ | ||
const path = require("path"); | ||
|
||
module.exports = { | ||
stories: [ | ||
'../stories/*.stories.js', | ||
], | ||
addons: [ | ||
'@storybook/addon-knobs', | ||
'@storybook/addon-viewport', | ||
'@storybook/addon-a11y', | ||
], | ||
}; |
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,3 @@ | ||
<!-- files under the 'dist' directory are configured to be served statically by storybook --> | ||
<link href="/cookie-consent.css" rel="stylesheet" type="text/css" media="all" /> | ||
<script src="/cookie-consent.js"></script> |
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,11 @@ | ||
import { addDecorator, addParameters } from '@storybook/html'; | ||
import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport'; | ||
|
||
addParameters({ | ||
viewport: { | ||
viewports: INITIAL_VIEWPORTS, | ||
}, | ||
ally: { | ||
|
||
} | ||
}); |
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,8 @@ | ||
const path = require('path'); | ||
// use development webpack config | ||
let custom = require('../webpack.config.js'); | ||
custom = custom[0]; | ||
|
||
module.exports = async ({ config, mode }) => { | ||
return { ...config, module: { ...config.module, rules: custom.module.rules }, resolve: {...config.resolve, alias: custom.resolve.alias }} | ||
}; |
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,30 @@ | ||
{ | ||
"name": "@asu-design-system/cookie-consent", | ||
"version": "1.0.0", | ||
"description": "ASU implementation of cookieconsent npm library", | ||
"main": "src/index.js", | ||
"author": "Colton Testamarck", | ||
"license": "UNLICENSED", | ||
"private": false, | ||
"dependencies": { | ||
"cookieconsent": "^3.1.1" | ||
}, | ||
"scripts": { | ||
"clean": "yarn shx rm -rf ./dist", | ||
"build": "cross-env NODE_ENV=production webpack --mode=production --progress --hide-modules", | ||
"storybook": "start-storybook -s ./dist -p 9009", | ||
"build-storybook": "build-storybook" | ||
}, | ||
"publishConfig": { | ||
"access": "restricted", | ||
"registry": "https://registry.web.asu.edu/" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/asu/asu-unity-stack", | ||
"directory": "packages/cookie-consent" | ||
}, | ||
"devDependencies": { | ||
"@storybook/html": "^6.0.7" | ||
} | ||
} |
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,42 @@ | ||
import "cookieconsent"; | ||
import "./styles.css"; | ||
|
||
/*** | ||
* Initializes cookie consent and sets cookie consent domain to cookieDomain | ||
*/ | ||
const init = cookieDomain => { | ||
const customContent = { | ||
message: | ||
"ASU websites use cookies to enhance user experience, analyze site usage, and assist with outreach and enrollment. By continuing to use this site, you are giving us your consent to do this. Learn more about cookies on ASU websites in our", | ||
dismiss: "I agree", | ||
link: "Privacy Statement", | ||
href: "https://www.asu.edu/privacy#cookies", | ||
}; | ||
|
||
const customElements = { | ||
message: | ||
'<span id="cookieconsent:desc" class="cc-message">{{message}}</span>', | ||
messagelink: | ||
'<span id="cookieconsent:desc" class="cc-message">{{message}} <a aria-label="learn more about cookies" tabindex="0" class="cc-link" href="{{href}}" target="_blank">{{link}}</a>.</span>', | ||
dismiss: | ||
'<a aria-label="dismiss cookie message" tabindex="0" class="cc-btn cc-dismiss asu-cc-btn">{{dismiss}}</a>', | ||
}; | ||
|
||
// If top level cookie domain not found in hostname, set to empty string (auto) | ||
if (window.location.hostname.indexOf(cookieDomain) === -1) { | ||
cookieDomain = ""; | ||
} | ||
|
||
window.cookieconsent.initialise({ | ||
content: customContent, | ||
elements: customElements, | ||
theme: "classic", | ||
palette: null, | ||
cookie: { | ||
domain: cookieDomain, | ||
expiryDays: 90, | ||
}, | ||
}); | ||
}; | ||
|
||
export { init }; |
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,53 @@ | ||
@import "cookieconsent/build/cookieconsent.min.css"; | ||
|
||
/* ASU Customization */ | ||
.cc-window.cc-theme-classic.cc-type-info { | ||
font-family: Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif; | ||
font-weight: 300; | ||
font-size: 14px; | ||
line-height: 1.5; | ||
padding: 1.5em; | ||
background-color: #5c6670; | ||
color: #fff; | ||
width: auto; | ||
max-width: 100%; | ||
z-index: 2147483647; | ||
} | ||
|
||
.cc-window.cc-theme-classic { | ||
opacity: 0.92; | ||
} | ||
|
||
.cc-floating.cc-theme-classic { | ||
border-radius: 0; | ||
} | ||
|
||
a.cc-link { | ||
color: #fff; | ||
border-bottom: none; | ||
} | ||
.cc-theme-classic .cc-link:visited { | ||
color: #fff; | ||
} | ||
|
||
.cc-theme-classic .cc-btn { | ||
border: none; | ||
padding: 0.6em 1.2em; | ||
background-color: #8c1d40; | ||
color: #fff; | ||
font-size: 1em; | ||
font-weight: 500; | ||
width: 100%; | ||
} | ||
.cc-btn:hover { | ||
background-color: #d23153; | ||
color: white; | ||
} | ||
|
||
body .__acs .acsModalBackdrop { | ||
z-index: 2147483646; | ||
} | ||
|
||
.cc-window.cc-invisible.cc-theme-classic { | ||
opacity: 0; | ||
} |
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,13 @@ | ||
import { AsuCookieConsent, window } from "global"; | ||
|
||
export default { | ||
title: "Cookie Consent", | ||
}; | ||
|
||
export const base = () => { | ||
window.addEventListener("DOMContentLoaded", event => { | ||
AsuCookieConsent.init(); | ||
}); | ||
|
||
return `<div style="width:100%; height:200vh;"></div>`; | ||
}; |
Oops, something went wrong.