import { IHubRequestOptions , IModel , getProp , _getHttpAndHttpsUris } from "@esri/hub-common" ; import { registerBrowserApp } from "./register-browser-app" ; param { string } siteId param { Array } uris param { IHubRequestOptions } hubRequestOptions export function registerSiteAsApplication ( model , hubRequestOptions ) { if ( hubRequestOptions . isPortal ) return Promise . resolve ( { } ) ; const uris = [ model . data . values . defaultHostname ] ; if ( getProp ( model , "data.values.customHostname" ) ) { uris . push ( model . data . values . customHostname ) ; } const redirectUris = uris . reduce ( ( acc , uri ) => { return acc . concat ( _getHttpAndHttpsUris ( uri ) ) ; } , [ ] ) ; return registerBrowserApp ( model . item . id , redirectUris , hubRequestOptions ) ; }