cookie banner added

This commit is contained in:
adeelehsan
2021-02-02 15:31:16 +05:00
parent 847df44349
commit 89f83c22b1
8 changed files with 299 additions and 2 deletions

264
package-lock.json generated
View File

@@ -1713,6 +1713,11 @@
"resolved": "https://registry.npmjs.org/@edx/brand-openedx/-/brand-openedx-1.1.0.tgz",
"integrity": "sha512-ne2ZKF1r0akkt0rEzCAQAk4cTDTI2GiWCpc+T7ldQpw9X57OnUB16dKsFNe40C9uEjL5h3Ps/ZsFM5dm4cIkEQ=="
},
"@edx/brand-edx.org": {
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/@edx/brand-edx.org/-/brand-edx.org-1.4.2.tgz",
"integrity": "sha512-BUP7CQ3mookaIpKCntQZWd6uwF1V88sDJn+gSFMG2oVFdIV+OJOEb6VF4sbor7LfARZpomniMjPta0z+ablUmA=="
},
"@edx/eslint-config": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/@edx/eslint-config/-/eslint-config-1.1.5.tgz",
@@ -1946,6 +1951,56 @@
}
}
},
"@edx/frontend-component-cookie-policy-banner": {
"version": "2.1.8",
"resolved": "https://registry.npmjs.org/@edx/frontend-component-cookie-policy-banner/-/frontend-component-cookie-policy-banner-2.1.8.tgz",
"integrity": "sha512-N9nwzSXaXz7fBvoxMQo8EkEkbvN1dF9snrGIF6VgQNXOkx6iV8e9Aw+0jnYpcdpEF+Oz34Aayam3uf/DA0v8OA==",
"requires": {
"@edx/brand-edx.org": "1.4.2",
"@edx/paragon": "^12.0.4",
"babel-preset-minify": "^0.5.0",
"classnames": "^2.2.5",
"prop-types": "^15.6.1",
"universal-cookie": "^4.0.0"
},
"dependencies": {
"@edx/paragon": {
"version": "12.8.0",
"resolved": "https://registry.npmjs.org/@edx/paragon/-/paragon-12.8.0.tgz",
"integrity": "sha512-gJVnozu4V1e2PCI0lFICvnrs2yi0ZzcaO5gJB9OjB1Pzf5GXpkKNWLtdTwjgp4fvzL9w4sqvyB30apbQzWW8yw==",
"requires": {
"@fortawesome/fontawesome-svg-core": "^1.2.30",
"@fortawesome/free-solid-svg-icons": "^5.14.0",
"@fortawesome/react-fontawesome": "^0.1.11",
"airbnb-prop-types": "^2.12.0",
"bootstrap": "^4.4.1",
"classnames": "^2.2.6",
"email-prop-type": "^3.0.0",
"font-awesome": "^4.7.0",
"mailto-link": "^1.0.0",
"prop-types": "^15.7.2",
"react-bootstrap": "^1.2.2",
"react-focus-on": "^3.5.0",
"react-proptype-conditional-require": "^1.0.4",
"react-responsive": "^6.1.1",
"react-table": "^7.6.1",
"react-transition-group": "^4.0.0",
"sanitize-html": "^1.20.0",
"tabbable": "^4.0.0"
}
},
"react-responsive": {
"version": "6.1.2",
"resolved": "https://registry.npmjs.org/react-responsive/-/react-responsive-6.1.2.tgz",
"integrity": "sha512-AXentVC/kN3KED9zhzJv2pu4vZ0i6cSHdTtbCScVV1MT6F5KXaG2qs5D7WLmhdaOvmiMX8UfmS4ZSO+WPwDt4g==",
"requires": {
"hyphenate-style-name": "^1.0.0",
"matchmediaquery": "^0.3.0",
"prop-types": "^15.6.1"
}
}
}
},
"@edx/frontend-component-header": {
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/@edx/frontend-component-header/-/frontend-component-header-2.2.3.tgz",
@@ -4719,6 +4774,41 @@
"resolve": "^1.12.0"
}
},
"babel-helper-evaluate-path": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/babel-helper-evaluate-path/-/babel-helper-evaluate-path-0.5.0.tgz",
"integrity": "sha512-mUh0UhS607bGh5wUMAQfOpt2JX2ThXMtppHRdRU1kL7ZLRWIXxoV2UIV1r2cAeeNeU1M5SB5/RSUgUxrK8yOkA=="
},
"babel-helper-flip-expressions": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/babel-helper-flip-expressions/-/babel-helper-flip-expressions-0.4.3.tgz",
"integrity": "sha1-NpZzahKKwYvCUlS19AoizrPB0/0="
},
"babel-helper-is-nodes-equiv": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/babel-helper-is-nodes-equiv/-/babel-helper-is-nodes-equiv-0.0.1.tgz",
"integrity": "sha1-NOmzALFHnd2Y7HfqC76TQt/jloQ="
},
"babel-helper-is-void-0": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/babel-helper-is-void-0/-/babel-helper-is-void-0-0.4.3.tgz",
"integrity": "sha1-fZwBtFYee5Xb2g9u7kj1tg5nMT4="
},
"babel-helper-mark-eval-scopes": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/babel-helper-mark-eval-scopes/-/babel-helper-mark-eval-scopes-0.4.3.tgz",
"integrity": "sha1-0kSjvvmESHJgP/tG4izorN9VFWI="
},
"babel-helper-remove-or-void": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/babel-helper-remove-or-void/-/babel-helper-remove-or-void-0.4.3.tgz",
"integrity": "sha1-pPA7QAd6D/6I5F0HAQ3uJB/1rmA="
},
"babel-helper-to-multiple-sequence-expressions": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/babel-helper-to-multiple-sequence-expressions/-/babel-helper-to-multiple-sequence-expressions-0.5.0.tgz",
"integrity": "sha512-m2CvfDW4+1qfDdsrtf4dwOslQC3yhbgyBFptncp4wvtdrDHqueW7slsYv4gArie056phvQFhT2nRcGS4bnm6mA=="
},
"babel-jest": {
"version": "26.3.0",
"resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-26.3.0.tgz",
@@ -4950,6 +5040,89 @@
}
}
},
"babel-plugin-minify-builtins": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/babel-plugin-minify-builtins/-/babel-plugin-minify-builtins-0.5.0.tgz",
"integrity": "sha512-wpqbN7Ov5hsNwGdzuzvFcjgRlzbIeVv1gMIlICbPj0xkexnfoIDe7q+AZHMkQmAE/F9R5jkrB6TLfTegImlXag=="
},
"babel-plugin-minify-constant-folding": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/babel-plugin-minify-constant-folding/-/babel-plugin-minify-constant-folding-0.5.0.tgz",
"integrity": "sha512-Vj97CTn/lE9hR1D+jKUeHfNy+m1baNiJ1wJvoGyOBUx7F7kJqDZxr9nCHjO/Ad+irbR3HzR6jABpSSA29QsrXQ==",
"requires": {
"babel-helper-evaluate-path": "^0.5.0"
}
},
"babel-plugin-minify-dead-code-elimination": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/babel-plugin-minify-dead-code-elimination/-/babel-plugin-minify-dead-code-elimination-0.5.1.tgz",
"integrity": "sha512-x8OJOZIrRmQBcSqxBcLbMIK8uPmTvNWPXH2bh5MDCW1latEqYiRMuUkPImKcfpo59pTUB2FT7HfcgtG8ZlR5Qg==",
"requires": {
"babel-helper-evaluate-path": "^0.5.0",
"babel-helper-mark-eval-scopes": "^0.4.3",
"babel-helper-remove-or-void": "^0.4.3",
"lodash": "^4.17.11"
}
},
"babel-plugin-minify-flip-comparisons": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/babel-plugin-minify-flip-comparisons/-/babel-plugin-minify-flip-comparisons-0.4.3.tgz",
"integrity": "sha1-AMqHDLjxO0XAOLPB68DyJyk8llo=",
"requires": {
"babel-helper-is-void-0": "^0.4.3"
}
},
"babel-plugin-minify-guarded-expressions": {
"version": "0.4.4",
"resolved": "https://registry.npmjs.org/babel-plugin-minify-guarded-expressions/-/babel-plugin-minify-guarded-expressions-0.4.4.tgz",
"integrity": "sha512-RMv0tM72YuPPfLT9QLr3ix9nwUIq+sHT6z8Iu3sLbqldzC1Dls8DPCywzUIzkTx9Zh1hWX4q/m9BPoPed9GOfA==",
"requires": {
"babel-helper-evaluate-path": "^0.5.0",
"babel-helper-flip-expressions": "^0.4.3"
}
},
"babel-plugin-minify-infinity": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/babel-plugin-minify-infinity/-/babel-plugin-minify-infinity-0.4.3.tgz",
"integrity": "sha1-37h2obCKBldjhO8/kuZTumB7Oco="
},
"babel-plugin-minify-mangle-names": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/babel-plugin-minify-mangle-names/-/babel-plugin-minify-mangle-names-0.5.0.tgz",
"integrity": "sha512-3jdNv6hCAw6fsX1p2wBGPfWuK69sfOjfd3zjUXkbq8McbohWy23tpXfy5RnToYWggvqzuMOwlId1PhyHOfgnGw==",
"requires": {
"babel-helper-mark-eval-scopes": "^0.4.3"
}
},
"babel-plugin-minify-numeric-literals": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/babel-plugin-minify-numeric-literals/-/babel-plugin-minify-numeric-literals-0.4.3.tgz",
"integrity": "sha1-jk/VYcefeAEob/YOjF/Z3u6TwLw="
},
"babel-plugin-minify-replace": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/babel-plugin-minify-replace/-/babel-plugin-minify-replace-0.5.0.tgz",
"integrity": "sha512-aXZiaqWDNUbyNNNpWs/8NyST+oU7QTpK7J9zFEFSA0eOmtUNMU3fczlTTTlnCxHmq/jYNFEmkkSG3DDBtW3Y4Q=="
},
"babel-plugin-minify-simplify": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/babel-plugin-minify-simplify/-/babel-plugin-minify-simplify-0.5.1.tgz",
"integrity": "sha512-OSYDSnoCxP2cYDMk9gxNAed6uJDiDz65zgL6h8d3tm8qXIagWGMLWhqysT6DY3Vs7Fgq7YUDcjOomhVUb+xX6A==",
"requires": {
"babel-helper-evaluate-path": "^0.5.0",
"babel-helper-flip-expressions": "^0.4.3",
"babel-helper-is-nodes-equiv": "^0.0.1",
"babel-helper-to-multiple-sequence-expressions": "^0.5.0"
}
},
"babel-plugin-minify-type-constructors": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/babel-plugin-minify-type-constructors/-/babel-plugin-minify-type-constructors-0.4.3.tgz",
"integrity": "sha1-G8bxW4f3qxCF1CszC3F2V6IVZQA=",
"requires": {
"babel-helper-is-void-0": "^0.4.3"
}
},
"babel-plugin-react-intl": {
"version": "8.2.21",
"resolved": "https://registry.npmjs.org/babel-plugin-react-intl/-/babel-plugin-react-intl-8.2.21.tgz",
@@ -5072,6 +5245,67 @@
"is-valid-path": "^0.1.1"
}
},
"babel-plugin-transform-inline-consecutive-adds": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-inline-consecutive-adds/-/babel-plugin-transform-inline-consecutive-adds-0.4.3.tgz",
"integrity": "sha1-Mj1Ho+pjqDp6w8gRro5pQfrysNE="
},
"babel-plugin-transform-member-expression-literals": {
"version": "6.9.4",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-member-expression-literals/-/babel-plugin-transform-member-expression-literals-6.9.4.tgz",
"integrity": "sha1-NwOcmgwzE6OUlfqsL/OmtbnQOL8="
},
"babel-plugin-transform-merge-sibling-variables": {
"version": "6.9.4",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-merge-sibling-variables/-/babel-plugin-transform-merge-sibling-variables-6.9.4.tgz",
"integrity": "sha1-hbQi/DN3tEnJ0c3kQIcgNTJAHa4="
},
"babel-plugin-transform-minify-booleans": {
"version": "6.9.4",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-minify-booleans/-/babel-plugin-transform-minify-booleans-6.9.4.tgz",
"integrity": "sha1-rLs+VqNVXdI5KOS1gtKFFi3SsZg="
},
"babel-plugin-transform-property-literals": {
"version": "6.9.4",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-property-literals/-/babel-plugin-transform-property-literals-6.9.4.tgz",
"integrity": "sha1-mMHSHiVXNlc/k+zlRFn2ziSYXTk=",
"requires": {
"esutils": "^2.0.2"
}
},
"babel-plugin-transform-regexp-constructors": {
"version": "0.4.3",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-regexp-constructors/-/babel-plugin-transform-regexp-constructors-0.4.3.tgz",
"integrity": "sha1-WLd3W2OvzzMyj66aX4j71PsLSWU="
},
"babel-plugin-transform-remove-console": {
"version": "6.9.4",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-remove-console/-/babel-plugin-transform-remove-console-6.9.4.tgz",
"integrity": "sha1-uYA2DAZzhOJLNXpYjYB9PINSd4A="
},
"babel-plugin-transform-remove-debugger": {
"version": "6.9.4",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-remove-debugger/-/babel-plugin-transform-remove-debugger-6.9.4.tgz",
"integrity": "sha1-QrcnYxyXl44estGZp67IShgznvI="
},
"babel-plugin-transform-remove-undefined": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-remove-undefined/-/babel-plugin-transform-remove-undefined-0.5.0.tgz",
"integrity": "sha512-+M7fJYFaEE/M9CXa0/IRkDbiV3wRELzA1kKQFCJ4ifhrzLKn/9VCCgj9OFmYWwBd8IB48YdgPkHYtbYq+4vtHQ==",
"requires": {
"babel-helper-evaluate-path": "^0.5.0"
}
},
"babel-plugin-transform-simplify-comparison-operators": {
"version": "6.9.4",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-simplify-comparison-operators/-/babel-plugin-transform-simplify-comparison-operators-6.9.4.tgz",
"integrity": "sha1-9ir+CWyrDh9ootdT/fKDiIRxzrk="
},
"babel-plugin-transform-undefined-to-void": {
"version": "6.9.4",
"resolved": "https://registry.npmjs.org/babel-plugin-transform-undefined-to-void/-/babel-plugin-transform-undefined-to-void-6.9.4.tgz",
"integrity": "sha1-viQcqBQEAwZ4t0hxcyK4nQyP4oA="
},
"babel-polyfill": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.26.0.tgz",
@@ -5112,6 +5346,36 @@
"babel-preset-current-node-syntax": "^1.0.0"
}
},
"babel-preset-minify": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/babel-preset-minify/-/babel-preset-minify-0.5.1.tgz",
"integrity": "sha512-1IajDumYOAPYImkHbrKeiN5AKKP9iOmRoO2IPbIuVp0j2iuCcj0n7P260z38siKMZZ+85d3mJZdtW8IgOv+Tzg==",
"requires": {
"babel-plugin-minify-builtins": "^0.5.0",
"babel-plugin-minify-constant-folding": "^0.5.0",
"babel-plugin-minify-dead-code-elimination": "^0.5.1",
"babel-plugin-minify-flip-comparisons": "^0.4.3",
"babel-plugin-minify-guarded-expressions": "^0.4.4",
"babel-plugin-minify-infinity": "^0.4.3",
"babel-plugin-minify-mangle-names": "^0.5.0",
"babel-plugin-minify-numeric-literals": "^0.4.3",
"babel-plugin-minify-replace": "^0.5.0",
"babel-plugin-minify-simplify": "^0.5.1",
"babel-plugin-minify-type-constructors": "^0.4.3",
"babel-plugin-transform-inline-consecutive-adds": "^0.4.3",
"babel-plugin-transform-member-expression-literals": "^6.9.4",
"babel-plugin-transform-merge-sibling-variables": "^6.9.4",
"babel-plugin-transform-minify-booleans": "^6.9.4",
"babel-plugin-transform-property-literals": "^6.9.4",
"babel-plugin-transform-regexp-constructors": "^0.4.3",
"babel-plugin-transform-remove-console": "^6.9.4",
"babel-plugin-transform-remove-debugger": "^6.9.4",
"babel-plugin-transform-remove-undefined": "^0.5.0",
"babel-plugin-transform-simplify-comparison-operators": "^6.9.4",
"babel-plugin-transform-undefined-to-void": "^6.9.4",
"lodash": "^4.17.11"
}
},
"babel-runtime": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz",

View File

@@ -37,6 +37,7 @@
"@edx/brand": "npm:@edx/brand-openedx@1.1.0",
"@edx/frontend-component-header": "^2.2.3",
"@edx/frontend-platform": "^1.8.1",
"@edx/frontend-component-cookie-policy-banner": "^2.1.8",
"@edx/paragon": "^13.1.2",
"@fortawesome/fontawesome-svg-core": "1.2.32",
"@fortawesome/free-brands-svg-icons": "5.15.1",

View File

@@ -1,10 +1,13 @@
import React from 'react';
import CookiePolicyBanner from '@edx/frontend-component-cookie-policy-banner';
import PropTypes from 'prop-types';
import { getLocale } from '@edx/frontend-platform/i18n';
import Header from '@edx/frontend-component-header';
const HeaderLayout = ({ children }) => (
<div className="d-flex flex-column">
<CookiePolicyBanner languageCode={getLocale()} />
<Header />
<main className="flex-grow-1">
{children}

View File

@@ -7,6 +7,7 @@ import { mount } from 'enzyme';
import configureStore from 'redux-mock-store';
import { createMemoryHistory } from 'history';
import { IntlProvider, injectIntl } from '@edx/frontend-platform/i18n';
import CookiePolicyBanner from '@edx/frontend-component-cookie-policy-banner';
import * as analytics from '@edx/frontend-platform/analytics';
import { runSaga } from 'redux-saga';
@@ -184,4 +185,9 @@ describe('ForgotPasswordPage', () => {
expect(wrapper.find('div.alert-heading').text()).toEqual(expectedMessage);
});
it('check cookie rendered', () => {
const forgotPage = mount(reduxWrapper(<IntlForgotPasswordPage {...props} />));
expect(forgotPage.find(<CookiePolicyBanner />)).toBeTruthy();
});
});

View File

@@ -5,4 +5,6 @@
@import "~@edx/frontend-component-header/dist/index";
@import '@edx/frontend-component-cookie-policy-banner/build/_cookie-policy-banner';
@import "./style";

View File

@@ -7,6 +7,7 @@ import configureStore from 'redux-mock-store';
import { getConfig } from '@edx/frontend-platform';
import { IntlProvider, injectIntl } from '@edx/frontend-platform/i18n';
import * as analytics from '@edx/frontend-platform/analytics';
import CookiePolicyBanner from '@edx/frontend-component-cookie-policy-banner';
import LoginPage from '../LoginPage';
import { RenderInstitutionButton } from '../../common-components';
import { PENDING_STATE } from '../../data/constants';
@@ -314,4 +315,9 @@ describe('LoginPage', () => {
expect(analytics.sendTrackEvent).toHaveBeenCalledWith('edx.bi.institution_login_form.toggled', { category: 'user-engagement' });
expect(analytics.sendPageEvent).toHaveBeenCalledWith('login_and_registration', 'institution_login');
});
it('check cookie rendered', () => {
const loginPage = mount(reduxWrapper(<IntlLoginPage {...props} />));
expect(loginPage.find(<CookiePolicyBanner />)).toBeTruthy();
});
});

View File

@@ -6,6 +6,7 @@ import configureStore from 'redux-mock-store';
import { getConfig } from '@edx/frontend-platform';
import { IntlProvider, injectIntl, configure } from '@edx/frontend-platform/i18n';
import * as analytics from '@edx/frontend-platform/analytics';
import CookiePolicyBanner from '@edx/frontend-component-cookie-policy-banner';
import RegistrationPage from '../RegistrationPage';
import { RenderInstitutionButton } from '../../common-components';
@@ -534,8 +535,13 @@ describe('./RegistrationPage.js', () => {
const expectedMessage = 'You\'ve successfully signed into Apple. We just need a little more information before '
+ 'you start learning with openedX.';
const loginPage = mount(reduxWrapper(<IntlRegistrationPage {...props} />));
expect(loginPage.find('#tpa-alert').find('span').text()).toEqual(expectedMessage);
const registerPage = mount(reduxWrapper(<IntlRegistrationPage {...props} />));
expect(registerPage.find('#tpa-alert').find('span').text()).toEqual(expectedMessage);
});
it('check cookie rendered', () => {
const registerPage = mount(reduxWrapper(<IntlRegistrationPage {...props} />));
expect(registerPage.find(<CookiePolicyBanner />)).toBeTruthy();
});
it('should show error message on 409', () => {

View File

@@ -5,6 +5,7 @@ import renderer from 'react-test-renderer';
import configureStore from 'redux-mock-store';
import { mount } from 'enzyme';
import { IntlProvider, injectIntl } from '@edx/frontend-platform/i18n';
import CookiePolicyBanner from '@edx/frontend-component-cookie-policy-banner';
import * as auth from '@edx/frontend-platform/auth';
import { resetPassword } from '../data/actions';
@@ -45,6 +46,9 @@ describe('ResetPasswordPage', () => {
token_status: 'pending',
token: null,
errors: null,
match: {
params: {},
},
};
});
@@ -215,4 +219,9 @@ describe('ResetPasswordPage', () => {
expect(resetPasswordPage.find('#reset-password-input-invalid-feedback').text()).toEqual(validationMessage);
expect(resetPasswordPage.find('#validation-errors').first().text()).toEqual('We couldn\'t reset your password.'.concat(validationMessage));
});
it('check cookie rendered', () => {
const resetPasswordPage = mount(reduxWrapper(<IntlResetPasswordPage {...props} />));
expect(resetPasswordPage.find(<CookiePolicyBanner />)).toBeTruthy();
});
});