@schibsted/niche-ads
Advanced tools
Comparing version 5.1.5 to 5.1.6
@@ -0,1 +1,2 @@ | ||
export function fetchTags(options: any): Promise<any>; | ||
export function getGlimrTags(options: any): Promise<any>; |
@@ -15,10 +15,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
const LOCAL_STORAGE_EXPIRATION = 24 * 60 * 60 * 1000; | ||
export function getGlimrTags(options) { | ||
export function fetchTags(options) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const cachedTags = getFromLocalStorageWithExpiration(options.localStorageKey || LOCAL_STORAGE_KEY, options.localStorageExpiration || LOCAL_STORAGE_EXPIRATION); | ||
if (cachedTags) { | ||
return cachedTags; | ||
} | ||
const glimr = yield import('glimr-sdk'); | ||
glimr.setTagCacheTimeInSeconds(300); // 300 is max https://developer.glimr.io/docs/retrieving-audiences#settagcachetimeinseconds | ||
return new Promise((resolve) => { | ||
@@ -32,1 +27,10 @@ glimr.getTags(options.clientId || CLIENT_ID, (tags) => { | ||
} | ||
export function getGlimrTags(options) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const cachedTags = getFromLocalStorageWithExpiration(options.localStorageKey || LOCAL_STORAGE_KEY, options.localStorageExpiration || LOCAL_STORAGE_EXPIRATION); | ||
if (cachedTags) { | ||
return cachedTags; | ||
} | ||
return fetchTags(options); | ||
}); | ||
} |
{ | ||
"name": "@schibsted/niche-ads", | ||
"version": "5.1.5", | ||
"version": "5.1.6", | ||
"description": "Package containing ads logic reappearing across our projects", | ||
@@ -27,6 +27,6 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@schibsted/niche-utils": "^0.4.2", | ||
"@schibsted/niche-utils": "^0.4.3", | ||
"glimr-sdk": "^3.3.3" | ||
}, | ||
"gitHead": "e4adf95152f7a254f3f531931e19814978b7e4cb" | ||
"gitHead": "8230f7e47354e8bc6754f895703ef215ec060f74" | ||
} |
@@ -9,2 +9,13 @@ import { localStorage } from '@schibsted/niche-utils'; | ||
export async function fetchTags(options) { | ||
const glimr = await import('glimr-sdk'); | ||
return new Promise((resolve) => { | ||
glimr.getTags(options.clientId || CLIENT_ID, (tags) => { | ||
saveToLocalStorageWithExpiration(options.localStorageKey || LOCAL_STORAGE_KEY, tags); | ||
resolve(tags); | ||
}); | ||
}); | ||
} | ||
export async function getGlimrTags(options) { | ||
@@ -20,11 +31,3 @@ const cachedTags = getFromLocalStorageWithExpiration( | ||
const glimr = await import('glimr-sdk'); | ||
glimr.setTagCacheTimeInSeconds(300); // 300 is max https://developer.glimr.io/docs/retrieving-audiences#settagcachetimeinseconds | ||
return new Promise((resolve) => { | ||
glimr.getTags(options.clientId || CLIENT_ID, (tags) => { | ||
saveToLocalStorageWithExpiration(options.localStorageKey || LOCAL_STORAGE_KEY, tags); | ||
resolve(tags); | ||
}); | ||
}); | ||
return fetchTags(options); | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61975
1291