@arcgis/portal-components 5.2.0-next.129 → 5.2.0-next.130
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/GDKX2CGS.js +2 -0
- package/dist/cdn/index.js +1 -1
- package/dist/components/arcgis-portal-account-switcher/customElement.js +100 -96
- package/dist/components/arcgis-portal-navigation/index.js +4 -4
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/package.json +7 -7
- package/dist/cdn/BYEIB47T.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{a as J}from"./YVKSTDL6.js";import c from"./RBGARTND.js";import b from"./F3ODJVJC.js";import{a as T}from"./MFT5NBI5.js";import{a as P}from"./KYNL256E.js";import{a as K}from"./NBB7R2RE.js";import a from"./OUFIJDIW.js";import"./VMQIDO4Z.js";import"./QS3GXAIH.js";import{b as M}from"./2GBRZSEC.js";import{a as B}from"./JJUCB3OG.js";import"./QFHL5APV.js";import"./KCYIOVJQ.js";import"./XD3TUJLE.js";import{b as x}from"./WMT55UQD.js";import{L as O,N as _,P as L,j as d,k as I,w as A}from"./EXBWPG5Y.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";export default $arcgis.t(([p,{substitute:w},,,{f:N,g:E,h:H,i:W}])=>{var b=1260*1e3,q=2500;function R(o,t="_blank",i=582,e=670){let s=window.screenLeft??0,n=window.screenTop??0,a=window.innerWidth||document.documentElement.clientWidth||window.screen.width,r=window.innerHeight||document.documentElement.clientHeight||window.screen.height,c=a/2-i/2+s,l=r/2-e/2+n,u=window.open(o,t,`scrollbars=no, width=${i}, height=${e}, top=${l}, left=${c}`);return u?.focus(),u}function z(o){let t=p.findOAuthInfo(o.url),{locale:i="en",expiration:e=b}=t??{},s=new URLSearchParams({locale:i,client_id:"arcgisonline",response_type:"token",expiration:`${e}`,linkUserRequest:"true",showSocialLogins:"true",hideEnterpriseLogins:"false",force_login:"true",parent:window.location.origin,redirect_uri:`https://${o.portalHostname}/home/link_account_callback.html`,state:JSON.stringify({useMessage:!0})}),n=`https://${o.portalHostname}/sharing/oauth2/authorize?${s.toString()}`;R(n)}function U(o){let{config:t,token:i,clientId:e="arcgisonline",redirectToClientUri:s=!1,displaySignoutComplete:n=!1,clientUri:a}=o,r=new URLSearchParams({display:"iframe",client_id:e,...i&&{token:i},parent:window.location.origin,redirect_uri:`${t.baseUrl}/home/check_sign_in_status.html`,state:JSON.stringify({signout:!0,origin:window.location.origin,accountOrigin:`${t.restBaseUrl}/`,redirectToClientUri:s,displaySignoutComplete:n,...a&&{redirectUri:a}})}),c=`${t.restBaseUrl}/oauth2/signout?${r.toString()}`,l=document.createElement("iframe");l.src=c,l.style.display="none",document.body.appendChild(l)}function F(o,t,i){let e=h(o.orgUrlKey,t),s=p.findOAuthInfo(e),{appId:n,locale:a="en",expiration:r=b}=s??{},c=C(o.provider),l=new URLSearchParams({locale:a,client_id:i??n??"arcgisonline",response_type:"token",expiration:`${r}`,parent:window.location.origin,...c==="social"&&{socialLoginProviderName:o.provider},...c==="default"&&{prepopulatedusername:o.username},force_login:"true",redirect_uri:`${e}/home/sign_in_callback.html`,state:JSON.stringify({user:o.username,server:e,portalUrl:e,origin:window.location.origin})}),u=`${v(o,t)}?${l.toString()}`;R(u)}function G({accounts:o,clientId:t="arcgisonline",usersToFilter:i=[],accountsToFilter:e=""}){let s={};return o.reduce((n,a)=>{let r={disabled:a.disabled??!1,allowed:a.clientAppAccessAllowed??!0};return n[a.username]=r,(i.includes(a.username)||i.includes(a.username.toLowerCase())||e==="org"&&a.orgUrlKey||t==="esriapps"&&a.userType!=="both")&&(r.allowed=!1),n},s),s}function Q({account:o,credential:t,clientId:i,portal:e,redirectUri:s}){let n=C(o.provider),a=v(o,e),r=s||D(o,e),c=new URLSearchParams({client_id:i,redirect_uri:r,parent:window.location.origin,response_type:"token",force_login:"false",...t.userId&&{prepopulatedusername:t.userId},...n==="social"&&{socialLoginProviderName:o.provider},expiration:`${(t?.expires??Date.now()+b)-Date.now()}`});return`${a}?${c.toString()}`}function C(o){return V(o)?"social":o==="enterprise"?"enterprise":o.includes("oidc")?"oidc":"default"}function V(o){return["apple","facebook","github","google"].includes(o)}function v(o,t){let i=h(o.orgUrlKey,t).toLowerCase(),e=C(o.provider),s="";switch(e){case"social":s="social/";break;case"enterprise":s="saml/";break;case"oidc":s=`oidc/${o.provider.split("_")[1]}/`;break}return`${i}/sharing/rest/oauth2/${s}authorize`}function h(o,t){return o?.startsWith("https://")?o:o&&t.customBaseUrl?`https://${o}.${t.customBaseUrl}`:`https://${t.portalHostname}`}function D(o,t){return`${h(o.orgUrlKey,t)}/home/accountswitcher-callback.html`}function X(o,t){return p.findCredential(h(o.orgUrlKey,t),o.username)}function Y(o,t){let i=X(o,t);if(i)return i;let e=h(o.orgUrlKey,t),s=`${e}/home/check_sign_in_status.html#state=${JSON.stringify({origin:window.location.origin,server:e,orgKey:e})}`;Z(s,`iframe__for-${e}`)}function Z(o,t){let i=document.createElement("iframe");i.src=o,i.id=t,i.style.display="none",document.body.appendChild(i)}var y=100,S=class extends O{constructor(){super(),this.messages=B({blocking:!0}),this.targetUser="",this.targetToken="",this.accountAccess={},this.remainingSignouts=0,this.signoutHandle=0,this.linkedAccounts=[],this.loading=!1,this.signedInStatus={},this.showAssociatedAccountsWarning=!1,this.signedInAccounts=[],this.clientId="arcgisonline",this.signout=!1,this.signoutOptions={redirectToClientUri:!1,displaySignoutComplete:!1},this.arcgisAccountSwitch=A(),this.arcgisClose=A(),this.arcgisSignoutComplete=A(),this.listenOn(window,"message",this.handleMessageEvent)}static{this.properties={linkedAccounts:16,userAccounts:16,user:16,credential:16,alertOptions:16,loading:16,signedInStatus:16,showAssociatedAccountsWarning:16,signedInAccounts:16,portal:0,clientId:1,redirectUri:1,signout:5,signoutOptions:0}}static{this.styles=K}willUpdate(t){if(t.has("portal")&&(this.user=this.portal?.user),(t.has("portal")||t.has("user"))&&this.portal&&this.user){this.findLinkedUsers();return}if(t.has("linkedAccounts")||t.has("signedInStatus")){if(this.signout){let{signedInStatus:i,linkedAccounts:e,portal:s,signoutOptions:n,clientId:a,user:r,redirectUri:c}=this,l=Object.keys(i).filter(k=>i[k]!==null).map(k=>e.find(j=>j.username===k));this.remainingSignouts=l.length+1;let u=h(s.urlKey??"",s),f=`${u}/sharing/rest`,{displaySignoutComplete:g=!0,redirectToClientUri:m=!0}=n;l.length>0&&(g=!1,m=!1),this.loading=!0;let $=p.findCredential(u,r?.id||r?.username);U({displaySignoutComplete:g,redirectToClientUri:m,clientId:a,config:{baseUrl:u,restBaseUrl:f},token:$?.token,clientUri:m?c:void 0}),this.signoutHandle=window.setTimeout(()=>{this.remainingSignouts-=1,this.finishSignout({accountOrigin:u,redirectToClientUri:m,displaySignoutComplete:g})},q)}return}}handleMessageEvent(t){if(new URL(t.origin).hostname!=="localhost"&&(t.origin.endsWith(".arcgis.com")||t.origin===window.location.origin)){if(typeof t.data=="string"){JSON.parse(t.data).type==="token_exchange"&&this.handleExchangeTokenMessage(t);return}if("type"in t.data)switch(t.data.type){case"signin":this.handleSigninMessage(t);return;case"signout":this.handleSignoutMessage(t);return;case"linkUser":this.handleLinkUserMessage(t);return;case"token_exchange":this.handleExchangeTokenMessage(t);return}if("credential"in t.data){this.handleSigninMessage(t);return}this.handleCheckSignInStatusMessage(t)}}handleSignoutMessage(t){let{error:i,signout:e,accountOrigin:s,redirectToClientUri:n,displaySignoutComplete:a}=t.data;if(this.remainingSignouts-=1,i&&i!=="unknown"){console.error(i),this.showAlert("danger",this.messages.errors.signout);return}e&&(this.user=void 0,this.credential=void 0,this.finishSignout({accountOrigin:s,redirectToClientUri:n,displaySignoutComplete:a}))}handleSigninMessage(t){let{messages:i,clientId:e}=this,{error:s,status:n,state:a,access_token:r,ssl:c}=t.data;if(s){console.error(s),this.showAlert("danger",i.errors.signin);return}if(n==="success"){let{portal:l,user:u,redirectUri:f}=this,g=this.linkedAccounts.find(k=>k.username===a.user);g?.orgUrlKey===this.portal.urlKey&&p.findCredential(`https://${l.portalHostname}`,u?.username)?.destroy();let m={server:a.portalUrl,userId:a.user,token:r,expires:Number(t.data.expires_in)+Date.now(),ssl:c===void 0||c!=="false"};p.registerToken(m);let $=Q({account:g,credential:m,clientId:e,portal:l,redirectUri:f});window.self!==window.top?window.top?.postMessage({type:"navigate",url:$}):window.location.href=$}}handleCheckSignInStatusMessage(t){let{success:i,orgKey:e,server:s,userId:n,token:a,expires:r,ssl:c}=t.data;e&&s&&i&&n&&a&&r&&c!==void 0&&(this.signedInStatus[n]={token:a,expires:r,ssl:c})}async handleLinkUserMessage(t){let{error:i,username:e,access_token:s}=t.data,{portal:n,user:a,linkedAccounts:r,messages:c}=this;if(i){if(i.toString().toLowerCase().includes("user denied your request"))return;this.showAlert("danger",c.errors.accessAccount);return}if(e===a?.username){this.showAlert("danger",c.errors.selfLink);return}if(r.find(u=>u.username===e)){this.showAlert("danger",w(c.errors.alreadyLinked,{username:e}));return}let l=await E(n,e,s);if(l?.length){this.userAccounts=l,this.targetUser=e??"",this.targetToken=s??"",this.showAssociatedAccountsWarning=!0;return}this.linkAccount(e,s)}handleExchangeTokenMessage(t){let i=typeof t.data=="string"?JSON.parse(t.data):t.data;if(!(i.type&&i.type!=="token_exchange")){if(i.error)console.error(i);else if(i.status==="success"&&this.targetUser){let{portal:e,linkedAccounts:s,targetUser:n,clientId:a}=this,r=s.find(g=>g.username===n);if(!r)return;let c=D(r,e),l=h(r.orgUrlKey,e),u=new URLSearchParams({response_type:"token",client_id:a,redirect_uri:c,state:JSON.stringify({user:r.username,portalUrl:l})}),f=`${v(r,e)}?${u.toString()}`;window.opener?(window.opener.location.href=f,window.close()):window.location.href=f}}}finishSignout({accountOrigin:t,redirectToClientUri:i,displaySignoutComplete:e}){this.signoutHandle&&window.clearTimeout(this.signoutHandle),t===window.location.origin&&p.destroyCredentials(),console.info("Signout complete",t,i,e),this.remainingSignouts<=0&&this.arcgisSignoutComplete.emit({accountOrigin:t,redirectToClientUri:i,displaySignoutComplete:e})}async findLinkedUsers(){if(this.loading=!0,!this.portal||!this.user){this.linkedAccounts=[],this.loading=!1;return}this.linkedAccounts=await N(this.portal,this.user),this.linkedAccounts.length&&(this.signedInStatus=this.linkedAccounts.filter(t=>t.orgUrlKey!==this.portal.urlKey).reduce((t,i)=>(t[i.username]=Y(i,this.portal)??null,t),{}),this.accountAccess=G({accounts:this.linkedAccounts,clientId:this.clientId})),this.loading=!1}async linkAccount(t,i){let{portal:e,user:s}=this;if(!e||!s)return;let n=await H({portal:e,user:s,targetUser:t,targetToken:i}),{messages:a}=this;if(n.error){this.showAlert("danger",w(a.errors.linkAccount,{username:t})),this.targetUser="",this.userAccounts=[];return}let r=this.userAccounts?.length?a.success.linkAccountMultiple:a.success.linkAccount;this.showAlert("success",w(r,{username:t})),this.targetUser="",this.userAccounts=[],await M(350),this.findLinkedUsers()}async unlinkAccount(t){if(!this.portal||!this.user)return;let{messages:i,portal:e,user:s}=this,{success:n}=await W({portal:e,user:s,linkedUsername:t.username});n?this.showAlert("success",w(i.success.unlinkAccount,{username:t.username})):this.showAlert("danger",w(i.errors.unlinkAccount,{username:t.username})),await this.findLinkedUsers()}startAccountLink(){z(this.portal)}switchAccount(t){let{portal:i,user:e,clientId:s}=this;if(!i||!e||!t)return;let n=h(e.sourceJSON.orgUrlKey??"",i),a=p.findCredential(n,e.id||e.username);a&&U({config:{baseUrl:n,restBaseUrl:`${n}/sharing/rest`},token:a?.token,clientId:s}),F(t,i,s)}signoutAll(t){let{portal:i,signedInStatus:e,clientId:s}=this;t.forEach(n=>{let a=h(n.orgUrlKey,i),r=`${a}/sharing/rest`,c=e[n.username];U({config:{baseUrl:a,restBaseUrl:r},token:c?.token,clientId:s})})}showAlert(t,i,e){this.alertOptions={kind:t,title:e,message:i}}showUnlinkConfirmation(t){let{messages:i}=this;this.alertOptions={kind:"danger",icon:"exclamation-mark-triangle-f",title:i.unlinkAccount,message:i.unlinkWarning,actions:[{text:i.unlink,kind:"danger",clickHandler:()=>{this.alertOptions=void 0,this.unlinkAccount(t)}}]}}render(){let{linkedAccounts:t,accountAccess:i,user:e,portal:s,messages:n,signout:a}=this;if(!s||!e)return null;if(a){let{signedInAccounts:r}=this;return r.length===0?d`<calcite-loader .label=${n.signingOut} .text=${n.signingOut}></calcite-loader>`:d`<arcgis-portal-account-switcher-signout .portal=${s} .signedInAccounts=${r} @arcgisSwitchAccount=${c=>{this.switchAccount(c.detail.account)}} @arcgisSignOutAll=${()=>{this.signoutAll(r)}}></arcgis-portal-account-switcher-signout>`}return d`<calcite-dialog .heading=${n.switchAccounts} heading-level=2 scale=m width=s open modal .loading=${this.loading} outside-close-disabled @calciteDialogClose=${()=>{this.arcgisClose.emit()}}><calcite-block .heading=${n.currentAccount} heading-level=3 .description=${n.signedInAs} expanded class="current-account-block" tabindex=-1>${T(e.id??e.username,d`<calcite-block class="current-account" .label=${s.urlKey?`${e.username}, ${s.name}`:e.username} heading-level=4 .heading=${e.username} .description=${s.urlKey?`${e.fullName??e.username}, ${s.name}`:e.fullName??e.username}><calcite-avatar slot=content-start inert .fullName=${e.fullName??void 0} .username=${e.username} .userId=${e.id} .thumbnail=${P(e,s)??void 0}></calcite-avatar></calcite-block>`)}</calcite-block>${t.length>0?d`<calcite-block .heading=${n.linkedAccounts} heading-level=3 .description=${n.linkedAccountActions} expanded class="linked-accounts-block"><calcite-button slot=content-end icon-start=plus class="link-account-button" @click=${()=>this.startAccountLink()} .disabled=${t.length>=y}>${n.addAccount}</calcite-button><arcgis-portal-account-switcher-list .portal=${s} .linkedAccounts=${t} .accountAccess=${i} .signedInUsers=${Object.keys(this.signedInStatus).filter(r=>this.signedInStatus[r]!==null)} interactive @arcgisAccountSwitch=${r=>{this.switchAccount(r.detail.account)}} @arcgisAccountUnlink=${r=>{this.showUnlinkConfirmation(r.detail.account)}}></arcgis-portal-account-switcher-list></calcite-block>`:d`<calcite-block .heading=${n.linkedAccounts} heading-level=3 expanded class="empty-accounts-block"><div class="empty-accounts-info"><svg class="empty-accounts-icon" width=48 height=48 viewBox="0 0 48 48" fill=none xmlns=http://www.w3.org/2000/svg>${I`<path d=${J.couple??L} fill=currentColor />`}</svg><h4>${n.emptyListTitle}</h4><p>${n.emptyList}</p><calcite-button icon-start=plus class="link-account-button" @click=${()=>this.startAccountLink()} .disabled=${t.length>=y}>${n.linkAccount}</calcite-button></div></calcite-block>`}<calcite-notice kind=info .open=${t.length>=y}><div slot=message>${n.maxAccounts}</div></calcite-notice><calcite-alert .label=${n.alertLabel} slot=alerts .autoClose=${this.alertOptions?.kind!=="danger"} auto-close-duration=fast placement=bottom .kind=${this.alertOptions?.kind} .icon=${this.alertOptions?.icon} .open=${!!this.alertOptions} @calciteAlertClose=${()=>{this.alertOptions=void 0}}>${this.alertOptions?.title&&d`<h4 slot=title class="alert-title">${this.alertOptions.title}</h4>`||""}${this.alertOptions?.message&&d`<p slot=message class=${_({"alert-message":!0,"short-message":!!this.alertOptions?.actions?.length})}>${this.alertOptions.message}</p>`||""}${this.alertOptions?.actions?.map(r=>d`<calcite-button slot=actions-end .kind=${r.kind} .appearance=${r.appearance} @click=${r.clickHandler}>${r.text}</calcite-button>`)}</calcite-alert></calcite-dialog>${this.showAssociatedAccountsWarning&&d`<arcgis-portal-account-switcher-accounts .portal=${s} .targetUser=${this.targetUser} .accounts=${this.userAccounts??[]} @arcgisLinkAll=${()=>{this.linkAccount(this.targetUser,this.targetToken)}} @arcgisCloseDialog=${()=>{this.showAssociatedAccountsWarning=!1}}></arcgis-portal-account-switcher-accounts>`||""}`}};x("arcgis-portal-account-switcher",S);return S},"identity/IdentityManager","intl",a,b,c)
|
package/dist/cdn/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as r}from"./WMT55UQD.js";import{z as e}from"./EXBWPG5Y.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var a=e(r,{"arcgis-portal-account-switcher":[()=>import("./
|
|
2
|
+
import{a as r}from"./WMT55UQD.js";import{z as e}from"./EXBWPG5Y.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var a=e(r,{"arcgis-portal-account-switcher":[()=>import("./GDKX2CGS.js"),"clientId,messages:,portal:,redirectUri,signout,signoutOptions:"],"arcgis-portal-account-switcher-accounts":[()=>import("./MDGR5FJS.js"),"accounts:,messages:,portal:,targetUser"],"arcgis-portal-account-switcher-list":[()=>import("./5D75JDVE.js"),"accountAccess:,actions:,interactive,linkedAccounts:,messages:,portal:,signedInUsers:"],"arcgis-portal-account-switcher-signout":[()=>import("./GOHJT66O.js"),"messages:,portal:,signedInAccounts:"],"arcgis-portal-add-gps-metadata":[()=>import("./Q5GFMD4E.js"),"item:,itemId,messages:,portal:"],"arcgis-portal-ai-assistant":[()=>import("./3YCGEFQP.js"),"autoDestroyDisabled,config:,defaultClosed,disabledAgents:,navigationCapabilities:,navigationTargetMap:,portal:,t9n:,useProdDocAssistant,user:"],"arcgis-portal-ai-assistant-interrupt":[()=>import("./6NRVGSZJ.js"),"_messages:,message,options:,type"],"arcgis-portal-browser":[()=>import("./7TN5Q3I2.js"),"_messages:,alwaysShowContent,alwaysShowPagination,alwaysShowSelection,formFactor,height,hideContentTop,hideFilters,hideTopBar,loading,panel,preview,rangeFormatter:,response:,searchTerm,selected:,showPreSearch,store:;scrollToTop"],"arcgis-portal-browser-actions":[()=>import("./E2AHTEKS.js"),"_messages:,actions:,selection:;restoreFocus"],"arcgis-portal-browser-filter-status":[()=>import("./4FQWB6HA.js"),"_messages:,browserWidth,componentWidth,filters:,hiddenFilterIds:"],"arcgis-portal-browser-pagination":[()=>import("./4LMVMZGG.js"),"_messages:,num,start,store:,total;nextPage"],"arcgis-portal-browser-search":[()=>import("./UFNGJCCT.js"),"_messages:,allowClear,placeholder,store:,term;setFocus"],"arcgis-portal-browser-sort":[()=>import("./PEO5PFZF.js"),"_messages:,appearance,field,options:,order,showText,useDeleted"],"arcgis-portal-browser-top-bar":[()=>import("./KS2JQYWA.js"),"_messages:,filtersDisabled,store:"],"arcgis-portal-browser-view":[()=>import("./27HHZHV5.js"),"options:,store:,view,viewText"],"arcgis-portal-classification-banner":[()=>import("./KWEVRR34.js"),"autoDestroyDisabled,messages:,missingExistingClassification,portalItem:,validationErrors,variant;destroy"],"arcgis-portal-classification-config":[()=>import("./EJXMHOYA.js"),"autoDestroyDisabled,messages:,portalItem:,status,valid,values;destroy,resetForm,validateForm"],"arcgis-portal-classification-favorite":[()=>import("./KOZMWZTT.js"),"attributeExpressionResults:,classificationValue:,favoriteClassifications:,messages:,portalItem:,resetFavoriteClassification:,selectedFavoriteClassificationName,updateClassificationData:"],"arcgis-portal-classification-form-element":[()=>import("./C2WQAFUM.js"),"attribute:,attributeKey,isRequiredErrors:,messages:,renderingInfo:,value:"],"arcgis-portal-delete-items":[()=>import("./JIBKSQBE.js"),"active,disableLinks,items:,messages:,portal:,user:"],"arcgis-portal-extent-picker":[()=>import("./74OADAQ6.js"),"active,contentOnly,extentService,extentValue:,isArea,itemId,messages:,portal:;;getExtent"],"arcgis-portal-extent-picker-coord-field":[()=>import("./BJ6YM6ZC.js"),"errorMessage,inputId,label,max,min,relatedErrorMessage,validateRelated:,value;;checkRelatedField,isValid,setFocus"],"arcgis-portal-field-delete":[()=>import("./EBUPCIL6.js"),"config:,fieldNames:,layer:,mapView:,messages:,options:"],"arcgis-portal-group-badges":[()=>import("./BV6XVVX2.js"),"_messages:,appearance,empty,group:,portal:,scale,showTooltips,width"],"arcgis-portal-group-browser":[()=>import("./426RS2JW.js"),"_browserMessages:,_messages:,alwaysShowSelection,cards:,fetch:,filters:,formFactor,hasIndoorsSpaces,height,hidePreviewBadges,hidePreviewFooter,hideTopBar,loading,messageOverrides:,num,portal:,preflight:,preview,q,searchParamInteraction:,searchTerm,searchUser,selected:,selection,sort:,store:,view;clearFilters,refresh"],"arcgis-portal-group-browser-card":[()=>import("./SABP5QOL.js"),"browser:,cardProps:,group:;restoreFocus"],"arcgis-portal-group-browser-preview":[()=>import("./CVTQ3A4T.js"),"currentResponse:,group:,hideBadges,hidePreviewFooter,messages:,portal:,previewFooterActionsSpaced,user:;setFocus"],"arcgis-portal-group-browser-preview-card":[()=>import("./VXAWOPU3.js"),"baseUrl,hideItemType,hideOwner,hideThumbnail,interactive,item:,link,newTab,portal:,showBadges,showDateUpdated,showOwnerPopup,showSummary,user:;restoreFocus"],"arcgis-portal-group-card":[()=>import("./HKD2GF4M.js"),"disabled,group:,hideBadges,hideDateUpdated,hideOwner,hideViewableBy,indeterminate,link,linkHandler:,messages:,name,newTab,portal:,preview,previewed,selected,selection,showDateCreated,showSummary,user:,view;restoreFocus"],"arcgis-portal-group-thumbnail":[()=>import("./4BQASKGB.js"),"group:,portal:,scale,tooltip"],"arcgis-portal-info-banner":[()=>import("./BNFEED2K.js"),"config:,position"],"arcgis-portal-item-actions":[()=>import("./LL5AA56F.js"),"actions:,item:,keyHandler:,label,messages:,portal:,previewText,showFavorite,showPreview,tabIndexOverride,user:;setFocus"],"arcgis-portal-item-badges":[()=>import("./L33CMX4M.js"),"appearance,empty,item:,portal:,scale,showTooltips,useProduction,user:,width"],"arcgis-portal-item-badge":[()=>import("./FED2DOMO.js"),"_messages:,appearance,badgeType,item:,portal:,scale,showTooltip,useProduction,user:,width"],"arcgis-portal-item-card":[()=>import("./WKJEITKD.js"),"actions:,disabled,disableSelection,hideActionsStart,item:,link,linkHandler:,messages:,name,newTab,portal:,preview,previewed,recycleBin,selected,selection,showAccess,showBadges,showBadgeTooltips,showDateUpdated,showFavorite,showFavoriteInActionsMenu,showItemType,showItemTypeHosted,showOwner,showSummary,showThumbnail,user:,userPopupZIndex,view;restoreFocus"],"arcgis-portal-item-favorite":[()=>import("./3NA4M2MH.js"),"iconOnly,item:,messages:,portal:,scale,showTooltip,user:,width;setFocus"],"arcgis-portal-item-thumbnail":[()=>import("./M33TAW7V.js"),"cacheString,generate,item:,portal:,serviceInfo:,useProduction,user:;generateThumbnail"],"arcgis-portal-item-type":[()=>import("./FNHI7NZ4.js"),"ellipsis,hideIcon,hideText,item:,messages:,portal:,scale,serviceInfo:,showHosted,user:"],"arcgis-portal-mentionable-text-area":[()=>import("./ZP4Q36AO.js"),"disabled,maxLength,placeholder,popoverListLabel,popoverPlacement,portal:,readOnly,rows,scale,starters:,user:,value;closePopover,focusTextArea,selectItem"],"arcgis-portal-navigation":[()=>import("./FOHZXQNV.js"),"clientId,currentPathname,disableNotebookServer,disableTrackViewer,maxWidth,messages:,portal:,portalItem:,product,productHref,projectMenuIcon,projectMenuOptions:,projectMenuSaveIndicator,projectTitle,projectTitleSave:"],"arcgis-portal-replacement-item-redirect":[()=>import("./EOQHBWKK.js"),"itemId,messages:,portal:,user:;setFocus"],"arcgis-portal-review-related-items":[()=>import("./KCLCOBT2.js"),"messages:,portal:,relatedItems:,sourceItem:,user:"],"arcgis-portal-sublayer-type":[()=>import("./VX6EE6FY.js"),"geometry,hideIcon,hideName,hideType,messages:,name,renderer:,scale,type,underline"],"arcgis-portal-user-avatar":[()=>import("./H5RBBOBZ.js"),"checkOnline,description,heading,hideAvatar,messages:,portal:,scale,showName,underline,user:,username,wrap"],"arcgis-portal-user-popup":[()=>import("./YARGA5LY.js"),"appearance,avatarAriaHidden,baseUrl,checkOnline,fullName,item:,messages:,portal:,scale,showAvatar,showName,showUsername,underline,user:,username,wrap,zIndex;openPopup,setFocus"],"arcgis-portal-voice-input":[()=>import("./6FKARLGX.js"),"language;clearText,startListening,stopListening"]});a({resourcesUrl:import.meta.url});var t=new CSSStyleSheet;t.replaceSync("@layer{:not([hydrated]):is(arcgis-portal-account-switcher,arcgis-portal-account-switcher-accounts,arcgis-portal-account-switcher-list,arcgis-portal-account-switcher-signout,arcgis-portal-add-gps-metadata,arcgis-portal-ai-assistant,arcgis-portal-ai-assistant-interrupt,arcgis-portal-browser,arcgis-portal-browser-actions,arcgis-portal-browser-filter-status,arcgis-portal-browser-pagination,arcgis-portal-browser-search,arcgis-portal-browser-sort,arcgis-portal-browser-top-bar,arcgis-portal-browser-view,arcgis-portal-classification-banner,arcgis-portal-classification-config,arcgis-portal-classification-favorite,arcgis-portal-classification-form-element,arcgis-portal-delete-items,arcgis-portal-extent-picker,arcgis-portal-field-delete,arcgis-portal-group-badges,arcgis-portal-group-browser,arcgis-portal-group-browser-card,arcgis-portal-group-browser-preview,arcgis-portal-group-browser-preview-card,arcgis-portal-group-card,arcgis-portal-group-thumbnail,arcgis-portal-info-banner,arcgis-portal-item-actions,arcgis-portal-item-badges,arcgis-portal-item-badge,arcgis-portal-item-card,arcgis-portal-item-favorite,arcgis-portal-item-thumbnail,arcgis-portal-item-type,arcgis-portal-mentionable-text-area,arcgis-portal-navigation,arcgis-portal-replacement-item-redirect,arcgis-portal-review-related-items,arcgis-portal-sublayer-type,arcgis-portal-user-avatar,arcgis-portal-user-popup,arcgis-portal-voice-input){visibility:hidden}}");document.adoptedStyleSheets=[...document.adoptedStyleSheets,t];window.$arcgis||Object.defineProperty(window,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),((a,r)=>{a.t=(c,...x)=>Promise.all(x.map(x=>x.then?x:(!a?.forceESM&&a?.import||(x=>import(x+".js").then(m=>m.default??m)))("@arcgis/core/"+x))).then(c);r.p=a.t(([m])=>{r.t=m.trackAccess;r.o=m.createObservable;r.c=m.createTrackingTarget;r.r=m.runTracked},"applications/Components/reactiveUtils")})($arcgis,r)
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
2
|
import { c as C } from "../../chunks/runtime.js";
|
|
3
3
|
import { keyed as v } from "lit/directives/keyed.js";
|
|
4
|
-
import { LitElement as x, createEvent as
|
|
4
|
+
import { LitElement as x, createEvent as U, safeClassMap as T, nothing as M } from "@arcgis/lumina";
|
|
5
5
|
import { html as d, svg as K } from "lit";
|
|
6
6
|
import { s as N } from "../../chunks/portal-account-switcher.js";
|
|
7
7
|
import { g as E, a as H, l as P, u as W } from "../../chunks/user.js";
|
|
8
|
-
import
|
|
8
|
+
import p from "@arcgis/core/identity/IdentityManager.js";
|
|
9
9
|
import { t as B } from "../../chunks/functionalities.js";
|
|
10
10
|
import { u as R } from "../../chunks/useT9n.js";
|
|
11
11
|
import { m as J } from "../../chunks/icons.js";
|
|
12
12
|
import { substitute as k } from "@arcgis/core/intl.js";
|
|
13
13
|
import { g as D } from "../../chunks/services.js";
|
|
14
|
-
const
|
|
14
|
+
const b = 1260 * 1e3, j = 2500;
|
|
15
15
|
function _(r, e = "_blank", s = 582, t = 670) {
|
|
16
|
-
const
|
|
16
|
+
const i = window.screenLeft ?? 0, n = window.screenTop ?? 0, a = window.innerWidth || document.documentElement.clientWidth || window.screen.width, o = window.innerHeight || document.documentElement.clientHeight || window.screen.height, c = a / 2 - s / 2 + i, l = o / 2 - t / 2 + n, u = window.open(r, e, `scrollbars=no, width=${s}, height=${t}, top=${l}, left=${c}`);
|
|
17
17
|
return u?.focus(), u;
|
|
18
18
|
}
|
|
19
19
|
function q(r) {
|
|
20
|
-
const e =
|
|
20
|
+
const e = p.findOAuthInfo(r.url), { locale: s = "en", expiration: t = b } = e ?? {}, i = new URLSearchParams({
|
|
21
21
|
locale: s,
|
|
22
22
|
// Linking accounts ALWAYS uses the "arcgisonline" client id
|
|
23
23
|
client_id: "arcgisonline",
|
|
@@ -30,35 +30,38 @@ function q(r) {
|
|
|
30
30
|
parent: window.location.origin,
|
|
31
31
|
redirect_uri: `https://${r.portalHostname}/home/link_account_callback.html`,
|
|
32
32
|
state: JSON.stringify({ useMessage: !0 })
|
|
33
|
-
}),
|
|
34
|
-
_(
|
|
33
|
+
}), n = `https://${r.portalHostname}/sharing/oauth2/authorize?${i.toString()}`;
|
|
34
|
+
_(n);
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function S(r) {
|
|
37
37
|
const {
|
|
38
38
|
config: e,
|
|
39
39
|
token: s,
|
|
40
40
|
clientId: t = "arcgisonline",
|
|
41
|
-
redirectToClientUri:
|
|
42
|
-
displaySignoutComplete:
|
|
43
|
-
|
|
41
|
+
redirectToClientUri: i = !1,
|
|
42
|
+
displaySignoutComplete: n = !1,
|
|
43
|
+
clientUri: a
|
|
44
|
+
} = r, o = new URLSearchParams({
|
|
44
45
|
display: "iframe",
|
|
45
46
|
client_id: t,
|
|
46
47
|
...s && { token: s },
|
|
47
48
|
parent: window.location.origin,
|
|
48
|
-
redirect_uri: `${e.baseUrl}/check_sign_in_status.html`,
|
|
49
|
+
redirect_uri: `${e.baseUrl}/home/check_sign_in_status.html`,
|
|
49
50
|
state: JSON.stringify({
|
|
50
51
|
signout: !0,
|
|
51
52
|
origin: window.location.origin,
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
accountOrigin: `${e.restBaseUrl}/`,
|
|
54
|
+
redirectToClientUri: i,
|
|
55
|
+
displaySignoutComplete: n,
|
|
56
|
+
...a && { redirectUri: a }
|
|
54
57
|
})
|
|
55
|
-
}),
|
|
56
|
-
|
|
58
|
+
}), c = `${e.restBaseUrl}/oauth2/signout?${o.toString()}`, l = document.createElement("iframe");
|
|
59
|
+
l.src = c, l.style.display = "none", document.body.appendChild(l);
|
|
57
60
|
}
|
|
58
61
|
function z(r, e, s) {
|
|
59
|
-
const t = h(r.orgUrlKey, e),
|
|
62
|
+
const t = h(r.orgUrlKey, e), i = p.findOAuthInfo(t), { appId: n, locale: a = "en", expiration: o = b } = i ?? {}, c = I(r.provider), l = new URLSearchParams({
|
|
60
63
|
locale: a,
|
|
61
|
-
client_id: s ??
|
|
64
|
+
client_id: s ?? n ?? "arcgisonline",
|
|
62
65
|
response_type: "token",
|
|
63
66
|
expiration: `${o}`,
|
|
64
67
|
parent: window.location.origin,
|
|
@@ -72,7 +75,7 @@ function z(r, e, s) {
|
|
|
72
75
|
portalUrl: t,
|
|
73
76
|
origin: window.location.origin
|
|
74
77
|
})
|
|
75
|
-
}), u = `${
|
|
78
|
+
}), u = `${O(r, e)}?${l.toString()}`;
|
|
76
79
|
_(u);
|
|
77
80
|
}
|
|
78
81
|
function F({
|
|
@@ -81,55 +84,55 @@ function F({
|
|
|
81
84
|
usersToFilter: s = [],
|
|
82
85
|
accountsToFilter: t = ""
|
|
83
86
|
}) {
|
|
84
|
-
const
|
|
85
|
-
return r.reduce((
|
|
87
|
+
const i = {};
|
|
88
|
+
return r.reduce((n, a) => {
|
|
86
89
|
const o = {
|
|
87
90
|
disabled: a.disabled ?? !1,
|
|
88
91
|
allowed: a.clientAppAccessAllowed ?? !0
|
|
89
92
|
};
|
|
90
|
-
return
|
|
91
|
-
},
|
|
93
|
+
return n[a.username] = o, (s.includes(a.username) || s.includes(a.username.toLowerCase()) || t === "org" && a.orgUrlKey || e === "esriapps" && a.userType !== "both") && (o.allowed = !1), n;
|
|
94
|
+
}, i), i;
|
|
92
95
|
}
|
|
93
96
|
function G({
|
|
94
97
|
account: r,
|
|
95
98
|
credential: e,
|
|
96
99
|
clientId: s,
|
|
97
100
|
portal: t,
|
|
98
|
-
redirectUri:
|
|
101
|
+
redirectUri: i
|
|
99
102
|
}) {
|
|
100
|
-
const
|
|
103
|
+
const n = I(r.provider), a = O(r, t), o = i || L(r, t), c = new URLSearchParams({
|
|
101
104
|
client_id: s,
|
|
102
105
|
redirect_uri: o,
|
|
103
106
|
parent: window.location.origin,
|
|
104
107
|
response_type: "token",
|
|
105
108
|
force_login: "false",
|
|
106
109
|
...e.userId && { prepopulatedusername: e.userId },
|
|
107
|
-
...
|
|
108
|
-
expiration: `${(e?.expires ?? Date.now() +
|
|
110
|
+
...n === "social" && { socialLoginProviderName: r.provider },
|
|
111
|
+
expiration: `${(e?.expires ?? Date.now() + b) - Date.now()}`
|
|
109
112
|
});
|
|
110
113
|
return `${a}?${c.toString()}`;
|
|
111
114
|
}
|
|
112
|
-
function
|
|
115
|
+
function I(r) {
|
|
113
116
|
return Q(r) ? "social" : r === "enterprise" ? "enterprise" : r.includes("oidc") ? "oidc" : "default";
|
|
114
117
|
}
|
|
115
118
|
function Q(r) {
|
|
116
119
|
return ["apple", "facebook", "github", "google"].includes(r);
|
|
117
120
|
}
|
|
118
|
-
function
|
|
119
|
-
const s = h(r.orgUrlKey, e).toLowerCase(), t =
|
|
120
|
-
let
|
|
121
|
+
function O(r, e) {
|
|
122
|
+
const s = h(r.orgUrlKey, e).toLowerCase(), t = I(r.provider);
|
|
123
|
+
let i = "";
|
|
121
124
|
switch (t) {
|
|
122
125
|
case "social":
|
|
123
|
-
|
|
126
|
+
i = "social/";
|
|
124
127
|
break;
|
|
125
128
|
case "enterprise":
|
|
126
|
-
|
|
129
|
+
i = "saml/";
|
|
127
130
|
break;
|
|
128
131
|
case "oidc":
|
|
129
|
-
|
|
132
|
+
i = `oidc/${r.provider.split("_")[1]}/`;
|
|
130
133
|
break;
|
|
131
134
|
}
|
|
132
|
-
return `${s}/sharing/rest/oauth2/${
|
|
135
|
+
return `${s}/sharing/rest/oauth2/${i}authorize`;
|
|
133
136
|
}
|
|
134
137
|
function h(r, e) {
|
|
135
138
|
return r?.startsWith("https://") ? r : r && e.customBaseUrl ? `https://${r}.${e.customBaseUrl}` : `https://${e.portalHostname}`;
|
|
@@ -138,30 +141,30 @@ function L(r, e) {
|
|
|
138
141
|
return `${h(r.orgUrlKey, e)}/home/accountswitcher-callback.html`;
|
|
139
142
|
}
|
|
140
143
|
function V(r, e) {
|
|
141
|
-
return
|
|
144
|
+
return p.findCredential(h(r.orgUrlKey, e), r.username);
|
|
142
145
|
}
|
|
143
146
|
function X(r, e) {
|
|
144
147
|
const s = V(r, e);
|
|
145
148
|
if (s)
|
|
146
149
|
return s;
|
|
147
|
-
const t = h(r.orgUrlKey, e),
|
|
150
|
+
const t = h(r.orgUrlKey, e), i = `${t}/home/check_sign_in_status.html#state=${JSON.stringify({
|
|
148
151
|
origin: window.location.origin,
|
|
149
152
|
server: t,
|
|
150
153
|
orgKey: t
|
|
151
154
|
})}`;
|
|
152
|
-
Y(
|
|
155
|
+
Y(i, `iframe__for-${t}`);
|
|
153
156
|
}
|
|
154
157
|
function Y(r, e) {
|
|
155
158
|
const s = document.createElement("iframe");
|
|
156
159
|
s.src = r, s.id = e, s.style.display = "none", document.body.appendChild(s);
|
|
157
160
|
}
|
|
158
|
-
const
|
|
161
|
+
const y = 100;
|
|
159
162
|
class Z extends x {
|
|
160
163
|
constructor() {
|
|
161
164
|
super(), this.messages = R({ blocking: !0 }), this.targetUser = "", this.targetToken = "", this.accountAccess = {}, this.remainingSignouts = 0, this.signoutHandle = 0, this.linkedAccounts = [], this.loading = !1, this.signedInStatus = {}, this.showAssociatedAccountsWarning = !1, this.signedInAccounts = [], this.clientId = "arcgisonline", this.signout = !1, this.signoutOptions = {
|
|
162
165
|
redirectToClientUri: !1,
|
|
163
166
|
displaySignoutComplete: !1
|
|
164
|
-
}, this.arcgisAccountSwitch =
|
|
167
|
+
}, this.arcgisAccountSwitch = U(), this.arcgisClose = U(), this.arcgisSignoutComplete = U(), this.listenOn(window, "message", this.handleMessageEvent);
|
|
165
168
|
}
|
|
166
169
|
static {
|
|
167
170
|
this.properties = { linkedAccounts: 16, userAccounts: 16, user: 16, credential: 16, alertOptions: 16, loading: 16, signedInStatus: 16, showAssociatedAccountsWarning: 16, signedInAccounts: 16, portal: 0, clientId: 1, redirectUri: 1, signout: 5, signoutOptions: 0 };
|
|
@@ -176,20 +179,21 @@ class Z extends x {
|
|
|
176
179
|
}
|
|
177
180
|
if (e.has("linkedAccounts") || e.has("signedInStatus")) {
|
|
178
181
|
if (this.signout) {
|
|
179
|
-
const { signedInStatus: s, linkedAccounts: t, portal:
|
|
180
|
-
this.remainingSignouts =
|
|
181
|
-
const
|
|
182
|
-
let { displaySignoutComplete: g = !0, redirectToClientUri:
|
|
183
|
-
|
|
184
|
-
const w =
|
|
185
|
-
|
|
182
|
+
const { signedInStatus: s, linkedAccounts: t, portal: i, signoutOptions: n, clientId: a, user: o, redirectUri: c } = this, l = Object.keys(s).filter((A) => s[A] !== null).map((A) => t.find(($) => $.username === A));
|
|
183
|
+
this.remainingSignouts = l.length + 1;
|
|
184
|
+
const u = h(i.urlKey ?? "", i), m = `${u}/sharing/rest`;
|
|
185
|
+
let { displaySignoutComplete: g = !0, redirectToClientUri: f = !0 } = n;
|
|
186
|
+
l.length > 0 && (g = !1, f = !1), this.loading = !0;
|
|
187
|
+
const w = p.findCredential(u, o?.id || o?.username);
|
|
188
|
+
S({
|
|
186
189
|
displaySignoutComplete: g,
|
|
187
|
-
redirectToClientUri:
|
|
190
|
+
redirectToClientUri: f,
|
|
188
191
|
clientId: a,
|
|
189
|
-
config: { baseUrl:
|
|
190
|
-
token: w?.token
|
|
192
|
+
config: { baseUrl: u, restBaseUrl: m },
|
|
193
|
+
token: w?.token,
|
|
194
|
+
clientUri: f ? c : void 0
|
|
191
195
|
}), this.signoutHandle = window.setTimeout(() => {
|
|
192
|
-
this.remainingSignouts -= 1, this.finishSignout({ accountOrigin:
|
|
196
|
+
this.remainingSignouts -= 1, this.finishSignout({ accountOrigin: u, redirectToClientUri: f, displaySignoutComplete: g });
|
|
193
197
|
}, j);
|
|
194
198
|
}
|
|
195
199
|
return;
|
|
@@ -224,46 +228,46 @@ class Z extends x {
|
|
|
224
228
|
}
|
|
225
229
|
}
|
|
226
230
|
handleSignoutMessage(e) {
|
|
227
|
-
const { error: s, signout: t, accountOrigin:
|
|
231
|
+
const { error: s, signout: t, accountOrigin: i, redirectToClientUri: n, displaySignoutComplete: a } = e.data;
|
|
228
232
|
if (this.remainingSignouts -= 1, s && s !== "unknown") {
|
|
229
233
|
console.error(s), this.showAlert("danger", this.messages.errors.signout);
|
|
230
234
|
return;
|
|
231
235
|
}
|
|
232
|
-
t && (this.user = void 0, this.credential = void 0, this.finishSignout({ accountOrigin:
|
|
236
|
+
t && (this.user = void 0, this.credential = void 0, this.finishSignout({ accountOrigin: i, redirectToClientUri: n, displaySignoutComplete: a }));
|
|
233
237
|
}
|
|
234
238
|
handleSigninMessage(e) {
|
|
235
|
-
const { messages: s, clientId: t } = this, { error:
|
|
236
|
-
if (
|
|
237
|
-
console.error(
|
|
239
|
+
const { messages: s, clientId: t } = this, { error: i, status: n, state: a, access_token: o, ssl: c } = e.data;
|
|
240
|
+
if (i) {
|
|
241
|
+
console.error(i), this.showAlert("danger", s.errors.signin);
|
|
238
242
|
return;
|
|
239
243
|
}
|
|
240
|
-
if (
|
|
241
|
-
const { portal: l, user: u, redirectUri:
|
|
242
|
-
|
|
243
|
-
const
|
|
244
|
+
if (n === "success") {
|
|
245
|
+
const { portal: l, user: u, redirectUri: m } = this, g = this.linkedAccounts.find(($) => $.username === a.user);
|
|
246
|
+
g?.orgUrlKey === this.portal.urlKey && p.findCredential(`https://${l.portalHostname}`, u?.username)?.destroy();
|
|
247
|
+
const f = {
|
|
244
248
|
server: a.portalUrl,
|
|
245
249
|
userId: a.user,
|
|
246
250
|
token: o,
|
|
247
251
|
expires: Number(e.data.expires_in) + Date.now(),
|
|
248
252
|
ssl: c === void 0 || c !== "false"
|
|
249
253
|
};
|
|
250
|
-
|
|
251
|
-
const
|
|
252
|
-
account:
|
|
253
|
-
credential:
|
|
254
|
+
p.registerToken(f);
|
|
255
|
+
const w = G({
|
|
256
|
+
account: g,
|
|
257
|
+
credential: f,
|
|
254
258
|
clientId: t,
|
|
255
259
|
portal: l,
|
|
256
|
-
redirectUri:
|
|
260
|
+
redirectUri: m
|
|
257
261
|
});
|
|
258
|
-
window.self !== window.top ? window.top?.postMessage({ type: "navigate", url:
|
|
262
|
+
window.self !== window.top ? window.top?.postMessage({ type: "navigate", url: w }) : window.location.href = w;
|
|
259
263
|
}
|
|
260
264
|
}
|
|
261
265
|
handleCheckSignInStatusMessage(e) {
|
|
262
|
-
const { success: s, orgKey: t, server:
|
|
263
|
-
t &&
|
|
266
|
+
const { success: s, orgKey: t, server: i, userId: n, token: a, expires: o, ssl: c } = e.data;
|
|
267
|
+
t && i && s && n && a && o && c !== void 0 && (this.signedInStatus[n] = { token: a, expires: o, ssl: c });
|
|
264
268
|
}
|
|
265
269
|
async handleLinkUserMessage(e) {
|
|
266
|
-
const { error: s, username: t, access_token:
|
|
270
|
+
const { error: s, username: t, access_token: i } = e.data, { portal: n, user: a, linkedAccounts: o, messages: c } = this;
|
|
267
271
|
if (s) {
|
|
268
272
|
if (s.toString().toLowerCase().includes("user denied your request"))
|
|
269
273
|
return;
|
|
@@ -278,12 +282,12 @@ class Z extends x {
|
|
|
278
282
|
this.showAlert("danger", k(c.errors.alreadyLinked, { username: t }));
|
|
279
283
|
return;
|
|
280
284
|
}
|
|
281
|
-
const l = await E(
|
|
285
|
+
const l = await E(n, t, i);
|
|
282
286
|
if (l?.length) {
|
|
283
|
-
this.userAccounts = l, this.targetUser = t ?? "", this.targetToken =
|
|
287
|
+
this.userAccounts = l, this.targetUser = t ?? "", this.targetToken = i ?? "", this.showAssociatedAccountsWarning = !0;
|
|
284
288
|
return;
|
|
285
289
|
}
|
|
286
|
-
this.linkAccount(t,
|
|
290
|
+
this.linkAccount(t, i);
|
|
287
291
|
}
|
|
288
292
|
handleExchangeTokenMessage(e) {
|
|
289
293
|
const s = typeof e.data == "string" ? JSON.parse(e.data) : e.data;
|
|
@@ -291,7 +295,7 @@ class Z extends x {
|
|
|
291
295
|
if (s.error)
|
|
292
296
|
console.error(s);
|
|
293
297
|
else if (s.status === "success" && this.targetUser) {
|
|
294
|
-
const { portal: t, linkedAccounts:
|
|
298
|
+
const { portal: t, linkedAccounts: i, targetUser: n, clientId: a } = this, o = i.find((g) => g.username === n);
|
|
295
299
|
if (!o)
|
|
296
300
|
return;
|
|
297
301
|
const c = L(o, t), l = h(o.orgUrlKey, t), u = new URLSearchParams({
|
|
@@ -302,13 +306,13 @@ class Z extends x {
|
|
|
302
306
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
303
307
|
redirect_uri: c,
|
|
304
308
|
state: JSON.stringify({ user: o.username, portalUrl: l })
|
|
305
|
-
}),
|
|
306
|
-
window.opener ? (window.opener.location.href =
|
|
309
|
+
}), m = `${O(o, t)}?${u.toString()}`;
|
|
310
|
+
window.opener ? (window.opener.location.href = m, window.close()) : window.location.href = m;
|
|
307
311
|
}
|
|
308
312
|
}
|
|
309
313
|
}
|
|
310
314
|
finishSignout({ accountOrigin: e, redirectToClientUri: s, displaySignoutComplete: t }) {
|
|
311
|
-
this.signoutHandle && window.clearTimeout(this.signoutHandle), e === window.location.origin &&
|
|
315
|
+
this.signoutHandle && window.clearTimeout(this.signoutHandle), e === window.location.origin && p.destroyCredentials(), console.info("Signout complete", e, s, t), this.remainingSignouts <= 0 && this.arcgisSignoutComplete.emit({ accountOrigin: e, redirectToClientUri: s, displaySignoutComplete: t });
|
|
312
316
|
}
|
|
313
317
|
async findLinkedUsers() {
|
|
314
318
|
if (this.loading = !0, !this.portal || !this.user) {
|
|
@@ -318,11 +322,11 @@ class Z extends x {
|
|
|
318
322
|
this.linkedAccounts = await H(this.portal, this.user), this.linkedAccounts.length && (this.signedInStatus = this.linkedAccounts.filter((e) => e.orgUrlKey !== this.portal.urlKey).reduce((e, s) => (e[s.username] = X(s, this.portal) ?? null, e), {}), this.accountAccess = F({ accounts: this.linkedAccounts, clientId: this.clientId })), this.loading = !1;
|
|
319
323
|
}
|
|
320
324
|
async linkAccount(e, s) {
|
|
321
|
-
const { portal: t, user:
|
|
322
|
-
if (!t || !
|
|
325
|
+
const { portal: t, user: i } = this;
|
|
326
|
+
if (!t || !i)
|
|
323
327
|
return;
|
|
324
|
-
const
|
|
325
|
-
if (
|
|
328
|
+
const n = await P({ portal: t, user: i, targetUser: e, targetToken: s }), { messages: a } = this;
|
|
329
|
+
if (n.error) {
|
|
326
330
|
this.showAlert("danger", k(a.errors.linkAccount, { username: e })), this.targetUser = "", this.userAccounts = [];
|
|
327
331
|
return;
|
|
328
332
|
}
|
|
@@ -332,24 +336,24 @@ class Z extends x {
|
|
|
332
336
|
async unlinkAccount(e) {
|
|
333
337
|
if (!this.portal || !this.user)
|
|
334
338
|
return;
|
|
335
|
-
const { messages: s, portal: t, user:
|
|
336
|
-
|
|
339
|
+
const { messages: s, portal: t, user: i } = this, { success: n } = await W({ portal: t, user: i, linkedUsername: e.username });
|
|
340
|
+
n ? this.showAlert("success", k(s.success.unlinkAccount, { username: e.username })) : this.showAlert("danger", k(s.errors.unlinkAccount, { username: e.username })), await this.findLinkedUsers();
|
|
337
341
|
}
|
|
338
342
|
startAccountLink() {
|
|
339
343
|
q(this.portal);
|
|
340
344
|
}
|
|
341
345
|
switchAccount(e) {
|
|
342
|
-
const { portal: s, user: t, clientId:
|
|
346
|
+
const { portal: s, user: t, clientId: i } = this;
|
|
343
347
|
if (!s || !t || !e)
|
|
344
348
|
return;
|
|
345
|
-
const
|
|
346
|
-
a &&
|
|
349
|
+
const n = h(t.sourceJSON.orgUrlKey ?? "", s), a = p.findCredential(n, t.id || t.username);
|
|
350
|
+
a && S({ config: { baseUrl: n, restBaseUrl: `${n}/sharing/rest` }, token: a?.token, clientId: i }), z(e, s, i);
|
|
347
351
|
}
|
|
348
352
|
signoutAll(e) {
|
|
349
|
-
const { portal: s, signedInStatus: t, clientId:
|
|
350
|
-
e.forEach((
|
|
351
|
-
const a = h(
|
|
352
|
-
|
|
353
|
+
const { portal: s, signedInStatus: t, clientId: i } = this;
|
|
354
|
+
e.forEach((n) => {
|
|
355
|
+
const a = h(n.orgUrlKey, s), o = `${a}/sharing/rest`, c = t[n.username];
|
|
356
|
+
S({ config: { baseUrl: a, restBaseUrl: o }, token: c?.token, clientId: i });
|
|
353
357
|
});
|
|
354
358
|
}
|
|
355
359
|
showAlert(e, s, t) {
|
|
@@ -378,26 +382,26 @@ class Z extends x {
|
|
|
378
382
|
};
|
|
379
383
|
}
|
|
380
384
|
render() {
|
|
381
|
-
const { linkedAccounts: e, accountAccess: s, user: t, portal:
|
|
382
|
-
if (!
|
|
385
|
+
const { linkedAccounts: e, accountAccess: s, user: t, portal: i, messages: n, signout: a } = this;
|
|
386
|
+
if (!i || !t)
|
|
383
387
|
return null;
|
|
384
388
|
if (a) {
|
|
385
389
|
const { signedInAccounts: o } = this;
|
|
386
|
-
return o.length === 0 ? d`<calcite-loader .label=${
|
|
390
|
+
return o.length === 0 ? d`<calcite-loader .label=${n.signingOut} .text=${n.signingOut}></calcite-loader>` : d`<arcgis-portal-account-switcher-signout .portal=${i} .signedInAccounts=${o} @arcgisSwitchAccount=${(c) => {
|
|
387
391
|
this.switchAccount(c.detail.account);
|
|
388
392
|
}} @arcgisSignOutAll=${() => {
|
|
389
393
|
this.signoutAll(o);
|
|
390
394
|
}}></arcgis-portal-account-switcher-signout>`;
|
|
391
395
|
}
|
|
392
|
-
return d`<calcite-dialog .heading=${
|
|
396
|
+
return d`<calcite-dialog .heading=${n.switchAccounts} heading-level=2 scale=m width=s open modal .loading=${this.loading} outside-close-disabled @calciteDialogClose=${() => {
|
|
393
397
|
this.arcgisClose.emit();
|
|
394
|
-
}}><calcite-block .heading=${
|
|
398
|
+
}}><calcite-block .heading=${n.currentAccount} heading-level=3 .description=${n.signedInAs} expanded class="current-account-block" tabindex=-1>${v(t.id ?? t.username, d`<calcite-block class="current-account" .label=${i.urlKey ? `${t.username}, ${i.name}` : t.username} heading-level=4 .heading=${t.username} .description=${i.urlKey ? `${t.fullName ?? t.username}, ${i.name}` : t.fullName ?? t.username}><calcite-avatar slot=content-start inert .fullName=${t.fullName ?? void 0} .username=${t.username} .userId=${t.id} .thumbnail=${D(t, i) ?? void 0}></calcite-avatar></calcite-block>`)}</calcite-block>${e.length > 0 ? d`<calcite-block .heading=${n.linkedAccounts} heading-level=3 .description=${n.linkedAccountActions} expanded class="linked-accounts-block"><calcite-button slot=content-end icon-start=plus class="link-account-button" @click=${() => this.startAccountLink()} .disabled=${e.length >= y}>${n.addAccount}</calcite-button><arcgis-portal-account-switcher-list .portal=${i} .linkedAccounts=${e} .accountAccess=${s} .signedInUsers=${Object.keys(this.signedInStatus).filter((o) => this.signedInStatus[o] !== null)} interactive @arcgisAccountSwitch=${(o) => {
|
|
395
399
|
this.switchAccount(o.detail.account);
|
|
396
400
|
}} @arcgisAccountUnlink=${(o) => {
|
|
397
401
|
this.showUnlinkConfirmation(o.detail.account);
|
|
398
|
-
}}></arcgis-portal-account-switcher-list></calcite-block>` : d`<calcite-block .heading=${
|
|
402
|
+
}}></arcgis-portal-account-switcher-list></calcite-block>` : d`<calcite-block .heading=${n.linkedAccounts} heading-level=3 expanded class="empty-accounts-block"><div class="empty-accounts-info"><svg class="empty-accounts-icon" width=48 height=48 viewBox="0 0 48 48" fill=none xmlns=http://www.w3.org/2000/svg>${K`<path d=${J.couple ?? M} fill=currentColor />`}</svg><h4>${n.emptyListTitle}</h4><p>${n.emptyList}</p><calcite-button icon-start=plus class="link-account-button" @click=${() => this.startAccountLink()} .disabled=${e.length >= y}>${n.linkAccount}</calcite-button></div></calcite-block>`}<calcite-notice kind=info .open=${e.length >= y}><div slot=message>${n.maxAccounts}</div></calcite-notice><calcite-alert .label=${n.alertLabel} slot=alerts .autoClose=${this.alertOptions?.kind !== "danger"} auto-close-duration=fast placement=bottom .kind=${this.alertOptions?.kind} .icon=${this.alertOptions?.icon} .open=${!!this.alertOptions} @calciteAlertClose=${() => {
|
|
399
403
|
this.alertOptions = void 0;
|
|
400
|
-
}}>${this.alertOptions?.title && d`<h4 slot=title class="alert-title">${this.alertOptions.title}</h4>` || ""}${this.alertOptions?.message && d`<p slot=message class=${T({ "alert-message": !0, "short-message": !!this.alertOptions?.actions?.length })}>${this.alertOptions.message}</p>` || ""}${this.alertOptions?.actions?.map((o) => d`<calcite-button slot=actions-end .kind=${o.kind} .appearance=${o.appearance} @click=${o.clickHandler}>${o.text}</calcite-button>`)}</calcite-alert></calcite-dialog>${this.showAssociatedAccountsWarning && d`<arcgis-portal-account-switcher-accounts .portal=${
|
|
404
|
+
}}>${this.alertOptions?.title && d`<h4 slot=title class="alert-title">${this.alertOptions.title}</h4>` || ""}${this.alertOptions?.message && d`<p slot=message class=${T({ "alert-message": !0, "short-message": !!this.alertOptions?.actions?.length })}>${this.alertOptions.message}</p>` || ""}${this.alertOptions?.actions?.map((o) => d`<calcite-button slot=actions-end .kind=${o.kind} .appearance=${o.appearance} @click=${o.clickHandler}>${o.text}</calcite-button>`)}</calcite-alert></calcite-dialog>${this.showAssociatedAccountsWarning && d`<arcgis-portal-account-switcher-accounts .portal=${i} .targetUser=${this.targetUser} .accounts=${this.userAccounts ?? []} @arcgisLinkAll=${() => {
|
|
401
405
|
this.linkAccount(this.targetUser, this.targetToken);
|
|
402
406
|
}} @arcgisCloseDialog=${() => {
|
|
403
407
|
this.showAssociatedAccountsWarning = !1;
|
|
@@ -2,14 +2,14 @@ import "@esri/calcite-components/components/calcite-chip";
|
|
|
2
2
|
import "@esri/calcite-components/components/calcite-tooltip";
|
|
3
3
|
import "@esri/calcite-components/components/calcite-list-item";
|
|
4
4
|
import "@esri/calcite-components/components/calcite-action";
|
|
5
|
-
import "../arcgis-portal-item-type/index.js";
|
|
6
|
-
import "@esri/calcite-components/components/calcite-button";
|
|
7
|
-
import "@esri/calcite-components/components/calcite-list";
|
|
8
|
-
import "@esri/calcite-components/components/calcite-input";
|
|
9
5
|
import "@esri/calcite-components/components/calcite-icon";
|
|
10
6
|
import "@esri/calcite-components/components/calcite-popover";
|
|
7
|
+
import "@esri/calcite-components/components/calcite-list";
|
|
8
|
+
import "../arcgis-portal-item-type/index.js";
|
|
11
9
|
import "@esri/calcite-components/components/calcite-loader";
|
|
10
|
+
import "@esri/calcite-components/components/calcite-button";
|
|
12
11
|
import "@esri/calcite-components/components/calcite-dropdown-item";
|
|
12
|
+
import "@esri/calcite-components/components/calcite-input";
|
|
13
13
|
import "@esri/calcite-components/components/calcite-dropdown";
|
|
14
14
|
import "../arcgis-portal-user-avatar/index.js";
|
|
15
15
|
import "@esri/calcite-components/components/calcite-dropdown-group";
|