openstack-uicore-foundation 3.0.97 → 3.0.98
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/actions.js +1 -1
- package/lib/components.js +1 -1
- package/lib/methods.js +1 -1
- package/lib/reducers.js +1 -1
- package/package.json +1 -1
package/lib/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,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=64)}({1:function(e,t,n){"use strict";n.d(t,"b",(function(){return h})),n.d(t,"d",(function(){return m})),n.d(t,"e",(function(){return b})),n.d(t,"f",(function(){return y})),n.d(t,"a",(function(){return O})),n.d(t,"c",(function(){return g})),n.d(t,"h",(function(){return w})),n.d(t,"v",(function(){return _})),n.d(t,"z",(function(){return j})),n.d(t,"A",(function(){return k})),n.d(t,"g",(function(){return E})),n.d(t,"q",(function(){return v})),n.d(t,"u",(function(){return U})),n.d(t,"j",(function(){return I})),n.d(t,"s",(function(){return T})),n.d(t,"r",(function(){return P})),n.d(t,"t",(function(){return x})),n.d(t,"i",(function(){return $})),n.d(t,"w",(function(){return A})),n.d(t,"m",(function(){return C})),n.d(t,"n",(function(){return q})),n.d(t,"x",(function(){return L})),n.d(t,"y",(function(){return N})),n.d(t,"k",(function(){return D})),n.d(t,"o",(function(){return G})),n.d(t,"p",(function(){return M})),n.d(t,"l",(function(){return z}));var r=n(13),o=n.n(r),c=n(5),i=n.n(c),a=n(9),u=n.n(a),s=n(6),l=n.n(s),d=n(2),f=n(7);let p=o.a;const h="RESET_LOADING",m="START_LOADING",b="STOP_LOADING",y="VALIDATE",O="CLEAR_MESSAGE",g="SHOW_MESSAGE",w=e=>t=>({type:e,payload:t}),_=w(h),j=w(m),k=w(b),R={},S=e=>0===Object.keys(e).length&&e.constructor===Object,E=(e,t)=>(t,n)=>{let r=e.status,o="";switch(t(k()),r){case 403:let n={title:"ERROR",html:l.a.translate("errors.user_not_authz"),type:"error"};t(L(n,f.initLogOut));break;case 401:let r=Object(d.m)(),a=Object(d.r)();t({type:f.a,payload:{}}),a||(Object(d.y)(!0),console.log("authErrorHandler 401 - re login"),Object(f.doLogin)(r));break;case 404:o="",o=e.response.body&&e.response.body.message?e.response.body.message:e.response.error&&e.response.error.message?e.response.error.message:e.message,u.a.fire("Not Found",o,"warning");break;case 412:for(var[c,i]of Object.entries(e.response.body.errors))isNaN(c)&&(o+=c+": "),o+=i+"<br>";u.a.fire("Validation error",o,"warning"),t({type:y,payload:{errors:e.response.body.errors}});break;default:u.a.fire("ERROR",l.a.translate("errors.server_error"),"error")}},v=(e,t,n,r=$,o={})=>(c={})=>(a,u)=>{let s=i()(n);S(c)||(s=s.query(c));let l=s.toString();return e&&"function"==typeof e&&a(e(o)),(e=>{R[e]&&(R[e].abort(),console.log("aborted request "+e),delete R[e])})(l),new Promise((e,n)=>{let o=p.get(s.toString()).timeout({response:6e4,deadline:6e4}).end(A(a,u,t,r,e,n));((e,t)=>{R[e]=t})(l,o)})},U=(e,t,n,r,o=$,c={})=>(a={})=>(u,s)=>{let l=i()(n);return S(a)||(l=l.query(a)),e&&"function"==typeof e&&u(e(c)),new Promise((e,n)=>{null==r&&(r={}),p.put(l.toString()).send(r).end(A(u,s,t,o,e,n))})},I=(e,t,n,r,o=$,c={})=>a=>(u,s)=>{let l=i()(n);return S(a)||(l=l.query(a)),e&&"function"==typeof e&&u(e(c)),new Promise((e,n)=>{null==r&&(r={}),p.delete(l).send(r).end(A(u,s,t,o,e,n))})},T=(e,t,n,r,o=$,c={})=>(a={})=>(u,s)=>{let l=i()(n);return S(a)||(l=l.query(a)),e&&"function"==typeof e&&u(e(c)),new Promise((e,n)=>{let c=p.post(l);null!=r?c.send(r):c.set("Content-Type","text/plain"),c.end(A(u,s,t,o,e,n))})},P=(e,t,n,r,o={},c=$,a={})=>(u={})=>(s,l)=>{let d=i()(n);return S(u)||(d=d.query(u)),e&&"function"==typeof e&&s(e(a)),new Promise((e,n)=>{const i=p.post(d).attach("file",r);S(o)||Object.keys(o).forEach((function(e){let t=o[e];i.field(e,t)})),i.end(A(s,l,t,c,e,n))})},x=(e,t,n,r=null,o={},c=$,a={})=>(u={})=>(s,l)=>{let d=i()(n);return S(u)||(d=d.query(u)),e&&"function"==typeof e&&s(e(a)),new Promise((e,n)=>{const i=p.put(d);null!=r&&i.attach("file",r),S(o)||Object.keys(o).forEach((function(e){let t=o[e];i.field(e,t)})),i.end(A(s,l,t,c,e,n))})},$=(e,t)=>e=>{let n=t.body,r="";n instanceof Object&&n.hasOwnProperty("message")&&(r=n.message),u.a.fire(t.statusText,r,"error")},A=(e,t,n,r,o,c)=>(i,a)=>{if(i||!a.ok)return r&&r(i,a)(e,t),c({err:i,res:a,dispatch:e,state:t});let u=a.body;return"function"==typeof n?(e(n({response:u})),o({response:u})):(e(n),o({response:u}))},C=e=>{let t=e.status,n=e.statusText;switch(t){case 403:u.a.fire("ERROR",l.a.translate("errors.user_not_authz"),"warning");break;case 401:u.a.fire("ERROR",l.a.translate("errors.session_expired"),"error");break;case 412:u.a.fire("ERROR",n,"warning");case 500:u.a.fire("ERROR",l.a.translate("errors.server_error"),"error")}},q=e=>{if(e.ok)return e.json();throw e},L=(e,t={})=>n=>{n(k()),u.a.fire(e).then(e=>{e.value&&"function"==typeof t&&t()})},N=e=>t=>{t(k()),u.a.fire({title:l.a.translate("general.done"),html:e,type:"success"})},D=(e,t,n)=>{let r=document.createElement("a");r.textContent="download",r.download=e,r.href=`data:${n},${encodeURIComponent(t)}`,document.body.appendChild(r),r.click(),document.body.removeChild(r)},G=(e,t,n,r=null)=>o=>{let c=i()(e);return S(t)||(c=c.query(t)),o(j()),fetch(c.toString()).then(e=>{if(e.ok)return e.text();throw e}).then(e=>{o(k()),r&&(e=r+"\r\r"+e),D(n,e,"text/csv;charset=utf-8")}).catch(C)},M=(e,t,n=null)=>{let r=i()(e);return S(t)||(r=r.query(t)),fetch(r.toString()).then(e=>{if(e.ok)return e.text();throw e}).then(e=>(n&&(e=n+"\r\r"+e),e)).catch(C)},z=e=>e=(e=e.replace(/,/g,"\\,")).replace(/;/g,"\\;")},10:function(e,t){e.exports=require("lodash")},11:function(e,t){e.exports=require("moment-timezone")},13:function(e,t){e.exports=require("superagent")},14:function(e,t){e.exports=require("crypto")},15:function(e,t){e.exports=require("idtoken-verifier")},16:function(e,t){e.exports=require("browser-tabs-lock")},2:function(e,t,n){"use strict";n.d(t,"f",(function(){return u})),n.d(t,"d",(function(){return s})),n.d(t,"e",(function(){return l})),n.d(t,"g",(function(){return d})),n.d(t,"t",(function(){return f})),n.d(t,"j",(function(){return p})),n.d(t,"i",(function(){return h})),n.d(t,"l",(function(){return m})),n.d(t,"p",(function(){return b})),n.d(t,"m",(function(){return y})),n.d(t,"k",(function(){return O})),n.d(t,"h",(function(){return g})),n.d(t,"c",(function(){return w})),n.d(t,"u",(function(){return _})),n.d(t,"o",(function(){return j})),n.d(t,"v",(function(){return k})),n.d(t,"r",(function(){return R})),n.d(t,"y",(function(){return S})),n.d(t,"n",(function(){return E})),n.d(t,"x",(function(){return v})),n.d(t,"q",(function(){return U})),n.d(t,"A",(function(){return I})),n.d(t,"a",(function(){return T})),n.d(t,"s",(function(){return P})),n.d(t,"b",(function(){return x})),n.d(t,"z",(function(){return $})),n.d(t,"w",(function(){return A}));var r=n(11),o=n.n(r),c=n(5),i=n.n(c),a=n(14);const u=e=>{var t=-70;if(e.offsetParent){do{t+=e.offsetTop}while(e=e.offsetParent);return[t]}},s=e=>e?(e*=1e3,o()(e)):e,l=(e,t)=>e?(e*=1e3,o()(e).tz(t)):e,d=(e,t="M/D/YYYY h:mm a")=>e?s(e).format(t):e,f=e=>{var t="";for(var n in e)""!=t&&(t+="&"),t+=n+"="+encodeURIComponent(e[n]);return t},p=()=>{let e=i()(window.location.href),t=e.search(!0),n=e.fragment(),r=t.hasOwnProperty("BackUrl")?t.BackUrl:null;return null!=n&&""!=n&&(r+="#"+n),r},h=()=>"undefined"!=typeof window?window.location.origin+"/auth/callback":null,m=()=>{let e="";return"undefined"!=typeof window&&(e=window.location,window.top&&(e=window.top.location)),e},b=()=>"undefined"!=typeof window?window.location.origin:null,y=()=>"undefined"!=typeof window?window.location.pathname:null,O=()=>"undefined"!=typeof window?window.location.href:null,g=()=>"undefined"!=typeof window?window.ALLOWED_USER_GROUPS||"":null,w=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,_=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},j=(e,t)=>{if("undefined"!=typeof window){let n=window.localStorage.getItem(e);return t&&(console.log("getFromLocalStorage removing key "+e),k(e)),n}return null},k=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},R=()=>"undefined"!=typeof window&&window.clearing_session_state,S=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},E=()=>{let e="en";return"undefined"!=typeof navigator&&(e=navigator.languages&&navigator.languages[0]||navigator.language||navigator.userLanguage),e},v=e=>{if(Object.keys(e).length>0){const t=Object.keys(e)[0],n=document.getElementById(t);n&&window.scrollTo(0,u(n))}},U=(e,t)=>e in t?t[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},T=(e,t)=>e.length===t.length&&e.every((e,n)=>I(e,t[n])),P=e=>0===Object.keys(e).length,x=e=>e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),$=e=>Object(a.createHash)("sha256").update(e).digest(),A=async(e,t=3)=>{for(let n=0;n<t;n++)if(await e())return!0;return!1}},3:function(e,t,n){"use strict";n.d(t,"b",(function(){return b})),n.d(t,"a",(function(){return y})),n.d(t,"j",(function(){return O})),n.d(t,"l",(function(){return g})),n.d(t,"e",(function(){return _})),n.d(t,"f",(function(){return j})),n.d(t,"g",(function(){return R})),n.d(t,"c",(function(){return S})),n.d(t,"h",(function(){return E})),n.d(t,"s",(function(){return U})),n.d(t,"i",(function(){return I})),n.d(t,"d",(function(){return T})),n.d(t,"k",(function(){return P})),n.d(t,"m",(function(){return x})),n.d(t,"n",(function(){return $})),n.d(t,"o",(function(){return C})),n.d(t,"p",(function(){return L})),n.d(t,"t",(function(){return N})),n.d(t,"r",(function(){return D})),n.d(t,"q",(function(){return G}));var r=n(2),o=n(13),c=n.n(o),i=n(14),a=n(16),u=n.n(a),s=n(5),l=n.n(s),d=n(15),f=n.n(d),p=n(7);let h=c.a;const m=new u.a,b="token id_token",y="code",O=(e=null,t=null,n=null,o=null)=>{let c=x(),i=Object(r.i)(),a=C(),u=q(),s=$();null!=e&&(i+="?BackUrl="+encodeURI(e));let d=w(16);Object(r.u)("nonce",d);let f=l()(a+"/oauth2/auth"),p={response_type:encodeURI(s),scope:encodeURI(u),nonce:d,response_mode:"fragment",client_id:encodeURI(c),redirect_uri:encodeURI(i)};if(s===y){const e=k();Object(r.u)("pkce",JSON.stringify(e)),p.code_challenge=e.codeChallenge,p.code_challenge_method="S256",p.approval_prompt="force"}return t&&(p.prompt=t),n&&(p.id_token_hint=n),o&&(p.provider=o),f=f.query(p),f},g=e=>{let t=C(),n=x(),o=l()(t+"/oauth2/end-session"),c=w(16),i=Object(r.p)()+"/auth/logout";return Object(r.u)("post_logout_state",c),o.query({id_token_hint:e,post_logout_redirect_uri:encodeURI(i),client_id:encodeURI(n),state:c})},w=e=>{let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n="";for(let r=0;r<e;r++)n+=t.charAt(Math.floor(Math.random()*t.length));return n},_=(e=null,t=null,n="consent")=>{let o=O(e,n,null,t);Object(r.l)().replace(o.toString())},j=(e=null)=>{_(e,null,null)},k=()=>{const e=Object(r.b)(Object(i.randomBytes)(64));return{codeVerifier:e,codeChallenge:Object(r.b)(Object(r.z)(Buffer.from(e))),createdAt:new Date}},R=async(e,t=null)=>{let n=C(),o=x(),c=Object(r.i)(),i=JSON.parse(Object(r.o)("pkce",!0));null!=t&&(c+="?BackUrl="+encodeURI(t));const a={code:e,grant_type:"authorization_code",code_verifier:i.codeVerifier,client_id:encodeURI(o),redirect_uri:encodeURI(c)};try{const e=await fetch(n+"/oauth2/token",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(a)}).catch((function(e){console.log("Request failed:",e.message)})),t=await e.json();let{access_token:r,refresh_token:o,id_token:c,expires_in:i,error:u,error_description:s}=t;return{access_token:r,refresh_token:o,id_token:c,expires_in:i,error:u,error_description:s}}catch(e){console.log(e)}},S=async()=>{if(await Object(r.w)(()=>m.acquireLock("openstackuicore.lock.getTokenSilently",5e3),10))try{let e=I();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:r,refreshToken:o}=e;U(null,0,o)}finally{await m.releaseLock("openstackuicore.lock.getTokenSilently")}},E=async()=>{if(await Object(r.w)(()=>m.acquireLock("openstackuicore.lock.getTokenSilently",5e3),10))try{let e=I();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:r,refreshToken:o}=e,c=$(),i=Math.floor(Date.now()/1e3);if(n-=20,i-r>n||null==t){if(console.log("getAccessToken access token expired"),c===y&&A()){if(!o)throw T(),Error("missing Refresh Token");let e=await v(o),{access_token:t,expires_in:n,refresh_token:r}=e;return void 0===r&&(r=null),U(t,n,r),t}throw T(),Error("Access Token Expired.")}return t}finally{await m.releaseLock("openstackuicore.lock.getTokenSilently")}throw Error("Lock acquire error.")},v=async e=>{let t=C(),n=x();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){Object(r.m)();throw Object(r.y)(!0),Error(`${e.status} - ${e.statusText}`)}return e}).catch((function(e){throw Error("Request failed: "+e.message)})),n=await e.json();let{access_token:c,refresh_token:i,expires_in:a}=n;return{access_token:c,refresh_token:i,expires_in:a}}catch(e){throw console.log(e),e}},U=(e,t,n=null,o=null)=>{let c=I(),i={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===n&&c&&(n=c.refreshToken),null===o&&c&&(o=c.idToken),n&&(i.refreshToken=n),o&&(i.idToken=o),Object(r.u)("authInfo",JSON.stringify(i))},I=()=>{let e=Object(r.o)("authInfo",!1);return null===e?null:JSON.parse(e)},T=()=>{if("undefined"!=typeof window)return Object(r.v)("authInfo"),Object(r.v)("nonce"),void Object(r.v)("pkce")},P=()=>{if("undefined"!=typeof window){const e=I();return e?e.idToken:null}return null},x=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,$=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",A=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),C=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null,q=()=>"undefined"!=typeof window?window.SCOPES:null,L=()=>{Object(r.l)().replace(g(P()).toString())},N=(e,t,n)=>{let o=new f.a({issuer:t,audience:n}),c=Object(r.o)("nonce",!0),i=o.decode(e),a=(i.header.alg,i.header.kid,i.payload.aud),u=i.payload.iss;i.payload.exp,i.payload.nbf;return(i.payload.nonce||null)==c&&a==n&&u==t},D=e=>{let t=x(),n=q(),o=w(16);Object(r.u)("nonce",o);let c=C(),i=l()(c+"/oauth2/auth"),a={response_type:"otp",scope:encodeURI(n),nonce:o,client_id:encodeURI(t),connection:e.connection||"email",send:e.send||"code"};return e.hasOwnProperty("email")&&(a.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(a.phone_number=encodeURIComponent(e.phone_number)),h.post(i.toString()).send(a).then(e=>{let t=e.body;return Promise.resolve({response:t})}).catch(e=>Promise.reject(e))},G=e=>t=>{let n=x(),r=q(),o=C(),c=l()(o+"/oauth2/token");if(!e.hasOwnProperty("otp"))throw Error("otp param is mandatory.");let i={grant_type:"passwordless",connection:e.connection||"email",scope:encodeURI(r),client_id:encodeURI(n),otp:e.otp};return e.hasOwnProperty("email")&&(i.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(i.phone_number=encodeURIComponent(e.phone_number)),h.post(c.toString()).send(i).then(e=>{try{let r=e.body,{access_token:c,expires_in:i,refresh_token:a,id_token:u}=r;if(void 0===a&&(a=null),void 0===u&&(u=null),u&&!N(u,o,n))throw Error("id token is not valid.");return U(c,i,a,u),t&&t({type:p.g,payload:{sessionState:null}}),Promise.resolve({response:r})}catch(e){return console.log(e),Promise.reject(e)}}).catch(e=>Promise.reject(e))}},5:function(e,t){e.exports=require("urijs")},6:function(e,t){e.exports=require("i18n-react/dist/i18n-react")},64:function(e,t,n){"use strict";n.r(t);var r=n(1);n.d(t,"RESET_LOADING",(function(){return r.b})),n.d(t,"START_LOADING",(function(){return r.d})),n.d(t,"STOP_LOADING",(function(){return r.e})),n.d(t,"VALIDATE",(function(){return r.f}));var o=n(8);n.d(t,"RECEIVE_COUNTRIES",(function(){return o.a}));var c=n(7);n.d(t,"SET_LOGGED_USER",(function(){return c.g})),n.d(t,"LOGOUT_USER",(function(){return c.b})),n.d(t,"REQUEST_USER_INFO",(function(){return c.d})),n.d(t,"RECEIVE_USER_INFO",(function(){return c.c}))},7:function(e,t,n){"use strict";n.d(t,"g",(function(){return d})),n.d(t,"b",(function(){return f})),n.d(t,"d",(function(){return p})),n.d(t,"c",(function(){return h})),n.d(t,"a",(function(){return m})),n.d(t,"h",(function(){return b})),n.d(t,"f",(function(){return y})),n.d(t,"e",(function(){return O})),n.d(t,"i",(function(){return g})),n.d(t,"n",(function(){return w})),n.d(t,"k",(function(){return _})),n.d(t,"l",(function(){return j})),n.d(t,"p",(function(){return k})),n.d(t,"o",(function(){return R}));var r=n(6),o=n.n(r),c=n(1),i=n(2),a=n(3);function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const d="SET_LOGGED_USER",f="LOGOUT_USER",p="REQUEST_USER_INFO",h="RECEIVE_USER_INFO",m="CLEAR_SESSION_STATE",b="UPDATE_SESSION_STATE_STATUS",y="unchanged",O="changed",g="UPDATE_USER_INFO",w=(e,t,n,r=0,o=null)=>c=>{Object(a.s)(e,r,o,t),c({type:d,payload:{sessionState:n}})},_=e=>(t,n)=>{t({type:f,payload:{backUrl:e}})},j=(e="groups",t="",n=null,r=null,u=null)=>async(s,l)=>{let d=Object(i.h)();d=""!==d?d.split(" "):[];let{loggedUserState:f}=l(),{member:m}=f,b=await Object(a.h)();if(null!=m)return null!=r&&null!=n&&r.push(n),Promise.resolve();null==u&&(u=c.g),s(Object(c.z)());let y={access_token:b,expand:e};return t&&(y.fields=t),Object(c.q)(Object(c.h)(p),Object(c.h)(h),Object(i.c)("/api/v1/members/me"),u)(y)(s,l).then(()=>{s(Object(c.A)());let{member:e}=l().loggedUserState;if(null==e){let e={title:"ERROR",html:o.a.translate("errors.user_not_set"),type:"error"};s(Object(c.x)(e,a.p))}if(d.length>0){if(0===e.groups.filter((e,t)=>d.includes(e.code)).length){let e={title:"ERROR",html:o.a.translate("errors.user_not_authz"),type:"error"};return void s(Object(c.x)(e,a.p))}}null!=r&&null!=n&&r.push(n)})},k=e=>(t,n)=>{let{loggedUserState:r}=n(),{member:o}=r;if(null==o)throw Error("Member is not set.");if(e.id!=o.id)throw Error("Member is not the same.");t({type:g,payload:s({},e)})},R=e=>(t,n)=>{t({type:b,payload:{sessionStateStatus:e}})}},8:function(e,t,n){"use strict";n.d(t,"a",(function(){return l})),n.d(t,"j",(function(){return d})),n.d(t,"o",(function(){return f})),n.d(t,"m",(function(){return p})),n.d(t,"p",(function(){return h})),n.d(t,"s",(function(){return m})),n.d(t,"r",(function(){return b})),n.d(t,"h",(function(){return y})),n.d(t,"i",(function(){return O})),n.d(t,"g",(function(){return g})),n.d(t,"l",(function(){return w})),n.d(t,"n",(function(){return _})),n.d(t,"f",(function(){return j})),n.d(t,"k",(function(){return k})),n.d(t,"e",(function(){return R})),n.d(t,"d",(function(){return S})),n.d(t,"b",(function(){return v})),n.d(t,"c",(function(){return U})),n.d(t,"q",(function(){return I}));var r=n(1),o=n(3),c=n(2),i=n(10),a=n.n(i),u=n(5),s=n.n(u);const l="RECEIVE_COUNTRIES",d=a.a.debounce(async(e,t)=>{const n=await Object(o.h)();e=Object(r.l)(e);let i=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch(Object(c.c)(`/api/v1/members?filter=${i}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(r.n).then(e=>{let n=[...e.data];t(n)}).catch(r.m)},500),f=a.a.debounce(async(e,t)=>{const n=await Object(o.h)();e=Object(r.l)(e);let i=encodeURIComponent("name=@"+e);fetch(Object(c.c)(`/api/v1/summits/all?filter=${i}&access_token=${n}`)).then(r.n).then(e=>{let n=[...e.data];t(n)}).catch(r.m)},500),p=a.a.debounce(async(e,t,n)=>{const i=await Object(o.h)();t=Object(r.l)(t);let a="/api/v1";e&&(a+="/summits/"+e),a+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${i}&expand=member,registration_request`,fetch(Object(c.c)(a)).then(r.n).then(e=>{let t=[...e.data];n(t)}).catch(r.m)},500),h=a.a.debounce(async(e,t,n)=>{const i=await Object(o.h)();t=Object(r.l)(t);let a="/api/v1",u=encodeURIComponent("tag=@"+t);a+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${u}&expand=tag,track_tag_group`:"/tags?filter="+u,a+="&order=tag&page=1&per_page=50&access_token="+i,fetch(Object(c.c)(a)).then(r.n).then(t=>{let r=[...t.data];e&&(r=r.map(e=>e.tag)),n(r)}).catch(r.m)},500),m=a.a.debounce(async(e,t,n)=>{const i=await Object(o.h)();t=Object(r.l)(t);let a=encodeURIComponent("name=@"+t);fetch(Object(c.c)(`/api/v1/summits/${e}/tracks?filter=${a}&order=name&access_token=${i}`)).then(r.n).then(e=>{let t=[...e.data];n(t)}).catch(r.m)},500),b=a.a.debounce(async(e,t,n)=>{const i=await Object(o.h)();let a=(t=Object(r.l)(t))?encodeURIComponent("filter=name=@"+t):"";fetch(Object(c.c)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${i}&${a}`)).then(r.n).then(e=>{let t=[...e.data];n(t)}).catch(r.m)},500),y=a.a.debounce(async(e,t,n=!1,i)=>{const a=await Object(o.h)();t=Object(r.l)(t);let u=`/api/v1/summits/${e}/events`+(n?"/published":""),s=encodeURIComponent("title=@"+t);fetch(Object(c.c)(`${u}?filter=${s}&order=title&access_token=${a}`)).then(r.n).then(e=>{let t=[...e.data];i(t)}).catch(r.m)},500),O=a.a.debounce(async(e,t)=>{const n=await Object(o.h)();let i=encodeURIComponent(`title=@${e},code=@${e}`);fetch(Object(c.c)(`/api/v1/groups?filter=${i}&access_token=${n}`)).then(r.n).then(e=>{let n=[...e.data];t(n)}).catch(r.m)},500),g=a.a.debounce(async(e,t)=>{const n=await Object(o.h)();e=Object(r.l)(e);let i=encodeURIComponent("name=@"+e);fetch(Object(c.c)(`/api/v1/companies?filter=${i}&access_token=${n}`)).then(r.n).then(e=>{let n=[...e.data];t(n)}).catch(r.m)},500),w=a.a.debounce(async(e,t,n)=>{let i;try{i=await Object(o.h)()}catch(e){return void n(e)}let a=s()(`/api/v1/summits/${e}/registration-companies`);a.addQuery("access_token",i),a.addQuery("order","name"),t&&(t=Object(r.l)(t),a.addQuery("filter[]","name=@"+t)),fetch(Object(c.c)(a.toString())).then(r.n).then(e=>{let t=[...e.data];n(t)}).catch(r.m)},500),_=a.a.debounce(async(e,t,n)=>{const i=await Object(o.h)();t=Object(r.l)(t);let a=encodeURIComponent("company_name=@"+t);fetch(Object(c.c)(`/api/v1/summits/${e}/sponsors?filter=${a}&expand=company,sponsorship&access_token=${i}`)).then(r.n).then(e=>{let t=[...e.data];n(t)}).catch(r.m)},500),j=a.a.debounce((e,t,n)=>{let i=Object(o.h)();t=Object(r.l)(t);let a=encodeURIComponent("name=@"+t);fetch(Object(c.c)(`/api/v1/summits/${e}/access-level-types?filter=${a}&&access_token=${i}`)).then(r.n).then(e=>{let t=[...e.data];n(t)}).catch(r.m)},500),k=a.a.debounce(async(e,t)=>{const n=await Object(o.h)();e=Object(r.l)(e);let i=encodeURIComponent("name=@"+e);fetch(Object(c.c)(`/api/v1/organizations?filter=${i}&access_token=${n}`)).then(r.n).then(e=>{let n=[...e.data];t(n)}).catch(r.m)},500),R=(e,t)=>fetch(Object(c.c)("/api/public/v1/languages"),{signal:t}).then(r.n).then(t=>{e(t.data)}).catch(r.m),S=(e,t)=>fetch(Object(c.c)("/api/public/v1/countries"),{signal:t}).then(r.n).then(t=>{e(t.data)}).catch(r.m);var E;const v=e=>(E||(E=new google.maps.Geocoder),new Promise((function(t,n){E.geocode({address:e},(function(e,r){r==google.maps.GeocoderStatus.OK?t(e):n(r)}))}))),U=(e,t)=>{E||(E=new google.maps.Geocoder);var n={lat:parseFloat(e),lng:parseFloat(t)};return new Promise((function(e,t){E.geocode({location:n},(function(n,r){r==google.maps.GeocoderStatus.OK?e(n):t(r)}))}))},I=a.a.debounce((e,t={},n,i="v1")=>{let a=Object(o.h)(),u=s()(`/api/${i}/summits/${e}/ticket-types`);if(u.addQuery("access_token",a),u.addQuery("order","name"),t.hasOwnProperty("name")){const e=Object(r.l)(t.name);u.addQuery("filter[]","name@@"+e)}if(t.hasOwnProperty("audience")){const e=Object(r.l)(t.audience);u.addQuery("filter[]","audience=="+e)}fetch(Object(c.c)(u.toString())).then(r.n).then(e=>{let t=[...e.data];n(t)}).catch(r.m)},500)},9:function(e,t){e.exports=require("sweetalert2")}})}));
|
|
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,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=64)}({1:function(e,t,n){"use strict";n.d(t,"b",(function(){return m})),n.d(t,"d",(function(){return b})),n.d(t,"e",(function(){return y})),n.d(t,"f",(function(){return O})),n.d(t,"a",(function(){return g})),n.d(t,"c",(function(){return w})),n.d(t,"h",(function(){return _})),n.d(t,"v",(function(){return j})),n.d(t,"z",(function(){return k})),n.d(t,"A",(function(){return R})),n.d(t,"g",(function(){return v})),n.d(t,"q",(function(){return U})),n.d(t,"u",(function(){return I})),n.d(t,"j",(function(){return T})),n.d(t,"s",(function(){return P})),n.d(t,"r",(function(){return x})),n.d(t,"t",(function(){return $})),n.d(t,"i",(function(){return A})),n.d(t,"w",(function(){return C})),n.d(t,"m",(function(){return q})),n.d(t,"n",(function(){return L})),n.d(t,"x",(function(){return N})),n.d(t,"y",(function(){return D})),n.d(t,"k",(function(){return G})),n.d(t,"o",(function(){return M})),n.d(t,"p",(function(){return z})),n.d(t,"l",(function(){return F}));var r=n(13),o=n.n(r),c=n(5),i=n.n(c),a=n(9),u=n.n(a),s=n(6),l=n.n(s),d=n(2),f=n(7),p=n(3);let h=o.a;const m="RESET_LOADING",b="START_LOADING",y="STOP_LOADING",O="VALIDATE",g="CLEAR_MESSAGE",w="SHOW_MESSAGE",_=e=>t=>({type:e,payload:t}),j=_(m),k=_(b),R=_(y),S={},E=e=>0===Object.keys(e).length&&e.constructor===Object,v=(e,t)=>(t,n)=>{let r=e.status,o="";switch(t(R()),r){case 403:let n={title:"ERROR",html:l.a.translate("errors.user_not_authz"),type:"error"};t(N(n,f.initLogOut));break;case 401:let r=Object(d.m)(),a=Object(d.r)();t({type:f.a,payload:{}}),a||(Object(d.y)(!0),console.log("authErrorHandler 401 - re login"),Object(p.e)(r));break;case 404:o="",o=e.response.body&&e.response.body.message?e.response.body.message:e.response.error&&e.response.error.message?e.response.error.message:e.message,u.a.fire("Not Found",o,"warning");break;case 412:for(var[c,i]of Object.entries(e.response.body.errors))isNaN(c)&&(o+=c+": "),o+=i+"<br>";u.a.fire("Validation error",o,"warning"),t({type:O,payload:{errors:e.response.body.errors}});break;default:u.a.fire("ERROR",l.a.translate("errors.server_error"),"error")}},U=(e,t,n,r=A,o={})=>(c={})=>(a,u)=>{let s=i()(n);E(c)||(s=s.query(c));let l=s.toString();return e&&"function"==typeof e&&a(e(o)),(e=>{S[e]&&(S[e].abort(),console.log("aborted request "+e),delete S[e])})(l),new Promise((e,n)=>{let o=h.get(s.toString()).timeout({response:6e4,deadline:6e4}).end(C(a,u,t,r,e,n));((e,t)=>{S[e]=t})(l,o)})},I=(e,t,n,r,o=A,c={})=>(a={})=>(u,s)=>{let l=i()(n);return E(a)||(l=l.query(a)),e&&"function"==typeof e&&u(e(c)),new Promise((e,n)=>{null==r&&(r={}),h.put(l.toString()).send(r).end(C(u,s,t,o,e,n))})},T=(e,t,n,r,o=A,c={})=>a=>(u,s)=>{let l=i()(n);return E(a)||(l=l.query(a)),e&&"function"==typeof e&&u(e(c)),new Promise((e,n)=>{null==r&&(r={}),h.delete(l).send(r).end(C(u,s,t,o,e,n))})},P=(e,t,n,r,o=A,c={})=>(a={})=>(u,s)=>{let l=i()(n);return E(a)||(l=l.query(a)),e&&"function"==typeof e&&u(e(c)),new Promise((e,n)=>{let c=h.post(l);null!=r?c.send(r):c.set("Content-Type","text/plain"),c.end(C(u,s,t,o,e,n))})},x=(e,t,n,r,o={},c=A,a={})=>(u={})=>(s,l)=>{let d=i()(n);return E(u)||(d=d.query(u)),e&&"function"==typeof e&&s(e(a)),new Promise((e,n)=>{const i=h.post(d).attach("file",r);E(o)||Object.keys(o).forEach((function(e){let t=o[e];i.field(e,t)})),i.end(C(s,l,t,c,e,n))})},$=(e,t,n,r=null,o={},c=A,a={})=>(u={})=>(s,l)=>{let d=i()(n);return E(u)||(d=d.query(u)),e&&"function"==typeof e&&s(e(a)),new Promise((e,n)=>{const i=h.put(d);null!=r&&i.attach("file",r),E(o)||Object.keys(o).forEach((function(e){let t=o[e];i.field(e,t)})),i.end(C(s,l,t,c,e,n))})},A=(e,t)=>e=>{let n=t.body,r="";n instanceof Object&&n.hasOwnProperty("message")&&(r=n.message),u.a.fire(t.statusText,r,"error")},C=(e,t,n,r,o,c)=>(i,a)=>{if(i||!a.ok)return r&&r(i,a)(e,t),c({err:i,res:a,dispatch:e,state:t});let u=a.body;return"function"==typeof n?(e(n({response:u})),o({response:u})):(e(n),o({response:u}))},q=e=>{let t=e.status,n=e.statusText;switch(t){case 403:u.a.fire("ERROR",l.a.translate("errors.user_not_authz"),"warning");break;case 401:u.a.fire("ERROR",l.a.translate("errors.session_expired"),"error");break;case 412:u.a.fire("ERROR",n,"warning");case 500:u.a.fire("ERROR",l.a.translate("errors.server_error"),"error")}},L=e=>{if(e.ok)return e.json();throw e},N=(e,t={})=>n=>{n(R()),u.a.fire(e).then(e=>{e.value&&"function"==typeof t&&t()})},D=e=>t=>{t(R()),u.a.fire({title:l.a.translate("general.done"),html:e,type:"success"})},G=(e,t,n)=>{let r=document.createElement("a");r.textContent="download",r.download=e,r.href=`data:${n},${encodeURIComponent(t)}`,document.body.appendChild(r),r.click(),document.body.removeChild(r)},M=(e,t,n,r=null)=>o=>{let c=i()(e);return E(t)||(c=c.query(t)),o(k()),fetch(c.toString()).then(e=>{if(e.ok)return e.text();throw e}).then(e=>{o(R()),r&&(e=r+"\r\r"+e),G(n,e,"text/csv;charset=utf-8")}).catch(q)},z=(e,t,n=null)=>{let r=i()(e);return E(t)||(r=r.query(t)),fetch(r.toString()).then(e=>{if(e.ok)return e.text();throw e}).then(e=>(n&&(e=n+"\r\r"+e),e)).catch(q)},F=e=>e=(e=e.replace(/,/g,"\\,")).replace(/;/g,"\\;")},10:function(e,t){e.exports=require("lodash")},11:function(e,t){e.exports=require("moment-timezone")},13:function(e,t){e.exports=require("superagent")},14:function(e,t){e.exports=require("crypto")},15:function(e,t){e.exports=require("idtoken-verifier")},16:function(e,t){e.exports=require("browser-tabs-lock")},2:function(e,t,n){"use strict";n.d(t,"f",(function(){return u})),n.d(t,"d",(function(){return s})),n.d(t,"e",(function(){return l})),n.d(t,"g",(function(){return d})),n.d(t,"t",(function(){return f})),n.d(t,"j",(function(){return p})),n.d(t,"i",(function(){return h})),n.d(t,"l",(function(){return m})),n.d(t,"p",(function(){return b})),n.d(t,"m",(function(){return y})),n.d(t,"k",(function(){return O})),n.d(t,"h",(function(){return g})),n.d(t,"c",(function(){return w})),n.d(t,"u",(function(){return _})),n.d(t,"o",(function(){return j})),n.d(t,"v",(function(){return k})),n.d(t,"r",(function(){return R})),n.d(t,"y",(function(){return S})),n.d(t,"n",(function(){return E})),n.d(t,"x",(function(){return v})),n.d(t,"q",(function(){return U})),n.d(t,"A",(function(){return I})),n.d(t,"a",(function(){return T})),n.d(t,"s",(function(){return P})),n.d(t,"b",(function(){return x})),n.d(t,"z",(function(){return $})),n.d(t,"w",(function(){return A}));var r=n(11),o=n.n(r),c=n(5),i=n.n(c),a=n(14);const u=e=>{var t=-70;if(e.offsetParent){do{t+=e.offsetTop}while(e=e.offsetParent);return[t]}},s=e=>e?(e*=1e3,o()(e)):e,l=(e,t)=>e?(e*=1e3,o()(e).tz(t)):e,d=(e,t="M/D/YYYY h:mm a")=>e?s(e).format(t):e,f=e=>{var t="";for(var n in e)""!=t&&(t+="&"),t+=n+"="+encodeURIComponent(e[n]);return t},p=()=>{let e=i()(window.location.href),t=e.search(!0),n=e.fragment(),r=t.hasOwnProperty("BackUrl")?t.BackUrl:null;return null!=n&&""!=n&&(r+="#"+n),r},h=()=>"undefined"!=typeof window?window.location.origin+"/auth/callback":null,m=()=>{let e="";return"undefined"!=typeof window&&(e=window.location,window.top&&(e=window.top.location)),e},b=()=>"undefined"!=typeof window?window.location.origin:null,y=()=>"undefined"!=typeof window?window.location.pathname:null,O=()=>"undefined"!=typeof window?window.location.href:null,g=()=>"undefined"!=typeof window?window.ALLOWED_USER_GROUPS||"":null,w=e=>"undefined"!=typeof window?`${window.API_BASE_URL}${e}`:null``,_=(e,t)=>{"undefined"!=typeof window&&window.localStorage.setItem(e,t)},j=(e,t)=>{if("undefined"!=typeof window){let n=window.localStorage.getItem(e);return t&&(console.log("getFromLocalStorage removing key "+e),k(e)),n}return null},k=e=>{"undefined"!=typeof window&&window.localStorage.removeItem(e)},R=()=>"undefined"!=typeof window&&window.clearing_session_state,S=e=>{"undefined"!=typeof window&&(window.clearing_session_state=e)},E=()=>{let e="en";return"undefined"!=typeof navigator&&(e=navigator.languages&&navigator.languages[0]||navigator.language||navigator.userLanguage),e},v=e=>{if(Object.keys(e).length>0){const t=Object.keys(e)[0],n=document.getElementById(t);n&&window.scrollTo(0,u(n))}},U=(e,t)=>e in t?t[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},T=(e,t)=>e.length===t.length&&e.every((e,n)=>I(e,t[n])),P=e=>0===Object.keys(e).length,x=e=>e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),$=e=>Object(a.createHash)("sha256").update(e).digest(),A=async(e,t=3)=>{for(let n=0;n<t;n++)if(await e())return!0;return!1}},3:function(e,t,n){"use strict";n.d(t,"b",(function(){return b})),n.d(t,"a",(function(){return y})),n.d(t,"j",(function(){return O})),n.d(t,"l",(function(){return g})),n.d(t,"e",(function(){return _})),n.d(t,"f",(function(){return j})),n.d(t,"g",(function(){return R})),n.d(t,"c",(function(){return S})),n.d(t,"h",(function(){return E})),n.d(t,"s",(function(){return U})),n.d(t,"i",(function(){return I})),n.d(t,"d",(function(){return T})),n.d(t,"k",(function(){return P})),n.d(t,"m",(function(){return x})),n.d(t,"n",(function(){return $})),n.d(t,"o",(function(){return C})),n.d(t,"p",(function(){return L})),n.d(t,"t",(function(){return N})),n.d(t,"r",(function(){return D})),n.d(t,"q",(function(){return G}));var r=n(2),o=n(13),c=n.n(o),i=n(14),a=n(16),u=n.n(a),s=n(5),l=n.n(s),d=n(15),f=n.n(d),p=n(7);let h=c.a;const m=new u.a,b="token id_token",y="code",O=(e=null,t=null,n=null,o=null)=>{let c=x(),i=Object(r.i)(),a=C(),u=q(),s=$();null!=e&&(i+="?BackUrl="+encodeURI(e));let d=w(16);Object(r.u)("nonce",d);let f=l()(a+"/oauth2/auth"),p={response_type:encodeURI(s),scope:encodeURI(u),nonce:d,response_mode:"fragment",client_id:encodeURI(c),redirect_uri:encodeURI(i)};if(s===y){const e=k();Object(r.u)("pkce",JSON.stringify(e)),p.code_challenge=e.codeChallenge,p.code_challenge_method="S256",p.approval_prompt="force"}return t&&(p.prompt=t),n&&(p.id_token_hint=n),o&&(p.provider=o),f=f.query(p),f},g=e=>{let t=C(),n=x(),o=l()(t+"/oauth2/end-session"),c=w(16),i=Object(r.p)()+"/auth/logout";return Object(r.u)("post_logout_state",c),o.query({id_token_hint:e,post_logout_redirect_uri:encodeURI(i),client_id:encodeURI(n),state:c})},w=e=>{let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n="";for(let r=0;r<e;r++)n+=t.charAt(Math.floor(Math.random()*t.length));return n},_=(e=null,t=null,n="consent")=>{let o=O(e,n,null,t);Object(r.l)().replace(o.toString())},j=(e=null)=>{_(e,null,null)},k=()=>{const e=Object(r.b)(Object(i.randomBytes)(64));return{codeVerifier:e,codeChallenge:Object(r.b)(Object(r.z)(Buffer.from(e))),createdAt:new Date}},R=async(e,t=null)=>{let n=C(),o=x(),c=Object(r.i)(),i=JSON.parse(Object(r.o)("pkce",!0));null!=t&&(c+="?BackUrl="+encodeURI(t));const a={code:e,grant_type:"authorization_code",code_verifier:i.codeVerifier,client_id:encodeURI(o),redirect_uri:encodeURI(c)};try{const e=await fetch(n+"/oauth2/token",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(a)}).catch((function(e){console.log("Request failed:",e.message)})),t=await e.json();let{access_token:r,refresh_token:o,id_token:c,expires_in:i,error:u,error_description:s}=t;return{access_token:r,refresh_token:o,id_token:c,expires_in:i,error:u,error_description:s}}catch(e){console.log(e)}},S=async()=>{if(await Object(r.w)(()=>m.acquireLock("openstackuicore.lock.getTokenSilently",5e3),10))try{let e=I();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:r,refreshToken:o}=e;U(null,0,o)}finally{await m.releaseLock("openstackuicore.lock.getTokenSilently")}},E=async()=>{if(await Object(r.w)(()=>m.acquireLock("openstackuicore.lock.getTokenSilently",5e3),10))try{let e=I();if(!e)throw Error("Missing Auth info.");let{accessToken:t,expiresIn:n,accessTokenUpdatedAt:r,refreshToken:o}=e,c=$(),i=Math.floor(Date.now()/1e3);if(n-=20,i-r>n||null==t){if(console.log("getAccessToken access token expired"),c===y&&A()){if(!o)throw T(),Error("missing Refresh Token");let e=await v(o),{access_token:t,expires_in:n,refresh_token:r}=e;return void 0===r&&(r=null),U(t,n,r),t}throw T(),Error("Access Token Expired.")}return t}finally{await m.releaseLock("openstackuicore.lock.getTokenSilently")}throw Error("Lock acquire error.")},v=async e=>{let t=C(),n=x();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){Object(r.m)();throw Object(r.y)(!0),Error(`${e.status} - ${e.statusText}`)}return e}).catch((function(e){throw Error("Request failed: "+e.message)})),n=await e.json();let{access_token:c,refresh_token:i,expires_in:a}=n;return{access_token:c,refresh_token:i,expires_in:a}}catch(e){throw console.log(e),e}},U=(e,t,n=null,o=null)=>{let c=I(),i={accessToken:e,expiresIn:t,accessTokenUpdatedAt:Math.floor(Date.now()/1e3)};null===n&&c&&(n=c.refreshToken),null===o&&c&&(o=c.idToken),n&&(i.refreshToken=n),o&&(i.idToken=o),Object(r.u)("authInfo",JSON.stringify(i))},I=()=>{let e=Object(r.o)("authInfo",!1);return null===e?null:JSON.parse(e)},T=()=>{if("undefined"!=typeof window)return Object(r.v)("authInfo"),Object(r.v)("nonce"),void Object(r.v)("pkce")},P=()=>{if("undefined"!=typeof window){const e=I();return e?e.idToken:null}return null},x=()=>"undefined"!=typeof window?window.OAUTH2_CLIENT_ID:null,$=()=>"undefined"!=typeof window&&window.OAUTH2_FLOW||"token id_token",A=()=>"undefined"==typeof window||new Boolean(window.OAUTH2_USE_REFRESH_TOKEN||!0),C=()=>"undefined"!=typeof window?window.IDP_BASE_URL:null,q=()=>"undefined"!=typeof window?window.SCOPES:null,L=()=>{Object(r.l)().replace(g(P()).toString())},N=(e,t,n)=>{let o=new f.a({issuer:t,audience:n}),c=Object(r.o)("nonce",!0),i=o.decode(e),a=(i.header.alg,i.header.kid,i.payload.aud),u=i.payload.iss;i.payload.exp,i.payload.nbf;return(i.payload.nonce||null)==c&&a==n&&u==t},D=e=>{let t=x(),n=q(),o=w(16);Object(r.u)("nonce",o);let c=C(),i=l()(c+"/oauth2/auth"),a={response_type:"otp",scope:encodeURI(n),nonce:o,client_id:encodeURI(t),connection:e.connection||"email",send:e.send||"code"};return e.hasOwnProperty("email")&&(a.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(a.phone_number=encodeURIComponent(e.phone_number)),h.post(i.toString()).send(a).then(e=>{let t=e.body;return Promise.resolve({response:t})}).catch(e=>Promise.reject(e))},G=e=>t=>{let n=x(),r=q(),o=C(),c=l()(o+"/oauth2/token");if(!e.hasOwnProperty("otp"))throw Error("otp param is mandatory.");let i={grant_type:"passwordless",connection:e.connection||"email",scope:encodeURI(r),client_id:encodeURI(n),otp:e.otp};return e.hasOwnProperty("email")&&(i.email=encodeURIComponent(e.email)),e.hasOwnProperty("phone_number")&&(i.phone_number=encodeURIComponent(e.phone_number)),h.post(c.toString()).send(i).then(e=>{try{let r=e.body,{access_token:c,expires_in:i,refresh_token:a,id_token:u}=r;if(void 0===a&&(a=null),void 0===u&&(u=null),u&&!N(u,o,n))throw Error("id token is not valid.");return U(c,i,a,u),t&&t({type:p.g,payload:{sessionState:null}}),Promise.resolve({response:r})}catch(e){return console.log(e),Promise.reject(e)}}).catch(e=>Promise.reject(e))}},5:function(e,t){e.exports=require("urijs")},6:function(e,t){e.exports=require("i18n-react/dist/i18n-react")},64:function(e,t,n){"use strict";n.r(t);var r=n(1);n.d(t,"RESET_LOADING",(function(){return r.b})),n.d(t,"START_LOADING",(function(){return r.d})),n.d(t,"STOP_LOADING",(function(){return r.e})),n.d(t,"VALIDATE",(function(){return r.f}));var o=n(8);n.d(t,"RECEIVE_COUNTRIES",(function(){return o.a}));var c=n(7);n.d(t,"SET_LOGGED_USER",(function(){return c.g})),n.d(t,"LOGOUT_USER",(function(){return c.b})),n.d(t,"REQUEST_USER_INFO",(function(){return c.d})),n.d(t,"RECEIVE_USER_INFO",(function(){return c.c}))},7:function(e,t,n){"use strict";n.d(t,"g",(function(){return d})),n.d(t,"b",(function(){return f})),n.d(t,"d",(function(){return p})),n.d(t,"c",(function(){return h})),n.d(t,"a",(function(){return m})),n.d(t,"h",(function(){return b})),n.d(t,"f",(function(){return y})),n.d(t,"e",(function(){return O})),n.d(t,"i",(function(){return g})),n.d(t,"m",(function(){return w})),n.d(t,"j",(function(){return _})),n.d(t,"k",(function(){return j})),n.d(t,"o",(function(){return k})),n.d(t,"n",(function(){return R}));var r=n(6),o=n.n(r),c=n(1),i=n(2),a=n(3);function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const d="SET_LOGGED_USER",f="LOGOUT_USER",p="REQUEST_USER_INFO",h="RECEIVE_USER_INFO",m="CLEAR_SESSION_STATE",b="UPDATE_SESSION_STATE_STATUS",y="unchanged",O="changed",g="UPDATE_USER_INFO",w=(e,t,n,r=0,o=null)=>c=>{Object(a.s)(e,r,o,t),c({type:d,payload:{sessionState:n}})},_=e=>(t,n)=>{t({type:f,payload:{backUrl:e}})},j=(e="groups",t="",n=null,r=null,u=null)=>async(s,l)=>{let d=Object(i.h)();d=""!==d?d.split(" "):[];let{loggedUserState:f}=l(),{member:m}=f,b=await Object(a.h)();if(null!=m)return null!=r&&null!=n&&r.push(n),Promise.resolve();null==u&&(u=c.g),s(Object(c.z)());let y={access_token:b,expand:e};return t&&(y.fields=t),Object(c.q)(Object(c.h)(p),Object(c.h)(h),Object(i.c)("/api/v1/members/me"),u)(y)(s,l).then(()=>{s(Object(c.A)());let{member:e}=l().loggedUserState;if(null==e){let e={title:"ERROR",html:o.a.translate("errors.user_not_set"),type:"error"};s(Object(c.x)(e,a.p))}if(d.length>0){if(0===e.groups.filter((e,t)=>d.includes(e.code)).length){let e={title:"ERROR",html:o.a.translate("errors.user_not_authz"),type:"error"};return void s(Object(c.x)(e,a.p))}}null!=r&&null!=n&&r.push(n)})},k=e=>(t,n)=>{let{loggedUserState:r}=n(),{member:o}=r;if(null==o)throw Error("Member is not set.");if(e.id!=o.id)throw Error("Member is not the same.");t({type:g,payload:s({},e)})},R=e=>(t,n)=>{t({type:b,payload:{sessionStateStatus:e}})}},8:function(e,t,n){"use strict";n.d(t,"a",(function(){return l})),n.d(t,"j",(function(){return d})),n.d(t,"o",(function(){return f})),n.d(t,"m",(function(){return p})),n.d(t,"p",(function(){return h})),n.d(t,"s",(function(){return m})),n.d(t,"r",(function(){return b})),n.d(t,"h",(function(){return y})),n.d(t,"i",(function(){return O})),n.d(t,"g",(function(){return g})),n.d(t,"l",(function(){return w})),n.d(t,"n",(function(){return _})),n.d(t,"f",(function(){return j})),n.d(t,"k",(function(){return k})),n.d(t,"e",(function(){return R})),n.d(t,"d",(function(){return S})),n.d(t,"b",(function(){return v})),n.d(t,"c",(function(){return U})),n.d(t,"q",(function(){return I}));var r=n(1),o=n(3),c=n(2),i=n(10),a=n.n(i),u=n(5),s=n.n(u);const l="RECEIVE_COUNTRIES",d=a.a.debounce(async(e,t)=>{const n=await Object(o.h)();e=Object(r.l)(e);let i=encodeURIComponent(`full_name=@${e},first_name=@${e},last_name=@${e},email=@${e}`);fetch(Object(c.c)(`/api/v1/members?filter=${i}&expand=tickets,rsvp,schedule_summit_events,all_affiliations&access_token=${n}`)).then(r.n).then(e=>{let n=[...e.data];t(n)}).catch(r.m)},500),f=a.a.debounce(async(e,t)=>{const n=await Object(o.h)();e=Object(r.l)(e);let i=encodeURIComponent("name=@"+e);fetch(Object(c.c)(`/api/v1/summits/all?filter=${i}&access_token=${n}`)).then(r.n).then(e=>{let n=[...e.data];t(n)}).catch(r.m)},500),p=a.a.debounce(async(e,t,n)=>{const i=await Object(o.h)();t=Object(r.l)(t);let a="/api/v1";e&&(a+="/summits/"+e),a+=`/speakers?filter=${encodeURIComponent(`full_name=@${t},first_name=@${t},last_name=@${t},email=@${t}`)}&access_token=${i}&expand=member,registration_request`,fetch(Object(c.c)(a)).then(r.n).then(e=>{let t=[...e.data];n(t)}).catch(r.m)},500),h=a.a.debounce(async(e,t,n)=>{const i=await Object(o.h)();t=Object(r.l)(t);let a="/api/v1",u=encodeURIComponent("tag=@"+t);a+=e?`/summits/${e}/track-tag-groups/all/allowed-tags?filter=${u}&expand=tag,track_tag_group`:"/tags?filter="+u,a+="&order=tag&page=1&per_page=50&access_token="+i,fetch(Object(c.c)(a)).then(r.n).then(t=>{let r=[...t.data];e&&(r=r.map(e=>e.tag)),n(r)}).catch(r.m)},500),m=a.a.debounce(async(e,t,n)=>{const i=await Object(o.h)();t=Object(r.l)(t);let a=encodeURIComponent("name=@"+t);fetch(Object(c.c)(`/api/v1/summits/${e}/tracks?filter=${a}&order=name&access_token=${i}`)).then(r.n).then(e=>{let t=[...e.data];n(t)}).catch(r.m)},500),b=a.a.debounce(async(e,t,n)=>{const i=await Object(o.h)();let a=(t=Object(r.l)(t))?encodeURIComponent("filter=name=@"+t):"";fetch(Object(c.c)(`/api/v1/summits/${e}/track-groups?order=name&access_token=${i}&${a}`)).then(r.n).then(e=>{let t=[...e.data];n(t)}).catch(r.m)},500),y=a.a.debounce(async(e,t,n=!1,i)=>{const a=await Object(o.h)();t=Object(r.l)(t);let u=`/api/v1/summits/${e}/events`+(n?"/published":""),s=encodeURIComponent("title=@"+t);fetch(Object(c.c)(`${u}?filter=${s}&order=title&access_token=${a}`)).then(r.n).then(e=>{let t=[...e.data];i(t)}).catch(r.m)},500),O=a.a.debounce(async(e,t)=>{const n=await Object(o.h)();let i=encodeURIComponent(`title=@${e},code=@${e}`);fetch(Object(c.c)(`/api/v1/groups?filter=${i}&access_token=${n}`)).then(r.n).then(e=>{let n=[...e.data];t(n)}).catch(r.m)},500),g=a.a.debounce(async(e,t)=>{const n=await Object(o.h)();e=Object(r.l)(e);let i=encodeURIComponent("name=@"+e);fetch(Object(c.c)(`/api/v1/companies?filter=${i}&access_token=${n}`)).then(r.n).then(e=>{let n=[...e.data];t(n)}).catch(r.m)},500),w=a.a.debounce(async(e,t,n)=>{let i;try{i=await Object(o.h)()}catch(e){return void n(e)}let a=s()(`/api/v1/summits/${e}/registration-companies`);a.addQuery("access_token",i),a.addQuery("order","name"),t&&(t=Object(r.l)(t),a.addQuery("filter[]","name=@"+t)),fetch(Object(c.c)(a.toString())).then(r.n).then(e=>{let t=[...e.data];n(t)}).catch(r.m)},500),_=a.a.debounce(async(e,t,n)=>{const i=await Object(o.h)();t=Object(r.l)(t);let a=encodeURIComponent("company_name=@"+t);fetch(Object(c.c)(`/api/v1/summits/${e}/sponsors?filter=${a}&expand=company,sponsorship&access_token=${i}`)).then(r.n).then(e=>{let t=[...e.data];n(t)}).catch(r.m)},500),j=a.a.debounce((e,t,n)=>{let i=Object(o.h)();t=Object(r.l)(t);let a=encodeURIComponent("name=@"+t);fetch(Object(c.c)(`/api/v1/summits/${e}/access-level-types?filter=${a}&&access_token=${i}`)).then(r.n).then(e=>{let t=[...e.data];n(t)}).catch(r.m)},500),k=a.a.debounce(async(e,t)=>{const n=await Object(o.h)();e=Object(r.l)(e);let i=encodeURIComponent("name=@"+e);fetch(Object(c.c)(`/api/v1/organizations?filter=${i}&access_token=${n}`)).then(r.n).then(e=>{let n=[...e.data];t(n)}).catch(r.m)},500),R=(e,t)=>fetch(Object(c.c)("/api/public/v1/languages"),{signal:t}).then(r.n).then(t=>{e(t.data)}).catch(r.m),S=(e,t)=>fetch(Object(c.c)("/api/public/v1/countries"),{signal:t}).then(r.n).then(t=>{e(t.data)}).catch(r.m);var E;const v=e=>(E||(E=new google.maps.Geocoder),new Promise((function(t,n){E.geocode({address:e},(function(e,r){r==google.maps.GeocoderStatus.OK?t(e):n(r)}))}))),U=(e,t)=>{E||(E=new google.maps.Geocoder);var n={lat:parseFloat(e),lng:parseFloat(t)};return new Promise((function(e,t){E.geocode({location:n},(function(n,r){r==google.maps.GeocoderStatus.OK?e(n):t(r)}))}))},I=a.a.debounce((e,t={},n,i="v1")=>{let a=Object(o.h)(),u=s()(`/api/${i}/summits/${e}/ticket-types`);if(u.addQuery("access_token",a),u.addQuery("order","name"),t.hasOwnProperty("name")){const e=Object(r.l)(t.name);u.addQuery("filter[]","name@@"+e)}if(t.hasOwnProperty("audience")){const e=Object(r.l)(t.audience);u.addQuery("filter[]","audience=="+e)}fetch(Object(c.c)(u.toString())).then(r.n).then(e=>{let t=[...e.data];n(t)}).catch(r.m)},500)},9:function(e,t){e.exports=require("sweetalert2")}})}));
|