@financial-times/privacy-legislation-client
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -5,7 +5,7 @@ export declare const API_URL = "https://privacy.ft.com/api/v1"; | ||
}; | ||
declare type RegionalCompliance = { | ||
export type RegionalCompliance = { | ||
region: string; | ||
legislation: Set<string>; | ||
}; | ||
declare type Props = { | ||
type Props = { | ||
url: string; | ||
@@ -17,4 +17,3 @@ legislation: Set<string>; | ||
* Return a promise resolving to an object containing information about the | ||
* user's legal protections: | ||
* | ||
* user's legal protections: * | ||
* - region: A string consisting of a country code or country-region ("GB", "US-CA") | ||
@@ -21,0 +20,0 @@ * - legislation: A Set of the applicable legislationIds |
"use strict"; | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -38,4 +39,3 @@ exports.buildConsentPageUrl = exports.fetchLegislation = exports.API_ENDPOINTS = exports.API_URL = void 0; | ||
* Return a promise resolving to an object containing information about the | ||
* user's legal protections: | ||
* | ||
* user's legal protections: * | ||
* - region: A string consisting of a country code or country-region ("GB", "US-CA") | ||
@@ -54,3 +54,4 @@ * - legislation: A Set of the applicable legislationIds | ||
try { | ||
const res = await fetch(`${exports.API_URL}${exports.API_ENDPOINTS.complianceRegion}`); | ||
const url = `${exports.API_URL}${exports.API_ENDPOINTS.complianceRegion}`; | ||
const res = await fetch(url); | ||
const compliance = await (res.ok ? res.json() : Promise.reject(res)); | ||
@@ -57,0 +58,0 @@ if (sessionStorageOk()) { |
@@ -5,7 +5,7 @@ export declare const API_URL = "https://privacy.ft.com/api/v1"; | ||
}; | ||
declare type RegionalCompliance = { | ||
export type RegionalCompliance = { | ||
region: string; | ||
legislation: Set<string>; | ||
}; | ||
declare type Props = { | ||
type Props = { | ||
url: string; | ||
@@ -17,4 +17,3 @@ legislation: Set<string>; | ||
* Return a promise resolving to an object containing information about the | ||
* user's legal protections: | ||
* | ||
* user's legal protections: * | ||
* - region: A string consisting of a country code or country-region ("GB", "US-CA") | ||
@@ -21,0 +20,0 @@ * - legislation: A Set of the applicable legislationIds |
@@ -0,1 +1,2 @@ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
export const API_URL = "https://privacy.ft.com/api/v1"; | ||
@@ -35,4 +36,3 @@ export const API_ENDPOINTS = { | ||
* Return a promise resolving to an object containing information about the | ||
* user's legal protections: | ||
* | ||
* user's legal protections: * | ||
* - region: A string consisting of a country code or country-region ("GB", "US-CA") | ||
@@ -51,3 +51,4 @@ * - legislation: A Set of the applicable legislationIds | ||
try { | ||
const res = await fetch(`${API_URL}${API_ENDPOINTS.complianceRegion}`); | ||
const url = `${API_URL}${API_ENDPOINTS.complianceRegion}`; | ||
const res = await fetch(url); | ||
const compliance = await (res.ok ? res.json() : Promise.reject(res)); | ||
@@ -54,0 +55,0 @@ if (sessionStorageOk()) { |
{ | ||
"name": "@financial-times/privacy-legislation-client", | ||
"description": "", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"main": "dist/cjs/main.js", | ||
@@ -21,2 +21,2 @@ "module": "dist/esm/main.js", | ||
} | ||
} | ||
} |
@@ -0,1 +1,3 @@ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
export const API_URL = "https://privacy.ft.com/api/v1"; | ||
@@ -6,3 +8,3 @@ export const API_ENDPOINTS = { | ||
type RegionalCompliance = { | ||
export type RegionalCompliance = { | ||
region: string; | ||
@@ -50,4 +52,3 @@ legislation: Set<string>; | ||
* Return a promise resolving to an object containing information about the | ||
* user's legal protections: | ||
* | ||
* user's legal protections: * | ||
* - region: A string consisting of a country code or country-region ("GB", "US-CA") | ||
@@ -66,3 +67,4 @@ * - legislation: A Set of the applicable legislationIds | ||
try { | ||
const res = await fetch(`${API_URL}${API_ENDPOINTS.complianceRegion}`); | ||
const url = `${API_URL}${API_ENDPOINTS.complianceRegion}`; | ||
const res = await fetch(url); | ||
const compliance = await (res.ok ? res.json() : Promise.reject(res)); | ||
@@ -74,3 +76,3 @@ if (sessionStorageOk()) { | ||
return formatResponse(compliance); | ||
} catch (err) { | ||
} catch (err: any) { | ||
throw new Error(err.status); | ||
@@ -77,0 +79,0 @@ } |
{ | ||
"extends": "../../../tsconfig", | ||
"rootDir": "./src/" | ||
"extends": "../../../tsconfig.json", | ||
"compilerOptions": { | ||
"rootDir": "./src/" | ||
} | ||
} |
41017
420