UNPKG

@sitecore-jss/sitecore-jss

Version:

This module is provided as a part of Sitecore JavaScript Rendering SDK. It contains the core JSS APIs (layout service) and utilities.

23 lines (22 loc) 1.68 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getEdgeProxyFormsUrl = exports.getEdgeProxyContentUrl = void 0; const constants_1 = require("../constants"); const normalizeUrl = (url) => (url.endsWith('/') ? url.slice(0, -1) : url); /** * Generates a URL for accessing Sitecore Edge Platform Content using the provided endpoint and context ID. * @param {string} sitecoreEdgeContextId - The unique context id. * @param {string} [sitecoreEdgeUrl] - The base endpoint URL for the Edge Platform. Default is https://edge-platform.sitecorecloud.io * @returns {string} The complete URL for accessing content through the Edge Platform. */ const getEdgeProxyContentUrl = (sitecoreEdgeContextId, sitecoreEdgeUrl = constants_1.SITECORE_EDGE_URL_DEFAULT) => `${normalizeUrl(sitecoreEdgeUrl)}/v1/content/api/graphql/v1?sitecoreContextId=${sitecoreEdgeContextId}`; exports.getEdgeProxyContentUrl = getEdgeProxyContentUrl; /** * Generates a URL for accessing Sitecore Edge Platform Forms using the provided form ID and context ID. * @param {string} sitecoreEdgeContextId - The unique context id. * @param {string} formId - The unique form id. * @param {string} [sitecoreEdgeUrl] - The base endpoint URL for the Edge Platform. Default is https://edge-platform.sitecorecloud.io * @returns {string} The complete URL for accessing forms through the Edge Platform. */ const getEdgeProxyFormsUrl = (sitecoreEdgeContextId, formId, sitecoreEdgeUrl = constants_1.SITECORE_EDGE_URL_DEFAULT) => `${normalizeUrl(sitecoreEdgeUrl)}/v1/forms/publisher/${formId}?sitecoreContextId=${sitecoreEdgeContextId}`; exports.getEdgeProxyFormsUrl = getEdgeProxyFormsUrl;