Skip to content

Commit

Permalink
feat(location): allow activating location services in config and impr…
Browse files Browse the repository at this point in the history
…ove typings for `NgcLawOptions`, `NgcLocationOptions`

Closes #57
  • Loading branch information
tinesoft committed Jun 14, 2019
1 parent 3da80e0 commit 306fe18
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/model/law-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export class NgcLawOptions {

// If false, then we only enable the popup if the country has the cookie law. We ignore all other country specific rules.
// Default: true
regionalLaw = true;
regionalLaw ?= true;
}
6 changes: 3 additions & 3 deletions src/model/location-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ export class NgcLocationOptions {
* We can't react to errors from script tag resources, so we set a timeout. If we don't have the answer after 5000ms, try the next service.
* Default: 5000 (milliseconds)
*/
timeout = 5000;
timeout ?= 5000;
/**
* This array defines the services that you want to use. We attempt to get the country code from the first service, and only if the service fails do we move onto the next service.
* If all services fail, the popup is opened without modification.
* If a service succeeds, then the two letter country code is passed to the 'Law' module, with changes your popup options depending on the cookie laws in the country code.
* Default: ['freegeoip', 'ipinfo', 'maxmind']
*/
services = ['freegeoip', 'ipinfo', 'maxmind'];
services ?: any[] = ['freegeoip', 'ipinfo', 'maxmind'];

/**
* This can be used to define new services via a key, but new services they can also go straight into the 'services' array in an ad-hoc fashion.
* It is recommended that you define services in 'serviceDefinitions' and use 'services' to configure priority between services
*/
serviceDefinitions: any;
serviceDefinitions ?: { [key: string]: (...options: any[]) => any };

}
2 changes: 1 addition & 1 deletion src/service/cookieconsent-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export class NgcCookieConsentConfig {
/**
* Location Options
*/
location?: NgcLocationOptions;
location?: boolean | NgcLocationOptions;

/**
* Set value as click anything on the page, excluding the `ignoreClicksFrom` below (if we click on the revoke button etc)
Expand Down

0 comments on commit 306fe18

Please sign in to comment.