@guardian/automat-contributions
Advanced tools
Comparing version 0.3.0 to 0.3.4
export { getWeeklyArticleHistory, incrementWeeklyArticleCount } from './history'; | ||
export { getViewLog, logView, getNumViewsInPreviousDays } from './viewLog'; | ||
export { compareVariantDecision } from './compare'; | ||
export { getBodyEnd } from './slots'; | ||
export { getEpicMeta } from './epic'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=window.localStorage,t=(()=>{const e="local-storage-module-test";try{return localStorage.setItem(e,"graun"),localStorage.removeItem(e),!0}catch(e){return!1}})(),o=e=>{if(!t)return null;let o;try{const t=r(e);if(null==t)return null;if(o=JSON.parse(t),null===o)return null}catch(t){return s(e),null}return o.expires&&new Date>new Date(o.expires)?(s(e),null):void 0!==o.value?o.value:o},r=o=>t?e.getItem(o):null,n=(o,r,n={})=>{t&&e.setItem(o,JSON.stringify({value:r,expires:n.expires}))},s=o=>{t&&e.removeItem(o)},i="gu.history.weeklyArticleCount",l=(e=>{const t=e.getDay()||7;return 1!==t&&e.setHours(-24*(t-1)),Math.floor(e.getTime()/864e5)})(new Date),a="gu.contributions.views",c=o(a)||[];exports.compareVariantDecision=(e,t="https://contributions.guardianapis.com/epic/compare-variant-decision")=>{const o=JSON.stringify(e);fetch(t,{method:"post",headers:{"Content-Type":"application/json"},body:o}).catch(()=>{})},exports.getBodyEnd=(e,t="https://contributions.guardianapis.com/epic")=>{const o=JSON.stringify(e);return fetch(t,{method:"post",headers:{"Content-Type":"application/json"},body:o})},exports.getNumViewsInPreviousDays=(e,t)=>{const o=1e3*e*60*60*24,r=(new Date).getTime();return c.filter(e=>(!t||e.testId===t)&&e.date>r-o).length},exports.getViewLog=()=>o(a)||void 0,exports.getWeeklyArticleHistory=()=>o(i)||void 0,exports.incrementWeeklyArticleCount=()=>{const e=o(i)||[];if(e[0]&&e[0].week&&e[0].week===l)e[0].count+=1,n(i,e);else{e.unshift({week:l,count:1});const t=l-365,o=e.filter(e=>e.week>=t);n(i,o)}},exports.logView=e=>{c.push({date:(new Date).getTime(),testId:e}),n(a,c.slice(-50))}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=window.localStorage,t=(()=>{const e="local-storage-module-test";try{return localStorage.setItem(e,"graun"),localStorage.removeItem(e),!0}catch(e){return!1}})(),o=e=>{if(!t)return null;let o;try{const t=r(e);if(null==t)return null;if(o=JSON.parse(t),null===o)return null}catch(t){return i(e),null}return o.expires&&new Date>new Date(o.expires)?(i(e),null):void 0!==o.value?o.value:o},r=o=>t?e.getItem(o):null,n=(o,r,n={})=>{t&&e.setItem(o,JSON.stringify({value:r,expires:n.expires}))},i=o=>{t&&e.removeItem(o)},s="gu.history.weeklyArticleCount",a=(e=>{const t=e.getDay()||7;return 1!==t&&e.setHours(-24*(t-1)),Math.floor(e.getTime()/864e5)})(new Date),l="gu.contributions.views",c=o(l)||[];exports.compareVariantDecision=(e,t="https://contributions.guardianapis.com/epic/compare-variant-decision")=>{const o=JSON.stringify(e);fetch(t,{method:"post",headers:{"Content-Type":"application/json"},body:o}).catch(()=>{})},exports.getEpicMeta=(e,t="https://contributions.guardianapis.com/epic")=>{const o=JSON.stringify(e);return fetch(t,{method:"post",headers:{"Content-Type":"application/json"},body:o})},exports.getNumViewsInPreviousDays=(e,t)=>{const o=1e3*e*60*60*24,r=(new Date).getTime();return c.filter(e=>(!t||e.testId===t)&&e.date>r-o).length},exports.getViewLog=()=>o(l)||void 0,exports.getWeeklyArticleHistory=()=>o(s)||void 0,exports.incrementWeeklyArticleCount=()=>{const e=o(s)||[];if(e[0]&&e[0].week&&e[0].week===a)e[0].count+=1,n(s,e);else{e.unshift({week:a,count:1});const t=a-365,o=e.filter(e=>e.week>=t);n(s,o)}},exports.logView=e=>{c.push({date:(new Date).getTime(),testId:e}),n(l,c.slice(-50))}; |
export { getWeeklyArticleHistory, incrementWeeklyArticleCount } from './history'; | ||
export { getViewLog, logView, getNumViewsInPreviousDays } from './viewLog'; | ||
export { compareVariantDecision } from './compare'; | ||
export { getBodyEnd } from './slots'; | ||
export { getEpicMeta } from './epic'; |
{ | ||
"name": "@guardian/automat-contributions", | ||
"version": "0.3.0", | ||
"version": "0.3.4", | ||
"author": "Nicolas Long <nicolas.long@theguardian.com>", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
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
20351
35
416