@arcgis/common-components 1.0.0-beta.4 → 1.0.0-beta.5

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.
Files changed (39) hide show
  1. package/dist/arcgis-common-components/arcgis-common-components.esm.js +1 -150
  2. package/dist/arcgis-common-components/index.esm.js +0 -3
  3. package/dist/arcgis-common-components/p-9fc4e265.entry.js +1 -0
  4. package/dist/arcgis-common-components/p-adc54f17.entry.js +1 -0
  5. package/dist/arcgis-common-components/p-b0c98bba.js +2 -0
  6. package/dist/arcgis-common-components/p-e8b62824.js +1 -0
  7. package/dist/cjs/arcgis-api-key.cjs.entry.js +51 -0
  8. package/dist/cjs/arcgis-common-components.cjs.js +23 -0
  9. package/dist/cjs/arcgis-identity.cjs.entry.js +139 -0
  10. package/dist/cjs/index-33f2dbd2.js +65 -0
  11. package/dist/cjs/index-e8c59179.js +858 -0
  12. package/dist/cjs/index.cjs.js +2 -0
  13. package/dist/cjs/loader.cjs.js +22 -0
  14. package/dist/components/arcgis-api-key.js +67 -0
  15. package/dist/components/arcgis-identity.js +165 -0
  16. package/dist/components/index.js +3 -0
  17. package/dist/components/index2.js +40 -0
  18. package/dist/esm/arcgis-api-key.entry.js +47 -0
  19. package/dist/esm/arcgis-common-components.js +18 -0
  20. package/dist/esm/arcgis-identity.entry.js +135 -0
  21. package/dist/esm/index-1f7e8e45.js +831 -0
  22. package/dist/esm/index-386f07e9.js +40 -0
  23. package/dist/esm/index.js +1 -0
  24. package/dist/esm/loader.js +18 -0
  25. package/dist/esm/polyfills/core-js.js +11 -0
  26. package/dist/esm/polyfills/css-shim.js +1 -0
  27. package/dist/esm/polyfills/dom.js +79 -0
  28. package/dist/esm/polyfills/es5-html-element.js +1 -0
  29. package/dist/esm/polyfills/index.js +34 -0
  30. package/dist/esm/polyfills/system.js +6 -0
  31. package/dist/index.cjs.js +1 -0
  32. package/dist/index.js +1 -0
  33. package/dist/loader/cdn.js +3 -0
  34. package/dist/loader/index.cjs.js +3 -0
  35. package/dist/loader/index.d.ts +21 -0
  36. package/dist/loader/index.es2017.js +3 -0
  37. package/dist/loader/index.js +4 -0
  38. package/dist/loader/package.json +11 -0
  39. package/package.json +3 -3
@@ -1,150 +1 @@
1
- import { B as BUILD, c as consoleDevInfo, p as plt, w as win, H, d as doc, N as NAMESPACE, a as promiseResolve, b as bootstrapLazy } from './index-5dbab23c.js';
2
- export { s as setNonce } from './index-5dbab23c.js';
3
- import { g as globalScripts } from './app-globals-0f993ce5.js';
4
-
5
- /*
6
- Stencil Client Patch Browser v2.22.3 | MIT Licensed | https://stenciljs.com
7
- */
8
- /**
9
- * Helper method for querying a `meta` tag that contains a nonce value
10
- * out of a DOM's head.
11
- *
12
- * @param doc The DOM containing the `head` to query against
13
- * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
14
- * exists or the tag has no content.
15
- */
16
- function queryNonceMetaTagContent(doc) {
17
- var _a, _b, _c;
18
- return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;
19
- }
20
- const getDynamicImportFunction = (namespace) => `__sc_import_${namespace.replace(/\s|-/g, '_')}`;
21
- const patchBrowser = () => {
22
- // NOTE!! This fn cannot use async/await!
23
- if (BUILD.isDev && !BUILD.isTesting) {
24
- consoleDevInfo('Running in development mode.');
25
- }
26
- if (BUILD.cssVarShim) {
27
- // shim css vars
28
- plt.$cssShim$ = win.__cssshim;
29
- }
30
- if (BUILD.cloneNodeFix) {
31
- // opted-in to polyfill cloneNode() for slot polyfilled components
32
- patchCloneNodeFix(H.prototype);
33
- }
34
- if (BUILD.profile && !performance.mark) {
35
- // not all browsers support performance.mark/measure (Safari 10)
36
- // because the mark/measure APIs are designed to write entries to a buffer in the browser that does not exist,
37
- // simply stub the implementations out.
38
- // TODO(STENCIL-323): Remove this patch when support for older browsers is removed (breaking)
39
- // @ts-ignore
40
- performance.mark = performance.measure = () => {
41
- /*noop*/
42
- };
43
- performance.getEntriesByName = () => [];
44
- }
45
- // @ts-ignore
46
- const scriptElm = BUILD.scriptDataOpts || BUILD.safari10 || BUILD.dynamicImportShim
47
- ? Array.from(doc.querySelectorAll('script')).find((s) => new RegExp(`\/${NAMESPACE}(\\.esm)?\\.js($|\\?|#)`).test(s.src) ||
48
- s.getAttribute('data-stencil-namespace') === NAMESPACE)
49
- : null;
50
- const importMeta = import.meta.url;
51
- const opts = BUILD.scriptDataOpts ? scriptElm['data-opts'] || {} : {};
52
- if (BUILD.safari10 && 'onbeforeload' in scriptElm && !history.scrollRestoration /* IS_ESM_BUILD */) {
53
- // Safari < v11 support: This IF is true if it's Safari below v11.
54
- // This fn cannot use async/await since Safari didn't support it until v11,
55
- // however, Safari 10 did support modules. Safari 10 also didn't support "nomodule",
56
- // so both the ESM file and nomodule file would get downloaded. Only Safari
57
- // has 'onbeforeload' in the script, and "history.scrollRestoration" was added
58
- // to Safari in v11. Return a noop then() so the async/await ESM code doesn't continue.
59
- // IS_ESM_BUILD is replaced at build time so this check doesn't happen in systemjs builds.
60
- return {
61
- then() {
62
- /* promise noop */
63
- },
64
- };
65
- }
66
- if (!BUILD.safari10 && importMeta !== '') {
67
- opts.resourcesUrl = new URL('.', importMeta).href;
68
- }
69
- else if (BUILD.dynamicImportShim || BUILD.safari10) {
70
- opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href)).href;
71
- if (BUILD.dynamicImportShim) {
72
- patchDynamicImport(opts.resourcesUrl, scriptElm);
73
- }
74
- if (BUILD.dynamicImportShim && !win.customElements) {
75
- // module support, but no custom elements support (Old Edge)
76
- // @ts-ignore
77
- return import(/* webpackChunkName: "polyfills-dom" */ './dom-64053c71.js').then(() => opts);
78
- }
79
- }
80
- return promiseResolve(opts);
81
- };
82
- const patchDynamicImport = (base, orgScriptElm) => {
83
- const importFunctionName = getDynamicImportFunction(NAMESPACE);
84
- try {
85
- // test if this browser supports dynamic imports
86
- // There is a caching issue in V8, that breaks using import() in Function
87
- // By generating a random string, we can workaround it
88
- // Check https://bugs.chromium.org/p/chromium/issues/detail?id=990810 for more info
89
- win[importFunctionName] = new Function('w', `return import(w);//${Math.random()}`);
90
- }
91
- catch (e) {
92
- // this shim is specifically for browsers that do support "esm" imports
93
- // however, they do NOT support "dynamic" imports
94
- // basically this code is for old Edge, v18 and below
95
- const moduleMap = new Map();
96
- win[importFunctionName] = (src) => {
97
- var _a;
98
- const url = new URL(src, base).href;
99
- let mod = moduleMap.get(url);
100
- if (!mod) {
101
- const script = doc.createElement('script');
102
- script.type = 'module';
103
- script.crossOrigin = orgScriptElm.crossOrigin;
104
- script.src = URL.createObjectURL(new Blob([`import * as m from '${url}'; window.${importFunctionName}.m = m;`], {
105
- type: 'application/javascript',
106
- }));
107
- // Apply CSP nonce to the script tag if it exists
108
- const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
109
- if (nonce != null) {
110
- script.setAttribute('nonce', nonce);
111
- }
112
- mod = new Promise((resolve) => {
113
- script.onload = () => {
114
- resolve(win[importFunctionName].m);
115
- script.remove();
116
- };
117
- });
118
- moduleMap.set(url, mod);
119
- doc.head.appendChild(script);
120
- }
121
- return mod;
122
- };
123
- }
124
- };
125
- const patchCloneNodeFix = (HTMLElementPrototype) => {
126
- const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;
127
- HTMLElementPrototype.cloneNode = function (deep) {
128
- if (this.nodeName === 'TEMPLATE') {
129
- return nativeCloneNodeFn.call(this, deep);
130
- }
131
- const clonedNode = nativeCloneNodeFn.call(this, false);
132
- const srcChildNodes = this.childNodes;
133
- if (deep) {
134
- for (let i = 0; i < srcChildNodes.length; i++) {
135
- // Node.ATTRIBUTE_NODE === 2, and checking because IE11
136
- if (srcChildNodes[i].nodeType !== 2) {
137
- clonedNode.appendChild(srcChildNodes[i].cloneNode(true));
138
- }
139
- }
140
- }
141
- return clonedNode;
142
- };
143
- };
144
-
145
- patchBrowser().then(options => {
146
- globalScripts();
147
- return bootstrapLazy([["arcgis-api-key",[[0,"arcgis-api-key",{"apiKey":[1,"api-key"]}]]],["arcgis-identity",[[0,"arcgis-identity",{"identity":[1040],"appId":[1,"app-id"],"credential":[1040],"expiration":[1026],"locale":[1],"usePopup":[4,"use-popup"],"popupCallbackUrl":[1,"popup-callback-url"],"portalUrl":[1,"portal-url"],"preserveUrlHash":[4,"preserve-url-hash"],"signIn":[64],"signOut":[64]}]]]], options);
148
- });
149
-
150
- //# sourceMappingURL=arcgis-common-components.esm.js.map
1
+ import{p,b as a}from"./p-b0c98bba.js";export{s as setNonce}from"./p-b0c98bba.js";(()=>{const a=import.meta.url,e={};return""!==a&&(e.resourcesUrl=new URL(".",a).href),p(e)})().then((p=>a([["p-9fc4e265",[[0,"arcgis-api-key",{apiKey:[1,"api-key"]}]]],["p-adc54f17",[[0,"arcgis-identity",{identity:[1040],appId:[1,"app-id"],credential:[1040],expiration:[1026],locale:[1],usePopup:[4,"use-popup"],popupCallbackUrl:[1,"popup-callback-url"],portalUrl:[1,"portal-url"],preserveUrlHash:[4,"preserve-url-hash"],signIn:[64],signOut:[64]}]]]],p)));
@@ -1,3 +0,0 @@
1
-
2
-
3
- //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ import{r as s,c as a,g as t}from"./p-b0c98bba.js";import{i}from"./p-e8b62824.js";const e=class{constructor(t){s(this,t),this.apiKeyReady=a(this,"apiKeyReady",7),this.apiKey=void 0}apiKeyWatcher(s){this._setApiKey(s)}async connectedCallback(){this.apiKey&&await this._setApiKey(this.apiKey)}async _setApiKey(s){(await i()).apiKey=s,this.apiKeyReady.emit(!0)}get el(){return t(this)}static get watchers(){return{apiKey:["apiKeyWatcher"]}}};e.style=":host{display:none}arcgis-api-key{display:none}";export{e as arcgis_api_key}
@@ -0,0 +1 @@
1
+ import{r as t,c as i,g as s}from"./p-b0c98bba.js";import{a as h,n as a,b as e}from"./p-e8b62824.js";const r=class{constructor(s){t(this,s),this.identityReady=i(this,"identityReady",7),this.credentialCreate=i(this,"credentialCreate",7),this.dialogCreate=i(this,"dialogCreate",7),this.identity=void 0,this.appId=void 0,this.credential=void 0,this.expiration=void 0,this.locale=void 0,this.usePopup=!1,this.popupCallbackUrl=void 0,this.portalUrl=void 0,this.preserveUrlHash=!1}appIdWatcher(t,i){i!==t&&this._registerOAuth()}async signIn(){if(!this.credential)try{this.credential=await this._checkCurrentStatus()}catch(t){this.credential=await this._fetchCredential()}return this.credential}async signOut(){if(!this.credential)try{this.identity.destroyCredentials()}catch(t){this.credential=void 0}this.credential=void 0}async connectedCallback(){this.appId&&await this._registerOAuth(),this._proxyEvents(),await this._addWatchers(),this.identityReady.emit({identity:this.identity,ready:!0})}async _addWatchers(){const{watch:t}=await h();t((()=>this._info.expiration),(t=>this.expiration=t),{initial:!0})}_checkCurrentStatus(){return this.identity.checkSignInStatus(`${this._info.portalUrl}/sharing`)}async _createOAuthInfo(){const t={};void 0!==this.appId&&(t.appId=this.appId),void 0!==this.locale&&(t.locale=this.locale),void 0!==this.popupCallbackUrl&&(t.popupCallbackUrl=this.popupCallbackUrl),void 0!==this.preserveUrlHash&&(t.preserveUrlHash=this.preserveUrlHash),void 0!==this.usePopup&&(t.popup=this.usePopup),void 0!==this.portalUrl&&(t.portalUrl=this.portalUrl);const i=await a(t);return this._info=i,i}async _fetchCredential(){return await this.identity.getCredential(`${this._info?.portalUrl}/sharing`,{error:null,oAuthPopupConfirmation:!1,token:null})}async _registerOAuth(){this.identity=await e();const t=await this._createOAuthInfo();this.identity.registerOAuthInfos([t])}_proxyEvents(){this.identity.on("credential-create",(t=>this.credentialCreate.emit(t))),this.identity.on("dialog-create",(t=>this.dialogCreate.emit(t)))}get el(){return s(this)}static get watchers(){return{appId:["appIdWatcher"]}}};r.style=":host{display:none}arcgis-identity{display:none}";export{r as arcgis_identity}
@@ -0,0 +1,2 @@
1
+ let e=!1;function t(e){var t,n,s;return null!==(s=null===(n=null===(t=e.head)||void 0===t?void 0:t.querySelector('meta[name="csp-nonce"]'))||void 0===n?void 0:n.getAttribute("content"))&&void 0!==s?s:void 0}const n=e=>S(e).t,s=(e,t,s)=>{const c=n(e);return{emit:e=>o(c,t,{bubbles:!!(4&s),composed:!!(2&s),cancelable:!!(1&s),detail:e})}},o=(e,t,n)=>{const s=N.ce(t,n);return e.dispatchEvent(s),s},c=new WeakMap,i=e=>"sc-"+e.o,r=(e,t)=>{t&&!e.i&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.i=t)))},a=(e,t)=>{if(e.l|=16,!(4&e.l))return r(e,e.u),A((()=>l(e,t)));e.l|=512},l=(e,t)=>{const n=e.m;return h(void 0,(()=>u(e,n,t)))},u=async(e,n,s)=>{const o=e.t,r=o["s-rc"];s&&(e=>{const n=e.h;((e,n)=>{var s;let o=i(n);const r=O.get(o);if(e=11===e.nodeType?e:E,r)if("string"==typeof r){let n,i=c.get(e=e.head||e);if(i||c.set(e,i=new Set),!i.has(o)){{n=E.createElement("style"),n.innerHTML=r;const o=null!==(s=N.p)&&void 0!==s?s:t(E);null!=o&&n.setAttribute("nonce",o),e.insertBefore(n,e.querySelector("link"))}i&&i.add(o)}}else e.adoptedStyleSheets.includes(r)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,r])})(e.t.getRootNode(),n)})(e);f(e,n),r&&(r.map((e=>e())),o["s-rc"]=void 0);{const t=o["s-p"],n=()=>d(e);0===t.length?n():(Promise.all(t).then(n),e.l|=4,t.length=0)}},f=(e,t)=>{try{t=t.render&&t.render(),e.l&=-17,e.l|=2}catch(t){M(t,e.t)}return null},d=e=>{const t=e.t,n=e.u;64&e.l||(e.l|=64,p(t),e.$(t),n||m()),e.v(t),e.i&&(e.i(),e.i=void 0),512&e.l&&q((()=>a(e,!1))),e.l&=-517},m=()=>{p(E.documentElement),q((()=>o(P,"appload",{detail:{namespace:"arcgis-common-components"}})))},h=(e,t)=>e&&e.then?e.then(t):t(),p=e=>e.setAttribute("hydrated",""),y=(e,t,n)=>{if(t.S){e.watchers&&(t.g=e.watchers);const s=Object.entries(t.S),o=e.prototype;if(s.map((([e,[s]])=>{31&s||2&n&&32&s?Object.defineProperty(o,e,{get(){return((e,t)=>S(this).j.get(t))(0,e)},set(n){((e,t,n,s)=>{const o=S(e),c=o.t,i=o.j.get(t),r=o.l,l=o.m;if(n=((e,t)=>null==e||(e=>"object"==(e=typeof e)||"function"===e)(e)?e:4&t?"false"!==e&&(""===e||!!e):2&t?parseFloat(e):1&t?e+"":e)(n,s.S[t][0]),(!(8&r)||void 0===i)&&n!==i&&(!Number.isNaN(i)||!Number.isNaN(n))&&(o.j.set(t,n),l)){if(s.g&&128&r){const e=s.g[t];e&&e.map((e=>{try{l[e](n,i,t)}catch(e){M(e,c)}}))}2==(18&r)&&a(o,!1)}})(this,e,n,t)},configurable:!0,enumerable:!0}):1&n&&64&s&&Object.defineProperty(o,e,{value(...t){const n=S(this);return n.M.then((()=>n.m[e](...t)))}})})),1&n){const t=new Map;o.attributeChangedCallback=function(e,n,s){N.jmp((()=>{const n=t.get(e);if(this.hasOwnProperty(n))s=this[n],delete this[n];else if(o.hasOwnProperty(n)&&"number"==typeof this[n]&&this[n]==s)return;this[n]=(null!==s||"boolean"!=typeof this[n])&&s}))},e.observedAttributes=s.filter((([e,t])=>15&t[0])).map((([e,n])=>{const s=n[1]||e;return t.set(s,e),s}))}}return e},b=e=>{((e,t)=>{if(e&&e[t])try{e[t](void 0)}catch(e){M(e)}})(e,"connectedCallback")},w=(e,n={})=>{var s;const o=[],c=n.exclude||[],l=P.customElements,u=E.head,f=u.querySelector("meta[charset]"),d=E.createElement("style"),h=[];let p,w=!0;Object.assign(N,n),N.k=new URL(n.resourcesUrl||"./",E.baseURI).href,e.map((e=>{e[1].map((t=>{const n={l:t[0],o:t[1],S:t[2],C:t[3]};n.S=t[2],n.g={};const s=n.o,u=class extends HTMLElement{constructor(e){super(e),j(e=this,n)}connectedCallback(){p&&(clearTimeout(p),p=null),w?h.push(this):N.jmp((()=>(e=>{if(0==(1&N.l)){const t=S(e),n=t.h,s=()=>{};if(1&t.l)b(t.m);else{t.l|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){r(t,t.u=n);break}}n.S&&Object.entries(n.S).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n,s,o)=>{if(0==(32&t.l)){{if(t.l|=32,(o=C(n)).then){const e=()=>{};o=await o,e()}o.isProxied||(n.g=o.watchers,y(o,n,2),o.isProxied=!0);const e=()=>{};t.l|=8;try{new o(t)}catch(e){M(e)}t.l&=-9,t.l|=128,e(),b(t.m)}if(o.style){let e=o.style;const t=i(n);if(!O.has(t)){const s=()=>{};((e,t,n)=>{let s=O.get(e);x&&n?(s=s||new CSSStyleSheet,"string"==typeof s?s=t:s.replaceSync(t)):s=t,O.set(e,s)})(t,e,!!(1&n.l)),s()}}}const c=t.u,r=()=>a(t,!0);c&&c["s-rc"]?c["s-rc"].push(r):r()})(0,t,n)}s()}})(this)))}disconnectedCallback(){N.jmp((()=>{}))}componentOnReady(){return S(this).O}};n.P=e[0],c.includes(s)||l.get(s)||(o.push(s),l.define(s,y(u,n,1)))}))}));{d.innerHTML=o+"{visibility:hidden}[hydrated]{visibility:inherit}",d.setAttribute("data-styles","");const e=null!==(s=N.p)&&void 0!==s?s:t(E);null!=e&&d.setAttribute("nonce",e),u.insertBefore(d,f?f.nextSibling:u.firstChild)}w=!1,h.length?h.map((e=>e.connectedCallback())):N.jmp((()=>p=setTimeout(m,30)))},$=e=>N.p=e,v=new WeakMap,S=e=>v.get(e),g=(e,t)=>v.set(t.m=e,t),j=(e,t)=>{const n={l:0,t:e,h:t,j:new Map};return n.M=new Promise((e=>n.v=e)),n.O=new Promise((e=>n.$=e)),e["s-p"]=[],e["s-rc"]=[],v.set(e,n)},M=(e,t)=>(0,console.error)(e,t),k=new Map,C=e=>{const t=e.o.replace(/-/g,"_"),n=e.P,s=k.get(n);return s?s[t]:import(`./${n}.entry.js`).then((e=>(k.set(n,e),e[t])),M)
2
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/},O=new Map,P="undefined"!=typeof window?window:{},E=P.document||{head:{}},N={l:0,k:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,s)=>e.addEventListener(t,n,s),rel:(e,t,n,s)=>e.removeEventListener(t,n,s),ce:(e,t)=>new CustomEvent(e,t)},T=e=>Promise.resolve(e),x=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),F=[],L=[],R=(t,n)=>s=>{t.push(s),e||(e=!0,n&&4&N.l?q(W):N.raf(W))},U=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){M(e)}e.length=0},W=()=>{U(F),U(L),(e=F.length>0)&&N.raf(W)},q=e=>T().then(e),A=R(L,!0);export{w as b,s as c,n as g,T as p,g as r,$ as s}
@@ -0,0 +1 @@
1
+ const i="define"in window&&"function"==typeof window.define&&"amd"in window.define;function n(i){return new Promise((n=>window.require([i],(i=>{n(i)}))))}async function t(){return i?n("esri/identity/IdentityManager"):(await import("@arcgis/core/identity/IdentityManager.js")).default}async function r(t){return new(await async function(){return i?n("esri/identity/OAuthInfo"):(await import("@arcgis/core/identity/OAuthInfo.js")).default}())(t)}async function e(){return i?n("esri/config"):(await import("@arcgis/core/config.js")).default}async function a(){return i?n("esri/core/reactiveUtils"):await import("@arcgis/core/core/reactiveUtils.js")}export{a,t as b,e as i,r as n}
@@ -0,0 +1,51 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-e8c59179.js');
6
+ const index$1 = require('./index-33f2dbd2.js');
7
+
8
+ const arcgisApiKeyCss = ":host{display:none}arcgis-api-key{display:none}";
9
+
10
+ const ArcgisApiKey = class {
11
+ constructor(hostRef) {
12
+ index.registerInstance(this, hostRef);
13
+ this.apiKeyReady = index.createEvent(this, "apiKeyReady", 7);
14
+ this.apiKey = undefined;
15
+ }
16
+ //--------------------------------------------------------------------------
17
+ //
18
+ // Watchers
19
+ //
20
+ //--------------------------------------------------------------------------
21
+ apiKeyWatcher(value) {
22
+ this._setApiKey(value);
23
+ }
24
+ //--------------------------------------------------------------------------
25
+ //
26
+ // Lifecycle
27
+ //
28
+ //--------------------------------------------------------------------------
29
+ async connectedCallback() {
30
+ if (this.apiKey) {
31
+ await this._setApiKey(this.apiKey);
32
+ }
33
+ }
34
+ //--------------------------------------------------------------------------
35
+ //
36
+ // Private Methods
37
+ //
38
+ //--------------------------------------------------------------------------
39
+ async _setApiKey(value) {
40
+ const config = await index$1.importConfig();
41
+ config.apiKey = value;
42
+ this.apiKeyReady.emit(true);
43
+ }
44
+ get el() { return index.getElement(this); }
45
+ static get watchers() { return {
46
+ "apiKey": ["apiKeyWatcher"]
47
+ }; }
48
+ };
49
+ ArcgisApiKey.style = arcgisApiKeyCss;
50
+
51
+ exports.arcgis_api_key = ArcgisApiKey;
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-e8c59179.js');
6
+
7
+ /*
8
+ Stencil Client Patch Browser v2.22.3 | MIT Licensed | https://stenciljs.com
9
+ */
10
+ const patchBrowser = () => {
11
+ const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('arcgis-common-components.cjs.js', document.baseURI).href));
12
+ const opts = {};
13
+ if (importMeta !== '') {
14
+ opts.resourcesUrl = new URL('.', importMeta).href;
15
+ }
16
+ return index.promiseResolve(opts);
17
+ };
18
+
19
+ patchBrowser().then(options => {
20
+ return index.bootstrapLazy([["arcgis-api-key.cjs",[[0,"arcgis-api-key",{"apiKey":[1,"api-key"]}]]],["arcgis-identity.cjs",[[0,"arcgis-identity",{"identity":[1040],"appId":[1,"app-id"],"credential":[1040],"expiration":[1026],"locale":[1],"usePopup":[4,"use-popup"],"popupCallbackUrl":[1,"popup-callback-url"],"portalUrl":[1,"portal-url"],"preserveUrlHash":[4,"preserve-url-hash"],"signIn":[64],"signOut":[64]}]]]], options);
21
+ });
22
+
23
+ exports.setNonce = index.setNonce;
@@ -0,0 +1,139 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-e8c59179.js');
6
+ const index$1 = require('./index-33f2dbd2.js');
7
+
8
+ const arcgisIdentityCss = ":host{display:none}arcgis-identity{display:none}";
9
+
10
+ const ArcgisIdentity = class {
11
+ constructor(hostRef) {
12
+ index.registerInstance(this, hostRef);
13
+ this.identityReady = index.createEvent(this, "identityReady", 7);
14
+ this.credentialCreate = index.createEvent(this, "credentialCreate", 7);
15
+ this.dialogCreate = index.createEvent(this, "dialogCreate", 7);
16
+ this.identity = undefined;
17
+ this.appId = undefined;
18
+ this.credential = undefined;
19
+ this.expiration = undefined;
20
+ this.locale = undefined;
21
+ this.usePopup = false;
22
+ this.popupCallbackUrl = undefined;
23
+ this.portalUrl = undefined;
24
+ this.preserveUrlHash = false;
25
+ }
26
+ //--------------------------------------------------------------------------
27
+ //
28
+ // Watchers
29
+ //
30
+ //--------------------------------------------------------------------------
31
+ appIdWatcher(value, oldValue) {
32
+ if (oldValue !== value) {
33
+ this._registerOAuth();
34
+ }
35
+ }
36
+ //--------------------------------------------------------------------------
37
+ //
38
+ // Methods
39
+ //
40
+ //--------------------------------------------------------------------------
41
+ async signIn() {
42
+ if (!this.credential) {
43
+ try {
44
+ this.credential = await this._checkCurrentStatus();
45
+ }
46
+ catch (error) {
47
+ this.credential = await this._fetchCredential();
48
+ }
49
+ }
50
+ return this.credential;
51
+ }
52
+ async signOut() {
53
+ if (!this.credential) {
54
+ try {
55
+ this.identity.destroyCredentials();
56
+ }
57
+ catch (error) {
58
+ this.credential = undefined;
59
+ }
60
+ }
61
+ this.credential = undefined;
62
+ return;
63
+ }
64
+ //--------------------------------------------------------------------------
65
+ //
66
+ // Lifecycle
67
+ //
68
+ //--------------------------------------------------------------------------
69
+ async connectedCallback() {
70
+ if (this.appId) {
71
+ await this._registerOAuth();
72
+ }
73
+ this._proxyEvents();
74
+ await this._addWatchers();
75
+ this.identityReady.emit({ identity: this.identity, ready: true });
76
+ }
77
+ //--------------------------------------------------------------------------
78
+ //
79
+ // Private Methods
80
+ //
81
+ //--------------------------------------------------------------------------
82
+ async _addWatchers() {
83
+ const { watch } = await index$1.importCoreReactiveUtils();
84
+ watch(() => this._info.expiration, (value) => (this.expiration = value), {
85
+ initial: true
86
+ });
87
+ }
88
+ _checkCurrentStatus() {
89
+ return this.identity.checkSignInStatus(`${this._info.portalUrl}/sharing`);
90
+ }
91
+ async _createOAuthInfo() {
92
+ const params = {};
93
+ if (this.appId !== undefined) {
94
+ params.appId = this.appId;
95
+ }
96
+ if (this.locale !== undefined) {
97
+ params.locale = this.locale;
98
+ }
99
+ if (this.popupCallbackUrl !== undefined) {
100
+ params.popupCallbackUrl = this.popupCallbackUrl;
101
+ }
102
+ if (this.preserveUrlHash !== undefined) {
103
+ params.preserveUrlHash = this.preserveUrlHash;
104
+ }
105
+ if (this.usePopup !== undefined) {
106
+ params.popup = this.usePopup;
107
+ }
108
+ if (this.portalUrl !== undefined) {
109
+ params.portalUrl = this.portalUrl;
110
+ }
111
+ const info = await index$1.newIdentityOAuthInfo(params);
112
+ this._info = info;
113
+ return info;
114
+ }
115
+ async _fetchCredential() {
116
+ const credential = await this.identity.getCredential(`${this._info?.portalUrl}/sharing`, {
117
+ error: null,
118
+ oAuthPopupConfirmation: false,
119
+ token: null
120
+ });
121
+ return credential;
122
+ }
123
+ async _registerOAuth() {
124
+ this.identity = await index$1.importIdentityIdentityManager();
125
+ const info = await this._createOAuthInfo();
126
+ this.identity.registerOAuthInfos([info]);
127
+ }
128
+ _proxyEvents() {
129
+ this.identity.on("credential-create", (e) => this.credentialCreate.emit(e));
130
+ this.identity.on("dialog-create", (e) => this.dialogCreate.emit(e));
131
+ }
132
+ get el() { return index.getElement(this); }
133
+ static get watchers() { return {
134
+ "appId": ["appIdWatcher"]
135
+ }; }
136
+ };
137
+ ArcgisIdentity.style = arcgisIdentityCss;
138
+
139
+ exports.arcgis_identity = ArcgisIdentity;
@@ -0,0 +1,65 @@
1
+ 'use strict';
2
+
3
+ function _interopNamespace(e) {
4
+ if (e && e.__esModule) return e;
5
+ var n = Object.create(null);
6
+ if (e) {
7
+ Object.keys(e).forEach(function (k) {
8
+ if (k !== 'default') {
9
+ var d = Object.getOwnPropertyDescriptor(e, k);
10
+ Object.defineProperty(n, k, d.get ? d : {
11
+ enumerable: true,
12
+ get: function () {
13
+ return e[k];
14
+ }
15
+ });
16
+ }
17
+ });
18
+ }
19
+ n['default'] = e;
20
+ return Object.freeze(n);
21
+ }
22
+
23
+ const amd = "define" in window && typeof window.define === "function" && "amd" in window.define;
24
+ function requireModule(modulePath) {
25
+ return new Promise((resolve) => window.require([modulePath], (moduleDefault) => {
26
+ resolve(moduleDefault);
27
+ }));
28
+ }
29
+ async function importIdentityIdentityManager() {
30
+ if (amd) {
31
+ return requireModule("esri/identity/IdentityManager");
32
+ }
33
+ const module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@arcgis/core/identity/IdentityManager.js')); });
34
+ return module.default;
35
+ }
36
+ async function importIdentityOAuthInfo() {
37
+ if (amd) {
38
+ return requireModule("esri/identity/OAuthInfo");
39
+ }
40
+ const module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@arcgis/core/identity/OAuthInfo.js')); });
41
+ return module.default;
42
+ }
43
+ async function newIdentityOAuthInfo(properties) {
44
+ const ModConstructor = await importIdentityOAuthInfo();
45
+ return new ModConstructor(properties);
46
+ }
47
+ async function importConfig() {
48
+ if (amd) {
49
+ return requireModule("esri/config");
50
+ }
51
+ const module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@arcgis/core/config.js')); });
52
+ return module.default;
53
+ }
54
+ async function importCoreReactiveUtils() {
55
+ if (amd) {
56
+ return requireModule("esri/core/reactiveUtils");
57
+ }
58
+ const module = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('@arcgis/core/core/reactiveUtils.js')); });
59
+ return module;
60
+ }
61
+
62
+ exports.importConfig = importConfig;
63
+ exports.importCoreReactiveUtils = importCoreReactiveUtils;
64
+ exports.importIdentityIdentityManager = importIdentityIdentityManager;
65
+ exports.newIdentityOAuthInfo = newIdentityOAuthInfo;