gdpr-consent
Version:
GDPR banner to comply with the European cookie law. Inspired by tarteaucitronjs.
24 lines (22 loc) • 850 B
text/typescript
import { GDPRConsentUser, ServiceInterface, ServiceLoader } from "../interfaces/index.js";
import { addScript } from "../utils/index.js";
export const subscribewithgoogle = ((user: GDPRConsentUser): ServiceInterface => {
return {
key: "subscribewithgoogle",
type: "other",
name: "Subscribe with Google",
uri: "https://policies.google.com/technologies/cookies#types-of-cookies",
needConsent: true,
lazyConsent: true,
cookies: [],
js: function () {
if (typeof user.subscribewithgoogleMore === "function") {
addScript("https://news.google.com/swg/js/v1/swg.js", { "subscriptions-control": "manual" }, function () {
(user.subscribewithgoogleMore as () => void)();
});
} else {
addScript("https://news.google.com/swg/js/v1/swg.js");
}
},
};
}) as ServiceLoader;