openstack-uicore-foundation 4.0.34 → 4.0.37

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
- !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,(()=>(()=>{"use strict";var e={4341:(e,t,n)=>{n(4656),n(4054),n(6793),n(8576)},8576:(e,t,n)=>{n.d(t,{getAccessToken:()=>p});var r=n(6793);n(4824);const a=require("browser-tabs-lock");var o=n.n(a);n(6530),n(3856),n(4341);require("crypto-js/sha256"),require("crypto-js/enc-base64url"),require("crypto-js/enc-hex"),"undefined"!=typeof window&&(window.crypto||window.msCrypto);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=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=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)(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),b=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null},4054:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>i,fetchResponseHandler:()=>l});n(4824),n(6530);var r=n(271),a=n.n(r),o=n(4656),s=n.n(o);n(6793),n(4341),n(8576);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,"\\;")},6793:(e,t,n)=>{n.d(t,{buildAPIBaseUrl:()=>a,getCurrentPathName:()=>r,getFromLocalStorage:()=>s,putOnLocalStorage:()=>o,removeFromLocalStorage:()=>c,retryPromise:()=>l,setSessionClearingState:()=>i});n(8362),n(6530);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=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,{queryOrganizations:()=>u});var r=n(4054),a=n(8576),o=n(6793),s=n(6530),c=n.n(s);const i=require("lodash");var l=n.n(i);const d=500,u=(l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().debounce((async(e,t,n,s=null)=>{let c=`/api/v1/summits/${e}/event-types?order=name&access_token=${await(0,a.getAccessToken)()}`;if(t=(0,r.escapeFilterValue)(t)){c+=`&filter[]=${encodeURIComponent(`name=@${t}`)}`}if(s){c+=`&filter[]=${encodeURIComponent(`class_name==${s}`)}`}fetch((0,o.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d),l().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)}),d),l().debounce((async(e,t,n)=>{let s;try{s=await(0,a.getAccessToken)()}catch(e){return void n(e)}let i=c()(`/api/v1/summits/${e}/registration-companies`);i.addQuery("access_token",s),i.addQuery("order","name"),t&&(t=(0,r.escapeFilterValue)(t),i.addQuery("filter[]",`name=@${t}`)),fetch((0,o.buildAPIBaseUrl)(i.toString())).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d),l().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}/access-level-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d));l().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}/ticket-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},8362:e=>{e.exports=require("moment-timezone")},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")},271:e=>{e.exports=require("sweetalert2")},6530:e=>{e.exports=require("urijs")}},t={};function n(r){var a=t[r];if(void 0!==a)return a.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}(()=>{n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t}})(),(()=>{n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}})(),(()=>{n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var r={};return(()=>{n.r(r),n.d(r,{default:()=>p});var e=n(6689),t=n.n(e),a=n(9953),o=n.n(a),s=n(9503),c=n.n(s),i=n(7525);const l=["error","value","id","onChange"];function d(){return d=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},d.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 p extends t().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:n,value:r,id:a,onChange:s}=e,i=u(e,l),p=this.props.hasOwnProperty("error")&&""!=n,h=this.props.hasOwnProperty("allowCreate"),f=r?{value:r.id.toString(),label:r.name}:null;const m=h?c():o();return t().createElement("div",null,t().createElement(m,d({value:f,onChange:this.handleChange,loadOptions:this.getOrganizations,onCreateOption:this.handleNew},i)),p&&t().createElement("p",{className:"error-label"},n))}}})(),r})()));
1
+ !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,(()=>(()=>{"use strict";var e={4341:(e,t,n)=>{n(4656),n(4054),n(6793),n(8576)},8576:(e,t,n)=>{n.d(t,{getAccessToken:()=>p});var r=n(6793);n(4824);const a=require("browser-tabs-lock");var o=n.n(a);n(6530),n(3856),n(4341);require("crypto-js/sha256"),require("crypto-js/enc-base64url"),require("crypto-js/enc-hex"),"undefined"!=typeof window&&(window.crypto||window.msCrypto);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=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=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)(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),b=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null},4054:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>i,fetchResponseHandler:()=>l});n(4824),n(6530);var r=n(271),a=n.n(r),o=n(4656),s=n.n(o);n(6793),n(4341),n(8576);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,"\\;")},6793:(e,t,n)=>{n.d(t,{buildAPIBaseUrl:()=>a,getCurrentPathName:()=>r,getFromLocalStorage:()=>s,putOnLocalStorage:()=>o,removeFromLocalStorage:()=>c,retryPromise:()=>l,setSessionClearingState:()=>i});n(8362),n(6530);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=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,{queryOrganizations:()=>u});var r=n(4054),a=n(8576),o=n(6793),s=n(6530),c=n.n(s);const i=require("lodash");var l=n.n(i);const d=500,u=(l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().debounce((async(e,t,n,s=null)=>{let c=`/api/v1/summits/${e}/event-types?order=name&access_token=${await(0,a.getAccessToken)()}`;if(t=(0,r.escapeFilterValue)(t)){c+=`&filter[]=${encodeURIComponent(`name=@${t}`)}`}if(s){c+=`&filter[]=${encodeURIComponent(`class_name==${s}`)}`}fetch((0,o.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d),l().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)}),d),l().debounce((async(e,t,n)=>{let s;try{s=await(0,a.getAccessToken)()}catch(e){return void n(e)}let i=c()(`/api/v1/summits/${e}/registration-companies`);i.addQuery("access_token",s),i.addQuery("order","name"),t&&(t=(0,r.escapeFilterValue)(t),i.addQuery("filter[]",`name@@${t}`)),fetch((0,o.buildAPIBaseUrl)(i.toString())).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d),l().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}/access-level-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d));l().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}/ticket-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},8362:e=>{e.exports=require("moment-timezone")},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")},271:e=>{e.exports=require("sweetalert2")},6530:e=>{e.exports=require("urijs")}},t={};function n(r){var a=t[r];if(void 0!==a)return a.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}(()=>{n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t}})(),(()=>{n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}})(),(()=>{n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var r={};return(()=>{n.r(r),n.d(r,{default:()=>p});var e=n(6689),t=n.n(e),a=n(9953),o=n.n(a),s=n(9503),c=n.n(s),i=n(7525);const l=["error","value","id","onChange"];function d(){return d=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},d.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 p extends t().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:n,value:r,id:a,onChange:s}=e,i=u(e,l),p=this.props.hasOwnProperty("error")&&""!=n,h=this.props.hasOwnProperty("allowCreate"),f=r?{value:r.id.toString(),label:r.name}:null;const m=h?c():o();return t().createElement("div",null,t().createElement(m,d({value:f,onChange:this.handleChange,loadOptions:this.getOrganizations,onCreateOption:this.handleNew},i)),p&&t().createElement("p",{className:"error-label"},n))}}})(),r})()));
@@ -1 +1 @@
1
- !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,(()=>(()=>{"use strict";var e={4341:(e,t,n)=>{n(4656),n(4054),n(6793),n(8576)},8576:(e,t,n)=>{n.d(t,{getAccessToken:()=>p});var a=n(6793);n(4824);const r=require("browser-tabs-lock");var o=n.n(r);n(6530),n(3856),n(4341);require("crypto-js/sha256"),require("crypto-js/enc-base64url"),require("crypto-js/enc-hex"),"undefined"!=typeof window&&(window.crypto||window.msCrypto);const s=new(o()),l="openstackuicore.lock.getTokenSilently",c="code",i="authInfo",u="nonce",d="pkce",p=async()=>{if(await(0,a.retryPromise)((()=>s.acquireLock(l,5e3)),10))try{let e=h();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:a,refreshToken:r}=e,o=w(),i=Math.floor(Date.now()/1e3);if(n-=20,i-a>n||null==t){if(console.log("getAccessToken access token expired"),o===c&&v()){if(!r)throw g(),Error("missing Refresh Token");let e=await f(r),{access_token:t,expires_in:n,refresh_token:a}=e;return void 0===a&&(a=null),m(t,n,a),t}throw g(),Error("Access Token Expired.")}return t}finally{await s.releaseLock(l)}throw Error("Lock acquire error.")},f=async e=>{let t=b(),n=y();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,a.getCurrentPathName)();throw(0,a.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:l}=n;return{access_token:o,refresh_token:s,expires_in:l}}catch(e){throw console.log(e),e}},m=(e,t,n=null,r=null)=>{let o=h(),s={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===n&&o&&(n=o.refreshToken),null===r&&o&&(r=o.idToken),n&&(s.refreshToken=n),r&&(s.idToken=r),(0,a.putOnLocalStorage)(i,JSON.stringify(s))},h=()=>{let e=(0,a.getFromLocalStorage)(i,!1);return null===e?null:JSON.parse(e)},g=()=>{if("undefined"!=typeof window)return(0,a.removeFromLocalStorage)(i),(0,a.removeFromLocalStorage)(u),void(0,a.removeFromLocalStorage)(d)},y=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,w=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",v=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),b=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null},4054:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>u,fetchErrorHandler:()=>c,fetchResponseHandler:()=>i});n(4824),n(6530);var a=n(271),r=n.n(a),o=n(4656),s=n.n(o);n(6793),n(4341),n(8576);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},u=e=>e=(e=e.replace(/,/g,"\\,")).replace(/;/g,"\\;")},6793:(e,t,n)=>{n.d(t,{buildAPIBaseUrl:()=>r,getCurrentPathName:()=>a,getFromLocalStorage:()=>s,putOnLocalStorage:()=>o,removeFromLocalStorage:()=>l,retryPromise:()=>i,setSessionClearingState:()=>c});n(8362),n(6530);const a=()=>"undefined"!=typeof window?window.location.pathname:null,r=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}`),l(e)),n}return null},l=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},c=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},i=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,{queryRegistrationCompanies:()=>d});var a=n(4054),r=n(8576),o=n(6793),s=n(6530),l=n.n(s);const c=require("lodash");var i=n.n(c);const u=500,d=(i().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,a.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(a.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(a.fetchErrorHandler)}),u),i().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,a.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(a.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(a.fetchErrorHandler)}),u),i().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,a.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,o.buildAPIBaseUrl)(l)).then(a.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(a.fetchErrorHandler)}),u),i().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,a.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,o.buildAPIBaseUrl)(l)).then(a.fetchResponseHandler).then((t=>{let a=[...t.data];e&&(a=a.map((e=>e.tag))),n(a)})).catch(a.fetchErrorHandler)}),u),i().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,a.escapeFilterValue)(t);let l=encodeURIComponent(`name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${l}&order=name&access_token=${s}`)).then(a.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(a.fetchErrorHandler)}),u),i().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();let l=(t=(0,a.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${l}`)).then(a.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(a.fetchErrorHandler)}),u),i().debounce((async(e,t,n=!1,s)=>{const l=await(0,r.getAccessToken)();t=(0,a.escapeFilterValue)(t);let c=`/api/v1/summits/${e}/events`+(n?"/published":""),i=encodeURIComponent(`title=@${t}`);fetch((0,o.buildAPIBaseUrl)(`${c}?filter=${i}&order=title&access_token=${l}`)).then(a.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(a.fetchErrorHandler)}),u),i().debounce((async(e,t,n,s=null)=>{let l=`/api/v1/summits/${e}/event-types?order=name&access_token=${await(0,r.getAccessToken)()}`;if(t=(0,a.escapeFilterValue)(t)){l+=`&filter[]=${encodeURIComponent(`name=@${t}`)}`}if(s){l+=`&filter[]=${encodeURIComponent(`class_name==${s}`)}`}fetch((0,o.buildAPIBaseUrl)(l)).then(a.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(a.fetchErrorHandler)}),u),i().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(a.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(a.fetchErrorHandler)}),u),i().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,a.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(a.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(a.fetchErrorHandler)}),u),i().debounce((async(e,t,n)=>{let s;try{s=await(0,r.getAccessToken)()}catch(e){return void n(e)}let c=l()(`/api/v1/summits/${e}/registration-companies`);c.addQuery("access_token",s),c.addQuery("order","name"),t&&(t=(0,a.escapeFilterValue)(t),c.addQuery("filter[]",`name=@${t}`)),fetch((0,o.buildAPIBaseUrl)(c.toString())).then(a.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(a.fetchErrorHandler)}),u));i().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,a.escapeFilterValue)(t);let l=encodeURIComponent(`company_name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${l}&expand=company,sponsorship&access_token=${s}`)).then(a.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(a.fetchErrorHandler)}),u),i().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,a.escapeFilterValue)(t);let l=encodeURIComponent(`name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${l}&&access_token=${s}`)).then(a.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(a.fetchErrorHandler)}),u),i().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,a.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(a.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(a.fetchErrorHandler)}),u);i().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,a.escapeFilterValue)(t);let l=encodeURIComponent(`name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/ticket-types?filter=${l}&&access_token=${s}`)).then(a.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(a.fetchErrorHandler)}),u)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},8362:e=>{e.exports=require("moment-timezone")},580:e=>{e.exports=require("prop-types")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},4824:e=>{e.exports=require("superagent")},271:e=>{e.exports=require("sweetalert2")},6530:e=>{e.exports=require("urijs")}},t={};function n(a){var r=t[a];if(void 0!==r)return r.exports;var o=t[a]={exports:{}};return e[a](o,o.exports,n),o.exports}(()=>{n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t}})(),(()=>{n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})}})(),(()=>{n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var a={};return(()=>{n.r(a),n.d(a,{default:()=>f});var e=n(6689),t=n.n(e),r=n(580),o=n.n(r),s=n(9953),l=n.n(s),c=n(7525);const i=["error","value","onChange","id","multi","isMulti","className","summitId","onError"];function u(){return u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},u.apply(this,arguments)}function d(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}const p=n=>{let{error:a,value:r,onChange:o,id:s,multi:p,isMulti:f,className:m,summitId:h,onError:g}=n,y=d(n,i);const[w,v]=(0,e.useState)({value:null,label:""}),[b,k]=(0,e.useState)(!1),[$,_]=(0,e.useState)(""),[R,E]=(0,e.useState)(p||f),[A,I]=(0,e.useState)(a);(0,e.useEffect)((()=>{}),[]),(0,e.useEffect)((()=>{!r.id&&r.name?(k(!0),_(r.name),v({value:null,label:r.name})):f&&r.length>0?v(r.map((e=>({value:e.id,label:e.name})))):!f&&r.id&&v({value:r.id,label:r.name})}),[r]);return t().createElement("div",null,b?t().createElement(t().Fragment,null,t().createElement("input",u({value:$,placeholder:"Enter your company",onChange:e=>{_(e.target.value);let t={target:{id:s,value:{id:null,name:e.target.value},type:"companyinput"}};o(t)},className:"form-control",style:{paddingRight:25}},y)),t().createElement("i",{"aria-label":"Clear",style:{position:"absolute",bottom:10,right:25,cursor:"pointer",opacity:"65%"},onClick:()=>{k(!b),_(""),v({value:null,label:""}),o({target:{id:s,value:{id:null,name:""},type:"companyinput"}})},className:"fa fa-close"})):t().createElement(l(),u({value:w.label&&w.value?w:null,placeholder:"Select a company",onChange:e=>{if(null===e.value){k(!0);const t=R?e.map((e=>({value:e.value,label:""}))):{value:e.value,label:""};return v(t),void o({target:{id:s,value:t,type:"companyinput"}})}const t=R?e.map((e=>({id:e.value,name:e.label}))):{id:e.value,name:e.label},n=R?e.map((e=>({value:e.value,label:e.label}))):{value:e.value,label:e.label};v(n),o({target:{id:s,value:t,type:"companyinput"}})},defaultOptions:!0,loadOptions:(e,t)=>{(0,c.queryRegistrationCompanies)(h,e,(e=>{e instanceof Error&&g(e),0===e.length&&t([]);let n=[...e.map((e=>({value:e.id.toString(),label:e.name}))),{value:null,label:"Other"}];t(n)}))},isMulti:R,className:m},y)),A&&t().createElement("p",{className:"error-label"},a))},f=p;p.propTypes={onError:o().func.isRequired}})(),a})()));
1
+ !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,(()=>(()=>{"use strict";var e={4341:(e,t,n)=>{n(4656),n(4054),n(6793),n(8576)},8576:(e,t,n)=>{n.d(t,{getAccessToken:()=>p});var a=n(6793);n(4824);const r=require("browser-tabs-lock");var o=n.n(r);n(6530),n(3856),n(4341);require("crypto-js/sha256"),require("crypto-js/enc-base64url"),require("crypto-js/enc-hex"),"undefined"!=typeof window&&(window.crypto||window.msCrypto);const s=new(o()),l="openstackuicore.lock.getTokenSilently",c="code",i="authInfo",u="nonce",d="pkce",p=async()=>{if(await(0,a.retryPromise)((()=>s.acquireLock(l,5e3)),10))try{let e=h();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:a,refreshToken:r}=e,o=w(),i=Math.floor(Date.now()/1e3);if(n-=20,i-a>n||null==t){if(console.log("getAccessToken access token expired"),o===c&&v()){if(!r)throw g(),Error("missing Refresh Token");let e=await f(r),{access_token:t,expires_in:n,refresh_token:a}=e;return void 0===a&&(a=null),m(t,n,a),t}throw g(),Error("Access Token Expired.")}return t}finally{await s.releaseLock(l)}throw Error("Lock acquire error.")},f=async e=>{let t=b(),n=y();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,a.getCurrentPathName)();throw(0,a.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:l}=n;return{access_token:o,refresh_token:s,expires_in:l}}catch(e){throw console.log(e),e}},m=(e,t,n=null,r=null)=>{let o=h(),s={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===n&&o&&(n=o.refreshToken),null===r&&o&&(r=o.idToken),n&&(s.refreshToken=n),r&&(s.idToken=r),(0,a.putOnLocalStorage)(i,JSON.stringify(s))},h=()=>{let e=(0,a.getFromLocalStorage)(i,!1);return null===e?null:JSON.parse(e)},g=()=>{if("undefined"!=typeof window)return(0,a.removeFromLocalStorage)(i),(0,a.removeFromLocalStorage)(u),void(0,a.removeFromLocalStorage)(d)},y=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,w=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",v=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),b=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null},4054:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>u,fetchErrorHandler:()=>c,fetchResponseHandler:()=>i});n(4824),n(6530);var a=n(271),r=n.n(a),o=n(4656),s=n.n(o);n(6793),n(4341),n(8576);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},u=e=>e=(e=e.replace(/,/g,"\\,")).replace(/;/g,"\\;")},6793:(e,t,n)=>{n.d(t,{buildAPIBaseUrl:()=>r,getCurrentPathName:()=>a,getFromLocalStorage:()=>s,putOnLocalStorage:()=>o,removeFromLocalStorage:()=>l,retryPromise:()=>i,setSessionClearingState:()=>c});n(8362),n(6530);const a=()=>"undefined"!=typeof window?window.location.pathname:null,r=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}`),l(e)),n}return null},l=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},c=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},i=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,{queryRegistrationCompanies:()=>d});var a=n(4054),r=n(8576),o=n(6793),s=n(6530),l=n.n(s);const c=require("lodash");var i=n.n(c);const u=500,d=(i().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,a.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(a.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(a.fetchErrorHandler)}),u),i().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,a.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(a.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(a.fetchErrorHandler)}),u),i().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,a.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,o.buildAPIBaseUrl)(l)).then(a.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(a.fetchErrorHandler)}),u),i().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,a.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,o.buildAPIBaseUrl)(l)).then(a.fetchResponseHandler).then((t=>{let a=[...t.data];e&&(a=a.map((e=>e.tag))),n(a)})).catch(a.fetchErrorHandler)}),u),i().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,a.escapeFilterValue)(t);let l=encodeURIComponent(`name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${l}&order=name&access_token=${s}`)).then(a.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(a.fetchErrorHandler)}),u),i().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();let l=(t=(0,a.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${l}`)).then(a.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(a.fetchErrorHandler)}),u),i().debounce((async(e,t,n=!1,s)=>{const l=await(0,r.getAccessToken)();t=(0,a.escapeFilterValue)(t);let c=`/api/v1/summits/${e}/events`+(n?"/published":""),i=encodeURIComponent(`title=@${t}`);fetch((0,o.buildAPIBaseUrl)(`${c}?filter=${i}&order=title&access_token=${l}`)).then(a.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(a.fetchErrorHandler)}),u),i().debounce((async(e,t,n,s=null)=>{let l=`/api/v1/summits/${e}/event-types?order=name&access_token=${await(0,r.getAccessToken)()}`;if(t=(0,a.escapeFilterValue)(t)){l+=`&filter[]=${encodeURIComponent(`name=@${t}`)}`}if(s){l+=`&filter[]=${encodeURIComponent(`class_name==${s}`)}`}fetch((0,o.buildAPIBaseUrl)(l)).then(a.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(a.fetchErrorHandler)}),u),i().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(a.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(a.fetchErrorHandler)}),u),i().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,a.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(a.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(a.fetchErrorHandler)}),u),i().debounce((async(e,t,n)=>{let s;try{s=await(0,r.getAccessToken)()}catch(e){return void n(e)}let c=l()(`/api/v1/summits/${e}/registration-companies`);c.addQuery("access_token",s),c.addQuery("order","name"),t&&(t=(0,a.escapeFilterValue)(t),c.addQuery("filter[]",`name@@${t}`)),fetch((0,o.buildAPIBaseUrl)(c.toString())).then(a.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(a.fetchErrorHandler)}),u));i().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,a.escapeFilterValue)(t);let l=encodeURIComponent(`company_name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${l}&expand=company,sponsorship&access_token=${s}`)).then(a.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(a.fetchErrorHandler)}),u),i().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,a.escapeFilterValue)(t);let l=encodeURIComponent(`name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${l}&&access_token=${s}`)).then(a.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(a.fetchErrorHandler)}),u),i().debounce((async(e,t)=>{const n=await(0,r.getAccessToken)();e=(0,a.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(a.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(a.fetchErrorHandler)}),u);i().debounce((async(e,t,n)=>{const s=await(0,r.getAccessToken)();t=(0,a.escapeFilterValue)(t);let l=encodeURIComponent(`name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/ticket-types?filter=${l}&&access_token=${s}`)).then(a.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(a.fetchErrorHandler)}),u)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},8362:e=>{e.exports=require("moment-timezone")},580:e=>{e.exports=require("prop-types")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},4824:e=>{e.exports=require("superagent")},271:e=>{e.exports=require("sweetalert2")},6530:e=>{e.exports=require("urijs")}},t={};function n(a){var r=t[a];if(void 0!==r)return r.exports;var o=t[a]={exports:{}};return e[a](o,o.exports,n),o.exports}(()=>{n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t}})(),(()=>{n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})}})(),(()=>{n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var a={};return(()=>{n.r(a),n.d(a,{default:()=>f});var e=n(6689),t=n.n(e),r=n(580),o=n.n(r),s=n(9953),l=n.n(s),c=n(7525);const i=["error","value","onChange","id","multi","isMulti","className","summitId","onError"];function u(){return u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},u.apply(this,arguments)}function d(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}const p=n=>{let{error:a,value:r,onChange:o,id:s,multi:p,isMulti:f,className:m,summitId:h,onError:g}=n,y=d(n,i);const[w,v]=(0,e.useState)({value:null,label:""}),[b,k]=(0,e.useState)(!1),[$,_]=(0,e.useState)(""),[R,E]=(0,e.useState)(p||f),[A,I]=(0,e.useState)(a);(0,e.useEffect)((()=>{}),[]),(0,e.useEffect)((()=>{!r.id&&r.name?(k(!0),_(r.name),v({value:null,label:r.name})):f&&r.length>0?v(r.map((e=>({value:e.id,label:e.name})))):!f&&r.id&&v({value:r.id,label:r.name})}),[r]);return t().createElement("div",null,b?t().createElement(t().Fragment,null,t().createElement("input",u({value:$,placeholder:"Enter your company",onChange:e=>{_(e.target.value);let t={target:{id:s,value:{id:null,name:e.target.value},type:"companyinput"}};o(t)},className:"form-control",style:{paddingRight:25}},y)),t().createElement("i",{"aria-label":"Clear",style:{position:"absolute",bottom:10,right:25,cursor:"pointer",opacity:"65%"},onClick:()=>{k(!b),_(""),v({value:null,label:""}),o({target:{id:s,value:{id:null,name:""},type:"companyinput"}})},className:"fa fa-close"})):t().createElement(l(),u({value:w.label&&w.value?w:null,placeholder:"Select a company",onChange:e=>{if(null===e.value){k(!0);const t=R?e.map((e=>({value:e.value,label:""}))):{value:e.value,label:""};return v(t),void o({target:{id:s,value:t,type:"companyinput"}})}const t=R?e.map((e=>({id:e.value,name:e.label}))):{id:e.value,name:e.label},n=R?e.map((e=>({value:e.value,label:e.label}))):{value:e.value,label:e.label};v(n),o({target:{id:s,value:t,type:"companyinput"}})},defaultOptions:[{value:null,label:"Other"}],loadOptions:(e,t)=>{(0,c.queryRegistrationCompanies)(h,e,(e=>{e instanceof Error&&g(e),0===e.length&&t([]);let n=[...e.map((e=>({value:e.id.toString(),label:e.name}))),{value:null,label:"Other"}];t(n)}))},isMulti:R,className:m},y)),A&&t().createElement("p",{className:"error-label"},a))},f=p;p.propTypes={onError:o().func.isRequired}})(),a})()));
@@ -1 +1 @@
1
- !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,(()=>(()=>{"use strict";var e={4341:(e,t,n)=>{n(4656),n(4054),n(6793),n(8576)},8576:(e,t,n)=>{n.d(t,{getAccessToken:()=>u});var r=n(6793);n(4824);const o=require("browser-tabs-lock");var a=n.n(o);n(6530),n(3856),n(4341);require("crypto-js/sha256"),require("crypto-js/enc-base64url"),require("crypto-js/enc-hex"),"undefined"!=typeof window&&(window.crypto||window.msCrypto);const s=new(a()),c="openstackuicore.lock.getTokenSilently",i="code",l="authInfo",d="nonce",p="pkce",u=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=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)(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)(p)},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},4054:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>i,fetchResponseHandler:()=>l});n(4824),n(6530);var r=n(271),o=n.n(r),a=n(4656),s=n.n(a);n(6793),n(4341),n(8576);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,"\\;")},6793:(e,t,n)=>{n.d(t,{buildAPIBaseUrl:()=>o,getCurrentPathName:()=>r,getFromLocalStorage:()=>s,putOnLocalStorage:()=>a,removeFromLocalStorage:()=>c,retryPromise:()=>l,setSessionClearingState:()=>i});n(8362),n(6530);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=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,{querySpeakers:()=>p});var r=n(4054),o=n(8576),a=n(6793),s=n(6530),c=n.n(s);const i=require("lodash");var l=n.n(i);const d=500,p=(l().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)}),d),l().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)}),d),l().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)}),d));l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().debounce((async(e,t,n,s=null)=>{let c=`/api/v1/summits/${e}/event-types?order=name&access_token=${await(0,o.getAccessToken)()}`;if(t=(0,r.escapeFilterValue)(t)){c+=`&filter[]=${encodeURIComponent(`name=@${t}`)}`}if(s){c+=`&filter[]=${encodeURIComponent(`class_name==${s}`)}`}fetch((0,a.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d),l().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)}),d),l().debounce((async(e,t,n)=>{let s;try{s=await(0,o.getAccessToken)()}catch(e){return void n(e)}let i=c()(`/api/v1/summits/${e}/registration-companies`);i.addQuery("access_token",s),i.addQuery("order","name"),t&&(t=(0,r.escapeFilterValue)(t),i.addQuery("filter[]",`name=@${t}`)),fetch((0,a.buildAPIBaseUrl)(i.toString())).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d),l().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}/access-level-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d);l().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}/ticket-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},8362:e=>{e.exports=require("moment-timezone")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},4824:e=>{e.exports=require("superagent")},271:e=>{e.exports=require("sweetalert2")},6530:e=>{e.exports=require("urijs")}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}(()=>{n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t}})(),(()=>{n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}})(),(()=>{n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var r={};return(()=>{n.r(r),n.d(r,{default:()=>p});var e=n(6689),t=n.n(e),o=n(9953),a=n.n(o);const s=require("react-select/lib/components");var c=n(7525);const i=["value","onChange","history","summitId","error","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 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 p extends t().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:n,onChange:r,history:o,summitId:c,error:p,id:u,multi:h}=e,f=d(e,i),m=this.props.hasOwnProperty("error")&&""!=p,g=this.props.hasOwnProperty("multi");return t().createElement("div",null,t().createElement(a(),l({value:n,onChange:this.handleChange,loadOptions:this.getSpeakers,components:{MultiValueLabel:e=>t().createElement("a",{onClick:()=>this.handleClick(e.data.id),style:{cursor:"pointer"}},t().createElement(s.components.MultiValueLabel,e))},getOptionValue:e=>this.getOptionValue(e),getOptionLabel:e=>this.getOptionLabel(e),isMulti:g},f)),m&&t().createElement("p",{className:"error-label"},p))}}})(),r})()));
1
+ !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,(()=>(()=>{"use strict";var e={4341:(e,t,n)=>{n(4656),n(4054),n(6793),n(8576)},8576:(e,t,n)=>{n.d(t,{getAccessToken:()=>u});var r=n(6793);n(4824);const o=require("browser-tabs-lock");var a=n.n(o);n(6530),n(3856),n(4341);require("crypto-js/sha256"),require("crypto-js/enc-base64url"),require("crypto-js/enc-hex"),"undefined"!=typeof window&&(window.crypto||window.msCrypto);const s=new(a()),c="openstackuicore.lock.getTokenSilently",i="code",l="authInfo",d="nonce",p="pkce",u=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=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)(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)(p)},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},4054:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>i,fetchResponseHandler:()=>l});n(4824),n(6530);var r=n(271),o=n.n(r),a=n(4656),s=n.n(a);n(6793),n(4341),n(8576);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,"\\;")},6793:(e,t,n)=>{n.d(t,{buildAPIBaseUrl:()=>o,getCurrentPathName:()=>r,getFromLocalStorage:()=>s,putOnLocalStorage:()=>a,removeFromLocalStorage:()=>c,retryPromise:()=>l,setSessionClearingState:()=>i});n(8362),n(6530);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=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,{querySpeakers:()=>p});var r=n(4054),o=n(8576),a=n(6793),s=n(6530),c=n.n(s);const i=require("lodash");var l=n.n(i);const d=500,p=(l().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)}),d),l().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)}),d),l().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)}),d));l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().debounce((async(e,t,n,s=null)=>{let c=`/api/v1/summits/${e}/event-types?order=name&access_token=${await(0,o.getAccessToken)()}`;if(t=(0,r.escapeFilterValue)(t)){c+=`&filter[]=${encodeURIComponent(`name=@${t}`)}`}if(s){c+=`&filter[]=${encodeURIComponent(`class_name==${s}`)}`}fetch((0,a.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d),l().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)}),d),l().debounce((async(e,t,n)=>{let s;try{s=await(0,o.getAccessToken)()}catch(e){return void n(e)}let i=c()(`/api/v1/summits/${e}/registration-companies`);i.addQuery("access_token",s),i.addQuery("order","name"),t&&(t=(0,r.escapeFilterValue)(t),i.addQuery("filter[]",`name@@${t}`)),fetch((0,a.buildAPIBaseUrl)(i.toString())).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d),l().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}/access-level-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d);l().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}/ticket-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},8362:e=>{e.exports=require("moment-timezone")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},4824:e=>{e.exports=require("superagent")},271:e=>{e.exports=require("sweetalert2")},6530:e=>{e.exports=require("urijs")}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}(()=>{n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t}})(),(()=>{n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}})(),(()=>{n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var r={};return(()=>{n.r(r),n.d(r,{default:()=>p});var e=n(6689),t=n.n(e),o=n(9953),a=n.n(o);const s=require("react-select/lib/components");var c=n(7525);const i=["value","onChange","history","summitId","error","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 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 p extends t().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:n,onChange:r,history:o,summitId:c,error:p,id:u,multi:h}=e,f=d(e,i),m=this.props.hasOwnProperty("error")&&""!=p,g=this.props.hasOwnProperty("multi");return t().createElement("div",null,t().createElement(a(),l({value:n,onChange:this.handleChange,loadOptions:this.getSpeakers,components:{MultiValueLabel:e=>t().createElement("a",{onClick:()=>this.handleClick(e.data.id),style:{cursor:"pointer"}},t().createElement(s.components.MultiValueLabel,e))},getOptionValue:e=>this.getOptionValue(e),getOptionLabel:e=>this.getOptionLabel(e),isMulti:g},f)),m&&t().createElement("p",{className:"error-label"},p))}}})(),r})()));
@@ -1 +1 @@
1
- !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,(()=>(()=>{"use strict";var e={4341:(e,t,n)=>{n(4656),n(4054),n(6793),n(8576)},8576:(e,t,n)=>{n.d(t,{getAccessToken:()=>u});var r=n(6793);n(4824);const o=require("browser-tabs-lock");var a=n.n(o);n(6530),n(3856),n(4341);require("crypto-js/sha256"),require("crypto-js/enc-base64url"),require("crypto-js/enc-hex"),"undefined"!=typeof window&&(window.crypto||window.msCrypto);const s=new(a()),c="openstackuicore.lock.getTokenSilently",i="code",l="authInfo",d="nonce",p="pkce",u=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)(p)},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},4054:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>i,fetchResponseHandler:()=>l});n(4824),n(6530);var r=n(271),o=n.n(r),a=n(4656),s=n.n(a);n(6793),n(4341),n(8576);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,"\\;")},6793:(e,t,n)=>{n.d(t,{buildAPIBaseUrl:()=>o,getCurrentPathName:()=>r,getFromLocalStorage:()=>s,putOnLocalStorage:()=>a,removeFromLocalStorage:()=>c,retryPromise:()=>l,setSessionClearingState:()=>i});n(8362),n(6530);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=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,{querySponsors:()=>p});var r=n(4054),o=n(8576),a=n(6793),s=n(6530),c=n.n(s);const i=require("lodash");var l=n.n(i);const d=500,p=(l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().debounce((async(e,t,n,s=null)=>{let c=`/api/v1/summits/${e}/event-types?order=name&access_token=${await(0,o.getAccessToken)()}`;if(t=(0,r.escapeFilterValue)(t)){c+=`&filter[]=${encodeURIComponent(`name=@${t}`)}`}if(s){c+=`&filter[]=${encodeURIComponent(`class_name==${s}`)}`}fetch((0,a.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d),l().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)}),d),l().debounce((async(e,t,n)=>{let s;try{s=await(0,o.getAccessToken)()}catch(e){return void n(e)}let i=c()(`/api/v1/summits/${e}/registration-companies`);i.addQuery("access_token",s),i.addQuery("order","name"),t&&(t=(0,r.escapeFilterValue)(t),i.addQuery("filter[]",`name=@${t}`)),fetch((0,a.buildAPIBaseUrl)(i.toString())).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d));l().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}/access-level-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d);l().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}/ticket-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},8362:e=>{e.exports=require("moment-timezone")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},4824:e=>{e.exports=require("superagent")},271:e=>{e.exports=require("sweetalert2")},6530:e=>{e.exports=require("urijs")}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}(()=>{n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t}})(),(()=>{n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}})(),(()=>{n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var r={};return(()=>{n.r(r),n.d(r,{default:()=>d});var e=n(6689),t=n.n(e),o=n(9953),a=n.n(o),s=n(7525);const c=["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 r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i.apply(this,arguments)}function l(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 t().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,s.querySponsors)(n,e,t)}render(){let e=this.props,{error:n,value:r,onChange:o,id:s,multi:d,summitId:p}=e,u=l(e,c),h=this.props.hasOwnProperty("error")&&""!=n,f=this.props.hasOwnProperty("multi");return t().createElement("div",null,t().createElement(a(),i({value:r,getOptionValue:e=>e.id,getOptionLabel:e=>`${e.company.name} (${e.sponsorship.label})`,onChange:this.handleChange,loadOptions:this.getSponsors,isMulti:f},u)),h&&t().createElement("p",{className:"error-label"},n))}}})(),r})()));
1
+ !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,(()=>(()=>{"use strict";var e={4341:(e,t,n)=>{n(4656),n(4054),n(6793),n(8576)},8576:(e,t,n)=>{n.d(t,{getAccessToken:()=>u});var r=n(6793);n(4824);const o=require("browser-tabs-lock");var a=n.n(o);n(6530),n(3856),n(4341);require("crypto-js/sha256"),require("crypto-js/enc-base64url"),require("crypto-js/enc-hex"),"undefined"!=typeof window&&(window.crypto||window.msCrypto);const s=new(a()),c="openstackuicore.lock.getTokenSilently",i="code",l="authInfo",d="nonce",p="pkce",u=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)(p)},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},4054:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>i,fetchResponseHandler:()=>l});n(4824),n(6530);var r=n(271),o=n.n(r),a=n(4656),s=n.n(a);n(6793),n(4341),n(8576);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,"\\;")},6793:(e,t,n)=>{n.d(t,{buildAPIBaseUrl:()=>o,getCurrentPathName:()=>r,getFromLocalStorage:()=>s,putOnLocalStorage:()=>a,removeFromLocalStorage:()=>c,retryPromise:()=>l,setSessionClearingState:()=>i});n(8362),n(6530);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=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,{querySponsors:()=>p});var r=n(4054),o=n(8576),a=n(6793),s=n(6530),c=n.n(s);const i=require("lodash");var l=n.n(i);const d=500,p=(l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().debounce((async(e,t,n,s=null)=>{let c=`/api/v1/summits/${e}/event-types?order=name&access_token=${await(0,o.getAccessToken)()}`;if(t=(0,r.escapeFilterValue)(t)){c+=`&filter[]=${encodeURIComponent(`name=@${t}`)}`}if(s){c+=`&filter[]=${encodeURIComponent(`class_name==${s}`)}`}fetch((0,a.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d),l().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)}),d),l().debounce((async(e,t,n)=>{let s;try{s=await(0,o.getAccessToken)()}catch(e){return void n(e)}let i=c()(`/api/v1/summits/${e}/registration-companies`);i.addQuery("access_token",s),i.addQuery("order","name"),t&&(t=(0,r.escapeFilterValue)(t),i.addQuery("filter[]",`name@@${t}`)),fetch((0,a.buildAPIBaseUrl)(i.toString())).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d));l().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}/access-level-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d);l().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}/ticket-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},8362:e=>{e.exports=require("moment-timezone")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},4824:e=>{e.exports=require("superagent")},271:e=>{e.exports=require("sweetalert2")},6530:e=>{e.exports=require("urijs")}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}(()=>{n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t}})(),(()=>{n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}})(),(()=>{n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var r={};return(()=>{n.r(r),n.d(r,{default:()=>d});var e=n(6689),t=n.n(e),o=n(9953),a=n.n(o),s=n(7525);const c=["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 r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i.apply(this,arguments)}function l(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 t().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,s.querySponsors)(n,e,t)}render(){let e=this.props,{error:n,value:r,onChange:o,id:s,multi:d,summitId:p}=e,u=l(e,c),h=this.props.hasOwnProperty("error")&&""!=n,f=this.props.hasOwnProperty("multi");return t().createElement("div",null,t().createElement(a(),i({value:r,getOptionValue:e=>e.id,getOptionLabel:e=>`${e.company.name} (${e.sponsorship.label})`,onChange:this.handleChange,loadOptions:this.getSponsors,isMulti:f},u)),h&&t().createElement("p",{className:"error-label"},n))}}})(),r})()));
@@ -1 +1 @@
1
- !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,(()=>(()=>{"use strict";var e={4341:(e,t,n)=>{n(4656),n(4054),n(6793),n(8576)},8576:(e,t,n)=>{n.d(t,{getAccessToken:()=>p});var r=n(6793);n(4824);const o=require("browser-tabs-lock");var a=n.n(o);n(6530),n(3856),n(4341);require("crypto-js/sha256"),require("crypto-js/enc-base64url"),require("crypto-js/enc-hex"),"undefined"!=typeof window&&(window.crypto||window.msCrypto);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 f(o),{access_token:t,expires_in:n,refresh_token:r}=e;return void 0===r&&(r=null),h(t,n,r),t}throw g(),Error("Access Token Expired.")}return t}finally{await s.releaseLock(c)}throw Error("Lock acquire error.")},f=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}},h=(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},4054:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>i,fetchResponseHandler:()=>l});n(4824),n(6530);var r=n(271),o=n.n(r),a=n(4656),s=n.n(a);n(6793),n(4341),n(8576);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,"\\;")},6793:(e,t,n)=>{n.d(t,{buildAPIBaseUrl:()=>o,getCurrentPathName:()=>r,getFromLocalStorage:()=>s,putOnLocalStorage:()=>a,removeFromLocalStorage:()=>c,retryPromise:()=>l,setSessionClearingState:()=>i});n(8362),n(6530);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=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,{querySummits:()=>u});var r=n(4054),o=n(8576),a=n(6793),s=n(6530),c=n.n(s);const i=require("lodash");var l=n.n(i);const d=500,u=(l().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)}),d),l().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)}),d));l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().debounce((async(e,t,n,s=null)=>{let c=`/api/v1/summits/${e}/event-types?order=name&access_token=${await(0,o.getAccessToken)()}`;if(t=(0,r.escapeFilterValue)(t)){c+=`&filter[]=${encodeURIComponent(`name=@${t}`)}`}if(s){c+=`&filter[]=${encodeURIComponent(`class_name==${s}`)}`}fetch((0,a.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d),l().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)}),d),l().debounce((async(e,t,n)=>{let s;try{s=await(0,o.getAccessToken)()}catch(e){return void n(e)}let i=c()(`/api/v1/summits/${e}/registration-companies`);i.addQuery("access_token",s),i.addQuery("order","name"),t&&(t=(0,r.escapeFilterValue)(t),i.addQuery("filter[]",`name=@${t}`)),fetch((0,a.buildAPIBaseUrl)(i.toString())).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d),l().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}/access-level-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d);l().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}/ticket-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},8362:e=>{e.exports=require("moment-timezone")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},4824:e=>{e.exports=require("superagent")},271:e=>{e.exports=require("sweetalert2")},6530:e=>{e.exports=require("urijs")}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}(()=>{n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t}})(),(()=>{n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}})(),(()=>{n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var r={};return(()=>{n.r(r),n.d(r,{default:()=>d});var e=n(6689),t=n.n(e),o=n(9953),a=n.n(o),s=n(7525);const c=["value","error","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 l(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 t().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,s.querySummits)(e,t)}render(){let e=this.props,{value:n,error:r,onChange:o,id:s,multi:d}=e,u=l(e,c),p=this.props.hasOwnProperty("multi"),f=this.props.hasOwnProperty("error")&&""!=r;return t().createElement("div",null,t().createElement(a(),i({value:n,onChange:this.handleChange,loadOptions:this.getSummits,getOptionValue:e=>e.id,getOptionLabel:e=>`${e.name} (${e.id})`,isMulti:p},u)),f&&t().createElement("p",{className:"error-label"},r))}}})(),r})()));
1
+ !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,(()=>(()=>{"use strict";var e={4341:(e,t,n)=>{n(4656),n(4054),n(6793),n(8576)},8576:(e,t,n)=>{n.d(t,{getAccessToken:()=>p});var r=n(6793);n(4824);const o=require("browser-tabs-lock");var a=n.n(o);n(6530),n(3856),n(4341);require("crypto-js/sha256"),require("crypto-js/enc-base64url"),require("crypto-js/enc-hex"),"undefined"!=typeof window&&(window.crypto||window.msCrypto);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 f(o),{access_token:t,expires_in:n,refresh_token:r}=e;return void 0===r&&(r=null),h(t,n,r),t}throw g(),Error("Access Token Expired.")}return t}finally{await s.releaseLock(c)}throw Error("Lock acquire error.")},f=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}},h=(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},4054:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>i,fetchResponseHandler:()=>l});n(4824),n(6530);var r=n(271),o=n.n(r),a=n(4656),s=n.n(a);n(6793),n(4341),n(8576);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,"\\;")},6793:(e,t,n)=>{n.d(t,{buildAPIBaseUrl:()=>o,getCurrentPathName:()=>r,getFromLocalStorage:()=>s,putOnLocalStorage:()=>a,removeFromLocalStorage:()=>c,retryPromise:()=>l,setSessionClearingState:()=>i});n(8362),n(6530);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=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,{querySummits:()=>u});var r=n(4054),o=n(8576),a=n(6793),s=n(6530),c=n.n(s);const i=require("lodash");var l=n.n(i);const d=500,u=(l().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)}),d),l().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)}),d));l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().debounce((async(e,t,n,s=null)=>{let c=`/api/v1/summits/${e}/event-types?order=name&access_token=${await(0,o.getAccessToken)()}`;if(t=(0,r.escapeFilterValue)(t)){c+=`&filter[]=${encodeURIComponent(`name=@${t}`)}`}if(s){c+=`&filter[]=${encodeURIComponent(`class_name==${s}`)}`}fetch((0,a.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d),l().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)}),d),l().debounce((async(e,t,n)=>{let s;try{s=await(0,o.getAccessToken)()}catch(e){return void n(e)}let i=c()(`/api/v1/summits/${e}/registration-companies`);i.addQuery("access_token",s),i.addQuery("order","name"),t&&(t=(0,r.escapeFilterValue)(t),i.addQuery("filter[]",`name@@${t}`)),fetch((0,a.buildAPIBaseUrl)(i.toString())).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d),l().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}/access-level-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d);l().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}/ticket-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},8362:e=>{e.exports=require("moment-timezone")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},4824:e=>{e.exports=require("superagent")},271:e=>{e.exports=require("sweetalert2")},6530:e=>{e.exports=require("urijs")}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}(()=>{n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t}})(),(()=>{n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}})(),(()=>{n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var r={};return(()=>{n.r(r),n.d(r,{default:()=>d});var e=n(6689),t=n.n(e),o=n(9953),a=n.n(o),s=n(7525);const c=["value","error","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 l(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 t().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,s.querySummits)(e,t)}render(){let e=this.props,{value:n,error:r,onChange:o,id:s,multi:d}=e,u=l(e,c),p=this.props.hasOwnProperty("multi"),f=this.props.hasOwnProperty("error")&&""!=r;return t().createElement("div",null,t().createElement(a(),i({value:n,onChange:this.handleChange,loadOptions:this.getSummits,getOptionValue:e=>e.id,getOptionLabel:e=>`${e.name} (${e.id})`,isMulti:p},u)),f&&t().createElement("p",{className:"error-label"},r))}}})(),r})()));
@@ -1 +1 @@
1
- !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,(()=>(()=>{"use strict";var e={4341:(e,t,n)=>{n(4656),n(4054),n(6793),n(8576)},8576:(e,t,n)=>{n.d(t,{getAccessToken:()=>p});var r=n(6793);n(4824);const a=require("browser-tabs-lock");var o=n.n(a);n(6530),n(3856),n(4341);require("crypto-js/sha256"),require("crypto-js/enc-base64url"),require("crypto-js/enc-hex"),"undefined"!=typeof window&&(window.crypto||window.msCrypto);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=$(),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),$=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null},4054:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>l,fetchResponseHandler:()=>i});n(4824),n(6530);var r=n(271),a=n.n(r),o=n(4656),s=n.n(o);n(6793),n(4341),n(8576);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,"\\;")},6793:(e,t,n)=>{n.d(t,{buildAPIBaseUrl:()=>a,getCurrentPathName:()=>r,getFromLocalStorage:()=>s,putOnLocalStorage:()=>o,removeFromLocalStorage:()=>c,retryPromise:()=>d,setSessionClearingState:()=>l,shallowEqual:()=>i});n(8362),n(6530);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=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,{queryTags:()=>u});var r=n(4054),a=n(8576),o=n(6793),s=n(6530),c=n.n(s);const l=require("lodash");var i=n.n(l);const d=500,u=(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)}),d),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)}),d),i().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)}),d),i().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)}),d));i().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)}),d),i().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)}),d),i().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)}),d),i().debounce((async(e,t,n,s=null)=>{let c=`/api/v1/summits/${e}/event-types?order=name&access_token=${await(0,a.getAccessToken)()}`;if(t=(0,r.escapeFilterValue)(t)){c+=`&filter[]=${encodeURIComponent(`name=@${t}`)}`}if(s){c+=`&filter[]=${encodeURIComponent(`class_name==${s}`)}`}fetch((0,o.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),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)}),d),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)}),d),i().debounce((async(e,t,n)=>{let s;try{s=await(0,a.getAccessToken)()}catch(e){return void n(e)}let l=c()(`/api/v1/summits/${e}/registration-companies`);l.addQuery("access_token",s),l.addQuery("order","name"),t&&(t=(0,r.escapeFilterValue)(t),l.addQuery("filter[]",`name=@${t}`)),fetch((0,o.buildAPIBaseUrl)(l.toString())).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),i().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)}),d),i().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}/access-level-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),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)}),d);i().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}/ticket-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},8362:e=>{e.exports=require("moment-timezone")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},4824:e=>{e.exports=require("superagent")},271:e=>{e.exports=require("sweetalert2")},6530:e=>{e.exports=require("urijs")}},t={};function n(r){var a=t[r];if(void 0!==a)return a.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}(()=>{n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t}})(),(()=>{n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}})(),(()=>{n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var r={};return(()=>{n.r(r),n.d(r,{default:()=>u});var e=n(6689),t=n.n(e),a=n(9953),o=n.n(a),s=n(7525),c=n(6793);const l=["className","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 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 t().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,c.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,s.queryTags)(n,e,t)}render(){let e=this.props,{className:n,error:r}=e,a=d(e,l),s=this.props.hasOwnProperty("error")&&""!=r,c=this.state.value.sort(((e,t)=>e.tag.toLowerCase()>t.tag.toLowerCase()?1:e.tag.toLowerCase()<t.tag.toLowerCase()?-1:0));return t().createElement("div",null,t().createElement(o(),i({},a,{className:n+" "+(s?"error":""),isMulti:!0,value:c,onChange:this.handleChange,loadOptions:this.getTags,getOptionLabel:e=>e.tag,getOptionValue:e=>e.tag})),s&&t().createElement("p",{className:"error-label"},r))}}})(),r})()));
1
+ !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,(()=>(()=>{"use strict";var e={4341:(e,t,n)=>{n(4656),n(4054),n(6793),n(8576)},8576:(e,t,n)=>{n.d(t,{getAccessToken:()=>p});var r=n(6793);n(4824);const a=require("browser-tabs-lock");var o=n.n(a);n(6530),n(3856),n(4341);require("crypto-js/sha256"),require("crypto-js/enc-base64url"),require("crypto-js/enc-hex"),"undefined"!=typeof window&&(window.crypto||window.msCrypto);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=$(),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),$=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null},4054:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>l,fetchResponseHandler:()=>i});n(4824),n(6530);var r=n(271),a=n.n(r),o=n(4656),s=n.n(o);n(6793),n(4341),n(8576);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,"\\;")},6793:(e,t,n)=>{n.d(t,{buildAPIBaseUrl:()=>a,getCurrentPathName:()=>r,getFromLocalStorage:()=>s,putOnLocalStorage:()=>o,removeFromLocalStorage:()=>c,retryPromise:()=>d,setSessionClearingState:()=>l,shallowEqual:()=>i});n(8362),n(6530);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=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,{queryTags:()=>u});var r=n(4054),a=n(8576),o=n(6793),s=n(6530),c=n.n(s);const l=require("lodash");var i=n.n(l);const d=500,u=(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)}),d),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)}),d),i().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)}),d),i().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)}),d));i().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)}),d),i().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)}),d),i().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)}),d),i().debounce((async(e,t,n,s=null)=>{let c=`/api/v1/summits/${e}/event-types?order=name&access_token=${await(0,a.getAccessToken)()}`;if(t=(0,r.escapeFilterValue)(t)){c+=`&filter[]=${encodeURIComponent(`name=@${t}`)}`}if(s){c+=`&filter[]=${encodeURIComponent(`class_name==${s}`)}`}fetch((0,o.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),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)}),d),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)}),d),i().debounce((async(e,t,n)=>{let s;try{s=await(0,a.getAccessToken)()}catch(e){return void n(e)}let l=c()(`/api/v1/summits/${e}/registration-companies`);l.addQuery("access_token",s),l.addQuery("order","name"),t&&(t=(0,r.escapeFilterValue)(t),l.addQuery("filter[]",`name@@${t}`)),fetch((0,o.buildAPIBaseUrl)(l.toString())).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),i().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)}),d),i().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}/access-level-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),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)}),d);i().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}/ticket-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},8362:e=>{e.exports=require("moment-timezone")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},4824:e=>{e.exports=require("superagent")},271:e=>{e.exports=require("sweetalert2")},6530:e=>{e.exports=require("urijs")}},t={};function n(r){var a=t[r];if(void 0!==a)return a.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}(()=>{n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t}})(),(()=>{n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}})(),(()=>{n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var r={};return(()=>{n.r(r),n.d(r,{default:()=>u});var e=n(6689),t=n.n(e),a=n(9953),o=n.n(a),s=n(7525),c=n(6793);const l=["className","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 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 t().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,c.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,s.queryTags)(n,e,t)}render(){let e=this.props,{className:n,error:r}=e,a=d(e,l),s=this.props.hasOwnProperty("error")&&""!=r,c=this.state.value.sort(((e,t)=>e.tag.toLowerCase()>t.tag.toLowerCase()?1:e.tag.toLowerCase()<t.tag.toLowerCase()?-1:0));return t().createElement("div",null,t().createElement(o(),i({},a,{className:n+" "+(s?"error":""),isMulti:!0,value:c,onChange:this.handleChange,loadOptions:this.getTags,getOptionLabel:e=>e.tag,getOptionValue:e=>e.tag})),s&&t().createElement("p",{className:"error-label"},r))}}})(),r})()));
@@ -1 +1 @@
1
- !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,(()=>(()=>{"use strict";var e={4341:(e,t,n)=>{n(4656),n(4054),n(6793),n(8576)},8576:(e,t,n)=>{n.d(t,{getAccessToken:()=>u});var r=n(6793);n(4824);const o=require("browser-tabs-lock");var a=n.n(o);n(6530),n(3856),n(4341);require("crypto-js/sha256"),require("crypto-js/enc-base64url"),require("crypto-js/enc-hex"),"undefined"!=typeof window&&(window.crypto||window.msCrypto);const s=new(a()),c="openstackuicore.lock.getTokenSilently",i="code",l="authInfo",d="nonce",p="pkce",u=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=w(),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=b(),n=y();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)(p)},y=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,w=()=>"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},4054:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>i,fetchResponseHandler:()=>l});n(4824),n(6530);var r=n(271),o=n.n(r),a=n(4656),s=n.n(a);n(6793),n(4341),n(8576);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,"\\;")},6793:(e,t,n)=>{n.d(t,{buildAPIBaseUrl:()=>o,getCurrentPathName:()=>r,getFromLocalStorage:()=>s,putOnLocalStorage:()=>a,removeFromLocalStorage:()=>c,retryPromise:()=>l,setSessionClearingState:()=>i});n(8362),n(6530);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=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,{queryTicketTypes:()=>p});var r=n(4054),o=n(8576),a=n(6793),s=n(6530),c=n.n(s);const i=require("lodash");var l=n.n(i);const d=500;l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().debounce((async(e,t,n,s=null)=>{let c=`/api/v1/summits/${e}/event-types?order=name&access_token=${await(0,o.getAccessToken)()}`;if(t=(0,r.escapeFilterValue)(t)){c+=`&filter[]=${encodeURIComponent(`name=@${t}`)}`}if(s){c+=`&filter[]=${encodeURIComponent(`class_name==${s}`)}`}fetch((0,a.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d),l().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)}),d),l().debounce((async(e,t,n)=>{let s;try{s=await(0,o.getAccessToken)()}catch(e){return void n(e)}let i=c()(`/api/v1/summits/${e}/registration-companies`);i.addQuery("access_token",s),i.addQuery("order","name"),t&&(t=(0,r.escapeFilterValue)(t),i.addQuery("filter[]",`name=@${t}`)),fetch((0,a.buildAPIBaseUrl)(i.toString())).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d),l().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}/access-level-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d);const p=l().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}/ticket-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},8362:e=>{e.exports=require("moment-timezone")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},4824:e=>{e.exports=require("superagent")},271:e=>{e.exports=require("sweetalert2")},6530:e=>{e.exports=require("urijs")}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}(()=>{n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t}})(),(()=>{n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}})(),(()=>{n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var r={};return(()=>{n.r(r),n.d(r,{default:()=>d});var e=n(6689),t=n.n(e),o=n(9953),a=n.n(o),s=n(7525);const c=["value","error","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 l(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 t().Component{constructor(e){super(e),this.state={value:e.value},this.handleChange=this.handleChange.bind(this),this.getTicketTypes=this.getTicketTypes.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:"tickettypeinput"}};this.props.onChange(t)}getTicketTypes(e,t){let{summitId:n}=this.props;if(!e)return Promise.resolve({options:[]});(0,s.queryTicketTypes)(n,e,t)}render(){let e=this.props,{value:n,error:r,onChange:o,id:s,multi:d}=e,p=l(e,c),u=this.props.hasOwnProperty("multi"),h=this.props.hasOwnProperty("error")&&""!=r;return t().createElement("div",null,t().createElement(a(),i({value:n,onChange:this.handleChange,loadOptions:this.getTicketTypes,getOptionValue:e=>this.getOptionValue(e),getOptionLabel:e=>this.getOptionLabel(e),isMulti:u},p)),h&&t().createElement("p",{className:"error-label"},r))}}})(),r})()));
1
+ !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,(()=>(()=>{"use strict";var e={4341:(e,t,n)=>{n(4656),n(4054),n(6793),n(8576)},8576:(e,t,n)=>{n.d(t,{getAccessToken:()=>u});var r=n(6793);n(4824);const o=require("browser-tabs-lock");var a=n.n(o);n(6530),n(3856),n(4341);require("crypto-js/sha256"),require("crypto-js/enc-base64url"),require("crypto-js/enc-hex"),"undefined"!=typeof window&&(window.crypto||window.msCrypto);const s=new(a()),c="openstackuicore.lock.getTokenSilently",i="code",l="authInfo",d="nonce",p="pkce",u=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=w(),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=b(),n=y();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)(p)},y=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,w=()=>"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},4054:(e,t,n)=>{n.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>i,fetchResponseHandler:()=>l});n(4824),n(6530);var r=n(271),o=n.n(r),a=n(4656),s=n.n(a);n(6793),n(4341),n(8576);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,"\\;")},6793:(e,t,n)=>{n.d(t,{buildAPIBaseUrl:()=>o,getCurrentPathName:()=>r,getFromLocalStorage:()=>s,putOnLocalStorage:()=>a,removeFromLocalStorage:()=>c,retryPromise:()=>l,setSessionClearingState:()=>i});n(8362),n(6530);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=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,{queryTicketTypes:()=>p});var r=n(4054),o=n(8576),a=n(6793),s=n(6530),c=n.n(s);const i=require("lodash");var l=n.n(i);const d=500;l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().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)}),d),l().debounce((async(e,t,n,s=null)=>{let c=`/api/v1/summits/${e}/event-types?order=name&access_token=${await(0,o.getAccessToken)()}`;if(t=(0,r.escapeFilterValue)(t)){c+=`&filter[]=${encodeURIComponent(`name=@${t}`)}`}if(s){c+=`&filter[]=${encodeURIComponent(`class_name==${s}`)}`}fetch((0,a.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d),l().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)}),d),l().debounce((async(e,t,n)=>{let s;try{s=await(0,o.getAccessToken)()}catch(e){return void n(e)}let i=c()(`/api/v1/summits/${e}/registration-companies`);i.addQuery("access_token",s),i.addQuery("order","name"),t&&(t=(0,r.escapeFilterValue)(t),i.addQuery("filter[]",`name@@${t}`)),fetch((0,a.buildAPIBaseUrl)(i.toString())).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d),l().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}/access-level-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),l().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)}),d);const p=l().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}/ticket-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d)},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},3856:e=>{e.exports=require("idtoken-verifier")},8362:e=>{e.exports=require("moment-timezone")},6689:e=>{e.exports=require("react")},9953:e=>{e.exports=require("react-select/lib/Async")},4824:e=>{e.exports=require("superagent")},271:e=>{e.exports=require("sweetalert2")},6530:e=>{e.exports=require("urijs")}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}(()=>{n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t}})(),(()=>{n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}})(),(()=>{n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var r={};return(()=>{n.r(r),n.d(r,{default:()=>d});var e=n(6689),t=n.n(e),o=n(9953),a=n.n(o),s=n(7525);const c=["value","error","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 l(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 t().Component{constructor(e){super(e),this.state={value:e.value},this.handleChange=this.handleChange.bind(this),this.getTicketTypes=this.getTicketTypes.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:"tickettypeinput"}};this.props.onChange(t)}getTicketTypes(e,t){let{summitId:n}=this.props;if(!e)return Promise.resolve({options:[]});(0,s.queryTicketTypes)(n,e,t)}render(){let e=this.props,{value:n,error:r,onChange:o,id:s,multi:d}=e,p=l(e,c),u=this.props.hasOwnProperty("multi"),h=this.props.hasOwnProperty("error")&&""!=r;return t().createElement("div",null,t().createElement(a(),i({value:n,onChange:this.handleChange,loadOptions:this.getTicketTypes,getOptionValue:e=>this.getOptionValue(e),getOptionLabel:e=>this.getOptionLabel(e),isMulti:u},p)),h&&t().createElement("p",{className:"error-label"},r))}}})(),r})()));
@@ -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,(()=>(()=>{"use strict";var e={4341:(e,o,t)=>{t.d(o,{SET_LOGGED_USER:()=>n});t(4656),t(4054),t(6793),t(8576);const n="SET_LOGGED_USER"},8576:(e,o,t)=>{t.r(o),t.d(o,{ACCESS_TOKEN_SKEW_TIME:()=>E,RESPONSE_TYPE_CODE:()=>R,RESPONSE_TYPE_IMPLICIT:()=>L,clearAccessToken:()=>D,clearAuthInfo:()=>G,doLogin:()=>C,doLoginBasicLogin:()=>j,emitAccessToken:()=>N,getAccessToken:()=>F,getAuthInfo:()=>B,getAuthUrl:()=>v,getIdToken:()=>J,getLogoutUrl:()=>P,getOAuth2ClientId:()=>H,getOAuth2Flow:()=>V,getOAuth2IDPBaseUrl:()=>z,getOAuth2Scopes:()=>W,initLogOut:()=>Y,passwordlessLogin:()=>Z,passwordlessStart:()=>X,refreshAccessToken:()=>$,storeAuthInfo:()=>M,useOAuth2RefreshToken:()=>K,validateIdToken:()=>Q});var n=t(6793),r=t(4824),i=t.n(r);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);const w=require("crypto-js/sha256");var g=t.n(w);const h=require("crypto-js/enc-base64url");var _=t.n(h);const y=require("crypto-js/enc-hex");var m=t.n(y);const k=65536,S="undefined"!=typeof window?window.crypto||window.msCrypto:null;let O=i();const T=new(s()),I="openstackuicore.lock.getTokenSilently",E=20,L="token id_token",R="code",U="authInfo",A="nonce",b="pkce",v=(e=null,o=null,t=null,r=null)=>{let i=H(),a=(0,n.getAuthCallback)(),l=z(),s=W(),c=V();null!=e&&(a+=`?BackUrl=${encodeURI(e)}`);let u=x(16);(0,n.putOnLocalStorage)(A,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===R){const e=q();(0,n.putOnLocalStorage)(b,JSON.stringify(e)),f.code_challenge=e.codeChallenge,f.code_challenge_method="S256",f.approval_prompt="force"}return o&&(f.prompt=o),s&&s.includes("offline_access")&&(f.prompt="consent"),t&&(f.id_token_hint=t),r&&(f.provider=r),p=p.query(f),p},P=e=>{let o=z(),t=H(),r=d()(`${o}/oauth2/end-session`),i=x(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})},x=e=>{let o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t="";for(let n=0;n<e;n++)t+=o.charAt(Math.floor(Math.random()*o.length));return t},C=(e=null,o=null,t=null)=>{let r=v(e,t,null,o);(0,n.getCurrentLocation)().replace(r.toString())},j=(e=null)=>{C(e,null,null)},q=()=>{const e=(0,n.base64URLEncode)((e=>{if(e>4294967295)throw new RangeError("requested too many random bytes");const o=Buffer.allocUnsafe(e);if(!S)return a;if(e>0)if(e>k)for(let t=0;t<e;t+=k)S.getRandomValues(o.slice(t,t+k));else S.getRandomValues(o);return o})(64));return{codeVerifier:e,codeChallenge:((e,o="hex")=>{let t=m();return"Base64url"===o&&(t=_()),g()(e).toString(t)})(e,"Base64url"),createdAt:new Date}},N=async(e,o=null)=>{let t=z(),r=H(),i=(0,n.getAuthCallback)(),a=JSON.parse((0,n.getFromLocalStorage)(b,!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)}},D=async()=>{if(await(0,n.retryPromise)((()=>T.acquireLock(I,5e3)),10))try{let e=B();if(!e)throw Error("Missing Auth info.");let{accessToken:o,expiresIn:t,accessTokenUpdatedAt:n,refreshToken:r}=e;M(null,0,r)}finally{await T.releaseLock(I)}},F=async()=>{if(await(0,n.retryPromise)((()=>T.acquireLock(I,5e3)),10))try{let e=B();if(!e)throw Error("Missing Auth info.");let{accessToken:o,expiresIn:t,accessTokenUpdatedAt:n,refreshToken:r}=e,i=V(),a=Math.floor(Date.now()/1e3);if(t-=E,a-n>t||null==o){if(console.log("getAccessToken access token expired"),i===R&&K()){if(!r)throw G(),Error("missing Refresh Token");let e=await $(r),{access_token:o,expires_in:t,refresh_token:n}=e;return void 0===n&&(n=null),M(o,t,n),o}throw G(),Error("Access Token Expired.")}return o}finally{await T.releaseLock(I)}throw Error("Lock acquire error.")},$=async e=>{let o=z(),t=H();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}},M=(e,o,t=null,r=null)=>{let i=B(),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)(U,JSON.stringify(a))},B=()=>{let e=(0,n.getFromLocalStorage)(U,!1);return null===e?null:JSON.parse(e)},G=()=>{if("undefined"!=typeof window)return(0,n.removeFromLocalStorage)(U),(0,n.removeFromLocalStorage)(A),void(0,n.removeFromLocalStorage)(b)},J=()=>{if("undefined"!=typeof window){const e=B();return e?e.idToken:null}return null},H=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,V=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",K=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),z=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null,W=()=>"undefined"!=typeof window?window.SCOPES:null,Y=()=>{(0,n.getCurrentLocation)().replace(P(J()).toString())},Q=(e,o,t)=>{let r=new(p())({issuer:o,audience:t}),i=(0,n.getFromLocalStorage)(A,!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},X=e=>{let o=H(),t=W(),r=x(16);(0,n.putOnLocalStorage)(A,r);let i=z(),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)),O.post(a.toString()).send(l).then((e=>{let o=e.body;return Promise.resolve({response:o})})).catch((e=>Promise.reject(e)))},Z=e=>o=>{let t=H(),n=W(),r=z(),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)),O.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&&!Q(s,r,t))throw Error("id token is not valid.");return M(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)))}},4054:(e,o,t)=>{t(4824),t(6530),t(271),t(4656),t(6793),t(4341),t(8576);const n=e=>o=>({type:e,payload:o});n("RESET_LOADING"),n("START_LOADING"),n("STOP_LOADING")},6793:(e,o,t)=>{t.d(o,{base64URLEncode:()=>u,getAuthCallback:()=>n,getCurrentLocation:()=>r,getCurrentPathName:()=>a,getFromLocalStorage:()=>s,getOrigin:()=>i,putOnLocalStorage:()=>l,removeFromLocalStorage:()=>c,retryPromise:()=>p,setSessionClearingState:()=>d});t(8362),t(6530);const n=()=>"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,a=()=>"undefined"!=typeof window?window.location.pathname:null,l=(e,o)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,o)},s=(e,o)=>{if("undefined"!=typeof window){let t=window.localStorage.getItem(e);return o&&(console.log(`getFromLocalStorage removing key ${e}`),c(e)),t}return null},c=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},d=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},u=e=>e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),p=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")},8362:e=>{e.exports=require("moment-timezone")},4824:e=>{e.exports=require("superagent")},271:e=>{e.exports=require("sweetalert2")},6530:e=>{e.exports=require("urijs")}},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(8576)})()));
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,(()=>(()=>{"use strict";var e={4341:(e,o,t)=>{t.d(o,{SET_LOGGED_USER:()=>n});t(4656),t(4054),t(6793),t(8576);const n="SET_LOGGED_USER"},8576:(e,o,t)=>{t.r(o),t.d(o,{ACCESS_TOKEN_SKEW_TIME:()=>E,RESPONSE_TYPE_CODE:()=>R,RESPONSE_TYPE_IMPLICIT:()=>L,clearAccessToken:()=>D,clearAuthInfo:()=>G,doLogin:()=>C,doLoginBasicLogin:()=>j,emitAccessToken:()=>N,getAccessToken:()=>F,getAuthInfo:()=>B,getAuthUrl:()=>v,getIdToken:()=>J,getLogoutUrl:()=>P,getOAuth2ClientId:()=>H,getOAuth2Flow:()=>V,getOAuth2IDPBaseUrl:()=>z,getOAuth2Scopes:()=>W,initLogOut:()=>Y,passwordlessLogin:()=>Z,passwordlessStart:()=>X,refreshAccessToken:()=>$,storeAuthInfo:()=>M,useOAuth2RefreshToken:()=>K,validateIdToken:()=>Q});var n=t(6793),r=t(4824),i=t.n(r);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);const w=require("crypto-js/sha256");var g=t.n(w);const h=require("crypto-js/enc-base64url");var _=t.n(h);const y=require("crypto-js/enc-hex");var m=t.n(y);const k=65536,S="undefined"!=typeof window?window.crypto||window.msCrypto:null;let O=i();const T=new(l()),I="openstackuicore.lock.getTokenSilently",E=20,L="token id_token",R="code",U="authInfo",A="nonce",b="pkce",v=(e=null,o=null,t=null,r=null)=>{let i=H(),a=(0,n.getAuthCallback)(),s=z(),l=W(),c=V();null!=e&&(a+=`?BackUrl=${encodeURI(e)}`);let u=x(16);(0,n.putOnLocalStorage)(A,u);let p=d()(`${s}/oauth2/auth`),f={response_type:encodeURI(c),scope:encodeURI(l),nonce:u,response_mode:"fragment",client_id:encodeURI(i),redirect_uri:encodeURI(a)};if(c===R){const e=q();(0,n.putOnLocalStorage)(b,JSON.stringify(e)),f.code_challenge=e.codeChallenge,f.code_challenge_method="S256",f.approval_prompt="force"}return o&&(f.prompt=o),l&&l.includes("offline_access")&&(f.prompt="consent"),t&&(f.id_token_hint=t),r&&(f.provider=r),p=p.query(f),p},P=e=>{let o=z(),t=H(),r=d()(`${o}/oauth2/end-session`),i=x(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})},x=e=>{let o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t="";for(let n=0;n<e;n++)t+=o.charAt(Math.floor(Math.random()*o.length));return t},C=(e=null,o=null,t=null)=>{let r=v(e,t,null,o);(0,n.getCurrentLocation)().replace(r.toString())},j=(e=null)=>{C(e,null,null)},q=()=>{const e=(0,n.base64URLEncode)((e=>{if(e>4294967295)throw new RangeError("requested too many random bytes");const o=Buffer.allocUnsafe(e);if(!S)return a;if(e>0)if(e>k)for(let t=0;t<e;t+=k)S.getRandomValues(o.slice(t,t+k));else S.getRandomValues(o);return o})(64));return{codeVerifier:e,codeChallenge:((e,o="hex")=>{let t=m();return"Base64url"===o&&(t=_()),g()(e).toString(t)})(e,"Base64url"),createdAt:new Date}},N=async(e,o=null)=>{let t=z(),r=H(),i=(0,n.getAuthCallback)(),a=JSON.parse((0,n.getFromLocalStorage)(b,!0));null!=o&&(i+=`?BackUrl=${encodeURI(o)}`);const s={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(s)}).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:l,error_description:c}=o;return{access_token:n,refresh_token:r,id_token:i,expires_in:a,error:l,error_description:c}}catch(e){console.log(e)}},D=async()=>{if(await(0,n.retryPromise)((()=>T.acquireLock(I,5e3)),10))try{let e=B();if(!e)throw Error("Missing Auth info.");let{accessToken:o,expiresIn:t,accessTokenUpdatedAt:n,refreshToken:r}=e;M(null,0,r)}finally{await T.releaseLock(I)}},F=async()=>{if(await(0,n.retryPromise)((()=>T.acquireLock(I,5e3)),10))try{let e=B();if(!e)throw Error("Missing Auth info.");let{accessToken:o,expiresIn:t,accessTokenUpdatedAt:n,refreshToken:r}=e,i=V(),a=Math.floor(Date.now()/1e3);if(t-=E,a-n>t||null==o){if(console.log("getAccessToken access token expired"),i===R&&K()){if(!r)throw G(),Error("missing Refresh Token");let e=await $(r),{access_token:o,expires_in:t,refresh_token:n}=e;return void 0===n&&(n=null),M(o,t,n),o}throw G(),Error("Access Token Expired.")}return o}finally{await T.releaseLock(I)}throw Error("Lock acquire error.")},$=async e=>{let o=z(),t=H();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:s}=t;return{access_token:i,refresh_token:a,expires_in:s}}catch(e){throw console.log(e),e}},M=(e,o,t=null,r=null)=>{let i=B(),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)(U,JSON.stringify(a))},B=()=>{let e=(0,n.getFromLocalStorage)(U,!1);return null===e?null:JSON.parse(e)},G=()=>{if("undefined"!=typeof window)return(0,n.removeFromLocalStorage)(U),(0,n.removeFromLocalStorage)(A),void(0,n.removeFromLocalStorage)(b)},J=()=>{if("undefined"!=typeof window){const e=B();return e?e.idToken:null}return null},H=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,V=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",K=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),z=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null,W=()=>"undefined"!=typeof window?window.SCOPES:null,Y=()=>{(0,n.getCurrentLocation)().replace(P(J()).toString())},Q=(e,o,t)=>{let r=new(p())({issuer:o,audience:t}),i=(0,n.getFromLocalStorage)(A,!0),a=r.decode(e),s=(a.header.alg,a.header.kid,a.payload.aud),l=a.payload.iss;a.payload.exp,a.payload.nbf;return(a.payload.nonce||null)==i&&s==t&&l==o},X=e=>{let o=H(),t=W(),r=x(16);(0,n.putOnLocalStorage)(A,r);let i=z(),a=d()(`${i}/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)),e.hasOwnProperty("redirect_uri")&&(s.redirect_uri=encodeURIComponent(e.redirect_uri)),O.post(a.toString()).send(s).then((e=>{let o=e.body;return Promise.resolve({response:o})})).catch((e=>Promise.reject(e)))},Z=e=>o=>{let t=H(),n=W(),r=z(),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)),O.post(i.toString()).send(a).then((e=>{try{let n=e.body,{access_token:i,expires_in:a,refresh_token:s,id_token:l}=n;if(void 0===s&&(s=null),void 0===l&&(l=null),l&&!Q(l,r,t))throw Error("id token is not valid.");return M(i,a,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)))}},4054:(e,o,t)=>{t(4824),t(6530),t(271),t(4656),t(6793),t(4341),t(8576);const n=e=>o=>({type:e,payload:o});n("RESET_LOADING"),n("START_LOADING"),n("STOP_LOADING")},6793:(e,o,t)=>{t.d(o,{base64URLEncode:()=>u,getAuthCallback:()=>n,getCurrentLocation:()=>r,getCurrentPathName:()=>a,getFromLocalStorage:()=>l,getOrigin:()=>i,putOnLocalStorage:()=>s,removeFromLocalStorage:()=>c,retryPromise:()=>p,setSessionClearingState:()=>d});t(8362),t(6530);const n=()=>"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,a=()=>"undefined"!=typeof window?window.location.pathname:null,s=(e,o)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,o)},l=(e,o)=>{if("undefined"!=typeof window){let t=window.localStorage.getItem(e);return o&&(console.log(`getFromLocalStorage removing key ${e}`),c(e)),t}return null},c=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},d=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},u=e=>e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),p=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")},8362:e=>{e.exports=require("moment-timezone")},4824:e=>{e.exports=require("superagent")},271:e=>{e.exports=require("sweetalert2")},6530:e=>{e.exports=require("urijs")}},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(8576)})()));