UNPKG

@lonelyplanet/dotcom-core

Version:

This package is meant to house some of our more common UI and shared libs across dotcom applications.

42 lines (33 loc) 1.22 kB
"use strict"; var __assign = this && this.__assign || Object.assign || function (t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; Object.defineProperty(exports, "__esModule", { value: true }); var authRequestBuilder_1 = require("@lonelyplanet/open-planet-node/dist/authRequestBuilder"); var constants_1 = require("../constants"); exports.authSetupWithDefaults = function (params) { if (params === void 0) { params = {}; } var defaults = constants_1.authDefaults; var options = params.options || {}; var host = params.host || defaults.host; return authRequestBuilder_1.default.build({ host: host, options: __assign({}, options, { clientId: options.clientId || defaults.options.clientId, scope: options.scope || defaults.options.scope, redirectUri: options.redirectUri || host.replace(/http:/, "https:") + "/sso", targetLinkUri: options.targetLinkUri || typeof window !== "undefined" && window.location.origin + window.location.pathname }) }); }; exports.default = { authSetupWithDefaults: exports.authSetupWithDefaults };