Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
const payload = paneContext.payload || {}
const urlTemplate = (paneContext.params || {}).template
const definedTemplate = props.options.template
if (urlTemplate && definedTemplate && definedTemplate !== urlTemplate) {
// eslint-disable-next-line no-console
console.warn(
`Conflicting templates: URL says "${urlTemplate}", structure node says "${definedTemplate}". Using "${definedTemplate}".`
)
}
const {options = {}} = props
const template = definedTemplate || urlTemplate
const typeTemplates = getTemplatesBySchemaType(options.type)
const parameters = {...options.templateParameters, ...payload}
let templateName = template
// If we have not specified a specific template, and we only have a single
// template available for a schema type, use it
if (!template && typeTemplates.length === 1) {
templateName = typeTemplates[0].id
}
return {templateName, parameters}
}