-
- By continuing to browse the site, you're agreeing to our use of cookies.
-
- Learn more in our privacy policy.
+
+ By continuing to browse the site, you're agreeing to our use of cookies.
+
+ Learn more in our privacy policy.
+
-
-
+
diff --git a/src/cookie-law.module.ts b/src/cookie-law.module.ts
index 92fb5cb..1b25909 100644
--- a/src/cookie-law.module.ts
+++ b/src/cookie-law.module.ts
@@ -9,6 +9,7 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { CookieLawComponent } from './cookie-law.component';
+import { CookieLawElementComponent } from './cookie-law-element.component';
import { CookieLawService } from './cookie-law.service';
@NgModule({
@@ -17,6 +18,7 @@ import { CookieLawService } from './cookie-law.service';
],
declarations: [
CookieLawComponent,
+ CookieLawElementComponent,
],
providers: [
CookieLawService,
@@ -29,5 +31,6 @@ export class CookieLawModule { }
export {
CookieLawComponent,
- CookieLawService
+ CookieLawElementComponent,
+ CookieLawService,
};
diff --git a/src/cookie-law.service.spec.ts b/src/cookie-law.service.spec.ts
index abd2691..3fe54d1 100644
--- a/src/cookie-law.service.spec.ts
+++ b/src/cookie-law.service.spec.ts
@@ -24,5 +24,15 @@ describe('CookieLawService', () => {
service.storeCookie();
expect(service.seen()).toBe(true);
+ expect(service.seen('cookieLawSeen')).toBe(true);
+ });
+
+ it('should stored different cookie names', () => {
+ service.storeCookie('testCookie');
+
+ expect(service.seen('fakeCookie')).toBe(false);
+ expect(service.seen()).toBe(false);
+
+ expect(service.seen('testCookie')).toBe(true);
});
});
diff --git a/src/cookie-law.service.ts b/src/cookie-law.service.ts
index b5df8f6..ec0f543 100644
--- a/src/cookie-law.service.ts
+++ b/src/cookie-law.service.ts
@@ -11,12 +11,12 @@ import { Injectable } from '@angular/core';
@Injectable()
export class CookieLawService {
- seen(): boolean {
- return this.cookieExisits('cookieLawSeen');
+ seen(cookieName?: string): boolean {
+ return this.cookieExisits(cookieName || 'cookieLawSeen');
}
- storeCookie(): void {
- return this.setCookie('cookieLawSeen');
+ storeCookie(cookieName?: string): void {
+ return this.setCookie(cookieName || 'cookieLawSeen');
}
/**
diff --git a/yarn.lock b/yarn.lock
index fb0adfb..7eab4a4 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2,33 +2,33 @@
# yarn lockfile v1
-"@angular/common@2.4.7":
- version "2.4.7"
- resolved "https://registry.yarnpkg.com/@angular/common/-/common-2.4.7.tgz#9316daf90e353e67187d2e0afec5521c2001bd4b"
+"@angular/common@2.4.10":
+ version "2.4.10"
+ resolved "https://registry.yarnpkg.com/@angular/common/-/common-2.4.10.tgz#a3a682d2228fa30ec23dd0eb57c8e887fba26997"
-"@angular/compiler-cli@2.4.7":
- version "2.4.7"
- resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-2.4.7.tgz#15768141816903636593f430ff9a808d98a2a762"
+"@angular/compiler-cli@2.4.10":
+ version "2.4.10"
+ resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-2.4.10.tgz#c21143bfaab45231c8d2eaa82456bed3d39f91a3"
dependencies:
"@angular/tsc-wrapped" "0.5.2"
minimist "^1.2.0"
reflect-metadata "^0.1.2"
-"@angular/compiler@2.4.7":
- version "2.4.7"
- resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-2.4.7.tgz#008c1f0d1409c46fbba215fe8ab0d886252c7ff0"
+"@angular/compiler@2.4.10":
+ version "2.4.10"
+ resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-2.4.10.tgz#f51fd34820b2a02c7cb61fbcf49873c58056fb0c"
-"@angular/core@2.4.7":
- version "2.4.7"
- resolved "https://registry.yarnpkg.com/@angular/core/-/core-2.4.7.tgz#8bed9a2d37e81342bd41d189df88aa3e02393cfb"
+"@angular/core@2.4.10":
+ version "2.4.10"
+ resolved "https://registry.yarnpkg.com/@angular/core/-/core-2.4.10.tgz#0b8320a65065965d998645b1f5cd3cf769b441ea"
-"@angular/platform-browser-dynamic@2.4.7":
- version "2.4.7"
- resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-2.4.7.tgz#9632586f9ce596186be4c124c3ea0a4a74b27b46"
+"@angular/platform-browser-dynamic@2.4.10":
+ version "2.4.10"
+ resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-2.4.10.tgz#8df25dec2b06adc690cc9bc26448deccaebcd8ec"
-"@angular/platform-browser@2.4.7":
- version "2.4.7"
- resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-2.4.7.tgz#19f7996a70f07b34ce8d6d0e255544e62cae75f1"
+"@angular/platform-browser@2.4.10":
+ version "2.4.10"
+ resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-2.4.10.tgz#cbf25608148fb4ffef96cc5005ba5d7b3e093906"
"@angular/tsc-wrapped@0.5.2":
version "0.5.2"
@@ -317,8 +317,8 @@ async@^0.9.0, async@~0.9.0:
resolved "https://registry.yarnpkg.com/async/-/async-0.9.2.tgz#aea74d5e61c1f899613bf64bda66d4c78f2fd17d"
async@^2.0.1, async@^2.1.2:
- version "2.1.5"
- resolved "https://registry.yarnpkg.com/async/-/async-2.1.5.tgz#e587c68580994ac67fc56ff86d3ac56bdbe810bc"
+ version "2.2.0"
+ resolved "https://registry.yarnpkg.com/async/-/async-2.2.0.tgz#c324eba010a237e4fbd55a12dee86367d5c0ef32"
dependencies:
lodash "^4.14.0"
@@ -593,8 +593,8 @@ browserify-rsa@^4.0.0:
randombytes "^2.0.1"
browserify-sign@^4.0.0:
- version "4.0.0"
- resolved "https://registry.yarnpkg.com/browserify-sign/-/browserify-sign-4.0.0.tgz#10773910c3c206d5420a46aad8694f820b85968f"
+ version "4.0.4"
+ resolved "https://registry.yarnpkg.com/browserify-sign/-/browserify-sign-4.0.4.tgz#aa4eb68e5d7b658baa6bf6a57e630cbd7a93d298"
dependencies:
bn.js "^4.1.1"
browserify-rsa "^4.0.0"
@@ -679,8 +679,8 @@ camelcase@^3.0.0:
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a"
camelcase@^4.0.0:
- version "4.0.0"
- resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.0.0.tgz#8b0f90d44be5e281b903b9887349b92595ef07f2"
+ version "4.1.0"
+ resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd"
capture-stack-trace@^1.0.0:
version "1.0.0"
@@ -997,8 +997,8 @@ conventional-commit-types@^2.0.0:
resolved "https://registry.yarnpkg.com/conventional-commit-types/-/conventional-commit-types-2.1.0.tgz#45d860386c9a2e6537ee91d8a1b61bd0411b3d04"
convert-source-map@^1.3.0:
- version "1.4.0"
- resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.4.0.tgz#e3dad195bf61bfe13a7a3c73e9876ec14a0268f3"
+ version "1.5.0"
+ resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.0.tgz#9acd70851c6d5dfdd93d9282e5edf94a03ff46b5"
cookie-signature@1.0.6:
version "1.0.6"
@@ -2218,8 +2218,8 @@ inquirer@1.2.3:
through "^2.3.6"
interpret@^1.0.0:
- version "1.0.1"
- resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.1.tgz#d579fb7f693b858004947af39fa0db49f795602c"
+ version "1.0.2"
+ resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.2.tgz#f4f623f0bb7122f15f5717c8e254b8161b5c5b2d"
invariant@^2.2.0:
version "2.2.2"
@@ -2425,20 +2425,20 @@ istanbul-instrumenter-loader@2.0.0:
loader-utils "^0.2.16"
object-assign "^4.1.0"
-istanbul-lib-coverage@^1.0.0:
- version "1.0.1"
- resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.0.1.tgz#f263efb519c051c5f1f3343034fc40e7b43ff212"
+istanbul-lib-coverage@^1.0.2:
+ version "1.0.2"
+ resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.0.2.tgz#87a0c015b6910651cb3b184814dfb339337e25e1"
istanbul-lib-instrument@^1.1.3:
- version "1.6.2"
- resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.6.2.tgz#dac644f358f51efd6113536d7070959a0111f73b"
+ version "1.7.0"
+ resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.7.0.tgz#b8e0dc25709bb44e17336ab47b7bb5c97c23f659"
dependencies:
babel-generator "^6.18.0"
babel-template "^6.16.0"
babel-traverse "^6.18.0"
babel-types "^6.18.0"
babylon "^6.13.0"
- istanbul-lib-coverage "^1.0.0"
+ istanbul-lib-coverage "^1.0.2"
semver "^5.3.0"
istanbul@0.4.5, istanbul@^0.4.0:
@@ -2647,10 +2647,10 @@ klaw@^1.0.0:
graceful-fs "^4.1.9"
latest-version@^3.0.0:
- version "3.0.0"
- resolved "https://registry.yarnpkg.com/latest-version/-/latest-version-3.0.0.tgz#3104f008c0c391084107f85a344bc61e38970649"
+ version "3.1.0"
+ resolved "https://registry.yarnpkg.com/latest-version/-/latest-version-3.1.0.tgz#a205383fea322b33b5ae3b18abee0dc2f356ee15"
dependencies:
- package-json "^3.0.0"
+ package-json "^4.0.0"
lazy-cache@^1.0.3:
version "1.0.4"
@@ -2991,7 +2991,7 @@ miller-rabin@^4.0.0:
version "1.27.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.27.0.tgz#820f572296bbd20ec25ed55e5b5de869e5436eb1"
-mime-types@^2.1.11, mime-types@^2.1.12, mime-types@~2.1.11, mime-types@~2.1.13, mime-types@~2.1.7:
+mime-types@^2.1.11, mime-types@^2.1.12, mime-types@~2.1.11, mime-types@~2.1.15, mime-types@~2.1.7:
version "2.1.15"
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.15.tgz#a4ebf5064094569237b8cf70046776d09fc92aed"
dependencies:
@@ -3152,8 +3152,10 @@ normalize-path@^1.0.0:
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-1.0.0.tgz#32d0e472f91ff345701c15a8311018d3b0a90379"
normalize-path@^2.0.1:
- version "2.0.1"
- resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.0.1.tgz#47886ac1662760d4261b7d979d241709d3ce3f7a"
+ version "2.1.1"
+ resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9"
+ dependencies:
+ remove-trailing-separator "^1.0.1"
"npm-package-arg@^3.0.0 || ^4.0.0":
version "4.2.1"
@@ -3344,9 +3346,9 @@ osenv@^0.1.0, osenv@^0.1.4:
os-homedir "^1.0.0"
os-tmpdir "^1.0.0"
-package-json@^3.0.0:
- version "3.1.0"
- resolved "https://registry.yarnpkg.com/package-json/-/package-json-3.1.0.tgz#ce281900fe8052150cc6709c6c006c18fdb2f379"
+package-json@^4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/package-json/-/package-json-4.0.0.tgz#f3c9dc8738f5b59304d54d2cfb3f91d08fdd7998"
dependencies:
got "^6.7.1"
registry-auth-token "^3.0.1"
@@ -3653,8 +3655,8 @@ raw-loader@0.5.1:
resolved "https://registry.yarnpkg.com/raw-loader/-/raw-loader-0.5.1.tgz#0c3d0beaed8a01c966d9787bf778281252a979aa"
rc@^1.0.1, rc@^1.1.6, rc@^1.1.7:
- version "1.1.7"
- resolved "https://registry.yarnpkg.com/rc/-/rc-1.1.7.tgz#c5ea564bb07aff9fd3a5b32e906c1d3a65940fea"
+ version "1.2.0"
+ resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.0.tgz#c7de973b7b46297c041366b2fd3d2363b1697c66"
dependencies:
deep-extend "~0.4.0"
ini "~1.3.0"
@@ -3676,18 +3678,7 @@ read-pkg@^1.0.0:
normalize-package-data "^2.3.2"
path-type "^1.0.0"
-"readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@~2.0.0, readable-stream@~2.0.5:
- version "2.0.6"
- resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.0.6.tgz#8f90341e68a53ccc928788dacfcd11b36eb9b78e"
- dependencies:
- core-util-is "~1.0.0"
- inherits "~2.0.1"
- isarray "~1.0.0"
- process-nextick-args "~1.0.6"
- string_decoder "~0.10.x"
- util-deprecate "~1.0.1"
-
-readable-stream@^2.1.0, readable-stream@^2.1.4:
+"readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.1.0, readable-stream@^2.1.4:
version "2.2.6"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.6.tgz#8b43aed76e71483938d12a8d46c6cf1a00b1f816"
dependencies:
@@ -3717,6 +3708,17 @@ readable-stream@~1.1.9:
isarray "0.0.1"
string_decoder "~0.10.x"
+readable-stream@~2.0.0, readable-stream@~2.0.5:
+ version "2.0.6"
+ resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.0.6.tgz#8f90341e68a53ccc928788dacfcd11b36eb9b78e"
+ dependencies:
+ core-util-is "~1.0.0"
+ inherits "~2.0.1"
+ isarray "~1.0.0"
+ process-nextick-args "~1.0.6"
+ string_decoder "~0.10.x"
+ util-deprecate "~1.0.1"
+
readdirp@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.1.0.tgz#4ed0ad060df3073300c48440373f72d1cc642d78"
@@ -3802,6 +3804,10 @@ remap-istanbul@0.8.4:
source-map ">=0.5.6"
through2 "2.0.1"
+remove-trailing-separator@^1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.0.1.tgz#615ebb96af559552d4bf4057c8436d486ab63cc4"
+
repeat-element@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.2.tgz#ef089a178d1483baae4d93eb98b4f9e4e11d990a"
@@ -4619,11 +4625,11 @@ type-check@~0.3.2:
prelude-ls "~1.1.2"
type-is@~1.6.14:
- version "1.6.14"
- resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.14.tgz#e219639c17ded1ca0789092dd54a03826b817cb2"
+ version "1.6.15"
+ resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.15.tgz#cab10fb4909e441c82842eafe1ad646c81804410"
dependencies:
media-typer "0.3.0"
- mime-types "~2.1.13"
+ mime-types "~2.1.15"
typedarray@~0.0.5:
version "0.0.6"
@@ -4743,8 +4749,8 @@ url@^0.11.0:
querystring "0.2.0"
useragent@^2.1.12:
- version "2.1.12"
- resolved "https://registry.yarnpkg.com/useragent/-/useragent-2.1.12.tgz#aa7da6cdc48bdc37ba86790871a7321d64edbaa2"
+ version "2.1.13"
+ resolved "https://registry.yarnpkg.com/useragent/-/useragent-2.1.13.tgz#bba43e8aa24d5ceb83c2937473e102e21df74c10"
dependencies:
lru-cache "2.2.x"
tmp "0.0.x"