Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
configure(searchkit) {
this.searchkit = searchkit
if (this.options.accessorId) {
let accessor = searchkit.accessors.statefulAccessors[this.options.accessorId]
if (!accessor) {
console.error(`Could not create facet filter datasource with accessorId=${this.options.accessorId}`)
} else {
this.originalAccessor = accessor
}
} else {
let { id, field, startLevel, title } = this.options
this.originalAccessor = new NestedFacetAccessor(id, {
id, field, startLevel, title
})
this.searchkit.addAccessor(this.originalAccessor)
}
this.delegateAccessor = this.createDelegate(this.originalAccessor)
}
createDelegate(accessor) {
let delegateAccessor = new NestedFacetAccessor(accessor.options.id, { ...accessor.options })
delegateAccessor.uuid = accessor.options.id
return delegateAccessor
}