{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"externalAppConfig\"","webpack:///./node_modules/cms-ui-components/node_modules/moment/locale sync ^\\.\\/.*$","webpack:///./node_modules/moment/locale sync ^\\.\\/.*$","webpack:///./src/app/globals/authentication.ts","webpack:///./src/app/EntityFactory.ts","webpack:///./src/app/globals/ccsdk.ts","webpack:///./src/app/presentation-logic/dataflows/searchResultsScrollPosition/SearchResultsScrollPositionActions.ts","webpack:///./src/app/globals/actions.ts","webpack:///./src/app/presentation-logic/dataflows/performanceCounters/ImageLoadingPerfCountersActions.ts","webpack:///./src/app/instrumentation/performanceApi/IPerformanceEntryTypes.ts","webpack:///./src/app/instrumentation/performanceApi/AppPerformanceObserver.ts","webpack:///./src/app/instrumentation/performanceApi/CatalystPerformanceObserver.ts","webpack:///./src/app/instrumentation/performanceApi/telemetryPayloadCreation/imageLoadingComputation.ts","webpack:///./src/app/instrumentation/performanceApi/CatalystImageLoadingPerfCountersManager.ts","webpack:///./src/app/instrumentation/performanceApi/telemetryPayloadCreation/lowVerbosityTelemetryPayloadStrategy.ts","webpack:///./src/app/instrumentation/instrumentationClient/InstrumentationClient.ts","webpack:///./src/app/Global.ts","webpack:///./src/app/rendering/appContentSection/AppContentSection.tsx","webpack:///./src/app/presentation-logic/dataflows/appHeaderSection/HeaderLinkPage.ts","webpack:///./src/app/Routes.ts","webpack:///./src/app/rendering/appHeaderSection/AppHeaderSection.tsx","webpack:///./src/app/rendering/components/messageBoxModal/MessageBoxModal.tsx","webpack:///./src/app/rendering/appLayoutPanel/AppLayoutPanel.tsx","webpack:///./src/app/rendering/components/queryFilterPane/IQueryFilterPaneProps.ts","webpack:///./src/app/models/displayMode/ResultsDisplayModeEnum.ts","webpack:///./src/app/rendering/components/catalystVirtualCollections/ICatalystVirtualCollectionProps.ts","webpack:///./src/app/rendering/components/catalystVirtualCollections/CatalystPagedVirtualCollection.tsx","webpack:///./src/app/rendering/components/catalystVirtualCollections/CatalystPagedVirtualGrid.tsx","webpack:///./src/app/rendering/components/imageTile/GridImageTile.tsx","webpack:///./src/app/rendering/components/queryFilterPane/IFilterItemOptionsList.ts","webpack:///./src/app/rendering/components/imageTile/ImageTile.tsx","webpack:///./src/app/rendering/components/dateRangePicker/DateRangePicker.tsx","webpack:///./src/app/rendering/components/queryFilterPane/QueryFilterPane.tsx","webpack:///./src/app/rendering/components/searchHint/SearchHint.tsx","webpack:///./src/app/rendering/components/searchWithAutosuggest/SearchWithAutosuggest.tsx","webpack:///./src/app/rendering/searchBase/SearchUI.tsx","webpack:///./src/app/rendering/searchBase/ISearchProps.ts","webpack:///./src/app/rendering/creativeSearch/CreativeSearch.tsx","webpack:///./src/app/editors/DriCmsEntityEditor.tsx","webpack:///./src/app/editors/EntityJsonEditorHost.tsx","webpack:///./src/app/experiences/search/modalNavigation/ModalNavigationHelper.ts","webpack:///./src/app/models/lightbox/ImageStatusEnum.ts","webpack:///./src/app/rendering/lightbox/LightboxPanelLightboxSourceEnum.ts","webpack:///./src/app/rendering/components/imagePreviewModal/ImagePreviewModal.tsx","webpack:///./src/app/rendering/imageDetails/ImageDetailsPage.tsx","webpack:///./src/app/rendering/components/imageTile/GridUnProcessedImageTile.tsx","webpack:///./src/app/rendering/components/lightboxCard/LightboxCardActionButton.tsx","webpack:///./src/app/rendering/components/lightboxCard/LightboxCard.tsx","webpack:///./src/app/experiences/lightbox/LoadLightboxSourceEnum.ts","webpack:///./src/app/rendering/lightbox/LightboxPage.tsx","webpack:///./src/app/rendering/searchAndSelect/SearchAndSelect.tsx","webpack:///./src/app/SignedInApp.tsx","webpack:///./src/app/instrumentation/instrumentationConstants/InstrumentationConstants.ts","webpack:///./src/app/common/resizeService.ts","webpack:///./src/app/rendering/components/addToLightboxOverlay/AddToLightboxOverlay.tsx","webpack:///./src/app/AppConstants.ts","webpack:///./src/app/common/appErrorConverter.ts","webpack:///./src/app/presentation-logic/dataflows/appHeaderSection/AppHeaderActions.ts","webpack:///./src/app/presentation-logic/dataflows/appHeaderSection/AppHeaderSectionReducer.ts","webpack:///./src/app/experiences/appHeaderSection/AppHeaderSectionBootstrapper.ts","webpack:///./src/app/models/fieldType/FieldTypeEnum.ts","webpack:///./src/app/models/filterRules/FilterRuleSelectionMode.ts","webpack:///./src/app/common/stringEscape.ts","webpack:///./src/app/experiences/catalystSearch/CatalystSearchManager.ts","webpack:///./src/app/experiences/searchAndSelect/FilterRules.ts","webpack:///./src/app/experiences/creativeSearch/FilterControlBuilder.ts","webpack:///./src/app/rendering/components/modalCarousel/CarouselDirection.ts","webpack:///./src/app/presentation-logic/dataflows/catalystSearch/CatalystSearchReduction.ts","webpack:///./src/app/presentation-logic/dataflows/creativeSearch/CreativeSearchActions.ts","webpack:///./src/app/presentation-logic/dataflows/creativeSearch/CreativeSearchActionCreator.ts","webpack:///./src/app/presentation-logic/dataflows/searchWithAutosuggest/SearchWithAutosuggestActionCreators.ts","webpack:///./src/app/presentation-logic/dataflows/searchWithAutosuggest/SearchWithAutosuggestReduction.ts","webpack:///./src/app/experiences/search/validation/SearchValidation.ts","webpack:///./src/app/experiences/search/SearchBootstrapperBase.ts","webpack:///./src/app/experiences/search/CreativeSearchBootstrapper.ts","webpack:///./src/app/presentation-logic/dataflows/creativeSearch/CreativeSearchReduction.ts","webpack:///./src/app/experiences/creativeSearch/CreativeSortOrderOptions.ts","webpack:///./src/app/experiences/searchAndSelect/GetDimensionsHelper.ts","webpack:///./src/app/presentation-logic/dataflows/imageCommand/ImageCommandActionCreator.ts","webpack:///./src/app/presentation-logic/dataflows/imageCommand/ImageCommandActions.ts","webpack:///./src/app/presentation-logic/dataflows/imageCommand/ImageCommandReduction.ts","webpack:///./src/app/presentation-logic/dataflows/imagePreviewModal/ImagePreviewModalActions.ts","webpack:///./src/app/presentation-logic/dataflows/listItemSelector/ListItemSelectorActions.ts","webpack:///./src/app/rendering/components/modalCarousel/ModalCarousel.tsx","webpack:///./src/app/presentation-logic/dataflows/searchWithAutosuggest/SearchWithAutosuggestActions.ts","webpack:///./src/app/experiences/searchAndSelect/calculateMosaicRenderInformation.ts","webpack:///./src/app/experiences/creativeSearch/CreativeSearchPageBootstrapper.ts","webpack:///./src/app/experiences/creativeSearch/CreativeFilterRules.ts","webpack:///./src/app/instrumentation/helpers/InstrumentationHelper.ts","webpack:///./src/app/experiences/imagePreviewModal/DownloadImageTelemetry.ts","webpack:///./src/app/experiences/imagePreviewModal/DownloadImage.ts","webpack:///./src/app/experiences/addImageQualityParamToUrl.ts","webpack:///./src/app/experiences/imagePreviewModal/ImagePreviewConstants.ts","webpack:///./src/app/experiences/imagePreviewModal/GetImagePreviewProps.ts","webpack:///./src/app/experiences/imagePreviewModal/GetImageQualityMessage.ts","webpack:///./src/app/presentation-logic/dataflows/imageDetails/imageDetailsPageActions.ts","webpack:///./src/app/presentation-logic/dataflows/imageDetails/ImageDetailsPageReduction.ts","webpack:///./src/app/experiences/lightbox/GetLatestStatusOfUnProcessedEntity.ts","webpack:///./src/app/experiences/imageDetails/ImageDetailsPageBootstrapper.ts","webpack:///./src/app/presentation-logic/dataflows/performanceCounters/ImageLoadingPerfCountersReducer.ts","webpack:///./src/app/presentation-logic/dataflows/lightbox/LightboxActionCreator.ts","webpack:///./src/app/presentation-logic/dataflows/lightbox/LightboxActions.ts","webpack:///./src/app/globals/CatalystServiceErrorParser.ts","webpack:///./src/app/globals/DomainAwareDeniedServiceErrorParser.ts","webpack:///./src/app/experiences/lightbox/LightboxManager.ts","webpack:///./src/app/presentation-logic/dataflows/lightboxPage/LightboxPanelNowShowingEnum.ts","webpack:///./src/app/experiences/lightbox/LightboxDownloadManager.ts","webpack:///./src/app/presentation-logic/dataflows/lightboxPage/LightboxPageBootstrapperReduction.ts","webpack:///./src/app/presentation-logic/dataflows/lightboxPage/LightboxPageReduction.ts","webpack:///./src/app/experiences/lightbox/LightboxPageBootstrapper.ts","webpack:///./src/app/experiences/lightbox/LightboxUserProfileManager.ts","webpack:///./src/app/presentation-logic/dataflows/messageBoxModal/MessageBoxModalActions.ts","webpack:///./src/app/presentation-logic/dataflows/messageBoxModal/MessageBoxModalReducer.ts","webpack:///./src/app/experiences/messageBoxModal/MessageBoxModalBootstrapper.ts","webpack:///./src/app/presentation-logic/dataflows/dateRangeSelector/DateRangeBoundaryIdentifier.ts","webpack:///./src/app/experiences/catalystSearch/DateRangeOptionType.ts","webpack:///./src/app/experiences/searchAndSelect/QueryBuilder.ts","webpack:///./src/app/presentation-logic/dataflows/searchAndSelect/DateRange.ts","webpack:///./src/app/experiences/catalystSearch/DateRangeOptions.ts","webpack:///./src/app/presentation-logic/dataflows/dateRangeSelector/DateRangeSelectorActions.ts","webpack:///./src/app/presentation-logic/dataflows/dateRangeSelector/DateRangeSelectorReduction.ts","webpack:///./src/app/experiences/imagePreviewModal/ModalCarousalEventCallbacks.ts","webpack:///./src/app/presentation-logic/dataflows/searchAndSelect/SearchAndSelectActions.ts","webpack:///./src/app/presentation-logic/dataflows/searchAndSelect/SearchAndSelectReduction.ts","webpack:///./src/app/experiences/search/validation/Rules.ts","webpack:///./src/app/experiences/search/SearchBootstrapper.ts","webpack:///./src/app/experiences/searchAndSelect/SortOrderOptions.ts","webpack:///./src/app/experiences/searchAndSelect/getTilesProperties.ts","webpack:///./src/app/experiences/searchAndSelect/SearchAndSelectBootstrapper.ts","webpack:///./src/app/SignedInAppActions.ts","webpack:///./src/app/SignedInAppReducer.ts","webpack:///./src/app/SignedInAppBootstrapper.ts","webpack:///./src/app/app.ts","webpack:///./src/app/createApp.ts"],"names":["webpackJsonpCallback","data","moduleId","chunkId","chunkIds","moreModules","executeModules","i","resolves","length","installedChunks","push","Object","prototype","hasOwnProperty","call","modules","parentJsonpFunction","shift","deferredModules","apply","checkDeferredModules","result","deferredModule","fulfilled","j","depId","splice","__webpack_require__","s","installedModules","1","exports","module","l","m","c","d","name","getter","o","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","p","jsonpArray","window","oldJsonpFunction","slice","externalAppConfig","map","./af","./af.js","./ar","./ar-dz","./ar-dz.js","./ar-kw","./ar-kw.js","./ar-ly","./ar-ly.js","./ar-ma","./ar-ma.js","./ar-sa","./ar-sa.js","./ar-tn","./ar-tn.js","./ar.js","./az","./az.js","./be","./be.js","./bg","./bg.js","./bn","./bn.js","./bo","./bo.js","./br","./br.js","./bs","./bs.js","./ca","./ca.js","./cs","./cs.js","./cv","./cv.js","./cy","./cy.js","./da","./da.js","./de","./de-at","./de-at.js","./de-ch","./de-ch.js","./de.js","./dv","./dv.js","./el","./el.js","./en-au","./en-au.js","./en-ca","./en-ca.js","./en-gb","./en-gb.js","./en-ie","./en-ie.js","./en-nz","./en-nz.js","./eo","./eo.js","./es","./es-do","./es-do.js","./es.js","./et","./et.js","./eu","./eu.js","./fa","./fa.js","./fi","./fi.js","./fo","./fo.js","./fr","./fr-ca","./fr-ca.js","./fr-ch","./fr-ch.js","./fr.js","./fy","./fy.js","./gd","./gd.js","./gl","./gl.js","./gom-latn","./gom-latn.js","./he","./he.js","./hi","./hi.js","./hr","./hr.js","./hu","./hu.js","./hy-am","./hy-am.js","./id","./id.js","./is","./is.js","./it","./it.js","./ja","./ja.js","./jv","./jv.js","./ka","./ka.js","./kk","./kk.js","./km","./km.js","./kn","./kn.js","./ko","./ko.js","./ky","./ky.js","./lb","./lb.js","./lo","./lo.js","./lt","./lt.js","./lv","./lv.js","./me","./me.js","./mi","./mi.js","./mk","./mk.js","./ml","./ml.js","./mr","./mr.js","./ms","./ms-my","./ms-my.js","./ms.js","./my","./my.js","./nb","./nb.js","./ne","./ne.js","./nl","./nl-be","./nl-be.js","./nl.js","./nn","./nn.js","./pa-in","./pa-in.js","./pl","./pl.js","./pt","./pt-br","./pt-br.js","./pt.js","./ro","./ro.js","./ru","./ru.js","./sd","./sd.js","./se","./se.js","./si","./si.js","./sk","./sk.js","./sl","./sl.js","./sq","./sq.js","./sr","./sr-cyrl","./sr-cyrl.js","./sr.js","./ss","./ss.js","./sv","./sv.js","./sw","./sw.js","./ta","./ta.js","./te","./te.js","./tet","./tet.js","./th","./th.js","./tl-ph","./tl-ph.js","./tlh","./tlh.js","./tr","./tr.js","./tzl","./tzl.js","./tzm","./tzm-latn","./tzm-latn.js","./tzm.js","./uk","./uk.js","./ur","./ur.js","./uz","./uz-latn","./uz-latn.js","./uz.js","./vi","./vi.js","./x-pseudo","./x-pseudo.js","./yo","./yo.js","./zh-cn","./zh-cn.js","./zh-hk","./zh-hk.js","./zh-tw","./zh-tw.js","webpackContext","req","id","webpackContextResolve","e","Error","code","keys","resolve","./bm","./bm.js","./en-SG","./en-SG.js","./en-il","./en-il.js","./es-us","./es-us.js","./ga","./ga.js","./gu","./gu.js","./it-ch","./it-ch.js","./ku","./ku.js","./mn","./mn.js","./mt","./mt.js","./tg","./tg.js","./ug-cn","./ug-cn.js","authentication_authenticationManager","AdalAuthenticationManager","AuthenticationContext","external_externalAppConfig_","adal","handleAuthenticationResponse","EntityFactory_EntityFactory","[object Object]","tenantId","proseDomain","authenticationContext","this","_businessLogicFactory","ProseBusinessLogicFactory","fromTenantIdAndProseDomain","serviceClientFactory","setAuthenticationToAdal","businessLogicFactory","entityManager","getManagersFactory","getEntityManager","searchManager","getSearchManager","catsEntityFactory","catsTenantName","proseEndpoint","ampEntityFactory","ampTenantName","localStorageUserProfileManager","LocalStorageUserProfileManager","localStorage","instrumentationService","managersFactory","proseUserProfileSettingManager","getProseUserProfileSettingManager","catsTenantDocumentId","undefined","userProfileRefreshInterval","entityInspector","EntityInspector","annotatedEntityCollectionInspector","AnnotatedEntityCollectionInspector","proseCompoundEntityOperationsManager","getProseCompoundEntityOperationsManager","userData","userName","collectionChangeMonitor","EntityChangeMonitor","AnnotatedEntityCollectionChangeChecker","lightBoxRefreshInterval","ccsdk","entityFactories","cats","amp","inspectors","entity","annotatedEntityCollection","userProfileManagers","local","prose","annotatedEntityCollectionManager","getAnnotatedEntityCollectionManager","SearchResultsScrollPositionActions_SearchResultsScrollPositionActions","NamespacePrefixActionsDefinitionBase","namespacePrefix","super","saveScrollPositionSignature","ActionMap","namespace","SaveScrollPosition","Actions","ApplicationLevelError","ApplicationErrorActions","SearchAndSelect","InlineError","SearchResultsScrollPositionActions","Creative","Telemetry","Editorial","ComputeImageLoadingPerfCounters","setImageLoadingPerfCounters","clearImageLoadingPerfCounters","SetImageLoadingPerfCounters","ClearImageLoadingPerfCounters","IPerformanceEntryTypes","AppPerformanceObserver","bufferSize","performanceApiAvailable","performance","isOnBufferTimingFullEventAvailable","performanceObserverAvailable","onPerformanceResourcesLoadedCallback","configurePerformanceResourceTimingBuffer","createPerformanceObserver","observe","SubscribeToEntryTypes","setResourceTimingBufferSize","_event","clearResourceTimings","PerformanceObserverFunctionCtor","StickyPerformanceApiPropertyName","observer","CatalystPerformanceObserver_CatalystPerformanceObserver","onEditorialImagesLoadedCallback","entryTypes","PerformanceResourceTiming","list","imageResources","getEntriesByType","filter","filterEditorialSearchedImages","resourceEntry","initiatorType","indexOf","computeElapsed","img","Math","round","responseEnd","startTime","domainLookupEnd","domainLookupStart","dnsLookupTime","connectEnd","connectStart","tcpHandshakeTime","filterSlowImage","imageLoadingTimeThreshold","elapsed","imageLoadingWasSlow","CatalystImageLoadingPerfCountersManager_CatalystImageLoadingPerfCountersManager","instrumentationClient","rootBootstrapper","setImageLoadingPerfCountersAction","getActionSender","store","catalystPerformanceObserver","browserMissesRequiredFeatures","SearchAndSelectBootstrap","registerHandlerOnEditorialSearchExecuted","flushPerformanceCounterToNetwork","onbeforeunload","catalystState","getCurrentState","loadedImagesBatchResourceTimings","performanceCounters","editorialSearchImageLoadingTimes","telemetryPerfCounter","loadedImagesResourceTimings","slowImages","image","slowImagesDetails","slowImage","loadingTime","url","CounterName","CounterValue","Data","imagesCount","slowImagesCount","createTelemetryPayload","logging","imageLoadingPerfCounters","loadingTimeThreshold","PerformanceCounterLoggingService","logPerfCounter","InstrumentationClient_InstrumentationClient","appConfig","authenticationManager","loggingService","LoggingService","getInstance","setLevel","LogLevel","loggingServiceLoglevel","activityLoggingService","ActivityLoggingService","userActivityTrackingService","UserActivityTrackingService","performanceCounterService","PerfCounterLoggingService","telemetryEnabled","consoleAppender","BrowserConsoleAppender","All","addAppender","activityLoggingEnabled","userActivityTrackingEnabled","performanceCountersLoggingEnabled","oneDsEnvironment","OneDsEnvironment","Dev","oneDsConfig","environment","Ppe","Prod","oneDsAppenderConfig","application","buildVersion","instrumentationKey","isLoggedIn","isUserAuthenticated","oneDsRoutingProfile","OneDsRoutingProfile","CAT","productName","toolsProduct","sendMode","OneDsSendMode","BatchEvents","authMethod","determine1DSUserAuthMethod","transmissionProfile","OneDsTransmissionProfile","BestEffort","shareAuthStatus","oneDsWebAppender","OneDsWebAppender","rootActivity","createActivity","username","OneDsUserAuthMethod","AAD","MSA","None","Instance","RootActivity","RootActivityCorrelationVector","correlationVector","event","elementTitle","eventType","elementId","areaOfPage","EventData","createFrom","Global","AppContentSection_AppContentSection","react","className","props","children","HeaderLinkPage","editorial","creative","lightbox","Routes_Routes","imageId","location","protocol","host","getImagePageRoutePath","baseOnly","lightboxId","appInternal","state","lodash","getLightboxPageRoutePath","entityId","AppHeaderSection_AppHeaderSection","context","activeLightboxId","pageHeaderClassName","onHeaderLinkClicked","onEditorialSearchLinkClicked","onCreativeSearchLinkClicked","toggleVisibility","isCollapsed","toLightbox","pathname","getStateForLightboxRoute","appNavBarClass","notificationToggleClass","es","to","onClick","target","href","UserBoxForNavBar","userProfile","onSignInClicked","onSignOutClicked","NotificationsPopup","assign","MessageBoxModal_MessageBoxModal","react_bootstrap_es","show","isVisible","onHide","close","Header","Title","Body","title","text","txt","Footer","AppLayoutPanel_AppLayoutPanel","connectedAppHeaderSection","appHeaderSectionBootstrapper","getConnectedComponentWithStateSelection","connectedErrorMessageBox","errorMessageBox","creativeSearchFilterPanePropsIndexes","providers","orientations","imageStyles","creativeSearchProvidersProps","queryFilterPaneProps","optionGroups","items","ResultsDisplayModeEnum","shouldCatalystVirtualCollectionUpdate","prevProps","nextProps","hasProviderChanged","creativeProvider","hasPagePropsChanged","resultsDisplayMode","Grid","pagedImagesProps","pagedVirtualCollectionProps","containerWidth","CatalystPagedVirtualCollection_CatalystPagedVirtualCollection","pagedVirtualCollectionElement","PagedVirtualCollection","ref","instance","containerHeight","pages","pageDescriptors","activePageIndex","activePageCellProps","onScroll","verticalOverscanSize","scrollTop","imageTiles","tileProps","renderTile","forceRecomputeOfCellSizesAndPositions","recomputeCellSizesAndPositions","CatalystPagedVirtualGrid_CatalystPagedVirtualGrid","PagedVirtualGrid","itemWidth","thumbnailImageWidth","itemHeight","thumbnailImageHeight","addTransitionEffect","GridImageTile_GridImageTile","onImageTileInvoked","onImageTileSelectionChanged","addToLightboxButtonOverlayProps","onAddToLightboxInvoked","glyph","setAsTabStop","position","ButtonOverlayPosition","TopRight","onInvoked","tooltip","removeFromLightboxButtonOverlayProps","onRemoveFromLightboxInvoked","tileDescription","customClassName","loading","tabIndex","Spinner","addToLightboxOverlay","ButtonOverlay","removeFromLightboxOverlay","altText","sourceHref","overlayableImageProps","source","alt","errorCode","tileDescriptionElement","selected","supportsMultiSelection","checkBoxClassName","checked","onChange","OverlayableImage","currentTarget","tagName","FilterItemOptionsType","FilterItemOptionsListSelectionType","ImageTile_ImageTile","textOverlayProps","TextOverlayPosition","Bottom","imageTitleTextOverlay","TextOverlay","renderAsPlaceholder","DateRangePicker_DateRangePicker","date","moment","toISOString","Datepicker","isKeyboardNavigable","dateFormat","placeholderText","maxDate","dateToMoment","maxStartOfRangeDate","selectedDate","startDate","onDateChange","StartOfRangeIndicator","maxEndOfRangeDate","endDate","EndOfRangeIndicator","whichDate","selectedMoment","newDate","toDate","onStartOfRangeChanged","onEndOfRangeChanged","QueryFilterPane_QueryFilterPane","onKeyDown","indexToToggle","values","selectedIndices","forEach","index","divider","renderDivider","optionGroup","renderGroup","renderItem","options","callback","menuItems","item","eventKey","indexToDefaultValue","findIndex","dropdownButtonTitle","replace","onSelect","radioButtonClassName","onCheckBoxClick","onKeyUp","onTabKey","eventArgs","keyCode","KeyCode","SPACE","preventDefault","helpElement","trigger","rootClose","placement","overlay","bsSize","which","TAB","checkBoxLabelTag","parentElement","NoOutlineCssClassName","classNameSplit","split","join","groupToRender","groupName","itemToRender","showItemName","element","$type","StringList","stringList","selectionType","SingleSelectDropdown","renderSingleSelectOptionsList","onSelectedOptionsChanged","SingleSelectRadio","renderSingleSelectRadioOptionsList","renderMultiSelectOptionsList","toggleItemAndGetSelectedIndices","dateRange","renderDateRange","titleElement","dateRangeFilter","SearchHint_SearchHint","ctx","expanded","toggleSearchHintDetail","expandCollapsible","notification","Notification","setState","SearchWithAutosuggest_SearchWithAutosuggest","searchGlyph","autoSuggestInputProps","allowSearch","searchIcon","suggestions","catalystSuggestions","concat","searchBox","dist","onSuggestionsFetchRequested","onSuggestionsClearRequested","onSuggestionSelected","getSuggestionValue","suggestionItem","renderSuggestion","suggestion","inputProps","shouldRenderSuggestions","searchBar","Addon","onSearchExecute","onSubmit","SearchUI_SearchUI","scrollTopEditorialSearch","scrollTopCreativeSearch","renderPagedComponent","saveLatestScrollPosition","serviceErrors","searchResultsBrowser","serviceError","renderServiceErrors","searchTip","renderSearchHints","renderBrowserComponent","filterPane","renderFilterPane","getRenderFilterPaneProps","sortOrderDropdown","renderSortOrderDropdown","showHideFilterOptionText","showFilterOptions","showHideFilterOptionGlyph","pageName","SingleDocker","dockPosition","DockPosition","Left","Sidebar","expandedWidth","expansionStyle","ExpansionStyle","Docked","isExpanded","onToggleFilterOptionsVisibility","Main","overflowX","overflowY","searchWithAutosuggestProps","style","display","aria-labelledby","type","getSelectedBtnCssName","onDisplayModeChanged","Mosaic","width","dockerMain","dockerMainRef","react_dom","searchHintsNotifications","searchHints","searchHintProps","itemType","titlePrefix","detail","setBackgroundColor","notificationProps","richNotification","RichNotification","sortOrderProps","onSelectedOptionChanged","onRetryClicked","tileInvokedHandler","imgWidth","imgHeight","onItemInvoked","_itemIndex","virtualCollectionMosaicProps","renderMosaicTile","virtualCollectionGridProps","renderGridTile","pageNavigation","buttonForMode","selectedOption","_value","active","bsStyle","onSortOrderChanged","isPageLoading","childDocumentsBeingLoaded","component","toolTip","pageBrowserContentComponent","browserContainerClassName","onlyFirstPageLoaded","isLast","aria-hidden","renderNextPageResultsLoadingComponent","renderFirstPageLoadingMessageComponent","height","dist_es","onResize","canvasSizeChanged","enrichedProviderProps","scrollParams","creativeSearchProps","onSearchViewWillUnmount","isLastPage","CreativeSearch_CreativeSearch","providerQueryFilterPaneProps","moreResultLoadingComponent","moreChildrenLoading","DriCmsEntityEditor_DriCmsEntityEditor","entityFactory","bootstrapper","CmsEntityJsonEditorBootstrapper","_entityEditingActions","cmsEntityJsonEditorActions","CmsEntityEditingActions","documentCommandActionCreator","DocumentCommandActionCreator","CmsCommandActions","CmsEntityEditingActionCreator","editor","bootstrap","CmsEntityJsonEditor","loadCmsDocument","mapDispatchToProps","EntityJsonEditorHost_EntityJsonEditorHost","jsonDocument","loadCmsEntity","JsonEditor","catTenantEntityManager","getLatest","then","getEntityResult","JSON","stringify","prevState","calculateNextImageIndex","pageSize","currentIndex","totalItems","pageIndex","floor","nextSelectedIndex","calculatePreviousImageIndex","maxPageIndex","getImageDimensionToDetermineLayout","selectedImageEntity","originalHeight","originalWidth","fileMetadata","downloads","isFinite","determineModalLayout","aspectRatio","Number","NaN","initializeModalCarouselProps","disableNextNavigation","disablePreviousNavigation","activeIndex","showIndicators","_eventKey","_carouselEvent","onKeyPressed","_eventArgs","ImageStatusEnum","LightboxPanelLightboxSourceEnum","ImagePreviewModal_ImagePreviewModal","expandImageLinkNotification","expandNotification","blankImgBufferRendered","showImageLinkOverlay","toggleImageLinkNotificationDetail","toggleNotificationDetail","displayVerticalLayout","maxTextWidthForModal","maxImageWidthForModal","max","min","textWidth","_prevProps","_prevState","hideAddToLightboxOverlay","layoutInformation","determineLayoutInformation","renderModalBody","modalBody","containerClassName","downloadBtnText","downloadInProgress","addToLightboxButton","getAddToLightboxBtn","addToLightboxOverlayIsVisible","showAddToLightboxOverlay","removeFromLightboxButton","getLightboxManager","getActiveLightboxId","getImageLinkButton","getImageLinkBtn","generateImageLinkInvoked","isImageLinkGenerationInProgress","popoverElement","imageLink","container","readOnly","defaultValue","disabled","copyLinkToClipboard","footerMessage","downloadEnabled","downloadImage","renderNotification","renderImageLinkErrorNotification","renderImagePreviewContent","document","querySelector","select","execCommand","renderErrorNotification","generateLinkErrorMessage","lastDownloadError","errorMessage","isOperationInProgress","errorTitle","toggleNotificationCallback","NotificationType","imageWidth","imageHeight","contentStatusStyle","contentImageText","contentImageAddition","isImageBeingProcessed","renderPropertyList","src","onLoad","ownerDocument","getElementById","lowQualtiySourceHref","restrictionsText","restrictions","propertyListProps","propertyListAlignment","PropertyListAlignments","Vertical","propertyListItemAlignment","Horizontal","separator","propertyListItems","addStringPropertyToList","caption","publishDate","qualityIndicatorMessage","providerName","photographerName","licenseModel","sourceId","addBooleanPropertyToList","isModelReleased","isPropertyReleased","PropertyList","displayLabel","displayValue","ImageDetailsPage_ImageDetailsPage","childComponent","isError","GridUnProcessedImageTile_GridUnProcessedImageTile","onImageTileRefresh","refreshButtonElement","isImageRefreshing","refreshButton","imageStatus","UnProcessed","LightboxCardActionButton_LightboxCardActionButton","haveTooltip","showTooltip","actionButton","stopPropagation","delayShow","LightboxCard_LightboxCard","lightboxCardStyle","itemCountComponent","itemCount","actionButtonProps","lastModifiedDate","lastModifiedBy","LoadLightboxSourceEnum","LightboxPage_LightboxPage","onCanvasSizeChanged","showImageIdListOverlay","onPageMounted","firstSelectedElement","offsetTop","offsetHeight","firstSelectedElementIndex","onPageUnmounting","browser","serviceErrorNotification","tilesSelected","tile","failedTilesSelected","sidePanel","renderLightboxSelectorSidePanel","downloadButtonEnabled","getImageIdsListButtonEnabled","getImageIdsBtnText","failedDownloadElement","failedImages","retryDownloadForFailedImages","clearImagesFailedToDownload","downloadButton","showDownloadButton","downloadSelectedImages","downloadAllImages","clearSelectionButton","clearSelection","getImageIdsListButton","generateImageIdsListBtn","_evt","generateImageIdsListImages","onlySelected","imageIds","imageTile","Processed","isSearchInProgress","isSearching","lightboxes","selectedLightbox","disableHeight","disableWidth","renderVirtualGrid","noLightboxesMessage","Recent","VirtualGrid","placeholder","searchPlaceholderText","searchText","onSearchTextChanged","_request","_text","headingText","headingButton","onExitSearch","heading","belowTheHeading","renderLightboxCard","lightboxProps","SearchAndSelect_SearchAndSelect","SignedInApp_SignedInApp","connectedSearchAndSelect","appBootstrapper","connectedCreativeSearchPage","CreativeSearchPageBootstrap","connectedLightboxPage","LightboxPageBootstrap","connectedImageDetailsPage","ImageDetailsPageBootstrap","localUserProfileIsLoading","history","path","getSearchPageRoutePath","onEnter","AppHeaderSectionBootstrap","setCurrentPageClassName","getCreativeSearchPageRoutePath","nextState","params","loadLightboxSourceEnum","External","isRouteNavigationSourceInternal","Internal","loadLightbox","loadImageToDisplayDetails","getErrorPageRoutePath","ErrorPage","errorDescription","backgroundImageUrl","getEditorPageRoutePath","routerProps","getEditorComponent","getWriteModeEditorPageRoutePath","readonly","routeParams","Editor","PageNames","Lightbox","ImageDetails","AreaOfPage","applicationTopNav","searchAndSelectFilterPanel","searchAndSelectSearchBar","searchAndSelectResultsView","searchAndSelectImagePreviewModal","searchAndSelectAddToLightboxModal","creativeFilterPanel","creativeSearchBar","creativeResultsView","creativeImagePreviewModal","creativeAddToLightboxModal","lightboxSelectBoardPanel","lightboxBoardContents","lightboxImagePreviewModal","ImagePreviewModal","ImageDetailsView","ResizeServiceMode","resizeService_ResizeService","ImageUri","backgroundColor","quality","urlWithoutProtocol","UrlExtension","removeProtocol","queryUri","url_parse","toString","queryParams","w","h","b","q","reduce","args","AddToLightboxOverlay_AddToLightboxOverlay","enableAdd","collections","collection","itemToAddWidth","itemToAddHeight","inlineStyle","addToLightboxOverlayTarget","ManageCollection","eventargs","isImageAdditionInProgress","onAddToCollectionsInvoked","_eventargs","onAddToCollections","selectedCollections","collectionWithSelectionState","nativeEvent","AppConstants","catalystProdUrl","disallowedSearchChars","RegExp","MillisecondsInADay","margin","gridTileImageWidthHeight","lightboxTileInnerMargin","lightboxTileTextboxHeight","requiredFieldListForImageFileData","OCID","OneServiceApiKey","thumbnailConfig","totalWidth","totalHeight","totalMargin","gridTileImageWidth","gridTileImageHeight","gridTileWidth","gridTileHeight","thumbnailsPerPage","maxLightboxSearchResults","resultsBrowsing","maximumNumberOfResults","scrollDebounceTime","scrollbarThresholdPercentage","AppErrorConverter","error","makeDetailed","prefix","toStringArray","innerError","ServiceErrorCodeLinkNotExist","AppHeaderActions_AppHeaderActions","headerLinkClicked","HeaderLinkClicked","AppHeaderSectionReducer_AppHeaderSectionReducer","NamespaceCheckReducerBase","appHeaderActions","userAuthenticationReducer","notificationsPopupReducer","actionPayload","newState","ActionHandler","handleAction","canReduce","authenticationState","notificationsState","AppHeaderSectionBootstrapper_AppHeaderSectionBootstrapper","ComponentBootstrapper","parentBootstrapper","stateSelector","userBoxBootstrapper","UserBoxBootstrapper","notificationsPopupBootstrapper","NotificationsPopupBootstrapper","getInitialState","userBoxDefaultProps","getDefaultProps","notificationsDefaultProps","createRootReducer","notificationsReducer","CollapsibleNotificationsReducer","ownProps","userboxProps","mapStateToProps","notificationListProps","dispatch","onBeforeComponentCreated","FieldType","FilterRuleSelectionMode","CmsStringEscape","input","CatalystSearchManager_CatalystSearchManager","onNewSearchInvokedCallback","actionNamespacePrefix","filterRules","editorspick","ruleName","fieldType","StringField","selectionMode","MultiSelect","displayString","helpText","queryTextFilterBuilder","filterValues","bestPicsSearchKeywords","provider","topPicsKeywords","headShots","NumberField","PromoCardPredicateBuilder","filters","isEditorialProvider","predicateFilterBuilderForStringValues","EditorialSearchQuery","providerFilter","orientationFilter","getNotQueryForFullTextSearch","people","comparisonOperator","Operators","EQUALS","GREATER_THAN","predicateFilterBuilderForNumberFilterValues","numberOfDetectedFacesFilter","displayPublishedDate","DateField","dateRangeFilterBuilder","from","searchCancellationToken","entityListActions","EntityListActions","getFilter","searchActivity","endActivity","SearchActivity","endCurrentAndCreateNewSearchActivity","searchForFirstPageEntitiesActivity","preFlightSearchPromise","SearchActionCreator","SectionListSearchScopeOptions","SearchCurrentAndAllDescendentDirectories","search","SearchIndex","Unpublished","PromiseExtension","onComplete","catch","orderBy","filterBy","searchMatchCriteria","parentActivity","cancelCurrentAndCreateNewCancellationToken","constructSectionListCreatorsInstance","loadEntitiesPromise","searchActionCreator","RequiredFieldList","escape","errorMsg","formatError","EntitiesLoadingError","continuationToken","loadMoreEneitiesPromise","continueSearch","FilterRules","cancel","ActionDispatchCancellationToken","ErrorType","ServiceClientResponseError","rawResponseBody","Code","buildMultiSelectOptionsList","selectedIndexes","selectedOptionsChangeCallback","filterOptions","buildSingleSelectOptionsList","selectedIndex","selectedOptionChangeCallback","retVal","CarouselDirection","Next","Previous","CatalystSearchReduction_CatalystSearchReduction","entitySearchActions","ExecuteSearch","searchUniqueIdentifier","SearchExecuted","Guid","newGuid","SearchTextChange","ClearSearch","CreativeSearchActions_CreativeSearchActions","resetfilter","setResultsDisplayMode","setProvider","firstPagesearchExecutingSignature","firstPagesearchExecutedSignature","firstPagesearchExecutionErrorSignature","nextPagesearchExecutingSignature","nextPagesearchExecutedSignature","nextPagesearchExecutionErrorSignature","ResetFilter","SetResultsDisplayMode","SetProvider","FirstPageSearchExecutingSignature","FirstPageSearchExecutedSignature","FirstPageSearchExecutionErrorSignature","NextPageSearchExecutingSignature","NextPageSearchExecutedSignature","NextPageSearchExecutionErrorSignature","CreativeSearchActionCreator_CreativeSearchActionCreator","creativeImageSearchManager","creativeSearchActions","searchResults","moreResultsAvailable","totalResultCount","page","ceil","searchQuery","creativeSearchResponsePromise","searchCreativeImage","isCancellationRequested","getContinuationToken","SearchWithAutosuggestActionCreators_SearchWithAutosuggestActionCreators","oneServiceBusinessLogicFactory","searchWithAutosuggestActions","autosuggestLoadCancellationToken","suggestionLabels","autoSuggestManager","getSuggestionsManager","Promise","getSuggestedEntities","response","suggestionsValueEntities","suggestedEntity","groups","suggestionGroupEntity","suggestionItems","suggestionItemEntity","displayText","UpdateAutosuggestions","inputString","clearSuggestions","SearchWithAutosuggestReduction_SearchWithAutosuggestReduction","searchHintsReduction","notificationListActions","SearchTextChanged","autoSuggestInputState","UpdateCatalystSuggestion","validateSearchText","rules","validationErrors","rule","testCondition","searchHint","SearchBootstrapperBase_SearchBootstrapperBase","parentBoostrapperName","getSearchText","searchHintsActions","validateSearchTextRules","cancelLastAutoSuggestLoad","onSearchTextChange","filterOutErrors","filterOutInfo","filterOutSuccess","filterOutWarnings","notifications","manageSearchHints","searchWithAutosuggestActionCreators","getAutosuggestEntities","searchWithAutosuggestState","defaultProps","_dispatch","_ownProps","NotificationListReduction","newValue","ClearAllNotifications","actionInput","PageActionData","performSearch","validationResult","hintServerity","notifications_NotificationType","AddNotification","quickHint","fullHint","CreativeSearchBootstrapper_CreativeSearchBootstrapper","buildCreativeFilterQuery","getActionInput","onSearchInvoked","creativeSearchActionCreator","control","controlType","query","creativeSearchActivity","logPageActionEvent","createEventData","getPageActionData","executeSearchPromise","executeCreativeSearch","CreativeSearchActionCreator","CreativeSearchReduction_CreativeSearchReduction","collapsibleActions","providerListSelectorActions","orientationListSelectorActions","imageStyleListItemSelectorActions","sortOrderListItemSelectorActions","imagePreviewModalActions","pagingActions","searchWithAutosuggestReduction","catalystSearchReduction","pagedImagesReduction","modalProvisioningReduction","imageCommandReduction","providerFilters","providerImageSearchFilters","selectedOrientations","selectedImageStyle","CreativeProvider","ShutterStock","selectedItems","currentSelectedProvider","Getty","selectedProviders","selectedSortOrder","resetProviderFilter","CreativeImagePreviewModalFetchEnd","selectedCreativeImage","selectedImageEntityIndex","currentResults","providerImageSearchResults","pagedImageState","pagedImagesState","totalResultsAvailable","pagedSearchResults","hasSearchExecutedOnce","pageNumber","lastPageFetched","results","totalResults","ToggleCollapsible","filterOptionVisibleState","collapsed","SelectionChanged","currentSelectedProviderFilter","CanvasSizeChanged","canvasWidth","canvasHeight","modalProvisioningState","entitySearchState","providerImageDownloads","creativeSortOrderOptions","displayName","CreativeImageSort","bestMatch","newest","popular","problemImageEntities","getDimensionsHelper","imageFileData","isValidDimension","dimension","_id","getCreativeImageDimensionsHelper","creativeImage","previewImageSize","maxImageSize","ImageCommandActionCreator_ImageCommandActionCreator","imageAcquisitionManager","imageCommandActions","NotificationListActions","progressEvent","downloadImageName","DownloadingImage","promise","_imageDownloadInfo","DownloadedImage","errorResponse","DownloadImageFailed","createFailureNotificationActionForActionResponse","_name","creativeImageId","downloadCreativeImage","ClearLastDownloadErrorMessage","notificationTitle","notificationMessage","ImageCommandActions_ImageCommandActions","downloadingImage","downloadedImage","downloadImageFailed","clearLastDownloadErrorMessage","imageIngestionInProgress","imageIngestionCompleted","imageIngestionFailed","imageUpdateByIngestionFailed","addImageStatusUpdateInProgress","removeCompletedImageStatusUpdate","removeFailedImageUpdateByIngestion","imagePreviewLinkGenerationStatusReset","ImageIngestionInProgress","AddImageStatusUpdateInProgress","RemoveCompletedImageStatusUpdate","ImageIngestionFailed","ImageIngestionCompleted","ImagePreviewLinkGenerationStatusReset","ImageUpdateByIngestionFailed","RemoveFailedImageUpdateByIngestion","ImageCommandReduction_ImageCommandReduction","imagesDownloading","creativeImageIngestionState","creativeImageIngestionError","cmsIdForCreativeImage","beingIngestedImageIds","creativeImageIngestionErrorMessage","imgId","failedToUpdateImages","imageUpdateInProgress","providerImageId","cmsId","ImagePreviewModalActions_ImagePreviewModalActions","imagePreviewModalFetchEnd","creativeImagePreviewModalFetchEndSignature","ImagePreviewModalFetchEnd","ListItemSelectorActions_ListItemSelectorActions","itemsChanged","selectionChanged","ItemsChanged","ModalCarousel_ModalCarousel","carouselItems","renderCarouselItems","nextIcon","renderNextIcon","previousIcon","renderPreviousIcon","autoFocus","indicators","prevIcon","iconCssClass","child","carouselItem","Item","renderNavigationIcon","GlyhiconCssClassChevronRight","GlyhiconCssClassChevronLeft","SearchWithAutosuggestActions_SearchWithAutosuggestActions","updateAutosuggest","searchTextChanged","updateCatalystSuggestion","memoizedCalculateCellRenderInformation","cache","tiles","startIndex","prev","current","CalculateCellRenderInformation","calculateCellRenderInformation","CreativeSearchPageBootstrapper_CreativeSearchPageBootstrapper","pagedImagesBootstrapper","onAddEntityToLightbox","modalProvisioningActions","setParent","creativeFilterFields","creativeFilterData","creativeProviderFilterData","ImageOrientation","vertical","horizontal","square","panoramicHorizontal","panoramicVertical","license","LicenseType","royaltyFree","rightsManaged","imageStyle","ImageStyle","photo","illustration","fineArt","SingleSelect","CreativeImageLicenseType","commercial","enhanced","sensitive","CreativeImageStyle","vector","createCreativeFilterData","EntitySearchActions","CollapsibleActions","providersListItemSelectorActions","orientationsListItemSelectorActions","lastSearchCancellationToken","loadMoreItemsOnScroll","onFilterOptionsVisibilityChanged","onSelectedProvidersChanged","onSelectedOrientationsChanged","onSelectedImageStyleChanged","onSelectedSortOrderChanged","onPreviewButtonOk","onPreviewButtonNext","onPreviewButtonPrev","onPageNavigation","onClearSearch","generateImageLink","creativeSearchBootstrapper","createCreativeSearchQuery","getSearchActionInput","adaptPagedComponentPropsToSinglePage","profileExists","creativeSearchFilters","sortOrder","creativeResultView","resultDisplayMode","displayMode","initialState","searchOperation","SearchOperationTypes","EXECUTE_SEARCH","initialResultState","mapProviderFilters","imageCommandActionCreator","pagedImagesReducer","ModalProvisioningReduction","currentProviderResultState","haveSearchResults","failedActions","imageProviders","buildImageProviderFilterOptions","currentProviderFilter","imageOrientations","buildOrientationsFilterOptions","buildImageStyleFilterOptions","createProviderQueryFilterPaneProps","option","currentPagedImageState","imageEntity","previewImageUrl","throttledLoadMoreItemsOnScroll","leading","trailing","containerHeightForCollection","indexOfLastElement","y","modal","createModal","modalId","pagedComponentProps","isFirst","endIndex","setSetting","orientationIndices","mapFiltersToIndices","styleOptions","styleIndices","indices","createModalCarousel","modalCarouselProps","carouselEvent","direction","LEFT_ARROW","RIGHT_ARROW","imagePreviewModalElement","createImagePreviewModal","currentProviderImageCommantState","showDownloadingMessage","showFailedDownloadingMessage","imagePreviewProps","visible","getImagePageRoutePathWithProtocol","dateCreated","photographer","licenseValues","licenseValue","entityInfo","getEntityAndIndexFromSearchResult","getSelectActionInput","ShowModal","currentProviderSearchResults","resultPageIndex","resultImageIndex","clearLastDownloadError","HideModal","currentProviderSearchResult","loadMoreData","entityOrder","currentState","ageOfImagesInDays","dateImageTaken","Date","nowTime","now","getTime","order","orientation","ageOfImageInDays","filterPaneVisibleState","selectedEntity","navigatedEntiries","creativeImageList","cancellationToken","pageActionData","_continuationToken","activityName","nextPageQuery","nextPageSearchActivity","nextPageSearchPromise","executeNextPageCreativeSearch","imageTileCount","selectedProvider","clientHeight","scrollHeight","scrollEvent","CustomEvent","currentProvider","orientationFilterData","imageStyleFilterData","currentProviderSelectedIndex","saveQueryFilterSelectionToProfile","currentSearchText","prevSearchResults","currentSelectedSortIndex","currentSortOrderName","prevSortorder","prevSearchText","searchPhrase","sort","selectedOrder","sourceData","selectedImage","logData","action","creativeImageIngestActivity","imageIngestionPromise","ingestImage","AssetFamily","cmsImageId","getDownloadActionInput","downloadActivity","downloadImagePromise","selectFilters","filterData","selectProviderFilters","selectedImageStyles","selectedSortOrderDisplayString","searchTerm","providersFilter","orientationsFilter","imageStyleFilter","pageToFetch","queryText","sortOption","CreativeSearchQueryBuilder","forProvider","sortBy","filterByStyle","filterByOrientation","GettyCreativeImageSelect","date_created","graphical_style","copyright","allowed_use","artist","thumb","license_model","max_dimensions","uri","filterByLicenseModel","build","GetSelectActionInput","entityWithMetadata","filterPaneCollapsed","message","metadata","documentId","GetProviderFromEntity","displayPublishedDateTime","_links","providerIndex","GetEntityWithMetadataAndIndexFromSearchResult","entitiesList","selectedEntityWithMetadata","createDownloadActionInput","providerDocumentId","assetFamily","GetDownloadActionInput","logDownloadActionEvent","createDownloadActivity","_selectedImageEntity","DownloadImage","promise_extension","addImageQualityQueryParamToUrl","urlToParse","sourceHrefParsed","queryString","query_string","imageTileQuality","set","ImagePreviewConstants","GetImagePreviewElementProps","selectedImageEntityWithMetadata","isImageIngestionInProgress","isFailedImage","isValidEntity","Message","sourceLocation","imageQualityUnknownMessage","downloadInfo","qualityMessage","usableDownloadInfo","thresholdExceeded","imageQualityThresholds","GetImageQualityMessage","NEGATIVE_INFINITY","imageDetailsPageActions_ImageDetailsPageActions","imageDetailsFetched","imageDetailsLoading","imageDetailsLoadingError","ImageDetailsFetched","ImageDetailsLoading","ImageDetailsLoadingError","ImageDetailsPageReduction_ImageDetailsPageReduction","imageDetailsPageActions","isLoading","isInErrorState","imageEntityWithMetadata","imageCommandState","getLatestStatusOfUnProcessedEntity","unProcessedEntity","methodName","providerSource","reject","ErrorResponse","responseStatus","status","ImageDetailsPageBootstrapper_ImageDetailsPageBootstrapper","imagePageActions","imageCommandReducer","imageLoadActivity","logPageView","documentData","loadPromise","Types","ImageFileData","getLatestEntityResponse","updateStatusPromise","dimensions","imagePreviewElementProps","ImageLoadingPerfCountersReducer_ImageLoadingPerfCountersReducer","LightboxActionCreator_LightboxActionCreator","lightboxUserProfileManager","lightboxActions","lightboxEntityListActions","removeLightbox","createLightbox","addLightbox","addItemsToLightbox","raiseErrorNotification","RemovingLightbox","removeLightboxActivity","remove","UpdatedLightbox","tenantName","parentSectionId","AddingLightbox","parentSectionHref","EntityLinkHref","defaultPrefix","Section","createAnnotatedEntityCollection","createPromise","EntityState","Published","EntityBehaviorType","BasicAndPrivate","cms_typed_promise","lightboxProfileInfo","lastAccessedDate","add","AddedLightboxAndSetActive","OperationFailed","addLightboxActivity","SetLightboxActive","lightboxName","entityHrefs","AddingItemsToLightbox","annotatedEntities","entityHref","cmsReference","annotations","addItemsPromise","addItems","AddedItemsToLightbox","collectionEntityWithMetadata","hrefs","getSelfLinkHrefString","EntitiesUpdating","EntitiesUpdated","RemovingItemsFromLightbox","removeItemsPromise","removeItems","RemovedItemsFromLightbox","ClearNotification","LightboxActions_LightboxActions","removingLightbox","updatedLightbox","addingLightbox","addedLightboxAndSetActive","addingItemsToLightbox","addedItemsToLightbox","removingItemsFromLightbox","removedItemsFromLightbox","operationFailed","clearNotification","setLightboxActive","lightboxImagesDownloadStarted","lightboxImagesDownloadFinished","lightboxImageDownloadFailed","lightboxClearFailedDownloadImages","lightboxRetryFailedImagesDownload","LightboxImagesDownloadStarted","LightboxImagesDownloadFinished","LightboxClearFailedDownloadImages","LightboxRetryFailedImagesDownload","LightboxImageDownloadFailed","helpLinkUserActions","buttonProps","urlTarget","authenticationServiceErrorParser","AuthenticationServiceErrorParser","MissingConsent","parse","getAzureActiveDirectoryConsentUrl","badRequestServiceErrorParser","serviceErrorParserEnhancers","BadRequestServiceErrorParser","deniedServiceErrorParser","DeniedServiceErrorParser","canParse","deniedAccessErrorNotification","isProdEnvironment","whatToDoSectionIndex","richTextSections","section","toLowerCase","whatToDoText","userAction","appUrl","unknownStatusCodeServiceErrorParser","UnknownStatusCodeServiceErrorParser","missingDetailsServiceErrorParser","MissingDetailsServiceErrorParser","serviceErrorParsers","appLevel","parsers","parser","CompositeServiceErrorParser","all","badRequest","LightboxManager_LightboxManager","lightboxActionCreator","lightboxGetEntityListActions","lightboxSearchEntityListActions","searchForLightboxesActionCreator","imageEntityListActions","getLightboxState","getLightboxPageState","onActiveLightboxChanged","getImageEntitiesCancellationToken","searchForLightboxesCancellationToken","getLightboxEntitiesActionCreator","GetEntitiesActionCreator","waitingToAdd","waitingToUpdate","getLightboxInformation","searchForLightboxes","removeItemsFromLightbox","getEntitiesInActiveLightbox","setActiveLightbox","addSetActiveAndMonitorLightbox","setActiveAndMonitorLightbox","startMonitoring","stopMonitoring","getLightboxEntityWithMetadata","constructGetImageEntitiesCreatorsInstance","onLightboxChangedCallback","statusMonitoringCallback","stopLightboxMonitoring","annotatedEntity","EntityLinkHrefSerialization","parseFromString","lightboxIds","getLightboxActivity","getLightboxPromise","getMoreEntities","RequiredFieldListForAnnotatedEntityCollection","handleServiceError","searchForLightboxesActivity","cancelCurrentAndCreateNewSearchCancellationToken","Predicate","lightboxParentSectionId","and","AnnotatedCollection","field","Direction","Desc","searchForLightboxesPromise","logUserAction","createNewLightboxActivity","MoreEntitiesLoaded","addLightboxPromise","removeLightboxPromise","info","entitiesWithMetadata","addItemsToLightboxActivity","addItemsToLightboxPromise","createErrorNotification","_reject","entitiesToRemove","removeItemsFromLightboxActivity","lightboxEntityWithMetadata","currentLightBoxEntity","find","idFromAnnotatedEntity","errorString","entityIds","getEntitiesPromise","clearErrorNotification","FirstPageEntitiesLoaded","getEntitiesInActiveLightboxActivity","getImageEntitiesActionCreator","getEntities","RequiredFieldListForImageFileData","activeLightboxChanged","registerCollectionUpdateListener","unregisterCollectionUpdateListener","addSetActiveAndMonitorLightboxHelper","startListening","stopListening","FirstPageEntitiesLoading","AnnotatedCollectionMonitorStatus","Running","monitoring","ewm","collectionStatusMonitoringCallbackActivity","getEntitiesInActiveLightboxPromise","_activityName","lightboxEntity","myLightboxes","lightboxEntitiesState","collectionId","changeDetails","changeType","AnnotatedCollectionChangeType","Remove","processChangesToActiveLightbox","getOrCreateCancellationToken","promiseToReturn","refreshLightboxActivity","changes","removedItems","removedIds","removedItem","processRemovalsActivity","itemsRemoved","selectedAnnotatedEntityIndex","maxIndex","prevEntityIds","getIDsOfEntitiesInActiveLightbox","shiftCount","newIndex","EntitiesRemovedById","newItems","newIds","newItem","processAddsActivity","itemsAdded","newCollection","parsedServiceError","SetApplicationError","LightboxPanelNowShowingEnum","LightboxDownloadManager_LightboxDownloadManager","downloadSelectedImagesHelper","lightBoxImages","eventData","initiateMultipleDownloads","eventName","controlName","download-count","initiateDownload","batchPromises","downloadAllPromises","downloadAllClickEvent","onAllComplete","batch","currentBatchPromises","downloadPromise","count","Info","LightboxPageBootstrapperReduction_LightboxPageBootstrapperReduction","lightboxPageReduction","lightboxPageState","LightboxPageReduction_LightboxPageReduction","lightboxPageActions","lightboxSearchReduction","entitySelectorReduction","downloadStatus","enableDownload","failedImage","nowShowing","ShowSearch","searchTextState","ShowRecent","searchResultsState","listAndSelectorState","entityList","entitySelector","LightboxPageBootstrapper_LightboxPageBootstrapper","entitySelectorActions","EntitySelectorActions","lightboxPageDownloadActions","onImageTileRefreshInvoked","lightboxState","recentLightboxes","operationPending","retriableAction","actionParameters","selectedEntities","allEntitiesSelectionChecked","EntityListReduction","entityListReduction","ListEntitySelectorReduction","EntitySelectorReduction","lightboxPageStateReducer","haveActiveLightbox","lightBoxDownloadStatus","activeLightBoxDownloadBtnStatus","hasValidTile","showEntitiesInActiveLightbox","foundEntityWithMetadataIndex","getImageOverlayTitle","NoDetailsErrorCode","NoDetailsErrorMessage","foundIndex","lastModified","existingOperationPending","lightboxInstance","Search","lightboxDownloadManager","idForRoute","rootLightboxActivity","onImageTileRefreshActivity","entityResponse","_error","getImagesForDownload","getDownloadMethod","imagesToDownload","createLogUserActivityCallback","downloadImageCount","logUserActivityCallback","getLightboxEntityWithMetadataFromMyLightboxes","EntitySelectionChanged","pathToLightbox","getLightboxPageRoutePathWithProtocol","getLightboxEntityWithMetadataFromSearchResults","lightboxDownloadStatus","lightboxImageCount","newSelectedImageEntityWithMetadata","getEntityWithMetadataFromEntityId","entityIndexIntoCollection","selectActionInput","removeFromLightboxActivity","deletePromise","delete","DeletionType","HardDelete","imageOverlayDateFormat","imageDate","format","adjustedIndex","imageTilePropsForEntity","listOfEntitiesInCollection","prevSelectedIndex","onNavigatePrevOrNext","newSelectedIndex","ewmIndex","selectedEntityId","searchLightboxesPromise","LightboxUserProfileManager_LightboxUserProfileManager","userProfileSettingName","_recentLightboxes","onUpdateCallback","subscribe","getAllSettings","profile","lengthIsDiff","diff","unshift","saveLightboxSettingsToCmsProfile","MessageBoxModalActions_MessageBoxModalActions","showErrorMessageBox","hideErrorMessageBox","ShowErrorMessageBox","HideErrorMessageBox","MessageBoxModalReducer_MessageBoxModalReducer","messageBoxModalActions","errorText","MessageBoxModalBootstrapper_MessageBoxModalBootstrapper","Show","onClose","DateRangeBoundaryIdentifier","DateRangeOptionType","QueryBuilder_QueryBuilder","predicates","filterRule","buildPredicate","builtPredicate","predicate","editorialImageFilter","parts","filterQuery","DateRange","hours","milliseconds","setTime","From","To","DateRangeOptions_dateRangeOptions","rangeOptionType","any","durationInHours","custom","DateRangeSelectorActions_DateRangeSelectorActions","dateRangeBoundaryChanged","DateRangeBoundaryChanged","DateRangeSelectorReduction_DateRangeSelectorReduction","dateRangeSelectorActions","whichEndOfRange","startOfRange","isStartBeforeEnd","ModalCarousalEventCallbacks_ModalCarousalEventCallbacks","getImageLinkInvoked","SearchAndSelectActions_SearchAndSelectActions","SearchAndSelectReduction_SearchAndSelectReduction","editorialPickListItemSelectorActions","headShotsListSelectorActions","collectionListSelectorActions","peopleFiltersListSelectorActions","dateRangeOptionsListSelectorActions","sortOrderOptionsListSelectorActions","searchAndSelectActions","dateRangeSelectorReduction","selectedTopEditorialImageOption","headShotsSelectionState","selectedDateRangeOption","FromDateAndHours","customDateRange","selectedPeopleFilters","ClearApplicationError","stateToReduce","startsWithSingleQuote","containsSpecialChar","matchResult","match","SearchBootstrapper_SearchBootstrapper","buildFilter","buildSortOrder","buildQueryText","getSearchMatchCriteria","catalystSearchManager","executeSearchForFirstPageEntities","sortOrderOptions","orderByItem","Asc","tilePropertiesCache","mapEntitiesToImageTileProperties","tilesCollection","multiSelectionSupported","getHref","getTileDimensions","computeImageTileProperties","onThisImageTileInvoked","onThisImageTileAddToLightboxInvoked","SearchAndSelectBootstrapper_SearchAndSelectBootstrapper","onEditorialSearchExecutedHandlers","headShotsListItemSelectorActions","collectionListItemSelectorActions","peopleFilterListItemSelectorActions","dateRangeOptionsListItemSelectorActions","onHeadShotsSelectionChanged","onSelectedCollectionsChanged","onSelectedPeopleFiltersChanged","onSelectedDateRangeOptionChanged","onEditorialPickOptionChanged","onDateInCustomDateRangeChanged","endOfRange","searchBootstrapper","handler","editorialSearchFilters","editorialPicks","buildEditorialPickFilterOptions","editorialPicksIndices","mapFilterIndices","providerIndices","headShotsOptions","buildHeadShotsFilterOptions","headShotsIndices","collectionOptions","buildCollectionFilterOptions","collectionIndices","peopleFilterOptions","buildPeopleFilterOptions","peopleFilterIndices","dateOptions","buildDateRangeFilterOptions","dateIndices","editorialResultView","getInitialDateRangeSelectorState","failedAction","retryFailedAction","editorialPick","selectedDateRangeOptionIndex","dateGroup","defaultDateRange","imageTilesProps","mapStateToImageTilesProperties","searchId","layoutType","cacheKey","some","keyName","firstIndexOfNewData","newTilesPropsToAppend","getCachedTilesProperties","_imageEntity","tileDimensions","getImageTileDimensions","getAddToLightboxActionInput","EntitiesLoading","executeSearchForNextPageEntities","editorialPickFilter","peopleFilters","dateRangeOption","whichEndOfTheRange","buildDateRangeForQuery","BuildFilter","SearchQueryMatchCriteria","SearchQueryMatchCriteriaMode","selectedEditorialPicks","textForFilter","BuildQueryTextFilter","startOf","allValues","selectedValues","createCarouselAddToCollectionOverlay","selectedProviderIds","getSelectedValues","catalystSuggestionSelected","providerId","selectedEditorialPick","startDateDaysToToday","endDateDaysToToday","selectedSortOrderIndex","collectionsFilter","peopleFilter","timeRangeFilter","catalystSuggestedSearchTerm","SignedInAppActions_SignedInAppActions","localUserProfileLoaded","LocalUserProfileLoaded","ShowAddToLightboxOverlay","HideAddToLightboxOverlay","SignedInAppReducer_SignedInAppReducer","signedInAppActions","lightboxListItemSelectorActions","appHeaderReducer","searchAndSelectReducer","applicationErrorsReducer","creativePageReducer","lightboxPageBootstrapperReducer","lightboxEntityListReduction","imageDetailsPageReduction","imageLoadingTelemetryReduction","errorMessageBoxReduction","_lightboxName","lightboxSummaryInfo","_lightboxId","errType","lastOperationNotification","appHeaderSectionState","searchAndSelectState","applicationError","creativeSearchState","imageDetailsPageState","errorMessageBoxState","SignedInAppBootstrapper_SignedInAppBootstrapper","ModalProvisioningActions","OneSrvBusinessLogicFactory","autoSuggestBaseUri","catalystManagerFactory","CatalystManagerFactory","fromProseDomain","catalystServiceClientsFactory","createImageAcquisitionManager","appHeaderSectionBootstrap","lightboxPageBootstrap","getLightboxIdForRoute","FixedPageSizePagedCollectionBootstrapper","PagingActions","ResetPager","catalystCreativeSearchManager","createCatalystCreativeImageSearchManager","searchAndSelectBootstrap","lightboxManager","overlayOnly","createAddToLightboxModalForEditorialImage","imageDetailsPageBootstrap","creativePagingActions","creativePagedImagesBootstrapper","creativeSearchPageBootstrap","createAddToLightboxModalForCreativeImage","onLightboxSelectionChange","onCreateNewLightbox","onAddToLightboxes","applicationErrorActions","errorMessageBoxBootstrap","closeDialogs","ErrorMessageBoxBootstrap","appHeaderSectionReducer","creativeSearchPageReducer","lightboxPageReducer","ApplicationErrorReduction","imageDetailsPageReducer","imageLoadingTelemetryReducer","errorMessageBoxReducer","getLightboxesActionCreator","_activeLightboxId","setOnUpdateCallback","loadLightboxesOnProfileUpdatetActivity","getMyProfile","_localUserProfile","recentLightboxIds","recentLightbox","loadLightboxesOnAppStartActivity","_e","loadLightboxSource","numberOfLightBoxes","logUserActivity","executeSearchForPreFlightCheck","imgProps","getUrifromImageUri","LetterBox","getAddToOverlayImageProps","evt","selectedCollection","AddToCollectionModal","onCreativeImageAddToLightboxes","lightboxEntities","description","emptyCollectionsString","getLightboxEntitiesCollection","itemToAdd","onToggleSelection","_selectedCollection","createNewPlaceholderText","onCreateNewCollection","createCollectionPending","selectedLightboxId","creativeId","addCreativeItemsToLightbox","runApp","parent","signIn","catsEntityManager","preFlightSearchError","catalystRootBootstrapper","initializeUserProfile","createRootBoostrapper","executeSearchForPreFlightSearch","hostElement","appElement","activate","setupImageLoadingPerformanceCounters","startCatalyst"],"mappings":"aACA,SAAAA,EAAAC,GAQA,IAPA,IAMAC,EAAAC,EANAC,EAAAH,EAAA,GACAI,EAAAJ,EAAA,GACAK,EAAAL,EAAA,GAIAM,EAAA,EAAAC,KACQD,EAAAH,EAAAK,OAAoBF,IAC5BJ,EAAAC,EAAAG,GACAG,EAAAP,IACAK,EAAAG,KAAAD,EAAAP,GAAA,IAEAO,EAAAP,GAAA,EAEA,IAAAD,KAAAG,EACAO,OAAAC,UAAAC,eAAAC,KAAAV,EAAAH,KACAc,EAAAd,GAAAG,EAAAH,IAKA,IAFAe,KAAAhB,GAEAO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Ac2sD,QACtBl7B,MAAM7kC,IACLyQ,EAAO2C,eACPpJ,EAAsBuC,eAAegyB,MAAM,+BAAgC,KAAMv+B,MA8BvDyxE,CAAsBznE,GAK9Byf,KAAK,KACvB+nD,EA9BR,SAA+BxnE,GAC3B,MAAMmtB,EAAkB,IAAIq1C,GAAwBxiE,GAGpD,OAFAyG,EAAO+D,6BAA+B2iB,EAAgBY,0BACtDtnB,EAAOkE,gBAAkBwiB,EAAgBq3C,yBAClCr3C,EA0BwBu6C,CAAsB1nE,IACjDo6B,EAAyBotC,EAAyBG,kCAAkC9sC,MAAOtG,IACvFgzC,EAAuB1gB,GAAoBC,SAAStB,MAAMjxB,MAGvC9U,KAAK,KACxB,IAAKx7B,OAAA4jB,GAAA,EAAA5jB,CAAWsjF,GAAuB,CACnC,MAAMK,EAAchjD,SAASsB,eAAe,iBACtC2hD,EAAaL,EAAyBzoD,UAAUkO,IAClDE,gBAAiBq6C,EACjBzuE,cAAeuuE,EACf55C,2BAA2B,EAC3BpV,aAAcivD,IAElB1sD,EAAA,OAAgBgtD,EAAYD,GArC5C,SAA8C5nE,EAA+CC,GACpFjI,EAAA,UAAU8J,QAAQoB,kBAAqBlL,EAAA,UAAU8J,QAAQ2B,mCAGd,IAAI1D,EAAwCC,EAAuBC,GAC3E6nE,WAkC5BC,CAAqC/nE,EAAuBwnE,QDjDxEQ","file":"app.d41d8cd98f00b204e980.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tfunction webpackJsonpCallback(data) {\n \t\tvar chunkIds = data[0];\n \t\tvar moreModules = data[1];\n \t\tvar executeModules = data[2];\n\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(data);\n\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n\n \t\t// add entry modules from loaded chunk to deferred list\n \t\tdeferredModules.push.apply(deferredModules, executeModules || []);\n\n \t\t// run deferred modules when all chunks ready\n \t\treturn checkDeferredModules();\n \t};\n \tfunction checkDeferredModules() {\n \t\tvar result;\n \t\tfor(var i = 0; i < deferredModules.length; i++) {\n \t\t\tvar deferredModule = deferredModules[i];\n \t\t\tvar fulfilled = true;\n \t\t\tfor(var j = 1; j < deferredModule.length; j++) {\n \t\t\t\tvar depId = deferredModule[j];\n \t\t\t\tif(installedChunks[depId] !== 0) fulfilled = false;\n \t\t\t}\n \t\t\tif(fulfilled) {\n \t\t\t\tdeferredModules.splice(i--, 1);\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = deferredModule[0]);\n \t\t\t}\n \t\t}\n \t\treturn result;\n \t}\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// undefined = chunk not loaded, null = chunk preloaded/prefetched\n \t// Promise = chunk loading, 0 = chunk loaded\n \tvar installedChunks = {\n \t\t1: 0\n \t};\n\n \tvar deferredModules = [];\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n \tvar jsonpArray = window[\"webpackJsonp\"] = window[\"webpackJsonp\"] || [];\n \tvar oldJsonpFunction = jsonpArray.push.bind(jsonpArray);\n \tjsonpArray.push = webpackJsonpCallback;\n \tjsonpArray = jsonpArray.slice();\n \tfor(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);\n \tvar parentJsonpFunction = oldJsonpFunction;\n\n\n \t// add entry module to deferred list\n \tdeferredModules.push([\"XbWe\",0]);\n \t// run deferred modules when ready\n \treturn checkDeferredModules();\n","module.exports = externalAppConfig;","var map = {\n\t\"./af\": \"pMzc\",\n\t\"./af.js\": \"pMzc\",\n\t\"./ar\": \"QNu8\",\n\t\"./ar-dz\": \"udw0\",\n\t\"./ar-dz.js\": \"udw0\",\n\t\"./ar-kw\": \"7XL0\",\n\t\"./ar-kw.js\": \"7XL0\",\n\t\"./ar-ly\": \"JsFR\",\n\t\"./ar-ly.js\": \"JsFR\",\n\t\"./ar-ma\": \"KSq3\",\n\t\"./ar-ma.js\": \"KSq3\",\n\t\"./ar-sa\": \"GczS\",\n\t\"./ar-sa.js\": \"GczS\",\n\t\"./ar-tn\": \"hJcq\",\n\t\"./ar-tn.js\": \"hJcq\",\n\t\"./ar.js\": \"QNu8\",\n\t\"./az\": \"woFP\",\n\t\"./az.js\": \"woFP\",\n\t\"./be\": \"lMwq\",\n\t\"./be.js\": \"lMwq\",\n\t\"./bg\": \"a7TX\",\n\t\"./bg.js\": \"a7TX\",\n\t\"./bn\": \"s0Vc\",\n\t\"./bn.js\": \"s0Vc\",\n\t\"./bo\": \"kOtj\",\n\t\"./bo.js\": \"kOtj\",\n\t\"./br\": \"jYCi\",\n\t\"./br.js\": \"jYCi\",\n\t\"./bs\": \"fVS8\",\n\t\"./bs.js\": \"fVS8\",\n\t\"./ca\": \"dyul\",\n\t\"./ca.js\": \"dyul\",\n\t\"./cs\": \"eyGg\",\n\t\"./cs.js\": \"eyGg\",\n\t\"./cv\": \"d0pk\",\n\t\"./cv.js\": \"d0pk\",\n\t\"./cy\": \"nHxI\",\n\t\"./cy.js\": \"nHxI\",\n\t\"./da\": \"hW45\",\n\t\"./da.js\": \"hW45\",\n\t\"./de\": \"6ZWu\",\n\t\"./de-at\": \"GoB/\",\n\t\"./de-at.js\": \"GoB/\",\n\t\"./de-ch\": \"A99U\",\n\t\"./de-ch.js\": \"A99U\",\n\t\"./de.js\": \"6ZWu\",\n\t\"./dv\": \"DRbm\",\n\t\"./dv.js\": \"DRbm\",\n\t\"./el\": \"EBBC\",\n\t\"./el.js\": \"EBBC\",\n\t\"./en-au\": \"rwjV\",\n\t\"./en-au.js\": \"rwjV\",\n\t\"./en-ca\": \"q9EJ\",\n\t\"./en-ca.js\": \"q9EJ\",\n\t\"./en-gb\": \"2Z/F\",\n\t\"./en-gb.js\": \"2Z/F\",\n\t\"./en-ie\": \"e5L+\",\n\t\"./en-ie.js\": \"e5L+\",\n\t\"./en-nz\": \"17ga\",\n\t\"./en-nz.js\": \"17ga\",\n\t\"./eo\": \"JQ0V\",\n\t\"./eo.js\": \"JQ0V\",\n\t\"./es\": \"4gIE\",\n\t\"./es-do\": \"DeY7\",\n\t\"./es-do.js\": \"DeY7\",\n\t\"./es.js\": \"4gIE\",\n\t\"./et\": \"MGkv\",\n\t\"./et.js\": \"MGkv\",\n\t\"./eu\": \"TzEi\",\n\t\"./eu.js\": \"TzEi\",\n\t\"./fa\": \"7Tug\",\n\t\"./fa.js\": \"7Tug\",\n\t\"./fi\": \"hc3U\",\n\t\"./fi.js\": \"hc3U\",\n\t\"./fo\": \"bkrA\",\n\t\"./fo.js\": \"bkrA\",\n\t\"./fr\": \"wR63\",\n\t\"./fr-ca\": \"P2UQ\",\n\t\"./fr-ca.js\": \"P2UQ\",\n\t\"./fr-ch\": \"wAZA\",\n\t\"./fr-ch.js\": \"wAZA\",\n\t\"./fr.js\": \"wR63\",\n\t\"./fy\": \"KVMG\",\n\t\"./fy.js\": \"KVMG\",\n\t\"./gd\": \"+u3p\",\n\t\"./gd.js\": \"+u3p\",\n\t\"./gl\": \"0/5f\",\n\t\"./gl.js\": \"0/5f\",\n\t\"./gom-latn\": \"lPZ/\",\n\t\"./gom-latn.js\": \"lPZ/\",\n\t\"./he\": \"lOgm\",\n\t\"./he.js\": \"lOgm\",\n\t\"./hi\": \"ErQK\",\n\t\"./hi.js\": \"ErQK\",\n\t\"./hr\": \"hIZT\",\n\t\"./hr.js\": \"hIZT\",\n\t\"./hu\": \"09O+\",\n\t\"./hu.js\": \"09O+\",\n\t\"./hy-am\": \"S7Al\",\n\t\"./hy-am.js\": \"S7Al\",\n\t\"./id\": \"Wure\",\n\t\"./id.js\": \"Wure\",\n\t\"./is\": \"8hq0\",\n\t\"./is.js\": \"8hq0\",\n\t\"./it\": \"TAsv\",\n\t\"./it.js\": \"TAsv\",\n\t\"./ja\": \"qyF/\",\n\t\"./ja.js\": \"qyF/\",\n\t\"./jv\": \"1x3Y\",\n\t\"./jv.js\": \"1x3Y\",\n\t\"./ka\": \"y14+\",\n\t\"./ka.js\": \"y14+\",\n\t\"./kk\": \"wG6m\",\n\t\"./kk.js\": \"wG6m\",\n\t\"./km\": \"rLWO\",\n\t\"./km.js\": \"rLWO\",\n\t\"./kn\": \"FA6o\",\n\t\"./kn.js\": \"FA6o\",\n\t\"./ko\": \"iVoX\",\n\t\"./ko.js\": \"iVoX\",\n\t\"./ky\": \"QkOA\",\n\t\"./ky.js\": \"QkOA\",\n\t\"./lb\": \"uZWb\",\n\t\"./lb.js\": \"uZWb\",\n\t\"./lo\": \"17Ql\",\n\t\"./lo.js\": \"17Ql\",\n\t\"./lt\": \"xH1F\",\n\t\"./lt.js\": \"xH1F\",\n\t\"./lv\": \"y93J\",\n\t\"./lv.js\": \"y93J\",\n\t\"./me\": \"jfUE\",\n\t\"./me.js\": \"jfUE\",\n\t\"./mi\": \"Lzka\",\n\t\"./mi.js\": \"Lzka\",\n\t\"./mk\": \"tHAc\",\n\t\"./mk.js\": \"tHAc\",\n\t\"./ml\": \"doyN\",\n\t\"./ml.js\": \"doyN\",\n\t\"./mr\": \"avmT\",\n\t\"./mr.js\": \"avmT\",\n\t\"./ms\": \"G6ui\",\n\t\"./ms-my\": \"TgJH\",\n\t\"./ms-my.js\": \"TgJH\",\n\t\"./ms.js\": \"G6ui\",\n\t\"./my\": \"1rq0\",\n\t\"./my.js\": \"1rq0\",\n\t\"./nb\": \"pI2O\",\n\t\"./nb.js\": \"pI2O\",\n\t\"./ne\": \"wmCx\",\n\t\"./ne.js\": \"wmCx\",\n\t\"./nl\": \"xeK/\",\n\t\"./nl-be\": \"NGJE\",\n\t\"./nl-be.js\": \"NGJE\",\n\t\"./nl.js\": \"xeK/\",\n\t\"./nn\": \"8/EW\",\n\t\"./nn.js\": \"8/EW\",\n\t\"./pa-in\": \"cu4G\",\n\t\"./pa-in.js\": \"cu4G\",\n\t\"./pl\": \"s+TZ\",\n\t\"./pl.js\": \"s+TZ\",\n\t\"./pt\": \"q8E0\",\n\t\"./pt-br\": \"wm21\",\n\t\"./pt-br.js\": \"wm21\",\n\t\"./pt.js\": \"q8E0\",\n\t\"./ro\": \"50ga\",\n\t\"./ro.js\": \"50ga\",\n\t\"./ru\": \"bv4G\",\n\t\"./ru.js\": \"bv4G\",\n\t\"./sd\": \"nMSH\",\n\t\"./sd.js\": \"nMSH\",\n\t\"./se\": \"LzPN\",\n\t\"./se.js\": \"LzPN\",\n\t\"./si\": \"HLhA\",\n\t\"./si.js\": \"HLhA\",\n\t\"./sk\": \"qetz\",\n\t\"./sk.js\": \"qetz\",\n\t\"./sl\": \"qltd\",\n\t\"./sl.js\": \"qltd\",\n\t\"./sq\": \"tlUu\",\n\t\"./sq.js\": \"tlUu\",\n\t\"./sr\": \"j9xn\",\n\t\"./sr-cyrl\": \"MXSU\",\n\t\"./sr-cyrl.js\": \"MXSU\",\n\t\"./sr.js\": \"j9xn\",\n\t\"./ss\": \"q4r6\",\n\t\"./ss.js\": \"q4r6\",\n\t\"./sv\": \"4Gu6\",\n\t\"./sv.js\": \"4Gu6\",\n\t\"./sw\": \"ZQzV\",\n\t\"./sw.js\": \"ZQzV\",\n\t\"./ta\": \"Aw73\",\n\t\"./ta.js\": \"Aw73\",\n\t\"./te\": \"5Ws9\",\n\t\"./te.js\": \"5Ws9\",\n\t\"./tet\": \"UIft\",\n\t\"./tet.js\": \"UIft\",\n\t\"./th\": \"gJaR\",\n\t\"./th.js\": \"gJaR\",\n\t\"./tl-ph\": \"1QqM\",\n\t\"./tl-ph.js\": \"1QqM\",\n\t\"./tlh\": \"gEJ7\",\n\t\"./tlh.js\": \"gEJ7\",\n\t\"./tr\": \"dFXB\",\n\t\"./tr.js\": \"dFXB\",\n\t\"./tzl\": \"o0R+\",\n\t\"./tzl.js\": \"o0R+\",\n\t\"./tzm\": \"/jnZ\",\n\t\"./tzm-latn\": \"GFDM\",\n\t\"./tzm-latn.js\": \"GFDM\",\n\t\"./tzm.js\": \"/jnZ\",\n\t\"./uk\": \"/xb+\",\n\t\"./uk.js\": \"/xb+\",\n\t\"./ur\": \"iDvc\",\n\t\"./ur.js\": \"iDvc\",\n\t\"./uz\": \"Q0ha\",\n\t\"./uz-latn\": \"4xrH\",\n\t\"./uz-latn.js\": \"4xrH\",\n\t\"./uz.js\": \"Q0ha\",\n\t\"./vi\": \"onSw\",\n\t\"./vi.js\": \"onSw\",\n\t\"./x-pseudo\": \"eUmU\",\n\t\"./x-pseudo.js\": \"eUmU\",\n\t\"./yo\": \"8Br9\",\n\t\"./yo.js\": \"8Br9\",\n\t\"./zh-cn\": \"he5a\",\n\t\"./zh-cn.js\": \"he5a\",\n\t\"./zh-hk\": \"wQrp\",\n\t\"./zh-hk.js\": \"wQrp\",\n\t\"./zh-tw\": \"RJQ3\",\n\t\"./zh-tw.js\": \"RJQ3\"\n};\n\n\nfunction webpackContext(req) {\n\tvar id = webpackContextResolve(req);\n\treturn __webpack_require__(id);\n}\nfunction webpackContextResolve(req) {\n\tif(!__webpack_require__.o(map, req)) {\n\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\treturn map[req];\n}\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = \"26DC\";","var map = {\n\t\"./af\": \"K/tc\",\n\t\"./af.js\": \"K/tc\",\n\t\"./ar\": \"jnO4\",\n\t\"./ar-dz\": \"o1bE\",\n\t\"./ar-dz.js\": \"o1bE\",\n\t\"./ar-kw\": \"Qj4J\",\n\t\"./ar-kw.js\": \"Qj4J\",\n\t\"./ar-ly\": \"HP3h\",\n\t\"./ar-ly.js\": \"HP3h\",\n\t\"./ar-ma\": \"CoRJ\",\n\t\"./ar-ma.js\": \"CoRJ\",\n\t\"./ar-sa\": \"gjCT\",\n\t\"./ar-sa.js\": \"gjCT\",\n\t\"./ar-tn\": \"bYM6\",\n\t\"./ar-tn.js\": \"bYM6\",\n\t\"./ar.js\": \"jnO4\",\n\t\"./az\": \"SFxW\",\n\t\"./az.js\": \"SFxW\",\n\t\"./be\": \"H8ED\",\n\t\"./be.js\": \"H8ED\",\n\t\"./bg\": \"hKrs\",\n\t\"./bg.js\": \"hKrs\",\n\t\"./bm\": \"p/rL\",\n\t\"./bm.js\": \"p/rL\",\n\t\"./bn\": \"kEOa\",\n\t\"./bn.js\": \"kEOa\",\n\t\"./bo\": \"0mo+\",\n\t\"./bo.js\": \"0mo+\",\n\t\"./br\": \"aIdf\",\n\t\"./br.js\": \"aIdf\",\n\t\"./bs\": \"JVSJ\",\n\t\"./bs.js\": \"JVSJ\",\n\t\"./ca\": \"1xZ4\",\n\t\"./ca.js\": \"1xZ4\",\n\t\"./cs\": \"PA2r\",\n\t\"./cs.js\": \"PA2r\",\n\t\"./cv\": \"A+xa\",\n\t\"./cv.js\": \"A+xa\",\n\t\"./cy\": \"l5ep\",\n\t\"./cy.js\": \"l5ep\",\n\t\"./da\": \"DxQv\",\n\t\"./da.js\": \"DxQv\",\n\t\"./de\": \"tGlX\",\n\t\"./de-at\": \"s+uk\",\n\t\"./de-at.js\": \"s+uk\",\n\t\"./de-ch\": \"u3GI\",\n\t\"./de-ch.js\": \"u3GI\",\n\t\"./de.js\": \"tGlX\",\n\t\"./dv\": \"WYrj\",\n\t\"./dv.js\": \"WYrj\",\n\t\"./el\": \"jUeY\",\n\t\"./el.js\": \"jUeY\",\n\t\"./en-SG\": \"zavE\",\n\t\"./en-SG.js\": \"zavE\",\n\t\"./en-au\": \"Dmvi\",\n\t\"./en-au.js\": \"Dmvi\",\n\t\"./en-ca\": \"OIYi\",\n\t\"./en-ca.js\": \"OIYi\",\n\t\"./en-gb\": \"Oaa7\",\n\t\"./en-gb.js\": \"Oaa7\",\n\t\"./en-ie\": \"4dOw\",\n\t\"./en-ie.js\": \"4dOw\",\n\t\"./en-il\": \"czMo\",\n\t\"./en-il.js\": \"czMo\",\n\t\"./en-nz\": \"b1Dy\",\n\t\"./en-nz.js\": \"b1Dy\",\n\t\"./eo\": \"Zduo\",\n\t\"./eo.js\": \"Zduo\",\n\t\"./es\": \"iYuL\",\n\t\"./es-do\": \"CjzT\",\n\t\"./es-do.js\": \"CjzT\",\n\t\"./es-us\": \"Vclq\",\n\t\"./es-us.js\": \"Vclq\",\n\t\"./es.js\": \"iYuL\",\n\t\"./et\": \"7BjC\",\n\t\"./et.js\": \"7BjC\",\n\t\"./eu\": \"D/JM\",\n\t\"./eu.js\": \"D/JM\",\n\t\"./fa\": \"jfSC\",\n\t\"./fa.js\": \"jfSC\",\n\t\"./fi\": \"gekB\",\n\t\"./fi.js\": \"gekB\",\n\t\"./fo\": \"ByF4\",\n\t\"./fo.js\": \"ByF4\",\n\t\"./fr\": \"nyYc\",\n\t\"./fr-ca\": \"2fjn\",\n\t\"./fr-ca.js\": \"2fjn\",\n\t\"./fr-ch\": \"Dkky\",\n\t\"./fr-ch.js\": \"Dkky\",\n\t\"./fr.js\": \"nyYc\",\n\t\"./fy\": \"cRix\",\n\t\"./fy.js\": \"cRix\",\n\t\"./ga\": \"USCx\",\n\t\"./ga.js\": \"USCx\",\n\t\"./gd\": \"9rRi\",\n\t\"./gd.js\": \"9rRi\",\n\t\"./gl\": \"iEDd\",\n\t\"./gl.js\": \"iEDd\",\n\t\"./gom-latn\": \"DKr+\",\n\t\"./gom-latn.js\": \"DKr+\",\n\t\"./gu\": \"4MV3\",\n\t\"./gu.js\": \"4MV3\",\n\t\"./he\": \"x6pH\",\n\t\"./he.js\": \"x6pH\",\n\t\"./hi\": \"3E1r\",\n\t\"./hi.js\": \"3E1r\",\n\t\"./hr\": \"S6ln\",\n\t\"./hr.js\": \"S6ln\",\n\t\"./hu\": \"WxRl\",\n\t\"./hu.js\": \"WxRl\",\n\t\"./hy-am\": \"1rYy\",\n\t\"./hy-am.js\": \"1rYy\",\n\t\"./id\": \"UDhR\",\n\t\"./id.js\": \"UDhR\",\n\t\"./is\": \"BVg3\",\n\t\"./is.js\": \"BVg3\",\n\t\"./it\": \"bpih\",\n\t\"./it-ch\": \"bxKX\",\n\t\"./it-ch.js\": \"bxKX\",\n\t\"./it.js\": \"bpih\",\n\t\"./ja\": \"B55N\",\n\t\"./ja.js\": \"B55N\",\n\t\"./jv\": \"tUCv\",\n\t\"./jv.js\": \"tUCv\",\n\t\"./ka\": \"IBtZ\",\n\t\"./ka.js\": \"IBtZ\",\n\t\"./kk\": \"bXm7\",\n\t\"./kk.js\": \"bXm7\",\n\t\"./km\": \"6B0Y\",\n\t\"./km.js\": \"6B0Y\",\n\t\"./kn\": \"PpIw\",\n\t\"./kn.js\": \"PpIw\",\n\t\"./ko\": \"Ivi+\",\n\t\"./ko.js\": \"Ivi+\",\n\t\"./ku\": \"JCF/\",\n\t\"./ku.js\": \"JCF/\",\n\t\"./ky\": \"lgnt\",\n\t\"./ky.js\": \"lgnt\",\n\t\"./lb\": \"RAwQ\",\n\t\"./lb.js\": \"RAwQ\",\n\t\"./lo\": \"sp3z\",\n\t\"./lo.js\": \"sp3z\",\n\t\"./lt\": \"JvlW\",\n\t\"./lt.js\": \"JvlW\",\n\t\"./lv\": \"uXwI\",\n\t\"./lv.js\": \"uXwI\",\n\t\"./me\": \"KTz0\",\n\t\"./me.js\": \"KTz0\",\n\t\"./mi\": \"aIsn\",\n\t\"./mi.js\": \"aIsn\",\n\t\"./mk\": \"aQkU\",\n\t\"./mk.js\": \"aQkU\",\n\t\"./ml\": \"AvvY\",\n\t\"./ml.js\": \"AvvY\",\n\t\"./mn\": \"lYtQ\",\n\t\"./mn.js\": \"lYtQ\",\n\t\"./mr\": \"Ob0Z\",\n\t\"./mr.js\": \"Ob0Z\",\n\t\"./ms\": \"6+QB\",\n\t\"./ms-my\": \"ZAMP\",\n\t\"./ms-my.js\": \"ZAMP\",\n\t\"./ms.js\": \"6+QB\",\n\t\"./mt\": \"G0Uy\",\n\t\"./mt.js\": \"G0Uy\",\n\t\"./my\": \"honF\",\n\t\"./my.js\": \"honF\",\n\t\"./nb\": \"bOMt\",\n\t\"./nb.js\": \"bOMt\",\n\t\"./ne\": \"OjkT\",\n\t\"./ne.js\": \"OjkT\",\n\t\"./nl\": \"+s0g\",\n\t\"./nl-be\": \"2ykv\",\n\t\"./nl-be.js\": \"2ykv\",\n\t\"./nl.js\": \"+s0g\",\n\t\"./nn\": \"uEye\",\n\t\"./nn.js\": \"uEye\",\n\t\"./pa-in\": \"8/+R\",\n\t\"./pa-in.js\": \"8/+R\",\n\t\"./pl\": \"jVdC\",\n\t\"./pl.js\": \"jVdC\",\n\t\"./pt\": \"8mBD\",\n\t\"./pt-br\": \"0tRk\",\n\t\"./pt-br.js\": \"0tRk\",\n\t\"./pt.js\": \"8mBD\",\n\t\"./ro\": \"lyxo\",\n\t\"./ro.js\": \"lyxo\",\n\t\"./ru\": \"lXzo\",\n\t\"./ru.js\": \"lXzo\",\n\t\"./sd\": \"Z4QM\",\n\t\"./sd.js\": \"Z4QM\",\n\t\"./se\": \"//9w\",\n\t\"./se.js\": \"//9w\",\n\t\"./si\": \"7aV9\",\n\t\"./si.js\": \"7aV9\",\n\t\"./sk\": \"e+ae\",\n\t\"./sk.js\": \"e+ae\",\n\t\"./sl\": \"gVVK\",\n\t\"./sl.js\": \"gVVK\",\n\t\"./sq\": \"yPMs\",\n\t\"./sq.js\": \"yPMs\",\n\t\"./sr\": \"zx6S\",\n\t\"./sr-cyrl\": \"E+lV\",\n\t\"./sr-cyrl.js\": \"E+lV\",\n\t\"./sr.js\": \"zx6S\",\n\t\"./ss\": \"Ur1D\",\n\t\"./ss.js\": \"Ur1D\",\n\t\"./sv\": \"X709\",\n\t\"./sv.js\": \"X709\",\n\t\"./sw\": \"dNwA\",\n\t\"./sw.js\": \"dNwA\",\n\t\"./ta\": \"PeUW\",\n\t\"./ta.js\": \"PeUW\",\n\t\"./te\": \"XLvN\",\n\t\"./te.js\": \"XLvN\",\n\t\"./tet\": \"V2x9\",\n\t\"./tet.js\": \"V2x9\",\n\t\"./tg\": \"Oxv6\",\n\t\"./tg.js\": \"Oxv6\",\n\t\"./th\": \"EOgW\",\n\t\"./th.js\": \"EOgW\",\n\t\"./tl-ph\": \"Dzi0\",\n\t\"./tl-ph.js\": \"Dzi0\",\n\t\"./tlh\": \"z3Vd\",\n\t\"./tlh.js\": \"z3Vd\",\n\t\"./tr\": \"DoHr\",\n\t\"./tr.js\": \"DoHr\",\n\t\"./tzl\": \"z1FC\",\n\t\"./tzl.js\": \"z1FC\",\n\t\"./tzm\": \"wQk9\",\n\t\"./tzm-latn\": \"tT3J\",\n\t\"./tzm-latn.js\": \"tT3J\",\n\t\"./tzm.js\": \"wQk9\",\n\t\"./ug-cn\": \"YRex\",\n\t\"./ug-cn.js\": \"YRex\",\n\t\"./uk\": \"raLr\",\n\t\"./uk.js\": \"raLr\",\n\t\"./ur\": \"UpQW\",\n\t\"./ur.js\": \"UpQW\",\n\t\"./uz\": \"Loxo\",\n\t\"./uz-latn\": \"AQ68\",\n\t\"./uz-latn.js\": \"AQ68\",\n\t\"./uz.js\": \"Loxo\",\n\t\"./vi\": \"KSF8\",\n\t\"./vi.js\": \"KSF8\",\n\t\"./x-pseudo\": \"/X5v\",\n\t\"./x-pseudo.js\": \"/X5v\",\n\t\"./yo\": \"fzPg\",\n\t\"./yo.js\": \"fzPg\",\n\t\"./zh-cn\": \"XDpg\",\n\t\"./zh-cn.js\": \"XDpg\",\n\t\"./zh-hk\": \"SatO\",\n\t\"./zh-hk.js\": \"SatO\",\n\t\"./zh-tw\": \"kOpN\",\n\t\"./zh-tw.js\": \"kOpN\"\n};\n\n\nfunction webpackContext(req) {\n\tvar id = webpackContextResolve(req);\n\treturn __webpack_require__(id);\n}\nfunction webpackContextResolve(req) {\n\tif(!__webpack_require__.o(map, req)) {\n\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\treturn map[req];\n}\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = \"RnhZ\";","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { appConfig } from \"appConfig\";\r\n\r\nimport { AdalAuthenticationManager } from \"cms-ui-presentationlogic/authentication/adaljs/AdalAuthenticationManager\";\r\n\r\nif (!window[\"AuthenticationContext\"]) {\r\n    // tslint:disable-next-line\r\n    window[\"AuthenticationContext\"] = require(\"adal-angular\");\r\n}\r\n\r\nexport const authenticationManager = new AdalAuthenticationManager(new AuthenticationContext(appConfig.adal));\r\nauthenticationManager.handleAuthenticationResponse();","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { BusinessLogicFactory } from \"cms-businesslogic/factory/BusinessLogicFactory\";\r\nimport { IEntityManager } from \"cms-businesslogic/entity/IEntityManager\";\r\nimport { ISearchManager } from \"cms-businesslogic/search/ISearchManager\";\r\n\r\nimport { ProseBusinessLogicFactory } from \"cms-businesslogic-extensions/factory/ProseBusinessLogicFactory\";\r\n\r\nimport { IAdalAxiosAuthenticationWrapperContext } from \"cms-infrastructure/authentication/IAdalAxiosAuthenticationWrapperContext\";\r\n\r\n/**\r\n * Factory for setting up a business logic factory instance with agent token auth.\r\n * @class\r\n */\r\nexport class EntityFactory {\r\n\r\n    /**\r\n     * BusinessLogicFactory used to create service clients.\r\n     * @type {BusinessLogicFactory}\r\n     */\r\n    private _businessLogicFactory: BusinessLogicFactory;\r\n\r\n    /**\r\n     * Initializes a new BusinessLogicFactory with the given tenantId and proseDomain.\r\n     * @constructor\r\n     * @param {string} tenantId The CMS tenant id.\r\n     * @param {string} proseDomain The PROSE services endpoint.\r\n     * @param {IAdalAxiosAuthenticationWrapperContext} authenticationContext An authentication context to provide authentication tokens.\r\n     */\r\n    constructor(tenantId: string, proseDomain: string, authenticationContext: IAdalAxiosAuthenticationWrapperContext) {\r\n\r\n        this._businessLogicFactory = ProseBusinessLogicFactory.fromTenantIdAndProseDomain(tenantId, proseDomain);\r\n\r\n        this._businessLogicFactory.serviceClientFactory.setAuthenticationToAdal(authenticationContext);\r\n    }\r\n\r\n    /**\r\n     * Provides access to an instance of BusinessLogicFactory.\r\n     * @type {BusinessLogicFactory}\r\n     */\r\n    get businessLogicFactory(): BusinessLogicFactory {\r\n        return this._businessLogicFactory;\r\n    }\r\n\r\n    /**\r\n     * Provides access to an instance of IEntityManager.\r\n     * @type {IEntityManager}\r\n     */\r\n    get entityManager(): IEntityManager {\r\n        return this._businessLogicFactory.getManagersFactory().getEntityManager();\r\n    }\r\n\r\n    /**\r\n     * Provides access to an instance of ISearchManager.\r\n     * @type {ISearchManager}\r\n     */\r\n    get searchManager(): ISearchManager {\r\n        return this._businessLogicFactory.getManagersFactory().getSearchManager();\r\n    }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { AnnotatedEntityCollectionChangeChecker } from \"cms-businesslogic/annotatedCollection/AnnotatedEntityCollectionChangeChecker\";\r\nimport { AnnotatedEntityCollectionInspector } from \"cms-businesslogic/inspectors/AnnotatedEntityCollectionInspector\";\r\nimport { EntityChangeMonitor } from \"cms-businesslogic/entityChangeMonitor/EntityChangeMonitor\";\r\nimport { EntityFactory } from \"../EntityFactory\";\r\nimport { EntityInspector } from \"cms-businesslogic/inspectors/EntityInspector\";\r\nimport { IUserProfileManager } from \"cms-businesslogic/userProfile/IUserProfileManager\";\r\nimport { IUserProfileSettingManager } from \"cms-businesslogic/userProfile/IUserProfileSettingManager\";\r\nimport { LocalStorageUserProfileManager } from \"cms-businesslogic/userProfile/LocalStorageUserProfileManager\";\r\nimport { ProseBusinessLogicFactory } from \"cms-businesslogic-extensions/factory/ProseBusinessLogicFactory\";\r\nimport { appConfig } from \"appConfig\";\r\nimport { authenticationManager } from \"./authentication\";\r\n\r\n// instantiate entity factories\r\nconst catsEntityFactory = new EntityFactory(appConfig.catsTenantName, appConfig.proseEndpoint, authenticationManager);\r\nconst ampEntityFactory = new EntityFactory(appConfig.ampTenantName, appConfig.proseEndpoint, authenticationManager);\r\n\r\n// instantiate user profile managers\r\nconst localStorageUserProfileManager: IUserProfileManager<any> =\r\n    new LocalStorageUserProfileManager(window.localStorage, catsEntityFactory.businessLogicFactory.instrumentationService);\r\n\r\nconst proseBusinessLogicFactory = new ProseBusinessLogicFactory(catsEntityFactory.businessLogicFactory.serviceClientFactory, catsEntityFactory.businessLogicFactory.instrumentationService);\r\nconst managersFactory = proseBusinessLogicFactory.getManagersFactory();\r\nconst proseUserProfileSettingManager: IUserProfileSettingManager = managersFactory.getProseUserProfileSettingManager(\r\n    appConfig.catsTenantName,\r\n    appConfig.catsTenantDocumentId,\r\n    undefined,\r\n    appConfig.userProfileRefreshInterval);\r\n\r\nconst entityInspector = new EntityInspector();\r\nconst annotatedEntityCollectionInspector = new AnnotatedEntityCollectionInspector();\r\n\r\nconst proseCompoundEntityOperationsManager = managersFactory.getProseCompoundEntityOperationsManager(authenticationManager.userData.userName);\r\n\r\nconst collectionChangeMonitor = new EntityChangeMonitor(\r\n    catsEntityFactory.businessLogicFactory.getManagersFactory().getEntityManager(),\r\n    catsEntityFactory.businessLogicFactory.instrumentationService,\r\n    new AnnotatedEntityCollectionChangeChecker(),\r\n    null /* batching manager */,\r\n    window /* ITimerInterval */,\r\n    appConfig.lightBoxRefreshInterval /* refreshInterval */);\r\nconst annotatedEntityCollectionManager = catsEntityFactory.businessLogicFactory.getManagersFactory().getAnnotatedEntityCollectionManager(collectionChangeMonitor);\r\n\r\nexport const ccsdk = {\r\n    entityFactories: {\r\n        cats: catsEntityFactory,\r\n        amp: ampEntityFactory\r\n    },\r\n    inspectors: {\r\n        entity: entityInspector,\r\n        annotatedEntityCollection: annotatedEntityCollectionInspector\r\n    },\r\n    userProfileManagers: {\r\n        local: localStorageUserProfileManager,\r\n        prose: proseUserProfileSettingManager\r\n    },\r\n    proseCompoundEntityOperationsManager,\r\n    annotatedEntityCollectionManager\r\n};","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { ActionMap } from \"cms-ui-redux/ActionMap\";\r\nimport { NamespacePrefixActionsDefinitionBase } from \"cms-ui-redux/NamespacePrefixActionsDefinitionBase\";\r\n\r\nexport type SaveScrollPositionSignature = (scrollTop: number) => void;\r\n\r\n/**\r\n * Redux actions that trigger the saving of the scroller position for the results browser component.\r\n * @class\r\n */\r\nexport class SearchResultsScrollPositionActions extends NamespacePrefixActionsDefinitionBase {\r\n\r\n    /**\r\n     * Defines the action indicating that the scroll position is being saved.\r\n     */\r\n    private saveScrollPositionSignature: ActionMap<SaveScrollPositionSignature> = new ActionMap<SaveScrollPositionSignature>(this.namespace + \"SaveScrollPosition\");\r\n\r\n    /**\r\n     * Initializes a new instance of the 'SearchResultsScrollPositionActions' class.\r\n     * @constructor\r\n     * @param namespacePrefix {string} Optional prefix to add to the namespace used to distinguish between different instances of this data flow.\r\n     */\r\n    constructor(namespacePrefix?: string) {\r\n        super(\"SearchResultsScrollPosition\", namespacePrefix);\r\n    }\r\n\r\n    /** Accessor for the save scroll position action.\r\n     * @type {ActionMap<SaveScrollPositionSignature>}\r\n     */\r\n    public get SaveScrollPosition(): ActionMap<SaveScrollPositionSignature> {\r\n        return this.saveScrollPositionSignature;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { ApplicationErrorActions } from \"cms-ui-presentationlogic/dataflows/applicationError/ApplicationErrorActions\";\r\nimport { ImageLoadingPerfCountersActions } from \"../presentation-logic/dataflows/performanceCounters/ImageLoadingPerfCountersActions\";\r\nimport { SearchResultsScrollPositionActions } from \"../presentation-logic/dataflows/searchResultsScrollPosition/SearchResultsScrollPositionActions\";\r\n\r\n// Set of Redux actions that drive the Catalyst app.\r\n// PS: this is not the complete set of actions, it's more an attempt at finding an alternate approach at providing reducers and other code\r\n// modules the set of actions they need. (as opposed to inject them in constructors).\r\n\r\nexport const Actions = {\r\n    ApplicationLevelError: new ApplicationErrorActions(),\r\n    SearchAndSelect: {\r\n        InlineError: new ApplicationErrorActions(\"SearchAndSelect\"),\r\n        SearchResultsScrollPositionActions: new SearchResultsScrollPositionActions(\"SearchAndSelect\")\r\n    },\r\n    Creative: {\r\n        SearchResultsScrollPositionActions: new SearchResultsScrollPositionActions(\"Creative\")\r\n    },\r\n    Telemetry: {\r\n        Editorial: {\r\n            ComputeImageLoadingPerfCounters: new ImageLoadingPerfCountersActions(\"Editorial\")\r\n        }\r\n    }\r\n};","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { ActionMap } from \"cms-ui-redux/ActionMap\";\r\nimport { NamespacePrefixActionsDefinitionBase } from \"cms-ui-redux/NamespacePrefixActionsDefinitionBase\";\r\n\r\nexport type SetImageLoadingPerfCountersSignature = (loadedImagesBatchResourceTimings: PerformanceResourceTiming[]) => void;\r\nexport type ClearImageLoadingPerfCountersSignature = () => void;\r\n\r\n/**\r\n * The set of actions that manage the part of state that deals with image loading telemetry.\r\n * @class\r\n */\r\nexport class ImageLoadingPerfCountersActions extends NamespacePrefixActionsDefinitionBase {\r\n    private setImageLoadingPerfCounters: ActionMap<SetImageLoadingPerfCountersSignature> = new ActionMap<SetImageLoadingPerfCountersSignature>(this.namespace + \"SetImageLoadingPerfCounters\");\r\n    private clearImageLoadingPerfCounters: ActionMap<ClearImageLoadingPerfCountersSignature> = new ActionMap<ClearImageLoadingPerfCountersSignature>(this.namespace + \"ClearImageLoadingPerfCounters\");\r\n\r\n    constructor(namespacePrefix: string = \"\") {\r\n        super(\"ImageLoadingPerfCountersActions\", namespacePrefix);\r\n    }\r\n\r\n    public get SetImageLoadingPerfCounters(): ActionMap<SetImageLoadingPerfCountersSignature> {\r\n        return this.setImageLoadingPerfCounters;\r\n    }\r\n\r\n    public get ClearImageLoadingPerfCounters(): ActionMap<ClearImageLoadingPerfCountersSignature> {\r\n        return this.clearImageLoadingPerfCounters;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\n/**\r\n * An enumeration that describes the types of resources the browser collects data for.\r\n * See: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry/entryType\r\n * @enum\r\n */\r\nexport enum IPerformanceEntryTypes {\r\n    PerformanceMark = \"mark\",\r\n\r\n    PerformanceMeasure = \"measure\",\r\n\r\n    PerformanceFrameTiming = \"frame\",\r\n\r\n    PerformanceNavigationTiming = \"navigation\",\r\n\r\n    PerformanceResourceTiming = \"resource\",\r\n\r\n    PerformancePaintTiming = \"paint\"\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\n/**\r\n * Basic wrapper that enables applications to record performance resources loading timings built on top of the native browser Performance Api.\r\n * This implementation relies on the existence of the `PerformanceObserver` object\r\n * (https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver)\r\n * @class AppPerformanceObserver\r\n */\r\nexport abstract class AppPerformanceObserver {\r\n\r\n    // a constant to store the name of a property we use in the global scope to store an instance of the `PerformanceObserver`.\r\n    // more details on the why below, where the instance is actually created.\r\n    private static StickyPerformanceApiPropertyName: string = \"perfomance-api-performance-observer-workaround\";\r\n\r\n    /**\r\n     * Creates an instance of AppPerformanceObserver.\r\n     * @param {number} bufferSize - The maximum size of the performance buffer. Defaults to 500.\r\n     */\r\n    constructor(private bufferSize: number = 500) {\r\n    }\r\n\r\n    /**\r\n     * This function verifies that the browser this code is running has the required APIs implemented.\r\n     * Future iterations could eventually provide support when some of those are missing, but currently the required features are:\r\n     * - the `performance` property in the global scope should be defined (this should be true for all modern browsers).\r\n     * - the `onresourcetimingbufferfull` event should be available. That is not currently true for Microsoft Edge.\r\n     * - the `PerformanceObserver` object should be available. That is not currently true for Microsoft Edge.\r\n     *\r\n     * (more info on the PerformanceObserver here: https://w3c.github.io/performance-timeline/#idl-def-performanceobservercallback)\r\n     * @returns {boolean}\r\n     */\r\n    public browserMissesRequiredFeatures(): boolean {\r\n        const performanceApiAvailable = !!window.performance;\r\n        const isOnBufferTimingFullEventAvailable = \"onresourcetimingbufferfull\" in window.performance;\r\n        const performanceObserverAvailable = \"PerformanceObserver\" in window;\r\n\r\n        return !performanceApiAvailable || !isOnBufferTimingFullEventAvailable || !performanceObserverAvailable;\r\n    }\r\n\r\n    /**\r\n     * Set-up an instance of the `PerformanceObserver` in order to listen and react to the events recorded by the browser through the Performance Api.\r\n     * @returns {void}\r\n     */\r\n    public observe(): void {\r\n        this.onPerformanceResourcesLoadedCallback = this.onPerformanceResourcesLoadedCallback.bind(this);\r\n\r\n        this.configurePerformanceResourceTimingBuffer();\r\n\r\n        const appObserver = this.createPerformanceObserver();\r\n        appObserver.observe(this.SubscribeToEntryTypes);\r\n    }\r\n\r\n    /**\r\n     * Consumers use this getter to specify which types of `PerformanceEntry` they want to observe.\r\n     * @type {{ entryTypes: string[] }}\r\n     */\r\n    protected abstract get SubscribeToEntryTypes(): { entryTypes: string[] };\r\n\r\n    /**\r\n     * Consumers need to pass the callback that gets invoked when a new set of resources has been loaded.\r\n     * @abstract\r\n     * @param {{ getEntriesByType: (resourceType: string) => PerformanceResourceTiming[] }} list\r\n     */\r\n    protected abstract onPerformanceResourcesLoadedCallback(list: { getEntriesByType: (resourceType: string) => PerformanceResourceTiming[] }): void;\r\n\r\n    /**\r\n     * Configure the maximum performace resource timing buffer size and attaches code the clear it when it's full.\r\n     * @method\r\n     */\r\n    private configurePerformanceResourceTimingBuffer(): void {\r\n        // the Performance Api records all the entries related to the recorded events into a buffer that, when full, forbids the recording of new\r\n        // incoming events.\r\n        // given the nature of our apps (SPAs with a lot of dinamically loaded resource) it seems appropriate to provide a default of 500 (which extends\r\n        // the browser default that is 150 entries).\r\n        window.performance.setResourceTimingBufferSize(this.bufferSize);\r\n\r\n        // when the performance buffer is full we need to clear it out, otherwise no new events get recorded.\r\n        // Edge does not provide this event.\r\n        window.performance[\"onresourcetimingbufferfull\"] = _event => window.performance.clearResourceTimings();\r\n    }\r\n\r\n    /**\r\n     * Creates an instance of the `PerformanceObserver` and returns it.\r\n     * Deals with a bug currently present in Chrome by attaching the object instance to a property in the global scope.\r\n     * @returns {{ observe: (params: { entryTypes: string[]}) => void }}\r\n     */\r\n    private createPerformanceObserver(): { observe: (params: { entryTypes: string[]}) => void } {\r\n        const PerformanceObserverFunctionCtor = window[\"PerformanceObserver\"];\r\n\r\n        // we need to attach the `PerformanceObserver` object somewhere in global scope to avoid hitting a bug currently present in Google Chrome.\r\n        // (https://bugs.chromium.org/p/chromium/issues/detail?id=742530&can=2&start=0&num=100&q=&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified&groupby=&sort=)\r\n        window[AppPerformanceObserver.StickyPerformanceApiPropertyName] = {\r\n            observer: new PerformanceObserverFunctionCtor(this.onPerformanceResourcesLoadedCallback as any)\r\n        };\r\n\r\n        return window[AppPerformanceObserver.StickyPerformanceApiPropertyName].observer;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { AppPerformanceObserver } from \"./AppPerformanceObserver\";\r\nimport { IPerformanceEntryTypes } from \"./IPerformanceEntryTypes\";\r\n\r\n/**\r\n * Specialization of the `AppPerformanceObserver` class that provides Catalyst-specific settings.\r\n * @class\r\n */\r\nexport class CatalystPerformanceObserver extends AppPerformanceObserver {\r\n\r\n    /**\r\n     * Creates an instance of CatalystPerformanceObserver.\r\n     * @param {(imageResources: PerformanceResourceTiming[]) => void} onEditorialImagesLoadedCallback - A callback invoked whenever an editorial image have been loaded into the browser.\r\n     */\r\n    constructor(\r\n        private onEditorialImagesLoadedCallback: (imageResources: PerformanceResourceTiming[]) => void) {\r\n\r\n        // this will configure the app to use the default value for the buffer size (500 entries).\r\n        super();\r\n    }\r\n\r\n    /**\r\n     * Catalyst is only interested in `PerformanceEntry`s of type `PerformanceResourceTiming` (because images belong to that category).\r\n     * @type {{ entryTypes: string[] }}\r\n     */\r\n    protected get SubscribeToEntryTypes(): { entryTypes: string[] } {\r\n        return { entryTypes: [IPerformanceEntryTypes.PerformanceResourceTiming] };\r\n    }\r\n\r\n    /**\r\n     * Catalyst speficic implementation of the callback that the `PerformanceObserver` invokes when a new set of resource gets loaded.\r\n     * @param {{ getEntriesByType: (resourceType: string) => PerformanceResourceTiming[] }} list\r\n     */\r\n    protected onPerformanceResourcesLoadedCallback(list: { getEntriesByType: (resourceType: string) => PerformanceResourceTiming[] }): void {\r\n\r\n        const imageResources = list.getEntriesByType(IPerformanceEntryTypes.PerformanceResourceTiming).filter(this.filterEditorialSearchedImages);\r\n        if (imageResources.length === 0) {\r\n            return;\r\n        }\r\n\r\n        this.onEditorialImagesLoadedCallback(imageResources);\r\n    }\r\n\r\n    /**\r\n     * Filter the resource entries to only get images that have been loaded as a result of an editorial/creative search.\r\n     * @param {PerformanceResourceTiming} resourceEntry\r\n     * @returns {boolean}\r\n     */\r\n    private filterEditorialSearchedImages(resourceEntry: PerformanceResourceTiming): boolean {\r\n        return (\r\n            resourceEntry.initiatorType === \"img\"       &&\r\n            resourceEntry.name.indexOf(\"api/cats\") > -1\r\n        );\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\n// set of functions used to extract timing info from the browser performance API.\r\n\r\nconst dnsLookupTime: (img: PerformanceResourceTiming) => number =\r\n    (img) => img.domainLookupEnd - img.domainLookupStart;\r\n\r\nconst tcpHandshakeTime: (img: PerformanceResourceTiming) => number =\r\n    (img) => img.connectEnd - img.connectStart;\r\n\r\nconst computeElapsed: (img: PerformanceResourceTiming) => number =\r\n    (img) => Math.round(img.responseEnd - img.startTime - (dnsLookupTime(img) + tcpHandshakeTime(img)));\r\n\r\nconst imageLoadingWasSlow: (elapsed: number, imageLoadingTimeThreshold: number) => boolean =\r\n    (elapsed, imageLoadingTimeThreshold) => elapsed > imageLoadingTimeThreshold;\r\n\r\nconst filterSlowImage: (img: PerformanceResourceTiming, imageLoadingTimeThreshold: number) => boolean =\r\n    (img, imageLoadingTimeThreshold) => imageLoadingWasSlow(computeElapsed(img), imageLoadingTimeThreshold);\r\n\r\nexport { filterSlowImage, computeElapsed };","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { Actions } from \"../../globals/actions\";\r\nimport { CatalystPerformanceObserver } from \"../../instrumentation/performanceApi/CatalystPerformanceObserver\";\r\nimport { IInstrumentationClient } from \"../instrumentationClient/IInstrumentationClient\";\r\nimport { SignedInAppBootstrapper } from \"../../SignedInAppBootstrapper\";\r\nimport { appConfig } from \"appConfig\";\r\nimport { createTelemetryPayload } from \"./telemetryPayloadCreation/lowVerbosityTelemetryPayloadStrategy\";\r\n\r\n/**\r\n * This class allows Catalyst to configure, start observing and log performance counters that have information on loading times of the images\r\n * the user has been browsing.\r\n * @class\r\n */\r\nexport class CatalystImageLoadingPerfCountersManager {\r\n\r\n    /**\r\n     * Creates an instance of CatalystImageLoadingPerfCountersManager.\r\n     * @param {IInstrumentationClient} instrumentationClient - An instance of the instrumentation client.\r\n     * @param {SignedInAppBootstrapper} rootBootstrapper - An instance of the app root bootstrapper.\r\n     */\r\n    constructor(private instrumentationClient: IInstrumentationClient, private rootBootstrapper: SignedInAppBootstrapper) {\r\n    }\r\n\r\n    /**\r\n     * Starts observing the configured performance entries using the browser PerformanceApi.\r\n     * Registers performance counter creation and sending when an editorial search is executed.\r\n     * @method\r\n     */\r\n    public activate(): void {\r\n\r\n        // associate the performance data collection action with the event `a new set of images has been loaded`.\r\n        // (triggered by the PerformanceObserver browser's API).\r\n        const setImageLoadingPerfCountersAction =\r\n            Actions.Telemetry.Editorial.ComputeImageLoadingPerfCounters.SetImageLoadingPerfCounters.getActionSender(this.rootBootstrapper.store);\r\n        const catalystPerformanceObserver = new CatalystPerformanceObserver(setImageLoadingPerfCountersAction);\r\n        if (catalystPerformanceObserver.browserMissesRequiredFeatures()) {\r\n            return;\r\n        }\r\n\r\n        catalystPerformanceObserver.observe();\r\n\r\n        // create and send to Asimov a performance counter when:\r\n        //    - an editorial search has been executed (clear that part of the state as well)\r\n        //    - the app is being closed\r\n        this.rootBootstrapper.SearchAndSelectBootstrap.registerHandlerOnEditorialSearchExecuted(() => {\r\n            this.flushPerformanceCounterToNetwork();\r\n            Actions.Telemetry.Editorial.ComputeImageLoadingPerfCounters.ClearImageLoadingPerfCounters.getActionSender(this.rootBootstrapper.store)();\r\n        });\r\n        window.onbeforeunload = () => this.flushPerformanceCounterToNetwork();\r\n    }\r\n\r\n    /**\r\n     * Creates and sends to Asimov a perfomance counter that captures the images loading times.\r\n     * @method\r\n     */\r\n    private flushPerformanceCounterToNetwork(): void {\r\n\r\n        // gather data from the state\r\n        const catalystState = this.rootBootstrapper.getCurrentState();\r\n        const { loadedImagesBatchResourceTimings } = catalystState.performanceCounters.editorialSearchImageLoadingTimes;\r\n\r\n        if (loadedImagesBatchResourceTimings.length === 0) {\r\n            return;\r\n        }\r\n\r\n        // build the telemetry payload\r\n        const telemetryPerfCounter = createTelemetryPayload(\r\n            loadedImagesBatchResourceTimings,\r\n            appConfig.logging.imageLoadingPerfCounters.loadingTimeThreshold);\r\n\r\n        // send the performance counter to Asimov\r\n        this.instrumentationClient.PerformanceCounterLoggingService.logPerfCounter(\r\n            telemetryPerfCounter.CounterName,\r\n            telemetryPerfCounter.CounterValue,\r\n            null,\r\n            telemetryPerfCounter.Data\r\n        );\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { computeElapsed, filterSlowImage } from \"./imageLoadingComputation\";\r\n\r\nimport { IPerfCounterItem } from \"clientcore-infrastructure-analytics/models/IPerfCounterItem\";\r\n\r\n/**\r\n * This interface assigns a type to the `Data` field of a `IPerfCounterItem`.\r\n * @interface\r\n */\r\nexport interface IImageLoadingLowVerbosityPerfCounter extends IPerfCounterItem {\r\n    Data: {\r\n        imagesCount: number;\r\n\r\n        slowImagesCount: number;\r\n\r\n        slowImagesDetails: {\r\n            loadingTime: number,\r\n            url: string;\r\n        }[]\r\n    }\r\n}\r\n\r\n/**\r\n * Creates a performance counter item that stores an aggregate view of the loaded images (number of slow images, total number of images, ...)\r\n * @param {PerformanceResourceTiming[]} loadedImagesBatchResourceTimings  - The array of image timings related to the loaded images.\r\n * @param {number} imageLoadingTimeThreshold - A threshold used to classify an image as `slow` in relation to the loading time.\r\n * @returns {IImageLoadingLowVerbosityPerfCounter} The computed perf counter item.\r\n */\r\nexport function createTelemetryPayload(loadedImagesResourceTimings: PerformanceResourceTiming[], imageLoadingTimeThreshold: number): IImageLoadingLowVerbosityPerfCounter {\r\n\r\n    const slowImages = loadedImagesResourceTimings.filter(image => filterSlowImage(image, imageLoadingTimeThreshold));\r\n    const slowImagesDetails = slowImages.map((slowImage) => {\r\n        return {\r\n            loadingTime: computeElapsed(slowImage),\r\n            url: slowImage.name\r\n        };\r\n    });\r\n\r\n    return {\r\n        CounterName: \"imageLoadingTelemetry/lowVerbosity\",\r\n        CounterValue: slowImages.length > 0 ? 1 : 0,\r\n        Data: {\r\n            imagesCount: loadedImagesResourceTimings.length,\r\n            slowImagesCount: slowImages.length,\r\n            slowImagesDetails\r\n        }\r\n    } as IPerfCounterItem;\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { ActivityLoggingService } from \"clientcore-infrastructure-analytics/ActivityLoggingService\";\r\nimport { AdalAuthenticationManager } from \"cms-ui-presentationlogic/authentication/adaljs/AdalAuthenticationManager\";\r\nimport { BrowserConsoleAppender } from \"clientcore-infrastructure-analytics/appenders/BrowserConsoleAppender\";\r\nimport { EventData } from \"clientcore-infrastructure-analytics/models/userActivityData/EventData\";\r\nimport { IActivityLogItem } from \"clientcore-infrastructure-analytics/models/IActivityLogItem\";\r\nimport { IActivityLoggingService } from \"clientcore-infrastructure-analytics/IActivityLoggingService\";\r\nimport { IAppConfig } from \"appConfig\";\r\nimport { IOneDsAppenderConfig } from \"clientcore-infrastructure-analytics/appenders/IOneDsAppenderConfig\";\r\nimport { IEvent } from \"clientcore-infrastructure-analytics/browser-object-models/IEvent\";\r\nimport { IEventData } from \"clientcore-infrastructure-analytics/models/userActivityData/IEventData\";\r\nimport { IInstrumentationClient } from \"./IInstrumentationClient\";\r\nimport { ILoggingService } from \"clientcore-infrastructure-analytics/ILoggingService\";\r\nimport { IPerfCounterLoggingService } from \"clientcore-infrastructure-analytics/IPerfCounterLoggingService\";\r\nimport { IUserActivityTrackingService } from \"clientcore-infrastructure-analytics/IUserActivityTrackingService\";\r\nimport { LogLevel } from \"clientcore-infrastructure-analytics/models/LogLevel\";\r\nimport { LoggingService } from \"clientcore-infrastructure-analytics/LoggingService\";\r\nimport { OneDsEnvironment } from \"clientcore-infrastructure-analytics/appenders/OneDsEnvironment\";\r\nimport { OneDsRoutingProfile } from \"clientcore-infrastructure-analytics/appenders/OneDsRoutingProfile\";\r\nimport { OneDsSendMode } from \"clientcore-infrastructure-analytics/appenders/OneDsSendMode\";\r\nimport { OneDsTransmissionProfile } from \"clientcore-infrastructure-analytics/appenders/OneDsTransmissionProfile\";\r\nimport { OneDsWebAppender } from \"clientcore-infrastructure-analytics/appenders/OneDsWebAppender\";\r\nimport { OneDsUserAuthMethod } from \"clientcore-infrastructure-analytics/appenders/OneDsUserAuthMethod\";\r\nimport { PerfCounterLoggingService } from \"clientcore-infrastructure-analytics/PerfCounterLoggingService\";\r\nimport { UserActivityTrackingService } from \"clientcore-infrastructure-analytics/UserActivityTrackingService\";\r\n\r\n/**\r\n * The Instrumentation client.\r\n * @class\r\n */\r\nclass InstrumentationClient implements IInstrumentationClient {\r\n\r\n    private static Instance: IInstrumentationClient = null;\r\n\r\n    /** The root activity.\r\n     * @type { IActivityLogItem }\r\n     */\r\n    private rootActivity: IActivityLogItem;\r\n\r\n    /** The service for tracking user activities.\r\n     * @type { IUserActivityTrackingService }\r\n     */\r\n    private userActivityTrackingService: IUserActivityTrackingService;\r\n\r\n    /** The service for tracking operational activities.\r\n     * @type { IActivityLoggingService }\r\n     */\r\n    private activityLoggingService: IActivityLoggingService;\r\n\r\n    /** The service for tracking operational activities.\r\n     * @type { IPerfCounterLoggingService }\r\n     */\r\n    private performanceCounterService: IPerfCounterLoggingService;\r\n\r\n    /** The service for tracking operational logs.\r\n     * @type { ILoggingService }\r\n     */\r\n    private loggingService: ILoggingService;\r\n\r\n    /**\r\n     * Initializes a new Instance of the `InstrumentationClient` class.\r\n     * @constructor\r\n     * @param appConfig {IAppConfig} The configuration for the app, including the telemetry configuration\r\n     * @param authenticationManager {AdalAuthenticationManager} Instance of class responsible for authentication scenario.\r\n     */\r\n    constructor(private appConfig: IAppConfig, private authenticationManager: AdalAuthenticationManager) {\r\n\r\n        this.loggingService = LoggingService.getInstance();\r\n        this.loggingService.setLevel(LogLevel[this.appConfig.logging.loggingServiceLoglevel]);\r\n        this.activityLoggingService = ActivityLoggingService.getInstance();\r\n        this.userActivityTrackingService = UserActivityTrackingService.getInstance();\r\n        this.performanceCounterService = PerfCounterLoggingService.getInstance();\r\n\r\n        if (appConfig.logging.telemetryEnabled) {\r\n            // Configure basic appenders\r\n            let consoleAppender = new BrowserConsoleAppender(LogLevel.All);\r\n            this.loggingService.addAppender(consoleAppender);\r\n\r\n            if (appConfig.logging.activityLoggingEnabled) {\r\n                this.activityLoggingService.addAppender(consoleAppender);\r\n            }\r\n\r\n            if (appConfig.logging.userActivityTrackingEnabled) {\r\n                this.userActivityTrackingService.addAppender(consoleAppender);\r\n            }\r\n\r\n            if (appConfig.logging.performanceCountersLoggingEnabled) {\r\n                this.performanceCounterService.addAppender(consoleAppender);\r\n            }\r\n\r\n            // OneDsWebAppender configuration\r\n            let oneDsEnvironment: OneDsEnvironment = OneDsEnvironment.Dev;\r\n            switch (appConfig.logging.oneDsConfig.environment) {\r\n            case \"PPE\":\r\n                oneDsEnvironment = OneDsEnvironment.Ppe;\r\n                break;\r\n            case \"PROD\":\r\n                oneDsEnvironment = OneDsEnvironment.Prod;\r\n                break;\r\n            default:\r\n                oneDsEnvironment = OneDsEnvironment.Dev;\r\n                break;\r\n            }\r\n\r\n            const oneDsAppenderConfig: IOneDsAppenderConfig = {\r\n            application: appConfig.logging.application,\r\n            buildVersion: appConfig.logging.application,\r\n            instrumentationKey: appConfig.logging.oneDsConfig.key,\r\n            isLoggedIn: this.authenticationManager.isUserAuthenticated,\r\n            oneDsEnvironment: oneDsEnvironment,\r\n            oneDsRoutingProfile: OneDsRoutingProfile.CAT,\r\n            productName: appConfig.logging.toolsProduct,\r\n            sendMode: OneDsSendMode.BatchEvents,\r\n            authMethod: InstrumentationClient.determine1DSUserAuthMethod(this.authenticationManager.userData.userName),\r\n            transmissionProfile: OneDsTransmissionProfile.BestEffort,\r\n            shareAuthStatus: false\r\n            };\r\n\r\n            const oneDsWebAppender = new OneDsWebAppender(\r\n            oneDsAppenderConfig,\r\n            window as any,\r\n            LogLevel.All\r\n            );\r\n            this.loggingService.addAppender(oneDsWebAppender);\r\n\r\n            if (appConfig.logging.activityLoggingEnabled) {\r\n                this.activityLoggingService.addAppender(oneDsWebAppender);\r\n            }\r\n\r\n            if (appConfig.logging.userActivityTrackingEnabled) {\r\n                this.userActivityTrackingService.addAppender(oneDsWebAppender);\r\n            }\r\n\r\n            // Create root activity for Catalyst.\r\n            this.rootActivity = this.activityLoggingService.createActivity(\"CatalystRoot\");\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Gets the correct OneDsUserAuthMethod based on the users username, used to configure the Asimov client.\r\n     * @param username {string} The Username string for the logged in user if provided.\r\n     * @return {OneDsUserAuthMethod} Returns the correct OneDsUserAuthMethod value for the given username.\r\n     */\r\n    public static determine1DSUserAuthMethod(username: string): OneDsUserAuthMethod {\r\n        if (username) {\r\n            if (username.indexOf(\"@microsoft.com\") !== -1) {\r\n                return OneDsUserAuthMethod.AAD;\r\n            }\r\n            return OneDsUserAuthMethod.MSA;\r\n        }\r\n        return OneDsUserAuthMethod.None;\r\n    }\r\n\r\n    /**\r\n     * Gets an Instance of the `InstrumentationClient` class, creating one if necessary.\r\n     * @constructor\r\n     * @param appConfig {IAppConfig} The configuration for the app, including the telemetry configuration\r\n     * @param authenticationManager {AdalAuthenticationManager} Instance of class responsible for authentication scenario.\r\n     */\r\n    public static getInstance(appConfig: IAppConfig, authenticationManager: AdalAuthenticationManager): IInstrumentationClient {\r\n        if (InstrumentationClient.Instance == null) {\r\n            InstrumentationClient.Instance = new InstrumentationClient(appConfig, authenticationManager);\r\n        }\r\n\r\n        return InstrumentationClient.Instance;\r\n    }\r\n\r\n    /**\r\n     * Accessor for the root activity\r\n     * @return {IActivityLogItem} Returns the rootAcitivty if it is set, otherwise, null\r\n     */\r\n    public get RootActivity(): IActivityLogItem {\r\n        return this.rootActivity ? this.rootActivity : null;\r\n    }\r\n\r\n    /**\r\n     * Accessor for the activity logging service\r\n     * @return {IActivityLoggingService} Returns the activityLoggingService\r\n     */\r\n    public get ActivityLoggingService(): IActivityLoggingService {\r\n        return this.activityLoggingService;\r\n    }\r\n\r\n    /**\r\n     * Accessor for the logging service\r\n     * @return {IActivityLogItem} Returns the loggingService\r\n     */\r\n    public get LoggingService(): ILoggingService {\r\n        return this.loggingService;\r\n    }\r\n\r\n    /**\r\n     * Accessor for the user activity tracking service\r\n     * @return {IUserActivityTrackingService} Returns the userActivityTrackingService\r\n     */\r\n    public get UserActivityTrackingService(): IUserActivityTrackingService {\r\n        return this.userActivityTrackingService;\r\n    }\r\n\r\n    /**\r\n     * Accessor for the performance counter logging service.\r\n     * @return {IPerfCounterLoggingService} Returns the performance counter logging service.\r\n     */\r\n    public get PerformanceCounterLoggingService(): IPerfCounterLoggingService {\r\n        return this.performanceCounterService;\r\n    }\r\n\r\n    /**\r\n     * Accessor for the Root Activity Correlation Vector\r\n     * @return {string} The root activity correlation vector\r\n     */\r\n    public get RootActivityCorrelationVector(): string {\r\n        return this.RootActivity ? this.RootActivity.correlationVector : null;\r\n    }\r\n\r\n    /**\r\n     * Creates Event Data\r\n     * @param event {IEvent} The DOM event.\r\n     * @param elementTitle {string} The element title or name to override.\r\n     * @param eventType {string} The event type to override.\r\n     * @param elementId {string} The unique identifier of the UI element to override.\r\n     * @param areaOfPage {string} The area of the page to override.\r\n     * @return {IEventData} The event data.\r\n     */\r\n    public createEventData(event: IEvent, elementTitle?: string, eventType?: string, elementId?: string, areaOfPage?: string): IEventData {\r\n        return EventData.createFrom(event, elementTitle, eventType, elementId, areaOfPage);\r\n    }\r\n}\r\n\r\n/**\r\n * Returns an Instance a Instance of the `InstrumentationClient` class.\r\n * @function\r\n * @param telemetryConfig {IAppTelemetryConfig} The Telemetry configuration for the app\r\n * @param authenticationManager {AdalAuthenticationManager} Instance of class responsible for authentication scenario.\r\n */\r\nfunction getInstrumentationClient(appConfig: IAppConfig, authenticationManager: AdalAuthenticationManager): IInstrumentationClient {\r\n    return InstrumentationClient.getInstance(appConfig, authenticationManager);\r\n}\r\n\r\nexport { getInstrumentationClient as GetInstrumentationClient };","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { AppHeaderSectionBootstrapper } from \"./experiences/appHeaderSection/AppHeaderSectionBootstrapper\";\r\nimport { ICatalystUserProfile } from \"./ICatalystUserProfile\";\r\nimport { MessageBoxModalBootstrapper } from \"./experiences/messageBoxModal/MessageBoxModalBootstrapper\";\r\n\r\n/**\r\n * The class provides access to application global services.\r\n * @class\r\n */\r\nexport class Global {\r\n    /**\r\n     * Provides access to an instance of AppHeaderSectionBootstrapper class.\r\n     * @property\r\n     * @returns {AppHeaderSectionBootstrapper} Instance of AppHeaderSectionBootstrapper class.\r\n     */\r\n    public static appHeaderSectionBootstrapper: AppHeaderSectionBootstrapper<any>;\r\n\r\n    /**\r\n     * The user profile (open scheme)\r\n     * @type {any}\r\n     */\r\n    public static userProfile: ICatalystUserProfile;\r\n\r\n    /**\r\n     * Provides access to common error message dialog box.\r\n     * @property\r\n     * @returns {MessageBoxModalBootstrapper} Instance of MessageBoxModalBootstrapper class.\r\n     */\r\n    public static errorMessageBox: MessageBoxModalBootstrapper<any>;\r\n\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\n/**\r\n * The AppContentSection is a React component which is responsible for rendering content of application.\r\n * @class\r\n */\r\nexport class AppContentSection extends React.Component<any, any> {\r\n\r\n    /**\r\n     * Renders child elements.\r\n     * @method\r\n     * @returns { React.ReactElement<any> } Application content section.\r\n     */\r\n    public render(): React.ReactElement<any> {\r\n        return (\r\n            <div className=\"app-content-section\">\r\n                {this.props.children}\r\n            </div>\r\n        );\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\n/**\r\n * Type of the pages linked to header link buttons.\r\n * @type\r\n */\r\nexport type HeaderLinkPageType =\r\n    \"editorial\" |\r\n    \"creative\" |\r\n    \"image\" |\r\n    \"lightbox\";\r\n\r\n/**\r\n * Predefine Pages linked to header link button\r\n */\r\nexport const HeaderLinkPage = {\r\n    editorial: \"editorial\" as HeaderLinkPageType,\r\n    creative: \"creative\" as HeaderLinkPageType,\r\n    image: \"image\" as HeaderLinkPageType,\r\n    lightbox: \"lightbox\" as HeaderLinkPageType\r\n};","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { HeaderLinkPage } from \"./presentation-logic/dataflows/appHeaderSection/HeaderLinkPage\";\r\nimport { isNil } from \"lodash-es\";\r\n\r\n/**\r\n * This class contains functions to return the Routes used in application.\r\n * @class\r\n */\r\nexport class Routes {\r\n    /**\r\n     * Returns the Image Route. If image id is present then returns /image/imageid else /image/(:/imageId)\r\n     * @method\r\n     * @param imageId {string} Id of the image\r\n     * @returns image path\r\n     */\r\n    public static getImagePageRoutePath(imageId?: string): string {\r\n        if (!imageId) {\r\n            return `/${HeaderLinkPage.image}(/:imageId)`;\r\n        } else {\r\n            return `/${HeaderLinkPage.image}/${imageId}`;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Returns the full Image Route with protocol. If imageId passed is null or empty, null is returned.\r\n     * @method\r\n     * @param imageId {string} Id of the image\r\n     * @returns image path\r\n     */\r\n    public static getImagePageRoutePathWithProtocol(imageId: string): string {\r\n        if (!!imageId) {\r\n            return window.location.protocol + \"//\" + window.location.host + Routes.getImagePageRoutePath(imageId);\r\n        } else {\r\n            return null;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Returns the Lightbox Route. If lightbox id is present then returns /lightbox/lightboxId else /lightbox or /lightbox/(:/lightboxId)\r\n     * @method\r\n     * @param baseOnly {boolean} This only applies when there is no lightboxId. If true, then only /lightbox is returned.\r\n     * @param lightboxId {string} Id of the Lightbox\r\n     * @returns lightbox path\r\n     */\r\n    public static getLightboxPageRoutePath(baseOnly: boolean, lightboxId?: string): string {\r\n        if (!lightboxId && baseOnly) {\r\n            return `/${HeaderLinkPage.lightbox}`;\r\n        } else if (!lightboxId && !baseOnly) {\r\n            return `/${HeaderLinkPage.lightbox}(/:lightboxId)`;\r\n        } else {\r\n            return `/${HeaderLinkPage.lightbox}/${lightboxId}`;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Returns an object to represent that a Link (to a lightbox page) is from an internal source\r\n     * @method\r\n     * @returns object\r\n     */\r\n    public static getStateForLightboxRoute(): { appInternal: boolean } {\r\n        return { appInternal: true };\r\n    }\r\n\r\n    /**\r\n     * Method to check if the state indicates that the Route navigation (to a lightbox page) is due to an internal Link being invoked\r\n     * (rather than a URL being pasted into a browser).\r\n     * @method\r\n     * @param state {any} This should be the nextParams.location.state object from the Route invocation.\r\n     * @returns boolean\r\n     */\r\n    public static isRouteNavigationSourceInternal(state: any): boolean {\r\n        if (!isNil(state) && !isNil(state.appInternal)) {\r\n            return state.appInternal as boolean;\r\n        }\r\n        return false;\r\n    }\r\n\r\n    /**\r\n     * Returns the full Lightbox Route with protocol. If lightboxId passed is null or empty, null is returned.\r\n     * @method\r\n     * @param lightboxId {string} Id of the Lightbox\r\n     * @returns lightbox path\r\n     */\r\n    public static getLightboxPageRoutePathWithProtocol(lightboxId: string): string {\r\n        if (!!lightboxId) {\r\n            return window.location.protocol + \"//\" + window.location.host + Routes.getLightboxPageRoutePath(true /* baseOnly */, lightboxId);\r\n        } else {\r\n            return null;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Returns the Editorial Search Route.\r\n     * @method\r\n     * @returns Search path\r\n     */\r\n    public static getSearchPageRoutePath(): string {\r\n        return \"/search\";\r\n    }\r\n\r\n    /**\r\n     * Returns the Creative Search Route.\r\n     * @method\r\n     * @returns Creative Search path\r\n     */\r\n    public static getCreativeSearchPageRoutePath(): string {\r\n        return \"/creativesearch\";\r\n    }\r\n\r\n    /**\r\n     * Returns the Error Search Route.\r\n     * @method\r\n     * @returns Error path\r\n     */\r\n    public static getErrorPageRoutePath(): string {\r\n        return \"/error\";\r\n    }\r\n\r\n    /**\r\n     * Returns the Read only JSON Editor Route.\r\n     * @method\r\n     * @param entityId {string} Id of the entity\r\n     * @returns Readonly JSON Editor path\r\n     */\r\n    public static getEditorPageRoutePath(entityId?: string): string {\r\n        if (!entityId) {\r\n            return \"/editor(/:entityId)\";\r\n        } else {\r\n            return \"/editor/\" + entityId;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Returns the write mode JSON Editor Route.\r\n     * @method\r\n     * @param entityId {string} Id of the entity\r\n     * @returns JSON Editor path\r\n     */\r\n    public static getWriteModeEditorPageRoutePath(entityId?: string): string {\r\n        if (!entityId) {\r\n            return \"/da39a3ee5e6b4b0d3255bfef95601890afd80709(/:entityId)\";\r\n        } else {\r\n            return \"/da39a3ee5e6b4b0d3255bfef95601890afd80709/\" + entityId;\r\n        }\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\nimport { IAppHeaderSectionProps } from \"./IAppHeaderSectionProps\";\r\nimport { Link } from \"react-router\";\r\nimport { NotificationsPopup } from \"cms-ui-components/notifications/notificationsPopup/NotificationsPopup\";\r\nimport { Routes } from \"../../Routes\";\r\nimport { UserBoxForNavBar } from \"cms-ui-components/userBox/UserBoxForNavBar\";\r\nimport { authenticationManager } from \"../../globals/authentication\";\r\nimport { LocationDescriptor } from \"history\";\r\n\r\n/**\r\n * The AppHeaderSection is a React component which is responsible for rendering header of the application.\r\n * @class\r\n */\r\nexport class AppHeaderSection extends React.Component<IAppHeaderSectionProps, {}> {\r\n\r\n    /**\r\n     * Initializes a new instance of the `AppHeaderSection` class.\r\n     * @constructor\r\n     * @param props {IAppHeaderSectionProps} The app header section props.\r\n     * @param context {any} The React context.\r\n     */\r\n    constructor(props: IAppHeaderSectionProps, context: any) {\r\n        super(props, context);\r\n    }\r\n\r\n    /**\r\n     * Renders application header.\r\n     * @method\r\n     * @returns { React.ReactElement<any> } Application header.\r\n     */\r\n    public render(): React.ReactElement<IAppHeaderSectionProps> {\r\n\r\n        const {\r\n            activeLightboxId,\r\n            pageHeaderClassName,\r\n            onHeaderLinkClicked,\r\n            onEditorialSearchLinkClicked,\r\n            onCreativeSearchLinkClicked,\r\n            toggleVisibility,\r\n            isCollapsed\r\n        } = this.props;\r\n\r\n        const lightboxPath = Routes.getLightboxPageRoutePath(true /* baseOnly */, activeLightboxId);\r\n\r\n        const toLightbox: LocationDescriptor = {\r\n            pathname: lightboxPath,\r\n            state: Routes.getStateForLightboxRoute()\r\n        };\r\n\r\n        const appNavBarClass = \"catalyst-header navbar navbar-default \" + pageHeaderClassName;\r\n        const notificationToggleClass = \"glyphicon glyphicon-flag\" + (isCollapsed ? \"\" : \" notification-active\");\r\n\r\n        const header = (\r\n            <nav className={appNavBarClass}>\r\n                <div className=\"container-fluid\">\r\n                    <div className=\"navbar-header\">\r\n                    <Link className=\"navbar-brand\" to=\"/search\" onClick={onHeaderLinkClicked}>\r\n                        <div className=\"home-link-header\">\r\n                            <span className=\"glyphicons glyphicons-fire\"></span>\r\n                            <span className=\"title-text\">Catalyst</span>\r\n                        </div>\r\n                    </Link>\r\n                    </div>\r\n                    <ul className=\"nav navbar-nav\">\r\n                        <li className=\"tab editorial\"><Link to=\"/search\" onClick={onEditorialSearchLinkClicked}>Editorial</Link></li>\r\n                        <li className=\"tab creative\"><Link to=\"/creativesearch\" onClick={onCreativeSearchLinkClicked}>Creative</Link></li>\r\n                        <li className=\"tab lightbox\"><Link to={toLightbox}>Lightbox</Link></li>\r\n                    </ul>\r\n                    <ul className=\"nav navbar-nav navbar-right\">\r\n                        <li>\r\n                            { authenticationManager.isUserAuthenticated\r\n                                ? (<a target=\"_blank\" href=\"https://aka.ms/catalyst-help\">Help</a>)\r\n                                : null\r\n                            }\r\n                        </li>\r\n                        <UserBoxForNavBar\r\n                            isUserAuthenticated={this.props.isUserAuthenticated}\r\n                            userProfile={this.props.userProfile}\r\n                            onSignInClicked={this.props.onSignInClicked}\r\n                            onSignOutClicked={this.props.onSignOutClicked} />\r\n                    </ul>\r\n                    <ul className=\"nav navbar-nav navbar-right notification-section\">\r\n                        <li>\r\n                            <a  href=\"#\"\r\n                                className={notificationToggleClass}\r\n                                onClick={toggleVisibility}></a>\r\n                            <NotificationsPopup {...this.props} />\r\n                        </li>\r\n                    </ul>\r\n                </div>\r\n            </nav>\r\n        );\r\n\r\n        return header;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\nimport { Button, Modal } from \"react-bootstrap\";\r\n\r\nimport { IMessageBoxModalProps } from \"./IMessageBoxModalProps\";\r\n\r\n/**\r\n * Modal dialog box react component class.\r\n * @class\r\n */\r\nexport class MessageBoxModal extends React.Component<IMessageBoxModalProps, any> {\r\n\r\n    /**\r\n     * @param {IMessageBoxModalProps} props - Message box properties.\r\n     * @param {any} context - Component context.\r\n     * @constructor\r\n     */\r\n    constructor(props: IMessageBoxModalProps, context: any) {\r\n        super(props, context);\r\n\r\n        if (!props) {\r\n            throw \"props paramter cannot be null\";\r\n        }\r\n    }\r\n\r\n    /**\r\n     * React render function\r\n     * @method\r\n     */\r\n    public render(): React.ReactElement<any> {\r\n        return (\r\n            <div className=\"static-modal\">\r\n                <Modal className=\"error-message-box\" show={this.props.isVisible} onHide={() => { this.props.close(); }}>\r\n                    <Modal.Header>\r\n                        <Modal.Title>Error</Modal.Title>\r\n                    </Modal.Header>\r\n                    <Modal.Body className=\"flex\">\r\n                        <span className=\"no-image-glyph glyphicon glyphicon-remove-circle\"></span>\r\n                        <div className=\"message-text\">\r\n                            <h4>{this.props.title}</h4>\r\n                            {this.props.text ? this.props.text.map(txt => <span>{txt}<br/></span>) : \"\"}\r\n                        </div>\r\n                    </Modal.Body>\r\n                    <Modal.Footer>\r\n                        <Button className=\"btn-primary btn-sm\" onClick={() => { this.props.close(); }}>Close</Button>\r\n                    </Modal.Footer>\r\n                </Modal>\r\n            </div>\r\n        );\r\n    }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\nimport { AppContentSection } from \"../appContentSection/AppContentSection\";\r\nimport { AppHeaderSection } from \"../appHeaderSection/AppHeaderSection\";\r\nimport { MessageBoxModal } from \"../components/messageBoxModal/MessageBoxModal\";\r\nimport { Global } from \"../../Global\";\r\n\r\n/**\r\n * The AppLayoutPanel is a React component which is responsible for application layout.\r\n * @class\r\n */\r\nexport class AppLayoutPanel extends React.Component<{}, {}> {\r\n\r\n    private connectedAppHeaderSection: React.ComponentClass<any>;\r\n    private connectedErrorMessageBox: React.ComponentClass<any>;\r\n\r\n    constructor(props: {}, context?: any) {\r\n        super(props, context);\r\n\r\n        this.connectedAppHeaderSection = Global.appHeaderSectionBootstrapper.getConnectedComponentWithStateSelection(AppHeaderSection);\r\n        this.connectedErrorMessageBox = Global.errorMessageBox.getConnectedComponentWithStateSelection(MessageBoxModal);\r\n    }\r\n\r\n    /**\r\n     * Renders application layout.\r\n     * @method\r\n     * @returns { React.ReactElement<{}> } Application layout.\r\n     */\r\n    public render(): React.ReactElement<{}> {\r\n        return (\r\n            <div className=\"app-layout-panel\">\r\n                {React.createElement(this.connectedErrorMessageBox)}\r\n                {React.createElement(this.connectedAppHeaderSection)}\r\n                <AppContentSection>\r\n                    {this.props.children}\r\n                </AppContentSection>\r\n\r\n                <div className=\"footer\">\r\n                    <span><a className=\"data-protection-link\" target=\"_blank\" href=\"https://microsoft.sharepoint.com/teams/msdpn/sitepages/default.aspx\">MS Data Protection Notice</a></span>\r\n                    <span>© Microsoft 2017</span>\r\n                </div>\r\n            </div>\r\n        );\r\n    }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { IFilterOptionsGroup, IFilterItemOptionsList } from \"./IFilterItemOptionsList\";\r\n\r\nconst creativeSearchFilterPanePropsIndexes = {\r\n    providers: 0,\r\n\r\n    orientations: 1,\r\n\r\n    imageStyles: 2\r\n};\r\n\r\n/**\r\n * Props for the QueryFilterPane\r\n * @interface\r\n */\r\nexport interface IQueryFilterPaneProps {\r\n\r\n    optionGroups: IFilterOptionsGroup[];\r\n\r\n    /** Setting this to false allows keyboard navigation to be disabled on this component.\r\n     * Optional and defaults to true.\r\n     * This is intended to be set to false when the filter pane is collapsed.\r\n     * @type {boolean}\r\n     */\r\n    isKeyboardNavigable?: boolean;\r\n}\r\n\r\nexport function creativeSearchProvidersProps(queryFilterPaneProps: IQueryFilterPaneProps): IFilterItemOptionsList {\r\n    return queryFilterPaneProps.optionGroups[creativeSearchFilterPanePropsIndexes.providers].items[0] as IFilterItemOptionsList;\r\n}\r\nexport function creativeSearchOrientationsProps(queryFilterPaneProps: IQueryFilterPaneProps): IFilterItemOptionsList {\r\n    return queryFilterPaneProps.optionGroups[creativeSearchFilterPanePropsIndexes.orientations].items[0] as IFilterItemOptionsList;\r\n}\r\nexport function creativeSearchImageStylesProps(queryFilterPaneProps: IQueryFilterPaneProps): IFilterItemOptionsList {\r\n    return queryFilterPaneProps.optionGroups[creativeSearchFilterPanePropsIndexes.imageStyles].items[0] as IFilterItemOptionsList;\r\n}\r\nexport function createProviderQueryFilterPaneProps(imageProviders: IFilterItemOptionsList, imageOrientations: IFilterItemOptionsList, imageStyles: IFilterItemOptionsList): IQueryFilterPaneProps {\r\n    return {\r\n        optionGroups: [\r\n            {\r\n                items:  [imageProviders]\r\n            },\r\n            {\r\n                items: [imageOrientations]\r\n            },\r\n            {\r\n                items: [imageStyles]\r\n            }\r\n        ]\r\n    };\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\n/**\r\n * Enum modeling the way the results can be viewed.\r\n * @enum\r\n */\r\nexport enum ResultsDisplayModeEnum {\r\n    /* Show items in a grid layout\r\n     */\r\n    Grid,\r\n\r\n    /* Show items in a mosaic style layout\r\n     */\r\n    Mosaic\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\nimport { isEqual, isNil } from \"lodash-es\";\r\n\r\nimport { ICreativeSearchProps } from \"../../creativeSearch/ICreativeSearchProps\";\r\nimport { IImageTileProps } from \"../../components/imageTile/IImageTileProps\";\r\nimport { ResultsDisplayModeEnum } from \"../../../models/displayMode/ResultsDisplayModeEnum\";\r\n\r\n/**\r\n * The set of props common to both the paged virtual grid and the paged virtual collection components.\r\n * @interface\r\n */\r\ninterface ICatalystVirtualCollectionProps extends ICreativeSearchProps {\r\n\r\n    /**\r\n     * The height of the container, expressed in pixels.\r\n     * @type {number}\r\n     */\r\n    containerHeight: number;\r\n\r\n    /**\r\n     * The width of the container, expressed in pixels.\r\n     * @type {number}\r\n     */\r\n    containerWidth: number;\r\n\r\n    /**\r\n     * A function that renders the single tile.\r\n     * @type {((props: IImageTileProps) => React.ReactElement<IImageTileProps>}\r\n     */\r\n    renderTile: (props: IImageTileProps) => React.ReactElement<IImageTileProps>;\r\n}\r\n\r\n/**\r\n * Checks if the props of a Catalyst virtual paged collection component have changed or not.\r\n * @method\r\n * @param {ICatalystVirtualCollectionProps} prevProps - The previous set of props\r\n * @param {ICatalystVirtualCollectionProps} nextProps - The new set of props\r\n * @returns {boolean} Returns true if the props have changed, false otherwise.\r\n */\r\nfunction shouldCatalystVirtualCollectionUpdate(prevProps: ICatalystVirtualCollectionProps, nextProps: ICatalystVirtualCollectionProps): boolean {\r\n    const hasProviderChanged =\r\n        !isNil(nextProps.creativeProvider) && !isNil(prevProps.creativeProvider)\r\n            ? nextProps.creativeProvider !== prevProps.creativeProvider\r\n            : false;\r\n\r\n    const hasPagePropsChanged = nextProps.resultsDisplayMode === ResultsDisplayModeEnum.Grid\r\n        ? !isEqual(prevProps.pagedImagesProps, nextProps.pagedImagesProps)\r\n        : !isEqual(prevProps.pagedVirtualCollectionProps, nextProps.pagedVirtualCollectionProps);\r\n\r\n    const shouldComponentUpdate = (\r\n        hasProviderChanged ||\r\n        prevProps.containerWidth !== nextProps.containerWidth ||\r\n        hasPagePropsChanged);\r\n\r\n    return shouldComponentUpdate;\r\n}\r\n\r\nexport { ICatalystVirtualCollectionProps, shouldCatalystVirtualCollectionUpdate };","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\nimport { ICatalystVirtualCollectionProps, shouldCatalystVirtualCollectionUpdate } from \"./ICatalystVirtualCollectionProps\";\r\n\r\nimport { PagedVirtualCollection } from \"cms-ui-components/pagedVirtualCollection/PagedVirtualCollection\";\r\nimport { isEqual } from \"lodash-es\";\r\n\r\n/**\r\n * This component wraps the <PagedVirtualCollection /> and adds the capability to prevent unnecessary re-render cycles.\r\n * @class\r\n */\r\nexport class CatalystPagedVirtualCollection extends React.Component<ICatalystVirtualCollectionProps, {}> {\r\n\r\n    /**\r\n     * A ref to the PagedVirtualCollection, used to force invalidation of the cached cell size and position information\r\n     * when anything changes.\r\n     * @type {Element}\r\n     */\r\n    private pagedVirtualCollectionElement: PagedVirtualCollection;\r\n\r\n    /**\r\n     * Initializes a new instance of the `SearchAndSelect` class.\r\n     * @constructor\r\n     * @param {ICatalystVirtualCollectionProps} props The properties controlling the layout of this component.\r\n     * @param {any} context The react context object.\r\n     */\r\n    constructor(props: ICatalystVirtualCollectionProps, context: any) {\r\n        super(props, context);\r\n\r\n        if (!props) {\r\n            throw \"props parameter cannot be null\";\r\n        }\r\n\r\n        this.pagedVirtualCollectionElement = null;\r\n    }\r\n\r\n    /**\r\n     * Renders the paged virtual collection element.\r\n     * @method\r\n     * @returns {React.ReactElement<ICatalystVirtualCollectionProps>} The paged virtual collection element.\r\n     */\r\n    public render(): React.ReactElement<ICatalystVirtualCollectionProps> {\r\n        return (\r\n            <PagedVirtualCollection\r\n                ref={instance => this.pagedVirtualCollectionElement = instance}\r\n                containerWidth={this.props.containerWidth}\r\n                containerHeight={this.props.containerHeight}\r\n                pages={this.props.pagedImagesProps.pageDescriptors}\r\n                activePageIndex={this.props.pagedImagesProps.activePageIndex}\r\n                activePageCellProps={this.props.pagedVirtualCollectionProps.activePageCellProps}\r\n                onScroll={this.props.onScroll}\r\n                verticalOverscanSize={500}\r\n                scrollTop={this.props.scrollTop}>\r\n\r\n                {this.props.imageTiles.map(tileProps => this.props.renderTile(tileProps))}\r\n            </PagedVirtualCollection>\r\n        );\r\n    }\r\n\r\n    /**\r\n     * If the pagedVirtualCollectionProps have changed, then force the pagedVirtualCollection component to invalidate\r\n     * its cache of size and position information.\r\n     * @method\r\n     * @param {ISearchAndSelectProps} nextProps The new properties that have been provided to the component.\r\n     */\r\n    public componentWillReceiveProps(nextProps: ICatalystVirtualCollectionProps): void {\r\n        if (!isEqual(this.props.pagedVirtualCollectionProps, nextProps.pagedVirtualCollectionProps)) {\r\n            this.forceRecomputeOfCellSizesAndPositions();\r\n        }\r\n    }\r\n\r\n    /**\r\n     * React lifecycle component used to preven unnecessary re-render cycles.\r\n     * @method\r\n     * @param {ICatalystVirtualCollectionProps} nextProps The new properties that have been provided to the component.\r\n     * @returns {boolean} Returns true when the component's render method need to be executed, false othewise.\r\n     */\r\n    public shouldComponentUpdate(nextProps: ICatalystVirtualCollectionProps): boolean {\r\n        return shouldCatalystVirtualCollectionUpdate(this.props, nextProps);\r\n    }\r\n\r\n    /**\r\n     * Convenience method to tell the underlying pagedVirtualCollection element to invalidate its cache of size and position information\r\n     * @method\r\n     */\r\n    private forceRecomputeOfCellSizesAndPositions(): void {\r\n        if (this.pagedVirtualCollectionElement !== null) {\r\n            this.pagedVirtualCollectionElement.recomputeCellSizesAndPositions();\r\n        }\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\nimport { PagedVirtualGrid } from \"cms-ui-components/pagedVirtualGrid/PagedVirtualGrid\";\r\n\r\nimport { ICatalystVirtualCollectionProps, shouldCatalystVirtualCollectionUpdate } from \"./ICatalystVirtualCollectionProps\";\r\n\r\n/**\r\n * This component wraps the <PagedVirtualGrid /> and adds the capability to prevent unnecessary re-render cycles.\r\n * @class\r\n */\r\nexport class CatalystPagedVirtualGrid extends React.Component<ICatalystVirtualCollectionProps, {}> {\r\n\r\n    /**\r\n     * Renders the paged virtual grif element.\r\n     * @method\r\n     * @returns {React.ReactElement<ICatalystVirtualCollectionProps>} The paged virtual grid element.\r\n     */\r\n    public render(): React.ReactElement<ICatalystVirtualCollectionProps> {\r\n          return (\r\n            <PagedVirtualGrid\r\n                    activePageIndex={this.props.pagedImagesProps.activePageIndex}\r\n                    pages={this.props.pagedImagesProps.pageDescriptors}\r\n                    itemWidth={this.props.thumbnailImageWidth}\r\n                    itemHeight={this.props.thumbnailImageHeight}\r\n                    containerHeight={this.props.containerHeight}\r\n                    containerWidth={this.props.containerWidth}\r\n                    onScroll={this.props.onScroll}\r\n                    scrollTop={this.props.scrollTop}\r\n                    addTransitionEffect={false}>\r\n\r\n                {this.props.imageTiles.map(tileProps => (this.props.renderTile(tileProps)))}\r\n            </PagedVirtualGrid>\r\n        );\r\n    }\r\n\r\n    /**\r\n     * React lifecycle component used to prevent unnecessary re-render cycles.\r\n     * @method\r\n     * @param {ICatalystVirtualCollectionProps} nextProps The new properties that have been provided to the component.\r\n     * @returns {boolean} Returns true when the component's render method need to be executed, false othewise.\r\n     */\r\n    public shouldComponentUpdate(nextProps: ICatalystVirtualCollectionProps): boolean {\r\n        return shouldCatalystVirtualCollectionUpdate(this.props, nextProps);\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\nimport { isEmpty, isNil } from \"lodash-es\";\r\n\r\nimport { ButtonOverlay } from \"cms-ui-components/overlayableImage/overlays/buttonOverlay/ButtonOverlay\";\r\nimport { ButtonOverlayPosition } from \"cms-ui-components/overlayableImage/overlays/buttonOverlay/ButtonOverlayPosition\";\r\nimport { Checkbox } from \"react-bootstrap\";\r\nimport { IButtonOverlayProps } from \"cms-ui-components/overlayableImage/overlays/buttonOverlay/IButtonOverlayProps\";\r\nimport { IImageTileProps } from \"./IImageTileProps\";\r\nimport { IOverlayableImageProps } from \"cms-ui-components/overlayableImage/IOverlayableImageProps\";\r\nimport { OverlayableImage } from \"cms-ui-components/overlayableImage/OverlayableImage\";\r\nimport { Spinner } from \"cms-ui-components/spinner/Spinner\";\r\n\r\n/**\r\n * Grid layout image tile react component class\r\n * @class\r\n */\r\nexport class GridImageTile extends React.Component<IImageTileProps, {}> {\r\n    /**\r\n     * constructor\r\n     * @param props {IImageTileProps} props\r\n     * @param context {any} context\r\n     */\r\n    constructor(props: IImageTileProps, context: any) {\r\n        super(props, context);\r\n        if (!props) {\r\n            throw \"props paramter cannot be null\";\r\n        }\r\n\r\n        this.onImageTileInvoked = this.onImageTileInvoked.bind(this);\r\n        this.onImageTileSelectionChanged = this.onImageTileSelectionChanged.bind(this);\r\n    }\r\n\r\n    /**\r\n     * React render function\r\n     * @method\r\n     */\r\n    public render(): React.ReactElement<any> {\r\n\r\n        const addToLightboxButtonOverlayProps: IButtonOverlayProps = isNil(this.props.onAddToLightboxInvoked) ? null : {\r\n            glyph: \"plus\",\r\n            setAsTabStop: false,\r\n            position: ButtonOverlayPosition.TopRight,\r\n            onInvoked: this.props.onAddToLightboxInvoked,\r\n            tooltip: \"Add this image to a lightbox\"\r\n        };\r\n\r\n        const removeFromLightboxButtonOverlayProps: IButtonOverlayProps = isNil(this.props.onRemoveFromLightboxInvoked) ? null : {\r\n            glyph: \"remove\",\r\n            setAsTabStop: false,\r\n            position: ButtonOverlayPosition.TopRight,\r\n            onInvoked: this.props.onRemoveFromLightboxInvoked,\r\n            tooltip: \"Remove this image from the current lightbox\"\r\n        };\r\n\r\n        let tileDescription = this.props.title;\r\n        const className = !!this.props.customClassName ? \"grid-tile \" + this.props.customClassName : \"grid-tile\";\r\n        if (!!this.props.loading) {\r\n            tileDescription = this.props.title + \": Loading details.\";\r\n            return (\r\n                <div\r\n                    className=\"grid-tile\"\r\n                    tabIndex={-1}>\r\n                    <div className=\"spinner-host\">\r\n                        <div className=\"spinner-normal\">\r\n                            <Spinner />\r\n                        </div>\r\n                    </div>\r\n                    <div className=\"grid-tile-description\">\r\n                        {tileDescription}\r\n                    </div>\r\n                </div>\r\n            );\r\n        }\r\n\r\n        const addToLightboxOverlay: React.ReactElement<any> = addToLightboxButtonOverlayProps !== null ? (<ButtonOverlay {...addToLightboxButtonOverlayProps} />) : null;\r\n        const removeFromLightboxOverlay: React.ReactElement<any> = removeFromLightboxButtonOverlayProps !== null ? (<ButtonOverlay {...removeFromLightboxButtonOverlayProps} />) : null;\r\n        const altText = !!this.props.sourceHref ? this.props.altText : \"No Image\";\r\n        const overlayableImageProps: IOverlayableImageProps = {\r\n            source: this.props.sourceHref,\r\n            alt: altText\r\n        };\r\n\r\n        if (!isNil(this.props.errorCode) && !isEmpty(this.props.errorCode)) {\r\n            tileDescription = this.props.title + \": \" + this.props.errorCode;\r\n        }\r\n\r\n        let tileDescriptionElement = (\r\n            <div className=\"grid-tile-description\">\r\n                {tileDescription}\r\n            </div>\r\n        );\r\n\r\n        let selected = false;\r\n        if (this.props.supportsMultiSelection) {\r\n            selected = this.props.selected || false;\r\n\r\n            const checkBoxClassName = selected ? \"glyphicon glyphicon-check\" : \"glyphicon glyphicon-unchecked\";\r\n\r\n            tileDescriptionElement = (\r\n                <div className=\"row\" key={\"row\" + this.props.id}>\r\n                    <div className=\"col-xs-1\" >\r\n                        <Checkbox tabIndex={-1} checked={selected} key={this.props.id} onChange={this.onImageTileSelectionChanged}>\r\n                            {(<i className={checkBoxClassName} tabIndex={-1} />)}\r\n                        </Checkbox>\r\n                    </div>\r\n                    <div className=\"col-xs-11\" >\r\n                        <div className=\"grid-tile-description\">\r\n                            {tileDescription}\r\n                        </div>\r\n                    </div>\r\n                </div>\r\n            );\r\n        }\r\n\r\n        return (\r\n            <div\r\n                className={className}\r\n                onClick={this.onImageTileInvoked}\r\n                tabIndex={-1}>\r\n                <OverlayableImage {...overlayableImageProps}>\r\n                    {addToLightboxOverlay}\r\n                    {removeFromLightboxOverlay}\r\n                </OverlayableImage>\r\n                <div className=\"grid-tile-footer\">\r\n                    {tileDescriptionElement}\r\n                </div>\r\n            </div>\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Exposes a hook for a callback passed via props by the consumer of this component to be called back when the tile has been invoked\r\n     * @method\r\n     */\r\n    private onImageTileInvoked(event: React.SyntheticEvent<HTMLDivElement>): void {\r\n        if (event.currentTarget.tagName === \"DIV\") {\r\n            if (this.props.onImageTileInvoked) {\r\n                this.props.onImageTileInvoked(event);\r\n            }\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Callback for when the tile is selected/deselected\r\n     * @method\r\n     */\r\n    private onImageTileSelectionChanged(event: React.SyntheticEvent<any>): void {\r\n        if (this.props.onImageTileSelectionChanged) {\r\n            const selected = !this.props.selected;\r\n            this.props.onImageTileSelectionChanged(selected, event);\r\n        }\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\n/**\r\n * An option value with selection state and an optional tooltip which can be used to add explanatory text.\r\n * @interface\r\n */\r\ninterface IOptionItemWithSelectionState {\r\n    value: string;\r\n    selected: boolean;\r\n    tooltip?: string;\r\n}\r\n\r\n/**\r\n * Enum representing whether a filter option is a DateRange or a string list (we currently only support two)\r\n * @interface\r\n */\r\nenum FilterItemOptionsType {\r\n    DateRange,\r\n    StringList\r\n}\r\n\r\n/**\r\n * Interface for a list of values for a particular option\r\n * @interface\r\n */\r\ninterface IFilterItemOptionBase {\r\n    $type: FilterItemOptionsType;\r\n    name: string;\r\n}\r\n\r\n/**\r\n * Enum representing whether an options list is single select or multiselect\r\n * @interface\r\n */\r\nenum FilterItemOptionsListSelectionType {\r\n    SingleSelectDropdown,\r\n    SingleSelectRadio,\r\n    MultiSelect\r\n}\r\n\r\n/**\r\n * Interface for a list of values for a particular option\r\n * @interface\r\n */\r\ninterface IFilterItemOptionsList extends IFilterItemOptionBase {\r\n    values: IOptionItemWithSelectionState[];\r\n    selectionType: FilterItemOptionsListSelectionType;\r\n    onSelectedOptionsChanged?: (selectedIndices: number[], event: React.SyntheticEvent<any>) => void;\r\n}\r\n\r\n/**\r\n * Interface for a date range filter\r\n * @interface\r\n */\r\ninterface IDateRangeFilter extends IFilterItemOptionBase {\r\n    /** Maximum allowable date that can be picked for the start date of the range (optional).\r\n     * @type {Date}\r\n     */\r\n    maxStartOfRangeDate?: Date;\r\n\r\n    /** Maximum allowable date that can be picked for the end date of the range (optional).\r\n     * @type {Date}\r\n     */\r\n    maxEndOfRangeDate?: Date;\r\n\r\n    /** The date to set as the initially selected date in the start date picker (optional).\r\n     * @type {Date}\r\n     */\r\n    startDate?: Date;\r\n\r\n    /** The date to set as the initially selected date in the end date picker (optional).\r\n     * @type {Date}\r\n     */\r\n    endDate?: Date;\r\n\r\n    /** Callback for when there's a change to the start date in the range.\r\n     * @type {function}\r\n     */\r\n    onStartOfRangeChanged?: (startDate: Date) => void;\r\n\r\n    /** Callback for when there's a change to the end date in the range.\r\n     * @type {function}\r\n     */\r\n    onEndOfRangeChanged?: (endDate: Date) => void;\r\n}\r\n\r\n/**\r\n * Interface representing a items to be shown together in a group within the filter pane.\r\n * Dividers are shown between groups.\r\n * @interface\r\n */\r\ninterface IFilterOptionsGroup {\r\n    items: (IDateRangeFilter | IFilterItemOptionsList)[];\r\n}\r\n\r\nexport { FilterItemOptionsType, FilterItemOptionsListSelectionType, IDateRangeFilter, IFilterOptionsGroup, IOptionItemWithSelectionState, IFilterItemOptionsList };\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\nimport { isEmpty, isNil } from \"lodash-es\";\r\n\r\nimport { ButtonOverlay } from \"cms-ui-components/overlayableImage/overlays/buttonOverlay/ButtonOverlay\";\r\nimport { ButtonOverlayPosition } from \"cms-ui-components/overlayableImage/overlays/buttonOverlay/ButtonOverlayPosition\";\r\nimport { IButtonOverlayProps } from \"cms-ui-components/overlayableImage/overlays/buttonOverlay/IButtonOverlayProps\";\r\nimport { IImageTileProps } from \"./IImageTileProps\";\r\nimport { IOverlayableImageProps } from \"cms-ui-components/overlayableImage/IOverlayableImageProps\";\r\nimport { ITextOverlayProps } from \"cms-ui-components/overlayableImage/overlays/textOverlay/ITextOverlayProps\";\r\nimport { OverlayableImage } from \"cms-ui-components/overlayableImage/OverlayableImage\";\r\nimport { TextOverlay } from \"cms-ui-components/overlayableImage/overlays/textOverlay/TextOverlay\";\r\nimport { TextOverlayPosition } from \"cms-ui-components/overlayableImage/overlays/textOverlay/TextOverlayPosition\";\r\n\r\n/**\r\n * Image tile react component class\r\n * @class\r\n */\r\nexport class ImageTile extends React.Component<IImageTileProps, {}> {\r\n\r\n    /**\r\n     * constructor\r\n     * @param props {IImageTilePropsWithDiv} props\r\n     * @param context {any} context\r\n     */\r\n    constructor(props: IImageTileProps, context: any) {\r\n        super(props, context);\r\n\r\n        if (!props) {\r\n            throw \"props paramter cannot be null\";\r\n        }\r\n\r\n        this.onImageTileInvoked = this.onImageTileInvoked.bind(this);\r\n    }\r\n\r\n    /**\r\n     * React render function\r\n     * @method\r\n     */\r\n    public render(): React.ReactElement<any> {\r\n\r\n        const addToLightboxButtonOverlayProps: IButtonOverlayProps = isNil(this.props.onAddToLightboxInvoked) ? null : {\r\n            glyph: \"plus\",\r\n            setAsTabStop: false,\r\n            position: ButtonOverlayPosition.TopRight,\r\n            onInvoked: this.props.onAddToLightboxInvoked,\r\n            tooltip: \"Add this image to a lightbox\"\r\n        };\r\n\r\n        const removeFromLightboxButtonOverlayProps: IButtonOverlayProps = isNil(this.props.onRemoveFromLightboxInvoked) ? null : {\r\n            glyph: \"remove\",\r\n            setAsTabStop: false,\r\n            position: ButtonOverlayPosition.TopRight,\r\n            onInvoked: this.props.onRemoveFromLightboxInvoked,\r\n            tooltip: \"Remove this image from the current lightbox\"\r\n        };\r\n\r\n        const addToLightboxOverlay: React.ReactElement<any> = addToLightboxButtonOverlayProps !== null ? (<ButtonOverlay {...addToLightboxButtonOverlayProps} />) : null;\r\n        const removeFromLightboxOverlay: React.ReactElement<any> = removeFromLightboxButtonOverlayProps !== null ? (<ButtonOverlay {...removeFromLightboxButtonOverlayProps} />) : null;\r\n\r\n        const textOverlayProps: ITextOverlayProps = isEmpty(this.props.sourceHref) ? null : {\r\n            text: this.props.title,\r\n            position: TextOverlayPosition.Bottom\r\n        };\r\n\r\n        const imageTitleTextOverlay: React.ReactElement<any> = textOverlayProps !== null ? (<TextOverlay {...textOverlayProps} />) : null;\r\n\r\n        const altText = !!this.props.sourceHref ? this.props.altText : \"No Image\";\r\n\r\n        const renderAsPlaceholder = this.props.renderAsPlaceholder || false;\r\n\r\n        const overlayableImageProps: IOverlayableImageProps = {\r\n            source: this.props.sourceHref,\r\n            alt: altText\r\n        };\r\n\r\n        return (\r\n            <div\r\n                className=\"image-tile\"\r\n                onClick={this.onImageTileInvoked}\r\n                tabIndex={-1}>\r\n                {!renderAsPlaceholder ? (\r\n                    <OverlayableImage {...overlayableImageProps}>\r\n                        {imageTitleTextOverlay}\r\n                        {addToLightboxOverlay}\r\n                        {removeFromLightboxOverlay}\r\n                    </OverlayableImage>\r\n                ) : null}\r\n            </div>\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Exposes a hook for a callback passed via props by the consumer of this component to be called back when the tile has been invoked\r\n     * @method\r\n     */\r\n    private onImageTileInvoked(event: React.SyntheticEvent<any>): void {\r\n        if (this.props.onImageTileInvoked) {\r\n            this.props.onImageTileInvoked(event);\r\n        }\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as Moment from \"moment\";\r\nimport * as React from \"react\";\r\n\r\nimport { DatePicker } from \"cms-ui-components/datePicker/Datepicker\";\r\nimport { IDateRangePickerProps } from \"./IDateRangePickerProps\";\r\nimport { IEvent } from \"clientcore-infrastructure-analytics/browser-object-models/IEvent\";\r\n\r\n/**\r\n * This component is responsible for rendering a date range picker\r\n * @class\r\n */\r\nexport class DateRangePicker extends React.Component<IDateRangePickerProps, any> {\r\n\r\n    // These are used to identify the individual date fields in the range in the onChange callbacks.\r\n    private static StartOfRangeIndicator: string = \"StartOfRange\";\r\n    private static EndOfRangeIndicator: string = \"EndOfRange\";\r\n\r\n    /**\r\n     * Initializes a new instance of the `DateRangePicker` class.\r\n     * @constructor\r\n     * @param {IDateRangePickerProps} props The properties controlling the layout of this component.\r\n     * @param {any} context The react context object.\r\n     */\r\n    constructor(props: IDateRangePickerProps, context: any) {\r\n        super(props, context);\r\n\r\n        if (!props) {\r\n            throw \"props parameter cannot be null\";\r\n        }\r\n    }\r\n\r\n    // Helper method to convert Date to Moment\r\n    private static dateToMoment(date: Date): Moment.Moment {\r\n        return (!!date ? Moment(date.toISOString()) : null);\r\n    }\r\n\r\n    /**\r\n     * Renders the date pickers for the custom date range\r\n     * @method\r\n     * @returns { React.ReactElement<any> } A div containing the date pickers.\r\n     */\r\n    public render(): React.ReactElement<any> {\r\n        const dateFormatAndPlaceholderText: string = \"YYYY/MM/DD\";\r\n\r\n        return (\r\n            <div>\r\n                <div>From:</div>\r\n                <div className=\"date-picker-host\" >\r\n                    <DatePicker\r\n                        isKeyboardNavigable={true}\r\n                        dateFormat={dateFormatAndPlaceholderText}\r\n                        placeholderText={dateFormatAndPlaceholderText}\r\n                        maxDate={DateRangePicker.dateToMoment(this.props.maxStartOfRangeDate) }\r\n                        selectedDate={this.props.startDate }\r\n                        onChange={(date, event) => this.onDateChange(DateRangePicker.StartOfRangeIndicator, event, date) } />\r\n                </div>\r\n                <div>To:</div>\r\n                <div className= \"date-picker-host\" >\r\n                    <DatePicker\r\n                        isKeyboardNavigable={true}\r\n                        dateFormat={dateFormatAndPlaceholderText}\r\n                        placeholderText={dateFormatAndPlaceholderText}\r\n                        maxDate={DateRangePicker.dateToMoment(this.props.maxEndOfRangeDate) }\r\n                        selectedDate={this.props.endDate }\r\n                        onChange={(date, event) => this.onDateChange(DateRangePicker.EndOfRangeIndicator, event, date) } />\r\n                </div>\r\n            </div>\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Callback when the user selects a date for either end of the range.\r\n     * @method\r\n     */\r\n    private onDateChange(whichDate: string, event: IEvent, selectedMoment: Moment.Moment): void {\r\n        let newDate: Date = !!selectedMoment ? selectedMoment.toDate() : null;\r\n\r\n        if (whichDate === DateRangePicker.StartOfRangeIndicator && this.props.onStartOfRangeChanged) {\r\n            this.props.onStartOfRangeChanged(newDate, event);\r\n        } else if (whichDate === DateRangePicker.EndOfRangeIndicator && this.props.onEndOfRangeChanged) {\r\n            this.props.onEndOfRangeChanged(newDate, event);\r\n        }\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\nimport { Button, Checkbox, DropdownButton, MenuItem, OverlayTrigger, Popover, Radio } from \"react-bootstrap\";\r\nimport { FilterItemOptionsListSelectionType, FilterItemOptionsType, IDateRangeFilter, IFilterItemOptionsList, IFilterOptionsGroup, IOptionItemWithSelectionState } from \"./IFilterItemOptionsList\";\r\nimport { isEmpty, isNil } from \"lodash-es\";\r\n\r\nimport { DateRangePicker } from \"../dateRangePicker/DateRangePicker\";\r\nimport { IDateRangePickerProps } from \"../dateRangePicker/IDateRangePickerProps\";\r\nimport { IQueryFilterPaneProps } from \"./IQueryFilterPaneProps\";\r\nimport { KeyCode } from \"cms-ui-components/KeyCode\";\r\n\r\n/**\r\n * This component is responsible for rendering the Filter Pane used to set filter options on search queries\r\n * @class\r\n */\r\nexport class QueryFilterPane extends React.Component<IQueryFilterPaneProps, any> {\r\n\r\n    /** The css class name to use for no-outline */\r\n    private static NoOutlineCssClassName: string = \"no-outline\";\r\n\r\n    // 0 if the items are to be set as tabstops and -1 if not.\r\n    private tabIndex: number;\r\n\r\n    /**\r\n     * Initializes a new instance of the `QueryFilterPane` class.\r\n     * @constructor\r\n     * @param {IQueryFilterPaneProps} props The properties controlling the layout of this component.\r\n     * @param {any} context The react context object.\r\n     */\r\n    constructor(props: IQueryFilterPaneProps, context: any) {\r\n        super(props, context);\r\n\r\n        if (!props) {\r\n            throw \"props parameter cannot be null\";\r\n        }\r\n\r\n        this.tabIndex = 0;\r\n        this.onKeyDown = this.onKeyDown.bind(this);\r\n    }\r\n\r\n    // Helper method to build an array of selected indexes for a multi-selection option list.\r\n    private static toggleItemAndGetSelectedIndices(indexToToggle: number, values: IOptionItemWithSelectionState[]): number[] {\r\n        values[indexToToggle].selected = !values[indexToToggle].selected;\r\n\r\n        let selectedIndices: number[] = [];\r\n        values.forEach((value, index) => {\r\n            if (value.selected) {\r\n                selectedIndices.push(index);\r\n            }\r\n        });\r\n\r\n        return selectedIndices;\r\n    }\r\n\r\n    /**\r\n     * Renders the search and select component.\r\n     * @method\r\n     * @returns { React.ReactElement<any> } The Search and Select page.\r\n     */\r\n    public render(): React.ReactElement<any> {\r\n\r\n        // Set tabIndex to 0 if isKeyboardNavigable is either undefined/null, or is true.\r\n        this.tabIndex = (isNil(this.props.isKeyboardNavigable) || this.props.isKeyboardNavigable) ? 0 : -1;\r\n\r\n        let divider = this.renderDivider();\r\n        let children: React.ReactElement<any>[] = [];\r\n\r\n        this.props.optionGroups.forEach((optionGroup, index) => {\r\n            if (optionGroup.items.length > 1) {\r\n                children.push(this.renderGroup(optionGroup));\r\n            } else {\r\n                children.push(this.renderItem(optionGroup.items[0], true));\r\n            }\r\n\r\n            // Render a divider between each group\r\n            if (index !== this.props.optionGroups.length - 1) {\r\n                children.push(divider);\r\n            }\r\n        });\r\n\r\n        return (\r\n            <div className=\"query-filter-pane-container\">\r\n                {children}\r\n            </div>\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Renders a div styled to look like a divider\r\n     * @method\r\n     * @returns {React.ReactElement<any>}\r\n     */\r\n    private renderDivider(): React.ReactElement<any> {\r\n        return (\r\n            <div className=\"query-filter-pane-option-set-divider\"></div>\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Renders a single selection list of options as a dropdown button.\r\n     * @param options {IFilterItemOptionsList} The set of filter options.\r\n     * @param callback {function} A callback to invoke when the selection changes\r\n     * @method\r\n     * @returns {React.ReactElement<any>}\r\n     */\r\n    private renderSingleSelectOptionsList(options: IFilterItemOptionsList, callback: (id: number, event: React.SyntheticEvent<any>) => void): React.ReactElement<any> {\r\n\r\n        if (options.values.length === 0) {\r\n            return null;\r\n        }\r\n\r\n        const menuItems = options.values.map((item, index) =>\r\n            <MenuItem tabIndex={this.tabIndex} eventKey={index} key={item.value}>{item.value}</MenuItem>\r\n        );\r\n\r\n        let indexToDefaultValue = options.values.findIndex(item => item.selected);\r\n        if (indexToDefaultValue === -1) {\r\n            indexToDefaultValue = 0;\r\n        }\r\n\r\n        const dropdownButtonTitle = options.values[indexToDefaultValue].value;\r\n\r\n        const dropdownButton = (\r\n            <div className=\"query-filter-pane-dropdown-with-title\">\r\n                <DropdownButton\r\n                        id={\"queryDropdown\" + dropdownButtonTitle.replace(/ /g, \"\")}\r\n                        className=\"query-filter-pane-dropdown themed-btn\"\r\n                        tabIndex={this.tabIndex}\r\n                        title={dropdownButtonTitle}\r\n                        onSelect={(id, event?) => callback(id, event)}>\r\n                    {menuItems}\r\n                </DropdownButton>\r\n            </div>\r\n\r\n        );\r\n        return dropdownButton;\r\n    }\r\n\r\n    /**\r\n     * Renders a single selection list of options as radio button list.\r\n     * @param options {IFilterItemOptionsList} The set of filter options.\r\n     * @param callback {function} A callback to invoke when the selection changes\r\n     * @method\r\n     * @returns {React.ReactElement<any>}\r\n     */\r\n    private renderSingleSelectRadioOptionsList(options: IFilterItemOptionsList, callback: (id: number, event: React.SyntheticEvent<any>) => void): React.ReactElement<any> {\r\n        if (options.values.length === 0) {\r\n            return null;\r\n        }\r\n\r\n        const items = options.values.map((item, index) => {\r\n            let radioButtonClassName = item.selected ? \"glyphicon glyphicon-ok-sign\" : \"glyphicon glyphicon-remove-sign\";\r\n            return (\r\n                <div className=\"row\" key={\"row\" + item.value}>\r\n                    <div className=\"col-xs-12\">\r\n                        <Radio tabIndex={-1} checked={item.selected} key={item.value} onChange={callback.bind(this, index)} onClick={this.onCheckBoxClick}>\r\n                            {(<i className={radioButtonClassName} tabIndex={this.tabIndex} onKeyUp={this.onTabKey} onKeyDown={(eventArgs) => this.onKeyDown(eventArgs, callback.bind(this, index, eventArgs))} />)}\r\n                            {item.value}\r\n                        </Radio>\r\n                    </div>\r\n                </div>\r\n            );\r\n        });\r\n\r\n        let optionsList = (\r\n            <div className=\"query-filter-pane-radiolist-with-title\">\r\n                <div className=\"container query-filter-pane-singleselectlist\">\r\n                    {items}\r\n                </div>\r\n            </div>\r\n        );\r\n\r\n        return optionsList;\r\n    }\r\n\r\n    /** Callback invoked when a key is pressed on one of the checkboxes.\r\n     * If the pressed key is not SPACE, than do nothing except letting the event bubble up to parent components\r\n     * @method\r\n     * @param eventArgs {KeyboardEvent} The arguments relative to the key press event.\r\n     * @param callback {(event) => void} Callback to invoke when the space key is pressed.\r\n     */\r\n    private onKeyDown(eventArgs: React.KeyboardEvent<HTMLElement>, callback: (event: React.KeyboardEvent<HTMLElement>) => void): void {\r\n        if (eventArgs.keyCode === KeyCode.SPACE) {\r\n            eventArgs.preventDefault();\r\n            callback(eventArgs);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Renders a multi-selection list of options as a set of checkboxes.\r\n     * @param options {IFilterItemOptionsList} The set of filter options.\r\n     * @param callback {function} A callback to invoke when the selection changes\r\n     * @method\r\n     * @returns {React.ReactElement<any>}\r\n     */\r\n    private renderMultiSelectOptionsList(options: IFilterItemOptionsList, callback: (index: number, eventArgs: React.SyntheticEvent<any>) => void): React.ReactElement<any> {\r\n\r\n        if (options.values.length === 0) {\r\n            return null;\r\n        }\r\n\r\n        const items = options.values.map((item, index) => {\r\n            let checkBoxClassName = item.selected ? \"glyphicon glyphicon-check\" : \"glyphicon glyphicon-unchecked\";\r\n\r\n            let helpElement: React.ReactElement<any> = null;\r\n            if (!isNil(item.tooltip) && !isEmpty(item.tooltip)) {\r\n                helpElement = (\r\n                    <OverlayTrigger trigger=\"click\" rootClose placement=\"right\" overlay={<Popover id={\"info-\" + index}>{item.tooltip}</Popover>} >\r\n                        <Button bsSize=\"xsmall\" tabIndex={this.tabIndex} title={item.tooltip}>\r\n                            <i className=\"glyphicon glyphicon-info-sign\"/>\r\n                        </Button>\r\n                    </OverlayTrigger>\r\n                );\r\n            }\r\n\r\n            return (\r\n                <div className=\"row\" key={\"row\" + item.value}>\r\n                    <div className=\"col-xs-10\" >\r\n                        <Checkbox tabIndex={-1} checked={item.selected} key={item.value} onChange={callback.bind(this, index)} onClick={this.onCheckBoxClick}>\r\n                            {(<i className={checkBoxClassName} tabIndex={this.tabIndex} onKeyUp={this.onTabKey} onKeyDown={(eventArgs) => this.onKeyDown(eventArgs, callback.bind(this, index, eventArgs))} />)}\r\n                            {item.value}\r\n                        </Checkbox>\r\n                    </div>\r\n                    <div className=\"col-xs-2\" >\r\n                        {helpElement}\r\n                    </div>\r\n                </div>\r\n            );\r\n        });\r\n\r\n        const optionsList = (\r\n            <div className=\"query-filter-pane-multiselectlist-with-title\">\r\n                <div className=\"container query-filter-pane-multiselectlist\">\r\n                    {items}\r\n                </div>\r\n            </div>\r\n        );\r\n        return optionsList;\r\n    }\r\n\r\n    /**\r\n     * The on check box click event add a no-outline css class name to the checkbox parent div to prevent click on checkbox, on tab navigation, we want to remove the no-outline class\r\n     * @param event {any} the onKeyUp event\r\n     */\r\n    private onTabKey(event: any): void {\r\n        if (event.which === KeyCode.TAB) {\r\n            let checkBoxLabelTag = event.currentTarget.parentElement;\r\n            if (!checkBoxLabelTag.className) {\r\n                return;\r\n            }\r\n\r\n            if (checkBoxLabelTag.className.indexOf(QueryFilterPane.NoOutlineCssClassName) > -1) {\r\n                let classNameSplit = checkBoxLabelTag.className.split(\" \");\r\n                let index = classNameSplit.indexOf(QueryFilterPane.NoOutlineCssClassName);\r\n                classNameSplit.splice(index, 1);\r\n                checkBoxLabelTag.className = classNameSplit.join(\" \");\r\n            }\r\n        }\r\n    }\r\n\r\n    /**\r\n     * The on check box click event add a no-outline css class name to the checkbox parent div to prevent click on checkbox, the on focus highlight is shown\r\n     * @param event {any} the onClick event\r\n     */\r\n    private onCheckBoxClick(event: any): void {\r\n        let checkBoxLabelTag = event.currentTarget.parentElement;\r\n        checkBoxLabelTag.className = !!checkBoxLabelTag.className ? (\r\n            checkBoxLabelTag.className.indexOf(QueryFilterPane.NoOutlineCssClassName) > -1 ?\r\n                checkBoxLabelTag.className :\r\n                checkBoxLabelTag.className + \" \" + QueryFilterPane.NoOutlineCssClassName) :\r\n            QueryFilterPane.NoOutlineCssClassName;\r\n    }\r\n\r\n    private renderGroup(groupToRender: IFilterOptionsGroup): React.ReactElement<any> {\r\n        // The group name is taken as the name of the first item\r\n        const groupName = groupToRender.items[0].name;\r\n\r\n        let children: React.ReactElement<any>[] = [];\r\n\r\n        groupToRender.items.forEach(item => {\r\n            children.push(this.renderItem(item, false));\r\n        });\r\n\r\n        return (<div className=\"query-filter-pane-group\">\r\n            <div className=\"query-filter-pane-group-title\">\r\n                {groupName}\r\n            </div>\r\n            <div className=\"query-filter-pane-group-items\">\r\n                {children}\r\n            </div>\r\n        </div>);\r\n    }\r\n\r\n    /**\r\n     * Renders an item.\r\n     * @param itemToRender {IDateRangeFilter | IFilterItemOptionsList} The filter item to render\r\n     * @method\r\n     * @returns { React.ReactElement<any> } A div containing the dropdown.\r\n     */\r\n    private renderItem(itemToRender: IDateRangeFilter | IFilterItemOptionsList, showItemName: boolean): React.ReactElement<any> {\r\n        let element: React.ReactElement<any> = null;\r\n\r\n        if (itemToRender.$type === FilterItemOptionsType.StringList) {\r\n            let stringList: IFilterItemOptionsList = itemToRender as IFilterItemOptionsList;\r\n            if (stringList.selectionType === FilterItemOptionsListSelectionType.SingleSelectDropdown) {\r\n                element = this.renderSingleSelectOptionsList(stringList, (index, event: React.SyntheticEvent<any>) => stringList.onSelectedOptionsChanged([index], event));\r\n            } else if (stringList.selectionType === FilterItemOptionsListSelectionType.SingleSelectRadio) {\r\n                element = this.renderSingleSelectRadioOptionsList(stringList, (index, event: React.SyntheticEvent<any>) => stringList.onSelectedOptionsChanged([index], event));\r\n            } else {\r\n                element = this.renderMultiSelectOptionsList(stringList, (index, event: React.SyntheticEvent<any>) => {\r\n                    let selectedIndices: number[] = QueryFilterPane.toggleItemAndGetSelectedIndices(index, stringList.values);\r\n                    stringList.onSelectedOptionsChanged(selectedIndices, event);\r\n                });\r\n            }\r\n        } else {\r\n            let dateRange: IDateRangeFilter = itemToRender as IDateRangeFilter;\r\n            element = this.renderDateRange(dateRange);\r\n        }\r\n\r\n        let titleElement: React.ReactElement<any> = null;\r\n        if (showItemName) {\r\n            titleElement = (\r\n                <div className=\"query-filter-pane-option-set-title\">\r\n                    {itemToRender.name}\r\n                </div>\r\n            );\r\n        }\r\n\r\n        return (\r\n            <div className=\"query-filter-pane-option-set\">\r\n                {titleElement}\r\n                {element}\r\n            </div>\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Renders the date pickers for the custom date range\r\n     * @param dateRangeFilter {IDateRangeFilter} The props for the date range\r\n     * @method\r\n     * @returns { React.ReactElement<any> } A div containing the date pickers.\r\n     */\r\n    private renderDateRange(dateRangeFilter: IDateRangeFilter): React.ReactElement<any> {\r\n        let props: IDateRangePickerProps = {\r\n            maxStartOfRangeDate: dateRangeFilter.maxStartOfRangeDate,\r\n            maxEndOfRangeDate: dateRangeFilter.maxEndOfRangeDate,\r\n            startDate: dateRangeFilter.startDate,\r\n            endDate: dateRangeFilter.endDate,\r\n            onStartOfRangeChanged: dateRangeFilter.onStartOfRangeChanged,\r\n            onEndOfRangeChanged: dateRangeFilter.onEndOfRangeChanged,\r\n            isKeyboardNavigable: this.props.isKeyboardNavigable\r\n        };\r\n\r\n        return (<DateRangePicker {...props} />);\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\nimport { Notification } from \"cms-ui-components/notifications/notification/Notification\";\r\nimport { INotificationProps } from \"cms-ui-components/notifications/notification/INotificationProps\";\r\n\r\n/**\r\n * Renders a notification that manages its expandable state internally.\r\n * @class\r\n */\r\nexport class SearchHint extends React.Component<INotificationProps, { expanded: boolean }> {\r\n\r\n    /**\r\n     * Initializes a new instance of the `SearchHint` class.\r\n     * @constructor\r\n     * @param {INotificationProps} props The React props\r\n     * @param {any} context The react context.\r\n     */\r\n    constructor(props: INotificationProps, ctx: any) {\r\n        super(props, ctx);\r\n\r\n        this.state = {\r\n            expanded: false\r\n        };\r\n\r\n        this.toggleSearchHintDetail = this.toggleSearchHintDetail.bind(this);\r\n    }\r\n\r\n    /**\r\n     * Renders the SearchHint component.\r\n     * @method\r\n     * @returns {React.ReactElement<INotificationProps>} The SearchHint element.\r\n     */\r\n    public render(): React.ReactElement<INotificationProps> {\r\n\r\n        const props = {\r\n            ...this.props,\r\n            expandCollapsible: this.toggleSearchHintDetail,\r\n            notification: { ...this.props.notification, expanded: this.state.expanded }\r\n        };\r\n\r\n        return (\r\n            <Notification {...props} />\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Expand/collapse the detail of the search hint.\r\n     * @method\r\n     */\r\n    private toggleSearchHintDetail(): void {\r\n        this.setState({ expanded: !this.state.expanded });\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport * as Autosuggest from \"react-autosuggest\";\r\n\r\nimport { InputGroup, Glyphicon, InputGroupAddon } from \"react-bootstrap\";\r\nimport { ISearchWithAutosuggestProps } from \"./ISearchWithAutosuggestProps\";\r\n\r\n/**\r\n * SearchWithAutosuggest react mdoule class\r\n * @class\r\n */\r\nexport class SearchWithAutosuggest extends React.Component<ISearchWithAutosuggestProps, {}> {\r\n    /**\r\n     * Initializes a new instance of the `SearchWithAutouggest` class.\r\n     * @constructor\r\n     * @param {ISearchWithAutosuggestProps} props The properties controlling the layout of this component.\r\n     * @param {any} context The react context object.\r\n     */\r\n    constructor(props: ISearchWithAutosuggestProps, context: any) {\r\n        super(props, context);\r\n\r\n        if (!props) {\r\n            throw \"props parameter cannot be null\";\r\n        }\r\n    }\r\n\r\n    /**\r\n     * React render method\r\n     */\r\n    public render(): React.ReactElement<any> {\r\n        const renderSuggestion = (suggestion: string) => (\r\n            <div className={\"suggestion-item \" + ((!!this.props.catalystSuggestions && this.props.catalystSuggestions.indexOf(suggestion) > -1) ? \"catalyst-suggestion\" : \"\")}>\r\n                {suggestion}\r\n            </div>\r\n        );\r\n\r\n        const getSuggestionValue = (suggestionItem: string) => {\r\n            return suggestionItem;\r\n        };\r\n\r\n        let allowSearch = !!this.props.autoSuggestInputProps.value ? this.props.allowSearch ? true : false : true;\r\n        let searchGlyph = allowSearch ? \"search\" : \"remove\";\r\n        let searchIcon = (<Glyphicon glyph={searchGlyph} />);\r\n\r\n        const suggestions = !!this.props.catalystSuggestions ? this.props.catalystSuggestions.concat(this.props.suggestions) : this.props.suggestions;\r\n        let searchBox = (\r\n            <Autosuggest\r\n                suggestions={suggestions}\r\n                onSuggestionsFetchRequested={this.props.onSuggestionsFetchRequested}\r\n                onSuggestionsClearRequested={this.props.onSuggestionsClearRequested}\r\n                onSuggestionSelected={this.props.onSuggestionSelected}\r\n                getSuggestionValue={getSuggestionValue}\r\n                renderSuggestion={renderSuggestion}\r\n                inputProps={this.props.autoSuggestInputProps}\r\n                shouldRenderSuggestions={this.props.shouldRenderSuggestions}\r\n            />\r\n        );\r\n\r\n        let searchBar = (\r\n            <InputGroup>\r\n                <InputGroup.Addon onClick={(event: React.SyntheticEvent<InputGroupAddon>) => this.props.onSearchExecute(event)} className={searchGlyph}>\r\n                    {searchIcon}\r\n                </InputGroup.Addon>\r\n                {searchBox}\r\n            </InputGroup>\r\n        );\r\n\r\n        return (\r\n            <div className=\"searchbox-container\">\r\n                <form onSubmit={(e: React.FormEvent<HTMLFormElement>) => {\r\n                    e.preventDefault();\r\n                    this.props.onSearchExecute(e);\r\n                }}>\r\n                    {searchBar}\r\n                </form>\r\n            </div>\r\n        );\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport * as ReactDom from \"react-dom\";\r\n\r\nimport { Button, DropdownButton, Glyphicon, MenuItem, OverlayTrigger, Popover } from \"react-bootstrap\";\r\nimport { IQueryFilterPaneProps, creativeSearchProvidersProps } from \"../components/queryFilterPane/IQueryFilterPaneProps\";\r\nimport { cloneDeep, isEmpty } from \"lodash-es\";\r\n\r\nimport { AutoSizer } from \"react-virtualized\";\r\nimport { CatalystPagedVirtualCollection } from \"../components/catalystVirtualCollections/CatalystPagedVirtualCollection\";\r\nimport { CatalystPagedVirtualGrid } from \"../components/catalystVirtualCollections/CatalystPagedVirtualGrid\";\r\nimport { DockPosition } from \"cms-ui-components/docker/DockPosition\";\r\nimport { ExpansionStyle } from \"cms-ui-components/docker/ExpansionStyle\";\r\nimport { GridImageTile } from \"../components/imageTile/GridImageTile\";\r\nimport { ICatalystVirtualCollectionProps } from \"../components/catalystVirtualCollections/ICatalystVirtualCollectionProps\";\r\nimport { ICreativeSearchProps } from  \"../creativeSearch/ICreativeSearchProps\";\r\nimport { IImageTileProps } from \"../components/imageTile/IImageTileProps\";\r\nimport { ISearchProps } from \"./ISearchProps\";\r\nimport { ISortOrderProps } from \"./ISortOrderProps\";\r\nimport { ImageTile } from \"../components/imageTile/ImageTile\";\r\nimport { QueryFilterPane } from \"../components/queryFilterPane/QueryFilterPane\";\r\nimport { ResultsDisplayModeEnum } from \"../../models/displayMode/ResultsDisplayModeEnum\";\r\nimport { RichNotification } from \"cms-ui-components/richNotification/RichNotification\";\r\nimport { SearchHint } from \"../components/searchHint/SearchHint\";\r\nimport { SearchWithAutosuggest } from \"../components/searchWithAutosuggest/SearchWithAutosuggest\";\r\nimport { SingleDocker } from \"cms-ui-components/docker/SingleDocker\";\r\n\r\n/**\r\n * This component is a React component which is responsible for rendering the Search base experience in this app.\r\n * @class\r\n */\r\nexport class SearchUI extends React.Component<ISearchProps, {}> {\r\n\r\n    /**\r\n     * A ref to the docker main div, used to automatically scroll to the top when page navigation occurs.\r\n     * @type {Element}\r\n     */\r\n    protected dockerMainRef: Element;\r\n\r\n    // A buffer variable used to store the current scroll position in the editorial search view.\r\n    private scrollTopEditorialSearch: number;\r\n\r\n    // A buffer variable used to store the current scroll position in the creative search view, per-provider.\r\n    private scrollTopCreativeSearch: { [provider: string]: number };\r\n\r\n    /**\r\n     * Initializes a new instance of the `SearchUI` class.\r\n     * @constructor\r\n     * @param {ISearchProps} props The properties controlling the layout of this component.\r\n     * @param {any} context The react context object.\r\n     */\r\n    constructor(props: ISearchProps, context: any) {\r\n        super(props, context);\r\n\r\n        if (!this.props) {\r\n            throw \"props parameter cannot be null\";\r\n        }\r\n\r\n        this.scrollTopEditorialSearch = 0;\r\n        this.scrollTopCreativeSearch = {};\r\n\r\n        this.renderPagedComponent = this.renderPagedComponent.bind(this);\r\n        this.onScroll = this.onScroll.bind(this);\r\n    }\r\n\r\n    /**\r\n     * When the search view is about to be unmounted, fire off an action to save the current scroll position.\r\n     */\r\n    public componentWillUnmount(): void {\r\n        this.saveLatestScrollPosition();\r\n    }\r\n\r\n    /**\r\n     * Renders the search and select component.\r\n     * @method\r\n     * @returns { React.ReactElement<ISearchProps> } The Search page.\r\n     */\r\n    public render(): React.ReactElement<ISearchProps> {\r\n        let serviceErrors: React.ReactElement<any>;\r\n        let searchResultsBrowser: React.ReactElement<any>;\r\n\r\n        if (this.props.imageTiles.length === 0 && !!this.props.serviceError) {\r\n            serviceErrors = this.renderServiceErrors();\r\n        }\r\n\r\n        let searchTip = this.renderSearchHints();\r\n        searchResultsBrowser = this.renderBrowserComponent();\r\n\r\n        let filterPane = this.renderFilterPane(this.props.getRenderFilterPaneProps());\r\n        let sortOrderDropdown = this.renderSortOrderDropdown();\r\n\r\n        let showHideFilterOptionText = this.props.showFilterOptions ? \"Hide Filters  \" : \"Show Filters  \";\r\n        let showHideFilterOptionGlyph = this.props.showFilterOptions ? \"chevron-left\" : \"chevron-right\";\r\n\r\n        let dockerSidebarWidth: number = 250;\r\n        let btnClassName = \"btn btn-default btn-sm\";\r\n        let className = \"image-search \" + this.props.pageName;\r\n\r\n        return (\r\n            <div className={className}>\r\n                <div className=\"search-bar\">\r\n                    <SingleDocker dockPosition={DockPosition.Left}>\r\n                        <SingleDocker.Sidebar expandedWidth={dockerSidebarWidth} expansionStyle={ExpansionStyle.Docked} isExpanded={true}>\r\n                            <div className=\"filter-container\">\r\n                                <Button className={\"filterbutton themed-btn\"} onClick={() => this.props.onToggleFilterOptionsVisibility !== null ? this.props.onToggleFilterOptionsVisibility() : null} >\r\n                                    {showHideFilterOptionText}\r\n                                    <Glyphicon glyph={showHideFilterOptionGlyph} />\r\n                                </Button>\r\n                            </div>\r\n                        </SingleDocker.Sidebar>\r\n                        <SingleDocker.Main overflowX={\"unset\"} overflowY={\"unset\"}>\r\n                            <SearchWithAutosuggest {...this.props.searchWithAutosuggestProps} />\r\n                            <div className=\"sort-selector\">\r\n                                {sortOrderDropdown}\r\n                            </div>\r\n                            <div className=\"grid-selector\">\r\n                                <div id=\"grid-selector-label\" style={{ display: \"none\" }}>Grid Selector</div>\r\n                                <button aria-labelledby=\"grid-selector-label\" type=\"button\" className={btnClassName + this.getSelectedBtnCssName(ResultsDisplayModeEnum.Grid)} onClick={() => this.onDisplayModeChanged(ResultsDisplayModeEnum.Grid)}>\r\n                                    <span className=\"glyphicon glyphicon-th\"></span>\r\n                                </button>\r\n                                <button aria-labelledby=\"grid-selector-label\" type=\"button\" className={btnClassName + this.getSelectedBtnCssName(ResultsDisplayModeEnum.Mosaic)} onClick={() => this.onDisplayModeChanged(ResultsDisplayModeEnum.Mosaic)}>\r\n                                    <span className=\"glyphicon glyphicon-align-justify\"></span>\r\n                                </button>\r\n                            </div>\r\n                        </SingleDocker.Main>\r\n                    </SingleDocker>\r\n                </div>\r\n                <div className=\"filter-and-results\">\r\n                    <SingleDocker dockPosition={DockPosition.Left}>\r\n                        <SingleDocker.Sidebar width={0} expandedWidth={dockerSidebarWidth} expansionStyle={ExpansionStyle.Docked} isExpanded={this.props.showFilterOptions}>\r\n                            {filterPane}\r\n                        </SingleDocker.Sidebar>\r\n                        <SingleDocker.Main overflowX={\"hidden\"} overflowY={\"hidden\"} ref={(dockerMain) => this.dockerMainRef = ReactDom.findDOMNode(dockerMain) as Element}>\r\n                            {searchTip}\r\n                            {serviceErrors}\r\n                            {searchResultsBrowser}\r\n                        </SingleDocker.Main>\r\n                    </SingleDocker>\r\n                </div>\r\n            </div>\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Renders a div containing a set of search hints, one for each failed validation rule.\r\n     * Nothing if all rules are succesfully validate.\r\n     * @method\r\n     * @returns {React.ReactElement<any>} The search hints\r\n     */\r\n    protected renderSearchHints(): React.ReactElement<any> {\r\n        if (this.props.searchWithAutosuggestProps.searchHintsNotifications.length === 0) {\r\n            return null;\r\n        }\r\n\r\n        const searchHints = this.props.searchWithAutosuggestProps.searchHintsNotifications.map((notification, index) => {\r\n            const searchHintProps = {\r\n                id: index,\r\n                notification: {\r\n                    itemType: notification.itemType,\r\n                    titlePrefix: notification.titlePrefix,\r\n                    title: notification.title,\r\n                    detail: notification.detail,\r\n                    expanded: notification.expanded\r\n                },\r\n                setBackgroundColor: true\r\n            };\r\n\r\n            return <SearchHint {...searchHintProps} />;\r\n        });\r\n\r\n        return <div>{searchHints}</div>;\r\n    }\r\n\r\n    /**\r\n     * Renders an error notification for a failed service call.\r\n     * @method\r\n     * @returns { React.ReactElement<any> } A div containing the error notification component.\r\n     */\r\n    protected renderServiceErrors(): React.ReactElement<any> {\r\n        if (!this.props.serviceError) {\r\n            return null;\r\n        }\r\n\r\n        const notificationProps = {\r\n            richNotification: this.props.serviceError,\r\n            setBackgroundColor: true\r\n        };\r\n\r\n        let serviceError = <RichNotification {...notificationProps} />;\r\n\r\n        return (\r\n            <div className=\"service-error-container\">\r\n                {serviceError}\r\n            </div>\r\n        );\r\n    }\r\n\r\n    /**\r\n     * invoked event opens the image preview modal\r\n     * @param id {string} the image entity id in cats tenant\r\n     * @param event {Event} the event that triggered this handler\r\n     */\r\n    protected onImageTileInvoked(id: string, event: React.SyntheticEvent<any>): void {\r\n        if (this.props.onImageTileInvoked) {\r\n            this.props.onImageTileInvoked(id, event);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Invoked when one of the display mode buttons is invoked.\r\n     * @param resultsDisplayMode {ResultsDisplayModeEnum} the mode to switch to\r\n     */\r\n    protected onDisplayModeChanged(resultsDisplayMode: ResultsDisplayModeEnum): void {\r\n\r\n        // switching between `mosaic` and `grid` layout does not unmount the search view, hence fire off an action in this case too to save\r\n        // the latest scroll position.\r\n        this.saveLatestScrollPosition();\r\n\r\n        if (this.props.onDisplayModeChanged) {\r\n            this.props.onDisplayModeChanged(resultsDisplayMode);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Invoked when the sort order is changed.\r\n     * @param index {number} which item has been selected\r\n     * @param event {Event} which triggered this handler\r\n     */\r\n    protected onSortOrderChanged(index: number, event?: React.ChangeEvent<DropdownButton>): void {\r\n        if (this.props.sortOrderProps.onSelectedOptionChanged) {\r\n            this.props.sortOrderProps.onSelectedOptionChanged(index, event);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Invoked when retry button is clicked.\r\n     * @param event {Event} which triggered this handler\r\n     */\r\n    protected onRetryClicked(event: React.MouseEvent<Button>): void {\r\n        if (this.props.onRetryClicked) {\r\n            this.props.onRetryClicked(event);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Renders an grid tile.\r\n     * @method\r\n     * @param props {IImageTileProps} the props for the image\r\n     * @returns {React.ReactElement<any>} A div element containing a thumbnail.\r\n     */\r\n    protected renderGridTile(props: IImageTileProps): React.ReactElement<IImageTileProps> {\r\n\r\n        const tileInvokedHandler = this.onImageTileInvoked ? this.onImageTileInvoked.bind(this, props.id) : () => { return; };\r\n        return (\r\n            <GridImageTile\r\n                id={props.id}\r\n                key={props.id}\r\n                sourceHref={props.sourceHref}\r\n                title={props.title}\r\n                imgWidth={props.imgWidth}\r\n                imgHeight={props.imgHeight}\r\n                supportsMultiSelection={props.supportsMultiSelection}\r\n                onImageTileInvoked={tileInvokedHandler}\r\n                onItemInvoked={(_itemIndex, event) => tileInvokedHandler(event)}\r\n                onAddToLightboxInvoked={props.onAddToLightboxInvoked}\r\n                altText={props.altText} />\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Renders an image tile.\r\n     * @method\r\n     * @param props {IImageTileProps} the props for the image\r\n     * @returns {React.ReactElement<any>} A div element containing a thumbnail.\r\n     */\r\n    protected renderMosaicTile(props: IImageTileProps): React.ReactElement<IImageTileProps> {\r\n\r\n        const tileInvokedHandler = this.onImageTileInvoked ? this.onImageTileInvoked.bind(this, props.id) : () => { return; };\r\n        return (\r\n            <ImageTile\r\n                id={props.id}\r\n                key={props.id}\r\n                sourceHref={props.sourceHref}\r\n                title={props.title}\r\n                imgWidth={props.imgWidth}\r\n                imgHeight={props.imgHeight}\r\n                supportsMultiSelection={props.supportsMultiSelection}\r\n                onImageTileInvoked={tileInvokedHandler}\r\n                onItemInvoked={(_itemIndex, event) => tileInvokedHandler(event)}\r\n                onAddToLightboxInvoked={props.onAddToLightboxInvoked}\r\n                altText={props.altText} />\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Renders the paged component.\r\n     * @method\r\n     * @param containerWidth {number} The container width\r\n     * @returns {React.ReactElement<any>} The paged component\r\n     */\r\n    protected renderPagedComponent(containerHeight: number, containerWidth: number): React.ReactElement<ICatalystVirtualCollectionProps> {\r\n\r\n        const virtualCollectionMosaicProps = {\r\n            ...this.props as Object,\r\n            onScroll: this.onScroll,\r\n            containerHeight,\r\n            containerWidth,\r\n            renderTile: this.renderMosaicTile\r\n        } as ICatalystVirtualCollectionProps;\r\n\r\n        const virtualCollectionGridProps = {\r\n            ...this.props as Object,\r\n            onScroll: this.onScroll,\r\n            containerHeight,\r\n            containerWidth,\r\n            renderTile: this.renderGridTile\r\n        } as ICatalystVirtualCollectionProps;\r\n\r\n        return this.props.resultsDisplayMode === ResultsDisplayModeEnum.Grid\r\n            ? <CatalystPagedVirtualGrid {...virtualCollectionGridProps} />\r\n            : <CatalystPagedVirtualCollection {...virtualCollectionMosaicProps} />;\r\n    }\r\n\r\n    /**\r\n     * Function that binds page navigation logic with automatic scroll to the top.\r\n     * @method\r\n     * @param pageNavigation {(event) => void} The actual page navigation function (next or previous page).\r\n     * @param event {Event} the event that triggered this handler\r\n     */\r\n    protected changePageAndScrollToTheTop(pageNavigation: (event: React.MouseEvent<Button>) => void, event: React.MouseEvent<Button>): void {\r\n        pageNavigation(event);\r\n        this.dockerMainRef.scrollTop = 0;\r\n    }\r\n\r\n    /**\r\n     * Gets the css class name for grid selection icon\r\n     * @method\r\n     * @param buttonForMode { ResultsDisplayModeEnum } Display mode represented by this button\r\n     * @returns { string } button class names\r\n     */\r\n    protected getSelectedBtnCssName(buttonForMode: ResultsDisplayModeEnum): string {\r\n        const selectedBtnCss = \" selected-btn\";\r\n        if (buttonForMode === this.props.resultsDisplayMode) {\r\n            return selectedBtnCss;\r\n        }\r\n        return \"\";\r\n    }\r\n\r\n    /**\r\n     * Creates sort order dropdown.\r\n     * @method\r\n     * @returns { React.ReactElement<any> } The react elements to render the Sort order dropdown.\r\n     */\r\n    protected renderSortOrderDropdown(): React.ReactElement<any> {\r\n        let sortOrderProps: ISortOrderProps = this.props.sortOrderProps;\r\n\r\n        if (isEmpty(sortOrderProps.options) ||\r\n            (sortOrderProps.selectedOption < 0 || sortOrderProps.selectedOption >= sortOrderProps.options.length)) {\r\n            return null;\r\n        }\r\n\r\n        const menuItems = sortOrderProps.options.map((_value, index) => {\r\n            return (\r\n                <MenuItem key={index} eventKey={index} active={index === sortOrderProps.selectedOption}>{sortOrderProps.options[index]}</MenuItem>\r\n            );\r\n        });\r\n\r\n        const title = sortOrderProps.options[sortOrderProps.selectedOption];\r\n        const dropdown = (\r\n            <DropdownButton\r\n                bsStyle=\"primary\"\r\n                title={title}\r\n                onSelect={(eventKey, event?: React.ChangeEvent<DropdownButton>) => this.onSortOrderChanged(eventKey, event)}\r\n                id=\"search-sort-order-dropdown\">\r\n                {menuItems}\r\n            </DropdownButton>\r\n        );\r\n        return dropdown;\r\n    }\r\n\r\n    /**\r\n     * Returns an instance of a loading spinner or a thumbnails view based on the current component state.\r\n     * @method\r\n     * @returns {React.ReactElement<any>} The component that will render the data.\r\n     */\r\n    protected renderBrowserComponent(): React.ReactElement<any> {\r\n        const isPageLoading = this.props.imageTiles.length === 0 && this.props.childDocumentsBeingLoaded;\r\n        let component: React.ReactElement<any>;\r\n        let toolTip: React.ReactElement<any>;\r\n        let pageBrowserContentComponent: React.ReactElement<any>;\r\n\r\n        let browserContainerClassName = !!this.props.serviceError ? \" with-service-error\" : \"\";\r\n\r\n        const activePageIndex = this.props.pagedImagesProps.activePageIndex;\r\n        if (this.props.pagedImagesProps.pageDescriptors[activePageIndex] &&\r\n            !this.props.onlyFirstPageLoaded &&    // show the RETRY UI only if we have loaded more than one page.\r\n            this.props.pagedImagesProps.pageDescriptors[activePageIndex].isLast) {\r\n\r\n            if (!!this.props.serviceError) {\r\n                toolTip = (\r\n                    <Popover className=\"tooltip-service-error\" id=\"tooltip\">{this.renderServiceErrors()}</Popover>\r\n                );\r\n                pageBrowserContentComponent = (\r\n                    <OverlayTrigger trigger={\"hover\"} placement=\"right\" overlay={toolTip}>\r\n                        <Button className=\"themed-btn search-error-retry\" onClick={(event) => this.onRetryClicked(event)}>\r\n                            <span>Error please retry </span><span className=\"glyphicon glyphicon-repeat\" aria-hidden=\"true\"></span> <span className=\"glyphicon-class\"></span>\r\n                        </Button>\r\n                    </OverlayTrigger>\r\n                );\r\n            } else {\r\n                pageBrowserContentComponent = this.props.renderNextPageResultsLoadingComponent();\r\n\r\n                if (!!pageBrowserContentComponent) {\r\n                    browserContainerClassName = \" loading \";\r\n                }\r\n            }\r\n        }\r\n\r\n        if (isPageLoading) {\r\n            component = this.props.renderFirstPageLoadingMessageComponent();\r\n        } else if (!isPageLoading && this.props.imageTiles.length === 0 && !this.props.serviceError) {\r\n            component = (\r\n                <div className=\"search-results-no-results\">No results</div>\r\n            );\r\n        } else {\r\n            component = (\r\n                <div style={{ height: \"100%\" }}>\r\n                    <AutoSizer onResize={({ height, width }) => {this.props.pagedImagesProps.canvasSizeChanged(width, height); }}>\r\n                        {({ height, width }) => {\r\n                            return (\r\n                                <div style={{ height, width }}>\r\n                                    {this.renderPagedComponent(height, width)}\r\n                                    {pageBrowserContentComponent !== undefined ?\r\n                                        <div className=\"page-browser\">\r\n                                            <div className=\"navigation\">\r\n                                                <div className=\"content\">\r\n                                                    {pageBrowserContentComponent}\r\n                                                </div>\r\n                                            </div>\r\n                                        </div> : null}\r\n                                </div>\r\n                            );\r\n                        }}\r\n                    </AutoSizer>\r\n                </div>\r\n            );\r\n        }\r\n\r\n        return (\r\n            <div className={\"search-results\" + browserContainerClassName}>\r\n                {component}\r\n                {this.props.children}\r\n            </div>\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Creates the filter pane.\r\n     * @method\r\n     * @returns { React.ReactElement<any> } The react elements to render the FilterPane.\r\n     */\r\n    protected renderFilterPane(queryFilterPaneProps: IQueryFilterPaneProps): React.ReactElement<any> {\r\n        if (this.props.pageName !== \"creative\") {\r\n            return <QueryFilterPane {...queryFilterPaneProps} />;\r\n        }\r\n\r\n        const { onSelectedOptionsChanged } = creativeSearchProvidersProps(queryFilterPaneProps);\r\n        const enrichedProviderProps = cloneDeep(queryFilterPaneProps);\r\n\r\n        creativeSearchProvidersProps(enrichedProviderProps).onSelectedOptionsChanged = (selectedIndices: number[], event: React.SyntheticEvent<any>) => {\r\n            this.saveLatestScrollPosition();\r\n            onSelectedOptionsChanged(selectedIndices, event);\r\n        };\r\n\r\n        return (\r\n            <QueryFilterPane {...enrichedProviderProps} />\r\n        );\r\n    }\r\n\r\n    /**\r\n     * When the user scrolls, save into buffer variables the scroll position, in order to have them ready to be saved in the state later on\r\n     * (when the search view is changed or the user changes the display mode from/to grid/mosaic).\r\n     * Invoke any additional callback if provided (used to manage the incremental load of new data when the user scrolls beyond a certain threshold).\r\n     * @method\r\n     * @param {{ scrollTop: number, scrollHeight: number }} scrollParams - An object containing the scroll info.\r\n     */\r\n    private onScroll(scrollParams: { scrollTop: number, scrollHeight: number }): void {\r\n        if (this.props.pageName === \"editorial\") {\r\n            this.scrollTopEditorialSearch = scrollParams.scrollTop;\r\n        } else {\r\n            const creativeSearchProps = this.props as ICreativeSearchProps;\r\n            this.scrollTopCreativeSearch[creativeSearchProps.creativeProvider] = scrollParams.scrollTop;\r\n        }\r\n\r\n        if (this.props.onScroll) {\r\n            this.props.onScroll(scrollParams);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * When switching from `editorial` or `creative` search to another view, save the latest scroll position by calling the provided callback.\r\n     * @method\r\n     */\r\n    private saveLatestScrollPosition(): void {\r\n        if (this.props.pageName === \"editorial\" || this.props.pageName === \"creative\") {\r\n            let scrollTop;\r\n            if (this.props.pageName === \"editorial\") {\r\n                scrollTop = this.scrollTopEditorialSearch;\r\n            } else {\r\n                const creativeSearchProps = this.props as ICreativeSearchProps;\r\n                scrollTop = this.scrollTopCreativeSearch[creativeSearchProps.creativeProvider];\r\n            }\r\n            this.props.onSearchViewWillUnmount(scrollTop);\r\n        }\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { HeaderLinkPageType } from \"../../presentation-logic/dataflows/appHeaderSection/HeaderLinkPage\";\r\nimport { IFailedAction } from \"cms-ui-components/errorNotification/IFailedAction\";\r\nimport { IImageTileProps } from \"../components/imageTile/IImageTileProps\";\r\nimport { IPagedComponentProps } from \"cms-ui-components/paging/IPagedComponentProps\";\r\nimport { IPagedVirtualCollectionProps } from \"cms-ui-components/pagedVirtualCollection/IPagedVirtualCollectionProps\";\r\nimport { IQueryFilterPaneProps } from \"../components/queryFilterPane/IQueryFilterPaneProps\";\r\nimport { IRichNotification } from \"cms-ui-components/richNotification/IRichNotification\";\r\nimport { ISearchWithAutosuggestProps } from \"../components/searchWithAutosuggest/ISearchWithAutosuggestProps\";\r\nimport { ISortOrderProps } from \"./ISortOrderProps\";\r\nimport { ResultsDisplayModeEnum } from \"../../models/displayMode/ResultsDisplayModeEnum\";\r\n\r\n/**\r\n * The Search set of props.\r\n * @interface\r\n */\r\nexport interface ISearchProps {\r\n\r\n    /**\r\n     * A string that represents the active page (Editorial, Creative or Lightbox)\r\n     * @type { HeaderLinkPageType }\r\n     */\r\n    pageName: HeaderLinkPageType;\r\n\r\n    /**\r\n     * A flag that indicates if only the first page of data have been loaded (true) or if more than one page of data have been loaded (true).\r\n     * @type { boolean }\r\n     */\r\n    onlyFirstPageLoaded: boolean;\r\n\r\n    /**\r\n     * Reads the QueryFilterPane props from the props.\r\n     * @method\r\n     * @returns { IQueryFilterPaneProps } The FilterPane props.\r\n     */\r\n    getRenderFilterPaneProps: () => IQueryFilterPaneProps;\r\n\r\n    /**\r\n     * Returns an instance of an element to indicate that more results are loading.\r\n     * @method\r\n     * @returns {React.ReactElement<any>} The component that will render the data.\r\n     */\r\n    renderNextPageResultsLoadingComponent: () => React.ReactElement<any>;\r\n\r\n    /**\r\n     * Returns an instance of an element to indicate that first pageresults are loading.\r\n     * @method\r\n     * @returns {React.ReactElement<any>} The component that will render the data.\r\n     */\r\n    renderFirstPageLoadingMessageComponent: () => React.ReactElement<any>;\r\n\r\n    /** True if the filter pane is to be shown (false if it's collapsed)\r\n     * @type {boolean}\r\n     */\r\n    showFilterOptions: boolean;\r\n\r\n    /** Props for search\r\n     * @type {ISearchWithAutosuggestProps}\r\n     */\r\n    searchWithAutosuggestProps: ISearchWithAutosuggestProps;\r\n\r\n    /** The width of the thumbnail image\r\n     * @type { number }\r\n     */\r\n    thumbnailImageWidth: number;\r\n\r\n    /** The height of the thumbnail image\r\n     * @type { number }\r\n     */\r\n    thumbnailImageHeight: number;\r\n\r\n    /** The number of thumbnails to show per page of results\r\n     * @type { number }\r\n     */\r\n    thumbnailsPerPage: number;\r\n\r\n    /** A boolean that models whether the data is being loaded (true) or is already available (false)\r\n     * @type {boolean}\r\n     */\r\n    childDocumentsBeingLoaded: boolean;\r\n\r\n    /** An array of failed actions used to show error notifications to the user\r\n     * @type {IFailedAction[]}\r\n     */\r\n    failedActions: IFailedAction[];\r\n\r\n    /** An array of props used to render image tiles\r\n     * @type {IImageTileProps[]}\r\n     */\r\n    imageTiles: IImageTileProps[];\r\n\r\n    /** Callback when moving to the next page.\r\n     * @type { function }\r\n     */\r\n    onPageNext?: (event: React.SyntheticEvent<any>) => void;\r\n\r\n    /** Callback to execute when user initiated Retry Action.\r\n     * @type { function }\r\n     */\r\n    onRetryClicked?: (event: React.SyntheticEvent<any>) => void;\r\n\r\n    /** A hook offered to the component consumers to react when the show/hide filter options is invoked.\r\n     * @type { function }\r\n     */\r\n    onToggleFilterOptionsVisibility?: () => void;\r\n\r\n    /**\r\n     * Properties for the sort order\r\n     * @type {ISortOrderProps}\r\n     */\r\n    sortOrderProps: ISortOrderProps;\r\n\r\n    /**\r\n     * Optional callback when an image tile is invoked.\r\n     * @type {function}\r\n     */\r\n    onImageTileInvoked?: (id: string, event: React.SyntheticEvent<any>) => void;\r\n\r\n    /**\r\n     * Optional callback when an image is to be added to a lightbox.\r\n     * @type {function}\r\n     */\r\n    onAddToLightboxInvoked?: (id: string, event: Event) => void;\r\n\r\n    /**\r\n     * The set of properties associated with the paged collection of images.\r\n     * @type {IPagedComponentProps}\r\n     */\r\n    pagedImagesProps: IPagedComponentProps;\r\n\r\n    /**\r\n     * Display mode for the search results.\r\n     * @type {ResultsDisplayModeEnum}\r\n     */\r\n    resultsDisplayMode: ResultsDisplayModeEnum;\r\n\r\n    /** A hook offered to the component consumers to react when the grid/mosaic buttons are invoked.\r\n     * @type { function }\r\n     */\r\n    onDisplayModeChanged?: (resultsDisplayMode: ResultsDisplayModeEnum) => void;\r\n\r\n    /**\r\n     * The set of properties associated with the paged collection of images when rendered as a PagedVirtualColleciton (i.e. non-grid layout)\r\n     * @type {IPagedVirtualCollectionProps}\r\n     */\r\n    pagedVirtualCollectionProps: IPagedVirtualCollectionProps;\r\n\r\n    /**\r\n     * Service error notification.\r\n     * @type {IRichNotification}\r\n     */\r\n    serviceError?: IRichNotification;\r\n\r\n    /**\r\n     * Handler used to attach logic that is executed in response to the user scrolling through the search results.\r\n     * @type {{ scrollTop: number, scrollHeight: number }) => void}\r\n     */\r\n    onScroll: (args: { scrollTop: number, scrollHeight: number }) => void;\r\n\r\n    /**\r\n     * The scroll position of the virtual collection component.\r\n     * @type {number}\r\n     */\r\n    scrollTop: number;\r\n\r\n    /**\r\n     * A callback that is executed every time a search view (`SearchAndSelect` or `CreativeSearch` is being unmounted).\r\n     * It's being used to fire an action that saves the latest scroll position.\r\n     * @type {(scrollPosition: number) => void}\r\n     */\r\n    onSearchViewWillUnmount: (scrollPosition: number) => void;\r\n}\r\n\r\n/**\r\n * Checks if the current rendered page is last page.\r\n * @method\r\n * @returns { boolean } true, if the current page is last page.\r\n */\r\nexport function isLastPage(props: ISearchProps): boolean {\r\n    const activePageIndex = props.pagedImagesProps.activePageIndex;\r\n    return props.pagedImagesProps.pageDescriptors[activePageIndex] && props.pagedImagesProps.pageDescriptors[activePageIndex].isLast;\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\nimport { Spinner } from \"cms-ui-components/spinner/Spinner\";\r\n\r\nimport { SearchUI } from \"../searchBase/SearchUI\";\r\nimport { isLastPage } from \"../searchBase/ISearchProps\";\r\n\r\nimport { ICreativeSearchProps } from \"./ICreativeSearchProps\";\r\n\r\n/**\r\n * This component is a React component which is responsible for rendering the Creative Search experience in this app.\r\n * @class\r\n */\r\nexport class CreativeSearch extends React.Component<ICreativeSearchProps> {\r\n\r\n    /**\r\n     * Initializes a new instance of the `CreativeSearch` class.\r\n     * @constructor\r\n     * @param {ICreativeSearchProps} props The properties controlling the layout of this component.\r\n     * @param {any} context The react context object.\r\n     */\r\n    constructor(props: ICreativeSearchProps, context: any) {\r\n        super(props, context);\r\n\r\n        if (!props) {\r\n            throw \"props parameter cannot be null\";\r\n        }\r\n\r\n        this.renderFirstPageLoadingMessageComponent = this.renderFirstPageLoadingMessageComponent.bind(this);\r\n        this.renderNextPageResultsLoadingComponent = this.renderNextPageResultsLoadingComponent.bind(this);\r\n    }\r\n\r\n    /**\r\n     * Renders the search and select component.\r\n     * @method\r\n     * @returns { React.ReactElement<ICreativeSearchProps> } The Creative Search Page.\r\n     */\r\n    public render(): React.ReactElement<ICreativeSearchProps> {\r\n        return (\r\n            <SearchUI\r\n                {...this.props}\r\n                pageName={\"creative\"}\r\n                getRenderFilterPaneProps={() => this.props.providerQueryFilterPaneProps[this.props.creativeProvider]}\r\n                renderFirstPageLoadingMessageComponent={this.renderFirstPageLoadingMessageComponent}\r\n                renderNextPageResultsLoadingComponent={this.renderNextPageResultsLoadingComponent}\r\n            />\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Returns an instance of an element to indicate that first pageresults are loading.\r\n     * @method\r\n     * @returns {React.ReactElement<any>} The component that will render the data.\r\n     */\r\n    protected renderFirstPageLoadingMessageComponent(): React.ReactElement<any> {\r\n        let component: React.ReactElement<any>;\r\n        component = (\r\n            <div className=\"spinner-normal\">\r\n                <Spinner />\r\n                <div>Loading results from {this.props.creativeProvider}</div>\r\n            </div>\r\n        );\r\n\r\n        return component;\r\n    }\r\n\r\n    /**\r\n     * Returns an instance of an element to indicate that more results are loading.\r\n     * @method\r\n     * @returns {React.ReactElement<any>} The component that will render the data.\r\n     */\r\n    protected renderNextPageResultsLoadingComponent(): React.ReactElement<any> {\r\n        let moreResultLoadingComponent: React.ReactElement<any>;\r\n        if (isLastPage(this.props) && this.props.moreChildrenLoading) {\r\n            moreResultLoadingComponent = (\r\n                <div className=\"spinner-small\">\r\n                    <Spinner />\r\n                    <span> Loading more results from {this.props.creativeProvider}</span>\r\n                </div>\r\n            );\r\n        }\r\n\r\n        return moreResultLoadingComponent;\r\n    }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\nimport { AdalAuthenticationManager } from \"cms-ui-presentationlogic/authentication/adaljs/AdalAuthenticationManager\";\r\nimport { CmsEntityEditingActionCreator } from \"cms-ui-presentationlogic/dataflows/cmsEntityEditing/CmsEntityEditingActionCreator\";\r\nimport { CmsEntityEditingActions } from \"cms-ui-presentationlogic/dataflows/cmsEntityEditing/CmsEntityEditingActions\";\r\nimport { CmsEntityJsonEditor } from \"cms-ui-views/cmsEntityJsonEditor/CmsEntityJsonEditor\";\r\nimport { CmsEntityJsonEditorBootstrapper } from \"cms-ui-views/cmsEntityJsonEditor/CmsEntityJsonEditorBootstrapper\";\r\nimport { DocumentCommandActionCreator } from \"cms-ui-presentationlogic/dataflows/explorer/DocumentCommandActionCreator\";\r\nimport { EntityFactory } from \"../EntityFactory\";\r\nimport { ICatalystEditorState } from \"./ICatalystEditorState\";\r\nimport { ICmsEntityEditingActionCreator } from \"cms-ui-presentationlogic/dataflows/cmsEntityEditing/ICmsEntityEditingActionCreator\";\r\nimport { IStore } from \"redux\";\r\nimport { appConfig } from \"appConfig\";\r\n\r\n/**\r\n * React component that wraps the <CmsEntityJsonEditor />.\r\n * It provides the capability to invoke CMS commands on the opened document and, if checked-out, to edit it.\r\n * @class\r\n */\r\nexport class DriCmsEntityEditor extends React.Component<{ entityId: string }, ICatalystEditorState> {\r\n\r\n    private entityFactory: EntityFactory;\r\n\r\n    private bootstrapper: CmsEntityJsonEditorBootstrapper<{}>;\r\n\r\n    private editor: React.ReactElement<any>;\r\n\r\n    constructor(props: { entityId: string }, context?: any) {\r\n        super(props, context);\r\n\r\n        const authenticationManager = new AdalAuthenticationManager((new AuthenticationContext(appConfig.adal)));\r\n        this.entityFactory = new EntityFactory(appConfig.catsTenantName, appConfig.proseEndpoint, authenticationManager);\r\n\r\n        const cmsEntityJsonEditorDocumentActionCreatorFactory = (_entityEditingActions: CmsEntityEditingActions, store: IStore<any>)\r\n            : ICmsEntityEditingActionCreator => {\r\n\r\n            const cmsEntityJsonEditorActions = new CmsEntityEditingActions();\r\n\r\n            const documentCommandActionCreator = new DocumentCommandActionCreator(\r\n                this.entityFactory.businessLogicFactory,\r\n                store,\r\n                cmsEntityJsonEditorActions.CmsCommandActions);\r\n\r\n            return new CmsEntityEditingActionCreator(\r\n                store,\r\n                cmsEntityJsonEditorActions,\r\n                authenticationManager.userData.userName,\r\n                this.entityFactory.entityManager,\r\n                documentCommandActionCreator);\r\n        };\r\n\r\n        this.bootstrapper = new CmsEntityJsonEditorBootstrapper(\r\n            null,\r\n            cmsEntityJsonEditorDocumentActionCreatorFactory);\r\n\r\n        this.editor = this.bootstrapper.bootstrap(CmsEntityJsonEditor);\r\n    }\r\n\r\n    public componentWillMount(): void {\r\n        const { entityId } = this.props;\r\n        const { loadCmsDocument } = this.bootstrapper.mapDispatchToProps(null, null);\r\n        loadCmsDocument(entityId);\r\n    }\r\n\r\n    public render(): React.ReactElement<any> {\r\n        return (\r\n            <div className=\"dri-editor\">\r\n                {this.editor}\r\n            </div>\r\n        );\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\nimport { ICatalystEditorProps } from \"./ICatalystEditorProps\";\r\nimport { ICatalystEditorState } from \"./ICatalystEditorState\";\r\nimport { IEntity } from \"cms-models/IEntity\";\r\nimport { IEntityResponse } from \"cms-businesslogic/response/IEntityResponse\";\r\nimport { JsonEditor } from \"cms-ui-components/jsonEditor/JsonEditor\";\r\n\r\n/**\r\n * React component that wraps the <JsonEditor />.\r\n * It provides the logic to load the document from the CMS and obtain a pretty-printed version that is passed to the editor as a prop.\r\n * @class\r\n */\r\nexport class EntityJsonEditorHost extends React.Component<ICatalystEditorProps, ICatalystEditorState> {\r\n\r\n    /**\r\n     * Initialize the Json document to null. The componentWillUnmount will replace this value before the component is actually mounted.\r\n     * @constructor\r\n     * @param props {ICatalystEditorProps} The React props.\r\n     * @param ctx {any} The React context.\r\n     */\r\n    constructor(props: ICatalystEditorProps, ctx: any) {\r\n        super(props, ctx);\r\n\r\n        this.state = {\r\n            jsonDocument: null\r\n        };\r\n    }\r\n\r\n    public componentWillMount(): void {\r\n        this.loadCmsEntity(this.props);\r\n    }\r\n\r\n    public componentWillReceiveProps(nextProps: ICatalystEditorProps): void {\r\n        this.loadCmsEntity(nextProps);\r\n    }\r\n\r\n    public render(): React.ReactElement<any> {\r\n\r\n        const { jsonDocument } = this.state;\r\n\r\n        return (\r\n            <div style={{ height: \"100%\" }}>\r\n                <JsonEditor jsonDocument={jsonDocument} />\r\n            </div>\r\n        );\r\n    }\r\n\r\n    private loadCmsEntity(props: ICatalystEditorProps): void {\r\n        const { entityId, catTenantEntityManager } = props;\r\n\r\n        catTenantEntityManager.getLatest({ name: \"document\" }, entityId).then((getEntityResult: IEntityResponse<IEntity>) => {\r\n            const jsonDocument = JSON.stringify(getEntityResult.data, null, 3);\r\n            this.setState((prevState) => {\r\n                const newState: ICatalystEditorState = { ...prevState, jsonDocument };\r\n                return newState;\r\n            });\r\n        });\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { ICatalystFileDataMetadata } from \"clientcore-models-catalyst/ICatalystFileDataMetadata\";\r\nimport { IImageFileData } from \"cms-models/IImageFileData\";\r\nimport { IModalCarouselProps } from \"../../../rendering/components/modalCarousel/IModalCarouselProps\";\r\n\r\n/**\r\n * Method signature for a helper method to get the next image index when user is navigating images on preview modal.\r\n * @param pageSize { number } The number of images rendered per page.\r\n * @param currentIndex { number } The current selected index\r\n * @param totalItems { number } The total results available\r\n * @type\r\n */\r\nexport type CalculateNextImageIndexSignature = (pageSize: number, currentIndex: number, totalItems: number) => number;\r\n\r\n/**\r\n * Helper method to determine if vertical layout should be rendered on preview modal.\r\n * @param width { number } The width of the image.\r\n * @param height { number } The height of the image.\r\n * @type\r\n */\r\nexport type DetermineModalLayoutSignature = (width: number, height: number) => boolean;\r\n\r\n/**\r\n * Helper method to get the next image index when user is navigating images on preview modal.\r\n * @method\r\n * @param pageSize { number } The number of images rendered per page.\r\n * @param currentIndex { number } The current selected index\r\n * @param totalItems { number } The total results available\r\n * @returns {number} the next image index\r\n */\r\nconst calculateNextImageIndex: CalculateNextImageIndexSignature = function (pageSize: number, currentIndex: number, totalItems: number): number {\r\n    const pageIndex = Math.floor(currentIndex / pageSize);\r\n    const tempIndex = (currentIndex + 1) % pageSize;\r\n\r\n    let nextSelectedIndex = (pageSize * pageIndex) + tempIndex;\r\n\r\n    if (nextSelectedIndex >= totalItems) {\r\n        nextSelectedIndex = pageSize * pageIndex;\r\n    }\r\n\r\n    return nextSelectedIndex;\r\n};\r\n\r\n/**\r\n * Helper method to get the previous image index when user is navigating images on preview modal.\r\n * @method\r\n * @param pageSize { number } The number of images rendered per page.\r\n * @param currentIndex { number } The current selected index\r\n * @param totalItems { number } The total results available\r\n * @returns {number} the next image index\r\n */\r\nconst calculatePreviousImageIndex: CalculateNextImageIndexSignature = function (pageSize: number, currentIndex: number, totalItems: number): number {\r\n    const pageIndex = Math.floor(currentIndex / pageSize);\r\n    const maxPageIndex = Math.floor(totalItems / pageSize);\r\n    const maxIndexForCurrentPage = pageIndex === maxPageIndex\r\n        ? (pageSize * pageIndex) + ((totalItems % pageSize) - 1)\r\n        : (pageSize * (pageIndex + 1)) - 1;\r\n\r\n    const tempIndex = (currentIndex - 1) % pageSize;\r\n    let nextSelectedIndex = (pageSize * pageIndex) + tempIndex;\r\n\r\n    if (nextSelectedIndex < 0) {\r\n        nextSelectedIndex = maxIndexForCurrentPage;\r\n    }\r\n\r\n    return nextSelectedIndex;\r\n};\r\n/**\r\n * Helper method to get the dimension of the image to determine the layout to render for image preview.\r\n * @method\r\n * @param selectedImageEntity { IImageFileData<ICatalystFileDataMetadata> } The selected image.\r\n * @returns {width: number, height: number} the image dimension to use\r\n */\r\nconst getImageDimensionToDetermineLayout = function (selectedImageEntity: IImageFileData<ICatalystFileDataMetadata>): {width: number, height: number} {\r\n    let originalHeight = 0;\r\n    let originalWidth = 0;\r\n    if (!!selectedImageEntity.fileMetadata && selectedImageEntity.fileMetadata.downloads.length > 0) {\r\n        originalHeight = selectedImageEntity.fileMetadata.downloads[0].height || 0;\r\n        originalWidth = selectedImageEntity.fileMetadata.downloads[0].width || 0;\r\n    }\r\n\r\n    const { width, height } = isFinite(selectedImageEntity.width) && isFinite(selectedImageEntity.height) ?\r\n        { width: selectedImageEntity.width, height: selectedImageEntity.height } :\r\n        { width: originalWidth, height: originalHeight };\r\n    return { width, height };\r\n};\r\n\r\n/**\r\n * Helper method to determine if vertical layout should be rendered on preview modal.\r\n * @method\r\n * @param width { number } The width of the image.\r\n * @param height { number } The height of the image.\r\n * @returns {boolean} true, if vertical layout should be rendered on preview modal\r\n */\r\nconst determineModalLayout = function (width: number, height: number): boolean {\r\n    const verticalLayoutThresholdRatio = 1.85;\r\n    const aspectRatio = (isFinite(width) && isFinite(height)) ? width / height : Number.NaN;\r\n\r\n    const displayVerticalLayout = isFinite(aspectRatio) ? aspectRatio > verticalLayoutThresholdRatio : false;\r\n\r\n    return displayVerticalLayout;\r\n};\r\n\r\n/**\r\n * Helper method to initialize the modal carousel props.\r\n * @method\r\n * @param width { number } The width of the image.\r\n * @param height { number } The height of the image.\r\n * @param displayVerticalLayout {boolean} true, if vertical layout should be rendered on preview modal\r\n * @returns {IModalCarouselProps} The props for modal carousel\r\n */\r\nconst initializeModalCarouselProps = function (width: number, height: number): IModalCarouselProps {\r\n    const modalCarouselProps: IModalCarouselProps = {\r\n        customClassName: determineModalLayout(width, height) ? \"preview-wideimage-modal\" : \"preview-modal\",\r\n        disableNextNavigation: false,\r\n        disablePreviousNavigation: false,\r\n        isVisible: true,\r\n        onHide: () => { return; },\r\n        activeIndex: 0,\r\n        showIndicators: false,\r\n        onSelect: (_eventKey: React.MouseEvent<{}>, _carouselEvent?: React.SyntheticEvent<{}>) => { return; },\r\n        onKeyPressed: (_eventArgs: React.KeyboardEvent<any>) => { return; }\r\n    };\r\n\r\n    return modalCarouselProps;\r\n};\r\n\r\nexport {\r\n    calculateNextImageIndex as CalculateNextImageIndex,\r\n    calculatePreviousImageIndex as CalculatePreviousImageIndex,\r\n    determineModalLayout as DetermineModalLayout,\r\n    initializeModalCarouselProps as InitializeModalCarouselProps,\r\n    getImageDimensionToDetermineLayout as GetImageDimensionToDetermineLayout\r\n};","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\n/**\r\n * Enum modeling the Image Processing status.\r\n * @enum\r\n */\r\nexport enum ImageStatusEnum {\r\n    /* Indicates that Image is not processed\r\n     */\r\n    UnProcessed,\r\n\r\n    /* Indicates that image processing is complete\r\n     */\r\n    Processed,\r\n\r\n    /* Indicates that image is in error state\r\n     */\r\n    Error\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\n/**\r\n * Enum to indicate if the lightboxes on display are as a result of Search or have been taken from the recent list in the user's profile.\r\n * @enum\r\n */\r\nexport enum LightboxPanelLightboxSourceEnum {\r\n    /*\r\n     * Showing lightboxes from the profile\r\n     */\r\n    Recent,\r\n\r\n    /*\r\n     * Show searching\r\n     */\r\n    Search\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\nimport { Button, Overlay, Popover } from \"react-bootstrap\";\r\n\r\nimport { DetermineModalLayout } from \"../../../experiences/search/modalNavigation/ModalNavigationHelper\";\r\nimport { IImagePreviewModalProps } from \"./IImagePreviewModalProps\";\r\nimport { INotification } from \"cms-ui-components/notifications/notification/INotification\";\r\nimport { INotificationProps } from \"cms-ui-components/notifications/notification/INotificationProps\";\r\nimport { IPropertyListProps } from \"cms-ui-components/propertyList/IPropertyListProps\";\r\nimport { Notification } from \"cms-ui-components/notifications/notification/Notification\";\r\nimport { NotificationType } from \"cms-ui-components/notifications/notification/NotificationType\";\r\nimport { PropertyList } from \"cms-ui-components/propertyList/PropertyList\";\r\nimport { PropertyListAlignments } from \"cms-ui-components/propertyList/PropertyListAlignments\";\r\nimport { Spinner } from \"cms-ui-components/spinner/Spinner\";\r\nimport { isNil } from \"lodash-es\";\r\n\r\n/**\r\n * Image preview modal react component class\r\n * @class\r\n */\r\n// TODO: convert rendering of the img tag directly in Modal.Body to use imagePreview module from UI SDK once bootstrap is upgraded to min version supports flex structure modal.\r\nexport class ImagePreviewModal extends React.Component<IImagePreviewModalProps, any> {\r\n\r\n    /**\r\n     * An instance of the AddToLightbox Button element.\r\n     * @type { Button }\r\n     */\r\n    private getAddToLightboxBtn: Button;\r\n\r\n    /**\r\n     * An instance of the GetImageLink Button element.\r\n     * @type { Button }\r\n     */\r\n    private getImageLinkBtn: Button;\r\n\r\n    /**\r\n     * Constructor\r\n     * @constructs\r\n     * @param {IImagePreviewModalProps} props - Class properties.\r\n     * @param {any} context - Component context.\r\n     */\r\n    constructor(props: IImagePreviewModalProps, context: any) {\r\n        super(props, context);\r\n\r\n        if (!props) {\r\n            throw \"props paramter cannot be null\";\r\n        }\r\n\r\n        this.state = {\r\n            expandImageLinkNotification: false,\r\n            expandNotification: false,\r\n            blankImgBufferRendered: false,\r\n            showImageLinkOverlay: false\r\n        };\r\n\r\n        this.toggleImageLinkNotificationDetail = this.toggleImageLinkNotificationDetail.bind(this);\r\n        this.toggleNotificationDetail = this.toggleNotificationDetail.bind(this);\r\n    }\r\n\r\n    /**\r\n     * Helper method to determine layout information based on props\r\n     * @method\r\n     * @param {number} width - The width of the image (may be undefined)\r\n     * @param {number} height - The height of the image (may be undefined)\r\n     * @returns {object} Object containing the layout information to use in the modal: width, height, text width.\r\n     */\r\n    public static determineLayoutInformation(width: number, height: number): { imgWidth: number, imgHeight: number, textWidth: number } {\r\n        let imgWidth: number;\r\n        let imgHeight: number;\r\n        const displayVerticalLayout = DetermineModalLayout(width, height);\r\n        const aspectRatio = (isFinite(width) && isFinite(height)) ? width / height : Number.NaN;\r\n        const maxTextWidthForModal = displayVerticalLayout ? 1070 : 1060; // These dimensions are related to the widths specified in ImagePreviewModal.scss.\r\n        const maxImageWidthForModal = displayVerticalLayout ? maxTextWidthForModal : 600;\r\n        const maxImageHeightForModal = 600;\r\n\r\n        if (isFinite(aspectRatio)) {\r\n            imgWidth = Math.max(width, maxImageWidthForModal);\r\n            imgWidth = Math.min(imgWidth, maxImageWidthForModal);\r\n            imgHeight = imgWidth / aspectRatio;\r\n\r\n            if (imgHeight > maxImageHeightForModal) {\r\n                imgHeight = maxImageHeightForModal;\r\n                imgWidth = imgHeight * aspectRatio;\r\n            }\r\n\r\n            imgWidth = Math.floor(imgWidth);\r\n            imgHeight = Math.floor(imgHeight);\r\n        } else { // width and/or height are undefined\r\n            if (!!width) {\r\n                imgWidth = Math.min(width, maxImageWidthForModal);\r\n            } else if (!!height) {\r\n                imgHeight = Math.min(height, maxImageHeightForModal);\r\n            } else {\r\n                imgWidth = maxImageWidthForModal;\r\n            }\r\n        }\r\n\r\n        const textWidth = displayVerticalLayout ? imgWidth : maxTextWidthForModal - (isFinite(imgWidth) ? imgWidth : maxImageWidthForModal);\r\n\r\n        return {\r\n            imgWidth,\r\n            imgHeight,\r\n            textWidth\r\n        };\r\n    }\r\n\r\n    /**\r\n     * React lfc componentWillReceiveProps function\r\n     * We are using this to determine if the image update is causing the image dimension to change.\r\n     * If so, we want to unload the image before the re-render so that the previous image does not appear to be stretched momentary before the next image is loaded.\r\n     * @callback\r\n     * @param {IImagePreviewModalProps} nextProps - Next set properties.\r\n     */\r\n    public componentWillReceiveProps(nextProps: IImagePreviewModalProps): void {\r\n        if (this.props.sourceHref !== nextProps.sourceHref) {\r\n            this.setState({ blankImgBufferRendered: false });\r\n        }\r\n    }\r\n\r\n    /**\r\n     * React lfc componentDidUpdate function\r\n     * We are using this to determine if a blank image is rendered to address the issue that if image dimension changes the previous image appears to be stretched momentary before the next image is loaded.\r\n     * If so, set the component state to indicate such event and trigger a re-render to render the correct image.\r\n     * @callback\r\n     * @param {IImagePreviewModalProps} prevProps - Previous component properties.\r\n     * @param {any} prevState - Previous component state.\r\n     */\r\n    public componentDidUpdate(_prevProps: IImagePreviewModalProps, _prevState: any): void {\r\n        if (!this.state.blankImgBufferRendered) {\r\n            this.setState({ blankImgBufferRendered: true });\r\n        }\r\n    }\r\n\r\n    /**\r\n     * React lfc componentWillUnmount function\r\n     * Hide the Overlay modal so that Overlay is not visible when user dismisses the Modal by clicking outside the modal.\r\n     * @callback\r\n     */\r\n    public componentWillUnmount(): void {\r\n        if (!!this.props.addToLightboxOverlay) {\r\n            this.props.addToLightboxOverlay.props.hideAddToLightboxOverlay();\r\n        }\r\n    }\r\n\r\n    /**\r\n     * React render function\r\n     * @method\r\n     */\r\n    public render(): React.ReactElement<any> {\r\n        const layoutInformation = isFinite(this.props.width) && isFinite(this.props.height) ?\r\n            ImagePreviewModal.determineLayoutInformation(this.props.width, this.props.height) :\r\n            ImagePreviewModal.determineLayoutInformation(this.props.originalWidth, this.props.originalHeight);\r\n\r\n        return (this.renderModalBody(layoutInformation, this.props.displayVerticalLayout));\r\n    }\r\n\r\n    /**\r\n     * Renders the modal body\r\n     * @method\r\n     * @param {object} layoutInformation - Provides information about modal window layout.\r\n     * @param {boolean} displayVerticalLayout - Determines if modal dialog has vertical of horizontal layout.\r\n     * @returns {React.ReactElement} Modal window body.\r\n     */\r\n    private renderModalBody(layoutInformation: { imgWidth: number, imgHeight: number, textWidth: number }, displayVerticalLayout: boolean): React.ReactElement<any> {\r\n        let modalBody: React.ReactElement<any>;\r\n        const containerClassName = !!this.props.containerClassName ? this.props.containerClassName : \"\";\r\n        let downloadBtnText = this.props.downloadInProgress ? (<span><Spinner />Download</span>) : \"Download\";\r\n\r\n        const addToLightboxButton = isNil(this.props.addToLightboxOverlay) ? null : (\r\n            <Button\r\n                ref={(getAddToLightboxBtn: Button) => { this.getAddToLightboxBtn = getAddToLightboxBtn; }}\r\n                className=\"add-to-lightbox-btn\"\r\n                onClick={() => {\r\n                    if (this.props.addToLightboxOverlay.props.addToLightboxOverlayIsVisible) {\r\n                        this.props.addToLightboxOverlay.props.hideAddToLightboxOverlay();\r\n                    } else {\r\n                        this.props.addToLightboxOverlay.props.showAddToLightboxOverlay(this.getAddToLightboxBtn);\r\n                    }\r\n                }}>Add to lightbox</Button>\r\n        );\r\n\r\n        const removeFromLightboxButton = isNil(this.props.onRemoveFromLightboxInvoked) ? null : (\r\n            <Button className=\"remove-from-lightbox-btn\" onClick={(event) => { this.props.onRemoveFromLightboxInvoked(this.props.getLightboxManager().getActiveLightboxId(), this.props.entityId, event); }}>Remove from lightbox</Button>\r\n        );\r\n\r\n        const getImageLinkButton = (\r\n            <Button\r\n                ref={(getImageLinkBtn: Button) => { this.getImageLinkBtn = getImageLinkBtn; }}\r\n                className=\"get-image-link-btn\"\r\n                onClick={(event) => { this.props.generateImageLinkInvoked(event); this.setState({ showImageLinkOverlay: true }); }}>\r\n                {this.props.isImageLinkGenerationInProgress ? (<span><Spinner />Get link</span>) : \"Get link\"}\r\n            </Button>\r\n        );\r\n\r\n        let popoverElement = null;\r\n        if (!!this.props.imageLink) {\r\n            popoverElement = (\r\n                <Overlay\r\n                    show={this.state.showImageLinkOverlay}\r\n                    placement=\"bottom\" rootClose\r\n                    container={this}\r\n                    target={this.getImageLinkBtn}\r\n                    onHide={() => { this.setState({ showImageLinkOverlay: false }); }}>\r\n                    <Popover id=\"copy-to-clipboard-popover\" className=\"copy-to-clipboard-popover\">\r\n                        <div className=\"copy-link-cntr\">\r\n                            <input type=\"text\" readOnly={true} className=\"img-link-txtarea\" id=\"img-link\" defaultValue={this.props.imageLink}></input>\r\n                            <Button title=\"Copy to clipboard\" disabled={this.props.isImageLinkGenerationInProgress} className=\"copy-image-link-btn\" onClick={(_event) => { this.copyLinkToClipboard(); }}><span className=\"glyphicon glyphicon-copy\"></span></Button>\r\n                        </div>\r\n                    </Popover>\r\n                </Overlay>\r\n            );\r\n        }\r\n\r\n        modalBody = (\r\n            <div className={containerClassName}>\r\n                <div className=\"btn-row\">\r\n                    <div className=\"footer-message\">\r\n                        <div>{this.props.footerMessage}</div>\r\n                    </div>\r\n                    {addToLightboxButton}\r\n                    {removeFromLightboxButton}\r\n                    {getImageLinkButton}\r\n                    {popoverElement}\r\n                    <Button className=\"download-btn\" disabled={!this.props.downloadEnabled} onClick={(event) => { this.props.downloadImage(event); }}>{downloadBtnText}</Button>\r\n                    {this.renderNotification()}\r\n                    {this.renderImageLinkErrorNotification()}\r\n                </div>\r\n                {this.renderImagePreviewContent(\r\n                    displayVerticalLayout,\r\n                    layoutInformation.textWidth,\r\n                    layoutInformation.imgWidth,\r\n                    layoutInformation.imgHeight\r\n                )}\r\n            </div>\r\n        );\r\n\r\n        return modalBody;\r\n    }\r\n\r\n    /**\r\n     * Copies image link to clipboard.\r\n     * @method\r\n     */\r\n    private copyLinkToClipboard(): void {\r\n        const copyTextarea = window.document.querySelector(\"#img-link\") as HTMLTextAreaElement;\r\n        copyTextarea.select();\r\n        document.execCommand(\"copy\");\r\n    }\r\n\r\n    /**\r\n     * Renders Image link error notification\r\n     * @method\r\n     * @returns {React.ReactElement} Error notification.\r\n     */\r\n    private renderImageLinkErrorNotification(): React.ReactElement<any> {\r\n        return this.renderErrorNotification(\r\n            this.props.generateLinkErrorMessage,\r\n            this.props.isImageLinkGenerationInProgress,\r\n            \"Attempt to generate link for this image failed.\",\r\n            !!this.state.expandImageLinkNotification,\r\n            this.toggleImageLinkNotificationDetail\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Renders download error notification\r\n     * @method\r\n     * @returns {React.ReactElement} Error notification.\r\n     */\r\n    private renderNotification(): React.ReactElement<any> {\r\n\r\n        return this.renderErrorNotification(\r\n            this.props.lastDownloadError,\r\n            this.props.downloadInProgress,\r\n            \"Last download attempt for this image failed.\",\r\n            !!this.state.expandNotification,\r\n            this.toggleNotificationDetail\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Renders error notification\r\n     * @method\r\n     * @returns {React.ReactElement} Error notification.\r\n     */\r\n    private renderErrorNotification(errorMessage: string, isOperationInProgress: boolean, errorTitle: string, isExpanded: boolean, toggleNotificationCallback: () => void): React.ReactElement<any> {\r\n        if (!errorMessage || isOperationInProgress) {\r\n            return null;\r\n        } else {\r\n            let notification: INotification;\r\n            let notificationProps: INotificationProps;\r\n\r\n            notification = {\r\n                itemType: NotificationType.Error,\r\n                titlePrefix: \"Oh Snap!\",\r\n                title: errorTitle,\r\n                detail: errorMessage,\r\n                expanded: isExpanded\r\n            };\r\n\r\n            notificationProps = {\r\n                notification: notification,\r\n                setBackgroundColor: true,\r\n                expandCollapsible: toggleNotificationCallback\r\n            };\r\n\r\n            return (<Notification {...notificationProps} />);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Toggles the download error detail expansion.\r\n     * @method\r\n     */\r\n    private toggleNotificationDetail(): void {\r\n        this.setState({ expandNotification: !this.state.expandNotification });\r\n        return;\r\n    }\r\n\r\n    /**\r\n     * Toggles the image link error detail expansion.\r\n     * @method\r\n     */\r\n    private toggleImageLinkNotificationDetail(): void {\r\n        this.setState({ expandImageLinkNotification: !this.state.expandImageLinkNotification });\r\n        return;\r\n    }\r\n\r\n    /**\r\n     * Renders image preview on popup modal or proper glyph and error message if image failed/expired.\r\n     * @method\r\n     * @param displayVerticalLayout Determines layout orientation.\r\n     * @param textWidth Width of image description text element.\r\n     * @param imageWidth Width of image preview.\r\n     * @param imageHeight Height of image preview.\r\n     * @returns {React.ReactElement} Modal window image preview.\r\n     */\r\n    private renderImagePreviewContent(displayVerticalLayout: boolean, textWidth: number, imageWidth: number, imageHeight: number): React.ReactElement<any> {\r\n\r\n        const className = displayVerticalLayout ? \"preview-main-row\" : \"preview-main-column\";\r\n        let contentStatusStyle = \"image-preview-content\";\r\n        let contentImageText = null;\r\n        let contentImageAddition = null;\r\n\r\n        if (this.props.isImageBeingProcessed) {\r\n            contentStatusStyle += \" unproccessed-image\";\r\n            contentImageText = this.props.errorMessage;\r\n            contentImageAddition = (<div className=\"warning-tile\"><span className=\"no-image-glyph glyphicon glyphicon-warning-sign\"></span></div>);\r\n        } else if (this.props.errorCode) {\r\n            contentStatusStyle += \" expired-image\";\r\n            contentImageText = this.props.errorMessage;\r\n            contentImageAddition = (<div className=\"warning-tile\"><span className=\"no-image-glyph glyphicon glyphicon-camera\"></span><div className=\"no-image-text\">NO IMAGE</div></div>);\r\n        } else {\r\n            contentImageText = [\r\n                this.renderPropertyList(),\r\n                this.props.addToLightboxOverlay\r\n            ];\r\n            contentImageAddition = (\r\n                <img\r\n                    className=\"preview-hq\"\r\n                    src={this.state.blankImgBufferRendered ? this.props.sourceHref : null}\r\n                    width={imageWidth}\r\n                    height={imageHeight}\r\n                    onLoad={(event) => { (event.currentTarget.ownerDocument.getElementById(\"previewImg\") as HTMLImageElement).src = this.props.sourceHref; }}\r\n                    alt={this.props.altText} />\r\n            );\r\n        }\r\n\r\n        return (\r\n            <div className={contentStatusStyle}>\r\n                <div className={className}>\r\n                    <img\r\n                        id=\"previewImg\"\r\n                        alt={this.props.title}\r\n                        src={this.state.blankImgBufferRendered ? this.props.lowQualtiySourceHref : null}\r\n                        width={imageWidth}\r\n                        height={imageHeight} />\r\n                    {contentImageAddition}\r\n                </div>\r\n                <div className={className} style={{ width: textWidth }}>\r\n                    {contentImageText}\r\n                </div>\r\n            </div>\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Renders property list\r\n     * @method\r\n     * @returns {React.ReactElement} Image property list.\r\n     */\r\n    private renderPropertyList(): React.ReactElement<any> {\r\n        let restrictionsText = !!this.props.restrictions && this.props.restrictions.length > 1 ? this.props.restrictions.join(\"; \") : !!this.props.restrictions && this.props.restrictions.length > 0 ? this.props.restrictions[0] : \"\";\r\n\r\n        const propertyListProps: IPropertyListProps = {\r\n            propertyListAlignment: PropertyListAlignments.Vertical,\r\n            propertyListItemAlignment: PropertyListAlignments.Horizontal,\r\n            separator: \": \",\r\n            propertyListItems: []\r\n        };\r\n\r\n        this.addStringPropertyToList(\"Title\", this.props.title, propertyListProps);\r\n        this.addStringPropertyToList(\"Caption\", this.props.caption, propertyListProps);\r\n        this.addStringPropertyToList(\"Date created\", this.props.publishDate, propertyListProps);\r\n        this.addStringPropertyToList(\"Image Size\", this.props.qualityIndicatorMessage, propertyListProps);\r\n        this.addStringPropertyToList(\"Source\", this.props.providerName, propertyListProps);\r\n        this.addStringPropertyToList(\"Photographer\", this.props.photographerName, propertyListProps);\r\n        this.addStringPropertyToList(\"License Type\", this.props.licenseModel, propertyListProps);\r\n        this.addStringPropertyToList(\"Source Id\", this.props.sourceId, propertyListProps);\r\n        this.addStringPropertyToList(\"Catalyst Id\", this.props.entityId, propertyListProps);\r\n        this.addStringPropertyToList(\"Restriction\", restrictionsText, propertyListProps);\r\n        this.addBooleanPropertyToList(\"Model Released\", this.props.isModelReleased, propertyListProps);\r\n        this.addBooleanPropertyToList(\"Property Released\", this.props.isPropertyReleased, propertyListProps);\r\n        this.addStringPropertyToList(\"Error Code\", this.props.errorCode, propertyListProps);\r\n        this.addStringPropertyToList(\"Error Message\", this.props.errorMessage, propertyListProps);\r\n\r\n        return (<PropertyList {...propertyListProps} />);\r\n    }\r\n\r\n    /**\r\n     * Adds the property to the propertyListProps.propertyListItems collection if it is not empty\r\n     * @param displayLabel {string} the label string\r\n     * @param displayValue {string} the display value\r\n     * @param propertyListProps {IPropertyListProps} the destination collection instance\r\n     * @method\r\n     */\r\n    private addStringPropertyToList(displayLabel: string, displayValue: string, propertyListProps: IPropertyListProps): void {\r\n        if (!!displayValue) {\r\n            propertyListProps.propertyListItems.push({\r\n                name: displayLabel,\r\n                value: displayValue\r\n            });\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Adds the property to the propertyListProps.propertyListItems collection if it is not empty\r\n     * @param displayLabel {string} the label string\r\n     * @param displayValue {string} the display value\r\n     * @param propertyListProps {IPropertyListProps} the destination collection instance\r\n     * @method\r\n     */\r\n    private addBooleanPropertyToList(displayLabel: string, displayValue: boolean, propertyListProps: IPropertyListProps): void {\r\n        if (displayValue !== undefined) {\r\n            propertyListProps.propertyListItems.push({\r\n                name: displayLabel,\r\n                value: displayValue ? \"Yes\" : \"No\"\r\n            });\r\n        }\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { IImageDetailsPageProps } from \"./IImageDetailsPageProps\";\r\nimport { ImagePreviewModal } from \"../components/imagePreviewModal/ImagePreviewModal\";\r\nimport { Notification } from \"cms-ui-components/notifications/notification/Notification\";\r\nimport { INotification } from \"cms-ui-components/notifications/notification/INotification\";\r\nimport { INotificationProps } from \"cms-ui-components/notifications/notification/INotificationProps\";\r\nimport { NotificationType } from \"cms-ui-components/notifications/notification/NotificationType\";\r\n\r\n/**\r\n * Class for the signed in App.\r\n * @class\r\n */\r\nexport class ImageDetailsPage extends React.Component<IImageDetailsPageProps, {}> {\r\n    /**\r\n     * Initialize the ImageDetails component\r\n     * @constructor\r\n     * @param props {IImageDetailsPageProps} The React props.\r\n     * @param ctx {any} The React context.\r\n     */\r\n    constructor(props: IImageDetailsPageProps, ctx: any) {\r\n        super(props, ctx);\r\n    }\r\n\r\n    public render(): React.ReactElement<any> {\r\n        let childComponent = null;\r\n        if (this.props.isError) {\r\n            let errorMessage = \"Error occurred while fetching the image details from server. Please ensure that Image Id is valid and try refreshing the page. \";\r\n            errorMessage += \"If error persist please contact catalyst team. Here is the error message received from service: \";\r\n            errorMessage += this.props.errorMessage;\r\n            childComponent = (\r\n                <div className=\"image-details-error\">\r\n                    <div>{errorMessage}</div>\r\n                    <div>Error code: {this.props.errorCode}</div>\r\n                    <div>Message: {this.props.errorMessage}</div>\r\n                </div>\r\n            );\r\n\r\n            let notification: INotification;\r\n            let notificationProps: INotificationProps;\r\n\r\n            notification = {\r\n                itemType: NotificationType.Error,\r\n                titlePrefix: \"Oh Snap!\",\r\n                title: \"Error occurred while fetching image details.\",\r\n                detail: errorMessage,\r\n                expanded: true\r\n            };\r\n\r\n            notificationProps = {\r\n                notification: notification,\r\n                setBackgroundColor: true\r\n            };\r\n\r\n            childComponent = (\r\n                <div className=\"image-details-error\">\r\n                    <Notification {...notificationProps} />\r\n                </div>);\r\n        } else {\r\n            childComponent = (<ImagePreviewModal {...this.props} />);\r\n        }\r\n\r\n        return (\r\n            <div className=\"image-details-page\">\r\n                {childComponent}\r\n            </div>\r\n        );\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\nimport { isEmpty, isNil } from \"lodash-es\";\r\n\r\nimport { Button } from \"react-bootstrap\";\r\nimport { ButtonOverlay } from \"cms-ui-components/overlayableImage/overlays/buttonOverlay/ButtonOverlay\";\r\nimport { ButtonOverlayPosition } from \"cms-ui-components/overlayableImage/overlays/buttonOverlay/ButtonOverlayPosition\";\r\nimport { IButtonOverlayProps } from \"cms-ui-components/overlayableImage/overlays/buttonOverlay/IButtonOverlayProps\";\r\nimport { IImageTileProps } from \"./IImageTileProps\";\r\nimport { IOverlayableImageProps } from \"cms-ui-components/overlayableImage/IOverlayableImageProps\";\r\nimport { ImageStatusEnum } from \"../../../models/lightbox/ImageStatusEnum\";\r\nimport { OverlayableImage } from \"cms-ui-components/overlayableImage/OverlayableImage\";\r\nimport { Spinner } from \"cms-ui-components/spinner/Spinner\";\r\n\r\n/**\r\n * Grid layout image tile react component class for unproccessed images.\r\n * TODO: Move the common code to some other file.\r\n * @class\r\n */\r\nexport class GridUnProcessedImageTile extends React.Component<IImageTileProps, {}> {\r\n    /**\r\n     * constructor\r\n     * @param props {IImageTileProps} props\r\n     * @param context {any} context\r\n     */\r\n    constructor(props: IImageTileProps, context: any) {\r\n        super(props, context);\r\n        if (!props) {\r\n            throw \"props paramter cannot be null\";\r\n        }\r\n\r\n        this.onImageTileRefresh = this.onImageTileRefresh.bind(this);\r\n    }\r\n\r\n    /**\r\n     * React render function\r\n     * @method\r\n     */\r\n    public render(): React.ReactElement<any> {\r\n\r\n        const removeFromLightboxButtonOverlayProps: IButtonOverlayProps = isNil(this.props.onRemoveFromLightboxInvoked) ? null : {\r\n            glyph: \"remove\",\r\n            setAsTabStop: false,\r\n            position: ButtonOverlayPosition.TopRight,\r\n            onInvoked: this.props.onRemoveFromLightboxInvoked,\r\n            tooltip: \"Remove this image from the current lightbox\"\r\n        };\r\n\r\n        let tileDescription = this.props.title;\r\n        const className = !!this.props.customClassName ? \"grid-tile \" + this.props.customClassName : \"grid-tile\";\r\n        if (!!this.props.loading) {\r\n            tileDescription = this.props.title + \": Loading details.\";\r\n            return (\r\n                <div\r\n                    className=\"grid-tile\"\r\n                    tabIndex={-1}>\r\n                    <div className=\"spinner-host\">\r\n                        <div className=\"spinner-normal\">\r\n                            <Spinner />\r\n                        </div>\r\n                    </div>\r\n                    <div className=\"grid-tile-description\">\r\n                        {tileDescription}\r\n                    </div>\r\n                </div>\r\n            );\r\n        }\r\n\r\n        const removeFromLightboxOverlay: React.ReactElement<any> = removeFromLightboxButtonOverlayProps !== null ? (<ButtonOverlay {...removeFromLightboxButtonOverlayProps} />) : null;\r\n        const altText = !!this.props.sourceHref ? this.props.altText : \"No Image\";\r\n        const overlayableImageProps: IOverlayableImageProps = {\r\n            source: this.props.sourceHref,\r\n            alt: altText\r\n        };\r\n\r\n        if (!isNil(this.props.errorCode) && !isEmpty(this.props.errorCode)) {\r\n            tileDescription = this.props.title + \": \" + this.props.errorCode;\r\n        }\r\n\r\n        let tileDescriptionElement = (\r\n            <div className=\"grid-tile-description\">\r\n                {tileDescription}\r\n            </div>\r\n        );\r\n\r\n        const refreshButtonElement = (\r\n            <div className=\"refresh-image-tile\">\r\n                <Button title=\"Refresh Tile\" className=\"refresh-image-tile-btn\" onClick={(event) => { this.onImageTileRefresh(event); }}>\r\n                    {this.props.isImageRefreshing ? (<div className=\"spinner-small\"><Spinner /></div>) : (<span className=\"glyphicon glyphicon-refresh\"></span>)}\r\n                </Button>\r\n            </div>);\r\n        const refreshButton = this.props.imageStatus === ImageStatusEnum.UnProcessed ? refreshButtonElement : null;\r\n        if (this.props.supportsMultiSelection) {\r\n            tileDescriptionElement = (\r\n                <div>\r\n                    {refreshButton}\r\n\r\n                    <div className=\"grid-tile-description\">\r\n                        {tileDescription}\r\n                    </div>\r\n                </div>\r\n            );\r\n        }\r\n\r\n        return (\r\n            <div\r\n                className={className}\r\n                tabIndex={-1}>\r\n                <OverlayableImage {...overlayableImageProps}>\r\n                    {removeFromLightboxOverlay}\r\n                </OverlayableImage>\r\n                <div className=\"warning-tile\"><span className=\"glyphicon glyphicon-warning-sign\"></span></div>\r\n                <div className=\"grid-tile-footer\">\r\n                    {tileDescriptionElement}\r\n                </div>\r\n            </div>\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Callback for Refresh button on image tile\r\n     * @method\r\n     */\r\n    private onImageTileRefresh(event: React.SyntheticEvent<any>): void {\r\n        if (this.props.onImageTileRefresh && !this.props.isImageRefreshing) {\r\n            this.props.onImageTileRefresh(this.props.id, event);\r\n        }\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\nimport { Button, Glyphicon, OverlayTrigger, Tooltip } from \"react-bootstrap\";\r\nimport { isEmpty, isNil } from \"lodash-es\";\r\n\r\nimport { ILightboxCardActionButtonProps } from \"./ILightboxCardActionButtonProps\";\r\n\r\n/**\r\n * Button to render on the lightbox card\r\n */\r\nexport class LightboxCardActionButton extends React.Component<ILightboxCardActionButtonProps, {}> {\r\n    /**\r\n     * Initializes a new instance of the `LightboxCard` class.\r\n     * @constructor\r\n     * @param {ILightboxCardActionButtonProps} props The properties controlling the layout of this component.\r\n     * @param {any} context The react context object.\r\n     */\r\n    constructor(props: ILightboxCardActionButtonProps, context: any) {\r\n        super(props, context);\r\n\r\n        if (!props) {\r\n            throw \"props parameter cannot be null\";\r\n        }\r\n    }\r\n\r\n    /**\r\n     * The react render function\r\n     */\r\n    public render(): React.ReactElement<any> {\r\n\r\n        const haveTooltip = !isNil(this.props.tooltip) && !isEmpty(this.props.tooltip);\r\n        const disabled = !!this.props.disabled;\r\n        const showTooltip = haveTooltip && !disabled;\r\n        const actionButton = (\r\n            <Button className=\"lightbox-card-action-button\" onClick={(event: React.SyntheticEvent<any>) => {\r\n                if (this.props.callback) {\r\n                    event.preventDefault();\r\n                    event.stopPropagation();\r\n                    this.props.callback(event);\r\n                }\r\n            }} disabled={disabled}><Glyphicon glyph={this.props.glyph} /></Button>\r\n        );\r\n\r\n        const componentToRender = showTooltip ? (\r\n            <OverlayTrigger delayShow={1000} placement=\"right\" overlay={<Tooltip id=\"tooltip\">{this.props.tooltip}</Tooltip>}>\r\n                {actionButton}\r\n            </OverlayTrigger>\r\n        ) : actionButton;\r\n\r\n        return componentToRender;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\nimport { ILightboxCardProps } from \"./ILightboxCardProps\";\r\nimport { LightboxCardActionButton } from \"./LightboxCardActionButton\";\r\nimport { isNil } from \"lodash-es\";\r\n\r\n/**\r\n * The lightbox card module\r\n */\r\nexport class LightboxCard extends React.Component<ILightboxCardProps, {}> {\r\n    /**\r\n     * Initializes a new instance of the `LightboxCard` class.\r\n     * @constructor\r\n     * @param {ILightboxCardProps} props The properties controlling the layout of this component.\r\n     * @param {any} context The react context object.\r\n     */\r\n    constructor(props: ILightboxCardProps, context: any) {\r\n        super(props, context);\r\n\r\n        if (!props) {\r\n            throw \"props parameter cannot be null\";\r\n        }\r\n    }\r\n\r\n    /**\r\n     * The react render function\r\n     */\r\n    public render(): React.ReactElement<any> {\r\n        const lightboxCardStyle = \"lightbox-card\".concat(isNil(this.props.selected) || !this.props.selected ? \"\" : \" active-lightbox-card\");\r\n\r\n        let itemCountComponent: React.ReactElement<any> = null;\r\n        if (isFinite(this.props.itemCount) && (this.props.itemCount >= 0)) {\r\n            itemCountComponent = (<div className=\"lightbox-card-information\">Items: {this.props.itemCount}</div>);\r\n        }\r\n\r\n        const actionButton = this.props.actionButtonProps ? (<LightboxCardActionButton {...this.props.actionButtonProps} />) : null;\r\n\r\n        return (\r\n            <div className={lightboxCardStyle}>\r\n                <div className=\"lightbox-card-title\">{this.props.title}</div>\r\n                <div className=\"lightbox-card-information\">Updated: {this.props.lastModifiedDate || \"\"}</div>\r\n                <div className=\"lightbox-card-information\">By: {this.props.lastModifiedBy || \"\"}</div>\r\n                {itemCountComponent}\r\n                {actionButton}\r\n            </div>\r\n        );\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\n/**\r\n * enum used to identify where a load lightbox has originated. There are two sources, external and internal\r\n * @enum\r\n */\r\nexport enum LoadLightboxSourceEnum {\r\n    /*\r\n     * Lightbox page has been loaded due to the user entering a URL directly into the browser\r\n     */\r\n    External,\r\n\r\n    /*\r\n     * Lightbox page has been loaded due to the user selecting a link in the app (Lighbox, lightbox card, or exit lightbox search)\r\n     */\r\n    Internal\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as Autosuggest from \"react-autosuggest\";\r\nimport * as React from \"react\";\r\n\r\nimport { Button, Overlay, Popover } from \"react-bootstrap\";\r\n\r\nimport { AutoSizer } from \"react-virtualized\";\r\nimport { DockPosition } from \"cms-ui-components/docker/DockPosition\";\r\nimport { ExpansionStyle } from \"cms-ui-components/docker/ExpansionStyle\";\r\nimport { GridImageTile } from \"../components/imageTile/GridImageTile\";\r\nimport { GridUnProcessedImageTile } from \"../components/imageTile/GridUnProcessedImageTile\";\r\nimport { IImageTileProps } from \"../components/imageTile/IImageTileProps\";\r\nimport { ILightboxCardProps } from \"../components/lightboxCard/ILightboxCardProps\";\r\nimport { ILightboxPageProps } from \"./ILightboxPageProps\";\r\nimport { ISearchWithAutosuggestProps } from \"../components/searchWithAutosuggest/ISearchWithAutosuggestProps\";\r\nimport { IVirtualGridProps } from \"cms-ui-components/virtualGrid/IVirtualGridProps\";\r\nimport { ImageStatusEnum } from \"../../models/lightbox/ImageStatusEnum\";\r\nimport { LightboxCard } from \"../components/lightboxCard/LightboxCard\";\r\nimport { LightboxPanelLightboxSourceEnum } from \"./LightboxPanelLightboxSourceEnum\";\r\nimport { Link } from \"react-router\";\r\nimport { Notification } from \"cms-ui-components/notifications/notification/Notification\";\r\nimport { Routes } from \"../../Routes\";\r\nimport { SearchWithAutosuggest } from \"../components/searchWithAutosuggest/SearchWithAutosuggest\";\r\nimport { SingleDocker } from \"cms-ui-components/docker/SingleDocker\";\r\nimport { Spinner } from \"cms-ui-components/spinner/Spinner\";\r\nimport { VirtualGrid } from \"cms-ui-components/virtualGrid/VirtualGrid\";\r\nimport { isEmpty } from \"lodash-es\";\r\n\r\n/**\r\n * This component is a React component which is responsible for rendering the Lightbox editing experience in this app.\r\n * @class\r\n */\r\nexport class LightboxPage extends React.Component<ILightboxPageProps, any> {\r\n\r\n    // Scroll to the first selected item when the component is mounted.\r\n    // These store the information for that item which is used to calculate the scroll position after the component has mounted.\r\n    private firstSelectedElement: HTMLElement;\r\n    private firstSelectedElementIndex: number;\r\n\r\n    /** An instance of the Generate ImageIdsList Button element.\r\n     * @type { Button }\r\n     */\r\n    private generateImageIdsListBtn: Button;\r\n\r\n    /**\r\n     * Initializes a new instance of the `LightboxPage` class.\r\n     * @constructor\r\n     * @param {ILightboxPageProps} props The properties controlling the layout of this component.\r\n     * @param {any} context The react context object.\r\n     */\r\n    constructor(props: ILightboxPageProps, context: any) {\r\n        super(props, context);\r\n\r\n        if (!props) {\r\n            throw \"props parameter cannot be null\";\r\n        }\r\n\r\n        this.onCanvasSizeChanged = this.onCanvasSizeChanged.bind(this);\r\n\r\n        this.state = {\r\n            width: 0,\r\n            height: 0,\r\n            showImageIdListOverlay: false\r\n        };\r\n    }\r\n\r\n    /**\r\n     * Call back to the bootstrapper to let it know that the page has mounted.\r\n     * @method\r\n     */\r\n    public componentDidMount(): void {\r\n        this.props.onPageMounted();\r\n\r\n        // When the component mounts, ensure that the first selected element is visible\r\n        // We use the height of the child and it's index in the array of children to determine the appropriate offset.\r\n        // This depends on knowing the margin around each card.\r\n        if (!!this.firstSelectedElement) {\r\n            const offsetTop =\r\n                (this.firstSelectedElement.offsetHeight + 10 /* This is the margin around the card specified in the scss */) *\r\n                this.firstSelectedElementIndex;\r\n            this.firstSelectedElement.parentElement.scrollTop = offsetTop;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Call back to the bootstrapper to let it know that the page will unmount.\r\n     * @method\r\n     */\r\n    public componentWillUnmount(): void {\r\n        this.props.onPageUnmounting();\r\n    }\r\n\r\n    /**\r\n     * Renders the lightbox page component.\r\n     * @method\r\n     * @returns { React.ReactElement<any> } The Lightbox page.\r\n     */\r\n    public render(): React.ReactElement<ILightboxPageProps> {\r\n        let serviceErrors: React.ReactElement<any>;\r\n        let browser: React.ReactElement<any>;\r\n\r\n        if (this.props.imageTiles.length === 0 && !!this.props.serviceErrorNotification) {\r\n            serviceErrors = this.renderServiceErrors();\r\n        }\r\n\r\n        browser = this.renderBrowserComponent();\r\n\r\n        const tilesSelected = this.props.imageTiles.filter(tile => tile.supportsMultiSelection && tile.selected).length > 0;\r\n        const failedTilesSelected = this.props.imageTiles.filter(tile => tile.supportsMultiSelection && tile.selected && tile.errorCode).length > 0;\r\n        const sidePanel = this.renderLightboxSelectorSidePanel();\r\n        const dockerSidebarWidth: number = 250;\r\n        const downloadButtonEnabled = !this.props.downloadInProgress && this.props.downloadEnabled && !failedTilesSelected;\r\n        const getImageIdsListButtonEnabled = this.props.imageTiles.length > 0;\r\n        let downloadBtnText = this.props.downloadInProgress ?\r\n            (<span><Spinner />Downloading</span>) :\r\n            tilesSelected ?\r\n                \"Download Selected\" :\r\n                \"Download All\";\r\n\r\n        let getImageIdsBtnText = tilesSelected ? \"Get Selected Ids\" : \"Get Ids\";\r\n\r\n        let failedDownloadElement = !!this.props.failedImages && this.props.failedImages.length > 0 ? (\r\n            <div className=\"failed-images\">\r\n                <span>{this.props.failedImages.length} {(this.props.failedImages.length === 1 ? \"image\" : \"images\") + \" failed to download.\"} </span>\r\n                <a className=\"retry-btn\" onClick={(event) => { this.props.retryDownloadForFailedImages(event); }}>Retry</a>\r\n                <span> download Or </span>\r\n                <a className=\"ignore-btn\" onClick={(event) => { this.props.clearImagesFailedToDownload(event); }}>Clear</a>\r\n                <span> message.</span>\r\n            </div>\r\n        ) : null;\r\n\r\n        const downloadButton = !!this.props.showDownloadButton ? (<Button className=\"download-btn\" disabled={!downloadButtonEnabled} onClick={(event) => { tilesSelected ? this.props.downloadSelectedImages(event) : this.props.downloadAllImages(event); }}>{downloadBtnText}</Button>) : null;\r\n        const clearSelectionButton = !!this.props.showDownloadButton ? (<Button className=\"download-btn\" disabled={!tilesSelected} onClick={(event) => { this.props.clearSelection(event); }}>Clear Selection</Button>) : null;\r\n        const getImageIdsListButton = !!this.props.imageTiles && this.props.imageTiles.length > 0 ?\r\n            (\r\n                <Button\r\n                    ref={(generateImageIdsListBtn: Button) => { this.generateImageIdsListBtn = generateImageIdsListBtn; }}\r\n                    className=\"getImgidList-btn\"\r\n                    disabled={!getImageIdsListButtonEnabled}\r\n                    onClick={(_evt) => { this.setState({ showImageIdListOverlay: true }); }}>{getImageIdsBtnText}\r\n                </Button>)\r\n            : null;\r\n\r\n        let popoverElement = (\r\n            <Overlay\r\n                show={this.state.showImageIdListOverlay}\r\n                placement=\"right\" rootClose\r\n                container={this}\r\n                target={this.generateImageIdsListBtn}\r\n                onHide={() => { this.setState({ showImageIdListOverlay: false }); }}>\r\n                <Popover id=\"copy-imglist-popover\" className=\"copy-imglist-popover\">\r\n                    <div className=\"copy-imglist-cntr\">\r\n                        <input type=\"text\" readOnly={true} className=\"imgids-list-txtarea\" id=\"imgids-list\" defaultValue={this.generateImageIdsListImages(tilesSelected)}></input>\r\n                        <Button title=\"Copy to clipboard\" className=\"copy-imageidlist-btn\" onClick={(_evt) => { this.copyLinkToClipboard(); }}><span className=\"glyphicon glyphicon-copy\"></span></Button>\r\n                    </div>\r\n                </Popover>\r\n            </Overlay>\r\n        );\r\n\r\n        return (\r\n            <div className={\"lightbox-page\"}>\r\n                <SingleDocker dockPosition={DockPosition.Left}>\r\n                    <SingleDocker.Sidebar width={0} expandedWidth={dockerSidebarWidth} expansionStyle={ExpansionStyle.Docked} isExpanded={true}>\r\n                        {sidePanel}\r\n                    </SingleDocker.Sidebar>\r\n                    <SingleDocker.Main overflowX={\"hidden\"}>\r\n                        <div className=\"lightbox-page-menu\">\r\n                            {downloadButton} {clearSelectionButton} {getImageIdsListButton} {failedDownloadElement}\r\n                            {popoverElement}\r\n                        </div>\r\n                        {serviceErrors}\r\n                        {browser}\r\n                    </SingleDocker.Main>\r\n                </SingleDocker>\r\n            </div>\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Renders an error notification for a failed service call.\r\n     * @method\r\n     * @returns { React.ReactElement<any> } A div containing the error notification component.\r\n     */\r\n    private renderServiceErrors(): React.ReactElement<any> {\r\n        if (!this.props.serviceErrorNotification) {\r\n            return null;\r\n        }\r\n\r\n        let notificationProps = {\r\n            id: \"1\",\r\n            notification: this.props.serviceErrorNotification,\r\n            setBackgroundColor: true\r\n        };\r\n\r\n        notificationProps.notification.expanded = true;\r\n\r\n        let serviceError = <Notification {...notificationProps} />;\r\n\r\n        return (\r\n            <div className=\"service-error-container\">\r\n                {serviceError}\r\n            </div>\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Creates a comma separated list of ids for the selected image.\r\n     * @method\r\n     */\r\n    private generateImageIdsListImages(onlySelected: boolean): string {\r\n        let imageIds: string[] = [];\r\n        if (onlySelected) {\r\n            imageIds = this.props.imageTiles.filter(imageTile => imageTile.selected).map(imageTile => { return imageTile.id; });\r\n        } else {\r\n            imageIds = this.props.imageTiles.map(imageTile => { return imageTile.id; });\r\n        }\r\n\r\n        return imageIds.join(\",\");\r\n    }\r\n\r\n    private copyLinkToClipboard(): void {\r\n        const copyTextarea = window.document.querySelector(\"#imgids-list\") as HTMLTextAreaElement;\r\n        copyTextarea.select();\r\n        document.execCommand(\"copy\");\r\n    }\r\n\r\n    // Renders an image tile.\r\n    private renderTile(props: IImageTileProps): React.ReactElement<IImageTileProps> {\r\n        if (props.imageStatus !== ImageStatusEnum.Processed) {\r\n            return (\r\n                <GridUnProcessedImageTile\r\n                    id={props.id}\r\n                    key={props.id}\r\n                    loading={props.loading}\r\n                    errorCode={props.errorCode}\r\n                    errorMessage={props.errorMessage}\r\n                    sourceHref={props.sourceHref}\r\n                    title={props.title}\r\n                    imgWidth={props.imgWidth}\r\n                    imgHeight={props.imgHeight}\r\n                    supportsMultiSelection={props.supportsMultiSelection}\r\n                    onItemInvoked={(_itemIndex, event) => props.onImageTileInvoked(event)}\r\n                    onRemoveFromLightboxInvoked={props.onRemoveFromLightboxInvoked}\r\n                    imageStatus={props.imageStatus}\r\n                    isImageRefreshing={props.isImageRefreshing}\r\n                    altText={props.altText}\r\n                    onImageTileRefresh={props.onImageTileRefresh}\r\n                    customClassName={props.customClassName} />\r\n            );\r\n        } else {\r\n            return (\r\n                <GridImageTile\r\n                    id={props.id}\r\n                    key={props.id}\r\n                    loading={props.loading}\r\n                    errorCode={props.errorCode}\r\n                    errorMessage={props.errorMessage}\r\n                    sourceHref={props.sourceHref}\r\n                    title={props.title}\r\n                    imgWidth={props.imgWidth}\r\n                    imgHeight={props.imgHeight}\r\n                    supportsMultiSelection={props.supportsMultiSelection}\r\n                    onImageTileInvoked={props.onImageTileInvoked}\r\n                    onItemInvoked={(_itemIndex, event) => props.onImageTileInvoked(event)}\r\n                    selected={props.selected}\r\n                    onImageTileSelectionChanged={(selected, event) => { if (props.onImageTileSelectionChanged) { props.onImageTileSelectionChanged(selected, event); } }}\r\n                    onRemoveFromLightboxInvoked={props.onRemoveFromLightboxInvoked}\r\n                    altText={props.altText}\r\n                    customClassName={props.customClassName} />\r\n            );\r\n        }\r\n    }\r\n\r\n    // Renders a view of the current lightbox contents, a spinner, or a lightbox empty message as appropriate\r\n    private renderBrowserComponent(): React.ReactElement<any> {\r\n        let component: React.ReactElement<any>;\r\n\r\n        const isSearchInProgress = this.props.isSearching || false;\r\n\r\n        if (this.props.lightboxes.length === 0 && !this.props.serviceErrorNotification) {\r\n            const noLightboxesMessage = this.props.source === LightboxPanelLightboxSourceEnum.Recent ?\r\n                \"You don't have any lightboxes saved to your profile.\" :\r\n                isSearchInProgress ? \"Searching...\" : \"No lightboxes found.\";\r\n            component = (\r\n                <div className=\"no-images-or-no-lightbox\">{noLightboxesMessage}</div>\r\n            );\r\n        } else if (isEmpty(this.props.selectedLightbox) && !this.props.serviceErrorNotification) {\r\n            component = (\r\n                <div className=\"no-images-or-no-lightbox\">Please select a lightbox.</div>\r\n            );\r\n        } else if (!isEmpty(this.props.selectedLightbox) && this.props.imageTiles.length === 0 && !this.props.serviceErrorNotification) {\r\n            component = (\r\n                <div className=\"no-images-or-no-lightbox\">Lightbox does not contain any images.</div>\r\n            );\r\n        } else {\r\n            component = (\r\n                <div>\r\n                    <AutoSizer disableHeight={true} disableWidth={false} onResize={({ height, width }) => { this.onCanvasSizeChanged(width, height); }}>\r\n                        {({ height, width }) => {\r\n                            return (\r\n                                <div style={{ height, width }}>\r\n                                    {this.renderVirtualGrid(width)}\r\n                                </div>\r\n                            );\r\n                        }}\r\n                    </AutoSizer>\r\n                </div>\r\n            );\r\n        }\r\n\r\n        return (\r\n            <div className={\"lightbox-contents\"}>\r\n                {component}\r\n                {this.props.children}\r\n            </div>\r\n        );\r\n    }\r\n\r\n    // Renders the lightbox contents in a virtual grid.\r\n    private renderVirtualGrid(containerWidth: number): React.ReactElement<IVirtualGridProps> {\r\n        return (\r\n            <VirtualGrid\r\n                containerWidth={containerWidth}\r\n                containerHeight={0}\r\n                itemWidth={this.props.thumbnailImageWidth}\r\n                itemHeight={this.props.thumbnailImageHeight}>\r\n\r\n                {this.props.imageTiles.map(tileProps => (this.renderTile(tileProps)))}\r\n            </VirtualGrid>\r\n        );\r\n    }\r\n\r\n    // Renders the side panel that shows the my ligthboxes as well as the currently selected lightbox\r\n    private renderLightboxSelectorSidePanel(): React.ReactElement<any> {\r\n        const searchWithAutosuggestProps: ISearchWithAutosuggestProps = {\r\n            autoSuggestInputProps: {\r\n                placeholder: this.props.searchPlaceholderText,\r\n                value: this.props.searchText || \"\",\r\n                onChange: this.props.onSearchTextChanged\r\n            },\r\n            onSearchExecute: this.props.onSearchExecute,\r\n            onSuggestionsFetchRequested: (_request: Autosuggest.SuggestionsFetchRequest) => { return; },\r\n            onSuggestionsClearRequested: () => { return; },\r\n            onSuggestionSelected: (_event: React.SyntheticEvent<any>) => { return; },\r\n            suggestions: [],\r\n            catalystSuggestions: [],\r\n            shouldRenderSuggestions: (_text: string) => { return false; },\r\n            allowSearch: true,\r\n            searchHintsNotifications: []\r\n        };\r\n\r\n        const headingText = this.props.source === LightboxPanelLightboxSourceEnum.Recent ? \"My Lightboxes\" : \"Search Results\";\r\n        const headingButton = this.props.source === LightboxPanelLightboxSourceEnum.Recent ? null : (\r\n            <Link to={{\r\n                pathname: Routes.getLightboxPageRoutePath(true /* baseOnly */),\r\n                state: Routes.getStateForLightboxRoute()\r\n            }\r\n            } onClick={(event) => { this.props.onExitSearch(event); }}>\r\n                exit search\r\n            </Link>\r\n        );\r\n\r\n        const heading = (\r\n            <div className=\"lightbox-card-list-heading\">\r\n                {headingText}\r\n                {headingButton}\r\n            </div>\r\n        );\r\n\r\n        const isSearchInProgress = this.props.isSearching || false;\r\n        const belowTheHeading = isSearchInProgress ?\r\n            (<div className=\"lightbox-search-spinner\"><div className=\"spinner-normal\"><Spinner /></div></div>) :\r\n            (<div className=\"lightbox-cards-scroll-container\"><div className=\"lightbox-cards-recent-or-search\">\r\n                {this.props.lightboxes.map(lightbox => this.renderLightboxCard(lightbox))}\r\n            </div></div>);\r\n\r\n        return (\r\n            <div className=\"lightbox-page-side-panel\">\r\n                <div className=\"title-container\">\r\n                    <div className=\"lightbox-page-side-panel-search\">\r\n                        <SearchWithAutosuggest {...searchWithAutosuggestProps} />\r\n                    </div>\r\n                </div>\r\n                {heading}\r\n                {belowTheHeading}\r\n            </div>\r\n        );\r\n    }\r\n\r\n    // Renders a single card\r\n    private renderLightboxCard(lightboxProps: ILightboxCardProps): React.ReactElement<ILightboxCardProps> {\r\n        const selected = this.props.selectedLightbox === lightboxProps.id;\r\n        const props: ILightboxCardProps = { ...lightboxProps, selected };\r\n        return (\r\n            <div\r\n                key={lightboxProps.id}\r\n                className=\"lightbox-card-container\"\r\n                ref={(instance) => {\r\n                    if (selected) {\r\n                        this.firstSelectedElement = instance;\r\n                        this.firstSelectedElementIndex = this.props.lightboxes.findIndex((lightbox) => lightbox.id === lightboxProps.id);\r\n                    }\r\n                }}>\r\n                <Link to={{\r\n                    pathname: Routes.getLightboxPageRoutePath(true /* baseOnly */, lightboxProps.id),\r\n                    state: Routes.getStateForLightboxRoute()\r\n                }\r\n                }>\r\n                    <LightboxCard {...props} />\r\n                </Link>\r\n            </div>\r\n        );\r\n    }\r\n\r\n    // Callback passed to the autosizer. When the container dimensions change, set state\r\n    // so that the virtual grid is re-rendered\r\n    private onCanvasSizeChanged(width: number, height: number): void {\r\n        this.setState({\r\n            width,\r\n            height\r\n        });\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { Spinner } from \"cms-ui-components/spinner/Spinner\";\r\n\r\nimport { SearchUI } from \"../searchBase/SearchUI\";\r\nimport { isLastPage } from \"../searchBase/ISearchProps\";\r\n\r\nimport { ISearchAndSelectProps } from \"./ISearchAndSelectProps\";\r\n\r\n/**\r\n * This component is a React component which is responsible for rendering the Search and Select experience in this app.\r\n * @class\r\n */\r\nexport class SearchAndSelect extends React.Component<ISearchAndSelectProps> {\r\n    /**\r\n     * Initializes a new instance of the `SearchAndSelect` class.\r\n     * @constructor\r\n     * @param {ISearchAndSelectProps} props The properties controlling the layout of this component.\r\n     * @param {any} context The react context object.\r\n     */\r\n    constructor(props: ISearchAndSelectProps, context: any) {\r\n        super(props, context);\r\n\r\n        if (!props) {\r\n            throw \"props parameter cannot be null\";\r\n        }\r\n\r\n        this.renderFirstPageLoadingMessageComponent = this.renderFirstPageLoadingMessageComponent.bind(this);\r\n        this.renderNextPageResultsLoadingComponent = this.renderNextPageResultsLoadingComponent.bind(this);\r\n    }\r\n\r\n    /**\r\n     * Renders the search and select component.\r\n     * @method\r\n     * @returns { React.ReactElement<ISearchAndSelectProps> } The Search and Select page.\r\n     */\r\n    public render(): React.ReactElement<ISearchAndSelectProps> {\r\n        return (\r\n            <SearchUI\r\n                {...this.props}\r\n                pageName={\"editorial\"}\r\n                getRenderFilterPaneProps={() => this.props.queryFilterPaneProps}\r\n                renderFirstPageLoadingMessageComponent={this.renderFirstPageLoadingMessageComponent}\r\n                renderNextPageResultsLoadingComponent={this.renderNextPageResultsLoadingComponent}\r\n            />\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Returns an instance of an element to indicate that first pageresults are loading.\r\n     * @method\r\n     * @returns {React.ReactElement<any>} The component that will render the data.\r\n     */\r\n    protected renderFirstPageLoadingMessageComponent(): React.ReactElement<any> {\r\n        let component: React.ReactElement<any>;\r\n        component = (\r\n            <div className=\"spinner-normal\">\r\n                <Spinner />\r\n            </div>\r\n        );\r\n\r\n        return component;\r\n    }\r\n\r\n    /**\r\n     * Returns an instance of an element to indicate that more results are loading.\r\n     * @method\r\n     * @returns {React.ReactElement<any>} The component that will render the data.\r\n     */\r\n    protected renderNextPageResultsLoadingComponent(): React.ReactElement<any> {\r\n        let moreResultLoadingComponent: React.ReactElement<any>;\r\n        if (isLastPage(this.props) && this.props.childDocumentsBeingLoaded) {\r\n            moreResultLoadingComponent = (\r\n                <div className=\"spinner-small\">\r\n                    <Spinner />\r\n                    <span> Loading more items</span>\r\n                </div>\r\n            );\r\n        }\r\n\r\n        return moreResultLoadingComponent;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\nimport { IndexRedirect, Route, Router, browserHistory } from \"react-router\";\r\n\r\nimport { AppLayoutPanel } from \"./rendering/appLayoutPanel/AppLayoutPanel\";\r\nimport { CreativeSearch } from \"./rendering/creativeSearch/CreativeSearch\";\r\nimport { DriCmsEntityEditor } from \"./editors/DriCmsEntityEditor\";\r\nimport { EntityJsonEditorHost } from \"./editors/EntityJsonEditorHost\";\r\nimport { ErrorPage } from \"cms-ui-components/errorPage/ErrorPage\";\r\nimport { HeaderLinkPage } from \"./presentation-logic/dataflows/appHeaderSection/HeaderLinkPage\";\r\nimport { ICatalystEditorProps } from \"./editors/ICatalystEditorProps\";\r\nimport { ISignedInAppProps } from \"./ISignedInAppProps\";\r\nimport { ImageDetailsPage } from \"./rendering/imageDetails/ImageDetailsPage\";\r\nimport { LightboxPage } from \"./rendering/lightbox/LightboxPage\";\r\nimport { LoadLightboxSourceEnum } from \"./experiences/lightbox/LoadLightboxSourceEnum\";\r\nimport { Routes } from \"./Routes\";\r\nimport { SearchAndSelect } from \"./rendering/searchAndSelect/SearchAndSelect\";\r\nimport { Spinner } from \"cms-ui-components/spinner/Spinner\";\r\nimport { ccsdk } from \"./globals/ccsdk\";\r\nimport { isFunction } from \"lodash-es\";\r\n\r\n/**\r\n * Class for the signed in App.\r\n * @class\r\n */\r\nexport class SignedInApp extends React.Component<ISignedInAppProps, {}> {\r\n\r\n    private connectedSearchAndSelect: React.ComponentClass<any>;\r\n\r\n    private connectedCreativeSearchPage: React.ComponentClass<any>;\r\n\r\n    private connectedLightboxPage: React.ComponentClass<any>;\r\n\r\n    private connectedImageDetailsPage: React.ComponentClass<any>;\r\n\r\n    /**\r\n     * SignedInApp constructor\r\n     * @constructor\r\n     * @param props\r\n     * @param context\r\n     */\r\n    constructor(props: ISignedInAppProps, context: any) {\r\n        super(props, context);\r\n\r\n        this.connectedSearchAndSelect = this.props.appBootstrapper.SearchAndSelectBootstrap.getConnectedComponentWithStateSelection(SearchAndSelect);\r\n\r\n        this.connectedCreativeSearchPage = this.props.appBootstrapper.CreativeSearchPageBootstrap.getConnectedComponentWithStateSelection(CreativeSearch);\r\n\r\n        this.connectedLightboxPage = this.props.appBootstrapper.LightboxPageBootstrap.getConnectedComponentWithStateSelection(LightboxPage);\r\n\r\n        this.connectedImageDetailsPage = this.props.appBootstrapper.ImageDetailsPageBootstrap.getConnectedComponentWithStateSelection(ImageDetailsPage);\r\n    }\r\n\r\n    /**\r\n     * Override parent component SingedOutApp rendering\r\n     */\r\n    public render(): React.ReactElement<ISignedInAppProps> {\r\n        // Render the spinner while user profile is loading. this should be invisible as the local profile reading speed is instant.\r\n        // But this code is needed for preventing severe flicking upon theme switch.\r\n        if (this.props.localUserProfileIsLoading) {\r\n            // There is really no need for the spinner as the user profile is loaded locally. Keeping it there in case anything goes wrong during local profile loading.\r\n            return (\r\n                <div className={\"userprofile-loading-spinner cuisdk-icon-size-normal\"} >\r\n                    <Spinner />\r\n                </div>\r\n            );\r\n        } else {\r\n            if (this.props.serviceError && !isFunction(this.props.serviceError)) {\r\n                browserHistory.push(\"/error\");\r\n            }\r\n\r\n            return (\r\n                <Router history={browserHistory}>\r\n                    <Route path=\"/\" component={AppLayoutPanel}>\r\n                        <IndexRedirect to=\"/search\" />\r\n                        <Route path={Routes.getSearchPageRoutePath()} key=\"search\" component={this.connectedSearchAndSelect} onEnter={() => this.props.appBootstrapper.AppHeaderSectionBootstrap.setCurrentPageClassName(HeaderLinkPage.editorial)} />\r\n                        <Route path={Routes.getCreativeSearchPageRoutePath()} key=\"creativesearch\" component={this.connectedCreativeSearchPage} onEnter={() => this.props.appBootstrapper.AppHeaderSectionBootstrap.setCurrentPageClassName(HeaderLinkPage.creative)} />\r\n                        <Route\r\n                            path={Routes.getLightboxPageRoutePath(false /* baseOnly */)}\r\n                            key=\"lightbox\"\r\n                            component={this.connectedLightboxPage}\r\n                            onEnter={(nextState) => {\r\n                                this.props.appBootstrapper.AppHeaderSectionBootstrap.setCurrentPageClassName(HeaderLinkPage.lightbox);\r\n                                const { lightboxId } = nextState.params;\r\n                                let loadLightboxSourceEnum = LoadLightboxSourceEnum.External;\r\n                                if (Routes.isRouteNavigationSourceInternal(nextState.location.state)) {\r\n                                    loadLightboxSourceEnum = LoadLightboxSourceEnum.Internal;\r\n                                }\r\n                                if (!!lightboxId) {\r\n                                    this.props.appBootstrapper.loadLightbox(lightboxId, loadLightboxSourceEnum);\r\n                                }\r\n                            }} />\r\n                        <Route\r\n                            path={Routes.getImagePageRoutePath()}\r\n                            key=\"image\"\r\n                            component={this.connectedImageDetailsPage}\r\n                            onEnter={(nextState) => {\r\n                                this.props.appBootstrapper.AppHeaderSectionBootstrap.setCurrentPageClassName(HeaderLinkPage.image);\r\n                                const { imageId } = nextState.params;\r\n                                if (!!imageId) {\r\n                                    this.props.appBootstrapper.ImageDetailsPageBootstrap.loadImageToDisplayDetails(imageId);\r\n                                } else {\r\n                                    // If there is no valid id present in url redirect user to search page\r\n                                    browserHistory.push(\"/search\");\r\n                                }\r\n                            }} />\r\n                        <Route path={Routes.getErrorPageRoutePath()} key=\"error\" component={() => <ErrorPage errorDescription={this.props.serviceError} backgroundImageUrl=\"https://img-s-msn-com.akamaized.net/tenant/cats/entityid/BB22vtS.img\" />} />\r\n                        <Route path={Routes.getEditorPageRoutePath()} key=\"editor\" component={(routerProps) => this.getEditorComponent(routerProps, true)} />\r\n                        <Route path={Routes.getWriteModeEditorPageRoutePath()} key=\"editor\" component={(routerProps) => this.getEditorComponent(routerProps, false)} />\r\n                    </Route>\r\n                </Router>\r\n            );\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Creates the editors\r\n     */\r\n    private getEditorComponent(routerProps: any, readonly: boolean): React.ReactElement<ICatalystEditorProps> {\r\n        const { entityId } = routerProps.routeParams;\r\n        if (!entityId) {\r\n            return null;\r\n        }\r\n\r\n        const Editor = readonly ? EntityJsonEditorHost : DriCmsEntityEditor;\r\n\r\n        return (\r\n            <Editor entityId={entityId} catTenantEntityManager={ccsdk.entityFactories.cats.entityManager} />\r\n        );\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nexport type PageNames = \"SearchAndSelect\" | \"Creative\" | \"Lightbox\";\r\n\r\n/**\r\n * Holds the constants for Page names\r\n * @type {string}\r\n */\r\n// supress the tslint rule for variable name. since this is a string enum, we want the const to be the same name as the type so that it behaves as a string enum when importing once, rather than import the type and const individually.\r\n// tslint:disable-next-line: variable-name\r\nexport const PageNames = {\r\n    Creative: \"Creative\" as PageNames,\r\n    SearchAndSelect: \"SearchAndSelect\" as PageNames,\r\n    Lightbox: \"Lightbox\" as PageNames,\r\n    ImageDetails: \"ImageDetails\" as PageNames\r\n};\r\n\r\nexport type AreaOfPage =\r\n    \"application-topNav\"\r\n    | \"searchAndSelect-filterPanel\"\r\n    | \"searchAndSelect-searchBar\"\r\n    | \"searchAndSelect-resultsView\"\r\n    | \"searchAndSelect-imagePreviewModal\"\r\n    | \"searchAndSelect-addToLightboxModal\"\r\n    | \"creative-filterPanel\"\r\n    | \"creative-searchBar\"\r\n    | \"creative-resultsView\"\r\n    | \"creative-imagePreviewModal\"\r\n    | \"creative-addToLightboxModal\"\r\n    | \"lightbox-selectBoardPanel\"\r\n    | \"lightbox-boardContents\"\r\n    | \"lightbox-imagePreviewModal\"\r\n    | \"imagePreviewModal\"\r\n    | \"imageDetailsView\"\r\n    ;\r\n\r\n/**\r\n * Holds the constants for Area of Page\r\n * @type {string}\r\n */\r\n// supress the tslint rule for variable name. since this is a string enum, we want the const to be the same name as the type so that it behaves as a string enum when importing once, rather than import the type and const individually.\r\n// tslint:disable-next-line: variable-name\r\nexport const AreaOfPage = {\r\n    applicationTopNav: \"application-topNav\" as AreaOfPage,\r\n    searchAndSelectFilterPanel: \"searchAndSelect-filterPanel\" as AreaOfPage,\r\n    searchAndSelectSearchBar: \"searchAndSelect-searchBar\" as AreaOfPage,\r\n    searchAndSelectResultsView: \"searchAndSelect-resultsView\" as AreaOfPage,\r\n    searchAndSelectImagePreviewModal: \"searchAndSelect-imagePreviewModal\" as AreaOfPage,\r\n    searchAndSelectAddToLightboxModal: \"searchAndSelect-addToLightboxModal\" as AreaOfPage,\r\n    creativeFilterPanel: \"creative-filterPanel\" as AreaOfPage,\r\n    creativeSearchBar: \"creative-searchBar\" as AreaOfPage,\r\n    creativeResultsView: \"creative-resultsView\" as AreaOfPage,\r\n    creativeImagePreviewModal: \"creative-imagePreviewModal\" as AreaOfPage,\r\n    creativeAddToLightboxModal: \"creative-addToLightboxModal\" as AreaOfPage,\r\n    lightboxSelectBoardPanel: \"lightbox-selectBoardPanel\" as AreaOfPage,\r\n    lightboxBoardContents: \"lightbox-boardContents\" as AreaOfPage,\r\n    lightboxImagePreviewModal: \"lightbox-imagePreviewModal\" as AreaOfPage,\r\n    ImagePreviewModal: \"imagePreviewModal\" as AreaOfPage,\r\n    ImageDetailsView: \"imageDetailsView\" as AreaOfPage\r\n};","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as URL from \"url-parse\";\r\n\r\nimport { UrlExtension } from \"cms-ui-presentationlogic/imageResizing/UrlExtension\";\r\n\r\n/**\r\n * @enum Service resize modes.\r\n */\r\nexport enum ResizeServiceMode {\r\n    LetterBox = 1,\r\n    Scale = 2,\r\n    Stretch = 3,\r\n    Crop = 4,\r\n    FocalCrop = 5,\r\n    TMXResize = 6\r\n}\r\n\r\n/**\r\n * Provides resize service URI builder helper.\r\n * @class\r\n */\r\nexport class ResizeService {\r\n\r\n    /**\r\n     * Builds address for resize image service.\r\n     * @method\r\n     * @param ImageUri Source address of image to be resized.\r\n     * @param imageWidth Target image width in pixels.\r\n     * @param imageHeight Target image height in pixels.\r\n     * @param backgroundColor Background color of LetterBox resize mode.\r\n     * @param mode Resize mode.\r\n     * @param quality Target image quality in percent.\r\n     */\r\n    public static getUrifromImageUri(ImageUri: string, imageWidth: number, imageHeight: number, backgroundColor?: string, mode?: ResizeServiceMode, quality?: number): string {\r\n\r\n        const urlWithoutProtocol = UrlExtension.removeProtocol(ImageUri);\r\n        const queryUri = URL(urlWithoutProtocol).toString();\r\n        let queryParams: { [key: string]: any } = {\r\n            \"w\": imageWidth,\r\n            \"h\": imageHeight,\r\n            \"b\": backgroundColor,\r\n            \"m\": mode,\r\n            \"q\": quality\r\n        };\r\n\r\n        const params = Object.keys(queryParams)\r\n            .reduce((args, key) => {\r\n                        if (queryParams[key]) {\r\n                            args.push(key + \"=\" + queryParams[key]);\r\n                        }\r\n                        return args;\r\n                    },\r\n                    []).join(\"&\");\r\n\r\n        return queryUri + (queryUri.indexOf(\"?\") > -1 ? \"&\" : \"?\") + params;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\nimport { Button, Overlay, Popover } from \"react-bootstrap\";\r\n\r\nimport { IAddToLightboxOverlayProps } from \"./IAddToLightboxOverlayProps\";\r\nimport { ICollectionInformation } from \"cms-ui-components/manageCollection/ICollectionInformation\";\r\nimport { ImagePreviewModal } from \"../imagePreviewModal/ImagePreviewModal\";\r\nimport { ManageCollection } from \"cms-ui-components/manageCollection/ManageCollection\";\r\nimport { Spinner } from \"cms-ui-components/spinner/Spinner\";\r\n\r\nexport class AddToLightboxOverlay<itemProps> extends React.Component<IAddToLightboxOverlayProps<itemProps>, any> {\r\n\r\n    /**\r\n     * constructor\r\n     * @param props {IAddToLightboxOverlayProps<itemProps>} props\r\n     * @param context {any} context\r\n     */\r\n    constructor(props: IAddToLightboxOverlayProps<itemProps>, context: any) {\r\n        super(props, context);\r\n    }\r\n\r\n    /**\r\n     * React render function\r\n     * @method\r\n     */\r\n    public render(): React.ReactElement<itemProps> {\r\n        if (!this.props.addToLightboxOverlayIsVisible) {\r\n            return null;\r\n        }\r\n\r\n        const enableAdd = this.props.collections.findIndex((collection) => (collection.selected)) !== -1;\r\n        const layoutInformation = isFinite(this.props.itemToAddWidth) && isFinite(this.props.itemToAddHeight) ?\r\n            ImagePreviewModal.determineLayoutInformation(this.props.itemToAddWidth, this.props.itemToAddHeight) : null;\r\n\r\n        const inlineStyle = !!layoutInformation && layoutInformation.textWidth ? { width: layoutInformation.textWidth } : null;\r\n\r\n        return (\r\n            <div className=\"add-to-lightbox-overlay\" style={inlineStyle}>\r\n                <Overlay\r\n                    show={this.props.addToLightboxOverlayIsVisible}\r\n                    placement=\"bottom\"\r\n                    container={this}\r\n                    target={this.props.addToLightboxOverlayTarget}\r\n                >\r\n                    <Popover id=\"add-to-lightbox\">\r\n                        <ManageCollection {...this.props} />\r\n                        <Button className=\"addto-lb-btn\" disabled={!enableAdd} onClick={(eventargs) => { if (!this.props.isImageAdditionInProgress) { this.onAddToCollectionsInvoked(eventargs); } }}> {this.props.isImageAdditionInProgress ? (<div className=\"spinner-small\"><Spinner /></div>) : \"Add\"}</Button>\r\n                        <Button className=\"close-btn\" onClick={(_eventargs) => { this.props.hideAddToLightboxOverlay(); }}>Close</Button>\r\n                    </Popover>\r\n                </Overlay>\r\n            </div>\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Prepare the entity and add it to the collection selected.\r\n     * @param eventargs\r\n     */\r\n    private onAddToCollectionsInvoked(eventargs: React.SyntheticEvent<Button>): void {\r\n        if (this.props.onAddToCollections) {\r\n            const selectedCollectionsWithState = this.props.collections.filter(collectionWithSelectionState => collectionWithSelectionState.selected);\r\n            const selectedCollections: ICollectionInformation[] = selectedCollectionsWithState.map(collectionWithSelectionState => collectionWithSelectionState.collection);\r\n            this.props.onAddToCollections(eventargs.nativeEvent, selectedCollections);\r\n        }\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nexport type ThumbnailConfig = {\r\n    width: number,\r\n    height: number,\r\n    margin: number,\r\n    totalWidth: number,\r\n    totalHeight: number,\r\n    totalMargin: number,\r\n    gridTileWidth: number,\r\n    gridTileHeight: number,\r\n    gridTileImageWidth: number,\r\n    gridTileImageHeight: number\r\n};\r\n\r\n/**\r\n * App constants\r\n * @class\r\n */\r\nexport class AppConstants {\r\n\r\n    public static catalystProdUrl: string = \"https://catalyst.microsoft.com\";\r\n\r\n    // Below are the disallowed search characters\r\n    public static disallowedSearchChars: RegExp = new RegExp(/\\!|\\^|\\(|\\)|\\[|\\]|\\{|\\}|\\\\|\\/|\\?|\\~/g);\r\n\r\n    // tslint:disable-next-line:ext-variable-name\r\n    public static MillisecondsInADay: number = 86400000;\r\n\r\n    public static width: number = 320;\r\n\r\n    public static height: number = 250;\r\n\r\n    public static margin: number = 5;\r\n\r\n    public static gridTileImageWidthHeight: number = 200;\r\n\r\n    public static lightboxTileInnerMargin: number = 15;\r\n\r\n    public static lightboxTileTextboxHeight: number = 38;\r\n\r\n    /**\r\n     * The list of fields that we should fetch for ImageFileData entities\r\n     * @type {string[]}\r\n     */\r\n    public static requiredFieldListForImageFileData: string[] = [\"_id\", \"sourceId\", \"$type\", \"_links\", \"_name\", \"href\", \"thumbnail\", \"width\", \"height\", \"attribution\", \"location\", \"fileMetadata\", \"title\", \"caption\", \"keywords\", \"photographer\", \"orientation\", \"altText\", \"displayPublishedDateTime\", \"processedByIngestion\"];\r\n\r\n    // tslint:disable-next-line:ext-variable-name\r\n    public static OCID: string = \"tools-web-cat\";\r\n\r\n    /**\r\n     * One service ApiKey.\r\n     * One service requires this parameter to be set.\r\n     * The value is the same for all environments and is provided by the one service team.\r\n     * @type {string}\r\n     */\r\n    public static OneServiceApiKey: string = \"MitbLaRkTTBadtWpgTm3YXffKYTN8NZEM0RVn51lkM\";\r\n\r\n    /** Defines the size of a thumbnail\r\n     *  These need to match the width and height in TileWidthAndHeightMixin.scss.\r\n     *  @type {ThumbnailConfig}\r\n     */\r\n    public static thumbnailConfig: ThumbnailConfig = {\r\n        width: AppConstants.width,\r\n        height: AppConstants.height,\r\n        margin: AppConstants.margin,\r\n        totalWidth: AppConstants.width + AppConstants.margin * 2, // 330\r\n        totalHeight: AppConstants.height + AppConstants.margin * 2, // 260\r\n        totalMargin: AppConstants.margin * 2, // 10\r\n        gridTileImageWidth: AppConstants.gridTileImageWidthHeight, // 200\r\n        gridTileImageHeight: AppConstants.gridTileImageWidthHeight, // 200\r\n        gridTileWidth: AppConstants.gridTileImageWidthHeight + AppConstants.lightboxTileInnerMargin * 2 + AppConstants.margin * 2,\r\n        // square image frame + 15*2 margin space + margin to offset the row width calculated touches the right browser frame. total: 240\r\n        gridTileHeight: AppConstants.gridTileImageWidthHeight + AppConstants.lightboxTileInnerMargin * 3 + AppConstants.lightboxTileTextboxHeight + AppConstants.margin * 2\r\n        // square image frame + 15*2 margin space + description text space 38 + description text bottom margin 5 + 5*2 tile spacing. total: 293\r\n    };\r\n\r\n    /** The number of thumbnails to show per page of results\r\n     *  This is an approximate number, as we may show slightly more or slightly less than this make sure we have a full row of images if possible.\r\n     *  @type { number }\r\n     */\r\n    public static thumbnailsPerPage: number = 50;\r\n\r\n    /** The maximum number of lightboxes to get when the user searches for lightboxes\r\n     *  @type { number }\r\n     */\r\n    public static maxLightboxSearchResults: number = 150;\r\n\r\n    // Set of constants that contains data used to drive the `on-demand` load of new data as the user browser the results.\r\n    public static resultsBrowsing: any = {\r\n\r\n        // max number of results Catalyst shows on any search.\r\n        maximumNumberOfResults: 1000,\r\n\r\n        // number of milliseconds used to throttle the `scroll` events.\r\n        scrollDebounceTime: 100,\r\n\r\n        // triggering the load of new data when the scroll position is 90% of the entire scroll height.\r\n        // keeping open, as an option, to specify a different value for editorial and creative searches.\r\n        scrollbarThresholdPercentage: {\r\n            editorial: 0.9,\r\n\r\n            creative: 0.9\r\n        }\r\n    };\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\n/**\r\n * Allows to convert error string/object to combined string or string array representation.\r\n * @class\r\n */\r\nexport class AppErrorConverter {\r\n\r\n    /**\r\n     * Missing item error code.\r\n     * @constant\r\n     */\r\n    public static readonly ServiceErrorCodeLinkNotExist: string = \"LinkNotExist\";\r\n\r\n    /**\r\n     * Converts error object/string to its friendly string representation.\r\n     * @param {any} error - Error to convert.\r\n     * @param {boolean} makeDetailed - Determines details level of error string.\r\n     * @param {string} prefix - Error string prefix.\r\n     * @returns {string} Combined error message.\r\n     */\r\n    public static toString(error: any, makeDetailed: boolean = false, prefix?: string): string {\r\n        return AppErrorConverter.toStringArray(error, makeDetailed, prefix).join(\" \");\r\n    }\r\n\r\n    /**\r\n     * Converts error object/string to its friendly string representation.\r\n     * @param {any} error - Error to convert.\r\n     * @param {boolean} makeDetailed - Determines details level of error string array.\r\n     * @param {string} prefix - Error string prefix.\r\n     * @returns {string[]} Combined error message string array.\r\n     */\r\n    public static toStringArray(error: any, makeDetailed: boolean = false, prefix?: string): string[] {\r\n        let result = prefix ? [prefix] : [];\r\n\r\n        if (error) {\r\n            if (typeof error === \"string\") {\r\n                result.push(error);\r\n            } else {\r\n                result.push(error.errorMessage);\r\n                if (error.innerError && makeDetailed) {\r\n                    result.push(error.innerError.errorMessage);\r\n                }\r\n            }\r\n        } else {\r\n            result.push(\"Unknown error occurred, this operation could not be completed.\");\r\n        }\r\n\r\n        return result;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { ActionMap } from \"cms-ui-redux/ActionMap\";\r\nimport { NamespacePrefixActionsDefinitionBase } from \"cms-ui-redux/NamespacePrefixActionsDefinitionBase\";\r\nimport { HeaderLinkPageType } from \"./HeaderLinkPage\";\r\n\r\nexport type HeaderLinkClickedSignature = (pageHeaderClassName: HeaderLinkPageType) => void;\r\n\r\n/**\r\n * Exposes a redux action to raise reset filter.\r\n * @class\r\n */\r\nexport class AppHeaderActions extends NamespacePrefixActionsDefinitionBase {\r\n    /** Defines the action indicating that the header link has clicked.\r\n     */\r\n    private headerLinkClicked: ActionMap<HeaderLinkClickedSignature> = new ActionMap<HeaderLinkClickedSignature>(this.namespace + \"HeaderLinkClickedSignature\");\r\n\r\n    /**\r\n     * Initializes a new instance of the 'AppHeaderActions' class.\r\n     * @constructor\r\n     * @param namespacePrefix {string} Optional prefix to add to the namespace used to distinguish between different instances of this data flow.\r\n     */\r\n    constructor(namespacePrefix?: string) {\r\n        super(\"AppHeader\", namespacePrefix);\r\n    }\r\n\r\n    /** Accessor for the Header link click action.\r\n     * @type {ActionMap<HeaderLinkClickedSignature>}\r\n     */\r\n    public get HeaderLinkClicked(): ActionMap<HeaderLinkClickedSignature> {\r\n        return this.headerLinkClicked;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { ActionHandler } from \"cms-ui-redux/ActionHandler\";\r\nimport { AppHeaderActions } from \"./AppHeaderActions\";\r\nimport { HeaderLinkPageType } from \"./HeaderLinkPage\";\r\nimport { IActionPayload } from \"cms-ui-redux/IActionPayload\";\r\nimport { IAppHeaderState } from \"./IAppHeaderState\";\r\nimport { ICollapsibleNotificationsState } from \"cms-ui-presentationlogic/dataflows/collapsibleNotifications/ICollapsibleNotificationsState\";\r\nimport { IReducer } from \"cms-ui-redux/IReducer\";\r\nimport { IUserAuthenticationState } from \"cms-ui-presentationlogic/dataflows/userAuthentication/IUserAuthenticationState\";\r\nimport { NamespaceCheckReducerBase } from \"cms-ui-redux/NamespaceCheckReducerBase\";\r\nimport { clone } from \"lodash-es\";\r\n\r\n/**\r\n * The top-level app redux reducer. Manages a `routeChanged` action and delegate others to its children reducers.\r\n * @class\r\n */\r\nexport class AppHeaderSectionReducer extends NamespaceCheckReducerBase<IAppHeaderState> {\r\n\r\n    /**\r\n     * @constructor\r\n     * @param appHeaderActions {IReducer<AppHeaderActions>} App header actions\r\n     * @param userAuthenticationReducer {IReducer<IUserAuthenticationState>} Reducer for authentication actions\r\n     * @param notificationsPopupReducer {IReducer<ICollapsibleNotificationsState>} Reducer for notifcation actions\r\n     */\r\n    constructor(\r\n        private appHeaderActions: AppHeaderActions,\r\n        private userAuthenticationReducer: IReducer<IUserAuthenticationState>,\r\n        private notificationsPopupReducer: IReducer<ICollapsibleNotificationsState>) {\r\n\r\n        super([appHeaderActions.namespace], [userAuthenticationReducer, notificationsPopupReducer]);\r\n\r\n        if (!userAuthenticationReducer) {\r\n            throw \"The userAuthenticationReducer parameter is required.\";\r\n        }\r\n\r\n        if (!notificationsPopupReducer) {\r\n            throw \"The notificationsPopupReducer parameter is required.\";\r\n        }\r\n    }\r\n\r\n    /**\r\n     * @method\r\n     * @param state {IAppHeaderState} The state to reduce\r\n     * @param actionPayload {IActionPayload} The payload to apply\r\n     * @returns {IAppHeaderState} The new state.\r\n     */\r\n    public reduce(state: IAppHeaderState, actionPayload: IActionPayload): IAppHeaderState {\r\n        if (!state) {\r\n            throw \"The state parameter is required.\";\r\n        }\r\n\r\n        if (!actionPayload) {\r\n            throw \"The actionPayload parameter is required.\";\r\n        }\r\n\r\n        let newState = clone(state);\r\n\r\n        ActionHandler.handleAction(actionPayload, this.appHeaderActions.HeaderLinkClicked, (pageName: HeaderLinkPageType) => {\r\n            newState.pageHeaderClassName = pageName;\r\n        });\r\n\r\n        // delegate user authentication state mutation to its reducer\r\n        if (this.userAuthenticationReducer.canReduce(actionPayload)) {\r\n            newState.authenticationState = this.userAuthenticationReducer.reduce(state.authenticationState, actionPayload);\r\n        }\r\n\r\n        // delegate NotificationList state mutation to its reducer\r\n        if (this.notificationsPopupReducer.canReduce(actionPayload)) {\r\n            newState.notificationsState = this.notificationsPopupReducer.reduce(state.notificationsState, actionPayload);\r\n        }\r\n\r\n        return newState;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { HeaderLinkPage, HeaderLinkPageType } from \"../../presentation-logic/dataflows/appHeaderSection/HeaderLinkPage\";\r\n\r\nimport { AppHeaderActions } from \"../../presentation-logic/dataflows/appHeaderSection/AppHeaderActions\";\r\nimport { AppHeaderSectionReducer } from \"../../presentation-logic/dataflows/appHeaderSection/AppHeaderSectionReducer\";\r\nimport { CollapsibleNotificationsReducer } from \"cms-ui-presentationlogic/dataflows/collapsibleNotifications/CollapsibleNotificationsReducer\";\r\nimport { ComponentBootstrapper } from \"cms-ui-views/ComponentBootstrapper\";\r\nimport { IAppHeaderSectionProps } from \"../../rendering/appHeaderSection/IAppHeaderSectionProps\";\r\nimport { IAppHeaderState } from \"../../presentation-logic/dataflows/appHeaderSection/IAppHeaderState\";\r\nimport { ICollapsibleNotificationsState } from \"cms-ui-presentationlogic/dataflows/collapsibleNotifications/ICollapsibleNotificationsState\";\r\nimport { IDispatch } from \"redux\";\r\nimport { IReducer } from \"cms-ui-redux/IReducer\";\r\nimport { IUserAuthenticationState } from \"cms-ui-presentationlogic/dataflows/userAuthentication/IUserAuthenticationState\";\r\nimport { NotificationsPopupBootstrapper } from \"cms-ui-views/notificationsPopup/NotificationsPopupBootstrapper\";\r\nimport { ReduxBootstrapper } from \"cms-ui-views/ReduxBootstrapper\";\r\nimport { UserBoxBootstrapper } from \"cms-ui-views/userBox/UserBoxBootstrapper\";\r\nimport { authenticationManager } from \"../../globals/authentication\";\r\nimport { merge } from \"lodash-es\";\r\n\r\n/**\r\n * The bootstrapper that wires the <AppHeaderSection /> component into Redux.\r\n * @class\r\n */\r\nexport class AppHeaderSectionBootstrapper<TParentState> extends ComponentBootstrapper<IAppHeaderState, IAppHeaderSectionProps, TParentState> {\r\n    /**\r\n     * Bootstrapper for user box\r\n     * @type {UserBoxBootstrapper<IAppHeaderState>}\r\n     */\r\n    private userBoxBootstrapper: UserBoxBootstrapper<IAppHeaderState>;\r\n\r\n    /**\r\n     * Bootstrapper for notifications\r\n     * @type {NotificationsPopupBootstrapper}\r\n     */\r\n    private notificationsPopupBootstrapper: NotificationsPopupBootstrapper;\r\n\r\n    /**\r\n     * The App header link click actions\r\n     * @type {AppHeaderActions}\r\n     */\r\n    private appHeaderActions: AppHeaderActions;\r\n\r\n    /**\r\n     * @constructor\r\n     * @param getActiveLightboxId {() => string} Callback to get the active lightbox id which is used in the construction for the Lightobx link\r\n     * @param parentBootstrapper {ComponentBootstrapper<TParentState, any, any> | RootComponentBootstrapper<TParentState>}\r\n     * @param stateSelector {function}\r\n     */\r\n    constructor(\r\n        private getActiveLightboxId: () => string,\r\n        parentBootstrapper?: ComponentBootstrapper<TParentState, any, any> | ReduxBootstrapper<TParentState>,\r\n        stateSelector?: (parentState: TParentState) => IAppHeaderState) {\r\n\r\n        super(parentBootstrapper, stateSelector);\r\n\r\n        this.userBoxBootstrapper = new UserBoxBootstrapper(\r\n            authenticationManager,\r\n            this as any,\r\n            (state: IAppHeaderState): IUserAuthenticationState => {\r\n                return state.authenticationState;\r\n            }\r\n        );\r\n\r\n        this.notificationsPopupBootstrapper = new NotificationsPopupBootstrapper(\r\n            (state: IAppHeaderState): ICollapsibleNotificationsState => {\r\n                return state.notificationsState;\r\n            },\r\n            this);\r\n\r\n        this.appHeaderActions = new AppHeaderActions();\r\n\r\n        this.onHeaderLinkClicked = this.onHeaderLinkClicked.bind(this);\r\n    }\r\n\r\n    /**\r\n     * Initializes the initial state of the component.\r\n     * @method\r\n     * @returns {IAppHeaderState} The initial state of the component.\r\n     */\r\n    public getInitialState(): IAppHeaderState {\r\n        let pageHeaderClassName = HeaderLinkPage.editorial;\r\n\r\n        const initialState: IAppHeaderState = {\r\n            authenticationState: this.userBoxBootstrapper.getInitialState(),\r\n            notificationsState: this.notificationsPopupBootstrapper.getInitialState(),\r\n            pageHeaderClassName: pageHeaderClassName\r\n        };\r\n\r\n        return initialState;\r\n    }\r\n\r\n    /**\r\n     * Initializes the default properties of the component.\r\n     * @method\r\n     * @returns {IAppHeaderSectionProps} The default props of the component.\r\n     */\r\n    public getDefaultProps(): IAppHeaderSectionProps {\r\n        const userBoxDefaultProps = this.userBoxBootstrapper.getDefaultProps();\r\n        const notificationsDefaultProps = this.notificationsPopupBootstrapper.getDefaultProps();\r\n        const pageHeaderClassName = HeaderLinkPage.editorial;\r\n        let defaultProps: IAppHeaderSectionProps = merge(\r\n            { pageHeaderClassName },\r\n            userBoxDefaultProps,\r\n            notificationsDefaultProps);\r\n\r\n        return defaultProps;\r\n    }\r\n\r\n    /**\r\n     * Creates the reducer that will manage IAppHeaderState.\r\n     * @method\r\n     * @returns {IReducer<IAppHeaderState>} The reducer that will manage IAppHeaderState.\r\n     */\r\n    public createRootReducer(): IReducer<IAppHeaderState> {\r\n        const userAuthenticationReducer = this.userBoxBootstrapper.createRootReducer();\r\n        const notificationsReducer = new CollapsibleNotificationsReducer();\r\n\r\n        return new AppHeaderSectionReducer(this.appHeaderActions, userAuthenticationReducer, notificationsReducer);\r\n    }\r\n\r\n    /**\r\n     * Redux mapper used to map the current state to props the component use to render itself.\r\n     * @method\r\n     * @param {IAppHeaderState} state The current state of the component.\r\n     * @param {IAppHeaderSectionProps} ownProps The set of pure properties of the component.\r\n     * @returns {IAppHeaderSectionProps} An enriched set of props.\r\n     */\r\n    public mapStateToProps(state: IAppHeaderState, ownProps: IAppHeaderSectionProps): IAppHeaderSectionProps {\r\n        const userboxProps = this.userBoxBootstrapper.mapStateToProps(state.authenticationState, ownProps);\r\n        let notificationListProps = this.notificationsPopupBootstrapper.mapStateToProps(state.notificationsState);\r\n\r\n        return merge(userboxProps, notificationListProps, { pageHeaderClassName: state.pageHeaderClassName, activeLightboxId: this.getActiveLightboxId() });\r\n    }\r\n\r\n    /**\r\n     * Inject into props redux action creators.\r\n     * @method\r\n     * @param {IDispatch} dispatch The redux dispatch function.\r\n     * @param {IAppHeaderSectionProps} ownProps The set of pure properties of the component.\r\n     * @returns {IAppHeaderSectionProps} An enriched set of props.\r\n     */\r\n    public mapDispatchToProps(dispatch: IDispatch, ownProps: IAppHeaderSectionProps): IAppHeaderSectionProps {\r\n        const userboxProps = this.userBoxBootstrapper.mapDispatchToProps(dispatch, ownProps);\r\n        const notificationListProps = this.notificationsPopupBootstrapper.mapDispatchToProps();\r\n\r\n        return merge(\r\n            {\r\n                onHeaderLinkClicked: this.onHeaderLinkClicked,\r\n                onEditorialSearchLinkClicked: (_event: Event) => { this.setCurrentPageClassName(HeaderLinkPage.editorial); },\r\n                onCreativeSearchLinkClicked: (_event: Event) => { this.setCurrentPageClassName(HeaderLinkPage.creative); }\r\n            },\r\n            userboxProps,\r\n            notificationListProps\r\n        ) as IAppHeaderSectionProps;\r\n    }\r\n\r\n    /**\r\n     * Initialize the userbox bootstrapper before the component is created.\r\n     * @method\r\n     */\r\n    public onBeforeComponentCreated(): void {\r\n        this.userBoxBootstrapper.onBeforeComponentCreated();\r\n    }\r\n\r\n    /**\r\n     * Set the current page name in the header\r\n     * @param {HeaderLinkPageType} pageName The current rendered page name .\r\n     * @method\r\n     */\r\n    public setCurrentPageClassName(pageName: HeaderLinkPageType): void {\r\n        this.appHeaderActions.HeaderLinkClicked.getActionSender(this.store)(pageName);\r\n    }\r\n\r\n    /**\r\n     * Handler to handle the link clicked in header. It resets the search state\r\n     * @method\r\n     */\r\n    private onHeaderLinkClicked(_event: any): void {\r\n        this.appHeaderActions.HeaderLinkClicked.getActionSender(this.store)(HeaderLinkPage.editorial);\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\n/**\r\n * Enum representing the type of the field.\r\n * We currently only support three types - fields that contain a date, fields that contain string value(s), and fields that contain numbers.\r\n * @enum\r\n */\r\nexport enum FieldType {\r\n    DateField,\r\n    StringField,\r\n    NumberField\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\n/**\r\n * Enum representing the selection mode of a rule that is filtering on a string field.\r\n * @enum\r\n */\r\nexport enum FilterRuleSelectionMode {\r\n    SingleSelect,\r\n    MultiSelect\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\n/**\r\n * A temporary workaround utility for escape ' and + in search query\r\n * Delete this when CCSDK implements this escape from search manager level.\r\n */\r\nexport class CmsStringEscape {\r\n    /**\r\n     * Escape ' to ''\r\n     * @param input {string}\r\n     */\r\n    public static escape(input: string): string {\r\n        let result = input;\r\n\r\n        if (!!result) {\r\n            let split = result.split(\"'\");\r\n\r\n            if (split.length > 1) {\r\n                result = split.join(\"''\");\r\n            }\r\n        }\r\n\r\n        return result;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { CreateFilterRuleData, IFilterRules } from \"../searchAndSelect/FilterRules\";\r\n\r\nimport { ActionDispatchCancellationToken } from \"cms-ui-redux/ActionDispatchCancellationToken\";\r\nimport { BusinessLogicFactory } from \"cms-businesslogic/factory/BusinessLogicFactory\";\r\nimport { CmsStringEscape } from \"../../common/stringEscape\";\r\nimport { EntityListActions } from \"cms-ui-presentationlogic/dataflows/entityList/EntityListActions\";\r\nimport { ErrorType } from \"clientcore-base-businesslogic/error/ErrorType\";\r\nimport { IActionDispatchCancellationToken } from \"cms-ui-redux/IActionDispatchCancellationToken\";\r\nimport { IActivityLogItem } from \"clientcore-infrastructure-analytics/models/IActivityLogItem\";\r\nimport { ICatalystSearchManager } from \"./ICatalystSearchManager\";\r\nimport { IContinuationToken } from \"cms-businesslogic/IContinuationToken\";\r\nimport { IEntity } from \"cms-models/IEntity\";\r\nimport { IEntityListState } from \"cms-ui-presentationlogic/dataflows/entityList/IEntityListState\";\r\nimport { IEntityWithMetadata } from \"cms-businesslogic/entity/IEntityWithMetadata\";\r\nimport { IError } from \"cms-infrastructure/error/IError\";\r\nimport { IErrorResponse } from \"clientcore-base-serviceclients/response/IErrorResponse\";\r\nimport { IInstrumentationClient } from \"../../instrumentation/instrumentationClient/IInstrumentationClient\";\r\nimport { IOrderByItem } from \"cms-businesslogic/search/orderby/IOrderByItem\";\r\nimport { ISearchActionCreator } from \"cms-ui-presentationlogic/dataflows/entityList/ISearchActionCreator\";\r\nimport { IStore } from \"redux\";\r\nimport { Predicate } from \"cms-businesslogic/search/filter/Predicate\";\r\nimport { PromiseExtension } from \"cms-infrastructure/promise-extension/PromiseExtension\";\r\nimport { SearchActionCreator } from \"cms-ui-presentationlogic/dataflows/entityList/SearchActionCreator\";\r\nimport { SearchIndex } from \"cms-ui-presentationlogic/dataflows/entityList/SearchIndex\";\r\nimport { SearchQueryMatchCriteria } from \"cms-businesslogic/search/query/SearchQueryMatchCriteria\";\r\nimport { SectionListSearchScopeOptions } from \"cms-ui-presentationlogic/dataflows/entityList/SectionListSearchScopeOptions\";\r\nimport { isNil } from \"lodash-es\";\r\n\r\n/**\r\n * Bootstrapper for the Signed In application.\r\n * @class\r\n */\r\nexport class CatalystSearchManager implements ICatalystSearchManager {\r\n\r\n    /**\r\n     * The list of fields that we should fetch.\r\n     * @type {string[]}\r\n     */\r\n    private static RequiredFieldList: string[] = [\"_id\", \"$type\", \"_links\", \"_name\", \"href\", \"thumbnail\", \"width\", \"height\", \"attribution\", \"location\", \"fileMetadata\", \"title\", \"caption\", \"keywords\", \"photographer\", \"orientation\", \"altText\", \"displayPublishedDateTime\"];\r\n\r\n    /** The current Predicate to apply to a search\r\n     * @type {Predicate}\r\n     */\r\n    private filterBy: Predicate;\r\n\r\n    /** Activity which is re-created every time a search is executed.\r\n     *  Used as the parent for other activities that happen in the context of the search results of this search (e.g. download an image)\r\n     * @type {IActivityLogItem}\r\n     */\r\n    private searchActivity: IActivityLogItem;\r\n\r\n    /**\r\n     * The filtered action creator for loading entities associated with a section\r\n     * @type {ISearchActionCreator}\r\n     */\r\n    private searchActionCreator: ISearchActionCreator;\r\n\r\n    /** An instance of the `EntityListActions` class.\r\n     * @type {EntityListActions}\r\n     */\r\n    private entityListActions: EntityListActions;\r\n\r\n    // Field filter rules\r\n    private filterRules: IFilterRules;\r\n\r\n    /**\r\n     * Cancellation token so we can cancel loading (or at least the dispatching of the action when search completes)\r\n     * when the user has decided to start a new search.\r\n     * @type {IActionDispatchCancellationToken}\r\n     */\r\n    private searchCancellationToken: IActionDispatchCancellationToken;\r\n\r\n    /**\r\n     * Store for search actions to disptach action to.\r\n     */\r\n    private store: IStore<IEntityListState>;\r\n\r\n    /**\r\n     * Initializes a new instance of the 'CatalystSearchManager' class.\r\n     * @constructor\r\n     * @param businessLogicFactory {BusinessLogicFactory} Used to construct business logic managers to use when interacting with the Catalyst (CATS) tenant.\r\n     * @param onNewSearchInvokedCallback {() => void)} A callback to be invoked when a new search is being executed. Passed to the FilteredSectionListActionCreator.\r\n     * @param instrumentationClient {IInstrumentationClient} Provides support for instrumentation.\r\n     * @param actionNamespacePrefix {string} Optional prefix to add to the namespace used to distinguish actions created by this bootstrapper.\r\n     */\r\n    constructor(\r\n        private businessLogicFactory: BusinessLogicFactory,\r\n        protected onNewSearchInvokedCallback: () => void,\r\n        protected instrumentationClient: IInstrumentationClient,\r\n        actionNamespacePrefix?: string) {\r\n\r\n        if (!businessLogicFactory) {\r\n            throw \"The businessLogicFactory parameter is required.\";\r\n        }\r\n\r\n        if (!instrumentationClient) {\r\n            throw \"The instrumentationClient parameter is required.\";\r\n        }\r\n\r\n        this.filterRules = CreateFilterRuleData();\r\n        this.searchCancellationToken = null;\r\n        this.entityListActions = new EntityListActions(actionNamespacePrefix);\r\n        this.getFilter = this.getFilter.bind(this);\r\n    }\r\n\r\n    /**\r\n     * Ends the current search activity and creates a new one\r\n     * @method\r\n     * @returns the created activity\r\n     */\r\n    public endCurrentAndCreateNewSearchActivity(): IActivityLogItem {\r\n        if (!isNil(this.searchActivity)) {\r\n            this.instrumentationClient.ActivityLoggingService.endActivity(this.searchActivity);\r\n        }\r\n        this.searchActivity = this.instrumentationClient.ActivityLoggingService.createActivity(\"EditorialRootSearchActivity\", this.instrumentationClient.RootActivity);\r\n        return this.SearchActivity;\r\n    }\r\n\r\n    /**\r\n     * Executes the Search for pre flight authentication checks.\r\n     * note: we execute a search here rather than attempting to read a specific document as its both more reliable and more authentic.\r\n     * @method\r\n     * @returns {Promise<IEntityWithMetadata<IEntity>[]>} The promise that the service call returns.\r\n     */\r\n    public executeSearchForPreFlightCheck(): Promise<IEntityWithMetadata<IEntity>[]> {\r\n\r\n        // this activity is used to track the perf of the search execution.\r\n        const searchActivity = this.endCurrentAndCreateNewSearchActivity();\r\n        const searchForFirstPageEntitiesActivity = this.instrumentationClient.ActivityLoggingService.createActivity(\"CatalystSearchManager.executeSearchForPreFlightCheck\", searchActivity);\r\n\r\n        // using a fake store allows Catalyst to run the pre-flight search when the root component hasn't been mounted yet.\r\n        // It also avoids several Redux cycles (one for each dispatched action) that, in the context of this test call, make no sense.\r\n        const fakeStore = { dispatch: () => { return; } } as any;\r\n\r\n        const entityListActions = new EntityListActions();\r\n        const sectionListActionCreator = new SearchActionCreator(\r\n            this.businessLogicFactory,\r\n            fakeStore,\r\n            entityListActions,\r\n            SectionListSearchScopeOptions.SearchCurrentAndAllDescendentDirectories);\r\n\r\n        const preFlightSearchPromise = sectionListActionCreator.search(\r\n            SearchIndex.Unpublished,\r\n            [\"_id\", \"$type\"],               // required field\r\n            null,                           // orderby\r\n            null,                           // filterby\r\n            \"\",                             // search text\r\n            1,                              // maxresult\r\n            this.searchCancellationToken,\r\n            searchForFirstPageEntitiesActivity\r\n        );\r\n\r\n        PromiseExtension.onComplete(preFlightSearchPromise, () => this.instrumentationClient.ActivityLoggingService.endActivity(searchForFirstPageEntitiesActivity));\r\n\r\n        return preFlightSearchPromise\r\n            .catch(error => {\r\n                this.instrumentationClient.LoggingService.error(\r\n                    \"CatalystSearchManager.executeSearchForPreFlightCheck - service call failed when attempting execute the pre-flight search.\",\r\n                    searchForFirstPageEntitiesActivity,\r\n                    error);\r\n                throw error;\r\n            });\r\n    }\r\n\r\n    /**\r\n     * Executes the Search to load the first page entities.\r\n     * @method\r\n     * @param searchText: { string} The search Text\r\n     * @param orderBy: {IOrderItem[]} How to sort the results\r\n     * @param filterBy: {Predicate} The filter criteria for the search\r\n     * @param searchMatchCriteria {SearchQueryMatchCriteria} Specifies the number of terms set for q that should match.\r\n     * @param parentActivity {IActivityLogItem} Optional parent activity\r\n     */\r\n    public executeSearchForFirstPageEntities(\r\n        store: IStore<any>,\r\n        searchText: string,\r\n        orderBy: IOrderByItem[],\r\n        filterBy: Predicate,\r\n        searchMatchCriteria?: SearchQueryMatchCriteria,\r\n        parentActivity?: IActivityLogItem): Promise<IEntityWithMetadata<IEntity>[]> {\r\n\r\n        this.cancelCurrentAndCreateNewCancellationToken();\r\n        this.filterBy = filterBy;\r\n        this.store = store;\r\n        this.constructSectionListCreatorsInstance(this.store);\r\n\r\n        let loadEntitiesPromise = this.searchActionCreator.search(\r\n            SearchIndex.Unpublished,\r\n            CatalystSearchManager.RequiredFieldList,\r\n            orderBy,\r\n            this.filterBy,\r\n            CmsStringEscape.escape(searchText),\r\n            null,\r\n            this.searchCancellationToken,\r\n            parentActivity,\r\n            searchMatchCriteria);\r\n\r\n        loadEntitiesPromise.catch(\r\n            (error: IError<ErrorType, IErrorResponse>) => {\r\n                let errorMsg = this.formatError(\"Search failed. \\r\\nSearchActionCreator.search encountered error.\", error);\r\n                this.instrumentationClient.LoggingService.error(\"SearchActionCreator.search\", parentActivity, error);\r\n                this.entityListActions.EntitiesLoadingError.getActionSender(store, this.searchCancellationToken)(errorMsg);\r\n            }\r\n        );\r\n\r\n        return loadEntitiesPromise;\r\n    }\r\n\r\n    /**\r\n     * Executes the Search to load the next page entities.\r\n     * @method\r\n     * @param searchText: { string} The search Text\r\n     * @param orderBy: {IOrderItem[]} How to sort the results*\r\n     * @param continuationToken {IContinuationToken} The continuation token.\r\n     * @param searchMatchCriteria {SearchQueryMatchCriteria} Specifies the number of terms set for q that should match.\r\n     * @param parentActivity {IActivityLogItem} Optional parent activity\r\n     */\r\n    public executeSearchForNextPageEntities(\r\n        searchText: string,\r\n        orderBy: IOrderByItem[],\r\n        continuationToken: IContinuationToken,\r\n        searchMatchCriteria?: SearchQueryMatchCriteria,\r\n        parentActivity?: IActivityLogItem): Promise<IEntityWithMetadata<IEntity>[]> {\r\n        let loadMoreEneitiesPromise = this.searchActionCreator.continueSearch(\r\n            continuationToken,\r\n            SearchIndex.Unpublished,\r\n            CatalystSearchManager.RequiredFieldList,\r\n            orderBy,\r\n            this.filterBy,\r\n            CmsStringEscape.escape(searchText),\r\n            null,\r\n            this.searchCancellationToken,\r\n            parentActivity,\r\n            searchMatchCriteria);\r\n\r\n        loadMoreEneitiesPromise.catch(\r\n            (error: IError<ErrorType, IErrorResponse>) => {\r\n                let errorMsg = this.formatError(\"Search failed. \\r\\nSearchActionCreator.continueSearch encountered error.\", error);\r\n                this.instrumentationClient.LoggingService.error(\"SearchActionCreator.continueSearch\", parentActivity, error);\r\n                this.entityListActions.EntitiesLoadingError.getActionSender(this.store, this.searchCancellationToken)(errorMsg);\r\n            }\r\n        );\r\n\r\n        return loadMoreEneitiesPromise;\r\n    }\r\n\r\n    /**\r\n     * Gets the filter rules.\r\n     * @getter\r\n     */\r\n    public get FilterRules(): IFilterRules {\r\n        return this.filterRules;\r\n    }\r\n\r\n    /**\r\n     * Gets the most recent search activity\r\n     * May be undefined if a search has not been executed yet.\r\n     * @getter\r\n     */\r\n    public get SearchActivity(): IActivityLogItem {\r\n        return this.searchActivity;\r\n    }\r\n\r\n    /**\r\n     * Callback function passed to the sectionListActionCreator to get the latest filter based on the current state.\r\n     * @method\r\n     */\r\n    private getFilter(): Predicate {\r\n        return this.filterBy;\r\n    }\r\n\r\n    /**\r\n     * Helper method to call cancel on the current searchCancellationToken and to create a new token.\r\n     * @method\r\n     */\r\n    private cancelCurrentAndCreateNewCancellationToken(): void {\r\n        if (this.searchCancellationToken !== null) {\r\n            this.searchCancellationToken.cancel();\r\n        }\r\n        this.searchCancellationToken = new ActionDispatchCancellationToken();\r\n    }\r\n\r\n    /**\r\n     * Helper method to initialize the FilteredSectionListActionCreator and GetEntityListActionCreator.\r\n     * @method\r\n     * @param store {IStore<any>} The store.\r\n     */\r\n    private constructSectionListCreatorsInstance(store: IStore<any>): void {\r\n        if (!!this.searchActionCreator) {\r\n            return;\r\n        }\r\n\r\n        if (!this.searchActionCreator) {\r\n            this.searchActionCreator = new SearchActionCreator(\r\n                this.businessLogicFactory,\r\n                store,\r\n                this.entityListActions,\r\n                SectionListSearchScopeOptions.SearchCurrentAndAllDescendentDirectories);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Formats the error message into a more readable format\r\n     * @param title {string} error title\r\n     * @param error {IError<ErrorType, IErrorResponse>} the error\r\n     */\r\n    private formatError(title: string, error: IError<ErrorType, IErrorResponse>): string {\r\n        let errorMsg = title + `\\r\\n  Error Detail:    ${error.errorMessage}`;\r\n        if (error.type === ErrorType.ServiceClientResponseError) {\r\n            errorMsg += `\\r\\n  Service Response Error:    ${error.innerError.rawResponseBody.Code}`;\r\n        } else {\r\n            errorMsg += `\\r\\n  Inner Error:   ${error.innerError.type}`;\r\n        }\r\n\r\n        return errorMsg;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as ops from \"cms-businesslogic/search/filter/Operators\";\r\n\r\nimport { EditorialSearchQuery } from \"clientcore-catalyst-businesslogic/editorialSearch/EditorialSearchQuery\";\r\nimport { FieldType } from \"../../models/fieldType/FieldTypeEnum\";\r\nimport { FilterRuleSelectionMode } from \"../../models/filterRules/FilterRuleSelectionMode\";\r\nimport { IFilterRuleDefinition } from \"../../models/filterRules/IFilterRuleDefinition\";\r\nimport { INumberFilter } from \"clientcore-catalyst-businesslogic/editorialSearch/INumberFilter\";\r\nimport { PromoCardPredicateBuilder } from \"cms-ui-presentationlogic/queryBuilder/predefinedRules/PromoCardPredicateBuilder\";\r\nimport { appConfig } from \"appConfig\";\r\n\r\n/**\r\n * Rules for the different fields on which the user can filter.\r\n * @interface\r\n */\r\ninterface IFilterRules {\r\n    editorspick: IFilterRuleDefinition;\r\n    headShots: IFilterRuleDefinition;\r\n    providers: IFilterRuleDefinition;\r\n    orientations: IFilterRuleDefinition;\r\n    collection: IFilterRuleDefinition;\r\n    people: IFilterRuleDefinition;\r\n    displayPublishedDate: IFilterRuleDefinition;\r\n}\r\n\r\n/**\r\n * Method to create the data defining the rules on which we currently filter\r\n * @method\r\n */\r\nfunction createFilterRuleData(): IFilterRules {\r\n\r\n    return {\r\n        editorspick: {\r\n            ruleName: \"Smart Search\",\r\n            fieldType: FieldType.StringField,\r\n            selectionMode: FilterRuleSelectionMode.MultiSelect,\r\n            values:\r\n            [\r\n                {\r\n                    displayString: \"Top Pictures\",\r\n                    value: \"true\",\r\n                    helpText: \"You should select this option to see only those images which are marked as 'best' from providers.\"\r\n                }\r\n            ],\r\n            queryTextFilterBuilder: (filterValues: string[]) => {\r\n                if (!!filterValues && filterValues.length > 0 && filterValues[0] === \"true\") {\r\n                    let bestPicsSearchKeywords = [];\r\n                    appConfig.providers.forEach(provider => {\r\n                        if (!!provider.topPicsKeywords && provider.topPicsKeywords.length > 0) {\r\n                            bestPicsSearchKeywords = bestPicsSearchKeywords.concat(provider.topPicsKeywords);\r\n                        }\r\n                    });\r\n\r\n                    return \"(\" + bestPicsSearchKeywords.join(\" OR \") + \")\";\r\n                } else {\r\n                    return \"\";\r\n                }\r\n            }\r\n        },\r\n        headShots: {\r\n            ruleName: \"Head Shots\",\r\n            fieldType: FieldType.NumberField,\r\n            selectionMode: FilterRuleSelectionMode.MultiSelect,\r\n            values:\r\n            [\r\n                {\r\n                    displayString: PromoCardPredicateBuilder.filters[0].displayString,\r\n                    value: PromoCardPredicateBuilder.filters[0].value,\r\n                    helpText: PromoCardPredicateBuilder.filters[0].helpText\r\n                }\r\n            ]\r\n        },\r\n        providers: {\r\n            ruleName: \"Source\",\r\n            fieldType: FieldType.StringField,\r\n            selectionMode: FilterRuleSelectionMode.MultiSelect,\r\n            values: appConfig.providers.filter(provider => provider.isEditorialProvider).map(provider => { return { displayString: provider.name, value: provider.id, helpText: provider.helpText }; }),\r\n            predicateFilterBuilderForStringValues: (filterValues: string[]) => EditorialSearchQuery.providerFilter(filterValues)\r\n        },\r\n        orientations: {\r\n            ruleName: \"Orientations\",\r\n            fieldType: FieldType.StringField,\r\n            selectionMode: FilterRuleSelectionMode.MultiSelect,\r\n            values:\r\n            [\r\n                {\r\n                    displayString: \"Portrait\",\r\n                    value: \"vertical\"\r\n                },\r\n                {\r\n                    displayString: \"Landscape\",\r\n                    value: \"horizontal\"\r\n                },\r\n                {\r\n                    displayString: \"Square\",\r\n                    value: \"square\"\r\n                },\r\n                {\r\n                    displayString: \"Panoramic Horizontal\",\r\n                    value: \"panoramicHorizontal\"\r\n                },\r\n                {\r\n                    displayString: \"Panoramic Vertical\",\r\n                    value: \"panoramicVertical\"\r\n                }\r\n            ],\r\n            predicateFilterBuilderForStringValues: (filterValues: string[]) => EditorialSearchQuery.orientationFilter(filterValues)\r\n        },\r\n        collection: {\r\n            ruleName: \"Licensing\",\r\n            fieldType: FieldType.StringField,\r\n            selectionMode: FilterRuleSelectionMode.MultiSelect,\r\n            values:\r\n            [\r\n                {\r\n                    displayString: \"Exclude AFP (Japan)\",\r\n                    value: \"AFP\",\r\n                    helpText: \"AFP by Getty images cannot be used in Japan. If you are programming for this region, you should select this option to exclude these images from your results.\"\r\n                }\r\n            ],\r\n            queryTextFilterBuilder: (filterValues: string[]) => {\r\n                if (!!filterValues && filterValues.length > 0 && filterValues[0] !== null && filterValues[0] !== undefined) {\r\n                    return EditorialSearchQuery.getNotQueryForFullTextSearch(\"fileMetadata.collection\", filterValues[0]);\r\n                } else {\r\n                    return \"\";\r\n                }\r\n            }\r\n        },\r\n        people: {\r\n            ruleName: \"People\",\r\n            fieldType: FieldType.NumberField,\r\n            selectionMode: FilterRuleSelectionMode.MultiSelect,\r\n            values:\r\n            [\r\n                {\r\n                    displayString: \"No people\",\r\n                    value: 0,\r\n                    comparisonOperator: ops.EqualityOperators.EQUALS\r\n                },\r\n                {\r\n                    displayString: \"One person\",\r\n                    value: 1,\r\n                    comparisonOperator: ops.EqualityOperators.EQUALS\r\n                },\r\n                {\r\n                    displayString: \"Two people\",\r\n                    value: 2,\r\n                    comparisonOperator: ops.EqualityOperators.EQUALS\r\n                },\r\n                {\r\n                    displayString: \"Group of people\",\r\n                    value: 2,\r\n                    comparisonOperator: ops.EqualityOperators.GREATER_THAN\r\n                }\r\n            ],\r\n            predicateFilterBuilderForNumberFilterValues: (filterValues: INumberFilter[]) => EditorialSearchQuery.numberOfDetectedFacesFilter(filterValues)\r\n        },\r\n        displayPublishedDate: {\r\n            ruleName: \"Date\",\r\n            fieldType: FieldType.DateField,\r\n            values: [],\r\n            dateRangeFilterBuilder:  (from: Date, to: Date) => EditorialSearchQuery.dateRangeFilter(\"displayPublishedDateTime\", from, to)\r\n        }\r\n    };\r\n}\r\n\r\nexport { createFilterRuleData as CreateFilterRuleData, IFilterRules };","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { IFieldValueBase } from \"../../models/filterRules/IFieldValueBase\";\r\nimport { FilterItemOptionsType, FilterItemOptionsListSelectionType, IFilterItemOptionsList } from \"../../rendering/components/queryFilterPane/IFilterItemOptionsList\";\r\n\r\n// Helper method to construct a FilterItemOptionsList for a multiple select set of options\r\nexport function buildMultiSelectOptionsList(\r\n    name: string,\r\n    options: IFieldValueBase[],\r\n    selectedIndexes: number[],\r\n    selectedOptionsChangeCallback: (selectedIndexes: number[], event: React.SyntheticEvent<any>) => void): IFilterItemOptionsList {\r\n\r\n    let filterOptions: IFilterItemOptionsList = {\r\n        $type: FilterItemOptionsType.StringList,\r\n        name: name,\r\n        selectionType: FilterItemOptionsListSelectionType.MultiSelect,\r\n        values: [],\r\n        onSelectedOptionsChanged: selectedOptionsChangeCallback\r\n    };\r\n\r\n    options.forEach(item => filterOptions.values.push({\r\n        value: item.displayString,\r\n        selected: false,\r\n        tooltip: item.helpText\r\n    }));\r\n\r\n    selectedIndexes.forEach(index => {\r\n        if (index >= 0 && index < filterOptions.values.length) {\r\n            filterOptions.values[index].selected = true;\r\n        }\r\n    });\r\n\r\n    return filterOptions;\r\n}\r\n\r\n// Helper method to construct a FilterItemOptionsList for a single select set of options\r\nexport function buildSingleSelectOptionsList(\r\n    name: string,\r\n    options: IFieldValueBase[],\r\n    selectedIndex: number[],\r\n    selectedOptionChangeCallback: (selectedIndex: number[], event: React.SyntheticEvent<any>) => void): IFilterItemOptionsList {\r\n    let retVal: IFilterItemOptionsList = buildMultiSelectOptionsList(\r\n        name,\r\n        options,\r\n        selectedIndex,\r\n        (selectedIndexes: number[], event: React.SyntheticEvent<any>) => {\r\n            return selectedIndexes.length > 0 ? selectedOptionChangeCallback(selectedIndexes, event) : selectedOptionChangeCallback([0], event);\r\n        });\r\n    retVal.selectionType = FilterItemOptionsListSelectionType.SingleSelectRadio;\r\n    return retVal;\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nexport type CarouselDirection = \"next\" | \"prev\";\r\n\r\n/**\r\n * Holds the constants for carousel directions.\r\n * @type {string}\r\n */\r\n// supress the tslint rule for variable name. since this is a string enum, we want the const to be the same name as the type so that it behaves as a string enum when importing once, rather than import the type and const individually.\r\n// tslint:disable-next-line: variable-name\r\nexport const CarouselDirection = {\r\n    Next: \"next\" as CarouselDirection,\r\n    Previous: \"prev\" as CarouselDirection\r\n};","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { Guid } from \"cms-infrastructure-javascriptextensions/Guid\";\r\n\r\nimport { ActionHandler } from \"cms-ui-redux/ActionHandler\";\r\nimport { IActionPayload } from \"cms-ui-redux/IActionPayload\";\r\nimport { NamespaceCheckReducerBase } from \"cms-ui-redux/NamespaceCheckReducerBase\";\r\n\r\nimport { EntitySearchActions } from \"cms-ui-presentationlogic/dataflows/entitySearch/EntitySearchActions\";\r\n\r\nimport { ICatalystEntitySearchState } from \"./ICatalystEntitySearchState\";\r\n\r\n/**\r\n * Contains reducer for the CatalystSearch Experience.\r\n * @class\r\n */\r\nexport class CatalystSearchReduction extends NamespaceCheckReducerBase<ICatalystEntitySearchState> {\r\n\r\n    /**\r\n     * Initializes a new instance of the 'CatalystSearchReduction' class.\r\n     * @param entitySearchActions {EntitySearchActions} entitySearch actions to handle\r\n     * @constructor\r\n     */\r\n    constructor(\r\n        public entitySearchActions: EntitySearchActions\r\n    ) {\r\n        super([entitySearchActions.namespace]);\r\n\r\n        if (!entitySearchActions) {\r\n            throw \"The entitySearchActions parameter is required.\";\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Mutates the given state with the given action.\r\n     * @function\r\n     * @param {ICatalystEntitySearchState} state - The state that the reducer should mutate.\r\n     * @param {IActionPayload} actionPayload - The action detail to update the state with.\r\n     * @returns {ICatalystEntitySearchState} The mutated state.\r\n     */\r\n    public reduce(state: ICatalystEntitySearchState, actionPayload: IActionPayload): ICatalystEntitySearchState {\r\n\r\n        if (!state) {\r\n            throw \"The state parameter is required.\";\r\n        }\r\n\r\n        if (!actionPayload) {\r\n            throw \"The actionPayload parameter is required.\";\r\n        }\r\n\r\n        let newState = state;\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.entitySearchActions.ExecuteSearch, () => {\r\n                newState = {\r\n                    ...state,\r\n                    searchUniqueIdentifier: null\r\n                };\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.entitySearchActions.SearchExecuted, () => {\r\n                newState = {\r\n                    ...state,\r\n                    searchUniqueIdentifier: Guid.newGuid()\r\n                };\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.entitySearchActions.SearchTextChange, (searchText: string) => {\r\n                newState = {\r\n                    ...state,\r\n                    searchText\r\n                };\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.entitySearchActions.ClearSearch, () => {\r\n                newState = {\r\n                    ...state,\r\n                    searchText: \"\"\r\n                };\r\n                return newState;\r\n            });\r\n\r\n        return newState;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { ActionMap } from \"cms-ui-redux/ActionMap\";\r\nimport { NamespacePrefixActionsDefinitionBase } from \"cms-ui-redux/NamespacePrefixActionsDefinitionBase\";\r\nimport { IContinuationToken } from \"cms-businesslogic/IContinuationToken\";\r\nimport { ICreativeImageSearchResults } from \"clientcore-catalyst-businesslogic/creativeSearch/ICreativeImageSearchResults\";\r\nimport { ICreativeSearchQuery } from \"clientcore-catalyst-businesslogic/creativeSearch/ICreativeSearchQuery\";\r\nimport { ICreativeImageSearchErrorResponse } from \"clientcore-catalyst-businesslogic/creativeSearch/ICreativeImageSearchErrorResponse\";\r\nimport { CreativeProvider } from \"clientcore-catalyst-businesslogic/creativeSearch/CreativeProvider\";\r\nimport { ResultsDisplayModeEnum } from \"../../../models/displayMode/ResultsDisplayModeEnum\";\r\n\r\nexport type ResetFilterSignature = () => void;\r\nexport type SetResultsDisplayModeSignature = (resultsDisplayMode: ResultsDisplayModeEnum) => void;\r\nexport type SetProviderSignature = (providerName: CreativeProvider) => void;\r\nexport type FirstPageSearchExecutingSignature = (query: ICreativeSearchQuery) => void;\r\nexport type FirstPageSearchExecutedSignature = (images: ICreativeImageSearchResults, continuationToken: IContinuationToken) => void;\r\nexport type FirstPageSearchExecutionErrorSignature = (error: ICreativeImageSearchErrorResponse, query: ICreativeSearchQuery) => void;\r\nexport type NextPageSearchExecutingSignature = (query: ICreativeSearchQuery) => void;\r\nexport type NextPageSearchExecutedSignature = (images: ICreativeImageSearchResults, continuationToken: IContinuationToken) => void;\r\nexport type NextPageSearchExecutionErrorSignature = (error: ICreativeImageSearchErrorResponse, query: ICreativeSearchQuery) => void;\r\n\r\n/**\r\n * This class contains the actions for the Creative Search Experience.\r\n * @class\r\n */\r\nexport class CreativeSearchActions extends NamespacePrefixActionsDefinitionBase {\r\n\r\n    /** Defines the action indicating that the filters have reset.\r\n     */\r\n    private resetfilter: ActionMap<ResetFilterSignature> = new ActionMap<ResetFilterSignature>(this.namespace + \"Resetfilter\");\r\n\r\n    /** Defines the action indicating that the format in which the results should be viewed has changed.\r\n     */\r\n    private setResultsDisplayMode: ActionMap<SetResultsDisplayModeSignature> = new ActionMap<SetResultsDisplayModeSignature>(this.namespace + \"SetResultsDisplayMode\");\r\n\r\n    /** Defines the action indicating that the provider selection has changed.\r\n     */\r\n    private setProvider: ActionMap<SetProviderSignature> = new ActionMap<SetProviderSignature>(this.namespace + \"SetProviderSignature\");\r\n\r\n    /** Defines the action indicating that the first page search is executing.\r\n     */\r\n    private firstPagesearchExecutingSignature: ActionMap<FirstPageSearchExecutingSignature> = new ActionMap<FirstPageSearchExecutingSignature>(this.namespace + \"FirstPageSearchExecutingSignature\");\r\n\r\n    /** Defines the action indicating that the first page search results are availale.\r\n     */\r\n    private firstPagesearchExecutedSignature: ActionMap<FirstPageSearchExecutedSignature> = new ActionMap<FirstPageSearchExecutedSignature>(this.namespace + \"FirstPageSearchExecutedSignature\");\r\n\r\n    /** Defines the action indicating that an error occurred while executing search for first page.\r\n     */\r\n    private firstPagesearchExecutionErrorSignature: ActionMap<FirstPageSearchExecutionErrorSignature> = new ActionMap<FirstPageSearchExecutionErrorSignature>(this.namespace + \"FirstPageSearchExecutionErrorSignature\");\r\n\r\n    /** Defines the action indicating that the next page search is executing.\r\n     */\r\n    private nextPagesearchExecutingSignature: ActionMap<NextPageSearchExecutingSignature> = new ActionMap<NextPageSearchExecutingSignature>(this.namespace + \"NextPageSearchExecutingSignature\");\r\n\r\n    /** Defines the action indicating that the next page search results are loaded.\r\n     */\r\n    private nextPagesearchExecutedSignature: ActionMap<NextPageSearchExecutedSignature> = new ActionMap<NextPageSearchExecutedSignature>(this.namespace + \"NextPageSearchExecutedSignature\");\r\n\r\n    /** Defines the action indicating that an error occurred while executing search for next page.\r\n     */\r\n    private nextPagesearchExecutionErrorSignature: ActionMap<NextPageSearchExecutionErrorSignature> = new ActionMap<NextPageSearchExecutionErrorSignature>(this.namespace + \"NextPageSearchExecutionErrorSignature\");\r\n\r\n    /**\r\n     * Initializes a new instance of the 'CreativeSearchActions' class.\r\n     * @constructor\r\n     * @param namespacePrefix {string} Optional prefix to add to the namespace used to distinguish between different instances of this data flow.\r\n     */\r\n    constructor(namespacePrefix?: string) {\r\n        super(\"CreativeSearch\", namespacePrefix);\r\n    }\r\n\r\n    /** Accessor for the Reset filter action.\r\n     * @type {ActionMap<ResetFilterSignature>}\r\n     */\r\n    public get ResetFilter(): ActionMap<ResetFilterSignature> {\r\n        return this.resetfilter;\r\n    }\r\n\r\n    /** Accessor for the SetResultsDisplayMode action.\r\n     * @type {ActionMap<SetResultsDisplayModeSignature>}\r\n     */\r\n    public get SetResultsDisplayMode(): ActionMap<SetResultsDisplayModeSignature> {\r\n        return this.setResultsDisplayMode;\r\n    }\r\n\r\n    /** Accessor for the SetProvider action.\r\n     * @type {ActionMap<SetProviderSignature>}\r\n     */\r\n    public get SetProvider(): ActionMap<SetProviderSignature> {\r\n        return this.setProvider;\r\n    }\r\n\r\n    /** Accessor for the FirstPageSearchExecutingSignature action.\r\n     * @type {ActionMap<FirstPageSearchExecutingSignature>}\r\n     */\r\n    public get FirstPageSearchExecutingSignature(): ActionMap<FirstPageSearchExecutingSignature> {\r\n        return this.firstPagesearchExecutingSignature;\r\n    }\r\n\r\n    /** Accessor for the FirstPageSearchExecutedSignature action.\r\n     * @type {ActionMap<FirstPageSearchExecutedSignature>}\r\n     */\r\n    public get FirstPageSearchExecutedSignature(): ActionMap<FirstPageSearchExecutedSignature> {\r\n        return this.firstPagesearchExecutedSignature;\r\n    }\r\n\r\n    /** Accessor for the FirstpageSearchExecutionErrorSignature action.\r\n     * @type {ActionMap<FirstpageSearchExecutionErrorSignature>}\r\n     */\r\n    public get FirstPageSearchExecutionErrorSignature(): ActionMap<FirstPageSearchExecutionErrorSignature> {\r\n        return this.firstPagesearchExecutionErrorSignature;\r\n    }\r\n\r\n    /** Accessor for the FirstPageSearchExecutingSignature action.\r\n     * @type {ActionMap<NextPageSearchExecutingSignature>}\r\n     */\r\n    public get NextPageSearchExecutingSignature(): ActionMap<NextPageSearchExecutingSignature> {\r\n        return this.nextPagesearchExecutingSignature;\r\n    }\r\n\r\n    /** Accessor for the NextPageSearchExecutedSignature action.\r\n     * @type {ActionMap<NextPageSearchExecutedSignature>}\r\n     */\r\n    public get NextPageSearchExecutedSignature(): ActionMap<NextPageSearchExecutedSignature> {\r\n        return this.nextPagesearchExecutedSignature;\r\n    }\r\n\r\n    /** Accessor for the NextpageSearchExecutionErrorSignature action.\r\n     * @type {ActionMap<NextpageSearchExecutionErrorSignature>}\r\n     */\r\n    public get NextPageSearchExecutionErrorSignature(): ActionMap<NextPageSearchExecutionErrorSignature> {\r\n        return this.nextPagesearchExecutionErrorSignature;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { ActionDispatchCancellationToken } from \"cms-ui-redux/ActionDispatchCancellationToken\";\r\nimport { CreativeSearchActions } from \"./CreativeSearchActions\";\r\nimport { IActionDispatchCancellationToken } from \"cms-ui-redux/IActionDispatchCancellationToken\";\r\nimport { IActivityLogItem } from \"clientcore-infrastructure-analytics/models/IActivityLogItem\";\r\nimport { IContinuationToken } from \"cms-businesslogic/IContinuationToken\";\r\nimport { ICreativeImageSearchErrorResponse } from \"clientcore-catalyst-businesslogic/creativeSearch/ICreativeImageSearchErrorResponse\";\r\nimport { ICreativeImageSearchManager } from \"clientcore-catalyst-businesslogic/creativeSearch/ICreativeImageSearchManager\";\r\nimport { ICreativeImageSearchResults } from \"clientcore-catalyst-businesslogic/creativeSearch/ICreativeImageSearchResults\";\r\nimport { ICreativeSearchQuery } from \"clientcore-catalyst-businesslogic/creativeSearch/ICreativeSearchQuery\";\r\nimport { IInstrumentationClient } from \"../../../instrumentation/instrumentationClient/IInstrumentationClient\";\r\nimport { IStore } from \"redux\";\r\nimport { TypedPromise } from \"cms-typed-promise\";\r\nimport { isNil } from \"lodash-es\";\r\n\r\n/**\r\n * This class contains methods to handle the Creative Search experience.\r\n * @class\r\n */\r\nexport class CreativeSearchActionCreator {\r\n\r\n    /** The current search activity\r\n     * @type {IActivityLogItem}\r\n     */\r\n    private searchActivity: IActivityLogItem;\r\n\r\n    /**\r\n     * Initializes a new instance of the 'CreativeSearchActionCreator' class.\r\n     * @param creativeImageSearchManager {ICreativeImageSearchManager} Used to execute the creative search.\r\n     * @param creativeSearchActions {CreativeSearchActions} CreativeSearchActions for action dispatch.\r\n     * @param store {IStore<any>} The store to dispatch actions to.\r\n     */\r\n    constructor(\r\n        protected creativeImageSearchManager: ICreativeImageSearchManager,\r\n        protected creativeSearchActions: CreativeSearchActions,\r\n        protected instrumentationClient: IInstrumentationClient,\r\n        protected store: IStore<any>) {\r\n        if (!creativeImageSearchManager) {\r\n            throw \"The creativeImageSearchManager parameter is required.\";\r\n        }\r\n\r\n        if (!creativeSearchActions) {\r\n            throw \"The creativeSearchActions parameter is required.\";\r\n        }\r\n\r\n        if (!instrumentationClient) {\r\n            throw \"The instrumentationClient parameter is required.\";\r\n        }\r\n\r\n        if (!store) {\r\n            throw \"The store parameter is required.\";\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Parses the search results and determines if more results are available.\r\n     * @param searchResults {ICreativeImageSearchResults} The creative search results\r\n     * @method\r\n     * @returns {IContinuationToken} the continuation token\r\n     */\r\n    private static getContinuationToken(searchResults: ICreativeImageSearchResults): IContinuationToken {\r\n        let moreResultsAvailable = false;\r\n        if (!!searchResults.totalResultCount) {\r\n            moreResultsAvailable = searchResults.page < (Math.ceil(searchResults.totalResultCount / searchResults.pageSize));\r\n        }\r\n\r\n        const continuationToken: IContinuationToken = { moreResultsAvailable };\r\n\r\n        return continuationToken;\r\n    }\r\n\r\n    /**\r\n     * Executes search for creative images\r\n     * @method\r\n     * @param searchQuery {executeCreativeSearch} The search query.\r\n     * @param searchCancellationToken {IActionDispatchCancellationToken} cancellation token for ignoring the cancelled search request.\r\n     * @param parentActivity {IActivityLogItem} parent activity for instrumentation\r\n     */\r\n    public executeCreativeSearch(\r\n        searchQuery: ICreativeSearchQuery,\r\n        searchCancellationToken: IActionDispatchCancellationToken,\r\n        parentActivity?: IActivityLogItem): TypedPromise<ICreativeImageSearchResults, ICreativeImageSearchErrorResponse> {\r\n\r\n        this.creativeSearchActions.FirstPageSearchExecutingSignature.getActionSender(this.store, searchCancellationToken)(searchQuery);\r\n        let creativeSearchResponsePromise: TypedPromise<ICreativeImageSearchResults, ICreativeImageSearchErrorResponse> = this.creativeImageSearchManager.searchCreativeImage(searchQuery, parentActivity);\r\n\r\n        creativeSearchResponsePromise.then((searchResults: ICreativeImageSearchResults) => {\r\n            if (!ActionDispatchCancellationToken.isCancellationRequested(searchCancellationToken)) {\r\n                const continuationToken: IContinuationToken = CreativeSearchActionCreator.getContinuationToken(searchResults);\r\n                this.creativeSearchActions.FirstPageSearchExecutedSignature.getActionSender(this.store, searchCancellationToken)(searchResults, continuationToken);\r\n            }\r\n        }).catch((error: ICreativeImageSearchErrorResponse) => {\r\n            this.creativeSearchActions.FirstPageSearchExecutionErrorSignature.getActionSender(this.store, searchCancellationToken)(error, searchQuery);\r\n        });\r\n\r\n        return creativeSearchResponsePromise;\r\n    }\r\n\r\n    /**\r\n     * Executes search for creative images\r\n     * @method\r\n     * @param searchQuery {executeCreativeSearch} The search query.\r\n     * @param searchCancellationToken {IActionDispatchCancellationToken} cancellation token for ignoring the cancelled search request.\r\n     * @param parentActivity {IActivityLogItem} parent activity for instrumentation\r\n     */\r\n    public executeNextPageCreativeSearch(\r\n        searchQuery: ICreativeSearchQuery,\r\n        searchCancellationToken: IActionDispatchCancellationToken,\r\n        parentActivity?: IActivityLogItem): TypedPromise<ICreativeImageSearchResults, ICreativeImageSearchErrorResponse> {\r\n\r\n        this.creativeSearchActions.NextPageSearchExecutingSignature.getActionSender(this.store, searchCancellationToken)(searchQuery);\r\n        let creativeSearchResponsePromise: TypedPromise<ICreativeImageSearchResults, ICreativeImageSearchErrorResponse> = this.creativeImageSearchManager.searchCreativeImage(searchQuery, parentActivity);\r\n\r\n        creativeSearchResponsePromise.then((searchResults: ICreativeImageSearchResults) => {\r\n            if (!ActionDispatchCancellationToken.isCancellationRequested(searchCancellationToken)) {\r\n                const continuationToken: IContinuationToken = CreativeSearchActionCreator.getContinuationToken(searchResults);\r\n                this.creativeSearchActions.NextPageSearchExecutedSignature.getActionSender(this.store, searchCancellationToken)(searchResults, continuationToken);\r\n            }\r\n        }).catch((error: ICreativeImageSearchErrorResponse) => {\r\n            this.creativeSearchActions.NextPageSearchExecutionErrorSignature.getActionSender(this.store, searchCancellationToken)(error, searchQuery);\r\n            this.instrumentationClient.LoggingService.error(\r\n                \"CreativeSearchActionCreator.executeNextPageCreativeSearch\",\r\n                this.searchActivity,\r\n                {\r\n                    provider: searchQuery.provider,\r\n                    error\r\n                });\r\n        });\r\n\r\n        return creativeSearchResponsePromise;\r\n    }\r\n\r\n    /**\r\n     * Ends the current search activity and creates a new one\r\n     * @method\r\n     * @returns the created activity\r\n     */\r\n    public endCurrentAndCreateNewSearchActivity(): IActivityLogItem {\r\n        if (!isNil(this.searchActivity)) {\r\n            this.instrumentationClient.ActivityLoggingService.endActivity(this.searchActivity);\r\n        }\r\n\r\n        this.searchActivity = this.instrumentationClient.ActivityLoggingService.createActivity(\"CreativeRootSearchActivity\", this.instrumentationClient.RootActivity);\r\n        return this.SearchActivity;\r\n    }\r\n\r\n    /**\r\n     * Gets the most recent search activity\r\n     * May be undefined if a search has not been executed yet.\r\n     * @getter\r\n     */\r\n    public get SearchActivity(): IActivityLogItem {\r\n        return this.searchActivity;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { AppConstants } from \"../../../AppConstants\";\r\nimport { IActionDispatchCancellationToken } from \"cms-ui-redux/IActionDispatchCancellationToken\";\r\nimport { IActivityLogItem } from \"clientcore-infrastructure-analytics/models/IActivityLogItem\";\r\nimport { IInstrumentationClient } from \"../../../instrumentation/instrumentationClient/IInstrumentationClient\";\r\nimport { IStore } from \"redux\";\r\nimport { ISuggestionsErrorResponse } from \"clientcore-onesrv-businesslogic/suggestions/ISuggestionsErrorResponse\";\r\nimport { ISuggestionsResponse } from \"clientcore-onesrv-businesslogic/suggestions/ISuggestionsResponse\";\r\nimport { ISuggestionsValueEntity } from \"clientcore-onesrv-serviceclients/suggestions/ISuggestionsValueEntity\";\r\nimport { OneSrvBusinessLogicFactory } from \"clientcore-onesrv-businesslogic/factory/OneSrvBusinessLogicFactory\";\r\nimport { SearchWithAutosuggestActions } from \"./SearchWithAutosuggestActions\";\r\n\r\n/**\r\n * Contains action creators to load search and select actions.\r\n * @class\r\n */\r\nexport class SearchWithAutosuggestActionCreators {\r\n\r\n    /**\r\n     * Initializes a new instance of the `SearchWithAutosuggestActionCreators` class.\r\n     * @param oneServiceBusinessLogicFactory {OneSrvBusinessLogicFactory} Used to construct managers for making service calls.\r\n     * @param instrumentationClient {IInstrumentationClient} Provides support for instrumentation.\r\n     * @param store {IStore<any>} The store to dispatch actions to.\r\n     * @param searchWithAutosuggestActions {SearchWithAutosuggestActions} SearhWithAutosuggestActions for action dispatch.\r\n     */\r\n    constructor(\r\n        protected oneServiceBusinessLogicFactory: OneSrvBusinessLogicFactory,\r\n        protected instrumentationClient: IInstrumentationClient,\r\n        protected store: IStore<any>,\r\n        protected searchWithAutosuggestActions: SearchWithAutosuggestActions\r\n    ) {\r\n        if (!oneServiceBusinessLogicFactory) {\r\n            throw \"The oneServiceBusinessLogicFactory parameter is required.\";\r\n        }\r\n\r\n        if (!instrumentationClient) {\r\n            throw \"The instrumentationClient parameter is required.\";\r\n        }\r\n\r\n        if (!store) {\r\n            throw \"The store parameter is required.\";\r\n        }\r\n\r\n        if (!searchWithAutosuggestActions) {\r\n            throw \"The searchWithAutosuggestActions parameter is required.\";\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Fetches suggestions for the given string\r\n     * @method\r\n     * @param input {string} The entity tag.\r\n     * @param parentActivity {IActivityLogItem} The parent activity.\r\n     * @param autosuggestLoadCancellationToken {IActionDispatchCancellationToken} cancellation token for cancelling autosuggestion load\r\n     */\r\n    public getAutosuggestEntities(input: string, parentActivity: IActivityLogItem, autosuggestLoadCancellationToken: IActionDispatchCancellationToken): Promise<string[]> {\r\n        if (!!input) {\r\n            let suggestionLabels: string[] = [];\r\n            let autoSuggestManager = this.oneServiceBusinessLogicFactory.getSuggestionsManager();\r\n            return new Promise<string[]>((resolve) => {\r\n                autoSuggestManager.getSuggestedEntities(input, 5, null, parentActivity, null, true, null, true, true, \"news\").then((response: ISuggestionsResponse) => {\r\n                    if (!!response.suggestionsValueEntities) {\r\n                        response.suggestionsValueEntities.forEach(function (suggestedEntity: ISuggestionsValueEntity): void {\r\n                            if (!!suggestedEntity.groups) {\r\n                                suggestedEntity.groups.forEach(suggestionGroupEntity => {\r\n                                    if (!!suggestionGroupEntity.suggestionItems) {\r\n                                        suggestionGroupEntity.suggestionItems.forEach(suggestionItemEntity => {\r\n\r\n                                            // If user selects a suggestion containing invalid chars, we display an error hence remove the invalid chars from the suggestions.\r\n                                            suggestionLabels.push(suggestionItemEntity.displayText.replace(AppConstants.disallowedSearchChars, \"\"));\r\n                                        });\r\n                                    }\r\n                                });\r\n                            }\r\n                        });\r\n                    }\r\n\r\n                    this.searchWithAutosuggestActions.UpdateAutosuggestions.getActionSender(this.store, autosuggestLoadCancellationToken)(suggestionLabels);\r\n                    return resolve(suggestionLabels);\r\n                }).catch((error: ISuggestionsErrorResponse) => {\r\n                    this.instrumentationClient.LoggingService.error(\r\n                        \"SearhAndSelectActionCreators.getAutosuggestEntities\" + error.type + \" \" + error.errorMessage,\r\n                        parentActivity,\r\n                        { inputString: input },\r\n                        parentActivity.correlationVector);\r\n                });\r\n            });\r\n        } else {\r\n            this.clearSuggestions();\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Clears auto suggest suggestions.\r\n     * @method\r\n     */\r\n    public clearSuggestions(): void {\r\n        this.searchWithAutosuggestActions.UpdateAutosuggestions.getActionSender(this.store)([]);\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { ActionHandler } from \"cms-ui-redux/ActionHandler\";\r\nimport { IActionPayload } from \"cms-ui-redux/IActionPayload\";\r\nimport { ISearchWithAutosuggestState } from \"./ISearchWithAutosuggestState\";\r\nimport { NamespaceCheckReducerBase } from \"cms-ui-redux/NamespaceCheckReducerBase\";\r\nimport { NotificationListReduction } from \"cms-ui-presentationlogic/dataflows/notifications/NotificationListReduction\";\r\nimport { SearchWithAutosuggestActions } from \"./SearchWithAutosuggestActions\";\r\nimport { cloneDeep } from \"lodash-es\";\r\n\r\n/** SearchWithAutosuggest reducer class\r\n * @class\r\n */\r\nexport class SearchWithAutosuggestReduction extends NamespaceCheckReducerBase<ISearchWithAutosuggestState> {\r\n\r\n    /** SearchWithAutosuggest reducer class\r\n     * @constructor\r\n     * @param {SearchWithAutosuggestActions} searchWithAutosuggestActions - The actions that drive auto-suggestion\r\n     * @param {NotificationListReduction} searchHintsReduction - The reducer that manages search hints.\r\n     */\r\n    constructor(\r\n        public searchWithAutosuggestActions: SearchWithAutosuggestActions,\r\n        public searchHintsReduction: NotificationListReduction) {\r\n\r\n        super([searchWithAutosuggestActions.namespace, searchHintsReduction.notificationListActions.namespace]);\r\n\r\n        if (!searchWithAutosuggestActions) {\r\n            throw \"The searchWithAutosuggestActions parameter is required.\";\r\n        }\r\n        if (!searchHintsReduction) {\r\n            throw \"The searchHintsReduction parameter is required.\";\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Reducer method\r\n     * @param state {ISearchWithAutosuggestState}\r\n     * @param actionPayload {IActionPayload}\r\n     * @return {ISearchWithAutosuggestState}\r\n     */\r\n    public reduce(state: ISearchWithAutosuggestState, actionPayload: IActionPayload): ISearchWithAutosuggestState {\r\n        if (!state) {\r\n            throw \"The state parameter is required.\";\r\n        }\r\n\r\n        if (!actionPayload) {\r\n            throw \"The actionPayload parameter is required.\";\r\n        }\r\n\r\n        let newState: ISearchWithAutosuggestState = cloneDeep(state);\r\n\r\n        if (this.searchHintsReduction.canReduce(actionPayload)) {\r\n            newState.searchHints = this.searchHintsReduction.reduce(state.searchHints, actionPayload);\r\n        }\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.searchWithAutosuggestActions.UpdateAutosuggestions, (suggestions: string[]) => {\r\n                newState.suggestions = suggestions;\r\n                return newState;\r\n            }\r\n        );\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.searchWithAutosuggestActions.SearchTextChanged, (value: string) => {\r\n                newState.autoSuggestInputState.value = value;\r\n                return newState;\r\n            }\r\n        );\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.searchWithAutosuggestActions.UpdateCatalystSuggestion, (suggestions: string[]) => {\r\n                newState.catalystSuggestions = suggestions;\r\n                return newState;\r\n            }\r\n        );\r\n\r\n        return newState;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { ISearchValidationRule } from \"./ISearchValidationRule\";\r\nimport { ISearchValidationRuleHint } from \"./ISearchValidationRuleHint\";\r\n\r\n/**\r\n * Applies a set of validation rules to the search text.\r\n * @param {string} searchText - The search text to validate.\r\n * @param {ISearchValidationRule[]} rules - The set of rules to apply.\r\n * @returns {ISearchValidationRuleTip[]} An array, possibly empty, containing the tips for the failed validation rules.\r\n */\r\nexport function validateSearchText(searchText: string, rules: ISearchValidationRule[]): ISearchValidationRuleHint[] {\r\n    let validationErrors: ISearchValidationRuleHint[] = [];\r\n\r\n    rules.forEach(rule => {\r\n        const validationFails = rule.testCondition(searchText);\r\n        if (validationFails) {\r\n            validationErrors.push(rule.searchHint);\r\n        }\r\n    });\r\n\r\n    return validationErrors;\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { defer, merge } from \"lodash-es\";\r\n\r\nimport { ActionDispatchCancellationToken } from \"cms-ui-redux/ActionDispatchCancellationToken\";\r\nimport { ComponentBootstrapper } from \"cms-ui-views/ComponentBootstrapper\";\r\nimport { EntitySearchActions } from \"cms-ui-presentationlogic/dataflows/entitySearch/EntitySearchActions\";\r\nimport { IActionDispatchCancellationToken } from \"cms-ui-redux/IActionDispatchCancellationToken\";\r\nimport { IDispatch } from \"redux\";\r\nimport { IInstrumentationClient } from \"../../instrumentation/instrumentationClient/IInstrumentationClient\";\r\nimport { IPageActionData } from \"clientcore-infrastructure-analytics/models/userActivityData/IPageActionData\";\r\nimport { IReducer } from \"cms-ui-redux/IReducer\";\r\nimport { ISearchValidationRule } from \"./validation/ISearchValidationRule\";\r\nimport { ISearchWithAutosuggestProps } from \"../../rendering/components/searchWithAutoSuggest/ISearchWithAutosuggestProps\";\r\nimport { ISearchWithAutosuggestState } from \"../../presentation-logic/dataflows/searchWithAutoSuggest/ISearchWithAutosuggestState\";\r\nimport { NotificationListActions } from \"cms-ui-presentationlogic/dataflows/notifications/NotificationListActions\";\r\nimport { NotificationListReduction } from \"cms-ui-presentationlogic/dataflows/notifications/NotificationListReduction\";\r\nimport { NotificationType } from \"cms-ui-presentationlogic/dataflows/notifications/NotificationType\";\r\nimport { OneSrvBusinessLogicFactory } from \"clientcore-onesrv-businesslogic/factory/OneSrvBusinessLogicFactory\";\r\nimport { PageActionData } from \"cms-businesslogic/instrumentation/PageActionData\";\r\nimport { PageNames } from \"../../instrumentation/instrumentationConstants/InstrumentationConstants\";\r\nimport { ReduxBootstrapper } from \"cms-ui-views/ReduxBootstrapper\";\r\nimport { SearchWithAutosuggestActionCreators } from \"../../presentation-logic/dataflows/searchWithAutosuggest/SearchWithAutosuggestActionCreators\";\r\nimport { SearchWithAutosuggestActions } from \"../../presentation-logic/dataflows/searchWithAutosuggest/SearchWithAutosuggestActions\";\r\nimport { SearchWithAutosuggestReduction } from \"../../presentation-logic/dataflows/searchWithAutosuggest/SearchWithAutosuggestReduction\";\r\nimport { validateSearchText } from \"./validation/SearchValidation\";\r\n\r\n/**\r\n * The bootstrapper that manages searches in Catalyst.\r\n * @class\r\n */\r\nexport abstract class SearchBootstrapperBase<TParentState> extends ComponentBootstrapper<ISearchWithAutosuggestState, ISearchWithAutosuggestProps, TParentState> {\r\n    /**\r\n     * Validation rules to apply for search text\r\n     * @type {ISearchValidationRule[]}\r\n     */\r\n    protected validateSearchTextRules: ISearchValidationRule[] = [];\r\n\r\n    /**\r\n     * Cancellation token so we can cancel loading (or at least the dispatching of the action when load autosuggest completes)\r\n     * when start a new autosuggest load.\r\n     * @type {IActionDispatchCancellationToken}\r\n     */\r\n    private autosuggestLoadCancellationToken: IActionDispatchCancellationToken;\r\n\r\n    /** An instance of the `SearchAndSelectActionCreators` class.\r\n     * @type {SearchWithAutosuggestActionCreators}\r\n     */\r\n    private searchWithAutosuggestActionCreators: SearchWithAutosuggestActionCreators;\r\n\r\n    /**\r\n     * Initializes a new instance of the 'SearchBootstrapperBase' class.\r\n     * @constructor\r\n     * @param parentBootstrapperName {string} String used for telemetry purposes to keep track of the source of the search (search and select).\r\n     * @param getSearchText {() => string} A function that returns the current search text.\r\n     * @param pageName {PageNames} Identifier of the page that triggered the search.\r\n     * @param oneServiceBusinessLogicFactory {OneSrvBusinessLogicFactory} The one service business logic factory.\r\n     * @param instrumentationClient {IInstrumentationClient} Provides support for instrumentation.\r\n     * @param entitySearchActions {EntitySearchActions} Actions related to entity search.\r\n     * @param searchWithAutosuggestActions {SearchWithAutosuggestActions} Action related to Auto Suggest.\r\n     * @param searchHintsActions {NotificationListActions} The ations for search hints.\r\n     * @param stateSelector {function} A function that selects the state for this bootstrapper from the parent state.\r\n     * @param parentBootstrapper {ComponentBootstrapper<TParentState, any, any>} The bootsrapper that contains this bootstrapper.\r\n     */\r\n    constructor(\r\n        protected parentBoostrapperName: string,\r\n        protected getSearchText: () => string,\r\n        protected pageName: PageNames,\r\n        protected oneServiceBusinessLogicFactory: OneSrvBusinessLogicFactory,\r\n        protected instrumentationClient: IInstrumentationClient,\r\n        protected entitySearchActions: EntitySearchActions,\r\n        protected searchWithAutosuggestActions: SearchWithAutosuggestActions,\r\n        protected searchHintsActions: NotificationListActions,\r\n        stateSelector?: (parentState: TParentState) => ISearchWithAutosuggestState,\r\n        parentBootstrapper?: ComponentBootstrapper<TParentState, any, any> | ReduxBootstrapper<TParentState>) {\r\n\r\n        super(parentBootstrapper, stateSelector);\r\n\r\n        if (!getSearchText) {\r\n            throw \"The getSearchText parameter is required.\";\r\n        }\r\n\r\n        if (!pageName) {\r\n            throw \"The pageName parameter is required.\";\r\n        }\r\n\r\n        if (!oneServiceBusinessLogicFactory) {\r\n            throw \"The oneServiceBusinessLogicFactory parameter is required.\";\r\n        }\r\n\r\n        if (!instrumentationClient) {\r\n            throw \"The instrumentationClient parameter is required.\";\r\n        }\r\n\r\n        if (!entitySearchActions) {\r\n            throw \"The entitySearchActions parameter is required.\";\r\n        }\r\n\r\n        if (!searchWithAutosuggestActions) {\r\n            throw \"The searchWithAutosuggestActions parameter is required.\";\r\n        }\r\n\r\n        if (!searchHintsActions) {\r\n            throw \"The searchHintsActions parameter is required.\";\r\n        }\r\n\r\n        this.autosuggestLoadCancellationToken = null;\r\n        this.cancelLastAutoSuggestLoad = this.cancelLastAutoSuggestLoad.bind(this);\r\n        this.onSearchTextChange = this.onSearchTextChange.bind(this);\r\n    }\r\n\r\n    /**\r\n     * Initializes the initial state.\r\n     * @method\r\n     * @returns {ISearchWithAutosuggestState<IEntityListState>} The initial state.\r\n     */\r\n    public getInitialState(): ISearchWithAutosuggestState {\r\n        return {\r\n            suggestions: [],\r\n            catalystSuggestions: [],\r\n            autoSuggestInputState: {\r\n                value: \"\"\r\n            },\r\n            searchHints: {\r\n                filterOutErrors: false,\r\n                filterOutInfo: false,\r\n                filterOutSuccess: false,\r\n                filterOutWarnings: false,\r\n                notifications: []\r\n            }\r\n        };\r\n    }\r\n\r\n    /**\r\n     * Initializes the default properties.\r\n     * @method\r\n     * @returns {ISearchWithAutosuggestProps} The default props.\r\n     */\r\n    public getDefaultProps(): ISearchWithAutosuggestProps {\r\n        return {\r\n            autoSuggestInputProps: {\r\n                placeholder: \"Find your perfect photo\",\r\n                value: \"\",\r\n                onChange: this.onSearchTextChange\r\n            },\r\n            shouldRenderSuggestions: (_text: string) => true,\r\n            allowSearch: this.manageSearchHints.bind(this),\r\n            suggestions: [],\r\n            onSuggestionsFetchRequested: ({ value }) => {\r\n                this.searchWithAutosuggestActionCreators.getAutosuggestEntities(\r\n                    value,\r\n                    this.instrumentationClient.RootActivity,\r\n                    this.autosuggestLoadCancellationToken);\r\n            },\r\n            onSuggestionsClearRequested: () => {\r\n                defer(() => this.searchWithAutosuggestActionCreators.clearSuggestions);\r\n            },\r\n            searchHintsNotifications: []\r\n        } as ISearchWithAutosuggestProps;\r\n    }\r\n\r\n    /**\r\n     * Maps the search state to the props that power the SearchWithAutosuggest component.\r\n     * @method\r\n     * @param state {ISearchWithAutosuggestState} The redux state.\r\n     * @returns {ISearchWithAutosuggestProps} The mapped props.\r\n     */\r\n    public mapStateToProps(searchWithAutosuggestState: ISearchWithAutosuggestState): ISearchWithAutosuggestProps {\r\n        const defaultProps = this.getDefaultProps();\r\n        const props = merge({}, {\r\n            ...defaultProps,\r\n            autoSuggestInputProps: {\r\n                ...defaultProps.autoSuggestInputProps,\r\n                value: this.getSearchText()\r\n            },\r\n            suggestions: searchWithAutosuggestState.suggestions,\r\n            shouldRenderSuggestions: (_text: string) => this.getCurrentState().searchHints.notifications.length === 0,\r\n            onSuggestionsFetchRequested: ({ value }) => {\r\n                const searchHints = validateSearchText(value, this.validateSearchTextRules);\r\n                if (searchHints.length === 0) {\r\n                    this.searchWithAutosuggestActionCreators.getAutosuggestEntities(\r\n                        value,\r\n                        this.instrumentationClient.RootActivity,\r\n                        this.autosuggestLoadCancellationToken);\r\n                }\r\n            },\r\n            searchHintsNotifications: searchWithAutosuggestState.searchHints.notifications,\r\n            allowSearch: this.allowSearch(searchWithAutosuggestState)\r\n        }) as ISearchWithAutosuggestProps;\r\n\r\n        return props;\r\n    }\r\n\r\n    /**\r\n     * Assign callbacks to the props that power the SearchWithAutosuggest component.\r\n     * @method\r\n     * @param {IDispatch} dispatch The redux dispatch function.\r\n     * @param {ISearchWithAutosuggestProps} ownProps The default props.\r\n     * @returns {ISearchWithAutosuggestProps} The mapped props.\r\n     */\r\n    public mapDispatchToProps(_dispatch: IDispatch, _ownProps: ISearchWithAutosuggestProps): ISearchWithAutosuggestProps {\r\n        return {} as ISearchWithAutosuggestProps;\r\n    }\r\n\r\n    /**\r\n     * Creates the root reducer of the component.\r\n     * @method\r\n     * @returns {IReducer<ISearchWithAutosuggestState>} The root reducer of the component.\r\n     */\r\n    public createRootReducer(): IReducer<ISearchWithAutosuggestState> {\r\n        const searchHintsReduction = new NotificationListReduction(this.searchHintsActions);\r\n\r\n        const searchWithAutosuggestReduction = new SearchWithAutosuggestReduction(this.searchWithAutosuggestActions, searchHintsReduction);\r\n\r\n        return searchWithAutosuggestReduction;\r\n    }\r\n\r\n    /**\r\n     * Performs required job before the component is created.\r\n     * @method\r\n     */\r\n    public onBeforeComponentCreated(): void {\r\n        this.searchWithAutosuggestActionCreators = new SearchWithAutosuggestActionCreators(\r\n            this.oneServiceBusinessLogicFactory,\r\n            this.instrumentationClient,\r\n            this.store,\r\n            this.searchWithAutosuggestActions);\r\n    }\r\n\r\n    /**\r\n     * Logic invoked when search text changes.\r\n     * @method\r\n     * @param event {React.FormEvent}\r\n     * @param value {string} User selection from AutoSuggest dropdown.\r\n     */\r\n    public onSearchTextChange(_event: React.SyntheticEvent<any>, value: { newValue: string }): void {\r\n        this.cancelLastAutoSuggestLoad();\r\n\r\n        this.manageSearchHints(value.newValue);\r\n\r\n        this.entitySearchActions.SearchTextChange.getActionSender(this.store)(value.newValue);\r\n    }\r\n\r\n    /**\r\n     * Remove all the search hint from the page.\r\n     * @method\r\n     */\r\n    public clearSearchHints(): void {\r\n        this.searchHintsActions.ClearAllNotifications.getActionSender(this.store)();\r\n    }\r\n\r\n    /**\r\n     * Get the Page action data for Search\r\n     * @parma { { [key: string]: string; } } The action input to be part of the page action data\r\n     * @method\r\n     * @returns { IPageActionData } The page action data.\r\n     */\r\n    public getPageActionData(actionInput: { [key: string]: string; }): IPageActionData {\r\n        return PageActionData.createFrom(null, actionInput, null, null, null, null, this.pageName);\r\n    }\r\n\r\n    /**\r\n     * Validates the search text and shows a hint in the form of a <Notification /> element for every failed rule.\r\n     * @param value {string} the search term\r\n     * @return {boolean} whether or not to block the search action.\r\n     */\r\n    protected manageSearchHints(searchText: string): boolean {\r\n        let performSearch = true;\r\n\r\n        // avoid to trigger a Redux cycle if there is nothing to clear.\r\n        // particularly useful until we optimize `mapStateToProps` perfs in `SearchAndSelectBootstrapper`.\r\n        if (this.getCurrentState().searchHints.notifications.length > 0) {\r\n            this.searchHintsActions.ClearAllNotifications.getActionSender(this.store)();\r\n        }\r\n\r\n        const searchHints = validateSearchText(searchText, this.validateSearchTextRules);\r\n\r\n        searchHints.forEach(validationResult => {\r\n            performSearch = performSearch && validationResult.hintServerity !== NotificationType.Error;\r\n            this.searchHintsActions.AddNotification.getActionSender(this.store)(\r\n                validationResult.hintServerity,\r\n                validationResult.quickHint,\r\n                validationResult.fullHint,\r\n                \"Search tip:\");\r\n        });\r\n\r\n        return performSearch;\r\n    }\r\n\r\n    /**\r\n     * Validates the search action should be blocked or not.\r\n     * @param searchWithAutoSuggestState {ISearchWithAutosuggestState} the current state\r\n     * @returns {boolean} search should be allowed or not\r\n     */\r\n    protected allowSearch(searchWithAutosuggestState: ISearchWithAutosuggestState): boolean {\r\n        let result = true;\r\n\r\n        if (!!searchWithAutosuggestState.searchHints && searchWithAutosuggestState.searchHints.notifications.length > 0) {\r\n            searchWithAutosuggestState.searchHints.notifications.forEach(notification => {\r\n                result = result && notification.itemType !== NotificationType.Error;\r\n            });\r\n        }\r\n\r\n        return result;\r\n    }\r\n\r\n    /**\r\n     * Cancel the last auto suggestion load\r\n     * @method\r\n     */\r\n    protected cancelLastAutoSuggestLoad(): void {\r\n        if (!!this.autosuggestLoadCancellationToken) {\r\n            this.autosuggestLoadCancellationToken.cancel();\r\n        }\r\n\r\n        this.autosuggestLoadCancellationToken = new ActionDispatchCancellationToken();\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { AreaOfPage, PageNames } from \"../../instrumentation/instrumentationConstants/InstrumentationConstants\";\r\n\r\nimport { ActionDispatchCancellationToken } from \"cms-ui-redux/ActionDispatchCancellationToken\";\r\nimport { ComponentBootstrapper } from \"cms-ui-views/ComponentBootstrapper\";\r\nimport { CreativeSearchActionCreator } from \"../../presentation-logic/dataflows/creativeSearch/CreativeSearchActionCreator\";\r\nimport { CreativeSearchActions } from \"../../presentation-logic/dataflows/creativeSearch/CreativeSearchActions\";\r\nimport { EntitySearchActions } from \"cms-ui-presentationlogic/dataflows/entitySearch/EntitySearchActions\";\r\nimport { IActionDispatchCancellationToken } from \"cms-ui-redux/IActionDispatchCancellationToken\";\r\nimport { ICreativeImageSearchManager } from \"clientcore-catalyst-businesslogic/creativeSearch/ICreativeImageSearchManager\";\r\nimport { ICreativeSearchQuery } from \"clientcore-catalyst-businesslogic/creativeSearch/ICreativeSearchQuery\";\r\nimport { IInstrumentationClient } from \"../../instrumentation/instrumentationClient/IInstrumentationClient\";\r\nimport { ISearchWithAutosuggestState } from \"../../presentation-logic/dataflows/searchWithAutoSuggest/ISearchWithAutosuggestState\";\r\nimport { NotificationListActions } from \"cms-ui-presentationlogic/dataflows/notifications/NotificationListActions\";\r\nimport { OneSrvBusinessLogicFactory } from \"clientcore-onesrv-businesslogic/factory/OneSrvBusinessLogicFactory\";\r\nimport { PromiseExtension } from \"cms-infrastructure/promise-extension/PromiseExtension\";\r\nimport { ReduxBootstrapper } from \"cms-ui-views/ReduxBootstrapper\";\r\nimport { SearchBootstrapperBase } from \"./SearchBootstrapperBase\";\r\nimport { SearchWithAutosuggestActions } from \"../../presentation-logic/dataflows/searchWithAutosuggest/SearchWithAutosuggestActions\";\r\n\r\n/**\r\n * The bootstrapper that manages creative  searches in Catalyst.\r\n * @class\r\n */\r\nexport class CreativeSearchBootstrapper<TParentState> extends SearchBootstrapperBase<TParentState> {\r\n    /**\r\n     * Cancellation token so we can cancel loading (or at least the dispatching of the action when search completes)\r\n     * when the user has decided to start a new search.\r\n     * @type {IActionDispatchCancellationToken}\r\n     */\r\n    private searchCancellationToken: IActionDispatchCancellationToken;\r\n\r\n    /** An instance of the 'CreativeSearchActions' class for dealing with the search.\r\n     * @type {CreativeSearchActions}\r\n     */\r\n    private creativeSearchActions: CreativeSearchActions;\r\n\r\n    /** An instance of the 'CreativeSearchActions' class for dealing with the search.\r\n     * @type {CreativeSearchActionCreator}\r\n     */\r\n    private creativeSearchActionCreator: CreativeSearchActionCreator;\r\n\r\n    /**\r\n     * Initializes a new instance of the 'CreativeSearchBootstrapper' class.\r\n     * @constructor\r\n     * @param parentBootstrapperName {string} String used for telemetry purposes to keep track of the source of the search (search and select).\r\n     * @param getSearchText {() => string} A function that returns the current search text.\r\n     * @param buildCreativeFilterQuery {() => Predicate} A function that returns the filters to apply to the search.\r\n     * @param creativeImageSearchManager {ICreativeImageSearchManager} A function that returns the sorting clauses to apply to the search.\r\n     * @param pageName {PageNames} Identifier of the page that triggered the search.\r\n     * @param getActionInput {() => { [key: string]: string; }} Function that returns the action input used for telemetry purposes.\r\n     * @param oneServiceBusinessLogicFactory {OneSrvBusinessLogicFactory} The one service business logic factory.\r\n     * @param instrumentationClient {IInstrumentationClient} Provides support for instrumentation.\r\n     * @param entitySearchActions {EntitySearchActions} The actions for creative image search.\r\n     * @param searchWithAutosuggestActions {SearchWithAutosuggestActions} The auto suggest actions.\r\n     * @param searchHintsActions {NotificationListActions} The search hint actions.\r\n     * @param actionNamespacePrefix {string} Optional prefix to add to the namespace used to distinguish actions created by this bootstrapper.\r\n     * @param stateSelector {function} A function that selects the state for this bootstrapper from the parent state.\r\n     * @param parentBootstrapper {ComponentBootstrapper<TParentState, any, any>} The bootsrapper that contains this bootstrapper.\r\n     */\r\n    constructor(\r\n        parentBoostrapperName: string,\r\n        protected getSearchText: () => string,\r\n        private buildCreativeFilterQuery: () => ICreativeSearchQuery,\r\n        private creativeImageSearchManager: ICreativeImageSearchManager,\r\n        pageName: PageNames,\r\n        private getActionInput: () => { [key: string]: string; },\r\n        oneServiceBusinessLogicFactory: OneSrvBusinessLogicFactory,\r\n        instrumentationClient: IInstrumentationClient,\r\n        entitySearchActions: EntitySearchActions,\r\n        searchWithAutosuggestActions: SearchWithAutosuggestActions,\r\n        searchHintsActions: NotificationListActions,\r\n        actionNamespacePrefix?: string,\r\n        stateSelector?: (parentState: TParentState) => ISearchWithAutosuggestState,\r\n        parentBootstrapper?: ComponentBootstrapper<TParentState, any, any> | ReduxBootstrapper<TParentState>) {\r\n\r\n        super(\r\n            parentBoostrapperName,\r\n            getSearchText,\r\n            pageName,\r\n            oneServiceBusinessLogicFactory,\r\n            instrumentationClient,\r\n            entitySearchActions,\r\n            searchWithAutosuggestActions,\r\n            searchHintsActions,\r\n            stateSelector,\r\n            parentBootstrapper);\r\n\r\n        this.creativeSearchActions = new CreativeSearchActions(actionNamespacePrefix + \"CreativeSearch\");\r\n        this.onSearchInvoked = this.onSearchInvoked.bind(this);\r\n    }\r\n\r\n    /**\r\n     * Performs required job before the component is created.\r\n     * @method\r\n     */\r\n    public onBeforeComponentCreated(): void {\r\n        super.onBeforeComponentCreated();\r\n        this.creativeSearchActionCreator = new CreativeSearchActionCreator(\r\n            this.creativeImageSearchManager,\r\n            this.creativeSearchActions,\r\n            this.instrumentationClient,\r\n            this.store);\r\n    }\r\n\r\n    /**\r\n     * Logic invoked when a Search is Executed.\r\n     * @param control {string} Identifier for the control that has instigated the search. Used as the element title in the event data when creating the telemetry.\r\n     * @param controlType {string} The type of the control that has instigated the search. This, combined with control, forms the elementId in the event data when creating the telemetry.\r\n     * @param event {Event} the event which triggered this handler\r\n     * @return {boolean} whether or not to reset pager.\r\n     * @method\r\n     */\r\n    public onSearchInvoked(control: string, controlType: string, event: React.SyntheticEvent<any>): IActionDispatchCancellationToken {\r\n        const searchText = this.getSearchText();\r\n\r\n        if (this.manageSearchHints(searchText)) {\r\n            // This is the root search activity, re-created each time there's a new search.\r\n            // All other actions, e.g. download, page navigation, that occur in the context of this search are tracked\r\n            // with the correlation vector from this activity.\r\n            const searchActivity = this.creativeSearchActionCreator.endCurrentAndCreateNewSearchActivity();\r\n\r\n            this.cancelCurrentAndCreateNewCancellationToken();\r\n\r\n            const query = this.buildCreativeFilterQuery();\r\n\r\n            // This activity is used to track the perf of the search execution.\r\n            const creativeSearchActivity =\r\n                this.instrumentationClient.ActivityLoggingService.createActivity(\r\n                    `${this.parentBoostrapperName}.onCreativeSearchInvoked`,\r\n                    searchActivity,\r\n                    { provider: query.provider } // Pass provider name as data so we can separate out search times by provider in reporting.\r\n                                                 // This data is also passed with the EndActivity where it is really needed.\r\n                );\r\n\r\n            this.instrumentationClient.UserActivityTrackingService.logPageActionEvent(\r\n                this.instrumentationClient.createEventData(event, control, null, control + \"-\" + controlType, AreaOfPage.creativeSearchBar),\r\n                PageNames.Creative,\r\n                creativeSearchActivity.correlationVector,\r\n                this.getPageActionData(this.getActionInput()));\r\n\r\n            const executeSearchPromise = this.creativeSearchActionCreator.executeCreativeSearch(query, this.searchCancellationToken, creativeSearchActivity);\r\n\r\n            executeSearchPromise.catch((error) => {\r\n                this.instrumentationClient.LoggingService.error(\r\n                    `${this.parentBoostrapperName}.onCreativeSearchInvoked`,\r\n                    creativeSearchActivity,\r\n                    {\r\n                        provider: query.provider,\r\n                        error\r\n                    });\r\n            });\r\n\r\n            PromiseExtension.onComplete(executeSearchPromise, () => this.instrumentationClient.ActivityLoggingService.endActivity(creativeSearchActivity));\r\n\r\n            return this.searchCancellationToken;\r\n        }\r\n\r\n        return null;\r\n    }\r\n\r\n    /**\r\n     * Gets the instance of the creativeSearchAction creator.\r\n     * @getter\r\n     */\r\n    public get CreativeSearchActionCreator(): CreativeSearchActionCreator {\r\n        return this.creativeSearchActionCreator;\r\n    }\r\n\r\n    /**\r\n     * Helper method to call cancel on the current searchCancellationToken and to create a new token.\r\n     * Move this to bootstrapper\r\n     * @method\r\n     */\r\n    private cancelCurrentAndCreateNewCancellationToken(): void {\r\n        if (!!this.searchCancellationToken) {\r\n            this.searchCancellationToken.cancel();\r\n        }\r\n\r\n        this.searchCancellationToken = new ActionDispatchCancellationToken();\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { clone, cloneDeep } from \"lodash-es\";\r\n\r\nimport { ActionHandler } from \"cms-ui-redux/ActionHandler\";\r\nimport { Actions } from \"../../../globals/actions\";\r\nimport { CatalystSearchReduction } from \"../catalystSearch/CatalystSearchReduction\";\r\nimport { CollapsibleActions } from \"cms-ui-presentationlogic/dataflows/collapsible/CollapsibleActions\";\r\nimport { CreativeProvider } from \"clientcore-catalyst-businesslogic/creativeSearch/CreativeProvider\";\r\nimport { CreativeSearchActions } from \"./CreativeSearchActions\";\r\nimport { EntitySearchActions } from \"cms-ui-presentationlogic/dataflows/entitySearch/EntitySearchActions\";\r\nimport { IActionPayload } from \"cms-ui-redux/IActionPayload\";\r\nimport { IContinuationToken } from \"cms-businesslogic/IContinuationToken\";\r\nimport { ICreativeImage } from \"clientcore-catalyst-businesslogic/creativeSearch/ICreativeImage\";\r\nimport { ICreativeImageSearchErrorResponse } from \"clientcore-catalyst-businesslogic/creativeSearch/ICreativeImageSearchErrorResponse\";\r\nimport { ICreativeImageSearchResults } from \"clientcore-catalyst-businesslogic/creativeSearch/ICreativeImageSearchResults\";\r\nimport { ICreativeImageSearchState } from \"./ICreativeImageSearchState\";\r\nimport { ICreativeSearchQuery } from \"clientcore-catalyst-businesslogic/creativeSearch/ICreativeSearchQuery\";\r\nimport { IPagingState } from \"cms-ui-presentationlogic/dataflows/paging/IPagingState\";\r\nimport { IReducer } from \"cms-ui-redux/IReducer\";\r\nimport { ISearchWithAutosuggestState } from \"../searchWithAutosuggest/ISearchWithAutosuggestState\";\r\nimport { ImageCommandReduction } from \"../imageCommand/ImageCommandReduction\";\r\nimport { ImagePreviewModalActions } from \"../imagePreviewModal/ImagePreviewModalActions\";\r\nimport { ListItemSelectorActions } from \"../listItemSelector/ListItemSelectorActions\";\r\nimport { ModalProvisioningReduction } from \"cms-ui-presentationlogic/dataflows/modalProvisioning/ModalProvisioningReduction\";\r\nimport { NamespaceCheckReducerBase } from \"cms-ui-redux/NamespaceCheckReducerBase\";\r\nimport { PagingActions } from \"cms-ui-presentationlogic/dataflows/paging/PagingActions\";\r\nimport { ResultsDisplayModeEnum } from \"../../../models/displayMode/ResultsDisplayModeEnum\";\r\nimport { SearchWithAutosuggestActions } from \"../searchWithAutosuggest/SearchWithAutosuggestActions\";\r\n\r\n/**\r\n * Contains reducer for the CreativeSearch experience.\r\n * @class\r\n */\r\nexport class CreativeSearchReduction extends NamespaceCheckReducerBase<ICreativeImageSearchState> {\r\n    /**\r\n     * Initializes a new instance of the `CreativeSearchReduction` class.\r\n     * @param collapsibleActions {CollapsibleActions} The actions that this reducer handles for filter pane.\r\n     * @param providerListSelectorActions {ListSelectorActions} The actions that this reducer handles for the list of image providers.\r\n     * @param orientationListSelectorActions {ListSelectorActions} The actions that this reducer handles for the list of image orientations.\r\n     * @param imageStyleListItemSelectorActions {ListSelectorActions} The actions that this reducer handles for the list of image styles.\r\n     * @param sortOrderOptionsListSelectorActions {ListSelectorActions} The actions that this reducer handles for the list of sort order options.\r\n     * @param creativeSearchActions {CreativeSearchActions} The creative search actions that this reducer handles.\r\n     * @param entitySearchActions {EntitySearchActions} The actions that this reducer handles.\r\n     * @param searchWithAutosuggestActions: {SearchWithAutosuggestActions} The search with autosuggest actions\r\n     * @param modalProvisioningReduction {ModalProvisioningReduction} modal provisioning reducer\r\n     * @param pagingActions {PagingActions} Creative search needs to listen to canvas width changes, which it can do via this set of actions\r\n     * @param searchWithAutosuggestReduction: {IReducer<ISearchWithAutosuggestState>} The search with autosuggest reducer\r\n     * @param catalystSearchReduction {CatalystSearchReduction} The catalystSearch reducer\r\n     * @param pagedImagesReduction {IReducer<IPagingState>} The reducer that mutates the state associated with the paging.\r\n     * @param imagePreviewModalVisibilityReduction {ModalVisibilityReduction} image preview modal visibility reducer\r\n     * @param imageCommandReduction: {ImageCommandReduction} Reducer for image command (e.g. downloadImage) actions\r\n     * @constructor\r\n     */\r\n    constructor(\r\n        public collapsibleActions: CollapsibleActions,\r\n        public providerListSelectorActions: ListItemSelectorActions<number>,\r\n        public orientationListSelectorActions: ListItemSelectorActions<number>,\r\n        public imageStyleListItemSelectorActions: ListItemSelectorActions<number>,\r\n        public sortOrderListItemSelectorActions: ListItemSelectorActions<number>,\r\n        public creativeSearchActions: CreativeSearchActions,\r\n        public entitySearchActions: EntitySearchActions,\r\n        public searchWithAutosuggestActions: SearchWithAutosuggestActions,\r\n        public imagePreviewModalActions: ImagePreviewModalActions,\r\n        public pagingActions: PagingActions,\r\n        public searchWithAutosuggestReduction: IReducer<ISearchWithAutosuggestState>,\r\n        public catalystSearchReduction: CatalystSearchReduction,\r\n        public pagedImagesReduction: IReducer<IPagingState>,\r\n        public modalProvisioningReduction: ModalProvisioningReduction,\r\n        public imageCommandReduction: ImageCommandReduction) {\r\n        super(\r\n            [\r\n                collapsibleActions.namespace,\r\n                providerListSelectorActions.namespace,\r\n                orientationListSelectorActions.namespace,\r\n                creativeSearchActions.namespace,\r\n                imageStyleListItemSelectorActions.namespace,\r\n                sortOrderListItemSelectorActions.namespace,\r\n                searchWithAutosuggestActions.namespace,\r\n                imagePreviewModalActions.namespace,\r\n                pagingActions.namespace,\r\n                Actions.Creative.SearchResultsScrollPositionActions.namespace],\r\n            [\r\n                searchWithAutosuggestReduction,\r\n                catalystSearchReduction,\r\n                pagedImagesReduction,\r\n                modalProvisioningReduction,\r\n                imageCommandReduction]);\r\n\r\n        if (!collapsibleActions) {\r\n            throw \"The collapsibleActions parameter is required.\";\r\n        }\r\n\r\n        if (!entitySearchActions) {\r\n            throw \"The entitySearchActions parameter is required.\";\r\n        }\r\n\r\n        if (!providerListSelectorActions) {\r\n            throw \"The providerListSelectorActions parameter is required.\";\r\n        }\r\n\r\n        if (!orientationListSelectorActions) {\r\n            throw \"The orientationListSelectorActions parameter is required.\";\r\n        }\r\n\r\n        if (!imageStyleListItemSelectorActions) {\r\n            throw \"The imageStyleListItemSelectorActions parameter is required.\";\r\n        }\r\n\r\n        if (!sortOrderListItemSelectorActions) {\r\n            throw \"The sortOrderListItemSelectorActions parameter is required.\";\r\n        }\r\n\r\n        if (!creativeSearchActions) {\r\n            throw \"The creativeSearchActions parameter is required.\";\r\n        }\r\n\r\n        if (!searchWithAutosuggestActions) {\r\n            throw \"The searchWithAutosuggestActions parameter is required.\";\r\n        }\r\n\r\n        if (!searchWithAutosuggestReduction) {\r\n            throw \"The searchWithAutosuggestReduction parameter is required.\";\r\n        }\r\n\r\n        if (!catalystSearchReduction) {\r\n            throw \"The catalystSearchReduction parameter is required.\";\r\n        }\r\n\r\n        if (!pagedImagesReduction) {\r\n            throw \"The pagedImagesReduction parameter is required.\";\r\n        }\r\n\r\n        if (!imagePreviewModalActions) {\r\n            throw \"The imagePreviewModalAction parameter is required.\";\r\n        }\r\n\r\n        if (!pagingActions) {\r\n            throw \"The pagingActions parameter is required.\";\r\n        }\r\n\r\n        if (!modalProvisioningReduction) {\r\n            throw \"The modalProvisioningReduction parameter is required.\";\r\n        }\r\n\r\n        if (!imageCommandReduction) {\r\n            throw \"The imageCommandReduction parameter is required.\";\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Resets the provider filter to their initial state.\r\n     * @function\r\n     * @param newState {ICreativeImageSearchState} The state that the reducer should mutate.\r\n     * @param providerName {string} The provider name.\r\n     */\r\n    private static resetProviderFilter(newState: ICreativeImageSearchState, providerName: string): void {\r\n        let providerFilters = newState.providerImageSearchFilters[providerName];\r\n        providerFilters = clone(providerFilters);\r\n\r\n        providerFilters.selectedOrientations = clone(providerFilters.selectedOrientations);\r\n        providerFilters.selectedImageStyle = clone(providerFilters.selectedImageStyle);\r\n        if (providerName === CreativeProvider.ShutterStock) {\r\n            providerFilters.selectedOrientations.selectedItems = [0];\r\n            providerFilters.selectedImageStyle.selectedItems = [0];\r\n        } else {\r\n            providerFilters.selectedOrientations.selectedItems = [];\r\n            providerFilters.selectedImageStyle.selectedItems = [];\r\n        }\r\n\r\n    }\r\n\r\n    /**\r\n     * Mutates the given state with the given action.\r\n     * @function\r\n     * @param state {ICreativeImageSearchState} The state that the reducer should mutate.\r\n     * @param actionPayload {IActionPayload} The action detail to update the state with.\r\n     * @returns {ICreativeImageSearchState} The mutated state.\r\n     */\r\n    public reduce(state: ICreativeImageSearchState, actionPayload: IActionPayload): ICreativeImageSearchState {\r\n\r\n        if (!state) {\r\n            throw \"The state parameter is required.\";\r\n        }\r\n\r\n        if (!actionPayload) {\r\n            throw \"The actionPayload parameter is required.\";\r\n        }\r\n\r\n        let newState = clone(state);\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.creativeSearchActions.ResetFilter, () => {\r\n                newState.currentSelectedProvider = CreativeProvider.Getty;\r\n                newState.selectedProviders = clone(newState.selectedProviders);\r\n                newState.selectedProviders.selectedItems = [0];\r\n                newState.selectedSortOrder = clone(newState.selectedSortOrder);\r\n                newState.selectedSortOrder.selectedItems = [0];\r\n\r\n                CreativeSearchReduction.resetProviderFilter(newState, CreativeProvider.Getty);\r\n                CreativeSearchReduction.resetProviderFilter(newState, CreativeProvider.ShutterStock);\r\n\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.imagePreviewModalActions.CreativeImagePreviewModalFetchEnd, (selectedCreativeImage: ICreativeImage, index: number) => {\r\n                newState.selectedImageEntity = selectedCreativeImage;\r\n                newState.selectedImageEntityIndex = index;\r\n                return newState;\r\n            }\r\n        );\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.creativeSearchActions.SetResultsDisplayMode, (resultsDisplayMode: ResultsDisplayModeEnum) => {\r\n                newState.resultsDisplayMode = resultsDisplayMode;\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, Actions.Creative.SearchResultsScrollPositionActions.SaveScrollPosition, (scrollTop: number) => {\r\n                newState.scrollTop[state.currentSelectedProvider] = scrollTop;\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.creativeSearchActions.FirstPageSearchExecutingSignature, (query: ICreativeSearchQuery) => {\r\n                let currentResults = newState.providerImageSearchResults[query.provider];\r\n                const pagedImageState = { ...currentResults.pagedImagesState, activePageIndex: 0 };\r\n\r\n                newState.providerImageSearchResults = cloneDeep(newState.providerImageSearchResults);\r\n                newState.providerImageSearchResults[query.provider] = {\r\n                    ...currentResults,\r\n                    loading: true,\r\n                    totalResultsAvailable: 0,\r\n                    pagedImagesState: pagedImageState,\r\n                    pagedSearchResults: {},\r\n                    serviceError: null,\r\n                    continuationToken: null\r\n                };\r\n\r\n                newState.hasSearchExecutedOnce = true;\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.creativeSearchActions.NextPageSearchExecutingSignature, (query: ICreativeSearchQuery) => {\r\n                newState.providerImageSearchResults = cloneDeep(newState.providerImageSearchResults);\r\n                let currentResults = newState.providerImageSearchResults[query.provider];\r\n                newState.providerImageSearchResults[query.provider] = {\r\n                    ...currentResults,\r\n                    loading: true,\r\n                    serviceError: null\r\n                };\r\n\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload,\r\n            this.creativeSearchActions.FirstPageSearchExecutionErrorSignature,\r\n            (error: ICreativeImageSearchErrorResponse, query: ICreativeSearchQuery) => {\r\n                newState.providerImageSearchResults = cloneDeep(newState.providerImageSearchResults);\r\n                let currentResults = newState.providerImageSearchResults[query.provider];\r\n                newState.providerImageSearchResults[query.provider] = {\r\n                    ...currentResults,\r\n                    loading: false,\r\n                    serviceError: {\r\n                        titlePrefix: \"Whoops! Error occurred while getting the images from \" + query.provider + \". Try executing the search again.\",\r\n                        title: error.errorMessage\r\n                    }\r\n                };\r\n\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload,\r\n            this.creativeSearchActions.NextPageSearchExecutionErrorSignature,\r\n            (error: ICreativeImageSearchErrorResponse, query: ICreativeSearchQuery) => {\r\n                newState.providerImageSearchResults = cloneDeep(newState.providerImageSearchResults);\r\n                let currentResults = newState.providerImageSearchResults[query.provider];\r\n                newState.providerImageSearchResults[query.provider] = {\r\n                    ...currentResults,\r\n                    loading: false,\r\n                    serviceError: {\r\n                        titlePrefix: \"Whoops! Error occurred while getting the images from \" + query.provider + \". Click Retry button to get more images.\",\r\n                        title: error.errorMessage\r\n                    }\r\n                };\r\n\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.creativeSearchActions.FirstPageSearchExecutedSignature, (searchResults: ICreativeImageSearchResults, continuationToken: IContinuationToken) => {\r\n                const provider = searchResults.query.provider;\r\n                newState.providerImageSearchResults = cloneDeep(newState.providerImageSearchResults);\r\n                let currentResults = newState.providerImageSearchResults[provider];\r\n                const pageNumber = searchResults.page;\r\n                newState.providerImageSearchResults[provider] = {\r\n                    ...currentResults,\r\n                    loading: false,\r\n                    continuationToken: continuationToken,\r\n                    lastPageFetched: searchResults.page,\r\n                    totalResultsAvailable: searchResults.results.length\r\n                };\r\n\r\n                newState.providerImageSearchResults[provider].pagedSearchResults[pageNumber] = searchResults;\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.creativeSearchActions.NextPageSearchExecutedSignature, (searchResults: ICreativeImageSearchResults, continuationToken: IContinuationToken) => {\r\n                const provider = searchResults.query.provider;\r\n                newState.providerImageSearchResults = cloneDeep(newState.providerImageSearchResults);\r\n                let currentResults = newState.providerImageSearchResults[provider];\r\n                const pageNumber = searchResults.page;\r\n                newState.providerImageSearchResults[provider] = {\r\n                    ...currentResults,\r\n                    loading: false,\r\n                    continuationToken: continuationToken,\r\n                    lastPageFetched: searchResults.page\r\n                };\r\n\r\n                newState.providerImageSearchResults[provider].pagedSearchResults[pageNumber] = searchResults;\r\n                let totalResultsAvailable = 0;\r\n\r\n                const pagedSearchResults = newState.providerImageSearchResults[provider].pagedSearchResults;\r\n                const keys = Object.keys(pagedSearchResults);\r\n\r\n                totalResultsAvailable = keys.reduce(\r\n                    (totalResults, key) => {\r\n                        return totalResults + pagedSearchResults[key].results.length;\r\n                    },\r\n                    totalResultsAvailable);\r\n\r\n                newState.providerImageSearchResults[provider].totalResultsAvailable = totalResultsAvailable;\r\n\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.collapsibleActions.ToggleCollapsible, () => {\r\n                newState.filterOptionVisibleState = clone(state.filterOptionVisibleState);\r\n                newState.filterOptionVisibleState.collapsed = !newState.filterOptionVisibleState.collapsed;\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.sortOrderListItemSelectorActions.SelectionChanged, (selectedItems: number[]) => {\r\n                newState.selectedSortOrder = {\r\n                    ...state.selectedSortOrder,\r\n                    selectedItems: [].concat(selectedItems)\r\n                };\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.providerListSelectorActions.SelectionChanged, (selectedItems: number[]) => {\r\n                newState.selectedProviders = clone(state.selectedProviders);\r\n                newState.selectedProviders.selectedItems = selectedItems;\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.creativeSearchActions.SetProvider, (provider: CreativeProvider) => {\r\n                newState.currentSelectedProvider = provider;\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.orientationListSelectorActions.SelectionChanged, (selectedItems: number[]) => {\r\n                newState.providerImageSearchResults = cloneDeep(newState.providerImageSearchResults);\r\n                let currentSelectedProviderFilter = newState.providerImageSearchFilters[newState.currentSelectedProvider];\r\n                currentSelectedProviderFilter.selectedOrientations = clone(currentSelectedProviderFilter.selectedOrientations);\r\n                currentSelectedProviderFilter.selectedOrientations.selectedItems = selectedItems;\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.imageStyleListItemSelectorActions.SelectionChanged, (selectedItems: number[]) => {\r\n                newState.providerImageSearchResults = cloneDeep(newState.providerImageSearchResults);\r\n                let currentSelectedProviderFilter = newState.providerImageSearchFilters[newState.currentSelectedProvider];\r\n                currentSelectedProviderFilter.selectedImageStyle = clone(currentSelectedProviderFilter.selectedImageStyle);\r\n                currentSelectedProviderFilter.selectedImageStyle.selectedItems = selectedItems;\r\n                return newState;\r\n            });\r\n\r\n        // manages a size change for the containing canvas\r\n        ActionHandler.handleAction(actionPayload, this.pagingActions.CanvasSizeChanged, (canvasWidth: number, canvasHeight: number) => {\r\n            newState.canvasWidth = canvasWidth;\r\n            newState.canvasHeight = canvasHeight;\r\n        }\r\n        );\r\n\r\n        if (this.modalProvisioningReduction.canReduce(actionPayload)) {\r\n            newState.modalProvisioningState = this.modalProvisioningReduction.reduce(newState.modalProvisioningState, actionPayload);\r\n        }\r\n\r\n        if (this.catalystSearchReduction.canReduce(actionPayload)) {\r\n            newState.entitySearchState = this.catalystSearchReduction.reduce(newState.entitySearchState, actionPayload);\r\n        }\r\n\r\n        if (this.searchWithAutosuggestReduction.canReduce(actionPayload)) {\r\n            newState.searchWithAutosuggestState = this.searchWithAutosuggestReduction.reduce(newState.searchWithAutosuggestState, actionPayload);\r\n        }\r\n\r\n        if (this.pagedImagesReduction.canReduce(actionPayload)) {\r\n            newState.providerImageSearchResults = cloneDeep(newState.providerImageSearchResults);\r\n            newState.providerImageSearchResults[newState.currentSelectedProvider].pagedImagesState =\r\n                this.pagedImagesReduction.reduce(newState.providerImageSearchResults[newState.currentSelectedProvider].pagedImagesState, actionPayload);\r\n        }\r\n\r\n        if (this.imageCommandReduction.canReduce(actionPayload)) {\r\n            newState.providerImageDownloads[newState.currentSelectedProvider] =\r\n                this.imageCommandReduction.reduce(newState.providerImageDownloads[newState.currentSelectedProvider], actionPayload);\r\n        }\r\n\r\n        return newState;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { CreativeImageSort } from \"clientcore-catalyst-businesslogic/creativeSearch/CreativeImageSort\";\r\n\r\nimport { ICreativeSortOrderOptionItem } from \"../../models/sortOrder/ICreativeSortOrderOptionItem\";\r\n\r\nconst creativeSortOrderOptions: ICreativeSortOrderOptionItem[] = [\r\n    {\r\n        displayName: \"Best Match\",\r\n        value: CreativeImageSort.bestMatch\r\n\r\n    },\r\n    {\r\n        displayName: \"Newest First\",\r\n        value: CreativeImageSort.newest\r\n    },\r\n    {\r\n        displayName: \"Most Popular\",\r\n        value: CreativeImageSort.popular\r\n    }\r\n];\r\n\r\nexport { creativeSortOrderOptions as CreativeSortOrderOptions };","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { AppConstants } from \"../../AppConstants\";\r\nimport { ICatalystFileDataMetadata } from \"clientcore-models-catalyst/ICatalystFileDataMetadata\";\r\nimport { ICreativeImage } from \"clientcore-catalyst-businesslogic/creativeSearch/ICreativeImage\";\r\nimport { IImageFileData } from \"cms-models/IImageFileData\";\r\nimport { IInstrumentationClient } from \"../../instrumentation/instrumentationClient/IInstrumentationClient\";\r\nimport { isNil } from \"lodash-es\";\r\n\r\n// A dictionary of items which have undefined width or height and which we have already logged\r\nlet problemImageEntities: { [key: string]: boolean } = {};\r\n\r\n/**\r\n * Method signature for a helper method to get image dimensions for an IImageFileData.\r\n * @param imageFileData { IImageFileData<ICatalystFileDataMetadata> } The image entity.\r\n * @param instrumentationClient { IInstrumentationClient } The instrumentation client (Optional)\r\n * @type\r\n */\r\nexport type GetDimensionsHelperSignature = (\r\n    imageFileData: IImageFileData<ICatalystFileDataMetadata>,\r\n    instrumentationClient?: IInstrumentationClient) => { width: number, height: number };\r\n\r\n/**\r\n * Method signature for a helper method to get image dimensions for an ICreativeImage.\r\n * @param creativeImage { ICreativeImage } The creative image.\r\n * @param instrumentationClient { IInstrumentationClient } The instrumentation client (Optional)\r\n * @type\r\n */\r\nexport type GetCreativeImageDimensionsHelperSignature = (\r\n    creativeImage: ICreativeImage,\r\n    instrumentationClient?: IInstrumentationClient) => { width: number, height: number };\r\n\r\n/**\r\n * Implementation of above method signature.\r\n * First try width and height at the root of the entity, then in downloads[0] (with appropriate scaling) and finally fallback to the thumbnailConfig width and height\r\n * @method\r\n * @param imageFileData { IImageFileData<ICatalystFileDataMetadata> } The image entity.\r\n * @param instrumentationClient { IInstrumentationClient } Instrumentation client (Optional)\r\n * @returns { width: number, height: number } The dimensions\r\n */\r\nconst getDimensionsHelper: GetDimensionsHelperSignature = function(\r\n    imageFileData: IImageFileData<ICatalystFileDataMetadata>,\r\n    instrumentationClient?: IInstrumentationClient): { width: number, height: number } {\r\n\r\n    // Helper method to check that a dimension value is valid\r\n    const isValidDimension = function(dimension: number): boolean {\r\n        return (!isNil(dimension) && dimension > 0);\r\n    };\r\n\r\n    let { width, height } = imageFileData;\r\n    if (!isValidDimension(width) || !isValidDimension(height)) {\r\n        if (!isNil(imageFileData.fileMetadata) &&\r\n            !isNil(imageFileData.fileMetadata.downloads) &&\r\n            (imageFileData.fileMetadata.downloads.length > 0) &&\r\n            isValidDimension(imageFileData.fileMetadata.downloads[0].width) &&\r\n            isValidDimension(imageFileData.fileMetadata.downloads[0].height)) {\r\n\r\n            // Calculate width and height based on the width and height of the first download, scaled to the ideal height we want to display images at\r\n            width = Math.floor(imageFileData.fileMetadata.downloads[0].width * (AppConstants.thumbnailConfig.height / imageFileData.fileMetadata.downloads[0].height));\r\n            height = AppConstants.thumbnailConfig.height;\r\n        } else {\r\n            // If we don't get width or height, then just use the thumbnail width and height even though this may result in a deformed image.\r\n            width = AppConstants.thumbnailConfig.width;\r\n            height = AppConstants.thumbnailConfig.height;\r\n        }\r\n\r\n        // Only log problem items once, otherwise we will generate a lot of duplicate log messages\r\n        if (!(imageFileData._id in problemImageEntities) && !!instrumentationClient) {\r\n            problemImageEntities[imageFileData._id] = true;\r\n            instrumentationClient.LoggingService.error(\"Image document in CMS has undefined image or height, check if ingestion and image processing pipeline is working correctly\", null, imageFileData._id, instrumentationClient.RootActivityCorrelationVector);\r\n        }\r\n    }\r\n\r\n    return { width, height };\r\n};\r\n\r\n/**\r\n * Implementation of above method signature.\r\n * First try width and height at the root of the entity, then in maxDimension node (with appropriate scaling) and finally fallback to the thumbnailConfig width and height\r\n * @method\r\n * @param creativeImage { ICreativeImage } The creative image.\r\n * @returns { width: number, height: number } The dimensions\r\n */\r\nconst getCreativeImageDimensionsHelper: GetCreativeImageDimensionsHelperSignature = function (\r\n    creativeImage: ICreativeImage): { width: number, height: number } {\r\n\r\n    // Helper method to check that a dimension value is valid\r\n    const isValidDimension = function (dimension: number): boolean {\r\n        return (!isNil(dimension) && dimension > 0);\r\n    };\r\n\r\n    let { width, height } = creativeImage.previewImageSize ? creativeImage.previewImageSize : { width: undefined, height: undefined };\r\n    if (!isValidDimension(width) || !isValidDimension(height)) {\r\n        if (!isNil(creativeImage.maxImageSize) &&\r\n            isValidDimension(creativeImage.maxImageSize.width) &&\r\n            isValidDimension(creativeImage.maxImageSize.height)) {\r\n\r\n            // Calculate width and height based on the width and height of the first download, scaled to the ideal height we want to display images at\r\n            width = Math.floor(creativeImage.maxImageSize.width * (AppConstants.thumbnailConfig.height / creativeImage.maxImageSize.height));\r\n            height = AppConstants.thumbnailConfig.height;\r\n        } else {\r\n            // If we don't get width or height, then just use the thumbnail width and height even though this may result in a deformed image.\r\n            width = AppConstants.thumbnailConfig.width;\r\n            height = AppConstants.thumbnailConfig.height;\r\n        }\r\n    }\r\n\r\n    return { width, height };\r\n};\r\n\r\nexport { getDimensionsHelper as GetDimensionsHelper, getCreativeImageDimensionsHelper as GetCreativeImageDimensionsHelper };","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { CreativeProvider } from \"clientcore-catalyst-businesslogic/creativeSearch/CreativeProvider\";\r\nimport { IActivityLogItem } from \"clientcore-infrastructure-analytics/models/IActivityLogItem\";\r\nimport { ICatalystFileDataMetadata } from \"clientcore-models-catalyst/ICatalystFileDataMetadata\";\r\nimport { IErrorResponse } from \"clientcore-catalyst-businesslogic/IErrorResponse\";\r\nimport { IImageAcquisitionManager } from \"clientcore-catalyst-businesslogic/IImageAcquisitionManager\";\r\nimport { IImageCommandActionCreator } from \"./IImageCommandActionCreator\";\r\nimport { IImageDownloadInfo } from \"clientcore-catalyst-businesslogic/IImageDownloadInfo\";\r\nimport { IImageFileData } from \"cms-models/IImageFileData\";\r\nimport { IStore } from \"redux\";\r\nimport { ImageCommandActions } from \"./ImageCommandActions\";\r\nimport { NotificationListActions } from \"cms-ui-presentationlogic/dataflows/notifications/NotificationListActions\";\r\nimport { NotificationType } from \"cms-ui-presentationlogic/dataflows/notifications/NotificationType\";\r\n\r\n/**\r\n * Contains action creators for image commands.\r\n * @class\r\n */\r\nexport class ImageCommandActionCreator implements IImageCommandActionCreator {\r\n\r\n    /**\r\n     * Initializes a new instance of the `ImageCommandActionCreator` class.\r\n     * @param imageAcquisitionManager {IImageAcquisitionManager} The manager for getting the image.\r\n     * @param store {IStore<any>} The store to dispatch actions to.\r\n     * @param imageCommandActions {ImageCommandActions} The command Actions.\r\n     */\r\n    constructor(\r\n        private imageAcquisitionManager: IImageAcquisitionManager,\r\n        private store: IStore<any>,\r\n        private imageCommandActions: ImageCommandActions,\r\n        private notificationListActions: NotificationListActions = new NotificationListActions()) {\r\n\r\n        if (!imageAcquisitionManager) {\r\n            throw \"The imageAcquisitionManager parameter is required.\";\r\n        }\r\n\r\n        if (!store) {\r\n            throw \"The store parameter is required.\";\r\n        }\r\n\r\n        if (!imageCommandActions) {\r\n            throw \"The ImageCommandActions parameter is required.\";\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Download full binary for the given image.\r\n     * @param image {IImageFileData<ICatalystFileDataMetadata>} image to download.\r\n     * @param parentActivity {IActivityLogItem} Optional parent activity\r\n     * @returns {Promise<IImageDownloadInfo>} Promise for the result of the operation.\r\n     */\r\n    public downloadImage(image: IImageFileData<ICatalystFileDataMetadata>, parentActivity?: IActivityLogItem, progressEvent?: (progressEvent: ProgressEvent) => void, downloadImageName?: string): Promise<IImageDownloadInfo> {\r\n\r\n        this.imageCommandActions.DownloadingImage.getActionSender(this.store)(image._id);\r\n        let promise = this.imageAcquisitionManager.downloadImage(image, parentActivity, progressEvent, downloadImageName);\r\n\r\n        promise.then((_imageDownloadInfo) => {\r\n            this.imageCommandActions.DownloadedImage.getActionSender(this.store)(image._id);\r\n        }).catch((error) => {\r\n            let errorResponse: IErrorResponse = <any>error;\r\n            this.imageCommandActions.DownloadImageFailed.getActionSender(this.store)(image._id, errorResponse);\r\n            this.createFailureNotificationActionForActionResponse(image._name, image._id, errorResponse);\r\n        });\r\n\r\n        return promise;\r\n    }\r\n\r\n    /**\r\n     * Download creative image from provider.\r\n     * @param creativeImageId {string} id of the image to download.\r\n     * @param creativeProvider {CreativeProvider} provider of the image to download.\r\n     * @param parentActivity {IActivityLogItem} Optional parent activity\r\n     * @returns {Promise<IImageDownloadInfo>} Promise for the result of the operation.\r\n     */\r\n    public downloadCreativeImage(creativeImageId: string, creativeProvider: CreativeProvider, parentActivity?: IActivityLogItem): Promise<IImageDownloadInfo> {\r\n\r\n        this.imageCommandActions.DownloadingImage.getActionSender(this.store)(creativeImageId);\r\n        let promise = this.imageAcquisitionManager.downloadCreativeImage(creativeProvider, creativeImageId, parentActivity);\r\n\r\n        promise.then((_imageDownloadInfo) => {\r\n            this.imageCommandActions.DownloadedImage.getActionSender(this.store)(creativeImageId);\r\n        }).catch((error) => {\r\n            let errorResponse: IErrorResponse = <any>error;\r\n            this.imageCommandActions.DownloadImageFailed.getActionSender(this.store)(creativeImageId, errorResponse);\r\n            this.createFailureNotificationActionForActionResponse(creativeImageId, creativeImageId, errorResponse);\r\n        });\r\n\r\n        return promise;\r\n    }\r\n\r\n    /**\r\n     * Clears the last download error message\r\n     * @method\r\n     */\r\n    public clearLastDownloadError(): void {\r\n        this.imageCommandActions.ClearLastDownloadErrorMessage.getActionSender(this.store)();\r\n    }\r\n\r\n    /**\r\n     * Creates an AddNotification action for the given operation name and action response.\r\n     * @param name {string} The image name.\r\n     * @param id {string} The image id.\r\n     * @param errorResponse {IErrorResponse} The error response.\r\n     */\r\n    private createFailureNotificationActionForActionResponse(name: string, _id: string, errorResponse: IErrorResponse): void {\r\n        let notificationTitle = `Failed to download image ${name}.`;\r\n        let notificationMessage = `Failed to download ${name} with error ${errorResponse.errorMessage}.`;\r\n        this.notificationListActions.AddNotification.getActionSender(this.store)(NotificationType.Error, notificationTitle, notificationMessage);\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { ActionMap } from \"cms-ui-redux/ActionMap\";\r\nimport { IErrorResponse } from \"clientcore-catalyst-businesslogic/IErrorResponse\";\r\nimport { NamespacePrefixActionsDefinitionBase } from \"cms-ui-redux/NamespacePrefixActionsDefinitionBase\";\r\n\r\nexport type DownloadingImageSignature = (imageId: string) => void;\r\nexport type DownloadedImageSignature = (imageId: string) => void;\r\nexport type ImageOperationFailedSignature = (imageId: string, errorResponse: IErrorResponse) => void;\r\nexport type ClearStatusSignature = () => void;\r\nexport type ImageIngestionInProgressSignature = (imageId: string) => void;\r\nexport type ImageIngestionCompletedSignature = (providerImageId: string, cmsId: string) => void;\r\nexport type AddImageIdsToCollectionSignature = (imageIds: string[]) => void;\r\nexport type RemoveImageIdsFromCollectionSignature = (imageIds: string[]) => void;\r\n\r\n/**\r\n * Exposes image command actions.\r\n * @class\r\n */\r\nexport class ImageCommandActions extends NamespacePrefixActionsDefinitionBase {\r\n\r\n    /** Defines the action indicating that an image is being downloaded.\r\n     */\r\n    private downloadingImage: ActionMap<DownloadingImageSignature> = new ActionMap<DownloadingImageSignature>(this.namespace + \"DownloadingImage\");\r\n\r\n    /** Defines the action indicating that an image has been downloaded.\r\n     */\r\n    private downloadedImage: ActionMap<DownloadedImageSignature> = new ActionMap<DownloadedImageSignature>(this.namespace + \"DownloadedImage\");\r\n\r\n    /** Defines the action indicating that an image download has failed.\r\n     */\r\n    private downloadImageFailed: ActionMap<ImageOperationFailedSignature> = new ActionMap<ImageOperationFailedSignature>(this.namespace + \"DownloadImageFailed\");\r\n\r\n    /** Clears the last download error message\r\n     */\r\n    private clearLastDownloadErrorMessage: ActionMap<ClearStatusSignature> = new ActionMap<ClearStatusSignature>(this.namespace + \"ClearLastDownloadErrorMessage\");\r\n\r\n    /** Defines action indicating that the image ingestion is in progress\r\n     */\r\n    private imageIngestionInProgress: ActionMap<ImageIngestionInProgressSignature> = new ActionMap<ImageIngestionInProgressSignature>(this.namespace + \"ImageIngestionInProgress\");\r\n\r\n    /** Defines action indicating that the image ingestion is in progress\r\n     */\r\n    private imageIngestionCompleted: ActionMap<ImageIngestionCompletedSignature> = new ActionMap<ImageIngestionCompletedSignature>(this.namespace + \"ImageIngestionCompleted\");\r\n\r\n    /** Defines the action indicating that an image ingestion has failed.\r\n     */\r\n    private imageIngestionFailed: ActionMap<ImageOperationFailedSignature> = new ActionMap<ImageOperationFailedSignature>(this.namespace + \"ImageIngestionFailed\");\r\n\r\n    /** Defines the action indicating that an image update has failed by Ingestion.\r\n     */\r\n    private imageUpdateByIngestionFailed: ActionMap<AddImageIdsToCollectionSignature> = new ActionMap<AddImageIdsToCollectionSignature>(this.namespace + \"ImageUpdateByIngestionFailedSignature\");\r\n\r\n    /** Defines the action indicating that an image update is in progress.\r\n     */\r\n    private addImageStatusUpdateInProgress: ActionMap<AddImageIdsToCollectionSignature> = new ActionMap<AddImageIdsToCollectionSignature>(this.namespace + \"ImageStatusRefreshInProgressSignature\");\r\n\r\n    /** Defines the action indicating that an image update is in progress.\r\n     */\r\n    private removeCompletedImageStatusUpdate: ActionMap<RemoveImageIdsFromCollectionSignature> = new ActionMap<RemoveImageIdsFromCollectionSignature>(this.namespace + \"CompleteImageStatusRefreshSignature\");\r\n\r\n    /** Defines the action to remove the image id from failed images collection.\r\n     */\r\n    private removeFailedImageUpdateByIngestion: ActionMap<RemoveImageIdsFromCollectionSignature> = new ActionMap<RemoveImageIdsFromCollectionSignature>(this.namespace + \"RemoveFailedImageUpdateByIngestionSignature\");\r\n\r\n    /** Defines the action to clear the state related to image preview link generation\r\n     */\r\n    private imagePreviewLinkGenerationStatusReset: ActionMap<ClearStatusSignature> = new ActionMap<ClearStatusSignature>(this.namespace + \"ClearImagePreviewLinkGenerationStatus\");\r\n\r\n    /**\r\n     * Initializes a new instance of the `DownloadImageActions` class.\r\n     * @constructor\r\n     * @param namespacePrefix {string} Optional prefix to add to the namespace used to distinguish between different instances of this data flow.\r\n     */\r\n    constructor(namespacePrefix?: string) {\r\n        super(\"DownloadImageActions\", namespacePrefix);\r\n    }\r\n\r\n    /** Get accessor for DownloadingImage action map\r\n     * @type {ActionMap<DownloadingImageSignature>}\r\n     */\r\n    public get DownloadingImage(): ActionMap<DownloadingImageSignature> {\r\n        return this.downloadingImage;\r\n    }\r\n\r\n    /** Get accessor for DownloadedImage action map\r\n     * @type {ActionMap<ImageOperationCompletedSignature>}\r\n     */\r\n    public get DownloadedImage(): ActionMap<DownloadedImageSignature> {\r\n        return this.downloadedImage;\r\n    }\r\n\r\n    /** Get accessor for DownloadImageFailed action map\r\n     * @type {ActionMap<ImageOperationFailedSignature>}\r\n     */\r\n    public get DownloadImageFailed(): ActionMap<ImageOperationFailedSignature> {\r\n        return this.downloadImageFailed;\r\n    }\r\n\r\n    /** Get accessor for ClearLastDownloadErrorMessage action map\r\n     */\r\n    public get ClearLastDownloadErrorMessage(): ActionMap<ClearStatusSignature> {\r\n        return this.clearLastDownloadErrorMessage;\r\n    }\r\n\r\n    /**\r\n     * Get accessor for Image Link creation is in progress action map\r\n     */\r\n    public get ImageIngestionInProgress(): ActionMap<ImageIngestionInProgressSignature> {\r\n        return this.imageIngestionInProgress;\r\n    }\r\n\r\n    /**\r\n     * Get accessor for Image status refresh action map\r\n     */\r\n    public get AddImageStatusUpdateInProgress(): ActionMap<AddImageIdsToCollectionSignature> {\r\n        return this.addImageStatusUpdateInProgress;\r\n    }\r\n\r\n    /**\r\n     * Get accessor for removing Image status refresh collection action map\r\n     */\r\n    public get RemoveCompletedImageStatusUpdate(): ActionMap<RemoveImageIdsFromCollectionSignature> {\r\n        return this.removeCompletedImageStatusUpdate;\r\n    }\r\n\r\n    /**\r\n     * Get accessor for Image Link creation is in progress action map\r\n     */\r\n    public get ImageIngestionFailed(): ActionMap<ImageOperationFailedSignature> {\r\n        return this.imageIngestionFailed;\r\n    }\r\n\r\n    /**\r\n     * Get accessor for Image ingestion completed action map\r\n     */\r\n    public get ImageIngestionCompleted(): ActionMap<ImageIngestionCompletedSignature> {\r\n        return this.imageIngestionCompleted;\r\n    }\r\n\r\n    /**\r\n     * Get accessor for Image Link creation status reset action map\r\n     */\r\n    public get ImagePreviewLinkGenerationStatusReset(): ActionMap<ClearStatusSignature> {\r\n        return this.imagePreviewLinkGenerationStatusReset;\r\n    }\r\n\r\n    /**\r\n     * Get accessor for Ingestion Image update fail action map\r\n     */\r\n    public get ImageUpdateByIngestionFailed(): ActionMap<AddImageIdsToCollectionSignature> {\r\n        return this.imageUpdateByIngestionFailed;\r\n    }\r\n\r\n    /**\r\n     * Get accessor for removing the image from failed collection\r\n     */\r\n    public get RemoveFailedImageUpdateByIngestion(): ActionMap<RemoveImageIdsFromCollectionSignature> {\r\n        return this.removeFailedImageUpdateByIngestion;\r\n    }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { cloneDeep, pull, uniq } from \"lodash-es\";\r\n\r\nimport { ActionHandler } from \"cms-ui-redux/ActionHandler\";\r\nimport { IActionPayload } from \"cms-ui-redux/IActionPayload\";\r\nimport { IErrorResponse } from \"clientcore-catalyst-businesslogic/IErrorResponse\";\r\nimport { IImageCommandState } from \"./IImageCommandState\";\r\nimport { ImageCommandActions } from \"./ImageCommandActions\";\r\nimport { NamespaceCheckReducerBase } from \"cms-ui-redux/NamespaceCheckReducerBase\";\r\n\r\n/**\r\n * Reducer for IImageCommandState.\r\n * @class\r\n */\r\nexport class ImageCommandReduction extends NamespaceCheckReducerBase<IImageCommandState> {\r\n\r\n    /**\r\n     * Initializes a new instance of the `ImageCommandReduction` class.\r\n     * @param imageCommandActions {ImageCommandActions} Actions to handle\r\n     * @constructor\r\n     */\r\n    constructor(public imageCommandActions: ImageCommandActions) {\r\n        super([imageCommandActions.namespace], []);\r\n    }\r\n\r\n    /**\r\n     * @method\r\n     * @param state {IImageCommandState} The state to reduce\r\n     * @param actionPayload {IActionPayload} The payload to apply\r\n     * @returns {IImageCommandState} The new state.\r\n     */\r\n    public reduce(state: IImageCommandState, actionPayload: IActionPayload): IImageCommandState {\r\n        if (!state) {\r\n            throw \"The state parameter is required.\";\r\n        }\r\n\r\n        if (!actionPayload) {\r\n            throw \"The actionPayload parameter is required.\";\r\n        }\r\n\r\n        let newState = cloneDeep(state);\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.imageCommandActions.DownloadingImage, (imageId: string) => {\r\n                newState.imagesDownloading.push(imageId);\r\n                pull(newState.failedImages, imageId);\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.imageCommandActions.DownloadedImage, (imageId: string) => {\r\n                pull(newState.imagesDownloading, imageId);\r\n                newState.lastDownloadError = \"\";\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.imageCommandActions.DownloadImageFailed, (imageId: string, errorResponse: IErrorResponse) => {\r\n                pull(newState.imagesDownloading, imageId);\r\n                newState.failedImages.push(imageId);\r\n                newState.lastDownloadError = !!errorResponse.errorMessage ? errorResponse.errorMessage : \"\";\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.imageCommandActions.ClearLastDownloadErrorMessage, () => {\r\n                newState.lastDownloadError = \"\";\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.imageCommandActions.ImageIngestionInProgress, (imageId: string) => {\r\n                newState.creativeImageIngestionState = {\r\n                    ...newState.creativeImageIngestionState,\r\n                    creativeImageIngestionError: false,\r\n                    cmsIdForCreativeImage: null,\r\n                    beingIngestedImageIds: uniq(newState.creativeImageIngestionState.beingIngestedImageIds.concat(imageId))\r\n                };\r\n\r\n                return newState;\r\n            }\r\n        );\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.imageCommandActions.ImageIngestionFailed, (imageId: string, errorResponse: IErrorResponse) => {\r\n\r\n                newState.creativeImageIngestionState = {\r\n                    ...newState.creativeImageIngestionState,\r\n                    creativeImageIngestionError: true,\r\n                    creativeImageIngestionErrorMessage: (!!errorResponse && !!errorResponse.errorMessage) ? errorResponse.errorMessage : \"\",\r\n                    cmsIdForCreativeImage: null,\r\n                    beingIngestedImageIds: newState.creativeImageIngestionState.beingIngestedImageIds.filter(imgId => imgId !== imageId)\r\n                };\r\n\r\n                return newState;\r\n            }\r\n        );\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.imageCommandActions.ImageUpdateByIngestionFailed, (imageIds: string[]) => {\r\n                newState.creativeImageIngestionState = {\r\n                    ...newState.creativeImageIngestionState,\r\n                    failedToUpdateImages: uniq(newState.creativeImageIngestionState.failedToUpdateImages.concat(imageIds))\r\n                };\r\n\r\n                return newState;\r\n            }\r\n        );\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.imageCommandActions.AddImageStatusUpdateInProgress, (imageIds: string[]) => {\r\n                newState.creativeImageIngestionState = {\r\n                    ...newState.creativeImageIngestionState,\r\n                    imageUpdateInProgress: uniq(newState.creativeImageIngestionState.imageUpdateInProgress.concat(imageIds))\r\n                };\r\n\r\n                return newState;\r\n            }\r\n        );\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.imageCommandActions.RemoveCompletedImageStatusUpdate, (imageIds: string[]) => {\r\n                newState.creativeImageIngestionState = {\r\n                    ...newState.creativeImageIngestionState,\r\n                    imageUpdateInProgress: newState.creativeImageIngestionState.imageUpdateInProgress.filter(imageId => imageIds.indexOf(imageId) < 0)\r\n                };\r\n\r\n                return newState;\r\n            }\r\n        );\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.imageCommandActions.RemoveFailedImageUpdateByIngestion, (imageIds: string[]) => {\r\n                newState.creativeImageIngestionState = {\r\n                    ...newState.creativeImageIngestionState,\r\n                    failedToUpdateImages: newState.creativeImageIngestionState.failedToUpdateImages.filter(imageId => imageIds.indexOf(imageId) < 0)\r\n                };\r\n\r\n                return newState;\r\n            }\r\n        );\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.imageCommandActions.ImageIngestionCompleted, (providerImageId: string, cmsId: string) => {\r\n                newState.creativeImageIngestionState = {\r\n                    ...newState.creativeImageIngestionState,\r\n                    creativeImageIngestionError: false,\r\n                    creativeImageIngestionErrorMessage: null,\r\n                    cmsIdForCreativeImage: cmsId,\r\n                    beingIngestedImageIds: newState.creativeImageIngestionState.beingIngestedImageIds.filter(imageId => imageId !== providerImageId)\r\n                };\r\n\r\n                return newState;\r\n            }\r\n        );\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.imageCommandActions.ImagePreviewLinkGenerationStatusReset, () => {\r\n                newState.creativeImageIngestionState = {\r\n                    ...newState.creativeImageIngestionState,\r\n                    creativeImageIngestionError: undefined,\r\n                    creativeImageIngestionErrorMessage: null,\r\n                    cmsIdForCreativeImage: null\r\n                };\r\n\r\n                return newState;\r\n            }\r\n        );\r\n\r\n        return newState;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { ICreativeImage } from \"clientcore-catalyst-businesslogic/creativeSearch/ICreativeImage\";\r\n\r\nimport { ActionMap } from \"cms-ui-redux/ActionMap\";\r\nimport { NamespacePrefixActionsDefinitionBase } from \"cms-ui-redux/NamespacePrefixActionsDefinitionBase\";\r\n\r\nexport type ImagePreviewModalFetchEndSignature = (index: number) => void;\r\nexport type CreativeImagePreviewModalFetchEndSignature = (creativeImage: ICreativeImage, index: number) => void;\r\n\r\n/**\r\n * Image preview modal actions\r\n * @class\r\n */\r\nexport class ImagePreviewModalActions extends NamespacePrefixActionsDefinitionBase {\r\n    private imagePreviewModalFetchEnd: ActionMap<ImagePreviewModalFetchEndSignature> = new ActionMap<ImagePreviewModalFetchEndSignature>(this.namespace + \"ImagePreviewModalFetchEndSignature\");\r\n    private creativeImagePreviewModalFetchEndSignature: ActionMap<CreativeImagePreviewModalFetchEndSignature> = new ActionMap<CreativeImagePreviewModalFetchEndSignature>(this.namespace + \"CreativeImagePreviewModalFetchEndSignature\");\r\n\r\n    /**\r\n     * @constructor\r\n     * @param namespacePrefix {string}\r\n     */\r\n    constructor(namespacePrefix?: string) {\r\n        super(\"ImagePreviewModalActions\", namespacePrefix);\r\n    }\r\n\r\n    /**\r\n     * Fetch image entity finished\r\n     */\r\n    public get ImagePreviewModalFetchEnd(): ActionMap<ImagePreviewModalFetchEndSignature> {\r\n        return this.imagePreviewModalFetchEnd;\r\n    }\r\n\r\n    /**\r\n     * Fetch creative image is finished\r\n     */\r\n    public get CreativeImagePreviewModalFetchEnd(): ActionMap<CreativeImagePreviewModalFetchEndSignature> {\r\n        return this.creativeImagePreviewModalFetchEndSignature;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { ActionMap } from \"cms-ui-redux/ActionMap\";\r\nimport { NamespacePrefixActionsDefinitionBase } from \"cms-ui-redux/NamespacePrefixActionsDefinitionBase\";\r\n\r\nexport type ItemsChangedSignature<T> = (items: T[], selectedItems: T[]) => void;\r\nexport type SelectionChangedSignature<T> = (items: T[]) => void;\r\n\r\n/**\r\n * Exposes a redux action to raise a change to selection state.\r\n * @class\r\n */\r\nexport class ListItemSelectorActions<T> extends NamespacePrefixActionsDefinitionBase {\r\n\r\n    /** Defines the action indicating that the items in the list have changed.\r\n     */\r\n    private itemsChanged: ActionMap<ItemsChangedSignature<T>> = new ActionMap<ItemsChangedSignature<T>>(this.namespace + \"ItemsChanged\");\r\n\r\n    /** Defines the action indicating that the selection has changed.\r\n     */\r\n    private selectionChanged: ActionMap<SelectionChangedSignature<T>> = new ActionMap<SelectionChangedSignature<T>>(this.namespace + \"SelectionChanged\");\r\n\r\n    /**\r\n     * Initializes a new instance of the `ListItemSelectorActions` class.\r\n     * @constructor\r\n     * @param namespacePrefix {string} Optional prefix to add to the namespace used to distinguish between different instances of this data flow.\r\n     */\r\n    constructor(namespacePrefix?: string) {\r\n        super(\"ListItemSelectorActions\", namespacePrefix);\r\n    }\r\n\r\n    /** Accessor for the ItemsChanged action.\r\n     * @type {ActionMap<ItemsChangedSignature>}\r\n     */\r\n    public get ItemsChanged(): ActionMap<ItemsChangedSignature<T>> {\r\n        return this.itemsChanged;\r\n    }\r\n\r\n    /** Accessor for the SelectionChanged action.\r\n     * @type {ActionMap<SelectionChangedSignature>}\r\n     */\r\n    public get SelectionChanged(): ActionMap<SelectionChangedSignature<T>> {\r\n        return this.selectionChanged;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\nimport { Carousel, CarouselItemProps, Glyphicon, GlyphiconProps, Modal } from \"react-bootstrap\";\r\nimport { IModalCarouselProps } from \"./IModalCarouselProps\";\r\n\r\n/**\r\n * Component to render a modal overlay with carousel as its body.\r\n * @class\r\n */\r\nexport class ModalCarousel extends React.Component<IModalCarouselProps, {}> {\r\n\r\n    /** CSS class name for glyphicon chevron right. */\r\n    private static GlyhiconCssClassChevronRight: string = \"chevron-right\";\r\n\r\n    /** CSS class name for glyphicon chevron left. */\r\n    private static GlyhiconCssClassChevronLeft: string = \"chevron-left\";\r\n\r\n    /**\r\n     * Creates a new instance of the 'ModalCarousel' class.\r\n     * @constructor\r\n     * @params {IModalCarouselProps} props the props.\r\n     */\r\n    constructor(props: IModalCarouselProps) {\r\n        super(props);\r\n\r\n        if (!props) {\r\n            throw \"props parameter cannot be null or undefined\";\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Renders the ModalCarousel Component.\r\n     * @method\r\n     * @returns {React.ReactElement<IModalCarouselProps>} the ModalCarousel component.\r\n     */\r\n    public render(): React.ReactElement<IModalCarouselProps> {\r\n\r\n        const carouselItems = this.renderCarouselItems();\r\n\r\n        const nextIcon = this.renderNextIcon();\r\n\r\n        const previousIcon = this.renderPreviousIcon();\r\n\r\n        return (\r\n            <div className=\"modal-carousel-container\">\r\n                <Modal className={this.props.customClassName + \" modal-carousel-dialog\"} show={this.props.isVisible} onHide={() => this.props.onHide()} autoFocus={true} onKeyDown={(eventArgs) => this.props.onKeyPressed && this.props.onKeyPressed(eventArgs)}>\r\n                   <Modal.Body>\r\n                        <div className=\"carousel-container\">\r\n                            <Carousel\r\n                                activeIndex={this.props.activeIndex}\r\n                                indicators={this.props.showIndicators}\r\n                                nextIcon={nextIcon}\r\n                                prevIcon={previousIcon}\r\n                                onSelect={this.props.onSelect}>\r\n                                {carouselItems}\r\n                            </Carousel>\r\n                        </div>\r\n                    </Modal.Body>\r\n                </Modal>\r\n                {this.props.isVisible && <div className={this.props.customClassName + \" modal-close\"} onClick={() => this.props.onHide()}>\r\n                    <span>X</span>\r\n                </div>}\r\n            </div>\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Renders the navigation icon for carousel.\r\n     * @method\r\n     * @param {string} iconCssClass the icon css class name.\r\n     * @returns {React.ReactElement<GlyphiconProps>} the glyphicon component.\r\n     */\r\n    protected renderNavigationIcon(iconCssClass: string): React.ReactElement<GlyphiconProps> {\r\n        return <Glyphicon glyph={iconCssClass} />;\r\n    }\r\n\r\n    /**\r\n     * Renders the carousel items.\r\n     * @method\r\n     * @returns {React.ReactElement<CarouselItemProps>[]} array of carousel items.\r\n     */\r\n    private renderCarouselItems(): React.ReactElement<CarouselItemProps>[] {\r\n        let carouselItems: React.ReactElement<CarouselItemProps>[] = [];\r\n\r\n        React.Children.map(this.props.children, (child, index) => {\r\n            let carouselItem = <Carousel.Item key={index}>{child}</Carousel.Item>;\r\n            carouselItems.push(carouselItem);\r\n        });\r\n\r\n        return carouselItems;\r\n    }\r\n\r\n    /**\r\n     * Renders the glyphicon component for next navigation.\r\n     * @method\r\n     * @returns {React.ReactElement<GlyphiconProps>} the glyphicon component.\r\n     */\r\n    private renderNextIcon(): React.ReactElement<GlyphiconProps> {\r\n        return this.props.disableNextNavigation\r\n            ? null\r\n            : this.renderNavigationIcon(ModalCarousel.GlyhiconCssClassChevronRight);\r\n    }\r\n\r\n    /**\r\n     * Renders the glyphicon component for previous navigation.\r\n     * @method\r\n     * @returns {React.ReactElement<GlyphiconProps>} the glyphicon component.\r\n     */\r\n    private renderPreviousIcon(): React.ReactElement<GlyphiconProps> {\r\n        return this.props.disablePreviousNavigation\r\n            ? null\r\n            : this.renderNavigationIcon(ModalCarousel.GlyhiconCssClassChevronLeft);\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { ActionMap } from \"cms-ui-redux/ActionMap\";\r\nimport { NamespacePrefixActionsDefinitionBase } from \"cms-ui-redux/NamespacePrefixActionsDefinitionBase\";\r\n\r\nexport type UpdateAutosuggestionsSignature = (suggestions: string[]) => void;\r\nexport type SearchTextChangedSignature = (value: string) => void;\r\n\r\n/**\r\n * Exposes a redux action to raise reset filter.\r\n * @class\r\n */\r\nexport class SearchWithAutosuggestActions extends NamespacePrefixActionsDefinitionBase {\r\n\r\n    /** Defines the action indicating that the auto suggestion is updated.\r\n     */\r\n    private updateAutosuggest: ActionMap<UpdateAutosuggestionsSignature> = new ActionMap<UpdateAutosuggestionsSignature>(this.namespace + \"UpdateAutosuggestions\");\r\n\r\n    /** Defines the action indicating that the auto suggestion text box is changed.\r\n     */\r\n    private searchTextChanged: ActionMap<SearchTextChangedSignature> = new ActionMap<SearchTextChangedSignature>(this.namespace + \"SearchTextChanged\");\r\n\r\n    /** Defines the action indicating that the catalyst suggestion is updated.\r\n     */\r\n    private updateCatalystSuggestion: ActionMap<UpdateAutosuggestionsSignature> = new ActionMap<UpdateAutosuggestionsSignature>(this.namespace + \"catalystSuggestionSelected\");\r\n\r\n    /**\r\n     * Initializes a new instance of the 'SearchAndSelectActions' class.\r\n     * @constructor\r\n     * @param namespacePrefix {string} Optional prefix to add to the namespace used to distinguish between different instances of this data flow.\r\n     */\r\n    constructor(namespacePrefix?: string) {\r\n        super(\"SearchWithAutosuggest\", namespacePrefix);\r\n    }\r\n\r\n    /** Update the autosuggest suggestions contents\r\n     * @method\r\n     */\r\n    public get UpdateAutosuggestions(): ActionMap<UpdateAutosuggestionsSignature> {\r\n        return this.updateAutosuggest;\r\n    }\r\n\r\n    /** Update the autosuggest search box value\r\n     * @method\r\n     */\r\n    public get SearchTextChanged(): ActionMap<SearchTextChangedSignature> {\r\n        return this.searchTextChanged;\r\n    }\r\n\r\n    /** Action to set that catalyst suggestion was picked\r\n     * @method\r\n     */\r\n    public get UpdateCatalystSuggestion(): ActionMap<UpdateAutosuggestionsSignature> {\r\n        return this.updateCatalystSuggestion;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { ICellRenderInformation } from \"cms-ui-components/pagedVirtualCollection/ICellRenderInformation\";\r\nimport { IWidthAndHeight } from \"cms-ui-components/pagedVirtualCollection/IWidthAndHeight\";\r\nimport { HeightBasedMosaicLayoutCalculator } from \"cms-ui-components/pagedVirtualCollection/CalculateCellRenderInformation\";\r\n\r\nimport { IImageTileProps } from \"../../rendering/components/imageTile/IImageTileProps\";\r\n\r\nimport { AppConstants } from \"../../AppConstants\";\r\n\r\n/**\r\n * Returns a memoized version of `calculateCellRenderInformation`.\r\n * @method\r\n * @returns {(tiles: IImageTileProps[], startIndex: number, itemCount: number, canvasWidth: number) => ICellRenderInformation[]} A memoized version of `calculateCellRenderInformation`.\r\n */\r\nexport function memoizedCalculateCellRenderInformation(): (tiles: IImageTileProps[], startIndex: number, itemCount: number, canvasWidth: number) => ICellRenderInformation[] {\r\n\r\n    const cache = {};\r\n\r\n    return function calculateMosaicRenderInformation(tiles: IImageTileProps[], startIndex: number, itemCount: number, canvasWidth: number): ICellRenderInformation[] {\r\n\r\n        // the key is computed as the concatenation of the entity ids plus the string representation of the remaining number parameters.\r\n        const key = tiles.reduce((prev, current) => { return prev + current.id; }, \"\") + startIndex.toString() + itemCount.toString() + canvasWidth.toString();\r\n\r\n        if (!cache[key]) {\r\n            cache[key] = calculateCellRenderInformation(tiles, startIndex, itemCount, canvasWidth);\r\n        }\r\n        return cache[key];\r\n    };\r\n}\r\n\r\n/**\r\n * Helper method to calculate the size and position information for each tile based on the canvas width\r\n * @method\r\n * @param tiles {IImageTileProps[]} The set of tiles\r\n * @param startIndex {number} The index into the above array of the tiles for which we want to calculate size and position information\r\n * @param itemCount {number} The number of tiles from the startIndex for which we want to calculate size and position information\r\n * @param canvasWidth {number} The canvas width\r\n * @returns  {ICellRenderInformation[]} The size and position information for each tile in the range.\r\n */\r\nfunction calculateCellRenderInformation(tiles: IImageTileProps[], startIndex: number, itemCount: number, canvasWidth: number): ICellRenderInformation[] {\r\n\r\n    // Allow 30px for the browser scrollbar\r\n    const widthForScrollbar = 30;\r\n    const items: IWidthAndHeight[] = tiles.slice(startIndex, startIndex + itemCount).map(tile => {\r\n        return {\r\n            width: tile.imgWidth,\r\n            height: tile.imgHeight\r\n        };\r\n    });\r\n\r\n    return HeightBasedMosaicLayoutCalculator(items, AppConstants.thumbnailConfig.totalMargin, canvasWidth - widthForScrollbar, AppConstants.thumbnailConfig.height);\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\n// External\r\n\r\nimport * as React from \"react\";\r\n\r\nimport { AreaOfPage, PageNames } from \"../../instrumentation/instrumentationConstants/InstrumentationConstants\";\r\nimport { CreateCreativeFilterData, ICreativeFilterData } from \"./CreativeFilterRules\";\r\nimport { DetermineModalLayout, InitializeModalCarouselProps } from \"../search/modalNavigation/ModalNavigationHelper\";\r\nimport { buildMultiSelectOptionsList, buildSingleSelectOptionsList } from \"./FilterControlBuilder\";\r\n\r\nimport { ActionDispatchCancellationToken } from \"cms-ui-redux/ActionDispatchCancellationToken\";\r\nimport { Actions } from \"../../globals/actions\";\r\nimport { AppConstants } from \"../../AppConstants\";\r\nimport { AssetFamily } from \"clientcore-models-catalyst/AssetFamily\";\r\nimport { CarouselDirection } from \"../../rendering/components/modalCarousel/CarouselDirection\";\r\nimport { CatalystSearchReduction } from \"../../presentation-logic/dataflows/catalystSearch/CatalystSearchReduction\";\r\nimport { CollapsibleActions } from \"cms-ui-presentationlogic/dataflows/collapsible/CollapsibleActions\";\r\nimport { ComponentBootstrapper } from \"cms-ui-views/ComponentBootstrapper\";\r\nimport { CreativeImageLicenseType } from \"clientcore-catalyst-businesslogic/creativeSearch/CreativeImageLicenseType\";\r\nimport { CreativeImageSort } from \"clientcore-catalyst-businesslogic/creativeSearch/CreativeImageSort\";\r\nimport { CreativeImageStyle } from \"clientcore-catalyst-businesslogic/creativeSearch/CreativeImageStyle\";\r\nimport { CreativeProvider } from \"clientcore-catalyst-businesslogic/creativeSearch/CreativeProvider\";\r\nimport { CreativeSearchActionCreator } from \"../../presentation-logic/dataflows/creativeSearch/CreativeSearchActionCreator\";\r\nimport { CreativeSearchActions } from \"../../presentation-logic/dataflows/creativeSearch/CreativeSearchActions\";\r\nimport { CreativeSearchBootstrapper } from \"../search/CreativeSearchBootstrapper\";\r\nimport { CreativeSearchQueryBuilder } from \"clientcore-catalyst-businesslogic/creativeSearch/CreativeSearchQueryBuilder\";\r\nimport { CreativeSearchReduction } from \"../../presentation-logic/dataflows/creativeSearch/CreativeSearchReduction\";\r\nimport { CreativeSortOrderOptions } from \"./CreativeSortOrderOptions\";\r\nimport { EntitySearchActions } from \"cms-ui-presentationlogic/dataflows/entitySearch/EntitySearchActions\";\r\nimport { FilterRuleSelectionMode } from \"../../models/filterRules/FilterRuleSelectionMode\";\r\nimport { GetCreativeImageDimensionsHelper } from \"../searchAndSelect/GetDimensionsHelper\";\r\nimport { GettyCreativeImageSelect } from \"clientcore-catalyst-businesslogic/creativeSearch/provider/GettyCreativeImageSelect\";\r\nimport { Global } from \"../../Global\";\r\nimport { IActionDispatchCancellationToken } from \"cms-ui-redux/IActionDispatchCancellationToken\";\r\nimport { ICellRenderInformation } from \"cms-ui-components/pagedVirtualCollection/ICellRenderInformation\";\r\nimport { IContinuationToken } from \"cms-businesslogic/IContinuationToken\";\r\nimport { ICreativeImage } from \"clientcore-catalyst-businesslogic/creativeSearch/ICreativeImage\";\r\nimport { ICreativeImageProviderSearchState } from \"../../presentation-logic/dataflows/creativeSearch/ICreativeImageProviderSearchState\";\r\nimport { ICreativeImageSearchFilterState } from \"../../presentation-logic/dataflows/creativeSearch/ICreativeImageSearchFilterState\";\r\nimport { ICreativeImageSearchManager } from \"clientcore-catalyst-businesslogic/creativeSearch/ICreativeImageSearchManager\";\r\nimport { ICreativeImageSearchState } from \"../../presentation-logic/dataflows/creativeSearch/ICreativeImageSearchState\";\r\nimport { ICreativeSearchProps } from \"../../rendering/creativeSearch/ICreativeSearchProps\";\r\nimport { ICreativeSearchQuery } from \"clientcore-catalyst-businesslogic/creativeSearch/ICreativeSearchQuery\";\r\nimport { IDispatch } from \"redux\";\r\nimport { IErrorResponse } from \"clientcore-catalyst-businesslogic/IErrorResponse\";\r\nimport { IEvent } from \"clientcore-infrastructure-analytics/browser-object-models/IEvent\";\r\nimport { IFilterItemOptionsList } from \"../../rendering/components/queryFilterPane/IFilterItemOptionsList\";\r\nimport { IFilterRuleDefinitionBase } from \"../../models/filterRules/IFilterRuleDefinitionBase\";\r\nimport { IImageAcquisitionManager } from \"clientcore-catalyst-businesslogic/IImageAcquisitionManager\";\r\nimport { IImageCommandActionCreator } from \"../../presentation-logic/dataflows/imageCommand/IImageCommandActionCreator\";\r\nimport { IImagePreviewModalProps } from \"../../rendering/components/imagePreviewModal/IImagePreviewModalProps\";\r\nimport { IImageTileProps } from \"../../rendering/components/imageTile/IImageTileProps\";\r\nimport { IInstrumentationClient } from \"../../instrumentation/instrumentationClient/IInstrumentationClient\";\r\nimport { IModalCarouselProps } from \"../../rendering/components/modalCarousel/IModalCarouselProps\";\r\nimport { IPagedComponentProps } from \"cms-ui-components/paging/IPagedComponentProps\";\r\nimport { IReducer } from \"cms-ui-redux/IReducer\";\r\nimport { ISearchWithAutosuggestProps } from \"../../rendering/components/searchWithAutosuggest/ISearchWithAutosuggestProps\";\r\nimport { ImageCommandActionCreator } from \"../../presentation-logic/dataflows/imageCommand/ImageCommandActionCreator\";\r\nimport { ImageCommandActions } from \"../../presentation-logic/dataflows/imageCommand/ImageCommandActions\";\r\nimport { ImageCommandReduction } from \"../../presentation-logic/dataflows/imageCommand/ImageCommandReduction\";\r\nimport { ImageOrientation } from \"cms-models/ImageOrientation\";\r\nimport { ImagePreviewModal } from \"../../rendering/components/imagePreviewModal/ImagePreviewModal\";\r\nimport { ImagePreviewModalActions } from \"../../presentation-logic/dataflows/imagePreviewModal/ImagePreviewModalActions\";\r\nimport { KeyCode } from \"cms-ui-components/KeyCode\";\r\nimport { ListItemSelectorActions } from \"../../presentation-logic/dataflows/listItemSelector/ListItemSelectorActions\";\r\nimport { ModalCarousel } from \"../../rendering/components/modalCarousel/ModalCarousel\";\r\nimport { ModalProvisioningActions } from \"cms-ui-presentationlogic/dataflows/modalProvisioning/ModalProvisioningActions\";\r\nimport { ModalProvisioningReduction } from \"cms-ui-presentationlogic/dataflows/modalProvisioning/ModalProvisioningReduction\";\r\nimport { NotificationListActions } from \"cms-ui-presentationlogic/dataflows/notifications/NotificationListActions\";\r\nimport { NotificationType } from \"cms-ui-components/notifications/notification/NotificationType\";\r\nimport { OneSrvBusinessLogicFactory } from \"clientcore-onesrv-businesslogic/factory/OneSrvBusinessLogicFactory\";\r\nimport { PagedCollectionBootstrapper } from \"cms-ui-views/paging/PagedCollectionBootstrapper\";\r\nimport { PagingActions } from \"cms-ui-presentationlogic/dataflows/paging/PagingActions\";\r\nimport { PromiseExtension } from \"cms-infrastructure/promise-extension/PromiseExtension\";\r\nimport { ReduxBootstrapper } from \"cms-ui-views/ReduxBootstrapper\";\r\nimport { ResultsDisplayModeEnum } from \"../../models/displayMode/ResultsDisplayModeEnum\";\r\nimport { Routes } from \"../../Routes\";\r\nimport { SearchOperationTypes } from \"cms-ui-presentationlogic/dataflows/entitySearch/SearchOperationTypes\";\r\nimport { SearchWithAutosuggestActions } from \"../../presentation-logic/dataflows/searchWithAutosuggest/SearchWithAutosuggestActions\";\r\nimport { ccsdk } from \"../../globals/ccsdk\";\r\nimport { createProviderQueryFilterPaneProps } from \"../../rendering/components/queryFilterPane/IQueryFilterPaneProps\";\r\nimport { memoizedCalculateCellRenderInformation } from \"../searchAndSelect/calculateMosaicRenderInformation\";\r\nimport { cloneDeep, isEmpty, isNil, throttle, merge } from \"lodash-es\";\r\n\r\n/**\r\n * Provides code to bootstrap the main app CreativePage experience with the required redux data flows.\r\n * @class\r\n */\r\nexport class CreativeSearchPageBootstrapper<TParentState>\r\n    extends ComponentBootstrapper<ICreativeImageSearchState, ICreativeSearchProps, TParentState> {\r\n\r\n    /** The number of milliseconds in a day\r\n     *  @type { number }\r\n     */\r\n    private static MillisecondsInADay: number = 86400000;\r\n\r\n    /**\r\n     * The entity search action for handling Search\r\n     * @type {EntitySearchActions}\r\n     */\r\n    private entitySearchActions: EntitySearchActions;\r\n\r\n    /** An instance of the `CollapsibleActions` class.\r\n     * @type {CollapsibleActions}\r\n     */\r\n    private collapsibleActions: CollapsibleActions;\r\n\r\n    /** An instance of the 'ListItemSelectorActions' class for dealing with the image providers option list.\r\n     * @type {ListItemSelectorActions<number>}\r\n     */\r\n    private providersListItemSelectorActions: ListItemSelectorActions<number>;\r\n\r\n    /** An instance of the 'ListItemSelectorActions' class for dealing with the image orientations option list.\r\n     * @type {ListItemSelectorActions<number>}\r\n     */\r\n    private orientationsListItemSelectorActions: ListItemSelectorActions<number>;\r\n\r\n    /** An instance of the 'ListItemSelectorActions' class for dealing with the image style option list.\r\n     * @type {ListItemSelectorActions<number>}\r\n     */\r\n    private imageStyleListItemSelectorActions: ListItemSelectorActions<number>;\r\n\r\n    /** An instance of the `ListItemSelectorActions` class for dealing with the sort order list.\r\n     * @type {ListItemSelectorActions<number>}\r\n     */\r\n    private sortOrderListItemSelectorActions: ListItemSelectorActions<number>;\r\n\r\n    /** An instance of the 'CreativeSearchActions' class for dealing with the search.\r\n     * @type {CreativeSearchActions}\r\n     */\r\n    private creativeSearchActions: CreativeSearchActions;\r\n\r\n    /** An instance of the 'CreativeSearchActions' class for dealing with the search.\r\n     * @type {CreativeSearchActions}\r\n     */\r\n    private creativeSearchActionCreator: CreativeSearchActionCreator;\r\n\r\n    /**\r\n     * Creative filter Data using which filter controls will be rendered on page based on selected provider.\r\n     * @type {ICreativeFilterData}\r\n     */\r\n    private creativeFilterFields: ICreativeFilterData;\r\n\r\n    /** An instance of the 'SearchWithAutosuggestActions' class for dealing with Search auto suggest drop downs.\r\n     * @type {SearchWithAutosuggestActions}\r\n     */\r\n    private searchWithAutosuggestActions: SearchWithAutosuggestActions;\r\n\r\n    /** An instance of the `CreativeSearchBootstrapper` class.\r\n     * @type {CreativeSearchBootstrapper}\r\n     */\r\n    private creativeSearchBootstrapper: CreativeSearchBootstrapper<ICreativeImageSearchState>;\r\n\r\n    /** An instance of the 'ImagePreviewModalActions' class.\r\n     * @type {ImagePreviewModalActions}\r\n     */\r\n    private imagePreviewModalActions: ImagePreviewModalActions;\r\n\r\n    /** An instance of the `ImageCommandActionCreator` class.\r\n     * @type {IImageCommandActionCreator}\r\n     */\r\n    private imageCommandActionCreator: IImageCommandActionCreator;\r\n\r\n    /** An instance of the `ImageCommandActions` class.\r\n     * @type {ImageCommandActions}\r\n     */\r\n    private imageCommandActions: ImageCommandActions;\r\n\r\n    /** The cancellation token for the most recent search. Used here so that results from 'next page' searches can\r\n     * be discarded when a new search has been executed.\r\n     * @type {IActionDispatchCancellationToken}\r\n     */\r\n    private lastSearchCancellationToken: IActionDispatchCancellationToken;\r\n\r\n    // an instance of a memoized version of the `calculateCellRenderInformation` function (imported from UISDK).\r\n    private calculateCellRenderInformation: (tiles: IImageTileProps[], startIndex: number, itemCount: number, canvasWidth: number) => ICellRenderInformation[];\r\n\r\n    /**\r\n     * Initializes a new instance of the `CreativeSearchPageBootstrapper` class.\r\n     * @constructor\r\n     * @param pagedImagesBootstrapper {PagedCollectionBootstrapper<ICreativeImageSearchState>} The bootstrapper to handle paged events.\r\n     * @param creativeImageSearchManager {ICreativeImageSearchManager} The creativeSearch Manager.\r\n     * @param imageAcquisitionManager {IImageAcquisitionManager} Used to download the images.\r\n     * @param instrumentationClient {IInstrumentationClient} Provides support for instrumentation.\r\n     * @param oneServiceBusinessLogicFactory {OneSrvBusinessLogicFactory} The OneSrvBusinessLogicFactory.\r\n     * @param pagingActions {PagingActions} The same paging actions as the pagedImagesBootstrapper is listening to.\r\n     * @param onAddEntityToLightbox {function} A function that manages the add entity to lightbox workflow\r\n     * @param parentBootstrapper {ComponentBootstrapper<TParentState, any, any>} The bootsrapper that contains this bootstrapper.\r\n     * @param stateSelector {function} A function that selects the state for this bootstrapper from the parent state.\r\n     * @param actionNamespacePrefix {string} Optional prefix to add to the namespace used to distinguish actions created by this bootstrapper.\r\n     */\r\n    constructor(\r\n        private pagedImagesBootstrapper: PagedCollectionBootstrapper<ICreativeImageSearchState>,\r\n        private creativeImageSearchManager: ICreativeImageSearchManager,\r\n        private imageAcquisitionManager: IImageAcquisitionManager,\r\n        private instrumentationClient: IInstrumentationClient,\r\n        private oneServiceBusinessLogicFactory: OneSrvBusinessLogicFactory,\r\n        private pagingActions: PagingActions,\r\n        private onAddEntityToLightbox: (creativeImage: ICreativeImage, modalProvisioningActions: ModalProvisioningActions, overlayOnly?: boolean) => React.ReactElement<any>,\r\n        private modalProvisioningActions: ModalProvisioningActions,\r\n        parentBootstrapper?: ComponentBootstrapper<TParentState, any, any> | ReduxBootstrapper<TParentState>,\r\n        stateSelector?: (parentState: TParentState) => ICreativeImageSearchState,\r\n        actionNamespacePrefix?: string) {\r\n        super(parentBootstrapper, stateSelector);\r\n\r\n        pagedImagesBootstrapper.setParent(\r\n            this,\r\n            (state: ICreativeImageSearchState) => state.providerImageSearchResults[state.currentSelectedProvider].pagedImagesState);\r\n\r\n        this.creativeFilterFields = CreateCreativeFilterData();\r\n\r\n        this.entitySearchActions = new EntitySearchActions(actionNamespacePrefix + \"CreativeSearchAction\");\r\n        this.collapsibleActions = new CollapsibleActions(actionNamespacePrefix + \"CreativeFilterOptions\");\r\n        this.providersListItemSelectorActions = new ListItemSelectorActions<number>(actionNamespacePrefix + \"CreativeProviders\");\r\n        this.orientationsListItemSelectorActions = new ListItemSelectorActions<number>(actionNamespacePrefix + \"CreativeOrientations\");\r\n        this.imageStyleListItemSelectorActions = new ListItemSelectorActions<number>(actionNamespacePrefix + \"CreativeImageStyles\");\r\n        this.creativeSearchActions = new CreativeSearchActions(actionNamespacePrefix + \"CreativeSearch\");\r\n        this.sortOrderListItemSelectorActions = new ListItemSelectorActions<number>(actionNamespacePrefix + \"CreativeSortOrder\");\r\n        this.searchWithAutosuggestActions = new SearchWithAutosuggestActions(actionNamespacePrefix + \"CreativeAutoSuggest\");\r\n\r\n        this.lastSearchCancellationToken = null;\r\n\r\n        this.imagePreviewModalActions = new ImagePreviewModalActions(actionNamespacePrefix + \"CreativeImagePreviewModal\");\r\n        this.imageCommandActions = new ImageCommandActions(actionNamespacePrefix + \"CreativeImageCommand\");\r\n        this.loadMoreItemsOnScroll = this.loadMoreItemsOnScroll.bind(this);\r\n        this.onFilterOptionsVisibilityChanged = this.onFilterOptionsVisibilityChanged.bind(this);\r\n        this.onSelectedProvidersChanged = this.onSelectedProvidersChanged.bind(this);\r\n        this.onSelectedOrientationsChanged = this.onSelectedOrientationsChanged.bind(this);\r\n        this.onSelectedImageStyleChanged = this.onSelectedImageStyleChanged.bind(this);\r\n        this.onSelectedSortOrderChanged = this.onSelectedSortOrderChanged.bind(this);\r\n        this.onSearchInvoked = this.onSearchInvoked.bind(this);\r\n        this.onImageTileInvoked = this.onImageTileInvoked.bind(this);\r\n        this.onPreviewButtonOk = this.onPreviewButtonOk.bind(this);\r\n        this.onPreviewButtonNext = this.onPreviewButtonNext.bind(this);\r\n        this.onPreviewButtonPrev = this.onPreviewButtonPrev.bind(this);\r\n        this.downloadImage = this.downloadImage.bind(this);\r\n        this.onPageNavigation = this.onPageNavigation.bind(this);\r\n        this.onClearSearch = this.onClearSearch.bind(this);\r\n        this.onDisplayModeChanged = this.onDisplayModeChanged.bind(this);\r\n        this.onRetryClicked = this.onRetryClicked.bind(this);\r\n        this.generateImageLink = this.generateImageLink.bind(this);\r\n        this.onAddToLightboxInvoked = this.onAddToLightboxInvoked.bind(this);\r\n\r\n        this.creativeSearchBootstrapper = new CreativeSearchBootstrapper(\r\n            \"CreativeSearchPageBoostrapper\",\r\n            () => {\r\n                const state = this.getCurrentState();\r\n                return state.entitySearchState.searchText;\r\n            },\r\n            () => {\r\n                const state = this.getCurrentState();\r\n                return this.createCreativeSearchQuery(state);\r\n            },\r\n            this.creativeImageSearchManager,\r\n            PageNames.Creative,\r\n            this.getSearchActionInput.bind(this),\r\n            this.oneServiceBusinessLogicFactory,\r\n            instrumentationClient,\r\n            this.entitySearchActions,\r\n            this.searchWithAutosuggestActions,\r\n            new NotificationListActions(actionNamespacePrefix + \"CreativeSearchHints\"),\r\n            actionNamespacePrefix,\r\n            (state: ICreativeImageSearchState) => state.searchWithAutosuggestState,\r\n            this);\r\n\r\n        this.calculateCellRenderInformation = memoizedCalculateCellRenderInformation();\r\n\r\n        this.adaptPagedComponentPropsToSinglePage = this.adaptPagedComponentPropsToSinglePage.bind(this);\r\n    }\r\n\r\n    /**\r\n     * Initializes the initial state of the component.\r\n     * @method\r\n     * @returns {ICreativeImageSearchState} The initial state.\r\n     */\r\n    public getInitialState(): ICreativeImageSearchState {\r\n        const profileExists = !!Global.userProfile\r\n            && !!Global.userProfile.creativeSearchFilters\r\n            && !!Global.userProfile.creativeSearchFilters.currentSelectedProvider;\r\n\r\n        let sortOrder = 0;\r\n        if (!!Global.userProfile && !!Global.userProfile.creativeResultView && !!Global.userProfile.creativeResultView.sortOrder) {\r\n            try {\r\n                CreativeSortOrderOptions.forEach((item, index) => {\r\n                    if (item.displayName === Global.userProfile.creativeResultView.sortOrder) {\r\n                        sortOrder = index;\r\n                        throw (\"break\");\r\n                    }\r\n                });\r\n            } catch (e) {\r\n                // expecting throw to break foreach loop only.\r\n            }\r\n        }\r\n\r\n        const resultDisplayMode = !!Global.userProfile\r\n            && !!Global.userProfile.creativeResultView\r\n            && Global.userProfile.creativeResultView.displayMode > -1 ? Global.userProfile.creativeResultView.displayMode : ResultsDisplayModeEnum.Mosaic;\r\n\r\n        let initialState: ICreativeImageSearchState = {\r\n            hasSearchExecutedOnce: false,\r\n            selectedProviders: { selectedItems: [0] },\r\n            selectedSortOrder: {\r\n                selectedItems: [sortOrder]\r\n            },\r\n            filterOptionVisibleState: { collapsed: false },\r\n            currentSelectedProvider: profileExists ? Global.userProfile.creativeSearchFilters.currentSelectedProvider : CreativeProvider.Getty,\r\n            entitySearchState: {\r\n                searchText: \"\",\r\n                searchOperation: SearchOperationTypes.EXECUTE_SEARCH\r\n            },\r\n            providerImageSearchResults: {},\r\n            providerImageSearchFilters: {},\r\n            providerImageDownloads: {},\r\n            searchWithAutosuggestState: this.creativeSearchBootstrapper.getInitialState(),\r\n            modalProvisioningState: { isVisible: false },\r\n            resultsDisplayMode: resultDisplayMode,\r\n            scrollTop: {},\r\n            canvasWidth: 0,\r\n            canvasHeight: 0\r\n        };\r\n\r\n        this.creativeFilterFields.providers.values.forEach((item, index) => {\r\n            if (profileExists && item.value === Global.userProfile.creativeSearchFilters.currentSelectedProvider) {\r\n                initialState.selectedProviders.selectedItems = [index];\r\n            }\r\n        });\r\n\r\n        const initialFilterState: ICreativeImageSearchFilterState = {\r\n            selectedOrientations: { selectedItems: [] },\r\n            selectedImageStyle: { selectedItems: [] }\r\n        };\r\n\r\n        const initialResultState: ICreativeImageProviderSearchState = {\r\n            continuationToken: { moreResultsAvailable: false },\r\n            loading: false,\r\n            lastPageFetched: 0,\r\n            totalResultsAvailable: 0,\r\n            pagedImagesState: this.pagedImagesBootstrapper.getInitialState(),\r\n            pagedSearchResults: {}\r\n        };\r\n\r\n        initialState.providerImageSearchFilters[CreativeProvider.Getty] = { ...initialFilterState };\r\n        initialState.providerImageSearchFilters[CreativeProvider.ShutterStock] = {\r\n            selectedOrientations: { selectedItems: [0] },\r\n            selectedImageStyle: { selectedItems: [0] }\r\n        };\r\n\r\n        if (profileExists && !!Global.userProfile.creativeSearchFilters.currentSelectedProvider) {\r\n            if (!!Global.userProfile.creativeSearchFilters.Getty) {\r\n                this.mapProviderFilters(initialState, CreativeProvider.Getty, profileExists);\r\n            }\r\n\r\n            if (!!Global.userProfile.creativeSearchFilters.ShutterStock) {\r\n                this.mapProviderFilters(initialState, CreativeProvider.ShutterStock, profileExists);\r\n            }\r\n        }\r\n\r\n        initialState.providerImageSearchResults[CreativeProvider.Getty] = cloneDeep(initialResultState);\r\n        initialState.providerImageSearchResults[CreativeProvider.ShutterStock] = cloneDeep(initialResultState);\r\n\r\n        initialState.providerImageDownloads[CreativeProvider.Getty] = {\r\n            imagesDownloading: [],\r\n            failedImages: [],\r\n            creativeImageIngestionState: {\r\n                beingIngestedImageIds: []\r\n            }\r\n        };\r\n\r\n        initialState.providerImageDownloads[CreativeProvider.ShutterStock] = {\r\n            imagesDownloading: [],\r\n            failedImages: [],\r\n            creativeImageIngestionState: {\r\n                beingIngestedImageIds: []\r\n            }\r\n        };\r\n\r\n        return initialState;\r\n    }\r\n\r\n    /**\r\n     * Performs required job before the component is created.\r\n     * @method\r\n     */\r\n    public onBeforeComponentCreated(): void {\r\n        this.creativeSearchBootstrapper.onBeforeComponentCreated();\r\n        this.creativeSearchActionCreator = this.creativeSearchBootstrapper.CreativeSearchActionCreator;\r\n\r\n        this.imageCommandActionCreator = new ImageCommandActionCreator(\r\n            this.imageAcquisitionManager,\r\n            this.store,\r\n            this.imageCommandActions);\r\n    }\r\n\r\n    /**\r\n     * Creates the root reducer of the component.\r\n     * @method\r\n     * @returns {IReducer<ICreativeImageSearchState>} The root reducer of the component.\r\n     */\r\n    public createRootReducer(): IReducer<ICreativeImageSearchState> {\r\n        const searchWithAutosuggestReduction = this.creativeSearchBootstrapper.createRootReducer();\r\n        const catalystSearchReduction = new CatalystSearchReduction(this.entitySearchActions);\r\n        const pagedImagesReducer = this.pagedImagesBootstrapper.createRootReducer();\r\n        const imageCommandReduction = new ImageCommandReduction(this.imageCommandActions);\r\n        const modalProvisioningReduction = new ModalProvisioningReduction(this.modalProvisioningActions);\r\n\r\n        return new CreativeSearchReduction(\r\n            this.collapsibleActions,\r\n            this.providersListItemSelectorActions,\r\n            this.orientationsListItemSelectorActions,\r\n            this.imageStyleListItemSelectorActions,\r\n            this.sortOrderListItemSelectorActions,\r\n            this.creativeSearchActions,\r\n            this.entitySearchActions,\r\n            this.searchWithAutosuggestActions,\r\n            this.imagePreviewModalActions,\r\n            this.pagingActions,\r\n            searchWithAutosuggestReduction,\r\n            catalystSearchReduction,\r\n            pagedImagesReducer,\r\n            modalProvisioningReduction,\r\n            imageCommandReduction);\r\n    }\r\n\r\n    /**\r\n     * Maps from the redux explorer state and default view properties to the view properties.\r\n     * @method\r\n     * @param state {ICreativeImageSearchState} The redux state.\r\n     * @returns {ICreativeSearchProps} The mapped view properties.\r\n     */\r\n    public mapStateToProps(state: ICreativeImageSearchState): ICreativeSearchProps {\r\n\r\n        const retVal = {} as ICreativeSearchProps;\r\n\r\n        retVal.thumbnailImageWidth = AppConstants.thumbnailConfig.gridTileWidth;\r\n        retVal.thumbnailImageHeight = AppConstants.thumbnailConfig.gridTileHeight;\r\n\r\n        const currentProviderResultState = state.providerImageSearchResults[state.currentSelectedProvider];\r\n        if (currentProviderResultState.serviceError) {\r\n            retVal.serviceError = {\r\n                title: currentProviderResultState.serviceError.title,\r\n                titlePrefix: currentProviderResultState.serviceError.titlePrefix,\r\n                itemType: NotificationType.Error\r\n            };\r\n        }\r\n\r\n        // childDocumentsBeingLoaded indicates that the first page of search results are being loaded\r\n        // (i.e. when a search if first executed)\r\n        // moreChildrenLoading indicates that subsequent pages are being loaded (i.e. on PageNext)\r\n        // These are set based on the valued of the loading flag in the state and the absence or presence of existing search results.\r\n        const haveSearchResults = !isEmpty(currentProviderResultState.pagedSearchResults);\r\n        retVal.childDocumentsBeingLoaded = currentProviderResultState.loading && !haveSearchResults;\r\n        retVal.moreChildrenLoading = currentProviderResultState.loading && haveSearchResults;\r\n\r\n        retVal.failedActions = [];\r\n\r\n        const imageProviders: IFilterItemOptionsList = this.buildImageProviderFilterOptions(state.selectedProviders.selectedItems);\r\n        const currentProviderFilter = state.providerImageSearchFilters[state.currentSelectedProvider];\r\n        const imageOrientations: IFilterItemOptionsList = this.buildOrientationsFilterOptions(state.currentSelectedProvider, currentProviderFilter.selectedOrientations.selectedItems);\r\n        const imageStyles: IFilterItemOptionsList = this.buildImageStyleFilterOptions(state.currentSelectedProvider, currentProviderFilter.selectedImageStyle.selectedItems);\r\n\r\n        retVal.providerQueryFilterPaneProps = {\r\n            [state.currentSelectedProvider]: createProviderQueryFilterPaneProps(imageProviders, imageOrientations, imageStyles)\r\n        };\r\n        retVal.providerQueryFilterPaneProps[state.currentSelectedProvider].isKeyboardNavigable = !state.filterOptionVisibleState.collapsed;\r\n\r\n        retVal.sortOrderProps = {\r\n            options: CreativeSortOrderOptions.map(option => option.displayName),\r\n            selectedOption: state.selectedSortOrder.selectedItems.length > 0 ? state.selectedSortOrder.selectedItems[0] : 0,\r\n            onSelectedOptionChanged: this.onSelectedSortOrderChanged\r\n        };\r\n\r\n        retVal.showFilterOptions = !state.filterOptionVisibleState.collapsed;\r\n        retVal.creativeProvider = state.currentSelectedProvider;\r\n\r\n        retVal.searchWithAutosuggestProps = this.creativeSearchBootstrapper.mapStateToProps(state.searchWithAutosuggestState);\r\n\r\n        let currentPagedImageState = currentProviderResultState.pagedImagesState;\r\n        // Take width and height of the canvas from our own state.\r\n        currentPagedImageState.canvasWidth = state.canvasWidth;\r\n        currentPagedImageState.canvasHeight = state.canvasHeight;\r\n        const pagedSearchResults = currentProviderResultState.pagedSearchResults;\r\n        let pagedImagesProps = this.pagedImagesBootstrapper.mapStateToProps(currentPagedImageState);\r\n        pagedImagesProps = this.adaptPagedComponentPropsToSinglePage(pagedImagesProps, currentProviderResultState.totalResultsAvailable);\r\n        retVal.pagedImagesProps = pagedImagesProps;\r\n        retVal.imageTiles = [];\r\n\r\n        if (!retVal.childDocumentsBeingLoaded) {\r\n            if (!!pagedSearchResults) {\r\n                Object.keys(pagedSearchResults).forEach((key) => {\r\n                    const pagedSearchResult = pagedSearchResults[key];\r\n                    pagedSearchResult.results.map((imageEntity: ICreativeImage) => {\r\n\r\n                        const { width, height } =\r\n                            state.resultsDisplayMode === ResultsDisplayModeEnum.Mosaic\r\n                                ? GetCreativeImageDimensionsHelper(imageEntity, this.instrumentationClient)\r\n                                : { width: AppConstants.thumbnailConfig.width, height: AppConstants.thumbnailConfig.height };\r\n\r\n                        retVal.imageTiles.push({\r\n                            id: imageEntity.id,\r\n                            sourceHref: imageEntity.previewImageUrl,\r\n                            title: imageEntity.title,\r\n                            imgWidth: width,\r\n                            imgHeight: height,\r\n                            supportsMultiSelection: false,\r\n                            onImageTileInvoked: this.onImageTileInvoked.bind(this, imageEntity.id),\r\n                            onAddToLightboxInvoked: this.onAddToLightboxInvoked.bind(this, imageEntity.id)\r\n                        });\r\n                    });\r\n                });\r\n\r\n                retVal.onlyFirstPageLoaded =\r\n                    isNil(state.providerImageSearchResults[state.currentSelectedProvider].continuationToken) ||\r\n                    state.providerImageSearchResults[state.currentSelectedProvider].continuationToken.moreResultsAvailable === false;\r\n\r\n                // the `load more items` function execution is throttled to avoid firing too many calls.\r\n                // (for details see: https://css-tricks.com/debouncing-throttling-explained-examples/)\r\n                const throttledLoadMoreItemsOnScroll = throttle(this.loadMoreItemsOnScroll.bind(this, retVal.imageTiles.length), AppConstants.resultsBrowsing.scrollDebounceTime, { leading: true, trailing: false });\r\n\r\n                if (retVal.imageTiles.length <= AppConstants.resultsBrowsing.maximumNumberOfResults) {\r\n                    retVal.onScroll = throttledLoadMoreItemsOnScroll;\r\n                } else {\r\n                    retVal.onScroll = () => { return; };\r\n                }\r\n            }\r\n\r\n            if (state.resultsDisplayMode === ResultsDisplayModeEnum.Mosaic) {\r\n\r\n                // the parameters we're passing reflect the fact that now we always have only one big logical page of data.\r\n                const activePageCellProps = pagedImagesProps.pageDescriptors.length > 0 ? this.calculateCellRenderInformation(\r\n                    retVal.imageTiles,\r\n                    0,\r\n                    retVal.imageTiles.length,\r\n                    state.canvasWidth) :\r\n                    [];\r\n\r\n                // Calculate the height of the page\r\n                // The height is the y position value of the last component in the page, plus the height of that element plus a margin\r\n                let containerHeightForCollection = 0;\r\n                const indexOfLastElement = activePageCellProps.length - 1;\r\n                if (indexOfLastElement >= 0) {\r\n                    containerHeightForCollection = activePageCellProps[indexOfLastElement].y + activePageCellProps[indexOfLastElement].height + AppConstants.thumbnailConfig.totalMargin;\r\n                }\r\n\r\n                retVal.pagedVirtualCollectionProps = {\r\n                    containerHeight: containerHeightForCollection,\r\n                    containerWidth: currentPagedImageState.canvasWidth,\r\n                    pages: pagedImagesProps.pageDescriptors,\r\n                    activePageIndex: pagedImagesProps.activePageIndex,\r\n                    activePageCellProps: activePageCellProps\r\n                };\r\n            }\r\n        }\r\n\r\n        retVal.resultsDisplayMode = state.resultsDisplayMode;\r\n\r\n        retVal.scrollTop = state.scrollTop[state.currentSelectedProvider];\r\n\r\n        const modal = state.modalProvisioningState.isVisible ? this.createModal(state.modalProvisioningState.modalId, state) : null;\r\n        if (modal) {\r\n            (retVal as any).children = modal;\r\n        }\r\n\r\n        return retVal as ICreativeSearchProps;\r\n    }\r\n\r\n    /**\r\n     * Inject into props redux action creators.\r\n     * @method\r\n     * @param {IDispatch} dispatch The redux dispatch function.\r\n     * @param {ICreativeSearchProps} ownProps The set of pure properties of the component.\r\n     * @returns {ICreativeSearchProps} An enriched set of props.\r\n     */\r\n    public mapDispatchToProps(dispatch: IDispatch, _ownProps: ICreativeSearchProps): ICreativeSearchProps {\r\n        const retVal = {} as ICreativeSearchProps;\r\n        retVal.onToggleFilterOptionsVisibility = this.onFilterOptionsVisibilityChanged;\r\n        retVal.onDisplayModeChanged = this.onDisplayModeChanged;\r\n        retVal.onImageTileInvoked = this.onImageTileInvoked;\r\n        retVal.onRetryClicked = this.onRetryClicked;\r\n        retVal.onAddToLightboxInvoked = this.onAddToLightboxInvoked;\r\n        retVal.pagedImagesProps = this.pagedImagesBootstrapper.mapDispatchToProps(dispatch);\r\n        retVal.searchWithAutosuggestProps = {\r\n            onSearchExecute: (event) => this.onSearchInvoked(\"searchText\", \"TextBox\", event),\r\n            onSuggestionSelected: (event) => this.onSearchInvoked(\"searchText\", \"AutosuggestDropDown\", event)\r\n        } as ISearchWithAutosuggestProps;\r\n        retVal.onSearchViewWillUnmount = (scrollTop: number) => Actions.Creative.SearchResultsScrollPositionActions.SaveScrollPosition.getActionSender(this.store)(scrollTop);\r\n\r\n        return retVal;\r\n    }\r\n\r\n    /**\r\n     * Converts the props that have been shaped for the `paging infrastructure` to a form that can be utilized in a context where we only have one (expandable in size)\r\n     * single page.\r\n     * @param {IPagedComponentProps} currentPagedImageState - The props shaped to power a multi-page scenario.\r\n     * @param {number} totalItems - The total number of items that have been loaded so far.\r\n     * @returns {IPagedComponentProps} A set of props that treats the set of data as a single (expandable in size) page.\r\n     */\r\n    private adaptPagedComponentPropsToSinglePage(pagedComponentProps: IPagedComponentProps, totalItems: number): IPagedComponentProps {\r\n        const pagedImagesProps = {\r\n            ...pagedComponentProps,\r\n            activePageIndex: 0,\r\n            pageDescriptors: [{\r\n                isFirst: true,\r\n                isLast: true,\r\n                pageIndex: 0,\r\n                startIndex: 0,\r\n                endIndex: totalItems - 1\r\n            }]\r\n        };\r\n        return pagedImagesProps;\r\n    }\r\n\r\n    /**\r\n     * Saves the query filter selection to profile stored in app\r\n     * @param provider {CreativeProvider} the provider currently selected, if no filters provided, will save currently selected provider to profile.\r\n     * @param filters {IFilterItemOptionsList} the filter list\r\n     * @method\r\n     */\r\n    private saveQueryFilterSelectionToProfile(provider: CreativeProvider, filters?: IFilterItemOptionsList): void {\r\n        if (!Global.userProfile.creativeSearchFilters) {\r\n            Global.userProfile[\"creativeSearchFilters\"] = {};\r\n        }\r\n\r\n        if (!Global.userProfile.creativeSearchFilters[provider]) {\r\n            Global.userProfile.creativeSearchFilters[provider] = {};\r\n        }\r\n\r\n        Global.userProfile.creativeSearchFilters.currentSelectedProvider = provider;\r\n\r\n        if (!!filters) {\r\n            filters.values.forEach((item) => {\r\n                Global.userProfile.creativeSearchFilters[provider][item.value] = item.selected;\r\n            });\r\n        }\r\n\r\n        ccsdk.userProfileManagers.prose.setSetting(\"creativeSearchFilters\", Global.userProfile.creativeSearchFilters).catch((e) => {\r\n            this.instrumentationClient.LoggingService.error(\"Saving user profile failed.\", null, e);\r\n        });\r\n    }\r\n\r\n    /**\r\n     * Maps filter options to indices.\r\n     * @param state {ICreativeImageSearchState} The state to store the indices\r\n     * @param provider {CreativeProvider} Creative provider\r\n     * @param profileExists {boolean} If the profile exists\r\n     */\r\n    private mapProviderFilters(state: ICreativeImageSearchState, provider: CreativeProvider, profileExists: boolean): void {\r\n        if (profileExists && !!Global.userProfile.creativeSearchFilters.Getty) {\r\n            let imageOrientations: IFilterItemOptionsList = this.buildOrientationsFilterOptions(provider, []);\r\n            let orientationIndices = [];\r\n            this.mapFiltersToIndices(imageOrientations, orientationIndices, provider);\r\n\r\n            let styleOptions: IFilterItemOptionsList = this.buildImageStyleFilterOptions(provider, []);\r\n            let styleIndices = [];\r\n            this.mapFiltersToIndices(styleOptions, styleIndices, provider);\r\n\r\n            state.providerImageSearchFilters[provider] = {\r\n                selectedOrientations: { selectedItems: orientationIndices },\r\n                selectedImageStyle: { selectedItems: styleIndices }\r\n            };\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Map filters to indices\r\n     * @param filter {IFilterItemOptionsList} The current filter\r\n     * @param indices {number[]} the indices to populate\r\n     * @param provider {CreativeProvider} The current provider\r\n     */\r\n    private mapFiltersToIndices(filter: IFilterItemOptionsList, indices: number[], provider: CreativeProvider): void {\r\n        filter.values.forEach((item, index) => {\r\n            if (Global.userProfile.creativeSearchFilters[provider].hasOwnProperty(item.value)\r\n                && Global.userProfile.creativeSearchFilters[provider][item.value]) {\r\n                indices.push(index);\r\n            }\r\n        });\r\n    }\r\n\r\n    // Helper to create the right type of modal\r\n    private createModal(modalId: string, state: ICreativeImageSearchState): React.ReactElement<any> {\r\n\r\n        switch (modalId) {\r\n            case \"ImagePreviewModal\": {\r\n                    return this.createModalCarousel(state);\r\n                }\r\n\r\n            case \"AddToLightboxModal\": {\r\n                    return this.onAddEntityToLightbox(state.selectedImageEntity, this.modalProvisioningActions);\r\n                }\r\n\r\n            default:\r\n                return null;\r\n        }\r\n    }\r\n\r\n    // Helper to create the modal Carousel\r\n    private createModalCarousel(state: ICreativeImageSearchState): React.ReactElement<IModalCarouselProps> {\r\n        if (!state.selectedImageEntity) {\r\n            return null;\r\n        }\r\n\r\n        let width = 0;\r\n        let height = 0;\r\n\r\n        if (!!state.selectedImageEntity.previewImageSize) {\r\n            width = state.selectedImageEntity.previewImageSize.width;\r\n            height = state.selectedImageEntity.previewImageSize.height;\r\n        } else if (!!state.selectedImageEntity.maxImageSize) {\r\n            width = state.selectedImageEntity.maxImageSize.width;\r\n            height = state.selectedImageEntity.maxImageSize.height;\r\n        }\r\n\r\n        let modalCarouselProps: IModalCarouselProps = InitializeModalCarouselProps(width, height);\r\n\r\n        modalCarouselProps = merge(modalCarouselProps, {\r\n            onHide: this.onPreviewButtonOk,\r\n            onSelect: (_eventKey: React.MouseEvent<{}>, carouselEvent?: React.SyntheticEvent<{}>) => {\r\n                if ((<any>carouselEvent).direction === CarouselDirection.Next) {\r\n                    this.onPreviewButtonNext(carouselEvent.nativeEvent);\r\n                } else if ((<any>carouselEvent).direction === CarouselDirection.Previous) {\r\n                    this.onPreviewButtonPrev(carouselEvent.nativeEvent);\r\n                }\r\n            },\r\n            onKeyPressed: (eventArgs: React.KeyboardEvent<any>) => {\r\n                switch (eventArgs.keyCode) {\r\n                    case KeyCode.LEFT_ARROW:\r\n                        eventArgs.preventDefault();\r\n                        this.onPreviewButtonPrev(eventArgs.nativeEvent);\r\n                        break;\r\n                    case KeyCode.RIGHT_ARROW:\r\n                        eventArgs.preventDefault();\r\n                        this.onPreviewButtonNext(eventArgs.nativeEvent);\r\n                        break;\r\n                    default:\r\n                        break;\r\n                }\r\n            }\r\n        });\r\n\r\n        const displayVerticalLayout = DetermineModalLayout(width, height);\r\n        const imagePreviewModalElement = this.createImagePreviewModal(state, displayVerticalLayout);\r\n\r\n        return React.createElement(ModalCarousel, modalCarouselProps, imagePreviewModalElement);\r\n    }\r\n\r\n    /**\r\n     * Helper method to create the image preview modal.\r\n     * @method\r\n     */\r\n    private createImagePreviewModal(state: ICreativeImageSearchState, displayVerticalLayout: boolean): React.ReactElement<any> {\r\n        const currentProviderImageCommantState = state.providerImageDownloads[state.currentSelectedProvider];\r\n        const downloadInProgress = currentProviderImageCommantState.imagesDownloading.indexOf(state.selectedImageEntity.id) >= 0;\r\n\r\n        const showDownloadingMessage: boolean = currentProviderImageCommantState.imagesDownloading.indexOf(state.selectedImageEntity.id) >= 0;\r\n        const showFailedDownloadingMessage: boolean = !showDownloadingMessage && (currentProviderImageCommantState.failedImages.indexOf(state.selectedImageEntity.id) >= 0);\r\n        const footerMessage: string = showDownloadingMessage ? \"Downloading image from \" + state.currentSelectedProvider :\r\n            (showFailedDownloadingMessage ? \"Last download attempt from \" + state.currentSelectedProvider + \" failed for this image.\" : \"\");\r\n\r\n        const imagePreviewProps: IImagePreviewModalProps = {\r\n            containerClassName: \"creative-image\",\r\n            sourceId: state.selectedImageEntity.id,\r\n            visible: true,\r\n            downloadInProgress,\r\n            downloadEnabled: !downloadInProgress,\r\n            onPreviewButtonOk: this.onPreviewButtonOk,\r\n            downloadImage: this.downloadImage,\r\n            footerMessage: footerMessage,\r\n            restrictions: state.selectedImageEntity ? state.selectedImageEntity.restrictions : [],\r\n            lastDownloadError: (showFailedDownloadingMessage && !!currentProviderImageCommantState.lastDownloadError) ? currentProviderImageCommantState.lastDownloadError : \"\",\r\n            displayVerticalLayout: displayVerticalLayout,\r\n            isImageLinkGenerationInProgress: currentProviderImageCommantState.creativeImageIngestionState.beingIngestedImageIds ? currentProviderImageCommantState.creativeImageIngestionState.beingIngestedImageIds.indexOf(state.selectedImageEntity.id) > -1 : false,\r\n            generateImageLinkInvoked: this.generateImageLink,\r\n            imageLink: currentProviderImageCommantState.creativeImageIngestionState.cmsIdForCreativeImage ? Routes.getImagePageRoutePathWithProtocol(currentProviderImageCommantState.creativeImageIngestionState.cmsIdForCreativeImage) : null,\r\n            generateLinkErrorMessage: currentProviderImageCommantState.creativeImageIngestionState.creativeImageIngestionErrorMessage,\r\n            addToLightboxOverlay: this.onAddEntityToLightbox(state.selectedImageEntity, this.modalProvisioningActions, true)\r\n        };\r\n\r\n        imagePreviewProps.sourceHref = state.selectedImageEntity.previewImageUrl;\r\n        imagePreviewProps.lowQualtiySourceHref = state.selectedImageEntity.previewImageUrl;\r\n        imagePreviewProps.title = state.selectedImageEntity.title;\r\n        imagePreviewProps.caption = state.selectedImageEntity.caption;\r\n        imagePreviewProps.publishDate = state.selectedImageEntity.dateCreated;\r\n        imagePreviewProps.isModelReleased = state.selectedImageEntity.isModelReleased;\r\n        imagePreviewProps.isPropertyReleased = state.selectedImageEntity.isPropertyReleased;\r\n        imagePreviewProps.photographerName = state.selectedImageEntity.photographer;\r\n\r\n        const licenseValues = this.creativeFilterFields.creativeProviderFilterData[state.currentSelectedProvider].license.values;\r\n\r\n        // Default set it to the Commercial if provider is shutterstock as license information is not present in provider metadata.\r\n        if (state.currentSelectedProvider === CreativeProvider.ShutterStock) {\r\n            imagePreviewProps.licenseModel = \"Commercial\";\r\n        } else if (!!licenseValues && licenseValues.length > 0) {\r\n            licenseValues.forEach((licenseValue) => {\r\n                if (licenseValue.value === state.selectedImageEntity.licenseModel) {\r\n                    imagePreviewProps.licenseModel = licenseValue.displayString;\r\n                }\r\n            });\r\n        } else {\r\n            imagePreviewProps.licenseModel = state.selectedImageEntity.licenseModel;\r\n        }\r\n\r\n        if (!!state.selectedImageEntity.previewImageSize) {\r\n            imagePreviewProps.width = state.selectedImageEntity.previewImageSize.width;\r\n            imagePreviewProps.height = state.selectedImageEntity.previewImageSize.height;\r\n        } else if (!!state.selectedImageEntity.maxImageSize) {\r\n            imagePreviewProps.width = state.selectedImageEntity.maxImageSize.width;\r\n            imagePreviewProps.height = state.selectedImageEntity.maxImageSize.height;\r\n        }\r\n\r\n        imagePreviewProps.providerName = state.currentSelectedProvider;\r\n\r\n        return React.createElement(ImagePreviewModal, imagePreviewProps);\r\n    }\r\n\r\n    /**\r\n     * Callback opens the Add To Lightbox modal.\r\n     * @param id {string} the id for the image\r\n     * @param event {IEvent} the event which triggered this handler\r\n     * @method\r\n     */\r\n    private onAddToLightboxInvoked(id: string, event: IEvent): void {\r\n        if (!id) {\r\n            this.instrumentationClient.LoggingService.error(\"CreativeSearchPageBootstrapper.onAddToLightboxInvoked::\", null, \"Tile clicked, but image id is not passed with the click event.\");\r\n            return;\r\n        }\r\n\r\n        let entityInfo = this.getEntityAndIndexFromSearchResult(id);\r\n\r\n        this.instrumentationClient.UserActivityTrackingService.logPageActionEvent(\r\n            this.instrumentationClient.createEventData(event, \"addToLightbox\", null, \"addToLightbox-Button\", AreaOfPage.creativeResultsView),\r\n            PageNames.Creative,\r\n            this.creativeSearchActionCreator.SearchActivity.correlationVector,\r\n            this.creativeSearchBootstrapper.getPageActionData(this.getSelectActionInput(entityInfo.creativeImage, entityInfo.index)));\r\n\r\n        if (!!entityInfo.creativeImage) {\r\n            this.imagePreviewModalActions.CreativeImagePreviewModalFetchEnd.getActionSender(this.store)(entityInfo.creativeImage, entityInfo.index);\r\n            this.modalProvisioningActions.ShowModal.getActionSender(this.store)(\"AddToLightboxModal\");\r\n        } else {\r\n            throw (`Error: Image entity ${id} is not in the entity list from search.`);\r\n        }\r\n\r\n        return;\r\n    }\r\n\r\n    /**\r\n     * On click event for Preview modal Next button.\r\n     * @method\r\n     * @param event {Event} the event which triggered this handler\r\n     */\r\n    private onPreviewButtonNext(event: Event): void {\r\n        const state = this.getCurrentState();\r\n        this.imagePreviewModalActions.CreativeImagePreviewModalFetchEnd.getActionSender(this.store)(null, state.selectedImageEntityIndex);\r\n        const currentProviderSearchResults = state.providerImageSearchResults[state.currentSelectedProvider];\r\n        const nextSelectedIndex = state.selectedImageEntityIndex === currentProviderSearchResults.totalResultsAvailable - 1 ? 0 : state.selectedImageEntityIndex + 1;\r\n\r\n        // If image index is 0, then pageIndex should be 1\r\n        const resultPageIndex = Math.floor(nextSelectedIndex / 100) + 1;\r\n        const resultImageIndex = nextSelectedIndex % 100;\r\n\r\n        if (!!currentProviderSearchResults && !!currentProviderSearchResults.pagedSearchResults) {\r\n            const pagedSearchResult = currentProviderSearchResults.pagedSearchResults[resultPageIndex];\r\n            const creativeImageList = pagedSearchResult.results;\r\n            const creativeImage = creativeImageList[resultImageIndex];\r\n            this.instrumentationClient.UserActivityTrackingService.logPageActionEvent(\r\n                this.instrumentationClient.createEventData(event, \"creativeImagePreview\", null, \"imagePreview-Next\", AreaOfPage.searchAndSelectResultsView),\r\n                PageNames.Creative,\r\n                this.creativeSearchActionCreator.SearchActivity.correlationVector,\r\n                this.creativeSearchBootstrapper.getPageActionData(this.getSelectActionInput(creativeImage, nextSelectedIndex)));\r\n\r\n            if (!!creativeImage) {\r\n                this.imageCommandActions.ImagePreviewLinkGenerationStatusReset.getActionSender(this.store)();\r\n                this.imagePreviewModalActions.CreativeImagePreviewModalFetchEnd.getActionSender(this.store)(creativeImage, nextSelectedIndex);\r\n                this.modalProvisioningActions.ShowModal.getActionSender(this.store)(\"ImagePreviewModal\");\r\n            }\r\n        }\r\n    }\r\n\r\n    /**\r\n     * On click event for preview modal Previous button.\r\n     * @method\r\n     * @param event {Event} the event which triggered this handler\r\n     */\r\n    private onPreviewButtonPrev(event: Event): void {\r\n        const state = this.getCurrentState();\r\n        this.imagePreviewModalActions.CreativeImagePreviewModalFetchEnd.getActionSender(this.store)(null, state.selectedImageEntityIndex);\r\n        const currentProviderSearchResults = state.providerImageSearchResults[state.currentSelectedProvider];\r\n        const nextSelectedIndex = state.selectedImageEntityIndex === 0 ? currentProviderSearchResults.totalResultsAvailable - 1 : state.selectedImageEntityIndex - 1;\r\n\r\n        const resultPageIndex = Math.floor(nextSelectedIndex / 100) + 1;\r\n        const resultImageIndex = nextSelectedIndex % 100;\r\n\r\n        if (!!currentProviderSearchResults && !!currentProviderSearchResults.pagedSearchResults) {\r\n            const pagedSearchResult = currentProviderSearchResults.pagedSearchResults[resultPageIndex];\r\n            const creativeImageList = pagedSearchResult.results;\r\n            const creativeImage = creativeImageList[resultImageIndex];\r\n            this.instrumentationClient.UserActivityTrackingService.logPageActionEvent(\r\n                this.instrumentationClient.createEventData(event, \"creativeImagePreview\", null, \"imagePreview-Prev\", AreaOfPage.searchAndSelectResultsView),\r\n                PageNames.Creative,\r\n                this.creativeSearchActionCreator.SearchActivity.correlationVector,\r\n                this.creativeSearchBootstrapper.getPageActionData(this.getSelectActionInput(creativeImage, nextSelectedIndex)));\r\n\r\n            if (!!creativeImage) {\r\n                this.imageCommandActions.ImagePreviewLinkGenerationStatusReset.getActionSender(this.store)();\r\n                this.imagePreviewModalActions.CreativeImagePreviewModalFetchEnd.getActionSender(this.store)(creativeImage, nextSelectedIndex);\r\n                this.modalProvisioningActions.ShowModal.getActionSender(this.store)(\"ImagePreviewModal\");\r\n            }\r\n        }\r\n    }\r\n\r\n    /**\r\n     * On click event for preivew modal ok button.\r\n     * @method\r\n     */\r\n    private onPreviewButtonOk(): void {\r\n        this.imageCommandActionCreator.clearLastDownloadError();\r\n        this.imageCommandActions.ImagePreviewLinkGenerationStatusReset.getActionSender(this.store)();\r\n        this.modalProvisioningActions.HideModal.getActionSender(this.store)();\r\n    }\r\n\r\n    /**\r\n     * On Retry button click event to retry the search.\r\n     * @method\r\n     * @param {React.SyntheticEvent<any>} event - The event that triggered the handler.\r\n     */\r\n    private onRetryClicked(_event: React.SyntheticEvent<any>): void {\r\n        const state = this.getCurrentState();\r\n        let currentProviderSearchResult = state.providerImageSearchResults[state.currentSelectedProvider];\r\n        let continuationToken = currentProviderSearchResult.continuationToken;\r\n\r\n        // Load more data if more results are available and there is no ongoing request to fetch more data.\r\n        if (continuationToken.moreResultsAvailable &&\r\n            !currentProviderSearchResult.loading) {\r\n            this.loadMoreData(this.lastSearchCancellationToken, continuationToken, \"CreativeSearchPageBootstrapper.creativeSearchNextPageQueryRetry\");\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Callback which loads the preview image when an image tile is invoked.\r\n     * @param {string} id - The `id` of the image being accessed.\r\n     * @param {React.SyntheticEvent<any>} event - The event that triggered the handler.\r\n     * @method\r\n     */\r\n    private onImageTileInvoked(id: string, event: React.SyntheticEvent<any>): void {\r\n        if (!id) {\r\n            console.error(\"Tile clicked, but image id is not passed with the click event.\");\r\n            return;\r\n        }\r\n\r\n        let entityInfo = this.getEntityAndIndexFromSearchResult(id);\r\n\r\n        this.instrumentationClient.UserActivityTrackingService.logPageActionEvent(\r\n            this.instrumentationClient.createEventData(event, \"image\", null, \"image-ImageTile\", AreaOfPage.creativeResultsView),\r\n            PageNames.Creative,\r\n            this.creativeSearchActionCreator.SearchActivity.correlationVector,\r\n            // 1 is added to the index below because we want to log 1 based index instead of 0 based index.\r\n            this.creativeSearchBootstrapper.getPageActionData(this.getSelectActionInput(entityInfo.creativeImage, entityInfo.index + 1)));\r\n\r\n        if (!!entityInfo.creativeImage) {\r\n            this.imagePreviewModalActions.CreativeImagePreviewModalFetchEnd.getActionSender(this.store)(entityInfo.creativeImage, entityInfo.index);\r\n            this.modalProvisioningActions.ShowModal.getActionSender(this.store)(\"ImagePreviewModal\");\r\n        } else {\r\n            throw (`Error: Image entity ${id} is not in the result list from search.`);\r\n        }\r\n        return;\r\n    }\r\n\r\n    /**\r\n     * Get the action input data for image selection\r\n     * @param creativeImage {ICreativeImage} the creative image\r\n     * @param entityOrder {number} the index at which the selected item is present in collection\r\n     * @method\r\n     * @returns { { [key: string]: string; } } The action input\r\n     */\r\n    private getSelectActionInput(creativeImage: ICreativeImage, entityOrder: number): { [key: string]: string; } {\r\n\r\n        let actionInput: { [key: string]: string; } = {};\r\n        const currentState = this.getCurrentState();\r\n\r\n        if (!!creativeImage) {\r\n            const providerName = currentState.currentSelectedProvider;\r\n\r\n            let ageOfImagesInDays: number = -1;\r\n            if (!isEmpty(creativeImage.dateCreated)) {\r\n                let dateImageTaken = new Date(creativeImage.dateCreated);\r\n\r\n                const nowTime = Date.now();\r\n                ageOfImagesInDays = Math.floor((nowTime - dateImageTaken.getTime()) / CreativeSearchPageBootstrapper.MillisecondsInADay);\r\n            }\r\n\r\n            actionInput = {\r\n                \"id\": creativeImage.id,\r\n                \"order\": entityOrder.toString(),\r\n                \"providerName\": providerName,\r\n                \"orientation\": creativeImage.orientation,\r\n                \"ageOfImageInDays\": ageOfImagesInDays.toString(),\r\n                \"filterPaneVisibleState\": currentState.filterOptionVisibleState.collapsed ? \"collapsed\" : \"expanded\",\r\n                \"resultsDisplayMode\": ResultsDisplayModeEnum[currentState.resultsDisplayMode]\r\n            };\r\n        }\r\n\r\n        return actionInput;\r\n    }\r\n\r\n    /**\r\n     * Gets the enitity by id from search results\r\n     * @param id {string} the entity id\r\n     * @return the information about the entity and where it fits in the search order.\r\n     * @method\r\n     */\r\n    private getEntityAndIndexFromSearchResult(id: string): { creativeImage: ICreativeImage, index: number } {\r\n        let selectedEntity: ICreativeImage = null;\r\n        let index: number = -1;\r\n        let navigatedEntiries: number = 0;\r\n        const currentProviderSearchResults = this.getCurrentState().providerImageSearchResults[this.getCurrentState().currentSelectedProvider];\r\n\r\n        if (!!currentProviderSearchResults && !!currentProviderSearchResults.pagedSearchResults) {\r\n            const pagedSearchResults = currentProviderSearchResults.pagedSearchResults;\r\n            for (const key in pagedSearchResults) {\r\n                if (pagedSearchResults.hasOwnProperty(key)) {\r\n                    const pagedSearchResult = pagedSearchResults[key];\r\n                    const creativeImageList = pagedSearchResult.results;\r\n\r\n                    for (let i = 0; i < creativeImageList.length; i++) {\r\n                        if (creativeImageList[i].id === id) {\r\n                            selectedEntity = creativeImageList[i];\r\n                            index = navigatedEntiries;\r\n                            break;\r\n                        }\r\n\r\n                        navigatedEntiries++;\r\n                    }\r\n\r\n                    if (index !== -1) {\r\n                        break;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\n        return {\r\n            creativeImage: selectedEntity,\r\n            index: index\r\n        };\r\n    }\r\n\r\n    /** Logic invoked when next page of data is required.\r\n     *  Don't disable search button when loading more entities. That's why we don't fire the searchOperationActions in this method.\r\n     * @method\r\n     * @param {IActionDispatchCancellationToken} cancellationToken - this is the token associated with the initial search\r\n     * @param {number} startIndex - The start index\r\n     * @param {number} endIndex - The end index\r\n     * @param {React.SyntheticEvent<any>| CustomEvent} event- The event that triggered this handler\r\n     */\r\n    private onPageNavigation(cancellationToken: IActionDispatchCancellationToken, startIndex: number, endIndex: number, event: React.SyntheticEvent<any> | CustomEvent): void {\r\n        let actionInput: { [key: string]: string; } = merge(\r\n            {\r\n                \"startIndex\": startIndex.toString(),\r\n                \"endIndex\": endIndex.toString()\r\n            },\r\n            this.getSearchActionInput());\r\n\r\n        let pageActionData = this.creativeSearchBootstrapper.getPageActionData(actionInput);\r\n\r\n        this.instrumentationClient.UserActivityTrackingService.logPageActionEvent(\r\n            this.instrumentationClient.createEventData(event, \"pageNavigator\", null, \"pageNavigator-Button\", AreaOfPage.creativeResultsView),\r\n            PageNames.Creative,\r\n            this.creativeSearchActionCreator.SearchActivity ? this.creativeSearchActionCreator.SearchActivity.correlationVector : undefined,\r\n            pageActionData);\r\n\r\n        let state = this.getCurrentState();\r\n        let currentProviderSearchResult = state.providerImageSearchResults[state.currentSelectedProvider];\r\n        let continuationToken = currentProviderSearchResult.continuationToken;\r\n\r\n        // Load more data if more results are available and there is no ongoing request to fetch more data.\r\n        if (continuationToken.moreResultsAvailable && !ActionDispatchCancellationToken.isCancellationRequested(cancellationToken)) {\r\n            this.loadMoreData(cancellationToken, continuationToken, \"CreativeSearchPageBootstrapper.creativeSearchNextPageQuery\");\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Loads a new page of data.\r\n     * @method\r\n     * @param {IContinuationToken} continuationToken - The continuation token that is being used to get another page of data.\r\n     * @param {string} activityName - The telemetry activity name that will be used for this search.\r\n     */\r\n    private loadMoreData(cancellationToken: IActionDispatchCancellationToken, _continuationToken: IContinuationToken, activityName: string): void {\r\n        const state = this.getCurrentState();\r\n        let currentProviderSearchResult = state.providerImageSearchResults[state.currentSelectedProvider];\r\n        let nextPageQuery = this.createCreativeSearchQuery(state, !!currentProviderSearchResult.lastPageFetched ? (currentProviderSearchResult.lastPageFetched + 1) : 1);\r\n\r\n        const nextPageSearchActivity =\r\n            this.instrumentationClient.ActivityLoggingService.createActivity(\r\n                activityName,\r\n                this.creativeSearchActionCreator.SearchActivity,\r\n                { provider: nextPageQuery.provider } // Pass provider name as data so we can separate out search times by provider in reporting.\r\n                // This data is also passed with the EndActivity where it is really needed.\r\n            );\r\n\r\n        const nextPageSearchPromise = this.creativeSearchActionCreator.executeNextPageCreativeSearch(nextPageQuery, cancellationToken, nextPageSearchActivity);\r\n\r\n        nextPageSearchPromise.catch((error) => {\r\n            this.instrumentationClient.LoggingService.error(\r\n                activityName,\r\n                nextPageSearchActivity,\r\n                {\r\n                    provider: nextPageQuery.provider,\r\n                    error\r\n                });\r\n        });\r\n\r\n        PromiseExtension.onComplete(nextPageSearchPromise, () => this.instrumentationClient.ActivityLoggingService.endActivity(nextPageSearchActivity));\r\n    }\r\n\r\n    // Triggers loadMoreData when the scroll nears the end of the existing data\r\n    private loadMoreItemsOnScroll(imageTileCount: number, scrollParams: { clientHeight: number, scrollHeight: number, scrollTop: number }): void {\r\n        const state = this.getCurrentState();\r\n        const selectedProvider = state.providerImageSearchResults[state.currentSelectedProvider];\r\n        const { loading, serviceError } = selectedProvider;\r\n\r\n        // load a new page of data only when:\r\n        // - the clientHeight is finite (this can initially be called with a value of infinity)\r\n        // - the last load succeeded\r\n        // - the scroll threshold have been reached\r\n        // - there is not a page already being loaded\r\n        if (isFinite(scrollParams.clientHeight) &&\r\n            !serviceError &&\r\n            scrollParams.scrollTop > Math.floor(AppConstants.resultsBrowsing.scrollbarThresholdPercentage.creative * (scrollParams.scrollHeight - scrollParams.clientHeight)) &&\r\n            !loading) {\r\n            const scrollEvent = new CustomEvent(\"onCreativeSearchScrollDownThresholdExceeded\");\r\n            this.onPageNavigation(this.lastSearchCancellationToken, 0, imageTileCount - 1, scrollEvent);\r\n        }\r\n    }\r\n\r\n    // Helper method to build the image provider filter control\r\n    private buildImageProviderFilterOptions(selectedIndex: number[]): IFilterItemOptionsList {\r\n        return buildSingleSelectOptionsList(this.creativeFilterFields.providers.ruleName, this.creativeFilterFields.providers.values, selectedIndex, this.onSelectedProvidersChanged);\r\n    }\r\n\r\n    // Helper method to build the orientations filter control\r\n    private buildOrientationsFilterOptions(currentProvider: string, selectedIndexes: number[]): IFilterItemOptionsList {\r\n        const orientationFilterData = this.creativeFilterFields.creativeProviderFilterData[currentProvider].orientations;\r\n        if (orientationFilterData.selectionMode === FilterRuleSelectionMode.MultiSelect) {\r\n            return buildMultiSelectOptionsList(orientationFilterData.ruleName, orientationFilterData.values, selectedIndexes, this.onSelectedOrientationsChanged);\r\n        } else {\r\n            return buildSingleSelectOptionsList(orientationFilterData.ruleName, orientationFilterData.values, selectedIndexes, this.onSelectedOrientationsChanged);\r\n        }\r\n    }\r\n\r\n    // Helper method to build the image style filter control\r\n    private buildImageStyleFilterOptions(currentProvider: string, selectedIndexes: number[]): IFilterItemOptionsList {\r\n        const imageStyleFilterData = this.creativeFilterFields.creativeProviderFilterData[currentProvider].imageStyle;\r\n        if (imageStyleFilterData.selectionMode === FilterRuleSelectionMode.MultiSelect) {\r\n            return buildMultiSelectOptionsList(imageStyleFilterData.ruleName, imageStyleFilterData.values, selectedIndexes, this.onSelectedImageStyleChanged);\r\n        } else {\r\n            return buildSingleSelectOptionsList(imageStyleFilterData.ruleName, imageStyleFilterData.values, selectedIndexes, this.onSelectedImageStyleChanged);\r\n        }\r\n    }\r\n\r\n    // Callback for filter options visibility changed\r\n    private onFilterOptionsVisibilityChanged(): void {\r\n        this.collapsibleActions.ToggleCollapsible.getActionSender(this.store)();\r\n    }\r\n\r\n    // Callback when there's a change to the set of selected providers\r\n    private onSelectedProvidersChanged(selectedIndex: number[], event: React.SyntheticEvent<any>): void {\r\n        const currentProviderSelectedIndex = selectedIndex.length > 0 ? selectedIndex[0] : 0;\r\n        const selectedProvider: CreativeProvider = this.creativeFilterFields.providers.values[currentProviderSelectedIndex].value as CreativeProvider;\r\n        this.creativeSearchActions.SetProvider.getActionSender(this.store)(selectedProvider);\r\n\r\n        this.saveQueryFilterSelectionToProfile(selectedProvider);\r\n\r\n        this.providersListItemSelectorActions.SelectionChanged.getActionSender(this.store)(selectedIndex);\r\n        const currentState = this.getCurrentState();\r\n        const currentSearchText = currentState.entitySearchState.searchText;\r\n        const prevSearchResults = currentState.providerImageSearchResults[currentState.currentSelectedProvider].pagedSearchResults;\r\n        const currentSelectedSortIndex = currentState.selectedSortOrder.selectedItems[0];\r\n        const currentSortOrderName = CreativeSortOrderOptions[currentSelectedSortIndex].value;\r\n        let prevSortorder = undefined;\r\n        let prevSearchText = undefined;\r\n        if (!!prevSearchResults && !!prevSearchResults[1]) {\r\n            prevSearchText = prevSearchResults[1].query.searchPhrase;\r\n            prevSortorder = prevSearchResults[1].query.sort;\r\n        }\r\n\r\n        // Below logic checks if the search text has change since the last search executed for the current selected provider. If the results are avaialble then\r\n        // we want to render the existing results.\r\n        if (currentState.hasSearchExecutedOnce) {\r\n            if (currentSearchText !== prevSearchText || currentSortOrderName !== prevSortorder) {\r\n                this.onSearchInvoked(\"providers\", \"Radio\", event);\r\n            }\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Callback which is invoked when the user switches the display mode.\r\n     * @param resultsDisplayMode {ResultsDisplayModeEnum} the display mode\r\n     * @method\r\n     */\r\n    private onDisplayModeChanged(resultsDisplayMode: ResultsDisplayModeEnum): void {\r\n        let creativeResultView = Global.userProfile.creativeResultView || {};\r\n        creativeResultView[\"displayMode\"] = resultsDisplayMode;\r\n        ccsdk.userProfileManagers.prose.setSetting(\"creativeResultView\", creativeResultView);\r\n\r\n        this.creativeSearchActions.SetResultsDisplayMode.getActionSender(this.store)(resultsDisplayMode);\r\n    }\r\n\r\n    // Callback when there's a change to the set of selected orientations\r\n    private onSelectedOrientationsChanged(selectedIndices: number[], event: React.SyntheticEvent<any>): void {\r\n        let currentProvider = this.getCurrentState().currentSelectedProvider;\r\n        let imageOrientations: IFilterItemOptionsList = this.buildOrientationsFilterOptions(currentProvider, selectedIndices);\r\n        this.saveQueryFilterSelectionToProfile(currentProvider, imageOrientations);\r\n\r\n        this.orientationsListItemSelectorActions.SelectionChanged.getActionSender(this.store)(selectedIndices);\r\n        const control = currentProvider === CreativeProvider.Getty ? \"Checkbox\" : \"Radio\";\r\n        this.onSearchInvoked(\"orientations\", control, event);\r\n    }\r\n\r\n    // Callback when there's a change to the set of selected orientations\r\n    private onSelectedImageStyleChanged(selectedIndices: number[], event: React.SyntheticEvent<any>): void {\r\n        let currentProvider = this.getCurrentState().currentSelectedProvider;\r\n        let imageStyle: IFilterItemOptionsList = this.buildImageStyleFilterOptions(currentProvider, selectedIndices);\r\n        this.saveQueryFilterSelectionToProfile(currentProvider, imageStyle);\r\n\r\n        this.imageStyleListItemSelectorActions.SelectionChanged.getActionSender(this.store)(selectedIndices);\r\n        const control = currentProvider === CreativeProvider.Getty ? \"Checkbox\" : \"Radio\";\r\n        this.onSearchInvoked(\"ImageStyles\", control, event);\r\n    }\r\n\r\n    // Callback when the sort order changes\r\n    private onSelectedSortOrderChanged(selectedOrder: number, event: React.SyntheticEvent<any>): void {\r\n        let creativeResultView = Global.userProfile.creativeResultView || {};\r\n        creativeResultView[\"sortOrder\"] = CreativeSortOrderOptions[selectedOrder].displayName;\r\n        ccsdk.userProfileManagers.prose.setSetting(\"creativeResultView\", creativeResultView);\r\n        this.sortOrderListItemSelectorActions.SelectionChanged.getActionSender(this.store)([selectedOrder]);\r\n\r\n        this.onSearchInvoked(\"sortBy\", \"Dropdown\", event);\r\n    }\r\n\r\n    /**\r\n     * Logic invoked when a Search is Executed.\r\n     * @param {string} control - Identifier for the control that has instigated the search. Used as the element title in the event data when creating the telemetry.\r\n     * @param {string} controlType - The type of the control that has instigated the search. This, combined with control, forms the elementId in the event data when creating the telemetry.\r\n     * @param {React.SyntheticEvent<any>} event - The event that triggered the handler.\r\n     * @method\r\n     */\r\n    private onSearchInvoked(control: string, controlType: string, event: React.SyntheticEvent<any>): void {\r\n        Actions.Creative.SearchResultsScrollPositionActions.SaveScrollPosition.getActionSender(this.store)(0);\r\n        this.lastSearchCancellationToken = this.creativeSearchBootstrapper.onSearchInvoked(control, controlType, event);\r\n    }\r\n\r\n    /**\r\n     * Parses through the filter collection and returns the selected filter options.\r\n     * @param sourceData {IFilterRuleDefinitionBase} The source data for filter\r\n     * @param selectedIndices {number[]} selected indices\r\n     * @method\r\n     * @returns { ICreativeSearchQuery } The build query\r\n     */\r\n    private selectProviderFilters<T extends ImageOrientation | CreativeImageStyle | CreativeImageLicenseType>(\r\n        sourceData: IFilterRuleDefinitionBase,\r\n        selectedIndices: number[]): T[] {\r\n\r\n        const filterCollection = selectedIndices\r\n            .filter(index => index >= 0 && index < sourceData.values.length && !!sourceData.values[index].value)\r\n            .map(index => sourceData.values[index].value as T);\r\n\r\n        return filterCollection;\r\n    }\r\n\r\n    /**\r\n     * Logic invoked when a Clear Search is Executed.\r\n     * @method\r\n     */\r\n    private onClearSearch(): void {\r\n        this.entitySearchActions.ClearSearch.getActionSender(this.store)();\r\n    }\r\n\r\n    /**\r\n     * Creates Image Url to share\r\n     * @param event {React.SyntheticEvent<any>} the event which triggered this handler\r\n     * @method\r\n     */\r\n    private generateImageLink(event: React.SyntheticEvent<any>): void {\r\n        const state = this.getCurrentState();\r\n        const selectedImage = state.selectedImageEntity;\r\n        this.imageCommandActions.ImageIngestionInProgress.getActionSender(this.store)(selectedImage.id);\r\n        this.instrumentationClient.UserActivityTrackingService.logPageActionEvent(\r\n            this.instrumentationClient.createEventData(event, \"ImagePreviewmodal\", null, \"imagepreview-getLink\", AreaOfPage.searchAndSelectResultsView),\r\n            PageNames.Creative,\r\n            this.creativeSearchActionCreator.SearchActivity.correlationVector,\r\n            this.creativeSearchBootstrapper.getPageActionData(this.getSelectActionInput(selectedImage, state.selectedImageEntityIndex)));\r\n\r\n        const logData = { entityId: selectedImage.id, provider: state.currentSelectedProvider, pageName: PageNames.Creative, action: \"getlink\" };\r\n        const creativeImageIngestActivity = this.instrumentationClient.ActivityLoggingService.createActivity(\r\n            \"creativeImageIngestion\",\r\n            this.creativeSearchActionCreator.SearchActivity,\r\n            logData);\r\n\r\n        const imageIngestionPromise = this.imageAcquisitionManager.ingestImage(\r\n            state.currentSelectedProvider,\r\n            selectedImage.id,\r\n            selectedImage.previewImageUrl,\r\n            selectedImage.id,\r\n            AssetFamily.creative).then((cmsImageId) => {\r\n                this.imageCommandActions.ImageIngestionCompleted.getActionSender(this.store)(selectedImage.id, cmsImageId);\r\n            }).catch((error: IErrorResponse) => {\r\n                this.instrumentationClient.LoggingService.error(\"Error occurred while ingesting image\", creativeImageIngestActivity, logData, this.creativeSearchActionCreator.SearchActivity.correlationVector);\r\n                this.imageCommandActions.ImageIngestionFailed.getActionSender(this.store)(selectedImage.id, error);\r\n            });\r\n\r\n        PromiseExtension.onComplete(imageIngestionPromise, () => this.instrumentationClient.ActivityLoggingService.endActivity(creativeImageIngestActivity));\r\n    }\r\n\r\n    /**\r\n     * download image function\r\n     * @param event {Event} the event which triggered this handler\r\n     * @method\r\n     */\r\n    private downloadImage(event: React.SyntheticEvent<any>): void {\r\n\r\n        this.instrumentationClient.UserActivityTrackingService.logPageActionEvent(\r\n            this.instrumentationClient.createEventData(event, \"download\", null, \"download-Button\", AreaOfPage.creativeImagePreviewModal),\r\n            PageNames.Creative,\r\n            this.creativeSearchActionCreator.SearchActivity.correlationVector,\r\n            this.creativeSearchBootstrapper.getPageActionData(this.getDownloadActionInput(this.getCurrentState().selectedImageEntity)));\r\n\r\n        const provider = this.getCurrentState().currentSelectedProvider;\r\n        const downloadActivity = this.instrumentationClient.ActivityLoggingService.createActivity(\r\n            \"CreativeSearchPageBootstrapper.downloadImage\",\r\n            this.creativeSearchActionCreator.SearchActivity,\r\n            { provider } // Pass provider name as data so we can separate out download times by provider in reporting.\r\n            // This data is also passed with the EndActivity where it is really needed.\r\n        );\r\n\r\n        const downloadImagePromise = this.imageCommandActionCreator.downloadCreativeImage(this.getCurrentState().selectedImageEntity.id, this.getCurrentState().currentSelectedProvider, downloadActivity);\r\n\r\n        downloadImagePromise.catch((error) => {\r\n            this.instrumentationClient.LoggingService.error(\r\n                \"CreativeSearchPageBootstrapper.downloadImage\",\r\n                downloadActivity,\r\n                {\r\n                    provider,\r\n                    error\r\n                });\r\n        });\r\n\r\n        PromiseExtension.onComplete(downloadImagePromise, () => this.instrumentationClient.ActivityLoggingService.endActivity(downloadActivity));\r\n    }\r\n\r\n    /**\r\n     * Get the action input data for image download\r\n     * @method\r\n     * @returns { { [key: string]: string; } } The action input\r\n     */\r\n    private getDownloadActionInput(creativeImage: ICreativeImage): { [key: string]: string; } {\r\n\r\n        let actionInput: { [key: string]: string; } = {};\r\n\r\n        const provider = this.getCurrentState().currentSelectedProvider;\r\n\r\n        if (!!creativeImage) {\r\n            actionInput = {\r\n                \"id\": creativeImage.id,\r\n                \"sourceId\": creativeImage.id,\r\n                \"providerName\": provider\r\n            };\r\n        }\r\n\r\n        return actionInput;\r\n    }\r\n\r\n    /**\r\n     * Get the action input data for Search\r\n     * @method\r\n     * @returns { { [key: string]: string; } } The action input\r\n     */\r\n    private getSearchActionInput(): { [key: string]: string; } {\r\n        const currentState = this.getCurrentState();\r\n        const searchText = currentState.entitySearchState.searchText;\r\n        const selectFilters = currentState.providerImageSearchFilters[currentState.currentSelectedProvider];\r\n        const filterData = this.creativeFilterFields.creativeProviderFilterData[currentState.currentSelectedProvider];\r\n\r\n        const selectedProviders = currentState.currentSelectedProvider;\r\n        const selectedOrientations: ImageOrientation[] = this.selectProviderFilters<ImageOrientation>(filterData.orientations, selectFilters.selectedOrientations.selectedItems);\r\n        const selectedImageStyles: CreativeImageStyle[] = this.selectProviderFilters<CreativeImageStyle>(filterData.imageStyle, selectFilters.selectedImageStyle.selectedItems);\r\n        let selectedSortOrderDisplayString: CreativeImageSort = CreativeImageSort.newest;\r\n\r\n        if (currentState.selectedSortOrder.selectedItems.length > 0) {\r\n            const selectedIndex = currentState.selectedSortOrder.selectedItems[0];\r\n            selectedSortOrderDisplayString = CreativeSortOrderOptions[selectedIndex].value as CreativeImageSort;\r\n        }\r\n\r\n        const actionInput: { [key: string]: string; } = {\r\n            \"searchTerm\": searchText,\r\n            \"providersFilter\": JSON.stringify(selectedProviders),\r\n            \"orientationsFilter\": JSON.stringify(selectedOrientations),\r\n            \"imageStyleFilter\": JSON.stringify(selectedImageStyles),\r\n            \"sortOrder\": selectedSortOrderDisplayString\r\n        };\r\n\r\n        return actionInput;\r\n    }\r\n\r\n    /**\r\n     * Builds the creative search query\r\n     * @param state {ICreativeImageSearchState} The current state\r\n     * @param pageToFetch {number} page to fetch\r\n     * @method\r\n     * @returns { ICreativeSearchQuery } The build query\r\n     */\r\n    private createCreativeSearchQuery(state: ICreativeImageSearchState, pageToFetch?: number): ICreativeSearchQuery {\r\n        const currentProvider = state.currentSelectedProvider;\r\n        const queryText = state.entitySearchState.searchText;\r\n        const selectFilters = state.providerImageSearchFilters[currentProvider];\r\n        const filterData = this.creativeFilterFields.creativeProviderFilterData[currentProvider];\r\n\r\n        const orientationFilter: ImageOrientation[] = this.selectProviderFilters<ImageOrientation>(filterData.orientations, selectFilters.selectedOrientations.selectedItems);\r\n        const imageStyleFilter: CreativeImageStyle[] = this.selectProviderFilters<CreativeImageStyle>(filterData.imageStyle, selectFilters.selectedImageStyle.selectedItems);\r\n\r\n        let sortOption: CreativeImageSort = CreativeImageSort.newest;\r\n\r\n        if (state.selectedSortOrder.selectedItems.length > 0) {\r\n            const selectedIndex = state.selectedSortOrder.selectedItems[0];\r\n            sortOption = CreativeSortOrderOptions[selectedIndex].value as CreativeImageSort;\r\n        }\r\n\r\n        let query = CreativeSearchQueryBuilder.forProvider(currentProvider)\r\n            .search(queryText)\r\n            .sortBy(sortOption)\r\n            .page(pageToFetch || 1)\r\n            .pageSize(100);\r\n\r\n        if (imageStyleFilter.length > 0) {\r\n            query = query.filterByStyle(imageStyleFilter);\r\n        }\r\n\r\n        if (orientationFilter.length > 0) {\r\n            query = query.filterByOrientation(orientationFilter);\r\n        }\r\n\r\n        if (currentProvider === CreativeProvider.Getty) {\r\n            query = query.select([\r\n                GettyCreativeImageSelect.caption,\r\n                GettyCreativeImageSelect.title,\r\n                GettyCreativeImageSelect.date_created,\r\n                GettyCreativeImageSelect.graphical_style,\r\n                GettyCreativeImageSelect.copyright,\r\n                GettyCreativeImageSelect.allowed_use,\r\n                GettyCreativeImageSelect.artist,\r\n                GettyCreativeImageSelect.thumb,\r\n                GettyCreativeImageSelect.orientation,\r\n                GettyCreativeImageSelect.license_model,\r\n                GettyCreativeImageSelect.max_dimensions,\r\n                GettyCreativeImageSelect.uri]);\r\n            query.filterByLicenseModel([CreativeImageLicenseType.royaltyFree]);\r\n        } else {\r\n            query.filterByLicenseModel([CreativeImageLicenseType.commercial]);\r\n        }\r\n\r\n        return query.build();\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { CreativeImageLicenseType } from \"clientcore-catalyst-businesslogic/creativeSearch/CreativeImageLicenseType\";\r\nimport { CreativeImageStyle } from \"clientcore-catalyst-businesslogic/creativeSearch/CreativeImageStyle\";\r\nimport { CreativeProvider } from \"clientcore-catalyst-businesslogic/creativeSearch/CreativeProvider\";\r\nimport { FieldType } from \"../../models/fieldType/FieldTypeEnum\";\r\nimport { FilterRuleSelectionMode } from \"../../models/filterRules/FilterRuleSelectionMode\";\r\nimport { IFilterRuleDefinitionBase } from \"../../models/filterRules/IFilterRuleDefinitionBase\";\r\nimport { ImageOrientation } from \"cms-models/ImageOrientation\";\r\nimport { ImageStyle } from \"cms-models/ImageStyle\";\r\nimport { LicenseType } from \"clientcore-models-catalyst/LicenseType\";\r\n\r\n/**\r\n * Rules for the different fields on which the user can filter.\r\n * @interface\r\n */\r\ninterface ICreativeProviderFilterData {\r\n    orientations: IFilterRuleDefinitionBase;\r\n    license: IFilterRuleDefinitionBase;\r\n    imageStyle: IFilterRuleDefinitionBase;\r\n}\r\n\r\n/**\r\n * Rules for the different fields on which the user can filter.\r\n * @interface\r\n */\r\ninterface ICreativeFilterData {\r\n    providers: IFilterRuleDefinitionBase;\r\n    creativeProviderFilterData: { [providerName: string]: ICreativeProviderFilterData };\r\n}\r\n\r\n/**\r\n * Method to create the data defining the rules on which we currently filter\r\n * @method\r\n */\r\nfunction createCreativeFilterData(): ICreativeFilterData {\r\n    let creativeFilterData: ICreativeFilterData = {\r\n        providers: {\r\n            ruleName: \"Source\",\r\n            fieldType: FieldType.StringField,\r\n            selectionMode: FilterRuleSelectionMode.MultiSelect,\r\n            values: [\r\n                { displayString: CreativeProvider.Getty, value: CreativeProvider.Getty },\r\n                { displayString: CreativeProvider.ShutterStock, value: CreativeProvider.ShutterStock }\r\n            ]\r\n        },\r\n        creativeProviderFilterData: {}\r\n    };\r\n    creativeFilterData.creativeProviderFilterData[CreativeProvider.Getty] = {\r\n        orientations: {\r\n            ruleName: \"Orientations\",\r\n            fieldType: FieldType.StringField,\r\n            selectionMode: FilterRuleSelectionMode.MultiSelect,\r\n            values:\r\n            [\r\n                {\r\n                    displayString: \"Portrait\",\r\n                    value: ImageOrientation.vertical\r\n                },\r\n                {\r\n                    displayString: \"Landscape\",\r\n                    value: ImageOrientation.horizontal\r\n                },\r\n                {\r\n                    displayString: \"Square\",\r\n                    value: ImageOrientation.square\r\n                },\r\n                {\r\n                    displayString: \"Panoramic Horizontal\",\r\n                    value: ImageOrientation.panoramicHorizontal\r\n                },\r\n                {\r\n                    displayString: \"Panoramic Vertical\",\r\n                    value: ImageOrientation.panoramicVertical\r\n                }\r\n            ]\r\n        },\r\n        license: {\r\n            ruleName: \"License\",\r\n            fieldType: FieldType.StringField,\r\n            selectionMode: FilterRuleSelectionMode.MultiSelect,\r\n            values: [\r\n                {\r\n                    displayString: \"Royalty Free\",\r\n                    value: LicenseType.royaltyFree\r\n                },\r\n                {\r\n                    displayString: \"Rights Managed\",\r\n                    value: LicenseType.rightsManaged\r\n                }\r\n            ]\r\n        },\r\n        imageStyle: {\r\n            ruleName: \"Style\",\r\n            fieldType: FieldType.StringField,\r\n            selectionMode: FilterRuleSelectionMode.MultiSelect,\r\n            values: [\r\n                {\r\n                    displayString: \"Photo\",\r\n                    value: ImageStyle.photo\r\n                },\r\n                {\r\n                    displayString: \"Illustration\",\r\n                    value: ImageStyle.illustration\r\n                },\r\n                {\r\n                    displayString: \"Fine Art\",\r\n                    value: ImageStyle.fineArt\r\n                }\r\n            ]\r\n        }\r\n    };\r\n\r\n    creativeFilterData.creativeProviderFilterData[CreativeProvider.ShutterStock] = {\r\n        orientations: {\r\n            ruleName: \"Orientations\",\r\n            fieldType: FieldType.StringField,\r\n            selectionMode: FilterRuleSelectionMode.SingleSelect,\r\n            values:\r\n            [\r\n                {\r\n                    displayString: \"All\",\r\n                    value: \"\"\r\n                },\r\n                {\r\n                    displayString: \"Portrait\",\r\n                    value: ImageOrientation.vertical\r\n                },\r\n                {\r\n                    displayString: \"Landscape\",\r\n                    value: ImageOrientation.horizontal\r\n                }\r\n            ]\r\n        },\r\n        license: {\r\n            ruleName: \"License\",\r\n            fieldType: FieldType.StringField,\r\n            selectionMode: FilterRuleSelectionMode.SingleSelect,\r\n            values: [\r\n                {\r\n                    displayString: \"All\",\r\n                    value: \"\"\r\n                },\r\n                {\r\n                    displayString: \"Commerical\",\r\n                    value: CreativeImageLicenseType.commercial\r\n                },\r\n                {\r\n                    displayString: \"Editorial\",\r\n                    value: CreativeImageLicenseType.editorial\r\n                },\r\n                {\r\n                    displayString: \"Enhanced\",\r\n                    value: CreativeImageLicenseType.enhanced\r\n                },\r\n                {\r\n                    displayString: \"Sensitive\",\r\n                    value: CreativeImageLicenseType.sensitive\r\n                }\r\n            ]\r\n        },\r\n        imageStyle: {\r\n            ruleName: \"Style\",\r\n            fieldType: FieldType.StringField,\r\n            selectionMode: FilterRuleSelectionMode.SingleSelect,\r\n            values: [\r\n                {\r\n                    displayString: \"All\",\r\n                    value: \"\"\r\n                },\r\n                {\r\n                    displayString: \"Photo\",\r\n                    value: CreativeImageStyle.photo\r\n                },\r\n                {\r\n                    displayString: \"Illustration\",\r\n                    value: CreativeImageStyle.illustration\r\n                },\r\n                {\r\n                    displayString: \"Vector\",\r\n                    value: CreativeImageStyle.vector\r\n                }\r\n            ]\r\n        }\r\n    };\r\n\r\n    return creativeFilterData;\r\n}\r\n\r\nexport { createCreativeFilterData as CreateCreativeFilterData, ICreativeFilterData, ICreativeProviderFilterData };","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { findIndex, isEmpty, isNil } from \"lodash-es\";\r\n\r\nimport { AppConstants } from \"../../AppConstants\";\r\nimport { ICatalystFileDataMetadata } from \"clientcore-models-catalyst/ICatalystFileDataMetadata\";\r\nimport { IEntityWithMetadata } from \"cms-businesslogic/entity/IEntityWithMetadata\";\r\nimport { IImageFileData } from \"cms-models/IImageFileData\";\r\nimport { IProvider } from \"../../models/provider/IProvider\";\r\nimport { ResultsDisplayModeEnum } from \"../../models/displayMode/ResultsDisplayModeEnum\";\r\nimport { appConfig } from \"appConfig\";\r\n\r\n/**\r\n * Get the action input data for image selection\r\n * @param entity { IImageFileData<ICatalystFileDataMetadata> } The entity for which we want the associated info\r\n * @param entityOrder {number} index at which the entity is present in the collection\r\n * @param filterPaneCollapsed {boolean} indicates if filter pane is open or closed\r\n * @param resultsDisplayMode {ResultsDisplayModeEnum} result Display mode used to render the result\r\n * @method\r\n * @returns { { [key: string]: string; } } The action input\r\n */\r\n// tslint:disable-next-line:ext-variable-name\r\nexport function GetSelectActionInput(entityWithMetadata: IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>>, entityOrder: number, filterPaneCollapsed: boolean, resultsDisplayMode: ResultsDisplayModeEnum): { [key: string]: string; } {\r\n\r\n    let actionInput: { [key: string]: string; } = {};\r\n\r\n    if (!!entityWithMetadata) {\r\n\r\n        const entity = entityWithMetadata.entity;\r\n\r\n        if (isNil(entity._id) || isEmpty(entity._id)) {\r\n            let code: string = entityWithMetadata.entity.hasOwnProperty(\"Code\") ? entityWithMetadata.entity.Code : \"\";\r\n            let message: string = entityWithMetadata.entity.hasOwnProperty(\"Message\") ? entityWithMetadata.entity.Code : \"\";\r\n            actionInput = {\r\n                \"id\": entityWithMetadata.metadata.documentId,\r\n                \"code\": code,\r\n                \"message\": message,\r\n                \"filterPaneVisibleState\": filterPaneCollapsed ? \"collapsed\" : \"expanded\",\r\n                \"resultsDisplayMode\": ResultsDisplayModeEnum[resultsDisplayMode]\r\n            };\r\n        } else {\r\n            let aspectRatio: string = \"\";\r\n\r\n            if (!!entity.width && !!entity.height) {\r\n                // Round aspect ratio to 2 decimal places\r\n                aspectRatio = (Math.round((100 * entity.width / entity.height)) / 100).toString();\r\n            }\r\n\r\n            const providerName = GetProviderFromEntity(entity).name;\r\n\r\n            let ageOfImagesInDays: number = -1;\r\n            if (!isEmpty(entity.displayPublishedDateTime)) {\r\n                let dateImageTaken = new Date(entity.displayPublishedDateTime);\r\n\r\n                const nowTime = Date.now();\r\n                ageOfImagesInDays = Math.floor((nowTime - dateImageTaken.getTime()) / AppConstants.MillisecondsInADay);\r\n            }\r\n\r\n            actionInput = {\r\n                \"id\": entity._id,\r\n                \"order\": entityOrder.toString(),\r\n                \"providerName\": providerName,\r\n                \"orientation\": entity.orientation,\r\n                \"aspectRatio\": aspectRatio,\r\n                \"ageOfImageInDays\": ageOfImagesInDays.toString(),\r\n                \"filterPaneVisibleState\": filterPaneCollapsed ? \"collapsed\" : \"expanded\",\r\n                \"resultsDisplayMode\": ResultsDisplayModeEnum[resultsDisplayMode]\r\n            };\r\n        }\r\n    }\r\n\r\n    return actionInput;\r\n}\r\n\r\n/**\r\n * Get the action input data for image download\r\n * @param entity { IImageFileData<ICatalystFileDataMetadata> } The entity which we want to download\r\n * @method\r\n * @returns { { [key: string]: string; } } The action input\r\n */\r\n// tslint:disable-next-line:ext-variable-name\r\nexport function GetDownloadActionInput(entity: IImageFileData<ICatalystFileDataMetadata>): { [key: string]: string; } {\r\n\r\n    let actionInput: { [key: string]: string; } = {};\r\n\r\n    const provider = GetProviderFromEntity(entity);\r\n\r\n    if (!!entity) {\r\n        actionInput = {\r\n            \"id\": entity._id,\r\n            \"sourceId\": entity._name, // In Catalyst, _name is guaranteed by ingestion to hold the provider's id for the image\r\n            \"providerName\": provider.name,\r\n            \"providerDocumentId\": provider.id,\r\n            \"assetFamily\": entity.fileMetadata ? entity.fileMetadata.assetFamily || \"\" : \"\"\r\n        };\r\n    }\r\n\r\n    return actionInput;\r\n}\r\n\r\n/**\r\n * Helper method to find the provider information, stored in our app config, based on the provider info in the entity\r\n * @param entity { IImageFileData<ICatalystFileDataMetadata> } The entity for which we want the associated provider info\r\n * @method\r\n * @returns { IProvider } Provider information\r\n */\r\n// tslint:disable-next-line:ext-variable-name\r\nexport function GetProviderFromEntity(entity: IImageFileData<ICatalystFileDataMetadata>): IProvider {\r\n    let provider: IProvider = { id: \"\", name: \"\" };\r\n    if (!!entity._links && !isEmpty(entity._links.provider)) {\r\n        const providerIndex = findIndex<IProvider>(appConfig.providers, item => item.id === entity._links.provider[0].href);\r\n        provider = providerIndex >= 0 ? appConfig.providers[providerIndex] : provider;\r\n    }\r\n    return provider;\r\n}\r\n\r\n/**\r\n * Gets the enitity by id from search results\r\n * @param id {string} the entity id\r\n * @return the information about the entity and where it fits in the search order.\r\n * @method\r\n */\r\n// tslint:disable-next-line:ext-variable-name\r\nexport function GetEntityWithMetadataAndIndexFromSearchResult(id: string, entitiesList: IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>>[]): { entityWithMetadata: IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>>, index: number } {\r\n    let selectedEntityWithMetadata: IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>> = null;\r\n    let index: number = -1;\r\n\r\n    for (let i = 0; i < entitiesList.length; i++) {\r\n        if (entitiesList[i].metadata.documentId === id) {\r\n            selectedEntityWithMetadata = entitiesList[i];\r\n            index = i;\r\n            break;\r\n        }\r\n    }\r\n\r\n    return {\r\n        entityWithMetadata: selectedEntityWithMetadata,\r\n        index: index\r\n    };\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { AreaOfPage } from \"../../instrumentation/instrumentationConstants/InstrumentationConstants\";\r\nimport { GetDownloadActionInput } from \"../../instrumentation/helpers/InstrumentationHelper\";\r\nimport { IActivityLogItem } from \"clientcore-infrastructure-analytics/models/IActivityLogItem\";\r\nimport { ICatalystFileDataMetadata } from \"clientcore-models-catalyst/ICatalystFileDataMetadata\";\r\nimport { IImageFileData } from \"cms-models/IImageFileData\";\r\nimport { IInstrumentationClient } from \"../../instrumentation/instrumentationClient/IInstrumentationClient\";\r\nimport { IPageActionData } from \"clientcore-infrastructure-analytics/models/userActivityData/IPageActionData\";\r\nimport { PageActionData } from \"cms-businesslogic/instrumentation/PageActionData\";\r\n\r\nconst createDownloadActionInput = (selectedImageEntity: IImageFileData<ICatalystFileDataMetadata>, pageName: string): IPageActionData => {\r\n    return PageActionData.createFrom(null, GetDownloadActionInput(selectedImageEntity), null, null, null, null, pageName);\r\n};\r\n\r\nconst logDownloadActionEvent = (instrumentationClient: IInstrumentationClient, selectedImageEntity: IImageFileData<ICatalystFileDataMetadata>, pageName: string, searchActivity?: IActivityLogItem,  areaOfPage: string = AreaOfPage.ImagePreviewModal): void => {\r\n    return instrumentationClient.UserActivityTrackingService.logPageActionEvent(\r\n        instrumentationClient.createEventData(event, \"download\", null, \"download-Button\", areaOfPage),\r\n        pageName,\r\n        !!searchActivity ? searchActivity.correlationVector : null,\r\n        createDownloadActionInput(selectedImageEntity, pageName));\r\n};\r\n\r\nconst createDownloadActivity = (instrumentationClient: IInstrumentationClient, _selectedImageEntity: IImageFileData<ICatalystFileDataMetadata>, provider: string, activityName: string, searchActivity?: IActivityLogItem): IActivityLogItem => {\r\n    const downloadActivity = instrumentationClient.ActivityLoggingService.createActivity(\r\n        activityName,\r\n        searchActivity,\r\n        { provider }\r\n    );\r\n    return downloadActivity;\r\n};\r\n\r\nexport { createDownloadActionInput, logDownloadActionEvent, createDownloadActivity };","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { createDownloadActivity, logDownloadActionEvent } from \"./DownloadImageTelemetry\";\r\n\r\nimport { AreaOfPage } from \"../../instrumentation/instrumentationConstants/InstrumentationConstants\";\r\nimport { GetProviderFromEntity } from \"../../instrumentation/helpers/InstrumentationHelper\";\r\nimport { IActivityLogItem } from \"clientcore-infrastructure-analytics/models/IActivityLogItem\";\r\nimport { ICatalystFileDataMetadata } from \"clientcore-models-catalyst/ICatalystFileDataMetadata\";\r\nimport { IImageCommandActionCreator } from \"../../presentation-logic/dataflows/imageCommand/IImageCommandActionCreator\";\r\nimport { IImageDownloadInfo } from \"clientcore-catalyst-businesslogic/IImageDownloadInfo\";\r\nimport { IImageFileData } from \"cms-models/IImageFileData\";\r\nimport { IInstrumentationClient } from \"../../instrumentation/instrumentationClient/IInstrumentationClient\";\r\nimport { PromiseExtension } from \"cms-infrastructure/promise-extension/promise-extension\";\r\n\r\n/**\r\n * download image function\r\n * @param event {Event} the event which triggered this handler\r\n * @param selectedImageEntity {: IImageFileData<ICatalystFileDataMetadata>} Selected Image Entity\r\n * @param pageName {string} Name of the page\r\n * @param imageCommandActionCreator {IImageCommandActionCreator} the action creator to use for downloading the image\r\n * @param instrumentationClient {IInstrumentationClient} instrumentation client\r\n * @param activityName {string} name of the activity\r\n * @param searchActivity {IActivityLogItem} current activity to log\r\n * @param areaOfPage {string} The area of page from where the download is triggered\r\n * @method\r\n */\r\n// tslint:disable-next-line:ext-variable-name\r\nexport function DownloadImage(\r\n    _event: React.SyntheticEvent<any>,\r\n    selectedImageEntity: IImageFileData<ICatalystFileDataMetadata>,\r\n    pageName: string,\r\n    imageCommandActionCreator: IImageCommandActionCreator,\r\n    instrumentationClient: IInstrumentationClient,\r\n    activityName: string,\r\n    searchActivity?: IActivityLogItem,\r\n    progressEvent?: (progressEvent: ProgressEvent) => void,\r\n    downloadImageName?: string,\r\n    areaOfPage: string = AreaOfPage.ImagePreviewModal): Promise<IImageDownloadInfo> {\r\n\r\n    logDownloadActionEvent(instrumentationClient, selectedImageEntity, pageName, searchActivity, areaOfPage);\r\n\r\n    const provider = GetProviderFromEntity(selectedImageEntity).name;\r\n    const downloadActivity = createDownloadActivity(instrumentationClient, selectedImageEntity, provider, activityName, searchActivity);\r\n\r\n    const downloadImagePromise = imageCommandActionCreator.downloadImage(selectedImageEntity, downloadActivity, progressEvent, downloadImageName);\r\n\r\n    downloadImagePromise.catch((error) => {\r\n        instrumentationClient.LoggingService.error(\r\n            activityName,\r\n            downloadActivity,\r\n            {\r\n                provider,\r\n                error\r\n            });\r\n    });\r\n\r\n    PromiseExtension.onComplete(downloadImagePromise, () => instrumentationClient.ActivityLoggingService.endActivity(downloadActivity));\r\n    return downloadImagePromise;\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as QueryString from \"query-string\";\r\nimport * as URL from \"url-parse\";\r\n\r\nimport { appConfig } from \"appConfig\";\r\n\r\nimport { UrlExtension } from \"cms-ui-presentationlogic/imageResizing/UrlExtension\";\r\n\r\n/**\r\n * Adds image quality query param to the source href\r\n * @param url {string} the original url\r\n * @method\r\n */\r\nfunction addImageQualityQueryParamToUrl(urlToParse: string): string {\r\n    const url = UrlExtension.removeProtocol(urlToParse);\r\n    const sourceHrefParsed = URL(url);\r\n    const queryString = QueryString.parse(sourceHrefParsed.query);\r\n    queryString.q = appConfig.imageTileQuality;\r\n    sourceHrefParsed.set(\"query\", \"?\" + QueryString.stringify(queryString));\r\n    return sourceHrefParsed.toString();\r\n}\r\n\r\nexport { addImageQualityQueryParamToUrl as AddImageQualityQueryParamToUrl };","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nexport type ImageQualityThreshold = { dimension: number, message: string };\r\n\r\n/**\r\n * Image preivew constants\r\n * @class\r\n */\r\nexport class ImagePreviewConstants {\r\n    public static imageQualityUnknownMessage: string = \"Unknown\";\r\n\r\n    // Ensure that these remain in sorted order from highest to lowest\r\n    public static imageQualityThresholds: ImageQualityThreshold[] = [\r\n        {\r\n            dimension: 1800,\r\n            message: \"Large enough to feature anywhere.\"\r\n        },\r\n        {\r\n            dimension: 600,\r\n            message: \"Large enough to feature in most web positions, too small for app hero.\"\r\n        },\r\n        {\r\n            dimension: Number.NEGATIVE_INFINITY,\r\n            message: \"Too small to feature.\"\r\n        }\r\n    ];\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as URL from \"url-parse\";\r\n\r\nimport { AddImageQualityQueryParamToUrl } from \"../addImageQualityParamToUrl\";\r\nimport { AppConstants } from \"../../AppConstants\";\r\nimport { GetImageQualityMessage } from \"./GetImageQualityMessage\";\r\nimport { GetProviderFromEntity } from \"../../instrumentation/helpers/InstrumentationHelper\";\r\nimport { ICatalystFileDataMetadata } from \"clientcore-models-catalyst/ICatalystFileDataMetadata\";\r\nimport { IEntityWithMetadata } from \"cms-businesslogic/entity/IEntityWithMetadata\";\r\nimport { IImageFileData } from \"cms-models/IImageFileData\";\r\nimport { IImagePreviewModalProps } from \"../../rendering/components/imagePreviewModal/IImagePreviewModalProps\";\r\nimport { ILightboxManager } from \"../lightbox/ILightboxManager\";\r\nimport { ImagePreviewConstants } from \"./ImagePreviewConstants\";\r\nimport { Routes } from \"../../Routes\";\r\nimport { UrlExtension } from \"cms-ui-presentationlogic/imageResizing/UrlExtension\";\r\nimport { isNil, isEmpty } from \"lodash-es\";\r\n\r\n/**\r\n * Creates the Image Preview element properties\r\n * @param selectedImageEntityWithMetadata {IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>>} Selected Image Entity\r\n * @param showDownloadingMessage {boolean} indicates if download in progress message should be displayed\r\n * @param showFailedDownloadingMessage {boolean} indicates if failed download message should be displayed\r\n * @param downloadInProgress {boolean} indicates if this image is being downloaded\r\n * @param downloadEnabled {boolean} indicates if download should be enabled\r\n * @param displayVerticalLayout {boolean} display vertical layout flag\r\n * @param downloadImage {(event: React.SyntheticEvent<any>) => void} the download callback\r\n * @param isImageIngestionInProgress {boolean} Indicates that image ingestion is in progress\r\n * @param isImageLinkGenerationInProgress {boolean} true indicates that image generation is in progress\r\n * @param generateImageLinkInvoked {(event: React.SyntheticEvent<any>) => void} Callback to handle generating image link\r\n * @param onRemoveFromLightboxInvoked {(lightboxId: string, entityId: string, event: React.SyntheticEvent<any>) => void} Callback to handle removing image from lightbox\r\n * @param lastDownloadError {string} last Download error\r\n * @param isFailedImage {boolean} Indicates that ingestion service failed to update the image.\r\n */\r\n// tslint:disable-next-line:ext-variable-name\r\nexport function GetImagePreviewElementProps(\r\n    selectedImageEntityWithMetadata: IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>>,\r\n    showDownloadingMessage: boolean,\r\n    showFailedDownloadingMessage: boolean,\r\n    downloadInProgress: boolean,\r\n    downloadEnabled: boolean,\r\n    displayVerticalLayout: boolean,\r\n    downloadImage: (event: React.SyntheticEvent<any>) => void,\r\n    isImageIngestionInProgress: boolean,\r\n    generateImageLinkInvoked: (event: React.SyntheticEvent<any>) => void,\r\n    lastDownloadError?: string,\r\n    getLightboxManager?: () => ILightboxManager,\r\n    onRemoveFromLightboxInvoked?: (lightboxId: string, entityId: string, event: React.SyntheticEvent<any>) => void,\r\n    isFailedImage?: boolean\r\n): IImagePreviewModalProps {\r\n    if (isNil(selectedImageEntityWithMetadata) || isNil(selectedImageEntityWithMetadata.entity)) {\r\n        return null;\r\n    }\r\n\r\n    const entity = selectedImageEntityWithMetadata.entity;\r\n\r\n    // When there is more than one entity in a collection and some (or all) of those entities have been deleted in the CMS,\r\n    // we will still get an EWM in the response from entityManager.getLatestEntities and that will be held in the lightbox page's entitylist state.\r\n    // However, the contained entity does not have an ID, it has a Code and a Message.\r\n    // The entityId is held in the metadata documentId field\r\n    const isValidEntity = !isNil(entity._id) && !isEmpty(entity._id);\r\n    const errorCode = entity.hasOwnProperty(\"Code\") ? entity.Code : \"\";\r\n    let errorMessage = entity.hasOwnProperty(\"Message\") ? entity.Message : \"\";\r\n    const entityId = selectedImageEntityWithMetadata.metadata.documentId;\r\n    const isImageBeingProcessed = selectedImageEntityWithMetadata.entity[\"processedByIngestion\"] === false;\r\n\r\n    let sourceId = \"\";\r\n    let title = \"\";\r\n    let urlWithoutProtocol = \"\";\r\n    let sourceHref = \"\";\r\n    let lowQualtiySourceHref = \"\";\r\n    let caption = \"\";\r\n    let publishDate = \"\";\r\n    let width = AppConstants.thumbnailConfig.width;\r\n    let height = AppConstants.thumbnailConfig.height;\r\n    let providerName = \"\";\r\n    let altText = \"No Image\";\r\n    let footerMessage = \"\";\r\n    let qualityIndicatorMessage = \"\";\r\n    let restrictions: string[] = [];\r\n    let originalHeight = 0;\r\n    let originalWidth = 0;\r\n\r\n    if (isValidEntity) {\r\n        if (isImageBeingProcessed) {\r\n            downloadEnabled = false;\r\n            lowQualtiySourceHref = entity.fileMetadata.downloads && entity.fileMetadata.downloads.length > 0 ? entity.fileMetadata.downloads[0].sourceLocation : null;\r\n            if (isFailedImage) {\r\n                errorMessage = `There was a problem fetching your image '${selectedImageEntityWithMetadata.entity._name}'. Please remove it from your lightbox.`;\r\n            } else {\r\n                errorMessage = \"We are attempting to get your image from the provider, which can take a couple of minutes. Here’s some things you could do to pass the time: stretch; make a cup of tea; look for more images in Catalyst. Once you’re done, refreshing the page should show your image. \";\r\n            }\r\n        } else {\r\n            sourceId = entity._name; // In Catalyst, _name is guaranteed by ingestion to hold the provider's id for the image\r\n            title = entity.title;\r\n            urlWithoutProtocol = UrlExtension.removeProtocol(selectedImageEntityWithMetadata.entity.href);\r\n            sourceHref = URL(urlWithoutProtocol).toString();\r\n            lowQualtiySourceHref = AddImageQualityQueryParamToUrl(urlWithoutProtocol);\r\n            caption = entity.caption;\r\n            publishDate = entity.displayPublishedDateTime;\r\n            width = entity.width;\r\n            height = entity.height;\r\n            providerName = GetProviderFromEntity(entity).name;\r\n            altText = entity.altText;\r\n            footerMessage = showDownloadingMessage ?\r\n                \"Downloading image\" :\r\n                (showFailedDownloadingMessage ?\r\n                    \"Last download attempt for this image failed\" :\r\n                    \"\");\r\n\r\n            qualityIndicatorMessage = ImagePreviewConstants.imageQualityUnknownMessage;\r\n\r\n            // workaround to get restrictions from the fileMetadata. It's not present in the model but we are getting it from the data.\r\n            if (<any>(entity.fileMetadata).hasOwnProperty(\"restrictions\") && (<any>(entity.fileMetadata)[\"restrictions\"]).length > 0) {\r\n                restrictions = <any>(entity.fileMetadata)[\"restrictions\"];\r\n            }\r\n\r\n            if (!!entity.fileMetadata && entity.fileMetadata.downloads.length > 0) {\r\n                originalHeight = entity.fileMetadata.downloads[0].height || 0;\r\n                originalWidth = entity.fileMetadata.downloads[0].width || 0;\r\n                qualityIndicatorMessage = GetImageQualityMessage(entity.fileMetadata.downloads);\r\n            }\r\n        }\r\n    }\r\n\r\n    const props: IImagePreviewModalProps = {\r\n        visible: true,\r\n        entityId,\r\n        sourceId,\r\n        downloadImage,\r\n        lastDownloadError: (showFailedDownloadingMessage && !!lastDownloadError) ? lastDownloadError : \"\",\r\n        sourceHref,\r\n        lowQualtiySourceHref,\r\n        title,\r\n        caption,\r\n        publishDate,\r\n        width,\r\n        height,\r\n        providerName,\r\n        altText,\r\n        footerMessage,\r\n        errorCode,\r\n        errorMessage,\r\n        downloadInProgress,\r\n        downloadEnabled,\r\n        restrictions,\r\n        originalHeight,\r\n        originalWidth,\r\n        qualityIndicatorMessage,\r\n        displayVerticalLayout,\r\n        onRemoveFromLightboxInvoked,\r\n        getLightboxManager,\r\n        isImageLinkGenerationInProgress: isImageIngestionInProgress,\r\n        generateImageLinkInvoked,\r\n        imageLink: Routes.getImagePageRoutePathWithProtocol(entityId),\r\n        isImageBeingProcessed\r\n    };\r\n\r\n    return props;\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { isEmpty, isFinite } from \"lodash-es\";\r\n\r\nimport { IDownloadInfo } from \"clientcore-models-catalyst/IDownloadInfo\";\r\nimport { ImagePreviewConstants } from \"./ImagePreviewConstants\";\r\n\r\n/**\r\n * Identify the highest threshold the image download matches.\r\n * This assumes that the threshold information is a sorted array from highest to lowest.\r\n * Returns the message to show on the UI.\r\n * @method\r\n * @param downloadInfo { IDownloadInfo[] } The information about the entity to be downloaded.\r\n * @returns { string } A string representing the quality of the image\r\n */\r\n// tslint:disable-next-line:ext-variable-name\r\nexport function GetImageQualityMessage(downloadInfo: IDownloadInfo[]): string {\r\n\r\n    let qualityMessage = ImagePreviewConstants.imageQualityUnknownMessage;\r\n\r\n    if (!isEmpty(downloadInfo)) {\r\n        // Ignore any download information which doesn't have either a width or a height\r\n        const usableDownloadInfo = downloadInfo.filter(value => { return isFinite(value.width) || isFinite(value.height); });\r\n        if (!isEmpty(usableDownloadInfo)) {\r\n            let thresholdExceeded = false;\r\n            for (let i = 0; (i < ImagePreviewConstants.imageQualityThresholds.length) && !thresholdExceeded; i++) {\r\n                for (let j = 0; (j < usableDownloadInfo.length) && !thresholdExceeded; j++) {\r\n                    if ((isFinite(usableDownloadInfo[j].width) && usableDownloadInfo[j].width > ImagePreviewConstants.imageQualityThresholds[i].dimension) ||\r\n                        (isFinite(usableDownloadInfo[j].height) && usableDownloadInfo[j].height > ImagePreviewConstants.imageQualityThresholds[i].dimension)) {\r\n                        thresholdExceeded = true;\r\n                        qualityMessage = ImagePreviewConstants.imageQualityThresholds[i].message;\r\n                    }\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    return qualityMessage;\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { ActionMap } from \"cms-ui-redux/ActionMap\";\r\nimport { NamespacePrefixActionsDefinitionBase } from \"cms-ui-redux/NamespacePrefixActionsDefinitionBase\";\r\nimport { IEntityWithMetadata } from \"cms-businesslogic/entity/IEntityWithMetadata\";\r\nimport { IImageFileData } from \"cms-models/IImageFileData\";\r\nimport { ICatalystFileDataMetadata } from \"clientcore-models-catalyst/ICatalystFileDataMetadata\";\r\nimport { IEntityErrorResponse } from \"cms-businesslogic/entity/IEntityErrorResponse\";\r\n\r\nexport type ImageDetailsLoadingSignature = () => void;\r\nexport type ImageDetailsLoadingErrorSignature = (error: IEntityErrorResponse) => void;\r\nexport type ImageDetailsFetchedSignature = (imageWithMetadata: IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>>) => void;\r\n\r\n/**\r\n * Image details page actions\r\n * @class\r\n */\r\nexport class ImageDetailsPageActions extends NamespacePrefixActionsDefinitionBase {\r\n    private imageDetailsFetched: ActionMap<ImageDetailsFetchedSignature> = new ActionMap<ImageDetailsFetchedSignature>(this.namespace + \"ImageDetailsFetchedSignature\");\r\n    private imageDetailsLoading: ActionMap<ImageDetailsLoadingSignature> = new ActionMap<ImageDetailsLoadingSignature>(this.namespace + \"ImageDetailsLoadingSignature\");\r\n    private imageDetailsLoadingError: ActionMap<ImageDetailsLoadingErrorSignature> = new ActionMap<ImageDetailsLoadingErrorSignature>(this.namespace + \"ImageDetailsLoadingErrorSignature\");\r\n\r\n    /**\r\n     * @constructor\r\n     * @param namespacePrefix {string}\r\n     */\r\n    constructor(namespacePrefix?: string) {\r\n        super(\"ImagePreviewModalActions\", namespacePrefix);\r\n    }\r\n\r\n    /**\r\n     * Fetch image entity finished\r\n     */\r\n    public get ImageDetailsFetched(): ActionMap<ImageDetailsFetchedSignature> {\r\n        return this.imageDetailsFetched;\r\n    }\r\n\r\n    /**\r\n     * Fetch image is in progress\r\n     */\r\n    public get ImageDetailsLoading(): ActionMap<ImageDetailsLoadingSignature> {\r\n        return this.imageDetailsLoading;\r\n    }\r\n\r\n    /**\r\n     * Error occurred while fetching the image\r\n     */\r\n    public get ImageDetailsLoadingError(): ActionMap<ImageDetailsLoadingErrorSignature> {\r\n        return this.imageDetailsLoadingError;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { clone, cloneDeep } from \"lodash-es\";\r\n\r\nimport { ActionHandler } from \"cms-ui-redux/ActionHandler\";\r\nimport { IActionPayload } from \"cms-ui-redux/IActionPayload\";\r\nimport { ICatalystFileDataMetadata } from \"clientcore-models-catalyst/ICatalystFileDataMetadata\";\r\nimport { IEntityErrorResponse } from \"cms-businesslogic/entity/IEntityErrorResponse\";\r\nimport { IEntityWithMetadata } from \"cms-businesslogic/entity/IEntityWithMetadata\";\r\nimport { IImageDetailsPageState } from \"./IImageDetailsPageState\";\r\nimport { IImageFileData } from \"cms-models/IImageFileData\";\r\nimport { ImageCommandReduction } from \"../imageCommand/ImageCommandReduction\";\r\nimport { ImageDetailsPageActions } from \"./imageDetailsPageActions\";\r\nimport { NamespaceCheckReducerBase } from \"cms-ui-redux/NamespaceCheckReducerBase\";\r\n\r\n/**\r\n * Reducer for ImageDetailsPageReduction.\r\n * @class\r\n */\r\nexport class ImageDetailsPageReduction extends NamespaceCheckReducerBase<IImageDetailsPageState> {\r\n\r\n    /**\r\n     * Initializes a new instance of the `ImageCommandReduction` class.\r\n     * @param imageDetailsPageActions {ImageDetailsPageActions} Actions to handle\r\n     * @param imageCommandReduction {ImageCommandReduction} Reducer to handle the image commands\r\n     * @constructor\r\n     */\r\n    constructor(\r\n        private imageDetailsPageActions: ImageDetailsPageActions,\r\n        private imageCommandReduction: ImageCommandReduction) {\r\n        super([imageDetailsPageActions.namespace], [imageCommandReduction]);\r\n\r\n        if (!imageDetailsPageActions) {\r\n            throw \"The imageDetailsPageActions parameter is required.\";\r\n        }\r\n\r\n        if (!imageCommandReduction) {\r\n            throw \"The imageCommandReduction parameter is required.\";\r\n        }\r\n    }\r\n\r\n    /**\r\n     * @method\r\n     * @param state {IImageCommandState} The state to reduce\r\n     * @param actionPayload {IActionPayload} The payload to apply\r\n     * @returns {IImageCommandState} The new state.\r\n     */\r\n    public reduce(state: IImageDetailsPageState, actionPayload: IActionPayload): IImageDetailsPageState {\r\n        if (!state) {\r\n            throw \"The state parameter is required.\";\r\n        }\r\n\r\n        if (!actionPayload) {\r\n            throw \"The actionPayload parameter is required.\";\r\n        }\r\n\r\n        let newState = cloneDeep(state);\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.imageDetailsPageActions.ImageDetailsLoading, () => {\r\n                newState.isLoading = true;\r\n                newState.isInErrorState = false;\r\n                newState.error = null;\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.imageDetailsPageActions.ImageDetailsLoadingError, (error: IEntityErrorResponse) => {\r\n                newState.isLoading = false;\r\n                newState.isInErrorState = true;\r\n                newState.error = clone(newState.error);\r\n                newState.error = error;\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.imageDetailsPageActions.ImageDetailsFetched, (imageEntityWithMetadata: IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>>) => {\r\n                newState.entityWithMetadata = imageEntityWithMetadata;\r\n                newState.isLoading = false;\r\n                return newState;\r\n            });\r\n\r\n        if (this.imageCommandReduction.canReduce(actionPayload)) {\r\n            newState.imageCommandState = this.imageCommandReduction.reduce(newState.imageCommandState, actionPayload);\r\n        }\r\n\r\n        return newState;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { CreativeProvider } from \"clientcore-catalyst-businesslogic/creativeSearch/CreativeProvider\";\r\nimport { ErrorResponse } from \"clientcore-base-serviceclients/response/ErrorResponse\";\r\nimport { IActivityLogItem } from \"clientcore-infrastructure-analytics/models/IActivityLogItem\";\r\nimport { ICatalystFileDataMetadata } from \"clientcore-models-catalyst/ICatalystFileDataMetadata\";\r\nimport { IEntity } from \"cms-models/IEntity\";\r\nimport { IEntityWithMetadata } from \"cms-businesslogic/entity/IEntityWithMetadata\";\r\nimport { IErrorResponse } from \"clientcore-catalyst-businesslogic/IErrorResponse\";\r\nimport { IImageAcquisitionManager } from \"clientcore-catalyst-businesslogic/IImageAcquisitionManager\";\r\nimport { IImageFileData } from \"cms-models/IImageFileData\";\r\nimport { IInstrumentationClient } from \"../../instrumentation/instrumentationClient/IInstrumentationClient\";\r\nimport { IStore } from \"redux\";\r\nimport { ImageCommandActions } from \"../../presentation-logic/dataflows/imageCommand/ImageCommandActions\";\r\n\r\n/**\r\n * Gets the latest status of the unprocessed entity in state.\r\n * @method\r\n * @param {string} store - The redux store\r\n * @param {IEntityWithMetadata<IEntity>} unProcessedEntity - entity which is yet to be processed by Ingestion\r\n * @param {ImageCommandActions} imageCommandActions - The image command actions\r\n * @param {IImageAcquisitionManager} imageAcquisitionManager - The imageAcquisitionManager\r\n * @param {IInstrumentationClient} instrumentationClient - Provides support for instrumentation.\r\n * @param {string} methodName - The name of the method which called this function. This is used in logging the error message\r\n * @param {IActivityLogItem} parentActivity - The telemetry parent activity\r\n * @returns {Promise<any>}\r\n */\r\nexport function getLatestStatusOfUnProcessedEntity(\r\n    store: IStore<any>,\r\n    unProcessedEntity: IEntityWithMetadata<IEntity>,\r\n    imageCommandActions: ImageCommandActions,\r\n    imageAcquisitionManager: IImageAcquisitionManager,\r\n    instrumentationClient: IInstrumentationClient,\r\n    methodName: string,\r\n    parentActivity?: IActivityLogItem): Promise<any> {\r\n    const entity = unProcessedEntity.entity as IImageFileData<ICatalystFileDataMetadata>;\r\n    const sourceId = entity.sourceId;\r\n    const providerSource = sourceId.split(\"-\");\r\n    return new Promise((resolve, reject) => {\r\n        if (providerSource.length !== 2) {\r\n            const errorMessage = \"Provider image id and name is missing in the sourceId property of image: \" + entity._id;\r\n            instrumentationClient.LoggingService.error(methodName, parentActivity, errorMessage);\r\n            reject(errorMessage);\r\n        } else {\r\n            const providerName = providerSource[0] === \"getty\" ? CreativeProvider.Getty : CreativeProvider.ShutterStock;\r\n            const imageId = providerSource[1];\r\n            imageAcquisitionManager.ingestImage(providerName, imageId, entity.fileMetadata.downloads[0].sourceLocation).then((cmsId: string) => {\r\n                resolve(cmsId);\r\n            }).catch((errorResponse: IErrorResponse) => {\r\n                if (errorResponse.innerError instanceof ErrorResponse && errorResponse.innerError.responseStatus.status === 422) {\r\n                    imageCommandActions.ImageUpdateByIngestionFailed.getActionSender(store)([entity._id]);\r\n                } else {\r\n                    instrumentationClient.LoggingService.error(methodName, parentActivity, errorResponse);\r\n                }\r\n\r\n                reject(errorResponse);\r\n            });\r\n        }\r\n    });\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { DetermineModalLayout, GetImageDimensionToDetermineLayout } from \"../search/modalNavigation/ModalNavigationHelper\";\r\nimport { isEmpty, isNil } from \"lodash-es\";\r\n\r\nimport { AppConstants } from \"../../AppConstants\";\r\nimport { BusinessLogicFactory } from \"cms-businesslogic/factory/BusinessLogicFactory\";\r\nimport { ComponentBootstrapper } from \"cms-ui-views/ComponentBootstrapper\";\r\nimport { DownloadImage } from \"../imagePreviewModal/DownloadImage\";\r\nimport { GetImagePreviewElementProps } from \"../imagePreviewModal/GetImagePreviewProps\";\r\nimport { ICatalystFileDataMetadata } from \"clientcore-models-catalyst/ICatalystFileDataMetadata\";\r\nimport { IEntity } from \"cms-models/IEntity\";\r\nimport { IEntityErrorResponse } from \"cms-businesslogic/entity/IEntityErrorResponse\";\r\nimport { IEntityResponse } from \"cms-businesslogic/response/IEntityResponse\";\r\nimport { IEntityWithMetadata } from \"cms-businesslogic/entity/IEntityWithMetadata\";\r\nimport { IImageAcquisitionManager } from \"clientcore-catalyst-businesslogic/IImageAcquisitionManager\";\r\nimport { IImageCommandActionCreator } from \"../../presentation-logic/dataflows/imageCommand/IImageCommandActionCreator\";\r\nimport { IImageDetailsPageProps } from \"../../rendering/imageDetails/IImageDetailsPageProps\";\r\nimport { IImageDetailsPageState } from \"../../presentation-logic/dataflows/imageDetails/IImageDetailsPageState\";\r\nimport { IImageFileData } from \"cms-models/IImageFileData\";\r\nimport { IInstrumentationClient } from \"../../instrumentation/instrumentationClient/IInstrumentationClient\";\r\nimport { IReducer } from \"cms-ui-redux/IReducer\";\r\nimport { ImageCommandActionCreator } from \"../../presentation-logic/dataflows/imageCommand/ImageCommandActionCreator\";\r\nimport { ImageCommandActions } from \"../../presentation-logic/dataflows/imageCommand/ImageCommandActions\";\r\nimport { ImageCommandReduction } from \"../../presentation-logic/dataflows/imageCommand/ImageCommandReduction\";\r\nimport { ImageDetailsPageActions } from \"../../presentation-logic/dataflows/imageDetails/imageDetailsPageActions\";\r\nimport { ImageDetailsPageReduction } from \"../../presentation-logic/dataflows/imageDetails/ImageDetailsPageReduction\";\r\nimport { PageNames } from \"../../instrumentation/instrumentationConstants/InstrumentationConstants\";\r\nimport { PromiseExtension } from \"cms-infrastructure/promise-extension/PromiseExtension\";\r\nimport { ReduxBootstrapper } from \"cms-ui-views/ReduxBootstrapper\";\r\nimport { Types } from \"cms-models/Types\";\r\nimport { getLatestStatusOfUnProcessedEntity } from \"../lightbox/GetLatestStatusOfUnProcessedEntity\";\r\n\r\n/**\r\n * The bootstrapper that wires the <ImageDetailsPage /> component into Redux.\r\n * @class\r\n */\r\nexport class ImageDetailsPageBootstrapper<TParentState> extends ComponentBootstrapper<IImageDetailsPageState, IImageDetailsPageProps, TParentState> {\r\n\r\n    /** An instance of the `ImageCommandActionCreator` class.\r\n     * @type {IImageCommandActionCreator}\r\n     */\r\n    private imageCommandActionCreator: IImageCommandActionCreator;\r\n\r\n    /** An instance of the `ImageCommandActions` class.\r\n     * @type {ImageCommandActions}\r\n     */\r\n    private imageCommandActions: ImageCommandActions;\r\n\r\n    /** An instance of the `ImageDetailsPageActions` class.\r\n     * @type {ImageDetailsPageActions}\r\n     */\r\n    private imagePageActions: ImageDetailsPageActions;\r\n\r\n    /**\r\n     * Initializes a new instance of the 'ImageDetailsPageBootstrap' class.\r\n     * @constructor\r\n     * @param businessLogicFactory {BusinessLogicFactory} Used to construct business logic managers to use when interacting with the Catalyst (CATS) tenant.\r\n     * @param imageAcquisitionManager {IImageAcquisitionManager} Used to download the images.\r\n     * @param instrumentationClient {IInstrumentationClient} Provides support for instrumentation.\r\n     * @param parentBootstrapper {ComponentBootstrapper<TParentState, any, any>} The bootsrapper that contains this bootstrapper.\r\n     * @param stateSelector {function} A function that selects the state for this bootstrapper from the parent state.\r\n     * @param actionNamespacePrefix {string} Optional prefix to add to the namespace used to distinguish actions created by this bootstrapper.\r\n     */\r\n    constructor(\r\n        private businessLogicFactory: BusinessLogicFactory,\r\n        private imageAcquisitionManager: IImageAcquisitionManager,\r\n        private instrumentationClient: IInstrumentationClient,\r\n        parentBootstrapper?: ComponentBootstrapper<TParentState, any, any> | ReduxBootstrapper<TParentState>,\r\n        stateSelector?: (parentState: TParentState) => IImageDetailsPageState,\r\n        actionNamespacePrefix?: string) {\r\n        super(parentBootstrapper, stateSelector);\r\n        this.imageCommandActions = new ImageCommandActions(actionNamespacePrefix);\r\n        this.downloadImage = this.downloadImage.bind(this);\r\n        this.imagePageActions = new ImageDetailsPageActions(\"ImageDetails\");\r\n    }\r\n\r\n    /**\r\n     * Initializes the initial state of the component.\r\n     * @method\r\n     * @returns {IImageDetailsPageState} The initial state.\r\n     */\r\n    public getInitialState(): IImageDetailsPageState {\r\n        return {\r\n            entityWithMetadata: null,\r\n            isLoading: false,\r\n            imageCommandState: {\r\n                failedImages: [],\r\n                imagesDownloading: [],\r\n                lastDownloadError: null,\r\n                creativeImageIngestionState: {\r\n                    failedToUpdateImages: [],\r\n                    imageUpdateInProgress: [],\r\n                    beingIngestedImageIds: []\r\n                }\r\n            }\r\n        };\r\n    }\r\n\r\n    /**\r\n     * Creates the root reducer of the component.\r\n     * This reducer needs to return state that includes the ImageDetailsPageState state\r\n     * @method\r\n     * @returns {IReducer<IImageDetailsPageState>} The root reducer of the component.\r\n     */\r\n    public createRootReducer(): IReducer<IImageDetailsPageState> {\r\n        const imageCommandReducer = new ImageCommandReduction(this.imageCommandActions);\r\n        return new ImageDetailsPageReduction(this.imagePageActions, imageCommandReducer);\r\n    }\r\n\r\n    /**\r\n     * Loads the image entity and raises action to set the image details in state\r\n     * @method\r\n     * @param entityId {string} The entity id.\r\n     */\r\n    public loadImageToDisplayDetails(entityId: string): void {\r\n        if (!entityId) {\r\n            return;\r\n        }\r\n\r\n        const entityManager = this.businessLogicFactory.getManagersFactory().getEntityManager();\r\n        this.imagePageActions.ImageDetailsLoading.getActionSender(this.store)();\r\n\r\n        const imageLoadActivity = this.instrumentationClient.ActivityLoggingService.createActivity(\"image-details\", this.instrumentationClient.RootActivity, { entityId, pageName: PageNames.ImageDetails });\r\n        this.instrumentationClient.UserActivityTrackingService.logPageView(PageNames.ImageDetails, this.instrumentationClient.RootActivityCorrelationVector, { documentData: [{ id: entityId }] });\r\n\r\n        const loadPromise = entityManager.getLatest(Types.ImageFileData, entityId).then((getLatestEntityResponse: IEntityResponse<IEntity>) => {\r\n            const entityWithMetadata = getLatestEntityResponse.data;\r\n            this.imagePageActions.ImageDetailsFetched.getActionSender(this.store)(entityWithMetadata as IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>>);\r\n            if (entityWithMetadata.entity[\"processedByIngestion\"] === false) {\r\n                const updateStatusPromise = getLatestStatusOfUnProcessedEntity(this.store, entityWithMetadata, this.imageCommandActions, this.imageAcquisitionManager, this.instrumentationClient, \"\");\r\n                PromiseExtension.onComplete(updateStatusPromise, () => {\r\n                    this.imageCommandActions.RemoveCompletedImageStatusUpdate.getActionSender(this.store)([entityId]);\r\n                });\r\n            }\r\n        }).catch((error: IEntityErrorResponse) => {\r\n            this.instrumentationClient.LoggingService.error(\"Error occurred while loading image details\", imageLoadActivity, { entityId, error, pageName: PageNames.ImageDetails }, this.instrumentationClient.RootActivityCorrelationVector);\r\n            this.imagePageActions.ImageDetailsLoadingError.getActionSender(this.store)(error);\r\n        });\r\n\r\n        PromiseExtension.onComplete(loadPromise, () => this.instrumentationClient.ActivityLoggingService.endActivity(imageLoadActivity));\r\n    }\r\n\r\n    /**\r\n     * Maps from the state to the props\r\n     * @method\r\n     * @param state {IImageDetailsPageState} The redux state.\r\n     * @returns {IImageDetailsPageProps} The mapped Image details page properties.\r\n     */\r\n    public mapStateToProps(state: IImageDetailsPageState): IImageDetailsPageProps {\r\n        const currentState = this.getCurrentState();\r\n        const selectedImageEntityWithMetadata = currentState.entityWithMetadata;\r\n\r\n        let dimensions = { width: AppConstants.thumbnailConfig.width, height: AppConstants.thumbnailConfig.height };\r\n        let displayVerticalLayout = false;\r\n        let downloadEnabled = false;\r\n        let downloadInProgress = false;\r\n        let imagePreviewElementProps: IImageDetailsPageProps = {\r\n            visible: true,\r\n            downloadInProgress,\r\n            downloadEnabled,\r\n            displayVerticalLayout,\r\n            sourceId: \"\",\r\n            width: dimensions.width,\r\n            height: dimensions.height,\r\n            entityId: null,\r\n            title: \"\",\r\n            caption: \"\",\r\n            lowQualtiySourceHref: \"\",\r\n            sourceHref: \"\",\r\n            errorCode: \"\",\r\n            errorMessage: \"\",\r\n            isImageLinkGenerationInProgress: false,\r\n            generateImageLinkInvoked: (_event: React.SyntheticEvent<any>): void => { return; },\r\n            imageLink: null\r\n        };\r\n\r\n        if (state.isInErrorState) {\r\n            imagePreviewElementProps.isError = true;\r\n            imagePreviewElementProps.errorCode = state.error.type;\r\n            imagePreviewElementProps.errorMessage = state.error.errorMessage;\r\n            imagePreviewElementProps.errorMessage += state.error.innerError && state.error.innerError.rawResponseBody ? state.error.innerError.rawResponseBody.Message : \"\";\r\n        } else if (selectedImageEntityWithMetadata !== null) {\r\n            const entityId = selectedImageEntityWithMetadata.entity._id;\r\n            const entity = selectedImageEntityWithMetadata.entity;\r\n            const isValidEntity = !isNil(entity._id) && !isEmpty(entity._id);\r\n\r\n            if (isValidEntity) {\r\n                dimensions = GetImageDimensionToDetermineLayout(entity);\r\n            }\r\n\r\n            const showDownloadingMessage = currentState.imageCommandState.imagesDownloading.indexOf(entityId) >= 0;\r\n            const showFailedDownloadingMessage: boolean = !showDownloadingMessage && (currentState.imageCommandState.failedImages.indexOf(entityId) >= 0);\r\n            displayVerticalLayout = DetermineModalLayout(dimensions.width, dimensions.height);\r\n            downloadInProgress = currentState.imageCommandState.imagesDownloading.indexOf(entityId) >= 0;\r\n            downloadEnabled = !downloadInProgress && isValidEntity;\r\n\r\n            imagePreviewElementProps = GetImagePreviewElementProps(\r\n                selectedImageEntityWithMetadata,\r\n                showDownloadingMessage,\r\n                showFailedDownloadingMessage,\r\n                downloadInProgress,\r\n                downloadEnabled,\r\n                displayVerticalLayout,\r\n                this.downloadImage,\r\n                false,\r\n                (_event: React.SyntheticEvent<any>): void => { return; },\r\n                currentState.imageCommandState.lastDownloadError,\r\n                undefined,\r\n                undefined,\r\n                state.imageCommandState.creativeImageIngestionState.failedToUpdateImages.indexOf(entityId) > -1\r\n            );\r\n\r\n            imagePreviewElementProps.entityId = entityId;\r\n        }\r\n\r\n        return imagePreviewElementProps;\r\n    }\r\n\r\n    /**\r\n     * Performs required job before the component is created.\r\n     * @method\r\n     */\r\n    public onBeforeComponentCreated(): void {\r\n        this.imageCommandActionCreator = new ImageCommandActionCreator(\r\n            this.imageAcquisitionManager,\r\n            this.store,\r\n            this.imageCommandActions);\r\n    }\r\n\r\n    /**\r\n     * download image function\r\n     * @param event {Event} the event which triggered this handler\r\n     * @method\r\n     */\r\n    private downloadImage(event: React.SyntheticEvent<Event>): void {\r\n        const state = this.getCurrentState();\r\n        const entity = state.entityWithMetadata.entity;\r\n        DownloadImage(\r\n            event,\r\n            entity,\r\n            PageNames.ImageDetails,\r\n            this.imageCommandActionCreator,\r\n            this.instrumentationClient,\r\n            \"ImageDetailsPageBootstrapper.downloadImage\"\r\n        );\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { ActionHandler } from \"cms-ui-redux/ActionHandler\";\r\nimport { Actions } from \"../../../globals/actions\";\r\nimport { IActionPayload } from \"cms-ui-redux/IActionPayload\";\r\nimport { IImageLoadingPerfCountersState } from \"./IImageLoadingPerfCountersState\";\r\nimport { NamespaceCheckReducerBase } from \"cms-ui-redux/NamespaceCheckReducerBase\";\r\n\r\n/**\r\n * Redux reducer that computes a new state in response to `image loading telemetry` actions.\r\n * @class\r\n */\r\nexport class ImageLoadingPerfCountersReducer extends NamespaceCheckReducerBase<IImageLoadingPerfCountersState> {\r\n\r\n    constructor() {\r\n        super([Actions.Telemetry.Editorial.ComputeImageLoadingPerfCounters.namespace]);\r\n    }\r\n\r\n    public static getInitialState(): IImageLoadingPerfCountersState {\r\n        return {\r\n            loadedImagesBatchResourceTimings: []\r\n        };\r\n    }\r\n\r\n    public reduce(state: IImageLoadingPerfCountersState, actionPayload: IActionPayload): IImageLoadingPerfCountersState {\r\n        let newState = state;\r\n\r\n        // store a new set of performance data in the state\r\n        ActionHandler.handleAction(\r\n            actionPayload,\r\n            Actions.Telemetry.Editorial.ComputeImageLoadingPerfCounters.SetImageLoadingPerfCounters,\r\n            (loadedImagesBatchResourceTimings: PerformanceResourceTiming[]) => {\r\n                newState = {\r\n                    loadedImagesBatchResourceTimings: [\r\n                        ...state.loadedImagesBatchResourceTimings,\r\n                        ...loadedImagesBatchResourceTimings\r\n                    ]\r\n                };\r\n            }\r\n        );\r\n\r\n        // clear-up the state\r\n        ActionHandler.handleAction(\r\n            actionPayload,\r\n            Actions.Telemetry.Editorial.ComputeImageLoadingPerfCounters.ClearImageLoadingPerfCounters,\r\n            () => {\r\n                newState = {\r\n                    loadedImagesBatchResourceTimings: []\r\n                };\r\n            }\r\n        );\r\n\r\n        return newState;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { AppErrorConverter } from \"../../../common/appErrorConverter\";\r\nimport { BusinessLogicFactory } from \"cms-businesslogic/factory/BusinessLogicFactory\";\r\nimport { CompoundErrorType } from \"cms-businesslogic/compound/CompoundErrorType\";\r\nimport { EntityBehaviorType } from \"cms-businesslogic/entity/EntityBehaviorType\";\r\nimport { EntityLinkHref } from \"cms-models/EntityLinkHref\";\r\nimport { EntityListActions } from \"cms-ui-presentationlogic/dataflows/entityList/EntityListActions\";\r\nimport { EntityState } from \"cms-models/EntityState\";\r\nimport { IActivityLogItem } from \"clientcore-infrastructure-analytics/models/IActivityLogItem\";\r\nimport { IAnnotatedCollectionError } from \"cms-businesslogic/annotatedCollection/IAnnotatedCollectionError\";\r\nimport { IAnnotatedEntity } from \"cms-models/annotatedCollection/IAnnotatedEntity\";\r\nimport { IAnnotatedEntityCollection } from \"cms-models/annotatedCollection/IAnnotatedEntityCollection\";\r\nimport { IEntityWithMetadata } from \"cms-businesslogic/entity/IEntityWithMetadata\";\r\nimport { IErrorResponse } from \"cms-businesslogic/compound/IErrorResponse\";\r\nimport { IInstrumentationClient } from \"../../../instrumentation/instrumentationClient/IInstrumentationClient\";\r\nimport { ILightboxActionCreator } from \"./ILightboxActionCreator\";\r\nimport { ILightboxProfileInfo } from \"../../../models/lightbox/ILightboxProfileInfo\";\r\nimport { ILightboxUserProfileManager } from \"../../../experiences/lightbox/LightboxUserProfileManager\";\r\nimport { IStore } from \"redux\";\r\nimport { LightboxActions } from \"./LightboxActions\";\r\nimport { NotificationListActions } from \"cms-ui-presentationlogic/dataflows/notifications/NotificationListActions\";\r\nimport { NotificationType } from \"cms-ui-presentationlogic/dataflows/notifications/NotificationType\";\r\nimport { PromiseExtension } from \"cms-infrastructure/promise-extension/PromiseExtension\";\r\nimport { TypedPromise } from \"cms-typed-promise\";\r\nimport { Types } from \"cms-models/Types\";\r\nimport { authenticationManager } from \"../../../globals/authentication\";\r\nimport { ccsdk } from \"../../../globals/ccsdk\";\r\n\r\n/**\r\n * @class\r\n */\r\nexport class LightboxActionCreator implements ILightboxActionCreator {\r\n\r\n    /**\r\n     * @param businessLogicFactory {BusinessLogicFactory} Used to construct managers for making service calls.\r\n     * @param instrumentationClient {IInstrumentationClient} Provides support for instrumentation.\r\n     * @param lightboxUserProfileManager {ILightboxUserProfileManager} The profile manager does server side operation.\r\n     * @param store {IStore<any>} The store to dispatch actions to.\r\n     * @param lightboxActions {LightboxActions} The lightbox actions.\r\n     * @param lightboxEntityListActions {EntityListActions} Action to update the Lightbox Entity once items have been added or removed\r\n     * @param notificationListActions {NotificationListActions}\r\n     */\r\n    constructor(\r\n        private businessLogicFactory: BusinessLogicFactory,\r\n        private instrumentationClient: IInstrumentationClient,\r\n        private lightboxUserProfileManager: ILightboxUserProfileManager,\r\n        private store: IStore<any>,\r\n        private lightboxActions: LightboxActions,\r\n        private lightboxEntityListActions: EntityListActions,\r\n        private notificationListActions: NotificationListActions = new NotificationListActions()) {\r\n\r\n        this.removeLightbox = this.removeLightbox.bind(this);\r\n        this.createLightbox = this.createLightbox.bind(this);\r\n        this.addLightbox = this.addLightbox.bind(this);\r\n        this.addItemsToLightbox = this.addItemsToLightbox.bind(this);\r\n\r\n        if (!this.businessLogicFactory) {\r\n            throw \"The businessLogicFactory parameter is required.\";\r\n        }\r\n\r\n        if (!this.instrumentationClient) {\r\n            throw \"The instrumentationClient parameter is required.\";\r\n        }\r\n\r\n        if (!this.store) {\r\n            throw \"The store parameter is required.\";\r\n        }\r\n\r\n        this.raiseErrorNotification = this.raiseErrorNotification.bind(this);\r\n    }\r\n\r\n    /**\r\n     * Performs the remove action to remove a lightbox by id.\r\n     * This only removes it from the recent list stored in the user profile. The lightbox is not deleted from the CMS.\r\n     * @param lightboxId {string} the lightbox id.\r\n     * @param parentActivity {IActivityLogItem} Activity for logging. Note, this is not used now but will be used when CCSDK's lightbox manager is in place to replace the lightbox user profile manager.\r\n     */\r\n    public removeLightbox(lightboxId: string, parentActivity: IActivityLogItem): Promise<any> {\r\n        this.lightboxActions.RemovingLightbox.getActionSender(this.store)(lightboxId);\r\n\r\n        const removeLightboxActivity =\r\n            this.instrumentationClient.ActivityLoggingService.createActivity(\"LightboxActionCreator.RemoveLightbox\", parentActivity, { lightboxId });\r\n\r\n        const promise = this.lightboxUserProfileManager.remove(lightboxId, removeLightboxActivity);\r\n\r\n        PromiseExtension.onComplete<ILightboxProfileInfo[]>(promise, () => this.instrumentationClient.ActivityLoggingService.endActivity(removeLightboxActivity));\r\n\r\n        return new Promise((resolve, reject) => {\r\n            promise.then((result) => {\r\n                this.lightboxActions.UpdatedLightbox.getActionSender(this.store)(result);\r\n                resolve(result);\r\n            }).catch((error) => {\r\n                this.instrumentationClient.LoggingService.error(\"LightboxActionCreator.RemoveLightbox::error\", removeLightboxActivity, { lightboxId });\r\n                const notificationTitle = \"Remove lightbox action failed.\";\r\n                const notificationMessage = AppErrorConverter.toString(error, false, `Remove lightbox \"${lightboxId}\" failed with error: `);\r\n                this.raiseErrorNotification(notificationTitle, notificationMessage);\r\n                reject(error);\r\n            });\r\n        });\r\n    }\r\n\r\n    /**\r\n     * Add a lightbox into the collection\r\n     * @param name {string} the lightbox name\r\n     * @param tenantName {string} The name of the tenant\r\n     * @param parentSectionId {string} the section under which to create the lightbox\r\n     * @param parentActivity {IActivityLogItem} actvity for logging.\r\n     */\r\n    public createLightbox(name: string, tenantName: string, parentSectionId: string, parentActivity?: IActivityLogItem): TypedPromise<IEntityWithMetadata<IAnnotatedEntityCollection>, IErrorResponse<CompoundErrorType>>  {\r\n        this.lightboxActions.AddingLightbox.getActionSender(this.store)(name);\r\n\r\n        const parentSectionHref = new EntityLinkHref(EntityLinkHref.defaultPrefix, tenantName, Types.Section.name, parentSectionId);\r\n        const lightbox = ccsdk.inspectors.annotatedEntityCollection.createAnnotatedEntityCollection(name, parentSectionHref, authenticationManager.userData.userName);\r\n\r\n        const createPromise = ccsdk.proseCompoundEntityOperationsManager.create<IAnnotatedEntityCollection>(lightbox, parentActivity, EntityState.Published, EntityBehaviorType.BasicAndPrivate);\r\n\r\n        return new TypedPromise<IEntityWithMetadata<IAnnotatedEntityCollection>, IErrorResponse<CompoundErrorType>>((resolve, reject) => {\r\n            createPromise.then((response) => {\r\n                const lightboxProfileInfo = {\r\n                    id: response.entity._id,\r\n                    lastAccessedDate: new Date(Date.now())\r\n                };\r\n\r\n                const promise = this.lightboxUserProfileManager.add(lightboxProfileInfo, parentActivity);\r\n                promise.then((result) => {\r\n                    this.lightboxActions.AddedLightboxAndSetActive.getActionSender(this.store)(lightboxProfileInfo, result);\r\n                    resolve(response);\r\n                }).catch((error) => {\r\n                    this.lightboxActions.OperationFailed.getActionSender(this.store)(\r\n                        NotificationType.Error,\r\n                        \"Failed to update user profile with newly created lightbox.\",\r\n                        AppErrorConverter.toString(error, true),\r\n                        \"Oops!\");\r\n\r\n                    // Add a notification to the notification list as well\r\n                    const notificationTitle = \"Failed to update user profile\";\r\n                    const notificationMessage = AppErrorConverter.toString(error, false, `Failed to update user profile with newly created lightbox id: ${response.entity._id}`);\r\n                    this.raiseErrorNotification(notificationTitle, notificationMessage);\r\n                    reject(error);\r\n                });\r\n            }).catch((error) => {\r\n                this.lightboxActions.OperationFailed.getActionSender(this.store)(\r\n                    NotificationType.Error,\r\n                    \"Last add new lightbox operation failed.\",\r\n                    AppErrorConverter.toString(error, true),\r\n                    \"Oh Snap!\");\r\n\r\n                // Add a notification to the notification list as well\r\n                const notificationTitle = \"Failed to create lightbox\";\r\n                const notificationMessage = AppErrorConverter.toString(error, false, `Failed to create lightbox ${name}.`);\r\n                this.raiseErrorNotification(notificationTitle, notificationMessage);\r\n                reject(error);\r\n            });\r\n        });\r\n    }\r\n\r\n    /**\r\n     * Add a lightbox into the collection\r\n     * @param lightboxId {string} the lightbox identifier\r\n     * @param name {string} the lightbox name\r\n     * @param parentActivity {IActivityLogItem} actvity for logging.\r\n     */\r\n    public addLightbox(lightboxId: string, name: string, parentActivity?: IActivityLogItem): Promise<any> {\r\n\r\n        this.lightboxActions.AddingLightbox.getActionSender(this.store)(name);\r\n\r\n        const lightboxProfileInfo = {\r\n            id: lightboxId,\r\n            lastAccessedDate: new Date(Date.now())\r\n        };\r\n\r\n        const addLightboxActivity =\r\n            this.instrumentationClient.ActivityLoggingService.createActivity(\"LightboxActionCreator.addLightbox\", parentActivity, { lightboxId });\r\n\r\n        const promise = this.lightboxUserProfileManager.add(lightboxProfileInfo, parentActivity);\r\n\r\n        PromiseExtension.onComplete(promise, () => this.instrumentationClient.ActivityLoggingService.endActivity(addLightboxActivity));\r\n\r\n        return new Promise<any>((resolve, reject) => {\r\n            promise.then((result) => {\r\n                this.lightboxActions.UpdatedLightbox.getActionSender(this.store)(result);\r\n                resolve(result);\r\n            }).catch((error) => {\r\n                this.instrumentationClient.LoggingService.error(\"LightboxActionCreator.RemoveLightbox::error\", addLightboxActivity, { lightboxId });\r\n                this.lightboxActions.OperationFailed.getActionSender(this.store)(\r\n                    NotificationType.Error,\r\n                    \"Add Lightbox action failed.\",\r\n                    AppErrorConverter.toString(error),\r\n                    \"Oops!\");\r\n\r\n                // Add a notification to the notification list as well\r\n                const notificationTitle = \"Failed to add lightbox\";\r\n                const notificationMessage = AppErrorConverter.toString(error, false, `Failed to add lightbox to user profile: ${lightboxId}.`);\r\n                this.raiseErrorNotification(notificationTitle, notificationMessage);\r\n                reject(error);\r\n            });\r\n        });\r\n    }\r\n\r\n    /**\r\n     * Make the lightbox the active lightbox\r\n     * @param lightboxId {string} the lightbox identifier\r\n     */\r\n    public setLightboxActive(lightboxId: string): void {\r\n        this.lightboxActions.SetLightboxActive.getActionSender(this.store)(lightboxId);\r\n    }\r\n\r\n    /**\r\n     * Add items into lightbox collection\r\n     * @param lightboxId {string} the lightbox identifier\r\n     * @param lightboxName {string} the lightbox name, used in error messages\r\n     * @param entityHrefs {string[]} References to the entities to add to the collection\r\n     * @param parentActivity {IActivityLogItem} actvity for logging.\r\n     * @returns {TypedPromise<IEntityWithMetadata<IAnnotatedEntityCollection>, IAnnotatedCollectionError>} A promise for the updated collection\r\n     */\r\n    public addItemsToLightbox(\r\n        lightboxId: string,\r\n        lightboxName: string,\r\n        entityHrefs: string[],\r\n        parentActivity?: IActivityLogItem): TypedPromise<IEntityWithMetadata<IAnnotatedEntityCollection>, IAnnotatedCollectionError> {\r\n        this.lightboxActions.AddingItemsToLightbox.getActionSender(this.store)(lightboxId);\r\n\r\n        const annotatedEntities = entityHrefs.map((entityHref) => {\r\n            return {\r\n                cmsReference: {\r\n                    href: entityHref\r\n                },\r\n                annotations: []\r\n            };\r\n        });\r\n\r\n        const addItemsPromise = ccsdk.annotatedEntityCollectionManager.addItems(lightboxId, annotatedEntities, parentActivity);\r\n\r\n        addItemsPromise.then((response) => {\r\n            this.lightboxActions.AddedItemsToLightbox.getActionSender(this.store)(lightboxId);\r\n            const collectionEntityWithMetadata = response as IEntityWithMetadata<IAnnotatedEntityCollection>;\r\n            const hrefs = ccsdk.inspectors.entity.getSelfLinkHrefString(collectionEntityWithMetadata);\r\n            this.lightboxEntityListActions.EntitiesUpdating.getActionSender(this.store)([hrefs]);\r\n            this.lightboxEntityListActions.EntitiesUpdated.getActionSender(this.store)([collectionEntityWithMetadata]);\r\n        }).catch((error) => {\r\n            this.instrumentationClient.LoggingService.error(\"LightboxActionCreator.AddItemsToLightbox\", parentActivity, { lightboxId, entityHrefs });\r\n\r\n            this.lightboxActions.OperationFailed.getActionSender(this.store)(\r\n                NotificationType.Error,\r\n                \"Add items to Lightbox action failed.\",\r\n                AppErrorConverter.toString(error),\r\n                \"Oops!\");\r\n\r\n            // Add a notification to the notification list as well\r\n            const notificationTitle = \"Failed to add items to lightbox\";\r\n            const notificationMessage = AppErrorConverter.toString(error, false, `Failed to add items to lightbox: ${lightboxName}.`);\r\n            this.raiseErrorNotification(notificationTitle, notificationMessage);\r\n        });\r\n\r\n        return addItemsPromise;\r\n    }\r\n\r\n    /**\r\n     * Remove items from a lightbox collection\r\n     * @param lightboxId {string} the lightbox identifier\r\n     * @param lightboxName {string} the lightbox name, used in error messages\r\n     * @param items {IAnnotatedEntity[]} The items to remove from collection.\r\n     * @param parentActivity {IActivityLogItem} actvity for logging.\r\n     * @returns {TypedPromise<IEntityWithMetadata<IAnnotatedEntityCollection>, IAnnotatedCollectionError>} A promise for the updated collection\r\n     */\r\n    public removeItemsFromLightbox(lightboxId: string, lightboxName: string, items: IAnnotatedEntity[], parentActivity?: IActivityLogItem): TypedPromise<IEntityWithMetadata<IAnnotatedEntityCollection>, IAnnotatedCollectionError> {\r\n        this.lightboxActions.RemovingItemsFromLightbox.getActionSender(this.store)(lightboxId);\r\n\r\n        const removeItemsPromise = ccsdk.annotatedEntityCollectionManager.removeItems(lightboxId, items, parentActivity);\r\n\r\n        removeItemsPromise.then((response) => {\r\n            this.lightboxActions.RemovedItemsFromLightbox.getActionSender(this.store)(lightboxId);\r\n            const collectionEntityWithMetadata = response as IEntityWithMetadata<IAnnotatedEntityCollection>;\r\n            const hrefs = ccsdk.inspectors.entity.getSelfLinkHrefString(collectionEntityWithMetadata);\r\n            this.lightboxEntityListActions.EntitiesUpdating.getActionSender(this.store)([hrefs]);\r\n            this.lightboxEntityListActions.EntitiesUpdated.getActionSender(this.store)([collectionEntityWithMetadata]);\r\n        }).catch((error) => {\r\n            this.instrumentationClient.LoggingService.error(\"LightboxActionCreator.RemoveItemsFromLightbox::error\", parentActivity, { lightboxId, items });\r\n\r\n            this.lightboxActions.OperationFailed.getActionSender(this.store)(\r\n                NotificationType.Error,\r\n\r\n                \"Remove items from Lightbox action failed.\",\r\n                AppErrorConverter.toString(error),\r\n                \"Oops!\");\r\n\r\n            // Add a notification to the notification list as well\r\n            const notificationTitle = \"Failed to remove items from lightbox\";\r\n            const notificationMessage = AppErrorConverter.toString(error, false, `Failed to remove items from lightbox: ${lightboxName}.`);\r\n            this.raiseErrorNotification(notificationTitle, notificationMessage);\r\n        });\r\n\r\n        return removeItemsPromise;\r\n    }\r\n\r\n    /**\r\n     * Creates a new error notification\r\n     */\r\n    public createErrorNotification(error: string): void {\r\n        this.lightboxActions.OperationFailed.getActionSender(this.store)(\r\n            NotificationType.Error,\r\n            \"Last operation failed.\",\r\n            AppErrorConverter.toString(error),\r\n            \"Oops!\");\r\n    }\r\n\r\n    /**\r\n     * Clears error notification\r\n     */\r\n    public clearErrorNotification(): void {\r\n        this.lightboxActions.ClearNotification.getActionSender(this.store)();\r\n    }\r\n\r\n    // Helper to raise an error notification so it will show on the applications notification list.\r\n    private raiseErrorNotification(title: string, message: string): void {\r\n        this.notificationListActions.AddNotification.getActionSender(this.store)(NotificationType.Error, title, message);\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { ActionMap } from \"cms-ui-redux/ActionMap\";\r\nimport { IEntity } from \"cms-models/IEntity\";\r\nimport { IEntityWithMetadata } from \"cms-businesslogic/entity/IEntityWithMetadata\";\r\nimport { ILightboxProfileInfo } from \"../../../models/lightbox/ILightboxProfileInfo\";\r\nimport { NamespacePrefixActionsDefinitionBase } from \"cms-ui-redux/NamespacePrefixActionsDefinitionBase\";\r\nimport { NotificationType } from \"cms-ui-components/notifications/notification/NotificationType\";\r\n\r\nexport type RemovingLightboxSignature = (id: string) => void;\r\nexport type UpdatedLightboxSignature = (lightboxes: ILightboxProfileInfo[]) => void;\r\nexport type AddingLightboxSignature = (name: string) => void;\r\nexport type AddedLightboxAndSetActiveSignature = (lightboxSummaryInfo: ILightboxProfileInfo, lightboxes: ILightboxProfileInfo[]) => void;\r\nexport type AddingItemsToLightboxSignature = (lightboxId: string) => void;\r\nexport type AddedItemsToLightboxSignature = (lightboxId: string) => void;\r\nexport type RemovingItemsFromLightboxSignature = (ligthboxId: string) => void;\r\nexport type RemovedItemsFromLightboxSignature = (ligthboxId: string) => void;\r\nexport type OperationFailedSignature = (notificationType: NotificationType, title: string, detail: string, prefix: string) => void;\r\nexport type ClearNotificationSignature = () => void;\r\nexport type SetLightboxActiveSignature = (lightboxId: string) => void;\r\nexport type LightboxDownloadOperationSignature = (lightboxId: string) => void;\r\nexport type LightboxImageDownloadFailedSignature = (lightboxId: string, failedImage: IEntityWithMetadata<IEntity>) => void;\r\n\r\n/**\r\n * @class\r\n */\r\nexport class LightboxActions extends NamespacePrefixActionsDefinitionBase {\r\n    /** Defines the action indicating removing lightbox */\r\n\r\n    private removingLightbox: ActionMap<RemovingLightboxSignature> = new ActionMap<RemovingLightboxSignature>(this.namespace + \"RemovingLightbox\");\r\n\r\n    /** Defines the action indicating lightbox is removed */\r\n    private updatedLightbox: ActionMap<UpdatedLightboxSignature> = new ActionMap<UpdatedLightboxSignature>(this.namespace + \"UpdatedLightbox\");\r\n\r\n    /** Defines the action indicating adding lightbox */\r\n    private addingLightbox: ActionMap<AddingLightboxSignature> = new ActionMap<AddingLightboxSignature>(this.namespace + \"AddingLightbox\");\r\n\r\n    /** Defines the action indicating lightbox is added and has been set as the active lightbox  */\r\n    private addedLightboxAndSetActive: ActionMap<AddedLightboxAndSetActiveSignature> = new ActionMap<AddedLightboxAndSetActiveSignature>(this.namespace + \"AddedLightboxAndSetActive\");\r\n\r\n    /** Defines the action indicating items are getting added to lightbox */\r\n    private addingItemsToLightbox: ActionMap<AddingItemsToLightboxSignature> = new ActionMap<AddingItemsToLightboxSignature>(this.namespace + \"AddingItemsToLightbox\");\r\n\r\n    /** Defines the action indicating items are added to lightbox */\r\n    private addedItemsToLightbox: ActionMap<AddedItemsToLightboxSignature> = new ActionMap<AddedItemsToLightboxSignature>(this.namespace + \"AddedItemsToLightbox\");\r\n\r\n    /** Defines the action indicating items are getting removed to lightbox */\r\n    private removingItemsFromLightbox: ActionMap<RemovingItemsFromLightboxSignature> = new ActionMap<RemovingItemsFromLightboxSignature>(this.namespace + \"RemovingItemsFromLightbox\");\r\n\r\n    /** Defines the action indicating items are removed to lightbox */\r\n    private removedItemsFromLightbox: ActionMap<RemovedItemsFromLightboxSignature> = new ActionMap<RemovedItemsFromLightboxSignature>(this.namespace + \"RemovedItemsFromLightbox\");\r\n\r\n    /** Defines the action indicating operation against lightbox is failed */\r\n    private operationFailed: ActionMap<OperationFailedSignature> = new ActionMap<OperationFailedSignature>(this.namespace + \"OperationFailed\");\r\n\r\n    /** Defines the action clears notification  */\r\n    private clearNotification: ActionMap<ClearNotificationSignature> = new ActionMap<ClearNotificationSignature>(this.namespace + \"ClearNotification\");\r\n\r\n    /** Defines the action indicating lightbox selection is changed */\r\n    private setLightboxActive: ActionMap<SetLightboxActiveSignature> = new ActionMap<SetLightboxActiveSignature>(this.namespace + \"SetLightboxActive\");\r\n\r\n    /** Defines the action indicating that download all images is initiated for a light box */\r\n    private lightboxImagesDownloadStarted: ActionMap<LightboxDownloadOperationSignature> = new ActionMap<LightboxDownloadOperationSignature>(this.namespace + \"DownloadAllStarted\");\r\n\r\n    /** Defines the action indicating that download all images is initiated for a light box */\r\n    private lightboxImagesDownloadFinished: ActionMap<LightboxDownloadOperationSignature> = new ActionMap<LightboxDownloadOperationSignature>(this.namespace + \"DownloadAllFinished\");\r\n\r\n    /** Defines the action indicating that images failed to download */\r\n    private lightboxImageDownloadFailed: ActionMap<LightboxImageDownloadFailedSignature> = new ActionMap<LightboxImageDownloadFailedSignature>(this.namespace + \"DownloadAllImageFailedSignature\");\r\n\r\n    /** Defines the action indicating to clear images which fail to download for a light box */\r\n    private lightboxClearFailedDownloadImages: ActionMap<LightboxDownloadOperationSignature> = new ActionMap<LightboxDownloadOperationSignature>(this.namespace + \"downloadAllClearFailedImages\");\r\n\r\n    /** Defines the action indicating to retry the download for images which fail to download earlier for a light box */\r\n    private lightboxRetryFailedImagesDownload: ActionMap<LightboxDownloadOperationSignature> = new ActionMap<LightboxDownloadOperationSignature>(this.namespace + \"downloadAllRetryFailedImages\");\r\n\r\n    /**\r\n     * @constructor\r\n     * @param namespacePrefix {string} Optional prefix to add to the namespace used to distinguish between different instances of this data flow.\r\n     */\r\n    constructor(namespacePrefix?: string) {\r\n        super(\"LightboxActions\", namespacePrefix);\r\n    }\r\n\r\n    /**\r\n     * @type {ActionMap<RemovingLightboxSignature>}\r\n     */\r\n    public get RemovingLightbox(): ActionMap<RemovingLightboxSignature> {\r\n        return this.removingLightbox;\r\n    }\r\n\r\n    /**\r\n     * @type {ActionMap<UpdatedLightboxSignature>}\r\n     */\r\n    public get UpdatedLightbox(): ActionMap<UpdatedLightboxSignature> {\r\n        return this.updatedLightbox;\r\n    }\r\n\r\n    /**\r\n     * @type {ActionMap<AddingLightboxSignature>}\r\n     */\r\n    public get AddingLightbox(): ActionMap<AddingLightboxSignature> {\r\n        return this.addingLightbox;\r\n    }\r\n\r\n    /**\r\n     * @type {ActionMap<AddedLightboxSignature>}\r\n     */\r\n    public get AddedLightboxAndSetActive(): ActionMap<AddedLightboxAndSetActiveSignature> {\r\n        return this.addedLightboxAndSetActive;\r\n    }\r\n\r\n    /**\r\n     * @type {ActionMap<AddingItemsToLightboxSignature>}\r\n     */\r\n    public get AddingItemsToLightbox(): ActionMap<AddingItemsToLightboxSignature> {\r\n        return this.addingItemsToLightbox;\r\n    }\r\n\r\n    /**\r\n     * @type {ActionMap<RemovedItemsFromLightboxSignature>}\r\n     */\r\n    public get RemovedItemsFromLightbox(): ActionMap<RemovedItemsFromLightboxSignature> {\r\n        return this.removedItemsFromLightbox;\r\n    }\r\n\r\n    /**\r\n     * @type {ActionMap<RemovingItemsFromLightboxSignature>}\r\n     */\r\n    public get RemovingItemsFromLightbox(): ActionMap<RemovingItemsFromLightboxSignature> {\r\n        return this.removingItemsFromLightbox;\r\n    }\r\n\r\n    /**\r\n     * @type {ActionMap<AddedItemsToLightboxSignature>}\r\n     */\r\n    public get AddedItemsToLightbox(): ActionMap<AddedItemsToLightboxSignature> {\r\n        return this.addedItemsToLightbox;\r\n    }\r\n\r\n    /**\r\n     * @type {ActionMap<OperationFailedSignature>}\r\n     */\r\n    public get OperationFailed(): ActionMap<OperationFailedSignature> {\r\n        return this.operationFailed;\r\n    }\r\n\r\n    /**\r\n     * @type {ActionMap<ClearNotificationSignature>}\r\n     */\r\n    public get ClearNotification(): ActionMap<ClearNotificationSignature> {\r\n        return this.clearNotification;\r\n    }\r\n\r\n    /**\r\n     * @type {ActionMap<SetLightboxActiveSignature>}\r\n     */\r\n    public get SetLightboxActive(): ActionMap<SetLightboxActiveSignature> {\r\n        return this.setLightboxActive;\r\n    }\r\n\r\n    /**\r\n     * @type {ActionMap<LightboxDownloadOperationSignature>}\r\n     */\r\n    public get LightboxImagesDownloadStarted(): ActionMap<LightboxDownloadOperationSignature> {\r\n        return this.lightboxImagesDownloadStarted;\r\n    }\r\n\r\n    /**\r\n     * @type {ActionMap<LightboxDownloadOperationSignature>}\r\n     */\r\n    public get LightboxImagesDownloadFinished(): ActionMap<LightboxDownloadOperationSignature> {\r\n        return this.lightboxImagesDownloadFinished;\r\n    }\r\n\r\n    /**\r\n     * @type {ActionMap<LightboxDownloadOperationSignature>}\r\n     */\r\n    public get LightboxClearFailedDownloadImages(): ActionMap<LightboxDownloadOperationSignature> {\r\n        return this.lightboxClearFailedDownloadImages;\r\n    }\r\n\r\n    /**\r\n     * @type {ActionMap<LightboxDownloadOperationSignature>}\r\n     */\r\n    public get LightboxRetryFailedImagesDownload(): ActionMap<LightboxDownloadOperationSignature> {\r\n        return this.lightboxRetryFailedImagesDownload;\r\n    }\r\n\r\n    /**\r\n     * @type {ActionMap<DownloadAllImageFailedSignature>}\r\n     */\r\n    public get LightboxImageDownloadFailed(): ActionMap<LightboxImageDownloadFailedSignature> {\r\n        return this.lightboxImageDownloadFailed;\r\n    }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { BadRequestServiceErrorParser } from \"cms-ui-views/serviceErrors/parsers/BadRequestServiceErrorParser\";\r\nimport { CompositeServiceErrorParser } from \"cms-ui-views/serviceErrors/parsers/CompositeServiceErrorParser\";\r\nimport { DomainAwareDeniedServiceErrorParser } from \"./DomainAwareDeniedServiceErrorParser\";\r\nimport { Error } from \"cms-infrastructure/error/Error\";\r\nimport { ErrorResponse } from \"clientcore-base-serviceclients/response/ErrorResponse\";\r\nimport { IServiceErrorParser } from \"cms-ui-views/serviceErrors/parsers/IServiceErrorParser\";\r\nimport { IUserActionProps } from \"cms-ui-components/richNotification/IRichNotification\";\r\nimport { MissingDetailsServiceErrorParser } from \"cms-ui-views/serviceErrors/parsers/MissingDetailsServiceErrorParser\";\r\nimport { ServiceErrorType } from \"clientcore-base-businesslogic/response/error/ServiceErrorType\";\r\nimport { UnknownStatusCodeServiceErrorParser } from \"cms-ui-views/serviceErrors/parsers/UnknownStatusCodeServiceErrorParser\";\r\nimport { authenticationManager } from \"./authentication\";\r\nimport { createAuthenticationServiceParser } from \"cms-ui-views/serviceErrors/parsers/AuthenticationServiceErrorParser\";\r\nimport { withUserAction } from \"cms-ui-views/serviceErrors/serviceErrorParserEnhancers\";\r\n\r\nconst helpLinkUserActions: IUserActionProps[] = [{\r\n    title: \"Help Me\",\r\n    buttonProps: {\r\n        url: \"https://aka.ms/catalyst-help\",\r\n        urlTarget: \"_blank\"\r\n    }\r\n}];\r\n\r\n/**\r\n * Service error parser for Catalyst.\r\n * @class CatalystServiceErrorParser\r\n * @implements {IServiceErrorParser}\r\n */\r\nclass CatalystServiceErrorParser implements IServiceErrorParser<any> {\r\n\r\n    /**\r\n     * An instance of `CompositeServiceErrorParser`, used as a basis to create the service error parser for Catalyst.\r\n     *\r\n     * @private\r\n     * @type {CompositeServiceErrorParser}\r\n     * @memberof CatalystServiceErrorParser\r\n     */\r\n    private parser: CompositeServiceErrorParser;\r\n\r\n    /**\r\n     * Creates an instance of CatalystServiceErrorParser.\r\n     * @constructor CatalystServiceErrorParser\r\n     */\r\n    constructor(parsers: IServiceErrorParser<any>[]) {\r\n        this.parser = new CompositeServiceErrorParser(parsers);\r\n    }\r\n\r\n    /**\r\n     * Returns true if the service error can be parsed, false otherwise.\r\n     *\r\n     * @param {Error<ServiceErrorType, ErrorResponse>} error\r\n     * @returns {boolean}\r\n     * @memberof CatalystServiceErrorParser\r\n     */\r\n    public canParse(error: Error<ServiceErrorType, ErrorResponse>): boolean {\r\n        return this.parser.canParse(error);\r\n    }\r\n\r\n    /**\r\n     * Returns a parsed version of the service error.\r\n     *\r\n     * @param {Error<ServiceErrorType, ErrorResponse>} error\r\n     * @returns {IRichNotification}\r\n     * @memberof CatalystServiceErrorParser\r\n     */\r\n    public parse(error: Error<ServiceErrorType, ErrorResponse>): any {\r\n        return this.parser.parse(error);\r\n    }\r\n}\r\n\r\nconst authenticationServiceErrorParser = createAuthenticationServiceParser(authenticationManager, {\r\n    MissingConsent: {\r\n        parse: () => () => { window.location.replace(authenticationManager.getAzureActiveDirectoryConsentUrl()); }\r\n    }\r\n});\r\nconst badRequestServiceErrorParser = withUserAction(new BadRequestServiceErrorParser(), helpLinkUserActions);\r\nconst deniedServiceErrorParser = new DomainAwareDeniedServiceErrorParser();\r\nconst unknownStatusCodeServiceErrorParser = withUserAction(new UnknownStatusCodeServiceErrorParser(), helpLinkUserActions);\r\nconst missingDetailsServiceErrorParser = withUserAction(new MissingDetailsServiceErrorParser(), helpLinkUserActions);\r\n\r\nconst appLevelServiceErrorParser = new CatalystServiceErrorParser([\r\n    ...authenticationServiceErrorParser.all(),\r\n    badRequestServiceErrorParser,\r\n    deniedServiceErrorParser,\r\n    unknownStatusCodeServiceErrorParser,\r\n    missingDetailsServiceErrorParser\r\n]);\r\n\r\nexport const serviceErrorParsers = {\r\n    appLevel: appLevelServiceErrorParser,\r\n    badRequest: badRequestServiceErrorParser\r\n};","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { IRichNotification, IUserActionProps } from \"cms-ui-components/richNotification/IRichNotification\";\r\n\r\nimport { AppConstants } from \"../AppConstants\";\r\nimport { DeniedServiceErrorParser } from \"cms-ui-views/serviceErrors/parsers//DeniedServiceErrorParser\";\r\nimport { Error } from \"cms-infrastructure/error/Error\";\r\nimport { ErrorResponse } from \"clientcore-base-serviceclients/response/ErrorResponse\";\r\nimport { IRichTextPreviewProps } from \"cms-ui-components/richTextPreview/IRichTextPreviewProps\";\r\nimport { IServiceErrorParser } from \"cms-ui-views/serviceErrors/parsers/IServiceErrorParser\";\r\nimport { ServiceErrorType } from \"clientcore-base-businesslogic/response/error/ServiceErrorType\";\r\nimport { findIndex } from \"lodash-es\";\r\nimport { withUserAction } from \"cms-ui-views/serviceErrors/serviceErrorParserEnhancers\";\r\n\r\n/**\r\n * A domain aware denied service error parser.\r\n * Falls back to the `DeniedServiceErrorParser` defined in UI SDK when Catalyst is being executed in PROD.\r\n * Customizes the parsed notification when Catalyst is being executed in all the other environments.\r\n * @class\r\n */\r\nexport class DomainAwareDeniedServiceErrorParser implements IServiceErrorParser<IRichNotification> {\r\n\r\n    // the wrapped `DeniedServiceErrorParser` to which this parser falls back when the app is being executed in prod.\r\n    private deniedServiceErrorParser: DeniedServiceErrorParser;\r\n\r\n    constructor() {\r\n        const requestAccessLinkUserActions: IUserActionProps[] = [{\r\n            title: \"Request Access\",\r\n            buttonProps: {\r\n                url: \"https://idwebelements/GroupManagement.aspx?Group=SFTD-PROD-CATS&Operation=join\",\r\n                urlTarget: \"_blank\"\r\n            }\r\n        }];\r\n\r\n        this.deniedServiceErrorParser = withUserAction(new DeniedServiceErrorParser(), requestAccessLinkUserActions);\r\n    }\r\n\r\n    /**\r\n     * Determines if an error parser is supposed to parse the provided service error or not.\r\n     * @param {Error<ServiceErrorType, ErrorResponse>} error - The error that resulted from the service call.\r\n     */\r\n    public canParse(error: Error<ServiceErrorType, ErrorResponse>): boolean {\r\n        return this.deniedServiceErrorParser.canParse(error);\r\n    }\r\n\r\n    /**\r\n     * Analyzes the service error and returns the appropriate rich notification.\r\n     * @param error {Error<ServiceErrorType, ErrorResponse>} The error that resulted from the service call.\r\n     * @returns {IRichNotification} The appropriate rich notification.\r\n     */\r\n    public parse(error: Error<ServiceErrorType, ErrorResponse>): IRichNotification {\r\n        const deniedAccessErrorNotification = this.deniedServiceErrorParser.parse(error);\r\n\r\n        if (this.isProdEnvironment()) {\r\n            return deniedAccessErrorNotification;\r\n        }\r\n\r\n        const whatToDoSectionIndex = findIndex(deniedAccessErrorNotification.richTextSections, section => section.title.toLowerCase() === \"what to do\");\r\n        if (whatToDoSectionIndex === -1) {\r\n            console.warn(\"Could not find the `what to do` in `DeniedServiceErrorParser` parsed rich notification.\");\r\n            return deniedAccessErrorNotification;\r\n        }\r\n\r\n        const richTextSections: IRichTextPreviewProps[] = [].concat(deniedAccessErrorNotification.richTextSections);\r\n        richTextSections[whatToDoSectionIndex] = {\r\n            text: this.whatToDoText()\r\n        };\r\n\r\n        return {\r\n            ...deniedAccessErrorNotification,\r\n            userAction: null,                   // this removes the \"Request access\" button\r\n            richTextSections\r\n        };\r\n    }\r\n\r\n    /**\r\n     * Returns the text for the \"what to do\" section.\r\n     * @returns {string}\r\n     */\r\n    public whatToDoText(): string {\r\n        return `You need to be a member of the required security groups to access the application. If you're an editor, you need to access the app through the URL: <b><a href=\"${AppConstants.catalystProdUrl}\">${AppConstants.catalystProdUrl}</a></b>`;\r\n    }\r\n\r\n    /**\r\n     * Returns true if Catalyst is being executed in PROD, false otherwise.\r\n     * @returns {boolean}\r\n     */\r\n    private isProdEnvironment(): boolean {\r\n        const appUrl = window.location.protocol + \"//\" + window.location.host;\r\n        return AppConstants.catalystProdUrl === appUrl;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as ops from \"cms-businesslogic/search/filter/Operators\";\r\n\r\nimport { intersection, isEmpty, isNil } from \"lodash-es\";\r\n\r\nimport { ActionDispatchCancellationToken } from \"cms-ui-redux/ActionDispatchCancellationToken\";\r\nimport { Actions } from \"../../globals/actions\";\r\nimport { AnnotatedCollectionChangeType } from \"cms-businesslogic/annotatedCollection/AnnotatedCollectionChangeType\";\r\nimport { AnnotatedCollectionMonitorStatus } from \"cms-businesslogic/annotatedCollection/AnnotatedCollectionMonitorStatus\";\r\nimport { AppConstants } from \"../../AppConstants\";\r\nimport { AssetFamily } from \"clientcore-models-catalyst/AssetFamily\";\r\nimport { CreativeProvider } from \"clientcore-catalyst-businesslogic/creativeSearch/CreativeProvider\";\r\nimport { Direction } from \"cms-businesslogic/search/orderby/Direction\";\r\nimport { EntityLinkHrefSerialization } from \"cms-models/EntityLinkHrefSerialization\";\r\nimport { EntityListActions } from \"cms-ui-presentationlogic/dataflows/entityList/EntityListActions\";\r\nimport { GetEntitiesActionCreator } from \"cms-ui-presentationlogic/dataflows/entityList/GetEntitiesActionCreator\";\r\nimport { IActionDispatchCancellationToken } from \"cms-ui-redux/IActionDispatchCancellationToken\";\r\nimport { IActivityLogItem } from \"clientcore-infrastructure-analytics/models/IActivityLogItem\";\r\nimport { IAnnotatedCollection } from \"cms-models/annotatedCollection/IAnnotatedCollection\";\r\nimport { IAnnotatedCollectionChange } from \"cms-businesslogic/annotatedCollection/IAnnotatedCollectionChange\";\r\nimport { IAnnotatedCollectionError } from \"cms-businesslogic/annotatedCollection/IAnnotatedCollectionError\";\r\nimport { IAnnotatedCollectionMonitorStatusInfo } from \"cms-businesslogic/annotatedCollection/IAnnotatedCollectionMonitorStatusInfo\";\r\nimport { IAnnotatedEntity } from \"cms-models/annotatedCollection/IAnnotatedEntity\";\r\nimport { IAnnotatedEntityCollection } from \"cms-models/annotatedCollection/IAnnotatedEntityCollection\";\r\nimport { ICatalystFileDataMetadata } from \"clientcore-models-catalyst/ICatalystFileDataMetadata\";\r\nimport { ICreativeImage } from \"clientcore-catalyst-businesslogic/creativeSearch/ICreativeImage\";\r\nimport { IEntity } from \"cms-models/IEntity\";\r\nimport { IEntityListState } from \"cms-ui-presentationlogic/dataflows/entityList/IEntityListState\";\r\nimport { IEntityWithMetadata } from \"cms-businesslogic/entity/IEntityWithMetadata\";\r\nimport { IErrorResponse } from \"clientcore-catalyst-businesslogic/IErrorResponse\";\r\nimport { IGetEntitiesActionCreator } from \"cms-ui-presentationlogic/dataflows/entityList/IGetEntitiesActionCreator\";\r\nimport { IImageAcquisitionManager } from \"clientcore-catalyst-businesslogic/IImageAcquisitionManager\";\r\nimport { IImageFileData } from \"cms-models/IImageFileData\";\r\nimport { IInstrumentationClient } from \"../../instrumentation/instrumentationClient/IInstrumentationClient\";\r\nimport { ILightboxActionCreator } from \"../../presentation-logic/dataflows/lightbox/ILightboxActionCreator\";\r\nimport { ILightboxManager } from \"./ILightboxManager\";\r\nimport { ILightboxPageState } from \"../../presentation-logic/dataflows/lightboxPage/ILightboxPageState\";\r\nimport { ILightboxState } from \"../../presentation-logic/dataflows/lightbox/ILightboxState\";\r\nimport { ISearchActionCreator } from \"cms-ui-presentationlogic/dataflows/entityList/ISearchActionCreator\";\r\nimport { IStore } from \"redux\";\r\nimport { ImageCommandActions } from \"../../presentation-logic/dataflows/imageCommand/ImageCommandActions\";\r\nimport { ImagePreviewModalActions } from \"../../presentation-logic/dataflows/imagePreviewModal/ImagePreviewModalActions\";\r\nimport { LightboxActions } from \"../../presentation-logic/dataflows/lightbox/LightboxActions\";\r\nimport { ModalProvisioningActions } from \"cms-ui-presentationlogic/dataflows/modalProvisioning/ModalProvisioningActions\";\r\nimport { Predicate } from \"cms-businesslogic/search/filter/Predicate\";\r\nimport { PromiseExtension } from \"cms-infrastructure/promise-extension/PromiseExtension\";\r\nimport { SearchIndex } from \"cms-ui-presentationlogic/dataflows/entityList/SearchIndex\";\r\nimport { TypedPromise } from \"cms-typed-promise\";\r\nimport { Types } from \"cms-models/Types\";\r\nimport { appConfig } from \"appConfig\";\r\nimport { ccsdk } from \"../../globals/ccsdk\";\r\nimport { getLatestStatusOfUnProcessedEntity } from \"./GetLatestStatusOfUnProcessedEntity\";\r\nimport { serviceErrorParsers } from \"../../globals/CatalystServiceErrorParser\";\r\n\r\n/**\r\n * Class wrapping functionality to manage lightboxes.\r\n * @class\r\n */\r\nexport class LightboxManager implements ILightboxManager {\r\n    /**\r\n     * The list of fields that we should fetch for AnnotatedEntityCollection entities\r\n     * @type {string[]}\r\n     */\r\n    private static RequiredFieldListForAnnotatedEntityCollection: string[] = [\"_id\", \"$type\", \"_name\", \"collection\"];\r\n\r\n    /** An instance of the 'GetEntitiesActionCreator' class for getting the image entities in the lightbox\r\n     * @type {IGetEntitiesActionCreator}\r\n     */\r\n    private getImageEntitiesActionCreator: IGetEntitiesActionCreator;\r\n\r\n    /** An instance of the 'GetEntitiesActionCreator' class for getting the lightbox entity details from the CMS\r\n     * @type {IGetEntitiesActionCreator}\r\n     */\r\n    private getLightboxEntitiesActionCreator: IGetEntitiesActionCreator;\r\n\r\n    /**\r\n     * Cancellation token so we can cancel loading (or at least the dispatching of the action when the load completes)\r\n     * of images for one lightbox when the user has switched to a different lightbox (i.e. when the active lightbox has changed).\r\n     * @type {IActionDispatchCancellationToken}\r\n     */\r\n    private getImageEntitiesCancellationToken: IActionDispatchCancellationToken;\r\n\r\n    /**\r\n     * Cancellation token so we can cancel a search (or at least the dispatching of the action when the load completes)\r\n     * @type {IActionDispatchCancellationToken}\r\n     */\r\n    private searchForLightboxesCancellationToken: IActionDispatchCancellationToken;\r\n\r\n    /**\r\n     * We set this when we want to add the lightbox once we get the information in the status monitoring callback\r\n     * @type {string}\r\n     */\r\n    private waitingToAdd: string;\r\n\r\n    /**\r\n     * We set this when we need to update the lightbox details in our state once we get the information in the status monitoring callback.\r\n     * This is set when a lightbox is set active.\r\n     * @type {string}\r\n     */\r\n    private waitingToUpdate: string;\r\n\r\n    /**\r\n     * Initializes a new instance of the LightboxManager class.\r\n     * @constructor\r\n     * @param instrumentationClient {IInstrumentationClient} Provides support for instrumentation.\r\n     * @param lightboxActions {LightboxActions} Actions to raise to update lightbox state\r\n     * @param lightboxActionCreator {ILightboxActionCreator} lightboxActionCreator to carry out operations and raise actions to update lightbox state\r\n     * @param lightboxGetEntityListActions {EntityListActions} Actions for managing the retrieval of the lightbox entity's information from the CMS when getting by ID\r\n     * @param lightboxSearchEntityListActions {EntityListActions} Actions for managing the retrieval of the lightbox entity's information from the CMS when searching\r\n     * @param searchForLightboxesActionCreator {ISearchActionCreator} Action creator for carrying out search and updating state\r\n     * @param imageAcquisitionManager {IImageAcquisitionManager} - The imageAcquisitionManager\r\n     * @param imageEntityListActions {EntityListActions} Actions for managing the retrieval of the image entities contained in the lightbox from the CMS\r\n     * @param imagePreviewModalActions {ImagePreviewModalActions} Actions for managing current selected preview modal index in the event lightbox is modified in a different window.\r\n     * @param modalProvisioningActions {ModalProvisioningActions} Actions for managing current preview modal.\r\n     * @param imageCommandActions {ImageCommandActions} - The image command actions\r\n     * @param store {string} - The redux store\r\n     * @param getLightboxState: {() => ILightboxState} Callback to get the lightbox state\r\n     * @param getLightboxPageState: {() => ILightboxPageState} Callback to get the lightbox page state\r\n     * @param onActiveLightboxChanged: {(activeId: string) => void} Callback to invoke when the active lightbox has changed\r\n     * @param notificationListActions {NotificationListActions}\r\n     */\r\n    constructor(\r\n        private instrumentationClient: IInstrumentationClient,\r\n        private lightboxActions: LightboxActions,\r\n        private lightboxActionCreator: ILightboxActionCreator,\r\n        private lightboxGetEntityListActions: EntityListActions,\r\n        private lightboxSearchEntityListActions: EntityListActions,\r\n        private searchForLightboxesActionCreator: ISearchActionCreator,\r\n        private imageAcquisitionManager: IImageAcquisitionManager,\r\n        private imageEntityListActions: EntityListActions,\r\n        private imagePreviewModalActions: ImagePreviewModalActions,\r\n        private modalProvisioningActions: ModalProvisioningActions,\r\n        private imageCommandActions: ImageCommandActions,\r\n        private store: IStore<any>,\r\n        private getLightboxState: () => ILightboxState,\r\n        private getLightboxPageState: () => ILightboxPageState<IEntityListState>,\r\n        private onActiveLightboxChanged: (activeId: string) => void\r\n    ) {\r\n        this.getImageEntitiesCancellationToken = null;\r\n        this.searchForLightboxesCancellationToken = null;\r\n\r\n        this.getLightboxEntitiesActionCreator = new GetEntitiesActionCreator(\r\n            ccsdk.entityFactories.cats.businessLogicFactory,\r\n            this.store,\r\n            this.lightboxGetEntityListActions);\r\n\r\n        this.waitingToAdd = \"\";\r\n        this.waitingToUpdate = \"\";\r\n\r\n        this.getLightboxInformation = this.getLightboxInformation.bind(this);\r\n        this.searchForLightboxes = this.searchForLightboxes.bind(this);\r\n        this.createLightbox = this.createLightbox.bind(this);\r\n        this.addLightbox = this.addLightbox.bind(this);\r\n        this.removeLightbox = this.removeLightbox.bind(this);\r\n        this.addItemsToLightbox = this.addItemsToLightbox.bind(this);\r\n        this.removeItemsFromLightbox = this.removeItemsFromLightbox.bind(this);\r\n        this.getEntitiesInActiveLightbox = this.getEntitiesInActiveLightbox.bind(this);\r\n        this.getActiveLightboxId = this.getActiveLightboxId.bind(this);\r\n        this.setActiveLightbox = this.setActiveLightbox.bind(this);\r\n        this.addSetActiveAndMonitorLightbox = this.addSetActiveAndMonitorLightbox.bind(this);\r\n        this.setActiveAndMonitorLightbox = this.setActiveAndMonitorLightbox.bind(this);\r\n        this.startMonitoring = this.startMonitoring.bind(this);\r\n        this.stopMonitoring = this.stopMonitoring.bind(this);\r\n        this.getLightboxEntityWithMetadata = this.getLightboxEntityWithMetadata.bind(this);\r\n        this.constructGetImageEntitiesCreatorsInstance = this.constructGetImageEntitiesCreatorsInstance.bind(this);\r\n        this.onLightboxChangedCallback = this.onLightboxChangedCallback.bind(this);\r\n        this.statusMonitoringCallback = this.statusMonitoringCallback.bind(this);\r\n        this.stopLightboxMonitoring = this.stopLightboxMonitoring.bind(this);\r\n    }\r\n\r\n    // Helper method to extract the id from the annotated entity's href\r\n    private static idFromAnnotatedEntity(annotatedEntity: IAnnotatedEntity): string {\r\n        return EntityLinkHrefSerialization.parseFromString(annotatedEntity.cmsReference.href).id;\r\n    }\r\n\r\n    /**\r\n     * Populate the information for a set of lightboxes\r\n     * @param {string[]} lightboxIds - The ids of the lightboxes to load\r\n     * @param {IActivityLogItem} parentActivity - The telemetry parent activity\r\n     * @method\r\n     * @param name: {Promise<IEntityWithMetadata<IEntity>[]>} Promise for the entities\r\n     */\r\n    public getLightboxInformation(lightboxIds: string[], parentActivity: IActivityLogItem): Promise<IEntityWithMetadata<IEntity>[]> {\r\n\r\n        const getLightboxActivity = this.instrumentationClient.ActivityLoggingService.createActivity(\"LightboxManager.GetLightboxInformation\", parentActivity);\r\n\r\n        const getLightboxPromise = this.getLightboxEntitiesActionCreator.getMoreEntities(\r\n            { name: \"annotatedCollection\" },\r\n            lightboxIds,\r\n            LightboxManager.RequiredFieldListForAnnotatedEntityCollection,\r\n            null,\r\n            getLightboxActivity);\r\n\r\n        getLightboxPromise.catch(error => {\r\n            this.instrumentationClient.LoggingService.error(\r\n                \"LightboxManager.GetLightboxInformation::error\",\r\n                getLightboxActivity,\r\n                {\r\n                    lightboxIds,\r\n                    error\r\n                }\r\n            );\r\n            this.handleServiceError(error);\r\n        });\r\n\r\n        PromiseExtension.onComplete(getLightboxPromise, () => this.instrumentationClient.ActivityLoggingService.endActivity(getLightboxActivity));\r\n\r\n        return getLightboxPromise;\r\n    }\r\n\r\n    /**\r\n     * Search for lightboxes by name\r\n     * @param {string} the search string\r\n     * @param {IActivityLogItem} parentActivity - The telemetry parent activity\r\n     * @method\r\n     * @param name: {Promise<IEntityWithMetadata<IEntity>[]>} Promise for the entities\r\n     */\r\n    public searchForLightboxes(name: string, parentActivity: IActivityLogItem): Promise<IEntityWithMetadata<IEntity>[]> {\r\n        const searchForLightboxesActivity = this.instrumentationClient.ActivityLoggingService.createActivity(\"LightboxManager.SearchForLightboxes\", parentActivity);\r\n\r\n        // Ensure results from any outstanding search are not dispatched\r\n        this.cancelCurrentAndCreateNewSearchCancellationToken();\r\n\r\n        // The search filter for lightboxes is always the same\r\n        // The search is for documents of type annotatedCollection under the lightbox parent section\r\n        const filterBy =\r\n            new Predicate(\"undersectionid\", ops.EqualityOperators.EQUALS, appConfig.lightboxParentSectionId)\r\n                .and(new Predicate(\"$type\", ops.EqualityOperators.EQUALS, Types.AnnotatedCollection.name));\r\n\r\n        // The order of results when searching for lightboxes is by relevance (the default) unless no search text\r\n        // has been specified. In this case the results are ordered by more recently updated\r\n        const orderBy = (isNil(name) || isEmpty(name)) ? [{\r\n            field: \"_lastEditedDateTime\",\r\n            direction: Direction.Desc\r\n        }] : [];\r\n\r\n        const searchForLightboxesPromise = this.searchForLightboxesActionCreator.search(\r\n            SearchIndex.Unpublished,\r\n            LightboxManager.RequiredFieldListForAnnotatedEntityCollection,\r\n            orderBy,\r\n            filterBy,\r\n            name,\r\n            AppConstants.maxLightboxSearchResults,\r\n            this.searchForLightboxesCancellationToken,\r\n            searchForLightboxesActivity);\r\n\r\n        searchForLightboxesPromise.catch((error) => {\r\n            this.instrumentationClient.LoggingService.error(\r\n                \"LightboxManager.SearchForLightboxes::error\",\r\n                searchForLightboxesActivity,\r\n                {\r\n                    name,\r\n                    error\r\n                }\r\n            );\r\n            this.handleServiceError(error);\r\n        });\r\n\r\n        PromiseExtension.onComplete(searchForLightboxesPromise, () => this.instrumentationClient.ActivityLoggingService.endActivity(searchForLightboxesActivity));\r\n\r\n        return searchForLightboxesPromise;\r\n    }\r\n\r\n    /**\r\n     * Creates a new lightbox.\r\n     * @method\r\n     * @param {string} name - The name of the lightbox\r\n     * @param {IActivityLogItem} parentActivity - The telemetry parent activity\r\n     * @param {(correlationVector: string) => void} logUserAction - A function that logs telemetry data for the user action.\r\n     */\r\n    public createLightbox(name: string, parentActivity: IActivityLogItem, logUserAction: (correlationVector: string) => void): void {\r\n\r\n        const createNewLightboxActivity = this.instrumentationClient.ActivityLoggingService.createActivity(\r\n            \"LightboxManager.CreateLightbox\",\r\n            parentActivity,\r\n            { name });\r\n\r\n        logUserAction(createNewLightboxActivity.correlationVector);\r\n\r\n        this.setActiveLightbox(\"\");\r\n        this.lightboxActions.ClearNotification.getActionSender(this.store)();\r\n\r\n        const createNewLightboxPromise = this.lightboxActionCreator.createLightbox(\r\n            name,\r\n            appConfig.catsTenantName,\r\n            appConfig.lightboxParentSectionId,\r\n            createNewLightboxActivity);\r\n\r\n        createNewLightboxPromise.then((response) => {\r\n            createNewLightboxActivity.Data.lightboxId = response.entity._id;\r\n            this.instrumentationClient.ActivityLoggingService.endActivity(createNewLightboxActivity);\r\n            this.lightboxGetEntityListActions.MoreEntitiesLoaded.getActionSender(this.store)([response], null);\r\n        }).catch((error) => {\r\n            this.instrumentationClient.LoggingService.error(\r\n                \"LightboxManager.CreateLightbox::error\",\r\n                createNewLightboxActivity,\r\n                {\r\n                    name,\r\n                    error\r\n                });\r\n            this.instrumentationClient.ActivityLoggingService.endActivity(createNewLightboxActivity);\r\n            this.handleServiceError(error);\r\n        });\r\n    }\r\n\r\n    /**\r\n     * Add a lightbox to the recent list.\r\n     * @method\r\n     * @param {string} lightboxId - The id of the lightbox\r\n     * @param {string} lightboxId - The name of the lightbox\r\n     * @param {IActivityLogItem} parentActivity - The telemetry parent activity\r\n     */\r\n    public addLightbox(lightboxId: string, lightboxName: string, parentActivity: IActivityLogItem): Promise<any> {\r\n\r\n        const addLightboxActivity = this.instrumentationClient.ActivityLoggingService.createActivity(\"LightboxManager.addLightbox\", parentActivity);\r\n\r\n        const addLightboxPromise = this.lightboxActionCreator.addLightbox(lightboxId, lightboxName, addLightboxActivity);\r\n\r\n        addLightboxPromise.catch((error) => {\r\n            this.instrumentationClient.LoggingService.error(\"LightboxManager.AddLightboxLoadActivity::error\", addLightboxActivity, { lightboxId, error });\r\n        });\r\n\r\n        PromiseExtension.onComplete(addLightboxPromise, () => this.instrumentationClient.ActivityLoggingService.endActivity(addLightboxActivity));\r\n\r\n        return addLightboxPromise;\r\n    }\r\n\r\n    /**\r\n     * Remove a lightbox from the recent list.\r\n     * @method\r\n     * @param {string} lightboxId - The id of the lightbox\r\n     */\r\n    public removeLightbox(lightboxId: string): void {\r\n\r\n        const removeLightboxActivity = this.instrumentationClient.ActivityLoggingService.createActivity(\"LightboxManager.RemoveLightbox\", this.instrumentationClient.RootActivity, { lightboxId });\r\n\r\n        const activeLightboxId = this.getActiveLightboxId();\r\n        if ((lightboxId === activeLightboxId) && !isEmpty(activeLightboxId)) {\r\n            this.setActiveLightbox(\"\");\r\n        }\r\n\r\n        const removeLightboxPromise = this.lightboxActionCreator.removeLightbox(lightboxId, removeLightboxActivity);\r\n\r\n        removeLightboxPromise\r\n            .then(() => this.instrumentationClient.LoggingService.info(\"LightboxManager.RemoveLightbox::success\", removeLightboxActivity, { lightboxId }))\r\n            .catch(error => {\r\n                this.instrumentationClient.LoggingService.error(\"LightboxManager.RemoveLightbox::error\", removeLightboxActivity, { lightboxId });\r\n                this.handleServiceError(error);\r\n            });\r\n\r\n        PromiseExtension.onComplete(removeLightboxPromise, () => this.instrumentationClient.ActivityLoggingService.endActivity(removeLightboxActivity));\r\n    }\r\n\r\n    /**\r\n     * Add items to a lightbox\r\n     * @method\r\n     * @param {string} lightboxId - The id of the lightbox\r\n     * @param {IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>>[]} entitiesWithMetadata - The entities to add\r\n     * @param {IActivityLogItem} parentActivity - The telemetry parent activity\r\n     * @param {(correlationVector: string) => void} logUserAction - A function that logs telemetry data for the user action.\r\n     */\r\n    public addItemsToLightbox(\r\n        lightboxId: string,\r\n        entitiesWithMetadata: IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>>[],\r\n        parentActivity: IActivityLogItem,\r\n        logUserAction: (correlationVector: string) => void): TypedPromise<IEntityWithMetadata<IAnnotatedEntityCollection>, IAnnotatedCollectionError> {\r\n\r\n        const addItemsToLightboxActivity = this.instrumentationClient.ActivityLoggingService.createActivity(\"LightboxManager.AddItemsToLightbox\", parentActivity);\r\n        logUserAction(addItemsToLightboxActivity.correlationVector);\r\n\r\n        this.lightboxActions.ClearNotification.getActionSender(this.store)();\r\n\r\n        const lightboxName = this.getLightboxEntityWithMetadata(lightboxId).entity._name;\r\n        const hrefs = entitiesWithMetadata.map(entityWithMetadata => ccsdk.inspectors.entity.getSelfLinkHrefString(entityWithMetadata));\r\n\r\n        const addItemsToLightboxPromise = this.lightboxActionCreator.addItemsToLightbox(lightboxId, lightboxName, hrefs, addItemsToLightboxActivity);\r\n\r\n        addItemsToLightboxPromise\r\n            .then(() => {\r\n                this.instrumentationClient.LoggingService.info(\"LightboxManager.addItemsToLightbox::success\", addItemsToLightboxActivity, { lightboxId, hrefs });\r\n            })\r\n            .catch((error) => {\r\n                if (error.type && error.type === \"LinkNotExist\") {\r\n                    throw error;\r\n                } else {\r\n                    this.lightboxActionCreator.createErrorNotification(error.toString());\r\n                }\r\n            });\r\n\r\n        PromiseExtension.onComplete(addItemsToLightboxPromise, () => this.instrumentationClient.ActivityLoggingService.endActivity(addItemsToLightboxActivity));\r\n\r\n        return addItemsToLightboxPromise;\r\n    }\r\n\r\n    /**\r\n     * Add creative items to a lightbox\r\n     * @method\r\n     * @param {IImageAcquisitionManager} imageAcquisitionManager - The image acqusition Manager to ingest creative image\r\n     * @param {string} lightboxId - The id of the lightbox\r\n     * @param {ICreativeImage} creativeImage - The creative Image to add\r\n     * @param {CreativeProvider} providerName - The provider of the image\r\n     * @param {IActivityLogItem} parentActivity - The telemetry parent activity\r\n     * @param {(correlationVector: string) => void} logUserAction - A function that logs telemetry data for the user action.\r\n     * @returns {TypedPromise<IEntityWithMetadata<IAnnotatedEntityCollection>, IAnnotatedCollectionError>}\r\n     */\r\n    public addCreativeItemsToLightbox(\r\n        imageAcquisitionManager: IImageAcquisitionManager,\r\n        lightboxId: string,\r\n        creativeImage: ICreativeImage,\r\n        providerName: CreativeProvider,\r\n        parentActivity: IActivityLogItem,\r\n        logUserAction: (correlationVector: string) => void): TypedPromise<IEntityWithMetadata<IAnnotatedEntityCollection>, IAnnotatedCollectionError> {\r\n\r\n        const addItemsToLightboxActivity = this.instrumentationClient.ActivityLoggingService.createActivity(\"LightboxManager.AddCreativeItemsToLightbox\", parentActivity);\r\n        logUserAction(addItemsToLightboxActivity.correlationVector);\r\n\r\n        this.lightboxActions.ClearNotification.getActionSender(this.store)();\r\n        const lightboxName = this.getLightboxEntityWithMetadata(lightboxId).entity._name;\r\n        this.imageCommandActions.ImageIngestionInProgress.getActionSender(this.store)(creativeImage.id);\r\n        const promise = new TypedPromise<IEntityWithMetadata<IAnnotatedEntityCollection>, IAnnotatedCollectionError>((resolve, _reject) => {\r\n            imageAcquisitionManager.ingestImage(\r\n                providerName,\r\n                creativeImage.id,\r\n                creativeImage.previewImageUrl,\r\n                creativeImage.id,\r\n                AssetFamily.creative,\r\n                parentActivity).then((cmsImageId) => {\r\n                    const href = \"cms/api/cats/imageFileData/\" + cmsImageId;\r\n                    const addItemsToLightboxPromise = this.lightboxActionCreator.addItemsToLightbox(lightboxId, lightboxName, [href], addItemsToLightboxActivity);\r\n                    addItemsToLightboxPromise.then((lightbox) => {\r\n                        resolve(lightbox);\r\n                    }).catch((error: IErrorResponse) => {\r\n                        this.instrumentationClient.LoggingService.error(\"LightboxManager.addCreativeItemsToLightbox::error\", addItemsToLightboxActivity, { lightboxId, hrefs: [href] });\r\n                        this.lightboxActionCreator.createErrorNotification(error.errorMessage);\r\n                    });\r\n\r\n                    PromiseExtension.onComplete(addItemsToLightboxPromise, () => this.imageCommandActions.ImageIngestionCompleted.getActionSender(this.store)(creativeImage.id, cmsImageId));\r\n\r\n                })\r\n                .catch((error) => {\r\n                    if (error.type && error.type === \"LinkNotExist\") {\r\n                        throw error;\r\n                    } else {\r\n                        this.lightboxActionCreator.createErrorNotification(error.toString());\r\n                    }\r\n                });\r\n        });\r\n\r\n        PromiseExtension.onComplete(promise, () => this.instrumentationClient.ActivityLoggingService.endActivity(addItemsToLightboxActivity));\r\n        return promise;\r\n    }\r\n\r\n    /**\r\n     * Remove items from a lightbox.\r\n     * @param {string} lightboxId - id of the lightbox\r\n     * @param {string[]} entitiesToRemove - The ids of the entities to remove\r\n     * @param {IActivityLogItem} parentActivity - The telemetry parent activity\r\n     * @param {(correlationVector: string) => void} logUserAction - A function that logs telemetry data for the user action.\r\n     */\r\n    public removeItemsFromLightbox(\r\n        lightboxId: string,\r\n        entitiesToRemove: string[],\r\n        parentActivity: IActivityLogItem,\r\n        logUserAction: (correlationVector: string) => void): void {\r\n\r\n        const removeItemsFromLightboxActivity =\r\n            this.instrumentationClient.ActivityLoggingService.createActivity(\"LightboxManager.RemoveItemsFromLightbox\", parentActivity, { lightboxId, entitiesToRemove });\r\n        logUserAction(removeItemsFromLightboxActivity.correlationVector);\r\n\r\n        const lightboxEntityWithMetadata = this.getLightboxEntityWithMetadata(lightboxId);\r\n\r\n        if (!isNil(lightboxEntityWithMetadata)) {\r\n\r\n            const currentLightBoxEntity = lightboxEntityWithMetadata.entity;\r\n\r\n            const annotatedEntities = entitiesToRemove.map((entityId) => {\r\n                const annotatedEntity = currentLightBoxEntity.collection.items.find(item => LightboxManager.idFromAnnotatedEntity(item) === entityId);\r\n                return annotatedEntity;\r\n            });\r\n\r\n            const removeItemsPromise = this.lightboxActionCreator.removeItemsFromLightbox(lightboxId, currentLightBoxEntity._name, annotatedEntities, removeItemsFromLightboxActivity);\r\n            removeItemsPromise.catch((error) => {\r\n                const errorString = typeof error === \"string\" ? error : (error as IAnnotatedCollectionError).errorMessage;\r\n                this.lightboxActionCreator.createErrorNotification(errorString);\r\n            });\r\n\r\n            PromiseExtension.onComplete(\r\n                removeItemsPromise,\r\n                () => this.instrumentationClient.ActivityLoggingService.endActivity(removeItemsFromLightboxActivity)\r\n            );\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Gets the list of entites that are in the active lightbox\r\n     * @method\r\n     * @returns {string[]} The list of entities (ids) that are in the lightbox\r\n     */\r\n    public getIDsOfEntitiesInActiveLightbox(): string[] {\r\n        let entityIds: string[] = [];\r\n        const activeLightboxId = this.getActiveLightboxId();\r\n\r\n        // Is there an active lightbox?\r\n        if (!isEmpty(activeLightboxId)) {\r\n            const lightboxEntityWithMetadata = this.getLightboxEntityWithMetadata(activeLightboxId);\r\n            if (!isNil(lightboxEntityWithMetadata)) {\r\n                lightboxEntityWithMetadata.entity.collection.items.forEach(item => entityIds.push(LightboxManager.idFromAnnotatedEntity(item)));\r\n            }\r\n        }\r\n\r\n        return entityIds;\r\n    }\r\n\r\n    /**\r\n     * Retrieve the entities in the active lightbox (currently only one lightbox can be active at a time).\r\n     * @method\r\n     * @param {IActivityLogItem} parentActivity - The telemetry parent activity\r\n     * @returns {Promise<IEntityWithMetadata<IEntity>[]>} A promise for the entities that are in the lightbox\r\n     */\r\n    public getEntitiesInActiveLightbox(parentActivity: IActivityLogItem): Promise<IEntityWithMetadata<IEntity>[]> {\r\n        const activeLightboxId = this.getActiveLightboxId();\r\n\r\n        let getEntitiesPromise: Promise<IEntityWithMetadata<IEntity>[]> = new Promise(resolve => resolve([]));\r\n\r\n        // Is there an active lightbox?\r\n        if (!isEmpty(activeLightboxId)) {\r\n\r\n            const lightboxEntityWithMetadata = this.getLightboxEntityWithMetadata(activeLightboxId);\r\n            if (!isNil(lightboxEntityWithMetadata)) {\r\n\r\n                this.lightboxActionCreator.clearErrorNotification();\r\n                this.constructGetImageEntitiesCreatorsInstance(this.store);\r\n                this.cancelCurrentAndCreateNewCancellationToken();\r\n\r\n                const cancellationToken = this.getImageEntitiesCancellationToken;\r\n\r\n                const currentLightBoxEntity = lightboxEntityWithMetadata.entity;\r\n\r\n                const entityIds = currentLightBoxEntity.collection.items.map(item => {\r\n                    return LightboxManager.idFromAnnotatedEntity(item);\r\n                });\r\n\r\n                if (!isEmpty(entityIds)) {\r\n                    const getEntitiesInActiveLightboxActivity = this.instrumentationClient.ActivityLoggingService.createActivity(\"LightboxManager.GetEntitiesInActiveLightbox\", parentActivity, { activeLightboxId });\r\n\r\n                    getEntitiesPromise = this.getImageEntitiesActionCreator.getEntities({ name: \"imageFileData\" }, entityIds, AppConstants.requiredFieldListForImageFileData, cancellationToken, getEntitiesInActiveLightboxActivity);\r\n\r\n                    getEntitiesPromise.catch((error) => {\r\n                        this.instrumentationClient.LoggingService.error(\"LightboxManager.getEntitiesInActiveLightbox::error\", getEntitiesInActiveLightboxActivity, { name: \"imageFileData\", entityIds, RequiredFieldListForImageFileData: AppConstants.requiredFieldListForImageFileData });\r\n                        this.lightboxActionCreator.createErrorNotification(error);\r\n                        if (!cancellationToken.isCancellationRequested) {\r\n                            this.imageEntityListActions.FirstPageEntitiesLoaded.getActionSender(this.store)([], null);\r\n                        }\r\n                        this.handleServiceError(error);\r\n                    });\r\n\r\n                    PromiseExtension.onComplete(getEntitiesPromise, () => this.instrumentationClient.ActivityLoggingService.endActivity(getEntitiesInActiveLightboxActivity));\r\n                } else {\r\n                    this.imageEntityListActions.FirstPageEntitiesLoaded.getActionSender(this.store)([], null);\r\n                }\r\n            }\r\n        }\r\n\r\n        return getEntitiesPromise;\r\n    }\r\n\r\n    /**\r\n     * Gets the active lightbox id.\r\n     * Returns an empty string if there isn't one.\r\n     * @method\r\n     */\r\n    public getActiveLightboxId(): string {\r\n        const activeLightboxId = this.getLightboxState().activeLightboxId;\r\n        return (isNil(activeLightboxId) || (isEmpty(activeLightboxId))) ? \"\" : activeLightboxId;\r\n    }\r\n\r\n    /**\r\n     * Sets the given lightbox as the active lightbox and deactivates the currently active lightbox\r\n     * @method\r\n     * @param {string} lightboxId - id of the lightbox\r\n     * @param {(correlationVector: string) => void} logUserAction - A function that logs telemetry data for the user action.\r\n     */\r\n    public setActiveLightbox(lightboxId: string, logUserAction?: (correlationVector: string) => void): void {\r\n\r\n        if (logUserAction) {\r\n            logUserAction(this.instrumentationClient.RootActivityCorrelationVector);\r\n        }\r\n\r\n        const activeLightboxId = this.getActiveLightboxId();\r\n\r\n        const activeLightboxChanged = (lightboxId !== activeLightboxId);\r\n        this.lightboxActionCreator.setLightboxActive(lightboxId);\r\n\r\n        if (!isEmpty(lightboxId)) {\r\n            this.waitingToUpdate = lightboxId;\r\n            ccsdk.annotatedEntityCollectionManager.registerCollectionUpdateListener(lightboxId, this.onLightboxChangedCallback);\r\n        }\r\n\r\n        // Unregister the previously active lightbox after registering the new one.\r\n        // This allows monitoring to continue.\r\n        if (activeLightboxChanged) {\r\n            if (!isEmpty(activeLightboxId)) {\r\n                // Only unregister the lightbox from the annotated entity collection manager monitoring,\r\n                // starting/stopping is managed outside of this function.\r\n                ccsdk.annotatedEntityCollectionManager.unregisterCollectionUpdateListener(activeLightboxId, this.onLightboxChangedCallback);\r\n            }\r\n            this.onActiveLightboxChanged(lightboxId);\r\n        }\r\n\r\n    }\r\n\r\n    /**\r\n     * Stops lightbox monitoring.\r\n     * @param {(correlationVector: string) => void} logUserAction - A function that logs telemetry data for the user action.\r\n     */\r\n    public stopLightboxMonitoring(logUserAction?: (correlationVector: string) => void): void {\r\n        if (logUserAction) {\r\n            logUserAction(this.instrumentationClient.RootActivityCorrelationVector);\r\n        }\r\n        this.stopMonitoring();\r\n    }\r\n\r\n    /**\r\n     * Adds the lightbox to the recent list (if necessary), sets it as the active lightbox and starts monitoring.\r\n     * @param {string} lightboxId - id of the lightbox\r\n     * @param {IActivityLogItem} parentActivity - The telemetry parent activity\r\n     * @param {(correlationVector: string) => void} logUserAction - A function that logs telemetry data for the user action.\r\n     * @method\r\n     */\r\n    public addSetActiveAndMonitorLightbox(lightboxId: string, parentActivity: IActivityLogItem, logUserAction?: (correlationVector: string) => void): void {\r\n        this.addSetActiveAndMonitorLightboxHelper(lightboxId, true /* add */, parentActivity, \"LightboxManager.AddSetActiveAndMonitorLightboxActivity\", logUserAction);\r\n    }\r\n\r\n    /**\r\n     * Sets the lightbox as the active lightbox and starts monitoring. Doesn't add it to the My Lightboxes (i.e. recent) list.\r\n     * @param {string} lightboxId - id of the lightbox\r\n     * @param {IActivityLogItem} parentActivity - The telemetry parent activity\r\n     * @param {(correlationVector: string) => void} logUserAction - A function that logs telemetry data for the user action.\r\n     * @method\r\n     */\r\n    public setActiveAndMonitorLightbox(lightboxId: string, parentActivity: IActivityLogItem, logUserAction?: (correlationVector: string) => void): void {\r\n        this.addSetActiveAndMonitorLightboxHelper(lightboxId, false /* add */, parentActivity, \"LightboxManager.SetActiveAndMonitorLightboxActivity\", logUserAction);\r\n    }\r\n\r\n    /**\r\n     * Start monitoring the active lightbox for changes\r\n     * It is safe to call this more than once for the currently active lightbox.\r\n     * @method\r\n     */\r\n    private startMonitoring(): void {\r\n        ccsdk.annotatedEntityCollectionManager.startListening(this.statusMonitoringCallback, this.instrumentationClient.RootActivity);\r\n    }\r\n\r\n    /**\r\n     * Stop monitoring the active lightbox for changes\r\n     * @method\r\n     */\r\n    private stopMonitoring(): void {\r\n        ccsdk.annotatedEntityCollectionManager.stopListening();\r\n\r\n        if (!isEmpty(this.getActiveLightboxId())) {\r\n            // If there's an active lightbox clear the image entities from the state\r\n            // This is a workaround to avoid a flicker when selecting a lightbox.\r\n            this.imageEntityListActions.FirstPageEntitiesLoading.getActionSender(this.store)();\r\n        }\r\n    }\r\n\r\n    private statusMonitoringCallback(status: IAnnotatedCollectionMonitorStatusInfo): void {\r\n        if (status.status === AnnotatedCollectionMonitorStatus.Running) {\r\n            const activeLightboxId = this.getActiveLightboxId();\r\n\r\n            if (!!activeLightboxId &&\r\n                status.monitoring &&\r\n                status.monitoring.length > 0) {\r\n\r\n                const entityWithMetadata = status.monitoring.find(ewm => ewm.entity._id === activeLightboxId);\r\n                if (!isNil(entityWithMetadata)) {\r\n\r\n                    const collectionStatusMonitoringCallbackActivity =\r\n                        this.instrumentationClient.ActivityLoggingService.createActivity(\"LightboxManager.statusMonitoringCallback\", this.instrumentationClient.RootActivity, { activeLightboxId });\r\n\r\n                    let promise = new Promise<any>((resolve, _reject) => {\r\n                        resolve();\r\n                    });\r\n\r\n                    if (this.waitingToAdd === activeLightboxId) {\r\n                        promise = this.addLightbox(activeLightboxId, entityWithMetadata.entity._name, collectionStatusMonitoringCallbackActivity);\r\n                        this.waitingToAdd = \"\";\r\n                    }\r\n\r\n                    if (this.waitingToUpdate === activeLightboxId) {\r\n                        const href = ccsdk.inspectors.entity.getSelfLinkHrefString(entityWithMetadata);\r\n                        this.lightboxGetEntityListActions.EntitiesUpdating.getActionSender(this.store)([href]);\r\n                        this.lightboxGetEntityListActions.EntitiesUpdated.getActionSender(this.store)([entityWithMetadata]);\r\n                        this.lightboxSearchEntityListActions.EntitiesUpdating.getActionSender(this.store)([href]);\r\n                        this.lightboxSearchEntityListActions.EntitiesUpdated.getActionSender(this.store)([entityWithMetadata]);\r\n                        this.waitingToUpdate = \"\";\r\n\r\n                        promise.then(() => {\r\n                            const getEntitiesInActiveLightboxPromise = this.getEntitiesInActiveLightbox(collectionStatusMonitoringCallbackActivity);\r\n\r\n                            getEntitiesInActiveLightboxPromise.then((entitiesWithMetadata) => {\r\n                                const failedToUpdateImages = this.getLightboxPageState().imageCommandState.creativeImageIngestionState\r\n                                    ? this.getLightboxPageState().imageCommandState.creativeImageIngestionState.failedToUpdateImages\r\n                                    : [];\r\n\r\n                                const unProcessedEntities = entitiesWithMetadata.filter(ewm =>\r\n                                    ewm.entity[\"processedByIngestion\"] === false\r\n                                    && !!ewm.entity[\"sourceId\"]\r\n                                    && failedToUpdateImages.indexOf(ewm.entity._id) < 0);\r\n\r\n                                unProcessedEntities.forEach(unProcessedEntity => {\r\n                                    getLatestStatusOfUnProcessedEntity(this.store, unProcessedEntity, this.imageCommandActions, this.imageAcquisitionManager, this.instrumentationClient, \"LightboxManager.updateLatestStatusOfUnProcessedEntity\", collectionStatusMonitoringCallbackActivity);\r\n                                });\r\n                            });\r\n\r\n                            PromiseExtension.onComplete(\r\n                                getEntitiesInActiveLightboxPromise,\r\n                                () => this.instrumentationClient.ActivityLoggingService.endActivity(collectionStatusMonitoringCallbackActivity));\r\n                        }).catch(error => {\r\n                            const errorName = \"LightboxManager.statusMonitoringCallback::error\";\r\n                            this.instrumentationClient.LoggingService.error(errorName, collectionStatusMonitoringCallbackActivity, { activeLightboxId });\r\n                            this.instrumentationClient.ActivityLoggingService.endActivity(collectionStatusMonitoringCallbackActivity);\r\n                            this.handleServiceError(error);\r\n                        });\r\n                    }\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    // Helper method for the public AddSetActiveAndMonitor and SetActiveAndMonitor methods\r\n    private addSetActiveAndMonitorLightboxHelper(lightboxId: string, add: boolean, parentActivity: IActivityLogItem, _activityName: string, logUserAction?: (correlationVector: string) => void): void {\r\n        if (logUserAction) {\r\n            logUserAction(parentActivity.correlationVector);\r\n        }\r\n\r\n        const lightboxEntity = this.getLightboxEntityWithMetadata(lightboxId);\r\n\r\n        this.waitingToUpdate = lightboxId;\r\n        if (isNil(this.getLightboxState().myLightboxes.find(item => item.id === lightboxId)) ||\r\n            isNil(lightboxEntity)) {\r\n\r\n            if (add) {\r\n                this.waitingToAdd = lightboxId;\r\n            }\r\n        }\r\n        this.setActiveLightbox(lightboxId);\r\n        this.startMonitoring();\r\n    }\r\n\r\n    // Helper to get the entityWithMetadata based on the lightbox id from the state.\r\n    private getLightboxEntityWithMetadata(lightboxId: string): IEntityWithMetadata<IAnnotatedCollection<IAnnotatedEntity>> {\r\n        const lightboxEntities = this.getLightboxState().lightboxEntitiesState.entitiesWithMetadata as IEntityWithMetadata<IAnnotatedCollection<IAnnotatedEntity>>[];\r\n        return lightboxEntities.find(lightbox => lightbox.entity._id === lightboxId);\r\n    }\r\n\r\n    /**\r\n     * Helper method to initialize the GetEntitiesActionCreator instance for getting the image entities\r\n     * @method\r\n     * @param store {IStore<any>} The store.\r\n     */\r\n    private constructGetImageEntitiesCreatorsInstance(store: IStore<any>): void {\r\n        if (!!this.getImageEntitiesActionCreator) {\r\n            return;\r\n        }\r\n\r\n        this.getImageEntitiesActionCreator = new GetEntitiesActionCreator(\r\n            ccsdk.entityFactories.cats.businessLogicFactory,\r\n            store,\r\n            this.imageEntityListActions);\r\n    }\r\n\r\n    // Callback for when the lightbox changes..\r\n    private onLightboxChangedCallback(collectionId: string, changeDetails: IAnnotatedCollectionChange<IAnnotatedEntity>): void {\r\n        if (changeDetails.changeType === AnnotatedCollectionChangeType.Remove) {\r\n            // We don't expect lightboxes to be deleted\r\n        } else {\r\n            // Lightbox has been updated\r\n            const activeLightboxId = this.getActiveLightboxId();\r\n\r\n            if (!isEmpty(activeLightboxId) && (activeLightboxId === collectionId)) {\r\n                this.processChangesToActiveLightbox(changeDetails, this.instrumentationClient.RootActivity);\r\n            }\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Refresh the active lightbox by processing the change details.\r\n     * @method\r\n     * @param {IAnnotatedCollectionChange<IAnnotatedEntity>} changeDetails The details describing the change to the collection\r\n     */\r\n    private processChangesToActiveLightbox(changeDetails: IAnnotatedCollectionChange<IAnnotatedEntity>, parentActivity: IActivityLogItem): Promise<any> {\r\n\r\n        const activeLightboxId = this.getActiveLightboxId();\r\n\r\n        this.lightboxActionCreator.clearErrorNotification();\r\n        this.constructGetImageEntitiesCreatorsInstance(this.store);\r\n        this.getOrCreateCancellationToken();\r\n\r\n        const lightboxEntityWithMetadata = this.getLightboxEntityWithMetadata(activeLightboxId);\r\n\r\n        let promiseToReturn = new Promise<any>((resolve, _reject) => {\r\n            resolve();\r\n        });\r\n\r\n        if (!isNil(lightboxEntityWithMetadata)) {\r\n            const refreshLightboxActivity = this.instrumentationClient.ActivityLoggingService.createActivity(\r\n                \"LightboxManager.RefreshLightbox\",\r\n                parentActivity,\r\n                {\r\n                    lightboxId: activeLightboxId\r\n                }\r\n            );\r\n\r\n            // Process the removals\r\n            if (!isEmpty(changeDetails.changes.removedItems)) {\r\n\r\n                // Extract the ids from the hrefs. The href is in the form \"cms/api/cats/imageFileData/AA1HuD\"\r\n                const removedIds = changeDetails.changes.removedItems.map(removedItem => LightboxManager.idFromAnnotatedEntity(removedItem));\r\n\r\n                const processRemovalsActivity =\r\n                    this.instrumentationClient.ActivityLoggingService.createActivity(\r\n                        \"LightboxManager.RefreshLightbox.ProcessRemovals\",\r\n                        refreshLightboxActivity,\r\n                        {\r\n                            lightboxId: activeLightboxId,\r\n                            itemsRemoved: removedIds\r\n                        });\r\n\r\n                const currentIndex = this.getLightboxPageState().selectedAnnotatedEntityIndex;\r\n                const maxIndex = lightboxEntityWithMetadata.entity.collection.items.length - 1;\r\n\r\n                // loop through all previous entities' ids to check if any deleted items is at pre position to the current selected one.\r\n                // we want to shift the current selected index in order to keep the current selected image stays the same after previous image(s) are deleted\r\n                const prevEntityIds = this.getIDsOfEntitiesInActiveLightbox().slice(0, currentIndex);\r\n\r\n                const shiftCount = intersection(removedIds, prevEntityIds).length;\r\n\r\n                let newIndex = Math.min(currentIndex - shiftCount, maxIndex);\r\n                if (newIndex < 0) {\r\n                    newIndex = 0;\r\n                    this.modalProvisioningActions.HideModal.getActionSender(this.store)();\r\n                }\r\n                if (currentIndex !== newIndex) {\r\n                    this.imagePreviewModalActions.ImagePreviewModalFetchEnd.getActionSender(this.store)(newIndex);\r\n                }\r\n\r\n                this.imageEntityListActions.EntitiesRemovedById.getActionSender(this.store)(removedIds);\r\n\r\n                this.instrumentationClient.ActivityLoggingService.endActivity(processRemovalsActivity);\r\n            }\r\n\r\n            // Process the adds\r\n            if (!isEmpty(changeDetails.changes.newItems)) {\r\n\r\n                const newIds = changeDetails.changes.newItems.map(newItem => LightboxManager.idFromAnnotatedEntity(newItem));\r\n\r\n                const processAddsActivity =\r\n                    this.instrumentationClient.ActivityLoggingService.createActivity(\r\n                        \"LightboxManager.RefreshLightbox.ProcessAdds\",\r\n                        refreshLightboxActivity,\r\n                        {\r\n                            lightboxId: activeLightboxId,\r\n                            itemsAdded: newIds\r\n                        });\r\n\r\n                const cancellationToken = this.getImageEntitiesCancellationToken;\r\n\r\n                promiseToReturn = this.getImageEntitiesActionCreator.getMoreEntities({ name: \"imageFileData\" }, newIds, AppConstants.requiredFieldListForImageFileData, cancellationToken, processAddsActivity);\r\n                promiseToReturn.catch((error) => {\r\n                    this.instrumentationClient.LoggingService.error(\r\n                        \"LightboxManager.RefreshLightbox::processAdds::error\",\r\n                        processAddsActivity,\r\n                        {\r\n                            lightboxId: activeLightboxId,\r\n                            error: error\r\n                        });\r\n                    this.lightboxActionCreator.createErrorNotification(error);\r\n                });\r\n\r\n                PromiseExtension.onComplete(promiseToReturn, () => {\r\n                    this.instrumentationClient.ActivityLoggingService.endActivity(processAddsActivity);\r\n                });\r\n            }\r\n\r\n            PromiseExtension.onComplete(promiseToReturn, () => {\r\n                this.instrumentationClient.ActivityLoggingService.endActivity(refreshLightboxActivity);\r\n            });\r\n        }\r\n\r\n        const href = ccsdk.inspectors.entity.getSelfLinkHrefString(changeDetails.newCollection);\r\n        this.lightboxGetEntityListActions.EntitiesUpdating.getActionSender(this.store)([href]);\r\n        this.lightboxGetEntityListActions.EntitiesUpdated.getActionSender(this.store)([changeDetails.newCollection]);\r\n        this.lightboxSearchEntityListActions.EntitiesUpdating.getActionSender(this.store)([href]);\r\n        this.lightboxSearchEntityListActions.EntitiesUpdated.getActionSender(this.store)([changeDetails.newCollection]);\r\n\r\n        return promiseToReturn;\r\n    }\r\n\r\n    /**\r\n     * Helper method to get the current cancellation token, provided it has not already been cancelled.\r\n     * Create and return a new one if it has.\r\n     * @method\r\n     * @returns {IActionDispatchCancellationToken} The token.\r\n     */\r\n    private getOrCreateCancellationToken(): IActionDispatchCancellationToken {\r\n        if ((this.getImageEntitiesCancellationToken === null) || this.getImageEntitiesCancellationToken.isCancellationRequested) {\r\n            this.getImageEntitiesCancellationToken = new ActionDispatchCancellationToken();\r\n        }\r\n        return this.getImageEntitiesCancellationToken;\r\n    }\r\n\r\n    /**\r\n     * Helper method to call cancel on the current getImageEntitiesCancellationToken and to create a new token.\r\n     * @method\r\n     */\r\n    private cancelCurrentAndCreateNewCancellationToken(): void {\r\n        if (this.getImageEntitiesCancellationToken !== null) {\r\n            this.getImageEntitiesCancellationToken.cancel();\r\n        }\r\n        this.getImageEntitiesCancellationToken = new ActionDispatchCancellationToken();\r\n    }\r\n\r\n    /**\r\n     * Helper method to call cancel on the current searchForLightboxesCancellationToken and to create a new token.\r\n     * @method\r\n     */\r\n    private cancelCurrentAndCreateNewSearchCancellationToken(): void {\r\n        if (this.searchForLightboxesCancellationToken !== null) {\r\n            this.searchForLightboxesCancellationToken.cancel();\r\n        }\r\n        this.searchForLightboxesCancellationToken = new ActionDispatchCancellationToken();\r\n    }\r\n\r\n    /**\r\n     * Handles known service errors and perform redirect to error page if needed.\r\n     * @param error {any} the error object.\r\n     * @method\r\n     */\r\n    private handleServiceError(error: any): void {\r\n        // display an inline error if there is a bad request error, raise an application level error otherwise.\r\n        let parsedServiceError = null;\r\n        if (serviceErrorParsers.badRequest.canParse(error)) {\r\n            parsedServiceError = serviceErrorParsers.badRequest.parse(error);\r\n            Actions.SearchAndSelect.InlineError.SetApplicationError.getActionSender(this.store)(parsedServiceError);\r\n        } else if (serviceErrorParsers.appLevel.canParse(error)) {\r\n            parsedServiceError = serviceErrorParsers.appLevel.parse(error);\r\n            Actions.ApplicationLevelError.SetApplicationError.getActionSender(this.store)(parsedServiceError);\r\n        } // else do nothing\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\n/**\r\n * Enum modeling the way the results can be viewed.\r\n * @enum\r\n */\r\nexport enum LightboxPanelNowShowingEnum {\r\n    /*\r\n     * Show the recent items\r\n     */\r\n    ShowRecent,\r\n\r\n    /*\r\n     * Show recently removed items as auto-suggestions\r\n     */\r\n    ShowSearch\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { DownloadImage } from \"../imagePreviewModal/DownloadImage\";\r\nimport { ICatalystFileDataMetadata } from \"clientcore-models-catalyst/ICatalystFileDataMetadata\";\r\nimport { IEntity } from \"cms-models/IEntity\";\r\nimport { IEntityWithMetadata } from \"cms-businesslogic/entity/IEntityWithMetadata\";\r\nimport { IEventData } from \"clientcore-infrastructure-analytics/models/userActivityData/IEventData\";\r\nimport { IImageCommandActionCreator } from \"../../presentation-logic/dataflows/imageCommand/IImageCommandActionCreator\";\r\nimport { IImageFileData } from \"cms-models/IImageFileData\";\r\nimport { IInstrumentationClient } from \"../../instrumentation/instrumentationClient/IInstrumentationClient\";\r\nimport { IStore } from \"redux\";\r\nimport { LightboxActions } from \"../../presentation-logic/dataflows/lightbox/LightboxActions\";\r\nimport { NotificationListActions } from \"cms-ui-presentationlogic/dataflows/notifications/NotificationListActions\";\r\nimport { NotificationType } from \"cms-ui-presentationlogic/dataflows/notifications/NotificationType\";\r\nimport { PageActionData } from \"cms-businesslogic/instrumentation/PageActionData\";\r\nimport { PromiseExtension } from \"cms-infrastructure/promise-extension/PromiseExtension\";\r\nimport { cloneDeep } from \"lodash-es\";\r\n\r\n/**\r\n * Contains functions to download the images in the lightbox.\r\n * @class\r\n */\r\nexport class LightboxDownloadManager {\r\n\r\n    /**\r\n     * Initializes a new instance of the 'LightboxDownloadManager' class.\r\n     * @constructor\r\n     * @param pageName {string} The name of the page from where the download is triggered.\r\n     * @param lightboxActions {LightboxActions} The lightbox Actions.\r\n     * @param imageCommandActionCreator {ImageCommandActionCreator} Used to download the images.\r\n     * @param instrumentationClient {IInstrumentationClient} Provides support for instrumentation.\r\n     * @param store {IStore<any>} The store to dispatch actions to.\r\n     */\r\n    constructor(\r\n        private pageName: string,\r\n        private lightboxActions: LightboxActions,\r\n        private imageCommandActionCreator: IImageCommandActionCreator,\r\n        private instrumentationClient: IInstrumentationClient,\r\n        private store: IStore<any>,\r\n        private notificationListActions: NotificationListActions = new NotificationListActions()) {\r\n        if (!pageName) {\r\n            throw \"The pageName parameter is required.\";\r\n        }\r\n        if (!store) {\r\n            throw \"The store parameter is required.\";\r\n        }\r\n\r\n        if (!lightboxActions) {\r\n            throw \"The lightboxActions parameter is required.\";\r\n        }\r\n\r\n        if (!instrumentationClient) {\r\n            throw \"The instrumentationClient parameter is required.\";\r\n        }\r\n\r\n        if (!store) {\r\n            throw \"The store parameter is required.\";\r\n        }\r\n\r\n        this.downloadAllImages = this.downloadAllImages.bind(this);\r\n        this.downloadSelectedImages = this.downloadSelectedImages.bind(this);\r\n        this.downloadSelectedImagesHelper = this.downloadSelectedImagesHelper.bind(this);\r\n    }\r\n\r\n    /**\r\n     * Download all Images in the lightbox.\r\n     * @param lightboxId {string} id of the lightbox\r\n     * @param lightboxName {string} name of the lightbox\r\n     * @param lightBoxImages {IEntityWithMetadata<IEntity>[]} image collection in the lightbox\r\n     * @param areaOfPage {string} Area of the page from where download is triggered\r\n     * @param event {React.SyntheticEvent<any>} event which triggered the download\r\n     * @method\r\n     */\r\n    public downloadAllImages(lightboxId: string, lightboxName: string, lightBoxImages: IEntityWithMetadata<IEntity>[], areaOfPage: string, event: React.SyntheticEvent<any>): void {\r\n        this.downloadSelectedImagesHelper(lightboxId, lightboxName, lightBoxImages, \"downloadAll\", \"downloadAll-Button\", areaOfPage, event);\r\n    }\r\n\r\n    /**\r\n     * Download the selected Images in the lightbox.\r\n     * @param lightboxId {string} id of the lightbox\r\n     * @param lightboxName {string} name of the lightbox\r\n     * @param lightBoxImages {IEntityWithMetadata<IEntity>[]} image collection in the lightbox\r\n     * @param areaOfPage {string} Area of the page from where download is triggered\r\n     * @param event {React.SyntheticEvent<any>} event which triggered the download\r\n     * @method\r\n     */\r\n    public downloadSelectedImages(lightboxId: string, lightboxName: string, lightBoxImages: IEntityWithMetadata<IEntity>[], areaOfPage: string, event: React.SyntheticEvent<any>): void {\r\n        this.downloadSelectedImagesHelper(lightboxId, lightboxName, lightBoxImages, \"downloadSelected\", \"downloadSelected-Button\", areaOfPage, event);\r\n    }\r\n\r\n    /**\r\n     * Retry function to download all Images which failed in the previous attempt.\r\n     * @param lightboxId {string} id of the lightbox\r\n     * @param lightboxName {string} name of the lightbox\r\n     * @param lightBoxImages {IEntityWithMetadata<IEntity>[]} image collection in the lightbox\r\n     * @param areaOfPage {string} Area of the page from where download is triggered\r\n     * @param event {React.SyntheticEvent<any>} event which triggered the download\r\n     * @method\r\n     */\r\n    public retryDownloadForFailedImages(lightboxId: string, lightboxName: string, lightBoxImages: IEntityWithMetadata<IEntity>[], areaOfPage: string, event: React.SyntheticEvent<any>): void {\r\n        this.lightboxActions.LightboxRetryFailedImagesDownload.getActionSender(this.store)(lightboxId);\r\n        const eventData = this.instrumentationClient.createEventData(event, \"downloadAll-Retry\", null, \"downloadAllRetry-Button\", areaOfPage);\r\n        this.initiateMultipleDownloads(lightboxId, lightboxName, lightBoxImages, eventData, event, areaOfPage);\r\n    }\r\n\r\n    /**\r\n     * Download Images in the lightbox.\r\n     * @param lightboxId {string} id of the lightbox\r\n     * @param lightboxName {string} name of the lightbox\r\n     * @param lightBoxImages {IEntityWithMetadata<IEntity>[]} image collection in the lightbox\r\n     * @param eventName {string} name of the event for telemetry\r\n     * @param controlName {string} name of the control for telemetry\r\n     * @param areaOfPage {string} Area of the page from where download is triggered\r\n     * @param event {React.SyntheticEvent<any>} event which triggered the download\r\n     * @method\r\n     */\r\n    private downloadSelectedImagesHelper(lightboxId: string, lightboxName: string, lightBoxImages: IEntityWithMetadata<IEntity>[], eventName: string, controlName: string, areaOfPage: string, event: React.SyntheticEvent<any>): void {\r\n        this.lightboxActions.LightboxImagesDownloadStarted.getActionSender(this.store)(lightboxId);\r\n        const eventData = this.instrumentationClient.createEventData(event, eventName, null, controlName, areaOfPage);\r\n        this.initiateMultipleDownloads(lightboxId, lightboxName, lightBoxImages, eventData, event, areaOfPage);\r\n    }\r\n\r\n    /**\r\n     * Function to handle the download of all Images in the lightbox.\r\n     * @param lightboxId {string} id of the lightbox\r\n     * @param lightboxName {string} name of the lightbox\r\n     * @param lightBoxImages {IEntityWithMetadata<IEntity>[]} image collection in the lightbox\r\n     * @param eventData {IEventData} event Data for instrumentation\r\n     * @param event {React.SyntheticEvent<any>} event which triggered the download\r\n     * @param areaOfPage {string} Area of the page from where download is triggered\r\n     * @method\r\n     */\r\n    private initiateMultipleDownloads(lightboxId: string, lightboxName: string, lightBoxImages: IEntityWithMetadata<IEntity>[], eventData: IEventData, event: React.SyntheticEvent<any>, areaOfPage: string): void {\r\n        this.instrumentationClient.UserActivityTrackingService.logPageActionEvent(\r\n            eventData,\r\n            this.pageName,\r\n            null,\r\n            PageActionData.createFrom(null, { \"download-count\": lightBoxImages.length }, null, null, null, null, this.pageName));\r\n        let downloadPromises = [];\r\n        let batchPromises = [];\r\n        let startIndex = 0;\r\n        let endIndex = 5;\r\n        this.lightboxActions.LightboxRetryFailedImagesDownload.getActionSender(this.store)(lightboxId);\r\n        this.initiateDownload(lightboxId, lightboxName, batchPromises, lightBoxImages, event, downloadPromises, areaOfPage, startIndex, endIndex);\r\n    }\r\n\r\n    /**\r\n     * Function to handle the download of all Images in the lightbox.\r\n     * @param lightboxId {string} id of the lightbox\r\n     * @param lightboxName {string} name of the lightbox\r\n     * @param batchPromises {Array<any>} collection of promises which when complete initiates the next set of downloads\r\n     * @param lightBoxImages {IEntityWithMetadata<IEntity>[]} image collection in the lightbox\r\n     * @param event {React.SyntheticEvent<any>} event which triggered the download\r\n     * @param downloadAllPromises {Array<any>} collection of all the download promises.\r\n     * @param areaOfPage {string} Area of the page from where download is triggered\r\n     * @param startIndex {number} start index in the lightbox collection\r\n     * @param endIndex {number} end index in the lightbox collection\r\n     * @method\r\n     */\r\n    private initiateDownload(\r\n        lightboxId: string,\r\n        lightboxName: string,\r\n        batchPromises: Array<any>,\r\n        lightBoxImages: Array<IEntityWithMetadata<IEntity>>,\r\n        event: React.SyntheticEvent<any>,\r\n        downloadAllPromises: Array<any>,\r\n        areaOfPage: string,\r\n        startIndex: number = 0,\r\n        endIndex: number = 5): void {\r\n        let downloadAllClickEvent = cloneDeep(event);\r\n        PromiseExtension.onAllComplete(batchPromises).then(() => {\r\n            let batch = lightBoxImages.slice(startIndex, endIndex);\r\n            if (batch.length > 0) {\r\n                let currentBatchPromises = [];\r\n                batch.forEach((selectedImageEntity => {\r\n                    const selectedEntity = selectedImageEntity.entity as IImageFileData<ICatalystFileDataMetadata>;\r\n                    const downloadPromise = DownloadImage(\r\n                        downloadAllClickEvent,\r\n                        selectedEntity,\r\n                        this.pageName,\r\n                        this.imageCommandActionCreator,\r\n                        this.instrumentationClient,\r\n                        \"DownloadAll\",\r\n                        null,\r\n                        null,\r\n                        lightboxId + \"_\" + selectedEntity._id,\r\n                        areaOfPage);\r\n                    downloadPromise.catch(() => {\r\n                        this.lightboxActions.LightboxImageDownloadFailed.getActionSender(this.store)(lightboxId, selectedImageEntity);\r\n                    });\r\n                    currentBatchPromises.push(downloadPromise);\r\n                }));\r\n\r\n                const count = 5;\r\n                startIndex += count;\r\n                endIndex += count;\r\n                this.initiateDownload(lightboxId, lightboxName, currentBatchPromises, lightBoxImages, downloadAllClickEvent, downloadAllPromises, areaOfPage, startIndex, endIndex);\r\n            } else {\r\n                PromiseExtension.onAllComplete(downloadAllPromises).then(() => {\r\n                    this.lightboxActions.LightboxImagesDownloadFinished.getActionSender(this.store)(lightboxId);\r\n                    this.notificationListActions.AddNotification.getActionSender(this.store)(NotificationType.Info, \"Download of images in '\" + lightboxName + \"' is complete.\");\r\n                });\r\n            }\r\n        });\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { IActionPayload } from \"cms-ui-redux/IActionPayload\";\r\nimport { ILightboxPageBootstrapperState } from \"./ILightboxPageBootstrapperState\";\r\nimport { LightboxPageReduction } from \"./LightboxPageReduction\";\r\nimport { NamespaceCheckReducerBase } from \"cms-ui-redux/NamespaceCheckReducerBase\";\r\nimport { clone } from \"lodash-es\";\r\n\r\n/**\r\n * The main state reduction for the lightbox page experience is actually the LightboxPageReduction.\r\n * This reducer wraps an instance of the LightboxPageReduction, and leaves the other aspect of the state (the lightboxState) untouched.\r\n * @class\r\n */\r\nexport class LightboxPageBootstrapperReduction extends NamespaceCheckReducerBase<ILightboxPageBootstrapperState> {\r\n    /**\r\n     * Initializes a new instance of the `LightboxPageBootstrapperReduction` class.\r\n     * @constructor\r\n     */\r\n    constructor(public lightboxPageReduction: LightboxPageReduction) {\r\n        super([], [lightboxPageReduction]);\r\n    }\r\n\r\n    /**\r\n     * Mutates the given state with the given action.\r\n     * Only the lightboxPageState component of the state is reduced by this reducer.\r\n     * The lightboxState is reduced by the SignedInApp reducer and is unchanged by this reducer.\r\n     * @function\r\n     * @param state {ILightboxPageBootstrapperState} The state that the reducer should mutate.\r\n     * @param actionPayload {IActionPayload} The action detail to update the state with.\r\n     * @returns {ILightboxPageBootstrapperState} The mutated state.\r\n     */\r\n    public reduce(state: ILightboxPageBootstrapperState, actionPayload: IActionPayload): ILightboxPageBootstrapperState {\r\n\r\n        if (!state) {\r\n            throw \"The state parameter is required.\";\r\n        }\r\n\r\n        if (!actionPayload) {\r\n            throw \"The actionPayload parameter is required.\";\r\n        }\r\n\r\n        let newState = clone(state);\r\n        if (this.lightboxPageReduction.canReduce(actionPayload)) {\r\n            newState.lightboxPageState = this.lightboxPageReduction.reduce(state.lightboxPageState, actionPayload);\r\n            return newState;\r\n        }\r\n\r\n        return newState;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { ActionHandler } from \"cms-ui-redux/ActionHandler\";\r\nimport { EntityListReduction } from \"cms-ui-presentationlogic/dataflows/entityList/EntityListReduction\";\r\nimport { EntitySearchActions } from \"cms-ui-presentationlogic/dataflows/entitySearch/EntitySearchActions\";\r\nimport { IActionPayload } from \"cms-ui-redux/IActionPayload\";\r\nimport { IEntity } from \"cms-models/IEntity\";\r\nimport { IEntityListState } from \"cms-ui-presentationlogic/dataflows/entityList/IEntityListState\";\r\nimport { IEntityWithMetadata } from \"cms-businesslogic/entity/IEntityWithMetadata\";\r\nimport { ILightboxPageState } from \"./ILightboxPageState\";\r\nimport { ImageCommandReduction } from \"../imageCommand/ImageCommandReduction\";\r\nimport { ImagePreviewModalActions } from \"../imagePreviewModal/ImagePreviewModalActions\";\r\nimport { LightboxActions } from \"../lightbox/LightboxActions\";\r\nimport { LightboxPanelNowShowingEnum } from \"./LightboxPanelNowShowingEnum\";\r\nimport { ListEntitySelectorReduction } from \"cms-ui-presentationlogic/dataflows/listEntitySelector/ListEntitySelectorReduction\";\r\nimport { ModalProvisioningReduction } from \"cms-ui-presentationlogic/dataflows/modalProvisioning/ModalProvisioningReduction\";\r\nimport { NamespaceCheckReducerBase } from \"cms-ui-redux/NamespaceCheckReducerBase\";\r\nimport { clone } from \"lodash-es\";\r\n\r\n/**\r\n * Contains reducer for the lightbox experience.\r\n * @class\r\n */\r\nexport class LightboxPageReduction extends NamespaceCheckReducerBase<ILightboxPageState<IEntityListState>> {\r\n    /**\r\n     * Initializes a new instance of the `LightboxPageReduction` class.\r\n     * @param imagePreviewModalActions {ImagePreviewModalActions} image preview modal actions\r\n     * @param lightboxPageActions {LightboxActions} lightbox actions\r\n     * @param entitySearchActions {EntitySearchActions} entity search actions\r\n     * @param entitySelectorReduction {ListEntitySelectorReduction<IEntityListState>} reducer for the selection state\r\n     * @param modalProvisioningReduction {ModalProvisioningReduction} modal provisioning reducer\r\n     * @param imageCommandReduction: {ImageCommandReduction} Reducer for image command (e.g. downloadImage) actions\r\n     */\r\n    constructor(\r\n        public imagePreviewModalActions: ImagePreviewModalActions,\r\n        public lightboxPageActions: LightboxActions,\r\n        public entitySearchActions: EntitySearchActions,\r\n        public lightboxSearchReduction: EntityListReduction<IEntityListState>,\r\n        public entitySelectorReduction: ListEntitySelectorReduction<IEntityListState>,\r\n        public modalProvisioningReduction: ModalProvisioningReduction,\r\n        public imageCommandReduction: ImageCommandReduction\r\n    ) {\r\n        super(\r\n            [\r\n                imagePreviewModalActions.namespace,\r\n                lightboxPageActions.namespace,\r\n                entitySearchActions.namespace\r\n            ],\r\n            [\r\n                lightboxSearchReduction,\r\n                entitySelectorReduction,\r\n                modalProvisioningReduction,\r\n                imageCommandReduction\r\n            ]);\r\n\r\n        if (!imagePreviewModalActions) {\r\n            throw (\"The imagePreviewModalActions parameter is required\");\r\n        }\r\n\r\n        if (!lightboxPageActions) {\r\n            throw (\"The lightboxPageActions parameter is required\");\r\n        }\r\n\r\n        if (!entitySearchActions) {\r\n            throw (\"The entitySearchActions parameter is required\");\r\n        }\r\n\r\n        if (!lightboxSearchReduction) {\r\n            throw \"The lightboxSearchReduction parameter is required.\";\r\n        }\r\n\r\n        if (!entitySelectorReduction) {\r\n            throw \"The entitySelectorReduction parameter is required.\";\r\n        }\r\n\r\n        if (!modalProvisioningReduction) {\r\n            throw (\"The modalProvisioningReduction parameter is required\");\r\n        }\r\n\r\n        if (!imageCommandReduction) {\r\n            throw (\"The imageCommandReduction parameter is required\");\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Mutates the given state with the given action.\r\n     * @function\r\n     * @param state {ILightboxPageState} The state that the reducer should mutate.\r\n     * @param actionPayload {IActionPayload} The action detail to update the state with.\r\n     * @returns {ILightboxPageState} The mutated state.\r\n     */\r\n    public reduce(state: ILightboxPageState<IEntityListState>, actionPayload: IActionPayload): ILightboxPageState<IEntityListState> {\r\n\r\n        if (!state) {\r\n            throw \"The state parameter is required.\";\r\n        }\r\n\r\n        if (!actionPayload) {\r\n            throw \"The actionPayload parameter is required.\";\r\n        }\r\n\r\n        let newState = clone(state);\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.imagePreviewModalActions.ImagePreviewModalFetchEnd, (index: number) => {\r\n                newState.selectedAnnotatedEntityIndex = index;\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.lightboxPageActions.LightboxImagesDownloadStarted, (lightboxId: string) => {\r\n                // Initialize the collection indicating that download is started for the lightbox.\r\n                newState.downloadStatus[lightboxId] = {\r\n                    enableDownload: false,\r\n                    failedImages: []\r\n                };\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.lightboxPageActions.LightboxImagesDownloadFinished, (lightboxId: string) => {\r\n                // Update the state when the download all is finished\r\n                newState.downloadStatus[lightboxId] = clone(newState.downloadStatus[lightboxId]);\r\n                newState.downloadStatus[lightboxId].enableDownload = true;\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.lightboxPageActions.LightboxImageDownloadFailed, (lightboxId: string, failedImage: IEntityWithMetadata<IEntity>) => {\r\n                // Push the failedImage in the collection to retry later.\r\n                newState.downloadStatus[lightboxId] = clone(newState.downloadStatus[lightboxId]);\r\n                newState.downloadStatus[lightboxId].failedImages.push(failedImage);\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.lightboxPageActions.LightboxClearFailedDownloadImages, (lightboxId: string) => {\r\n                // Delete the failed images from the state.\r\n                newState.downloadStatus = clone(newState.downloadStatus);\r\n                delete newState.downloadStatus[lightboxId];\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.lightboxPageActions.LightboxRetryFailedImagesDownload, (lightboxId: string) => {\r\n                // Clear the failed download collection when retry process to download failed images is started.\r\n                newState.downloadStatus[lightboxId] = clone(newState.downloadStatus[lightboxId]);\r\n                newState.downloadStatus[lightboxId].enableDownload = false;\r\n                newState.downloadStatus[lightboxId].failedImages = [];\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(actionPayload, this.entitySearchActions.ExecuteSearch, () => {\r\n            newState.nowShowing = LightboxPanelNowShowingEnum.ShowSearch;\r\n        });\r\n\r\n        ActionHandler.handleAction(actionPayload, this.entitySearchActions.SearchTextChange, (searchText) => {\r\n            newState.searchTextState = clone(newState.searchTextState);\r\n            newState.searchTextState.searchText = searchText;\r\n        });\r\n\r\n        ActionHandler.handleAction(actionPayload, this.entitySearchActions.ClearSearch, () => {\r\n            newState.searchTextState = clone(newState.searchTextState);\r\n            newState.searchTextState.searchText = \"\";\r\n            newState.nowShowing = LightboxPanelNowShowingEnum.ShowRecent;\r\n        });\r\n\r\n        if (this.lightboxSearchReduction.canReduce(actionPayload)) {\r\n            newState.searchResultsState = this.lightboxSearchReduction.reduce(newState.searchResultsState, actionPayload);\r\n            return newState;\r\n        }\r\n\r\n        if (this.entitySelectorReduction.canReduce(actionPayload)) {\r\n            // The entitySelectorReduction reduces both the entityList and the entitySelector substates,\r\n            // so assign both of these into newState are the reducer is called.\r\n            const listAndSelectorState = this.entitySelectorReduction.reduce(newState, actionPayload);\r\n            newState.entityList = listAndSelectorState.entityList;\r\n            newState.entitySelector = listAndSelectorState.entitySelector;\r\n        }\r\n\r\n        if (this.modalProvisioningReduction.canReduce(actionPayload)) {\r\n            newState.modalProvisioningState = this.modalProvisioningReduction.reduce(newState.modalProvisioningState, actionPayload);\r\n            return newState;\r\n        }\r\n\r\n        if (this.imageCommandReduction.canReduce(actionPayload)) {\r\n            newState.imageCommandState = this.imageCommandReduction.reduce(newState.imageCommandState, actionPayload);\r\n            return newState;\r\n        }\r\n\r\n        return newState;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as Moment from \"moment\";\r\nimport * as React from \"react\";\r\n\r\nimport { AreaOfPage, PageNames } from \"../../instrumentation/instrumentationConstants/InstrumentationConstants\";\r\nimport { CalculateNextImageIndex, CalculatePreviousImageIndex, DetermineModalLayout, GetImageDimensionToDetermineLayout, InitializeModalCarouselProps } from \"../search/modalNavigation/ModalNavigationHelper\";\r\n\r\nimport { AddImageQualityQueryParamToUrl } from \"../addImageQualityParamToUrl\";\r\nimport { AppConstants } from \"../../AppConstants\";\r\nimport { BusinessLogicFactory } from \"cms-businesslogic/factory/BusinessLogicFactory\";\r\nimport { CarouselDirection } from \"../../rendering/components/modalCarousel/CarouselDirection\";\r\nimport { ComponentBootstrapper } from \"cms-ui-views/ComponentBootstrapper\";\r\nimport { DeletionType } from \"cms-businesslogic/entity/DeletionType\";\r\nimport { DownloadImage } from \"../imagePreviewModal/DownloadImage\";\r\nimport { EntityListActions } from \"cms-ui-presentationlogic/dataflows/entityList/EntityListActions\";\r\nimport { EntityListReduction } from \"cms-ui-presentationlogic/dataflows/entityList/EntityListReduction\";\r\nimport { EntitySearchActions } from \"cms-ui-presentationlogic/dataflows/entitySearch/EntitySearchActions\";\r\nimport { EntitySelectorActions } from \"cms-ui-presentationlogic/dataflows/entitySelector/EntitySelectorActions\";\r\nimport { EntitySelectorReduction } from \"cms-ui-presentationlogic/dataflows/entitySelector/EntitySelectorReduction\";\r\nimport { GetImagePreviewElementProps } from \"../imagePreviewModal/GetImagePreviewProps\";\r\nimport { GetSelectActionInput } from \"../../instrumentation/helpers/InstrumentationHelper\";\r\nimport { IActivityLogItem } from \"clientcore-infrastructure-analytics/models/IActivityLogItem\";\r\nimport { IAnnotatedCollection } from \"cms-models/annotatedCollection/IAnnotatedCollection\";\r\nimport { IAnnotatedEntity } from \"cms-models/annotatedCollection/IAnnotatedEntity\";\r\nimport { ICatalystFileDataMetadata } from \"clientcore-models-catalyst/ICatalystFileDataMetadata\";\r\nimport { IDispatch } from \"redux\";\r\nimport { IEntity } from \"cms-models/IEntity\";\r\nimport { IEntityListState } from \"cms-ui-presentationlogic/dataflows/entityList/IEntityListState\";\r\nimport { IEntityResponse } from \"cms-businesslogic/response/IEntityResponse\";\r\nimport { IEntityWithMetadata } from \"cms-businesslogic/entity/IEntityWithMetadata\";\r\nimport { IImageAcquisitionManager } from \"clientcore-catalyst-businesslogic/IImageAcquisitionManager\";\r\nimport { IImageCommandActionCreator } from \"../../presentation-logic/dataflows/imageCommand/IImageCommandActionCreator\";\r\nimport { IImageFileData } from \"cms-models/IImageFileData\";\r\nimport { IImagePreviewModalProps } from \"../../rendering/components/imagePreviewModal/IImagePreviewModalProps\";\r\nimport { IImageTileProps } from \"../../rendering/components/imageTile/IImageTileProps\";\r\nimport { IInstrumentationClient } from \"../../instrumentation/instrumentationClient/IInstrumentationClient\";\r\nimport { ILightboxManager } from \"./ILightboxManager\";\r\nimport { ILightboxPageBootstrapperState } from \"../../presentation-logic/dataflows/lightboxPage/ILightboxPageBootstrapperState\";\r\nimport { ILightboxPageProps } from \"../../rendering/lightbox/ILightboxPageProps\";\r\nimport { IModalCarouselProps } from \"../../rendering/components/modalCarousel/IModalCarouselProps\";\r\nimport { IReducer } from \"cms-ui-redux/IReducer\";\r\nimport { ImageCommandActionCreator } from \"../../presentation-logic/dataflows/imageCommand/ImageCommandActionCreator\";\r\nimport { ImageCommandActions } from \"../../presentation-logic/dataflows/imageCommand/ImageCommandActions\";\r\nimport { ImageCommandReduction } from \"../../presentation-logic/dataflows/imageCommand/ImageCommandReduction\";\r\nimport { ImagePreviewModal } from \"../../rendering/components/imagePreviewModal/ImagePreviewModal\";\r\nimport { ImagePreviewModalActions } from \"../../presentation-logic/dataflows/imagePreviewModal/ImagePreviewModalActions\";\r\nimport { ImageStatusEnum } from \"../../models/lightbox/ImageStatusEnum\";\r\nimport { KeyCode } from \"cms-ui-components/KeyCode\";\r\nimport { LightboxActions } from \"../../presentation-logic/dataflows/lightbox/LightboxActions\";\r\nimport { LightboxDownloadManager } from \"./LightboxDownloadManager\";\r\nimport { LightboxPageBootstrapperReduction } from \"../../presentation-logic/dataflows/lightboxPage/LightboxPageBootstrapperReduction\";\r\nimport { LightboxPageReduction } from \"../../presentation-logic/dataflows/lightboxPage/LightboxPageReduction\";\r\nimport { LightboxPanelLightboxSourceEnum } from \"../../rendering/lightbox/LightboxPanelLightboxSourceEnum\";\r\nimport { LightboxPanelNowShowingEnum } from \"../../presentation-logic/dataflows/lightboxPage/LightboxPanelNowShowingEnum\";\r\nimport { LightboxUserProfileManager } from \"./LightboxUserProfileManager\";\r\nimport { ListEntitySelectorReduction } from \"cms-ui-presentationlogic/dataflows/listEntitySelector/ListEntitySelectorReduction\";\r\nimport { ModalCarousel } from \"../../rendering/components/modalCarousel/ModalCarousel\";\r\nimport { ModalProvisioningActions } from \"cms-ui-presentationlogic/dataflows/modalProvisioning/ModalProvisioningActions\";\r\nimport { ModalProvisioningReduction } from \"cms-ui-presentationlogic/dataflows/modalProvisioning/ModalProvisioningReduction\";\r\nimport { PageActionData } from \"cms-businesslogic/instrumentation/PageActionData\";\r\nimport { PromiseExtension } from \"cms-infrastructure/promise-extension/PromiseExtension\";\r\nimport { ReduxBootstrapper } from \"cms-ui-views/ReduxBootstrapper\";\r\nimport { ResultsDisplayModeEnum } from \"../../models/displayMode/ResultsDisplayModeEnum\";\r\nimport { Routes } from \"../../Routes\";\r\nimport { Types } from \"cms-models/Types\";\r\nimport { appConfig } from \"appConfig\";\r\nimport { browserHistory } from \"react-router\";\r\nimport { getLatestStatusOfUnProcessedEntity } from \"./GetLatestStatusOfUnProcessedEntity\";\r\nimport { cloneDeep, isEmpty, isNil, merge } from \"lodash-es\";\r\n\r\n/**\r\n * The bootstrapper that wires the <LightboxPage /> component into Redux.\r\n * @class\r\n */\r\nexport class LightboxPageBootstrapper<TParentState> extends ComponentBootstrapper<ILightboxPageBootstrapperState, ILightboxPageProps, TParentState> {\r\n\r\n    // Hardcoded strings for the case where we don't have an EntityWithMetadata in our state, for an entity that's listed as present in a collection.\r\n    private static NoDetailsErrorCode: string = \"NoDetails\";\r\n    private static NoDetailsErrorMessage: string = \"No details for image.\";\r\n\r\n    /** An instance of the `EntitySelectorActions` class.\r\n     * @type {EntitySelectorActions}\r\n     */\r\n    private entitySelectorActions: EntitySelectorActions;\r\n\r\n    /** An instance of the `EntitySearchActions` class.\r\n     * @type {EntitySearchActions}\r\n     */\r\n    private entitySearchActions: EntitySearchActions;\r\n\r\n    /** An instance of the 'LightboxActions' class.\r\n     * @type {LightboxActions}\r\n     */\r\n    private lightboxPageDownloadActions: LightboxActions;\r\n\r\n    /** An instance of the `ImageCommandActionCreator` class.\r\n     * @type {IImageCommandActionCreator}\r\n     */\r\n    private imageCommandActionCreator: IImageCommandActionCreator;\r\n\r\n    /** An instance of the 'LightboxDownloadManager' class to manage the download of images in the lightbox\r\n     * @type {LightboxDownloadManager}\r\n     */\r\n    private lightboxDownloadManager: LightboxDownloadManager;\r\n\r\n    /** The modal provisioning reducer instance\r\n     * @type {ModalProvisioningReduction}\r\n     */\r\n    private modalProvisioningReduction: ModalProvisioningReduction;\r\n\r\n    /** Activity which is re-created every time the page is loaded.\r\n     *  Used as the parent for other activities that happen in the context of the this page load activity.\r\n     * @type {IActivityLogItem}\r\n     */\r\n    private rootLightboxActivity: IActivityLogItem;\r\n\r\n    /**\r\n     * Initializes a new instance of the 'LightboxPageBootstrapper' class.\r\n     * @constructor\r\n     * @param businessLogicFactory {BusinessLogicFactory} Used to construct business logic managers to use when interacting with the Catalyst (CATS) tenant.\r\n     * @param imageAcquisitionManager {IImageAcquisitionManager} Used to download the images.\r\n     * @param instrumentationClient {IInstrumentationClient} Provides support for instrumentation.\r\n     * @param lightboxSearchEntityListActions {EntityListActions} Actions we want to reduce to update the search results state\r\n     * @param entityListActions {EntityListActions} An instance of the `EntityListActions` class to for updating this page's entity list state\r\n     * @param imagePreviewModalActions {ImagePreviewModalActions} Actions for managing current selected preview modal index in the event lightbox is modified in a different window.\r\n     * @param modalProvisioningActions {ModalProvisioningActions} Actions for managing current preview modal.\r\n     * @param imageCommandActions {ImageCommandActions} Actions for commands related to image.\r\n     * @param getLightboxManager { () => ILightboxManager } The callback to the get the LightboxManager\r\n     * @param lightboxUserProfileManager { LightboxUserProfileManager } the lightbox user profile manager instance.\r\n     * @param parentBootstrapper {ComponentBootstrapper<TParentState, any, any>} The bootsrapper that contains this bootstrapper.\r\n     * @param stateSelector {function} A function that selects the state for this bootstrapper from the parent state.\r\n     * @param actionNamespacePrefix {string} Optional prefix to add to the namespace used to distinguish actions created by this bootstrapper.\r\n     */\r\n    constructor(\r\n        private businessLogicFactory: BusinessLogicFactory,\r\n        private imageAcquisitionManager: IImageAcquisitionManager,\r\n        private instrumentationClient: IInstrumentationClient,\r\n        private lightboxSearchEntityListActions: EntityListActions,\r\n        private entityListActions: EntityListActions,\r\n        private imagePreviewModalActions: ImagePreviewModalActions,\r\n        private modalProvisioningActions: ModalProvisioningActions,\r\n        private imageCommandActions: ImageCommandActions,\r\n        private getLightboxManager: () => ILightboxManager,\r\n        private lightboxUserProfileManager: LightboxUserProfileManager,\r\n        parentBootstrapper?: ComponentBootstrapper<TParentState, any, any> | ReduxBootstrapper<TParentState>,\r\n        stateSelector?: (parentState: TParentState) => ILightboxPageBootstrapperState,\r\n        actionNamespacePrefix?: string) {\r\n\r\n        super(parentBootstrapper, stateSelector);\r\n\r\n        this.entitySearchActions = new EntitySearchActions(actionNamespacePrefix);\r\n        this.entitySelectorActions = new EntitySelectorActions(actionNamespacePrefix);\r\n        this.lightboxPageDownloadActions = new LightboxActions(actionNamespacePrefix + \"Download\");\r\n\r\n        this.onPageMounted = this.onPageMounted.bind(this);\r\n        this.onPageUnmounting = this.onPageUnmounting.bind(this);\r\n        this.onImageTileSelectionChanged = this.onImageTileSelectionChanged.bind(this);\r\n        this.onImageTileInvoked = this.onImageTileInvoked.bind(this);\r\n        this.onImageTileRefreshInvoked = this.onImageTileRefreshInvoked.bind(this);\r\n        this.onRemoveFromLightboxInvoked = this.onRemoveFromLightboxInvoked.bind(this);\r\n        this.removeLightbox = this.removeLightbox.bind(this);\r\n        this.addLightbox = this.addLightbox.bind(this);\r\n        this.downloadImage = this.downloadImage.bind(this);\r\n        this.downloadSelectedImagesHelper = this.downloadSelectedImagesHelper.bind(this);\r\n        this.clearSelection = this.clearSelection.bind(this);\r\n        this.createModalCarousel = this.createModalCarousel.bind(this);\r\n        this.onPreviewButtonPrev = this.onPreviewButtonPrev.bind(this);\r\n        this.onPreviewButtonNext = this.onPreviewButtonNext.bind(this);\r\n        this.retryDownloadForFailedImages = this.retryDownloadForFailedImages.bind(this);\r\n        this.clearImagesFailedToDownload = this.clearImagesFailedToDownload.bind(this);\r\n        this.onSearchExecute = this.onSearchExecute.bind(this);\r\n        this.onExitSearch = this.onExitSearch.bind(this);\r\n        this.onSearchTextChanged = this.onSearchTextChanged.bind(this);\r\n\r\n        this.modalProvisioningReduction = new ModalProvisioningReduction(this.modalProvisioningActions);\r\n    }\r\n\r\n    /**\r\n     * Initializes the initial state of the component.\r\n     * @method\r\n     * @returns {ILightboxPageBootstrapperState} The initial state.\r\n     */\r\n    public getInitialState(): ILightboxPageBootstrapperState {\r\n\r\n        return {\r\n            lightboxState: {\r\n                myLightboxes: cloneDeep(this.lightboxUserProfileManager.recentLightboxes),\r\n                activeLightboxId: \"\",\r\n                operationPending: false,\r\n                lightboxEntitiesState: {\r\n                    continuationToken: null,\r\n                    entitiesWithMetadata: [],\r\n                    loading: false,\r\n                    sortOrder: [],\r\n                    retriableAction: {\r\n                        error: null,\r\n                        action: undefined,\r\n                        actionParameters: []\r\n                    }\r\n                }\r\n            },\r\n            lightboxPageState: {\r\n                searchTextState: {\r\n                    searchText: \"\"\r\n                },\r\n                searchResultsState: {\r\n                    continuationToken: null,\r\n                    entitiesWithMetadata: [],\r\n                    loading: false,\r\n                    sortOrder: [],\r\n                    retriableAction: {\r\n                        error: null,\r\n                        action: undefined,\r\n                        actionParameters: []\r\n                    }\r\n                },\r\n                nowShowing: LightboxPanelNowShowingEnum.ShowRecent,\r\n                entityList: {\r\n                    continuationToken: null,\r\n                    entitiesWithMetadata: [],\r\n                    loading: false,\r\n                    sortOrder: [],\r\n                    retriableAction: {\r\n                        error: null,\r\n                        action: undefined,\r\n                        actionParameters: []\r\n                    }\r\n                },\r\n                entitySelector: {\r\n                    selectedEntities: [],\r\n                    allEntitiesSelectionChecked: false\r\n                },\r\n                modalProvisioningState: { isVisible: false },\r\n                imageCommandState: {\r\n                    imagesDownloading: [],\r\n                    failedImages: [],\r\n                    creativeImageIngestionState: {\r\n                        failedToUpdateImages: [],\r\n                        imageUpdateInProgress: [],\r\n                        beingIngestedImageIds: []\r\n                    }\r\n                },\r\n                downloadStatus: {}\r\n            }\r\n        };\r\n    }\r\n\r\n    /**\r\n     * Creates the root reducer of the component.\r\n     * This reducer needs to return state that includes the lightbox state (this is shared state),\r\n     * but in reality it only reduces the lightbox page state (the state of the page).\r\n     * So the reducer here is a thin wrapper for an instance of the LightboxPageReduction class.\r\n     * @method\r\n     * @returns {IReducer<ILightboxPageBootstrapperState>} The root reducer of the component.\r\n     */\r\n    public createRootReducer(): IReducer<ILightboxPageBootstrapperState> {\r\n        const lightboxSearchReduction = new EntityListReduction<IEntityListState>(this.lightboxSearchEntityListActions);\r\n        const entityListReduction = new EntityListReduction<IEntityListState>(this.entityListActions);\r\n        const entitySelectorReduction = new ListEntitySelectorReduction(\r\n            entityListReduction,\r\n            new EntitySelectorReduction(this.entitySelectorActions));\r\n\r\n        const imageCommandReduction = new ImageCommandReduction(this.imageCommandActions);\r\n\r\n        const lightboxPageStateReducer = new LightboxPageReduction(\r\n            this.imagePreviewModalActions,\r\n            this.lightboxPageDownloadActions,\r\n            this.entitySearchActions,\r\n            lightboxSearchReduction,\r\n            entitySelectorReduction,\r\n            this.modalProvisioningReduction,\r\n            imageCommandReduction\r\n        );\r\n\r\n        const lightboxPageBootstrapperReduction = new LightboxPageBootstrapperReduction(lightboxPageStateReducer);\r\n        return lightboxPageBootstrapperReduction;\r\n    }\r\n\r\n    /**\r\n     * Maps from the state to the props\r\n     * @method\r\n     * @param state {ILightboxPageBootstrapperState} The redux state.\r\n     * @param ownProps ILandingPageProps} The landing page properties.\r\n     * @returns {ILightboxPageProps} The mapped landing page properties.\r\n     */\r\n    public mapStateToProps(state: ILightboxPageBootstrapperState): ILightboxPageProps {\r\n\r\n        let imageTiles: IImageTileProps[] = [];\r\n\r\n        const activeLightboxId = this.getCurrentState().lightboxState.activeLightboxId;\r\n        const haveActiveLightbox = !!activeLightboxId;\r\n        const lightBoxDownloadStatus = state.lightboxPageState.downloadStatus[activeLightboxId];\r\n        let activeLightBoxDownloadBtnStatus = true;\r\n        let failedImages = [];\r\n        // if value is undefined or null it means that there is no entry in the collection and downloadall should be enabled.\r\n        if (!!lightBoxDownloadStatus) {\r\n            activeLightBoxDownloadBtnStatus = !lightBoxDownloadStatus.enableDownload === false;\r\n            failedImages = lightBoxDownloadStatus.failedImages || [];\r\n        }\r\n\r\n        // Use this flag to track if we have at least one valid entity on the page.\r\n        // We will only enable the download all button if we have at least one valid entity on the page\r\n        let hasValidTile = false;\r\n\r\n        // If there's an active lightbox but it is not in the search results, don't show the Search results even if we have them. Show the recent list.\r\n        let showEntitiesInActiveLightbox = false;\r\n        if (haveActiveLightbox) {\r\n            if (state.lightboxPageState.nowShowing === LightboxPanelNowShowingEnum.ShowRecent) {\r\n                showEntitiesInActiveLightbox = state.lightboxState.myLightboxes.findIndex(lightbox => lightbox.id === activeLightboxId) >= 0;\r\n            } else {\r\n                showEntitiesInActiveLightbox = state.lightboxPageState.searchResultsState.entitiesWithMetadata.findIndex(entityWithMetadata => entityWithMetadata.entity._id === activeLightboxId) >= 0;\r\n            }\r\n        }\r\n\r\n        if (showEntitiesInActiveLightbox) {\r\n            const entitiesInLightbox = this.getLightboxManager().getIDsOfEntitiesInActiveLightbox();\r\n            imageTiles = entitiesInLightbox.map((entityId) => {\r\n                const foundEntityWithMetadataIndex = state.lightboxPageState.entityList.entitiesWithMetadata.findIndex(ewm => ewm.metadata.documentId === entityId);\r\n\r\n                const selected = state.lightboxPageState.entitySelector.selectedEntities.findIndex(ewm => ewm.metadata.documentId === entityId) >= 0;\r\n\r\n                let title = entityId;\r\n                let sourceHref = \"\";\r\n                let altText = \"\";\r\n                let loading = state.lightboxPageState.entityList.loading;\r\n                let errorCode = \"\";\r\n                let errorMessage = \"\";\r\n                let customClassName = \"\";\r\n                let imageStatus = ImageStatusEnum.Processed;\r\n                let isImageRefreshing = false;\r\n\r\n                if (foundEntityWithMetadataIndex >= 0) {\r\n                    // Overwrite the loading flag if we have entityWithMetadata for an entity.\r\n                    loading = false;\r\n                    const ewm = state.lightboxPageState.entityList.entitiesWithMetadata[foundEntityWithMetadataIndex] as IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>>;\r\n\r\n                    const imageIngestionInProgress = ewm.entity[\"processedByIngestion\"] === false;\r\n\r\n                    if (isNil(ewm.entity._id) || isEmpty(ewm.entity._id)) {\r\n                        errorCode = ewm.entity.hasOwnProperty(\"Code\") ? ewm.entity.Code : \"\";\r\n                        errorMessage = ewm.entity.hasOwnProperty(\"Message\") ? ewm.entity.Message : \"\";\r\n                    } else if (imageIngestionInProgress) {\r\n                        sourceHref = ewm.entity.fileMetadata.downloads && ewm.entity.fileMetadata.downloads.length > 0\r\n                            ? ewm.entity.fileMetadata.downloads[0].sourceLocation\r\n                            : null;\r\n\r\n                        isImageRefreshing = state.lightboxPageState.imageCommandState.creativeImageIngestionState.imageUpdateInProgress.indexOf(ewm.entity._id) > -1;\r\n                        imageStatus = ImageStatusEnum.UnProcessed;\r\n                        const isFailedImage = state.lightboxPageState.imageCommandState.creativeImageIngestionState.failedToUpdateImages.indexOf(ewm.entity._id) > -1;\r\n                        if (isFailedImage) {\r\n                            title = \"Failed. Sorry, we were unable to retrieve this image. Please remove from your lightbox.\";\r\n                            customClassName = \"error-image\";\r\n                            imageStatus = ImageStatusEnum.Error;\r\n                        } else {\r\n                            title = \"Fetching. Hit Refresh for status update.\";\r\n                            customClassName = \"unprocessed-image\";\r\n                        }\r\n                    } else {\r\n                        title = this.getImageOverlayTitle(ewm.entity);\r\n                        sourceHref = AddImageQualityQueryParamToUrl(ewm.entity.href);\r\n                        altText = ewm.entity.altText;\r\n                        hasValidTile = true;\r\n                    }\r\n                } else {\r\n                    title = entityId;\r\n                    errorCode = LightboxPageBootstrapper.NoDetailsErrorCode;\r\n                    errorMessage = errorCode = LightboxPageBootstrapper.NoDetailsErrorMessage;\r\n                }\r\n\r\n                return {\r\n                    id: entityId,\r\n                    loading,\r\n                    errorCode,\r\n                    errorMessage,\r\n                    sourceHref,\r\n                    customClassName,\r\n                    title,\r\n                    imgWidth: AppConstants.thumbnailConfig.gridTileImageWidth,\r\n                    imgHeight: AppConstants.thumbnailConfig.gridTileImageHeight,\r\n                    supportsMultiSelection: true,\r\n                    selected,\r\n                    altText,\r\n                    imageStatus,\r\n                    isImageRefreshing,\r\n                    onImageTileInvoked: this.onImageTileInvoked.bind(this, entityId),\r\n                    onImageTileSelectionChanged: this.onImageTileSelectionChanged.bind(this, entityId),\r\n                    onRemoveFromLightboxInvoked: this.onRemoveFromLightboxInvoked.bind(this, activeLightboxId, entityId),\r\n                    onImageTileRefresh: this.onImageTileRefreshInvoked\r\n                };\r\n            });\r\n        }\r\n\r\n        let lightboxes: any;\r\n        if (state.lightboxPageState.nowShowing === LightboxPanelNowShowingEnum.ShowRecent) {\r\n            lightboxes = state.lightboxState.myLightboxes.map(item => {\r\n                const foundIndex = state.lightboxState.lightboxEntitiesState.entitiesWithMetadata.findIndex(entityWithMetadata => entityWithMetadata.entity._id === item.id);\r\n                const selected = item.id === activeLightboxId;\r\n                let title = item.id;\r\n                let itemCount: number;\r\n                let lastModifiedDate = \"\";\r\n                let lastModifiedBy = \"\";\r\n                let actionButtonProps = {\r\n                    callback: this.removeLightbox.bind(this, item.id),\r\n                    glyph: \"remove\",\r\n                    tooltip: \"Remove from My Lightboxes.\",\r\n                    disabled: true\r\n                };\r\n\r\n                if (foundIndex >= 0) {\r\n                    const lightbox = state.lightboxState.lightboxEntitiesState.entitiesWithMetadata[foundIndex] as IEntityWithMetadata<IAnnotatedCollection<IAnnotatedEntity>>;\r\n                    title = lightbox.entity._name;\r\n                    lastModifiedDate = lightbox.metadata.lastModified;\r\n                    lastModifiedBy = lightbox.metadata.lastModifiedBy;\r\n                    itemCount = lightbox.entity.collection.items.length;\r\n                    actionButtonProps.disabled = false;\r\n                }\r\n\r\n                return {\r\n                    id: item.id,\r\n                    title,\r\n                    lastModifiedDate,\r\n                    lastModifiedBy,\r\n                    itemCount,\r\n                    selected,\r\n                    actionButtonProps,\r\n                    existingOperationPending: false\r\n                };\r\n            });\r\n        } else {\r\n            lightboxes = state.lightboxPageState.searchResultsState.loading ?\r\n                [] :\r\n                state.lightboxPageState.searchResultsState.entitiesWithMetadata.map(ewm => {\r\n                    const lightbox = ewm as IEntityWithMetadata<IAnnotatedCollection<IAnnotatedEntity>>;\r\n                    const id = lightbox.entity._id;\r\n                    const selected = id === activeLightboxId;\r\n                    const title = lightbox.entity._name;\r\n                    const itemCount = lightbox.entity.collection.items.length;\r\n                    const lastModifiedDate = ewm.metadata.lastModified;\r\n                    const lastModifiedBy = ewm.metadata.lastModifiedBy;\r\n                    let actionButtonProps = {\r\n                        callback: this.addLightbox.bind(this, id),\r\n                        glyph: \"plus\",\r\n                        tooltip: \"Add to My Lightboxes.\",\r\n                        disabled: state.lightboxState.myLightboxes.findIndex(lightboxInstance => lightboxInstance.id === id) >= 0 ? true : false\r\n                    };\r\n\r\n                    return {\r\n                        id,\r\n                        title,\r\n                        lastModifiedDate,\r\n                        lastModifiedBy,\r\n                        itemCount,\r\n                        selected,\r\n                        actionButtonProps,\r\n                        existingOperationPending: false\r\n                    };\r\n                });\r\n        }\r\n\r\n        const source = state.lightboxPageState.nowShowing === LightboxPanelNowShowingEnum.ShowRecent ?\r\n            LightboxPanelLightboxSourceEnum.Recent :\r\n            LightboxPanelLightboxSourceEnum.Search;\r\n\r\n        const isSearching = source === LightboxPanelLightboxSourceEnum.Search ?\r\n            state.lightboxPageState.searchResultsState.loading :\r\n            false;\r\n\r\n        const retVal = {\r\n            lightboxes,\r\n            source,\r\n            recentLightboxes: state.lightboxState.myLightboxes.map(item => item.id),\r\n            selectedLightbox: showEntitiesInActiveLightbox ? activeLightboxId : \"\",\r\n            downloadInProgress: !activeLightBoxDownloadBtnStatus,\r\n            // Disable download all if we don't have at least one valid tile, if a download all is already in progress, and also while items are loading\r\n            downloadEnabled: hasValidTile && activeLightBoxDownloadBtnStatus && !state.lightboxPageState.entityList.loading,\r\n            showDownloadButton: !isEmpty(activeLightboxId) && imageTiles.length > 0,\r\n            searchPlaceholderText: \"Find a lightbox\",\r\n            isSearching,\r\n            failedImages,\r\n            imageTiles,\r\n            searchText: state.lightboxPageState.searchTextState.searchText,\r\n            existingOperationPending: false,\r\n            thumbnailImageHeight: AppConstants.thumbnailConfig.gridTileHeight,\r\n            thumbnailImageWidth: AppConstants.thumbnailConfig.gridTileWidth\r\n        } as ILightboxPageProps;\r\n\r\n        const modal = state.lightboxPageState.modalProvisioningState.isVisible ? this.createModalCarousel(state, imageTiles) : null;\r\n        if (modal) {\r\n            (retVal as any).children = modal;\r\n        }\r\n\r\n        return retVal;\r\n    }\r\n\r\n    /**\r\n     * Inject into props redux action creators.\r\n     * @method\r\n     * @param {IDispatch} _dispatch The redux dispatch function.\r\n     * @param {ILightboxPageProps} _ownProps The set of pure properties of the component.\r\n     * @returns {ILightboxPageProps} An enriched set of props.\r\n     */\r\n    public mapDispatchToProps(_dispatch: IDispatch, _ownProps: ILightboxPageProps): ILightboxPageProps {\r\n        return {\r\n            lightboxes: undefined,\r\n            source: undefined,\r\n            recentLightboxes: undefined,\r\n            selectedLightbox: undefined,\r\n            imageTiles: undefined,\r\n            thumbnailImageWidth: undefined,\r\n            thumbnailImageHeight: undefined,\r\n            existingOperationPending: undefined,\r\n            onRemoveFromLightboxInvoked: this.onRemoveFromLightboxInvoked,\r\n            onPageMounted: this.onPageMounted,\r\n            onPageUnmounting: this.onPageUnmounting,\r\n            downloadInProgress: undefined,\r\n            downloadEnabled: undefined,\r\n            showDownloadButton: undefined,\r\n            failedImages: undefined,\r\n            downloadAllImages: this.downloadSelectedImagesHelper.bind(\r\n                this,\r\n                () => { return this.getCurrentState().lightboxPageState.entityList.entitiesWithMetadata; },\r\n                \"downloadAll-lightbox\",\r\n                \"downloadAll-btn\",\r\n                () => { return this.lightboxDownloadManager.downloadAllImages; }\r\n            ),\r\n            downloadSelectedImages: this.downloadSelectedImagesHelper.bind(\r\n                this,\r\n                () => { return this.getCurrentState().lightboxPageState.entitySelector.selectedEntities; },\r\n                \"downloadSelected-lightbox\",\r\n                \"downloadSelected-btn\",\r\n                () => { return this.lightboxDownloadManager.downloadSelectedImages; }\r\n            ),\r\n            clearSelection: this.clearSelection,\r\n            retryDownloadForFailedImages: this.retryDownloadForFailedImages,\r\n            clearImagesFailedToDownload: this.clearImagesFailedToDownload,\r\n            searchPlaceholderText: undefined,\r\n            onSearchTextChanged: this.onSearchTextChanged,\r\n            onSearchExecute: this.onSearchExecute,\r\n            onExitSearch: this.onExitSearch\r\n        };\r\n    }\r\n\r\n    /**\r\n     * Performs required job before the component is created.\r\n     * @method\r\n     */\r\n    public onBeforeComponentCreated(): void {\r\n        this.imageCommandActionCreator = new ImageCommandActionCreator(\r\n            this.imageAcquisitionManager,\r\n            this.store,\r\n            this.imageCommandActions);\r\n        this.lightboxDownloadManager = new LightboxDownloadManager(\r\n            PageNames.Lightbox,\r\n            this.lightboxPageDownloadActions,\r\n            this.imageCommandActionCreator,\r\n            this.instrumentationClient,\r\n            this.store\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Gets the id for the lightbox page route.\r\n     * Because the lightbox page shows search results and My Lightboxes separately, the Active lightbox may not be in what is currently being shown.\r\n     * If this is the case, then we just want to route to /lightbox rather than /lightbox/lightboxId.\r\n     * @method\r\n     */\r\n    public getLightboxIdForRoute(): string {\r\n        const state = this.getCurrentState();\r\n\r\n        let idForRoute = this.getCurrentState().lightboxState.activeLightboxId;\r\n        const haveActiveLightbox = !isNil(idForRoute) && !isEmpty(idForRoute);\r\n\r\n        if (haveActiveLightbox) {\r\n            if (!((state.lightboxPageState.nowShowing === LightboxPanelNowShowingEnum.ShowRecent) &&\r\n                (state.lightboxState.myLightboxes.findIndex(lightbox => lightbox.id === idForRoute) >= 0)) &&\r\n                !((state.lightboxPageState.nowShowing === LightboxPanelNowShowingEnum.ShowSearch) &&\r\n                    (state.lightboxPageState.searchResultsState.entitiesWithMetadata.findIndex(entityWithMetadata => entityWithMetadata.entity._id === idForRoute) >= 0))) {\r\n                idForRoute = \"\";\r\n            }\r\n        }\r\n\r\n        return idForRoute;\r\n    }\r\n\r\n    /**\r\n     * Clears the selected entity when the active lightbox has changed.\r\n     * @method\r\n     */\r\n    public onActiveLightboxChanged(): void {\r\n        this.clearSelection(null);\r\n    }\r\n\r\n    // onPageMounted helper. Starts monitoring for lightbox changes and creates a top level activity for the page\r\n    private onPageMounted(): void {\r\n        this.rootLightboxActivity = this.instrumentationClient.ActivityLoggingService.createActivity(\"RootLightboxActivity\", this.instrumentationClient.RootActivity);\r\n    }\r\n\r\n    // onPageUnmounting helper. Stops monitoring for lightbox changes and completes the top level activity\r\n    private onPageUnmounting(): void {\r\n        this.getLightboxManager().stopLightboxMonitoring();\r\n        this.instrumentationClient.ActivityLoggingService.endActivity(this.rootLightboxActivity);\r\n    }\r\n\r\n    // Helper to get the entityWithMetadata based on the lightbox id from the My Lightboxes list\r\n    private getLightboxEntityWithMetadataFromMyLightboxes(lightboxId: string): IEntityWithMetadata<IAnnotatedCollection<IAnnotatedEntity>> {\r\n        const lightboxEntities = this.getCurrentState().lightboxState.lightboxEntitiesState.entitiesWithMetadata as IEntityWithMetadata<IAnnotatedCollection<IAnnotatedEntity>>[];\r\n        return lightboxEntities.find(lightbox => lightbox.entity._id === lightboxId);\r\n    }\r\n\r\n    // Helper to get the entityWithMetadata based on the lightbox id from the lightbox search results\r\n    private getLightboxEntityWithMetadataFromSearchResults(lightboxId: string): IEntityWithMetadata<IAnnotatedCollection<IAnnotatedEntity>> {\r\n        const lightboxEntities = this.getCurrentState().lightboxPageState.searchResultsState.entitiesWithMetadata as IEntityWithMetadata<IAnnotatedCollection<IAnnotatedEntity>>[];\r\n        return lightboxEntities.find(lightbox => lightbox.entity._id === lightboxId);\r\n    }\r\n\r\n    private onImageTileRefreshInvoked(entityId: string, _event: React.SyntheticEvent<any>): void {\r\n        const onImageTileRefreshActivity = this.instrumentationClient.ActivityLoggingService.createActivity(\"LightboxPageBootstrapper.imageTileRefresh\", this.instrumentationClient.RootActivity);\r\n        let entityManager = this.businessLogicFactory.getManagersFactory().getEntityManager();\r\n        let updateStatusPromise = null;\r\n        this.imageCommandActions.AddImageStatusUpdateInProgress.getActionSender(this.store)([entityId]);\r\n        const isFailedImage = this.getCurrentState().lightboxPageState.imageCommandState.creativeImageIngestionState.failedToUpdateImages.indexOf(entityId) > -1;\r\n\r\n        if (isFailedImage) {\r\n            this.imageCommandActions.RemoveCompletedImageStatusUpdate.getActionSender(this.store)([entityId]);\r\n            return;\r\n        }\r\n\r\n        entityManager.getLatest({ name: Types.ImageFileData.name }, entityId, AppConstants.requiredFieldListForImageFileData).then((entityResponse: IEntityResponse<IEntity>) => {\r\n            const ewm = entityResponse.data;\r\n            if (ewm.entity[\"processedByIngestion\"] === false) {\r\n                updateStatusPromise = getLatestStatusOfUnProcessedEntity(this.store, ewm, this.imageCommandActions, this.imageAcquisitionManager, this.instrumentationClient, \"LightboxPageBootstrapper.imageTileRefresh\", onImageTileRefreshActivity);\r\n                PromiseExtension.onComplete(updateStatusPromise, () => {\r\n                    this.instrumentationClient.ActivityLoggingService.endActivity(onImageTileRefreshActivity);\r\n                    this.imageCommandActions.RemoveCompletedImageStatusUpdate.getActionSender(this.store)([entityId]);\r\n                });\r\n            } else {\r\n                this.entityListActions.EntitiesUpdated.getActionSender(this.store)([entityResponse.data]);\r\n                this.instrumentationClient.ActivityLoggingService.endActivity(onImageTileRefreshActivity);\r\n                this.imageCommandActions.RemoveCompletedImageStatusUpdate.getActionSender(this.store)([entityId]);\r\n            }\r\n        }).catch(_error => {\r\n            this.imageCommandActions.RemoveCompletedImageStatusUpdate.getActionSender(this.store)([entityId]);\r\n            this.instrumentationClient.LoggingService.error(\"LightboxPageBootstrapper.onImageTileRefresh::getLatestError\", onImageTileRefreshActivity, { entityId });\r\n            this.instrumentationClient.ActivityLoggingService.endActivity(onImageTileRefreshActivity);\r\n        });\r\n    }\r\n\r\n    // Helper to download all/download selected images\r\n    private downloadSelectedImagesHelper(\r\n        getImagesForDownload: () => IEntityWithMetadata<IEntity>[],\r\n        eventName: string,\r\n        controlName: string,\r\n        getDownloadMethod: () => (lightboxId: string, lightboxName: string, imagesToBeDownloaded: IEntityWithMetadata<IEntity>[], areaOfPage: string, event: React.SyntheticEvent<any>) => void,\r\n        event: React.SyntheticEvent<any>): void {\r\n        const activeLightboxId = this.getCurrentState().lightboxState.activeLightboxId;\r\n        if (isNil(activeLightboxId) || isEmpty(activeLightboxId)) {\r\n            return;\r\n        }\r\n\r\n        // Only attempt to download images for which we have a valid entity even though we may have an document Id in the metadata that we could use.\r\n        const imagesToDownload = getImagesForDownload().filter(ewm => !isNil(ewm.entity._id) && ewm.entity[\"processedByIngestion\"] === undefined);\r\n\r\n        const getActionInput = () => {\r\n            return {\r\n                \"lightboxId\": activeLightboxId,\r\n                \"downloadImageCount\": imagesToDownload.length.toString()\r\n            };\r\n        };\r\n        const logUserActivityCallback =\r\n            this.createLogUserActivityCallback(event, eventName, controlName, AreaOfPage.lightboxBoardContents, getActionInput);\r\n        logUserActivityCallback(this.instrumentationClient.RootActivityCorrelationVector);\r\n\r\n        const lightboxEntity = this.getLightboxEntityWithMetadataFromMyLightboxes(activeLightboxId);\r\n        getDownloadMethod()(activeLightboxId, lightboxEntity.entity._name, imagesToDownload, AreaOfPage.lightboxBoardContents, event);\r\n    }\r\n\r\n    // Clear the image selection state (i.e. deselect all selected images)\r\n    private clearSelection(_event: React.SyntheticEvent<any>): void {\r\n        this.entitySelectorActions.EntitySelectionChanged.getActionSender(this.store)([], false);\r\n    }\r\n\r\n    // Remove a lightbox from My Lightboxes\r\n    private removeLightbox(lightboxId: string, event: React.SyntheticEvent<any>): void {\r\n        const pathToLightbox = Routes.getLightboxPageRoutePathWithProtocol(lightboxId);\r\n        const lightboxEntity = this.getLightboxEntityWithMetadataFromMyLightboxes(lightboxId);\r\n        const getActionInput = () => {\r\n            return {\r\n                \"lightboxId\": lightboxId,\r\n                \"pathToLightbox\": pathToLightbox,\r\n                \"lightboxName\": lightboxEntity.entity._name\r\n            };\r\n        };\r\n        const logUserActivityCallback =\r\n            this.createLogUserActivityCallback(event, \"remove-lightbox\", \"remove-lightbox-button\", AreaOfPage.lightboxBoardContents, getActionInput);\r\n        logUserActivityCallback(this.instrumentationClient.RootActivityCorrelationVector);\r\n\r\n        this.getLightboxManager().removeLightbox(lightboxId, this.instrumentationClient.RootActivity);\r\n    }\r\n\r\n    // Add a lightbox to My Lightboxes\r\n    private addLightbox(lightboxId: string, event: React.SyntheticEvent<any>): void {\r\n        const pathToLightbox = Routes.getLightboxPageRoutePathWithProtocol(lightboxId);\r\n        const lightboxEntity = this.getLightboxEntityWithMetadataFromSearchResults(lightboxId);\r\n        const getActionInput = () => {\r\n            return {\r\n                \"lightboxId\": lightboxId,\r\n                \"pathToLightbox\": pathToLightbox,\r\n                \"lightboxName\": lightboxEntity.entity._name\r\n            };\r\n        };\r\n\r\n        const logUserActivityCallback =\r\n            this.createLogUserActivityCallback(event, \"add-lightbox\", \"remove-lightbox-button\", AreaOfPage.lightboxBoardContents, getActionInput);\r\n        logUserActivityCallback(this.instrumentationClient.RootActivityCorrelationVector);\r\n\r\n        this.getLightboxManager().addLightbox(lightboxId, lightboxEntity.entity._name, this.instrumentationClient.RootActivity);\r\n    }\r\n\r\n    // Retry download for failed images\r\n    private retryDownloadForFailedImages(event: React.SyntheticEvent<any>): void {\r\n        const lightboxId = this.getCurrentState().lightboxState.activeLightboxId;\r\n        const lightboxDownloadStatus = this.getCurrentState().lightboxPageState.downloadStatus[lightboxId];\r\n        if (!lightboxDownloadStatus || !lightboxDownloadStatus.failedImages || lightboxDownloadStatus.failedImages.length < 1) {\r\n            return;\r\n        }\r\n\r\n        const lightBoxImages = lightboxDownloadStatus.failedImages;\r\n        const lightboxEntity = this.getLightboxEntityWithMetadataFromMyLightboxes(lightboxId);\r\n\r\n        const getActionInput = () => {\r\n            return {\r\n                \"lightboxId\": lightboxId,\r\n                \"lightboxImageCount\": lightBoxImages.length.toString()\r\n            };\r\n        };\r\n        const logUserActivityCallback =\r\n            this.createLogUserActivityCallback(event, \"retry-failed-to-dowload-images\", \"retry-btn\", AreaOfPage.lightboxBoardContents, getActionInput);\r\n        logUserActivityCallback(this.instrumentationClient.RootActivityCorrelationVector);\r\n\r\n        this.lightboxDownloadManager.retryDownloadForFailedImages(lightboxId, lightboxEntity.entity._name, lightBoxImages, AreaOfPage.lightboxBoardContents, event);\r\n    }\r\n\r\n    // Clear failed images from the state\r\n    private clearImagesFailedToDownload(event: React.SyntheticEvent<any>): void {\r\n        const lightboxId = this.getCurrentState().lightboxState.activeLightboxId;\r\n\r\n        const getActionInput = () => {\r\n            return {\r\n                \"lightboxId\": lightboxId\r\n            };\r\n        };\r\n        const logUserActivityCallback =\r\n            this.createLogUserActivityCallback(event, \"clear-failed-to-dowload-images\", \"ignore-btn\", AreaOfPage.lightboxBoardContents, getActionInput);\r\n        logUserActivityCallback(this.instrumentationClient.RootActivityCorrelationVector);\r\n\r\n        this.lightboxPageDownloadActions.LightboxClearFailedDownloadImages.getActionSender(this.store)(lightboxId);\r\n    }\r\n\r\n    /**\r\n     * Callback that gets fired when a tile is selected/deselected\r\n     * @param id {string} the id for the image\r\n     * @param selected {boolean} whether the tile is selected or not\r\n     * @param _event {Event} the event which triggered this handler\r\n     * @method\r\n     */\r\n    private onImageTileSelectionChanged(id: string, selected: boolean, _event: React.SyntheticEvent<any>): void {\r\n        if (!id) {\r\n            this.instrumentationClient.LoggingService.error(\r\n                \"Tile checkbox selected/deselected, but image id is not passed with the event.\",\r\n                this.instrumentationClient.RootActivity,\r\n                { lightboxId: id },\r\n                this.instrumentationClient.RootActivityCorrelationVector);\r\n\r\n            return;\r\n        }\r\n\r\n        // Update the selected entities\r\n        const state = this.getCurrentState();\r\n        let selectedEntities = state.lightboxPageState.entitySelector.selectedEntities;\r\n        if (selected) {\r\n            const newSelectedImageEntityWithMetadata = this.getEntityWithMetadataFromEntityId(id, this.getCurrentState()) as IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>>;\r\n            selectedEntities.push(newSelectedImageEntityWithMetadata);\r\n        } else {\r\n            selectedEntities = selectedEntities.filter(ewm => ewm.metadata.documentId !== id);\r\n        }\r\n\r\n        this.entitySelectorActions.EntitySelectionChanged.getActionSender(this.store)(selectedEntities, false);\r\n    }\r\n\r\n    /**\r\n     * Callback which loads the preview image when an image tile is invoked.\r\n     * @param id {string} the id for the image\r\n     * @param event {Event} the event which triggered this handler\r\n     * @method\r\n     */\r\n    private onImageTileInvoked(id: string, event: React.SyntheticEvent<any>): void {\r\n        if (!id) {\r\n            this.instrumentationClient.LoggingService.error(\r\n                \"Tile clicked, but image id is not passed with the click event.\",\r\n                this.instrumentationClient.RootActivity,\r\n                { lightboxId: id },\r\n                this.instrumentationClient.RootActivityCorrelationVector);\r\n\r\n            return;\r\n        }\r\n\r\n        const entityIndexIntoCollection = this.getLightboxManager().getIDsOfEntitiesInActiveLightbox().indexOf(id);\r\n        const newSelectedImageEntityWithMetadata = this.getEntityWithMetadataFromEntityId(id, this.getCurrentState()) as IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>>;\r\n\r\n        const selectActionInput = newSelectedImageEntityWithMetadata === null ?\r\n            {\r\n                \"id\": id,\r\n                \"message\": LightboxPageBootstrapper.NoDetailsErrorMessage\r\n            } :\r\n            GetSelectActionInput(newSelectedImageEntityWithMetadata, entityIndexIntoCollection, true, ResultsDisplayModeEnum.Grid);\r\n\r\n        this.instrumentationClient.UserActivityTrackingService.logPageActionEvent(\r\n            this.instrumentationClient.createEventData(event, \"image\", null, \"image-ImageTile\", AreaOfPage.lightboxBoardContents),\r\n            PageNames.Lightbox,\r\n            this.instrumentationClient.RootActivityCorrelationVector,\r\n            PageActionData.createFrom(null, selectActionInput, null, null, null, null, PageNames.Lightbox));\r\n\r\n        this.imagePreviewModalActions.ImagePreviewModalFetchEnd.getActionSender(this.store)(entityIndexIntoCollection);\r\n        this.modalProvisioningActions.ShowModal.getActionSender(this.store)(\"ImagePreviewModal\");\r\n\r\n        return;\r\n    }\r\n\r\n    /**\r\n     * Handler to execute when an entity is removed from a lightbox.\r\n     * @param id {string} id of the lightbox\r\n     * @param entityId {string} The id of the item to remove\r\n     * @param event {React.SyntheticEvent<any>} event which trigerred this handler\r\n     */\r\n    private onRemoveFromLightboxInvoked(lightboxId: string, entityId: string, event: React.SyntheticEvent<any>): void {\r\n\r\n        const getActionInput = () => {\r\n            return {\r\n                \"lightboxId\": lightboxId\r\n            };\r\n        };\r\n        const logUserActivityCallback = this.createLogUserActivityCallback(\r\n            event,\r\n            \"remove-from-lightbox\",\r\n            \"remove-from-lightbox-button\",\r\n            AreaOfPage.lightboxBoardContents,\r\n            getActionInput);\r\n\r\n        this.getLightboxManager().removeItemsFromLightbox(\r\n            lightboxId,\r\n            [entityId],\r\n            this.instrumentationClient.RootActivity,\r\n            logUserActivityCallback);\r\n        // remove the entity from the selection state if it is selected\r\n        const selectedEntities = this.getCurrentState().lightboxPageState.entitySelector.selectedEntities.filter(ewm => ewm.metadata.documentId !== entityId);\r\n        this.entitySelectorActions.EntitySelectionChanged.getActionSender(this.store)(selectedEntities, false);\r\n        if (this.getCurrentState().lightboxPageState.imageCommandState.creativeImageIngestionState.failedToUpdateImages.indexOf(entityId) > -1) {\r\n            const removeFromLightboxActivity = this.instrumentationClient.ActivityLoggingService.createActivity(\"LightboxPageBootstrapper.onRemoveFromLightboxInvoked\", this.instrumentationClient.RootActivity);\r\n            let entityManager = this.businessLogicFactory.getManagersFactory().getEntityManager();\r\n            const deletePromise = entityManager.delete(entityId, { name: Types.ImageFileData.name }, DeletionType.HardDelete, this.instrumentationClient.RootActivity).then(() => {\r\n                // Raise action to remove the image id from collection which maintains the Id images which fail to update by Ingestion\r\n                this.imageCommandActions.RemoveFailedImageUpdateByIngestion.getActionSender(this.store)([entityId]);\r\n            }).catch(_error => {\r\n                this.instrumentationClient.LoggingService.error(\"LightboxPageBootstrapper.onRemoveFromLightboxInvoked::deleteError\", removeFromLightboxActivity, { entityId });\r\n            });\r\n\r\n            PromiseExtension.onComplete(deletePromise, () => { this.instrumentationClient.ActivityLoggingService.endActivity(removeFromLightboxActivity); });\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Creates the Image overlay title.\r\n     * @method\r\n     * @param {IImageFileData<ICatalystFileDataMetadata>} imageEntity The image entity.\r\n     * @returns {string} date with image title.\r\n     */\r\n    private getImageOverlayTitle(imageEntity: IImageFileData<ICatalystFileDataMetadata>): string {\r\n        const dateFormat = appConfig.imageOverlayDateFormat || \"DD MMM YYYY\";\r\n        let imageDate = \"\";\r\n        if (!!imageEntity.displayPublishedDateTime) {\r\n            imageDate = Moment(imageEntity.displayPublishedDateTime).format(dateFormat) + (!!imageEntity.title ? \" - \" : \"\");\r\n        }\r\n\r\n        return imageDate + imageEntity.title;\r\n    }\r\n\r\n    // Helper to create the modal carousel\r\n    private createModalCarousel(state: ILightboxPageBootstrapperState, imageTiles: IImageTileProps[]): React.ReactElement<IModalCarouselProps> {\r\n        // adjust index if the current selected index is the last image and it's been deleted to avoid the possibility that index can be out of bound\r\n        const adjustedIndex = Math.min(state.lightboxPageState.selectedAnnotatedEntityIndex, this.getLightboxManager().getIDsOfEntitiesInActiveLightbox().length - 1);\r\n        if (adjustedIndex !== state.lightboxPageState.selectedAnnotatedEntityIndex) {\r\n            this.imagePreviewModalActions.ImagePreviewModalFetchEnd.getActionSender(this.store)(adjustedIndex);\r\n        }\r\n\r\n        const entityId = this.getLightboxManager().getIDsOfEntitiesInActiveLightbox()[adjustedIndex];\r\n        const imageTilePropsForEntity = imageTiles.find(imageTile => imageTile.id === entityId);\r\n        const selectedImageEntityWithMetadata = this.getEntityWithMetadataFromEntityId(entityId, state);\r\n\r\n        let dimensions = { width: AppConstants.thumbnailConfig.width, height: AppConstants.thumbnailConfig.height };\r\n        let displayVerticalLayout = false;\r\n        const showDownloadingMessage = state.lightboxPageState.imageCommandState.imagesDownloading.indexOf(entityId) >= 0;\r\n        const showFailedDownloadingMessage: boolean = !showDownloadingMessage && (state.lightboxPageState.imageCommandState.failedImages.indexOf(entityId) >= 0);\r\n        let downloadEnabled = false;\r\n        let downloadInProgress = false;\r\n\r\n        let imagePreviewElementProps: IImagePreviewModalProps = {\r\n            visible: true,\r\n            downloadInProgress,\r\n            downloadEnabled,\r\n            displayVerticalLayout,\r\n            sourceId: \"\",\r\n            width: dimensions.width,\r\n            height: dimensions.height,\r\n            entityId,\r\n            title: \"\",\r\n            caption: \"\",\r\n            lowQualtiySourceHref: \"\",\r\n            sourceHref: \"\",\r\n            errorCode: imageTilePropsForEntity.loading ? \"\" : LightboxPageBootstrapper.NoDetailsErrorCode,\r\n            errorMessage: imageTilePropsForEntity.loading ? \"\" : LightboxPageBootstrapper.NoDetailsErrorMessage,\r\n            isImageLinkGenerationInProgress: false,\r\n            generateImageLinkInvoked: undefined,\r\n            imageLink: null\r\n        };\r\n\r\n        if (selectedImageEntityWithMetadata !== null) {\r\n\r\n            const entity = selectedImageEntityWithMetadata.entity;\r\n            const isValidEntity = !isNil(entity._id) && !isEmpty(entity._id);\r\n\r\n            if (isValidEntity) {\r\n                dimensions = GetImageDimensionToDetermineLayout(entity);\r\n            }\r\n\r\n            displayVerticalLayout = DetermineModalLayout(dimensions.width, dimensions.height);\r\n            downloadInProgress = state.lightboxPageState.imageCommandState.imagesDownloading.indexOf(entityId) >= 0;\r\n            downloadEnabled = !downloadInProgress && isValidEntity;\r\n            const isFailedImage = state.lightboxPageState.imageCommandState.creativeImageIngestionState.failedToUpdateImages.indexOf(entityId) > -1;\r\n            const isImageIngestionInProgress = !!state.lightboxPageState.imageCommandState.creativeImageIngestionState\r\n                ? state.lightboxPageState.imageCommandState.creativeImageIngestionState.beingIngestedImageIds.indexOf(entity.sourceId) > -1 : false;\r\n\r\n            imagePreviewElementProps = GetImagePreviewElementProps(\r\n                selectedImageEntityWithMetadata,\r\n                showDownloadingMessage,\r\n                showFailedDownloadingMessage,\r\n                downloadInProgress,\r\n                downloadEnabled,\r\n                displayVerticalLayout,\r\n                this.downloadImage,\r\n                isImageIngestionInProgress,\r\n                (_event: React.SyntheticEvent<any>): void => { return; },\r\n                state.lightboxPageState.imageCommandState.lastDownloadError,\r\n                this.getLightboxManager,\r\n                this.onRemoveFromLightboxInvoked,\r\n                isFailedImage\r\n            );\r\n        }\r\n\r\n        let modalCarouselProps: IModalCarouselProps = InitializeModalCarouselProps(dimensions.width, dimensions.height);\r\n\r\n        modalCarouselProps = merge(modalCarouselProps, {\r\n            onHide: () => {\r\n                this.imageCommandActions.ImagePreviewLinkGenerationStatusReset.getActionSender(this.store)();\r\n                this.modalProvisioningActions.HideModal.getActionSender(this.store)();\r\n            },\r\n            onSelect: (_eventKey: React.MouseEvent<{}>, carouselEvent?: React.SyntheticEvent<{}>) => {\r\n                if ((<any>carouselEvent).direction === CarouselDirection.Next) {\r\n                    this.onPreviewButtonNext(carouselEvent.nativeEvent);\r\n                } else if ((<any>carouselEvent).direction === CarouselDirection.Previous) {\r\n                    this.onPreviewButtonPrev(carouselEvent.nativeEvent);\r\n                }\r\n            },\r\n            onKeyPressed: (eventArgs: React.KeyboardEvent<any>) => {\r\n                switch (eventArgs.keyCode) {\r\n                    case KeyCode.LEFT_ARROW:\r\n                        eventArgs.preventDefault();\r\n                        this.onPreviewButtonPrev(eventArgs.nativeEvent);\r\n                        break;\r\n                    case KeyCode.RIGHT_ARROW:\r\n                        eventArgs.preventDefault();\r\n                        this.onPreviewButtonNext(eventArgs.nativeEvent);\r\n                        break;\r\n                    default:\r\n                        break;\r\n                }\r\n            }\r\n        });\r\n\r\n        return React.createElement(ModalCarousel, modalCarouselProps, React.createElement(ImagePreviewModal, imagePreviewElementProps));\r\n    }\r\n\r\n    // The preview button prev function\r\n    private onPreviewButtonPrev(event: Event): void {\r\n        const state = this.getCurrentState();\r\n        const listOfEntitiesInCollection = this.getLightboxManager().getIDsOfEntitiesInActiveLightbox();\r\n        const prevSelectedIndex = CalculatePreviousImageIndex(listOfEntitiesInCollection.length, state.lightboxPageState.selectedAnnotatedEntityIndex, listOfEntitiesInCollection.length);\r\n        this.onNavigatePrevOrNext(event, state, prevSelectedIndex, listOfEntitiesInCollection, \"imagePreview-Prev\");\r\n    }\r\n\r\n    // The preview button next function\r\n    private onPreviewButtonNext(event: Event): void {\r\n        const state = this.getCurrentState();\r\n        const listOfEntitiesInCollection = this.getLightboxManager().getIDsOfEntitiesInActiveLightbox();\r\n        const nextSelectedIndex = CalculateNextImageIndex(listOfEntitiesInCollection.length, state.lightboxPageState.selectedAnnotatedEntityIndex, listOfEntitiesInCollection.length);\r\n        this.onNavigatePrevOrNext(event, state, nextSelectedIndex, listOfEntitiesInCollection, \"imagePreview-Next\");\r\n    }\r\n\r\n    // Helper for page navigation\r\n    private onNavigatePrevOrNext(\r\n        event: Event,\r\n        state: ILightboxPageBootstrapperState,\r\n        newSelectedIndex: number,\r\n        listOfEntitiesInCollection: string[],\r\n        elementId: string\r\n    ): void {\r\n        const entityId = listOfEntitiesInCollection[newSelectedIndex];\r\n        const newSelectedImageEntityWithMetadata = this.getEntityWithMetadataFromEntityId(entityId, state) as IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>>;\r\n        const selectActionInput = newSelectedImageEntityWithMetadata === null ?\r\n            {\r\n                \"id\": entityId,\r\n                \"message\": LightboxPageBootstrapper.NoDetailsErrorMessage\r\n            } :\r\n            GetSelectActionInput(newSelectedImageEntityWithMetadata, newSelectedIndex, true, ResultsDisplayModeEnum.Grid);\r\n\r\n        this.instrumentationClient.UserActivityTrackingService.logPageActionEvent(\r\n            this.instrumentationClient.createEventData(event, \"ImagePreview\", null, elementId, AreaOfPage.ImagePreviewModal),\r\n            PageNames.Lightbox,\r\n            this.instrumentationClient.RootActivityCorrelationVector,\r\n            PageActionData.createFrom(null, selectActionInput, null, null, null, null, PageNames.Lightbox));\r\n        this.imageCommandActions.ImagePreviewLinkGenerationStatusReset.getActionSender(this.store)();\r\n        this.imagePreviewModalActions.ImagePreviewModalFetchEnd.getActionSender(this.store)(newSelectedIndex);\r\n    }\r\n\r\n    // Helper to get the EntityWithMetadata by id from the state\r\n    private getEntityWithMetadataFromEntityId(id: string, state: ILightboxPageBootstrapperState): IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>> {\r\n\r\n        const ewmIndex = state.lightboxPageState.entityList.entitiesWithMetadata.findIndex(ewm => ewm.metadata.documentId === id);\r\n        if (ewmIndex >= 0) {\r\n            return state.lightboxPageState.entityList.entitiesWithMetadata[ewmIndex] as IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>>;\r\n        }\r\n\r\n        return null;\r\n    }\r\n\r\n    /**\r\n     * download image function\r\n     * @param event {Event} the event which triggered this handler\r\n     * @method\r\n     */\r\n    private downloadImage(event: React.SyntheticEvent<Event>): void {\r\n        const state = this.getCurrentState();\r\n        const selectedEntityId = this.getLightboxManager().getIDsOfEntitiesInActiveLightbox()[state.lightboxPageState.selectedAnnotatedEntityIndex];\r\n        const entity = this.getEntityWithMetadataFromEntityId(selectedEntityId, state).entity;\r\n\r\n        const lightboxId = state.lightboxState.activeLightboxId;\r\n\r\n        const getActionInput = () => {\r\n            return {\r\n                \"lightboxId\": lightboxId,\r\n                \"imageId\": entity._id\r\n            };\r\n        };\r\n        const logUserActivityCallback =\r\n            this.createLogUserActivityCallback(event, \"download-lightbox-image\", \"preview-download-btn\", AreaOfPage.lightboxImagePreviewModal, getActionInput);\r\n        logUserActivityCallback(this.instrumentationClient.RootActivityCorrelationVector);\r\n\r\n        DownloadImage(\r\n            event,\r\n            entity,\r\n            PageNames.Lightbox,\r\n            this.imageCommandActionCreator,\r\n            this.instrumentationClient,\r\n            \"LightboxPageBootstrapper.downloadImage\"\r\n        );\r\n    }\r\n\r\n    private createLogUserActivityCallback(event: Event | React.SyntheticEvent<any>, elementId: string, elementTitle: string, areaOfPage: string, getActionInput: () => { [key: string]: string; }): (correlationVector: string) => void {\r\n\r\n        const eventData = this.instrumentationClient.createEventData(event, elementTitle, null, elementId, areaOfPage);\r\n        const actionInput = getActionInput();\r\n        const pageActionData = PageActionData.createFrom(null, actionInput, null, null, null, null, areaOfPage);\r\n\r\n        const logUserActivity = (correlationVector: string) => {\r\n            this.instrumentationClient.UserActivityTrackingService.logPageActionEvent(\r\n                eventData,\r\n                PageNames.Lightbox,\r\n                correlationVector,\r\n                pageActionData\r\n            );\r\n        };\r\n\r\n        return logUserActivity;\r\n    }\r\n\r\n    // Callback for when the search text has changed\r\n    private onSearchTextChanged(_event: React.FormEvent<HTMLInputElement>, value: { newValue: string }): void {\r\n        this.entitySearchActions.SearchTextChange.getActionSender(this.store)(value.newValue);\r\n    }\r\n\r\n    // Callback to exit search mode\r\n    private onExitSearch(event: React.SyntheticEvent<any>): void {\r\n\r\n        // When we exit search, clear the active lightbox, if there is one.\r\n        const activeLightboxId = this.getLightboxManager().getActiveLightboxId();\r\n        if (!isEmpty(activeLightboxId)) {\r\n            this.getLightboxManager().setActiveLightbox(\"\");\r\n        }\r\n\r\n        this.instrumentationClient.UserActivityTrackingService.logPageActionEvent(\r\n            this.instrumentationClient.createEventData(event, \"exitSearch\", null, \"Button\", AreaOfPage.lightboxSelectBoardPanel),\r\n            PageNames.Lightbox,\r\n            this.rootLightboxActivity.correlationVector,\r\n            PageActionData.createFrom(null, null, null, null, null, null, PageNames.Lightbox));\r\n\r\n        // Clear any selected items in the lightbox and switch back to showing the recent list\r\n        this.entitySelectorActions.EntitySelectionChanged.getActionSender(this.store)([], false);\r\n        this.entitySearchActions.ClearSearch.getActionSender(this.store)();\r\n    }\r\n\r\n    // Callback to execute the search\r\n    private onSearchExecute(event: React.SyntheticEvent<any>): void {\r\n\r\n        const searchText = this.getCurrentState().lightboxPageState.searchTextState.searchText || \"\";\r\n\r\n        const actionInput = {\r\n            \"searchText\": searchText\r\n        };\r\n\r\n        this.instrumentationClient.UserActivityTrackingService.logPageActionEvent(\r\n            this.instrumentationClient.createEventData(event, \"searchText\", null, \"TextBox\", AreaOfPage.lightboxSelectBoardPanel),\r\n            PageNames.Lightbox,\r\n            this.rootLightboxActivity.correlationVector,\r\n            PageActionData.createFrom(null, actionInput, null, null, null, null, PageNames.Lightbox));\r\n\r\n        // Switch to showing search results\r\n        this.entitySearchActions.ExecuteSearch.getActionSender(this.store)();\r\n\r\n        const activeLightboxId = this.getLightboxManager().getActiveLightboxId();\r\n\r\n        // When we execute a search, clear the active lightbox, if there is one.\r\n        // In this case we do push the lightbox path to the browser history as the search execute is not a link,\r\n        // so the app does not route there automatically.\r\n        if (!!activeLightboxId) {\r\n            // Clear any selected items in the active lightbox\r\n            this.entitySelectorActions.EntitySelectionChanged.getActionSender(this.store)([], false);\r\n            this.getLightboxManager().setActiveLightbox(\"\");\r\n            browserHistory.push(Routes.getLightboxPageRoutePath(true /* baseOnly */));\r\n        }\r\n\r\n        // This activity is used to track the perf of the search execution.\r\n        const searchActivity =\r\n            this.instrumentationClient.ActivityLoggingService.createActivity(\r\n                \"LightboxPageBootstrapper.onSearchExecute\",\r\n                this.rootLightboxActivity,\r\n                { searchText }\r\n            );\r\n\r\n        const searchLightboxesPromise = this.getLightboxManager().searchForLightboxes(searchText, searchActivity);\r\n\r\n        searchLightboxesPromise.catch((error) => {\r\n            this.instrumentationClient.LoggingService.error(\"SearchAndSelectBootstrapper.searchNextPageQuery\", searchActivity, error);\r\n        });\r\n\r\n        PromiseExtension.onComplete<IEntityWithMetadata<IEntity>[]>(searchLightboxesPromise, () => this.instrumentationClient.ActivityLoggingService.endActivity(searchActivity));\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { cloneDeep, differenceWith, isEmpty, isEqual } from \"lodash-es\";\r\n\r\nimport { Global } from \"../../Global\";\r\nimport { IActivityLogItem } from \"clientcore-infrastructure-analytics/models/IActivityLogItem\";\r\nimport { ILightboxProfileInfo } from \"../../models/lightbox/ILightboxProfileInfo\";\r\nimport { IStore } from \"redux\";\r\nimport { LightboxActions } from \"../../presentation-logic/dataflows/lightbox/LightboxActions\";\r\nimport { ccsdk } from \"../../globals/ccsdk\";\r\n\r\n/**\r\n * Interface for the profile manager manages lightbox settings.\r\n */\r\ninterface ILightboxUserProfileManager {\r\n    /**\r\n     * Get all lightboxes stored in the profile.\r\n     */\r\n    recentLightboxes: ILightboxProfileInfo[];\r\n\r\n    /**\r\n     * Sets the on profile update callback\r\n     * @param store {IStore<any>} The redux store\r\n     * @param lightboxActions {LightboxActions} The lightbox actions\r\n     * @param onUpdateCallback {(lightboxProfileInfo: ILightboxProfileInfo[]) => void} The on profiile update callback\r\n     */\r\n    setOnUpdateCallback: (store: IStore<any>, lightboxActions: LightboxActions, onUpdateCallback: (lightboxProfileInfo: ILightboxProfileInfo[]) => void) => void;\r\n\r\n    /**\r\n     * Add a new lightbox to the recent lightbox list stored in the user's profile\r\n     * @param lightboxProfileInfo {ILightboxProfileInfo} the lightbox information\r\n     * @param parentActivity {IActivityLogItem} parent activity for telemetry\r\n     */\r\n    add: (lightboxProfileInfo: ILightboxProfileInfo, parentActivity: IActivityLogItem) => Promise<ILightboxProfileInfo[]>;\r\n\r\n    /**\r\n     * Removes a lightbox from recent lightbox list in the profile\r\n     * @param lightboxId {string} The id of the lightbox to be removed\r\n     * @param parentActivity {IActivityLogItem} parent activity for telemetry\r\n     */\r\n    remove: (lightBoxId: string, parentActivity: IActivityLogItem) => Promise<ILightboxProfileInfo[]>;\r\n\r\n    /**\r\n     * Clear all lightboxes from profile\r\n     * @param parentActivity {IActivityLogItem} parent activity for telemetry\r\n     */\r\n    clear(parentActivity: IActivityLogItem): void;\r\n}\r\n\r\n/**\r\n * The user profile manager manages updates to the lighbox section of the userprofile.\r\n */\r\nclass LightboxUserProfileManager implements ILightboxUserProfileManager {\r\n    /**\r\n     * The lightbox property name in the userprofile.\r\n     */\r\n    private userProfileSettingName: string = \"recentLightboxes\";\r\n\r\n    /**\r\n     * The redux store\r\n     */\r\n    private store: IStore<any>;\r\n\r\n    /*\r\n     * lightbox actions.\r\n     */\r\n    private lightboxActions: LightboxActions;\r\n\r\n    /**\r\n     * A local copy of the lightbox setting section from the userprofile.\r\n     */\r\n    private _recentLightboxes: ILightboxProfileInfo[];\r\n    public get recentLightboxes(): ILightboxProfileInfo[] {\r\n        return this._recentLightboxes;\r\n    }\r\n\r\n    /**\r\n     * @constructor\r\n     */\r\n    constructor() {\r\n        if (!!Global.userProfile && !!Global.userProfile.recentLightboxes) {\r\n            this._recentLightboxes = cloneDeep(Global.userProfile.recentLightboxes);\r\n        } else {\r\n            this._recentLightboxes = [];\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Sets the on profile update callback\r\n     * @param store {IStore<any>} The redux store\r\n     * @param lightboxActions {LightboxActions} The lightbox actions\r\n     * @param onUpdateCallback {(lightboxProfileInfo: ILightboxProfileInfo[]) => void} The on profiile update callback\r\n     */\r\n    public setOnUpdateCallback(store: IStore<any>, lightboxActions: LightboxActions, onUpdateCallback: (lightboxProfileInfo: ILightboxProfileInfo[]) => void): void {\r\n        this.store = store;\r\n        this.lightboxActions = lightboxActions;\r\n\r\n        ccsdk.userProfileManagers.prose.subscribe(() => {\r\n            ccsdk.userProfileManagers.prose.getAllSettings().then(profile => {\r\n                if (!!profile && !!profile.recentLightboxes) {\r\n                    const profileRecentLightboxes: ILightboxProfileInfo[] = profile.recentLightboxes;\r\n                    const lengthIsDiff = profileRecentLightboxes.length !== Global.userProfile.recentLightboxes.length;\r\n                    let diff = null;\r\n\r\n                    // check if content length are same, if not, always call callback, otherwise check if contents are different.\r\n                    if (!lengthIsDiff) {\r\n                        diff = differenceWith(profile.recentLightboxes, Global.userProfile.recentLightboxes, isEqual);\r\n                    }\r\n\r\n                    const callCallBack = lengthIsDiff || !isEmpty(diff);\r\n\r\n                    if (callCallBack) {\r\n                        Global.userProfile = profile || {};\r\n                        this._recentLightboxes = cloneDeep(profile.recentLightboxes);\r\n                        this.lightboxActions.UpdatedLightbox.getActionSender(this.store)(this._recentLightboxes);\r\n                        if (!!onUpdateCallback) {\r\n                            onUpdateCallback(this._recentLightboxes);\r\n                        }\r\n                    }\r\n                }\r\n            });\r\n        });\r\n    }\r\n\r\n    /**\r\n     * Clear all lightboxes from profile\r\n     * @param parentActivity {IActivityLogItem} parent activity for telemetry\r\n     */\r\n    public clear(parentActivity: IActivityLogItem): void {\r\n        this._recentLightboxes = [];\r\n        ccsdk.userProfileManagers.prose.setSetting(this.userProfileSettingName, cloneDeep(this._recentLightboxes), parentActivity);\r\n    }\r\n\r\n    /**\r\n     * Add a new lightbox\r\n     * @param lightboxName {string} the new lightbox name\r\n     * @param parentActivity {IActivityLogItem} parent activity for telemetry\r\n     */\r\n    public add(lightboxProfileInfo: ILightboxProfileInfo, parentActivity: IActivityLogItem): Promise<ILightboxProfileInfo[]> {\r\n        // Do nothing if the lightbox is already present\r\n        if (!!this._recentLightboxes.find(lightbox => lightbox.id === lightboxProfileInfo.id)) {\r\n            return Promise.resolve(this._recentLightboxes);\r\n        }\r\n\r\n        return new Promise<ILightboxProfileInfo[]>((resolve, reject) => {\r\n            if (!lightboxProfileInfo) {\r\n                reject(\"Add lightbox failed. Error: No information given;\");\r\n                return;\r\n            }\r\n\r\n            this._recentLightboxes.unshift(lightboxProfileInfo);\r\n            this.saveLightboxSettingsToCmsProfile(resolve, reject, parentActivity);\r\n        });\r\n    }\r\n\r\n    /**\r\n     * Removes a lightbox from profile\r\n     * @param lightboxId {string} the lightbox to be removed\r\n     * @param parentActivity {IActivityLogItem} parent activity for telemetry\r\n     */\r\n    public remove(lightboxId: string, parentActivity: IActivityLogItem): Promise<ILightboxProfileInfo[]> {\r\n        // Do nothing if the lightbox isn't present\r\n        let index = this._recentLightboxes.findIndex(lightbox => lightbox.id === lightboxId);\r\n        if (index < 0) {\r\n            return Promise.resolve(this._recentLightboxes);\r\n        }\r\n\r\n        return new Promise<any>((resolve, reject) => {\r\n            this._recentLightboxes.splice(index, 1);\r\n            this.saveLightboxSettingsToCmsProfile(resolve, reject, parentActivity);\r\n        });\r\n    }\r\n\r\n    /**\r\n     * Saves the local copy of lightbox profile into CMS profile doc.\r\n     * @param resolve {(result?) => void} Parent promise resolve function\r\n     * @param reject {(result?) => void} Parent promise reject function\r\n     */\r\n    private saveLightboxSettingsToCmsProfile(resolve: (result) => void, reject: (error?) => void, parentActivity: IActivityLogItem): void {\r\n        ccsdk.userProfileManagers.prose.setSetting(this.userProfileSettingName, this._recentLightboxes, parentActivity).then(() => {\r\n            resolve(cloneDeep(this._recentLightboxes));\r\n        }).catch((e) => {\r\n            reject(e);\r\n        });\r\n    }\r\n}\r\n\r\nexport { LightboxUserProfileManager, ILightboxUserProfileManager };","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { ActionMap } from \"cms-ui-redux/ActionMap\";\r\n\r\nimport { NamespacePrefixActionsDefinitionBase } from \"cms-ui-redux/NamespacePrefixActionsDefinitionBase\";\r\n\r\n/**\r\n * Show message box action signature.\r\n * @typedef {(string, string) => void} ShowErrorMessageBoxSignature\r\n */\r\nexport type ShowErrorMessageBoxSignature = (title: string, message: string[]) => void;\r\n\r\n/**\r\n * Hide message box action signature.\r\n * @typedef {() => void} ShowErrorMessageBoxSignature\r\n */\r\nexport type HideErrorMessageBoxSignature = () => void;\r\n\r\n/**\r\n * Exposes a redux action to show/hide error message box.\r\n * @class\r\n */\r\nexport class MessageBoxModalActions extends NamespacePrefixActionsDefinitionBase {\r\n\r\n    /**\r\n     * Defines action for showing message box.\r\n     */\r\n    private showErrorMessageBox: ActionMap<ShowErrorMessageBoxSignature> = new ActionMap<ShowErrorMessageBoxSignature>(\"MessageBoxModalActions.ShowErrorMessageBox\");\r\n\r\n    /**\r\n     * Defines action for hiding message box.\r\n     */\r\n    private hideErrorMessageBox: ActionMap<HideErrorMessageBoxSignature> = new ActionMap<HideErrorMessageBoxSignature>(\"MessageBoxModalActions.HideErrorMessageBox\");\r\n\r\n    /**\r\n     * Initializes a new instance of the 'MessageBoxModalActions' class.\r\n     * @constructor\r\n     * @param namespacePrefix {string} Optional prefix to add to the namespace used to distinguish between different instances of this data flow.\r\n     */\r\n    constructor(namespacePrefix?: string) {\r\n        super(\"MessageBoxModal\", namespacePrefix);\r\n    }\r\n\r\n    /**\r\n     * Show error message box action.\r\n     * @returns {ActionMap<ShowErrorMessageBoxSignature>}\r\n     */\r\n    public get ShowErrorMessageBox(): ActionMap<ShowErrorMessageBoxSignature> {\r\n        return this.showErrorMessageBox;\r\n    }\r\n\r\n    /**\r\n     * Hides message box.\r\n     * @returns {ActionMap<HideErrorMessageBoxSignature>}\r\n     */\r\n    public get HideErrorMessageBox(): ActionMap<HideErrorMessageBoxSignature> {\r\n        return this.hideErrorMessageBox;\r\n    }\r\n\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { ActionHandler } from \"cms-ui-redux/ActionHandler\";\r\nimport { IActionPayload } from \"cms-ui-redux/IActionPayload\";\r\nimport { IMessageBoxModalState } from \"./IMessageBoxModalState\";\r\nimport { MessageBoxModalActions } from \"./MessageBoxModalActions\";\r\nimport { NamespaceCheckReducerBase } from \"cms-ui-redux/NamespaceCheckReducerBase\";\r\nimport { clone } from \"lodash-es\";\r\n\r\n/**\r\n * The top-level app redux reducer. Manages a `routeChanged` action and delegate others to its children reducers.\r\n * @class\r\n */\r\nexport class MessageBoxModalReducer extends NamespaceCheckReducerBase<IMessageBoxModalState> {\r\n\r\n    /**\r\n     * @constructor\r\n     * @param {MessageBoxModalActions} messageBoxModalActions - Error message box actions.\r\n     */\r\n    constructor(private messageBoxModalActions: MessageBoxModalActions) {\r\n        super([messageBoxModalActions.namespace]);\r\n    }\r\n\r\n    /**\r\n     * @method\r\n     * @param {IMessageBoxModalState} state -The state to reduce\r\n     * @param {IActionPayload} actionPayload - The payload to apply\r\n     * @returns {IMessageBoxModalState} The new state.\r\n     */\r\n    public reduce(state: IMessageBoxModalState, actionPayload: IActionPayload): IMessageBoxModalState {\r\n\r\n        if (!state) {\r\n            throw \"The state parameter is required.\";\r\n        }\r\n\r\n        if (!actionPayload) {\r\n            throw \"The actionPayload parameter is required.\";\r\n        }\r\n\r\n        let newState = clone(state);\r\n\r\n        ActionHandler.handleAction(actionPayload, this.messageBoxModalActions.ShowErrorMessageBox, (errorTitle: string, errorText: string[]) => {\r\n            newState.title = errorTitle;\r\n            newState.text = errorText;\r\n            newState.isVisible = true;\r\n        });\r\n\r\n        ActionHandler.handleAction(actionPayload, this.messageBoxModalActions.HideErrorMessageBox, () => {\r\n            newState.title = null;\r\n            newState.text = null;\r\n            newState.isVisible = false;\r\n        });\r\n\r\n        return newState;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { IDispatch } from \"redux\";\r\nimport { IReducer } from \"cms-ui-redux/IReducer\";\r\nimport { ComponentBootstrapper } from \"cms-ui-views/ComponentBootstrapper\";\r\nimport { ReduxBootstrapper } from \"cms-ui-views/ReduxBootstrapper\";\r\n\r\nimport { IMessageBoxModalState } from \"../../presentation-logic/dataflows/messageBoxModal/IMessageBoxModalState\";\r\nimport { MessageBoxModalActions } from \"../../presentation-logic/dataflows/messageBoxModal/MessageBoxModalActions\";\r\nimport { MessageBoxModalReducer } from \"../../presentation-logic/dataflows/messageBoxModal/MessageBoxModalReducer\";\r\nimport { IMessageBoxModalProps } from \"../../rendering/components/messageBoxModal/IMessageBoxModalProps\";\r\n\r\n/**\r\n * The bootstrapper that wires the <MessageBoxModal /> component into Redux.\r\n * @class\r\n */\r\nexport class MessageBoxModalBootstrapper<TParentState> extends ComponentBootstrapper<IMessageBoxModalState, IMessageBoxModalProps, TParentState> {\r\n\r\n    // Massage dialog box actions.\r\n    private messageBoxModalActions: MessageBoxModalActions;\r\n\r\n    /**\r\n     * Creates new message box bootstrapper instance.\r\n     * @param {ComponentBootstrapper | ReduxBootstrapper} parentBootstrapper - Parent bootstrapper instance.\r\n     * @param {function} stateSelector - Component state selector.\r\n     * @constructor\r\n     */\r\n    constructor(\r\n        parentBootstrapper?: ComponentBootstrapper<TParentState, any, any> | ReduxBootstrapper<TParentState>,\r\n        stateSelector?: (parentState: TParentState) => IMessageBoxModalState\r\n    ) {\r\n\r\n        super(parentBootstrapper, stateSelector);\r\n\r\n        this.messageBoxModalActions = new MessageBoxModalActions();\r\n\r\n        this.Show = this.Show.bind(this);\r\n        this.onClose = this.onClose.bind(this);\r\n    }\r\n\r\n    /**\r\n     * Initializes the initial state of the component.\r\n     * @method\r\n     * @returns {IMessageBoxModalState} The initial state of the component.\r\n     */\r\n    public getInitialState(): IMessageBoxModalState {\r\n\r\n        const initialState: IMessageBoxModalState = {\r\n            isVisible: false,\r\n            title: null,\r\n            text: null\r\n        };\r\n\r\n        return initialState;\r\n    }\r\n\r\n    /**\r\n     * Creates the reducer that will manage IMessageBoxModalState.\r\n     * @method\r\n     * @returns {IReducer<IMessageBoxModalState>} The reducer that will manage IMessageBoxModalState.\r\n     */\r\n    public createRootReducer(): IReducer<IMessageBoxModalState> {\r\n        return new MessageBoxModalReducer(this.messageBoxModalActions);\r\n    }\r\n\r\n    /**\r\n     * Inject into props redux action creators.\r\n     * @method\r\n     * @param {IDispatch} dispatch - The redux dispatch function.\r\n     * @param {IMessageBoxModalProps} ownProps - The set of pure properties of the component.\r\n     * @returns {IMessageBoxModalProps} An enriched set of props.\r\n     */\r\n    public mapDispatchToProps(_dispatch: IDispatch, _ownProps: IMessageBoxModalProps): IMessageBoxModalProps {\r\n        return {\r\n            close: this.onClose\r\n        } as IMessageBoxModalProps;\r\n    }\r\n\r\n    /**\r\n     * Redux mapper used to map the current state to props the component use to render itself.\r\n     * @method\r\n     * @param {IMessageBoxModalState} state - The current state of the component.\r\n     * @param {IMessageBoxModalProps} ownProps - The set of pure properties of the component.\r\n     * @returns {IMessageBoxModalProps} An enriched set of props.\r\n     */\r\n    public mapStateToProps(state: IMessageBoxModalState, _ownProps: IMessageBoxModalProps): IMessageBoxModalProps {\r\n\r\n        return {\r\n            isVisible: state.isVisible,\r\n            title: state.title,\r\n            text: state.text\r\n        } as IMessageBoxModalProps;\r\n    }\r\n\r\n    /**\r\n     * Triggers dialog show action.\r\n     * @method\r\n     * @param {string} errorTitle - Message box title.\r\n     * @param {string[]} errorMessage - Message box content text.\r\n     */\r\n    public Show(errorTitle: string, errorMessage: string[]): void {\r\n        this.messageBoxModalActions.ShowErrorMessageBox.getActionSender(this.store)(errorTitle, errorMessage);\r\n    }\r\n\r\n    /**\r\n     * Triggers close action of massage box dialog.\r\n     * @method\r\n     */\r\n    private onClose(): void {\r\n        this.messageBoxModalActions.HideErrorMessageBox.getActionSender(this.store)();\r\n    }\r\n\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\n/**\r\n * Enum representing which end of the range a given date represents.\r\n * @enum\r\n */\r\nexport enum DateRangeBoundaryIdentifier {\r\n    startOfRange,\r\n    endOfRange\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\n/**\r\n * enum used to identify what the option specified in the date range option list dropdown represents.\r\n * @enum\r\n */\r\nexport enum DateRangeOptionType {\r\n    any, // Any date allowed - i.e. no range is specified\r\n    durationInHours, // Range is a duration in hours extending backwards from the current date\r\n    custom // Range is identified by a start and an end date.\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { EditorialSearchQuery } from \"clientcore-catalyst-businesslogic/editorialSearch/EditorialSearchQuery\";\r\nimport { FieldType } from \"../../models/fieldType/FieldTypeEnum\";\r\nimport { IFilterRuleDefinition } from \"../../models/filterRules/IFilterRuleDefinition\";\r\nimport { INumberFilter } from \"clientcore-catalyst-businesslogic/editorialSearch/INumberFilter\";\r\nimport { Predicate } from \"cms-businesslogic/search/filter/Predicate\";\r\nimport { PromoCardPredicateBuilder } from \"cms-ui-presentationlogic/queryBuilder/predefinedRules/PromoCardPredicateBuilder\";\r\nimport { isNil } from \"lodash-es\";\r\n\r\n/**\r\n * Interface to wrap the information needed when building a filter for the\r\n * two types of values we currently support\r\n *  - string values\r\n *  - date ranges\r\n * @interface\r\n */\r\ninterface IQueryBuilderRuleInfo {\r\n    // The rule definition\r\n    filterRule: IFilterRuleDefinition;\r\n\r\n    // Applies to string or number type fields only\r\n    filterValues?: (string | INumberFilter)[];\r\n\r\n    // Applies to date type fields only\r\n    from?: Date;\r\n    to?: Date;\r\n}\r\n\r\n/**\r\n * Contains static methods for building the catalyst search query.\r\n * @class\r\n */\r\nclass QueryBuilder {\r\n\r\n    /**\r\n     * Builds a filter predicate which can be passed to the search query as part of the filter params.\r\n     * Apart from the filters passed fileMetadata.assetFamily=editorial and $type=imageFileData predicates are also added by default.\r\n     * @param filters {IQueryBuilderRuleInfo[]} An array of fields with values on which to filter by\r\n     * @returns {Predicate} The Predicate which will form part of the query\r\n     */\r\n    // tslint:disable-next-line:ext-variable-name\r\n    public static BuildFilter(filters: IQueryBuilderRuleInfo[]): Predicate {\r\n\r\n        let predicates: Predicate[] = [];\r\n\r\n        filters.forEach((filter) => {\r\n            if (filter.filterRule.ruleName === \"Head Shots\") {\r\n                predicates.push(PromoCardPredicateBuilder.buildPredicate());\r\n            } else if ((filter.filterRule.fieldType === FieldType.StringField) &&\r\n                !isNil(filter.filterValues)) {\r\n                predicates.push(filter.filterRule.predicateFilterBuilderForStringValues(filter.filterValues as string[]));\r\n            } else if ((filter.filterRule.fieldType === FieldType.NumberField) &&\r\n                !isNil(filter.filterValues)) {\r\n                predicates.push(filter.filterRule.predicateFilterBuilderForNumberFilterValues(filter.filterValues as INumberFilter[]));\r\n            } else if ((filter.filterRule.fieldType === FieldType.DateField) &&\r\n                !isNil(filter.from) &&\r\n                !isNil(filter.to)) {\r\n                predicates.push(filter.filterRule.dateRangeFilterBuilder(filter.from, filter.to));\r\n            }\r\n        });\r\n\r\n        let builtPredicate: Predicate = null;\r\n        if (predicates.length >= 2) {\r\n            predicates.slice(1).forEach(predicate => predicates[0].and(predicate));\r\n            builtPredicate = predicates[0];\r\n        } else if (predicates.length === 1) {\r\n            builtPredicate = predicates[0];\r\n        }\r\n\r\n        if (!!builtPredicate) {\r\n            return EditorialSearchQuery.editorialImageFilter().and(builtPredicate);\r\n        }\r\n\r\n        return EditorialSearchQuery.editorialImageFilter();\r\n    }\r\n\r\n    /**\r\n     * Builds a filter string which can be passed to the search as part of the q parameter (query string)\r\n     * @param filters {IQueryBuilderRuleInfo[]} An array of fields with values on which to filter by\r\n     * @returns {string} The string representing the query\r\n     */\r\n    // tslint:disable-next-line:ext-variable-name\r\n    public static BuildQueryTextFilter(filters: IQueryBuilderRuleInfo[]): string {\r\n        let parts: string[] = [];\r\n\r\n        if (!!filters && filters.length > 0) {\r\n            filters.forEach((filter) => {\r\n                if ((filter.filterRule.fieldType === FieldType.StringField) &&\r\n                    !isNil(filter.filterValues)) {\r\n                    const filterQuery = filter.filterRule.queryTextFilterBuilder(filter.filterValues as string[]);\r\n                    if (!!filterQuery) {\r\n                        parts.push(filterQuery);\r\n                    }\r\n                }\r\n            });\r\n        }\r\n\r\n        return parts.join(\" AND \");\r\n    }\r\n}\r\n\r\nexport { QueryBuilder, IQueryBuilderRuleInfo };\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\n/**\r\n * Class representing a date range.\r\n * @class\r\n */\r\nexport class DateRange {\r\n    /** The earlier date in the date range\r\n     * @type {Date}\r\n     */\r\n    private from: Date;\r\n\r\n    /** The later date in the date range\r\n     * @type {Date}\r\n     */\r\n    private to: Date;\r\n\r\n    /**\r\n     * Initializes a new instance of the `DateRange` class.\r\n     * From property is set to the earlier of the dates, and To property is set to the later of the dates.\r\n     * @constructor\r\n     * @param startDate {Date} One end of the range.\r\n     * @param endDate {Date} The other end of the range.\r\n     */\r\n    constructor(\r\n        startDate: Date,\r\n        endDate: Date) {\r\n\r\n        let startTime = startDate.getTime();\r\n        let endTime = endDate.getTime();\r\n\r\n        if (startTime < endTime) {\r\n            this.from = startDate;\r\n            this.to = endDate;\r\n        } else {\r\n            this.from = endDate;\r\n            this.to = startDate;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Constructs a DateRange based on a date and a number of hours.\r\n     * @param date {Date} A Date which will form one end of the range.\r\n     * @param hours {number} The duration of the range in hours. Negative means that the range will extend backwards from date.\r\n     * @returns {DateRange} The constructed date range.\r\n     */\r\n    // tslint:disable-next-line:ext-variable-name\r\n    public static FromDateAndHours(date: Date, hours: number): DateRange {\r\n\r\n        let startDate: Date = date;\r\n        let endDate: Date = date;\r\n        let milliseconds = hours * 3600000 /* milliseconds in an hour */;\r\n\r\n        if (hours > 0) {\r\n            startDate = date;\r\n            endDate = new Date();\r\n            endDate.setTime(date.getTime() + milliseconds);\r\n        } else if (hours < 0) {\r\n            endDate = date;\r\n            startDate = new Date();\r\n            startDate.setTime(date.getTime() + milliseconds);\r\n        }\r\n\r\n        return new DateRange(startDate, endDate);\r\n    }\r\n\r\n    /** Get accessor for the earlier (from) date in the range.\r\n     * @type {Date}\r\n     */\r\n    public get From(): Date {\r\n        return this.from;\r\n    }\r\n\r\n    /** Get accessor for the later (to) date in the range.\r\n     * @type {Date}\r\n     */\r\n    public get To(): Date {\r\n        return this.to;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { DateRangeOptionType } from \"./DateRangeOptionType\";\r\n\r\n// type used for each option in the date range dropdown.\r\ntype DateRangeOption = {\r\n    displayString: string,\r\n    rangeOptionType: DateRangeOptionType,\r\n    hours?: number\r\n};\r\n\r\nexport let dateRangeOptions: DateRangeOption[] = [\r\n    {\r\n        displayString: \"Any Date\",\r\n        rangeOptionType: DateRangeOptionType.any\r\n    },\r\n    {\r\n        displayString: \"Last hour\",\r\n        rangeOptionType: DateRangeOptionType.durationInHours,\r\n        hours: 1\r\n    },\r\n    {\r\n        displayString: \"Last 3 hours\",\r\n        rangeOptionType: DateRangeOptionType.durationInHours,\r\n        hours: 3\r\n    },\r\n    {\r\n        displayString: \"Last 6 hours\",\r\n        rangeOptionType: DateRangeOptionType.durationInHours,\r\n        hours: 6\r\n    },\r\n    {\r\n        displayString: \"Last 12 hours\",\r\n        rangeOptionType: DateRangeOptionType.durationInHours,\r\n        hours: 12\r\n    },\r\n    {\r\n        displayString: \"Last 24 hours\",\r\n        rangeOptionType: DateRangeOptionType.durationInHours,\r\n        hours: 24\r\n    },\r\n    {\r\n        displayString: \"Last 48 hours\",\r\n        rangeOptionType: DateRangeOptionType.durationInHours,\r\n        hours: 48\r\n    },\r\n    {\r\n        displayString: \"Last 72 hours\",\r\n        rangeOptionType: DateRangeOptionType.durationInHours,\r\n        hours: 72\r\n    },\r\n    {\r\n        displayString: \"Last week\",\r\n        rangeOptionType: DateRangeOptionType.durationInHours,\r\n        hours: 168 // 168 hours in a week\r\n    },\r\n    {\r\n        displayString: \"Last month\",\r\n        rangeOptionType: DateRangeOptionType.durationInHours,\r\n        hours: 720 // 720 hours in 30 days\r\n    },\r\n    {\r\n        displayString: \"Last year\",\r\n        rangeOptionType: DateRangeOptionType.durationInHours,\r\n        hours: 8760 // 8760 hours in 365 days\r\n    },\r\n    {\r\n        displayString: \"Select a date range ...\",\r\n        rangeOptionType: DateRangeOptionType.custom\r\n    }\r\n];","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { ActionMap } from \"cms-ui-redux/ActionMap\";\r\nimport { NamespacePrefixActionsDefinitionBase } from \"cms-ui-redux/NamespacePrefixActionsDefinitionBase\";\r\n\r\nimport { DateRangeBoundaryIdentifier } from \"./DateRangeBoundaryIdentifier\";\r\n\r\nexport type DateRangeBoundaryChangedSignature = (whichEndOfRange: DateRangeBoundaryIdentifier, newDate: Date) => void;\r\n\r\n/**\r\n * Exposes a redux action to raise a change to date range state.\r\n * @class\r\n */\r\nexport class DateRangeSelectorActions extends NamespacePrefixActionsDefinitionBase {\r\n\r\n    /** Defines the action indicating that the selection has changed.\r\n     */\r\n    private dateRangeBoundaryChanged: ActionMap<DateRangeBoundaryChangedSignature> = new ActionMap<DateRangeBoundaryChangedSignature>(this.namespace + \"DateRangeBoundaryChanged\");\r\n\r\n    /**\r\n     * Initializes a new instance of the `DateRangeSelectorActions` class.\r\n     * @constructor\r\n     * @param namespacePrefix {string} Optional prefix to add to the namespace used to distinguish between different instances of this data flow.\r\n     */\r\n    constructor(namespacePrefix?: string) {\r\n        super(\"DateRangeSelectorActions\", namespacePrefix);\r\n    }\r\n\r\n    /** Accessor for the DateRangeBoundaryChangedSignature action.\r\n     * @type {ActionMap<DateRangeBoundaryChangedSignature>}\r\n     */\r\n    public get DateRangeBoundaryChanged(): ActionMap<DateRangeBoundaryChangedSignature> {\r\n        return this.dateRangeBoundaryChanged;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { ActionHandler } from \"cms-ui-redux/ActionHandler\";\r\nimport { DateRangeBoundaryIdentifier } from \"./DateRangeBoundaryIdentifier\";\r\nimport { DateRangeSelectorActions } from \"./DateRangeSelectorActions\";\r\nimport { IActionPayload } from \"cms-ui-redux/IActionPayload\";\r\nimport { IDateRangeSelectorState } from \"./IDateRangeSelectorState\";\r\nimport { NamespaceCheckReducerBase } from \"cms-ui-redux/NamespaceCheckReducerBase\";\r\nimport { clone } from \"lodash-es\";\r\n\r\n/**\r\n * Reducer for DateRangeSelectorState.\r\n * @class\r\n */\r\nexport class DateRangeSelectorReduction extends NamespaceCheckReducerBase<IDateRangeSelectorState> {\r\n\r\n    /**\r\n     * Initializes a new instance of the `DateRangeSelectorReducer` class.\r\n     * @param dateRangeSelectorActions {DateRangeSelectorActions} date range selector actions to handle\r\n     * @constructor\r\n     */\r\n    constructor(public dateRangeSelectorActions: DateRangeSelectorActions) {\r\n        super([dateRangeSelectorActions.namespace], []);\r\n    }\r\n\r\n    // Helper method to check if the start date is before the end range.\r\n    // If either date is null or undefined, then this will return true.\r\n    private static isStartBeforeEnd(startDate: Date, endDate: Date): boolean {\r\n        return !(!!startDate && !!endDate && (endDate.getTime() < startDate.getTime()));\r\n    }\r\n\r\n    /**\r\n     * @method\r\n     * @param state {IDateRangeSelectorState} The state to reduce\r\n     * @param actionPayload {IActionPayload} The payload to apply\r\n     * @returns {IDateRangeSelectorState} The new state.\r\n     */\r\n    public reduce(state: IDateRangeSelectorState, actionPayload: IActionPayload): IDateRangeSelectorState {\r\n        if (!state) {\r\n            throw \"The state parameter is required.\";\r\n        }\r\n\r\n        if (!actionPayload) {\r\n            throw \"The actionPayload parameter is required.\";\r\n        }\r\n\r\n        let newState = clone(state);\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.dateRangeSelectorActions.DateRangeBoundaryChanged, (whichEndOfRange: DateRangeBoundaryIdentifier, newDate: Date) => {\r\n                if (whichEndOfRange === DateRangeBoundaryIdentifier.startOfRange) {\r\n                    newState.startDate = newDate;\r\n                    // Adjust the end date if it is not after the new start date\r\n                    if (!DateRangeSelectorReduction.isStartBeforeEnd(newState.startDate, newState.endDate)) {\r\n                        newState.endDate = newState.startDate;\r\n                        }\r\n                } else {\r\n                    newState.endDate = newDate;\r\n                    // Adjust the start date if it does not precede the new end date\r\n                    if (!DateRangeSelectorReduction.isStartBeforeEnd(newState.startDate, newState.endDate)) {\r\n                        newState.startDate = newState.endDate;\r\n                    }\r\n                }\r\n                return newState;\r\n            });\r\n\r\n        return newState;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\nimport { AreaOfPage, PageNames } from \"../../instrumentation/instrumentationConstants/InstrumentationConstants\";\r\nimport { DetermineModalLayout, GetImageDimensionToDetermineLayout, InitializeModalCarouselProps } from \"../search/modalNavigation/ModalNavigationHelper\";\r\n\r\nimport { CarouselDirection } from \"../../rendering/components/modalCarousel/CarouselDirection\";\r\nimport { GetImagePreviewElementProps } from \"./GetImagePreviewProps\";\r\nimport { GetSelectActionInput } from \"../../instrumentation/helpers/InstrumentationHelper\";\r\nimport { ICatalystFileDataMetadata } from \"clientcore-models-catalyst/ICatalystFileDataMetadata\";\r\nimport { IEntity } from \"cms-models/IEntity\";\r\nimport { IEntityListState } from \"cms-ui-presentationlogic/dataflows/entityList/IEntityListState\";\r\nimport { IEntityWithMetadata } from \"cms-businesslogic/entity/IEntityWithMetadata\";\r\nimport { IImageFileData } from \"cms-models/IImageFileData\";\r\nimport { IImagePreviewModalProps } from \"../../rendering/components/imagePreviewModal/IImagePreviewModalProps\";\r\nimport { IInstrumentationClient } from \"../../instrumentation/instrumentationClient/IInstrumentationClient\";\r\nimport { ILightboxManager } from \"../lightbox/ILightboxManager\";\r\nimport { IModalCarouselProps } from \"../../rendering/components/modalCarousel/IModalCarouselProps\";\r\nimport { ISearchAndSelectState } from \"../../presentation-logic/dataflows/searchAndSelect/ISearchAndSelectState\";\r\nimport { IStore } from \"redux\";\r\nimport { ImageCommandActions } from \"../../presentation-logic/dataflows/imageCommand/ImageCommandActions\";\r\nimport { ImagePreviewModal } from \"../../rendering/components/imagePreviewModal/ImagePreviewModal\";\r\nimport { ImagePreviewModalActions } from \"../../presentation-logic/dataflows/imagePreviewModal/ImagePreviewModalActions\";\r\nimport { KeyCode } from \"cms-ui-components/KeyCode\";\r\nimport { ModalCarousel } from \"../../rendering/components/modalCarousel/ModalCarousel\";\r\nimport { ModalProvisioningActions } from \"cms-ui-presentationlogic/dataflows/modalProvisioning/ModalProvisioningActions\";\r\nimport { PageActionData } from \"cms-businesslogic/instrumentation/PageActionData\";\r\nimport { ResultsDisplayModeEnum } from \"../../models/displayMode/ResultsDisplayModeEnum\";\r\nimport { merge } from \"lodash-es\";\r\n\r\n/**\r\n * The common code to create preview carousel and handle callbacks\r\n */\r\nclass ModalCarousalEventCallbacks {\r\n\r\n    /**\r\n     * Creates the modal crousel\r\n     * @param state {ILightboxPageState<IEntityListState> | ISearchAndSelectState<IEntityListState>} Lightbox page state or search and select page state\r\n     * @param store {IStore<any>} the current page context store\r\n     * @param pageName {PageNames} the current page where modal is invoked\r\n     * @param imagePreviewModalActions {ImagePreviewModalActions} the current context image preview modal actions\r\n     * @param modalProvisioningActions {ModalProvisioningActions} the current context modal provisioning actions\r\n     * @param imageCommandActions {ImageCommandActions} the current context imageCommand actions\r\n     * @param instrumentationClient {IInstrumentationClient} the instrumentation client\r\n     * @param filterPaneCollapsed {boolean} indicates if filter pane is open or closed\r\n     * @param resultsDisplayMode {ResultsDisplayModeEnum} result Display mode used to render the result\r\n     * @param downloadImage {(event: React.SyntheticEvent<any>) => void} the download callback\r\n     * @param isImageLinkGenerationInProgress {boolean} true indicates that image generation is in progress\r\n     * @param getImageLinkInvoked {(event: React.SyntheticEvent<any>) => void} Callback to handle generating image link\r\n     * @param correlationVector {string} correlation vector\r\n     */\r\n    public static createModalCarousel(\r\n        state: ISearchAndSelectState<IEntityListState>,\r\n        store: IStore<any>,\r\n        pageName: PageNames,\r\n        imagePreviewModalActions: ImagePreviewModalActions,\r\n        modalProvisioningActions: ModalProvisioningActions,\r\n        imageCommandActions: ImageCommandActions,\r\n        instrumentationClient: IInstrumentationClient,\r\n        filterPaneCollapsed: boolean,\r\n        resultsDisplayMode: ResultsDisplayModeEnum,\r\n        downloadImage: (event: React.SyntheticEvent<any>) => void,\r\n        getImageLinkInvoked: (event: React.SyntheticEvent<any>) => void,\r\n        correlationVector?: string,\r\n        getLightboxManager?: () => ILightboxManager,\r\n        addToLightboxOverlay?: React.ReactElement<any>\r\n    ): React.ReactElement<IModalCarouselProps> {\r\n\r\n        const selectedImageEntityWithMetadata = state.entityList.entitiesWithMetadata[state.selectedImageEntityIndex] as IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>>;\r\n        const selectedImageEntity = selectedImageEntityWithMetadata.entity;\r\n        const { width, height } = GetImageDimensionToDetermineLayout(selectedImageEntity);\r\n        const showDownloadingMessage: boolean = state.imageCommandState.imagesDownloading.indexOf(selectedImageEntity._id) >= 0;\r\n        const showFailedDownloadingMessage: boolean = !showDownloadingMessage && (state.imageCommandState.failedImages.indexOf(selectedImageEntity._id) >= 0);\r\n        const downloadEnabled = state.imageCommandState.imagesDownloading.indexOf(selectedImageEntity._id) < 0;\r\n\r\n        const imagePreviewElementProps: IImagePreviewModalProps = merge({ addToLightboxOverlay }, GetImagePreviewElementProps(\r\n            selectedImageEntityWithMetadata,\r\n            showDownloadingMessage,\r\n            showFailedDownloadingMessage,\r\n            !downloadEnabled, // download in progress\r\n            downloadEnabled,\r\n            DetermineModalLayout(width, height),\r\n            downloadImage,\r\n            false,\r\n            getImageLinkInvoked,\r\n            state.imageCommandState.lastDownloadError,\r\n            getLightboxManager,\r\n            null\r\n        ));\r\n\r\n        let modalCarouselProps: IModalCarouselProps = InitializeModalCarouselProps(width, height);\r\n\r\n        modalCarouselProps = merge(modalCarouselProps, {\r\n            onHide: () => {\r\n                imageCommandActions.ImagePreviewLinkGenerationStatusReset.getActionSender(store)();\r\n                modalProvisioningActions.HideModal.getActionSender(store)();\r\n            },\r\n            onSelect: (_eventKey: React.MouseEvent<{}>, carouselEvent?: React.SyntheticEvent<{}>) => {\r\n                if ((<any>carouselEvent).direction === CarouselDirection.Next) {\r\n                    this.onPreviewButtonNext(\r\n                        carouselEvent.nativeEvent,\r\n                        state.entityList.entitiesWithMetadata,\r\n                        state.selectedImageEntityIndex,\r\n                        imagePreviewModalActions,\r\n                        imageCommandActions,\r\n                        pageName,\r\n                        store,\r\n                        instrumentationClient,\r\n                        filterPaneCollapsed,\r\n                        resultsDisplayMode,\r\n                        correlationVector\r\n                    );\r\n                } else if ((<any>carouselEvent).direction === CarouselDirection.Previous) {\r\n                    this.onPreviewButtonPrev(\r\n                        carouselEvent.nativeEvent,\r\n                        state.entityList.entitiesWithMetadata,\r\n                        state.selectedImageEntityIndex,\r\n                        imagePreviewModalActions,\r\n                        imageCommandActions,\r\n                        pageName,\r\n                        store,\r\n                        instrumentationClient,\r\n                        filterPaneCollapsed,\r\n                        resultsDisplayMode,\r\n                        correlationVector);\r\n                }\r\n            },\r\n            onKeyPressed: (eventArgs: React.KeyboardEvent<any>) => {\r\n                switch (eventArgs.keyCode) {\r\n                    case KeyCode.LEFT_ARROW:\r\n                        eventArgs.preventDefault();\r\n                        this.onPreviewButtonPrev(\r\n                            eventArgs.nativeEvent,\r\n                            state.entityList.entitiesWithMetadata,\r\n                            state.selectedImageEntityIndex,\r\n                            imagePreviewModalActions,\r\n                            imageCommandActions,\r\n                            pageName,\r\n                            store,\r\n                            instrumentationClient,\r\n                            filterPaneCollapsed,\r\n                            resultsDisplayMode,\r\n                            correlationVector);\r\n                        break;\r\n                    case KeyCode.RIGHT_ARROW:\r\n                        eventArgs.preventDefault();\r\n                        this.onPreviewButtonNext(\r\n                            eventArgs.nativeEvent,\r\n                            state.entityList.entitiesWithMetadata,\r\n                            state.selectedImageEntityIndex,\r\n                            imagePreviewModalActions,\r\n                            imageCommandActions,\r\n                            pageName,\r\n                            store,\r\n                            instrumentationClient,\r\n                            filterPaneCollapsed,\r\n                            resultsDisplayMode,\r\n                            correlationVector);\r\n                        break;\r\n                    default:\r\n                        break;\r\n                }\r\n            }\r\n        });\r\n\r\n        return React.createElement(ModalCarousel, modalCarouselProps, React.createElement(ImagePreviewModal, imagePreviewElementProps));\r\n    }\r\n\r\n    /**\r\n     * the preview button prev function\r\n     * @param event {Event} the click event\r\n     * @param entitiesList {IEntityWithMetadata<IEntity>[]} the entity list in the carousel\r\n     * @param selectedImageEntityIndex {number} selected image index\r\n     * @param imagePreviewModalActions {ImagePreviewModalActions} the current context image preview modal actions\r\n     * @param imageCommandActions {ImageCommandActions} the current context imageCommand actions\r\n     * @param pageName {Pagenames} the current page name\r\n     * @param store {IStore<any>} the current store\r\n     * @param instrumentationClient {IInstrumentationClient} the instrumentation client\r\n     * @param filterPaneVisibleState {boolean} indicates if filter pane is open or closed\r\n     * @param resultsDisplayMode {ResultsDisplayModeEnum} result Display mode used to render the result\r\n     * @param correlationVector {string} correlation vector\r\n     */\r\n    public static onPreviewButtonPrev(\r\n        event: Event,\r\n        entitiesList: IEntityWithMetadata<IEntity>[],\r\n        selectedImageEntityIndex: number,\r\n        imagePreviewModalActions: ImagePreviewModalActions,\r\n        imageCommandActions: ImageCommandActions,\r\n        pageName: PageNames,\r\n        store: IStore<any>,\r\n        instrumentationClient: IInstrumentationClient,\r\n        filterPaneVisibleState: boolean,\r\n        resultsDisplayMode: ResultsDisplayModeEnum,\r\n        correlationVector?: string\r\n    ): void {\r\n        const nextSelectedIndex = selectedImageEntityIndex === 0 ? entitiesList.length - 1 : selectedImageEntityIndex - 1;\r\n        const ewm = entitiesList[nextSelectedIndex] as IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>>;\r\n        instrumentationClient.UserActivityTrackingService.logPageActionEvent(\r\n            instrumentationClient.createEventData(event, \"ImagePreview\", null, \"imagePreview-Prev\", AreaOfPage.ImagePreviewModal),\r\n            pageName,\r\n            correlationVector,\r\n            PageActionData.createFrom(null, GetSelectActionInput(ewm, nextSelectedIndex, filterPaneVisibleState, resultsDisplayMode), null, null, null, null, pageName));\r\n\r\n        if (!!entitiesList[nextSelectedIndex].entity) {\r\n            imageCommandActions.ImagePreviewLinkGenerationStatusReset.getActionSender(store)();\r\n            imagePreviewModalActions.ImagePreviewModalFetchEnd.getActionSender(store)(nextSelectedIndex);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * the preview button next function\r\n     * @param event {Event} the click event\r\n     * @param entitiesList {IEntityWithMetadata<IEntity>[]} the entity list in the carousel\r\n     * @param selectedImageEntityIndex {number} selected image index\r\n     * @param imagePreviewModalActions {ImagePreviewModalActions} the current context image preview modal actions\r\n     * @param imageCommandActions {ImageCommandActions} the current context imageCommand actions\r\n     * @param pageName {Pagenames} the current page name\r\n     * @param store {IStore<any>} the current store\r\n     * @param instrumentationClient {IInstrumentationClient} the instrumentation client\r\n     * @param filterPaneVisibleState {boolean} indicates if filter pane is open or closed\r\n     * @param resultsDisplayMode {ResultsDisplayModeEnum} result Display mode used to render the result\r\n     * @param correlationVector {string} correlation vector\r\n     */\r\n    public static onPreviewButtonNext(\r\n        event: Event,\r\n        entitiesList: IEntityWithMetadata<IEntity>[],\r\n        selectedImageEntityIndex: number,\r\n        imagePreviewModalActions: ImagePreviewModalActions,\r\n        imageCommandActions: ImageCommandActions,\r\n        pageName: PageNames,\r\n        store: IStore<any>,\r\n        instrumentationClient: IInstrumentationClient,\r\n        filterPaneVisibleState: boolean,\r\n        resultsDisplayMode: ResultsDisplayModeEnum,\r\n        correlationVector?: string\r\n    ): void {\r\n        const nextSelectedIndex = selectedImageEntityIndex === entitiesList.length - 1 ? 0 : selectedImageEntityIndex + 1;\r\n        const ewm = entitiesList[nextSelectedIndex] as IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>>;\r\n        instrumentationClient.UserActivityTrackingService.logPageActionEvent(\r\n            instrumentationClient.createEventData(event, \"ImagePreview\", null, \"imagePreview-Next\", AreaOfPage.ImagePreviewModal),\r\n            pageName,\r\n            correlationVector,\r\n            PageActionData.createFrom(null, GetSelectActionInput(ewm, nextSelectedIndex, filterPaneVisibleState, resultsDisplayMode), null, null, null, null, pageName));\r\n\r\n        if (!!entitiesList[nextSelectedIndex].entity) {\r\n            imageCommandActions.ImagePreviewLinkGenerationStatusReset.getActionSender(store)();\r\n            imagePreviewModalActions.ImagePreviewModalFetchEnd.getActionSender(store)(nextSelectedIndex);\r\n        }\r\n    }\r\n}\r\n\r\nexport { ModalCarousalEventCallbacks };","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { ActionMap } from \"cms-ui-redux/ActionMap\";\r\nimport { NamespacePrefixActionsDefinitionBase } from \"cms-ui-redux/NamespacePrefixActionsDefinitionBase\";\r\n\r\nimport { ResultsDisplayModeEnum } from \"../../../models/displayMode/ResultsDisplayModeEnum\";\r\n\r\nexport type ResetFilterSignature = () => void;\r\nexport type SetResultsDisplayModeSignature = (resultsDisplayMode: ResultsDisplayModeEnum) => void;\r\n\r\n/**\r\n * Exposes a redux action to raise reset filter.\r\n * @class\r\n */\r\nexport class SearchAndSelectActions extends NamespacePrefixActionsDefinitionBase {\r\n\r\n    /** Defines the action indicating that the filters have reset.\r\n     */\r\n    private resetfilter: ActionMap<ResetFilterSignature> = new ActionMap<ResetFilterSignature>(this.namespace + \"Resetfilter\");\r\n\r\n    /** Defines the action indicating that the format in which the results should be viewed has changed.\r\n     */\r\n    private setResultsDisplayMode: ActionMap<SetResultsDisplayModeSignature> = new ActionMap<SetResultsDisplayModeSignature>(this.namespace + \"SetResultsDisplayMode\");\r\n\r\n    /**\r\n     * Initializes a new instance of the 'SearchAndSelectActions' class.\r\n     * @constructor\r\n     * @param namespacePrefix {string} Optional prefix to add to the namespace used to distinguish between different instances of this data flow.\r\n     */\r\n    constructor(namespacePrefix?: string) {\r\n        super(\"SearchAndSelect\", namespacePrefix);\r\n    }\r\n\r\n    /** Accessor for the SelectionChanged action.\r\n     * @type {ActionMap<ResetFilterSignature>}\r\n     */\r\n    public get ResetFilter(): ActionMap<ResetFilterSignature> {\r\n        return this.resetfilter;\r\n    }\r\n\r\n    /** Accessor for the SetResultsDisplayMode action.\r\n     * @type {ActionMap<SetResultsDisplayModeSignature>}\r\n     */\r\n    public get SetResultsDisplayMode(): ActionMap<SetResultsDisplayModeSignature> {\r\n        return this.setResultsDisplayMode;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { ActionHandler } from \"cms-ui-redux/ActionHandler\";\r\nimport { Actions } from \"../../../globals/actions\";\r\nimport { CatalystSearchReduction } from \"../catalystSearch/CatalystSearchReduction\";\r\nimport { CollapsibleActions } from \"cms-ui-presentationlogic/dataflows/collapsible/CollapsibleActions\";\r\nimport { DateRange } from \"./DateRange\";\r\nimport { DateRangeSelectorReduction } from \"../dateRangeSelector/DateRangeSelectorReduction\";\r\nimport { EntitySearchActions } from \"cms-ui-presentationlogic/dataflows/entitySearch/EntitySearchActions\";\r\nimport { IActionPayload } from \"cms-ui-redux/IActionPayload\";\r\nimport { IDateRangeSelectorState } from \"../dateRangeSelector/IDateRangeSelectorState\";\r\nimport { IEntityListState } from \"cms-ui-presentationlogic/dataflows/entityList/IEntityListState\";\r\nimport { IPagingState } from \"cms-ui-presentationlogic/dataflows/paging/IPagingState\";\r\nimport { IReducer } from \"cms-ui-redux/IReducer\";\r\nimport { IRichNotification } from \"cms-ui-components/richNotification/IRichNotification\";\r\nimport { ISearchAndSelectState } from \"./ISearchAndSelectState\";\r\nimport { ISearchWithAutosuggestState } from \"../searchWithAutosuggest/ISearchWithAutosuggestState\";\r\nimport { ImageCommandReduction } from \"../imageCommand/ImageCommandReduction\";\r\nimport { ImagePreviewModalActions } from \"../imagePreviewModal/ImagePreviewModalActions\";\r\nimport { ListEntitySelectorReduction } from \"cms-ui-presentationlogic/dataflows/listEntitySelector/ListEntitySelectorReduction\";\r\nimport { ListItemSelectorActions } from \"../listItemSelector/ListItemSelectorActions\";\r\nimport { ModalProvisioningReduction } from \"cms-ui-presentationlogic/dataflows/modalProvisioning/ModalProvisioningReduction\";\r\nimport { NamespaceCheckReducerBase } from \"cms-ui-redux/NamespaceCheckReducerBase\";\r\nimport { ResultsDisplayModeEnum } from \"../../../models/displayMode/ResultsDisplayModeEnum\";\r\nimport { SearchAndSelectActions } from \"./SearchAndSelectActions\";\r\nimport { SearchWithAutosuggestActions } from \"../searchWithAutosuggest/SearchWithAutosuggestActions\";\r\nimport { clone } from \"lodash-es\";\r\n\r\n/**\r\n * Contains reducer for the SearchAndSelect experience.\r\n * @class\r\n */\r\nexport class SearchAndSelectReduction extends NamespaceCheckReducerBase<ISearchAndSelectState<IEntityListState>> {\r\n\r\n    /**\r\n     * Initializes a new instance of the `SearchAndSelectReduction` class.\r\n     * @param entitySearchActions {EntitySearchActions} The actions that this reducer handles.\r\n     * @param providerListSelectorActions {ListItemSelectorActions} The actions that this reducer handles for the list of image providers.\r\n     * @param editorialPickListItemSelectorActions {ListItemSelectorActions} The actions that this reducer handles for the editorial Pick filters.\r\n     * @param orientationListSelectorActions {ListItemSelectorActions} The actions that this reducer handles for the list of image orientations.\r\n     * @param headShotsListSelectorActions {ListItemSelectorActions} The actions that this reducer handles for the Head Shots selected state.\r\n     * @param collectionListSelectorActions {ListItemSelectorActions} The actions that this reducer handles for the list of collections.\r\n     * @param peopleFiltersListSelectorActions {ListItemSelectorActions} The actions that this reducer handles for the people filter option list.\r\n     * @param dateRangeOptionsListSelectorActions {ListItemSelectorActions} The actions that this reducer handles for the list of date range options.\r\n     * @param sortOrderOptionsListSelectorActions {ListItemSelectorActions} The actions that this reducer handles for the list of sort order options.\r\n     * @param searchAndSelectActions {SearchAndSelectActions} The actions that this reducer handles for the SearchAndSelect Providers.\r\n     * @param dateRangeSelectorReduction {DateRangeSelectorReduction} reducer for custom date range state.\r\n     * @param entitySelectorReduction {ListEntitySelectorReduction<IEntityListState>} reducer for the selection state\r\n     * @param imagePreviewModalActions {ImagePreviewModalActions} image preview modal actions\r\n     * @param modalProvisioningReduction {ModalProvisioningReduction} modal provisioning reducer\r\n     * @param catalystSearchReduction {CatalystSearchReduction} The catalystSearch reducer\r\n     * @param pagedImagesReduction {IReducer<IPagingState>} The reducer that mutates the state associated with the paging.\r\n     * @param searchWithAutosuggestActions: {SearchWithAutosuggestActions} The search with autosuggest actions\r\n     * @param searchWithAutosuggestReduction: {IReducer<ISearchWithAutosuggestState>} The search with autosuggest reducer\r\n     * @param imageCommandReduction: {ImageCommandReduction} Reducer for image command (e.g. downloadImage) actions\r\n     * @constructor\r\n     */\r\n    constructor(\r\n        public entitySearchActions: EntitySearchActions,\r\n        public collapsibleActions: CollapsibleActions,\r\n        public providerListSelectorActions: ListItemSelectorActions<number>,\r\n        public editorialPickListItemSelectorActions: ListItemSelectorActions<number>,\r\n        public orientationListSelectorActions: ListItemSelectorActions<number>,\r\n        public headShotsListSelectorActions: ListItemSelectorActions<number>,\r\n        public collectionListSelectorActions: ListItemSelectorActions<number>,\r\n        public peopleFiltersListSelectorActions: ListItemSelectorActions<number>,\r\n        public dateRangeOptionsListSelectorActions: ListItemSelectorActions<number>,\r\n        public sortOrderOptionsListSelectorActions: ListItemSelectorActions<number>,\r\n        public searchAndSelectActions: SearchAndSelectActions,\r\n        public dateRangeSelectorReduction: DateRangeSelectorReduction,\r\n        public entitySelectorReduction: ListEntitySelectorReduction<IEntityListState>,\r\n        public imagePreviewModalActions: ImagePreviewModalActions,\r\n        public modalProvisioningReduction: ModalProvisioningReduction,\r\n        public catalystSearchReduction: CatalystSearchReduction,\r\n        public pagedImagesReduction: IReducer<IPagingState>,\r\n        public searchWithAutosuggestActions: SearchWithAutosuggestActions,\r\n        public searchWithAutosuggestReduction: IReducer<ISearchWithAutosuggestState>,\r\n        public imageCommandReduction: ImageCommandReduction\r\n    ) {\r\n        super(\r\n            [entitySearchActions.namespace,\r\n            collapsibleActions.namespace,\r\n            providerListSelectorActions.namespace,\r\n            editorialPickListItemSelectorActions.namespace,\r\n            orientationListSelectorActions.namespace,\r\n            headShotsListSelectorActions.namespace,\r\n            collectionListSelectorActions.namespace,\r\n            peopleFiltersListSelectorActions.namespace,\r\n            dateRangeOptionsListSelectorActions.namespace,\r\n            sortOrderOptionsListSelectorActions.namespace,\r\n            imagePreviewModalActions.namespace,\r\n            searchAndSelectActions.namespace,\r\n            searchWithAutosuggestActions.namespace,\r\n            Actions.SearchAndSelect.InlineError.namespace,\r\n            Actions.SearchAndSelect.SearchResultsScrollPositionActions.namespace],\r\n            [dateRangeSelectorReduction,\r\n                entitySelectorReduction,\r\n                modalProvisioningReduction,\r\n                catalystSearchReduction,\r\n                pagedImagesReduction,\r\n                searchWithAutosuggestReduction,\r\n                imageCommandReduction]);\r\n\r\n        if (!entitySearchActions) {\r\n            throw \"The entitySearchActions parameter is required.\";\r\n        }\r\n\r\n        if (!collapsibleActions) {\r\n            throw \"The collapsibleActions parameter is required.\";\r\n        }\r\n\r\n        if (!providerListSelectorActions) {\r\n            throw \"The providerListSelectorActions parameter is required.\";\r\n        }\r\n\r\n        if (!editorialPickListItemSelectorActions) {\r\n            throw \"The editorialPickListItemSelectorActions parameter is required.\";\r\n        }\r\n\r\n        if (!orientationListSelectorActions) {\r\n            throw \"The orientationListSelectorActions parameter is required.\";\r\n        }\r\n\r\n        if (!headShotsListSelectorActions) {\r\n            throw \"The headShotsListSelectorActions parameter is required.\";\r\n        }\r\n\r\n        if (!collectionListSelectorActions) {\r\n            throw \"The collectionListSelectorActions parameter is required.\";\r\n        }\r\n\r\n        if (!peopleFiltersListSelectorActions) {\r\n            throw \"The peopleFiltersListSelectorActions parameter is required.\";\r\n        }\r\n\r\n        if (!dateRangeOptionsListSelectorActions) {\r\n            throw \"The dateRangeOptionsListSelectorActions parameter is required.\";\r\n        }\r\n\r\n        if (!sortOrderOptionsListSelectorActions) {\r\n            throw \"The sortOrderOptionsListSelectorActions parameter is required.\";\r\n        }\r\n\r\n        if (!searchAndSelectActions) {\r\n            throw \"The searchAndSelectActions parameter is required.\";\r\n        }\r\n\r\n        if (!dateRangeSelectorReduction) {\r\n            throw \"The dateRangeSelectorReduction parameter is required.\";\r\n        }\r\n\r\n        if (!imagePreviewModalActions) {\r\n            throw \"The imagePreviewModalAction parameter is required.\";\r\n        }\r\n\r\n        if (!entitySelectorReduction) {\r\n            throw \"The entitySelectorReduction parameter is required.\";\r\n        }\r\n\r\n        if (!modalProvisioningReduction) {\r\n            throw \"The modalProvisioningReduction parameter is required.\";\r\n        }\r\n\r\n        if (!pagedImagesReduction) {\r\n            throw \"The pagedImagesReduction parameter is required.\";\r\n        }\r\n\r\n        if (!catalystSearchReduction) {\r\n            throw \"The catalystSearchReduction parameter is required.\";\r\n        }\r\n\r\n        if (!searchWithAutosuggestActions) {\r\n            throw \"The searchWithAutosuggestActions parameter is required.\";\r\n        }\r\n\r\n        if (!searchWithAutosuggestReduction) {\r\n            throw \"The searchWithAutosuggestReduction parameter is required.\";\r\n        }\r\n\r\n        if (!imageCommandReduction) {\r\n            throw \"The imageCommandReduction parameter is required.\";\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Mutates the given state with the given action.\r\n     * @function\r\n     * @param state {ISearchAndSelectState<IEntityListState>} The state that the reducer should mutate.\r\n     * @param actionPayload {IActionPayload} The action detail to update the state with.\r\n     * @returns {ISearchAndSelectState<IEntityListState>} The mutated state.\r\n     */\r\n    public reduce(state: ISearchAndSelectState<IEntityListState>, actionPayload: IActionPayload): ISearchAndSelectState<IEntityListState> {\r\n\r\n        if (!state) {\r\n            throw \"The state parameter is required.\";\r\n        }\r\n\r\n        if (!actionPayload) {\r\n            throw \"The actionPayload parameter is required.\";\r\n        }\r\n\r\n        let newState = clone(state);\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.searchAndSelectActions.ResetFilter, () => {\r\n                newState.selectedTopEditorialImageOption = clone(state.selectedTopEditorialImageOption);\r\n                newState.selectedTopEditorialImageOption.selectedItems = [];\r\n                newState.selectedProviders = clone(state.selectedProviders);\r\n                newState.selectedProviders.selectedItems = [];\r\n                newState.selectedOrientations = clone(state.selectedOrientations);\r\n                newState.selectedOrientations.selectedItems = [];\r\n                newState.headShotsSelectionState = clone(state.headShotsSelectionState);\r\n                newState.headShotsSelectionState.selectedItems = [];\r\n                newState.selectedCollections = clone(state.selectedCollections);\r\n                newState.selectedCollections.selectedItems = [];\r\n\r\n                newState.selectedDateRangeOption = clone(state.selectedDateRangeOption);\r\n                newState.selectedDateRangeOption.selectedItems = [0];\r\n\r\n                let dateRange = DateRange.FromDateAndHours(new Date(), -24);\r\n                newState.customDateRange = {\r\n                    startDate: dateRange.From,\r\n                    endDate: dateRange.To\r\n                };\r\n\r\n                newState.selectedSortOrder = clone(state.selectedSortOrder);\r\n                newState.selectedSortOrder.selectedItems = [0];\r\n\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.searchAndSelectActions.SetResultsDisplayMode, (resultsDisplayMode: ResultsDisplayModeEnum) => {\r\n                newState.resultsDisplayMode = resultsDisplayMode;\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, Actions.SearchAndSelect.SearchResultsScrollPositionActions.SaveScrollPosition, (scrollTop: number) => {\r\n                newState.scrollTop = scrollTop;\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.collapsibleActions.ToggleCollapsible, () => {\r\n                newState.filterOptionVisibleState = clone(state.filterOptionVisibleState);\r\n                newState.filterOptionVisibleState.collapsed = !newState.filterOptionVisibleState.collapsed;\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.providerListSelectorActions.SelectionChanged, (selectedItems: number[]) => {\r\n                newState.selectedProviders = {\r\n                    ...state.selectedProviders,\r\n                    selectedItems: [].concat(selectedItems)\r\n                };\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.editorialPickListItemSelectorActions.SelectionChanged, (selectedItems: number[]) => {\r\n                newState.selectedTopEditorialImageOption = {\r\n                    ...state.selectedTopEditorialImageOption,\r\n                    selectedItems: [].concat(selectedItems)\r\n                };\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.orientationListSelectorActions.SelectionChanged, (selectedItems: number[]) => {\r\n                newState.selectedOrientations = {\r\n                    ...state.selectedOrientations,\r\n                    selectedItems: [].concat(selectedItems)\r\n                };\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.headShotsListSelectorActions.SelectionChanged, (selectedItems: number[]) => {\r\n                newState.headShotsSelectionState = {\r\n                    ...state.headShotsSelectionState,\r\n                    selectedItems: [].concat(selectedItems)\r\n                };\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.collectionListSelectorActions.SelectionChanged, (selectedItems: number[]) => {\r\n                newState.selectedCollections = {\r\n                    ...state.selectedCollections,\r\n                    selectedItems: [].concat(selectedItems)\r\n                };\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.peopleFiltersListSelectorActions.SelectionChanged, (selectedItems: number[]) => {\r\n                newState.selectedPeopleFilters = {\r\n                    ...state.selectedPeopleFilters,\r\n                    selectedItems: [].concat(selectedItems)\r\n                };\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.dateRangeOptionsListSelectorActions.SelectionChanged, (selectedItems: number[]) => {\r\n                newState.selectedDateRangeOption = {\r\n                    ...state.selectedDateRangeOption,\r\n                    selectedItems: [].concat(selectedItems)\r\n                };\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.sortOrderOptionsListSelectorActions.SelectionChanged, (selectedItems: number[]) => {\r\n                newState.selectedSortOrder = {\r\n                    ...state.selectedSortOrder,\r\n                    selectedItems: [].concat(selectedItems)\r\n                };\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.imagePreviewModalActions.ImagePreviewModalFetchEnd, (index: number) => {\r\n                newState.selectedImageEntityIndex = index;\r\n                return newState;\r\n            }\r\n        );\r\n\r\n        ActionHandler.handleAction(actionPayload, Actions.SearchAndSelect.InlineError.SetApplicationError, (serviceError: IRichNotification) => {\r\n            newState.serviceError = serviceError;\r\n        });\r\n\r\n        ActionHandler.handleAction(actionPayload, Actions.SearchAndSelect.InlineError.ClearApplicationError, () => {\r\n            newState.serviceError = null;\r\n        });\r\n\r\n        if (this.dateRangeSelectorReduction.canReduce(actionPayload)) {\r\n            let stateToReduce: IDateRangeSelectorState = !!newState.customDateRange ? newState.customDateRange : {};\r\n            newState.customDateRange = this.dateRangeSelectorReduction.reduce(stateToReduce, actionPayload);\r\n        }\r\n\r\n        if (this.entitySelectorReduction.canReduce(actionPayload)) {\r\n            // The entitySelectorReduction reduces both the entityList and the entitySelector substates,\r\n            // so assign both of these into newState are the reducer is called.\r\n            let listAndSelectorState = this.entitySelectorReduction.reduce(newState, actionPayload);\r\n            newState.entityList = listAndSelectorState.entityList;\r\n            newState.entitySelector = listAndSelectorState.entitySelector;\r\n        }\r\n\r\n        if (this.catalystSearchReduction.canReduce(actionPayload)) {\r\n            newState.entitySearchState = this.catalystSearchReduction.reduce(newState.entitySearchState, actionPayload);\r\n        }\r\n\r\n        if (this.pagedImagesReduction.canReduce(actionPayload)) {\r\n            newState.pagedImagesState = this.pagedImagesReduction.reduce(newState.pagedImagesState, actionPayload);\r\n        }\r\n\r\n        if (this.searchWithAutosuggestReduction.canReduce(actionPayload)) {\r\n            newState.searchWithAutosuggestState = this.searchWithAutosuggestReduction.reduce(newState.searchWithAutosuggestState, actionPayload);\r\n        }\r\n\r\n        if (this.imageCommandReduction.canReduce(actionPayload)) {\r\n            newState.imageCommandState = this.imageCommandReduction.reduce(newState.imageCommandState, actionPayload);\r\n        }\r\n\r\n        if (this.modalProvisioningReduction.canReduce(actionPayload)) {\r\n            newState.modalProvisioningState = this.modalProvisioningReduction.reduce(newState.modalProvisioningState, actionPayload);\r\n            return newState;\r\n        }\r\n\r\n        return newState;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { AppConstants } from \"../../../AppConstants\";\r\nimport { ISearchValidationRule } from \"./ISearchValidationRule\";\r\nimport { NotificationType } from \"cms-ui-presentationlogic/dataflows/notifications/NotificationType\";\r\nimport { isString } from \"lodash-es\";\r\n\r\n// This rule returns true if the search text starts with a single quote, false otherwise.\r\nconst startsWithSingleQuote: ISearchValidationRule = {\r\n    testCondition: (text) =>\r\n        isString(text) &&\r\n        text.length > 0 &&\r\n        text[0] === \"'\",\r\n\r\n    searchHint: {\r\n        quickHint: \"Use double quotes to specify an exact string.\",\r\n        fullHint: \"Single quotes should only be used for apostrophes. To specify a phrase or string, please surround it with double quotes. More information and examples are available in Help.\",\r\n        hintServerity: NotificationType.Info\r\n    }\r\n};\r\n\r\n/**\r\n * This rule checks if the search term contains special characters.\r\n * Produces error type notification if special char detected.\r\n * At the moment, CMS query/querypre don't handle queries with the specified special chars and returns error. We want to block search from happening in these cases.\r\n */\r\nconst containsSpecialChar: ISearchValidationRule = {\r\n    testCondition: (text: string) => {\r\n        let matchResult = text.match(AppConstants.disallowedSearchChars);\r\n        return !!matchResult && matchResult.length > 0;\r\n    },\r\n    searchHint: {\r\n        quickHint: \"You are using a character which is not currently supported.\",\r\n        fullHint: \"The following list of characters are not allowed in the search string:  !  ^  (  )  [  ]  {  }  \\  /  ?  ~\",\r\n        hintServerity: NotificationType.Error\r\n    }\r\n};\r\n\r\nexport {\r\n    startsWithSingleQuote,\r\n    containsSpecialChar\r\n};","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { AreaOfPage, PageNames } from \"../../instrumentation/instrumentationConstants/InstrumentationConstants\";\r\nimport { containsSpecialChar, startsWithSingleQuote } from \"./validation/Rules\";\r\nimport { isNil, merge } from \"lodash-es\";\r\n\r\nimport { Actions } from \"../../globals/actions\";\r\nimport { ComponentBootstrapper } from \"cms-ui-views/ComponentBootstrapper\";\r\nimport { EntitySearchActions } from \"cms-ui-presentationlogic/dataflows/entitySearch/EntitySearchActions\";\r\nimport { ICatalystSearchManager } from \"../catalystSearch/ICatalystSearchManager\";\r\nimport { IInstrumentationClient } from \"../../instrumentation/instrumentationClient/IInstrumentationClient\";\r\nimport { IOrderByItem } from \"cms-businesslogic/search/orderby/IOrderByItem\";\r\nimport { ISearchWithAutosuggestProps } from \"../../rendering/components/searchWithAutoSuggest/ISearchWithAutosuggestProps\";\r\nimport { ISearchWithAutosuggestState } from \"../../presentation-logic/dataflows/searchWithAutoSuggest/ISearchWithAutosuggestState\";\r\nimport { NotificationListActions } from \"cms-ui-presentationlogic/dataflows/notifications/NotificationListActions\";\r\nimport { OneSrvBusinessLogicFactory } from \"clientcore-onesrv-businesslogic/factory/OneSrvBusinessLogicFactory\";\r\nimport { Predicate } from \"cms-businesslogic/search/filter/Predicate\";\r\nimport { PromiseExtension } from \"cms-infrastructure/promise-extension/PromiseExtension\";\r\nimport { ReduxBootstrapper } from \"cms-ui-views/ReduxBootstrapper\";\r\nimport { SearchBootstrapperBase } from \"./SearchBootstrapperBase\";\r\nimport { SearchQueryMatchCriteria } from \"cms-businesslogic/search/query/SearchQueryMatchCriteria\";\r\nimport { SearchWithAutosuggestActions } from \"../../presentation-logic/dataflows/searchWithAutosuggest/SearchWithAutosuggestActions\";\r\nimport { serviceErrorParsers } from \"../../globals/CatalystServiceErrorParser\";\r\n\r\n/**\r\n * The bootstrapper that manages searches in Catalyst.\r\n * @class\r\n */\r\nexport class SearchBootstrapper<TParentState> extends SearchBootstrapperBase<TParentState> {\r\n\r\n    /**\r\n     * Initializes a new instance of the 'SearchBootstrapper' class.\r\n     * @constructor\r\n     * @param parentBootstrapperName {string} String used for telemetry purposes to keep track of the source of the search (search and select).\r\n     * @param getSearchText {() => string} A function that returns the current search text.\r\n     * @param buildFilter {() => Predicate} A function that returns the filters to apply to the search.\r\n     * @param buildSortOrder {() => IOrderByItem[]} A function that returns the sorting clauses to apply to the search.\r\n     * @param buildQueryText {() => string} A function that returns the query text. This is a combination of the search text and any filters that may get applied as part of the query text\r\n     * @param getSearchMatchCriteria {() => SearchQueryMatchCriteria} A function that returns the search match criteria.\r\n     * @param pageName {PageNames} Identifier of the page that triggered the search.\r\n     * @param getActionInput {() => { [key: string]: string; }} Function that returns the action input used for telemetry purposes.\r\n     * @param oneServiceBusinessLogicFactory {OneSrvBusinessLogicFactory} The one service business logic factory.\r\n     * @param instrumentationClient {IInstrumentationClient} Provides support for instrumentation.\r\n     * @param catalystSearchManager {ICatalystSearchManager} The CatalystSearch Manager.\r\n     * @param actionNamespacePrefix {string} Optional prefix to add to the namespace used to distinguish actions created by this bootstrapper.\r\n     * @param stateSelector {function} A function that selects the state for this bootstrapper from the parent state.\r\n     * @param parentBootstrapper {ComponentBootstrapper<TParentState, any, any>} The bootsrapper that contains this bootstrapper.\r\n     */\r\n    constructor(\r\n        parentBoostrapperName: string,\r\n        getSearchText: () => string,\r\n        private buildFilter: () => Predicate,\r\n        private buildSortOrder: () => IOrderByItem[],\r\n        private buildQueryText: () => string,\r\n        private getSearchMatchCriteria: () => SearchQueryMatchCriteria,\r\n        pageName: PageNames,\r\n        private getActionInput: () => { [key: string]: string; },\r\n        oneServiceBusinessLogicFactory: OneSrvBusinessLogicFactory,\r\n        instrumentationClient: IInstrumentationClient,\r\n        private catalystSearchManager: ICatalystSearchManager,\r\n        actionNamespacePrefix?: string,\r\n        stateSelector?: (parentState: TParentState) => ISearchWithAutosuggestState,\r\n        parentBootstrapper?: ComponentBootstrapper<TParentState, any, any> | ReduxBootstrapper<TParentState>) {\r\n\r\n        super(\r\n            parentBoostrapperName,\r\n            getSearchText,\r\n            pageName,\r\n            oneServiceBusinessLogicFactory,\r\n            instrumentationClient,\r\n            new EntitySearchActions(actionNamespacePrefix || \"\"),\r\n            new SearchWithAutosuggestActions(actionNamespacePrefix || \"\"),\r\n            new NotificationListActions(!isNil(actionNamespacePrefix)\r\n                ? actionNamespacePrefix + \"SearchHint\"\r\n                : \"SearchHint\"),\r\n            stateSelector,\r\n            parentBootstrapper);\r\n\r\n        this.validateSearchTextRules = [\r\n            startsWithSingleQuote,\r\n            containsSpecialChar\r\n        ];\r\n\r\n        this.onSearchInvoked = this.onSearchInvoked.bind(this);\r\n    }\r\n\r\n    /**\r\n     * Maps the search state to the props that power the SearchWithAutosuggest component.\r\n     * @method\r\n     * @param state {ISearchWithAutosuggestState} The redux state.\r\n     * @returns {ISearchWithAutosuggestProps} The mapped props.\r\n     */\r\n    public mapStateToProps(searchWithAutosuggestState: ISearchWithAutosuggestState): ISearchWithAutosuggestProps {\r\n        const props = merge({}, super.mapStateToProps(searchWithAutosuggestState), {\r\n            catalystSuggestions: !!searchWithAutosuggestState.catalystSuggestions ? searchWithAutosuggestState.catalystSuggestions : []\r\n        }) as ISearchWithAutosuggestProps;\r\n\r\n        return props;\r\n    }\r\n\r\n    /**\r\n     * Performs required job before the component is created.\r\n     * @method\r\n     */\r\n    public onBeforeComponentCreated(): void {\r\n        super.onBeforeComponentCreated();\r\n    }\r\n\r\n    /**\r\n     * Logic invoked when a Search is Executed.\r\n     * @param control {string} Identifier for the control that has instigated the search. Used as the element title in the event data when creating the telemetry.\r\n     * @param controlType {string} The type of the control that has instigated the search. This, combined with control, forms the elementId in the event data when creating the telemetry.\r\n     * @param event {Event} the event which triggered this handler\r\n     * @return {boolean} whether or not to reset pager.\r\n     * @method\r\n     */\r\n    public onSearchInvoked(control: string, controlType: string, event: React.SyntheticEvent<any>): boolean {\r\n        const searchText = this.getSearchText();\r\n\r\n        if (this.manageSearchHints(searchText)) {\r\n\r\n            this.entitySearchActions.ExecuteSearch.getActionSender(this.store)();\r\n            Actions.SearchAndSelect.InlineError.ClearApplicationError.getActionSender(this.store)();\r\n\r\n            // This is the root search activity, re-created each time there's a new search.\r\n            // All other actions, e.g. download, page navigation, that occur in the context of this search are tracked\r\n            // with the correlation vector from this activity.\r\n            const searchActivity = this.catalystSearchManager.endCurrentAndCreateNewSearchActivity();\r\n\r\n            // This activity is used to track the perf of the search execution.\r\n            const searchForFirstPageEntitiesActivity =\r\n                this.instrumentationClient.ActivityLoggingService.createActivity(`${this.parentBoostrapperName}.onSearchInvoked`, searchActivity);\r\n\r\n            this.instrumentationClient.UserActivityTrackingService.logPageActionEvent(\r\n                this.instrumentationClient.createEventData(event, control, null, control + \"-\" + controlType, AreaOfPage.searchAndSelectSearchBar),\r\n                PageNames.SearchAndSelect,\r\n                searchForFirstPageEntitiesActivity.correlationVector,\r\n                this.getPageActionData(this.getActionInput()));\r\n\r\n            const filterBy = this.buildFilter();\r\n            const orderBy = this.buildSortOrder();\r\n            const queryText = this.buildQueryText();\r\n            const searchMatchCriteria = this.getSearchMatchCriteria();\r\n\r\n            const executeSearchPromise = this.catalystSearchManager.executeSearchForFirstPageEntities(\r\n                this.store,\r\n                queryText,\r\n                orderBy,\r\n                filterBy,\r\n                searchMatchCriteria,\r\n                searchForFirstPageEntitiesActivity);\r\n\r\n            executeSearchPromise.catch((error) => {\r\n                this.instrumentationClient.LoggingService.error(`${this.parentBoostrapperName}.onSearchInvoked`, searchForFirstPageEntitiesActivity, error);\r\n\r\n                // display an inline error if there is a bad request error, raise an application level error otherwise.\r\n                let parsedServiceError = null;\r\n                if (serviceErrorParsers.badRequest.canParse(error)) {\r\n                    parsedServiceError = serviceErrorParsers.badRequest.parse(error);\r\n                    Actions.SearchAndSelect.InlineError.SetApplicationError.getActionSender(this.store)(parsedServiceError);\r\n                } else {\r\n                    Actions.ApplicationLevelError.SetApplicationError.getActionSender(this.store)(error);\r\n                }\r\n            });\r\n\r\n            PromiseExtension.onComplete(executeSearchPromise, () => {\r\n                this.entitySearchActions.SearchExecuted.getActionSender(this.store)();\r\n                this.instrumentationClient.ActivityLoggingService.endActivity(searchForFirstPageEntitiesActivity);\r\n            });\r\n\r\n            return true;\r\n        }\r\n\r\n        return false;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { Direction } from \"cms-businesslogic/search/orderby/Direction\";\r\n\r\nimport { ISortOrderOptionItem } from \"../../models/sortOrder/ISortOrderOptionItem\";\r\n\r\nconst sortOrderOptions: ISortOrderOptionItem[] = [\r\n    {\r\n        displayName: \"Best Match\"\r\n    },\r\n    {\r\n        displayName: \"Newest First\",\r\n        orderByItem: {\r\n            field: \"displayPublishedDateTime\",\r\n            direction: Direction.Desc\r\n        }\r\n    },\r\n    {\r\n        displayName: \"Oldest First\",\r\n        orderByItem: {\r\n            field: \"displayPublishedDateTime\",\r\n            direction: Direction.Asc\r\n        }\r\n    },\r\n    {\r\n        displayName: \"Recently Updated\",\r\n        orderByItem: {\r\n            field: \"_lastEditedDateTime\",\r\n            direction: Direction.Desc\r\n        }\r\n    }\r\n];\r\n\r\nexport { sortOrderOptions as SortOrderOptions };","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as Moment from \"moment\";\r\n\r\nimport { AddImageQualityQueryParamToUrl } from \"../addImageQualityParamToUrl\";\r\nimport { ICatalystFileDataMetadata } from \"clientcore-models-catalyst/ICatalystFileDataMetadata\";\r\nimport { IEntity } from \"cms-models/IEntity\";\r\nimport { IEntityWithMetadata } from \"cms-businesslogic/entity/IEntityWithMetadata\";\r\nimport { IImageFileData } from \"cms-models/IImageFileData\";\r\nimport { IImageTileProps } from \"../../rendering/components/imageTile/IImageTileProps\";\r\nimport { ResultsDisplayModeEnum } from \"../../models/displayMode/ResultsDisplayModeEnum\";\r\nimport { appConfig } from \"appConfig\";\r\nimport { curry } from \"lodash-es\";\r\n\r\n// when the app starts, the cache is initialized as an empty object.\r\n// the key `searchIdByLayout` has the format [<searchId>/\"grid | \"mosaic\"].\r\nlet tilePropertiesCache: { [searchIdByLayout: string]: IImageTileProps[] } = {} as any;\r\n\r\n/**\r\n * Creates the Image overlay title.\r\n * @param {IImageFileData<ICatalystFileDataMetadata>} imageEntity - The image entity to compute the overlay title for.\r\n * @returns {string} The computed overlay title.\r\n * @method\r\n */\r\nfunction getImageOverlayTitle(imageEntity: IImageFileData<ICatalystFileDataMetadata>): string {\r\n    const dateFormat = appConfig.imageOverlayDateFormat || \"DD MMM YYYY\";\r\n    let imageDate = \"\";\r\n    if (!!imageEntity.displayPublishedDateTime) {\r\n        imageDate = Moment(imageEntity.displayPublishedDateTime).format(dateFormat) + (!!imageEntity.title ? \" - \" : \"\");\r\n    }\r\n    return imageDate + imageEntity.title;\r\n}\r\n\r\n/**\r\n * Map the search results to the corresponding array of image tile props.\r\n * @export\r\n * @param {IEntityWithMetadata<IEntity>[]} tilesCollection - Tile collection to be mapped.\r\n * @param {boolean} multiSelectionSupported - Determines if multiselect feature should be enabled.\r\n * @param {callback} onImageTileInvoked - A function that returns the href for an image entity (different for mosaic and grid layouts).\r\n * @param {callback} onAddToLightboxInvoked - A function that returns the href for an image entity (different for mosaic and grid layouts).\r\n * @param {function} getHref - A function that returns the href for an image entity (different for mosaic and grid layouts).\r\n * @param {function} getTileDimensions - A function that returns width and height of an image entity (different for mosaic and grid layouts).\r\n * @returns {IImageTileProps[]} List of mapped image tiles.\r\n */\r\nexport function mapEntitiesToImageTileProperties(\r\n    tilesCollection: IEntityWithMetadata<IEntity>[],\r\n    multiSelectionSupported: boolean,\r\n    onImageTileInvoked: (id: string, event: React.SyntheticEvent<any>) => void,\r\n    onAddToLightboxInvoked: (id: string, event: Event) => void,\r\n    getHref: (imageEntity: IImageFileData<ICatalystFileDataMetadata>) => string,\r\n    getTileDimensions: (imageEntity: IImageFileData<ICatalystFileDataMetadata>) => { imgWidth: number, imgHeight: number }): IImageTileProps[] {\r\n\r\n    // compute the properties of a single image entity.\r\n    const computeImageTileProperties = (imageEntity: IImageFileData<ICatalystFileDataMetadata>) => {\r\n        const { imgWidth, imgHeight } = getTileDimensions(imageEntity);\r\n        const href = getHref(imageEntity);\r\n        const sourceHref: string = href !== undefined ? AddImageQualityQueryParamToUrl(href) : undefined;\r\n        const title = getImageOverlayTitle(imageEntity);\r\n        const { altText } = imageEntity;\r\n        const onThisImageTileInvoked = curry(onImageTileInvoked)(imageEntity._id);\r\n        const onThisImageTileAddToLightboxInvoked = curry(onAddToLightboxInvoked)(imageEntity._id);\r\n\r\n        return {\r\n            id: imageEntity._id,\r\n            sourceHref,\r\n            title,\r\n            imgWidth,\r\n            imgHeight,\r\n            supportsMultiSelection: multiSelectionSupported,\r\n            altText,\r\n            onImageTileInvoked: onThisImageTileInvoked,\r\n            onAddToLightboxInvoked: onThisImageTileAddToLightboxInvoked\r\n        };\r\n    };\r\n\r\n    return tilesCollection.map((imageEntity: IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>>) => {\r\n        return computeImageTileProperties(imageEntity.entity);\r\n    });\r\n}\r\n\r\n/**\r\n * This function manages a cache to speed-up the `mapStateToProps` method of the editorial search bootstrapper (SearchAndSelectBootstrapper.ts).\r\n * we store the entire array of image tile props corresponding to the pair <searchId, \"mosaic\" | \"grid\">.\r\n * e.g:\r\n * tilePropertiesCache = {\r\n *    <someGuid>/mosaic: [ ...<mosaic tiles props> ]\r\n *     <someGuid>/grid:   [ ...<grid tiles props> ]\r\n * }\r\n * At any given point in time the cache object will:\r\n *   - be an empty object, when no search have been executed yet.\r\n *   - be an object with 1 property, when a search have been executed and only one layout type have been selected.\r\n *   - be an object with 2 properties, when a search have been executed and both layout types have been selected at different times.\r\n *\r\n * @param {string} searchId - A unique identifier for a search.\r\n * @param {ResultsDisplayModeEnum} layoutType - The type of layout the tiles will be shown with.\r\n * @param {IEntityWithMetadata<IEntity>[]} searchResults - The set of search cms entities that need to be mapped in their corresponding image tile props.\r\n * @param {(id: string, event: React.SyntheticEvent<any>) => void} onImageTileInvoked - A function that returns the href for an image entity (different for mosaic and grid layouts).\r\n * @param { (id: string, event: Event) => void} onAddToLightboxInvoked - A function that returns the href for an image entity (different for mosaic and grid layouts).\r\n * @param {(imageEntity: IImageFileData<ICatalystFileDataMetadata>) => string} getHref - A function that returns the href for an image entity (different for mosaic and grid layouts).\r\n * @param {(imageEntity: IImageFileData<ICatalystFileDataMetadata>) => { imgWidth: number, imgHeight: number }} getTileDimensions - A function that returns width and height of an image entity (different for mosaic and grid layouts).\r\n * @method\r\n */\r\nexport function getCachedTilesProperties(\r\n    searchId: string,\r\n    layoutType: ResultsDisplayModeEnum,\r\n    searchResults: IEntityWithMetadata<IEntity>[],\r\n    onImageTileInvoked: (id: string, event: React.SyntheticEvent<any>) => void,\r\n    onAddToLightboxInvoked: (id: string, event: Event) => void,\r\n    getHref: (imageEntity: IImageFileData<ICatalystFileDataMetadata>) => string,\r\n    getTileDimensions: (imageEntity: IImageFileData<ICatalystFileDataMetadata>) => { imgWidth: number, imgHeight: number }): IImageTileProps[] {\r\n\r\n    const cacheKey =  `${searchId}/${layoutType}`;\r\n\r\n    // if a new search has been executed\r\n    if (!Object.keys(tilePropertiesCache).some(keyName => keyName.indexOf(searchId) > -1)) {\r\n\r\n        tilePropertiesCache = {\r\n            [cacheKey]: mapEntitiesToImageTileProperties(searchResults, false, onImageTileInvoked, onAddToLightboxInvoked, getHref, getTileDimensions)\r\n        };\r\n    } else {\r\n        // not the first search, but the first time a particular layout is being viewed.\r\n        if (!tilePropertiesCache[cacheKey]) {\r\n            tilePropertiesCache[cacheKey] = mapEntitiesToImageTileProperties(searchResults, false, onImageTileInvoked, onAddToLightboxInvoked, getHref, getTileDimensions);\r\n        }\r\n\r\n        // check if, for the pair <searchId, \"mosaic\" | \"grid\">, more data have been loaded. If so, compute the missing properties.\r\n        if (tilePropertiesCache[cacheKey].length < searchResults.length) {\r\n            const firstIndexOfNewData = tilePropertiesCache[cacheKey].length;\r\n            const stateSliceToProcess = searchResults.slice(firstIndexOfNewData);\r\n\r\n            const newTilesPropsToAppend = mapEntitiesToImageTileProperties(stateSliceToProcess, false, onImageTileInvoked, onAddToLightboxInvoked, getHref, getTileDimensions);\r\n            tilePropertiesCache[cacheKey] = tilePropertiesCache[cacheKey].concat(newTilesPropsToAppend);\r\n        }\r\n    }\r\n    return tilePropertiesCache[cacheKey];\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as Moment from \"moment\";\r\nimport * as React from \"react\";\r\n\r\nimport { AreaOfPage, PageNames } from \"../../instrumentation/instrumentationConstants/InstrumentationConstants\";\r\nimport { FilterItemOptionsListSelectionType, FilterItemOptionsType, IDateRangeFilter, IFilterItemOptionsList, IFilterOptionsGroup } from \"../../rendering/components/queryFilterPane/IFilterItemOptionsList\";\r\nimport { GetEntityWithMetadataAndIndexFromSearchResult, GetSelectActionInput } from \"../../instrumentation/helpers/InstrumentationHelper\";\r\nimport { IQueryBuilderRuleInfo, QueryBuilder } from \"./QueryBuilder\";\r\nimport { findIndex, isEmpty, isNil, merge, throttle } from \"lodash-es\";\r\n\r\nimport { Actions } from \"../../globals/actions\";\r\nimport { AddImageQualityQueryParamToUrl } from \"../addImageQualityParamToUrl\";\r\nimport { AppConstants } from \"../../AppConstants\";\r\nimport { CatalystSearchReduction } from \"../../presentation-logic/dataflows/catalystSearch/CatalystSearchReduction\";\r\nimport { CollapsibleActions } from \"cms-ui-presentationlogic/dataflows/collapsible/CollapsibleActions\";\r\nimport { ComponentBootstrapper } from \"cms-ui-views/ComponentBootstrapper\";\r\nimport { DateRange } from \"../../presentation-logic/dataflows/searchAndSelect/DateRange\";\r\nimport { DateRangeBoundaryIdentifier } from \"../../presentation-logic/dataflows/dateRangeSelector/DateRangeBoundaryIdentifier\";\r\nimport { DateRangeOptionType } from \"../catalystSearch/DateRangeOptionType\";\r\nimport { dateRangeOptions as DateRangeOptions } from \"../catalystSearch/DateRangeOptions\";\r\nimport { DateRangeSelectorActions } from \"../../presentation-logic/dataflows/dateRangeSelector/DateRangeSelectorActions\";\r\nimport { DateRangeSelectorReduction } from \"../../presentation-logic/dataflows/dateRangeSelector/DateRangeSelectorReduction\";\r\nimport { DownloadImage } from \"../imagePreviewModal/DownloadImage\";\r\nimport { EntityListActions } from \"cms-ui-presentationlogic/dataflows/entityList/EntityListActions\";\r\nimport { EntityListReduction } from \"cms-ui-presentationlogic/dataflows/entityList/EntityListReduction\";\r\nimport { EntitySearchActions } from \"cms-ui-presentationlogic/dataflows/entitySearch/EntitySearchActions\";\r\nimport { EntitySelectorActions } from \"cms-ui-presentationlogic/dataflows/entitySelector/EntitySelectorActions\";\r\nimport { EntitySelectorReduction } from \"cms-ui-presentationlogic/dataflows/entitySelector/EntitySelectorReduction\";\r\nimport { GetDimensionsHelper } from \"./GetDimensionsHelper\";\r\nimport { Global } from \"../../Global\";\r\nimport { ICatalystFileDataMetadata } from \"clientcore-models-catalyst/ICatalystFileDataMetadata\";\r\nimport { ICatalystSearchManager } from \"../catalystSearch/ICatalystSearchManager\";\r\nimport { ICellRenderInformation } from \"cms-ui-components/pagedVirtualCollection/ICellRenderInformation\";\r\nimport { IContinuationToken } from \"cms-businesslogic/IContinuationToken\";\r\nimport { IDateRangeSelectorState } from \"../../presentation-logic/dataflows/dateRangeSelector/IDateRangeSelectorState\";\r\nimport { IDispatch } from \"redux\";\r\nimport { IEntityListState } from \"cms-ui-presentationlogic/dataflows/entityList/IEntityListState\";\r\nimport { IEntityWithMetadata } from \"cms-businesslogic/entity/IEntityWithMetadata\";\r\nimport { IEvent } from \"clientcore-infrastructure-analytics/browser-object-models/IEvent\";\r\nimport { IFailedAction } from \"cms-ui-components/errorNotification/IFailedAction\";\r\nimport { IFieldNumberValue } from \"../../models/filterRules/IFieldNumberValue\";\r\nimport { IFieldStringValue } from \"../../models/filterRules/IFieldStringValue\";\r\nimport { IFieldValueBase } from \"../../models/filterRules/IFieldValueBase\";\r\nimport { IFilterRules } from \"./FilterRules\";\r\nimport { IImageAcquisitionManager } from \"clientcore-catalyst-businesslogic/IImageAcquisitionManager\";\r\nimport { IImageCommandActionCreator } from \"../../presentation-logic/dataflows/imageCommand/IImageCommandActionCreator\";\r\nimport { IImageFileData } from \"cms-models/IImageFileData\";\r\nimport { IImageTileProps } from \"../../rendering/components/imageTile/IImageTileProps\";\r\nimport { IInstrumentationClient } from \"../../instrumentation/instrumentationClient/IInstrumentationClient\";\r\nimport { ILightboxManager } from \"../lightbox/ILightboxManager\";\r\nimport { IListItemSelectorState } from \"../../presentation-logic/dataflows/listItemSelector/IListItemSelectorState\";\r\nimport { IModalCarouselProps } from \"../../rendering/components/modalCarousel/IModalCarouselProps\";\r\nimport { INumberFilter } from \"clientcore-catalyst-businesslogic/editorialSearch/INumberFilter\";\r\nimport { IOrderByItem } from \"cms-businesslogic/search/orderby/IOrderByItem\";\r\nimport { IPagedComponentProps } from \"cms-ui-components/paging/IPagedComponentProps\";\r\nimport { IProvider } from \"../../models/provider/IProvider\";\r\nimport { IReducer } from \"cms-ui-redux/IReducer\";\r\nimport { ISearchAndSelectProps } from \"../../rendering/searchAndSelect/ISearchAndSelectProps\";\r\nimport { ISearchAndSelectState } from \"../../presentation-logic/dataflows/searchAndSelect/ISearchAndSelectState\";\r\nimport { ImageCommandActionCreator } from \"../../presentation-logic/dataflows/imageCommand/ImageCommandActionCreator\";\r\nimport { ImageCommandActions } from \"../../presentation-logic/dataflows/imageCommand/ImageCommandActions\";\r\nimport { ImageCommandReduction } from \"../../presentation-logic/dataflows/imageCommand/ImageCommandReduction\";\r\nimport { ImagePreviewModalActions } from \"../../presentation-logic/dataflows/imagePreviewModal/ImagePreviewModalActions\";\r\nimport { ListEntitySelectorReduction } from \"cms-ui-presentationlogic/dataflows/listEntitySelector/ListEntitySelectorReduction\";\r\nimport { ListItemSelectorActions } from \"../../presentation-logic/dataflows/listItemSelector/ListItemSelectorActions\";\r\nimport { ModalCarousalEventCallbacks } from \"../imagePreviewModal/ModalCarousalEventCallbacks\";\r\nimport { ModalProvisioningActions } from \"cms-ui-presentationlogic/dataflows/modalProvisioning/ModalProvisioningActions\";\r\nimport { ModalProvisioningReduction } from \"cms-ui-presentationlogic/dataflows/modalProvisioning/ModalProvisioningReduction\";\r\nimport { OneSrvBusinessLogicFactory } from \"clientcore-onesrv-businesslogic/factory/OneSrvBusinessLogicFactory\";\r\nimport { PagedCollectionBootstrapper } from \"cms-ui-views/paging/PagedCollectionBootstrapper\";\r\nimport { Predicate } from \"cms-businesslogic/search/filter/Predicate\";\r\nimport { PromiseExtension } from \"cms-infrastructure/promise-extension/PromiseExtension\";\r\nimport { ReduxBootstrapper } from \"cms-ui-views/ReduxBootstrapper\";\r\nimport { ResultsDisplayModeEnum } from \"../../models/displayMode/ResultsDisplayModeEnum\";\r\nimport { SearchAndSelectActions } from \"../../presentation-logic/dataflows/searchAndSelect/SearchAndSelectActions\";\r\nimport { SearchAndSelectReduction } from \"../../presentation-logic/dataflows/searchAndSelect/SearchAndSelectReduction\";\r\nimport { SearchBootstrapper } from \"../search/SearchBootstrapper\";\r\nimport { SearchOperationTypes } from \"cms-ui-presentationlogic/dataflows/entitySearch/SearchOperationTypes\";\r\nimport { SearchQueryMatchCriteria } from \"cms-businesslogic/search/query/SearchQueryMatchCriteria\";\r\nimport { SearchQueryMatchCriteriaMode } from \"cms-businesslogic/search/query/SearchQueryMatchCriteriaMode\";\r\nimport { SearchWithAutosuggestActions } from \"../../presentation-logic/dataflows/searchWithAutosuggest/SearchWithAutosuggestActions\";\r\nimport { SortOrderOptions } from \"./SortOrderOptions\";\r\nimport { appConfig } from \"appConfig\";\r\nimport { ccsdk } from \"../../globals/ccsdk\";\r\nimport { getCachedTilesProperties } from \"./getTilesProperties\";\r\nimport { memoizedCalculateCellRenderInformation } from \"./calculateMosaicRenderInformation\";\r\n\r\n/**\r\n * Provides code to bootstrap the main app search and select experience with the required redux data flows.\r\n * @class\r\n */\r\nexport class SearchAndSelectBootstrapper<TParentState>\r\n    extends ComponentBootstrapper<ISearchAndSelectState<IEntityListState>, ISearchAndSelectProps, TParentState> {\r\n\r\n    /** The number of milliseconds in a day\r\n     *  @type { number }\r\n     */\r\n    private static MillisecondsInADay: number = 86400000;\r\n\r\n    /** An instance of the `EntityListActions` class.\r\n     * @type {EntityListActions}\r\n     */\r\n    private entityListActions: EntityListActions;\r\n\r\n    /**\r\n     * The entity search action for handling Search\r\n     * @type {EntitySearchActions}\r\n     */\r\n    private entitySearchActions: EntitySearchActions;\r\n\r\n    /** An instance of the `EntitySelectorActions` class.\r\n     * @type {EntitySelectorActions}\r\n     */\r\n    private entitySelectorActions: EntitySelectorActions;\r\n\r\n    /** An instance of the 'SearchWithAutosuggestActions' class for dealing with Search auto suggest drop downs.\r\n     * @type {SearchWithAutosuggestActions}\r\n     */\r\n    private searchWithAutosuggestActions: SearchWithAutosuggestActions;\r\n\r\n    /** An instance of the `ImageCommandActionCreator` class.\r\n     * @type {IImageCommandActionCreator}\r\n     */\r\n    private imageCommandActionCreator: IImageCommandActionCreator;\r\n\r\n    /** An instance of the `ImageCommandActions` class.\r\n     * @type {ImageCommandActions}\r\n     */\r\n    private imageCommandActions: ImageCommandActions;\r\n\r\n    /** An instance of the 'ImagePreviewModalActions' class.\r\n     * @type {ImagePreviewModalActions}\r\n     */\r\n    private imagePreviewModalActions: ImagePreviewModalActions;\r\n\r\n    /** An instance of the `CollapsibleActions` class.\r\n     * @type {CollapsibleActions}\r\n     */\r\n    private collapsibleActions: CollapsibleActions;\r\n\r\n    /** An instance of the `ListItemSelectorActions` class for dealing with the image providers option list.\r\n     * @type {ListItemSelectorActions<number>}\r\n     */\r\n    private providersListItemSelectorActions: ListItemSelectorActions<number>;\r\n\r\n    /** An instance of the `ListItemSelectorActions` class for dealing with the editorial Pick option.\r\n     * @type {ListItemSelectorActions}\r\n     */\r\n    private editorialPickListItemSelectorActions: ListItemSelectorActions<number>;\r\n\r\n    /** An instance of the `ListItemSelectorActions` class for dealing with the image orientations option list.\r\n     * @type {ListItemSelectorActions<number>}\r\n     */\r\n    private orientationsListItemSelectorActions: ListItemSelectorActions<number>;\r\n\r\n    /** An instance of the `ListItemSelectorActions` class for dealing with the image headShots option list.\r\n     * @type {ListItemSelectorActions<number>}\r\n     */\r\n    private headShotsListItemSelectorActions: ListItemSelectorActions<number>;\r\n\r\n    /** An instance of the `ListItemSelectorActions` class for dealing with the image collection option list.\r\n     * @type {ListItemSelectorActions<number>}\r\n     */\r\n    private collectionListItemSelectorActions: ListItemSelectorActions<number>;\r\n\r\n    /** An instance of the `ListItemSelectorActions` class for dealing with the number of people option list.\r\n     * @type {ListItemSelectorActions<number>}\r\n     */\r\n    private peopleFilterListItemSelectorActions: ListItemSelectorActions<number>;\r\n\r\n    /** An instance of the `ListItemSelectorActions` class for dealing with the date range filter options list.\r\n     * @type {ListItemSelectorActions<number>}\r\n     */\r\n    private dateRangeOptionsListItemSelectorActions: ListItemSelectorActions<number>;\r\n\r\n    /** An instance of the `DateRangeSelectorActions` class for dealing with custom date ranges.\r\n     * @type {DateRangeSelectorActions}\r\n     */\r\n    private dateRangeSelectorActions: DateRangeSelectorActions;\r\n\r\n    /** An instance of the `ListItemSelectorActions` class for dealing with the sort order list.\r\n     * @type {ListItemSelectorActions<number>}\r\n     */\r\n    private sortOrderListItemSelectorActions: ListItemSelectorActions<number>;\r\n\r\n    /** An instance of the 'SearchAndSelectActions' class for dealing with SearchAndSelect page filters.\r\n     * @type {SearchAndSelectActions}\r\n     */\r\n    private searchAndSelectActions: SearchAndSelectActions;\r\n\r\n    // Convenience members bound to a third member function in the constructor\r\n    private onStartOfRangeChanged: (date: Date) => void;\r\n    private onEndOfRangeChanged: (date: Date) => void;\r\n\r\n    // Filter rules defining the filters that can be applied\r\n    private filterRules: IFilterRules;\r\n\r\n    private searchBootstrapper: SearchBootstrapper<ISearchAndSelectState<IEntityListState>>;\r\n\r\n    // an instance of a memoized version of the `calculateCellRenderInformation` function (imported from UISDK).\r\n    private calculateCellRenderInformation: (tiles: IImageTileProps[], startIndex: number, itemCount: number, canvasWidth: number) => ICellRenderInformation[];\r\n\r\n    // consumers can register additional logic to be executed right after the editorial search has been executed.\r\n    private onEditorialSearchExecutedHandlers: (() => void)[] = [];\r\n\r\n    /**\r\n     * Initializes a new instance of the `SearchAndSelectBootstrapper` class.\r\n     * @constructor\r\n     * @param pagedImagesBootstrapper {PagedCollectionBootstrapper<ISearchAndSelectState<IEntityListState>>} The Redux bootstrapper that manages paging.\r\n     * @param imageAcquisitionManager {IImageAcquisitionManager} Used to download the images.\r\n     * @param oneServiceBusinessLogicFactory {OneSrvBusinessLogicFactory} The OneSrvBusinessLogicFactory.\r\n     * @param instrumentationClient {IInstrumentationClient} Provides support for instrumentation.\r\n     * @param catalystSearchManager {ICatalystSearchManager} The CatalystSearch Manager.\r\n     * @param onAddEntityToLightbox {function} A function that manages the add entity to lightbox workflow\r\n     * @param parentBootstrapper {ComponentBootstrapper<TParentState, any, any>} The bootsrapper that contains this bootstrapper.\r\n     * @param stateSelector {function} A function that selects the state for this bootstrapper from the parent state.\r\n     * @param actionNamespacePrefix {string} Optional prefix to add to the namespace used to distinguish actions created by this bootstrapper.\r\n     */\r\n    constructor(\r\n        private pagedImagesBootstrapper: PagedCollectionBootstrapper<ISearchAndSelectState<IEntityListState>>,\r\n        private imageAcquisitionManager: IImageAcquisitionManager,\r\n        private oneServiceBusinessLogicFactory: OneSrvBusinessLogicFactory,\r\n        private instrumentationClient: IInstrumentationClient,\r\n        private catalystSearchManager: ICatalystSearchManager,\r\n        private getLightboxManager: () => ILightboxManager,\r\n        private onAddEntityToLightbox: (entityWithMetadata: IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>>, modalProvisioningActions: ModalProvisioningActions, overlayOnly?: boolean) => React.ReactElement<any>,\r\n        private modalProvisioningActions: ModalProvisioningActions,\r\n        parentBootstrapper?: ComponentBootstrapper<TParentState, any, any> | ReduxBootstrapper<TParentState>,\r\n        stateSelector?: (parentState: TParentState) => ISearchAndSelectState<IEntityListState>,\r\n        actionNamespacePrefix?: string) {\r\n\r\n        super(parentBootstrapper, stateSelector);\r\n\r\n        pagedImagesBootstrapper.setParent(this, (state: ISearchAndSelectState<IEntityListState>) => state.pagedImagesState);\r\n\r\n        this.filterRules = catalystSearchManager.FilterRules;\r\n        DateRangeOptions.forEach(item => this.filterRules.displayPublishedDate.values.push({ displayString: item.displayString, value: item.hours }));\r\n\r\n        this.entitySearchActions = new EntitySearchActions(actionNamespacePrefix);\r\n        this.entityListActions = new EntityListActions(actionNamespacePrefix);\r\n        this.entitySelectorActions = new EntitySelectorActions(actionNamespacePrefix);\r\n        this.imageCommandActions = new ImageCommandActions(actionNamespacePrefix);\r\n        this.collapsibleActions = new CollapsibleActions(actionNamespacePrefix);\r\n        this.providersListItemSelectorActions = new ListItemSelectorActions<number>(actionNamespacePrefix + \"Providers\");\r\n        this.orientationsListItemSelectorActions = new ListItemSelectorActions<number>(actionNamespacePrefix + \"Orientations\");\r\n        this.headShotsListItemSelectorActions = new ListItemSelectorActions<number>(actionNamespacePrefix + \"HeadShots\");\r\n        this.editorialPickListItemSelectorActions = new ListItemSelectorActions<number>(actionNamespacePrefix + \"EditorialPick\");\r\n        this.collectionListItemSelectorActions = new ListItemSelectorActions<number>(actionNamespacePrefix + \"Collections\");\r\n        this.peopleFilterListItemSelectorActions = new ListItemSelectorActions<number>(actionNamespacePrefix + \"People\");\r\n        this.dateRangeOptionsListItemSelectorActions = new ListItemSelectorActions<number>(actionNamespacePrefix + \"DateRangeOptions\");\r\n        this.sortOrderListItemSelectorActions = new ListItemSelectorActions<number>(actionNamespacePrefix + \"SortOrder\");\r\n        this.searchAndSelectActions = new SearchAndSelectActions(actionNamespacePrefix);\r\n        this.dateRangeSelectorActions = new DateRangeSelectorActions(actionNamespacePrefix);\r\n        this.onClearSearch = this.onClearSearch.bind(this);\r\n        this.onDisplayModeChanged = this.onDisplayModeChanged.bind(this);\r\n        this.onPageNavigation = this.onPageNavigation.bind(this);\r\n        this.onFilterOptionsVisibilityChanged = this.onFilterOptionsVisibilityChanged.bind(this);\r\n        this.onSelectedProvidersChanged = this.onSelectedProvidersChanged.bind(this);\r\n        this.onSelectedOrientationsChanged = this.onSelectedOrientationsChanged.bind(this);\r\n        this.onHeadShotsSelectionChanged = this.onHeadShotsSelectionChanged.bind(this);\r\n        this.onSelectedCollectionsChanged = this.onSelectedCollectionsChanged.bind(this);\r\n        this.onSelectedPeopleFiltersChanged = this.onSelectedPeopleFiltersChanged.bind(this);\r\n        this.onSelectedDateRangeOptionChanged = this.onSelectedDateRangeOptionChanged.bind(this);\r\n        this.onSelectedSortOrderChanged = this.onSelectedSortOrderChanged.bind(this);\r\n        this.onEditorialPickOptionChanged = this.onEditorialPickOptionChanged.bind(this);\r\n        this.onStartOfRangeChanged = this.onDateInCustomDateRangeChanged.bind(this, DateRangeBoundaryIdentifier.startOfRange);\r\n        this.onEndOfRangeChanged = this.onDateInCustomDateRangeChanged.bind(this, DateRangeBoundaryIdentifier.endOfRange);\r\n        this.imagePreviewModalActions = new ImagePreviewModalActions(actionNamespacePrefix);\r\n        this.onImageTileInvoked = this.onImageTileInvoked.bind(this);\r\n        this.onAddToLightboxInvoked = this.onAddToLightboxInvoked.bind(this);\r\n        this.onPreviewButtonOk = this.onPreviewButtonOk.bind(this);\r\n        this.downloadImage = this.downloadImage.bind(this);\r\n        this.searchWithAutosuggestActions = new SearchWithAutosuggestActions(actionNamespacePrefix);\r\n        this.onSearchInvoked = this.onSearchInvoked.bind(this);\r\n        this.createModalCarousel = this.createModalCarousel.bind(this);\r\n\r\n        this.searchBootstrapper = new SearchBootstrapper(\r\n            \"SearchAndSelectBoostrapper\",\r\n            () => {\r\n                const state = this.getCurrentState();\r\n                return state.entitySearchState.searchText;\r\n            },\r\n            () => {\r\n                const state = this.getCurrentState();\r\n                return this.buildFilter(state);\r\n            },\r\n            () => {\r\n                const state = this.getCurrentState();\r\n                return this.buildSortOrder(state.selectedSortOrder);\r\n            },\r\n            () => {\r\n                const state = this.getCurrentState();\r\n                return this.buildQueryText(state);\r\n            },\r\n            () => {\r\n                const state = this.getCurrentState();\r\n                return this.getSearchMatchCriteria(state);\r\n            },\r\n            PageNames.SearchAndSelect,\r\n            this.getSearchActionInput.bind(this),\r\n            this.oneServiceBusinessLogicFactory,\r\n            instrumentationClient,\r\n            catalystSearchManager,\r\n            actionNamespacePrefix,\r\n            (state: ISearchAndSelectState<IEntityListState>) => state.searchWithAutosuggestState,\r\n            this\r\n        );\r\n\r\n        this.calculateCellRenderInformation = memoizedCalculateCellRenderInformation();\r\n\r\n        this.adaptPagedComponentPropsToSinglePage = this.adaptPagedComponentPropsToSinglePage.bind(this);\r\n        this.loadMoreData = this.loadMoreData.bind(this);\r\n    }\r\n\r\n    // Helper method to construct a FilterItemOptionsList for a single select set of options\r\n    private static buildMultiSelectOptionsList(\r\n        name: string,\r\n        options: IFieldValueBase[],\r\n        selectedIndexes: number[],\r\n        selectedOptionsChangeCallback: (selectedIndexes: number[], event: React.SyntheticEvent<any>) => void): IFilterItemOptionsList {\r\n\r\n        let filterOptions: IFilterItemOptionsList = {\r\n            $type: FilterItemOptionsType.StringList,\r\n            name: name,\r\n            selectionType: FilterItemOptionsListSelectionType.MultiSelect,\r\n            values: [],\r\n            onSelectedOptionsChanged: selectedOptionsChangeCallback\r\n        };\r\n\r\n        options.forEach(item => filterOptions.values.push({\r\n            value: item.displayString,\r\n            selected: false,\r\n            tooltip: item.helpText\r\n        }));\r\n\r\n        selectedIndexes.forEach(index => {\r\n            if (index >= 0 && index < filterOptions.values.length) {\r\n                filterOptions.values[index].selected = true;\r\n            }\r\n        });\r\n\r\n        return filterOptions;\r\n    }\r\n\r\n    // Helper method to construct a FilterItemOptionsList for a single select set of options\r\n    private static buildSingleSelectOptionsList(\r\n        name: string,\r\n        options: IFieldValueBase[],\r\n        selectedIndex: number,\r\n        selectedOptionChangeCallback: (selectedIndex: number, event: React.SyntheticEvent<any>) => void): IFilterItemOptionsList {\r\n        let retVal: IFilterItemOptionsList = SearchAndSelectBootstrapper.buildMultiSelectOptionsList(\r\n            name,\r\n            options,\r\n            [selectedIndex],\r\n            (selectedIndexes: number[], event) => {\r\n                return selectedIndexes.length > 0 ? selectedOptionChangeCallback(selectedIndexes[0], event) : selectedOptionChangeCallback(0, event);\r\n            });\r\n        retVal.selectionType = FilterItemOptionsListSelectionType.SingleSelectDropdown;\r\n        return retVal;\r\n    }\r\n\r\n    // Helper method to get the initial custom date range selector state\r\n    private static getInitialDateRangeSelectorState(): IDateRangeSelectorState {\r\n        let dateRange = DateRange.FromDateAndHours(new Date(), -24);\r\n\r\n        return {\r\n            startDate: dateRange.From,\r\n            endDate: dateRange.To\r\n        };\r\n    }\r\n\r\n    // Allows clients to add a handler to be executed after the editorial search is executed.\r\n    public registerHandlerOnEditorialSearchExecuted(handler: () => void): void {\r\n        this.onEditorialSearchExecutedHandlers.push(handler);\r\n    }\r\n\r\n    /**\r\n     * Initializes the initial state of the component.\r\n     * @method\r\n     * @returns {ISearchAndSelectState<IEntityListState>} The initial state.\r\n     */\r\n    public getInitialState(): ISearchAndSelectState<IEntityListState> {\r\n\r\n        const profileExists = !!Global.userProfile && !!Global.userProfile.editorialSearchFilters;\r\n        const imageProviders = this.buildImageProviderFilterOptions([]);\r\n        const editorialPicks = this.buildEditorialPickFilterOptions([]);\r\n        let editorialPicksIndices = [];\r\n        this.mapFilterIndices(editorialPicks, editorialPicksIndices, profileExists);\r\n\r\n        let providerIndices = [];\r\n        this.mapFilterIndices(imageProviders, providerIndices, profileExists);\r\n\r\n        const imageOrientations = this.buildOrientationsFilterOptions([]);\r\n        let orientationIndices = [];\r\n        this.mapFilterIndices(imageOrientations, orientationIndices, profileExists);\r\n\r\n        const headShotsOptions = this.buildHeadShotsFilterOptions([]);\r\n        let headShotsIndices = [];\r\n        this.mapFilterIndices(headShotsOptions, headShotsIndices, profileExists);\r\n\r\n        const collectionOptions = this.buildCollectionFilterOptions([]);\r\n        let collectionIndices = [];\r\n        this.mapFilterIndices(collectionOptions, collectionIndices, profileExists);\r\n\r\n        const peopleFilterOptions = this.buildPeopleFilterOptions([]);\r\n        let peopleFilterIndices = [];\r\n        this.mapFilterIndices(peopleFilterOptions, peopleFilterIndices, profileExists);\r\n\r\n        const dateOptions = this.buildDateRangeFilterOptions(0);\r\n        let dateIndices = [];\r\n        this.mapFilterIndices(dateOptions, dateIndices, profileExists);\r\n        if (dateIndices.length < 1) {\r\n            dateIndices = [0];\r\n        }\r\n\r\n        let sortOrder = 0;\r\n        if (!!Global.userProfile && !!Global.userProfile.editorialResultView && !!Global.userProfile.editorialResultView.sortOrder) {\r\n            try {\r\n                SortOrderOptions.forEach((item, index) => {\r\n                    if (item.displayName === Global.userProfile.editorialResultView.sortOrder) {\r\n                        sortOrder = index;\r\n                        throw (\"break\");\r\n                    }\r\n                });\r\n            } catch (e) {\r\n                // expecting throw to break foreach loop only.\r\n            }\r\n        }\r\n\r\n        const resultDisplayMode = !!Global.userProfile\r\n            && !!Global.userProfile.editorialResultView\r\n            && Global.userProfile.editorialResultView.displayMode > -1 ? Global.userProfile.editorialResultView.displayMode : ResultsDisplayModeEnum.Mosaic;\r\n\r\n        return {\r\n            selectedTopEditorialImageOption: {\r\n                selectedItems: editorialPicksIndices\r\n            },\r\n            pagedImagesState: this.pagedImagesBootstrapper.getInitialState(),\r\n            filterOptionVisibleState: {\r\n                collapsed: false\r\n            },\r\n            selectedProviders: {\r\n                selectedItems: providerIndices\r\n            },\r\n            selectedOrientations: {\r\n                selectedItems: orientationIndices\r\n            },\r\n            headShotsSelectionState: {\r\n                selectedItems: headShotsIndices\r\n            },\r\n            selectedCollections: {\r\n                selectedItems: collectionIndices\r\n            },\r\n            selectedPeopleFilters: {\r\n                selectedItems: peopleFilterIndices\r\n            },\r\n            selectedDateRangeOption: {\r\n                selectedItems: dateIndices\r\n            },\r\n            selectedSortOrder: {\r\n                selectedItems: [sortOrder]\r\n            },\r\n            customDateRange: SearchAndSelectBootstrapper.getInitialDateRangeSelectorState(),\r\n            entitySearchState: {\r\n                searchText: \"\",\r\n                searchOperation: SearchOperationTypes.EXECUTE_SEARCH\r\n            },\r\n            entityList: {\r\n                continuationToken: null,\r\n                entitiesWithMetadata: [],\r\n                loading: false,\r\n                sortOrder: [],\r\n                retriableAction: {\r\n                    error: null,\r\n                    action: undefined,\r\n                    actionParameters: []\r\n                }\r\n            },\r\n            entitySelector: {\r\n                selectedEntities: [],\r\n                allEntitiesSelectionChecked: false\r\n            },\r\n            modalProvisioningState: { isVisible: false },\r\n            searchWithAutosuggestState: this.searchBootstrapper.getInitialState(),\r\n            imageCommandState: {\r\n                imagesDownloading: [],\r\n                failedImages: []\r\n            },\r\n            resultsDisplayMode: resultDisplayMode\r\n        } as ISearchAndSelectState<IEntityListState>;\r\n    }\r\n\r\n    /**\r\n     * Creates the root reducer of the component.\r\n     * @method\r\n     * @returns {IReducer<ISearchAndSelectState>} The root reducer of the component.\r\n     */\r\n    public createRootReducer(): IReducer<ISearchAndSelectState<IEntityListState>> {\r\n\r\n        let entityListReduction = new EntityListReduction<IEntityListState>(this.entityListActions);\r\n\r\n        const entitySelectorReduction = new ListEntitySelectorReduction(\r\n            entityListReduction,\r\n            new EntitySelectorReduction(this.entitySelectorActions));\r\n\r\n        const dateRangeSelectorReduction = new DateRangeSelectorReduction(this.dateRangeSelectorActions);\r\n        const catalystSearchReduction = new CatalystSearchReduction(this.entitySearchActions);\r\n\r\n        const imageCommandReduction = new ImageCommandReduction(this.imageCommandActions);\r\n\r\n        const pagedImagesReducer = this.pagedImagesBootstrapper.createRootReducer();\r\n\r\n        const searchWithAutosuggestReduction = this.searchBootstrapper.createRootReducer();\r\n\r\n        const modalProvisioningReduction = new ModalProvisioningReduction(this.modalProvisioningActions);\r\n\r\n        const rootReducer = new SearchAndSelectReduction(\r\n            this.entitySearchActions,\r\n            this.collapsibleActions,\r\n            this.providersListItemSelectorActions,\r\n            this.editorialPickListItemSelectorActions,\r\n            this.orientationsListItemSelectorActions,\r\n            this.headShotsListItemSelectorActions,\r\n            this.collectionListItemSelectorActions,\r\n            this.peopleFilterListItemSelectorActions,\r\n            this.dateRangeOptionsListItemSelectorActions,\r\n            this.sortOrderListItemSelectorActions,\r\n            this.searchAndSelectActions,\r\n            dateRangeSelectorReduction,\r\n            entitySelectorReduction,\r\n            this.imagePreviewModalActions,\r\n            modalProvisioningReduction,\r\n            catalystSearchReduction,\r\n            pagedImagesReducer,\r\n            this.searchWithAutosuggestActions,\r\n            searchWithAutosuggestReduction,\r\n            imageCommandReduction\r\n        );\r\n\r\n        return rootReducer;\r\n    }\r\n\r\n    /**\r\n     * Maps from the redux explorer state and default view properties to the view properties.\r\n     * @method\r\n     * @param state {ISearchAndSelectState<IEntityListState>} The redux state.\r\n     * @returns {ISearchAndSelectProps} The mapped view properties.\r\n     */\r\n    public mapStateToProps(state: ISearchAndSelectState<IEntityListState>): ISearchAndSelectProps {\r\n\r\n        const retVal = {} as ISearchAndSelectProps;\r\n\r\n        retVal.thumbnailImageWidth = AppConstants.thumbnailConfig.gridTileWidth;\r\n        retVal.thumbnailImageHeight = AppConstants.thumbnailConfig.gridTileHeight;\r\n\r\n        retVal.serviceError = state.serviceError;\r\n\r\n        retVal.childDocumentsBeingLoaded = state.entityList.loading;\r\n\r\n        retVal.failedActions = [];\r\n        if (state.entityList.retriableAction && state.entityList.retriableAction.error) {\r\n            let failedAction: IFailedAction = {\r\n                error: state.entityList.retriableAction.error,\r\n                retryFailedAction: function (): void {\r\n                    state.entityList.retriableAction.action.apply(null, state.entityList.retriableAction.actionParameters);\r\n                }\r\n            };\r\n            retVal.failedActions.push(failedAction);\r\n        }\r\n\r\n        const editorialPick = this.buildEditorialPickFilterOptions(state.selectedTopEditorialImageOption.selectedItems);\r\n        const headShots = this.buildHeadShotsFilterOptions(state.headShotsSelectionState.selectedItems);\r\n        const imageProviders = this.buildImageProviderFilterOptions(state.selectedProviders.selectedItems);\r\n        const imageOrientations = this.buildOrientationsFilterOptions(state.selectedOrientations.selectedItems);\r\n        const collectionOptions = this.buildCollectionFilterOptions(state.selectedCollections.selectedItems);\r\n        const peopleFilterOptions = this.buildPeopleFilterOptions(state.selectedPeopleFilters.selectedItems);\r\n\r\n        let selectedDateRangeOptionIndex = state.selectedDateRangeOption.selectedItems.length > 0 ?\r\n            state.selectedDateRangeOption.selectedItems[0] :\r\n            0;\r\n        let dateRangeOptions: IFilterItemOptionsList = this.buildDateRangeFilterOptions(selectedDateRangeOptionIndex);\r\n\r\n        let dateGroup: IFilterOptionsGroup = {\r\n            items: [dateRangeOptions]\r\n        };\r\n\r\n        if (DateRangeOptions[selectedDateRangeOptionIndex].rangeOptionType === DateRangeOptionType.custom) {\r\n\r\n            let defaultDateRange = DateRange.FromDateAndHours(new Date(), -24);\r\n            // Render the custom date range props\r\n            let dateRangeFilter: IDateRangeFilter = {\r\n                $type: FilterItemOptionsType.DateRange,\r\n                name: \"Date\",\r\n                startDate: !!state.customDateRange ? state.customDateRange.startDate : defaultDateRange.From,\r\n                endDate: !!state.customDateRange ? state.customDateRange.endDate : defaultDateRange.To,\r\n                maxEndOfRangeDate: defaultDateRange.To,\r\n                maxStartOfRangeDate: defaultDateRange.To,\r\n                onStartOfRangeChanged: this.onStartOfRangeChanged,\r\n                onEndOfRangeChanged: this.onEndOfRangeChanged\r\n            };\r\n\r\n            dateGroup.items.push(dateRangeFilter);\r\n        }\r\n\r\n        retVal.queryFilterPaneProps = {\r\n            optionGroups: [\r\n                {\r\n                    items: [editorialPick, headShots]\r\n                },\r\n                {\r\n                    items: [imageProviders]\r\n                },\r\n                {\r\n                    items: [imageOrientations]\r\n                },\r\n                {\r\n                    items: [collectionOptions]\r\n                },\r\n                {\r\n                    items: [peopleFilterOptions]\r\n                },\r\n                dateGroup\r\n            ],\r\n            isKeyboardNavigable: !state.filterOptionVisibleState.collapsed\r\n        };\r\n\r\n        retVal.sortOrderProps = {\r\n            selectedOption: state.selectedSortOrder.selectedItems.length > 0\r\n                ? state.selectedSortOrder.selectedItems[0]\r\n                : 0,\r\n            options: SortOrderOptions.map(option => option.displayName),\r\n            onSelectedOptionChanged: this.onSelectedSortOrderChanged\r\n        };\r\n\r\n        retVal.showFilterOptions = !state.filterOptionVisibleState.collapsed;\r\n\r\n        let pagedImagesProps = this.pagedImagesBootstrapper.mapStateToProps(state.pagedImagesState);\r\n        pagedImagesProps = this.adaptPagedComponentPropsToSinglePage(pagedImagesProps, state.entityList.entitiesWithMetadata.length - 1);\r\n        retVal.pagedImagesProps = pagedImagesProps;\r\n\r\n        let imageTilesProps = this.mapStateToImageTilesProperties(state);\r\n\r\n        retVal.imageTiles = imageTilesProps;\r\n\r\n        retVal.onlyFirstPageLoaded = isNil(state.entityList.continuationToken) || state.entityList.continuationToken.moreResultsAvailable === false;\r\n\r\n        const loadMoreItemsOnScroll =\r\n            ({ clientHeight, scrollHeight, scrollTop }) => {\r\n\r\n                // load a new page of data only when:\r\n                if (isFinite(clientHeight) &&\r\n                    !state.serviceError &&                                                                                                          // the last load succeeded\r\n                    scrollTop > Math.floor(AppConstants.resultsBrowsing.scrollbarThresholdPercentage.editorial * (scrollHeight - clientHeight)) &&  // the scroll threshold have been reached\r\n                    !state.entityList.loading) {                                                                                                    // there is not a page already being loaded\r\n\r\n                    const scrollEvent = new CustomEvent(\"onEditorialSearchScrollDownThresholdExceeded\");\r\n                    this.onPageNavigation(0, retVal.imageTiles.length - 1, scrollEvent);\r\n                }\r\n            };\r\n\r\n        // the `load more items` function execution is throttled to avoid firing too many calls.\r\n        // (for details see: https://css-tricks.com/debouncing-throttling-explained-examples/)\r\n        const throttledLoadMoreItemsOnScroll = throttle(loadMoreItemsOnScroll, AppConstants.resultsBrowsing.scrollDebounceTime, { leading: true, trailing: false });\r\n\r\n        if (state.entityList.entitiesWithMetadata.length <= AppConstants.resultsBrowsing.maximumNumberOfResults) {\r\n            retVal.onScroll = throttledLoadMoreItemsOnScroll;\r\n        } else {\r\n            retVal.onScroll = () => { return; };\r\n        }\r\n\r\n        if (state.resultsDisplayMode === ResultsDisplayModeEnum.Mosaic) {\r\n\r\n            const activePageCellProps = state.entityList.entitiesWithMetadata.length > 0 ? this.calculateCellRenderInformation(\r\n                retVal.imageTiles,\r\n                0,\r\n                state.entityList.entitiesWithMetadata.length,\r\n                state.pagedImagesState.canvasWidth) :\r\n                [];\r\n\r\n            // Calculate the height of the page\r\n            // The height is the y position value of the last component in the page, plus the height of that element plus a margin\r\n            let containerHeightForCollection = 0;\r\n            const indexOfLastElement = activePageCellProps.length - 1;\r\n            if (indexOfLastElement >= 0) {\r\n                containerHeightForCollection = activePageCellProps[indexOfLastElement].y + activePageCellProps[indexOfLastElement].height + AppConstants.thumbnailConfig.totalMargin;\r\n            }\r\n\r\n            retVal.pagedVirtualCollectionProps = {\r\n                containerHeight: containerHeightForCollection,\r\n                containerWidth: state.pagedImagesState.canvasWidth,\r\n                pages: pagedImagesProps.pageDescriptors,\r\n                activePageIndex: pagedImagesProps.activePageIndex,\r\n                activePageCellProps\r\n            };\r\n        }\r\n\r\n        retVal.searchWithAutosuggestProps = this.searchBootstrapper.mapStateToProps(state.searchWithAutosuggestState);\r\n\r\n        retVal.resultsDisplayMode = state.resultsDisplayMode;\r\n\r\n        retVal.scrollTop = state.scrollTop;\r\n\r\n        const modal = state.modalProvisioningState.isVisible ? this.createModal(state.modalProvisioningState.modalId, state) : null;\r\n        if (modal) {\r\n            (retVal as any).children = modal;\r\n        }\r\n\r\n        return retVal as ISearchAndSelectProps;\r\n    }\r\n\r\n    /**\r\n     * Inject into props redux action creators.\r\n     * @method\r\n     * @param {IDispatch} dispatch The redux dispatch function.\r\n     * @param {ISearchAndSelectProps} _ownProps The set of pure properties of the component.\r\n     * @returns {ISearchAndSelectProps} An enriched set of props.\r\n     */\r\n    public mapDispatchToProps(dispatch: IDispatch, _ownProps: ISearchAndSelectProps): ISearchAndSelectProps {\r\n        return {\r\n            onToggleFilterOptionsVisibility: this.onFilterOptionsVisibilityChanged,\r\n            onDisplayModeChanged: this.onDisplayModeChanged,\r\n            onImageTileInvoked: this.onImageTileInvoked,\r\n            onAddToLightboxInvoked: this.onAddToLightboxInvoked,\r\n            pagedImagesProps: this.pagedImagesBootstrapper.mapDispatchToProps(dispatch),\r\n            searchWithAutosuggestProps: {\r\n                onSearchExecute: (event: React.SyntheticEvent<any>) => this.onSearchInvoked(\"searchText\", \"TextBox\", event),\r\n                onSuggestionSelected: (event: React.SyntheticEvent<any>) => this.onSearchInvoked(\"searchText\", \"AutosuggestDropDown\", event)\r\n            },\r\n            onSearchViewWillUnmount: (scrollTop: number) => Actions.SearchAndSelect.SearchResultsScrollPositionActions.SaveScrollPosition.getActionSender(this.store)(scrollTop),\r\n            onRetryClicked: this.onRetryClicked\r\n        } as ISearchAndSelectProps;\r\n    }\r\n\r\n    /**\r\n     * Performs required job before the component is created.\r\n     * @method\r\n     */\r\n    public onBeforeComponentCreated(): void {\r\n        this.searchBootstrapper.onBeforeComponentCreated();\r\n\r\n        this.imageCommandActionCreator = new ImageCommandActionCreator(\r\n            this.imageAcquisitionManager,\r\n            this.store,\r\n            this.imageCommandActions);\r\n    }\r\n\r\n    /**\r\n     * Converts the props that have been shaped for the `paging infrastructure` to a form that can be utilized in a context where we only have one (expandable in size)\r\n     * single page.\r\n     * @param {IPagedComponentProps} currentPagedImageState - The props shaped to power a multi-page scenario.\r\n     * @param {number} totalItems - The total number of items that have been loaded so far.\r\n     * @returns {IPagedComponentProps} A set of props that treats the set of data as a single (expandable in size) page.\r\n     */\r\n    private adaptPagedComponentPropsToSinglePage(pagedComponentProps: IPagedComponentProps, totalItems: number): IPagedComponentProps {\r\n        const pagedImagesProps = {\r\n            ...pagedComponentProps,\r\n            activePageIndex: 0,\r\n            pageDescriptors: [{\r\n                isFirst: true,\r\n                isLast: true,\r\n                pageIndex: 0,\r\n                startIndex: 0,\r\n                endIndex: totalItems\r\n            }]\r\n        };\r\n        return pagedImagesProps;\r\n    }\r\n\r\n    /**\r\n     * Saves the query filter selection to profile stored in app\r\n     * @param filters {IFilterItemOptionsList} the filters\r\n     * @method\r\n     */\r\n    private saveQueryFilterSelectionToProfile(filters: IFilterItemOptionsList): void {\r\n        if (!Global.userProfile.editorialSearchFilters) {\r\n            Global.userProfile[\"editorialSearchFilters\"] = {};\r\n        }\r\n\r\n        filters.values.forEach((item) => {\r\n            Global.userProfile.editorialSearchFilters[item.value] = item.selected;\r\n        });\r\n\r\n        ccsdk.userProfileManagers.prose.setSetting(\"editorialSearchFilters\", Global.userProfile.editorialSearchFilters).catch((e) => {\r\n            this.instrumentationClient.LoggingService.error(\"Saving user profile failed.\", null, e);\r\n        });\r\n    }\r\n\r\n    /**\r\n     * Maps the editorial search state to an array of image tile properties.\r\n     * It uses the `getTilesProperties` function, that uses a cache to speed-up the mapping process.\r\n     * @param {ISearchAndSelectState<IEntityListState>} state - The editorial search state\r\n     * @returns {IImageTileProps[]} The array of image tile properties result of the mapping.\r\n     * @method\r\n     */\r\n    private mapStateToImageTilesProperties(state: ISearchAndSelectState<IEntityListState>): IImageTileProps[] {\r\n\r\n        // if no search have been executed, there are no image tile props stored yet, return an empty array.\r\n        if (!state.entitySearchState.searchUniqueIdentifier) {\r\n            return [];\r\n        }\r\n\r\n        // function that retrieves the href for the image tile, abstracting the layout it will be shown in.\r\n        const getHref = (): (imageEntity: IImageFileData<ICatalystFileDataMetadata>) => string => {\r\n            return (imageEntity: IImageFileData<ICatalystFileDataMetadata>): string => AddImageQualityQueryParamToUrl(imageEntity.href);\r\n        };\r\n\r\n        // function that retrieves the dimensions for the image tile, abstracting the layout it will be shown in.\r\n        const getImageTileDimensions = (): (imageEntity: IImageFileData<ICatalystFileDataMetadata>) => { imgWidth: number, imgHeight: number } => {\r\n            const getImageTileDimensionsForGridLayout = (_imageEntity: IImageFileData<ICatalystFileDataMetadata>): { imgWidth: number, imgHeight: number } => {\r\n                return { imgWidth: AppConstants.thumbnailConfig.width, imgHeight: AppConstants.thumbnailConfig.height };\r\n            };\r\n            const getImageTileDimensionsForMosaicLayout = (imageEntity: IImageFileData<ICatalystFileDataMetadata>): { imgWidth: number, imgHeight: number } => {\r\n                const tileDimensions = GetDimensionsHelper(imageEntity, this.instrumentationClient);\r\n                return { imgWidth: tileDimensions.width, imgHeight: tileDimensions.height };\r\n            };\r\n\r\n            return state.resultsDisplayMode === ResultsDisplayModeEnum.Grid ? getImageTileDimensionsForGridLayout : getImageTileDimensionsForMosaicLayout;\r\n        };\r\n\r\n        const cachedTileProps = getCachedTilesProperties(\r\n            state.entitySearchState.searchUniqueIdentifier,\r\n            state.resultsDisplayMode,\r\n            state.entityList.entitiesWithMetadata,\r\n            this.onImageTileInvoked,\r\n            this.onAddToLightboxInvoked,\r\n            getHref(),\r\n            getImageTileDimensions());\r\n\r\n        return cachedTileProps;\r\n    }\r\n\r\n    /**\r\n     * Map filter options to indices.\r\n     * @param filterOptions {IFilterItemOptionsList} the filter item options list\r\n     * @param indices {number[]} the indices to populate\r\n     * @param profileExists {boolean} if profile exists\r\n     */\r\n    private mapFilterIndices(filterOptions: IFilterItemOptionsList, indices: number[], profileExists: boolean): void {\r\n        filterOptions.values.forEach((item, index) => {\r\n            if (profileExists\r\n                && Global.userProfile.editorialSearchFilters.hasOwnProperty(item.value)\r\n                && Global.userProfile.editorialSearchFilters[item.value]) {\r\n                indices.push(index);\r\n            }\r\n        });\r\n    }\r\n\r\n    /**\r\n     * Callback which is invoked when the user switches the display mode.\r\n     * @param resultsDisplayMode {ResultsDisplayModeEnum} the display mode\r\n     * @method\r\n     */\r\n    private onDisplayModeChanged(resultsDisplayMode: ResultsDisplayModeEnum): void {\r\n        let editorialResultView = Global.userProfile.editorialResultView || {};\r\n        editorialResultView[\"displayMode\"] = resultsDisplayMode;\r\n        ccsdk.userProfileManagers.prose.setSetting(\"editorialResultView\", editorialResultView);\r\n\r\n        this.searchAndSelectActions.SetResultsDisplayMode.getActionSender(this.store)(resultsDisplayMode);\r\n    }\r\n\r\n    /**\r\n     * Callback which loads the preview image when an image tile is invoked.\r\n     * @param id {string} the id for the image\r\n     * @param event {Event} the event which triggered this handler\r\n     * @method\r\n     */\r\n    private onImageTileInvoked(id: string, event: React.SyntheticEvent<any>): void {\r\n        if (!id) {\r\n            console.error(\"Tile clicked, but image id is not passed with the click event.\");\r\n            return;\r\n        }\r\n\r\n        const entityList = this.getCurrentState().entityList.entitiesWithMetadata;\r\n        const entityInfo = GetEntityWithMetadataAndIndexFromSearchResult(id, entityList as IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>>[]);\r\n        const state = this.getCurrentState();\r\n        this.instrumentationClient.UserActivityTrackingService.logPageActionEvent(\r\n            this.instrumentationClient.createEventData(event, \"image\", null, \"image-ImageTile\", AreaOfPage.searchAndSelectResultsView),\r\n            PageNames.SearchAndSelect,\r\n            this.catalystSearchManager.SearchActivity.correlationVector,\r\n            this.searchBootstrapper.getPageActionData(\r\n                GetSelectActionInput(entityInfo.entityWithMetadata, entityInfo.index + 1, state.filterOptionVisibleState.collapsed, state.resultsDisplayMode)));\r\n\r\n        if (!!entityInfo.entityWithMetadata) {\r\n            this.imagePreviewModalActions.ImagePreviewModalFetchEnd.getActionSender(this.store)(entityInfo.index);\r\n            this.modalProvisioningActions.ShowModal.getActionSender(this.store)(\"ImagePreviewModal\");\r\n        } else {\r\n            throw (`Error: Image entity ${id} is not in the entity list from search.`);\r\n        }\r\n\r\n        return;\r\n    }\r\n\r\n    /**\r\n     * Callback opens the Add To Lightbox modal.\r\n     * @param id {string} the id for the image\r\n     * @param event {IEvent} the event which triggered this handler\r\n     * @method\r\n     */\r\n    private onAddToLightboxInvoked(id: string, event: IEvent): void {\r\n        if (!id) {\r\n            console.error(\"Tile clicked, but image id is not passed with the click event.\");\r\n            return;\r\n        }\r\n\r\n        const entityList = this.getCurrentState().entityList.entitiesWithMetadata;\r\n        const entityInfo = GetEntityWithMetadataAndIndexFromSearchResult(id, entityList as IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>>[]);\r\n\r\n        this.instrumentationClient.UserActivityTrackingService.logPageActionEvent(\r\n            this.instrumentationClient.createEventData(event, \"addToLightbox\", null, \"addToLightbox-Button\", AreaOfPage.searchAndSelectResultsView),\r\n            PageNames.SearchAndSelect,\r\n            this.catalystSearchManager.SearchActivity.correlationVector,\r\n            this.searchBootstrapper.getPageActionData(this.getAddToLightboxActionInput(entityInfo.entityWithMetadata, entityInfo.index + 1)));\r\n\r\n        if (!!entityInfo.entityWithMetadata) {\r\n            // This action selects the entity. It should be renamed.\r\n            this.imagePreviewModalActions.ImagePreviewModalFetchEnd.getActionSender(this.store)(entityInfo.index);\r\n            this.modalProvisioningActions.ShowModal.getActionSender(this.store)(\"AddToLightboxModal\");\r\n        } else {\r\n            throw (`Error: Image entity ${id} is not in the entity list from search.`);\r\n        }\r\n\r\n        return;\r\n    }\r\n\r\n    /**\r\n     * On click event for preivew modal ok button.\r\n     * @method\r\n     */\r\n    private onPreviewButtonOk(): void {\r\n        this.imageCommandActionCreator.clearLastDownloadError();\r\n        this.modalProvisioningActions.HideModal.getActionSender(this.store)();\r\n    }\r\n\r\n    /**\r\n     * download image function\r\n     * @param event {Event} the event which triggered this handler\r\n     * @method\r\n     */\r\n    private downloadImage(event: React.SyntheticEvent<any>): void {\r\n        const state = this.getCurrentState();\r\n        const selectedEntity = state.entityList.entitiesWithMetadata[state.selectedImageEntityIndex].entity as IImageFileData<ICatalystFileDataMetadata>;\r\n        DownloadImage(\r\n            event,\r\n            selectedEntity,\r\n            PageNames.SearchAndSelect,\r\n            this.imageCommandActionCreator,\r\n            this.instrumentationClient,\r\n            \"SearchAndSelectBootstrapper.downloadImage\",\r\n            this.catalystSearchManager.SearchActivity\r\n        );\r\n    }\r\n\r\n    // Helper method to build the image provider filter props\r\n    private buildImageProviderFilterOptions(selectedIndexes: number[]): IFilterItemOptionsList {\r\n        return SearchAndSelectBootstrapper.buildMultiSelectOptionsList(this.filterRules.providers.ruleName, this.filterRules.providers.values, selectedIndexes, this.onSelectedProvidersChanged);\r\n    }\r\n\r\n    // Helper method to build the editorial pick filter props\r\n    private buildEditorialPickFilterOptions(selectedIndexes: number[]): IFilterItemOptionsList {\r\n        return SearchAndSelectBootstrapper.buildMultiSelectOptionsList(this.filterRules.editorspick.ruleName, this.filterRules.editorspick.values, selectedIndexes, this.onEditorialPickOptionChanged);\r\n    }\r\n\r\n    // Helper method to build the orientations filter props\r\n    private buildOrientationsFilterOptions(selectedIndexes: number[]): IFilterItemOptionsList {\r\n        return SearchAndSelectBootstrapper.buildMultiSelectOptionsList(this.filterRules.orientations.ruleName, this.filterRules.orientations.values, selectedIndexes, this.onSelectedOrientationsChanged);\r\n    }\r\n\r\n    // Helper method to build the headShots filter props\r\n    private buildHeadShotsFilterOptions(selectedIndexes: number[]): IFilterItemOptionsList {\r\n        return SearchAndSelectBootstrapper.buildMultiSelectOptionsList(this.filterRules.headShots.ruleName, this.filterRules.headShots.values, selectedIndexes, this.onHeadShotsSelectionChanged);\r\n    }\r\n\r\n    // Helper method to build the collection filter props\r\n    private buildCollectionFilterOptions(selectedIndexes: number[]): IFilterItemOptionsList {\r\n        return SearchAndSelectBootstrapper.buildMultiSelectOptionsList(this.filterRules.collection.ruleName, this.filterRules.collection.values, selectedIndexes, this.onSelectedCollectionsChanged);\r\n    }\r\n\r\n    // Helper method to build the people filter props\r\n    private buildPeopleFilterOptions(selectedIndexes: number[]): IFilterItemOptionsList {\r\n        return SearchAndSelectBootstrapper.buildMultiSelectOptionsList(this.filterRules.people.ruleName, this.filterRules.people.values, selectedIndexes, this.onSelectedPeopleFiltersChanged);\r\n    }\r\n\r\n    // Helper method to build the date range options filter props\r\n    private buildDateRangeFilterOptions(selectedIndex: number): IFilterItemOptionsList {\r\n        return SearchAndSelectBootstrapper.buildSingleSelectOptionsList(this.filterRules.displayPublishedDate.ruleName, this.filterRules.displayPublishedDate.values, selectedIndex, this.onSelectedDateRangeOptionChanged);\r\n    }\r\n\r\n    /**\r\n     * Logic invoked when a Clear Search is Executed.\r\n     * @method\r\n     */\r\n    private onClearSearch(): void {\r\n        this.entitySearchActions.ClearSearch.getActionSender(this.store)();\r\n    }\r\n\r\n    /**\r\n     * Logic invoked when next page of data is required.\r\n     * Don't disable search button when loading more entities. That's why we don't fire the searchOperationActions in this method.\r\n     * @method\r\n     * @param {number} startIndex - The start index\r\n     * @param {number} endIndex - The end index\r\n     * @param {React.SyntheticEvent<any> | CustomEvent} event - The event that triggered this handler.\r\n     */\r\n    private onPageNavigation(startIndex: number, endIndex: number, event: React.SyntheticEvent<any> | CustomEvent): void {\r\n        let actionInput: { [key: string]: string; } = merge(\r\n            {\r\n                \"startIndex\": startIndex.toString(),\r\n                \"endIndex\": endIndex.toString()\r\n            },\r\n            this.getSearchActionInput());\r\n\r\n        let pageActionData = this.searchBootstrapper.getPageActionData(actionInput);\r\n\r\n        this.instrumentationClient.UserActivityTrackingService.logPageActionEvent(\r\n            this.instrumentationClient.createEventData(event, \"pageNavigator\", null, \"pageNavigator-Button\", AreaOfPage.searchAndSelectResultsView),\r\n            PageNames.SearchAndSelect,\r\n            this.catalystSearchManager.SearchActivity.correlationVector,\r\n            pageActionData);\r\n\r\n        let state = this.getCurrentState();\r\n        let continuationToken = state.entityList.continuationToken;\r\n\r\n        if (continuationToken.moreResultsAvailable &&\r\n            (endIndex >= Math.floor(state.entityList.entitiesWithMetadata.length * 0.66))) {\r\n            this.loadMoreData(continuationToken, \"SearchAndSelectBootstrapper.searchNextPageQuery\");\r\n        }\r\n    }\r\n\r\n    /**\r\n     * Loads a new page of data.\r\n     * @method\r\n     * @param {IContinuationToken} continuationToken - The continuation token that is being used to get another page of data.\r\n     * @param {string} activityName - The telemetry activity name that will be used for this search.\r\n     */\r\n    private loadMoreData(continuationToken: IContinuationToken, activityName: string): void {\r\n        const state = this.getCurrentState();\r\n        this.entityListActions.EntitiesLoading.getActionSender(this.store)(this.loadMoreData, [continuationToken]);\r\n\r\n        const orderBy = this.buildSortOrder(state.selectedSortOrder);\r\n        const queryText = this.buildQueryText(state);\r\n        const searchMatchCriteria = this.getSearchMatchCriteria(state);\r\n\r\n        // This activity is used to track the perf of the search execution.\r\n        const nextPageSearchActivity =\r\n            this.instrumentationClient.ActivityLoggingService.createActivity(\r\n                activityName,\r\n                this.catalystSearchManager.SearchActivity\r\n            );\r\n\r\n        const nextPageSearchPromise = this.catalystSearchManager.executeSearchForNextPageEntities(\r\n            queryText,\r\n            orderBy,\r\n            continuationToken,\r\n            searchMatchCriteria,\r\n            nextPageSearchActivity);\r\n\r\n        nextPageSearchPromise.catch((error) => {\r\n            this.instrumentationClient.LoggingService.error(\"SearchAndSelectBootstrapper.searchNextPageQuery\", nextPageSearchActivity, error);\r\n            Actions.ApplicationLevelError.SetApplicationError.getActionSender(this.store)(error);\r\n        });\r\n\r\n        PromiseExtension.onComplete(nextPageSearchPromise, () => this.instrumentationClient.ActivityLoggingService.endActivity(nextPageSearchActivity));\r\n    }\r\n\r\n    // Callback for filter options visibility changed\r\n    private onFilterOptionsVisibilityChanged(): void {\r\n        this.collapsibleActions.ToggleCollapsible.getActionSender(this.store)();\r\n    }\r\n\r\n    // Callback when there's a change to the set of selected providers\r\n    private onSelectedProvidersChanged(selectedIndices: number[], event: React.SyntheticEvent<any>): void {\r\n        this.providersListItemSelectorActions.SelectionChanged.getActionSender(this.store)(selectedIndices);\r\n\r\n        const imageProviders: IFilterItemOptionsList = this.buildImageProviderFilterOptions(selectedIndices);\r\n\r\n        this.saveQueryFilterSelectionToProfile(imageProviders);\r\n\r\n        this.onSearchInvoked(\"providers\", \"Checkbox\", event);\r\n    }\r\n\r\n    // Callback when user changes the editorial pick filter\r\n    private onEditorialPickOptionChanged(selectedIndices: number[], event: React.SyntheticEvent<any>): void {\r\n        this.editorialPickListItemSelectorActions.SelectionChanged.getActionSender(this.store)(selectedIndices);\r\n\r\n        const editorialPickFilter: IFilterItemOptionsList = this.buildEditorialPickFilterOptions(selectedIndices);\r\n\r\n        this.saveQueryFilterSelectionToProfile(editorialPickFilter);\r\n\r\n        this.onSearchInvoked(\"editorialPick\", \"Checkbox\", event);\r\n    }\r\n\r\n    // Callback when there's a change to the set of selected orientations\r\n    private onSelectedOrientationsChanged(selectedIndices: number[], event: React.SyntheticEvent<any>): void {\r\n        this.orientationsListItemSelectorActions.SelectionChanged.getActionSender(this.store)(selectedIndices);\r\n\r\n        const imageOrientations: IFilterItemOptionsList = this.buildOrientationsFilterOptions(selectedIndices);\r\n        this.saveQueryFilterSelectionToProfile(imageOrientations);\r\n\r\n        this.onSearchInvoked(\"orientations\", \"Checkbox\", event);\r\n    }\r\n\r\n    // Callback when the Head Shots selection changes\r\n    private onHeadShotsSelectionChanged(selectedIndices: number[], event: React.SyntheticEvent<any>): void {\r\n        this.headShotsListItemSelectorActions.SelectionChanged.getActionSender(this.store)(selectedIndices);\r\n\r\n        const headShotsOptions = this.buildHeadShotsFilterOptions(selectedIndices);\r\n        this.saveQueryFilterSelectionToProfile(headShotsOptions);\r\n\r\n        this.onSearchInvoked(\"headShots\", \"Checkbox\", event);\r\n    }\r\n\r\n    // Callback when there's a change to the set of selected collections\r\n    private onSelectedCollectionsChanged(selectedIndices: number[], event: React.SyntheticEvent<any>): void {\r\n        this.collectionListItemSelectorActions.SelectionChanged.getActionSender(this.store)(selectedIndices);\r\n\r\n        const collections = this.buildCollectionFilterOptions(selectedIndices);\r\n        this.saveQueryFilterSelectionToProfile(collections);\r\n\r\n        this.onSearchInvoked(\"collection\", \"Checkbox\", event);\r\n    }\r\n\r\n    // Callback when there's a change to the set of selected people filter options\r\n    private onSelectedPeopleFiltersChanged(selectedIndices: number[], event: React.SyntheticEvent<any>): void {\r\n        this.peopleFilterListItemSelectorActions.SelectionChanged.getActionSender(this.store)(selectedIndices);\r\n\r\n        const peopleFilters = this.buildPeopleFilterOptions(selectedIndices);\r\n        this.saveQueryFilterSelectionToProfile(peopleFilters);\r\n\r\n        this.onSearchInvoked(\"people\", \"Checkbox\", event);\r\n    }\r\n\r\n    // Callback when the selected predefined date range has changed\r\n    private onSelectedDateRangeOptionChanged(selectedIndex: number, event: React.SyntheticEvent<any>): void {\r\n        this.dateRangeOptionsListItemSelectorActions.SelectionChanged.getActionSender(this.store)([selectedIndex]);\r\n\r\n        const dateRangeOption: IFilterItemOptionsList = this.buildDateRangeFilterOptions(selectedIndex);\r\n        this.saveQueryFilterSelectionToProfile(dateRangeOption);\r\n\r\n        this.onSearchInvoked(\"date\", \"Dropdown\", event);\r\n    }\r\n\r\n    // Callback when one of the dates in the custom date range has changed\r\n    private onDateInCustomDateRangeChanged(whichEndOfTheRange: DateRangeBoundaryIdentifier, date: Date, event: React.SyntheticEvent<any>): void {\r\n        this.dateRangeSelectorActions.DateRangeBoundaryChanged.getActionSender(this.store)(whichEndOfTheRange, date);\r\n\r\n        this.onSearchInvoked(\"date\", \"DatePicker\", event);\r\n    }\r\n\r\n    /* Returns the function that embeds the logic to execute when the search is triggered on the \"SearchAndSelect\" page.\r\n     * @method\r\n     * @param {string} control - Identifier for the control that has instigated the search. Used as the element title in the event data when creating the telemetry.\r\n     * @param {string} controlType - The type of the control that has instigated the search. This, combined with control, forms the elementId in the event data when creating the telemetry.\r\n     * @param {React.SyntheticEvent<any>} event - The event that triggered the handler.\r\n     */\r\n    private onSearchInvoked(control: string, controlType: string, event: React.SyntheticEvent<any>): void {\r\n        Actions.SearchAndSelect.SearchResultsScrollPositionActions.SaveScrollPosition.getActionSender(this.store)(0);\r\n        this.searchBootstrapper.onSearchInvoked(control, controlType, event);\r\n\r\n        this.onEditorialSearchExecutedHandlers.forEach(handler => handler());\r\n    }\r\n\r\n    // Callback when the sort order changes\r\n    private onSelectedSortOrderChanged(selectedOrder: number, event: React.SyntheticEvent<any>): void {\r\n        let editorialResultView = Global.userProfile.editorialResultView || {};\r\n        editorialResultView[\"sortOrder\"] = SortOrderOptions[selectedOrder].displayName;\r\n        ccsdk.userProfileManagers.prose.setSetting(\"editorialResultView\", editorialResultView);\r\n\r\n        this.sortOrderListItemSelectorActions.SelectionChanged.getActionSender(this.store)([selectedOrder]);\r\n\r\n        this.onSearchInvoked(\"sortBy\", \"Dropdown\", event);\r\n    }\r\n\r\n    /**\r\n     * Builds the sort order from the current state\r\n     * @method\r\n     * @param state: { IListItemSelectorState} The sort order part of the state\r\n     * @returns { IOrderByItem[] } The\r\n     */\r\n    private buildSortOrder(state: IListItemSelectorState<number>): IOrderByItem[] {\r\n        let orderBy: IOrderByItem[] = [];\r\n\r\n        const selectedSortOrder = state.selectedItems.length > 0 ?\r\n            state.selectedItems[0] :\r\n            0;\r\n\r\n        if (!isNil(SortOrderOptions[selectedSortOrder].orderByItem)) {\r\n            orderBy.push(SortOrderOptions[selectedSortOrder].orderByItem);\r\n        }\r\n        return orderBy;\r\n    }\r\n\r\n    /**\r\n     * Builds the filter from the current state\r\n     * @method\r\n     * @param state: { ISearchAndSelectState<IEntityListState>} The State of the SearchAndSelect\r\n     * @returns { Predicate } the predicate to build the filter query\r\n     */\r\n    private buildFilter(state: ISearchAndSelectState<IEntityListState>): Predicate {\r\n\r\n        let filters: IQueryBuilderRuleInfo[] = [];\r\n\r\n        if (state.selectedProviders.selectedItems.length > 0 &&\r\n            state.selectedProviders.selectedItems.length < this.filterRules.providers.values.length) {\r\n            // If none or all providers are selected, don't include them for the purposes of building the filter.\r\n\r\n            let selectedProviders = state.selectedProviders.selectedItems.map(index => this.filterRules.providers.values[index].value);\r\n\r\n            filters.push({\r\n                filterRule: this.filterRules.providers,\r\n                filterValues: selectedProviders as string[]\r\n            });\r\n        }\r\n\r\n        const selectedOrientations = state.selectedOrientations.selectedItems.map(index => this.filterRules.orientations.values[index].value);\r\n        if (selectedOrientations.length > 0) {\r\n            filters.push({\r\n                filterRule: this.filterRules.orientations,\r\n                filterValues: selectedOrientations as string[]\r\n            });\r\n        }\r\n\r\n        if (state.headShotsSelectionState.selectedItems.length > 0) {\r\n            filters.push({\r\n                filterRule: this.filterRules.headShots\r\n            });\r\n        }\r\n\r\n        const selectedPeopleFilters = state.selectedPeopleFilters.selectedItems.map(index => {\r\n            const values = this.filterRules.people.values as IFieldNumberValue[];\r\n            const { value, comparisonOperator } = values[index];\r\n            return { value, comparisonOperator };\r\n        });\r\n        if (selectedPeopleFilters.length > 0) {\r\n            filters.push({\r\n                filterRule: this.filterRules.people,\r\n                filterValues: selectedPeopleFilters as INumberFilter[]\r\n            });\r\n        }\r\n\r\n        let dateRange: DateRange = this.buildDateRangeForQuery(state);\r\n        if (dateRange !== null) {\r\n            filters.push({\r\n                filterRule: this.filterRules.displayPublishedDate,\r\n                from: dateRange.From,\r\n                to: dateRange.To\r\n            });\r\n        }\r\n\r\n        return QueryBuilder.BuildFilter(filters);\r\n    }\r\n\r\n    /**\r\n     * Gets the search match criteria based on the querytext present in the current state\r\n     * @method\r\n     * @param state: { ISearchAndSelectState<IEntityListState>} The State of the SearchAndSelect\r\n     * @returns { SearchQueryMatchCriteria } the search match criteria\r\n     */\r\n    private getSearchMatchCriteria(state: ISearchAndSelectState<IEntityListState>): SearchQueryMatchCriteria {\r\n        return !!state.entitySearchState.searchText ? new SearchQueryMatchCriteria(SearchQueryMatchCriteriaMode.All) : undefined;\r\n    }\r\n\r\n    /**\r\n     * Builds the querytext from the current state\r\n     * @method\r\n     * @param state: { ISearchAndSelectState<IEntityListState>} The State of the SearchAndSelect\r\n     * @returns { string } the query text\r\n     */\r\n    private buildQueryText(state: ISearchAndSelectState<IEntityListState>): string {\r\n        let filters: IQueryBuilderRuleInfo[] = [];\r\n\r\n        const selectedCollections = state.selectedCollections.selectedItems.map(index => this.filterRules.collection.values[index].value);\r\n        if (selectedCollections.length > 0) {\r\n            filters.push({\r\n                filterRule: this.filterRules.collection,\r\n                filterValues: selectedCollections as string[]\r\n            });\r\n        }\r\n\r\n        const selectedEditorialPicks = state.selectedTopEditorialImageOption.selectedItems.map(index => this.filterRules.editorspick.values[index].value);\r\n        if (selectedEditorialPicks.length > 0) {\r\n            filters.push({\r\n                filterRule: this.filterRules.editorspick,\r\n                filterValues: selectedEditorialPicks as string[]\r\n            });\r\n        }\r\n        const textForFilter = QueryBuilder.BuildQueryTextFilter(filters);\r\n        let queryText = state.entitySearchState.searchText;\r\n\r\n        if (!isEmpty(state.entitySearchState.searchText) &&\r\n            !isEmpty(textForFilter)) {\r\n            queryText = state.entitySearchState.searchText + \" \" + textForFilter;\r\n        } else if (isEmpty(state.entitySearchState.searchText)) {\r\n            queryText = textForFilter;\r\n        }\r\n\r\n        return queryText;\r\n    }\r\n\r\n    /**\r\n     * Builds the DateRange for the query based on the currently selected date range option\r\n     * @method\r\n     * @param state: { ISearchAndSelectState<IEntityListState>} The State of the SearchAndSelect\r\n     * @returns { DateRange } the date range for the filter query\r\n     */\r\n    private buildDateRangeForQuery(state: ISearchAndSelectState<IEntityListState>): DateRange {\r\n        let dateRange: DateRange = null;\r\n\r\n        let selectedDateRangeOptionIndex = state.selectedDateRangeOption.selectedItems[0];\r\n        if ((selectedDateRangeOptionIndex >= 0) && (selectedDateRangeOptionIndex < DateRangeOptions.length)) {\r\n            let selectedOption = DateRangeOptions[selectedDateRangeOptionIndex];\r\n            if (selectedOption.rangeOptionType === DateRangeOptionType.durationInHours) {\r\n                dateRange = DateRange.FromDateAndHours(new Date(Date.now()), -selectedOption.hours);\r\n            } else if (selectedOption.rangeOptionType === DateRangeOptionType.custom) {\r\n                if (!!state.customDateRange && !!state.customDateRange.startDate && !!state.customDateRange.endDate) {\r\n                    // When constructing the custom date range for the query we do not want to include time values.\r\n                    // So, here set the start date and end date time fields to 0 and advance the end date to 0h0m0s of the following day.\r\n                    let startDate: Date = Moment(state.customDateRange.startDate.toISOString()).startOf(\"day\").toDate();\r\n                    let endDate: Date = Moment(state.customDateRange.endDate.toISOString()).add(1, \"days\").startOf(\"day\").toDate();\r\n\r\n                    dateRange = new DateRange(startDate, endDate);\r\n                }\r\n            }\r\n        }\r\n\r\n        return dateRange;\r\n    }\r\n\r\n    // Helper method to build an array of selected values\r\n    private getSelectedValues(allValues: (IFieldStringValue | IFieldNumberValue)[], selectedIndexes: number[]): (string | number)[] {\r\n        let selectedValues: (string | number)[] = [];\r\n\r\n        selectedIndexes.forEach(index => {\r\n            if (index >= 0 && index < allValues.length) {\r\n                selectedValues.push(allValues[index].value);\r\n            }\r\n        });\r\n\r\n        return selectedValues;\r\n    }\r\n\r\n    // Helper to create the right type of modal\r\n    private createModal(modalId: string, state: ISearchAndSelectState<IEntityListState>): React.ReactElement<any> {\r\n\r\n        switch (modalId) {\r\n            case \"ImagePreviewModal\": {\r\n                    return this.createModalCarousel(state);\r\n                }\r\n\r\n            case \"AddToLightboxModal\": {\r\n                    const selectedEntityWithMetadata = state.entityList.entitiesWithMetadata[state.selectedImageEntityIndex] as IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>>;\r\n                    return this.onAddEntityToLightbox(selectedEntityWithMetadata, this.modalProvisioningActions);\r\n                }\r\n\r\n            default:\r\n                return null;\r\n        }\r\n    }\r\n\r\n    // Helper to create the lightbox overlay for carousel modal\r\n    private createCarouselAddToCollectionOverlay(state: ISearchAndSelectState<IEntityListState>): React.ReactElement<any> {\r\n        const selectedEntityWithMetadata = state.entityList.entitiesWithMetadata[state.selectedImageEntityIndex] as IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>>;\r\n        return this.onAddEntityToLightbox(selectedEntityWithMetadata, this.modalProvisioningActions, true);\r\n    }\r\n\r\n    // Helper to create the modal carousel\r\n    private createModalCarousel(state: ISearchAndSelectState<IEntityListState>\r\n    ): React.ReactElement<IModalCarouselProps> {\r\n        return ModalCarousalEventCallbacks.createModalCarousel(\r\n            state,\r\n            this.store,\r\n            PageNames.SearchAndSelect,\r\n            this.imagePreviewModalActions,\r\n            this.modalProvisioningActions,\r\n            this.imageCommandActions,\r\n            this.instrumentationClient,\r\n            state.filterOptionVisibleState.collapsed,\r\n            state.resultsDisplayMode,\r\n            this.downloadImage,\r\n            (_event: React.SyntheticEvent<any>): void => { return; },\r\n            this.catalystSearchManager.SearchActivity.correlationVector,\r\n            this.getLightboxManager,\r\n            this.createCarouselAddToCollectionOverlay(state)\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Get the action input data for Search\r\n     * @method\r\n     * @returns { { [key: string]: string; } } The action input\r\n     */\r\n    private getSearchActionInput(): { [key: string]: string; } {\r\n\r\n        const searchText = this.getCurrentState().entitySearchState.searchText;\r\n        const selectedProviderIds = this.getSelectedValues(this.filterRules.providers.values, this.getCurrentState().selectedProviders.selectedItems);\r\n        const catalystSuggestionSelected = this.getCurrentState().searchWithAutosuggestState.catalystSuggestions.indexOf(searchText) > -1 ? \"true\" : \"false\";\r\n\r\n        const selectedProviders = selectedProviderIds.map(providerId => {\r\n            const providerIndex = findIndex<IProvider>(appConfig.providers, provider => provider.id === providerId);\r\n            return providerIndex >= 0 ? appConfig.providers[providerIndex].name : \"\";\r\n        });\r\n\r\n        const selectedOrientations = this.getSelectedValues(this.filterRules.orientations.values, this.getCurrentState().selectedOrientations.selectedItems);\r\n        const headShotsSelectionState = this.getSelectedValues(this.filterRules.headShots.values, this.getCurrentState().headShotsSelectionState.selectedItems);\r\n        const selectedCollections = this.getSelectedValues(this.filterRules.collection.values, this.getCurrentState().selectedCollections.selectedItems);\r\n        const selectedPeopleFilters = this.getSelectedValues(this.filterRules.people.values, this.getCurrentState().selectedPeopleFilters.selectedItems);\r\n        const selectedEditorialPick = this.getSelectedValues(this.filterRules.editorspick.values, this.getCurrentState().selectedTopEditorialImageOption.selectedItems);\r\n        const selectedDateRangeOption = this.getSelectedValues(this.filterRules.displayPublishedDate.values, this.getCurrentState().selectedDateRangeOption.selectedItems);\r\n        const selectedDateRangeOptionIndex = this.getCurrentState().selectedDateRangeOption.selectedItems[0];\r\n\r\n        let startDateDaysToToday: number = Number.NaN;\r\n        let endDateDaysToToday: number = 0;\r\n\r\n        if (DateRangeOptions[selectedDateRangeOptionIndex].rangeOptionType === DateRangeOptionType.durationInHours) {\r\n            startDateDaysToToday = Math.floor(DateRangeOptions[selectedDateRangeOptionIndex].hours / 24);\r\n        } else if (DateRangeOptions[selectedDateRangeOptionIndex].rangeOptionType === DateRangeOptionType.custom) {\r\n\r\n            const nowTime = Date.now();\r\n\r\n            startDateDaysToToday = Math.floor((nowTime - this.getCurrentState().customDateRange.startDate.getTime()) / SearchAndSelectBootstrapper.MillisecondsInADay);\r\n            endDateDaysToToday = Math.floor((nowTime - this.getCurrentState().customDateRange.endDate.getTime()) / SearchAndSelectBootstrapper.MillisecondsInADay);\r\n        }\r\n\r\n        const selectedSortOrderIndex = this.getCurrentState().selectedSortOrder.selectedItems[0];\r\n        const selectedSortOrderDisplayString = SortOrderOptions[selectedSortOrderIndex].displayName;\r\n\r\n        const actionInput: { [key: string]: string; } = {\r\n            \"searchTerm\": searchText,\r\n            \"providersFilter\": JSON.stringify(selectedProviders),\r\n            \"orientationsFilter\": JSON.stringify(selectedOrientations),\r\n            \"editorialPick\": JSON.stringify(selectedEditorialPick),\r\n            \"headShots\": JSON.stringify(headShotsSelectionState),\r\n            \"collectionsFilter\": JSON.stringify(selectedCollections),\r\n            \"peopleFilter\": JSON.stringify(selectedPeopleFilters),\r\n            \"timeRangeFilter\": JSON.stringify(selectedDateRangeOption),\r\n            \"startDateDaysToToday\": startDateDaysToToday.toString(),\r\n            \"endDateDaysToToday\": endDateDaysToToday.toString(),\r\n            \"sortOrder\": selectedSortOrderDisplayString,\r\n            \"catalystSuggestedSearchTerm\": catalystSuggestionSelected\r\n        };\r\n\r\n        return actionInput;\r\n    }\r\n\r\n    /**\r\n     * Get the action input data for add to lightbox.\r\n     * We capture the same action input as for image selection.\r\n     * @method\r\n     * @returns { { [key: string]: string; } } The action input\r\n     */\r\n    private getAddToLightboxActionInput(entityWithMetadata: IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>>, entityOrder: number): { [key: string]: string; } {\r\n        const state = this.getCurrentState();\r\n        return GetSelectActionInput(entityWithMetadata, entityOrder, state.filterOptionVisibleState.collapsed, state.resultsDisplayMode);\r\n    }\r\n\r\n    /**\r\n     * On Retry button click event to retry the search.\r\n     * @method\r\n     * @param {React.SyntheticEvent<any>} event - The event that triggered the handler.\r\n     */\r\n    private onRetryClicked(_event: React.SyntheticEvent<any>): void {\r\n        const state = this.getCurrentState();\r\n        let continuationToken = state.entityList.continuationToken;\r\n\r\n        // Load more data if more results are available and there is no ongoing request to fetch more data.\r\n        if (continuationToken.moreResultsAvailable && !state.entityList.loading) {\r\n            this.loadMoreData(continuationToken, \"SearchAndSelectBootstrapper.searchNextPageQueryRetry\");\r\n        }\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { ActionMap } from \"cms-ui-redux/ActionMap\";\r\nimport { Button } from \"react-bootstrap\";\r\nimport { NamespacePrefixActionsDefinitionBase } from \"cms-ui-redux/NamespacePrefixActionsDefinitionBase\";\r\n\r\nexport type LocalUserProfileLoadedSignature = () => void;\r\n\r\nexport type ShowAddToLightboxOverlaySignature = (target?: Button) => void;\r\nexport type HideAddToLightboxOverlaySignature = () => void;\r\n\r\n/**\r\n * Exposes a redux action to raise user profile loaded.\r\n * @class\r\n */\r\nexport class SignedInAppActions extends NamespacePrefixActionsDefinitionBase {\r\n    /** Defines the action indicating that the user profile is loaded.\r\n     */\r\n    private localUserProfileLoaded: ActionMap<LocalUserProfileLoadedSignature> = new ActionMap<LocalUserProfileLoadedSignature>(this.namespace + \"LocalUserProfileLoaded\");\r\n\r\n    /**\r\n     * Defines the action to shaw the lightbox overlay.\r\n     */\r\n    private showAddToLightboxOverlay: ActionMap<ShowAddToLightboxOverlaySignature> = new ActionMap<ShowAddToLightboxOverlaySignature>(this.namespace + \"ShowAddToLightboxOverlay\");\r\n\r\n    /**\r\n     * Defines the action to hide the lightbox overlay\r\n     */\r\n    private hideAddToLightboxOverlay: ActionMap<HideAddToLightboxOverlaySignature> = new ActionMap<HideAddToLightboxOverlaySignature>(this.namespace + \"HideAddToLightboxOverlay\");\r\n\r\n    /**\r\n     * Initializes a new instance of the 'SignedInAppActions' class.\r\n     * @constructor\r\n     * @param namespacePrefix {string} Optional prefix to add to the namespace used to distinguish between different instances of this data flow.\r\n     */\r\n    constructor(namespacePrefix?: string) {\r\n        super(\"SignedInApp\", namespacePrefix);\r\n    }\r\n\r\n    /** Accessor for the user profile loaded action.\r\n     * @type {ActionMap<LocalUserProfileLoadedSignature>}\r\n     */\r\n    public get LocalUserProfileLoaded(): ActionMap<LocalUserProfileLoadedSignature> {\r\n        return this.localUserProfileLoaded;\r\n    }\r\n\r\n    /**\r\n     * Accessor for the show the add to lightbox overlay action\r\n     * @type {ActionMap<ShowAddToLightboxOverlaySignature>}\r\n     */\r\n    public get ShowAddToLightboxOverlay(): ActionMap<ShowAddToLightboxOverlaySignature> {\r\n        return this.showAddToLightboxOverlay;\r\n    }\r\n\r\n    /**\r\n     * Accessor for the hide the add to lightbox overlay action\r\n     * @type {ActionMap<HideAddToLightboxOverlaySignature>}\r\n     */\r\n    public get HideAddToLightboxOverlay(): ActionMap<HideAddToLightboxOverlaySignature> {\r\n        return this.hideAddToLightboxOverlay;\r\n    }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport { ActionHandler } from \"cms-ui-redux/ActionHandler\";\r\nimport { Button } from \"react-bootstrap\";\r\nimport { EntityListReduction } from \"cms-ui-presentationlogic/dataflows/entityList/EntityListReduction\";\r\nimport { IActionPayload } from \"cms-ui-redux/IActionPayload\";\r\nimport { IAppHeaderState } from \"./presentation-logic/dataflows/appHeaderSection/IAppHeaderState\";\r\nimport { ICreativeImageSearchState } from \"./presentation-logic/dataflows/creativeSearch/ICreativeImageSearchState\";\r\nimport { IEntityListState } from \"cms-ui-presentationlogic/dataflows/entityList/IEntityListState\";\r\nimport { IImageDetailsPageState } from \"./presentation-logic/dataflows/imageDetails/IImageDetailsPageState\";\r\nimport { IImageLoadingPerfCountersState } from \"./presentation-logic/dataflows/performanceCounters/IImageLoadingPerfCountersState\";\r\nimport { ILightboxPageBootstrapperState } from \"./presentation-logic/dataflows/lightboxPage/ILightboxPageBootstrapperState\";\r\nimport { ILightboxProfileInfo } from \"./models/lightbox/ILightboxProfileInfo\";\r\nimport { IMessageBoxModalState } from \"./presentation-logic/dataflows/messageBoxModal/IMessageBoxModalState\";\r\nimport { IReducer } from \"cms-ui-redux/IReducer\";\r\nimport { ISearchAndSelectState } from \"./presentation-logic/dataflows/searchAndSelect/ISearchAndSelectState\";\r\nimport { ISignedInAppState } from \"./ISignedInAppState\";\r\nimport { LightboxActions } from \"./presentation-logic/dataflows/lightbox/LightboxActions\";\r\nimport { ListItemSelectorActions } from \"./presentation-logic/dataflows/listItemSelector/ListItemSelectorActions\";\r\nimport { NamespaceCheckReducerBase } from \"cms-ui-redux/NamespaceCheckReducerBase\";\r\nimport { NotificationType } from \"cms-ui-components/notifications/notification/NotificationType\";\r\nimport { SignedInAppActions } from \"./SignedInAppActions\";\r\nimport { clone } from \"lodash-es\";\r\n\r\n/**\r\n * The top-level redux reducer for the Signed In application. Delegates reduction to appropriate children reducers.\r\n * @class\r\n */\r\nexport class SignedInAppReducer<TAppState extends ISignedInAppState> extends NamespaceCheckReducerBase<TAppState> {\r\n    /**\r\n     * Initializes a new instance of the `SignedInAppReducer` class.\r\n     * @constructor\r\n     */\r\n    constructor(\r\n        public signedInAppActions: SignedInAppActions,\r\n        public lightboxListItemSelectorActions: ListItemSelectorActions<ILightboxProfileInfo>,\r\n        private appHeaderReducer: IReducer<IAppHeaderState>,\r\n        private searchAndSelectReducer: IReducer<ISearchAndSelectState<IEntityListState>>,\r\n        private applicationErrorsReducer: IReducer<any>,\r\n        private creativePageReducer: IReducer<ICreativeImageSearchState>,\r\n        private lightboxPageBootstrapperReducer: IReducer<ILightboxPageBootstrapperState>,\r\n        private lightboxActions: LightboxActions,\r\n        private lightboxEntityListReduction: EntityListReduction<IEntityListState>,\r\n        private imageDetailsPageReduction: IReducer<IImageDetailsPageState>,\r\n        private imageLoadingTelemetryReduction: IReducer<IImageLoadingPerfCountersState>,\r\n        private errorMessageBoxReduction: IReducer<IMessageBoxModalState>\r\n    ) {\r\n        super(\r\n            [signedInAppActions.namespace,\r\n            lightboxListItemSelectorActions.namespace,\r\n            lightboxActions.namespace],\r\n            [appHeaderReducer,\r\n                searchAndSelectReducer,\r\n                applicationErrorsReducer,\r\n                creativePageReducer,\r\n                lightboxPageBootstrapperReducer,\r\n                lightboxEntityListReduction,\r\n                imageDetailsPageReduction,\r\n                imageLoadingTelemetryReduction,\r\n                errorMessageBoxReduction\r\n            ]);\r\n\r\n        if (!signedInAppActions) {\r\n            throw \"The signedInAppActions parameter is required.\";\r\n        }\r\n\r\n        if (!lightboxListItemSelectorActions) {\r\n            throw \"The signedInAppActions parameter is required.\";\r\n        }\r\n\r\n        if (!appHeaderReducer) {\r\n            throw \"The appHeaderReducer parameter is required.\";\r\n        }\r\n\r\n        if (!searchAndSelectReducer) {\r\n            throw \"The searchAndSelectReducer parameter is required.\";\r\n        }\r\n\r\n        if (!applicationErrorsReducer) {\r\n            throw \"The applicationErrorsReducer parameter is required.\";\r\n        }\r\n\r\n        if (!creativePageReducer) {\r\n            throw \"The creativePageReducer parameter is required.\";\r\n        }\r\n\r\n        if (!lightboxPageBootstrapperReducer) {\r\n            throw \"The lightboxPageBootstrapperReducer parameter is required.\";\r\n        }\r\n\r\n        if (!lightboxEntityListReduction) {\r\n            throw \"The lightboxEntityListReduction parameter is required.\";\r\n        }\r\n\r\n        if (!imageDetailsPageReduction) {\r\n            throw \"The imageDetailsPageReduction parameter is required.\";\r\n        }\r\n\r\n        if (!imageLoadingTelemetryReduction) {\r\n            throw \"The imageLoadingTelemetryReduction parameter is required.\";\r\n        }\r\n    }\r\n\r\n    public reduce(state: TAppState, actionPayload: IActionPayload): TAppState {\r\n\r\n        if (!state) {\r\n            throw \"The state parameter is required.\";\r\n        }\r\n\r\n        if (!actionPayload) {\r\n            throw \"The actionPayload parameter is required.\";\r\n        }\r\n\r\n        let newState = clone(state);\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.signedInAppActions.LocalUserProfileLoaded, () => {\r\n                newState.localUserProfileIsLoading = false;\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.signedInAppActions.ShowAddToLightboxOverlay, (target: Button) => {\r\n                newState.addToLightboxOverlayIsVisible = true;\r\n                newState.addToLightboxOverlayTarget = target;\r\n                return newState;\r\n            }\r\n        );\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.signedInAppActions.HideAddToLightboxOverlay, () => {\r\n                newState.addToLightboxOverlayIsVisible = false;\r\n                newState.addToLightboxOverlayTarget = null;\r\n                return newState;\r\n            }\r\n        );\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.lightboxActions.RemovingLightbox, (lightboxId: string) => {\r\n                newState.lightboxState = { ...newState.lightboxState, operationPending: true };\r\n                // Make sure that the lightbox being deleted is removed from the selectedItems, if it is present\r\n                if (newState.lightboxState.activeLightboxId === lightboxId) {\r\n                    newState.lightboxState.activeLightboxId = \"\";\r\n                }\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.lightboxActions.UpdatedLightbox, (lightboxes: ILightboxProfileInfo[]) => {\r\n                newState.lightboxState = { ...newState.lightboxState, operationPending: false };\r\n                newState.lightboxState.myLightboxes = lightboxes;\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.lightboxActions.AddingLightbox, (_lightboxName: string) => {\r\n                newState.lightboxState = { ...newState.lightboxState, operationPending: true };\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.lightboxActions.AddedLightboxAndSetActive, (lightboxSummaryInfo: ILightboxProfileInfo, lightboxes: ILightboxProfileInfo[]) => {\r\n                newState.lightboxState = { ...newState.lightboxState, operationPending: false };\r\n                newState.lightboxState.myLightboxes = lightboxes;\r\n                newState.lightboxState.activeLightboxId = lightboxSummaryInfo.id;\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.lightboxActions.AddingItemsToLightbox, (_lightboxId: string) => {\r\n                newState.lightboxState = { ...newState.lightboxState, operationPending: true };\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.lightboxActions.RemovingItemsFromLightbox, (_lightboxId: string) => {\r\n                newState.lightboxState = { ...newState.lightboxState, operationPending: true };\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.lightboxActions.AddedItemsToLightbox, (_lightboxId: string) => {\r\n                newState.lightboxState = { ...newState.lightboxState, operationPending: false };\r\n                newState.addToLightboxOverlayIsVisible = false;\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.lightboxActions.RemovedItemsFromLightbox, (_lightboxId: string) => {\r\n                newState.lightboxState = { ...newState.lightboxState, operationPending: false };\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.lightboxActions.OperationFailed, (errType: NotificationType, title: string, detail: string, prefix: string) => {\r\n                newState.lightboxState = {\r\n                    ...newState.lightboxState,\r\n                    operationPending: false,\r\n                    lastOperationNotification: {\r\n                        itemType: errType,\r\n                        titlePrefix: prefix,\r\n                        title,\r\n                        detail,\r\n                        expanded: false\r\n                    }\r\n                };\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.lightboxActions.ClearNotification, () => {\r\n                newState.lightboxState = { ...newState.lightboxState };\r\n                newState.lightboxState.lastOperationNotification = undefined;\r\n                return newState;\r\n            });\r\n\r\n        ActionHandler.handleAction(\r\n            actionPayload, this.lightboxActions.SetLightboxActive, (lightboxId: string) => {\r\n                // Make the lightbox the selected lightbox\r\n                newState.lightboxState.activeLightboxId = lightboxId;\r\n                return newState;\r\n            });\r\n\r\n        // delegate user authentication state mutation to its reducer\r\n        if (this.appHeaderReducer.canReduce(actionPayload)) {\r\n            newState.appHeaderSectionState = this.appHeaderReducer.reduce(state.appHeaderSectionState, actionPayload);\r\n        }\r\n\r\n        // delegate search and select state mutation to its reducer\r\n        if (this.searchAndSelectReducer.canReduce(actionPayload)) {\r\n            newState.searchAndSelectState = this.searchAndSelectReducer.reduce(state.searchAndSelectState, actionPayload);\r\n        }\r\n\r\n        if (this.applicationErrorsReducer.canReduce(actionPayload)) {\r\n            newState.applicationError = this.applicationErrorsReducer.reduce(state.applicationError, actionPayload);\r\n        }\r\n\r\n        if (this.creativePageReducer.canReduce(actionPayload)) {\r\n            newState.creativeSearchState = this.creativePageReducer.reduce(state.creativeSearchState, actionPayload);\r\n        }\r\n\r\n        if (this.imageDetailsPageReduction.canReduce(actionPayload)) {\r\n            newState.imageDetailsPageState = this.imageDetailsPageReduction.reduce(state.imageDetailsPageState, actionPayload);\r\n        }\r\n\r\n        if (this.lightboxPageBootstrapperReducer.canReduce(actionPayload)) {\r\n            const stateToReduce: ILightboxPageBootstrapperState = {\r\n                lightboxState: state.lightboxState,\r\n                lightboxPageState: state.lightboxPageState\r\n            };\r\n            newState.lightboxPageState = this.lightboxPageBootstrapperReducer.reduce(stateToReduce, actionPayload).lightboxPageState;\r\n        }\r\n\r\n        if (this.lightboxEntityListReduction.canReduce(actionPayload)) {\r\n            newState.lightboxState = { ...newState.lightboxState };\r\n            newState.lightboxState.lightboxEntitiesState = this.lightboxEntityListReduction.reduce(state.lightboxState.lightboxEntitiesState, actionPayload);\r\n        }\r\n\r\n        if (this.imageLoadingTelemetryReduction.canReduce(actionPayload)) {\r\n            newState.performanceCounters.editorialSearchImageLoadingTimes =\r\n                this.imageLoadingTelemetryReduction.reduce(state.performanceCounters.editorialSearchImageLoadingTimes, actionPayload);\r\n        }\r\n\r\n        if (this.errorMessageBoxReduction.canReduce(actionPayload)) {\r\n            newState.errorMessageBoxState = this.errorMessageBoxReduction.reduce(state.errorMessageBoxState, actionPayload);\r\n        }\r\n\r\n        return newState;\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as React from \"react\";\r\n\r\nimport { AreaOfPage, PageNames } from \"./instrumentation/instrumentationConstants/InstrumentationConstants\";\r\nimport { ResizeService, ResizeServiceMode } from \"./common/resizeService\";\r\nimport { isEmpty, isNil } from \"lodash-es\";\r\n\r\nimport { AddToCollectionModal } from \"cms-ui-components/addToCollectionModal/AddToCollectionModal\";\r\nimport { AddToLightboxOverlay } from \"./rendering/components/addToLightboxOverlay/AddToLightboxOverlay\";\r\nimport { AppConstants } from \"./AppConstants\";\r\nimport { AppErrorConverter } from \"./common/appErrorConverter\";\r\nimport { AppHeaderSectionBootstrapper } from \"./experiences/appHeaderSection/AppHeaderSectionBootstrapper\";\r\nimport { ApplicationErrorActions } from \"cms-ui-presentationlogic/dataflows/applicationError/ApplicationErrorActions\";\r\nimport { ApplicationErrorReducer } from \"cms-ui-presentationlogic/dataflows/applicationError/ApplicationErrorReduction\";\r\nimport { Button } from \"react-bootstrap\";\r\nimport { CatalystManagerFactory } from \"clientcore-catalyst-businesslogic/CatalystManagerFactory\";\r\nimport { CatalystSearchManager } from \"./experiences/catalystSearch/CatalystSearchManager\";\r\nimport { ComponentBootstrapper } from \"cms-ui-views/ComponentBootstrapper\";\r\nimport { CreativeProvider } from \"clientcore-catalyst-businesslogic/creativeSearch/CreativeProvider\";\r\nimport { CreativeSearchPageBootstrapper } from \"./experiences/creativeSearch/CreativeSearchPageBootstrapper\";\r\nimport { EntityListActions } from \"cms-ui-presentationlogic/dataflows/entityList/EntityListActions\";\r\nimport { EntityListReduction } from \"cms-ui-presentationlogic/dataflows/entityList/EntityListReduction\";\r\nimport { FixedPageSizePagedCollectionBootstrapper } from \"cms-ui-views/paging/FixedPageSizePagedCollectionBootstrapper\";\r\nimport { Global } from \"./Global\";\r\nimport { IAddToLightboxOverlayProps } from \"./rendering/components/addToLightboxOverlay/IAddToLightboxOverlayProps\";\r\nimport { IAppHeaderState } from \"./presentation-logic/dataflows/appHeaderSection/IAppHeaderState\";\r\nimport { ICatalystFileDataMetadata } from \"clientcore-models-catalyst/ICatalystFileDataMetadata\";\r\nimport { ICatalystSearchManager } from \"./experiences/catalystSearch/ICatalystSearchManager\";\r\nimport { ICollectionInformation } from \"cms-ui-components/manageCollection/ICollectionInformation\";\r\nimport { ICollectionInformationWithSelectionState } from \"cms-ui-components/manageCollection/ICollectionInformationWithSelectionState\";\r\nimport { ICreativeImage } from \"clientcore-catalyst-businesslogic/creativeSearch/ICreativeImage\";\r\nimport { ICreativeImageSearchManager } from \"clientcore-catalyst-businesslogic/creativeSearch/ICreativeImageSearchManager\";\r\nimport { ICreativeImageSearchState } from \"./presentation-logic/dataflows/creativeSearch/ICreativeImageSearchState\";\r\nimport { IEntity } from \"cms-models/IEntity\";\r\nimport { IEntityListState } from \"cms-ui-presentationlogic/dataflows/entityList/IEntityListState\";\r\nimport { IEntityWithMetadata } from \"cms-businesslogic/entity/IEntityWithMetadata\";\r\nimport { IImageAcquisitionManager } from \"clientcore-catalyst-businesslogic/IImageAcquisitionManager\";\r\nimport { IImageDetailsPageState } from \"./presentation-logic/dataflows/imageDetails/IImageDetailsPageState\";\r\nimport { IImageFileData } from \"cms-models/IImageFileData\";\r\nimport { IInstrumentationClient } from \"./instrumentation/instrumentationClient/IInstrumentationClient\";\r\nimport { ILightboxManager } from \"./experiences/lightbox/ILightboxManager\";\r\nimport { ILightboxPageBootstrapperState } from \"./presentation-logic/dataflows/lightboxPage/ILightboxPageBootstrapperState\";\r\nimport { ILightboxProfileInfo } from \"./models/lightbox/ILightboxProfileInfo\";\r\nimport { IManageCollectionProps } from \"cms-ui-components/manageCollection/IManageCollectionProps\";\r\nimport { IMessageBoxModalState } from \"./presentation-logic/dataflows/messageBoxModal/IMessageBoxModalState\";\r\nimport { IReducer } from \"cms-ui-redux/IReducer\";\r\nimport { ISearchAndSelectState } from \"./presentation-logic/dataflows/searchAndSelect/ISearchAndSelectState\";\r\nimport { ISignedInAppProps } from \"./ISignedInAppProps\";\r\nimport { ISignedInAppState } from \"./ISignedInAppState\";\r\nimport { ImageCommandActions } from \"./presentation-logic/dataflows/imageCommand/ImageCommandActions\";\r\nimport { ImageDetailsPageBootstrapper } from \"./experiences/imageDetails/ImageDetailsPageBootstrapper\";\r\nimport { ImageLoadingPerfCountersReducer } from \"./presentation-logic/dataflows/performanceCounters/ImageLoadingPerfCountersReducer\";\r\nimport { ImagePreviewModalActions } from \"./presentation-logic/dataflows/imagePreviewModal/ImagePreviewModalActions\";\r\nimport { LightboxActionCreator } from \"./presentation-logic/dataflows/lightbox/LightboxActionCreator\";\r\nimport { LightboxActions } from \"./presentation-logic/dataflows/lightbox/LightboxActions\";\r\nimport { LightboxManager } from \"./experiences/lightbox/LightboxManager\";\r\nimport { LightboxPageBootstrapper } from \"./experiences/lightbox/LightboxPageBootstrapper\";\r\nimport { LightboxUserProfileManager } from \"./experiences/lightbox/LightboxUserProfileManager\";\r\nimport { ListItemSelectorActions } from \"./presentation-logic/dataflows/listItemSelector/ListItemSelectorActions\";\r\nimport { LoadLightboxSourceEnum } from \"./experiences/lightbox/LoadLightboxSourceEnum\";\r\nimport { MessageBoxModalBootstrapper } from \"./experiences/messageBoxModal/MessageBoxModalBootstrapper\";\r\nimport { ModalProvisioningActions } from \"cms-ui-presentationlogic/dataflows/modalProvisioning/ModalProvisioningActions\";\r\nimport { OneSrvBusinessLogicFactory } from \"clientcore-onesrv-businesslogic/factory/OneSrvBusinessLogicFactory\";\r\nimport { PageActionData } from \"cms-businesslogic/instrumentation/PageActionData\";\r\nimport { PagingActions } from \"cms-ui-presentationlogic/dataflows/paging/PagingActions\";\r\nimport { SearchActionCreator } from \"cms-ui-presentationlogic/dataflows/entityList/SearchActionCreator\";\r\nimport { SearchAndSelectBootstrapper } from \"./experiences/searchAndSelect/SearchAndSelectBootstrapper\";\r\nimport { SectionListSearchScopeOptions } from \"cms-ui-presentationlogic/dataflows/entityList/SectionListSearchScopeOptions\";\r\nimport { SignedInAppActions } from \"./SignedInAppActions\";\r\nimport { SignedInAppReducer } from \"./SignedInAppReducer\";\r\nimport { appConfig } from \"appConfig\";\r\nimport { authenticationManager } from \"./globals/authentication\";\r\nimport { ccsdk } from \"./globals/ccsdk\";\r\nimport { serviceErrorParsers } from \"./globals/CatalystServiceErrorParser\";\r\n\r\n/**\r\n * Bootstrapper for the Signed In application.\r\n * @class\r\n */\r\nexport class SignedInAppBootstrapper extends ComponentBootstrapper<ISignedInAppState, ISignedInAppProps, null> {\r\n\r\n    /** Signed in app actions\r\n     * @type {SignedInAppActions}\r\n     */\r\n    private signedInAppActions: SignedInAppActions = new SignedInAppActions();\r\n\r\n    public get SearchAndSelectBootstrap(): SearchAndSelectBootstrapper<ISignedInAppState> {\r\n        return this.searchAndSelectBootstrap;\r\n    }\r\n\r\n    public get AppHeaderSectionBootstrap(): AppHeaderSectionBootstrapper<ISignedInAppState> {\r\n        return this.appHeaderSectionBootstrap;\r\n    }\r\n\r\n    public get CreativeSearchPageBootstrap(): CreativeSearchPageBootstrapper<ISignedInAppState> {\r\n        return this.creativeSearchPageBootstrap;\r\n    }\r\n\r\n    public get LightboxPageBootstrap(): LightboxPageBootstrapper<ISignedInAppState> {\r\n        return this.lightboxPageBootstrap;\r\n    }\r\n\r\n    public get ImageDetailsPageBootstrap(): ImageDetailsPageBootstrapper<ISignedInAppState> {\r\n        return this.imageDetailsPageBootstrap;\r\n    }\r\n\r\n    public get ErrorMessageBoxBootstrap(): MessageBoxModalBootstrapper<ISignedInAppState> {\r\n        return this.errorMessageBoxBootstrap;\r\n    }\r\n\r\n    /**\r\n     * The CreativeSearchPageBootstrapper bootstrapper.\r\n     * @type {CreativeSearchPageBootstrapper<ISignedInAppState>}\r\n     */\r\n    private creativeSearchPageBootstrap: CreativeSearchPageBootstrapper<ISignedInAppState>;\r\n\r\n    /**\r\n     * The LightboxPageBootstrapper bootstrapper.\r\n     * @type {LightboxPageBootstrapper<ISignedInAppState>}\r\n     */\r\n    private lightboxPageBootstrap: LightboxPageBootstrapper<ISignedInAppState>;\r\n\r\n    /**\r\n     * The AppHeaderSectionBootstrapper bootstrapper.\r\n     * @type {AppHeaderSectionBootstrapper<ISignedOutAppState>}\r\n     */\r\n    private appHeaderSectionBootstrap: AppHeaderSectionBootstrapper<ISignedInAppState>;\r\n\r\n    /**\r\n     * The SearchAndSelectBootstrap bootstrapper.\r\n     * @type {SearchAndSelectBootstrap<ISignedInAppState>}\r\n     */\r\n    private searchAndSelectBootstrap: SearchAndSelectBootstrapper<ISignedInAppState>;\r\n\r\n    /**\r\n     * Image details bootstraper shown at modal carousel.\r\n     * @type {ImageDetailsPageBootstrapper<ISignedInAppState>}\r\n     */\r\n    private imageDetailsPageBootstrap: ImageDetailsPageBootstrapper<ISignedInAppState>;\r\n\r\n    /**\r\n     * Common error message box bootstraper.\r\n     * @type {MessageBoxModalBootstrapper<ISignedInAppState>}\r\n     */\r\n    private errorMessageBoxBootstrap: MessageBoxModalBootstrapper<ISignedInAppState>;\r\n\r\n    /**\r\n     * Catalyst search manager.\r\n     * @type {ICatalystSearchManager}\r\n     */\r\n    private catalystSearchManager: ICatalystSearchManager;\r\n\r\n    /**\r\n     * Global application error actions.\r\n     * @type {ApplicationErrorActions}\r\n     */\r\n    private applicationErrorActions: ApplicationErrorActions;\r\n\r\n    /** An instance of the `ListItemSelectorActions` class for dealing with the selected collections.\r\n     * @type {ListItemSelectorActions<ILightboxProfileInfo>}\r\n     */\r\n    private lightboxListItemSelectorActions: ListItemSelectorActions<ILightboxProfileInfo>;\r\n\r\n    /** The lightbox profile manager */\r\n    private lightboxUserProfileManager: LightboxUserProfileManager;\r\n\r\n    /** The lightbox actions */\r\n    private lightboxActions: LightboxActions;\r\n\r\n    /** Actions for managing the retrieval of the lightbox entity's information from the CMS by ID */\r\n    private lightboxGetEntityListActions: EntityListActions;\r\n\r\n    /** Actions for managing the retrieval of the lightbox entity's information from the CMS as part of Search */\r\n    private lightboxSearchEntityListActions: EntityListActions;\r\n\r\n    /** The lightbox manager */\r\n    private lightboxManager: ILightboxManager;\r\n\r\n    /** An instance of the `EntityListActions` class for dealing with the entities in the active lightbox\r\n     *  Passed into the LightboxPageBootstrapper and to the LightboxManager\r\n     * @type {EntityListActions}\r\n     */\r\n    private entityListActions: EntityListActions;\r\n\r\n    /** An instance of the 'ImagePreviewModalActions' class.\r\n     * @type {ImagePreviewModalActions}\r\n     */\r\n    private imagePreviewModalActions: ImagePreviewModalActions;\r\n\r\n    /** An instance of the 'ModalProvisioningActions' class.\r\n     * @type {ModalVisibilityActions}\r\n     */\r\n    private modalProvisioningActions: ModalProvisioningActions;\r\n\r\n    /** An instance of the 'ImageAcquisitionManager' class.\r\n     * @type {IImageAcquisitionManager}\r\n     */\r\n    private imageAcquisitionManager: IImageAcquisitionManager;\r\n\r\n    /** An instance of the `ImageCommandActions` class.\r\n     * @type {ImageCommandActions}\r\n     */\r\n    private imageCommandActions: ImageCommandActions;\r\n\r\n    /**\r\n     * Initializes a new instance of the AppBootstrapper class.\r\n     * @constructor\r\n     * @param instrumentationClient {IInstrumentationClient} Provides support for instrumentation.\r\n     */\r\n    constructor(private instrumentationClient: IInstrumentationClient) {\r\n\r\n        super(null, null);\r\n\r\n        this.lightboxActions = new LightboxActions();\r\n        this.lightboxUserProfileManager = new LightboxUserProfileManager();\r\n        this.modalProvisioningActions = new ModalProvisioningActions(\"ModalProvisioningActions\");\r\n\r\n        const oneServiceBusinessLogicFactory = OneSrvBusinessLogicFactory.createFrom(\r\n            appConfig.autoSuggestBaseUri,\r\n            AppConstants.OCID,\r\n            AppConstants.OneServiceApiKey,\r\n            ccsdk.entityFactories.cats.businessLogicFactory.instrumentationService);\r\n\r\n        const catalystManagerFactory = CatalystManagerFactory.fromProseDomain(appConfig.proseEndpoint, appConfig.catsTenantName);\r\n        catalystManagerFactory.catalystServiceClientsFactory.setAuthenticationToAdal(authenticationManager);\r\n        this.imageAcquisitionManager = catalystManagerFactory.createImageAcquisitionManager();\r\n\r\n        this.appHeaderSectionBootstrap = new AppHeaderSectionBootstrapper(\r\n            () => { return this.lightboxPageBootstrap.getLightboxIdForRoute(); },\r\n            this,\r\n            (state: ISignedInAppState): IAppHeaderState => {\r\n                return state.appHeaderSectionState;\r\n            });\r\n\r\n        const pagedImagesBootstrapper =\r\n            new FixedPageSizePagedCollectionBootstrapper<ISearchAndSelectState<IEntityListState>>(\r\n                AppConstants.thumbnailConfig.totalWidth,\r\n                AppConstants.thumbnailConfig.totalHeight,\r\n                () => {\r\n                    const state = this.getCurrentState();\r\n                    return state.searchAndSelectState.entityList.entitiesWithMetadata.length;\r\n                },\r\n                AppConstants.thumbnailsPerPage,\r\n                new PagingActions());\r\n\r\n        this.catalystSearchManager = new CatalystSearchManager(\r\n            ccsdk.entityFactories.cats.businessLogicFactory,\r\n            () => { pagedImagesBootstrapper.ResetPager(); },\r\n            instrumentationClient);\r\n        const catalystCreativeSearchManager: ICreativeImageSearchManager = catalystManagerFactory.createCatalystCreativeImageSearchManager();\r\n\r\n        this.lightboxListItemSelectorActions = new ListItemSelectorActions<ILightboxProfileInfo>(\"Lightboxes\");\r\n\r\n        this.searchAndSelectBootstrap = new SearchAndSelectBootstrapper(\r\n            pagedImagesBootstrapper,\r\n            this.imageAcquisitionManager,\r\n            oneServiceBusinessLogicFactory,\r\n            instrumentationClient,\r\n            this.catalystSearchManager,\r\n            () => this.lightboxManager,\r\n            (entityWithMetadata: IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>>, modalProvisioningActions: ModalProvisioningActions, overlayOnly?: boolean): React.ReactElement<any> => {\r\n                return this.createAddToLightboxModalForEditorialImage(entityWithMetadata, this.getCurrentState(), modalProvisioningActions, overlayOnly);\r\n            },\r\n            this.modalProvisioningActions,\r\n            this,\r\n            (state: ISignedInAppState): ISearchAndSelectState<IEntityListState> => {\r\n                return state.searchAndSelectState;\r\n            });\r\n\r\n        this.imageDetailsPageBootstrap = new ImageDetailsPageBootstrapper(\r\n            ccsdk.entityFactories.cats.businessLogicFactory,\r\n            this.imageAcquisitionManager,\r\n            instrumentationClient,\r\n            this,\r\n            (state: ISignedInAppState): IImageDetailsPageState => {\r\n                return state.imageDetailsPageState;\r\n            });\r\n\r\n        const creativePagingActions = new PagingActions(\"CreativePagingActions\");\r\n\r\n        this.imagePreviewModalActions = new ImagePreviewModalActions(\"LightboxImagePreivewModalActions\");\r\n        this.imageCommandActions = new ImageCommandActions(\"LightboxImageCommandActions\");\r\n\r\n        const creativePagedImagesBootstrapper =\r\n            new FixedPageSizePagedCollectionBootstrapper<ICreativeImageSearchState>(\r\n                AppConstants.thumbnailConfig.totalWidth,\r\n                AppConstants.thumbnailConfig.totalHeight,\r\n                () => {\r\n                    const state = this.getCurrentState();\r\n                    const currentSelectedProvider = state.creativeSearchState.currentSelectedProvider;\r\n                    return state.creativeSearchState.providerImageSearchResults[currentSelectedProvider].totalResultsAvailable;\r\n                },\r\n                AppConstants.thumbnailsPerPage,\r\n                creativePagingActions);\r\n\r\n        this.creativeSearchPageBootstrap = new CreativeSearchPageBootstrapper(\r\n            creativePagedImagesBootstrapper,\r\n            catalystCreativeSearchManager,\r\n            this.imageAcquisitionManager,\r\n            instrumentationClient,\r\n            oneServiceBusinessLogicFactory,\r\n            creativePagingActions,\r\n            (creativeImage: ICreativeImage, modalProvisioningActions: ModalProvisioningActions, overlayOnly?: boolean): React.ReactElement<any> => {\r\n                if (isNil(creativeImage)) {\r\n                    return null;\r\n                }\r\n\r\n                return this.createAddToLightboxModalForCreativeImage(creativeImage, this.getCurrentState(), modalProvisioningActions, overlayOnly);\r\n            },\r\n            this.modalProvisioningActions,\r\n            this,\r\n            (state: ISignedInAppState): ICreativeImageSearchState => {\r\n                return state.creativeSearchState;\r\n            },\r\n            \"CreativeSearchPage\");\r\n\r\n        this.entityListActions = new EntityListActions(\"SharedEntityListActions\");\r\n        this.lightboxSearchEntityListActions = new EntityListActions(\"LightboxSearchEntityListActions\");\r\n\r\n        this.lightboxPageBootstrap = new LightboxPageBootstrapper(\r\n            ccsdk.entityFactories.cats.businessLogicFactory,\r\n            this.imageAcquisitionManager,\r\n            instrumentationClient,\r\n            this.lightboxSearchEntityListActions,\r\n            this.entityListActions,\r\n            this.imagePreviewModalActions,\r\n            this.modalProvisioningActions,\r\n            this.imageCommandActions,\r\n            () => this.lightboxManager,\r\n            this.lightboxUserProfileManager,\r\n            this,\r\n            (state: ISignedInAppState): ILightboxPageBootstrapperState => {\r\n                return {\r\n                    lightboxState: state.lightboxState,\r\n                    lightboxPageState: state.lightboxPageState\r\n                };\r\n            },\r\n            \"LightboxPage\");\r\n\r\n        this.onLightboxSelectionChange = this.onLightboxSelectionChange.bind(this);\r\n        this.onCreateNewLightbox = this.onCreateNewLightbox.bind(this);\r\n        this.onAddToLightboxes = this.onAddToLightboxes.bind(this);\r\n        this.showAddToLightboxOverlay = this.showAddToLightboxOverlay.bind(this);\r\n        this.hideAddToLightboxOverlay = this.hideAddToLightboxOverlay.bind(this);\r\n\r\n        this.applicationErrorActions = new ApplicationErrorActions();\r\n\r\n        this.lightboxGetEntityListActions = new EntityListActions(\"LightboxGetEntityListActions\");\r\n\r\n        this.applicationErrorActions = new ApplicationErrorActions();\r\n\r\n        this.errorMessageBoxBootstrap = new MessageBoxModalBootstrapper(\r\n            this,\r\n            (state: ISignedInAppState): IMessageBoxModalState => {\r\n                return state.errorMessageBoxState;\r\n            });\r\n\r\n        this.closeDialogs = this.closeDialogs.bind(this);\r\n    }\r\n\r\n    /**\r\n     * Returns the initial application state.\r\n     * @method\r\n     * @returns {ISignedInAppState} The initial state of the application.\r\n     */\r\n    public getInitialState(): ISignedInAppState {\r\n\r\n        const recentLightboxes = !!Global.userProfile && !!Global.userProfile.recentLightboxes ? [].concat(Global.userProfile.recentLightboxes) : [];\r\n\r\n        const initialState: ISignedInAppState = {\r\n            appHeaderSectionState: this.appHeaderSectionBootstrap.getInitialState(),\r\n            searchAndSelectState: this.searchAndSelectBootstrap.getInitialState(),\r\n            creativeSearchState: this.creativeSearchPageBootstrap.getInitialState(),\r\n            lightboxPageState: this.LightboxPageBootstrap.getInitialState().lightboxPageState,\r\n            errorMessageBoxState: this.ErrorMessageBoxBootstrap.getInitialState(),\r\n            localUserProfileIsLoading: true,\r\n            imageDetailsPageState: this.imageDetailsPageBootstrap.getInitialState(),\r\n            lightboxState: {\r\n                myLightboxes: recentLightboxes,\r\n                activeLightboxId: \"\",\r\n                operationPending: false,\r\n                lightboxEntitiesState: {\r\n                    continuationToken: null,\r\n                    entitiesWithMetadata: [],\r\n                    loading: false,\r\n                    sortOrder: [],\r\n                    retriableAction: {\r\n                        error: null,\r\n                        action: () => { return; },\r\n                        actionParameters: []\r\n                    }\r\n                }\r\n            },\r\n            applicationError: null,\r\n            addToLightboxOverlayIsVisible: false,\r\n            performanceCounters: { editorialSearchImageLoadingTimes: ImageLoadingPerfCountersReducer.getInitialState() }\r\n        };\r\n\r\n        return initialState;\r\n    }\r\n\r\n    /**\r\n     * Composes the child reducers in order to create the root app reducer.\r\n     * @method\r\n     * @returns {IReducer<ISignedInAppState>} The redux root reducer for the app.\r\n     */\r\n    public createRootReducer(): IReducer<ISignedInAppState> {\r\n\r\n        const appHeaderSectionReducer = this.appHeaderSectionBootstrap.createRootReducer();\r\n        const searchAndSelectReducer = this.searchAndSelectBootstrap.createRootReducer();\r\n        const creativeSearchPageReducer = this.creativeSearchPageBootstrap.createRootReducer();\r\n        const lightboxPageReducer = this.lightboxPageBootstrap.createRootReducer();\r\n        const applicationErrorsReducer = new ApplicationErrorReducer(this.applicationErrorActions);\r\n        const imageDetailsPageReducer = this.imageDetailsPageBootstrap.createRootReducer();\r\n        const lightboxEntityListReduction = new EntityListReduction(this.lightboxGetEntityListActions);\r\n        const imageLoadingTelemetryReducer = new ImageLoadingPerfCountersReducer();\r\n        const errorMessageBoxReducer = this.errorMessageBoxBootstrap.createRootReducer();\r\n\r\n        return new SignedInAppReducer(\r\n            this.signedInAppActions,\r\n            this.lightboxListItemSelectorActions,\r\n            appHeaderSectionReducer,\r\n            searchAndSelectReducer,\r\n            applicationErrorsReducer,\r\n            creativeSearchPageReducer,\r\n            lightboxPageReducer,\r\n            this.lightboxActions,\r\n            lightboxEntityListReduction,\r\n            imageDetailsPageReducer,\r\n            imageLoadingTelemetryReducer,\r\n            errorMessageBoxReducer\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Triggers operations the child components need to execute before being mounted.\r\n     * @method\r\n     */\r\n    public onBeforeComponentCreated(): void {\r\n        this.appHeaderSectionBootstrap.onBeforeComponentCreated();\r\n        this.searchAndSelectBootstrap.onBeforeComponentCreated();\r\n        this.creativeSearchPageBootstrap.onBeforeComponentCreated();\r\n        this.lightboxPageBootstrap.onBeforeComponentCreated();\r\n        this.imageDetailsPageBootstrap.onBeforeComponentCreated();\r\n\r\n        const getLightboxesActionCreator = new LightboxActionCreator(\r\n            ccsdk.entityFactories.cats.businessLogicFactory,\r\n            this.instrumentationClient,\r\n            this.lightboxUserProfileManager,\r\n            this.store,\r\n            this.lightboxActions,\r\n            this.lightboxGetEntityListActions);\r\n\r\n        const searchForLightboxesActionCreator = new SearchActionCreator(\r\n            ccsdk.entityFactories.cats.businessLogicFactory,\r\n            this.store,\r\n            this.lightboxSearchEntityListActions,\r\n            SectionListSearchScopeOptions.SearchCurrentAndAllDescendentDirectories);\r\n\r\n        this.lightboxManager = new LightboxManager(\r\n            this.instrumentationClient,\r\n            this.lightboxActions,\r\n            getLightboxesActionCreator,\r\n            this.lightboxGetEntityListActions,\r\n            this.lightboxSearchEntityListActions,\r\n            searchForLightboxesActionCreator,\r\n            this.imageAcquisitionManager,\r\n            this.entityListActions,\r\n            this.imagePreviewModalActions,\r\n            this.modalProvisioningActions,\r\n            this.imageCommandActions,\r\n            this.store,\r\n            () => this.getCurrentState().lightboxState,\r\n            () => this.getCurrentState().lightboxPageState,\r\n            (_activeLightboxId) => { this.lightboxPageBootstrap.onActiveLightboxChanged(); }\r\n        );\r\n\r\n        const lightboxUpdateCallback = (lightboxes) => {\r\n            const lightboxIds = lightboxes.map((lightbox => lightbox.id));\r\n            if (!isEmpty(lightboxIds)) {\r\n                const loadLightboxesOnProfileUpdatetActivity = this.instrumentationClient.ActivityLoggingService.createActivity(\r\n                    \"SignedInAppBootstrapper onLightboxUserProfileUpdated\",\r\n                    this.instrumentationClient.RootActivity);\r\n\r\n                return this.lightboxManager.getLightboxInformation(lightboxIds, loadLightboxesOnProfileUpdatetActivity);\r\n            }\r\n        };\r\n\r\n        this.lightboxUserProfileManager.setOnUpdateCallback(this.store, this.lightboxActions, lightboxUpdateCallback);\r\n\r\n        ccsdk.userProfileManagers.local.getMyProfile().then((_localUserProfile) => {\r\n            this.signedInAppActions.LocalUserProfileLoaded.getActionSender(this.store)();\r\n            if (Global.userProfile.recentLightboxes.length > 0) {\r\n                const recentLightboxIds = Global.userProfile.recentLightboxes.map((recentLightbox => recentLightbox.id));\r\n                const loadLightboxesOnAppStartActivity = this.instrumentationClient.ActivityLoggingService.createActivity(\r\n                    \"SignedInAppBootstrapper.onBeforeComponentCreated\",\r\n                    this.instrumentationClient.RootActivity);\r\n                return this.lightboxManager.getLightboxInformation(recentLightboxIds, loadLightboxesOnAppStartActivity);\r\n            }\r\n            return null;\r\n        }).catch((_e) => {\r\n            this.signedInAppActions.LocalUserProfileLoaded.getActionSender(this.store)();\r\n        });\r\n    }\r\n\r\n    /**\r\n     * This is invoked from SignedInApp.tsx when a lightbox route is being loaded.\r\n     * @param lightboxId {string} The id of the lightbox\r\n     * @param loadLightboxSource {loadLightboxSource} Where the load came from (direct URL or from selecting a lightbox card)\r\n     */\r\n    public loadLightbox(lightboxId: string, loadLightboxSource: LoadLightboxSourceEnum): void {\r\n\r\n        if (loadLightboxSource === LoadLightboxSourceEnum.Internal) {\r\n            this.lightboxManager.setActiveAndMonitorLightbox(lightboxId, this.instrumentationClient.RootActivity);\r\n        } else {\r\n            this.lightboxManager.addSetActiveAndMonitorLightbox(lightboxId, this.instrumentationClient.RootActivity);\r\n        }\r\n\r\n        const eventData = this.instrumentationClient.createEventData(event, \"LoadLightbox\", null, null, null);\r\n        const actionInput = {\r\n            \"lightboxId\": lightboxId,\r\n            \"numberOfLightBoxes\": this.getCurrentState().lightboxState.myLightboxes.length.toString()\r\n        };\r\n        const pageActionData = PageActionData.createFrom(null, actionInput, null, null, null, null, PageNames.Lightbox);\r\n\r\n        const logUserActivity = (correlationVector: string) => {\r\n            this.instrumentationClient.UserActivityTrackingService.logPageActionEvent(\r\n                eventData,\r\n                PageNames.Lightbox,\r\n                correlationVector,\r\n                pageActionData\r\n            );\r\n        };\r\n\r\n        logUserActivity(this.instrumentationClient.RootActivityCorrelationVector);\r\n    }\r\n\r\n    /**\r\n     * Executes a pre-flight serach. If it fails, the app will transition in an\r\n     * @method\r\n     */\r\n    public executeSearchForPreFlightSearch(): Promise<IEntityWithMetadata<IEntity>[]> {\r\n        return this.catalystSearchManager.executeSearchForPreFlightCheck();\r\n    }\r\n\r\n    /**\r\n     * Redux mapper used to map the current state to props the component use to render itself.\r\n     * @method\r\n     * @param {ISignedInAppState} state The current state of the component.\r\n     * @param {ISignedInAppProps} ownProps The set of pure properties of the component.\r\n     * @returns {ISignedInAppProps} An enriched set of props.\r\n     */\r\n    public mapStateToProps(state: ISignedInAppState, ownProps: ISignedInAppProps): ISignedInAppProps {\r\n        const { applicationError } = state;\r\n        let serviceError = null;\r\n        if (applicationError) {\r\n            serviceError = serviceErrorParsers.appLevel.parse(applicationError);\r\n        }\r\n\r\n        return {\r\n            ...ownProps,\r\n            localUserProfileIsLoading: state.localUserProfileIsLoading,\r\n            serviceError: serviceError || ownProps.serviceError\r\n        };\r\n    }\r\n\r\n    // Helper to create the Add To Lightbox modal\r\n    private createAddToLightboxModalForEditorialImage(\r\n        entityWithMetadata: IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>>,\r\n        state: ISignedInAppState,\r\n        modalProvisioningActions: ModalProvisioningActions,\r\n        overlayOnly: boolean = false\r\n    ): React.ReactElement<IAddToLightboxOverlayProps<{ src: string, alt: string, height?: number, width?: number }>> |\r\n    React.ReactElement<IManageCollectionProps<{ src: string, alt: string, height?: number, width?: number }>> {\r\n\r\n        if (isNil(entityWithMetadata)) {\r\n            return null;\r\n        }\r\n\r\n        const entity = entityWithMetadata.entity;\r\n\r\n        if (isNil(entity)) {\r\n            return null;\r\n        }\r\n\r\n        const imgProps = {\r\n            src: ResizeService.getUrifromImageUri(entity.href, 250, 250, \"White\", ResizeServiceMode.LetterBox, 80),\r\n            alt: entity.altText,\r\n            height: AppConstants.height\r\n        };\r\n\r\n        const props = this.getAddToOverlayImageProps(state, imgProps);\r\n\r\n        props.onAddToCollections = (evt, selectedCollection) => {\r\n            this.onAddToLightboxes(evt, entityWithMetadata, selectedCollection);\r\n            modalProvisioningActions.HideModal.getActionSender(this.store)();\r\n        };\r\n\r\n        props.onClose = (_event: Event) => {\r\n            modalProvisioningActions.HideModal.getActionSender(this.store)();\r\n            this.lightboxActions.ClearNotification.getActionSender(this.store)();\r\n        };\r\n\r\n        props.itemToAddWidth = entity.width;\r\n        props.itemToAddHeight = entity.height;\r\n\r\n        if (overlayOnly) {\r\n\r\n            props.onAddToCollections = (evt, selectedCollection) => {\r\n                this.onAddToLightboxes(evt, entityWithMetadata, selectedCollection);\r\n            };\r\n            return React.createElement<IAddToLightboxOverlayProps<{ src: string, alt: string, height?: number, width?: number }>>(AddToLightboxOverlay, props);\r\n        }\r\n\r\n        return React.createElement<IManageCollectionProps<{ src: string, alt: string, height?: number, width?: number }>>(AddToCollectionModal, props);\r\n    }\r\n\r\n    // Helper to create the Add To Lightbox modal for creative Images\r\n    private createAddToLightboxModalForCreativeImage(\r\n        creativeImage: ICreativeImage,\r\n        state: ISignedInAppState,\r\n        modalProvisioningActions: ModalProvisioningActions,\r\n        overlayOnly: boolean = false\r\n    ): React.ReactElement<IAddToLightboxOverlayProps<{ src: string, alt: string, height?: number, width?: number }>> |\r\n    React.ReactElement<IManageCollectionProps<{ src: string, alt: string, height?: number, width?: number }>> {\r\n\r\n        const imgProps = {\r\n            src: creativeImage.previewImageUrl,\r\n            alt: creativeImage.caption,\r\n            height: AppConstants.height\r\n        };\r\n\r\n        const props = this.getAddToOverlayImageProps(state, imgProps);\r\n        props.onAddToCollections = (evt, selectedCollection) => {\r\n            this.onCreativeImageAddToLightboxes(evt, creativeImage, state.creativeSearchState.currentSelectedProvider, selectedCollection);\r\n            modalProvisioningActions.HideModal.getActionSender(this.store)();\r\n        };\r\n\r\n        props.onClose = (_event: Event) => {\r\n            modalProvisioningActions.HideModal.getActionSender(this.store)();\r\n            this.lightboxActions.ClearNotification.getActionSender(this.store)();\r\n        };\r\n\r\n        props.itemToAddWidth = !!creativeImage.previewImageSize ? creativeImage.previewImageSize.width : AppConstants.gridTileImageWidthHeight;\r\n        props.itemToAddHeight = !!creativeImage.previewImageSize ? creativeImage.previewImageSize.height : AppConstants.gridTileImageWidthHeight;\r\n        props.isImageAdditionInProgress = state.lightboxPageState.imageCommandState.creativeImageIngestionState.beingIngestedImageIds ?\r\n            state.lightboxPageState.imageCommandState.creativeImageIngestionState.beingIngestedImageIds.indexOf(creativeImage.id) > -1 : false;\r\n        if (overlayOnly) {\r\n\r\n            props.onAddToCollections = (evt, selectedCollection) => {\r\n                this.onCreativeImageAddToLightboxes(evt, creativeImage, state.creativeSearchState.currentSelectedProvider, selectedCollection);\r\n            };\r\n\r\n            return React.createElement<IAddToLightboxOverlayProps<{ src: string, alt: string, height?: number, width?: number }>>(AddToLightboxOverlay, props);\r\n        }\r\n\r\n        return React.createElement<IManageCollectionProps<{ src: string, alt: string, height?: number, width?: number }>>(AddToCollectionModal, props);\r\n    }\r\n\r\n    // Returns the lightbox entity collection from state with active lightbox as selected.\r\n    private getLightboxEntitiesCollection(state: ISignedInAppState): ICollectionInformationWithSelectionState[] {\r\n        const collectionsWithSelectionState: ICollectionInformationWithSelectionState[] = state.lightboxState.myLightboxes.map((recentLightbox) => {\r\n\r\n            const lightboxEntities = this.getCurrentState().lightboxState.lightboxEntitiesState.entitiesWithMetadata;\r\n\r\n            let displayString = recentLightbox.id;\r\n            let foundIndex = lightboxEntities.findIndex(lightbox => lightbox.entity._id === recentLightbox.id);\r\n            if (foundIndex >= 0) {\r\n                displayString = lightboxEntities[foundIndex].entity._name;\r\n            }\r\n\r\n            const collection: ICollectionInformation = {\r\n                id: recentLightbox.id,\r\n                displayString\r\n            };\r\n\r\n            return {\r\n                collection,\r\n                selected: (state.lightboxState.activeLightboxId === recentLightbox.id)\r\n            };\r\n        });\r\n\r\n        return collectionsWithSelectionState;\r\n    }\r\n\r\n    // Function to return the AddToOverlayImage props. Caller then overrides the callbacks as per editorial or creative image.\r\n    private getAddToOverlayImageProps(state: ISignedInAppState, imgProps: { src: string, alt: string, height?: number, width?: number }): IAddToLightboxOverlayProps<{ src: string, alt: string, height?: number, width?: number }> {\r\n        const props: IAddToLightboxOverlayProps<{ src: string, alt: string, height?: number, width?: number }> = {\r\n            title: \"Add Image to Lightbox\",\r\n            description: \"My Lightboxes\",\r\n            emptyCollectionsString: \"You don't have any lightboxes saved to your profile.\",\r\n            collections: this.getLightboxEntitiesCollection(state),\r\n            itemToAdd: React.createElement(\"img\", imgProps),\r\n            onToggleSelection: this.onLightboxSelectionChange,\r\n            onAddToCollections: (_evt, _selectedCollection) => { return; },\r\n            onClose: (_event: Event) => { return; },\r\n            createNewPlaceholderText: \"Enter name for a new lightbox\",\r\n            onCreateNewCollection: this.onCreateNewLightbox,\r\n            createCollectionPending: state.lightboxState.operationPending,\r\n            itemToAddWidth: AppConstants.gridTileImageWidthHeight,\r\n            itemToAddHeight: AppConstants.gridTileImageWidthHeight,\r\n            showAddToLightboxOverlay: this.showAddToLightboxOverlay,\r\n            hideAddToLightboxOverlay: this.hideAddToLightboxOverlay,\r\n            addToLightboxOverlayIsVisible: state.addToLightboxOverlayIsVisible,\r\n            addToLightboxOverlayTarget: state.addToLightboxOverlayTarget\r\n        };\r\n\r\n        return props;\r\n    }\r\n\r\n    // Callback for when a lightbox is selected in the modal\r\n    private onLightboxSelectionChange(event: Event, collection: ICollectionInformation): void {\r\n\r\n        const activeLightboxId = this.lightboxManager.getActiveLightboxId();\r\n\r\n        if (activeLightboxId !== collection.id) {\r\n            const getActionInput = () => {\r\n                return {\r\n                    \"selectedLightboxId\": collection.id\r\n                };\r\n            };\r\n            const logUserActivityCallback = this.createLogUserActivityCallback(event, \"modal-select-lightbox\", getActionInput);\r\n            logUserActivityCallback(this.instrumentationClient.RootActivityCorrelationVector);\r\n\r\n            this.lightboxManager.setActiveLightbox(collection.id);\r\n        }\r\n    }\r\n\r\n    // Callback for when a lightbox is to be created through the overlay modal.\r\n    private onCreateNewLightbox(event: Event, name: string): void {\r\n\r\n        const getActionInput = () => {\r\n            return {\r\n                \"lightboxName\": name\r\n            };\r\n        };\r\n        const logUserActivity = this.createLogUserActivityCallback(event, \"modal-new-lightbox\", getActionInput);\r\n\r\n        this.lightboxManager.createLightbox(name, this.instrumentationClient.RootActivity, logUserActivity);\r\n    }\r\n\r\n    // Lightbox overlay trigger\r\n    private showAddToLightboxOverlay(target: Button): void {\r\n        this.signedInAppActions.ShowAddToLightboxOverlay.getActionSender(this.store)(target);\r\n    }\r\n\r\n    // Lightbox overlay trigger\r\n    private hideAddToLightboxOverlay(): void {\r\n        this.signedInAppActions.HideAddToLightboxOverlay.getActionSender(this.store)();\r\n    }\r\n\r\n    // Add an item to the selected lightboxes\r\n    private onAddToLightboxes(event: Event, entityWithMetadata: IEntityWithMetadata<IImageFileData<ICatalystFileDataMetadata>>, collections: ICollectionInformation[]): void {\r\n\r\n        const getActionInput = () => {\r\n            return {\r\n                \"lightboxId\": collections[0].id,\r\n                \"entityId\": entityWithMetadata.entity._id\r\n            };\r\n        };\r\n        const logUserActivity = this.createLogUserActivityCallback(event, \"modal-add-to-lightboxes\", getActionInput);\r\n\r\n        this.lightboxManager.addItemsToLightbox(collections[0].id, [entityWithMetadata], this.instrumentationClient.RootActivity, logUserActivity)\r\n        .then((lightbox) => {\r\n            const logUserActivityCallback = this.createLogUserActivityCallback(event, \"modal-add-item-to-lightbox\", () => {\r\n                return {\r\n                    \"lightboxId\": lightbox.entity._id,\r\n                    \"lightboxName\": lightbox.entity._name,\r\n                    \"count\": lightbox.entity.collection.items.length.toString()\r\n                };\r\n            });\r\n\r\n            logUserActivityCallback(this.instrumentationClient.RootActivityCorrelationVector);\r\n        })\r\n        .catch((error) => {\r\n            if (error.type && error.type === AppErrorConverter.ServiceErrorCodeLinkNotExist) {\r\n                let message = AppErrorConverter.toStringArray(error, true, `Failed to add image to  \"${collections[0].displayString}\" Lightbox.`);\r\n                Global.errorMessageBox.Show(\"Failed to add items to lightbox\", message);\r\n                this.closeDialogs();\r\n            }\r\n        });\r\n    }\r\n\r\n    // Add an item to the selected lightboxes\r\n    private onCreativeImageAddToLightboxes(event: Event, creativeImage: ICreativeImage, provider: CreativeProvider, collections: ICollectionInformation[]): void {\r\n\r\n        const getActionInput = () => {\r\n            return {\r\n                \"lightboxId\": collections[0].id,\r\n                \"creativeId\": creativeImage.id\r\n            };\r\n        };\r\n        const logUserActivity = this.createLogUserActivityCallback(event, \"modal-add-to-lightboxes\", getActionInput);\r\n\r\n        const addItemsToLightboxPromise =\r\n            this.lightboxManager.addCreativeItemsToLightbox(\r\n                this.imageAcquisitionManager,\r\n                collections[0].id,\r\n                creativeImage,\r\n                provider,\r\n                this.instrumentationClient.RootActivity,\r\n                logUserActivity\r\n            );\r\n\r\n        addItemsToLightboxPromise.then((lightbox) => {\r\n            const logUserActivityCallback = this.createLogUserActivityCallback(event, \"modal-add-item-to-lightbox\", () => {\r\n                return {\r\n                    \"lightboxId\": lightbox.entity._id,\r\n                    \"lightboxName\": lightbox.entity._name,\r\n                    \"count\": lightbox.entity.collection.items.length.toString()\r\n                };\r\n            });\r\n\r\n            logUserActivityCallback(this.instrumentationClient.RootActivityCorrelationVector);\r\n        }).catch((error => {\r\n            if (error.type && error.type === AppErrorConverter.ServiceErrorCodeLinkNotExist) {\r\n                let message = AppErrorConverter.toStringArray(error, true, `Failed to acquire image '${creativeImage.id}' from provider '${provider}.`);\r\n                Global.errorMessageBox.Show(\"Failed to add items to lightbox\", message);\r\n                this.closeDialogs();\r\n            }\r\n        }));\r\n    }\r\n\r\n    // returns a function that can be used to track user activity\r\n    private createLogUserActivityCallback(event: Event, elementId: string, getActionInput: () => { [key: string]: string; }): (correlationVector: string) => void {\r\n\r\n        const eventData = this.instrumentationClient.createEventData(event, \"AddToLightboxModal\", null, elementId, AreaOfPage.lightboxImagePreviewModal);\r\n        const actionInput = getActionInput();\r\n        const pageActionData = PageActionData.createFrom(null, actionInput, null, null, null, null, AreaOfPage.lightboxImagePreviewModal);\r\n\r\n        const logUserActivity = (correlationVector: string) => {\r\n            this.instrumentationClient.UserActivityTrackingService.logPageActionEvent(\r\n                eventData,\r\n                PageNames.SearchAndSelect,\r\n                correlationVector,\r\n                pageActionData\r\n            );\r\n        };\r\n\r\n        return logUserActivity;\r\n    }\r\n\r\n    // closes all opened modal dialog windows\r\n    private closeDialogs(): void {\r\n        this.modalProvisioningActions.HideModal.getActionSender(this.store)();\r\n        this.hideAddToLightboxOverlay();\r\n    }\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport \"./globals/authentication\";          // initialize adal.js authentication\r\nimport \"./globals/ccsdk\";                   // initialize Catalyst CCSDK's dependencies\r\nimport \"./globals/actions\";                 // initialize Catalyst Redux actions\r\n\r\nimport { startCatalyst } from \"./createApp\";\r\n\r\n// adal.js library injects an hidden iFrame into the DOM to silently renew the token for a resource when it expires.\r\n// The `src` attribute of the iFrame is set to something similar to:\r\n// https://login.microsoftonline.com/{tenantId}/oauth2/authorize?response_type={id_token|access_token}&client_id={client_id}&resource={resourceId}&{library_details}&prompt=none\r\n// the expected HTTP response for a successful not-interactive token renewal is an HTTP 302 with the header `Location` set to some route of the app\r\n// and a fragment part containing the requested token. Example:\r\n// https://catalyst-dev.microsoft-ice.com/#access_token={token}&expires_in=3599&...\r\n// This implies that the entire app gets reloaded into the iFrame and without a mechanism that recognizes that condition the app code would be\r\n// executed twice, just in different windows. This is an unexpected behaviour that can raise unxpected issues.\r\n// In Catalyst, our service error management would for instance trigger an endless loop of iFrame injection and app execution that stops only\r\n// when the browser probably due to the amount of memory occupied by the giant DOM.\r\nlet runApp = true;\r\nif (window.parent !== window) {\r\n    runApp = false;\r\n}\r\n\r\nif (runApp) {\r\n    startCatalyst();\r\n}","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n */\r\n\r\nimport * as ReactDom from \"react-dom\";\r\n\r\nimport { CatalystImageLoadingPerfCountersManager } from \"./instrumentation/performanceApi/CatalystImageLoadingPerfCountersManager\";\r\nimport { GetInstrumentationClient } from \"./instrumentation/instrumentationClient/InstrumentationClient\";\r\nimport { Global } from \"./Global\";\r\nimport { IInstrumentationClient } from \"./instrumentation/instrumentationClient/IInstrumentationClient\";\r\nimport { SignedInApp } from \"./SignedInApp\";\r\nimport { SignedInAppBootstrapper } from \"./SignedInAppBootstrapper\";\r\nimport { appConfig } from \"appConfig\";\r\nimport { authenticationManager } from \"./globals/authentication\";\r\nimport { ccsdk } from \"./globals/ccsdk\";\r\nimport { isFunction } from \"lodash-es\";\r\nimport { serviceErrorParsers } from \"./globals/CatalystServiceErrorParser\";\r\n\r\nfunction initializeUserProfile(instrumentationClient: IInstrumentationClient): Promise<void> {\r\n    const getAllSettingsPromise = ccsdk.userProfileManagers.prose.getAllSettings().then(profile => {\r\n        Global.userProfile = profile || {};\r\n    }).catch(e => {\r\n        Global.userProfile = {};\r\n        instrumentationClient.LoggingService.error(\"Loading user profile failed.\", null, e);\r\n    });\r\n\r\n    return getAllSettingsPromise;\r\n}\r\n\r\nfunction createRootBoostrapper(instrumentationClient: IInstrumentationClient): SignedInAppBootstrapper {\r\n    const appBootstrapper = new SignedInAppBootstrapper(instrumentationClient);\r\n    Global.appHeaderSectionBootstrapper = appBootstrapper.AppHeaderSectionBootstrap;\r\n    Global.errorMessageBox = appBootstrapper.ErrorMessageBoxBootstrap;\r\n    return appBootstrapper;\r\n}\r\n\r\nfunction setupImageLoadingPerformanceCounters(instrumentationClient: IInstrumentationClient, rootBootstrapper: SignedInAppBootstrapper): void {\r\n    if (!appConfig.logging.telemetryEnabled || !appConfig.logging.performanceCountersLoggingEnabled) {\r\n        return;\r\n    }\r\n    const catalystImageLoadingPerfCountersManager = new CatalystImageLoadingPerfCountersManager(instrumentationClient, rootBootstrapper);\r\n    catalystImageLoadingPerfCountersManager.activate();\r\n}\r\n\r\nexport function startCatalyst(): void {\r\n    if (!authenticationManager.isUserAuthenticated) {\r\n        authenticationManager.signIn();\r\n        return;\r\n    }\r\n\r\n    const instrumentationClient = GetInstrumentationClient(appConfig, authenticationManager);\r\n    const catsEntityManager = ccsdk.entityFactories.cats.businessLogicFactory.getManagersFactory().getEntityManager();\r\n\r\n    const getAllSettingsPromise = initializeUserProfile(instrumentationClient);\r\n\r\n    let preFlightSearchError = null;\r\n    let preFlightSearchPromise = null;\r\n    let catalystRootBootstrapper = null;\r\n    getAllSettingsPromise.then(() => {\r\n        catalystRootBootstrapper = createRootBoostrapper(instrumentationClient);\r\n        preFlightSearchPromise = catalystRootBootstrapper.executeSearchForPreFlightSearch().catch((error) => {\r\n            preFlightSearchError = serviceErrorParsers.appLevel.parse(error);\r\n        });\r\n\r\n        preFlightSearchPromise.then(() => {\r\n            if (!isFunction(preFlightSearchError)) {\r\n                const hostElement = document.getElementById(\"app-container\");\r\n                const appElement = catalystRootBootstrapper.bootstrap(SignedInApp, {\r\n                    appBootstrapper: catalystRootBootstrapper,\r\n                    entityManager: catsEntityManager,\r\n                    localUserProfileIsLoading: false,\r\n                    serviceError: preFlightSearchError\r\n                });\r\n                ReactDom.render(appElement, hostElement);\r\n\r\n                setupImageLoadingPerformanceCounters(instrumentationClient, catalystRootBootstrapper);\r\n            }\r\n        });\r\n    });\r\n}"],"sourceRoot":""}