diff --git a/build/bundle.js b/build/bundle.js index c2bc2c93..188bf24e 100644 --- a/build/bundle.js +++ b/build/bundle.js @@ -1 +1 @@ -module.exports=function(e){var n={};function t(o){if(n[o])return n[o].exports;var i=n[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,t),i.l=!0,i.exports}return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t.w={},t(t.s=0)}([function(e,n,t){"use strict";const o=t(1),i=t(2),a=t(10),s=t(5),r=o.createServer((e,n)=>(a.info("Starting Account Link Extension - Version:","2.2.0"),a.info(" > WT_URL:",e("WT_URL")),a.info(" > PUBLIC_WT_URL:",s("PUBLIC_WT_URL")),i(e,n)));e.exports=((e,n,t)=>{s.setValue("PUBLIC_WT_URL",o.urlHelpers.getWebtaskUrl(n)),r(e,n,t)})},function(e,n){e.exports=require("auth0-extension-hapi-tools")},function(e,n,t){"use strict";(function(n){const o=t(3),{FileStorageContext:i,WebtaskStorageContext:a}=t(4),s=t(5),r=t(6),c=t(10),l=t(20).init,u=e=>{e?(c.error("Hapi initialization failed."),c.error(e)):c.info("Hapi initialization completed.")};e.exports=((e,t,c)=>(s.setProvider(n=>e(n)||Object({NODE_ENV:"production",CLIENT_VERSION:"2.2.0"})[n]),l(t?new a(t,{force:0}):new i(o.join(n,"../data.json"))),r(c||u)))}).call(this,"/")},function(e,n){e.exports=require("path")},function(e,n){e.exports=require("auth0-extension-tools")},function(e,n,t){"use strict";const{config:o}=t(4);e.exports=o()},function(e,n,t){"use strict";(function(n){const o=t(3),i=t(7),a=t(8),s=t(9),r=t(5),c=t(10),l=t(12),u=t(54),d=t(55);e.exports=((e,t=u)=>{const h=new i.Server;return h.connection({host:"localhost",port:r("PORT"),routes:{cors:!0,validate:{},files:{relativeTo:o.join(n,"../public")}}}),h.register([s,a],()=>{}),h.route({method:"GET",path:"/js/{file*}",config:{auth:!1},handler:{directory:{path:o.join(n,"../public/js")}}}),h.route({method:"GET",path:"/css/{file*}",config:{auth:!1},handler:{directory:{path:o.join(n,"../public/css")}}}),h.register([d,t,l],n=>{c.debug=((...e)=>{h.log(["debug"],e.join(" "))}),c.info=((...e)=>{h.log(["info"],e.join(" "))}),c.error=((...e)=>{h.log(["error"],e.join(" "))}),n&&e(n),e(null,h)}),h})}).call(this,"/")},function(e,n){e.exports=require("hapi")},function(e,n){e.exports=require("inert")},function(e,n){e.exports=require("hapi-auth-jwt2")},function(e,n,t){"use strict";const o=t(11);o.emitErrs=!0;const i=new o.Logger({transports:[new o.transports.Console({timestamp:!0,level:"debug",handleExceptions:!0,json:!1,colorize:!0})],exitOnError:!1});e.exports=i},function(e,n){e.exports=require("winston")},function(e,n,t){"use strict";const o=t(13),i=t(33),a=t(36),s=t(37),r=t(39),c=t(44),l=t(46),u=t(47),d=t(48),h=t(49),p=t(51),m=(e,n)=>n.route(e(n)),g=(e,n,t)=>{m(o,e),m(i,e),m(a,e),m(s,e),m(r,e),m(d,e),m(h,e),m(p,e),m(c,e),m(l,e),m(u,e),t()};g.attributes={name:"routes"},e.exports=g},function(e,n,t){"use strict";const{decode:o}=t(14),i=t(5),a=t(15),s=t(18),r=t(10),c=t(29),l=t(31),u=t(32),d=t(22),{getSettings:h}=t(24);e.exports=(()=>({method:"GET",path:"/",config:{auth:!1},handler:(e,n)=>{const t=e.state["account-linking-admin-state"];if(void 0!==t&&""!==t)return void n.redirect(`${i("PUBLIC_WT_URL")}/admin`).state("account-linking-admin-state","");const p=c("production"===i("NODE_ENV")),m=p.tag("link"),g=p.tag(i("CUSTOM_CSS")),f={};e.query.locale&&(f.locale=e.query.locale),e.query.color&&(f.color=`#${e.query.color}`),e.query.title&&(f.title=e.query.title),e.query.logoPath&&(f.logoPath=e.query.logoPath),(e=>new Promise((n,t)=>{try{n(o(e))}catch(e){t(e)}}))(e.query.child_token).then(t=>{(({sub:e,email:n})=>a(n).then(n=>({currentUser:n.find(n=>n.user_id===e),matchingUsers:n.filter(n=>n.user_id!==e)})))(t).then(({currentUser:e,matchingUsers:t})=>{h().then(o=>{const i=t[0].user_metadata.locale||o.locale;d(i).then(o=>{const a=(t.length>0?t[0].identities:[]).map(e=>e.provider).map(l),r=u(a,o("or"));n(s({dynamicSettings:f,stylesheetTag:m,currentUser:e,matchingUsers:t,customCSSTag:g,locale:i,identities:r}))})})}).catch(o=>{const i=e.query.state;r.error("An error was encountered: ",o),r.info(`Redirecting to failed link to /continue: ${t.iss}continue?state=${e.query.state}`),n.redirect(`${t.iss}continue?state=${i}`)})}).catch(e=>{r.error("An invalid token was provided",e),s({dynamicSettings:f,stylesheetTag:m,currentUser:null,matchingUsers:[],customCSSTag:g}).then(e=>{n(e).code(400)})})}}))},function(e,n){e.exports=require("jsonwebtoken")},function(e,n,t){"use strict";const o=t(16);e.exports=(e=>o({path:"users-by-email",qs:{email:e}}))},function(e,n,t){"use strict";const{managementApi:o}=t(4),i=t(17),a=t(5),s=t(10),r={base:void 0,getBaseUrl(){return this.base||(this.base=`https://${a("AUTH0_DOMAIN")}/api/v2`),this.base},endpoint(e){return`${this.getBaseUrl()}/${e}`}};e.exports=(({path:e,...n}={})=>(()=>o.getAccessTokenCached(a("AUTH0_DOMAIN"),a("AUTH0_CLIENT_ID"),a("AUTH0_CLIENT_SECRET")))().then(t=>new Promise((o,a)=>{i({url:r.endpoint(e),headers:{Authorization:`Bearer ${t}`,Accept:"application/json"},json:!0,...n},(e,n,t)=>{e?a(e):n.statusCode<200||n.statusCode>=300?(s.error("API call failed: ",n.status,t),a(new Error(t))):o(n.body)})})))},function(e,n){e.exports=require("request")},function(e,n,t){"use strict";const o=t(19),i=(t(20).getStorage,t(21)),a=t(27),s=/\{\{\s*(.*?)\s*\}\}/g;e.exports=(({stylesheetTag:e,customCSSTag:n,currentUser:t,matchingUsers:r,dynamicSettings:c,identities:l,locale:u})=>Promise.all([i(c,l,u),getStorage().read()]).then(([i,c])=>{return((e,n={})=>{if(!e||"string"!=typeof e)throw new Error("Invalid template provided");return e.replace(s,(e,t)=>n[t]||"")})(c.settings?c.settings.template:o,{ExtensionCSS:e,CustomCSS:n,Auth0Widget:i,ExtensionScripts:a(t,r)})}))},function(e,n,t){"use strict";e.exports='\n\n\n
\n \n \n \n \n