UNPKG

@prezly/theme-kit-core

Version:

Data layer and utility library for developing Prezly themes with JavaScript

21 lines 641 B
import { Locale } from '@prezly/theme-kit-intl'; import { PRIVACY_PORTAL_URL } from "./constants.mjs"; export function generateUrl(newsroom, locale, options) { var { email, action = 'subscribe' } = options || {}; var { slug } = Locale.from(locale); var url = new URL("/".concat(slug, "/newsroom/").concat(newsroom.uuid, "/").concat(action), PRIVACY_PORTAL_URL); if (email) { url.searchParams.append('email', email); } return url.toString(); } export function getDataRequestUrl(newsroom, locale) { return newsroom.custom_data_request_link || generateUrl(newsroom, locale, { action: 'data-request' }); }