{"version":3,"sources":["webpack://CoveoForSitecore/./src/utils/TabUtils.ts","webpack://CoveoForSitecore/./src/ui/scopes/CoveoForSitecoreExternalContent.ts"],"names":["coveo_search_ui_1","__webpack_require__","exports","isTabCurrentlySelected","selected","searchInterface","queryStateModel","get","QueryStateModel","attributesEnum","t","TabUtils_1","ExpressionEvents_1","CoveoForSitecoreExternalContent","_super","element","options","bindings","_this","call","this","ID","ComponentOptions","initComponentOptions","bind","onRootElement","SitecoreExpressionEvents","onBuildingSitecoreExternalContent","__extends","prototype","buildingExternalContentEventArgs","shouldAddExternalContent","_a","sources","push","apply","scSources","_b","collections","scCollections","scScopeToTab","buildListOption","buildStringOption","Component","Initialization","registerAutoCreateComponent"],"mappings":"0KAAA,IAAAA,EAAAC,EAAA,GAKAC,EAAAC,uBAAA,SAAuCC,EAAkBC,GACrD,QAAWD,GAAYA,IAAaC,EAAgBC,gBAAgBC,IAAIP,EAAAQ,gBAAgBC,eAAeC,yYCN3G,IAAAV,EAAAC,EAAA,GAOAU,EAAAV,EAAA,IACAW,EAAAX,EAAA,GAQAY,EAAA,SAAAC,GASI,SAAAD,EAAmBE,EAA6BC,EAAyDC,GAAzG,IAAAC,EACIJ,EAAAK,KAAAC,KAAML,EAASF,EAAgCQ,GAAIJ,IAASG,YAD7CF,EAAAH,UAA6BG,EAAAF,UAAyDE,EAAAD,WAGrGC,EAAKF,QAAUhB,EAAAsB,iBAAiBC,qBAAqBR,EAASF,EAAiCG,GAC/FE,EAAKM,KAAKC,cAAcb,EAAAc,yBAAyBC,kCAAmCT,EAAKS,qCAajG,OA1BqDC,EAAAf,EAAAC,GAgBzCD,EAAAgB,UAAAF,kCAAR,SAA0CG,WAClCV,KAAKW,8BACLC,EAAAF,EAAiCG,SAAQC,KAAIC,MAAAH,EAAIZ,KAAKJ,QAAQoB,YAC9DC,EAAAP,EAAiCQ,aAAYJ,KAAIC,MAAAE,EAAIjB,KAAKJ,QAAQuB,iBAIlE1B,EAAAgB,UAAAE,yBAAR,WACI,OAAOpB,EAAAR,uBAAuBiB,KAAKJ,QAAQwB,aAAcpB,KAAKf,kBAvB3DQ,EAAAQ,GAAK,6BAELR,EAAAG,QAAmD,CACtDoB,UAAWpC,EAAAsB,iBAAiBmB,kBAC5BF,cAAevC,EAAAsB,iBAAiBmB,kBAChCD,aAAcxC,EAAAsB,iBAAiBoB,qBAoBvC7B,EA1BA,CAAqDb,EAAA2C,WAAxCzC,EAAAW,kCA4Bbb,EAAA4C,eAAeC,4BAA4BhC","file":"CoveoForSitecoreExternalContent.min.js","sourcesContent":["import {\r\n    SearchInterface,\r\n    QueryStateModel\r\n} from \"coveo-search-ui\";\r\n\r\nexport function isTabCurrentlySelected(selected: string, searchInterface: SearchInterface): boolean {\r\n    return !(!!selected && selected !== searchInterface.queryStateModel.get(QueryStateModel.attributesEnum.t));\r\n}\r\n","import {\r\n    Component,\r\n    ComponentOptions,\r\n    IComponentBindings,\r\n    Initialization,\r\n} from \"coveo-search-ui\";\r\n\r\nimport { isTabCurrentlySelected } from \"../../utils/TabUtils\";\r\nimport { IBuildingExternalContentEventArgs, SitecoreExpressionEvents } from \"../../events/ExpressionEvents\";\r\n\r\nexport interface ICoveoForSitecoreExternalContentOptions {\r\n    scSources: string[];\r\n    scCollections: string[];\r\n    scScopeToTab: string;\r\n}\r\n\r\nexport class CoveoForSitecoreExternalContent extends Component {\r\n    static ID = \"ForSitecoreExternalContent\";\r\n\r\n    static options: ICoveoForSitecoreExternalContentOptions = {\r\n        scSources: ComponentOptions.buildListOption<string>(),\r\n        scCollections: ComponentOptions.buildListOption<string>(),\r\n        scScopeToTab: ComponentOptions.buildStringOption()\r\n    };\r\n\r\n    constructor(public element: HTMLElement, public options: ICoveoForSitecoreExternalContentOptions, public bindings: IComponentBindings) {\r\n        super(element, CoveoForSitecoreExternalContent.ID, bindings);\r\n\r\n        this.options = ComponentOptions.initComponentOptions(element, CoveoForSitecoreExternalContent, options);\r\n        this.bind.onRootElement(SitecoreExpressionEvents.onBuildingSitecoreExternalContent, this.onBuildingSitecoreExternalContent);\r\n    }\r\n\r\n    private onBuildingSitecoreExternalContent(buildingExternalContentEventArgs: IBuildingExternalContentEventArgs): void {\r\n        if (this.shouldAddExternalContent()) {\r\n            buildingExternalContentEventArgs.sources.push(...this.options.scSources);\r\n            buildingExternalContentEventArgs.collections.push(...this.options.scCollections);\r\n        }\r\n    }\r\n\r\n    private shouldAddExternalContent(): boolean {\r\n        return isTabCurrentlySelected(this.options.scScopeToTab, this.searchInterface);\r\n    }\r\n}\r\n\r\nInitialization.registerAutoCreateComponent(CoveoForSitecoreExternalContent);\r\n"],"sourceRoot":""}