UNPKG

@kiwicom/smart-faq

Version:

Smart FAQ

42 lines (34 loc) 878 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.addDeepLink = exports.replaceWithCurrentDomain = exports.replaceDomain = void 0; // @flow var replaceDomain = function replaceDomain(link /*: string*/ , domain /*: string*/ ) { return link.replace(/(https?:\/\/)[^/]+(.*)/, "".concat(domain, "$2")); }; exports.replaceDomain = replaceDomain; var replaceWithCurrentDomain = function replaceWithCurrentDomain(url /*: string*/ ) { if (typeof window === 'undefined') { return url; } return replaceDomain(url, window.location.origin); }; exports.replaceWithCurrentDomain = replaceWithCurrentDomain; var addDeepLink = function addDeepLink(url /*: string*/ , queryParam /*: string*/ ) { return ( /*: string*/ "".concat(url, "?deeplink=").concat(queryParam, "&source=smartfaq") ); }; exports.addDeepLink = addDeepLink;