@arcgis/portal-components 5.2.0-next.85 → 5.2.0-next.87
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/{GADH24KO.js → 25KISBCS.js} +1 -1
- package/dist/cdn/2TQ4B2LU.js +2 -0
- package/dist/cdn/4GRTJ7XT.js +2 -0
- package/dist/cdn/{ZAB6B2B6.js → 5EMPEJ65.js} +1 -1
- package/dist/cdn/C7XKSVMU.js +2 -0
- package/dist/cdn/{DHWAQSKG.js → F3LFFR3K.js} +1 -1
- package/dist/cdn/F3M3R7X2.js +2 -0
- package/dist/cdn/{CD2GV5YW.js → F76RXJ66.js} +1 -1
- package/dist/cdn/FQTFZLHT.js +2 -0
- package/dist/cdn/KYNL256E.js +2 -0
- package/dist/cdn/{NASFEWDT.js → LDYOCDG6.js} +1 -1
- package/dist/cdn/{LRADZ46B.js → NQQLTGIK.js} +1 -1
- package/dist/cdn/{R5MGNFM2.js → PMQCCLS5.js} +1 -1
- package/dist/cdn/QTKBB22S.js +2 -0
- package/dist/cdn/SYDYG3CL.js +2 -0
- package/dist/cdn/{TUBYAQ6R.js → X5B4PAML.js} +1 -1
- package/dist/cdn/{ECA5GSSU.js → X6XTK2TE.js} +1 -1
- package/dist/cdn/{6BALICUQ.js → Y56BS6IQ.js} +52 -52
- package/dist/cdn/YBWCEZJP.js +2 -0
- package/dist/cdn/assets/portal-account-switcher/t9n/messages.en.json +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/fieldAddDelete.js +1 -1
- package/dist/chunks/groups2.js +1 -1
- package/dist/chunks/item2.js +1 -1
- package/dist/chunks/portal-account-switcher.js +3 -3
- package/dist/chunks/portal.js +2 -2
- package/dist/chunks/portal2.js +1 -1
- package/dist/chunks/request.js +1 -1
- package/dist/chunks/services.js +17 -0
- package/dist/chunks/user.js +1 -1
- package/dist/chunks/utils.js +4 -4
- package/dist/components/arcgis-portal-account-switcher/customElement.d.ts +22 -2
- package/dist/components/arcgis-portal-account-switcher/customElement.js +211 -207
- package/dist/components/arcgis-portal-account-switcher/index.js +1 -3
- package/dist/components/arcgis-portal-account-switcher/types.d.ts +6 -0
- package/dist/components/arcgis-portal-account-switcher-accounts/customElement.d.ts +20 -2
- package/dist/components/arcgis-portal-account-switcher-accounts/customElement.js +5 -5
- package/dist/components/arcgis-portal-account-switcher-list/customElement.d.ts +22 -4
- package/dist/components/arcgis-portal-account-switcher-list/customElement.js +58 -37
- package/dist/components/arcgis-portal-account-switcher-list/index.js +2 -3
- package/dist/components/arcgis-portal-ai-assistant/agents/portalRouteKeys.d.ts +25 -16
- package/dist/components/arcgis-portal-ai-assistant/agents/types.d.ts +4 -4
- package/dist/components/arcgis-portal-ai-assistant/customElement.js +611 -603
- package/dist/components/arcgis-portal-field-delete/customElement.js +1 -1
- package/dist/components/arcgis-portal-group-browser/customElement.js +1 -1
- package/dist/components/arcgis-portal-group-thumbnail/customElement.js +1 -1
- package/dist/components/arcgis-portal-navigation/customElement.js +1 -2
- package/dist/components/arcgis-portal-user-avatar/customElement.js +25 -36
- package/dist/components/arcgis-portal-user-popup/customElement.js +27 -27
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/loader.js +4 -4
- package/dist/types/lumina.d.ts +2 -2
- package/dist/types/preact.d.ts +2 -2
- package/dist/types/react.d.ts +2 -2
- package/dist/types/stencil.d.ts +2 -2
- package/dist/types/user.d.ts +1 -1
- package/package.json +7 -7
- package/dist/cdn/5MVBQWW3.js +0 -2
- package/dist/cdn/76A6NXMY.js +0 -2
- package/dist/cdn/E4D3U6ZA.js +0 -2
- package/dist/cdn/J57ZXL3U.js +0 -2
- package/dist/cdn/OAKVCMNN.js +0 -2
- package/dist/cdn/QREMLELA.js +0 -2
- package/dist/cdn/SOJ5KMMZ.js +0 -2
- package/dist/cdn/V6N5BWDA.js +0 -2
|
@@ -1,284 +1,288 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
2
|
import { c as L } from "../../chunks/runtime.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
3
|
+
import { keyed as _ } from "lit/directives/keyed.js";
|
|
4
|
+
import { LitElement as O, createEvent as b, nothing as v } from "@arcgis/lumina";
|
|
5
|
+
import { html as d, svg as x } from "lit";
|
|
6
|
+
import { s as C } from "../../chunks/portal-account-switcher.js";
|
|
7
|
+
import { g as T, a as M, l as K, u as N } from "../../chunks/user.js";
|
|
8
|
+
import g from "@arcgis/core/identity/IdentityManager.js";
|
|
8
9
|
import { t as E } from "../../chunks/functionalities.js";
|
|
9
|
-
import { u as
|
|
10
|
-
import { m as
|
|
11
|
-
import { substitute as
|
|
10
|
+
import { u as P } from "../../chunks/useT9n.js";
|
|
11
|
+
import { m as W } from "../../chunks/icons.js";
|
|
12
|
+
import { substitute as m } from "@arcgis/core/intl.js";
|
|
13
|
+
import { g as H } from "../../chunks/services.js";
|
|
12
14
|
const w = 1260 * 1e3;
|
|
13
|
-
function S(
|
|
14
|
-
const
|
|
15
|
-
return
|
|
15
|
+
function S(n, e = "_blank", s = 582, t = 670) {
|
|
16
|
+
const i = window.screenLeft ?? 0, o = window.screenTop ?? 0, r = window.innerWidth || document.documentElement.clientWidth || window.screen.width, a = window.innerHeight || document.documentElement.clientHeight || window.screen.height, c = r / 2 - s / 2 + i, l = a / 2 - t / 2 + o, u = window.open(n, e, `scrollbars=no, width=${s}, height=${t}, top=${l}, left=${c}`);
|
|
17
|
+
return u?.focus(), u;
|
|
16
18
|
}
|
|
17
|
-
function
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
expiration: s = w
|
|
22
|
-
} = t ?? {}, n = new URLSearchParams({
|
|
23
|
-
locale: e,
|
|
24
|
-
client_id: "arcgisonline",
|
|
25
|
-
//appId!,
|
|
19
|
+
function R(n, e) {
|
|
20
|
+
const s = g.findOAuthInfo(n.url), { appId: t, locale: i = "en", expiration: o = w } = s ?? {}, r = new URLSearchParams({
|
|
21
|
+
locale: i,
|
|
22
|
+
client_id: e ?? t ?? "arcgisonline",
|
|
26
23
|
response_type: "token",
|
|
27
|
-
expiration: `${
|
|
24
|
+
expiration: `${o}`,
|
|
28
25
|
linkUserRequest: "true",
|
|
29
26
|
showSocialLogins: "true",
|
|
30
27
|
hideEnterpriseLogins: "false",
|
|
31
28
|
force_login: "true",
|
|
32
29
|
parent: window.location.origin,
|
|
33
|
-
redirect_uri: `https://${
|
|
30
|
+
redirect_uri: `https://${n.portalHostname}/home/link_account_callback.html`,
|
|
34
31
|
state: JSON.stringify({ useMessage: !0 })
|
|
35
|
-
}),
|
|
36
|
-
S(
|
|
32
|
+
}), a = `https://${n.portalHostname}/sharing/oauth2/authorize?${r.toString()}`;
|
|
33
|
+
S(a);
|
|
37
34
|
}
|
|
38
|
-
function
|
|
35
|
+
function B(n) {
|
|
39
36
|
const {
|
|
40
|
-
config:
|
|
41
|
-
credential:
|
|
42
|
-
clientId:
|
|
43
|
-
redirectToClientUri:
|
|
44
|
-
displaySignoutComplete:
|
|
45
|
-
} =
|
|
37
|
+
config: e,
|
|
38
|
+
credential: s,
|
|
39
|
+
clientId: t = "arcgisonline",
|
|
40
|
+
redirectToClientUri: i = !1,
|
|
41
|
+
displaySignoutComplete: o = !1
|
|
42
|
+
} = n, r = new URLSearchParams({
|
|
46
43
|
display: "iframe",
|
|
47
|
-
client_id:
|
|
48
|
-
...
|
|
44
|
+
client_id: t,
|
|
45
|
+
...s.token && { token: s.token },
|
|
49
46
|
parent: window.location.origin,
|
|
50
|
-
redirect_uri: `${
|
|
47
|
+
redirect_uri: `${e.baseUrl}signout_callback.html`,
|
|
51
48
|
state: JSON.stringify({
|
|
52
49
|
signout: !0,
|
|
53
50
|
origin: window.location.origin,
|
|
54
|
-
redirectToClientUri:
|
|
55
|
-
displaySignoutComplete:
|
|
51
|
+
redirectToClientUri: i,
|
|
52
|
+
displaySignoutComplete: o
|
|
56
53
|
})
|
|
57
|
-
}), a = `${
|
|
54
|
+
}), a = `${e.restBaseUrl}oauth2/signout?${r.toString()}`, c = document.createElement("iframe");
|
|
58
55
|
c.src = a, c.style.display = "none", document.body.appendChild(c);
|
|
59
56
|
}
|
|
60
|
-
function
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
expiration: r = w
|
|
65
|
-
} = s ?? {}, o = $(i.provider), a = new URLSearchParams({
|
|
66
|
-
locale: n,
|
|
67
|
-
client_id: "arcgisonline",
|
|
68
|
-
//appId,
|
|
57
|
+
function J(n, e, s) {
|
|
58
|
+
const t = h(n.orgUrlKey, e), i = g.findOAuthInfo(t), { appId: o, locale: r = "en", expiration: a = w } = i ?? {}, c = $(n.provider), l = new URLSearchParams({
|
|
59
|
+
locale: r,
|
|
60
|
+
client_id: s ?? o ?? "arcgisonline",
|
|
69
61
|
response_type: "token",
|
|
70
|
-
expiration: `${
|
|
62
|
+
expiration: `${a}`,
|
|
71
63
|
parent: window.location.origin,
|
|
72
|
-
...
|
|
73
|
-
...
|
|
64
|
+
...c === "social" && { socialLoginProviderName: n.provider },
|
|
65
|
+
...c === "default" && { prepopulatedusername: n.username },
|
|
74
66
|
force_login: "true",
|
|
75
|
-
redirect_uri: `${
|
|
67
|
+
redirect_uri: `${t}/home/sign_in_callback.html`,
|
|
76
68
|
state: JSON.stringify({
|
|
77
|
-
user:
|
|
78
|
-
server:
|
|
79
|
-
portalUrl:
|
|
69
|
+
user: n.username,
|
|
70
|
+
server: t,
|
|
71
|
+
portalUrl: t,
|
|
80
72
|
origin: window.location.origin
|
|
81
73
|
})
|
|
82
|
-
}),
|
|
83
|
-
S(
|
|
74
|
+
}), u = `${A(n, e)}?${l.toString()}`;
|
|
75
|
+
S(u);
|
|
76
|
+
}
|
|
77
|
+
function D({
|
|
78
|
+
accounts: n,
|
|
79
|
+
clientId: e = "arcgisonline",
|
|
80
|
+
usersToFilter: s = [],
|
|
81
|
+
accountsToFilter: t = ""
|
|
82
|
+
}) {
|
|
83
|
+
const i = {};
|
|
84
|
+
return n.reduce((o, r) => {
|
|
85
|
+
const a = {
|
|
86
|
+
disabled: r.disabled ?? !1,
|
|
87
|
+
allowed: r.clientAppAccessAllowed ?? !0
|
|
88
|
+
};
|
|
89
|
+
return o[r.username] = a, (s.includes(r.username) || s.includes(r.username.toLowerCase()) || t === "org" && r.orgUrlKey || e === "esriapps" && r.userType !== "both") && (a.allowed = !1), o;
|
|
90
|
+
}, i), i;
|
|
84
91
|
}
|
|
85
|
-
function
|
|
86
|
-
account:
|
|
87
|
-
credential:
|
|
88
|
-
|
|
89
|
-
portal:
|
|
92
|
+
function j({
|
|
93
|
+
account: n,
|
|
94
|
+
credential: e,
|
|
95
|
+
client_id: s,
|
|
96
|
+
portal: t
|
|
90
97
|
}) {
|
|
91
|
-
const
|
|
92
|
-
client_id:
|
|
98
|
+
const i = $(n.provider), o = A(n, t), r = I(n, t), a = new URLSearchParams({
|
|
99
|
+
client_id: s,
|
|
93
100
|
redirect_uri: r,
|
|
94
101
|
parent: window.location.origin,
|
|
95
102
|
response_type: "token",
|
|
96
103
|
force_login: "false",
|
|
97
|
-
...
|
|
98
|
-
...
|
|
99
|
-
expiration: `${(
|
|
104
|
+
...e.userId && { prepopulatedusername: e.userId },
|
|
105
|
+
...i === "social" && { socialLoginProviderName: n.provider },
|
|
106
|
+
expiration: `${(e?.expires ?? Date.now() + w) - Date.now()}`
|
|
100
107
|
});
|
|
101
|
-
return `${
|
|
108
|
+
return `${o}?${a.toString()}`;
|
|
102
109
|
}
|
|
103
|
-
function $(
|
|
104
|
-
return
|
|
110
|
+
function $(n) {
|
|
111
|
+
return q(n) ? "social" : n === "enterprise" ? "enterprise" : n.includes("oidc") ? "oidc" : "default";
|
|
105
112
|
}
|
|
106
|
-
function
|
|
107
|
-
return ["apple", "facebook", "github", "google"].includes(
|
|
113
|
+
function q(n) {
|
|
114
|
+
return ["apple", "facebook", "github", "google"].includes(n);
|
|
108
115
|
}
|
|
109
|
-
function A(
|
|
110
|
-
const
|
|
111
|
-
let
|
|
112
|
-
switch (
|
|
116
|
+
function A(n, e) {
|
|
117
|
+
const s = h(n.orgUrlKey, e).toLowerCase(), t = $(n.provider);
|
|
118
|
+
let i = "";
|
|
119
|
+
switch (t) {
|
|
113
120
|
case "social":
|
|
114
|
-
|
|
121
|
+
i = "social/";
|
|
115
122
|
break;
|
|
116
123
|
case "enterprise":
|
|
117
|
-
|
|
124
|
+
i = "saml/";
|
|
118
125
|
break;
|
|
119
126
|
case "oidc":
|
|
120
|
-
|
|
127
|
+
i = `oidc/${n.provider.split("_")[1]}/`;
|
|
121
128
|
break;
|
|
122
129
|
}
|
|
123
|
-
return `${
|
|
130
|
+
return `${s}/sharing/rest/oauth2/${i}authorize`;
|
|
124
131
|
}
|
|
125
|
-
function h(
|
|
126
|
-
return
|
|
132
|
+
function h(n, e) {
|
|
133
|
+
return n?.startsWith("https://") ? n : n && e.customBaseUrl ? `https://${n}.${e.customBaseUrl}` : `https://${e.portalHostname}`;
|
|
127
134
|
}
|
|
128
|
-
function
|
|
129
|
-
return `${h(
|
|
135
|
+
function I(n, e) {
|
|
136
|
+
return `${h(n.orgUrlKey, e)}/home/accountswitcher-callback.html`;
|
|
130
137
|
}
|
|
131
|
-
function
|
|
132
|
-
origin:
|
|
133
|
-
redirectToClientUri:
|
|
134
|
-
displaySignoutComplete:
|
|
138
|
+
function z({
|
|
139
|
+
origin: n,
|
|
140
|
+
redirectToClientUri: e,
|
|
141
|
+
displaySignoutComplete: s
|
|
135
142
|
}) {
|
|
136
|
-
console.log("Signout complete",
|
|
143
|
+
console.log("Signout complete", n, e, s);
|
|
137
144
|
}
|
|
138
|
-
function
|
|
139
|
-
return
|
|
145
|
+
function F(n, e) {
|
|
146
|
+
return g.findCredential(h(n.orgUrlKey, e), n.username);
|
|
140
147
|
}
|
|
141
|
-
function
|
|
142
|
-
const
|
|
143
|
-
if (
|
|
144
|
-
return
|
|
145
|
-
const
|
|
148
|
+
function G(n, e) {
|
|
149
|
+
const s = F(n, e);
|
|
150
|
+
if (s)
|
|
151
|
+
return s;
|
|
152
|
+
const t = h(n.orgUrlKey, e), i = `${t}/home/check_sign_in_status.html#state=${JSON.stringify({
|
|
146
153
|
origin: window.location.origin,
|
|
147
|
-
server:
|
|
148
|
-
orgKey:
|
|
154
|
+
server: t,
|
|
155
|
+
orgKey: t
|
|
149
156
|
})}`;
|
|
150
|
-
|
|
157
|
+
Q(i, `iframe__for-${t}`);
|
|
151
158
|
}
|
|
152
|
-
function
|
|
153
|
-
const
|
|
154
|
-
|
|
159
|
+
function Q(n, e) {
|
|
160
|
+
const s = document.createElement("iframe");
|
|
161
|
+
s.src = n, s.id = e, s.style.display = "none", document.body.appendChild(s);
|
|
155
162
|
}
|
|
156
163
|
const k = 100;
|
|
157
|
-
class
|
|
164
|
+
class V extends O {
|
|
158
165
|
constructor() {
|
|
159
|
-
super(), this.messages =
|
|
166
|
+
super(), this.messages = P({ blocking: !0 }), this.targetUser = "", this.targetToken = "", this.accountAccess = {}, this.linkedAccounts = [], this.loading = !1, this.signedInStatus = {}, this.showAssociatedAccountsWarning = !1, this.clientId = "arcgisonline", this.arcgisAccountSwitch = b(), this.arcgisClose = b(), this.listenOn(window, "message", this.handleMessageEvent);
|
|
160
167
|
}
|
|
161
168
|
static {
|
|
162
|
-
this.properties = { linkedAccounts: 16, userAccounts: 16, user: 16, credential: 16, alertOptions: 16, loading: 16, signedInStatus: 16, showAssociatedAccountsWarning: 16, portal: 0 };
|
|
169
|
+
this.properties = { linkedAccounts: 16, userAccounts: 16, user: 16, credential: 16, alertOptions: 16, loading: 16, signedInStatus: 16, showAssociatedAccountsWarning: 16, portal: 0, clientId: 1 };
|
|
163
170
|
}
|
|
164
171
|
static {
|
|
165
|
-
this.styles =
|
|
172
|
+
this.styles = C;
|
|
166
173
|
}
|
|
167
|
-
willUpdate(
|
|
168
|
-
|
|
174
|
+
willUpdate(e) {
|
|
175
|
+
e.has("portal") && (this.user = this.portal?.user), (e.has("portal") || e.has("user")) && this.portal && this.user && this.findLinkedUsers();
|
|
169
176
|
}
|
|
170
|
-
handleMessageEvent(
|
|
171
|
-
if (new URL(
|
|
172
|
-
if (typeof
|
|
173
|
-
JSON.parse(
|
|
177
|
+
handleMessageEvent(e) {
|
|
178
|
+
if (new URL(e.origin).hostname !== "localhost" && (e.origin.endsWith(".arcgis.com") || e.origin === window.location.origin)) {
|
|
179
|
+
if (typeof e.data == "string") {
|
|
180
|
+
JSON.parse(e.data).type === "token_exchange" && this.handleExchangeTokenMessage(e);
|
|
174
181
|
return;
|
|
175
182
|
}
|
|
176
|
-
if ("type" in
|
|
177
|
-
switch (
|
|
183
|
+
if ("type" in e.data)
|
|
184
|
+
switch (e.data.type) {
|
|
178
185
|
case "signin":
|
|
179
|
-
this.handleSigninMessage(
|
|
186
|
+
this.handleSigninMessage(e);
|
|
180
187
|
return;
|
|
181
188
|
case "signout":
|
|
182
|
-
this.handleSignoutMessage(
|
|
189
|
+
this.handleSignoutMessage(e);
|
|
183
190
|
return;
|
|
184
191
|
case "linkUser":
|
|
185
|
-
this.handleLinkUserMessage(
|
|
192
|
+
this.handleLinkUserMessage(e);
|
|
186
193
|
return;
|
|
187
194
|
case "token_exchange":
|
|
188
|
-
this.handleExchangeTokenMessage(
|
|
195
|
+
this.handleExchangeTokenMessage(e);
|
|
189
196
|
return;
|
|
190
197
|
}
|
|
191
|
-
if ("credential" in
|
|
192
|
-
this.handleSigninMessage(
|
|
198
|
+
if ("credential" in e.data) {
|
|
199
|
+
this.handleSigninMessage(e);
|
|
193
200
|
return;
|
|
194
201
|
}
|
|
195
|
-
this.handleCheckSignInStatusMessage(
|
|
202
|
+
this.handleCheckSignInStatusMessage(e);
|
|
196
203
|
}
|
|
197
204
|
}
|
|
198
|
-
handleSignoutMessage(
|
|
199
|
-
const { error:
|
|
200
|
-
if (
|
|
201
|
-
console.error(
|
|
205
|
+
handleSignoutMessage(e) {
|
|
206
|
+
const { error: s, signout: t, accountOrigin: i, redirectToClientUri: o, displaySignoutComplete: r } = e.data;
|
|
207
|
+
if (s && s !== "unknown") {
|
|
208
|
+
console.error(s), this.showAlert("danger", this.messages.errors.signout);
|
|
202
209
|
return;
|
|
203
210
|
}
|
|
204
|
-
|
|
211
|
+
t && (this.user = void 0, this.credential = void 0, z({ origin: i, redirectToClientUri: o, displaySignoutComplete: r }));
|
|
205
212
|
}
|
|
206
|
-
handleSigninMessage(
|
|
207
|
-
const { messages:
|
|
208
|
-
if (
|
|
209
|
-
console.error(
|
|
213
|
+
handleSigninMessage(e) {
|
|
214
|
+
const { messages: s, clientId: t } = this, { error: i, status: o, state: r, access_token: a, ssl: c } = e.data;
|
|
215
|
+
if (i) {
|
|
216
|
+
console.error(i), this.showAlert("danger", s.errors.signin);
|
|
210
217
|
return;
|
|
211
218
|
}
|
|
212
|
-
if (
|
|
213
|
-
const {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
/* , clientId */
|
|
217
|
-
} = this, l = this.linkedAccounts.find((U) => U.username === r.user);
|
|
218
|
-
l?.orgUrlKey === this.portal.urlKey && p.findCredential(`https://${c.portalHostname}`, u?.username)?.destroy();
|
|
219
|
-
const m = {
|
|
219
|
+
if (o === "success") {
|
|
220
|
+
const { portal: l, user: u } = this, p = this.linkedAccounts.find((y) => y.username === r.user);
|
|
221
|
+
p?.orgUrlKey === this.portal.urlKey && g.findCredential(`https://${l.portalHostname}`, u?.username)?.destroy();
|
|
222
|
+
const f = {
|
|
220
223
|
server: r.portalUrl,
|
|
221
224
|
userId: r.user,
|
|
222
|
-
token:
|
|
223
|
-
expires: Number(
|
|
224
|
-
ssl:
|
|
225
|
+
token: a,
|
|
226
|
+
expires: Number(e.data.expires_in) + Date.now(),
|
|
227
|
+
ssl: c === void 0 || c !== "false"
|
|
225
228
|
};
|
|
226
|
-
|
|
227
|
-
const
|
|
228
|
-
account:
|
|
229
|
-
credential:
|
|
230
|
-
|
|
231
|
-
|
|
229
|
+
g.registerToken(f);
|
|
230
|
+
const U = j({
|
|
231
|
+
account: p,
|
|
232
|
+
credential: f,
|
|
233
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
234
|
+
client_id: t,
|
|
235
|
+
portal: l
|
|
232
236
|
});
|
|
233
|
-
window.self !== window.top ? window.top?.postMessage({ type: "navigate", url:
|
|
237
|
+
window.self !== window.top ? window.top?.postMessage({ type: "navigate", url: U }) : window.location.href = U;
|
|
234
238
|
}
|
|
235
239
|
}
|
|
236
|
-
handleCheckSignInStatusMessage(
|
|
237
|
-
const { success:
|
|
238
|
-
|
|
240
|
+
handleCheckSignInStatusMessage(e) {
|
|
241
|
+
const { success: s, orgKey: t, server: i, userId: o, token: r, expires: a, ssl: c } = e.data;
|
|
242
|
+
t && i && s && o && r && a && c !== void 0 && (this.signedInStatus[o] = { token: r, expires: a, ssl: c });
|
|
239
243
|
}
|
|
240
|
-
async handleLinkUserMessage(
|
|
241
|
-
const { error:
|
|
242
|
-
if (
|
|
243
|
-
if (
|
|
244
|
+
async handleLinkUserMessage(e) {
|
|
245
|
+
const { error: s, username: t, access_token: i } = e.data, { portal: o, user: r, linkedAccounts: a, messages: c } = this;
|
|
246
|
+
if (s) {
|
|
247
|
+
if (s.toString().toLowerCase().includes("user denied your request"))
|
|
244
248
|
return;
|
|
245
249
|
this.showAlert("danger", c.errors.accessAccount);
|
|
246
250
|
return;
|
|
247
251
|
}
|
|
248
|
-
if (
|
|
252
|
+
if (t === r?.username) {
|
|
249
253
|
this.showAlert("danger", c.errors.selfLink);
|
|
250
254
|
return;
|
|
251
255
|
}
|
|
252
|
-
if (a.find((
|
|
253
|
-
this.showAlert("danger",
|
|
256
|
+
if (a.find((u) => u.username === t)) {
|
|
257
|
+
this.showAlert("danger", m(c.errors.alreadyLinked, { username: t }));
|
|
254
258
|
return;
|
|
255
259
|
}
|
|
256
|
-
const
|
|
257
|
-
if (
|
|
258
|
-
this.userAccounts =
|
|
260
|
+
const l = await T(o, t, i);
|
|
261
|
+
if (l?.length) {
|
|
262
|
+
this.userAccounts = l, this.targetUser = t ?? "", this.targetToken = i ?? "", this.showAssociatedAccountsWarning = !0;
|
|
259
263
|
return;
|
|
260
264
|
}
|
|
261
|
-
this.linkAccount(
|
|
265
|
+
this.linkAccount(t, i);
|
|
262
266
|
}
|
|
263
|
-
handleExchangeTokenMessage(
|
|
264
|
-
const
|
|
265
|
-
if (!(
|
|
266
|
-
if (
|
|
267
|
-
console.error(
|
|
268
|
-
else if (
|
|
269
|
-
const { portal:
|
|
267
|
+
handleExchangeTokenMessage(e) {
|
|
268
|
+
const s = typeof e.data == "string" ? JSON.parse(e.data) : e.data;
|
|
269
|
+
if (!(s.type && s.type !== "token_exchange")) {
|
|
270
|
+
if (s.error)
|
|
271
|
+
console.error(s);
|
|
272
|
+
else if (s.status === "success" && this.targetUser) {
|
|
273
|
+
const { portal: t, linkedAccounts: i, targetUser: o, clientId: r } = this, a = i.find((f) => f.username === o);
|
|
270
274
|
if (!a)
|
|
271
275
|
return;
|
|
272
|
-
const c =
|
|
276
|
+
const c = I(a, t), l = h(a.orgUrlKey, t), u = new URLSearchParams({
|
|
273
277
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
274
278
|
response_type: "token",
|
|
275
279
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
276
|
-
client_id:
|
|
280
|
+
client_id: r,
|
|
277
281
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
278
282
|
redirect_uri: c,
|
|
279
|
-
state: JSON.stringify({ user: a.username, portalUrl:
|
|
280
|
-
}),
|
|
281
|
-
window.opener ? (window.opener.location.href =
|
|
283
|
+
state: JSON.stringify({ user: a.username, portalUrl: l })
|
|
284
|
+
}), p = `${A(a, t)}?${u.toString()}`;
|
|
285
|
+
window.opener ? (window.opener.location.href = p, window.close()) : window.location.href = p;
|
|
282
286
|
}
|
|
283
287
|
}
|
|
284
288
|
}
|
|
@@ -287,79 +291,79 @@ class z extends _ {
|
|
|
287
291
|
this.linkedAccounts = [], this.loading = !1;
|
|
288
292
|
return;
|
|
289
293
|
}
|
|
290
|
-
this.linkedAccounts = await
|
|
294
|
+
this.linkedAccounts = await M(this.portal, this.user), this.linkedAccounts.length && (this.signedInStatus = this.linkedAccounts.filter((e) => e.orgUrlKey !== this.portal.urlKey).reduce((e, s) => (e[s.username] = G(s, this.portal) ?? null, e), {}), this.accountAccess = D({ accounts: this.linkedAccounts, clientId: this.clientId })), this.loading = !1;
|
|
291
295
|
}
|
|
292
|
-
async linkAccount(
|
|
293
|
-
const { portal:
|
|
294
|
-
if (!
|
|
296
|
+
async linkAccount(e, s) {
|
|
297
|
+
const { portal: t, user: i } = this;
|
|
298
|
+
if (!t || !i)
|
|
295
299
|
return;
|
|
296
|
-
const
|
|
297
|
-
if (
|
|
298
|
-
this.showAlert("danger",
|
|
300
|
+
const o = await K({ portal: t, user: i, targetUser: e, targetToken: s }), { messages: r } = this;
|
|
301
|
+
if (o.error) {
|
|
302
|
+
this.showAlert("danger", m(r.errors.linkAccount, { username: e })), this.targetUser = "", this.userAccounts = [];
|
|
299
303
|
return;
|
|
300
304
|
}
|
|
301
|
-
const a = this.userAccounts?.length ?
|
|
302
|
-
this.showAlert("success",
|
|
305
|
+
const a = this.userAccounts?.length ? r.success.linkAccountMultiple : r.success.linkAccount;
|
|
306
|
+
this.showAlert("success", m(a, { username: e })), this.targetUser = "", this.userAccounts = [], await E(350), this.findLinkedUsers();
|
|
303
307
|
}
|
|
304
|
-
async unlinkAccount(
|
|
308
|
+
async unlinkAccount(e) {
|
|
305
309
|
if (!this.portal || !this.user)
|
|
306
310
|
return;
|
|
307
|
-
const { messages:
|
|
308
|
-
|
|
311
|
+
const { messages: s, portal: t, user: i } = this, { success: o } = await N({ portal: t, user: i, linkedUsername: e.username });
|
|
312
|
+
o ? this.showAlert("success", m(s.success.unlinkAccount, { username: e.username })) : this.showAlert("danger", m(s.errors.unlinkAccount, { username: e.username })), await this.findLinkedUsers();
|
|
309
313
|
}
|
|
310
314
|
startAccountLink() {
|
|
311
|
-
|
|
315
|
+
R(this.portal, this.clientId);
|
|
312
316
|
}
|
|
313
|
-
switchAccount(
|
|
314
|
-
const { portal:
|
|
315
|
-
if (!
|
|
317
|
+
switchAccount(e) {
|
|
318
|
+
const { portal: s, user: t, clientId: i } = this;
|
|
319
|
+
if (!s || !t || !e)
|
|
316
320
|
return;
|
|
317
|
-
const
|
|
318
|
-
|
|
321
|
+
const o = h(t.sourceJSON.orgUrlKey ?? "", s), r = g.findCredential(o, t.id || t.username);
|
|
322
|
+
r && B({ config: { baseUrl: o, restBaseUrl: `${o}/sharing/rest` }, credential: r, clientId: i }), J(e, s, i);
|
|
319
323
|
}
|
|
320
|
-
showAlert(
|
|
324
|
+
showAlert(e, s, t) {
|
|
321
325
|
this.alertOptions = {
|
|
322
|
-
kind:
|
|
323
|
-
title:
|
|
324
|
-
message:
|
|
326
|
+
kind: e,
|
|
327
|
+
title: t,
|
|
328
|
+
message: s
|
|
325
329
|
};
|
|
326
330
|
}
|
|
327
|
-
showUnlinkConfirmation(
|
|
328
|
-
const { messages:
|
|
331
|
+
showUnlinkConfirmation(e) {
|
|
332
|
+
const { messages: s } = this;
|
|
329
333
|
this.alertOptions = {
|
|
330
334
|
kind: "danger",
|
|
331
335
|
icon: "exclamation-mark-triangle-f",
|
|
332
|
-
title:
|
|
333
|
-
message:
|
|
336
|
+
title: s.unlinkTitle,
|
|
337
|
+
message: s.unlinkWarning,
|
|
334
338
|
actions: [
|
|
335
339
|
{
|
|
336
|
-
text:
|
|
340
|
+
text: s.unlink,
|
|
337
341
|
kind: "danger",
|
|
338
342
|
clickHandler: () => {
|
|
339
|
-
this.alertOptions = void 0, this.unlinkAccount(
|
|
343
|
+
this.alertOptions = void 0, this.unlinkAccount(e);
|
|
340
344
|
}
|
|
341
345
|
}
|
|
342
346
|
]
|
|
343
347
|
};
|
|
344
348
|
}
|
|
345
349
|
render() {
|
|
346
|
-
const { linkedAccounts:
|
|
347
|
-
return !
|
|
350
|
+
const { linkedAccounts: e, accountAccess: s, user: t, portal: i, messages: o } = this;
|
|
351
|
+
return !i || !t ? null : d`<calcite-dialog .heading=${o.switchAccounts} scale=m width=s open modal .loading=${this.loading} outside-close-disabled @calciteDialogClose=${() => {
|
|
348
352
|
this.arcgisClose.emit();
|
|
349
|
-
}}><calcite-block .heading=${
|
|
353
|
+
}}><calcite-block .heading=${o.currentAccount} .description=${o.signedInAs} expanded class="current-account-block" tabindex=-1>${_(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=${H(t, i) ?? void 0}></calcite-avatar></calcite-block>`)}</calcite-block>${e.length > 0 ? d`<calcite-block .heading=${o.linkedAccounts} .description=${o.linkedAccountActions} expanded class="linked-accounts-block"><calcite-button slot=content-end icon-start=plus class="link-account-button" @click=${() => this.startAccountLink()} .disabled=${e.length >= k}>${o.addAccount}</calcite-button><arcgis-portal-account-switcher-list .portal=${i} .linkedAccounts=${e} .accountAccess=${s} .signedInUsers=${Object.keys(this.signedInStatus).filter((r) => this.signedInStatus[r] !== null)} interactive @arcgisAccountSwitch=${(r) => {
|
|
350
354
|
this.switchAccount(r.detail.account);
|
|
351
355
|
}} @arcgisAccountUnlink=${(r) => {
|
|
352
356
|
this.showUnlinkConfirmation(r.detail.account);
|
|
353
|
-
}}></arcgis-portal-account-switcher-list></calcite-block>` : d`<calcite-block .heading=${
|
|
357
|
+
}}></arcgis-portal-account-switcher-list></calcite-block>` : d`<calcite-block .heading=${o.linkedAccounts} 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>${x`<path d=${W.couple ?? v} fill=currentColor />`}</svg><h4>${o.emptyListTitle}</h4><p>${o.emptyList}</p><calcite-button icon-start=plus class="link-account-button" @click=${() => this.startAccountLink()} .disabled=${e.length >= k}>${o.linkAccount}</calcite-button></div></calcite-block>`}<calcite-notice kind=info .open=${e.length >= k}><div slot=message>${o.maxAccounts}</div></calcite-notice><calcite-alert .label=${o.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=${() => {
|
|
354
358
|
this.alertOptions = void 0;
|
|
355
|
-
}}>${this.alertOptions?.title && d`<h4 slot=title class="alert-title">${this.alertOptions.title}</h4>` || ""}${this.alertOptions?.message && d`<p slot=message class="alert-message">${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=${
|
|
359
|
+
}}>${this.alertOptions?.title && d`<h4 slot=title class="alert-title">${this.alertOptions.title}</h4>` || ""}${this.alertOptions?.message && d`<p slot=message class="alert-message">${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=${i} .targetUser=${this.targetUser} .accounts=${this.userAccounts ?? []} @arcgisLinkAll=${() => {
|
|
356
360
|
this.linkAccount(this.targetUser, this.targetToken);
|
|
357
361
|
}} @arcgisCloseDialog=${() => {
|
|
358
362
|
this.showAssociatedAccountsWarning = !1;
|
|
359
363
|
}}></arcgis-portal-account-switcher-accounts>` || ""}`;
|
|
360
364
|
}
|
|
361
365
|
}
|
|
362
|
-
L("arcgis-portal-account-switcher",
|
|
366
|
+
L("arcgis-portal-account-switcher", V);
|
|
363
367
|
export {
|
|
364
|
-
|
|
368
|
+
V as ArcgisPortalAccountSwitcher
|
|
365
369
|
};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import "@esri/calcite-components/components/calcite-dialog";
|
|
2
2
|
import "@esri/calcite-components/components/calcite-block";
|
|
3
|
-
import "@esri/calcite-components/components/calcite-
|
|
4
|
-
import "@esri/calcite-components/components/calcite-list-item";
|
|
5
|
-
import "../arcgis-portal-user-avatar/index.js";
|
|
3
|
+
import "@esri/calcite-components/components/calcite-avatar";
|
|
6
4
|
import "@esri/calcite-components/components/calcite-button";
|
|
7
5
|
import "../arcgis-portal-account-switcher-list/index.js";
|
|
8
6
|
import "@esri/calcite-components/components/calcite-notice";
|