openstack-uicore-foundation 4.0.4 → 4.0.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.
@@ -1 +1 @@
1
- "use strict";!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],n):"object"==typeof exports?exports["openstack-uicore-foundation"]=n():e["openstack-uicore-foundation"]=n()}(this,(function(){return(()=>{var e={id:307,ids:[307,1813]};e.modules={7213:(e,n,t)=>{t.r(n),t.d(n,{GMap:()=>g,default:()=>h});var o=t(6689),a=t.n(o),r=t(1692);const i=require("react-google-maps/lib/components/addons/MarkerClusterer");var l=t.n(i),s=t(9732);const d={defaultZoom:2,defaultCenter:{lat:30.270166,lng:-97.731271},options:{minZoom:1,maxZoom:19}},p=(0,r.withGoogleMap)((e=>a().createElement(r.GoogleMap,{ref:e.onMapLoad,zoom:e.zoom,center:e.center,onBoundsChanged:e.onMapChange,onClick:e.onMapClick},e.showMarkers&&a().createElement(l(),{averageCenter:!0,enableRetinaIcons:!0,gridSize:60},e.markers.map((n=>a().createElement(r.Marker,{key:n.id,position:{lat:n.lat,lng:n.lng},onClick:()=>e.onToggleInfoWindow(n.id),onDragEnd:e.onMarkerDrag,draggable:e.draggable},n.isInfoWindowOpen&&a().createElement(r.InfoWindow,{onCloseClick:()=>e.onToggleInfoWindow(n.id)},a().createElement("div",null,n.name)))))))));class g extends a().Component{constructor(e){super(e),this.state={markers:e.markers},this.handleMapLoad=this.handleMapLoad.bind(this),this.handleMapChange=this.handleMapChange.bind(this),this.handleMarkerDrag=this.handleMarkerDrag.bind(this),this.handleMapClick=this.handleMapClick.bind(this)}componentDidUpdate(e,n,t){const o=this.props.markers;(0,s.arraysEqual)(o,e.markers)||this.setState({markers:o});let a=e.markers.map((e=>e.id)).sort().join(),r=o.map((e=>e.id)).sort().join();if(o.length>1&&a!==r){const e=new google.maps.LatLngBounds;for(let n of o){let t=new google.maps.LatLng(n.lat,n.lng);e.extend(t)}this._mapComponent.fitBounds(e)}}handleMapLoad(e){this._mapComponent=e}handleMapChange(){let e=this.props.markers.filter((e=>{let n=new google.maps.LatLng(e.lat,e.lng);return this._mapComponent.getBounds().contains(n)}));this.props.hasOwnProperty("onChangeCallback")&&this.props.onChangeCallback(e)}handleMarkerClick(e){let n=this.state.markers,t=n.find((n=>n.id==e)).isInfoWindowOpen;n.find((n=>n.id==e)).isInfoWindowOpen=!t,this.setState({markers:n})}handleMarkerDrag(e){this.props.onMarkerDragged(e.latLng.lat(),e.latLng.lng())}handleMapClick(e){this.props.onMapClick(e.latLng.lat(),e.latLng.lng())}render(){let{markers:e}=this.state,{zoom:n,center:t}=this.props,o=this.props.hasOwnProperty("draggable");return a().createElement(p,{showMarkers:e.length>0,markers:e,zoom:n||d.defaultZoom,center:t.lat?t:d.defaultCenter,loadingElement:a().createElement("div",{style:{height:"100%"}}),containerElement:a().createElement("div",{style:{height:"400px"}}),mapElement:a().createElement("div",{style:{height:"100%"}}),onMapLoad:this.handleMapLoad,onMapChange:this.handleMapChange,onToggleInfoWindow:this.handleMarkerClick,onMarkerDrag:this.handleMarkerDrag,draggable:o,onMapClick:this.handleMapClick})}}const h=g},9732:(e,n,t)=>{t.d(n,{arraysEqual:()=>p,buildAPIBaseUrl:()=>a,getCurrentPathName:()=>o,getFromLocalStorage:()=>i,putOnLocalStorage:()=>r,removeFromLocalStorage:()=>l,retryPromise:()=>g,setSessionClearingState:()=>s,shallowEqual:()=>d});require("moment-timezone");t(6530),t(6113);const o=()=>"undefined"!=typeof window?window.location.pathname:null,a=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,r=(e,n)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,n)},i=(e,n)=>{if("undefined"!=typeof window){let t=window.localStorage.getItem(e);return n&&(console.log(`getFromLocalStorage removing key ${e}`),l(e)),t}return null},l=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},s=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},d=(e,n)=>{const t=Object.keys(e),o=Object.keys(n);if(t.length!==o.length)return!1;for(let o of t)if(e[o]!==n[o])return!1;return!0},p=(e,n)=>e.length===n.length&&e.every(((e,t)=>d(e,n[t]))),g=async(e,n=3)=>{for(let t=0;t<n;t++)if(await e())return!0;return!1}},6689:e=>{e.exports=require("react")},6530:e=>{e.exports=require("urijs")},6113:e=>{e.exports=require("crypto")}};var n=require("../runtime.js");n.C(e);n.X(0,[3732],(()=>(e=>n(n.s=e))(7213)))})()}));
1
+ "use strict";!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],n):"object"==typeof exports?exports["openstack-uicore-foundation"]=n():e["openstack-uicore-foundation"]=n()}(this,(function(){return(()=>{var e={id:307,ids:[307,7634,1813]};e.modules={7213:(e,n,t)=>{t.r(n),t.d(n,{GMap:()=>g,default:()=>h});var o=t(6689),a=t.n(o),r=t(1692);const i=require("react-google-maps/lib/components/addons/MarkerClusterer");var l=t.n(i),s=t(9732);const d={defaultZoom:2,defaultCenter:{lat:30.270166,lng:-97.731271},options:{minZoom:1,maxZoom:19}},p=(0,r.withGoogleMap)((e=>a().createElement(r.GoogleMap,{ref:e.onMapLoad,zoom:e.zoom,center:e.center,onBoundsChanged:e.onMapChange,onClick:e.onMapClick},e.showMarkers&&a().createElement(l(),{averageCenter:!0,enableRetinaIcons:!0,gridSize:60},e.markers.map((n=>a().createElement(r.Marker,{key:n.id,position:{lat:n.lat,lng:n.lng},onClick:()=>e.onToggleInfoWindow(n.id),onDragEnd:e.onMarkerDrag,draggable:e.draggable},n.isInfoWindowOpen&&a().createElement(r.InfoWindow,{onCloseClick:()=>e.onToggleInfoWindow(n.id)},a().createElement("div",null,n.name)))))))));class g extends a().Component{constructor(e){super(e),this.state={markers:e.markers},this.handleMapLoad=this.handleMapLoad.bind(this),this.handleMapChange=this.handleMapChange.bind(this),this.handleMarkerDrag=this.handleMarkerDrag.bind(this),this.handleMapClick=this.handleMapClick.bind(this)}componentDidUpdate(e,n,t){const o=this.props.markers;(0,s.arraysEqual)(o,e.markers)||this.setState({markers:o});let a=e.markers.map((e=>e.id)).sort().join(),r=o.map((e=>e.id)).sort().join();if(o.length>1&&a!==r){const e=new google.maps.LatLngBounds;for(let n of o){let t=new google.maps.LatLng(n.lat,n.lng);e.extend(t)}this._mapComponent.fitBounds(e)}}handleMapLoad(e){this._mapComponent=e}handleMapChange(){let e=this.props.markers.filter((e=>{let n=new google.maps.LatLng(e.lat,e.lng);return this._mapComponent.getBounds().contains(n)}));this.props.hasOwnProperty("onChangeCallback")&&this.props.onChangeCallback(e)}handleMarkerClick(e){let n=this.state.markers,t=n.find((n=>n.id==e)).isInfoWindowOpen;n.find((n=>n.id==e)).isInfoWindowOpen=!t,this.setState({markers:n})}handleMarkerDrag(e){this.props.onMarkerDragged(e.latLng.lat(),e.latLng.lng())}handleMapClick(e){this.props.onMapClick(e.latLng.lat(),e.latLng.lng())}render(){let{markers:e}=this.state,{zoom:n,center:t}=this.props,o=this.props.hasOwnProperty("draggable");return a().createElement(p,{showMarkers:e.length>0,markers:e,zoom:n||d.defaultZoom,center:t.lat?t:d.defaultCenter,loadingElement:a().createElement("div",{style:{height:"100%"}}),containerElement:a().createElement("div",{style:{height:"400px"}}),mapElement:a().createElement("div",{style:{height:"100%"}}),onMapLoad:this.handleMapLoad,onMapChange:this.handleMapChange,onToggleInfoWindow:this.handleMarkerClick,onMarkerDrag:this.handleMarkerDrag,draggable:o,onMapClick:this.handleMapClick})}}const h=g},9732:(e,n,t)=>{t.d(n,{arraysEqual:()=>m,base64URLEncode:()=>u,buildAPIBaseUrl:()=>s,getAuthCallback:()=>a,getCurrentLocation:()=>r,getCurrentPathName:()=>l,getFromLocalStorage:()=>p,getOrigin:()=>i,putOnLocalStorage:()=>d,removeFromLocalStorage:()=>g,retryPromise:()=>w,setSessionClearingState:()=>h,sha256:()=>f,shallowEqual:()=>c});require("moment-timezone");t(6530);var o=t(6113);const a=()=>"undefined"!=typeof window?`${window.location.origin}/auth/callback`:null,r=()=>{let e="";return"undefined"!=typeof window&&(e=window.location,window.top&&(e=window.top.location)),e},i=()=>"undefined"!=typeof window?window.location.origin:null,l=()=>"undefined"!=typeof window?window.location.pathname:null,s=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,d=(e,n)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,n)},p=(e,n)=>{if("undefined"!=typeof window){let t=window.localStorage.getItem(e);return n&&(console.log(`getFromLocalStorage removing key ${e}`),g(e)),t}return null},g=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},h=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},c=(e,n)=>{const t=Object.keys(e),o=Object.keys(n);if(t.length!==o.length)return!1;for(let o of t)if(e[o]!==n[o])return!1;return!0},m=(e,n)=>e.length===n.length&&e.every(((e,t)=>c(e,n[t]))),u=e=>e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),f=e=>(0,o.createHash)("sha256").update(e).digest(),w=async(e,n=3)=>{for(let t=0;t<n;t++)if(await e())return!0;return!1}},6689:e=>{e.exports=require("react")},6530:e=>{e.exports=require("urijs")},6113:e=>{e.exports=require("crypto")}};var n=require("../runtime.js");n.C(e);n.X(0,[3732],(()=>(e=>n(n.s=e))(7213)))})()}));
@@ -1 +1 @@
1
- "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{var e={id:7376,ids:[7376,3737,3451,4823,1813,1149]};e.modules={6708:(e,t,n)=>{n.r(t),n.d(t,{default:()=>d});var r=n(6689),a=n.n(r),o=n(9953),s=n.n(o),c=n(7525);const i=["value","error","onChange","id","multi"];function l(){return l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l.apply(this,arguments)}function u(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}class d extends a().Component{constructor(e){super(e),this.state={value:e.value},this.handleChange=this.handleChange.bind(this),this.getAccessLevels=this.getAccessLevels.bind(this),this.getOptionValue=this.getOptionValue.bind(this),this.getOptionLabel=this.getOptionLabel.bind(this)}getOptionValue(e){return this.props.hasOwnProperty("getOptionValue")?this.props.getOptionValue(e):e.id}getOptionLabel(e){return this.props.hasOwnProperty("getOptionLabel")?this.props.getOptionLabel(e):`${e.name}`}handleChange(e){let t={target:{id:this.props.id,value:e,type:"accesslevelinpurt"}};this.props.onChange(t)}getAccessLevels(e,t){let{summitId:n}=this.props;if(!e)return Promise.resolve({options:[]});(0,c.queryAccessLevels)(n,e,t)}render(){let e=this.props,{value:t,error:n,onChange:r,id:o,multi:c}=e,d=u(e,i),p=this.props.hasOwnProperty("multi"),h=this.props.hasOwnProperty("error")&&""!=n;return a().createElement("div",null,a().createElement(s(),l({value:t,onChange:this.handleChange,loadOptions:this.getAccessLevels,getOptionValue:e=>this.getOptionValue(e),getOptionLabel:e=>this.getOptionLabel(e),isMulti:p},d)),h&&a().createElement("p",{className:"error-label"},n))}}},4341:(e,t,n)=>{n(4656),n(3605),n(9732),n(886)},886:(e,t,n)=>{n.d(t,{getAccessToken:()=>p});var r=n(9732);n(4824),n(6113);const a=require("browser-tabs-lock");var o=n.n(a);n(6530),n(3856),n(4341);const s=new(o()),c="openstackuicore.lock.getTokenSilently",i="code",l="authInfo",u="nonce",d="pkce",p=async()=>{if(await(0,r.retryPromise)((()=>s.acquireLock(c,5e3)),10))try{let e=g();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:r,refreshToken:a}=e,o=y(),l=Math.floor(Date.now()/1e3);if(n-=20,l-r>n||null==t){if(console.log("getAccessToken access token expired"),o===i&&k()){if(!a)throw m(),Error("missing Refresh Token");let e=await h(a),{access_token:t,expires_in:n,refresh_token:r}=e;return void 0===r&&(r=null),f(t,n,r),t}throw m(),Error("Access Token Expired.")}return t}finally{await s.releaseLock(c)}throw Error("Lock acquire error.")},h=async e=>{let t=b(),n=w();const a={grant_type:"refresh_token",client_id:encodeURI(n),refresh_token:e};try{const e=await fetch(`${t}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(a)}).then((e=>{if(400===e.status){(0,r.getCurrentPathName)();throw(0,r.setSessionClearingState)(!0),Error(`${e.status} - ${e.statusText}`)}return e})).catch((function(e){throw Error(`Request failed: ${e.message}`)})),n=await e.json();let{access_token:o,refresh_token:s,expires_in:c}=n;return{access_token:o,refresh_token:s,expires_in:c}}catch(e){throw console.log(e),e}},f=(e,t,n=null,a=null)=>{let o=g(),s={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===n&&o&&(n=o.refreshToken),null===a&&o&&(a=o.idToken),n&&(s.refreshToken=n),a&&(s.idToken=a),(0,r.putOnLocalStorage)(l,JSON.stringify(s))},g=()=>{let e=(0,r.getFromLocalStorage)(l,!1);return null===e?null:JSON.parse(e)},m=()=>{if("undefined"!=typeof window)return(0,r.removeFromLocalStorage)(l),(0,r.removeFromLocalStorage)(u),void(0,r.removeFromLocalStorage)(d)},w=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,y=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",k=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),b=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null},3605:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>u,fetchErrorHandler:()=>i,fetchResponseHandler:()=>l});n(4824),n(6530);const r=require("sweetalert2");var a=n.n(r),o=n(4656),s=n.n(o);n(9732),n(4341),n(886);const c=e=>t=>({type:e,payload:t}),i=(c("RESET_LOADING"),c("START_LOADING"),c("STOP_LOADING"),e=>{let t=e.status,n=e.statusText;switch(t){case 403:a().fire("ERROR",s().translate("errors.user_not_authz"),"warning");break;case 401:a().fire("ERROR",s().translate("errors.session_expired"),"error");break;case 412:a().fire("ERROR",n,"warning");case 500:a().fire("ERROR",s().translate("errors.server_error"),"error")}}),l=e=>{if(e.ok)return e.json();throw e},u=e=>e=(e=e.replace(/,/g,"\\,")).replace(/;/g,"\\;")},9732:(e,t,n)=>{n.d(t,{arraysEqual:()=>u,buildAPIBaseUrl:()=>a,getCurrentPathName:()=>r,getFromLocalStorage:()=>s,putOnLocalStorage:()=>o,removeFromLocalStorage:()=>c,retryPromise:()=>d,setSessionClearingState:()=>i,shallowEqual:()=>l});require("moment-timezone");n(6530),n(6113);const r=()=>"undefined"!=typeof window?window.location.pathname:null,a=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,o=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},s=(e,t)=>{if("undefined"!=typeof window){let n=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),c(e)),n}return null},c=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},i=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},l=(e,t)=>{const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0},u=(e,t)=>e.length===t.length&&e.every(((e,n)=>l(e,t[n]))),d=async(e,t=3)=>{for(let n=0;n<t;n++)if(await e())return!0;return!1}},7525:(e,t,n)=>{n.d(t,{getCountryList:()=>k,getLanguageList:()=>y,queryAccessLevels:()=>m,queryCompanies:()=>f,queryGroups:()=>h,queryMembers:()=>l,queryOrganizations:()=>w,querySpeakers:()=>d,querySponsors:()=>g,querySummits:()=>u,queryTags:()=>p});var r=n(3605),a=n(886),o=n(9732);const s=require("lodash");var c=n.n(s);const i=500,l=c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/members?filter=${s}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),i),u=c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),i),d=c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1";e&&(c+=`/summits/${e}`),c+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${s}&expand=member,registration_request`,fetch((0,o.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),i),p=c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1",i=encodeURIComponent(`tag=@${t}`);c+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${i}&expand=tag,track_tag_group`:`/tags?filter=${i}`,c+=`&order=tag&page=1&per_page=50&access_token=${s}`,fetch((0,o.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((t=>{let r=[...t.data];e&&(r=r.map((e=>e.tag))),n(r)})).catch(r.fetchErrorHandler)}),i),h=(c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${c}&order=name&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),i),c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();let c=(t=(0,r.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),i),c().debounce((async(e,t,n=!1,s)=>{const c=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let i=`/api/v1/summits/${e}/events`+(n?"/published":""),l=encodeURIComponent(`title=@${t}`);fetch((0,o.buildAPIBaseUrl)(`${i}?filter=${l}&order=title&access_token=${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(r.fetchErrorHandler)}),i),c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),i)),f=c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),i),g=c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`company_name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${c}&expand=company,sponsorship&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),i),m=c().debounce(((e,t,n)=>{let s=(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),i),w=c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),i),y=(e,t)=>fetch((0,o.buildAPIBaseUrl)("/api/public/v1/languages"),{signal:t}).then(r.fetchResponseHandler).then((t=>{e(t.data)})).catch(r.fetchErrorHandler),k=(e,t)=>fetch((0,o.buildAPIBaseUrl)("/api/public/v1/countries"),{signal:t}).then(r.fetchResponseHandler).then((t=>{e(t.data)})).catch(r.fetchErrorHandler)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},4824:e=>{e.exports=require("superagent")},6530:e=>{e.exports=require("urijs")},6113:e=>{e.exports=require("crypto")}};var t=require("../../runtime.js");t.C(e);t.X(0,[5344],(()=>(e=>t(t.s=e))(6708)))})()}));
1
+ "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{var e={id:7376,ids:[7376,3737,7634,3451,4823,1813,1149]};e.modules={6708:(e,t,n)=>{n.r(t),n.d(t,{default:()=>u});var o=n(6689),r=n.n(o),a=n(9953),s=n.n(a),c=n(7525);const i=["value","error","onChange","id","multi"];function l(){return l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},l.apply(this,arguments)}function d(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}class u extends r().Component{constructor(e){super(e),this.state={value:e.value},this.handleChange=this.handleChange.bind(this),this.getAccessLevels=this.getAccessLevels.bind(this),this.getOptionValue=this.getOptionValue.bind(this),this.getOptionLabel=this.getOptionLabel.bind(this)}getOptionValue(e){return this.props.hasOwnProperty("getOptionValue")?this.props.getOptionValue(e):e.id}getOptionLabel(e){return this.props.hasOwnProperty("getOptionLabel")?this.props.getOptionLabel(e):`${e.name}`}handleChange(e){let t={target:{id:this.props.id,value:e,type:"accesslevelinpurt"}};this.props.onChange(t)}getAccessLevels(e,t){let{summitId:n}=this.props;if(!e)return Promise.resolve({options:[]});(0,c.queryAccessLevels)(n,e,t)}render(){let e=this.props,{value:t,error:n,onChange:o,id:a,multi:c}=e,u=d(e,i),p=this.props.hasOwnProperty("multi"),h=this.props.hasOwnProperty("error")&&""!=n;return r().createElement("div",null,r().createElement(s(),l({value:t,onChange:this.handleChange,loadOptions:this.getAccessLevels,getOptionValue:e=>this.getOptionValue(e),getOptionLabel:e=>this.getOptionLabel(e),isMulti:p},u)),h&&r().createElement("p",{className:"error-label"},n))}}},4341:(e,t,n)=>{n.d(t,{SET_LOGGED_USER:()=>o});n(4656),n(3605),n(9732),n(886);const o="SET_LOGGED_USER"},886:(e,t,n)=>{n.r(t),n.d(t,{ACCESS_TOKEN_SKEW_TIME:()=>w,RESPONSE_TYPE_CODE:()=>y,RESPONSE_TYPE_IMPLICIT:()=>_,clearAccessToken:()=>U,clearAuthInfo:()=>H,doLogin:()=>v,doLoginBasicLogin:()=>E,emitAccessToken:()=>$,getAccessToken:()=>T,getAuthInfo:()=>C,getAuthUrl:()=>R,getIdToken:()=>x,getLogoutUrl:()=>I,getOAuth2ClientId:()=>q,getOAuth2Flow:()=>B,getOAuth2IDPBaseUrl:()=>j,getOAuth2Scopes:()=>V,initLogOut:()=>N,passwordlessLogin:()=>M,passwordlessStart:()=>G,refreshAccessToken:()=>L,storeAuthInfo:()=>P,useOAuth2RefreshToken:()=>F,validateIdToken:()=>D});var o=n(9732),r=n(4824),a=n.n(r),s=n(6113);const c=require("browser-tabs-lock");var i=n.n(c),l=n(6530),d=n.n(l),u=n(3856),p=n.n(u),h=n(4341);let f=a();const g=new(i()),m="openstackuicore.lock.getTokenSilently",w=20,_="token id_token",y="code",k="authInfo",b="nonce",O="pkce",R=(e=null,t=null,n=null,r=null)=>{let a=q(),s=(0,o.getAuthCallback)(),c=j(),i=V(),l=B();null!=e&&(s+=`?BackUrl=${encodeURI(e)}`);let u=A(16);(0,o.putOnLocalStorage)(b,u);let p=d()(`${c}/oauth2/auth`),h={response_type:encodeURI(l),scope:encodeURI(i),nonce:u,response_mode:"fragment",client_id:encodeURI(a),redirect_uri:encodeURI(s)};if(l===y){const e=S();(0,o.putOnLocalStorage)(O,JSON.stringify(e)),h.code_challenge=e.codeChallenge,h.code_challenge_method="S256",h.approval_prompt="force"}return t&&(h.prompt=t),n&&(h.id_token_hint=n),r&&(h.provider=r),p=p.query(h),p},I=e=>{let t=j(),n=q(),r=d()(`${t}/oauth2/end-session`),a=A(16),s=(0,o.getOrigin)()+"/auth/logout";return(0,o.putOnLocalStorage)("post_logout_state",a),r.query({id_token_hint:e,post_logout_redirect_uri:encodeURI(s),client_id:encodeURI(n),state:a})},A=e=>{let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n="";for(let o=0;o<e;o++)n+=t.charAt(Math.floor(Math.random()*t.length));return n},v=(e=null,t=null,n=null)=>{let r=R(e,n,null,t);(0,o.getCurrentLocation)().replace(r.toString())},E=(e=null)=>{v(e,null,null)},S=()=>{const e=(0,o.base64URLEncode)((0,s.randomBytes)(64));return{codeVerifier:e,codeChallenge:(0,o.base64URLEncode)((0,o.sha256)(Buffer.from(e))),createdAt:new Date}},$=async(e,t=null)=>{let n=j(),r=q(),a=(0,o.getAuthCallback)(),s=JSON.parse((0,o.getFromLocalStorage)(O,!0));null!=t&&(a+=`?BackUrl=${encodeURI(t)}`);const c={code:e,grant_type:"authorization_code",code_verifier:s.codeVerifier,client_id:encodeURI(r),redirect_uri:encodeURI(a)};try{const e=await fetch(`${n}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(c)}).catch((function(e){console.log("Request failed:",e.message)})),t=await e.json();let{access_token:o,refresh_token:r,id_token:a,expires_in:s,error:i,error_description:l}=t;return{access_token:o,refresh_token:r,id_token:a,expires_in:s,error:i,error_description:l}}catch(e){console.log(e)}},U=async()=>{if(await(0,o.retryPromise)((()=>g.acquireLock(m,5e3)),10))try{let e=C();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:o,refreshToken:r}=e;P(null,0,r)}finally{await g.releaseLock(m)}},T=async()=>{if(await(0,o.retryPromise)((()=>g.acquireLock(m,5e3)),10))try{let e=C();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:o,refreshToken:r}=e,a=B(),s=Math.floor(Date.now()/1e3);if(n-=w,s-o>n||null==t){if(console.log("getAccessToken access token expired"),a===y&&F()){if(!r)throw H(),Error("missing Refresh Token");let e=await L(r),{access_token:t,expires_in:n,refresh_token:o}=e;return void 0===o&&(o=null),P(t,n,o),t}throw H(),Error("Access Token Expired.")}return t}finally{await g.releaseLock(m)}throw Error("Lock acquire error.")},L=async e=>{let t=j(),n=q();const r={grant_type:"refresh_token",client_id:encodeURI(n),refresh_token:e};try{const e=await fetch(`${t}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(r)}).then((e=>{if(400===e.status){(0,o.getCurrentPathName)();throw(0,o.setSessionClearingState)(!0),Error(`${e.status} - ${e.statusText}`)}return e})).catch((function(e){throw Error(`Request failed: ${e.message}`)})),n=await e.json();let{access_token:a,refresh_token:s,expires_in:c}=n;return{access_token:a,refresh_token:s,expires_in:c}}catch(e){throw console.log(e),e}},P=(e,t,n=null,r=null)=>{let a=C(),s={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===n&&a&&(n=a.refreshToken),null===r&&a&&(r=a.idToken),n&&(s.refreshToken=n),r&&(s.idToken=r),(0,o.putOnLocalStorage)(k,JSON.stringify(s))},C=()=>{let e=(0,o.getFromLocalStorage)(k,!1);return null===e?null:JSON.parse(e)},H=()=>{if("undefined"!=typeof window)return(0,o.removeFromLocalStorage)(k),(0,o.removeFromLocalStorage)(b),void(0,o.removeFromLocalStorage)(O)},x=()=>{if("undefined"!=typeof window){const e=C();return e?e.idToken:null}return null},q=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,B=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",F=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),j=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null,V=()=>"undefined"!=typeof window?window.SCOPES:null,N=()=>{(0,o.getCurrentLocation)().replace(I(x()).toString())},D=(e,t,n)=>{let r=new(p())({issuer:t,audience:n}),a=(0,o.getFromLocalStorage)(b,!0),s=r.decode(e),c=(s.header.alg,s.header.kid,s.payload.aud),i=s.payload.iss;s.payload.exp,s.payload.nbf;return(s.payload.nonce||null)==a&&c==n&&i==t},G=e=>{let t=q(),n=V(),r=A(16);(0,o.putOnLocalStorage)(b,r);let a=j(),s=d()(`${a}/oauth2/auth`),c={response_type:"otp",scope:encodeURI(n),nonce:r,client_id:encodeURI(t),connection:e.connection||"email",send:e.send||"code"};return e.hasOwnProperty("email")&&(c.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(c.phone_number=encodeURIComponent(e.phone_number)),f.post(s.toString()).send(c).then((e=>{let t=e.body;return Promise.resolve({response:t})})).catch((e=>Promise.reject(e)))},M=e=>t=>{let n=q(),o=V(),r=j(),a=d()(`${r}/oauth2/token`);if(!e.hasOwnProperty("otp"))throw Error("otp param is mandatory.");let s={grant_type:"passwordless",connection:e.connection||"email",scope:encodeURI(o),client_id:encodeURI(n),otp:e.otp};return e.hasOwnProperty("email")&&(s.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(s.phone_number=encodeURIComponent(e.phone_number)),f.post(a.toString()).send(s).then((e=>{try{let o=e.body,{access_token:a,expires_in:s,refresh_token:c,id_token:i}=o;if(void 0===c&&(c=null),void 0===i&&(i=null),i&&!D(i,r,n))throw Error("id token is not valid.");return P(a,s,c,i),t&&t({type:h.SET_LOGGED_USER,payload:{sessionState:null}}),Promise.resolve({response:o})}catch(e){return console.log(e),Promise.reject(e)}})).catch((e=>Promise.reject(e)))}},3605:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>i,fetchResponseHandler:()=>l});n(4824),n(6530);const o=require("sweetalert2");var r=n.n(o),a=n(4656),s=n.n(a);n(9732),n(4341),n(886);const c=e=>t=>({type:e,payload:t}),i=(c("RESET_LOADING"),c("START_LOADING"),c("STOP_LOADING"),e=>{let t=e.status,n=e.statusText;switch(t){case 403:r().fire("ERROR",s().translate("errors.user_not_authz"),"warning");break;case 401:r().fire("ERROR",s().translate("errors.session_expired"),"error");break;case 412:r().fire("ERROR",n,"warning");case 500:r().fire("ERROR",s().translate("errors.server_error"),"error")}}),l=e=>{if(e.ok)return e.json();throw e},d=e=>e=(e=e.replace(/,/g,"\\,")).replace(/;/g,"\\;")},9732:(e,t,n)=>{n.d(t,{arraysEqual:()=>f,base64URLEncode:()=>g,buildAPIBaseUrl:()=>i,getAuthCallback:()=>r,getCurrentLocation:()=>a,getCurrentPathName:()=>c,getFromLocalStorage:()=>d,getOrigin:()=>s,putOnLocalStorage:()=>l,removeFromLocalStorage:()=>u,retryPromise:()=>w,setSessionClearingState:()=>p,sha256:()=>m,shallowEqual:()=>h});require("moment-timezone");n(6530);var o=n(6113);const r=()=>"undefined"!=typeof window?`${window.location.origin}/auth/callback`:null,a=()=>{let e="";return"undefined"!=typeof window&&(e=window.location,window.top&&(e=window.top.location)),e},s=()=>"undefined"!=typeof window?window.location.origin:null,c=()=>"undefined"!=typeof window?window.location.pathname:null,i=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,l=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},d=(e,t)=>{if("undefined"!=typeof window){let n=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),u(e)),n}return null},u=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},p=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},h=(e,t)=>{const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(let o of n)if(e[o]!==t[o])return!1;return!0},f=(e,t)=>e.length===t.length&&e.every(((e,n)=>h(e,t[n]))),g=e=>e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),m=e=>(0,o.createHash)("sha256").update(e).digest(),w=async(e,t=3)=>{for(let n=0;n<t;n++)if(await e())return!0;return!1}},7525:(e,t,n)=>{n.d(t,{getCountryList:()=>y,getLanguageList:()=>_,queryAccessLevels:()=>m,queryCompanies:()=>f,queryGroups:()=>h,queryMembers:()=>l,queryOrganizations:()=>w,querySpeakers:()=>u,querySponsors:()=>g,querySummits:()=>d,queryTags:()=>p});var o=n(3605),r=n(886),a=n(9732);const s=require("lodash");var c=n.n(s);const i=500,l=c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/members?filter=${s}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),i),d=c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),i),u=c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c="/api/v1";e&&(c+=`/summits/${e}`),c+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${s}&expand=member,registration_request`,fetch((0,a.buildAPIBaseUrl)(c)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),i),p=c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c="/api/v1",i=encodeURIComponent(`tag=@${t}`);c+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${i}&expand=tag,track_tag_group`:`/tags?filter=${i}`,c+=`&order=tag&page=1&per_page=50&access_token=${s}`,fetch((0,a.buildAPIBaseUrl)(c)).then(o.fetchResponseHandler).then((t=>{let o=[...t.data];e&&(o=o.map((e=>e.tag))),n(o)})).catch(o.fetchErrorHandler)}),i),h=(c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${c}&order=name&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),i),c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();let c=(t=(0,o.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${c}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),i),c().debounce((async(e,t,n=!1,s)=>{const c=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let i=`/api/v1/summits/${e}/events`+(n?"/published":""),l=encodeURIComponent(`title=@${t}`);fetch((0,a.buildAPIBaseUrl)(`${i}?filter=${l}&order=title&access_token=${c}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(o.fetchErrorHandler)}),i),c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),i)),f=c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),i),g=c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c=encodeURIComponent(`company_name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${c}&expand=company,sponsorship&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),i),m=c().debounce(((e,t,n)=>{let s=(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${c}&&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),i),w=c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),i),_=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/languages"),{signal:t}).then(o.fetchResponseHandler).then((t=>{e(t.data)})).catch(o.fetchErrorHandler),y=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/countries"),{signal:t}).then(o.fetchResponseHandler).then((t=>{e(t.data)})).catch(o.fetchErrorHandler)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},4824:e=>{e.exports=require("superagent")},6530:e=>{e.exports=require("urijs")},6113:e=>{e.exports=require("crypto")}};var t=require("../../runtime.js");t.C(e);t.X(0,[5344],(()=>(e=>t(t.s=e))(6708)))})()}));
@@ -1 +1 @@
1
- "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{var e={id:4225,ids:[4225,3737,3451,4823,1813,1149]};e.modules={178:(e,t,n)=>{n.r(t),n.d(t,{default:()=>h});var r=n(6689),a=n.n(r),o=n(9953),s=n.n(o),c=n(7525),l=n(9503),i=n.n(l);const d=["error","value","onChange","id","multi"];function u(){return u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u.apply(this,arguments)}function p(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}class h extends a().Component{constructor(e){super(e),this.handleChange=this.handleChange.bind(this),this.handleNew=this.handleNew.bind(this),this.getCompanies=this.getCompanies.bind(this)}handleChange(e){const t=this.props.hasOwnProperty("multi")||this.props.hasOwnProperty("isMulti")?e.map((e=>({id:e.value,name:e.label}))):{id:e.value,name:e.label};let n={target:{id:this.props.id,value:t,type:"companyinput"}};this.props.onChange(n)}handleNew(e){this.props.onCreate(e,(e=>{this.handleChange({value:e.id,label:e.name})}))}getCompanies(e,t){if(!e)return Promise.resolve({options:[]});(0,c.queryCompanies)(e,(e=>{let n=e.map((e=>({value:e.id.toString(),label:e.name})));t(n)}))}render(){let e=this.props,{error:t,value:n,onChange:r,id:o,multi:c}=e,l=p(e,d),h=this.props.hasOwnProperty("error")&&""!=t,f=this.props.hasOwnProperty("multi")||this.props.hasOwnProperty("isMulti"),m=this.props.hasOwnProperty("allowCreate"),g=null;f&&n.length>0?g=n.map((e=>({value:e.id.toString(),label:e.name}))):!f&&n&&(g={value:n.id.toString(),label:n.name});const w=m?i():s();return a().createElement("div",null,a().createElement(w,u({value:g,onChange:this.handleChange,loadOptions:this.getCompanies,onCreateOption:this.handleNew,isMulti:f},l)),h&&a().createElement("p",{className:"error-label"},t))}}},4341:(e,t,n)=>{n(4656),n(3605),n(9732),n(886)},886:(e,t,n)=>{n.d(t,{getAccessToken:()=>p});var r=n(9732);n(4824),n(6113);const a=require("browser-tabs-lock");var o=n.n(a);n(6530),n(3856),n(4341);const s=new(o()),c="openstackuicore.lock.getTokenSilently",l="code",i="authInfo",d="nonce",u="pkce",p=async()=>{if(await(0,r.retryPromise)((()=>s.acquireLock(c,5e3)),10))try{let e=m();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:r,refreshToken:a}=e,o=y(),i=Math.floor(Date.now()/1e3);if(n-=20,i-r>n||null==t){if(console.log("getAccessToken access token expired"),o===l&&k()){if(!a)throw g(),Error("missing Refresh Token");let e=await h(a),{access_token:t,expires_in:n,refresh_token:r}=e;return void 0===r&&(r=null),f(t,n,r),t}throw g(),Error("Access Token Expired.")}return t}finally{await s.releaseLock(c)}throw Error("Lock acquire error.")},h=async e=>{let t=b(),n=w();const a={grant_type:"refresh_token",client_id:encodeURI(n),refresh_token:e};try{const e=await fetch(`${t}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(a)}).then((e=>{if(400===e.status){(0,r.getCurrentPathName)();throw(0,r.setSessionClearingState)(!0),Error(`${e.status} - ${e.statusText}`)}return e})).catch((function(e){throw Error(`Request failed: ${e.message}`)})),n=await e.json();let{access_token:o,refresh_token:s,expires_in:c}=n;return{access_token:o,refresh_token:s,expires_in:c}}catch(e){throw console.log(e),e}},f=(e,t,n=null,a=null)=>{let o=m(),s={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===n&&o&&(n=o.refreshToken),null===a&&o&&(a=o.idToken),n&&(s.refreshToken=n),a&&(s.idToken=a),(0,r.putOnLocalStorage)(i,JSON.stringify(s))},m=()=>{let e=(0,r.getFromLocalStorage)(i,!1);return null===e?null:JSON.parse(e)},g=()=>{if("undefined"!=typeof window)return(0,r.removeFromLocalStorage)(i),(0,r.removeFromLocalStorage)(d),void(0,r.removeFromLocalStorage)(u)},w=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,y=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",k=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),b=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null},3605:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>l,fetchResponseHandler:()=>i});n(4824),n(6530);const r=require("sweetalert2");var a=n.n(r),o=n(4656),s=n.n(o);n(9732),n(4341),n(886);const c=e=>t=>({type:e,payload:t}),l=(c("RESET_LOADING"),c("START_LOADING"),c("STOP_LOADING"),e=>{let t=e.status,n=e.statusText;switch(t){case 403:a().fire("ERROR",s().translate("errors.user_not_authz"),"warning");break;case 401:a().fire("ERROR",s().translate("errors.session_expired"),"error");break;case 412:a().fire("ERROR",n,"warning");case 500:a().fire("ERROR",s().translate("errors.server_error"),"error")}}),i=e=>{if(e.ok)return e.json();throw e},d=e=>e=(e=e.replace(/,/g,"\\,")).replace(/;/g,"\\;")},9732:(e,t,n)=>{n.d(t,{arraysEqual:()=>d,buildAPIBaseUrl:()=>a,getCurrentPathName:()=>r,getFromLocalStorage:()=>s,putOnLocalStorage:()=>o,removeFromLocalStorage:()=>c,retryPromise:()=>u,setSessionClearingState:()=>l,shallowEqual:()=>i});require("moment-timezone");n(6530),n(6113);const r=()=>"undefined"!=typeof window?window.location.pathname:null,a=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,o=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},s=(e,t)=>{if("undefined"!=typeof window){let n=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),c(e)),n}return null},c=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},l=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},i=(e,t)=>{const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0},d=(e,t)=>e.length===t.length&&e.every(((e,n)=>i(e,t[n]))),u=async(e,t=3)=>{for(let n=0;n<t;n++)if(await e())return!0;return!1}},7525:(e,t,n)=>{n.d(t,{getCountryList:()=>k,getLanguageList:()=>y,queryAccessLevels:()=>g,queryCompanies:()=>f,queryGroups:()=>h,queryMembers:()=>i,queryOrganizations:()=>w,querySpeakers:()=>u,querySponsors:()=>m,querySummits:()=>d,queryTags:()=>p});var r=n(3605),a=n(886),o=n(9732);const s=require("lodash");var c=n.n(s);const l=500,i=c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/members?filter=${s}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),l),d=c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),l),u=c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1";e&&(c+=`/summits/${e}`),c+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${s}&expand=member,registration_request`,fetch((0,o.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),l),p=c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1",l=encodeURIComponent(`tag=@${t}`);c+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${l}&expand=tag,track_tag_group`:`/tags?filter=${l}`,c+=`&order=tag&page=1&per_page=50&access_token=${s}`,fetch((0,o.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((t=>{let r=[...t.data];e&&(r=r.map((e=>e.tag))),n(r)})).catch(r.fetchErrorHandler)}),l),h=(c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${c}&order=name&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),l),c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();let c=(t=(0,r.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),l),c().debounce((async(e,t,n=!1,s)=>{const c=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let l=`/api/v1/summits/${e}/events`+(n?"/published":""),i=encodeURIComponent(`title=@${t}`);fetch((0,o.buildAPIBaseUrl)(`${l}?filter=${i}&order=title&access_token=${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(r.fetchErrorHandler)}),l),c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),l)),f=c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),l),m=c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`company_name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${c}&expand=company,sponsorship&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),l),g=c().debounce(((e,t,n)=>{let s=(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),l),w=c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),l),y=(e,t)=>fetch((0,o.buildAPIBaseUrl)("/api/public/v1/languages"),{signal:t}).then(r.fetchResponseHandler).then((t=>{e(t.data)})).catch(r.fetchErrorHandler),k=(e,t)=>fetch((0,o.buildAPIBaseUrl)("/api/public/v1/countries"),{signal:t}).then(r.fetchResponseHandler).then((t=>{e(t.data)})).catch(r.fetchErrorHandler)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},9503:e=>{e.exports=require("react-select/lib/AsyncCreatable")},4824:e=>{e.exports=require("superagent")},6530:e=>{e.exports=require("urijs")},6113:e=>{e.exports=require("crypto")}};var t=require("../../runtime.js");t.C(e);t.X(0,[5344],(()=>(e=>t(t.s=e))(178)))})()}));
1
+ "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{var e={id:4225,ids:[4225,3737,7634,3451,4823,1813,1149]};e.modules={178:(e,t,n)=>{n.r(t),n.d(t,{default:()=>h});var o=n(6689),r=n.n(o),a=n(9953),s=n.n(a),l=n(7525),i=n(9503),c=n.n(i);const d=["error","value","onChange","id","multi"];function u(){return u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},u.apply(this,arguments)}function p(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}class h extends r().Component{constructor(e){super(e),this.handleChange=this.handleChange.bind(this),this.handleNew=this.handleNew.bind(this),this.getCompanies=this.getCompanies.bind(this)}handleChange(e){const t=this.props.hasOwnProperty("multi")||this.props.hasOwnProperty("isMulti")?e.map((e=>({id:e.value,name:e.label}))):{id:e.value,name:e.label};let n={target:{id:this.props.id,value:t,type:"companyinput"}};this.props.onChange(n)}handleNew(e){this.props.onCreate(e,(e=>{this.handleChange({value:e.id,label:e.name})}))}getCompanies(e,t){if(!e)return Promise.resolve({options:[]});(0,l.queryCompanies)(e,(e=>{let n=e.map((e=>({value:e.id.toString(),label:e.name})));t(n)}))}render(){let e=this.props,{error:t,value:n,onChange:o,id:a,multi:l}=e,i=p(e,d),h=this.props.hasOwnProperty("error")&&""!=t,f=this.props.hasOwnProperty("multi")||this.props.hasOwnProperty("isMulti"),g=this.props.hasOwnProperty("allowCreate"),m=null;f&&n.length>0?m=n.map((e=>({value:e.id.toString(),label:e.name}))):!f&&n&&(m={value:n.id.toString(),label:n.name});const w=g?c():s();return r().createElement("div",null,r().createElement(w,u({value:m,onChange:this.handleChange,loadOptions:this.getCompanies,onCreateOption:this.handleNew,isMulti:f},i)),h&&r().createElement("p",{className:"error-label"},t))}}},4341:(e,t,n)=>{n.d(t,{SET_LOGGED_USER:()=>o});n(4656),n(3605),n(9732),n(886);const o="SET_LOGGED_USER"},886:(e,t,n)=>{n.r(t),n.d(t,{ACCESS_TOKEN_SKEW_TIME:()=>w,RESPONSE_TYPE_CODE:()=>_,RESPONSE_TYPE_IMPLICIT:()=>y,clearAccessToken:()=>$,clearAuthInfo:()=>H,doLogin:()=>A,doLoginBasicLogin:()=>E,emitAccessToken:()=>U,getAccessToken:()=>T,getAuthInfo:()=>L,getAuthUrl:()=>I,getIdToken:()=>x,getLogoutUrl:()=>O,getOAuth2ClientId:()=>q,getOAuth2Flow:()=>B,getOAuth2IDPBaseUrl:()=>j,getOAuth2Scopes:()=>N,initLogOut:()=>V,passwordlessLogin:()=>G,passwordlessStart:()=>M,refreshAccessToken:()=>C,storeAuthInfo:()=>P,useOAuth2RefreshToken:()=>F,validateIdToken:()=>D});var o=n(9732),r=n(4824),a=n.n(r),s=n(6113);const l=require("browser-tabs-lock");var i=n.n(l),c=n(6530),d=n.n(c),u=n(3856),p=n.n(u),h=n(4341);let f=a();const g=new(i()),m="openstackuicore.lock.getTokenSilently",w=20,y="token id_token",_="code",k="authInfo",b="nonce",R="pkce",I=(e=null,t=null,n=null,r=null)=>{let a=q(),s=(0,o.getAuthCallback)(),l=j(),i=N(),c=B();null!=e&&(s+=`?BackUrl=${encodeURI(e)}`);let u=S(16);(0,o.putOnLocalStorage)(b,u);let p=d()(`${l}/oauth2/auth`),h={response_type:encodeURI(c),scope:encodeURI(i),nonce:u,response_mode:"fragment",client_id:encodeURI(a),redirect_uri:encodeURI(s)};if(c===_){const e=v();(0,o.putOnLocalStorage)(R,JSON.stringify(e)),h.code_challenge=e.codeChallenge,h.code_challenge_method="S256",h.approval_prompt="force"}return t&&(h.prompt=t),n&&(h.id_token_hint=n),r&&(h.provider=r),p=p.query(h),p},O=e=>{let t=j(),n=q(),r=d()(`${t}/oauth2/end-session`),a=S(16),s=(0,o.getOrigin)()+"/auth/logout";return(0,o.putOnLocalStorage)("post_logout_state",a),r.query({id_token_hint:e,post_logout_redirect_uri:encodeURI(s),client_id:encodeURI(n),state:a})},S=e=>{let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n="";for(let o=0;o<e;o++)n+=t.charAt(Math.floor(Math.random()*t.length));return n},A=(e=null,t=null,n=null)=>{let r=I(e,n,null,t);(0,o.getCurrentLocation)().replace(r.toString())},E=(e=null)=>{A(e,null,null)},v=()=>{const e=(0,o.base64URLEncode)((0,s.randomBytes)(64));return{codeVerifier:e,codeChallenge:(0,o.base64URLEncode)((0,o.sha256)(Buffer.from(e))),createdAt:new Date}},U=async(e,t=null)=>{let n=j(),r=q(),a=(0,o.getAuthCallback)(),s=JSON.parse((0,o.getFromLocalStorage)(R,!0));null!=t&&(a+=`?BackUrl=${encodeURI(t)}`);const l={code:e,grant_type:"authorization_code",code_verifier:s.codeVerifier,client_id:encodeURI(r),redirect_uri:encodeURI(a)};try{const e=await fetch(`${n}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(l)}).catch((function(e){console.log("Request failed:",e.message)})),t=await e.json();let{access_token:o,refresh_token:r,id_token:a,expires_in:s,error:i,error_description:c}=t;return{access_token:o,refresh_token:r,id_token:a,expires_in:s,error:i,error_description:c}}catch(e){console.log(e)}},$=async()=>{if(await(0,o.retryPromise)((()=>g.acquireLock(m,5e3)),10))try{let e=L();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:o,refreshToken:r}=e;P(null,0,r)}finally{await g.releaseLock(m)}},T=async()=>{if(await(0,o.retryPromise)((()=>g.acquireLock(m,5e3)),10))try{let e=L();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:o,refreshToken:r}=e,a=B(),s=Math.floor(Date.now()/1e3);if(n-=w,s-o>n||null==t){if(console.log("getAccessToken access token expired"),a===_&&F()){if(!r)throw H(),Error("missing Refresh Token");let e=await C(r),{access_token:t,expires_in:n,refresh_token:o}=e;return void 0===o&&(o=null),P(t,n,o),t}throw H(),Error("Access Token Expired.")}return t}finally{await g.releaseLock(m)}throw Error("Lock acquire error.")},C=async e=>{let t=j(),n=q();const r={grant_type:"refresh_token",client_id:encodeURI(n),refresh_token:e};try{const e=await fetch(`${t}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(r)}).then((e=>{if(400===e.status){(0,o.getCurrentPathName)();throw(0,o.setSessionClearingState)(!0),Error(`${e.status} - ${e.statusText}`)}return e})).catch((function(e){throw Error(`Request failed: ${e.message}`)})),n=await e.json();let{access_token:a,refresh_token:s,expires_in:l}=n;return{access_token:a,refresh_token:s,expires_in:l}}catch(e){throw console.log(e),e}},P=(e,t,n=null,r=null)=>{let a=L(),s={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===n&&a&&(n=a.refreshToken),null===r&&a&&(r=a.idToken),n&&(s.refreshToken=n),r&&(s.idToken=r),(0,o.putOnLocalStorage)(k,JSON.stringify(s))},L=()=>{let e=(0,o.getFromLocalStorage)(k,!1);return null===e?null:JSON.parse(e)},H=()=>{if("undefined"!=typeof window)return(0,o.removeFromLocalStorage)(k),(0,o.removeFromLocalStorage)(b),void(0,o.removeFromLocalStorage)(R)},x=()=>{if("undefined"!=typeof window){const e=L();return e?e.idToken:null}return null},q=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,B=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",F=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),j=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null,N=()=>"undefined"!=typeof window?window.SCOPES:null,V=()=>{(0,o.getCurrentLocation)().replace(O(x()).toString())},D=(e,t,n)=>{let r=new(p())({issuer:t,audience:n}),a=(0,o.getFromLocalStorage)(b,!0),s=r.decode(e),l=(s.header.alg,s.header.kid,s.payload.aud),i=s.payload.iss;s.payload.exp,s.payload.nbf;return(s.payload.nonce||null)==a&&l==n&&i==t},M=e=>{let t=q(),n=N(),r=S(16);(0,o.putOnLocalStorage)(b,r);let a=j(),s=d()(`${a}/oauth2/auth`),l={response_type:"otp",scope:encodeURI(n),nonce:r,client_id:encodeURI(t),connection:e.connection||"email",send:e.send||"code"};return e.hasOwnProperty("email")&&(l.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(l.phone_number=encodeURIComponent(e.phone_number)),f.post(s.toString()).send(l).then((e=>{let t=e.body;return Promise.resolve({response:t})})).catch((e=>Promise.reject(e)))},G=e=>t=>{let n=q(),o=N(),r=j(),a=d()(`${r}/oauth2/token`);if(!e.hasOwnProperty("otp"))throw Error("otp param is mandatory.");let s={grant_type:"passwordless",connection:e.connection||"email",scope:encodeURI(o),client_id:encodeURI(n),otp:e.otp};return e.hasOwnProperty("email")&&(s.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(s.phone_number=encodeURIComponent(e.phone_number)),f.post(a.toString()).send(s).then((e=>{try{let o=e.body,{access_token:a,expires_in:s,refresh_token:l,id_token:i}=o;if(void 0===l&&(l=null),void 0===i&&(i=null),i&&!D(i,r,n))throw Error("id token is not valid.");return P(a,s,l,i),t&&t({type:h.SET_LOGGED_USER,payload:{sessionState:null}}),Promise.resolve({response:o})}catch(e){return console.log(e),Promise.reject(e)}})).catch((e=>Promise.reject(e)))}},3605:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>i,fetchResponseHandler:()=>c});n(4824),n(6530);const o=require("sweetalert2");var r=n.n(o),a=n(4656),s=n.n(a);n(9732),n(4341),n(886);const l=e=>t=>({type:e,payload:t}),i=(l("RESET_LOADING"),l("START_LOADING"),l("STOP_LOADING"),e=>{let t=e.status,n=e.statusText;switch(t){case 403:r().fire("ERROR",s().translate("errors.user_not_authz"),"warning");break;case 401:r().fire("ERROR",s().translate("errors.session_expired"),"error");break;case 412:r().fire("ERROR",n,"warning");case 500:r().fire("ERROR",s().translate("errors.server_error"),"error")}}),c=e=>{if(e.ok)return e.json();throw e},d=e=>e=(e=e.replace(/,/g,"\\,")).replace(/;/g,"\\;")},9732:(e,t,n)=>{n.d(t,{arraysEqual:()=>f,base64URLEncode:()=>g,buildAPIBaseUrl:()=>i,getAuthCallback:()=>r,getCurrentLocation:()=>a,getCurrentPathName:()=>l,getFromLocalStorage:()=>d,getOrigin:()=>s,putOnLocalStorage:()=>c,removeFromLocalStorage:()=>u,retryPromise:()=>w,setSessionClearingState:()=>p,sha256:()=>m,shallowEqual:()=>h});require("moment-timezone");n(6530);var o=n(6113);const r=()=>"undefined"!=typeof window?`${window.location.origin}/auth/callback`:null,a=()=>{let e="";return"undefined"!=typeof window&&(e=window.location,window.top&&(e=window.top.location)),e},s=()=>"undefined"!=typeof window?window.location.origin:null,l=()=>"undefined"!=typeof window?window.location.pathname:null,i=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,c=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},d=(e,t)=>{if("undefined"!=typeof window){let n=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),u(e)),n}return null},u=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},p=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},h=(e,t)=>{const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(let o of n)if(e[o]!==t[o])return!1;return!0},f=(e,t)=>e.length===t.length&&e.every(((e,n)=>h(e,t[n]))),g=e=>e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),m=e=>(0,o.createHash)("sha256").update(e).digest(),w=async(e,t=3)=>{for(let n=0;n<t;n++)if(await e())return!0;return!1}},7525:(e,t,n)=>{n.d(t,{getCountryList:()=>_,getLanguageList:()=>y,queryAccessLevels:()=>m,queryCompanies:()=>f,queryGroups:()=>h,queryMembers:()=>c,queryOrganizations:()=>w,querySpeakers:()=>u,querySponsors:()=>g,querySummits:()=>d,queryTags:()=>p});var o=n(3605),r=n(886),a=n(9732);const s=require("lodash");var l=n.n(s);const i=500,c=l().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/members?filter=${s}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),i),d=l().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),i),u=l().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let l="/api/v1";e&&(l+=`/summits/${e}`),l+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${s}&expand=member,registration_request`,fetch((0,a.buildAPIBaseUrl)(l)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),i),p=l().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let l="/api/v1",i=encodeURIComponent(`tag=@${t}`);l+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${i}&expand=tag,track_tag_group`:`/tags?filter=${i}`,l+=`&order=tag&page=1&per_page=50&access_token=${s}`,fetch((0,a.buildAPIBaseUrl)(l)).then(o.fetchResponseHandler).then((t=>{let o=[...t.data];e&&(o=o.map((e=>e.tag))),n(o)})).catch(o.fetchErrorHandler)}),i),h=(l().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let l=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${l}&order=name&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),i),l().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();let l=(t=(0,o.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${l}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),i),l().debounce((async(e,t,n=!1,s)=>{const l=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let i=`/api/v1/summits/${e}/events`+(n?"/published":""),c=encodeURIComponent(`title=@${t}`);fetch((0,a.buildAPIBaseUrl)(`${i}?filter=${c}&order=title&access_token=${l}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(o.fetchErrorHandler)}),i),l().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),i)),f=l().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),i),g=l().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let l=encodeURIComponent(`company_name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${l}&expand=company,sponsorship&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),i),m=l().debounce(((e,t,n)=>{let s=(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let l=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${l}&&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),i),w=l().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),i),y=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/languages"),{signal:t}).then(o.fetchResponseHandler).then((t=>{e(t.data)})).catch(o.fetchErrorHandler),_=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/countries"),{signal:t}).then(o.fetchResponseHandler).then((t=>{e(t.data)})).catch(o.fetchErrorHandler)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},9503:e=>{e.exports=require("react-select/lib/AsyncCreatable")},4824:e=>{e.exports=require("superagent")},6530:e=>{e.exports=require("urijs")},6113:e=>{e.exports=require("crypto")}};var t=require("../../runtime.js");t.C(e);t.X(0,[5344],(()=>(e=>t(t.s=e))(178)))})()}));
@@ -1 +1 @@
1
- "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{var e={id:575,ids:[575,3737,3451,3219,4823,1813,1149]};e.modules={8289:(e,t,n)=>{n.r(t),n.d(t,{default:()=>l});var r=n(6689),o=n.n(r),a=n(401),s=n(7525);function c(){return c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c.apply(this,arguments)}class l extends o().Component{constructor(e){super(e),this.state={options:[]},this.handleChange=this.handleChange.bind(this),this.setOptions=this.setOptions.bind(this),this.abortController=new AbortController}componentDidMount(){let{options:e}=this.state;0==e.length&&(0,s.getCountryList)(this.setOptions,this.abortController.signal)}componentWillUnmount(){this.abortController.abort()}handleChange(e){let t={target:{id:this.props.id,value:e,type:"countryddl"}};this.props.onChange(t)}setOptions(e){let t=e.map((e=>({label:e.name,value:e.iso_code})));this.setState({options:t})}render(){let{options:e}=this.state;return o().createElement(a.default,c({options:e},this.props))}}},401:(e,t,n)=>{n.r(t),n.d(t,{default:()=>h});var r=n(6689),o=n.n(r),a=n(1929),s=n.n(a);const c=["onChange","value","className","error","clearable","disabled","overrideCSS"];function l(){return l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l.apply(this,arguments)}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){u(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}class h extends o().Component{constructor(e){super(e),this.handleChange=this.handleChange.bind(this)}handleChange(e){let t=null;t=this.props.isMulti?e?e.map((e=>e.value)):null:e?e.value:null;let n={target:{id:this.props.id,value:t,type:"dropdown"}};this.props.onChange(n)}render(){let e=this.props,{onChange:t,value:n,className:r,error:a,clearable:i,disabled:u,overrideCSS:h}=e,f=p(e,c),m=this.props.hasOwnProperty("error")&&""!=a,g=this.props.hasOwnProperty("clearable"),w=this.props.hasOwnProperty("disabled")&&1==u,y=null,b=r;this.props.hasOwnProperty("overrideCSS")&&0!=h||(b="dropdown "+r+" "+(m?"error":"")),y=this.props.isMulti?this.props.options.filter((e=>n.includes(e.value))):n instanceof Object||null==n?n:this.props.options.find((e=>e.value==n));const k={menu:e=>d(d({},e),{},{zIndex:999})};return o().createElement("div",null,o().createElement(s(),l({className:b,value:y,onChange:this.handleChange,isClearable:g,isDisabled:w,styles:k},f)),m&&o().createElement("p",{className:"error-label"},a))}}},4341:(e,t,n)=>{n(4656),n(3605),n(9732),n(886)},886:(e,t,n)=>{n.d(t,{getAccessToken:()=>p});var r=n(9732);n(4824),n(6113);const o=require("browser-tabs-lock");var a=n.n(o);n(6530),n(3856),n(4341);const s=new(a()),c="openstackuicore.lock.getTokenSilently",l="code",i="authInfo",d="nonce",u="pkce",p=async()=>{if(await(0,r.retryPromise)((()=>s.acquireLock(c,5e3)),10))try{let e=m();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:r,refreshToken:o}=e,a=y(),i=Math.floor(Date.now()/1e3);if(n-=20,i-r>n||null==t){if(console.log("getAccessToken access token expired"),a===l&&b()){if(!o)throw g(),Error("missing Refresh Token");let e=await h(o),{access_token:t,expires_in:n,refresh_token:r}=e;return void 0===r&&(r=null),f(t,n,r),t}throw g(),Error("Access Token Expired.")}return t}finally{await s.releaseLock(c)}throw Error("Lock acquire error.")},h=async e=>{let t=k(),n=w();const o={grant_type:"refresh_token",client_id:encodeURI(n),refresh_token:e};try{const e=await fetch(`${t}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(o)}).then((e=>{if(400===e.status){(0,r.getCurrentPathName)();throw(0,r.setSessionClearingState)(!0),Error(`${e.status} - ${e.statusText}`)}return e})).catch((function(e){throw Error(`Request failed: ${e.message}`)})),n=await e.json();let{access_token:a,refresh_token:s,expires_in:c}=n;return{access_token:a,refresh_token:s,expires_in:c}}catch(e){throw console.log(e),e}},f=(e,t,n=null,o=null)=>{let a=m(),s={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===n&&a&&(n=a.refreshToken),null===o&&a&&(o=a.idToken),n&&(s.refreshToken=n),o&&(s.idToken=o),(0,r.putOnLocalStorage)(i,JSON.stringify(s))},m=()=>{let e=(0,r.getFromLocalStorage)(i,!1);return null===e?null:JSON.parse(e)},g=()=>{if("undefined"!=typeof window)return(0,r.removeFromLocalStorage)(i),(0,r.removeFromLocalStorage)(d),void(0,r.removeFromLocalStorage)(u)},w=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,y=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",b=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),k=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null},3605:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>l,fetchResponseHandler:()=>i});n(4824),n(6530);const r=require("sweetalert2");var o=n.n(r),a=n(4656),s=n.n(a);n(9732),n(4341),n(886);const c=e=>t=>({type:e,payload:t}),l=(c("RESET_LOADING"),c("START_LOADING"),c("STOP_LOADING"),e=>{let t=e.status,n=e.statusText;switch(t){case 403:o().fire("ERROR",s().translate("errors.user_not_authz"),"warning");break;case 401:o().fire("ERROR",s().translate("errors.session_expired"),"error");break;case 412:o().fire("ERROR",n,"warning");case 500:o().fire("ERROR",s().translate("errors.server_error"),"error")}}),i=e=>{if(e.ok)return e.json();throw e},d=e=>e=(e=e.replace(/,/g,"\\,")).replace(/;/g,"\\;")},9732:(e,t,n)=>{n.d(t,{arraysEqual:()=>d,buildAPIBaseUrl:()=>o,getCurrentPathName:()=>r,getFromLocalStorage:()=>s,putOnLocalStorage:()=>a,removeFromLocalStorage:()=>c,retryPromise:()=>u,setSessionClearingState:()=>l,shallowEqual:()=>i});require("moment-timezone");n(6530),n(6113);const r=()=>"undefined"!=typeof window?window.location.pathname:null,o=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,a=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},s=(e,t)=>{if("undefined"!=typeof window){let n=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),c(e)),n}return null},c=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},l=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},i=(e,t)=>{const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0},d=(e,t)=>e.length===t.length&&e.every(((e,n)=>i(e,t[n]))),u=async(e,t=3)=>{for(let n=0;n<t;n++)if(await e())return!0;return!1}},7525:(e,t,n)=>{n.d(t,{getCountryList:()=>b,getLanguageList:()=>y,queryAccessLevels:()=>g,queryCompanies:()=>f,queryGroups:()=>h,queryMembers:()=>i,queryOrganizations:()=>w,querySpeakers:()=>u,querySponsors:()=>m,querySummits:()=>d,queryTags:()=>p});var r=n(3605),o=n(886),a=n(9732);const s=require("lodash");var c=n.n(s);const l=500,i=c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/members?filter=${s}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),l),d=c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),l),u=c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1";e&&(c+=`/summits/${e}`),c+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${s}&expand=member,registration_request`,fetch((0,a.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),l),p=c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1",l=encodeURIComponent(`tag=@${t}`);c+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${l}&expand=tag,track_tag_group`:`/tags?filter=${l}`,c+=`&order=tag&page=1&per_page=50&access_token=${s}`,fetch((0,a.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((t=>{let r=[...t.data];e&&(r=r.map((e=>e.tag))),n(r)})).catch(r.fetchErrorHandler)}),l),h=(c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${c}&order=name&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),l),c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();let c=(t=(0,r.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),l),c().debounce((async(e,t,n=!1,s)=>{const c=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let l=`/api/v1/summits/${e}/events`+(n?"/published":""),i=encodeURIComponent(`title=@${t}`);fetch((0,a.buildAPIBaseUrl)(`${l}?filter=${i}&order=title&access_token=${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(r.fetchErrorHandler)}),l),c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),l)),f=c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),l),m=c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`company_name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${c}&expand=company,sponsorship&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),l),g=c().debounce(((e,t,n)=>{let s=(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),l),w=c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),l),y=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/languages"),{signal:t}).then(r.fetchResponseHandler).then((t=>{e(t.data)})).catch(r.fetchErrorHandler),b=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/countries"),{signal:t}).then(r.fetchResponseHandler).then((t=>{e(t.data)})).catch(r.fetchErrorHandler)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},6689:e=>{e.exports=require("react")},4824:e=>{e.exports=require("superagent")},6530:e=>{e.exports=require("urijs")},6113:e=>{e.exports=require("crypto")}};var t=require("../../runtime.js");t.C(e);t.X(0,[5344],(()=>(e=>t(t.s=e))(8289)))})()}));
1
+ "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{var e={id:575,ids:[575,3737,7634,3451,3219,4823,1813,1149]};e.modules={8289:(e,t,n)=>{n.r(t),n.d(t,{default:()=>c});var o=n(6689),r=n.n(o),a=n(401),s=n(7525);function l(){return l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},l.apply(this,arguments)}class c extends r().Component{constructor(e){super(e),this.state={options:[]},this.handleChange=this.handleChange.bind(this),this.setOptions=this.setOptions.bind(this),this.abortController=new AbortController}componentDidMount(){let{options:e}=this.state;0==e.length&&(0,s.getCountryList)(this.setOptions,this.abortController.signal)}componentWillUnmount(){this.abortController.abort()}handleChange(e){let t={target:{id:this.props.id,value:e,type:"countryddl"}};this.props.onChange(t)}setOptions(e){let t=e.map((e=>({label:e.name,value:e.iso_code})));this.setState({options:t})}render(){let{options:e}=this.state;return r().createElement(a.default,l({options:e},this.props))}}},401:(e,t,n)=>{n.r(t),n.d(t,{default:()=>h});var o=n(6689),r=n.n(o),a=n(1929),s=n.n(a);const l=["onChange","value","className","error","clearable","disabled","overrideCSS"];function c(){return c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},c.apply(this,arguments)}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){u(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}class h extends r().Component{constructor(e){super(e),this.handleChange=this.handleChange.bind(this)}handleChange(e){let t=null;t=this.props.isMulti?e?e.map((e=>e.value)):null:e?e.value:null;let n={target:{id:this.props.id,value:t,type:"dropdown"}};this.props.onChange(n)}render(){let e=this.props,{onChange:t,value:n,className:o,error:a,clearable:i,disabled:u,overrideCSS:h}=e,f=p(e,l),g=this.props.hasOwnProperty("error")&&""!=a,m=this.props.hasOwnProperty("clearable"),w=this.props.hasOwnProperty("disabled")&&1==u,y=null,_=o;this.props.hasOwnProperty("overrideCSS")&&0!=h||(_="dropdown "+o+" "+(g?"error":"")),y=this.props.isMulti?this.props.options.filter((e=>n.includes(e.value))):n instanceof Object||null==n?n:this.props.options.find((e=>e.value==n));const k={menu:e=>d(d({},e),{},{zIndex:999})};return r().createElement("div",null,r().createElement(s(),c({className:_,value:y,onChange:this.handleChange,isClearable:m,isDisabled:w,styles:k},f)),g&&r().createElement("p",{className:"error-label"},a))}}},4341:(e,t,n)=>{n.d(t,{SET_LOGGED_USER:()=>o});n(4656),n(3605),n(9732),n(886);const o="SET_LOGGED_USER"},886:(e,t,n)=>{n.r(t),n.d(t,{ACCESS_TOKEN_SKEW_TIME:()=>w,RESPONSE_TYPE_CODE:()=>_,RESPONSE_TYPE_IMPLICIT:()=>y,clearAccessToken:()=>$,clearAuthInfo:()=>j,doLogin:()=>I,doLoginBasicLogin:()=>E,emitAccessToken:()=>U,getAccessToken:()=>C,getAuthInfo:()=>L,getAuthUrl:()=>v,getIdToken:()=>H,getLogoutUrl:()=>R,getOAuth2ClientId:()=>x,getOAuth2Flow:()=>q,getOAuth2IDPBaseUrl:()=>F,getOAuth2Scopes:()=>N,initLogOut:()=>D,passwordlessLogin:()=>G,passwordlessStart:()=>M,refreshAccessToken:()=>T,storeAuthInfo:()=>P,useOAuth2RefreshToken:()=>B,validateIdToken:()=>V});var o=n(9732),r=n(4824),a=n.n(r),s=n(6113);const l=require("browser-tabs-lock");var c=n.n(l),i=n(6530),d=n.n(i),u=n(3856),p=n.n(u),h=n(4341);let f=a();const g=new(c()),m="openstackuicore.lock.getTokenSilently",w=20,y="token id_token",_="code",k="authInfo",b="nonce",O="pkce",v=(e=null,t=null,n=null,r=null)=>{let a=x(),s=(0,o.getAuthCallback)(),l=F(),c=N(),i=q();null!=e&&(s+=`?BackUrl=${encodeURI(e)}`);let u=S(16);(0,o.putOnLocalStorage)(b,u);let p=d()(`${l}/oauth2/auth`),h={response_type:encodeURI(i),scope:encodeURI(c),nonce:u,response_mode:"fragment",client_id:encodeURI(a),redirect_uri:encodeURI(s)};if(i===_){const e=A();(0,o.putOnLocalStorage)(O,JSON.stringify(e)),h.code_challenge=e.codeChallenge,h.code_challenge_method="S256",h.approval_prompt="force"}return t&&(h.prompt=t),n&&(h.id_token_hint=n),r&&(h.provider=r),p=p.query(h),p},R=e=>{let t=F(),n=x(),r=d()(`${t}/oauth2/end-session`),a=S(16),s=(0,o.getOrigin)()+"/auth/logout";return(0,o.putOnLocalStorage)("post_logout_state",a),r.query({id_token_hint:e,post_logout_redirect_uri:encodeURI(s),client_id:encodeURI(n),state:a})},S=e=>{let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n="";for(let o=0;o<e;o++)n+=t.charAt(Math.floor(Math.random()*t.length));return n},I=(e=null,t=null,n=null)=>{let r=v(e,n,null,t);(0,o.getCurrentLocation)().replace(r.toString())},E=(e=null)=>{I(e,null,null)},A=()=>{const e=(0,o.base64URLEncode)((0,s.randomBytes)(64));return{codeVerifier:e,codeChallenge:(0,o.base64URLEncode)((0,o.sha256)(Buffer.from(e))),createdAt:new Date}},U=async(e,t=null)=>{let n=F(),r=x(),a=(0,o.getAuthCallback)(),s=JSON.parse((0,o.getFromLocalStorage)(O,!0));null!=t&&(a+=`?BackUrl=${encodeURI(t)}`);const l={code:e,grant_type:"authorization_code",code_verifier:s.codeVerifier,client_id:encodeURI(r),redirect_uri:encodeURI(a)};try{const e=await fetch(`${n}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(l)}).catch((function(e){console.log("Request failed:",e.message)})),t=await e.json();let{access_token:o,refresh_token:r,id_token:a,expires_in:s,error:c,error_description:i}=t;return{access_token:o,refresh_token:r,id_token:a,expires_in:s,error:c,error_description:i}}catch(e){console.log(e)}},$=async()=>{if(await(0,o.retryPromise)((()=>g.acquireLock(m,5e3)),10))try{let e=L();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:o,refreshToken:r}=e;P(null,0,r)}finally{await g.releaseLock(m)}},C=async()=>{if(await(0,o.retryPromise)((()=>g.acquireLock(m,5e3)),10))try{let e=L();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:o,refreshToken:r}=e,a=q(),s=Math.floor(Date.now()/1e3);if(n-=w,s-o>n||null==t){if(console.log("getAccessToken access token expired"),a===_&&B()){if(!r)throw j(),Error("missing Refresh Token");let e=await T(r),{access_token:t,expires_in:n,refresh_token:o}=e;return void 0===o&&(o=null),P(t,n,o),t}throw j(),Error("Access Token Expired.")}return t}finally{await g.releaseLock(m)}throw Error("Lock acquire error.")},T=async e=>{let t=F(),n=x();const r={grant_type:"refresh_token",client_id:encodeURI(n),refresh_token:e};try{const e=await fetch(`${t}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(r)}).then((e=>{if(400===e.status){(0,o.getCurrentPathName)();throw(0,o.setSessionClearingState)(!0),Error(`${e.status} - ${e.statusText}`)}return e})).catch((function(e){throw Error(`Request failed: ${e.message}`)})),n=await e.json();let{access_token:a,refresh_token:s,expires_in:l}=n;return{access_token:a,refresh_token:s,expires_in:l}}catch(e){throw console.log(e),e}},P=(e,t,n=null,r=null)=>{let a=L(),s={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===n&&a&&(n=a.refreshToken),null===r&&a&&(r=a.idToken),n&&(s.refreshToken=n),r&&(s.idToken=r),(0,o.putOnLocalStorage)(k,JSON.stringify(s))},L=()=>{let e=(0,o.getFromLocalStorage)(k,!1);return null===e?null:JSON.parse(e)},j=()=>{if("undefined"!=typeof window)return(0,o.removeFromLocalStorage)(k),(0,o.removeFromLocalStorage)(b),void(0,o.removeFromLocalStorage)(O)},H=()=>{if("undefined"!=typeof window){const e=L();return e?e.idToken:null}return null},x=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,q=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",B=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),F=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null,N=()=>"undefined"!=typeof window?window.SCOPES:null,D=()=>{(0,o.getCurrentLocation)().replace(R(H()).toString())},V=(e,t,n)=>{let r=new(p())({issuer:t,audience:n}),a=(0,o.getFromLocalStorage)(b,!0),s=r.decode(e),l=(s.header.alg,s.header.kid,s.payload.aud),c=s.payload.iss;s.payload.exp,s.payload.nbf;return(s.payload.nonce||null)==a&&l==n&&c==t},M=e=>{let t=x(),n=N(),r=S(16);(0,o.putOnLocalStorage)(b,r);let a=F(),s=d()(`${a}/oauth2/auth`),l={response_type:"otp",scope:encodeURI(n),nonce:r,client_id:encodeURI(t),connection:e.connection||"email",send:e.send||"code"};return e.hasOwnProperty("email")&&(l.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(l.phone_number=encodeURIComponent(e.phone_number)),f.post(s.toString()).send(l).then((e=>{let t=e.body;return Promise.resolve({response:t})})).catch((e=>Promise.reject(e)))},G=e=>t=>{let n=x(),o=N(),r=F(),a=d()(`${r}/oauth2/token`);if(!e.hasOwnProperty("otp"))throw Error("otp param is mandatory.");let s={grant_type:"passwordless",connection:e.connection||"email",scope:encodeURI(o),client_id:encodeURI(n),otp:e.otp};return e.hasOwnProperty("email")&&(s.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(s.phone_number=encodeURIComponent(e.phone_number)),f.post(a.toString()).send(s).then((e=>{try{let o=e.body,{access_token:a,expires_in:s,refresh_token:l,id_token:c}=o;if(void 0===l&&(l=null),void 0===c&&(c=null),c&&!V(c,r,n))throw Error("id token is not valid.");return P(a,s,l,c),t&&t({type:h.SET_LOGGED_USER,payload:{sessionState:null}}),Promise.resolve({response:o})}catch(e){return console.log(e),Promise.reject(e)}})).catch((e=>Promise.reject(e)))}},3605:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>c,fetchResponseHandler:()=>i});n(4824),n(6530);const o=require("sweetalert2");var r=n.n(o),a=n(4656),s=n.n(a);n(9732),n(4341),n(886);const l=e=>t=>({type:e,payload:t}),c=(l("RESET_LOADING"),l("START_LOADING"),l("STOP_LOADING"),e=>{let t=e.status,n=e.statusText;switch(t){case 403:r().fire("ERROR",s().translate("errors.user_not_authz"),"warning");break;case 401:r().fire("ERROR",s().translate("errors.session_expired"),"error");break;case 412:r().fire("ERROR",n,"warning");case 500:r().fire("ERROR",s().translate("errors.server_error"),"error")}}),i=e=>{if(e.ok)return e.json();throw e},d=e=>e=(e=e.replace(/,/g,"\\,")).replace(/;/g,"\\;")},9732:(e,t,n)=>{n.d(t,{arraysEqual:()=>f,base64URLEncode:()=>g,buildAPIBaseUrl:()=>c,getAuthCallback:()=>r,getCurrentLocation:()=>a,getCurrentPathName:()=>l,getFromLocalStorage:()=>d,getOrigin:()=>s,putOnLocalStorage:()=>i,removeFromLocalStorage:()=>u,retryPromise:()=>w,setSessionClearingState:()=>p,sha256:()=>m,shallowEqual:()=>h});require("moment-timezone");n(6530);var o=n(6113);const r=()=>"undefined"!=typeof window?`${window.location.origin}/auth/callback`:null,a=()=>{let e="";return"undefined"!=typeof window&&(e=window.location,window.top&&(e=window.top.location)),e},s=()=>"undefined"!=typeof window?window.location.origin:null,l=()=>"undefined"!=typeof window?window.location.pathname:null,c=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,i=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},d=(e,t)=>{if("undefined"!=typeof window){let n=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),u(e)),n}return null},u=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},p=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},h=(e,t)=>{const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(let o of n)if(e[o]!==t[o])return!1;return!0},f=(e,t)=>e.length===t.length&&e.every(((e,n)=>h(e,t[n]))),g=e=>e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),m=e=>(0,o.createHash)("sha256").update(e).digest(),w=async(e,t=3)=>{for(let n=0;n<t;n++)if(await e())return!0;return!1}},7525:(e,t,n)=>{n.d(t,{getCountryList:()=>_,getLanguageList:()=>y,queryAccessLevels:()=>m,queryCompanies:()=>f,queryGroups:()=>h,queryMembers:()=>i,queryOrganizations:()=>w,querySpeakers:()=>u,querySponsors:()=>g,querySummits:()=>d,queryTags:()=>p});var o=n(3605),r=n(886),a=n(9732);const s=require("lodash");var l=n.n(s);const c=500,i=l().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/members?filter=${s}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),c),d=l().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),c),u=l().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let l="/api/v1";e&&(l+=`/summits/${e}`),l+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${s}&expand=member,registration_request`,fetch((0,a.buildAPIBaseUrl)(l)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),c),p=l().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let l="/api/v1",c=encodeURIComponent(`tag=@${t}`);l+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${c}&expand=tag,track_tag_group`:`/tags?filter=${c}`,l+=`&order=tag&page=1&per_page=50&access_token=${s}`,fetch((0,a.buildAPIBaseUrl)(l)).then(o.fetchResponseHandler).then((t=>{let o=[...t.data];e&&(o=o.map((e=>e.tag))),n(o)})).catch(o.fetchErrorHandler)}),c),h=(l().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let l=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${l}&order=name&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),c),l().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();let l=(t=(0,o.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${l}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),c),l().debounce((async(e,t,n=!1,s)=>{const l=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c=`/api/v1/summits/${e}/events`+(n?"/published":""),i=encodeURIComponent(`title=@${t}`);fetch((0,a.buildAPIBaseUrl)(`${c}?filter=${i}&order=title&access_token=${l}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(o.fetchErrorHandler)}),c),l().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),c)),f=l().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),c),g=l().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let l=encodeURIComponent(`company_name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${l}&expand=company,sponsorship&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),c),m=l().debounce(((e,t,n)=>{let s=(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let l=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${l}&&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),c),w=l().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),c),y=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/languages"),{signal:t}).then(o.fetchResponseHandler).then((t=>{e(t.data)})).catch(o.fetchErrorHandler),_=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/countries"),{signal:t}).then(o.fetchResponseHandler).then((t=>{e(t.data)})).catch(o.fetchErrorHandler)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},6689:e=>{e.exports=require("react")},4824:e=>{e.exports=require("superagent")},6530:e=>{e.exports=require("urijs")},6113:e=>{e.exports=require("crypto")}};var t=require("../../runtime.js");t.C(e);t.X(0,[5344],(()=>(e=>t(t.s=e))(8289)))})()}));
@@ -1 +1 @@
1
- "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{var e={id:8726,ids:[8726,3737,3451,4823,1813,1149]};e.modules={3953:(e,t,n)=>{n.r(t),n.d(t,{default:()=>d});var r=n(6689),o=n.n(r),a=n(1929),s=n.n(a),c=n(7525);const l=["value","onChange","id","multi","error"];function i(){return i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i.apply(this,arguments)}function u(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}class d extends o().Component{constructor(e){super(e),this.state={options:[]},this.handleChange=this.handleChange.bind(this),this.setOptions=this.setOptions.bind(this),(0,c.getCountryList)(this.setOptions)}setOptions(e){let t=e.map((e=>({label:e.name,value:e.iso_code})));this.setState({options:t})}handleChange(e){let t=null;t=this.props.hasOwnProperty("multi")?e.map((e=>e.value)):e.value;let n={target:{id:this.props.id,value:t,type:"countryinput"}};this.props.onChange(n)}render(){let e=this.props,{value:t,onChange:n,id:r,multi:a,error:c}=e,d=u(e,l),{options:p}=this.state,h=this.props.hasOwnProperty("multi"),f=null,m=this.props.hasOwnProperty("error")&&""!=c;return f=h?p.filter((e=>t.includes(e.value))):t instanceof Object||null==t?t:p.find((e=>e.value==t)),o().createElement("div",null,o().createElement(s(),i({className:"dropdown"+(m?" error":""),onChange:this.handleChange,options:p,value:f,isMulti:h},d)),m&&o().createElement("p",{className:"error-label"},c))}}},4341:(e,t,n)=>{n(4656),n(3605),n(9732),n(886)},886:(e,t,n)=>{n.d(t,{getAccessToken:()=>p});var r=n(9732);n(4824),n(6113);const o=require("browser-tabs-lock");var a=n.n(o);n(6530),n(3856),n(4341);const s=new(a()),c="openstackuicore.lock.getTokenSilently",l="code",i="authInfo",u="nonce",d="pkce",p=async()=>{if(await(0,r.retryPromise)((()=>s.acquireLock(c,5e3)),10))try{let e=m();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:r,refreshToken:o}=e,a=y(),i=Math.floor(Date.now()/1e3);if(n-=20,i-r>n||null==t){if(console.log("getAccessToken access token expired"),a===l&&k()){if(!o)throw g(),Error("missing Refresh Token");let e=await h(o),{access_token:t,expires_in:n,refresh_token:r}=e;return void 0===r&&(r=null),f(t,n,r),t}throw g(),Error("Access Token Expired.")}return t}finally{await s.releaseLock(c)}throw Error("Lock acquire error.")},h=async e=>{let t=_(),n=w();const o={grant_type:"refresh_token",client_id:encodeURI(n),refresh_token:e};try{const e=await fetch(`${t}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(o)}).then((e=>{if(400===e.status){(0,r.getCurrentPathName)();throw(0,r.setSessionClearingState)(!0),Error(`${e.status} - ${e.statusText}`)}return e})).catch((function(e){throw Error(`Request failed: ${e.message}`)})),n=await e.json();let{access_token:a,refresh_token:s,expires_in:c}=n;return{access_token:a,refresh_token:s,expires_in:c}}catch(e){throw console.log(e),e}},f=(e,t,n=null,o=null)=>{let a=m(),s={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===n&&a&&(n=a.refreshToken),null===o&&a&&(o=a.idToken),n&&(s.refreshToken=n),o&&(s.idToken=o),(0,r.putOnLocalStorage)(i,JSON.stringify(s))},m=()=>{let e=(0,r.getFromLocalStorage)(i,!1);return null===e?null:JSON.parse(e)},g=()=>{if("undefined"!=typeof window)return(0,r.removeFromLocalStorage)(i),(0,r.removeFromLocalStorage)(u),void(0,r.removeFromLocalStorage)(d)},w=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,y=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",k=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),_=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null},3605:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>u,fetchErrorHandler:()=>l,fetchResponseHandler:()=>i});n(4824),n(6530);const r=require("sweetalert2");var o=n.n(r),a=n(4656),s=n.n(a);n(9732),n(4341),n(886);const c=e=>t=>({type:e,payload:t}),l=(c("RESET_LOADING"),c("START_LOADING"),c("STOP_LOADING"),e=>{let t=e.status,n=e.statusText;switch(t){case 403:o().fire("ERROR",s().translate("errors.user_not_authz"),"warning");break;case 401:o().fire("ERROR",s().translate("errors.session_expired"),"error");break;case 412:o().fire("ERROR",n,"warning");case 500:o().fire("ERROR",s().translate("errors.server_error"),"error")}}),i=e=>{if(e.ok)return e.json();throw e},u=e=>e=(e=e.replace(/,/g,"\\,")).replace(/;/g,"\\;")},9732:(e,t,n)=>{n.d(t,{arraysEqual:()=>u,buildAPIBaseUrl:()=>o,getCurrentPathName:()=>r,getFromLocalStorage:()=>s,putOnLocalStorage:()=>a,removeFromLocalStorage:()=>c,retryPromise:()=>d,setSessionClearingState:()=>l,shallowEqual:()=>i});require("moment-timezone");n(6530),n(6113);const r=()=>"undefined"!=typeof window?window.location.pathname:null,o=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,a=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},s=(e,t)=>{if("undefined"!=typeof window){let n=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),c(e)),n}return null},c=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},l=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},i=(e,t)=>{const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0},u=(e,t)=>e.length===t.length&&e.every(((e,n)=>i(e,t[n]))),d=async(e,t=3)=>{for(let n=0;n<t;n++)if(await e())return!0;return!1}},7525:(e,t,n)=>{n.d(t,{getCountryList:()=>k,getLanguageList:()=>y,queryAccessLevels:()=>g,queryCompanies:()=>f,queryGroups:()=>h,queryMembers:()=>i,queryOrganizations:()=>w,querySpeakers:()=>d,querySponsors:()=>m,querySummits:()=>u,queryTags:()=>p});var r=n(3605),o=n(886),a=n(9732);const s=require("lodash");var c=n.n(s);const l=500,i=c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/members?filter=${s}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),l),u=c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),l),d=c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1";e&&(c+=`/summits/${e}`),c+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${s}&expand=member,registration_request`,fetch((0,a.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),l),p=c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1",l=encodeURIComponent(`tag=@${t}`);c+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${l}&expand=tag,track_tag_group`:`/tags?filter=${l}`,c+=`&order=tag&page=1&per_page=50&access_token=${s}`,fetch((0,a.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((t=>{let r=[...t.data];e&&(r=r.map((e=>e.tag))),n(r)})).catch(r.fetchErrorHandler)}),l),h=(c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${c}&order=name&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),l),c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();let c=(t=(0,r.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),l),c().debounce((async(e,t,n=!1,s)=>{const c=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let l=`/api/v1/summits/${e}/events`+(n?"/published":""),i=encodeURIComponent(`title=@${t}`);fetch((0,a.buildAPIBaseUrl)(`${l}?filter=${i}&order=title&access_token=${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(r.fetchErrorHandler)}),l),c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),l)),f=c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),l),m=c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`company_name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${c}&expand=company,sponsorship&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),l),g=c().debounce(((e,t,n)=>{let s=(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),l),w=c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),l),y=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/languages"),{signal:t}).then(r.fetchResponseHandler).then((t=>{e(t.data)})).catch(r.fetchErrorHandler),k=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/countries"),{signal:t}).then(r.fetchResponseHandler).then((t=>{e(t.data)})).catch(r.fetchErrorHandler)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},6689:e=>{e.exports=require("react")},4824:e=>{e.exports=require("superagent")},6530:e=>{e.exports=require("urijs")},6113:e=>{e.exports=require("crypto")}};var t=require("../../runtime.js");t.C(e);t.X(0,[5344],(()=>(e=>t(t.s=e))(3953)))})()}));
1
+ "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{var e={id:8726,ids:[8726,3737,7634,3451,4823,1813,1149]};e.modules={3953:(e,t,n)=>{n.r(t),n.d(t,{default:()=>u});var o=n(6689),r=n.n(o),a=n(1929),s=n.n(a),c=n(7525);const l=["value","onChange","id","multi","error"];function i(){return i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},i.apply(this,arguments)}function d(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}class u extends r().Component{constructor(e){super(e),this.state={options:[]},this.handleChange=this.handleChange.bind(this),this.setOptions=this.setOptions.bind(this),(0,c.getCountryList)(this.setOptions)}setOptions(e){let t=e.map((e=>({label:e.name,value:e.iso_code})));this.setState({options:t})}handleChange(e){let t=null;t=this.props.hasOwnProperty("multi")?e.map((e=>e.value)):e.value;let n={target:{id:this.props.id,value:t,type:"countryinput"}};this.props.onChange(n)}render(){let e=this.props,{value:t,onChange:n,id:o,multi:a,error:c}=e,u=d(e,l),{options:p}=this.state,h=this.props.hasOwnProperty("multi"),f=null,g=this.props.hasOwnProperty("error")&&""!=c;return f=h?p.filter((e=>t.includes(e.value))):t instanceof Object||null==t?t:p.find((e=>e.value==t)),r().createElement("div",null,r().createElement(s(),i({className:"dropdown"+(g?" error":""),onChange:this.handleChange,options:p,value:f,isMulti:h},u)),g&&r().createElement("p",{className:"error-label"},c))}}},4341:(e,t,n)=>{n.d(t,{SET_LOGGED_USER:()=>o});n(4656),n(3605),n(9732),n(886);const o="SET_LOGGED_USER"},886:(e,t,n)=>{n.r(t),n.d(t,{ACCESS_TOKEN_SKEW_TIME:()=>w,RESPONSE_TYPE_CODE:()=>y,RESPONSE_TYPE_IMPLICIT:()=>_,clearAccessToken:()=>v,clearAuthInfo:()=>H,doLogin:()=>S,doLoginBasicLogin:()=>A,emitAccessToken:()=>$,getAccessToken:()=>T,getAuthInfo:()=>P,getAuthUrl:()=>I,getIdToken:()=>x,getLogoutUrl:()=>O,getOAuth2ClientId:()=>q,getOAuth2Flow:()=>j,getOAuth2IDPBaseUrl:()=>F,getOAuth2Scopes:()=>N,initLogOut:()=>V,passwordlessLogin:()=>M,passwordlessStart:()=>G,refreshAccessToken:()=>C,storeAuthInfo:()=>L,useOAuth2RefreshToken:()=>B,validateIdToken:()=>D});var o=n(9732),r=n(4824),a=n.n(r),s=n(6113);const c=require("browser-tabs-lock");var l=n.n(c),i=n(6530),d=n.n(i),u=n(3856),p=n.n(u),h=n(4341);let f=a();const g=new(l()),m="openstackuicore.lock.getTokenSilently",w=20,_="token id_token",y="code",k="authInfo",R="nonce",b="pkce",I=(e=null,t=null,n=null,r=null)=>{let a=q(),s=(0,o.getAuthCallback)(),c=F(),l=N(),i=j();null!=e&&(s+=`?BackUrl=${encodeURI(e)}`);let u=E(16);(0,o.putOnLocalStorage)(R,u);let p=d()(`${c}/oauth2/auth`),h={response_type:encodeURI(i),scope:encodeURI(l),nonce:u,response_mode:"fragment",client_id:encodeURI(a),redirect_uri:encodeURI(s)};if(i===y){const e=U();(0,o.putOnLocalStorage)(b,JSON.stringify(e)),h.code_challenge=e.codeChallenge,h.code_challenge_method="S256",h.approval_prompt="force"}return t&&(h.prompt=t),n&&(h.id_token_hint=n),r&&(h.provider=r),p=p.query(h),p},O=e=>{let t=F(),n=q(),r=d()(`${t}/oauth2/end-session`),a=E(16),s=(0,o.getOrigin)()+"/auth/logout";return(0,o.putOnLocalStorage)("post_logout_state",a),r.query({id_token_hint:e,post_logout_redirect_uri:encodeURI(s),client_id:encodeURI(n),state:a})},E=e=>{let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n="";for(let o=0;o<e;o++)n+=t.charAt(Math.floor(Math.random()*t.length));return n},S=(e=null,t=null,n=null)=>{let r=I(e,n,null,t);(0,o.getCurrentLocation)().replace(r.toString())},A=(e=null)=>{S(e,null,null)},U=()=>{const e=(0,o.base64URLEncode)((0,s.randomBytes)(64));return{codeVerifier:e,codeChallenge:(0,o.base64URLEncode)((0,o.sha256)(Buffer.from(e))),createdAt:new Date}},$=async(e,t=null)=>{let n=F(),r=q(),a=(0,o.getAuthCallback)(),s=JSON.parse((0,o.getFromLocalStorage)(b,!0));null!=t&&(a+=`?BackUrl=${encodeURI(t)}`);const c={code:e,grant_type:"authorization_code",code_verifier:s.codeVerifier,client_id:encodeURI(r),redirect_uri:encodeURI(a)};try{const e=await fetch(`${n}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(c)}).catch((function(e){console.log("Request failed:",e.message)})),t=await e.json();let{access_token:o,refresh_token:r,id_token:a,expires_in:s,error:l,error_description:i}=t;return{access_token:o,refresh_token:r,id_token:a,expires_in:s,error:l,error_description:i}}catch(e){console.log(e)}},v=async()=>{if(await(0,o.retryPromise)((()=>g.acquireLock(m,5e3)),10))try{let e=P();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:o,refreshToken:r}=e;L(null,0,r)}finally{await g.releaseLock(m)}},T=async()=>{if(await(0,o.retryPromise)((()=>g.acquireLock(m,5e3)),10))try{let e=P();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:o,refreshToken:r}=e,a=j(),s=Math.floor(Date.now()/1e3);if(n-=w,s-o>n||null==t){if(console.log("getAccessToken access token expired"),a===y&&B()){if(!r)throw H(),Error("missing Refresh Token");let e=await C(r),{access_token:t,expires_in:n,refresh_token:o}=e;return void 0===o&&(o=null),L(t,n,o),t}throw H(),Error("Access Token Expired.")}return t}finally{await g.releaseLock(m)}throw Error("Lock acquire error.")},C=async e=>{let t=F(),n=q();const r={grant_type:"refresh_token",client_id:encodeURI(n),refresh_token:e};try{const e=await fetch(`${t}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(r)}).then((e=>{if(400===e.status){(0,o.getCurrentPathName)();throw(0,o.setSessionClearingState)(!0),Error(`${e.status} - ${e.statusText}`)}return e})).catch((function(e){throw Error(`Request failed: ${e.message}`)})),n=await e.json();let{access_token:a,refresh_token:s,expires_in:c}=n;return{access_token:a,refresh_token:s,expires_in:c}}catch(e){throw console.log(e),e}},L=(e,t,n=null,r=null)=>{let a=P(),s={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===n&&a&&(n=a.refreshToken),null===r&&a&&(r=a.idToken),n&&(s.refreshToken=n),r&&(s.idToken=r),(0,o.putOnLocalStorage)(k,JSON.stringify(s))},P=()=>{let e=(0,o.getFromLocalStorage)(k,!1);return null===e?null:JSON.parse(e)},H=()=>{if("undefined"!=typeof window)return(0,o.removeFromLocalStorage)(k),(0,o.removeFromLocalStorage)(R),void(0,o.removeFromLocalStorage)(b)},x=()=>{if("undefined"!=typeof window){const e=P();return e?e.idToken:null}return null},q=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,j=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",B=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),F=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null,N=()=>"undefined"!=typeof window?window.SCOPES:null,V=()=>{(0,o.getCurrentLocation)().replace(O(x()).toString())},D=(e,t,n)=>{let r=new(p())({issuer:t,audience:n}),a=(0,o.getFromLocalStorage)(R,!0),s=r.decode(e),c=(s.header.alg,s.header.kid,s.payload.aud),l=s.payload.iss;s.payload.exp,s.payload.nbf;return(s.payload.nonce||null)==a&&c==n&&l==t},G=e=>{let t=q(),n=N(),r=E(16);(0,o.putOnLocalStorage)(R,r);let a=F(),s=d()(`${a}/oauth2/auth`),c={response_type:"otp",scope:encodeURI(n),nonce:r,client_id:encodeURI(t),connection:e.connection||"email",send:e.send||"code"};return e.hasOwnProperty("email")&&(c.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(c.phone_number=encodeURIComponent(e.phone_number)),f.post(s.toString()).send(c).then((e=>{let t=e.body;return Promise.resolve({response:t})})).catch((e=>Promise.reject(e)))},M=e=>t=>{let n=q(),o=N(),r=F(),a=d()(`${r}/oauth2/token`);if(!e.hasOwnProperty("otp"))throw Error("otp param is mandatory.");let s={grant_type:"passwordless",connection:e.connection||"email",scope:encodeURI(o),client_id:encodeURI(n),otp:e.otp};return e.hasOwnProperty("email")&&(s.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(s.phone_number=encodeURIComponent(e.phone_number)),f.post(a.toString()).send(s).then((e=>{try{let o=e.body,{access_token:a,expires_in:s,refresh_token:c,id_token:l}=o;if(void 0===c&&(c=null),void 0===l&&(l=null),l&&!D(l,r,n))throw Error("id token is not valid.");return L(a,s,c,l),t&&t({type:h.SET_LOGGED_USER,payload:{sessionState:null}}),Promise.resolve({response:o})}catch(e){return console.log(e),Promise.reject(e)}})).catch((e=>Promise.reject(e)))}},3605:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>l,fetchResponseHandler:()=>i});n(4824),n(6530);const o=require("sweetalert2");var r=n.n(o),a=n(4656),s=n.n(a);n(9732),n(4341),n(886);const c=e=>t=>({type:e,payload:t}),l=(c("RESET_LOADING"),c("START_LOADING"),c("STOP_LOADING"),e=>{let t=e.status,n=e.statusText;switch(t){case 403:r().fire("ERROR",s().translate("errors.user_not_authz"),"warning");break;case 401:r().fire("ERROR",s().translate("errors.session_expired"),"error");break;case 412:r().fire("ERROR",n,"warning");case 500:r().fire("ERROR",s().translate("errors.server_error"),"error")}}),i=e=>{if(e.ok)return e.json();throw e},d=e=>e=(e=e.replace(/,/g,"\\,")).replace(/;/g,"\\;")},9732:(e,t,n)=>{n.d(t,{arraysEqual:()=>f,base64URLEncode:()=>g,buildAPIBaseUrl:()=>l,getAuthCallback:()=>r,getCurrentLocation:()=>a,getCurrentPathName:()=>c,getFromLocalStorage:()=>d,getOrigin:()=>s,putOnLocalStorage:()=>i,removeFromLocalStorage:()=>u,retryPromise:()=>w,setSessionClearingState:()=>p,sha256:()=>m,shallowEqual:()=>h});require("moment-timezone");n(6530);var o=n(6113);const r=()=>"undefined"!=typeof window?`${window.location.origin}/auth/callback`:null,a=()=>{let e="";return"undefined"!=typeof window&&(e=window.location,window.top&&(e=window.top.location)),e},s=()=>"undefined"!=typeof window?window.location.origin:null,c=()=>"undefined"!=typeof window?window.location.pathname:null,l=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,i=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},d=(e,t)=>{if("undefined"!=typeof window){let n=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),u(e)),n}return null},u=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},p=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},h=(e,t)=>{const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(let o of n)if(e[o]!==t[o])return!1;return!0},f=(e,t)=>e.length===t.length&&e.every(((e,n)=>h(e,t[n]))),g=e=>e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),m=e=>(0,o.createHash)("sha256").update(e).digest(),w=async(e,t=3)=>{for(let n=0;n<t;n++)if(await e())return!0;return!1}},7525:(e,t,n)=>{n.d(t,{getCountryList:()=>y,getLanguageList:()=>_,queryAccessLevels:()=>m,queryCompanies:()=>f,queryGroups:()=>h,queryMembers:()=>i,queryOrganizations:()=>w,querySpeakers:()=>u,querySponsors:()=>g,querySummits:()=>d,queryTags:()=>p});var o=n(3605),r=n(886),a=n(9732);const s=require("lodash");var c=n.n(s);const l=500,i=c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/members?filter=${s}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l),d=c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l),u=c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c="/api/v1";e&&(c+=`/summits/${e}`),c+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${s}&expand=member,registration_request`,fetch((0,a.buildAPIBaseUrl)(c)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),p=c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c="/api/v1",l=encodeURIComponent(`tag=@${t}`);c+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${l}&expand=tag,track_tag_group`:`/tags?filter=${l}`,c+=`&order=tag&page=1&per_page=50&access_token=${s}`,fetch((0,a.buildAPIBaseUrl)(c)).then(o.fetchResponseHandler).then((t=>{let o=[...t.data];e&&(o=o.map((e=>e.tag))),n(o)})).catch(o.fetchErrorHandler)}),l),h=(c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${c}&order=name&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();let c=(t=(0,o.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${c}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),c().debounce((async(e,t,n=!1,s)=>{const c=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let l=`/api/v1/summits/${e}/events`+(n?"/published":""),i=encodeURIComponent(`title=@${t}`);fetch((0,a.buildAPIBaseUrl)(`${l}?filter=${i}&order=title&access_token=${c}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(o.fetchErrorHandler)}),l),c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l)),f=c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l),g=c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c=encodeURIComponent(`company_name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${c}&expand=company,sponsorship&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),m=c().debounce(((e,t,n)=>{let s=(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${c}&&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),w=c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l),_=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/languages"),{signal:t}).then(o.fetchResponseHandler).then((t=>{e(t.data)})).catch(o.fetchErrorHandler),y=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/countries"),{signal:t}).then(o.fetchResponseHandler).then((t=>{e(t.data)})).catch(o.fetchErrorHandler)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},6689:e=>{e.exports=require("react")},4824:e=>{e.exports=require("superagent")},6530:e=>{e.exports=require("urijs")},6113:e=>{e.exports=require("crypto")}};var t=require("../../runtime.js");t.C(e);t.X(0,[5344],(()=>(e=>t(t.s=e))(3953)))})()}));
@@ -1 +1 @@
1
- "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{var e={id:6082,ids:[6082,3737,3451,4823,1813,1149]};e.modules={2712:(e,t,n)=>{n.r(t),n.d(t,{default:()=>d});var r=n(6689),o=n.n(r),a=n(9953),s=n.n(a),c=n(7525);const i=["value","onChange","id","multi"];function l(){return l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l.apply(this,arguments)}function u(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}class d extends o().Component{constructor(e){super(e),this.handleChange=this.handleChange.bind(this),this.getGroups=this.getGroups.bind(this)}handleChange(e){let t={target:{id:this.props.id,value:e,type:"groupinput"}};this.props.onChange(t)}getGroups(e,t){if(!e)return Promise.resolve({options:[]});(0,c.queryGroups)(e,t)}render(){let e=this.props,{value:t,onChange:n,id:r,multi:a}=e,c=u(e,i),d=this.props.hasOwnProperty("multi");return o().createElement(s(),l({value:t,onChange:this.handleChange,loadOptions:this.getGroups,getOptionValue:e=>e.id,getOptionLabel:e=>e.title,isMulti:d},c))}}},4341:(e,t,n)=>{n(4656),n(3605),n(9732),n(886)},886:(e,t,n)=>{n.d(t,{getAccessToken:()=>p});var r=n(9732);n(4824),n(6113);const o=require("browser-tabs-lock");var a=n.n(o);n(6530),n(3856),n(4341);const s=new(a()),c="openstackuicore.lock.getTokenSilently",i="code",l="authInfo",u="nonce",d="pkce",p=async()=>{if(await(0,r.retryPromise)((()=>s.acquireLock(c,5e3)),10))try{let e=g();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:r,refreshToken:o}=e,a=k(),l=Math.floor(Date.now()/1e3);if(n-=20,l-r>n||null==t){if(console.log("getAccessToken access token expired"),a===i&&y()){if(!o)throw m(),Error("missing Refresh Token");let e=await h(o),{access_token:t,expires_in:n,refresh_token:r}=e;return void 0===r&&(r=null),f(t,n,r),t}throw m(),Error("Access Token Expired.")}return t}finally{await s.releaseLock(c)}throw Error("Lock acquire error.")},h=async e=>{let t=$(),n=w();const o={grant_type:"refresh_token",client_id:encodeURI(n),refresh_token:e};try{const e=await fetch(`${t}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(o)}).then((e=>{if(400===e.status){(0,r.getCurrentPathName)();throw(0,r.setSessionClearingState)(!0),Error(`${e.status} - ${e.statusText}`)}return e})).catch((function(e){throw Error(`Request failed: ${e.message}`)})),n=await e.json();let{access_token:a,refresh_token:s,expires_in:c}=n;return{access_token:a,refresh_token:s,expires_in:c}}catch(e){throw console.log(e),e}},f=(e,t,n=null,o=null)=>{let a=g(),s={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===n&&a&&(n=a.refreshToken),null===o&&a&&(o=a.idToken),n&&(s.refreshToken=n),o&&(s.idToken=o),(0,r.putOnLocalStorage)(l,JSON.stringify(s))},g=()=>{let e=(0,r.getFromLocalStorage)(l,!1);return null===e?null:JSON.parse(e)},m=()=>{if("undefined"!=typeof window)return(0,r.removeFromLocalStorage)(l),(0,r.removeFromLocalStorage)(u),void(0,r.removeFromLocalStorage)(d)},w=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,k=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",y=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),$=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null},3605:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>u,fetchErrorHandler:()=>i,fetchResponseHandler:()=>l});n(4824),n(6530);const r=require("sweetalert2");var o=n.n(r),a=n(4656),s=n.n(a);n(9732),n(4341),n(886);const c=e=>t=>({type:e,payload:t}),i=(c("RESET_LOADING"),c("START_LOADING"),c("STOP_LOADING"),e=>{let t=e.status,n=e.statusText;switch(t){case 403:o().fire("ERROR",s().translate("errors.user_not_authz"),"warning");break;case 401:o().fire("ERROR",s().translate("errors.session_expired"),"error");break;case 412:o().fire("ERROR",n,"warning");case 500:o().fire("ERROR",s().translate("errors.server_error"),"error")}}),l=e=>{if(e.ok)return e.json();throw e},u=e=>e=(e=e.replace(/,/g,"\\,")).replace(/;/g,"\\;")},9732:(e,t,n)=>{n.d(t,{arraysEqual:()=>u,buildAPIBaseUrl:()=>o,getCurrentPathName:()=>r,getFromLocalStorage:()=>s,putOnLocalStorage:()=>a,removeFromLocalStorage:()=>c,retryPromise:()=>d,setSessionClearingState:()=>i,shallowEqual:()=>l});require("moment-timezone");n(6530),n(6113);const r=()=>"undefined"!=typeof window?window.location.pathname:null,o=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,a=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},s=(e,t)=>{if("undefined"!=typeof window){let n=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),c(e)),n}return null},c=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},i=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},l=(e,t)=>{const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0},u=(e,t)=>e.length===t.length&&e.every(((e,n)=>l(e,t[n]))),d=async(e,t=3)=>{for(let n=0;n<t;n++)if(await e())return!0;return!1}},7525:(e,t,n)=>{n.d(t,{getCountryList:()=>y,getLanguageList:()=>k,queryAccessLevels:()=>m,queryCompanies:()=>f,queryGroups:()=>h,queryMembers:()=>l,queryOrganizations:()=>w,querySpeakers:()=>d,querySponsors:()=>g,querySummits:()=>u,queryTags:()=>p});var r=n(3605),o=n(886),a=n(9732);const s=require("lodash");var c=n.n(s);const i=500,l=c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/members?filter=${s}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),i),u=c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),i),d=c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1";e&&(c+=`/summits/${e}`),c+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${s}&expand=member,registration_request`,fetch((0,a.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),i),p=c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1",i=encodeURIComponent(`tag=@${t}`);c+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${i}&expand=tag,track_tag_group`:`/tags?filter=${i}`,c+=`&order=tag&page=1&per_page=50&access_token=${s}`,fetch((0,a.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((t=>{let r=[...t.data];e&&(r=r.map((e=>e.tag))),n(r)})).catch(r.fetchErrorHandler)}),i),h=(c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${c}&order=name&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),i),c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();let c=(t=(0,r.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),i),c().debounce((async(e,t,n=!1,s)=>{const c=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let i=`/api/v1/summits/${e}/events`+(n?"/published":""),l=encodeURIComponent(`title=@${t}`);fetch((0,a.buildAPIBaseUrl)(`${i}?filter=${l}&order=title&access_token=${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(r.fetchErrorHandler)}),i),c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),i)),f=c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),i),g=c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`company_name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${c}&expand=company,sponsorship&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),i),m=c().debounce(((e,t,n)=>{let s=(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),i),w=c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),i),k=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/languages"),{signal:t}).then(r.fetchResponseHandler).then((t=>{e(t.data)})).catch(r.fetchErrorHandler),y=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/countries"),{signal:t}).then(r.fetchResponseHandler).then((t=>{e(t.data)})).catch(r.fetchErrorHandler)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},4824:e=>{e.exports=require("superagent")},6530:e=>{e.exports=require("urijs")},6113:e=>{e.exports=require("crypto")}};var t=require("../../runtime.js");t.C(e);t.X(0,[5344],(()=>(e=>t(t.s=e))(2712)))})()}));
1
+ "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{var e={id:6082,ids:[6082,3737,7634,3451,4823,1813,1149]};e.modules={2712:(e,t,n)=>{n.r(t),n.d(t,{default:()=>u});var o=n(6689),r=n.n(o),a=n(9953),s=n.n(a),c=n(7525);const l=["value","onChange","id","multi"];function i(){return i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},i.apply(this,arguments)}function d(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}class u extends r().Component{constructor(e){super(e),this.handleChange=this.handleChange.bind(this),this.getGroups=this.getGroups.bind(this)}handleChange(e){let t={target:{id:this.props.id,value:e,type:"groupinput"}};this.props.onChange(t)}getGroups(e,t){if(!e)return Promise.resolve({options:[]});(0,c.queryGroups)(e,t)}render(){let e=this.props,{value:t,onChange:n,id:o,multi:a}=e,c=d(e,l),u=this.props.hasOwnProperty("multi");return r().createElement(s(),i({value:t,onChange:this.handleChange,loadOptions:this.getGroups,getOptionValue:e=>e.id,getOptionLabel:e=>e.title,isMulti:u},c))}}},4341:(e,t,n)=>{n.d(t,{SET_LOGGED_USER:()=>o});n(4656),n(3605),n(9732),n(886);const o="SET_LOGGED_USER"},886:(e,t,n)=>{n.r(t),n.d(t,{ACCESS_TOKEN_SKEW_TIME:()=>w,RESPONSE_TYPE_CODE:()=>y,RESPONSE_TYPE_IMPLICIT:()=>_,clearAccessToken:()=>T,clearAuthInfo:()=>H,doLogin:()=>E,doLoginBasicLogin:()=>O,emitAccessToken:()=>$,getAccessToken:()=>v,getAuthInfo:()=>P,getAuthUrl:()=>I,getIdToken:()=>x,getLogoutUrl:()=>A,getOAuth2ClientId:()=>q,getOAuth2Flow:()=>B,getOAuth2IDPBaseUrl:()=>j,getOAuth2Scopes:()=>N,initLogOut:()=>G,passwordlessLogin:()=>M,passwordlessStart:()=>D,refreshAccessToken:()=>C,storeAuthInfo:()=>L,useOAuth2RefreshToken:()=>F,validateIdToken:()=>V});var o=n(9732),r=n(4824),a=n.n(r),s=n(6113);const c=require("browser-tabs-lock");var l=n.n(c),i=n(6530),d=n.n(i),u=n(3856),p=n.n(u),h=n(4341);let f=a();const g=new(l()),m="openstackuicore.lock.getTokenSilently",w=20,_="token id_token",y="code",k="authInfo",R="nonce",b="pkce",I=(e=null,t=null,n=null,r=null)=>{let a=q(),s=(0,o.getAuthCallback)(),c=j(),l=N(),i=B();null!=e&&(s+=`?BackUrl=${encodeURI(e)}`);let u=S(16);(0,o.putOnLocalStorage)(R,u);let p=d()(`${c}/oauth2/auth`),h={response_type:encodeURI(i),scope:encodeURI(l),nonce:u,response_mode:"fragment",client_id:encodeURI(a),redirect_uri:encodeURI(s)};if(i===y){const e=U();(0,o.putOnLocalStorage)(b,JSON.stringify(e)),h.code_challenge=e.codeChallenge,h.code_challenge_method="S256",h.approval_prompt="force"}return t&&(h.prompt=t),n&&(h.id_token_hint=n),r&&(h.provider=r),p=p.query(h),p},A=e=>{let t=j(),n=q(),r=d()(`${t}/oauth2/end-session`),a=S(16),s=(0,o.getOrigin)()+"/auth/logout";return(0,o.putOnLocalStorage)("post_logout_state",a),r.query({id_token_hint:e,post_logout_redirect_uri:encodeURI(s),client_id:encodeURI(n),state:a})},S=e=>{let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n="";for(let o=0;o<e;o++)n+=t.charAt(Math.floor(Math.random()*t.length));return n},E=(e=null,t=null,n=null)=>{let r=I(e,n,null,t);(0,o.getCurrentLocation)().replace(r.toString())},O=(e=null)=>{E(e,null,null)},U=()=>{const e=(0,o.base64URLEncode)((0,s.randomBytes)(64));return{codeVerifier:e,codeChallenge:(0,o.base64URLEncode)((0,o.sha256)(Buffer.from(e))),createdAt:new Date}},$=async(e,t=null)=>{let n=j(),r=q(),a=(0,o.getAuthCallback)(),s=JSON.parse((0,o.getFromLocalStorage)(b,!0));null!=t&&(a+=`?BackUrl=${encodeURI(t)}`);const c={code:e,grant_type:"authorization_code",code_verifier:s.codeVerifier,client_id:encodeURI(r),redirect_uri:encodeURI(a)};try{const e=await fetch(`${n}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(c)}).catch((function(e){console.log("Request failed:",e.message)})),t=await e.json();let{access_token:o,refresh_token:r,id_token:a,expires_in:s,error:l,error_description:i}=t;return{access_token:o,refresh_token:r,id_token:a,expires_in:s,error:l,error_description:i}}catch(e){console.log(e)}},T=async()=>{if(await(0,o.retryPromise)((()=>g.acquireLock(m,5e3)),10))try{let e=P();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:o,refreshToken:r}=e;L(null,0,r)}finally{await g.releaseLock(m)}},v=async()=>{if(await(0,o.retryPromise)((()=>g.acquireLock(m,5e3)),10))try{let e=P();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:o,refreshToken:r}=e,a=B(),s=Math.floor(Date.now()/1e3);if(n-=w,s-o>n||null==t){if(console.log("getAccessToken access token expired"),a===y&&F()){if(!r)throw H(),Error("missing Refresh Token");let e=await C(r),{access_token:t,expires_in:n,refresh_token:o}=e;return void 0===o&&(o=null),L(t,n,o),t}throw H(),Error("Access Token Expired.")}return t}finally{await g.releaseLock(m)}throw Error("Lock acquire error.")},C=async e=>{let t=j(),n=q();const r={grant_type:"refresh_token",client_id:encodeURI(n),refresh_token:e};try{const e=await fetch(`${t}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(r)}).then((e=>{if(400===e.status){(0,o.getCurrentPathName)();throw(0,o.setSessionClearingState)(!0),Error(`${e.status} - ${e.statusText}`)}return e})).catch((function(e){throw Error(`Request failed: ${e.message}`)})),n=await e.json();let{access_token:a,refresh_token:s,expires_in:c}=n;return{access_token:a,refresh_token:s,expires_in:c}}catch(e){throw console.log(e),e}},L=(e,t,n=null,r=null)=>{let a=P(),s={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===n&&a&&(n=a.refreshToken),null===r&&a&&(r=a.idToken),n&&(s.refreshToken=n),r&&(s.idToken=r),(0,o.putOnLocalStorage)(k,JSON.stringify(s))},P=()=>{let e=(0,o.getFromLocalStorage)(k,!1);return null===e?null:JSON.parse(e)},H=()=>{if("undefined"!=typeof window)return(0,o.removeFromLocalStorage)(k),(0,o.removeFromLocalStorage)(R),void(0,o.removeFromLocalStorage)(b)},x=()=>{if("undefined"!=typeof window){const e=P();return e?e.idToken:null}return null},q=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,B=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",F=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),j=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null,N=()=>"undefined"!=typeof window?window.SCOPES:null,G=()=>{(0,o.getCurrentLocation)().replace(A(x()).toString())},V=(e,t,n)=>{let r=new(p())({issuer:t,audience:n}),a=(0,o.getFromLocalStorage)(R,!0),s=r.decode(e),c=(s.header.alg,s.header.kid,s.payload.aud),l=s.payload.iss;s.payload.exp,s.payload.nbf;return(s.payload.nonce||null)==a&&c==n&&l==t},D=e=>{let t=q(),n=N(),r=S(16);(0,o.putOnLocalStorage)(R,r);let a=j(),s=d()(`${a}/oauth2/auth`),c={response_type:"otp",scope:encodeURI(n),nonce:r,client_id:encodeURI(t),connection:e.connection||"email",send:e.send||"code"};return e.hasOwnProperty("email")&&(c.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(c.phone_number=encodeURIComponent(e.phone_number)),f.post(s.toString()).send(c).then((e=>{let t=e.body;return Promise.resolve({response:t})})).catch((e=>Promise.reject(e)))},M=e=>t=>{let n=q(),o=N(),r=j(),a=d()(`${r}/oauth2/token`);if(!e.hasOwnProperty("otp"))throw Error("otp param is mandatory.");let s={grant_type:"passwordless",connection:e.connection||"email",scope:encodeURI(o),client_id:encodeURI(n),otp:e.otp};return e.hasOwnProperty("email")&&(s.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(s.phone_number=encodeURIComponent(e.phone_number)),f.post(a.toString()).send(s).then((e=>{try{let o=e.body,{access_token:a,expires_in:s,refresh_token:c,id_token:l}=o;if(void 0===c&&(c=null),void 0===l&&(l=null),l&&!V(l,r,n))throw Error("id token is not valid.");return L(a,s,c,l),t&&t({type:h.SET_LOGGED_USER,payload:{sessionState:null}}),Promise.resolve({response:o})}catch(e){return console.log(e),Promise.reject(e)}})).catch((e=>Promise.reject(e)))}},3605:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>l,fetchResponseHandler:()=>i});n(4824),n(6530);const o=require("sweetalert2");var r=n.n(o),a=n(4656),s=n.n(a);n(9732),n(4341),n(886);const c=e=>t=>({type:e,payload:t}),l=(c("RESET_LOADING"),c("START_LOADING"),c("STOP_LOADING"),e=>{let t=e.status,n=e.statusText;switch(t){case 403:r().fire("ERROR",s().translate("errors.user_not_authz"),"warning");break;case 401:r().fire("ERROR",s().translate("errors.session_expired"),"error");break;case 412:r().fire("ERROR",n,"warning");case 500:r().fire("ERROR",s().translate("errors.server_error"),"error")}}),i=e=>{if(e.ok)return e.json();throw e},d=e=>e=(e=e.replace(/,/g,"\\,")).replace(/;/g,"\\;")},9732:(e,t,n)=>{n.d(t,{arraysEqual:()=>f,base64URLEncode:()=>g,buildAPIBaseUrl:()=>l,getAuthCallback:()=>r,getCurrentLocation:()=>a,getCurrentPathName:()=>c,getFromLocalStorage:()=>d,getOrigin:()=>s,putOnLocalStorage:()=>i,removeFromLocalStorage:()=>u,retryPromise:()=>w,setSessionClearingState:()=>p,sha256:()=>m,shallowEqual:()=>h});require("moment-timezone");n(6530);var o=n(6113);const r=()=>"undefined"!=typeof window?`${window.location.origin}/auth/callback`:null,a=()=>{let e="";return"undefined"!=typeof window&&(e=window.location,window.top&&(e=window.top.location)),e},s=()=>"undefined"!=typeof window?window.location.origin:null,c=()=>"undefined"!=typeof window?window.location.pathname:null,l=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,i=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},d=(e,t)=>{if("undefined"!=typeof window){let n=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),u(e)),n}return null},u=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},p=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},h=(e,t)=>{const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(let o of n)if(e[o]!==t[o])return!1;return!0},f=(e,t)=>e.length===t.length&&e.every(((e,n)=>h(e,t[n]))),g=e=>e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),m=e=>(0,o.createHash)("sha256").update(e).digest(),w=async(e,t=3)=>{for(let n=0;n<t;n++)if(await e())return!0;return!1}},7525:(e,t,n)=>{n.d(t,{getCountryList:()=>y,getLanguageList:()=>_,queryAccessLevels:()=>m,queryCompanies:()=>f,queryGroups:()=>h,queryMembers:()=>i,queryOrganizations:()=>w,querySpeakers:()=>u,querySponsors:()=>g,querySummits:()=>d,queryTags:()=>p});var o=n(3605),r=n(886),a=n(9732);const s=require("lodash");var c=n.n(s);const l=500,i=c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/members?filter=${s}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l),d=c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l),u=c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c="/api/v1";e&&(c+=`/summits/${e}`),c+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${s}&expand=member,registration_request`,fetch((0,a.buildAPIBaseUrl)(c)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),p=c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c="/api/v1",l=encodeURIComponent(`tag=@${t}`);c+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${l}&expand=tag,track_tag_group`:`/tags?filter=${l}`,c+=`&order=tag&page=1&per_page=50&access_token=${s}`,fetch((0,a.buildAPIBaseUrl)(c)).then(o.fetchResponseHandler).then((t=>{let o=[...t.data];e&&(o=o.map((e=>e.tag))),n(o)})).catch(o.fetchErrorHandler)}),l),h=(c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${c}&order=name&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();let c=(t=(0,o.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${c}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),c().debounce((async(e,t,n=!1,s)=>{const c=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let l=`/api/v1/summits/${e}/events`+(n?"/published":""),i=encodeURIComponent(`title=@${t}`);fetch((0,a.buildAPIBaseUrl)(`${l}?filter=${i}&order=title&access_token=${c}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(o.fetchErrorHandler)}),l),c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l)),f=c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l),g=c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c=encodeURIComponent(`company_name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${c}&expand=company,sponsorship&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),m=c().debounce(((e,t,n)=>{let s=(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${c}&&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),w=c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l),_=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/languages"),{signal:t}).then(o.fetchResponseHandler).then((t=>{e(t.data)})).catch(o.fetchErrorHandler),y=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/countries"),{signal:t}).then(o.fetchResponseHandler).then((t=>{e(t.data)})).catch(o.fetchErrorHandler)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},4824:e=>{e.exports=require("superagent")},6530:e=>{e.exports=require("urijs")},6113:e=>{e.exports=require("crypto")}};var t=require("../../runtime.js");t.C(e);t.X(0,[5344],(()=>(e=>t(t.s=e))(2712)))})()}));
@@ -1 +1 @@
1
- "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{var e={id:7178,ids:[7178,3737,3451,4823,1813,1149]};e.modules={9900:(e,t,n)=>{n.r(t),n.d(t,{default:()=>u});var r=n(6689),o=n.n(r),a=n(1929),s=n.n(a),c=n(7525);const l=["value","onChange","id","multi"];function i(){return i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i.apply(this,arguments)}function d(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}class u extends o().Component{constructor(e){super(e),this.state={options:[],shouldUseId:!!e.hasOwnProperty("shouldUseId")&&e.shouldUseId},this.handleChange=this.handleChange.bind(this),this.setOptions=this.setOptions.bind(this),this.abortController=new AbortController,(0,c.getLanguageList)(this.setOptions,this.abortController.signal)}componentWillUnmount(){this.abortController.abort()}setOptions(e){let t=this.state.shouldUseId?e.map((e=>({label:e.name,value:e.id}))):e.map((e=>({label:e.name,value:e.iso_code})));this.setState({options:t})}handleChange(e){let t=null;t=this.props.hasOwnProperty("multi")?e.map((e=>e.value)):e.value;let n={target:{id:this.props.id,value:t,type:"laguageinput"}};this.props.onChange(n)}render(){let e=this.props,{value:t,onChange:n,id:r,multi:a}=e,c=d(e,l),{options:u}=this.state,p=this.props.hasOwnProperty("multi"),h=null;return h=p?u.filter((e=>t.includes(e.value))):t instanceof Object||null==t?t:u.find((e=>e.value==t)),o().createElement(s(),i({className:"dropdown",onChange:this.handleChange,options:u,value:h,isMulti:p},c))}}},4341:(e,t,n)=>{n(4656),n(3605),n(9732),n(886)},886:(e,t,n)=>{n.d(t,{getAccessToken:()=>p});var r=n(9732);n(4824),n(6113);const o=require("browser-tabs-lock");var a=n.n(o);n(6530),n(3856),n(4341);const s=new(a()),c="openstackuicore.lock.getTokenSilently",l="code",i="authInfo",d="nonce",u="pkce",p=async()=>{if(await(0,r.retryPromise)((()=>s.acquireLock(c,5e3)),10))try{let e=m();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:r,refreshToken:o}=e,a=k(),i=Math.floor(Date.now()/1e3);if(n-=20,i-r>n||null==t){if(console.log("getAccessToken access token expired"),a===l&&y()){if(!o)throw g(),Error("missing Refresh Token");let e=await h(o),{access_token:t,expires_in:n,refresh_token:r}=e;return void 0===r&&(r=null),f(t,n,r),t}throw g(),Error("Access Token Expired.")}return t}finally{await s.releaseLock(c)}throw Error("Lock acquire error.")},h=async e=>{let t=b(),n=w();const o={grant_type:"refresh_token",client_id:encodeURI(n),refresh_token:e};try{const e=await fetch(`${t}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(o)}).then((e=>{if(400===e.status){(0,r.getCurrentPathName)();throw(0,r.setSessionClearingState)(!0),Error(`${e.status} - ${e.statusText}`)}return e})).catch((function(e){throw Error(`Request failed: ${e.message}`)})),n=await e.json();let{access_token:a,refresh_token:s,expires_in:c}=n;return{access_token:a,refresh_token:s,expires_in:c}}catch(e){throw console.log(e),e}},f=(e,t,n=null,o=null)=>{let a=m(),s={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===n&&a&&(n=a.refreshToken),null===o&&a&&(o=a.idToken),n&&(s.refreshToken=n),o&&(s.idToken=o),(0,r.putOnLocalStorage)(i,JSON.stringify(s))},m=()=>{let e=(0,r.getFromLocalStorage)(i,!1);return null===e?null:JSON.parse(e)},g=()=>{if("undefined"!=typeof window)return(0,r.removeFromLocalStorage)(i),(0,r.removeFromLocalStorage)(d),void(0,r.removeFromLocalStorage)(u)},w=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,k=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",y=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),b=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null},3605:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>l,fetchResponseHandler:()=>i});n(4824),n(6530);const r=require("sweetalert2");var o=n.n(r),a=n(4656),s=n.n(a);n(9732),n(4341),n(886);const c=e=>t=>({type:e,payload:t}),l=(c("RESET_LOADING"),c("START_LOADING"),c("STOP_LOADING"),e=>{let t=e.status,n=e.statusText;switch(t){case 403:o().fire("ERROR",s().translate("errors.user_not_authz"),"warning");break;case 401:o().fire("ERROR",s().translate("errors.session_expired"),"error");break;case 412:o().fire("ERROR",n,"warning");case 500:o().fire("ERROR",s().translate("errors.server_error"),"error")}}),i=e=>{if(e.ok)return e.json();throw e},d=e=>e=(e=e.replace(/,/g,"\\,")).replace(/;/g,"\\;")},9732:(e,t,n)=>{n.d(t,{arraysEqual:()=>d,buildAPIBaseUrl:()=>o,getCurrentPathName:()=>r,getFromLocalStorage:()=>s,putOnLocalStorage:()=>a,removeFromLocalStorage:()=>c,retryPromise:()=>u,setSessionClearingState:()=>l,shallowEqual:()=>i});require("moment-timezone");n(6530),n(6113);const r=()=>"undefined"!=typeof window?window.location.pathname:null,o=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,a=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},s=(e,t)=>{if("undefined"!=typeof window){let n=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),c(e)),n}return null},c=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},l=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},i=(e,t)=>{const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0},d=(e,t)=>e.length===t.length&&e.every(((e,n)=>i(e,t[n]))),u=async(e,t=3)=>{for(let n=0;n<t;n++)if(await e())return!0;return!1}},7525:(e,t,n)=>{n.d(t,{getCountryList:()=>y,getLanguageList:()=>k,queryAccessLevels:()=>g,queryCompanies:()=>f,queryGroups:()=>h,queryMembers:()=>i,queryOrganizations:()=>w,querySpeakers:()=>u,querySponsors:()=>m,querySummits:()=>d,queryTags:()=>p});var r=n(3605),o=n(886),a=n(9732);const s=require("lodash");var c=n.n(s);const l=500,i=c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/members?filter=${s}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),l),d=c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),l),u=c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1";e&&(c+=`/summits/${e}`),c+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${s}&expand=member,registration_request`,fetch((0,a.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),l),p=c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1",l=encodeURIComponent(`tag=@${t}`);c+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${l}&expand=tag,track_tag_group`:`/tags?filter=${l}`,c+=`&order=tag&page=1&per_page=50&access_token=${s}`,fetch((0,a.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((t=>{let r=[...t.data];e&&(r=r.map((e=>e.tag))),n(r)})).catch(r.fetchErrorHandler)}),l),h=(c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${c}&order=name&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),l),c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();let c=(t=(0,r.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),l),c().debounce((async(e,t,n=!1,s)=>{const c=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let l=`/api/v1/summits/${e}/events`+(n?"/published":""),i=encodeURIComponent(`title=@${t}`);fetch((0,a.buildAPIBaseUrl)(`${l}?filter=${i}&order=title&access_token=${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(r.fetchErrorHandler)}),l),c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),l)),f=c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),l),m=c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`company_name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${c}&expand=company,sponsorship&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),l),g=c().debounce(((e,t,n)=>{let s=(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),l),w=c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),l),k=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/languages"),{signal:t}).then(r.fetchResponseHandler).then((t=>{e(t.data)})).catch(r.fetchErrorHandler),y=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/countries"),{signal:t}).then(r.fetchResponseHandler).then((t=>{e(t.data)})).catch(r.fetchErrorHandler)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},6689:e=>{e.exports=require("react")},4824:e=>{e.exports=require("superagent")},6530:e=>{e.exports=require("urijs")},6113:e=>{e.exports=require("crypto")}};var t=require("../../runtime.js");t.C(e);t.X(0,[5344],(()=>(e=>t(t.s=e))(9900)))})()}));
1
+ "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{var e={id:7178,ids:[7178,3737,7634,3451,4823,1813,1149]};e.modules={9900:(e,t,n)=>{n.r(t),n.d(t,{default:()=>u});var o=n(6689),r=n.n(o),a=n(1929),s=n.n(a),l=n(7525);const c=["value","onChange","id","multi"];function i(){return i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},i.apply(this,arguments)}function d(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}class u extends r().Component{constructor(e){super(e),this.state={options:[],shouldUseId:!!e.hasOwnProperty("shouldUseId")&&e.shouldUseId},this.handleChange=this.handleChange.bind(this),this.setOptions=this.setOptions.bind(this),this.abortController=new AbortController,(0,l.getLanguageList)(this.setOptions,this.abortController.signal)}componentWillUnmount(){this.abortController.abort()}setOptions(e){let t=this.state.shouldUseId?e.map((e=>({label:e.name,value:e.id}))):e.map((e=>({label:e.name,value:e.iso_code})));this.setState({options:t})}handleChange(e){let t=null;t=this.props.hasOwnProperty("multi")?e.map((e=>e.value)):e.value;let n={target:{id:this.props.id,value:t,type:"laguageinput"}};this.props.onChange(n)}render(){let e=this.props,{value:t,onChange:n,id:o,multi:a}=e,l=d(e,c),{options:u}=this.state,p=this.props.hasOwnProperty("multi"),h=null;return h=p?u.filter((e=>t.includes(e.value))):t instanceof Object||null==t?t:u.find((e=>e.value==t)),r().createElement(s(),i({className:"dropdown",onChange:this.handleChange,options:u,value:h,isMulti:p},l))}}},4341:(e,t,n)=>{n.d(t,{SET_LOGGED_USER:()=>o});n(4656),n(3605),n(9732),n(886);const o="SET_LOGGED_USER"},886:(e,t,n)=>{n.r(t),n.d(t,{ACCESS_TOKEN_SKEW_TIME:()=>w,RESPONSE_TYPE_CODE:()=>y,RESPONSE_TYPE_IMPLICIT:()=>_,clearAccessToken:()=>v,clearAuthInfo:()=>H,doLogin:()=>S,doLoginBasicLogin:()=>A,emitAccessToken:()=>$,getAccessToken:()=>T,getAuthInfo:()=>P,getAuthUrl:()=>R,getIdToken:()=>x,getLogoutUrl:()=>U,getOAuth2ClientId:()=>q,getOAuth2Flow:()=>j,getOAuth2IDPBaseUrl:()=>F,getOAuth2Scopes:()=>N,initLogOut:()=>V,passwordlessLogin:()=>M,passwordlessStart:()=>G,refreshAccessToken:()=>C,storeAuthInfo:()=>L,useOAuth2RefreshToken:()=>B,validateIdToken:()=>D});var o=n(9732),r=n(4824),a=n.n(r),s=n(6113);const l=require("browser-tabs-lock");var c=n.n(l),i=n(6530),d=n.n(i),u=n(3856),p=n.n(u),h=n(4341);let f=a();const g=new(c()),m="openstackuicore.lock.getTokenSilently",w=20,_="token id_token",y="code",k="authInfo",b="nonce",I="pkce",R=(e=null,t=null,n=null,r=null)=>{let a=q(),s=(0,o.getAuthCallback)(),l=F(),c=N(),i=j();null!=e&&(s+=`?BackUrl=${encodeURI(e)}`);let u=O(16);(0,o.putOnLocalStorage)(b,u);let p=d()(`${l}/oauth2/auth`),h={response_type:encodeURI(i),scope:encodeURI(c),nonce:u,response_mode:"fragment",client_id:encodeURI(a),redirect_uri:encodeURI(s)};if(i===y){const e=E();(0,o.putOnLocalStorage)(I,JSON.stringify(e)),h.code_challenge=e.codeChallenge,h.code_challenge_method="S256",h.approval_prompt="force"}return t&&(h.prompt=t),n&&(h.id_token_hint=n),r&&(h.provider=r),p=p.query(h),p},U=e=>{let t=F(),n=q(),r=d()(`${t}/oauth2/end-session`),a=O(16),s=(0,o.getOrigin)()+"/auth/logout";return(0,o.putOnLocalStorage)("post_logout_state",a),r.query({id_token_hint:e,post_logout_redirect_uri:encodeURI(s),client_id:encodeURI(n),state:a})},O=e=>{let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n="";for(let o=0;o<e;o++)n+=t.charAt(Math.floor(Math.random()*t.length));return n},S=(e=null,t=null,n=null)=>{let r=R(e,n,null,t);(0,o.getCurrentLocation)().replace(r.toString())},A=(e=null)=>{S(e,null,null)},E=()=>{const e=(0,o.base64URLEncode)((0,s.randomBytes)(64));return{codeVerifier:e,codeChallenge:(0,o.base64URLEncode)((0,o.sha256)(Buffer.from(e))),createdAt:new Date}},$=async(e,t=null)=>{let n=F(),r=q(),a=(0,o.getAuthCallback)(),s=JSON.parse((0,o.getFromLocalStorage)(I,!0));null!=t&&(a+=`?BackUrl=${encodeURI(t)}`);const l={code:e,grant_type:"authorization_code",code_verifier:s.codeVerifier,client_id:encodeURI(r),redirect_uri:encodeURI(a)};try{const e=await fetch(`${n}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(l)}).catch((function(e){console.log("Request failed:",e.message)})),t=await e.json();let{access_token:o,refresh_token:r,id_token:a,expires_in:s,error:c,error_description:i}=t;return{access_token:o,refresh_token:r,id_token:a,expires_in:s,error:c,error_description:i}}catch(e){console.log(e)}},v=async()=>{if(await(0,o.retryPromise)((()=>g.acquireLock(m,5e3)),10))try{let e=P();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:o,refreshToken:r}=e;L(null,0,r)}finally{await g.releaseLock(m)}},T=async()=>{if(await(0,o.retryPromise)((()=>g.acquireLock(m,5e3)),10))try{let e=P();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:o,refreshToken:r}=e,a=j(),s=Math.floor(Date.now()/1e3);if(n-=w,s-o>n||null==t){if(console.log("getAccessToken access token expired"),a===y&&B()){if(!r)throw H(),Error("missing Refresh Token");let e=await C(r),{access_token:t,expires_in:n,refresh_token:o}=e;return void 0===o&&(o=null),L(t,n,o),t}throw H(),Error("Access Token Expired.")}return t}finally{await g.releaseLock(m)}throw Error("Lock acquire error.")},C=async e=>{let t=F(),n=q();const r={grant_type:"refresh_token",client_id:encodeURI(n),refresh_token:e};try{const e=await fetch(`${t}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(r)}).then((e=>{if(400===e.status){(0,o.getCurrentPathName)();throw(0,o.setSessionClearingState)(!0),Error(`${e.status} - ${e.statusText}`)}return e})).catch((function(e){throw Error(`Request failed: ${e.message}`)})),n=await e.json();let{access_token:a,refresh_token:s,expires_in:l}=n;return{access_token:a,refresh_token:s,expires_in:l}}catch(e){throw console.log(e),e}},L=(e,t,n=null,r=null)=>{let a=P(),s={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===n&&a&&(n=a.refreshToken),null===r&&a&&(r=a.idToken),n&&(s.refreshToken=n),r&&(s.idToken=r),(0,o.putOnLocalStorage)(k,JSON.stringify(s))},P=()=>{let e=(0,o.getFromLocalStorage)(k,!1);return null===e?null:JSON.parse(e)},H=()=>{if("undefined"!=typeof window)return(0,o.removeFromLocalStorage)(k),(0,o.removeFromLocalStorage)(b),void(0,o.removeFromLocalStorage)(I)},x=()=>{if("undefined"!=typeof window){const e=P();return e?e.idToken:null}return null},q=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,j=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",B=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),F=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null,N=()=>"undefined"!=typeof window?window.SCOPES:null,V=()=>{(0,o.getCurrentLocation)().replace(U(x()).toString())},D=(e,t,n)=>{let r=new(p())({issuer:t,audience:n}),a=(0,o.getFromLocalStorage)(b,!0),s=r.decode(e),l=(s.header.alg,s.header.kid,s.payload.aud),c=s.payload.iss;s.payload.exp,s.payload.nbf;return(s.payload.nonce||null)==a&&l==n&&c==t},G=e=>{let t=q(),n=N(),r=O(16);(0,o.putOnLocalStorage)(b,r);let a=F(),s=d()(`${a}/oauth2/auth`),l={response_type:"otp",scope:encodeURI(n),nonce:r,client_id:encodeURI(t),connection:e.connection||"email",send:e.send||"code"};return e.hasOwnProperty("email")&&(l.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(l.phone_number=encodeURIComponent(e.phone_number)),f.post(s.toString()).send(l).then((e=>{let t=e.body;return Promise.resolve({response:t})})).catch((e=>Promise.reject(e)))},M=e=>t=>{let n=q(),o=N(),r=F(),a=d()(`${r}/oauth2/token`);if(!e.hasOwnProperty("otp"))throw Error("otp param is mandatory.");let s={grant_type:"passwordless",connection:e.connection||"email",scope:encodeURI(o),client_id:encodeURI(n),otp:e.otp};return e.hasOwnProperty("email")&&(s.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(s.phone_number=encodeURIComponent(e.phone_number)),f.post(a.toString()).send(s).then((e=>{try{let o=e.body,{access_token:a,expires_in:s,refresh_token:l,id_token:c}=o;if(void 0===l&&(l=null),void 0===c&&(c=null),c&&!D(c,r,n))throw Error("id token is not valid.");return L(a,s,l,c),t&&t({type:h.SET_LOGGED_USER,payload:{sessionState:null}}),Promise.resolve({response:o})}catch(e){return console.log(e),Promise.reject(e)}})).catch((e=>Promise.reject(e)))}},3605:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>c,fetchResponseHandler:()=>i});n(4824),n(6530);const o=require("sweetalert2");var r=n.n(o),a=n(4656),s=n.n(a);n(9732),n(4341),n(886);const l=e=>t=>({type:e,payload:t}),c=(l("RESET_LOADING"),l("START_LOADING"),l("STOP_LOADING"),e=>{let t=e.status,n=e.statusText;switch(t){case 403:r().fire("ERROR",s().translate("errors.user_not_authz"),"warning");break;case 401:r().fire("ERROR",s().translate("errors.session_expired"),"error");break;case 412:r().fire("ERROR",n,"warning");case 500:r().fire("ERROR",s().translate("errors.server_error"),"error")}}),i=e=>{if(e.ok)return e.json();throw e},d=e=>e=(e=e.replace(/,/g,"\\,")).replace(/;/g,"\\;")},9732:(e,t,n)=>{n.d(t,{arraysEqual:()=>f,base64URLEncode:()=>g,buildAPIBaseUrl:()=>c,getAuthCallback:()=>r,getCurrentLocation:()=>a,getCurrentPathName:()=>l,getFromLocalStorage:()=>d,getOrigin:()=>s,putOnLocalStorage:()=>i,removeFromLocalStorage:()=>u,retryPromise:()=>w,setSessionClearingState:()=>p,sha256:()=>m,shallowEqual:()=>h});require("moment-timezone");n(6530);var o=n(6113);const r=()=>"undefined"!=typeof window?`${window.location.origin}/auth/callback`:null,a=()=>{let e="";return"undefined"!=typeof window&&(e=window.location,window.top&&(e=window.top.location)),e},s=()=>"undefined"!=typeof window?window.location.origin:null,l=()=>"undefined"!=typeof window?window.location.pathname:null,c=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,i=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},d=(e,t)=>{if("undefined"!=typeof window){let n=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),u(e)),n}return null},u=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},p=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},h=(e,t)=>{const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(let o of n)if(e[o]!==t[o])return!1;return!0},f=(e,t)=>e.length===t.length&&e.every(((e,n)=>h(e,t[n]))),g=e=>e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),m=e=>(0,o.createHash)("sha256").update(e).digest(),w=async(e,t=3)=>{for(let n=0;n<t;n++)if(await e())return!0;return!1}},7525:(e,t,n)=>{n.d(t,{getCountryList:()=>y,getLanguageList:()=>_,queryAccessLevels:()=>m,queryCompanies:()=>f,queryGroups:()=>h,queryMembers:()=>i,queryOrganizations:()=>w,querySpeakers:()=>u,querySponsors:()=>g,querySummits:()=>d,queryTags:()=>p});var o=n(3605),r=n(886),a=n(9732);const s=require("lodash");var l=n.n(s);const c=500,i=l().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/members?filter=${s}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),c),d=l().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),c),u=l().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let l="/api/v1";e&&(l+=`/summits/${e}`),l+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${s}&expand=member,registration_request`,fetch((0,a.buildAPIBaseUrl)(l)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),c),p=l().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let l="/api/v1",c=encodeURIComponent(`tag=@${t}`);l+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${c}&expand=tag,track_tag_group`:`/tags?filter=${c}`,l+=`&order=tag&page=1&per_page=50&access_token=${s}`,fetch((0,a.buildAPIBaseUrl)(l)).then(o.fetchResponseHandler).then((t=>{let o=[...t.data];e&&(o=o.map((e=>e.tag))),n(o)})).catch(o.fetchErrorHandler)}),c),h=(l().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let l=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${l}&order=name&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),c),l().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();let l=(t=(0,o.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${l}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),c),l().debounce((async(e,t,n=!1,s)=>{const l=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c=`/api/v1/summits/${e}/events`+(n?"/published":""),i=encodeURIComponent(`title=@${t}`);fetch((0,a.buildAPIBaseUrl)(`${c}?filter=${i}&order=title&access_token=${l}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(o.fetchErrorHandler)}),c),l().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),c)),f=l().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),c),g=l().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let l=encodeURIComponent(`company_name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${l}&expand=company,sponsorship&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),c),m=l().debounce(((e,t,n)=>{let s=(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let l=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${l}&&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),c),w=l().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),c),_=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/languages"),{signal:t}).then(o.fetchResponseHandler).then((t=>{e(t.data)})).catch(o.fetchErrorHandler),y=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/countries"),{signal:t}).then(o.fetchResponseHandler).then((t=>{e(t.data)})).catch(o.fetchErrorHandler)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},6689:e=>{e.exports=require("react")},4824:e=>{e.exports=require("superagent")},6530:e=>{e.exports=require("urijs")},6113:e=>{e.exports=require("crypto")}};var t=require("../../runtime.js");t.C(e);t.X(0,[5344],(()=>(e=>t(t.s=e))(9900)))})()}));
@@ -1 +1 @@
1
- "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{var e={id:6461,ids:[6461,3737,3451,4823,1813,1149]};e.modules={7744:(e,t,n)=>{n.r(t),n.d(t,{default:()=>d});var r=n(6689),a=n.n(r),o=n(9953),s=n.n(o),i=n(7525);const c=["value","error","onChange","id","multi"];function l(){return l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l.apply(this,arguments)}function u(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}class d extends a().Component{constructor(e){super(e),this.state={value:e.value},this.handleChange=this.handleChange.bind(this),this.getMembers=this.getMembers.bind(this),this.getOptionValue=this.getOptionValue.bind(this),this.getOptionLabel=this.getOptionLabel.bind(this)}getOptionValue(e){return this.props.hasOwnProperty("getOptionValue")?this.props.getOptionValue(e):e.id}getOptionLabel(e){return this.props.hasOwnProperty("getOptionLabel")?this.props.getOptionLabel(e):`${e.first_name} ${e.last_name} (${e.id})`}handleChange(e){let t={target:{id:this.props.id,value:e,type:"memberinput"}};this.props.onChange(t)}getMembers(e,t){if(!e)return Promise.resolve({options:[]});(0,i.queryMembers)(e,t)}render(){let e=this.props,{value:t,error:n,onChange:r,id:o,multi:i}=e,d=u(e,c),p=this.props.hasOwnProperty("multi"),h=this.props.hasOwnProperty("error")&&""!=n;return a().createElement("div",null,a().createElement(s(),l({value:t,onChange:this.handleChange,loadOptions:this.getMembers,getOptionValue:e=>this.getOptionValue(e),getOptionLabel:e=>this.getOptionLabel(e),isMulti:p},d)),h&&a().createElement("p",{className:"error-label"},n))}}},4341:(e,t,n)=>{n(4656),n(3605),n(9732),n(886)},886:(e,t,n)=>{n.d(t,{getAccessToken:()=>p});var r=n(9732);n(4824),n(6113);const a=require("browser-tabs-lock");var o=n.n(a);n(6530),n(3856),n(4341);const s=new(o()),i="openstackuicore.lock.getTokenSilently",c="code",l="authInfo",u="nonce",d="pkce",p=async()=>{if(await(0,r.retryPromise)((()=>s.acquireLock(i,5e3)),10))try{let e=g();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:r,refreshToken:a}=e,o=y(),l=Math.floor(Date.now()/1e3);if(n-=20,l-r>n||null==t){if(console.log("getAccessToken access token expired"),o===c&&k()){if(!a)throw m(),Error("missing Refresh Token");let e=await h(a),{access_token:t,expires_in:n,refresh_token:r}=e;return void 0===r&&(r=null),f(t,n,r),t}throw m(),Error("Access Token Expired.")}return t}finally{await s.releaseLock(i)}throw Error("Lock acquire error.")},h=async e=>{let t=b(),n=w();const a={grant_type:"refresh_token",client_id:encodeURI(n),refresh_token:e};try{const e=await fetch(`${t}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(a)}).then((e=>{if(400===e.status){(0,r.getCurrentPathName)();throw(0,r.setSessionClearingState)(!0),Error(`${e.status} - ${e.statusText}`)}return e})).catch((function(e){throw Error(`Request failed: ${e.message}`)})),n=await e.json();let{access_token:o,refresh_token:s,expires_in:i}=n;return{access_token:o,refresh_token:s,expires_in:i}}catch(e){throw console.log(e),e}},f=(e,t,n=null,a=null)=>{let o=g(),s={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===n&&o&&(n=o.refreshToken),null===a&&o&&(a=o.idToken),n&&(s.refreshToken=n),a&&(s.idToken=a),(0,r.putOnLocalStorage)(l,JSON.stringify(s))},g=()=>{let e=(0,r.getFromLocalStorage)(l,!1);return null===e?null:JSON.parse(e)},m=()=>{if("undefined"!=typeof window)return(0,r.removeFromLocalStorage)(l),(0,r.removeFromLocalStorage)(u),void(0,r.removeFromLocalStorage)(d)},w=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,y=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",k=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),b=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null},3605:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>u,fetchErrorHandler:()=>c,fetchResponseHandler:()=>l});n(4824),n(6530);const r=require("sweetalert2");var a=n.n(r),o=n(4656),s=n.n(o);n(9732),n(4341),n(886);const i=e=>t=>({type:e,payload:t}),c=(i("RESET_LOADING"),i("START_LOADING"),i("STOP_LOADING"),e=>{let t=e.status,n=e.statusText;switch(t){case 403:a().fire("ERROR",s().translate("errors.user_not_authz"),"warning");break;case 401:a().fire("ERROR",s().translate("errors.session_expired"),"error");break;case 412:a().fire("ERROR",n,"warning");case 500:a().fire("ERROR",s().translate("errors.server_error"),"error")}}),l=e=>{if(e.ok)return e.json();throw e},u=e=>e=(e=e.replace(/,/g,"\\,")).replace(/;/g,"\\;")},9732:(e,t,n)=>{n.d(t,{arraysEqual:()=>u,buildAPIBaseUrl:()=>a,getCurrentPathName:()=>r,getFromLocalStorage:()=>s,putOnLocalStorage:()=>o,removeFromLocalStorage:()=>i,retryPromise:()=>d,setSessionClearingState:()=>c,shallowEqual:()=>l});require("moment-timezone");n(6530),n(6113);const r=()=>"undefined"!=typeof window?window.location.pathname:null,a=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,o=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},s=(e,t)=>{if("undefined"!=typeof window){let n=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),i(e)),n}return null},i=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},c=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},l=(e,t)=>{const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0},u=(e,t)=>e.length===t.length&&e.every(((e,n)=>l(e,t[n]))),d=async(e,t=3)=>{for(let n=0;n<t;n++)if(await e())return!0;return!1}},7525:(e,t,n)=>{n.d(t,{getCountryList:()=>k,getLanguageList:()=>y,queryAccessLevels:()=>m,queryCompanies:()=>f,queryGroups:()=>h,queryMembers:()=>l,queryOrganizations:()=>w,querySpeakers:()=>d,querySponsors:()=>g,querySummits:()=>u,queryTags:()=>p});var r=n(3605),a=n(886),o=n(9732);const s=require("lodash");var i=n.n(s);const c=500,l=i().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/members?filter=${s}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),c),u=i().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),c),d=i().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let i="/api/v1";e&&(i+=`/summits/${e}`),i+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${s}&expand=member,registration_request`,fetch((0,o.buildAPIBaseUrl)(i)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),c),p=i().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let i="/api/v1",c=encodeURIComponent(`tag=@${t}`);i+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${c}&expand=tag,track_tag_group`:`/tags?filter=${c}`,i+=`&order=tag&page=1&per_page=50&access_token=${s}`,fetch((0,o.buildAPIBaseUrl)(i)).then(r.fetchResponseHandler).then((t=>{let r=[...t.data];e&&(r=r.map((e=>e.tag))),n(r)})).catch(r.fetchErrorHandler)}),c),h=(i().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let i=encodeURIComponent(`name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${i}&order=name&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),c),i().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();let i=(t=(0,r.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${i}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),c),i().debounce((async(e,t,n=!1,s)=>{const i=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=`/api/v1/summits/${e}/events`+(n?"/published":""),l=encodeURIComponent(`title=@${t}`);fetch((0,o.buildAPIBaseUrl)(`${c}?filter=${l}&order=title&access_token=${i}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(r.fetchErrorHandler)}),c),i().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),c)),f=i().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),c),g=i().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let i=encodeURIComponent(`company_name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${i}&expand=company,sponsorship&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),c),m=i().debounce(((e,t,n)=>{let s=(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let i=encodeURIComponent(`name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${i}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),c),w=i().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),c),y=(e,t)=>fetch((0,o.buildAPIBaseUrl)("/api/public/v1/languages"),{signal:t}).then(r.fetchResponseHandler).then((t=>{e(t.data)})).catch(r.fetchErrorHandler),k=(e,t)=>fetch((0,o.buildAPIBaseUrl)("/api/public/v1/countries"),{signal:t}).then(r.fetchResponseHandler).then((t=>{e(t.data)})).catch(r.fetchErrorHandler)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},4824:e=>{e.exports=require("superagent")},6530:e=>{e.exports=require("urijs")},6113:e=>{e.exports=require("crypto")}};var t=require("../../runtime.js");t.C(e);t.X(0,[5344],(()=>(e=>t(t.s=e))(7744)))})()}));
1
+ "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{var e={id:6461,ids:[6461,3737,7634,3451,4823,1813,1149]};e.modules={7744:(e,t,n)=>{n.r(t),n.d(t,{default:()=>u});var o=n(6689),r=n.n(o),a=n(9953),s=n.n(a),i=n(7525);const c=["value","error","onChange","id","multi"];function l(){return l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},l.apply(this,arguments)}function d(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}class u extends r().Component{constructor(e){super(e),this.state={value:e.value},this.handleChange=this.handleChange.bind(this),this.getMembers=this.getMembers.bind(this),this.getOptionValue=this.getOptionValue.bind(this),this.getOptionLabel=this.getOptionLabel.bind(this)}getOptionValue(e){return this.props.hasOwnProperty("getOptionValue")?this.props.getOptionValue(e):e.id}getOptionLabel(e){return this.props.hasOwnProperty("getOptionLabel")?this.props.getOptionLabel(e):`${e.first_name} ${e.last_name} (${e.id})`}handleChange(e){let t={target:{id:this.props.id,value:e,type:"memberinput"}};this.props.onChange(t)}getMembers(e,t){if(!e)return Promise.resolve({options:[]});(0,i.queryMembers)(e,t)}render(){let e=this.props,{value:t,error:n,onChange:o,id:a,multi:i}=e,u=d(e,c),p=this.props.hasOwnProperty("multi"),h=this.props.hasOwnProperty("error")&&""!=n;return r().createElement("div",null,r().createElement(s(),l({value:t,onChange:this.handleChange,loadOptions:this.getMembers,getOptionValue:e=>this.getOptionValue(e),getOptionLabel:e=>this.getOptionLabel(e),isMulti:p},u)),h&&r().createElement("p",{className:"error-label"},n))}}},4341:(e,t,n)=>{n.d(t,{SET_LOGGED_USER:()=>o});n(4656),n(3605),n(9732),n(886);const o="SET_LOGGED_USER"},886:(e,t,n)=>{n.r(t),n.d(t,{ACCESS_TOKEN_SKEW_TIME:()=>w,RESPONSE_TYPE_CODE:()=>y,RESPONSE_TYPE_IMPLICIT:()=>_,clearAccessToken:()=>v,clearAuthInfo:()=>H,doLogin:()=>E,doLoginBasicLogin:()=>A,emitAccessToken:()=>U,getAccessToken:()=>T,getAuthInfo:()=>C,getAuthUrl:()=>R,getIdToken:()=>x,getLogoutUrl:()=>I,getOAuth2ClientId:()=>q,getOAuth2Flow:()=>B,getOAuth2IDPBaseUrl:()=>j,getOAuth2Scopes:()=>V,initLogOut:()=>N,passwordlessLogin:()=>G,passwordlessStart:()=>D,refreshAccessToken:()=>L,storeAuthInfo:()=>P,useOAuth2RefreshToken:()=>F,validateIdToken:()=>M});var o=n(9732),r=n(4824),a=n.n(r),s=n(6113);const i=require("browser-tabs-lock");var c=n.n(i),l=n(6530),d=n.n(l),u=n(3856),p=n.n(u),h=n(4341);let f=a();const g=new(c()),m="openstackuicore.lock.getTokenSilently",w=20,_="token id_token",y="code",k="authInfo",b="nonce",O="pkce",R=(e=null,t=null,n=null,r=null)=>{let a=q(),s=(0,o.getAuthCallback)(),i=j(),c=V(),l=B();null!=e&&(s+=`?BackUrl=${encodeURI(e)}`);let u=$(16);(0,o.putOnLocalStorage)(b,u);let p=d()(`${i}/oauth2/auth`),h={response_type:encodeURI(l),scope:encodeURI(c),nonce:u,response_mode:"fragment",client_id:encodeURI(a),redirect_uri:encodeURI(s)};if(l===y){const e=S();(0,o.putOnLocalStorage)(O,JSON.stringify(e)),h.code_challenge=e.codeChallenge,h.code_challenge_method="S256",h.approval_prompt="force"}return t&&(h.prompt=t),n&&(h.id_token_hint=n),r&&(h.provider=r),p=p.query(h),p},I=e=>{let t=j(),n=q(),r=d()(`${t}/oauth2/end-session`),a=$(16),s=(0,o.getOrigin)()+"/auth/logout";return(0,o.putOnLocalStorage)("post_logout_state",a),r.query({id_token_hint:e,post_logout_redirect_uri:encodeURI(s),client_id:encodeURI(n),state:a})},$=e=>{let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n="";for(let o=0;o<e;o++)n+=t.charAt(Math.floor(Math.random()*t.length));return n},E=(e=null,t=null,n=null)=>{let r=R(e,n,null,t);(0,o.getCurrentLocation)().replace(r.toString())},A=(e=null)=>{E(e,null,null)},S=()=>{const e=(0,o.base64URLEncode)((0,s.randomBytes)(64));return{codeVerifier:e,codeChallenge:(0,o.base64URLEncode)((0,o.sha256)(Buffer.from(e))),createdAt:new Date}},U=async(e,t=null)=>{let n=j(),r=q(),a=(0,o.getAuthCallback)(),s=JSON.parse((0,o.getFromLocalStorage)(O,!0));null!=t&&(a+=`?BackUrl=${encodeURI(t)}`);const i={code:e,grant_type:"authorization_code",code_verifier:s.codeVerifier,client_id:encodeURI(r),redirect_uri:encodeURI(a)};try{const e=await fetch(`${n}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(i)}).catch((function(e){console.log("Request failed:",e.message)})),t=await e.json();let{access_token:o,refresh_token:r,id_token:a,expires_in:s,error:c,error_description:l}=t;return{access_token:o,refresh_token:r,id_token:a,expires_in:s,error:c,error_description:l}}catch(e){console.log(e)}},v=async()=>{if(await(0,o.retryPromise)((()=>g.acquireLock(m,5e3)),10))try{let e=C();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:o,refreshToken:r}=e;P(null,0,r)}finally{await g.releaseLock(m)}},T=async()=>{if(await(0,o.retryPromise)((()=>g.acquireLock(m,5e3)),10))try{let e=C();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:o,refreshToken:r}=e,a=B(),s=Math.floor(Date.now()/1e3);if(n-=w,s-o>n||null==t){if(console.log("getAccessToken access token expired"),a===y&&F()){if(!r)throw H(),Error("missing Refresh Token");let e=await L(r),{access_token:t,expires_in:n,refresh_token:o}=e;return void 0===o&&(o=null),P(t,n,o),t}throw H(),Error("Access Token Expired.")}return t}finally{await g.releaseLock(m)}throw Error("Lock acquire error.")},L=async e=>{let t=j(),n=q();const r={grant_type:"refresh_token",client_id:encodeURI(n),refresh_token:e};try{const e=await fetch(`${t}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(r)}).then((e=>{if(400===e.status){(0,o.getCurrentPathName)();throw(0,o.setSessionClearingState)(!0),Error(`${e.status} - ${e.statusText}`)}return e})).catch((function(e){throw Error(`Request failed: ${e.message}`)})),n=await e.json();let{access_token:a,refresh_token:s,expires_in:i}=n;return{access_token:a,refresh_token:s,expires_in:i}}catch(e){throw console.log(e),e}},P=(e,t,n=null,r=null)=>{let a=C(),s={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===n&&a&&(n=a.refreshToken),null===r&&a&&(r=a.idToken),n&&(s.refreshToken=n),r&&(s.idToken=r),(0,o.putOnLocalStorage)(k,JSON.stringify(s))},C=()=>{let e=(0,o.getFromLocalStorage)(k,!1);return null===e?null:JSON.parse(e)},H=()=>{if("undefined"!=typeof window)return(0,o.removeFromLocalStorage)(k),(0,o.removeFromLocalStorage)(b),void(0,o.removeFromLocalStorage)(O)},x=()=>{if("undefined"!=typeof window){const e=C();return e?e.idToken:null}return null},q=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,B=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",F=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),j=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null,V=()=>"undefined"!=typeof window?window.SCOPES:null,N=()=>{(0,o.getCurrentLocation)().replace(I(x()).toString())},M=(e,t,n)=>{let r=new(p())({issuer:t,audience:n}),a=(0,o.getFromLocalStorage)(b,!0),s=r.decode(e),i=(s.header.alg,s.header.kid,s.payload.aud),c=s.payload.iss;s.payload.exp,s.payload.nbf;return(s.payload.nonce||null)==a&&i==n&&c==t},D=e=>{let t=q(),n=V(),r=$(16);(0,o.putOnLocalStorage)(b,r);let a=j(),s=d()(`${a}/oauth2/auth`),i={response_type:"otp",scope:encodeURI(n),nonce:r,client_id:encodeURI(t),connection:e.connection||"email",send:e.send||"code"};return e.hasOwnProperty("email")&&(i.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(i.phone_number=encodeURIComponent(e.phone_number)),f.post(s.toString()).send(i).then((e=>{let t=e.body;return Promise.resolve({response:t})})).catch((e=>Promise.reject(e)))},G=e=>t=>{let n=q(),o=V(),r=j(),a=d()(`${r}/oauth2/token`);if(!e.hasOwnProperty("otp"))throw Error("otp param is mandatory.");let s={grant_type:"passwordless",connection:e.connection||"email",scope:encodeURI(o),client_id:encodeURI(n),otp:e.otp};return e.hasOwnProperty("email")&&(s.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(s.phone_number=encodeURIComponent(e.phone_number)),f.post(a.toString()).send(s).then((e=>{try{let o=e.body,{access_token:a,expires_in:s,refresh_token:i,id_token:c}=o;if(void 0===i&&(i=null),void 0===c&&(c=null),c&&!M(c,r,n))throw Error("id token is not valid.");return P(a,s,i,c),t&&t({type:h.SET_LOGGED_USER,payload:{sessionState:null}}),Promise.resolve({response:o})}catch(e){return console.log(e),Promise.reject(e)}})).catch((e=>Promise.reject(e)))}},3605:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>c,fetchResponseHandler:()=>l});n(4824),n(6530);const o=require("sweetalert2");var r=n.n(o),a=n(4656),s=n.n(a);n(9732),n(4341),n(886);const i=e=>t=>({type:e,payload:t}),c=(i("RESET_LOADING"),i("START_LOADING"),i("STOP_LOADING"),e=>{let t=e.status,n=e.statusText;switch(t){case 403:r().fire("ERROR",s().translate("errors.user_not_authz"),"warning");break;case 401:r().fire("ERROR",s().translate("errors.session_expired"),"error");break;case 412:r().fire("ERROR",n,"warning");case 500:r().fire("ERROR",s().translate("errors.server_error"),"error")}}),l=e=>{if(e.ok)return e.json();throw e},d=e=>e=(e=e.replace(/,/g,"\\,")).replace(/;/g,"\\;")},9732:(e,t,n)=>{n.d(t,{arraysEqual:()=>f,base64URLEncode:()=>g,buildAPIBaseUrl:()=>c,getAuthCallback:()=>r,getCurrentLocation:()=>a,getCurrentPathName:()=>i,getFromLocalStorage:()=>d,getOrigin:()=>s,putOnLocalStorage:()=>l,removeFromLocalStorage:()=>u,retryPromise:()=>w,setSessionClearingState:()=>p,sha256:()=>m,shallowEqual:()=>h});require("moment-timezone");n(6530);var o=n(6113);const r=()=>"undefined"!=typeof window?`${window.location.origin}/auth/callback`:null,a=()=>{let e="";return"undefined"!=typeof window&&(e=window.location,window.top&&(e=window.top.location)),e},s=()=>"undefined"!=typeof window?window.location.origin:null,i=()=>"undefined"!=typeof window?window.location.pathname:null,c=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,l=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},d=(e,t)=>{if("undefined"!=typeof window){let n=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),u(e)),n}return null},u=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},p=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},h=(e,t)=>{const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(let o of n)if(e[o]!==t[o])return!1;return!0},f=(e,t)=>e.length===t.length&&e.every(((e,n)=>h(e,t[n]))),g=e=>e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),m=e=>(0,o.createHash)("sha256").update(e).digest(),w=async(e,t=3)=>{for(let n=0;n<t;n++)if(await e())return!0;return!1}},7525:(e,t,n)=>{n.d(t,{getCountryList:()=>y,getLanguageList:()=>_,queryAccessLevels:()=>m,queryCompanies:()=>f,queryGroups:()=>h,queryMembers:()=>l,queryOrganizations:()=>w,querySpeakers:()=>u,querySponsors:()=>g,querySummits:()=>d,queryTags:()=>p});var o=n(3605),r=n(886),a=n(9732);const s=require("lodash");var i=n.n(s);const c=500,l=i().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/members?filter=${s}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),c),d=i().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),c),u=i().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let i="/api/v1";e&&(i+=`/summits/${e}`),i+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${s}&expand=member,registration_request`,fetch((0,a.buildAPIBaseUrl)(i)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),c),p=i().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let i="/api/v1",c=encodeURIComponent(`tag=@${t}`);i+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${c}&expand=tag,track_tag_group`:`/tags?filter=${c}`,i+=`&order=tag&page=1&per_page=50&access_token=${s}`,fetch((0,a.buildAPIBaseUrl)(i)).then(o.fetchResponseHandler).then((t=>{let o=[...t.data];e&&(o=o.map((e=>e.tag))),n(o)})).catch(o.fetchErrorHandler)}),c),h=(i().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let i=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${i}&order=name&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),c),i().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();let i=(t=(0,o.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${i}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),c),i().debounce((async(e,t,n=!1,s)=>{const i=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c=`/api/v1/summits/${e}/events`+(n?"/published":""),l=encodeURIComponent(`title=@${t}`);fetch((0,a.buildAPIBaseUrl)(`${c}?filter=${l}&order=title&access_token=${i}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(o.fetchErrorHandler)}),c),i().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),c)),f=i().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),c),g=i().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let i=encodeURIComponent(`company_name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${i}&expand=company,sponsorship&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),c),m=i().debounce(((e,t,n)=>{let s=(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let i=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${i}&&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),c),w=i().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),c),_=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/languages"),{signal:t}).then(o.fetchResponseHandler).then((t=>{e(t.data)})).catch(o.fetchErrorHandler),y=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/countries"),{signal:t}).then(o.fetchResponseHandler).then((t=>{e(t.data)})).catch(o.fetchErrorHandler)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},4824:e=>{e.exports=require("superagent")},6530:e=>{e.exports=require("urijs")},6113:e=>{e.exports=require("crypto")}};var t=require("../../runtime.js");t.C(e);t.X(0,[5344],(()=>(e=>t(t.s=e))(7744)))})()}));
@@ -1 +1 @@
1
- "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{var e={id:4685,ids:[4685,3737,3451,4823,1813,1149]};e.modules={7966:(e,t,n)=>{n.r(t),n.d(t,{default:()=>h});var r=n(6689),a=n.n(r),o=n(9953),s=n.n(o),c=n(9503),i=n.n(c),l=n(7525);const d=["error","value","id","onChange"];function u(){return u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u.apply(this,arguments)}function p(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}class h extends a().Component{constructor(e){super(e),this.handleChange=this.handleChange.bind(this),this.handleNew=this.handleNew.bind(this),this.getOrganizations=this.getOrganizations.bind(this)}handleChange(e){let t={target:{id:this.props.id,value:{id:e.value,name:e.label},type:"organizationinput"}};this.props.onChange(t)}handleNew(e){this.props.onCreate(e,(e=>{this.handleChange({value:e.id,label:e.name})}))}getOrganizations(e,t){if(!e)return Promise.resolve({options:[]});(0,l.queryOrganizations)(e,(e=>{let n=e.map((e=>({value:e.id.toString(),label:e.name})));t(n)}))}render(){let e=this.props,{error:t,value:n,id:r,onChange:o}=e,c=p(e,d),l=this.props.hasOwnProperty("error")&&""!=t,h=this.props.hasOwnProperty("allowCreate"),f=n?{value:n.id.toString(),label:n.name}:null;const g=h?i():s();return a().createElement("div",null,a().createElement(g,u({value:f,onChange:this.handleChange,loadOptions:this.getOrganizations,onCreateOption:this.handleNew},c)),l&&a().createElement("p",{className:"error-label"},t))}}},4341:(e,t,n)=>{n(4656),n(3605),n(9732),n(886)},886:(e,t,n)=>{n.d(t,{getAccessToken:()=>p});var r=n(9732);n(4824),n(6113);const a=require("browser-tabs-lock");var o=n.n(a);n(6530),n(3856),n(4341);const s=new(o()),c="openstackuicore.lock.getTokenSilently",i="code",l="authInfo",d="nonce",u="pkce",p=async()=>{if(await(0,r.retryPromise)((()=>s.acquireLock(c,5e3)),10))try{let e=g();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:r,refreshToken:a}=e,o=y(),l=Math.floor(Date.now()/1e3);if(n-=20,l-r>n||null==t){if(console.log("getAccessToken access token expired"),o===i&&k()){if(!a)throw m(),Error("missing Refresh Token");let e=await h(a),{access_token:t,expires_in:n,refresh_token:r}=e;return void 0===r&&(r=null),f(t,n,r),t}throw m(),Error("Access Token Expired.")}return t}finally{await s.releaseLock(c)}throw Error("Lock acquire error.")},h=async e=>{let t=b(),n=w();const a={grant_type:"refresh_token",client_id:encodeURI(n),refresh_token:e};try{const e=await fetch(`${t}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(a)}).then((e=>{if(400===e.status){(0,r.getCurrentPathName)();throw(0,r.setSessionClearingState)(!0),Error(`${e.status} - ${e.statusText}`)}return e})).catch((function(e){throw Error(`Request failed: ${e.message}`)})),n=await e.json();let{access_token:o,refresh_token:s,expires_in:c}=n;return{access_token:o,refresh_token:s,expires_in:c}}catch(e){throw console.log(e),e}},f=(e,t,n=null,a=null)=>{let o=g(),s={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===n&&o&&(n=o.refreshToken),null===a&&o&&(a=o.idToken),n&&(s.refreshToken=n),a&&(s.idToken=a),(0,r.putOnLocalStorage)(l,JSON.stringify(s))},g=()=>{let e=(0,r.getFromLocalStorage)(l,!1);return null===e?null:JSON.parse(e)},m=()=>{if("undefined"!=typeof window)return(0,r.removeFromLocalStorage)(l),(0,r.removeFromLocalStorage)(d),void(0,r.removeFromLocalStorage)(u)},w=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,y=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",k=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),b=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null},3605:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>i,fetchResponseHandler:()=>l});n(4824),n(6530);const r=require("sweetalert2");var a=n.n(r),o=n(4656),s=n.n(o);n(9732),n(4341),n(886);const c=e=>t=>({type:e,payload:t}),i=(c("RESET_LOADING"),c("START_LOADING"),c("STOP_LOADING"),e=>{let t=e.status,n=e.statusText;switch(t){case 403:a().fire("ERROR",s().translate("errors.user_not_authz"),"warning");break;case 401:a().fire("ERROR",s().translate("errors.session_expired"),"error");break;case 412:a().fire("ERROR",n,"warning");case 500:a().fire("ERROR",s().translate("errors.server_error"),"error")}}),l=e=>{if(e.ok)return e.json();throw e},d=e=>e=(e=e.replace(/,/g,"\\,")).replace(/;/g,"\\;")},9732:(e,t,n)=>{n.d(t,{arraysEqual:()=>d,buildAPIBaseUrl:()=>a,getCurrentPathName:()=>r,getFromLocalStorage:()=>s,putOnLocalStorage:()=>o,removeFromLocalStorage:()=>c,retryPromise:()=>u,setSessionClearingState:()=>i,shallowEqual:()=>l});require("moment-timezone");n(6530),n(6113);const r=()=>"undefined"!=typeof window?window.location.pathname:null,a=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,o=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},s=(e,t)=>{if("undefined"!=typeof window){let n=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),c(e)),n}return null},c=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},i=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},l=(e,t)=>{const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0},d=(e,t)=>e.length===t.length&&e.every(((e,n)=>l(e,t[n]))),u=async(e,t=3)=>{for(let n=0;n<t;n++)if(await e())return!0;return!1}},7525:(e,t,n)=>{n.d(t,{getCountryList:()=>k,getLanguageList:()=>y,queryAccessLevels:()=>m,queryCompanies:()=>f,queryGroups:()=>h,queryMembers:()=>l,queryOrganizations:()=>w,querySpeakers:()=>u,querySponsors:()=>g,querySummits:()=>d,queryTags:()=>p});var r=n(3605),a=n(886),o=n(9732);const s=require("lodash");var c=n.n(s);const i=500,l=c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/members?filter=${s}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),i),d=c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),i),u=c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1";e&&(c+=`/summits/${e}`),c+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${s}&expand=member,registration_request`,fetch((0,o.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),i),p=c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1",i=encodeURIComponent(`tag=@${t}`);c+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${i}&expand=tag,track_tag_group`:`/tags?filter=${i}`,c+=`&order=tag&page=1&per_page=50&access_token=${s}`,fetch((0,o.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((t=>{let r=[...t.data];e&&(r=r.map((e=>e.tag))),n(r)})).catch(r.fetchErrorHandler)}),i),h=(c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${c}&order=name&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),i),c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();let c=(t=(0,r.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),i),c().debounce((async(e,t,n=!1,s)=>{const c=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let i=`/api/v1/summits/${e}/events`+(n?"/published":""),l=encodeURIComponent(`title=@${t}`);fetch((0,o.buildAPIBaseUrl)(`${i}?filter=${l}&order=title&access_token=${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(r.fetchErrorHandler)}),i),c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),i)),f=c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),i),g=c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`company_name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${c}&expand=company,sponsorship&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),i),m=c().debounce(((e,t,n)=>{let s=(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),i),w=c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),i),y=(e,t)=>fetch((0,o.buildAPIBaseUrl)("/api/public/v1/languages"),{signal:t}).then(r.fetchResponseHandler).then((t=>{e(t.data)})).catch(r.fetchErrorHandler),k=(e,t)=>fetch((0,o.buildAPIBaseUrl)("/api/public/v1/countries"),{signal:t}).then(r.fetchResponseHandler).then((t=>{e(t.data)})).catch(r.fetchErrorHandler)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},9503:e=>{e.exports=require("react-select/lib/AsyncCreatable")},4824:e=>{e.exports=require("superagent")},6530:e=>{e.exports=require("urijs")},6113:e=>{e.exports=require("crypto")}};var t=require("../../runtime.js");t.C(e);t.X(0,[5344],(()=>(e=>t(t.s=e))(7966)))})()}));
1
+ "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{var e={id:4685,ids:[4685,3737,7634,3451,4823,1813,1149]};e.modules={7966:(e,t,n)=>{n.r(t),n.d(t,{default:()=>h});var o=n(6689),r=n.n(o),a=n(9953),s=n.n(a),c=n(9503),l=n.n(c),i=n(7525);const d=["error","value","id","onChange"];function u(){return u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},u.apply(this,arguments)}function p(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}class h extends r().Component{constructor(e){super(e),this.handleChange=this.handleChange.bind(this),this.handleNew=this.handleNew.bind(this),this.getOrganizations=this.getOrganizations.bind(this)}handleChange(e){let t={target:{id:this.props.id,value:{id:e.value,name:e.label},type:"organizationinput"}};this.props.onChange(t)}handleNew(e){this.props.onCreate(e,(e=>{this.handleChange({value:e.id,label:e.name})}))}getOrganizations(e,t){if(!e)return Promise.resolve({options:[]});(0,i.queryOrganizations)(e,(e=>{let n=e.map((e=>({value:e.id.toString(),label:e.name})));t(n)}))}render(){let e=this.props,{error:t,value:n,id:o,onChange:a}=e,c=p(e,d),i=this.props.hasOwnProperty("error")&&""!=t,h=this.props.hasOwnProperty("allowCreate"),f=n?{value:n.id.toString(),label:n.name}:null;const g=h?l():s();return r().createElement("div",null,r().createElement(g,u({value:f,onChange:this.handleChange,loadOptions:this.getOrganizations,onCreateOption:this.handleNew},c)),i&&r().createElement("p",{className:"error-label"},t))}}},4341:(e,t,n)=>{n.d(t,{SET_LOGGED_USER:()=>o});n(4656),n(3605),n(9732),n(886);const o="SET_LOGGED_USER"},886:(e,t,n)=>{n.r(t),n.d(t,{ACCESS_TOKEN_SKEW_TIME:()=>w,RESPONSE_TYPE_CODE:()=>y,RESPONSE_TYPE_IMPLICIT:()=>_,clearAccessToken:()=>v,clearAuthInfo:()=>H,doLogin:()=>A,doLoginBasicLogin:()=>E,emitAccessToken:()=>$,getAccessToken:()=>T,getAuthInfo:()=>L,getAuthUrl:()=>I,getIdToken:()=>x,getLogoutUrl:()=>O,getOAuth2ClientId:()=>q,getOAuth2Flow:()=>B,getOAuth2IDPBaseUrl:()=>j,getOAuth2Scopes:()=>N,initLogOut:()=>V,passwordlessLogin:()=>G,passwordlessStart:()=>z,refreshAccessToken:()=>C,storeAuthInfo:()=>P,useOAuth2RefreshToken:()=>F,validateIdToken:()=>D});var o=n(9732),r=n(4824),a=n.n(r),s=n(6113);const c=require("browser-tabs-lock");var l=n.n(c),i=n(6530),d=n.n(i),u=n(3856),p=n.n(u),h=n(4341);let f=a();const g=new(l()),m="openstackuicore.lock.getTokenSilently",w=20,_="token id_token",y="code",k="authInfo",b="nonce",R="pkce",I=(e=null,t=null,n=null,r=null)=>{let a=q(),s=(0,o.getAuthCallback)(),c=j(),l=N(),i=B();null!=e&&(s+=`?BackUrl=${encodeURI(e)}`);let u=S(16);(0,o.putOnLocalStorage)(b,u);let p=d()(`${c}/oauth2/auth`),h={response_type:encodeURI(i),scope:encodeURI(l),nonce:u,response_mode:"fragment",client_id:encodeURI(a),redirect_uri:encodeURI(s)};if(i===y){const e=U();(0,o.putOnLocalStorage)(R,JSON.stringify(e)),h.code_challenge=e.codeChallenge,h.code_challenge_method="S256",h.approval_prompt="force"}return t&&(h.prompt=t),n&&(h.id_token_hint=n),r&&(h.provider=r),p=p.query(h),p},O=e=>{let t=j(),n=q(),r=d()(`${t}/oauth2/end-session`),a=S(16),s=(0,o.getOrigin)()+"/auth/logout";return(0,o.putOnLocalStorage)("post_logout_state",a),r.query({id_token_hint:e,post_logout_redirect_uri:encodeURI(s),client_id:encodeURI(n),state:a})},S=e=>{let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n="";for(let o=0;o<e;o++)n+=t.charAt(Math.floor(Math.random()*t.length));return n},A=(e=null,t=null,n=null)=>{let r=I(e,n,null,t);(0,o.getCurrentLocation)().replace(r.toString())},E=(e=null)=>{A(e,null,null)},U=()=>{const e=(0,o.base64URLEncode)((0,s.randomBytes)(64));return{codeVerifier:e,codeChallenge:(0,o.base64URLEncode)((0,o.sha256)(Buffer.from(e))),createdAt:new Date}},$=async(e,t=null)=>{let n=j(),r=q(),a=(0,o.getAuthCallback)(),s=JSON.parse((0,o.getFromLocalStorage)(R,!0));null!=t&&(a+=`?BackUrl=${encodeURI(t)}`);const c={code:e,grant_type:"authorization_code",code_verifier:s.codeVerifier,client_id:encodeURI(r),redirect_uri:encodeURI(a)};try{const e=await fetch(`${n}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(c)}).catch((function(e){console.log("Request failed:",e.message)})),t=await e.json();let{access_token:o,refresh_token:r,id_token:a,expires_in:s,error:l,error_description:i}=t;return{access_token:o,refresh_token:r,id_token:a,expires_in:s,error:l,error_description:i}}catch(e){console.log(e)}},v=async()=>{if(await(0,o.retryPromise)((()=>g.acquireLock(m,5e3)),10))try{let e=L();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:o,refreshToken:r}=e;P(null,0,r)}finally{await g.releaseLock(m)}},T=async()=>{if(await(0,o.retryPromise)((()=>g.acquireLock(m,5e3)),10))try{let e=L();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:o,refreshToken:r}=e,a=B(),s=Math.floor(Date.now()/1e3);if(n-=w,s-o>n||null==t){if(console.log("getAccessToken access token expired"),a===y&&F()){if(!r)throw H(),Error("missing Refresh Token");let e=await C(r),{access_token:t,expires_in:n,refresh_token:o}=e;return void 0===o&&(o=null),P(t,n,o),t}throw H(),Error("Access Token Expired.")}return t}finally{await g.releaseLock(m)}throw Error("Lock acquire error.")},C=async e=>{let t=j(),n=q();const r={grant_type:"refresh_token",client_id:encodeURI(n),refresh_token:e};try{const e=await fetch(`${t}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(r)}).then((e=>{if(400===e.status){(0,o.getCurrentPathName)();throw(0,o.setSessionClearingState)(!0),Error(`${e.status} - ${e.statusText}`)}return e})).catch((function(e){throw Error(`Request failed: ${e.message}`)})),n=await e.json();let{access_token:a,refresh_token:s,expires_in:c}=n;return{access_token:a,refresh_token:s,expires_in:c}}catch(e){throw console.log(e),e}},P=(e,t,n=null,r=null)=>{let a=L(),s={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===n&&a&&(n=a.refreshToken),null===r&&a&&(r=a.idToken),n&&(s.refreshToken=n),r&&(s.idToken=r),(0,o.putOnLocalStorage)(k,JSON.stringify(s))},L=()=>{let e=(0,o.getFromLocalStorage)(k,!1);return null===e?null:JSON.parse(e)},H=()=>{if("undefined"!=typeof window)return(0,o.removeFromLocalStorage)(k),(0,o.removeFromLocalStorage)(b),void(0,o.removeFromLocalStorage)(R)},x=()=>{if("undefined"!=typeof window){const e=L();return e?e.idToken:null}return null},q=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,B=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",F=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),j=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null,N=()=>"undefined"!=typeof window?window.SCOPES:null,V=()=>{(0,o.getCurrentLocation)().replace(O(x()).toString())},D=(e,t,n)=>{let r=new(p())({issuer:t,audience:n}),a=(0,o.getFromLocalStorage)(b,!0),s=r.decode(e),c=(s.header.alg,s.header.kid,s.payload.aud),l=s.payload.iss;s.payload.exp,s.payload.nbf;return(s.payload.nonce||null)==a&&c==n&&l==t},z=e=>{let t=q(),n=N(),r=S(16);(0,o.putOnLocalStorage)(b,r);let a=j(),s=d()(`${a}/oauth2/auth`),c={response_type:"otp",scope:encodeURI(n),nonce:r,client_id:encodeURI(t),connection:e.connection||"email",send:e.send||"code"};return e.hasOwnProperty("email")&&(c.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(c.phone_number=encodeURIComponent(e.phone_number)),f.post(s.toString()).send(c).then((e=>{let t=e.body;return Promise.resolve({response:t})})).catch((e=>Promise.reject(e)))},G=e=>t=>{let n=q(),o=N(),r=j(),a=d()(`${r}/oauth2/token`);if(!e.hasOwnProperty("otp"))throw Error("otp param is mandatory.");let s={grant_type:"passwordless",connection:e.connection||"email",scope:encodeURI(o),client_id:encodeURI(n),otp:e.otp};return e.hasOwnProperty("email")&&(s.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(s.phone_number=encodeURIComponent(e.phone_number)),f.post(a.toString()).send(s).then((e=>{try{let o=e.body,{access_token:a,expires_in:s,refresh_token:c,id_token:l}=o;if(void 0===c&&(c=null),void 0===l&&(l=null),l&&!D(l,r,n))throw Error("id token is not valid.");return P(a,s,c,l),t&&t({type:h.SET_LOGGED_USER,payload:{sessionState:null}}),Promise.resolve({response:o})}catch(e){return console.log(e),Promise.reject(e)}})).catch((e=>Promise.reject(e)))}},3605:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>l,fetchResponseHandler:()=>i});n(4824),n(6530);const o=require("sweetalert2");var r=n.n(o),a=n(4656),s=n.n(a);n(9732),n(4341),n(886);const c=e=>t=>({type:e,payload:t}),l=(c("RESET_LOADING"),c("START_LOADING"),c("STOP_LOADING"),e=>{let t=e.status,n=e.statusText;switch(t){case 403:r().fire("ERROR",s().translate("errors.user_not_authz"),"warning");break;case 401:r().fire("ERROR",s().translate("errors.session_expired"),"error");break;case 412:r().fire("ERROR",n,"warning");case 500:r().fire("ERROR",s().translate("errors.server_error"),"error")}}),i=e=>{if(e.ok)return e.json();throw e},d=e=>e=(e=e.replace(/,/g,"\\,")).replace(/;/g,"\\;")},9732:(e,t,n)=>{n.d(t,{arraysEqual:()=>f,base64URLEncode:()=>g,buildAPIBaseUrl:()=>l,getAuthCallback:()=>r,getCurrentLocation:()=>a,getCurrentPathName:()=>c,getFromLocalStorage:()=>d,getOrigin:()=>s,putOnLocalStorage:()=>i,removeFromLocalStorage:()=>u,retryPromise:()=>w,setSessionClearingState:()=>p,sha256:()=>m,shallowEqual:()=>h});require("moment-timezone");n(6530);var o=n(6113);const r=()=>"undefined"!=typeof window?`${window.location.origin}/auth/callback`:null,a=()=>{let e="";return"undefined"!=typeof window&&(e=window.location,window.top&&(e=window.top.location)),e},s=()=>"undefined"!=typeof window?window.location.origin:null,c=()=>"undefined"!=typeof window?window.location.pathname:null,l=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,i=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},d=(e,t)=>{if("undefined"!=typeof window){let n=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),u(e)),n}return null},u=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},p=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},h=(e,t)=>{const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(let o of n)if(e[o]!==t[o])return!1;return!0},f=(e,t)=>e.length===t.length&&e.every(((e,n)=>h(e,t[n]))),g=e=>e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),m=e=>(0,o.createHash)("sha256").update(e).digest(),w=async(e,t=3)=>{for(let n=0;n<t;n++)if(await e())return!0;return!1}},7525:(e,t,n)=>{n.d(t,{getCountryList:()=>y,getLanguageList:()=>_,queryAccessLevels:()=>m,queryCompanies:()=>f,queryGroups:()=>h,queryMembers:()=>i,queryOrganizations:()=>w,querySpeakers:()=>u,querySponsors:()=>g,querySummits:()=>d,queryTags:()=>p});var o=n(3605),r=n(886),a=n(9732);const s=require("lodash");var c=n.n(s);const l=500,i=c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/members?filter=${s}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l),d=c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l),u=c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c="/api/v1";e&&(c+=`/summits/${e}`),c+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${s}&expand=member,registration_request`,fetch((0,a.buildAPIBaseUrl)(c)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),p=c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c="/api/v1",l=encodeURIComponent(`tag=@${t}`);c+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${l}&expand=tag,track_tag_group`:`/tags?filter=${l}`,c+=`&order=tag&page=1&per_page=50&access_token=${s}`,fetch((0,a.buildAPIBaseUrl)(c)).then(o.fetchResponseHandler).then((t=>{let o=[...t.data];e&&(o=o.map((e=>e.tag))),n(o)})).catch(o.fetchErrorHandler)}),l),h=(c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${c}&order=name&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();let c=(t=(0,o.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${c}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),c().debounce((async(e,t,n=!1,s)=>{const c=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let l=`/api/v1/summits/${e}/events`+(n?"/published":""),i=encodeURIComponent(`title=@${t}`);fetch((0,a.buildAPIBaseUrl)(`${l}?filter=${i}&order=title&access_token=${c}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(o.fetchErrorHandler)}),l),c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l)),f=c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l),g=c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c=encodeURIComponent(`company_name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${c}&expand=company,sponsorship&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),m=c().debounce(((e,t,n)=>{let s=(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${c}&&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),w=c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l),_=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/languages"),{signal:t}).then(o.fetchResponseHandler).then((t=>{e(t.data)})).catch(o.fetchErrorHandler),y=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/countries"),{signal:t}).then(o.fetchResponseHandler).then((t=>{e(t.data)})).catch(o.fetchErrorHandler)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},9503:e=>{e.exports=require("react-select/lib/AsyncCreatable")},4824:e=>{e.exports=require("superagent")},6530:e=>{e.exports=require("urijs")},6113:e=>{e.exports=require("crypto")}};var t=require("../../runtime.js");t.C(e);t.X(0,[5344],(()=>(e=>t(t.s=e))(7966)))})()}));
@@ -1 +1 @@
1
- "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{var e={id:7885,ids:[7885,3737,3451,4823,1813,1149]};e.modules={4560:(e,t,n)=>{n.r(t),n.d(t,{default:()=>d});var r=n(6689),a=n.n(r),o=n(9953),s=n.n(o);const i=require("react-select/lib/components");var c=n(7525);const l=["value","onChange","history","summitId","error","id","multi"];function p(){return p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},p.apply(this,arguments)}function u(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}class d extends a().Component{constructor(e){super(e),this.handleChange=this.handleChange.bind(this),this.getSpeakers=this.getSpeakers.bind(this),this.handleClick=this.handleClick.bind(this),this.getOptionValue=this.getOptionValue.bind(this),this.getOptionLabel=this.getOptionLabel.bind(this)}handleChange(e){let t={target:{id:this.props.id,value:e,type:"speakerinput"}};this.props.onChange(t)}handleClick(e){let{history:t}=this.props;t.push(`/app/speakers/${e}`)}getSpeakers(e,t){if(!e)return Promise.resolve({options:[]});let n=this.props.hasOwnProperty("summitId")?this.props.summitId:null;(0,c.querySpeakers)(n,e,t)}getOptionValue(e){return this.props.hasOwnProperty("getOptionValue")?this.props.getOptionValue(e):e.id}getOptionLabel(e){return this.props.hasOwnProperty("getOptionLabel")?this.props.getOptionLabel(e):`${e.first_name} ${e.last_name} (${e.id})`}render(){let e=this.props,{value:t,onChange:n,history:r,summitId:o,error:c,id:d,multi:h}=e,f=u(e,l),m=this.props.hasOwnProperty("error")&&""!=c,g=this.props.hasOwnProperty("multi");return a().createElement("div",null,a().createElement(s(),p({value:t,onChange:this.handleChange,loadOptions:this.getSpeakers,components:{MultiValueLabel:e=>a().createElement("a",{onClick:()=>this.handleClick(e.data.id),style:{cursor:"pointer"}},a().createElement(i.components.MultiValueLabel,e))},getOptionValue:e=>this.getOptionValue(e),getOptionLabel:e=>this.getOptionLabel(e),isMulti:g},f)),m&&a().createElement("p",{className:"error-label"},c))}}},4341:(e,t,n)=>{n(4656),n(3605),n(9732),n(886)},886:(e,t,n)=>{n.d(t,{getAccessToken:()=>d});var r=n(9732);n(4824),n(6113);const a=require("browser-tabs-lock");var o=n.n(a);n(6530),n(3856),n(4341);const s=new(o()),i="openstackuicore.lock.getTokenSilently",c="code",l="authInfo",p="nonce",u="pkce",d=async()=>{if(await(0,r.retryPromise)((()=>s.acquireLock(i,5e3)),10))try{let e=m();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:r,refreshToken:a}=e,o=w(),l=Math.floor(Date.now()/1e3);if(n-=20,l-r>n||null==t){if(console.log("getAccessToken access token expired"),o===c&&y()){if(!a)throw g(),Error("missing Refresh Token");let e=await h(a),{access_token:t,expires_in:n,refresh_token:r}=e;return void 0===r&&(r=null),f(t,n,r),t}throw g(),Error("Access Token Expired.")}return t}finally{await s.releaseLock(i)}throw Error("Lock acquire error.")},h=async e=>{let t=b(),n=k();const a={grant_type:"refresh_token",client_id:encodeURI(n),refresh_token:e};try{const e=await fetch(`${t}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(a)}).then((e=>{if(400===e.status){(0,r.getCurrentPathName)();throw(0,r.setSessionClearingState)(!0),Error(`${e.status} - ${e.statusText}`)}return e})).catch((function(e){throw Error(`Request failed: ${e.message}`)})),n=await e.json();let{access_token:o,refresh_token:s,expires_in:i}=n;return{access_token:o,refresh_token:s,expires_in:i}}catch(e){throw console.log(e),e}},f=(e,t,n=null,a=null)=>{let o=m(),s={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===n&&o&&(n=o.refreshToken),null===a&&o&&(a=o.idToken),n&&(s.refreshToken=n),a&&(s.idToken=a),(0,r.putOnLocalStorage)(l,JSON.stringify(s))},m=()=>{let e=(0,r.getFromLocalStorage)(l,!1);return null===e?null:JSON.parse(e)},g=()=>{if("undefined"!=typeof window)return(0,r.removeFromLocalStorage)(l),(0,r.removeFromLocalStorage)(p),void(0,r.removeFromLocalStorage)(u)},k=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,w=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",y=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),b=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null},3605:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>p,fetchErrorHandler:()=>c,fetchResponseHandler:()=>l});n(4824),n(6530);const r=require("sweetalert2");var a=n.n(r),o=n(4656),s=n.n(o);n(9732),n(4341),n(886);const i=e=>t=>({type:e,payload:t}),c=(i("RESET_LOADING"),i("START_LOADING"),i("STOP_LOADING"),e=>{let t=e.status,n=e.statusText;switch(t){case 403:a().fire("ERROR",s().translate("errors.user_not_authz"),"warning");break;case 401:a().fire("ERROR",s().translate("errors.session_expired"),"error");break;case 412:a().fire("ERROR",n,"warning");case 500:a().fire("ERROR",s().translate("errors.server_error"),"error")}}),l=e=>{if(e.ok)return e.json();throw e},p=e=>e=(e=e.replace(/,/g,"\\,")).replace(/;/g,"\\;")},9732:(e,t,n)=>{n.d(t,{arraysEqual:()=>p,buildAPIBaseUrl:()=>a,getCurrentPathName:()=>r,getFromLocalStorage:()=>s,putOnLocalStorage:()=>o,removeFromLocalStorage:()=>i,retryPromise:()=>u,setSessionClearingState:()=>c,shallowEqual:()=>l});require("moment-timezone");n(6530),n(6113);const r=()=>"undefined"!=typeof window?window.location.pathname:null,a=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,o=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},s=(e,t)=>{if("undefined"!=typeof window){let n=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),i(e)),n}return null},i=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},c=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},l=(e,t)=>{const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0},p=(e,t)=>e.length===t.length&&e.every(((e,n)=>l(e,t[n]))),u=async(e,t=3)=>{for(let n=0;n<t;n++)if(await e())return!0;return!1}},7525:(e,t,n)=>{n.d(t,{getCountryList:()=>y,getLanguageList:()=>w,queryAccessLevels:()=>g,queryCompanies:()=>f,queryGroups:()=>h,queryMembers:()=>l,queryOrganizations:()=>k,querySpeakers:()=>u,querySponsors:()=>m,querySummits:()=>p,queryTags:()=>d});var r=n(3605),a=n(886),o=n(9732);const s=require("lodash");var i=n.n(s);const c=500,l=i().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/members?filter=${s}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),c),p=i().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),c),u=i().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let i="/api/v1";e&&(i+=`/summits/${e}`),i+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${s}&expand=member,registration_request`,fetch((0,o.buildAPIBaseUrl)(i)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),c),d=i().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let i="/api/v1",c=encodeURIComponent(`tag=@${t}`);i+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${c}&expand=tag,track_tag_group`:`/tags?filter=${c}`,i+=`&order=tag&page=1&per_page=50&access_token=${s}`,fetch((0,o.buildAPIBaseUrl)(i)).then(r.fetchResponseHandler).then((t=>{let r=[...t.data];e&&(r=r.map((e=>e.tag))),n(r)})).catch(r.fetchErrorHandler)}),c),h=(i().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let i=encodeURIComponent(`name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${i}&order=name&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),c),i().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();let i=(t=(0,r.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${i}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),c),i().debounce((async(e,t,n=!1,s)=>{const i=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=`/api/v1/summits/${e}/events`+(n?"/published":""),l=encodeURIComponent(`title=@${t}`);fetch((0,o.buildAPIBaseUrl)(`${c}?filter=${l}&order=title&access_token=${i}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(r.fetchErrorHandler)}),c),i().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),c)),f=i().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),c),m=i().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let i=encodeURIComponent(`company_name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${i}&expand=company,sponsorship&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),c),g=i().debounce(((e,t,n)=>{let s=(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let i=encodeURIComponent(`name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${i}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),c),k=i().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),c),w=(e,t)=>fetch((0,o.buildAPIBaseUrl)("/api/public/v1/languages"),{signal:t}).then(r.fetchResponseHandler).then((t=>{e(t.data)})).catch(r.fetchErrorHandler),y=(e,t)=>fetch((0,o.buildAPIBaseUrl)("/api/public/v1/countries"),{signal:t}).then(r.fetchResponseHandler).then((t=>{e(t.data)})).catch(r.fetchErrorHandler)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},4824:e=>{e.exports=require("superagent")},6530:e=>{e.exports=require("urijs")},6113:e=>{e.exports=require("crypto")}};var t=require("../../runtime.js");t.C(e);t.X(0,[5344],(()=>(e=>t(t.s=e))(4560)))})()}));
1
+ "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{var e={id:7885,ids:[7885,3737,7634,3451,4823,1813,1149]};e.modules={4560:(e,t,n)=>{n.r(t),n.d(t,{default:()=>p});var o=n(6689),r=n.n(o),a=n(9953),s=n.n(a);const i=require("react-select/lib/components");var l=n(7525);const c=["value","onChange","history","summitId","error","id","multi"];function d(){return d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},d.apply(this,arguments)}function u(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}class p extends r().Component{constructor(e){super(e),this.handleChange=this.handleChange.bind(this),this.getSpeakers=this.getSpeakers.bind(this),this.handleClick=this.handleClick.bind(this),this.getOptionValue=this.getOptionValue.bind(this),this.getOptionLabel=this.getOptionLabel.bind(this)}handleChange(e){let t={target:{id:this.props.id,value:e,type:"speakerinput"}};this.props.onChange(t)}handleClick(e){let{history:t}=this.props;t.push(`/app/speakers/${e}`)}getSpeakers(e,t){if(!e)return Promise.resolve({options:[]});let n=this.props.hasOwnProperty("summitId")?this.props.summitId:null;(0,l.querySpeakers)(n,e,t)}getOptionValue(e){return this.props.hasOwnProperty("getOptionValue")?this.props.getOptionValue(e):e.id}getOptionLabel(e){return this.props.hasOwnProperty("getOptionLabel")?this.props.getOptionLabel(e):`${e.first_name} ${e.last_name} (${e.id})`}render(){let e=this.props,{value:t,onChange:n,history:o,summitId:a,error:l,id:p,multi:h}=e,f=u(e,c),g=this.props.hasOwnProperty("error")&&""!=l,m=this.props.hasOwnProperty("multi");return r().createElement("div",null,r().createElement(s(),d({value:t,onChange:this.handleChange,loadOptions:this.getSpeakers,components:{MultiValueLabel:e=>r().createElement("a",{onClick:()=>this.handleClick(e.data.id),style:{cursor:"pointer"}},r().createElement(i.components.MultiValueLabel,e))},getOptionValue:e=>this.getOptionValue(e),getOptionLabel:e=>this.getOptionLabel(e),isMulti:m},f)),g&&r().createElement("p",{className:"error-label"},l))}}},4341:(e,t,n)=>{n.d(t,{SET_LOGGED_USER:()=>o});n(4656),n(3605),n(9732),n(886);const o="SET_LOGGED_USER"},886:(e,t,n)=>{n.r(t),n.d(t,{ACCESS_TOKEN_SKEW_TIME:()=>w,RESPONSE_TYPE_CODE:()=>_,RESPONSE_TYPE_IMPLICIT:()=>k,clearAccessToken:()=>v,clearAuthInfo:()=>H,doLogin:()=>E,doLoginBasicLogin:()=>$,emitAccessToken:()=>U,getAccessToken:()=>T,getAuthInfo:()=>P,getAuthUrl:()=>I,getIdToken:()=>q,getLogoutUrl:()=>R,getOAuth2ClientId:()=>x,getOAuth2Flow:()=>B,getOAuth2IDPBaseUrl:()=>j,getOAuth2Scopes:()=>V,initLogOut:()=>N,passwordlessLogin:()=>G,passwordlessStart:()=>M,refreshAccessToken:()=>L,storeAuthInfo:()=>C,useOAuth2RefreshToken:()=>F,validateIdToken:()=>D});var o=n(9732),r=n(4824),a=n.n(r),s=n(6113);const i=require("browser-tabs-lock");var l=n.n(i),c=n(6530),d=n.n(c),u=n(3856),p=n.n(u),h=n(4341);let f=a();const g=new(l()),m="openstackuicore.lock.getTokenSilently",w=20,k="token id_token",_="code",y="authInfo",b="nonce",O="pkce",I=(e=null,t=null,n=null,r=null)=>{let a=x(),s=(0,o.getAuthCallback)(),i=j(),l=V(),c=B();null!=e&&(s+=`?BackUrl=${encodeURI(e)}`);let u=S(16);(0,o.putOnLocalStorage)(b,u);let p=d()(`${i}/oauth2/auth`),h={response_type:encodeURI(c),scope:encodeURI(l),nonce:u,response_mode:"fragment",client_id:encodeURI(a),redirect_uri:encodeURI(s)};if(c===_){const e=A();(0,o.putOnLocalStorage)(O,JSON.stringify(e)),h.code_challenge=e.codeChallenge,h.code_challenge_method="S256",h.approval_prompt="force"}return t&&(h.prompt=t),n&&(h.id_token_hint=n),r&&(h.provider=r),p=p.query(h),p},R=e=>{let t=j(),n=x(),r=d()(`${t}/oauth2/end-session`),a=S(16),s=(0,o.getOrigin)()+"/auth/logout";return(0,o.putOnLocalStorage)("post_logout_state",a),r.query({id_token_hint:e,post_logout_redirect_uri:encodeURI(s),client_id:encodeURI(n),state:a})},S=e=>{let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n="";for(let o=0;o<e;o++)n+=t.charAt(Math.floor(Math.random()*t.length));return n},E=(e=null,t=null,n=null)=>{let r=I(e,n,null,t);(0,o.getCurrentLocation)().replace(r.toString())},$=(e=null)=>{E(e,null,null)},A=()=>{const e=(0,o.base64URLEncode)((0,s.randomBytes)(64));return{codeVerifier:e,codeChallenge:(0,o.base64URLEncode)((0,o.sha256)(Buffer.from(e))),createdAt:new Date}},U=async(e,t=null)=>{let n=j(),r=x(),a=(0,o.getAuthCallback)(),s=JSON.parse((0,o.getFromLocalStorage)(O,!0));null!=t&&(a+=`?BackUrl=${encodeURI(t)}`);const i={code:e,grant_type:"authorization_code",code_verifier:s.codeVerifier,client_id:encodeURI(r),redirect_uri:encodeURI(a)};try{const e=await fetch(`${n}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(i)}).catch((function(e){console.log("Request failed:",e.message)})),t=await e.json();let{access_token:o,refresh_token:r,id_token:a,expires_in:s,error:l,error_description:c}=t;return{access_token:o,refresh_token:r,id_token:a,expires_in:s,error:l,error_description:c}}catch(e){console.log(e)}},v=async()=>{if(await(0,o.retryPromise)((()=>g.acquireLock(m,5e3)),10))try{let e=P();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:o,refreshToken:r}=e;C(null,0,r)}finally{await g.releaseLock(m)}},T=async()=>{if(await(0,o.retryPromise)((()=>g.acquireLock(m,5e3)),10))try{let e=P();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:o,refreshToken:r}=e,a=B(),s=Math.floor(Date.now()/1e3);if(n-=w,s-o>n||null==t){if(console.log("getAccessToken access token expired"),a===_&&F()){if(!r)throw H(),Error("missing Refresh Token");let e=await L(r),{access_token:t,expires_in:n,refresh_token:o}=e;return void 0===o&&(o=null),C(t,n,o),t}throw H(),Error("Access Token Expired.")}return t}finally{await g.releaseLock(m)}throw Error("Lock acquire error.")},L=async e=>{let t=j(),n=x();const r={grant_type:"refresh_token",client_id:encodeURI(n),refresh_token:e};try{const e=await fetch(`${t}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(r)}).then((e=>{if(400===e.status){(0,o.getCurrentPathName)();throw(0,o.setSessionClearingState)(!0),Error(`${e.status} - ${e.statusText}`)}return e})).catch((function(e){throw Error(`Request failed: ${e.message}`)})),n=await e.json();let{access_token:a,refresh_token:s,expires_in:i}=n;return{access_token:a,refresh_token:s,expires_in:i}}catch(e){throw console.log(e),e}},C=(e,t,n=null,r=null)=>{let a=P(),s={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===n&&a&&(n=a.refreshToken),null===r&&a&&(r=a.idToken),n&&(s.refreshToken=n),r&&(s.idToken=r),(0,o.putOnLocalStorage)(y,JSON.stringify(s))},P=()=>{let e=(0,o.getFromLocalStorage)(y,!1);return null===e?null:JSON.parse(e)},H=()=>{if("undefined"!=typeof window)return(0,o.removeFromLocalStorage)(y),(0,o.removeFromLocalStorage)(b),void(0,o.removeFromLocalStorage)(O)},q=()=>{if("undefined"!=typeof window){const e=P();return e?e.idToken:null}return null},x=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,B=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",F=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),j=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null,V=()=>"undefined"!=typeof window?window.SCOPES:null,N=()=>{(0,o.getCurrentLocation)().replace(R(q()).toString())},D=(e,t,n)=>{let r=new(p())({issuer:t,audience:n}),a=(0,o.getFromLocalStorage)(b,!0),s=r.decode(e),i=(s.header.alg,s.header.kid,s.payload.aud),l=s.payload.iss;s.payload.exp,s.payload.nbf;return(s.payload.nonce||null)==a&&i==n&&l==t},M=e=>{let t=x(),n=V(),r=S(16);(0,o.putOnLocalStorage)(b,r);let a=j(),s=d()(`${a}/oauth2/auth`),i={response_type:"otp",scope:encodeURI(n),nonce:r,client_id:encodeURI(t),connection:e.connection||"email",send:e.send||"code"};return e.hasOwnProperty("email")&&(i.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(i.phone_number=encodeURIComponent(e.phone_number)),f.post(s.toString()).send(i).then((e=>{let t=e.body;return Promise.resolve({response:t})})).catch((e=>Promise.reject(e)))},G=e=>t=>{let n=x(),o=V(),r=j(),a=d()(`${r}/oauth2/token`);if(!e.hasOwnProperty("otp"))throw Error("otp param is mandatory.");let s={grant_type:"passwordless",connection:e.connection||"email",scope:encodeURI(o),client_id:encodeURI(n),otp:e.otp};return e.hasOwnProperty("email")&&(s.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(s.phone_number=encodeURIComponent(e.phone_number)),f.post(a.toString()).send(s).then((e=>{try{let o=e.body,{access_token:a,expires_in:s,refresh_token:i,id_token:l}=o;if(void 0===i&&(i=null),void 0===l&&(l=null),l&&!D(l,r,n))throw Error("id token is not valid.");return C(a,s,i,l),t&&t({type:h.SET_LOGGED_USER,payload:{sessionState:null}}),Promise.resolve({response:o})}catch(e){return console.log(e),Promise.reject(e)}})).catch((e=>Promise.reject(e)))}},3605:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>l,fetchResponseHandler:()=>c});n(4824),n(6530);const o=require("sweetalert2");var r=n.n(o),a=n(4656),s=n.n(a);n(9732),n(4341),n(886);const i=e=>t=>({type:e,payload:t}),l=(i("RESET_LOADING"),i("START_LOADING"),i("STOP_LOADING"),e=>{let t=e.status,n=e.statusText;switch(t){case 403:r().fire("ERROR",s().translate("errors.user_not_authz"),"warning");break;case 401:r().fire("ERROR",s().translate("errors.session_expired"),"error");break;case 412:r().fire("ERROR",n,"warning");case 500:r().fire("ERROR",s().translate("errors.server_error"),"error")}}),c=e=>{if(e.ok)return e.json();throw e},d=e=>e=(e=e.replace(/,/g,"\\,")).replace(/;/g,"\\;")},9732:(e,t,n)=>{n.d(t,{arraysEqual:()=>f,base64URLEncode:()=>g,buildAPIBaseUrl:()=>l,getAuthCallback:()=>r,getCurrentLocation:()=>a,getCurrentPathName:()=>i,getFromLocalStorage:()=>d,getOrigin:()=>s,putOnLocalStorage:()=>c,removeFromLocalStorage:()=>u,retryPromise:()=>w,setSessionClearingState:()=>p,sha256:()=>m,shallowEqual:()=>h});require("moment-timezone");n(6530);var o=n(6113);const r=()=>"undefined"!=typeof window?`${window.location.origin}/auth/callback`:null,a=()=>{let e="";return"undefined"!=typeof window&&(e=window.location,window.top&&(e=window.top.location)),e},s=()=>"undefined"!=typeof window?window.location.origin:null,i=()=>"undefined"!=typeof window?window.location.pathname:null,l=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,c=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},d=(e,t)=>{if("undefined"!=typeof window){let n=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),u(e)),n}return null},u=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},p=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},h=(e,t)=>{const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(let o of n)if(e[o]!==t[o])return!1;return!0},f=(e,t)=>e.length===t.length&&e.every(((e,n)=>h(e,t[n]))),g=e=>e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),m=e=>(0,o.createHash)("sha256").update(e).digest(),w=async(e,t=3)=>{for(let n=0;n<t;n++)if(await e())return!0;return!1}},7525:(e,t,n)=>{n.d(t,{getCountryList:()=>_,getLanguageList:()=>k,queryAccessLevels:()=>m,queryCompanies:()=>f,queryGroups:()=>h,queryMembers:()=>c,queryOrganizations:()=>w,querySpeakers:()=>u,querySponsors:()=>g,querySummits:()=>d,queryTags:()=>p});var o=n(3605),r=n(886),a=n(9732);const s=require("lodash");var i=n.n(s);const l=500,c=i().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/members?filter=${s}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l),d=i().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l),u=i().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let i="/api/v1";e&&(i+=`/summits/${e}`),i+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${s}&expand=member,registration_request`,fetch((0,a.buildAPIBaseUrl)(i)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),p=i().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let i="/api/v1",l=encodeURIComponent(`tag=@${t}`);i+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${l}&expand=tag,track_tag_group`:`/tags?filter=${l}`,i+=`&order=tag&page=1&per_page=50&access_token=${s}`,fetch((0,a.buildAPIBaseUrl)(i)).then(o.fetchResponseHandler).then((t=>{let o=[...t.data];e&&(o=o.map((e=>e.tag))),n(o)})).catch(o.fetchErrorHandler)}),l),h=(i().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let i=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${i}&order=name&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),i().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();let i=(t=(0,o.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${i}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),i().debounce((async(e,t,n=!1,s)=>{const i=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let l=`/api/v1/summits/${e}/events`+(n?"/published":""),c=encodeURIComponent(`title=@${t}`);fetch((0,a.buildAPIBaseUrl)(`${l}?filter=${c}&order=title&access_token=${i}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(o.fetchErrorHandler)}),l),i().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l)),f=i().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l),g=i().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let i=encodeURIComponent(`company_name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${i}&expand=company,sponsorship&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),m=i().debounce(((e,t,n)=>{let s=(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let i=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${i}&&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),w=i().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l),k=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/languages"),{signal:t}).then(o.fetchResponseHandler).then((t=>{e(t.data)})).catch(o.fetchErrorHandler),_=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/countries"),{signal:t}).then(o.fetchResponseHandler).then((t=>{e(t.data)})).catch(o.fetchErrorHandler)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},4824:e=>{e.exports=require("superagent")},6530:e=>{e.exports=require("urijs")},6113:e=>{e.exports=require("crypto")}};var t=require("../../runtime.js");t.C(e);t.X(0,[5344],(()=>(e=>t(t.s=e))(4560)))})()}));
@@ -1 +1 @@
1
- "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{var e={id:4052,ids:[4052,3737,3451,4823,1813,1149]};e.modules={680:(e,t,n)=>{n.r(t),n.d(t,{default:()=>u});var r=n(6689),o=n.n(r),a=n(9953),s=n.n(a),c=n(7525);const i=["error","value","onChange","id","multi","summitId"];function l(){return l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l.apply(this,arguments)}function d(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}class u extends o().Component{constructor(e){super(e),this.handleChange=this.handleChange.bind(this),this.getSponsors=this.getSponsors.bind(this)}handleChange(e){let t={target:{id:this.props.id,value:e,type:"sponsorinput"}};this.props.onChange(t)}getSponsors(e,t){let{summitId:n}=this.props;if(!e)return Promise.resolve({options:[]});(0,c.querySponsors)(n,e,t)}render(){let e=this.props,{error:t,value:n,onChange:r,id:a,multi:c,summitId:u}=e,p=d(e,i),h=this.props.hasOwnProperty("error")&&""!=t,f=this.props.hasOwnProperty("multi");return o().createElement("div",null,o().createElement(s(),l({value:n,getOptionValue:e=>e.id,getOptionLabel:e=>`${e.company.name} (${e.sponsorship.label})`,onChange:this.handleChange,loadOptions:this.getSponsors,isMulti:f},p)),h&&o().createElement("p",{className:"error-label"},t))}}},4341:(e,t,n)=>{n(4656),n(3605),n(9732),n(886)},886:(e,t,n)=>{n.d(t,{getAccessToken:()=>p});var r=n(9732);n(4824),n(6113);const o=require("browser-tabs-lock");var a=n.n(o);n(6530),n(3856),n(4341);const s=new(a()),c="openstackuicore.lock.getTokenSilently",i="code",l="authInfo",d="nonce",u="pkce",p=async()=>{if(await(0,r.retryPromise)((()=>s.acquireLock(c,5e3)),10))try{let e=m();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:r,refreshToken:o}=e,a=y(),l=Math.floor(Date.now()/1e3);if(n-=20,l-r>n||null==t){if(console.log("getAccessToken access token expired"),a===i&&k()){if(!o)throw g(),Error("missing Refresh Token");let e=await h(o),{access_token:t,expires_in:n,refresh_token:r}=e;return void 0===r&&(r=null),f(t,n,r),t}throw g(),Error("Access Token Expired.")}return t}finally{await s.releaseLock(c)}throw Error("Lock acquire error.")},h=async e=>{let t=$(),n=w();const o={grant_type:"refresh_token",client_id:encodeURI(n),refresh_token:e};try{const e=await fetch(`${t}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(o)}).then((e=>{if(400===e.status){(0,r.getCurrentPathName)();throw(0,r.setSessionClearingState)(!0),Error(`${e.status} - ${e.statusText}`)}return e})).catch((function(e){throw Error(`Request failed: ${e.message}`)})),n=await e.json();let{access_token:a,refresh_token:s,expires_in:c}=n;return{access_token:a,refresh_token:s,expires_in:c}}catch(e){throw console.log(e),e}},f=(e,t,n=null,o=null)=>{let a=m(),s={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===n&&a&&(n=a.refreshToken),null===o&&a&&(o=a.idToken),n&&(s.refreshToken=n),o&&(s.idToken=o),(0,r.putOnLocalStorage)(l,JSON.stringify(s))},m=()=>{let e=(0,r.getFromLocalStorage)(l,!1);return null===e?null:JSON.parse(e)},g=()=>{if("undefined"!=typeof window)return(0,r.removeFromLocalStorage)(l),(0,r.removeFromLocalStorage)(d),void(0,r.removeFromLocalStorage)(u)},w=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,y=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",k=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),$=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null},3605:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>i,fetchResponseHandler:()=>l});n(4824),n(6530);const r=require("sweetalert2");var o=n.n(r),a=n(4656),s=n.n(a);n(9732),n(4341),n(886);const c=e=>t=>({type:e,payload:t}),i=(c("RESET_LOADING"),c("START_LOADING"),c("STOP_LOADING"),e=>{let t=e.status,n=e.statusText;switch(t){case 403:o().fire("ERROR",s().translate("errors.user_not_authz"),"warning");break;case 401:o().fire("ERROR",s().translate("errors.session_expired"),"error");break;case 412:o().fire("ERROR",n,"warning");case 500:o().fire("ERROR",s().translate("errors.server_error"),"error")}}),l=e=>{if(e.ok)return e.json();throw e},d=e=>e=(e=e.replace(/,/g,"\\,")).replace(/;/g,"\\;")},9732:(e,t,n)=>{n.d(t,{arraysEqual:()=>d,buildAPIBaseUrl:()=>o,getCurrentPathName:()=>r,getFromLocalStorage:()=>s,putOnLocalStorage:()=>a,removeFromLocalStorage:()=>c,retryPromise:()=>u,setSessionClearingState:()=>i,shallowEqual:()=>l});require("moment-timezone");n(6530),n(6113);const r=()=>"undefined"!=typeof window?window.location.pathname:null,o=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,a=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},s=(e,t)=>{if("undefined"!=typeof window){let n=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),c(e)),n}return null},c=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},i=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},l=(e,t)=>{const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0},d=(e,t)=>e.length===t.length&&e.every(((e,n)=>l(e,t[n]))),u=async(e,t=3)=>{for(let n=0;n<t;n++)if(await e())return!0;return!1}},7525:(e,t,n)=>{n.d(t,{getCountryList:()=>k,getLanguageList:()=>y,queryAccessLevels:()=>g,queryCompanies:()=>f,queryGroups:()=>h,queryMembers:()=>l,queryOrganizations:()=>w,querySpeakers:()=>u,querySponsors:()=>m,querySummits:()=>d,queryTags:()=>p});var r=n(3605),o=n(886),a=n(9732);const s=require("lodash");var c=n.n(s);const i=500,l=c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/members?filter=${s}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),i),d=c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),i),u=c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1";e&&(c+=`/summits/${e}`),c+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${s}&expand=member,registration_request`,fetch((0,a.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),i),p=c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1",i=encodeURIComponent(`tag=@${t}`);c+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${i}&expand=tag,track_tag_group`:`/tags?filter=${i}`,c+=`&order=tag&page=1&per_page=50&access_token=${s}`,fetch((0,a.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((t=>{let r=[...t.data];e&&(r=r.map((e=>e.tag))),n(r)})).catch(r.fetchErrorHandler)}),i),h=(c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${c}&order=name&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),i),c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();let c=(t=(0,r.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),i),c().debounce((async(e,t,n=!1,s)=>{const c=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let i=`/api/v1/summits/${e}/events`+(n?"/published":""),l=encodeURIComponent(`title=@${t}`);fetch((0,a.buildAPIBaseUrl)(`${i}?filter=${l}&order=title&access_token=${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(r.fetchErrorHandler)}),i),c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),i)),f=c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),i),m=c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`company_name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${c}&expand=company,sponsorship&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),i),g=c().debounce(((e,t,n)=>{let s=(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),i),w=c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),i),y=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/languages"),{signal:t}).then(r.fetchResponseHandler).then((t=>{e(t.data)})).catch(r.fetchErrorHandler),k=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/countries"),{signal:t}).then(r.fetchResponseHandler).then((t=>{e(t.data)})).catch(r.fetchErrorHandler)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},4824:e=>{e.exports=require("superagent")},6530:e=>{e.exports=require("urijs")},6113:e=>{e.exports=require("crypto")}};var t=require("../../runtime.js");t.C(e);t.X(0,[5344],(()=>(e=>t(t.s=e))(680)))})()}));
1
+ "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{var e={id:4052,ids:[4052,3737,7634,3451,4823,1813,1149]};e.modules={680:(e,t,n)=>{n.r(t),n.d(t,{default:()=>u});var o=n(6689),r=n.n(o),a=n(9953),s=n.n(a),c=n(7525);const l=["error","value","onChange","id","multi","summitId"];function i(){return i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},i.apply(this,arguments)}function d(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}class u extends r().Component{constructor(e){super(e),this.handleChange=this.handleChange.bind(this),this.getSponsors=this.getSponsors.bind(this)}handleChange(e){let t={target:{id:this.props.id,value:e,type:"sponsorinput"}};this.props.onChange(t)}getSponsors(e,t){let{summitId:n}=this.props;if(!e)return Promise.resolve({options:[]});(0,c.querySponsors)(n,e,t)}render(){let e=this.props,{error:t,value:n,onChange:o,id:a,multi:c,summitId:u}=e,p=d(e,l),h=this.props.hasOwnProperty("error")&&""!=t,f=this.props.hasOwnProperty("multi");return r().createElement("div",null,r().createElement(s(),i({value:n,getOptionValue:e=>e.id,getOptionLabel:e=>`${e.company.name} (${e.sponsorship.label})`,onChange:this.handleChange,loadOptions:this.getSponsors,isMulti:f},p)),h&&r().createElement("p",{className:"error-label"},t))}}},4341:(e,t,n)=>{n.d(t,{SET_LOGGED_USER:()=>o});n(4656),n(3605),n(9732),n(886);const o="SET_LOGGED_USER"},886:(e,t,n)=>{n.r(t),n.d(t,{ACCESS_TOKEN_SKEW_TIME:()=>w,RESPONSE_TYPE_CODE:()=>y,RESPONSE_TYPE_IMPLICIT:()=>_,clearAccessToken:()=>v,clearAuthInfo:()=>H,doLogin:()=>$,doLoginBasicLogin:()=>A,emitAccessToken:()=>U,getAccessToken:()=>T,getAuthInfo:()=>P,getAuthUrl:()=>I,getIdToken:()=>x,getLogoutUrl:()=>S,getOAuth2ClientId:()=>q,getOAuth2Flow:()=>B,getOAuth2IDPBaseUrl:()=>j,getOAuth2Scopes:()=>N,initLogOut:()=>V,passwordlessLogin:()=>M,passwordlessStart:()=>G,refreshAccessToken:()=>C,storeAuthInfo:()=>L,useOAuth2RefreshToken:()=>F,validateIdToken:()=>D});var o=n(9732),r=n(4824),a=n.n(r),s=n(6113);const c=require("browser-tabs-lock");var l=n.n(c),i=n(6530),d=n.n(i),u=n(3856),p=n.n(u),h=n(4341);let f=a();const g=new(l()),m="openstackuicore.lock.getTokenSilently",w=20,_="token id_token",y="code",k="authInfo",b="nonce",R="pkce",I=(e=null,t=null,n=null,r=null)=>{let a=q(),s=(0,o.getAuthCallback)(),c=j(),l=N(),i=B();null!=e&&(s+=`?BackUrl=${encodeURI(e)}`);let u=E(16);(0,o.putOnLocalStorage)(b,u);let p=d()(`${c}/oauth2/auth`),h={response_type:encodeURI(i),scope:encodeURI(l),nonce:u,response_mode:"fragment",client_id:encodeURI(a),redirect_uri:encodeURI(s)};if(i===y){const e=O();(0,o.putOnLocalStorage)(R,JSON.stringify(e)),h.code_challenge=e.codeChallenge,h.code_challenge_method="S256",h.approval_prompt="force"}return t&&(h.prompt=t),n&&(h.id_token_hint=n),r&&(h.provider=r),p=p.query(h),p},S=e=>{let t=j(),n=q(),r=d()(`${t}/oauth2/end-session`),a=E(16),s=(0,o.getOrigin)()+"/auth/logout";return(0,o.putOnLocalStorage)("post_logout_state",a),r.query({id_token_hint:e,post_logout_redirect_uri:encodeURI(s),client_id:encodeURI(n),state:a})},E=e=>{let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n="";for(let o=0;o<e;o++)n+=t.charAt(Math.floor(Math.random()*t.length));return n},$=(e=null,t=null,n=null)=>{let r=I(e,n,null,t);(0,o.getCurrentLocation)().replace(r.toString())},A=(e=null)=>{$(e,null,null)},O=()=>{const e=(0,o.base64URLEncode)((0,s.randomBytes)(64));return{codeVerifier:e,codeChallenge:(0,o.base64URLEncode)((0,o.sha256)(Buffer.from(e))),createdAt:new Date}},U=async(e,t=null)=>{let n=j(),r=q(),a=(0,o.getAuthCallback)(),s=JSON.parse((0,o.getFromLocalStorage)(R,!0));null!=t&&(a+=`?BackUrl=${encodeURI(t)}`);const c={code:e,grant_type:"authorization_code",code_verifier:s.codeVerifier,client_id:encodeURI(r),redirect_uri:encodeURI(a)};try{const e=await fetch(`${n}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(c)}).catch((function(e){console.log("Request failed:",e.message)})),t=await e.json();let{access_token:o,refresh_token:r,id_token:a,expires_in:s,error:l,error_description:i}=t;return{access_token:o,refresh_token:r,id_token:a,expires_in:s,error:l,error_description:i}}catch(e){console.log(e)}},v=async()=>{if(await(0,o.retryPromise)((()=>g.acquireLock(m,5e3)),10))try{let e=P();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:o,refreshToken:r}=e;L(null,0,r)}finally{await g.releaseLock(m)}},T=async()=>{if(await(0,o.retryPromise)((()=>g.acquireLock(m,5e3)),10))try{let e=P();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:o,refreshToken:r}=e,a=B(),s=Math.floor(Date.now()/1e3);if(n-=w,s-o>n||null==t){if(console.log("getAccessToken access token expired"),a===y&&F()){if(!r)throw H(),Error("missing Refresh Token");let e=await C(r),{access_token:t,expires_in:n,refresh_token:o}=e;return void 0===o&&(o=null),L(t,n,o),t}throw H(),Error("Access Token Expired.")}return t}finally{await g.releaseLock(m)}throw Error("Lock acquire error.")},C=async e=>{let t=j(),n=q();const r={grant_type:"refresh_token",client_id:encodeURI(n),refresh_token:e};try{const e=await fetch(`${t}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(r)}).then((e=>{if(400===e.status){(0,o.getCurrentPathName)();throw(0,o.setSessionClearingState)(!0),Error(`${e.status} - ${e.statusText}`)}return e})).catch((function(e){throw Error(`Request failed: ${e.message}`)})),n=await e.json();let{access_token:a,refresh_token:s,expires_in:c}=n;return{access_token:a,refresh_token:s,expires_in:c}}catch(e){throw console.log(e),e}},L=(e,t,n=null,r=null)=>{let a=P(),s={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===n&&a&&(n=a.refreshToken),null===r&&a&&(r=a.idToken),n&&(s.refreshToken=n),r&&(s.idToken=r),(0,o.putOnLocalStorage)(k,JSON.stringify(s))},P=()=>{let e=(0,o.getFromLocalStorage)(k,!1);return null===e?null:JSON.parse(e)},H=()=>{if("undefined"!=typeof window)return(0,o.removeFromLocalStorage)(k),(0,o.removeFromLocalStorage)(b),void(0,o.removeFromLocalStorage)(R)},x=()=>{if("undefined"!=typeof window){const e=P();return e?e.idToken:null}return null},q=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,B=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",F=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),j=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null,N=()=>"undefined"!=typeof window?window.SCOPES:null,V=()=>{(0,o.getCurrentLocation)().replace(S(x()).toString())},D=(e,t,n)=>{let r=new(p())({issuer:t,audience:n}),a=(0,o.getFromLocalStorage)(b,!0),s=r.decode(e),c=(s.header.alg,s.header.kid,s.payload.aud),l=s.payload.iss;s.payload.exp,s.payload.nbf;return(s.payload.nonce||null)==a&&c==n&&l==t},G=e=>{let t=q(),n=N(),r=E(16);(0,o.putOnLocalStorage)(b,r);let a=j(),s=d()(`${a}/oauth2/auth`),c={response_type:"otp",scope:encodeURI(n),nonce:r,client_id:encodeURI(t),connection:e.connection||"email",send:e.send||"code"};return e.hasOwnProperty("email")&&(c.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(c.phone_number=encodeURIComponent(e.phone_number)),f.post(s.toString()).send(c).then((e=>{let t=e.body;return Promise.resolve({response:t})})).catch((e=>Promise.reject(e)))},M=e=>t=>{let n=q(),o=N(),r=j(),a=d()(`${r}/oauth2/token`);if(!e.hasOwnProperty("otp"))throw Error("otp param is mandatory.");let s={grant_type:"passwordless",connection:e.connection||"email",scope:encodeURI(o),client_id:encodeURI(n),otp:e.otp};return e.hasOwnProperty("email")&&(s.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(s.phone_number=encodeURIComponent(e.phone_number)),f.post(a.toString()).send(s).then((e=>{try{let o=e.body,{access_token:a,expires_in:s,refresh_token:c,id_token:l}=o;if(void 0===c&&(c=null),void 0===l&&(l=null),l&&!D(l,r,n))throw Error("id token is not valid.");return L(a,s,c,l),t&&t({type:h.SET_LOGGED_USER,payload:{sessionState:null}}),Promise.resolve({response:o})}catch(e){return console.log(e),Promise.reject(e)}})).catch((e=>Promise.reject(e)))}},3605:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>l,fetchResponseHandler:()=>i});n(4824),n(6530);const o=require("sweetalert2");var r=n.n(o),a=n(4656),s=n.n(a);n(9732),n(4341),n(886);const c=e=>t=>({type:e,payload:t}),l=(c("RESET_LOADING"),c("START_LOADING"),c("STOP_LOADING"),e=>{let t=e.status,n=e.statusText;switch(t){case 403:r().fire("ERROR",s().translate("errors.user_not_authz"),"warning");break;case 401:r().fire("ERROR",s().translate("errors.session_expired"),"error");break;case 412:r().fire("ERROR",n,"warning");case 500:r().fire("ERROR",s().translate("errors.server_error"),"error")}}),i=e=>{if(e.ok)return e.json();throw e},d=e=>e=(e=e.replace(/,/g,"\\,")).replace(/;/g,"\\;")},9732:(e,t,n)=>{n.d(t,{arraysEqual:()=>f,base64URLEncode:()=>g,buildAPIBaseUrl:()=>l,getAuthCallback:()=>r,getCurrentLocation:()=>a,getCurrentPathName:()=>c,getFromLocalStorage:()=>d,getOrigin:()=>s,putOnLocalStorage:()=>i,removeFromLocalStorage:()=>u,retryPromise:()=>w,setSessionClearingState:()=>p,sha256:()=>m,shallowEqual:()=>h});require("moment-timezone");n(6530);var o=n(6113);const r=()=>"undefined"!=typeof window?`${window.location.origin}/auth/callback`:null,a=()=>{let e="";return"undefined"!=typeof window&&(e=window.location,window.top&&(e=window.top.location)),e},s=()=>"undefined"!=typeof window?window.location.origin:null,c=()=>"undefined"!=typeof window?window.location.pathname:null,l=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,i=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},d=(e,t)=>{if("undefined"!=typeof window){let n=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),u(e)),n}return null},u=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},p=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},h=(e,t)=>{const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(let o of n)if(e[o]!==t[o])return!1;return!0},f=(e,t)=>e.length===t.length&&e.every(((e,n)=>h(e,t[n]))),g=e=>e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),m=e=>(0,o.createHash)("sha256").update(e).digest(),w=async(e,t=3)=>{for(let n=0;n<t;n++)if(await e())return!0;return!1}},7525:(e,t,n)=>{n.d(t,{getCountryList:()=>y,getLanguageList:()=>_,queryAccessLevels:()=>m,queryCompanies:()=>f,queryGroups:()=>h,queryMembers:()=>i,queryOrganizations:()=>w,querySpeakers:()=>u,querySponsors:()=>g,querySummits:()=>d,queryTags:()=>p});var o=n(3605),r=n(886),a=n(9732);const s=require("lodash");var c=n.n(s);const l=500,i=c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/members?filter=${s}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l),d=c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l),u=c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c="/api/v1";e&&(c+=`/summits/${e}`),c+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${s}&expand=member,registration_request`,fetch((0,a.buildAPIBaseUrl)(c)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),p=c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c="/api/v1",l=encodeURIComponent(`tag=@${t}`);c+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${l}&expand=tag,track_tag_group`:`/tags?filter=${l}`,c+=`&order=tag&page=1&per_page=50&access_token=${s}`,fetch((0,a.buildAPIBaseUrl)(c)).then(o.fetchResponseHandler).then((t=>{let o=[...t.data];e&&(o=o.map((e=>e.tag))),n(o)})).catch(o.fetchErrorHandler)}),l),h=(c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${c}&order=name&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();let c=(t=(0,o.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${c}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),c().debounce((async(e,t,n=!1,s)=>{const c=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let l=`/api/v1/summits/${e}/events`+(n?"/published":""),i=encodeURIComponent(`title=@${t}`);fetch((0,a.buildAPIBaseUrl)(`${l}?filter=${i}&order=title&access_token=${c}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(o.fetchErrorHandler)}),l),c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l)),f=c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l),g=c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c=encodeURIComponent(`company_name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${c}&expand=company,sponsorship&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),m=c().debounce(((e,t,n)=>{let s=(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${c}&&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),w=c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l),_=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/languages"),{signal:t}).then(o.fetchResponseHandler).then((t=>{e(t.data)})).catch(o.fetchErrorHandler),y=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/countries"),{signal:t}).then(o.fetchResponseHandler).then((t=>{e(t.data)})).catch(o.fetchErrorHandler)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},4824:e=>{e.exports=require("superagent")},6530:e=>{e.exports=require("urijs")},6113:e=>{e.exports=require("crypto")}};var t=require("../../runtime.js");t.C(e);t.X(0,[5344],(()=>(e=>t(t.s=e))(680)))})()}));
@@ -1 +1 @@
1
- "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{var e={id:5883,ids:[5883,3737,3451,4823,1813,1149]};e.modules={9341:(e,t,n)=>{n.r(t),n.d(t,{default:()=>d});var r=n(6689),a=n.n(r),o=n(9953),s=n.n(o),c=n(7525);const i=["value","error","onChange","id","multi"];function l(){return l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l.apply(this,arguments)}function u(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}class d extends a().Component{constructor(e){super(e),this.state={value:e.value},this.handleChange=this.handleChange.bind(this),this.getSummits=this.getSummits.bind(this)}handleChange(e){let t={target:{id:this.props.id,value:e,type:"summitinput"}};this.props.onChange(t)}getSummits(e,t){if(!e)return Promise.resolve({options:[]});(0,c.querySummits)(e,t)}render(){let e=this.props,{value:t,error:n,onChange:r,id:o,multi:c}=e,d=u(e,i),p=this.props.hasOwnProperty("multi"),h=this.props.hasOwnProperty("error")&&""!=n;return a().createElement("div",null,a().createElement(s(),l({value:t,onChange:this.handleChange,loadOptions:this.getSummits,getOptionValue:e=>e.id,getOptionLabel:e=>`${e.name} (${e.id})`,isMulti:p},d)),h&&a().createElement("p",{className:"error-label"},n))}}},4341:(e,t,n)=>{n(4656),n(3605),n(9732),n(886)},886:(e,t,n)=>{n.d(t,{getAccessToken:()=>p});var r=n(9732);n(4824),n(6113);const a=require("browser-tabs-lock");var o=n.n(a);n(6530),n(3856),n(4341);const s=new(o()),c="openstackuicore.lock.getTokenSilently",i="code",l="authInfo",u="nonce",d="pkce",p=async()=>{if(await(0,r.retryPromise)((()=>s.acquireLock(c,5e3)),10))try{let e=m();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:r,refreshToken:a}=e,o=y(),l=Math.floor(Date.now()/1e3);if(n-=20,l-r>n||null==t){if(console.log("getAccessToken access token expired"),o===i&&k()){if(!a)throw g(),Error("missing Refresh Token");let e=await h(a),{access_token:t,expires_in:n,refresh_token:r}=e;return void 0===r&&(r=null),f(t,n,r),t}throw g(),Error("Access Token Expired.")}return t}finally{await s.releaseLock(c)}throw Error("Lock acquire error.")},h=async e=>{let t=$(),n=w();const a={grant_type:"refresh_token",client_id:encodeURI(n),refresh_token:e};try{const e=await fetch(`${t}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(a)}).then((e=>{if(400===e.status){(0,r.getCurrentPathName)();throw(0,r.setSessionClearingState)(!0),Error(`${e.status} - ${e.statusText}`)}return e})).catch((function(e){throw Error(`Request failed: ${e.message}`)})),n=await e.json();let{access_token:o,refresh_token:s,expires_in:c}=n;return{access_token:o,refresh_token:s,expires_in:c}}catch(e){throw console.log(e),e}},f=(e,t,n=null,a=null)=>{let o=m(),s={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===n&&o&&(n=o.refreshToken),null===a&&o&&(a=o.idToken),n&&(s.refreshToken=n),a&&(s.idToken=a),(0,r.putOnLocalStorage)(l,JSON.stringify(s))},m=()=>{let e=(0,r.getFromLocalStorage)(l,!1);return null===e?null:JSON.parse(e)},g=()=>{if("undefined"!=typeof window)return(0,r.removeFromLocalStorage)(l),(0,r.removeFromLocalStorage)(u),void(0,r.removeFromLocalStorage)(d)},w=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,y=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",k=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),$=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null},3605:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>u,fetchErrorHandler:()=>i,fetchResponseHandler:()=>l});n(4824),n(6530);const r=require("sweetalert2");var a=n.n(r),o=n(4656),s=n.n(o);n(9732),n(4341),n(886);const c=e=>t=>({type:e,payload:t}),i=(c("RESET_LOADING"),c("START_LOADING"),c("STOP_LOADING"),e=>{let t=e.status,n=e.statusText;switch(t){case 403:a().fire("ERROR",s().translate("errors.user_not_authz"),"warning");break;case 401:a().fire("ERROR",s().translate("errors.session_expired"),"error");break;case 412:a().fire("ERROR",n,"warning");case 500:a().fire("ERROR",s().translate("errors.server_error"),"error")}}),l=e=>{if(e.ok)return e.json();throw e},u=e=>e=(e=e.replace(/,/g,"\\,")).replace(/;/g,"\\;")},9732:(e,t,n)=>{n.d(t,{arraysEqual:()=>u,buildAPIBaseUrl:()=>a,getCurrentPathName:()=>r,getFromLocalStorage:()=>s,putOnLocalStorage:()=>o,removeFromLocalStorage:()=>c,retryPromise:()=>d,setSessionClearingState:()=>i,shallowEqual:()=>l});require("moment-timezone");n(6530),n(6113);const r=()=>"undefined"!=typeof window?window.location.pathname:null,a=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,o=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},s=(e,t)=>{if("undefined"!=typeof window){let n=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),c(e)),n}return null},c=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},i=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},l=(e,t)=>{const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0},u=(e,t)=>e.length===t.length&&e.every(((e,n)=>l(e,t[n]))),d=async(e,t=3)=>{for(let n=0;n<t;n++)if(await e())return!0;return!1}},7525:(e,t,n)=>{n.d(t,{getCountryList:()=>k,getLanguageList:()=>y,queryAccessLevels:()=>g,queryCompanies:()=>f,queryGroups:()=>h,queryMembers:()=>l,queryOrganizations:()=>w,querySpeakers:()=>d,querySponsors:()=>m,querySummits:()=>u,queryTags:()=>p});var r=n(3605),a=n(886),o=n(9732);const s=require("lodash");var c=n.n(s);const i=500,l=c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/members?filter=${s}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),i),u=c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),i),d=c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1";e&&(c+=`/summits/${e}`),c+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${s}&expand=member,registration_request`,fetch((0,o.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),i),p=c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1",i=encodeURIComponent(`tag=@${t}`);c+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${i}&expand=tag,track_tag_group`:`/tags?filter=${i}`,c+=`&order=tag&page=1&per_page=50&access_token=${s}`,fetch((0,o.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((t=>{let r=[...t.data];e&&(r=r.map((e=>e.tag))),n(r)})).catch(r.fetchErrorHandler)}),i),h=(c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${c}&order=name&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),i),c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();let c=(t=(0,r.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),i),c().debounce((async(e,t,n=!1,s)=>{const c=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let i=`/api/v1/summits/${e}/events`+(n?"/published":""),l=encodeURIComponent(`title=@${t}`);fetch((0,o.buildAPIBaseUrl)(`${i}?filter=${l}&order=title&access_token=${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(r.fetchErrorHandler)}),i),c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),i)),f=c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),i),m=c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`company_name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${c}&expand=company,sponsorship&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),i),g=c().debounce(((e,t,n)=>{let s=(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),i),w=c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),i),y=(e,t)=>fetch((0,o.buildAPIBaseUrl)("/api/public/v1/languages"),{signal:t}).then(r.fetchResponseHandler).then((t=>{e(t.data)})).catch(r.fetchErrorHandler),k=(e,t)=>fetch((0,o.buildAPIBaseUrl)("/api/public/v1/countries"),{signal:t}).then(r.fetchResponseHandler).then((t=>{e(t.data)})).catch(r.fetchErrorHandler)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},4824:e=>{e.exports=require("superagent")},6530:e=>{e.exports=require("urijs")},6113:e=>{e.exports=require("crypto")}};var t=require("../../runtime.js");t.C(e);t.X(0,[5344],(()=>(e=>t(t.s=e))(9341)))})()}));
1
+ "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{var e={id:5883,ids:[5883,3737,7634,3451,4823,1813,1149]};e.modules={9341:(e,t,n)=>{n.r(t),n.d(t,{default:()=>u});var o=n(6689),r=n.n(o),a=n(9953),s=n.n(a),c=n(7525);const i=["value","error","onChange","id","multi"];function l(){return l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},l.apply(this,arguments)}function d(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}class u extends r().Component{constructor(e){super(e),this.state={value:e.value},this.handleChange=this.handleChange.bind(this),this.getSummits=this.getSummits.bind(this)}handleChange(e){let t={target:{id:this.props.id,value:e,type:"summitinput"}};this.props.onChange(t)}getSummits(e,t){if(!e)return Promise.resolve({options:[]});(0,c.querySummits)(e,t)}render(){let e=this.props,{value:t,error:n,onChange:o,id:a,multi:c}=e,u=d(e,i),p=this.props.hasOwnProperty("multi"),h=this.props.hasOwnProperty("error")&&""!=n;return r().createElement("div",null,r().createElement(s(),l({value:t,onChange:this.handleChange,loadOptions:this.getSummits,getOptionValue:e=>e.id,getOptionLabel:e=>`${e.name} (${e.id})`,isMulti:p},u)),h&&r().createElement("p",{className:"error-label"},n))}}},4341:(e,t,n)=>{n.d(t,{SET_LOGGED_USER:()=>o});n(4656),n(3605),n(9732),n(886);const o="SET_LOGGED_USER"},886:(e,t,n)=>{n.r(t),n.d(t,{ACCESS_TOKEN_SKEW_TIME:()=>w,RESPONSE_TYPE_CODE:()=>y,RESPONSE_TYPE_IMPLICIT:()=>_,clearAccessToken:()=>v,clearAuthInfo:()=>H,doLogin:()=>$,doLoginBasicLogin:()=>A,emitAccessToken:()=>U,getAccessToken:()=>T,getAuthInfo:()=>P,getAuthUrl:()=>I,getIdToken:()=>x,getLogoutUrl:()=>S,getOAuth2ClientId:()=>q,getOAuth2Flow:()=>B,getOAuth2IDPBaseUrl:()=>j,getOAuth2Scopes:()=>N,initLogOut:()=>V,passwordlessLogin:()=>M,passwordlessStart:()=>G,refreshAccessToken:()=>C,storeAuthInfo:()=>L,useOAuth2RefreshToken:()=>F,validateIdToken:()=>D});var o=n(9732),r=n(4824),a=n.n(r),s=n(6113);const c=require("browser-tabs-lock");var i=n.n(c),l=n(6530),d=n.n(l),u=n(3856),p=n.n(u),h=n(4341);let f=a();const g=new(i()),m="openstackuicore.lock.getTokenSilently",w=20,_="token id_token",y="code",k="authInfo",R="nonce",b="pkce",I=(e=null,t=null,n=null,r=null)=>{let a=q(),s=(0,o.getAuthCallback)(),c=j(),i=N(),l=B();null!=e&&(s+=`?BackUrl=${encodeURI(e)}`);let u=E(16);(0,o.putOnLocalStorage)(R,u);let p=d()(`${c}/oauth2/auth`),h={response_type:encodeURI(l),scope:encodeURI(i),nonce:u,response_mode:"fragment",client_id:encodeURI(a),redirect_uri:encodeURI(s)};if(l===y){const e=O();(0,o.putOnLocalStorage)(b,JSON.stringify(e)),h.code_challenge=e.codeChallenge,h.code_challenge_method="S256",h.approval_prompt="force"}return t&&(h.prompt=t),n&&(h.id_token_hint=n),r&&(h.provider=r),p=p.query(h),p},S=e=>{let t=j(),n=q(),r=d()(`${t}/oauth2/end-session`),a=E(16),s=(0,o.getOrigin)()+"/auth/logout";return(0,o.putOnLocalStorage)("post_logout_state",a),r.query({id_token_hint:e,post_logout_redirect_uri:encodeURI(s),client_id:encodeURI(n),state:a})},E=e=>{let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n="";for(let o=0;o<e;o++)n+=t.charAt(Math.floor(Math.random()*t.length));return n},$=(e=null,t=null,n=null)=>{let r=I(e,n,null,t);(0,o.getCurrentLocation)().replace(r.toString())},A=(e=null)=>{$(e,null,null)},O=()=>{const e=(0,o.base64URLEncode)((0,s.randomBytes)(64));return{codeVerifier:e,codeChallenge:(0,o.base64URLEncode)((0,o.sha256)(Buffer.from(e))),createdAt:new Date}},U=async(e,t=null)=>{let n=j(),r=q(),a=(0,o.getAuthCallback)(),s=JSON.parse((0,o.getFromLocalStorage)(b,!0));null!=t&&(a+=`?BackUrl=${encodeURI(t)}`);const c={code:e,grant_type:"authorization_code",code_verifier:s.codeVerifier,client_id:encodeURI(r),redirect_uri:encodeURI(a)};try{const e=await fetch(`${n}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(c)}).catch((function(e){console.log("Request failed:",e.message)})),t=await e.json();let{access_token:o,refresh_token:r,id_token:a,expires_in:s,error:i,error_description:l}=t;return{access_token:o,refresh_token:r,id_token:a,expires_in:s,error:i,error_description:l}}catch(e){console.log(e)}},v=async()=>{if(await(0,o.retryPromise)((()=>g.acquireLock(m,5e3)),10))try{let e=P();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:o,refreshToken:r}=e;L(null,0,r)}finally{await g.releaseLock(m)}},T=async()=>{if(await(0,o.retryPromise)((()=>g.acquireLock(m,5e3)),10))try{let e=P();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:o,refreshToken:r}=e,a=B(),s=Math.floor(Date.now()/1e3);if(n-=w,s-o>n||null==t){if(console.log("getAccessToken access token expired"),a===y&&F()){if(!r)throw H(),Error("missing Refresh Token");let e=await C(r),{access_token:t,expires_in:n,refresh_token:o}=e;return void 0===o&&(o=null),L(t,n,o),t}throw H(),Error("Access Token Expired.")}return t}finally{await g.releaseLock(m)}throw Error("Lock acquire error.")},C=async e=>{let t=j(),n=q();const r={grant_type:"refresh_token",client_id:encodeURI(n),refresh_token:e};try{const e=await fetch(`${t}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(r)}).then((e=>{if(400===e.status){(0,o.getCurrentPathName)();throw(0,o.setSessionClearingState)(!0),Error(`${e.status} - ${e.statusText}`)}return e})).catch((function(e){throw Error(`Request failed: ${e.message}`)})),n=await e.json();let{access_token:a,refresh_token:s,expires_in:c}=n;return{access_token:a,refresh_token:s,expires_in:c}}catch(e){throw console.log(e),e}},L=(e,t,n=null,r=null)=>{let a=P(),s={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===n&&a&&(n=a.refreshToken),null===r&&a&&(r=a.idToken),n&&(s.refreshToken=n),r&&(s.idToken=r),(0,o.putOnLocalStorage)(k,JSON.stringify(s))},P=()=>{let e=(0,o.getFromLocalStorage)(k,!1);return null===e?null:JSON.parse(e)},H=()=>{if("undefined"!=typeof window)return(0,o.removeFromLocalStorage)(k),(0,o.removeFromLocalStorage)(R),void(0,o.removeFromLocalStorage)(b)},x=()=>{if("undefined"!=typeof window){const e=P();return e?e.idToken:null}return null},q=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,B=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",F=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),j=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null,N=()=>"undefined"!=typeof window?window.SCOPES:null,V=()=>{(0,o.getCurrentLocation)().replace(S(x()).toString())},D=(e,t,n)=>{let r=new(p())({issuer:t,audience:n}),a=(0,o.getFromLocalStorage)(R,!0),s=r.decode(e),c=(s.header.alg,s.header.kid,s.payload.aud),i=s.payload.iss;s.payload.exp,s.payload.nbf;return(s.payload.nonce||null)==a&&c==n&&i==t},G=e=>{let t=q(),n=N(),r=E(16);(0,o.putOnLocalStorage)(R,r);let a=j(),s=d()(`${a}/oauth2/auth`),c={response_type:"otp",scope:encodeURI(n),nonce:r,client_id:encodeURI(t),connection:e.connection||"email",send:e.send||"code"};return e.hasOwnProperty("email")&&(c.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(c.phone_number=encodeURIComponent(e.phone_number)),f.post(s.toString()).send(c).then((e=>{let t=e.body;return Promise.resolve({response:t})})).catch((e=>Promise.reject(e)))},M=e=>t=>{let n=q(),o=N(),r=j(),a=d()(`${r}/oauth2/token`);if(!e.hasOwnProperty("otp"))throw Error("otp param is mandatory.");let s={grant_type:"passwordless",connection:e.connection||"email",scope:encodeURI(o),client_id:encodeURI(n),otp:e.otp};return e.hasOwnProperty("email")&&(s.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(s.phone_number=encodeURIComponent(e.phone_number)),f.post(a.toString()).send(s).then((e=>{try{let o=e.body,{access_token:a,expires_in:s,refresh_token:c,id_token:i}=o;if(void 0===c&&(c=null),void 0===i&&(i=null),i&&!D(i,r,n))throw Error("id token is not valid.");return L(a,s,c,i),t&&t({type:h.SET_LOGGED_USER,payload:{sessionState:null}}),Promise.resolve({response:o})}catch(e){return console.log(e),Promise.reject(e)}})).catch((e=>Promise.reject(e)))}},3605:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>i,fetchResponseHandler:()=>l});n(4824),n(6530);const o=require("sweetalert2");var r=n.n(o),a=n(4656),s=n.n(a);n(9732),n(4341),n(886);const c=e=>t=>({type:e,payload:t}),i=(c("RESET_LOADING"),c("START_LOADING"),c("STOP_LOADING"),e=>{let t=e.status,n=e.statusText;switch(t){case 403:r().fire("ERROR",s().translate("errors.user_not_authz"),"warning");break;case 401:r().fire("ERROR",s().translate("errors.session_expired"),"error");break;case 412:r().fire("ERROR",n,"warning");case 500:r().fire("ERROR",s().translate("errors.server_error"),"error")}}),l=e=>{if(e.ok)return e.json();throw e},d=e=>e=(e=e.replace(/,/g,"\\,")).replace(/;/g,"\\;")},9732:(e,t,n)=>{n.d(t,{arraysEqual:()=>f,base64URLEncode:()=>g,buildAPIBaseUrl:()=>i,getAuthCallback:()=>r,getCurrentLocation:()=>a,getCurrentPathName:()=>c,getFromLocalStorage:()=>d,getOrigin:()=>s,putOnLocalStorage:()=>l,removeFromLocalStorage:()=>u,retryPromise:()=>w,setSessionClearingState:()=>p,sha256:()=>m,shallowEqual:()=>h});require("moment-timezone");n(6530);var o=n(6113);const r=()=>"undefined"!=typeof window?`${window.location.origin}/auth/callback`:null,a=()=>{let e="";return"undefined"!=typeof window&&(e=window.location,window.top&&(e=window.top.location)),e},s=()=>"undefined"!=typeof window?window.location.origin:null,c=()=>"undefined"!=typeof window?window.location.pathname:null,i=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,l=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},d=(e,t)=>{if("undefined"!=typeof window){let n=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),u(e)),n}return null},u=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},p=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},h=(e,t)=>{const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(let o of n)if(e[o]!==t[o])return!1;return!0},f=(e,t)=>e.length===t.length&&e.every(((e,n)=>h(e,t[n]))),g=e=>e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),m=e=>(0,o.createHash)("sha256").update(e).digest(),w=async(e,t=3)=>{for(let n=0;n<t;n++)if(await e())return!0;return!1}},7525:(e,t,n)=>{n.d(t,{getCountryList:()=>y,getLanguageList:()=>_,queryAccessLevels:()=>m,queryCompanies:()=>f,queryGroups:()=>h,queryMembers:()=>l,queryOrganizations:()=>w,querySpeakers:()=>u,querySponsors:()=>g,querySummits:()=>d,queryTags:()=>p});var o=n(3605),r=n(886),a=n(9732);const s=require("lodash");var c=n.n(s);const i=500,l=c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/members?filter=${s}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),i),d=c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),i),u=c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c="/api/v1";e&&(c+=`/summits/${e}`),c+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${s}&expand=member,registration_request`,fetch((0,a.buildAPIBaseUrl)(c)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),i),p=c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c="/api/v1",i=encodeURIComponent(`tag=@${t}`);c+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${i}&expand=tag,track_tag_group`:`/tags?filter=${i}`,c+=`&order=tag&page=1&per_page=50&access_token=${s}`,fetch((0,a.buildAPIBaseUrl)(c)).then(o.fetchResponseHandler).then((t=>{let o=[...t.data];e&&(o=o.map((e=>e.tag))),n(o)})).catch(o.fetchErrorHandler)}),i),h=(c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${c}&order=name&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),i),c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();let c=(t=(0,o.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${c}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),i),c().debounce((async(e,t,n=!1,s)=>{const c=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let i=`/api/v1/summits/${e}/events`+(n?"/published":""),l=encodeURIComponent(`title=@${t}`);fetch((0,a.buildAPIBaseUrl)(`${i}?filter=${l}&order=title&access_token=${c}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(o.fetchErrorHandler)}),i),c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),i)),f=c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),i),g=c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c=encodeURIComponent(`company_name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${c}&expand=company,sponsorship&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),i),m=c().debounce(((e,t,n)=>{let s=(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${c}&&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),i),w=c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),i),_=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/languages"),{signal:t}).then(o.fetchResponseHandler).then((t=>{e(t.data)})).catch(o.fetchErrorHandler),y=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/countries"),{signal:t}).then(o.fetchResponseHandler).then((t=>{e(t.data)})).catch(o.fetchErrorHandler)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},4824:e=>{e.exports=require("superagent")},6530:e=>{e.exports=require("urijs")},6113:e=>{e.exports=require("crypto")}};var t=require("../../runtime.js");t.C(e);t.X(0,[5344],(()=>(e=>t(t.s=e))(9341)))})()}));
@@ -1 +1 @@
1
- "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{var e={id:5693,ids:[5693,3737,3451,4823,1813,1149]};e.modules={8064:(e,t,n)=>{n.r(t),n.d(t,{default:()=>u});var r=n(6689),a=n.n(r),o=n(9953),s=n.n(o),c=n(7525),l=n(9732);const i=["className","error"];function d(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}class u extends a().Component{constructor(e){super(e),this.state={value:e.value.map((e=>({tag:e.tag})))},this.handleChange=this.handleChange.bind(this),this.getTags=this.getTags.bind(this)}componentDidUpdate(e,t,n){if(!(0,l.shallowEqual)(this.props.value,e.value)){let e=this.props.value.map((e=>({tag:e.tag})));this.setState({value:e})}}handleChange(e){let t={target:{id:this.props.id,value:e,type:"taginput"}};this.props.onChange(t)}getTags(e,t){if(!e)return Promise.resolve({options:[]});let n=this.props.hasOwnProperty("summitId")?this.props.summitId:null;(0,c.queryTags)(n,e,t)}render(){let e=this.props,{className:t,error:n}=e,r=(d(e,i),this.props.hasOwnProperty("error")&&""!=n),o=this.state.value.sort(((e,t)=>e.tag.toLowerCase()>t.tag.toLowerCase()?1:e.tag.toLowerCase()<t.tag.toLowerCase()?-1:0));return a().createElement("div",null,a().createElement(s(),{className:t+" "+(r?"error":""),isMulti:!0,value:o,onChange:this.handleChange,loadOptions:this.getTags,getOptionLabel:e=>e.tag,getOptionValue:e=>e.tag}),r&&a().createElement("p",{className:"error-label"},n))}}},4341:(e,t,n)=>{n(4656),n(3605),n(9732),n(886)},886:(e,t,n)=>{n.d(t,{getAccessToken:()=>p});var r=n(9732);n(4824),n(6113);const a=require("browser-tabs-lock");var o=n.n(a);n(6530),n(3856),n(4341);const s=new(o()),c="openstackuicore.lock.getTokenSilently",l="code",i="authInfo",d="nonce",u="pkce",p=async()=>{if(await(0,r.retryPromise)((()=>s.acquireLock(c,5e3)),10))try{let e=g();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:r,refreshToken:a}=e,o=k(),i=Math.floor(Date.now()/1e3);if(n-=20,i-r>n||null==t){if(console.log("getAccessToken access token expired"),o===l&&y()){if(!a)throw m(),Error("missing Refresh Token");let e=await h(a),{access_token:t,expires_in:n,refresh_token:r}=e;return void 0===r&&(r=null),f(t,n,r),t}throw m(),Error("Access Token Expired.")}return t}finally{await s.releaseLock(c)}throw Error("Lock acquire error.")},h=async e=>{let t=$(),n=w();const a={grant_type:"refresh_token",client_id:encodeURI(n),refresh_token:e};try{const e=await fetch(`${t}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(a)}).then((e=>{if(400===e.status){(0,r.getCurrentPathName)();throw(0,r.setSessionClearingState)(!0),Error(`${e.status} - ${e.statusText}`)}return e})).catch((function(e){throw Error(`Request failed: ${e.message}`)})),n=await e.json();let{access_token:o,refresh_token:s,expires_in:c}=n;return{access_token:o,refresh_token:s,expires_in:c}}catch(e){throw console.log(e),e}},f=(e,t,n=null,a=null)=>{let o=g(),s={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===n&&o&&(n=o.refreshToken),null===a&&o&&(a=o.idToken),n&&(s.refreshToken=n),a&&(s.idToken=a),(0,r.putOnLocalStorage)(i,JSON.stringify(s))},g=()=>{let e=(0,r.getFromLocalStorage)(i,!1);return null===e?null:JSON.parse(e)},m=()=>{if("undefined"!=typeof window)return(0,r.removeFromLocalStorage)(i),(0,r.removeFromLocalStorage)(d),void(0,r.removeFromLocalStorage)(u)},w=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,k=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",y=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),$=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null},3605:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>l,fetchResponseHandler:()=>i});n(4824),n(6530);const r=require("sweetalert2");var a=n.n(r),o=n(4656),s=n.n(o);n(9732),n(4341),n(886);const c=e=>t=>({type:e,payload:t}),l=(c("RESET_LOADING"),c("START_LOADING"),c("STOP_LOADING"),e=>{let t=e.status,n=e.statusText;switch(t){case 403:a().fire("ERROR",s().translate("errors.user_not_authz"),"warning");break;case 401:a().fire("ERROR",s().translate("errors.session_expired"),"error");break;case 412:a().fire("ERROR",n,"warning");case 500:a().fire("ERROR",s().translate("errors.server_error"),"error")}}),i=e=>{if(e.ok)return e.json();throw e},d=e=>e=(e=e.replace(/,/g,"\\,")).replace(/;/g,"\\;")},9732:(e,t,n)=>{n.d(t,{arraysEqual:()=>d,buildAPIBaseUrl:()=>a,getCurrentPathName:()=>r,getFromLocalStorage:()=>s,putOnLocalStorage:()=>o,removeFromLocalStorage:()=>c,retryPromise:()=>u,setSessionClearingState:()=>l,shallowEqual:()=>i});require("moment-timezone");n(6530),n(6113);const r=()=>"undefined"!=typeof window?window.location.pathname:null,a=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,o=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},s=(e,t)=>{if("undefined"!=typeof window){let n=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),c(e)),n}return null},c=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},l=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},i=(e,t)=>{const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0},d=(e,t)=>e.length===t.length&&e.every(((e,n)=>i(e,t[n]))),u=async(e,t=3)=>{for(let n=0;n<t;n++)if(await e())return!0;return!1}},7525:(e,t,n)=>{n.d(t,{getCountryList:()=>y,getLanguageList:()=>k,queryAccessLevels:()=>m,queryCompanies:()=>f,queryGroups:()=>h,queryMembers:()=>i,queryOrganizations:()=>w,querySpeakers:()=>u,querySponsors:()=>g,querySummits:()=>d,queryTags:()=>p});var r=n(3605),a=n(886),o=n(9732);const s=require("lodash");var c=n.n(s);const l=500,i=c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/members?filter=${s}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),l),d=c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),l),u=c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1";e&&(c+=`/summits/${e}`),c+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${s}&expand=member,registration_request`,fetch((0,o.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),l),p=c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1",l=encodeURIComponent(`tag=@${t}`);c+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${l}&expand=tag,track_tag_group`:`/tags?filter=${l}`,c+=`&order=tag&page=1&per_page=50&access_token=${s}`,fetch((0,o.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((t=>{let r=[...t.data];e&&(r=r.map((e=>e.tag))),n(r)})).catch(r.fetchErrorHandler)}),l),h=(c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${c}&order=name&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),l),c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();let c=(t=(0,r.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),l),c().debounce((async(e,t,n=!1,s)=>{const c=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let l=`/api/v1/summits/${e}/events`+(n?"/published":""),i=encodeURIComponent(`title=@${t}`);fetch((0,o.buildAPIBaseUrl)(`${l}?filter=${i}&order=title&access_token=${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(r.fetchErrorHandler)}),l),c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),l)),f=c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),l),g=c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`company_name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${c}&expand=company,sponsorship&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),l),m=c().debounce(((e,t,n)=>{let s=(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),l),w=c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),l),k=(e,t)=>fetch((0,o.buildAPIBaseUrl)("/api/public/v1/languages"),{signal:t}).then(r.fetchResponseHandler).then((t=>{e(t.data)})).catch(r.fetchErrorHandler),y=(e,t)=>fetch((0,o.buildAPIBaseUrl)("/api/public/v1/countries"),{signal:t}).then(r.fetchResponseHandler).then((t=>{e(t.data)})).catch(r.fetchErrorHandler)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},4824:e=>{e.exports=require("superagent")},6530:e=>{e.exports=require("urijs")},6113:e=>{e.exports=require("crypto")}};var t=require("../../runtime.js");t.C(e);t.X(0,[5344],(()=>(e=>t(t.s=e))(8064)))})()}));
1
+ "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{var e={id:5693,ids:[5693,3737,7634,3451,4823,1813,1149]};e.modules={8064:(e,t,n)=>{n.r(t),n.d(t,{default:()=>u});var o=n(6689),r=n.n(o),a=n(9953),s=n.n(a),c=n(7525),l=n(9732);const i=["className","error"];function d(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}class u extends r().Component{constructor(e){super(e),this.state={value:e.value.map((e=>({tag:e.tag})))},this.handleChange=this.handleChange.bind(this),this.getTags=this.getTags.bind(this)}componentDidUpdate(e,t,n){if(!(0,l.shallowEqual)(this.props.value,e.value)){let e=this.props.value.map((e=>({tag:e.tag})));this.setState({value:e})}}handleChange(e){let t={target:{id:this.props.id,value:e,type:"taginput"}};this.props.onChange(t)}getTags(e,t){if(!e)return Promise.resolve({options:[]});let n=this.props.hasOwnProperty("summitId")?this.props.summitId:null;(0,c.queryTags)(n,e,t)}render(){let e=this.props,{className:t,error:n}=e,o=(d(e,i),this.props.hasOwnProperty("error")&&""!=n),a=this.state.value.sort(((e,t)=>e.tag.toLowerCase()>t.tag.toLowerCase()?1:e.tag.toLowerCase()<t.tag.toLowerCase()?-1:0));return r().createElement("div",null,r().createElement(s(),{className:t+" "+(o?"error":""),isMulti:!0,value:a,onChange:this.handleChange,loadOptions:this.getTags,getOptionLabel:e=>e.tag,getOptionValue:e=>e.tag}),o&&r().createElement("p",{className:"error-label"},n))}}},4341:(e,t,n)=>{n.d(t,{SET_LOGGED_USER:()=>o});n(4656),n(3605),n(9732),n(886);const o="SET_LOGGED_USER"},886:(e,t,n)=>{n.r(t),n.d(t,{ACCESS_TOKEN_SKEW_TIME:()=>w,RESPONSE_TYPE_CODE:()=>y,RESPONSE_TYPE_IMPLICIT:()=>_,clearAccessToken:()=>O,clearAuthInfo:()=>H,doLogin:()=>A,doLoginBasicLogin:()=>U,emitAccessToken:()=>T,getAccessToken:()=>v,getAuthInfo:()=>P,getAuthUrl:()=>b,getIdToken:()=>q,getLogoutUrl:()=>E,getOAuth2ClientId:()=>x,getOAuth2Flow:()=>B,getOAuth2IDPBaseUrl:()=>j,getOAuth2Scopes:()=>N,initLogOut:()=>V,passwordlessLogin:()=>M,passwordlessStart:()=>G,refreshAccessToken:()=>L,storeAuthInfo:()=>C,useOAuth2RefreshToken:()=>F,validateIdToken:()=>D});var o=n(9732),r=n(4824),a=n.n(r),s=n(6113);const c=require("browser-tabs-lock");var l=n.n(c),i=n(6530),d=n.n(i),u=n(3856),p=n.n(u),h=n(4341);let f=a();const g=new(l()),m="openstackuicore.lock.getTokenSilently",w=20,_="token id_token",y="code",k="authInfo",R="nonce",I="pkce",b=(e=null,t=null,n=null,r=null)=>{let a=x(),s=(0,o.getAuthCallback)(),c=j(),l=N(),i=B();null!=e&&(s+=`?BackUrl=${encodeURI(e)}`);let u=S(16);(0,o.putOnLocalStorage)(R,u);let p=d()(`${c}/oauth2/auth`),h={response_type:encodeURI(i),scope:encodeURI(l),nonce:u,response_mode:"fragment",client_id:encodeURI(a),redirect_uri:encodeURI(s)};if(i===y){const e=$();(0,o.putOnLocalStorage)(I,JSON.stringify(e)),h.code_challenge=e.codeChallenge,h.code_challenge_method="S256",h.approval_prompt="force"}return t&&(h.prompt=t),n&&(h.id_token_hint=n),r&&(h.provider=r),p=p.query(h),p},E=e=>{let t=j(),n=x(),r=d()(`${t}/oauth2/end-session`),a=S(16),s=(0,o.getOrigin)()+"/auth/logout";return(0,o.putOnLocalStorage)("post_logout_state",a),r.query({id_token_hint:e,post_logout_redirect_uri:encodeURI(s),client_id:encodeURI(n),state:a})},S=e=>{let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n="";for(let o=0;o<e;o++)n+=t.charAt(Math.floor(Math.random()*t.length));return n},A=(e=null,t=null,n=null)=>{let r=b(e,n,null,t);(0,o.getCurrentLocation)().replace(r.toString())},U=(e=null)=>{A(e,null,null)},$=()=>{const e=(0,o.base64URLEncode)((0,s.randomBytes)(64));return{codeVerifier:e,codeChallenge:(0,o.base64URLEncode)((0,o.sha256)(Buffer.from(e))),createdAt:new Date}},T=async(e,t=null)=>{let n=j(),r=x(),a=(0,o.getAuthCallback)(),s=JSON.parse((0,o.getFromLocalStorage)(I,!0));null!=t&&(a+=`?BackUrl=${encodeURI(t)}`);const c={code:e,grant_type:"authorization_code",code_verifier:s.codeVerifier,client_id:encodeURI(r),redirect_uri:encodeURI(a)};try{const e=await fetch(`${n}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(c)}).catch((function(e){console.log("Request failed:",e.message)})),t=await e.json();let{access_token:o,refresh_token:r,id_token:a,expires_in:s,error:l,error_description:i}=t;return{access_token:o,refresh_token:r,id_token:a,expires_in:s,error:l,error_description:i}}catch(e){console.log(e)}},O=async()=>{if(await(0,o.retryPromise)((()=>g.acquireLock(m,5e3)),10))try{let e=P();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:o,refreshToken:r}=e;C(null,0,r)}finally{await g.releaseLock(m)}},v=async()=>{if(await(0,o.retryPromise)((()=>g.acquireLock(m,5e3)),10))try{let e=P();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:o,refreshToken:r}=e,a=B(),s=Math.floor(Date.now()/1e3);if(n-=w,s-o>n||null==t){if(console.log("getAccessToken access token expired"),a===y&&F()){if(!r)throw H(),Error("missing Refresh Token");let e=await L(r),{access_token:t,expires_in:n,refresh_token:o}=e;return void 0===o&&(o=null),C(t,n,o),t}throw H(),Error("Access Token Expired.")}return t}finally{await g.releaseLock(m)}throw Error("Lock acquire error.")},L=async e=>{let t=j(),n=x();const r={grant_type:"refresh_token",client_id:encodeURI(n),refresh_token:e};try{const e=await fetch(`${t}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(r)}).then((e=>{if(400===e.status){(0,o.getCurrentPathName)();throw(0,o.setSessionClearingState)(!0),Error(`${e.status} - ${e.statusText}`)}return e})).catch((function(e){throw Error(`Request failed: ${e.message}`)})),n=await e.json();let{access_token:a,refresh_token:s,expires_in:c}=n;return{access_token:a,refresh_token:s,expires_in:c}}catch(e){throw console.log(e),e}},C=(e,t,n=null,r=null)=>{let a=P(),s={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===n&&a&&(n=a.refreshToken),null===r&&a&&(r=a.idToken),n&&(s.refreshToken=n),r&&(s.idToken=r),(0,o.putOnLocalStorage)(k,JSON.stringify(s))},P=()=>{let e=(0,o.getFromLocalStorage)(k,!1);return null===e?null:JSON.parse(e)},H=()=>{if("undefined"!=typeof window)return(0,o.removeFromLocalStorage)(k),(0,o.removeFromLocalStorage)(R),void(0,o.removeFromLocalStorage)(I)},q=()=>{if("undefined"!=typeof window){const e=P();return e?e.idToken:null}return null},x=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,B=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",F=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),j=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null,N=()=>"undefined"!=typeof window?window.SCOPES:null,V=()=>{(0,o.getCurrentLocation)().replace(E(q()).toString())},D=(e,t,n)=>{let r=new(p())({issuer:t,audience:n}),a=(0,o.getFromLocalStorage)(R,!0),s=r.decode(e),c=(s.header.alg,s.header.kid,s.payload.aud),l=s.payload.iss;s.payload.exp,s.payload.nbf;return(s.payload.nonce||null)==a&&c==n&&l==t},G=e=>{let t=x(),n=N(),r=S(16);(0,o.putOnLocalStorage)(R,r);let a=j(),s=d()(`${a}/oauth2/auth`),c={response_type:"otp",scope:encodeURI(n),nonce:r,client_id:encodeURI(t),connection:e.connection||"email",send:e.send||"code"};return e.hasOwnProperty("email")&&(c.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(c.phone_number=encodeURIComponent(e.phone_number)),f.post(s.toString()).send(c).then((e=>{let t=e.body;return Promise.resolve({response:t})})).catch((e=>Promise.reject(e)))},M=e=>t=>{let n=x(),o=N(),r=j(),a=d()(`${r}/oauth2/token`);if(!e.hasOwnProperty("otp"))throw Error("otp param is mandatory.");let s={grant_type:"passwordless",connection:e.connection||"email",scope:encodeURI(o),client_id:encodeURI(n),otp:e.otp};return e.hasOwnProperty("email")&&(s.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(s.phone_number=encodeURIComponent(e.phone_number)),f.post(a.toString()).send(s).then((e=>{try{let o=e.body,{access_token:a,expires_in:s,refresh_token:c,id_token:l}=o;if(void 0===c&&(c=null),void 0===l&&(l=null),l&&!D(l,r,n))throw Error("id token is not valid.");return C(a,s,c,l),t&&t({type:h.SET_LOGGED_USER,payload:{sessionState:null}}),Promise.resolve({response:o})}catch(e){return console.log(e),Promise.reject(e)}})).catch((e=>Promise.reject(e)))}},3605:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>l,fetchResponseHandler:()=>i});n(4824),n(6530);const o=require("sweetalert2");var r=n.n(o),a=n(4656),s=n.n(a);n(9732),n(4341),n(886);const c=e=>t=>({type:e,payload:t}),l=(c("RESET_LOADING"),c("START_LOADING"),c("STOP_LOADING"),e=>{let t=e.status,n=e.statusText;switch(t){case 403:r().fire("ERROR",s().translate("errors.user_not_authz"),"warning");break;case 401:r().fire("ERROR",s().translate("errors.session_expired"),"error");break;case 412:r().fire("ERROR",n,"warning");case 500:r().fire("ERROR",s().translate("errors.server_error"),"error")}}),i=e=>{if(e.ok)return e.json();throw e},d=e=>e=(e=e.replace(/,/g,"\\,")).replace(/;/g,"\\;")},9732:(e,t,n)=>{n.d(t,{arraysEqual:()=>f,base64URLEncode:()=>g,buildAPIBaseUrl:()=>l,getAuthCallback:()=>r,getCurrentLocation:()=>a,getCurrentPathName:()=>c,getFromLocalStorage:()=>d,getOrigin:()=>s,putOnLocalStorage:()=>i,removeFromLocalStorage:()=>u,retryPromise:()=>w,setSessionClearingState:()=>p,sha256:()=>m,shallowEqual:()=>h});require("moment-timezone");n(6530);var o=n(6113);const r=()=>"undefined"!=typeof window?`${window.location.origin}/auth/callback`:null,a=()=>{let e="";return"undefined"!=typeof window&&(e=window.location,window.top&&(e=window.top.location)),e},s=()=>"undefined"!=typeof window?window.location.origin:null,c=()=>"undefined"!=typeof window?window.location.pathname:null,l=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,i=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},d=(e,t)=>{if("undefined"!=typeof window){let n=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),u(e)),n}return null},u=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},p=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},h=(e,t)=>{const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(let o of n)if(e[o]!==t[o])return!1;return!0},f=(e,t)=>e.length===t.length&&e.every(((e,n)=>h(e,t[n]))),g=e=>e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),m=e=>(0,o.createHash)("sha256").update(e).digest(),w=async(e,t=3)=>{for(let n=0;n<t;n++)if(await e())return!0;return!1}},7525:(e,t,n)=>{n.d(t,{getCountryList:()=>y,getLanguageList:()=>_,queryAccessLevels:()=>m,queryCompanies:()=>f,queryGroups:()=>h,queryMembers:()=>i,queryOrganizations:()=>w,querySpeakers:()=>u,querySponsors:()=>g,querySummits:()=>d,queryTags:()=>p});var o=n(3605),r=n(886),a=n(9732);const s=require("lodash");var c=n.n(s);const l=500,i=c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/members?filter=${s}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l),d=c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l),u=c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c="/api/v1";e&&(c+=`/summits/${e}`),c+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${s}&expand=member,registration_request`,fetch((0,a.buildAPIBaseUrl)(c)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),p=c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c="/api/v1",l=encodeURIComponent(`tag=@${t}`);c+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${l}&expand=tag,track_tag_group`:`/tags?filter=${l}`,c+=`&order=tag&page=1&per_page=50&access_token=${s}`,fetch((0,a.buildAPIBaseUrl)(c)).then(o.fetchResponseHandler).then((t=>{let o=[...t.data];e&&(o=o.map((e=>e.tag))),n(o)})).catch(o.fetchErrorHandler)}),l),h=(c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${c}&order=name&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();let c=(t=(0,o.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${c}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),c().debounce((async(e,t,n=!1,s)=>{const c=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let l=`/api/v1/summits/${e}/events`+(n?"/published":""),i=encodeURIComponent(`title=@${t}`);fetch((0,a.buildAPIBaseUrl)(`${l}?filter=${i}&order=title&access_token=${c}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(o.fetchErrorHandler)}),l),c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l)),f=c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l),g=c().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c=encodeURIComponent(`company_name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${c}&expand=company,sponsorship&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),m=c().debounce(((e,t,n)=>{let s=(0,r.getAccessToken)();t=(0,o.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${c}&&access_token=${s}`)).then(o.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(o.fetchErrorHandler)}),l),w=c().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,o.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(o.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(o.fetchErrorHandler)}),l),_=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/languages"),{signal:t}).then(o.fetchResponseHandler).then((t=>{e(t.data)})).catch(o.fetchErrorHandler),y=(e,t)=>fetch((0,a.buildAPIBaseUrl)("/api/public/v1/countries"),{signal:t}).then(o.fetchResponseHandler).then((t=>{e(t.data)})).catch(o.fetchErrorHandler)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},4824:e=>{e.exports=require("superagent")},6530:e=>{e.exports=require("urijs")},6113:e=>{e.exports=require("crypto")}};var t=require("../../runtime.js");t.C(e);t.X(0,[5344],(()=>(e=>t(t.s=e))(8064)))})()}));
@@ -1 +1 @@
1
- "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{var e={id:7286,ids:[7286,1813]};e.modules={4149:(e,t,r)=>{r.r(t),r.d(t,{default:()=>S});var n=r(6689),o=r.n(n);const i=require("prop-types");var a=r.n(i);const s=require("immutability-helper");var c=r.n(s),d=r(7964),l=r(359),p=r.n(l);class u extends o().Component{constructor(e){super(e)}render(){return o().createElement("th",{width:this.props.width},this.props.children)}}const h=u,m=e=>o().createElement("td",e,e.children);class g extends o().Component{constructor(e){super(e),this.handleAction=this.handleAction.bind(this)}shouldDisplayAction(e){let{id:t}=this.props;return!e.hasOwnProperty("display")||e.display(t)}handleAction(e,t,r){r.stopPropagation(),r.preventDefault(),e(t)}render(){let{actions:e,id:t}=this.props;return o().createElement("td",{className:"actions",key:"actions"},e.hasOwnProperty("edit")&&this.shouldDisplayAction(e.edit)&&o().createElement("a",{href:"","data-tip":"edit",onClick:this.handleAction.bind(this,e.edit.onClick,t)},o().createElement("i",{className:"fa fa-pencil-square-o"})),e.hasOwnProperty("delete")&&this.shouldDisplayAction(e.delete)&&o().createElement("a",{href:"","data-tip":"delete",onClick:this.handleAction.bind(this,e.delete.onClick,t)},o().createElement("i",{className:"fa fa-trash-o delete-icon"})),"custom"in e&&e.custom.map((e=>this.shouldDisplayAction(e,t)&&o().createElement("a",{href:"","data-tip":e.tooltip,key:"custom_"+e.name,onClick:this.handleAction.bind(this,e.onClick,t)},e.icon))))}}const f=require("react-dom");function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function w(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach((function(t){b(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function b(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const v={border:"1px dashed gray",padding:"0.5rem 1rem",marginBottom:".5rem",backgroundColor:"white",cursor:"move"},D={beginDrag:e=>({id:e.id,index:e.index}),endDrag(e,t){t.didDrop()&&e.dropCard(e.id,e.index)}},O={hover(e,t,r){const n=t.getItem().index,o=e.index;if(n===o)return;const i=(0,f.findDOMNode)(r).getBoundingClientRect(),a=(i.bottom-i.top)/2,s=t.getClientOffset().y-i.top;n<o&&s<a||n>o&&s>a||(e.moveCard(n,o),t.getItem().index=o)}};class E extends o().Component{render(){const{text:e,isDragging:t,connectDragSource:r,connectDropTarget:n,children:i,even:a,id:s}=this.props,c=t?0:1;return r(n(o().createElement("tr",{id:s,role:"row",className:a?"even":"odd",style:w(w({},v),{},{opacity:c})},i)))}}E.propTypes={connectDragSource:a().func.isRequired,connectDropTarget:a().func.isRequired,index:a().number.isRequired,isDragging:a().bool.isRequired,id:a().any.isRequired,moveCard:a().func.isRequired};const q=(0,d.DragSource)("card",D,((e,t)=>({connectDragSource:e.dragSource(),isDragging:t.isDragging()})))((0,d.DropTarget)("card",O,(e=>({connectDropTarget:e.dropTarget()})))(E));var x=r(4656),C=r.n(x),k=r(9732);const R="";class j extends o().Component{constructor(e){super(e),this.moveRow=this.moveRow.bind(this),this.dropRow=this.dropRow.bind(this),this.state={rows:e.data}}componentDidUpdate(e,t,r){(0,k.shallowEqual)(this.props.data,e.data)||this.setState({rows:this.props.data})}moveRow(e,t){const{rows:r}=this.state,n=r[e];this.setState(c()(this.state,{rows:{$splice:[[e,1],[t,0,n]]}}))}dropRow(e,t){let{orderField:r}=this.props,n=t+1,o=[...this.state.rows];for(var i in o)o[i][r]=parseInt(i)+1;this.setState(c()(this.state,{rows:{$set:o}})),this.props.dropCallback(o,e,n)}render(){let{options:e,columns:t}=this.props,r=e.hasOwnProperty("className")?e.className:"";return o().createElement("div",{className:"sortable-table-box"},o().createElement("i",null,C().translate("general.drag_and_drop")),o().createElement("table",{className:"table table-striped table-hover sortableTable "+r},o().createElement("thead",null,o().createElement("tr",null,t.map(((e,t)=>{let r=e.width?e.width:R;return o().createElement(h,{width:r,key:t},e.value)})),e.actions&&o().createElement(h,{key:"actions"},"Actions"))),o().createElement("tbody",null,t.length>0&&this.state.rows.map(((r,n)=>Array.isArray(r)&&r.length!==t.length?(console.warn(`Data at row ${n} is ${r.length}. It should be ${t.length}.`),o().createElement("tr",null)):o().createElement(q,{even:n%2==0,key:r.id,index:n,id:r.id,moveCard:this.moveRow,dropCard:this.dropRow},((e,t,r)=>{var n=t.map(((t,r)=>o().createElement(m,{key:r},e[t.columnKey])));return r&&n.push(o().createElement(g,{key:"actions",id:e.id,actions:r})),n})(r,t,e.actions)))))))}}j.propTypes={data:a().array.isRequired,options:a().shape({className:a().string,actions:a().object}).isRequired,columns:a().arrayOf(a().shape({columnKey:a().string.isRequired,value:a().any.isRequired})).isRequired,orderField:a().string.isRequired,dropCallback:a().func.isRequired};const S=(0,d.DragDropContext)(p())(j)},9732:(e,t,r)=>{r.d(t,{arraysEqual:()=>l,buildAPIBaseUrl:()=>o,getCurrentPathName:()=>n,getFromLocalStorage:()=>a,putOnLocalStorage:()=>i,removeFromLocalStorage:()=>s,retryPromise:()=>p,setSessionClearingState:()=>c,shallowEqual:()=>d});require("moment-timezone");r(6530),r(6113);const n=()=>"undefined"!=typeof window?window.location.pathname:null,o=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,i=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},a=(e,t)=>{if("undefined"!=typeof window){let r=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),s(e)),r}return null},s=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},c=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},d=(e,t)=>{const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let n of r)if(e[n]!==t[n])return!1;return!0},l=(e,t)=>e.length===t.length&&e.every(((e,r)=>d(e,t[r]))),p=async(e,t=3)=>{for(let r=0;r<t;r++)if(await e())return!0;return!1}},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},6689:e=>{e.exports=require("react")},6530:e=>{e.exports=require("urijs")},6113:e=>{e.exports=require("crypto")}};var t=require("../runtime.js");t.C(e);t.X(0,[8752],(()=>(e=>t(t.s=e))(4149)))})()}));
1
+ "use strict";!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{var e={id:7286,ids:[7286,7634,1813]};e.modules={4149:(e,t,r)=>{r.r(t),r.d(t,{default:()=>j});var n=r(6689),o=r.n(n);const i=require("prop-types");var a=r.n(i);const s=require("immutability-helper");var c=r.n(s),d=r(7964),l=r(359),p=r.n(l);class u extends o().Component{constructor(e){super(e)}render(){return o().createElement("th",{width:this.props.width},this.props.children)}}const h=u,m=e=>o().createElement("td",e,e.children);class g extends o().Component{constructor(e){super(e),this.handleAction=this.handleAction.bind(this)}shouldDisplayAction(e){let{id:t}=this.props;return!e.hasOwnProperty("display")||e.display(t)}handleAction(e,t,r){r.stopPropagation(),r.preventDefault(),e(t)}render(){let{actions:e,id:t}=this.props;return o().createElement("td",{className:"actions",key:"actions"},e.hasOwnProperty("edit")&&this.shouldDisplayAction(e.edit)&&o().createElement("a",{href:"","data-tip":"edit",onClick:this.handleAction.bind(this,e.edit.onClick,t)},o().createElement("i",{className:"fa fa-pencil-square-o"})),e.hasOwnProperty("delete")&&this.shouldDisplayAction(e.delete)&&o().createElement("a",{href:"","data-tip":"delete",onClick:this.handleAction.bind(this,e.delete.onClick,t)},o().createElement("i",{className:"fa fa-trash-o delete-icon"})),"custom"in e&&e.custom.map((e=>this.shouldDisplayAction(e,t)&&o().createElement("a",{href:"","data-tip":e.tooltip,key:"custom_"+e.name,onClick:this.handleAction.bind(this,e.onClick,t)},e.icon))))}}const w=require("react-dom");function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function y(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach((function(t){b(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function b(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const v={border:"1px dashed gray",padding:"0.5rem 1rem",marginBottom:".5rem",backgroundColor:"white",cursor:"move"},D={beginDrag:e=>({id:e.id,index:e.index}),endDrag(e,t){t.didDrop()&&e.dropCard(e.id,e.index)}},O={hover(e,t,r){const n=t.getItem().index,o=e.index;if(n===o)return;const i=(0,w.findDOMNode)(r).getBoundingClientRect(),a=(i.bottom-i.top)/2,s=t.getClientOffset().y-i.top;n<o&&s<a||n>o&&s>a||(e.moveCard(n,o),t.getItem().index=o)}};class E extends o().Component{render(){const{text:e,isDragging:t,connectDragSource:r,connectDropTarget:n,children:i,even:a,id:s}=this.props,c=t?0:1;return r(n(o().createElement("tr",{id:s,role:"row",className:a?"even":"odd",style:y(y({},v),{},{opacity:c})},i)))}}E.propTypes={connectDragSource:a().func.isRequired,connectDropTarget:a().func.isRequired,index:a().number.isRequired,isDragging:a().bool.isRequired,id:a().any.isRequired,moveCard:a().func.isRequired};const q=(0,d.DragSource)("card",D,((e,t)=>({connectDragSource:e.dragSource(),isDragging:t.isDragging()})))((0,d.DropTarget)("card",O,(e=>({connectDropTarget:e.dropTarget()})))(E));var C=r(4656),k=r.n(C),x=r(9732);const R="";class S extends o().Component{constructor(e){super(e),this.moveRow=this.moveRow.bind(this),this.dropRow=this.dropRow.bind(this),this.state={rows:e.data}}componentDidUpdate(e,t,r){(0,x.shallowEqual)(this.props.data,e.data)||this.setState({rows:this.props.data})}moveRow(e,t){const{rows:r}=this.state,n=r[e];this.setState(c()(this.state,{rows:{$splice:[[e,1],[t,0,n]]}}))}dropRow(e,t){let{orderField:r}=this.props,n=t+1,o=[...this.state.rows];for(var i in o)o[i][r]=parseInt(i)+1;this.setState(c()(this.state,{rows:{$set:o}})),this.props.dropCallback(o,e,n)}render(){let{options:e,columns:t}=this.props,r=e.hasOwnProperty("className")?e.className:"";return o().createElement("div",{className:"sortable-table-box"},o().createElement("i",null,k().translate("general.drag_and_drop")),o().createElement("table",{className:"table table-striped table-hover sortableTable "+r},o().createElement("thead",null,o().createElement("tr",null,t.map(((e,t)=>{let r=e.width?e.width:R;return o().createElement(h,{width:r,key:t},e.value)})),e.actions&&o().createElement(h,{key:"actions"},"Actions"))),o().createElement("tbody",null,t.length>0&&this.state.rows.map(((r,n)=>Array.isArray(r)&&r.length!==t.length?(console.warn(`Data at row ${n} is ${r.length}. It should be ${t.length}.`),o().createElement("tr",null)):o().createElement(q,{even:n%2==0,key:r.id,index:n,id:r.id,moveCard:this.moveRow,dropCard:this.dropRow},((e,t,r)=>{var n=t.map(((t,r)=>o().createElement(m,{key:r},e[t.columnKey])));return r&&n.push(o().createElement(g,{key:"actions",id:e.id,actions:r})),n})(r,t,e.actions)))))))}}S.propTypes={data:a().array.isRequired,options:a().shape({className:a().string,actions:a().object}).isRequired,columns:a().arrayOf(a().shape({columnKey:a().string.isRequired,value:a().any.isRequired})).isRequired,orderField:a().string.isRequired,dropCallback:a().func.isRequired};const j=(0,d.DragDropContext)(p())(S)},9732:(e,t,r)=>{r.d(t,{arraysEqual:()=>m,base64URLEncode:()=>g,buildAPIBaseUrl:()=>c,getAuthCallback:()=>o,getCurrentLocation:()=>i,getCurrentPathName:()=>s,getFromLocalStorage:()=>l,getOrigin:()=>a,putOnLocalStorage:()=>d,removeFromLocalStorage:()=>p,retryPromise:()=>f,setSessionClearingState:()=>u,sha256:()=>w,shallowEqual:()=>h});require("moment-timezone");r(6530);var n=r(6113);const o=()=>"undefined"!=typeof window?`${window.location.origin}/auth/callback`:null,i=()=>{let e="";return"undefined"!=typeof window&&(e=window.location,window.top&&(e=window.top.location)),e},a=()=>"undefined"!=typeof window?window.location.origin:null,s=()=>"undefined"!=typeof window?window.location.pathname:null,c=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,d=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},l=(e,t)=>{if("undefined"!=typeof window){let r=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),p(e)),r}return null},p=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},u=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},h=(e,t)=>{const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let n of r)if(e[n]!==t[n])return!1;return!0},m=(e,t)=>e.length===t.length&&e.every(((e,r)=>h(e,t[r]))),g=e=>e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),w=e=>(0,n.createHash)("sha256").update(e).digest(),f=async(e,t=3)=>{for(let r=0;r<t;r++)if(await e())return!0;return!1}},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},6689:e=>{e.exports=require("react")},6530:e=>{e.exports=require("urijs")},6113:e=>{e.exports=require("crypto")}};var t=require("../runtime.js");t.C(e);t.X(0,[8752],(()=>(e=>t(t.s=e))(4149)))})()}));
package/lib/crypto.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";!function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],o):"object"==typeof exports?exports["openstack-uicore-foundation"]=o():e["openstack-uicore-foundation"]=o()}(this,(function(){return(()=>{var e={id:7634,ids:[7634]};e.modules={6113:e=>{e.exports=require("crypto")}};var o=require("./runtime.js");o.C(e);(e=>{o(o.s=e)})(6113)})()}));
@@ -1 +1 @@
1
- !function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],o):"object"==typeof exports?exports["openstack-uicore-foundation"]=o():e["openstack-uicore-foundation"]=o()}(this,(function(){return(()=>{"use strict";var e={4341:(e,o,t)=>{t.d(o,{SET_LOGGED_USER:()=>n});t(4656),t(3605),t(9732),t(886);const n="SET_LOGGED_USER"},886:(e,o,t)=>{t.r(o),t.d(o,{ACCESS_TOKEN_SKEW_TIME:()=>_,RESPONSE_TYPE_CODE:()=>k,RESPONSE_TYPE_IMPLICIT:()=>y,clearAccessToken:()=>b,clearAuthInfo:()=>j,doLogin:()=>L,doLoginBasicLogin:()=>U,emitAccessToken:()=>R,getAccessToken:()=>P,getAuthInfo:()=>C,getAuthUrl:()=>T,getIdToken:()=>N,getLogoutUrl:()=>I,getOAuth2ClientId:()=>q,getOAuth2Flow:()=>D,getOAuth2IDPBaseUrl:()=>$,getOAuth2Scopes:()=>M,initLogOut:()=>G,passwordlessLogin:()=>H,passwordlessStart:()=>J,refreshAccessToken:()=>v,storeAuthInfo:()=>x,useOAuth2RefreshToken:()=>F,validateIdToken:()=>B});var n=t(9732),r=t(4824),i=t.n(r),a=t(6113);const l=require("browser-tabs-lock");var s=t.n(l),c=t(6530),d=t.n(c),u=t(3856),p=t.n(u),f=t(4341);let g=i();const h=new(s()),w="openstackuicore.lock.getTokenSilently",_=20,y="token id_token",k="code",m="authInfo",S="nonce",O="pkce",T=(e=null,o=null,t=null,r=null)=>{let i=q(),a=(0,n.getAuthCallback)(),l=$(),s=M(),c=D();null!=e&&(a+=`?BackUrl=${encodeURI(e)}`);let u=E(16);(0,n.putOnLocalStorage)(S,u);let p=d()(`${l}/oauth2/auth`),f={response_type:encodeURI(c),scope:encodeURI(s),nonce:u,response_mode:"fragment",client_id:encodeURI(i),redirect_uri:encodeURI(a)};if(c===k){const e=A();(0,n.putOnLocalStorage)(O,JSON.stringify(e)),f.code_challenge=e.codeChallenge,f.code_challenge_method="S256",f.approval_prompt="force"}return o&&(f.prompt=o),t&&(f.id_token_hint=t),r&&(f.provider=r),p=p.query(f),p},I=e=>{let o=$(),t=q(),r=d()(`${o}/oauth2/end-session`),i=E(16),a=(0,n.getOrigin)()+"/auth/logout";return(0,n.putOnLocalStorage)("post_logout_state",i),r.query({id_token_hint:e,post_logout_redirect_uri:encodeURI(a),client_id:encodeURI(t),state:i})},E=e=>{let o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t="";for(let n=0;n<e;n++)t+=o.charAt(Math.floor(Math.random()*o.length));return t},L=(e=null,o=null,t=null)=>{let r=T(e,t,null,o);(0,n.getCurrentLocation)().replace(r.toString())},U=(e=null)=>{L(e,null,null)},A=()=>{const e=(0,n.base64URLEncode)((0,a.randomBytes)(64));return{codeVerifier:e,codeChallenge:(0,n.base64URLEncode)((0,n.sha256)(Buffer.from(e))),createdAt:new Date}},R=async(e,o=null)=>{let t=$(),r=q(),i=(0,n.getAuthCallback)(),a=JSON.parse((0,n.getFromLocalStorage)(O,!0));null!=o&&(i+=`?BackUrl=${encodeURI(o)}`);const l={code:e,grant_type:"authorization_code",code_verifier:a.codeVerifier,client_id:encodeURI(r),redirect_uri:encodeURI(i)};try{const e=await fetch(`${t}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(l)}).catch((function(e){console.log("Request failed:",e.message)})),o=await e.json();let{access_token:n,refresh_token:r,id_token:i,expires_in:a,error:s,error_description:c}=o;return{access_token:n,refresh_token:r,id_token:i,expires_in:a,error:s,error_description:c}}catch(e){console.log(e)}},b=async()=>{if(await(0,n.retryPromise)((()=>h.acquireLock(w,5e3)),10))try{let e=C();if(!e)throw Error("Missing Auth info.");let{accessToken:o,expiresIn:t,accessTokenUpdatedAt:n,refreshToken:r}=e;x(null,0,r)}finally{await h.releaseLock(w)}},P=async()=>{if(await(0,n.retryPromise)((()=>h.acquireLock(w,5e3)),10))try{let e=C();if(!e)throw Error("Missing Auth info.");let{accessToken:o,expiresIn:t,accessTokenUpdatedAt:n,refreshToken:r}=e,i=D(),a=Math.floor(Date.now()/1e3);if(t-=_,a-n>t||null==o){if(console.log("getAccessToken access token expired"),i===k&&F()){if(!r)throw j(),Error("missing Refresh Token");let e=await v(r),{access_token:o,expires_in:t,refresh_token:n}=e;return void 0===n&&(n=null),x(o,t,n),o}throw j(),Error("Access Token Expired.")}return o}finally{await h.releaseLock(w)}throw Error("Lock acquire error.")},v=async e=>{let o=$(),t=q();const r={grant_type:"refresh_token",client_id:encodeURI(t),refresh_token:e};try{const e=await fetch(`${o}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(r)}).then((e=>{if(400===e.status){(0,n.getCurrentPathName)();throw(0,n.setSessionClearingState)(!0),Error(`${e.status} - ${e.statusText}`)}return e})).catch((function(e){throw Error(`Request failed: ${e.message}`)})),t=await e.json();let{access_token:i,refresh_token:a,expires_in:l}=t;return{access_token:i,refresh_token:a,expires_in:l}}catch(e){throw console.log(e),e}},x=(e,o,t=null,r=null)=>{let i=C(),a={accessToken:e,expiresIn:o,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===t&&i&&(t=i.refreshToken),null===r&&i&&(r=i.idToken),t&&(a.refreshToken=t),r&&(a.idToken=r),(0,n.putOnLocalStorage)(m,JSON.stringify(a))},C=()=>{let e=(0,n.getFromLocalStorage)(m,!1);return null===e?null:JSON.parse(e)},j=()=>{if("undefined"!=typeof window)return(0,n.removeFromLocalStorage)(m),(0,n.removeFromLocalStorage)(S),void(0,n.removeFromLocalStorage)(O)},N=()=>{if("undefined"!=typeof window){const e=C();return e?e.idToken:null}return null},q=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,D=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",F=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),$=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null,M=()=>"undefined"!=typeof window?window.SCOPES:null,G=()=>{(0,n.getCurrentLocation)().replace(I(N()).toString())},B=(e,o,t)=>{let r=new(p())({issuer:o,audience:t}),i=(0,n.getFromLocalStorage)(S,!0),a=r.decode(e),l=(a.header.alg,a.header.kid,a.payload.aud),s=a.payload.iss;a.payload.exp,a.payload.nbf;return(a.payload.nonce||null)==i&&l==t&&s==o},J=e=>{let o=q(),t=M(),r=E(16);(0,n.putOnLocalStorage)(S,r);let i=$(),a=d()(`${i}/oauth2/auth`),l={response_type:"otp",scope:encodeURI(t),nonce:r,client_id:encodeURI(o),connection:e.connection||"email",send:e.send||"code"};return e.hasOwnProperty("email")&&(l.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(l.phone_number=encodeURIComponent(e.phone_number)),g.post(a.toString()).send(l).then((e=>{let o=e.body;return Promise.resolve({response:o})})).catch((e=>Promise.reject(e)))},H=e=>o=>{let t=q(),n=M(),r=$(),i=d()(`${r}/oauth2/token`);if(!e.hasOwnProperty("otp"))throw Error("otp param is mandatory.");let a={grant_type:"passwordless",connection:e.connection||"email",scope:encodeURI(n),client_id:encodeURI(t),otp:e.otp};return e.hasOwnProperty("email")&&(a.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(a.phone_number=encodeURIComponent(e.phone_number)),g.post(i.toString()).send(a).then((e=>{try{let n=e.body,{access_token:i,expires_in:a,refresh_token:l,id_token:s}=n;if(void 0===l&&(l=null),void 0===s&&(s=null),s&&!B(s,r,t))throw Error("id token is not valid.");return x(i,a,l,s),o&&o({type:f.SET_LOGGED_USER,payload:{sessionState:null}}),Promise.resolve({response:n})}catch(e){return console.log(e),Promise.reject(e)}})).catch((e=>Promise.reject(e)))}},3605:(e,o,t)=>{t(4824),t(6530);require("sweetalert2");t(4656),t(9732),t(4341),t(886);const n=e=>o=>({type:e,payload:o});n("RESET_LOADING"),n("START_LOADING"),n("STOP_LOADING")},9732:(e,o,t)=>{t.d(o,{base64URLEncode:()=>p,getAuthCallback:()=>r,getCurrentLocation:()=>i,getCurrentPathName:()=>l,getFromLocalStorage:()=>c,getOrigin:()=>a,putOnLocalStorage:()=>s,removeFromLocalStorage:()=>d,retryPromise:()=>g,setSessionClearingState:()=>u,sha256:()=>f});require("moment-timezone");t(6530);var n=t(6113);const r=()=>"undefined"!=typeof window?`${window.location.origin}/auth/callback`:null,i=()=>{let e="";return"undefined"!=typeof window&&(e=window.location,window.top&&(e=window.top.location)),e},a=()=>"undefined"!=typeof window?window.location.origin:null,l=()=>"undefined"!=typeof window?window.location.pathname:null,s=(e,o)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,o)},c=(e,o)=>{if("undefined"!=typeof window){let t=window.localStorage.getItem(e);return o&&(console.log(`getFromLocalStorage removing key ${e}`),d(e)),t}return null},d=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},u=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},p=e=>e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),f=e=>(0,n.createHash)("sha256").update(e).digest(),g=async(e,o=3)=>{for(let t=0;t<o;t++)if(await e())return!0;return!1}},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},4824:e=>{e.exports=require("superagent")},6530:e=>{e.exports=require("urijs")},6113:e=>{e.exports=require("crypto")}},o={};function t(n){var r=o[n];if(void 0!==r)return r.exports;var i=o[n]={exports:{}};return e[n](i,i.exports,t),i.exports}return(()=>{t.n=e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return t.d(o,{a:o}),o}})(),(()=>{t.d=(e,o)=>{for(var n in o)t.o(o,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:o[n]})}})(),(()=>{t.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o)})(),(()=>{t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})(),t(886)})()}));
1
+ "use strict";!function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],o):"object"==typeof exports?exports["openstack-uicore-foundation"]=o():e["openstack-uicore-foundation"]=o()}(this,(function(){return(()=>{var e={id:3451,ids:[3451]};e.modules={4341:(e,o,t)=>{t.d(o,{SET_LOGGED_USER:()=>n});t(4656),t(3605),t(9732),t(886);const n="SET_LOGGED_USER"},886:(e,o,t)=>{t.r(o),t.d(o,{ACCESS_TOKEN_SKEW_TIME:()=>_,RESPONSE_TYPE_CODE:()=>y,RESPONSE_TYPE_IMPLICIT:()=>k,clearAccessToken:()=>b,clearAuthInfo:()=>j,doLogin:()=>I,doLoginBasicLogin:()=>L,emitAccessToken:()=>A,getAccessToken:()=>P,getAuthInfo:()=>x,getAuthUrl:()=>O,getIdToken:()=>q,getLogoutUrl:()=>R,getOAuth2ClientId:()=>N,getOAuth2Flow:()=>$,getOAuth2IDPBaseUrl:()=>F,getOAuth2Scopes:()=>B,initLogOut:()=>G,passwordlessLogin:()=>J,passwordlessStart:()=>H,refreshAccessToken:()=>v,storeAuthInfo:()=>C,useOAuth2RefreshToken:()=>D,validateIdToken:()=>M});var n=t(9732),r=t(4824),a=t.n(r),i=t(6113);const s=require("browser-tabs-lock");var l=t.n(s),c=t(6530),d=t.n(c),u=t(3856),p=t.n(u),f=t(4341);let h=a();const w=new(l()),g="openstackuicore.lock.getTokenSilently",_=20,k="token id_token",y="code",m="authInfo",S="nonce",E="pkce",O=(e=null,o=null,t=null,r=null)=>{let a=N(),i=(0,n.getAuthCallback)(),s=F(),l=B(),c=$();null!=e&&(i+=`?BackUrl=${encodeURI(e)}`);let u=T(16);(0,n.putOnLocalStorage)(S,u);let p=d()(`${s}/oauth2/auth`),f={response_type:encodeURI(c),scope:encodeURI(l),nonce:u,response_mode:"fragment",client_id:encodeURI(a),redirect_uri:encodeURI(i)};if(c===y){const e=U();(0,n.putOnLocalStorage)(E,JSON.stringify(e)),f.code_challenge=e.codeChallenge,f.code_challenge_method="S256",f.approval_prompt="force"}return o&&(f.prompt=o),t&&(f.id_token_hint=t),r&&(f.provider=r),p=p.query(f),p},R=e=>{let o=F(),t=N(),r=d()(`${o}/oauth2/end-session`),a=T(16),i=(0,n.getOrigin)()+"/auth/logout";return(0,n.putOnLocalStorage)("post_logout_state",a),r.query({id_token_hint:e,post_logout_redirect_uri:encodeURI(i),client_id:encodeURI(t),state:a})},T=e=>{let o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t="";for(let n=0;n<e;n++)t+=o.charAt(Math.floor(Math.random()*o.length));return t},I=(e=null,o=null,t=null)=>{let r=O(e,t,null,o);(0,n.getCurrentLocation)().replace(r.toString())},L=(e=null)=>{I(e,null,null)},U=()=>{const e=(0,n.base64URLEncode)((0,i.randomBytes)(64));return{codeVerifier:e,codeChallenge:(0,n.base64URLEncode)((0,n.sha256)(Buffer.from(e))),createdAt:new Date}},A=async(e,o=null)=>{let t=F(),r=N(),a=(0,n.getAuthCallback)(),i=JSON.parse((0,n.getFromLocalStorage)(E,!0));null!=o&&(a+=`?BackUrl=${encodeURI(o)}`);const s={code:e,grant_type:"authorization_code",code_verifier:i.codeVerifier,client_id:encodeURI(r),redirect_uri:encodeURI(a)};try{const e=await fetch(`${t}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(s)}).catch((function(e){console.log("Request failed:",e.message)})),o=await e.json();let{access_token:n,refresh_token:r,id_token:a,expires_in:i,error:l,error_description:c}=o;return{access_token:n,refresh_token:r,id_token:a,expires_in:i,error:l,error_description:c}}catch(e){console.log(e)}},b=async()=>{if(await(0,n.retryPromise)((()=>w.acquireLock(g,5e3)),10))try{let e=x();if(!e)throw Error("Missing Auth info.");let{accessToken:o,expiresIn:t,accessTokenUpdatedAt:n,refreshToken:r}=e;C(null,0,r)}finally{await w.releaseLock(g)}},P=async()=>{if(await(0,n.retryPromise)((()=>w.acquireLock(g,5e3)),10))try{let e=x();if(!e)throw Error("Missing Auth info.");let{accessToken:o,expiresIn:t,accessTokenUpdatedAt:n,refreshToken:r}=e,a=$(),i=Math.floor(Date.now()/1e3);if(t-=_,i-n>t||null==o){if(console.log("getAccessToken access token expired"),a===y&&D()){if(!r)throw j(),Error("missing Refresh Token");let e=await v(r),{access_token:o,expires_in:t,refresh_token:n}=e;return void 0===n&&(n=null),C(o,t,n),o}throw j(),Error("Access Token Expired.")}return o}finally{await w.releaseLock(g)}throw Error("Lock acquire error.")},v=async e=>{let o=F(),t=N();const r={grant_type:"refresh_token",client_id:encodeURI(t),refresh_token:e};try{const e=await fetch(`${o}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(r)}).then((e=>{if(400===e.status){(0,n.getCurrentPathName)();throw(0,n.setSessionClearingState)(!0),Error(`${e.status} - ${e.statusText}`)}return e})).catch((function(e){throw Error(`Request failed: ${e.message}`)})),t=await e.json();let{access_token:a,refresh_token:i,expires_in:s}=t;return{access_token:a,refresh_token:i,expires_in:s}}catch(e){throw console.log(e),e}},C=(e,o,t=null,r=null)=>{let a=x(),i={accessToken:e,expiresIn:o,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===t&&a&&(t=a.refreshToken),null===r&&a&&(r=a.idToken),t&&(i.refreshToken=t),r&&(i.idToken=r),(0,n.putOnLocalStorage)(m,JSON.stringify(i))},x=()=>{let e=(0,n.getFromLocalStorage)(m,!1);return null===e?null:JSON.parse(e)},j=()=>{if("undefined"!=typeof window)return(0,n.removeFromLocalStorage)(m),(0,n.removeFromLocalStorage)(S),void(0,n.removeFromLocalStorage)(E)},q=()=>{if("undefined"!=typeof window){const e=x();return e?e.idToken:null}return null},N=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,$=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",D=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),F=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null,B=()=>"undefined"!=typeof window?window.SCOPES:null,G=()=>{(0,n.getCurrentLocation)().replace(R(q()).toString())},M=(e,o,t)=>{let r=new(p())({issuer:o,audience:t}),a=(0,n.getFromLocalStorage)(S,!0),i=r.decode(e),s=(i.header.alg,i.header.kid,i.payload.aud),l=i.payload.iss;i.payload.exp,i.payload.nbf;return(i.payload.nonce||null)==a&&s==t&&l==o},H=e=>{let o=N(),t=B(),r=T(16);(0,n.putOnLocalStorage)(S,r);let a=F(),i=d()(`${a}/oauth2/auth`),s={response_type:"otp",scope:encodeURI(t),nonce:r,client_id:encodeURI(o),connection:e.connection||"email",send:e.send||"code"};return e.hasOwnProperty("email")&&(s.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(s.phone_number=encodeURIComponent(e.phone_number)),h.post(i.toString()).send(s).then((e=>{let o=e.body;return Promise.resolve({response:o})})).catch((e=>Promise.reject(e)))},J=e=>o=>{let t=N(),n=B(),r=F(),a=d()(`${r}/oauth2/token`);if(!e.hasOwnProperty("otp"))throw Error("otp param is mandatory.");let i={grant_type:"passwordless",connection:e.connection||"email",scope:encodeURI(n),client_id:encodeURI(t),otp:e.otp};return e.hasOwnProperty("email")&&(i.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(i.phone_number=encodeURIComponent(e.phone_number)),h.post(a.toString()).send(i).then((e=>{try{let n=e.body,{access_token:a,expires_in:i,refresh_token:s,id_token:l}=n;if(void 0===s&&(s=null),void 0===l&&(l=null),l&&!M(l,r,t))throw Error("id token is not valid.");return C(a,i,s,l),o&&o({type:f.SET_LOGGED_USER,payload:{sessionState:null}}),Promise.resolve({response:n})}catch(e){return console.log(e),Promise.reject(e)}})).catch((e=>Promise.reject(e)))}},3605:(e,o,t)=>{t.d(o,{escapeFilterValue:()=>d,fetchErrorHandler:()=>l,fetchResponseHandler:()=>c});t(4824),t(6530);const n=require("sweetalert2");var r=t.n(n),a=t(4656),i=t.n(a);t(9732),t(4341),t(886);const s=e=>o=>({type:e,payload:o}),l=(s("RESET_LOADING"),s("START_LOADING"),s("STOP_LOADING"),e=>{let o=e.status,t=e.statusText;switch(o){case 403:r().fire("ERROR",i().translate("errors.user_not_authz"),"warning");break;case 401:r().fire("ERROR",i().translate("errors.session_expired"),"error");break;case 412:r().fire("ERROR",t,"warning");case 500:r().fire("ERROR",i().translate("errors.server_error"),"error")}}),c=e=>{if(e.ok)return e.json();throw e},d=e=>e=(e=e.replace(/,/g,"\\,")).replace(/;/g,"\\;")},9732:(e,o,t)=>{t.d(o,{arraysEqual:()=>h,base64URLEncode:()=>w,buildAPIBaseUrl:()=>l,getAuthCallback:()=>r,getCurrentLocation:()=>a,getCurrentPathName:()=>s,getFromLocalStorage:()=>d,getOrigin:()=>i,putOnLocalStorage:()=>c,removeFromLocalStorage:()=>u,retryPromise:()=>_,setSessionClearingState:()=>p,sha256:()=>g,shallowEqual:()=>f});require("moment-timezone");t(6530);var n=t(6113);const r=()=>"undefined"!=typeof window?`${window.location.origin}/auth/callback`:null,a=()=>{let e="";return"undefined"!=typeof window&&(e=window.location,window.top&&(e=window.top.location)),e},i=()=>"undefined"!=typeof window?window.location.origin:null,s=()=>"undefined"!=typeof window?window.location.pathname:null,l=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,c=(e,o)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,o)},d=(e,o)=>{if("undefined"!=typeof window){let t=window.localStorage.getItem(e);return o&&(console.log(`getFromLocalStorage removing key ${e}`),u(e)),t}return null},u=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},p=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},f=(e,o)=>{const t=Object.keys(e),n=Object.keys(o);if(t.length!==n.length)return!1;for(let n of t)if(e[n]!==o[n])return!1;return!0},h=(e,o)=>e.length===o.length&&e.every(((e,t)=>f(e,o[t]))),w=e=>e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),g=e=>(0,n.createHash)("sha256").update(e).digest(),_=async(e,o=3)=>{for(let t=0;t<o;t++)if(await e())return!0;return!1}},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},4824:e=>{e.exports=require("superagent")},6530:e=>{e.exports=require("urijs")}};var o=require("../runtime.js");o.C(e);o.X(0,[7634],(()=>(e=>o(o.s=e))(886)))})()}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openstack-uicore-foundation",
3
- "version": "4.0.4",
3
+ "version": "4.0.5",
4
4
  "description": "ui reactjs components for openstack marketing site",
5
5
  "main": "lib/openstack-uicore-foundation.js",
6
6
  "scripts": {
@@ -21,6 +21,7 @@
21
21
  "babel-cli": "^6.26.0",
22
22
  "babel-loader": "^8.2.4",
23
23
  "browser-tabs-lock": "^1.2.15",
24
+ "crypto-browserify": "^3.12.0",
24
25
  "css-loader": "^6.7.1",
25
26
  "dropzone": "5.7.2",
26
27
  "extend": "^3.0.1",
@@ -75,6 +76,7 @@
75
76
  "peerDependencies": {
76
77
  "awesome-bootstrap-checkbox": "^1.0.1",
77
78
  "browser-tabs-lock": "1.2.9",
79
+ "crypto-browserify": "^3.12.0",
78
80
  "dropzone": "^5.7.2",
79
81
  "extend": "^3.0.1",
80
82
  "font-awesome": "^4.7.0",