openstack-uicore-foundation 4.0.40 → 4.0.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/attendance-tracker.js +1 -1
- package/lib/components/index.js +1 -1
- package/lib/components/inputs/access-levels-input.js +1 -1
- package/lib/components/inputs/company-input.js +1 -1
- package/lib/components/inputs/country-dropdown.js +1 -1
- package/lib/components/inputs/country-input.js +1 -1
- package/lib/components/inputs/event-input.js +1 -1
- package/lib/components/inputs/group-input.js +1 -1
- package/lib/components/inputs/language-input.js +1 -1
- package/lib/components/inputs/member-input.js +1 -1
- package/lib/components/inputs/organization-input.js +1 -1
- package/lib/components/inputs/registration-company-input.js +1 -1
- package/lib/components/inputs/speaker-input.js +1 -1
- package/lib/components/inputs/sponsor-input.js +1 -1
- package/lib/components/inputs/summit-input.js +1 -1
- package/lib/components/inputs/tag-input.js +1 -1
- package/lib/components/inputs/ticket-types-input.js +1 -1
- package/lib/security/actions.js +1 -1
- package/lib/security/methods.js +1 -1
- package/lib/security/reducers.js +1 -1
- package/lib/security/session-checker.js +1 -1
- package/lib/utils/actions.js +1 -1
- package/lib/utils/query-actions.js +1 -1
- package/package.json +1 -1
|
@@ -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=()=>{try{let e=(0,r.getFromLocalStorage)(l,!1);return e?JSON.parse(e):null}catch(e){return null}},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);const s=require("lodash");var c=n.n(s),i=n(6530),l=n.n(i);const d=500,u=(c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/members?filter=${s}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1";e&&(c+=`/summits/${e}`),c+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${s}&expand=member,registration_request`,fetch((0,o.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1",i=encodeURIComponent(`tag=@${t}`);c+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${i}&expand=tag,track_tag_group`:`/tags?filter=${i}`,c+=`&order=tag&page=1&per_page=50&access_token=${s}`,fetch((0,o.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((t=>{let r=[...t.data];e&&(r=r.map((e=>e.tag))),n(r)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${c}&order=name&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();let c=(t=(0,r.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n=!1,s)=>{const c=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let i=`/api/v1/summits/${e}/events`+(n?"/published":""),l=encodeURIComponent(`title=@${t}`);fetch((0,o.buildAPIBaseUrl)(`${i}?filter=${l}&order=title&access_token=${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(r.fetchErrorHandler)}),d),c().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),c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{let s;try{s=await(0,a.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,r.escapeFilterValue)(t),c.addQuery("filter[]",`name@@${t}`)),fetch((0,o.buildAPIBaseUrl)(c.toString())).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`company_name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${c}&expand=company,sponsorship&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),d));c().debounce((async(e,t={},n,s="v1")=>{const c=await(0,a.getAccessToken)();let i=l()(`/api/${s}/summits/${e}/ticket-types`);if(i.addQuery("access_token",c),i.addQuery("order","name"),t.hasOwnProperty("name")){const e=(0,r.escapeFilterValue)(t.name);i.addQuery("filter[]",`name@@${e}`)}if(t.hasOwnProperty("audience")){const e=(0,r.escapeFilterValue)(t.audience);i.addQuery("filter[]",`audience==${e}`)}fetch((0,o.buildAPIBaseUrl)(i.toString())).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=m();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),h(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}},h=(e,t,n=null,r=null)=>{let o=m(),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))},m=()=>{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:h,summitId:m,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),[T,S]=(0,e.useState)(!1);(0,e.useEffect)((()=>{I(a)}),[a]),(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&&t().createElement("i",{"aria-label":"Clear",style:{position:"absolute",top: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)(m,e,(n=>{if(!e){if(0===n.length)S(!0),k(!0);else{t([{value:null,label:"Other"}])}return}n instanceof Error&&g(n),0===n.length&&t([]);let a=[...n.map((e=>({value:e.id.toString(),label:e.name}))),{value:null,label:"Other"}];t(a)}))},isMulti:R,className:h},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=m();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 y(),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),h(t,n,a),t}throw y(),Error("Access Token Expired.")}return t}finally{await s.releaseLock(l)}throw Error("Lock acquire error.")},f=async e=>{let t=b(),n=g();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}},h=(e,t,n=null,r=null)=>{let o=m(),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))},m=()=>{try{let e=(0,a.getFromLocalStorage)(i,!1);return e?JSON.parse(e):null}catch(e){return null}},y=()=>{if("undefined"!=typeof window)return(0,a.removeFromLocalStorage)(i),(0,a.removeFromLocalStorage)(u),void(0,a.removeFromLocalStorage)(d)},g=()=>"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);const s=require("lodash");var l=n.n(s),c=n(6530),i=n.n(c);const u=500,d=(l().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),l().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),l().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),l().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),l().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),l().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),l().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),l().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),l().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),l().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),l().debounce((async(e,t,n)=>{let s;try{s=await(0,r.getAccessToken)()}catch(e){return void n(e)}let l=i()(`/api/v1/summits/${e}/registration-companies`);l.addQuery("access_token",s),l.addQuery("order","name"),t&&(t=(0,a.escapeFilterValue)(t),l.addQuery("filter[]",`name@@${t}`)),fetch((0,o.buildAPIBaseUrl)(l.toString())).then(a.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(a.fetchErrorHandler)}),u));l().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),l().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),l().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);l().debounce((async(e,t={},n,s="v1")=>{const l=await(0,r.getAccessToken)();let c=i()(`/api/${s}/summits/${e}/ticket-types`);if(c.addQuery("access_token",l),c.addQuery("order","name"),t.hasOwnProperty("name")){const e=(0,a.escapeFilterValue)(t.name);c.addQuery("filter[]",`name@@${e}`)}if(t.hasOwnProperty("audience")){const e=(0,a.escapeFilterValue)(t.audience);c.addQuery("filter[]",`audience==${e}`)}fetch((0,o.buildAPIBaseUrl)(c.toString())).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:h,summitId:m,onError:y}=n,g=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),[S,T]=(0,e.useState)(!1);(0,e.useEffect)((()=>{I(a)}),[a]),(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}},g)),!S&&t().createElement("i",{"aria-label":"Clear",style:{position:"absolute",top: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)(m,e,(n=>{if(!e){if(0===n.length)T(!0),k(!0);else{t([{value:null,label:"Other"}])}return}n instanceof Error&&y(n),0===n.length&&t([]);let a=[...n.map((e=>({value:e.id.toString(),label:e.name}))),{value:null,label:"Other"}];t(a)}))},isMulti:R,className:h},g)),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 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",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:a}=e,o=w(),l=Math.floor(Date.now()/1e3);if(n-=20,l-r>n||null==t){if(console.log("getAccessToken access token expired"),o===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=y();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=()=>{try{let e=(0,r.getFromLocalStorage)(l,!1);return e?JSON.parse(e):null}catch(e){return null}},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),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,{querySpeakers:()=>p});var r=n(4054),a=n(8576),o=n(6793);const s=require("lodash");var c=n.n(s),i=n(6530),l=n.n(i);const d=500,p=(c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/members?filter=${s}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1";e&&(c+=`/summits/${e}`),c+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${s}&expand=member,registration_request`,fetch((0,o.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d));c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1",i=encodeURIComponent(`tag=@${t}`);c+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${i}&expand=tag,track_tag_group`:`/tags?filter=${i}`,c+=`&order=tag&page=1&per_page=50&access_token=${s}`,fetch((0,o.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((t=>{let r=[...t.data];e&&(r=r.map((e=>e.tag))),n(r)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${c}&order=name&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();let c=(t=(0,r.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n=!1,s)=>{const c=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let i=`/api/v1/summits/${e}/events`+(n?"/published":""),l=encodeURIComponent(`title=@${t}`);fetch((0,o.buildAPIBaseUrl)(`${i}?filter=${l}&order=title&access_token=${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(r.fetchErrorHandler)}),d),c().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),c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{let s;try{s=await(0,a.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,r.escapeFilterValue)(t),c.addQuery("filter[]",`name@@${t}`)),fetch((0,o.buildAPIBaseUrl)(c.toString())).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`company_name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${c}&expand=company,sponsorship&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),d);c().debounce((async(e,t={},n,s="v1")=>{const c=await(0,a.getAccessToken)();let i=l()(`/api/${s}/summits/${e}/ticket-types`);if(i.addQuery("access_token",c),i.addQuery("order","name"),t.hasOwnProperty("name")){const e=(0,r.escapeFilterValue)(t.name);i.addQuery("filter[]",`name@@${e}`)}if(t.hasOwnProperty("audience")){const e=(0,r.escapeFilterValue)(t.audience);i.addQuery("filter[]",`audience==${e}`)}fetch((0,o.buildAPIBaseUrl)(i.toString())).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:()=>p});var e=n(6689),t=n.n(e),a=n(9953),o=n.n(a);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,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.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:a,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(o(),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:()=>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 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=()=>{try{let e=(0,r.getFromLocalStorage)(l,!1);return e?JSON.parse(e):null}catch(e){return null}},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,{querySponsors:()=>u});var r=n(4054),o=n(8576),a=n(6793);const s=require("lodash");var c=n.n(s),i=n(6530),l=n.n(i);const d=500,u=(c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/members?filter=${s}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1";e&&(c+=`/summits/${e}`),c+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${s}&expand=member,registration_request`,fetch((0,a.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1",i=encodeURIComponent(`tag=@${t}`);c+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${i}&expand=tag,track_tag_group`:`/tags?filter=${i}`,c+=`&order=tag&page=1&per_page=50&access_token=${s}`,fetch((0,a.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((t=>{let r=[...t.data];e&&(r=r.map((e=>e.tag))),n(r)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${c}&order=name&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();let c=(t=(0,r.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n=!1,s)=>{const c=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let i=`/api/v1/summits/${e}/events`+(n?"/published":""),l=encodeURIComponent(`title=@${t}`);fetch((0,a.buildAPIBaseUrl)(`${i}?filter=${l}&order=title&access_token=${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(r.fetchErrorHandler)}),d),c().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),c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{let s;try{s=await(0,o.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,r.escapeFilterValue)(t),c.addQuery("filter[]",`name@@${t}`)),fetch((0,a.buildAPIBaseUrl)(c.toString())).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`company_name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${c}&expand=company,sponsorship&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d));c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),d);c().debounce((async(e,t={},n,s="v1")=>{const c=await(0,o.getAccessToken)();let i=l()(`/api/${s}/summits/${e}/ticket-types`);if(i.addQuery("access_token",c),i.addQuery("order","name"),t.hasOwnProperty("name")){const e=(0,r.escapeFilterValue)(t.name);i.addQuery("filter[]",`name@@${e}`)}if(t.hasOwnProperty("audience")){const e=(0,r.escapeFilterValue)(t.audience);i.addQuery("filter[]",`audience==${e}`)}fetch((0,a.buildAPIBaseUrl)(i.toString())).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:u}=e,p=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},p)),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 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 f(a),{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 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}},h=(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=()=>{try{let e=(0,r.getFromLocalStorage)(l,!1);return e?JSON.parse(e):null}catch(e){return null}},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),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,{querySummits:()=>u});var r=n(4054),a=n(8576),o=n(6793);const s=require("lodash");var c=n.n(s),i=n(6530),l=n.n(i);const d=500,u=(c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/members?filter=${s}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),d));c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1";e&&(c+=`/summits/${e}`),c+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${s}&expand=member,registration_request`,fetch((0,o.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1",i=encodeURIComponent(`tag=@${t}`);c+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${i}&expand=tag,track_tag_group`:`/tags?filter=${i}`,c+=`&order=tag&page=1&per_page=50&access_token=${s}`,fetch((0,o.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((t=>{let r=[...t.data];e&&(r=r.map((e=>e.tag))),n(r)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${c}&order=name&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();let c=(t=(0,r.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n=!1,s)=>{const c=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let i=`/api/v1/summits/${e}/events`+(n?"/published":""),l=encodeURIComponent(`title=@${t}`);fetch((0,o.buildAPIBaseUrl)(`${i}?filter=${l}&order=title&access_token=${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(r.fetchErrorHandler)}),d),c().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),c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{let s;try{s=await(0,a.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,r.escapeFilterValue)(t),c.addQuery("filter[]",`name@@${t}`)),fetch((0,o.buildAPIBaseUrl)(c.toString())).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`company_name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${c}&expand=company,sponsorship&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{const s=await(0,a.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t)=>{const n=await(0,a.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),d);c().debounce((async(e,t={},n,s="v1")=>{const c=await(0,a.getAccessToken)();let i=l()(`/api/${s}/summits/${e}/ticket-types`);if(i.addQuery("access_token",c),i.addQuery("order","name"),t.hasOwnProperty("name")){const e=(0,r.escapeFilterValue)(t.name);i.addQuery("filter[]",`name@@${e}`)}if(t.hasOwnProperty("audience")){const e=(0,r.escapeFilterValue)(t.audience);i.addQuery("filter[]",`audience==${e}`)}fetch((0,o.buildAPIBaseUrl)(i.toString())).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:()=>d});var e=n(6689),t=n.n(e),a=n(9953),o=n.n(a),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,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}class d extends 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:a,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(o(),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,r)=>{r(4656),r(4054),r(6793),r(8576)},8576:(e,t,r)=>{r.d(t,{getAccessToken:()=>p});var n=r(6793);r(4824);const a=require("browser-tabs-lock");var o=r.n(a);r(6530),r(3856),r(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,n.retryPromise)((()=>s.acquireLock(c,5e3)),10))try{let e=m();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:r,accessTokenUpdatedAt:n,refreshToken:a}=e,o=y(),i=Math.floor(Date.now()/1e3);if(r-=20,i-n>r||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:r,refresh_token:n}=e;return void 0===n&&(n=null),f(t,r,n),t}throw g(),Error("Access Token Expired.")}return t}finally{await s.releaseLock(c)}throw Error("Lock acquire error.")},h=async e=>{let t=$(),r=w();const a={grant_type:"refresh_token",client_id:encodeURI(r),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,n.getCurrentPathName)();throw(0,n.setSessionClearingState)(!0),Error(`${e.status} - ${e.statusText}`)}return e})).catch((function(e){throw Error(`Request failed: ${e.message}`)})),r=await e.json();let{access_token:o,refresh_token:s,expires_in:c}=r;return{access_token:o,refresh_token:s,expires_in:c}}catch(e){throw console.log(e),e}},f=(e,t,r=null,a=null)=>{let o=m(),s={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===r&&o&&(r=o.refreshToken),null===a&&o&&(a=o.idToken),r&&(s.refreshToken=r),a&&(s.idToken=a),(0,n.putOnLocalStorage)(i,JSON.stringify(s))},m=()=>{try{let e=(0,n.getFromLocalStorage)(i,!1);return e?JSON.parse(e):null}catch(e){return null}},g=()=>{if("undefined"!=typeof window)return(0,n.removeFromLocalStorage)(i),(0,n.removeFromLocalStorage)(d),void(0,n.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,r)=>{r.d(t,{escapeFilterValue:()=>d,fetchErrorHandler:()=>l,fetchResponseHandler:()=>i});r(4824),r(6530);var n=r(271),a=r.n(n),o=r(4656),s=r.n(o);r(6793),r(4341),r(8576);const c=e=>t=>({type:e,payload:t}),l=(c("RESET_LOADING"),c("START_LOADING"),c("STOP_LOADING"),e=>{let t=e.status,r=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",r,"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,r)=>{r.d(t,{buildAPIBaseUrl:()=>a,getCurrentPathName:()=>n,getFromLocalStorage:()=>s,putOnLocalStorage:()=>o,removeFromLocalStorage:()=>c,retryPromise:()=>d,setSessionClearingState:()=>l,shallowEqual:()=>i});r(8362),r(6530);const n=()=>"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 r=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),c(e)),r}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 r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let n of r)if(e[n]!==t[n])return!1;return!0},d=async(e,t=3)=>{for(let r=0;r<t;r++)if(await e())return!0;return!1}},7525:(e,t,r)=>{r.d(t,{queryTags:()=>u});var n=r(4054),a=r(8576),o=r(6793);const s=require("lodash");var c=r.n(s),l=r(6530),i=r.n(l);const d=500,u=(c().debounce((async(e,t)=>{const r=await(0,a.getAccessToken)();e=(0,n.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=${r}`)).then(n.fetchResponseHandler).then((e=>{let r=[...e.data];t(r)})).catch(n.fetchErrorHandler)}),d),c().debounce((async(e,t)=>{const r=await(0,a.getAccessToken)();e=(0,n.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${r}`)).then(n.fetchResponseHandler).then((e=>{let r=[...e.data];t(r)})).catch(n.fetchErrorHandler)}),d),c().debounce((async(e,t,r)=>{const s=await(0,a.getAccessToken)();t=(0,n.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(n.fetchResponseHandler).then((e=>{let t=[...e.data];r(t)})).catch(n.fetchErrorHandler)}),d),c().debounce((async(e,t,r)=>{const s=await(0,a.getAccessToken)();t=(0,n.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(n.fetchResponseHandler).then((t=>{let n=[...t.data];e&&(n=n.map((e=>e.tag))),r(n)})).catch(n.fetchErrorHandler)}),d));c().debounce((async(e,t,r)=>{const s=await(0,a.getAccessToken)();t=(0,n.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${c}&order=name&access_token=${s}`)).then(n.fetchResponseHandler).then((e=>{let t=[...e.data];r(t)})).catch(n.fetchErrorHandler)}),d),c().debounce((async(e,t,r)=>{const s=await(0,a.getAccessToken)();let c=(t=(0,n.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${c}`)).then(n.fetchResponseHandler).then((e=>{let t=[...e.data];r(t)})).catch(n.fetchErrorHandler)}),d),c().debounce((async(e,t,r=!1,s)=>{const c=await(0,a.getAccessToken)();t=(0,n.escapeFilterValue)(t);let l=`/api/v1/summits/${e}/events`+(r?"/published":""),i=encodeURIComponent(`title=@${t}`);fetch((0,o.buildAPIBaseUrl)(`${l}?filter=${i}&order=title&access_token=${c}`)).then(n.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(n.fetchErrorHandler)}),d),c().debounce((async(e,t,r,s=null)=>{let c=`/api/v1/summits/${e}/event-types?order=name&access_token=${await(0,a.getAccessToken)()}`;if(t=(0,n.escapeFilterValue)(t)){c+=`&filter[]=${encodeURIComponent(`name=@${t}`)}`}if(s){c+=`&filter[]=${encodeURIComponent(`class_name==${s}`)}`}fetch((0,o.buildAPIBaseUrl)(c)).then(n.fetchResponseHandler).then((e=>{let t=[...e.data];r(t)})).catch(n.fetchErrorHandler)}),d),c().debounce((async(e,t)=>{const r=await(0,a.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${r}`)).then(n.fetchResponseHandler).then((e=>{let r=[...e.data];t(r)})).catch(n.fetchErrorHandler)}),d),c().debounce((async(e,t)=>{const r=await(0,a.getAccessToken)();e=(0,n.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${r}`)).then(n.fetchResponseHandler).then((e=>{let r=[...e.data];t(r)})).catch(n.fetchErrorHandler)}),d),c().debounce((async(e,t,r)=>{let s;try{s=await(0,a.getAccessToken)()}catch(e){return void r(e)}let c=i()(`/api/v1/summits/${e}/registration-companies`);c.addQuery("access_token",s),c.addQuery("order","name"),t&&(t=(0,n.escapeFilterValue)(t),c.addQuery("filter[]",`name@@${t}`)),fetch((0,o.buildAPIBaseUrl)(c.toString())).then(n.fetchResponseHandler).then((e=>{let t=[...e.data];r(t)})).catch(n.fetchErrorHandler)}),d),c().debounce((async(e,t,r)=>{const s=await(0,a.getAccessToken)();t=(0,n.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(n.fetchResponseHandler).then((e=>{let t=[...e.data];r(t)})).catch(n.fetchErrorHandler)}),d),c().debounce((async(e,t,r)=>{const s=await(0,a.getAccessToken)();t=(0,n.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${c}&&access_token=${s}`)).then(n.fetchResponseHandler).then((e=>{let t=[...e.data];r(t)})).catch(n.fetchErrorHandler)}),d),c().debounce((async(e,t)=>{const r=await(0,a.getAccessToken)();e=(0,n.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,o.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${r}`)).then(n.fetchResponseHandler).then((e=>{let r=[...e.data];t(r)})).catch(n.fetchErrorHandler)}),d);c().debounce((async(e,t={},r,s="v1")=>{const c=await(0,a.getAccessToken)();let l=i()(`/api/${s}/summits/${e}/ticket-types`);if(l.addQuery("access_token",c),l.addQuery("order","name"),t.hasOwnProperty("name")){const e=(0,n.escapeFilterValue)(t.name);l.addQuery("filter[]",`name@@${e}`)}if(t.hasOwnProperty("audience")){const e=(0,n.escapeFilterValue)(t.audience);l.addQuery("filter[]",`audience==${e}`)}fetch((0,o.buildAPIBaseUrl)(l.toString())).then(n.fetchResponseHandler).then((e=>{let t=[...e.data];r(t)})).catch(n.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 r(n){var a=t[n];if(void 0!==a)return a.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}(()=>{r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t}})(),(()=>{r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}})(),(()=>{r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var n={};return(()=>{r.r(n),r.d(n,{default:()=>u});var e=r(6689),t=r.n(e),a=r(9953),o=r.n(a),s=r(7525),c=r(6793);const l=["className","error"];function i(){return i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i.apply(this,arguments)}function d(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}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,r){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 r=this.props.hasOwnProperty("summitId")?this.props.summitId:null;(0,s.queryTags)(r,e,t)}render(){let e=this.props,{className:r,error:n}=e,a=d(e,l),s=this.props.hasOwnProperty("error")&&""!=n,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:r+" "+(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"},n))}}})(),n})()));
|
|
@@ -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=()=>{try{let e=(0,r.getFromLocalStorage)(l,!1);return e?JSON.parse(e):null}catch(e){return null}},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);const s=require("lodash");var c=n.n(s),i=n(6530),l=n.n(i);const d=500;c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/members?filter=${s}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/all?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1";e&&(c+=`/summits/${e}`),c+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${s}&expand=member,registration_request`,fetch((0,a.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c="/api/v1",i=encodeURIComponent(`tag=@${t}`);c+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${i}&expand=tag,track_tag_group`:`/tags?filter=${i}`,c+=`&order=tag&page=1&per_page=50&access_token=${s}`,fetch((0,a.buildAPIBaseUrl)(c)).then(r.fetchResponseHandler).then((t=>{let r=[...t.data];e&&(r=r.map((e=>e.tag))),n(r)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/tracks?filter=${c}&order=name&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();let c=(t=(0,r.escapeFilterValue)(t))?encodeURIComponent(`filter=name=@${t}`):"";fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${s}&${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n=!1,s)=>{const c=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let i=`/api/v1/summits/${e}/events`+(n?"/published":""),l=encodeURIComponent(`title=@${t}`);fetch((0,a.buildAPIBaseUrl)(`${i}?filter=${l}&order=title&access_token=${c}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];s(t)})).catch(r.fetchErrorHandler)}),d),c().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),c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();let s=encodeURIComponent(`title=@${e},code=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/groups?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/companies?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{let s;try{s=await(0,o.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,r.escapeFilterValue)(t),c.addQuery("filter[]",`name@@${t}`)),fetch((0,a.buildAPIBaseUrl)(c.toString())).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`company_name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/sponsors?filter=${c}&expand=company,sponsorship&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t,n)=>{const s=await(0,o.getAccessToken)();t=(0,r.escapeFilterValue)(t);let c=encodeURIComponent(`name=@${t}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/summits/${e}/access-level-types?filter=${c}&&access_token=${s}`)).then(r.fetchResponseHandler).then((e=>{let t=[...e.data];n(t)})).catch(r.fetchErrorHandler)}),d),c().debounce((async(e,t)=>{const n=await(0,o.getAccessToken)();e=(0,r.escapeFilterValue)(e);let s=encodeURIComponent(`name=@${e}`);fetch((0,a.buildAPIBaseUrl)(`/api/v1/organizations?filter=${s}&access_token=${n}`)).then(r.fetchResponseHandler).then((e=>{let n=[...e.data];t(n)})).catch(r.fetchErrorHandler)}),d);const p=c().debounce((async(e,t={},n,s="v1")=>{const c=await(0,o.getAccessToken)();let i=l()(`/api/${s}/summits/${e}/ticket-types`);if(i.addQuery("access_token",c),i.addQuery("order","name"),t.hasOwnProperty("name")){const e=(0,r.escapeFilterValue)(t.name);i.addQuery("filter[]",`name@@${e}`)}if(t.hasOwnProperty("audience")){const e=(0,r.escapeFilterValue)(t.audience);i.addQuery("filter[]",`audience==${e}`)}fetch((0,a.buildAPIBaseUrl)(i.toString())).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")},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(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:()=>h});var e=n(6689),t=n.n(e),o=n(9953),a=n.n(o),s=n(7525),c=n(580),i=n.n(c);const l=["value","error","onChange","id","multi"];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 p(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}class u 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,version:r}=this.props;if(!e)return Promise.resolve({options:[]});let o={name:e};this.props.hasOwnProperty("audience")&&(o.audience=this.props.audience),(0,s.queryTicketTypes)(n,o,t,r)}render(){let e=this.props,{value:n,error:r,onChange:o,id:s,multi:c}=e,i=p(e,l),u=this.props.hasOwnProperty("multi"),h=this.props.hasOwnProperty("error")&&""!=r;return t().createElement("div",null,t().createElement(a(),d({value:n,onChange:this.handleChange,loadOptions:this.getTicketTypes,getOptionValue:e=>this.getOptionValue(e),getOptionLabel:e=>this.getOptionLabel(e),isMulti:u},i)),h&&t().createElement("p",{className:"error-label"},r))}}u.defaultProps={version:"v1"},u.propTypes={audience:i().string,version:i().string};const h=u})(),r})()));
|
package/lib/security/actions.js
CHANGED
|
@@ -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,o)=>{o.r(t),o.d(t,{CLEAR_SESSION_STATE:()=>w,LOGOUT_USER:()=>p,RECEIVE_USER_INFO:()=>g,REQUEST_USER_INFO:()=>f,SESSION_STATE_STATUS_CHANGED:()=>y,SESSION_STATE_STATUS_ERROR:()=>h,SESSION_STATE_STATUS_UNCHANGED:()=>_,SET_LOGGED_USER:()=>d,UPDATE_SESSION_STATE_STATUS:()=>S,UPDATE_USER_INFO:()=>E,doLogout:()=>m,getUserInfo:()=>T,onUserAuth:()=>O,updateSessionStateStatus:()=>A,updateUserInfo:()=>b});var r=o(4656),n=o.n(r),s=o(4054),i=o(6793),a=o(8576);function l(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function u(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?l(Object(o),!0).forEach((function(t){c(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):l(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function c(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}const d="SET_LOGGED_USER",p="LOGOUT_USER",f="REQUEST_USER_INFO",g="RECEIVE_USER_INFO",w="CLEAR_SESSION_STATE",S="UPDATE_SESSION_STATE_STATUS",_="unchanged",y="changed",h="error",E="UPDATE_USER_INFO",O=(e,t,o,r=0,n=null)=>s=>{(0,a.storeAuthInfo)(e,r,n,t),s({type:d,payload:{sessionState:o}})},m=e=>(t,o)=>{t({type:p,payload:{backUrl:e}})},T=(e="groups",t="",o=null,r=null,l=null)=>async(u,c)=>{let d=(0,i.getAllowedUserGroups)();d=""!==d?d.split(" "):[];let{loggedUserState:p}=c(),{member:w}=p,S=await(0,a.getAccessToken)();if(null!=w)return null!=r&&null!=o&&r.push(o),Promise.resolve();null==l&&(l=s.authErrorHandler),u((0,s.startLoading)());let _={access_token:S,expand:e};return t&&(_.fields=t),(0,s.getRequest)((0,s.createAction)(f),(0,s.createAction)(g),(0,i.buildAPIBaseUrl)("/api/v1/members/me"),l)(_)(u,c).then((()=>{u((0,s.stopLoading)());let{member:e}=c().loggedUserState;if(null==e){let e={title:"ERROR",html:n().translate("errors.user_not_set"),type:"error"};u((0,s.showMessage)(e,a.initLogOut))}if(d.length>0){if(0===e.groups.filter(((e,t)=>d.includes(e.code))).length){let e={title:"ERROR",html:n().translate("errors.user_not_authz"),type:"error"};return void u((0,s.showMessage)(e,a.initLogOut))}}null!=r&&null!=o&&r.push(o)}))},b=e=>(t,o)=>{let{loggedUserState:r}=o(),{member:n}=r;if(null==n)throw Error("Member is not set.");if(e.id!=n.id)throw Error("Member is not the same.");t({type:E,payload:u({},e)})},A=e=>(t,o)=>{t({type:S,payload:{sessionStateStatus:e}})}},8576:(e,t,o)=>{o.d(t,{doLogin:()=>b,getAccessToken:()=>R,initLogOut:()=>C,storeAuthInfo:()=>k});var r=o(6793);o(4824);const n=require("browser-tabs-lock");var s=o.n(n),i=o(6530),l=o.n(i);o(3856),o(4341);const u=require("crypto-js/sha256");var c=o.n(u);const d=require("crypto-js/enc-base64url");var p=o.n(d);const f=require("crypto-js/enc-hex");var g=o.n(f);const w=65536,S="undefined"!=typeof window?window.crypto||window.msCrypto:null;const _=new(s()),y="openstackuicore.lock.getTokenSilently",h="code",E="authInfo",O="nonce",m="pkce",T=e=>{let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",o="";for(let r=0;r<e;r++)o+=t.charAt(Math.floor(Math.random()*t.length));return o},b=(e=null,t=null,o=null)=>{let n=((e=null,t=null,o=null,n=null)=>{let s=v(),i=(0,r.getAuthCallback)(),a=j(),u=x(),c=P();null!=e&&(i+=`?BackUrl=${encodeURI(e)}`);let d=T(16);(0,r.putOnLocalStorage)(O,d);let p=l()(`${a}/oauth2/auth`),f={response_type:encodeURI(c),scope:encodeURI(u),nonce:d,response_mode:"fragment",client_id:encodeURI(s),redirect_uri:encodeURI(i)};if(c===h){const e=A();(0,r.putOnLocalStorage)(m,JSON.stringify(e)),f.code_challenge=e.codeChallenge,f.code_challenge_method="S256",f.approval_prompt="force"}return t&&(f.prompt=t),u&&u.includes("offline_access")&&(f.prompt="consent"),o&&(f.id_token_hint=o),n&&(f.provider=n),p=p.query(f),p})(e,o,null,t);(0,r.getCurrentLocation)().replace(n.toString())},A=()=>{const e=(0,r.base64URLEncode)((e=>{if(e>4294967295)throw new RangeError("requested too many random bytes");const t=Buffer.allocUnsafe(e);if(!S)return a;if(e>0)if(e>w)for(let o=0;o<e;o+=w)S.getRandomValues(t.slice(o,o+w));else S.getRandomValues(t);return t})(64));return{codeVerifier:e,codeChallenge:((e,t="hex")=>{let o=g();return"Base64url"===t&&(o=p()),c()(e).toString(o)})(e,"Base64url"),createdAt:new Date}},R=async()=>{if(await(0,r.retryPromise)((()=>_.acquireLock(y,5e3)),10))try{let e=L();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:o,accessTokenUpdatedAt:r,refreshToken:n}=e,s=P(),i=Math.floor(Date.now()/1e3);if(o-=20,i-r>o||null==t){if(console.log("getAccessToken access token expired"),s===h&&N()){if(!n)throw I(),Error("missing Refresh Token");let e=await U(n),{access_token:t,expires_in:o,refresh_token:r}=e;return void 0===r&&(r=null),k(t,o,r),t}throw I(),Error("Access Token Expired.")}return t}finally{await _.releaseLock(y)}throw Error("Lock acquire error.")},U=async e=>{let t=j(),o=v();const n={grant_type:"refresh_token",client_id:encodeURI(o),refresh_token:e};try{const e=await fetch(`${t}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(n)}).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}`)})),o=await e.json();let{access_token:s,refresh_token:i,expires_in:a}=o;return{access_token:s,refresh_token:i,expires_in:a}}catch(e){throw console.log(e),e}},k=(e,t,o=null,n=null)=>{let s=L(),i={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===o&&s&&(o=s.refreshToken),null===n&&s&&(n=s.idToken),o&&(i.refreshToken=o),n&&(i.idToken=n),(0,r.putOnLocalStorage)(E,JSON.stringify(i))},L=()=>{let e=(0,r.getFromLocalStorage)(E,!1);return null===e?null:JSON.parse(e)},I=()=>{if("undefined"!=typeof window)return(0,r.removeFromLocalStorage)(E),(0,r.removeFromLocalStorage)(O),void(0,r.removeFromLocalStorage)(m)},v=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,P=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",N=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),j=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null,x=()=>"undefined"!=typeof window?window.SCOPES:null,C=()=>{(0,r.getCurrentLocation)().replace((e=>{let t=j(),o=v(),n=l()(`${t}/oauth2/end-session`),s=T(16),i=(0,r.getOrigin)()+"/auth/logout";return(0,r.putOnLocalStorage)("post_logout_state",s),n.query({id_token_hint:e,post_logout_redirect_uri:encodeURI(i),client_id:encodeURI(o),state:s})})((()=>{if("undefined"!=typeof window){const e=L();return e?e.idToken:null}return null})()).toString())}},4054:(e,t,o)=>{o.d(t,{authErrorHandler:()=>E,createAction:()=>w,getRequest:()=>O,showMessage:()=>b,startLoading:()=>S,stopLoading:()=>_});var r=o(4824),n=o.n(r),s=o(6530),i=o.n(s),a=o(271),l=o.n(a),u=o(4656),c=o.n(u),d=o(6793),p=o(4341),f=o(8576);let g=n();const w=e=>t=>({type:e,payload:t}),S=(w("RESET_LOADING"),w("START_LOADING")),_=w("STOP_LOADING"),y={},h=e=>0===Object.keys(e).length&&e.constructor===Object,E=(e,t)=>(t,o)=>{let r=e.status,n="";switch(t(_()),r){case 403:let o={title:"ERROR",html:c().translate("errors.user_not_authz"),type:"error"};t(b(o,f.initLogOut));break;case 401:let r=(0,d.getCurrentPathName)(),a=(0,d.isClearingSessionState)();t({type:p.CLEAR_SESSION_STATE,payload:{}}),a||((0,d.setSessionClearingState)(!0),console.log("authErrorHandler 401 - re login"),(0,f.doLogin)(r));break;case 404:n="",n=e.response.body&&e.response.body.message?e.response.body.message:e.response.error&&e.response.error.message?e.response.error.message:e.message,l().fire("Not Found",n,"warning");break;case 412:for(var[s,i]of Object.entries(e.response.body.errors))isNaN(s)&&(n+=s+": "),n+=i+"<br>";l().fire("Validation error",n,"warning"),t({type:"VALIDATE",payload:{errors:e.response.body.errors}});break;default:l().fire("ERROR",c().translate("errors.server_error"),"error")}},O=(e,t,o,r=m,n={})=>(s={})=>(a,l)=>{let u=i()(o);h(s)||(u=u.query(s));let c=u.toString();return e&&"function"==typeof e&&a(e(n)),(e=>{y[e]&&(y[e].abort(),console.log(`aborted request ${e}`),delete y[e])})(c),new Promise(((e,o)=>{let n=g.get(u.toString()).timeout({response:6e4,deadline:6e4}).end(T(a,l,t,r,e,o));((e,t)=>{y[e]=t})(c,n)}))},m=(e,t)=>e=>{let o=t.body,r="";o instanceof Object&&o.hasOwnProperty("message")&&(r=o.message),l().fire(t.statusText,r,"error")},T=(e,t,o,r,n,s)=>(i,a)=>{if(i||!a.ok)return r&&r(i,a)(e,t),s({err:i,res:a,dispatch:e,state:t});let l=a.body;return"function"==typeof o?(e(o({response:l})),n({response:l})):(e(o),n({response:l}))},b=(e,t={})=>o=>{o(_()),l().fire(e).then((e=>{e.value&&"function"==typeof t&&t()}))}},6793:(e,t,o)=>{o.d(t,{base64URLEncode:()=>g,buildAPIBaseUrl:()=>l,getAllowedUserGroups:()=>a,getAuthCallback:()=>r,getCurrentLocation:()=>n,getCurrentPathName:()=>i,getFromLocalStorage:()=>c,getOrigin:()=>s,isClearingSessionState:()=>p,putOnLocalStorage:()=>u,removeFromLocalStorage:()=>d,retryPromise:()=>w,setSessionClearingState:()=>f});o(8362),o(6530);const r=()=>"undefined"!=typeof window?`${window.location.origin}/auth/callback`:null,n=()=>{let e="";return"undefined"!=typeof window&&(e=window.location,window.top&&(e=window.top.location)),e},s=()=>"undefined"!=typeof window?window.location.origin:null,i=()=>"undefined"!=typeof window?window.location.pathname:null,a=()=>"undefined"!=typeof window?window.ALLOWED_USER_GROUPS||"":null,l=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,u=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},c=(e,t)=>{if("undefined"!=typeof window){let o=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),d(e)),o}return null},d=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},p=()=>"undefined"!=typeof window&&window.clearing_session_state,f=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},g=e=>e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),w=async(e,t=3)=>{for(let o=0;o<t;o++)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")}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var s=t[r]={exports:{}};return e[r](s,s.exports,o),s.exports}return(()=>{o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t}})(),(()=>{o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}})(),(()=>{o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})(),o(4341)})()));
|
|
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,r)=>{r.r(t),r.d(t,{CLEAR_SESSION_STATE:()=>w,LOGOUT_USER:()=>p,RECEIVE_USER_INFO:()=>g,REQUEST_USER_INFO:()=>f,SESSION_STATE_STATUS_CHANGED:()=>y,SESSION_STATE_STATUS_ERROR:()=>h,SESSION_STATE_STATUS_UNCHANGED:()=>_,SET_LOGGED_USER:()=>d,UPDATE_SESSION_STATE_STATUS:()=>S,UPDATE_USER_INFO:()=>E,doLogout:()=>m,getUserInfo:()=>T,onUserAuth:()=>O,updateSessionStateStatus:()=>A,updateUserInfo:()=>b});var o=r(4656),n=r.n(o),s=r(4054),i=r(6793),a=r(8576);function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function u(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){c(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const d="SET_LOGGED_USER",p="LOGOUT_USER",f="REQUEST_USER_INFO",g="RECEIVE_USER_INFO",w="CLEAR_SESSION_STATE",S="UPDATE_SESSION_STATE_STATUS",_="unchanged",y="changed",h="error",E="UPDATE_USER_INFO",O=(e,t,r,o=0,n=null)=>s=>{(0,a.storeAuthInfo)(e,o,n,t),s({type:d,payload:{sessionState:r}})},m=e=>(t,r)=>{t({type:p,payload:{backUrl:e}})},T=(e="groups",t="",r=null,o=null,l=null)=>async(u,c)=>{let d=(0,i.getAllowedUserGroups)();d=""!==d?d.split(" "):[];let{loggedUserState:p}=c(),{member:w}=p,S=await(0,a.getAccessToken)();if(null!=w)return null!=o&&null!=r&&o.push(r),Promise.resolve();null==l&&(l=s.authErrorHandler),u((0,s.startLoading)());let _={access_token:S,expand:e};return t&&(_.fields=t),(0,s.getRequest)((0,s.createAction)(f),(0,s.createAction)(g),(0,i.buildAPIBaseUrl)("/api/v1/members/me"),l)(_)(u,c).then((()=>{u((0,s.stopLoading)());let{member:e}=c().loggedUserState;if(null==e){let e={title:"ERROR",html:n().translate("errors.user_not_set"),type:"error"};u((0,s.showMessage)(e,a.initLogOut))}if(d.length>0){if(0===e.groups.filter(((e,t)=>d.includes(e.code))).length){let e={title:"ERROR",html:n().translate("errors.user_not_authz"),type:"error"};return void u((0,s.showMessage)(e,a.initLogOut))}}null!=o&&null!=r&&o.push(r)}))},b=e=>(t,r)=>{let{loggedUserState:o}=r(),{member:n}=o;if(null==n)throw Error("Member is not set.");if(e.id!=n.id)throw Error("Member is not the same.");t({type:E,payload:u({},e)})},A=e=>(t,r)=>{t({type:S,payload:{sessionStateStatus:e}})}},8576:(e,t,r)=>{r.d(t,{doLogin:()=>b,getAccessToken:()=>R,initLogOut:()=>C,storeAuthInfo:()=>k});var o=r(6793);r(4824);const n=require("browser-tabs-lock");var s=r.n(n),i=r(6530),l=r.n(i);r(3856),r(4341);const u=require("crypto-js/sha256");var c=r.n(u);const d=require("crypto-js/enc-base64url");var p=r.n(d);const f=require("crypto-js/enc-hex");var g=r.n(f);const w=65536,S="undefined"!=typeof window?window.crypto||window.msCrypto:null;const _=new(s()),y="openstackuicore.lock.getTokenSilently",h="code",E="authInfo",O="nonce",m="pkce",T=e=>{let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r="";for(let o=0;o<e;o++)r+=t.charAt(Math.floor(Math.random()*t.length));return r},b=(e=null,t=null,r=null)=>{let n=((e=null,t=null,r=null,n=null)=>{let s=v(),i=(0,o.getAuthCallback)(),a=j(),u=x(),c=P();null!=e&&(i+=`?BackUrl=${encodeURI(e)}`);let d=T(16);(0,o.putOnLocalStorage)(O,d);let p=l()(`${a}/oauth2/auth`),f={response_type:encodeURI(c),scope:encodeURI(u),nonce:d,response_mode:"fragment",client_id:encodeURI(s),redirect_uri:encodeURI(i)};if(c===h){const e=A();(0,o.putOnLocalStorage)(m,JSON.stringify(e)),f.code_challenge=e.codeChallenge,f.code_challenge_method="S256",f.approval_prompt="force"}return t&&(f.prompt=t),u&&u.includes("offline_access")&&(f.prompt="consent"),r&&(f.id_token_hint=r),n&&(f.provider=n),p=p.query(f),p})(e,r,null,t);(0,o.getCurrentLocation)().replace(n.toString())},A=()=>{const e=(0,o.base64URLEncode)((e=>{if(e>4294967295)throw new RangeError("requested too many random bytes");const t=Buffer.allocUnsafe(e);if(!S)return a;if(e>0)if(e>w)for(let r=0;r<e;r+=w)S.getRandomValues(t.slice(r,r+w));else S.getRandomValues(t);return t})(64));return{codeVerifier:e,codeChallenge:((e,t="hex")=>{let r=g();return"Base64url"===t&&(r=p()),c()(e).toString(r)})(e,"Base64url"),createdAt:new Date}},R=async()=>{if(await(0,o.retryPromise)((()=>_.acquireLock(y,5e3)),10))try{let e=L();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:r,accessTokenUpdatedAt:o,refreshToken:n}=e,s=P(),i=Math.floor(Date.now()/1e3);if(r-=20,i-o>r||null==t){if(console.log("getAccessToken access token expired"),s===h&&N()){if(!n)throw I(),Error("missing Refresh Token");let e=await U(n),{access_token:t,expires_in:r,refresh_token:o}=e;return void 0===o&&(o=null),k(t,r,o),t}throw I(),Error("Access Token Expired.")}return t}finally{await _.releaseLock(y)}throw Error("Lock acquire error.")},U=async e=>{let t=j(),r=v();const n={grant_type:"refresh_token",client_id:encodeURI(r),refresh_token:e};try{const e=await fetch(`${t}/oauth2/token`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(n)}).then((e=>{if(400===e.status){(0,o.getCurrentPathName)();throw(0,o.setSessionClearingState)(!0),Error(`${e.status} - ${e.statusText}`)}return e})).catch((function(e){throw Error(`Request failed: ${e.message}`)})),r=await e.json();let{access_token:s,refresh_token:i,expires_in:a}=r;return{access_token:s,refresh_token:i,expires_in:a}}catch(e){throw console.log(e),e}},k=(e,t,r=null,n=null)=>{let s=L(),i={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===r&&s&&(r=s.refreshToken),null===n&&s&&(n=s.idToken),r&&(i.refreshToken=r),n&&(i.idToken=n),(0,o.putOnLocalStorage)(E,JSON.stringify(i))},L=()=>{try{let e=(0,o.getFromLocalStorage)(E,!1);return e?JSON.parse(e):null}catch(e){return null}},I=()=>{if("undefined"!=typeof window)return(0,o.removeFromLocalStorage)(E),(0,o.removeFromLocalStorage)(O),void(0,o.removeFromLocalStorage)(m)},v=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,P=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",N=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),j=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null,x=()=>"undefined"!=typeof window?window.SCOPES:null,C=()=>{(0,o.getCurrentLocation)().replace((e=>{let t=j(),r=v(),n=l()(`${t}/oauth2/end-session`),s=T(16),i=(0,o.getOrigin)()+"/auth/logout";return(0,o.putOnLocalStorage)("post_logout_state",s),n.query({id_token_hint:e,post_logout_redirect_uri:encodeURI(i),client_id:encodeURI(r),state:s})})((()=>{if("undefined"!=typeof window){const e=L();return e?e.idToken:null}return null})()).toString())}},4054:(e,t,r)=>{r.d(t,{authErrorHandler:()=>E,createAction:()=>w,getRequest:()=>O,showMessage:()=>b,startLoading:()=>S,stopLoading:()=>_});var o=r(4824),n=r.n(o),s=r(6530),i=r.n(s),a=r(271),l=r.n(a),u=r(4656),c=r.n(u),d=r(6793),p=r(4341),f=r(8576);let g=n();const w=e=>t=>({type:e,payload:t}),S=(w("RESET_LOADING"),w("START_LOADING")),_=w("STOP_LOADING"),y={},h=e=>0===Object.keys(e).length&&e.constructor===Object,E=(e,t)=>(t,r)=>{let o=e.status,n="";switch(t(_()),o){case 403:let r={title:"ERROR",html:c().translate("errors.user_not_authz"),type:"error"};t(b(r,f.initLogOut));break;case 401:let o=(0,d.getCurrentPathName)(),a=(0,d.isClearingSessionState)();t({type:p.CLEAR_SESSION_STATE,payload:{}}),a||((0,d.setSessionClearingState)(!0),console.log("authErrorHandler 401 - re login"),(0,f.doLogin)(o));break;case 404:n="",n=e.response.body&&e.response.body.message?e.response.body.message:e.response.error&&e.response.error.message?e.response.error.message:e.message,l().fire("Not Found",n,"warning");break;case 412:for(var[s,i]of Object.entries(e.response.body.errors))isNaN(s)&&(n+=s+": "),n+=i+"<br>";l().fire("Validation error",n,"warning"),t({type:"VALIDATE",payload:{errors:e.response.body.errors}});break;default:l().fire("ERROR",c().translate("errors.server_error"),"error")}},O=(e,t,r,o=m,n={})=>(s={})=>(a,l)=>{let u=i()(r);h(s)||(u=u.query(s));let c=u.toString();return e&&"function"==typeof e&&a(e(n)),(e=>{y[e]&&(y[e].abort(),console.log(`aborted request ${e}`),delete y[e])})(c),new Promise(((e,r)=>{let n=g.get(u.toString()).timeout({response:6e4,deadline:6e4}).end(T(a,l,t,o,e,r));((e,t)=>{y[e]=t})(c,n)}))},m=(e,t)=>e=>{let r=t.body,o="";r instanceof Object&&r.hasOwnProperty("message")&&(o=r.message),l().fire(t.statusText,o,"error")},T=(e,t,r,o,n,s)=>(i,a)=>{if(i||!a.ok)return o&&o(i,a)(e,t),s({err:i,res:a,dispatch:e,state:t});let l=a.body;return"function"==typeof r?(e(r({response:l})),n({response:l})):(e(r),n({response:l}))},b=(e,t={})=>r=>{r(_()),l().fire(e).then((e=>{e.value&&"function"==typeof t&&t()}))}},6793:(e,t,r)=>{r.d(t,{base64URLEncode:()=>g,buildAPIBaseUrl:()=>l,getAllowedUserGroups:()=>a,getAuthCallback:()=>o,getCurrentLocation:()=>n,getCurrentPathName:()=>i,getFromLocalStorage:()=>c,getOrigin:()=>s,isClearingSessionState:()=>p,putOnLocalStorage:()=>u,removeFromLocalStorage:()=>d,retryPromise:()=>w,setSessionClearingState:()=>f});r(8362),r(6530);const o=()=>"undefined"!=typeof window?`${window.location.origin}/auth/callback`:null,n=()=>{let e="";return"undefined"!=typeof window&&(e=window.location,window.top&&(e=window.top.location)),e},s=()=>"undefined"!=typeof window?window.location.origin:null,i=()=>"undefined"!=typeof window?window.location.pathname:null,a=()=>"undefined"!=typeof window?window.ALLOWED_USER_GROUPS||"":null,l=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,u=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},c=(e,t)=>{if("undefined"!=typeof window){let r=window.localStorage.getItem(e);return t&&(console.log(`getFromLocalStorage removing key ${e}`),d(e)),r}return null},d=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},p=()=>"undefined"!=typeof window&&window.clearing_session_state,f=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},g=e=>e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),w=async(e,t=3)=>{for(let r=0;r<t;r++)if(await e())return!0;return!1}},4656:e=>{e.exports=require("i18n-react/dist/i18n-react")},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")}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var s=t[o]={exports:{}};return e[o](s,s.exports,r),s.exports}return(()=>{r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t}})(),(()=>{r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})}})(),(()=>{r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})(),r(4341)})()));
|