@frontegg/vue 4.10.1 → 4.10.2
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/dist/index.js +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.ssr.js +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
package/dist/index.min.js
CHANGED
|
@@ -13,4 +13,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
15
|
***************************************************************************** */
|
|
16
|
-
function m(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n}var S=Symbol("fronteggLoade"),y=Symbol("authState"),R=Symbol("unsubscribeFronteggStore"),O=Symbol("fronteggAuth"),E=Symbol("loadEntitlements"),j=Symbol("router"),U=Symbol("fronteggOptions"),I=Symbol("fronteggStore"),P=Symbol("stepUp"),T=function(t,e){var n;return t.FRONTEGG_STORE_KEY=null!==(n=t.FRONTEGG_STORE_KEY)&&void 0!==n?n:e},w=function(t){return t.FRONTEGG_STORE_KEY},L=function(t){return t.FRONTEGG_REDUX_BINDINGS},k=function(){function t(){d(this,t)}return v(t,null,[{key:"getInstance",value:function(){return t.instance||(t.instance=new t),t.instance}},{key:"setStore",value:function(e){t.getInstance().store=e}},{key:"getStore",value:function(){return t.getInstance().store}},{key:"setBasename",value:function(e){t.getInstance().baseName=e}},{key:"getBasename",value:function(){return t.getInstance().baseName}}]),t}(),F=function(t){return function(e){return f.default(e,t)}},_=function(t,e,n){return function(){var r,o=this,i=Object.keys(e),u=f.default(w(o).getState(),t),a=function(t,e,n,r,o){return n.reduce((function(n,i){return Object.assign({},n,h({},e,Object.assign(Object.assign({},n[e]),h({},i,function(t,e,n){return"function"==typeof e?e.bind(t):n(e)}(t,r[i],o)))))}),L(t)||{})}(o,t,i,e,n);return r=a,o.FRONTEGG_REDUX_BINDINGS=r,i.reduce((function(t,r){return Object.assign({},t,h({},r,function(t,e,n,r){return"function"==typeof e?e.call(t,r):n(e)(r)}(o,e[r],n,u)))}),{})}},G=function(t){var e,n;return null!==(e=null==t?void 0:t.options.base)&&void 0!==e?e:null===(n=(null==t?void 0:t.options).history)||void 0===n?void 0:n.base},N=function(){function t(){d(this,t)}return v(t,null,[{key:"getInstance",value:function(){return t.instance||(t.instance=new t),t.instance}},{key:"setActions",value:function(e){t.getInstance().actions=e}},{key:"getAction",value:function(e){return t.getInstance().actions[e]}}]),t}(),C=function(){function t(e){var n=this;d(this,t);var r=e.router,i=m(e,["router"]);this.userRef=void 0,this.init=function(t,e){n.store=e,n.loginActions=e.stateActions.auth.loginActions,n.socialLoginsActions=e.stateActions.auth.socialLoginActions,n.activateAccountActions=e.stateActions.auth.activateAccountActions,n.acceptInvitationActions=e.stateActions.auth.acceptInvitationActions,n.forgotPasswordActions=e.stateActions.auth.forgotPasswordActions,n.signUpActions=e.stateActions.auth.signUpActions,n.profileActions=e.stateActions.auth.profileActions,n.ssoActions=e.stateActions.auth.ssoActions,n.mfaActions=e.stateActions.auth.mfaActions,n.teamActions=e.stateActions.auth.teamActions,n.apiTokensActions=e.stateActions.auth.apiTokensActions,n.securityPolicyActions=e.stateActions.auth.securityPolicyActions,n.tenantsActions=e.stateActions.auth.tenantsActions,N.setActions(e.actions),t.hostedLoginBox||n.store.subscribe(n.storeSubscriber)},this.storeSubscriber=function(){n.state=n.store.getState().auth;var t=!1;n.state.user!==n.userRef&&(n.userRef=n.state.user,t=!0),n.state.isAuthenticated!==n.isAuthenticatedRef&&(n.isAuthenticatedRef=n.state.isAuthenticated,t=!0),n.userRef&&n.state.isAuthenticated?t&&n.accessTokenUpdater():clearInterval(n.accessTokenUpdaterRef)},this.accessTokenUpdater=function(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(n.accessTokenUpdaterRef&&clearInterval(n.accessTokenUpdaterRef),e)n.loginActions.requestAuthorize(!0);else if(n.isAuthenticated){var r=1e3*((null===(t=n.user)||void 0===t?void 0:t.expiresIn)||20)*.8;n.accessTokenUpdaterRef=setInterval(n.loginActions.requestAuthorize,r)}},this.getCurrentRoute=function(){var t,e,r,o,i,u,a,s,c,l,f="/";return(null===(e=null===(t=n.router)||void 0===t?void 0:t.currentRoute)||void 0===e?void 0:e.path)&&(f=null===(o=null===(r=n.router)||void 0===r?void 0:r.currentRoute)||void 0===o?void 0:o.path),(null===(a=null===(u=null===(i=n.router)||void 0===i?void 0:i.currentRoute)||void 0===u?void 0:u.value)||void 0===a?void 0:a.fullPath)&&(f=null===(l=null===(c=null===(s=n.router)||void 0===s?void 0:s.currentRoute)||void 0===c?void 0:c.value)||void 0===l?void 0:l.fullPath),f},this.isAuthRoutes=function(t){var e=new URL(t,window.location.origin).pathname;return Object.values(n.routes).filter((function(t){return t!=n.routes.authenticatedUrl})).includes(e)},this._routes=Object.assign(Object.assign({},o.defaultFronteggRoutes),i.routes),this.router=r}return v(t,[{key:"loading",get:function(){var t,e;return null===(e=null===(t=this.store)||void 0===t?void 0:t.getState().auth.isLoading)||void 0===e||e}},{key:"routes",get:function(){var t,e;return null!==(e=null===(t=this.store)||void 0===t?void 0:t.getState().auth.routes)&&void 0!==e?e:this._routes}},{key:"isAuthenticated",get:function(){var t,e;return null!==(e=null===(t=this.store)||void 0===t?void 0:t.getState().auth.isAuthenticated)&&void 0!==e&&e}},{key:"user",get:function(){var t;return null===(t=this.store)||void 0===t?void 0:t.getState().auth.user}}]),t}(),x=function(t,e){return function(){var n=h({},null!=e?e:t.substring("auth.".length),(function(t){return t}));return _(t,n,F).bind(this)()}},B=function(t){return x("auth","authState").bind(t)},H=function(t){return x("auth.loginState").bind(t)},z=function(t){return x("auth.acceptInvitationState").bind(t)},D=function(t){return x("auth.activateState").bind(t)},q=function(t){return x("auth.apiTokensState").bind(t)},W=function(t){return x("auth.forgotPasswordState").bind(t)},M=function(t){return x("auth.mfaState").bind(t)},V=function(t){return x("auth.profileState").bind(t)},$=function(t){return x("auth.securityPolicyState").bind(t)},K=function(t){return x("auth.signUpState").bind(t)},Y=function(t){return x("auth.socialLoginState").bind(t)},X=function(t){return x("auth.ssoState").bind(t)},Q=function(t){return x("auth.teamState").bind(t)},J=function(t){return x("auth.tenantsState").bind(t)},Z=function(t){Object.assign(t,{mapAuthState:B(t),mapLoginState:H(t),mapAcceptInvitationState:z(t),mapActivateAccountState:D(t),mapApiTokensState:q(t),mapForgotPasswordState:W(t),mapMfaState:M(t),mapProfileState:V(t),mapSecurityPolicyState:$(t),mapSignUpState:K(t),mapSocialLoginState:Y(t),mapSsoState:X(t),mapTeamState:Q(t),mapTenantsState:J(t)})},tt=function(t){return function(){return N.getAction(t).apply(void 0,arguments)}},et=function(){return e.inject(S)},nt=function(){return e.inject(y)},rt=function(){return e.inject(I)},ot=function(){return e.inject(O)},it="4.10.1",ut="2.6.12",at=function(t){var n=e.inject(y).user;return{entitlements:null==n?void 0:n.entitlements,attributes:{custom:t,jwt:n}}},st=null,ct={install:function(t,r){var i,a,s=null!=r?r:{},d=s.router,g=m(s,["router"]),v=(null!=r?r:{}).contextOptions;if(null==v)throw Error("contextOptions must be passed to Vue.use(Frontegg, { /* OPTIONS */ })");v.requestCredentials=null!==(i=v.requestCredentials)&&void 0!==i?i:"include",v.metadataHeaders={framework:"".concat(n.FronteggFrameworks.Vuejs,"@").concat(ut),fronteggSdkVersion:"@frontegg/vuejs@".concat(it)},n.ContextHolder.setContext(v);var h,A=!1,F=!1,_="3"===t.version.charAt(0);_&&(h=e.ref(!1));var N=new Set,x=d&&function(t,e){var r=G(t)||"";k.setBasename(r);var i=function(n,i){var u=n;u.startsWith(r)&&"/"!==r&&(u=u.substring(r.length-1)),((null==i?void 0:i.preserveQueryParams)||o.isAuthRoute(u,e))&&(u="".concat(u).concat(window.location.search)),(null==i?void 0:i.refresh)?window.location.href=u:(null==i?void 0:i.replace)?t.replace(u):t.push(u)};return n.ContextHolder.setOnRedirectTo(i),i}(d,null===(a=null==r?void 0:r.authOptions)||void 0===a?void 0:a.routes),B=(st=u.initialize(Object.assign(Object.assign({},g),{onRedirectTo:x,basename:G(d)}))).store;k.setStore(B),t.$fronteggApp=st,t.fronteggAuth||(t.fronteggAuth=new C({router:d}),function(t,e){var n;t.fronteggPlugins=null!==(n=t.fronteggPlugins)&&void 0!==n?n:[],t.fronteggPlugins.push(e)}(t,t.fronteggAuth));var H=function(){var e=(t.fronteggPlugins||[]).reduce((function(t,e){return t&&!e.loading}),!0);if(e!==F){F=e,_&&(h.value=e);var n,r=function(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=b(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==n.return||n.return()}finally{if(a)throw i}}}}(N);try{for(r.s();!(n=r.n()).done;){(0,n.value)()}}catch(t){r.e(t)}finally{r.f()}}};null==d||d.getRoutes().map((function(t){var e=t.beforeEnter;t.beforeEnter=function(t,n,r){var o=function(){e?e(t,n,r):r()};if(F)o();else var i=setInterval((function(){H(),F&&(clearInterval(i),o())}),1)}}));var z,D=setInterval((function(){H(),F&&clearInterval(D)}),10),q=function(e){if(e.authorizedContent&&!t.fronteggAuth.isAuthRoutes(e.$route.path)&&!t.fronteggAuth.loading&&!t.fronteggAuth.isAuthenticated)if(null==r?void 0:r.hostedLoginBox)t.fronteggAuth.loginActions.requestHostedLoginAuthorize();else{var n=t.fronteggAuth.routes.loginUrl;e.$router.push(n)}};function W(){this.$route.path.startsWith(t.fronteggAuth.routes.hostedLoginRedirectUrl)||(B.dispatch({type:"auth/setState",payload:{isLoading:!0}}),t.fronteggAuth.loginActions.requestHostedLoginAuthorize())}A||(z=t,A=!0,(t.fronteggPlugins||[]).forEach((function(t){return t.init(g,B)})),T(z,B),z.fronteggAuth=t.fronteggAuth,Z(z));var M=st.loadEntitlements.bind(st),V=st.stepUp.bind(st);if(_){t.provide(S,h);var $=function(t){var n=t.getState();if(t.subscribed)return{authState:t.previousAuthState,unsubscribe:t.previousUnsubscribe};var r=e.reactive(Object.assign({},n.auth)),o=t.subscribe((function(){t.subscribed=!0;var e=t.getState().auth;Object.entries(e).forEach((function(t){var n=p(t,2),o=n[0],i=n[1];r[o]!==e[o]&&(r[o]=i)}))})),i=function(){t.subscribed=!1,o()};return t.previousAuthState=r,t.previousUnsubscribe=i,{authState:r,unsubscribe:i}}(B),K=$.authState,Y=$.unsubscribe,X=e.reactive(Object.assign({},t.fronteggAuth));t.provide(y,K),t.provide(R,Y),t.provide(O,X),t.provide(j,d),t.provide(U,r),t.provide(I,B),t.provide(E,M),t.provide(P,V)}t.mixin({data:function(){return{fronteggLoaded:F}},beforeCreate:function(){T(this,B),this.fronteggAuth=t.fronteggAuth,this.loginWithRedirect=W.bind(this),this.getFeatureEntitlements=function(t,e,n){return st.getFeatureEntitlements(e,n)},this.getPermissionEntitlements=function(t,e,n){return st.getPermissionEntitlements(e,n)},this.getEntitlements=function(t,e,n){return st.getEntitlements(e,n)},this.loadEntitlements=M,this.isSteppedUp=function(t){return st.isSteppedUp()},Z(this)},updated:function(){q(this)},mounted:function(){q(this)},created:function(){var t,e;L(this)&&function(t,e){t.FRONTEGG_UNSUBSCRIBE=e}(this,B.subscribe((t=this,e=L(this),function(){var n=w(t).getState();Object.keys(e).forEach((function(r){Object.keys(e[r]).forEach((function(o){var i=e[r][o];if(i){var u,a=i(f.default(n,r)),s=Object.assign({},c);s.default&&(u=2),s.version&&"3"===s.version[0]&&(u=3),3===u&&l.default(t.$data,o,a),2===u&&l.default(t._data,o,a)}}))}))}))),function(t,e){t.FRONTEGG_LOADER_UNSUBSCRIBE=e}(this,function(t){var e=function(){t.fronteggLoaded=F};return N.add(e),function(){return N.delete(e)}}(this))},beforeDestroy:function(){!function(t){var e;null===(e=t.FRONTEGG_UNSUBSCRIBE)||void 0===e||e.call(t)}(this),function(t){var e;null===(e=t.FRONTEGG_LOADER_UNSUBSCRIBE)||void 0===e||e.call(t)}(this)}})}};return Object.defineProperty(t,"ContextHolder",{enumerable:!0,get:function(){return n.ContextHolder}}),Object.defineProperty(t,"AdminPortal",{enumerable:!0,get:function(){return u.AdminPortal}}),t.Frontegg=ct,t.closeAdminPortal=function(){return u.AdminPortal.hide()},t.isAuthenticatedGuard=function(t,e,n){var r,o,i=function(){var e,r=k.getStore().getState().auth;if(r.isAuthenticated)n();else{var o=null!==(e=k.getBasename())&&void 0!==e?e:"",i=o.endsWith("/")?o.substring(0,o.length-1):"";localStorage.setItem("FRONTEGG_AFTER_AUTH_REDIRECT_URL","".concat(i).concat(t.fullPath)),n({path:r.routes.loginUrl,replace:!0})}},u=null===(o=null===(r=k.getStore())||void 0===r?void 0:r.getState())||void 0===o?void 0:o.auth;if(!u||(null==u?void 0:u.isLoading))var a=setInterval((function(){var t,e;(u=null===(e=null===(t=k.getStore())||void 0===t?void 0:t.getState())||void 0===e?void 0:e.auth)&&!(null==u?void 0:u.isLoading)&&(clearInterval(a),i())}),1);else i()},t.mapAcceptInvitationActions=function(t){return tt(t)},t.mapActivateAccountActions=function(t){return tt(t)},t.mapApiTokensActions=function(t){return tt(t)},t.mapAuthActions=function(t){return tt(t)},t.mapForgotPasswordActions=function(t){return tt(t)},t.mapLoginActions=function(t){return tt("loginWithRedirect"===t?"requestHostedLoginAuthorize":t)},t.mapMfaActions=function(t){return tt(t)},t.mapProfileActions=function(t){return tt(t)},t.mapSecurityPolicyActions=function(t){return tt(t)},t.mapSignupActions=function(t){return tt(t)},t.mapSocialLoginActions=function(t){return tt(t)},t.mapSsoActions=function(t){return tt(t)},t.mapTeamActions=function(t){return tt(t)},t.openAdminPortal=function(){return u.AdminPortal.show()},t.useAuthState=nt,t.useEntitlements=function(t,n){return e.computed((function(){var e=at(n),r=e.entitlements,i=e.attributes;return o.getEntitlements(r,t,i,!0)}))},t.useFeatureEntitlements=function(t,n){return e.computed((function(){var e=at(n),r=e.entitlements,i=e.attributes;return o.getFeatureEntitlements(r,t,i,!0)}))},t.useFrontegg=function(){var t=et(),n=nt(),r=ot(),i=e.inject(E),u=e.inject(P),a=rt();return{fronteggLoaded:t,authState:n,fronteggAuth:r,loginWithRedirect:function(){var t,e;r.getCurrentRoute().startsWith(null!==(e=null!==(t=n.routes.hostedLoginRedirectUrl)&&void 0!==t?t:o.defaultFronteggRoutes.hostedLoginRedirectUrl)&&void 0!==e?e:"oauth/callback")||(a.dispatch({type:"auth/setState",payload:{isLoading:!0}}),r.loginActions.requestHostedLoginAuthorize())},loadEntitlements:i,stepUp:u}},t.useFronteggAuthGuard=function(t){var n=(null!=t?t:{}).redirectUrl,r=ot(),i=e.inject(U),u=nt(),a=e.inject(j),s=rt(),c=function(){var t=r.getCurrentRoute();r.isAuthRoutes(t)||u.isAuthenticated||u.isLoading||(i.hostedLoginBox?(s.dispatch({type:"auth/setState",payload:{isLoading:!0}}),n&&localStorage.setItem(o.FRONTEGG_AFTER_AUTH_REDIRECT_URL,n),r.loginActions.requestHostedLoginAuthorize()):a.push(u.routes.loginUrl))};e.onMounted(c),e.onUpdated(c)},t.useFronteggLoaded=et,t.useIsSteppedUp=function(t){return e.computed((function(){var n=e.inject(y).user;return o.isSteppedUp(n,t)}))},t.usePermissionEntitlements=function(t,n){return e.computed((function(){var e=at(n),r=e.entitlements,i=e.attributes;return o.getPermissionEntitlements(r,t,i,!0)}))},t.useUnsubscribeFronteggStore=function(){return e.inject(R)},Object.defineProperty(t,"__esModule",{value:!0}),t}({},Vue,fronteggRestApi,setValue,fronteggReduxStore,getValue,js);
|
|
16
|
+
function m(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n}var S=Symbol("fronteggLoade"),y=Symbol("authState"),R=Symbol("unsubscribeFronteggStore"),O=Symbol("fronteggAuth"),E=Symbol("loadEntitlements"),j=Symbol("router"),U=Symbol("fronteggOptions"),I=Symbol("fronteggStore"),P=Symbol("stepUp"),T=function(t,e){var n;return t.FRONTEGG_STORE_KEY=null!==(n=t.FRONTEGG_STORE_KEY)&&void 0!==n?n:e},w=function(t){return t.FRONTEGG_STORE_KEY},L=function(t){return t.FRONTEGG_REDUX_BINDINGS},k=function(){function t(){d(this,t)}return v(t,null,[{key:"getInstance",value:function(){return t.instance||(t.instance=new t),t.instance}},{key:"setStore",value:function(e){t.getInstance().store=e}},{key:"getStore",value:function(){return t.getInstance().store}},{key:"setBasename",value:function(e){t.getInstance().baseName=e}},{key:"getBasename",value:function(){return t.getInstance().baseName}}]),t}(),F=function(t){return function(e){return f.default(e,t)}},_=function(t,e,n){return function(){var r,o=this,i=Object.keys(e),u=f.default(w(o).getState(),t),a=function(t,e,n,r,o){return n.reduce((function(n,i){return Object.assign({},n,h({},e,Object.assign(Object.assign({},n[e]),h({},i,function(t,e,n){return"function"==typeof e?e.bind(t):n(e)}(t,r[i],o)))))}),L(t)||{})}(o,t,i,e,n);return r=a,o.FRONTEGG_REDUX_BINDINGS=r,i.reduce((function(t,r){return Object.assign({},t,h({},r,function(t,e,n,r){return"function"==typeof e?e.call(t,r):n(e)(r)}(o,e[r],n,u)))}),{})}},G=function(t){var e,n;return null!==(e=null==t?void 0:t.options.base)&&void 0!==e?e:null===(n=(null==t?void 0:t.options).history)||void 0===n?void 0:n.base},N=function(){function t(){d(this,t)}return v(t,null,[{key:"getInstance",value:function(){return t.instance||(t.instance=new t),t.instance}},{key:"setActions",value:function(e){t.getInstance().actions=e}},{key:"getAction",value:function(e){return t.getInstance().actions[e]}}]),t}(),C=function(){function t(e){var n=this;d(this,t);var r=e.router,i=m(e,["router"]);this.userRef=void 0,this.init=function(t,e){n.store=e,n.loginActions=e.stateActions.auth.loginActions,n.socialLoginsActions=e.stateActions.auth.socialLoginActions,n.activateAccountActions=e.stateActions.auth.activateAccountActions,n.acceptInvitationActions=e.stateActions.auth.acceptInvitationActions,n.forgotPasswordActions=e.stateActions.auth.forgotPasswordActions,n.signUpActions=e.stateActions.auth.signUpActions,n.profileActions=e.stateActions.auth.profileActions,n.ssoActions=e.stateActions.auth.ssoActions,n.mfaActions=e.stateActions.auth.mfaActions,n.teamActions=e.stateActions.auth.teamActions,n.apiTokensActions=e.stateActions.auth.apiTokensActions,n.securityPolicyActions=e.stateActions.auth.securityPolicyActions,n.tenantsActions=e.stateActions.auth.tenantsActions,N.setActions(e.actions),t.hostedLoginBox||n.store.subscribe(n.storeSubscriber)},this.storeSubscriber=function(){n.state=n.store.getState().auth;var t=!1;n.state.user!==n.userRef&&(n.userRef=n.state.user,t=!0),n.state.isAuthenticated!==n.isAuthenticatedRef&&(n.isAuthenticatedRef=n.state.isAuthenticated,t=!0),n.userRef&&n.state.isAuthenticated?t&&n.accessTokenUpdater():clearInterval(n.accessTokenUpdaterRef)},this.accessTokenUpdater=function(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(n.accessTokenUpdaterRef&&clearInterval(n.accessTokenUpdaterRef),e)n.loginActions.requestAuthorize(!0);else if(n.isAuthenticated){var r=1e3*((null===(t=n.user)||void 0===t?void 0:t.expiresIn)||20)*.8;n.accessTokenUpdaterRef=setInterval(n.loginActions.requestAuthorize,r)}},this.getCurrentRoute=function(){var t,e,r,o,i,u,a,s,c,l,f="/";return(null===(e=null===(t=n.router)||void 0===t?void 0:t.currentRoute)||void 0===e?void 0:e.path)&&(f=null===(o=null===(r=n.router)||void 0===r?void 0:r.currentRoute)||void 0===o?void 0:o.path),(null===(a=null===(u=null===(i=n.router)||void 0===i?void 0:i.currentRoute)||void 0===u?void 0:u.value)||void 0===a?void 0:a.fullPath)&&(f=null===(l=null===(c=null===(s=n.router)||void 0===s?void 0:s.currentRoute)||void 0===c?void 0:c.value)||void 0===l?void 0:l.fullPath),f},this.isAuthRoutes=function(t){var e=new URL(t,window.location.origin).pathname;return Object.values(n.routes).filter((function(t){return t!=n.routes.authenticatedUrl})).includes(e)},this._routes=Object.assign(Object.assign({},o.defaultFronteggRoutes),i.routes),this.router=r}return v(t,[{key:"loading",get:function(){var t,e;return null===(e=null===(t=this.store)||void 0===t?void 0:t.getState().auth.isLoading)||void 0===e||e}},{key:"routes",get:function(){var t,e;return null!==(e=null===(t=this.store)||void 0===t?void 0:t.getState().auth.routes)&&void 0!==e?e:this._routes}},{key:"isAuthenticated",get:function(){var t,e;return null!==(e=null===(t=this.store)||void 0===t?void 0:t.getState().auth.isAuthenticated)&&void 0!==e&&e}},{key:"user",get:function(){var t;return null===(t=this.store)||void 0===t?void 0:t.getState().auth.user}}]),t}(),x=function(t,e){return function(){var n=h({},null!=e?e:t.substring("auth.".length),(function(t){return t}));return _(t,n,F).bind(this)()}},B=function(t){return x("auth","authState").bind(t)},H=function(t){return x("auth.loginState").bind(t)},z=function(t){return x("auth.acceptInvitationState").bind(t)},D=function(t){return x("auth.activateState").bind(t)},q=function(t){return x("auth.apiTokensState").bind(t)},W=function(t){return x("auth.forgotPasswordState").bind(t)},M=function(t){return x("auth.mfaState").bind(t)},V=function(t){return x("auth.profileState").bind(t)},$=function(t){return x("auth.securityPolicyState").bind(t)},K=function(t){return x("auth.signUpState").bind(t)},Y=function(t){return x("auth.socialLoginState").bind(t)},X=function(t){return x("auth.ssoState").bind(t)},Q=function(t){return x("auth.teamState").bind(t)},J=function(t){return x("auth.tenantsState").bind(t)},Z=function(t){Object.assign(t,{mapAuthState:B(t),mapLoginState:H(t),mapAcceptInvitationState:z(t),mapActivateAccountState:D(t),mapApiTokensState:q(t),mapForgotPasswordState:W(t),mapMfaState:M(t),mapProfileState:V(t),mapSecurityPolicyState:$(t),mapSignUpState:K(t),mapSocialLoginState:Y(t),mapSsoState:X(t),mapTeamState:Q(t),mapTenantsState:J(t)})},tt=function(t){return function(){return N.getAction(t).apply(void 0,arguments)}},et=function(){return e.inject(S)},nt=function(){return e.inject(y)},rt=function(){return e.inject(I)},ot=function(){return e.inject(O)},it="4.10.2",ut="2.6.12",at=function(t){var n=e.inject(y).user;return{entitlements:null==n?void 0:n.entitlements,attributes:{custom:t,jwt:n}}},st=null,ct={install:function(t,r){var i,a,s=null!=r?r:{},d=s.router,g=m(s,["router"]),v=(null!=r?r:{}).contextOptions;if(null==v)throw Error("contextOptions must be passed to Vue.use(Frontegg, { /* OPTIONS */ })");v.requestCredentials=null!==(i=v.requestCredentials)&&void 0!==i?i:"include",v.metadataHeaders={framework:"".concat(n.FronteggFrameworks.Vuejs,"@").concat(ut),fronteggSdkVersion:"@frontegg/vuejs@".concat(it)},n.ContextHolder.setContext(v);var h,A=!1,F=!1,_="3"===t.version.charAt(0);_&&(h=e.ref(!1));var N=new Set,x=d&&function(t,e){var r=G(t)||"";k.setBasename(r);var i=function(n,i){var u=n;u.startsWith(r)&&"/"!==r&&(u=u.substring(r.length-1)),((null==i?void 0:i.preserveQueryParams)||o.isAuthRoute(u,e))&&(u="".concat(u).concat(window.location.search)),(null==i?void 0:i.refresh)?window.location.href=u:(null==i?void 0:i.replace)?t.replace(u):t.push(u)};return n.ContextHolder.setOnRedirectTo(i),i}(d,null===(a=null==r?void 0:r.authOptions)||void 0===a?void 0:a.routes),B=(st=u.initialize(Object.assign(Object.assign({},g),{onRedirectTo:x,basename:G(d)}))).store;k.setStore(B),t.$fronteggApp=st,t.fronteggAuth||(t.fronteggAuth=new C({router:d}),function(t,e){var n;t.fronteggPlugins=null!==(n=t.fronteggPlugins)&&void 0!==n?n:[],t.fronteggPlugins.push(e)}(t,t.fronteggAuth));var H=function(){var e=(t.fronteggPlugins||[]).reduce((function(t,e){return t&&!e.loading}),!0);if(e!==F){F=e,_&&(h.value=e);var n,r=function(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=b(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==n.return||n.return()}finally{if(a)throw i}}}}(N);try{for(r.s();!(n=r.n()).done;){(0,n.value)()}}catch(t){r.e(t)}finally{r.f()}}};null==d||d.getRoutes().map((function(t){var e=t.beforeEnter;t.beforeEnter=function(t,n,r){var o=function(){e?e(t,n,r):r()};if(F)o();else var i=setInterval((function(){H(),F&&(clearInterval(i),o())}),1)}}));var z,D=setInterval((function(){H(),F&&clearInterval(D)}),10),q=function(e){if(e.authorizedContent&&!t.fronteggAuth.isAuthRoutes(e.$route.path)&&!t.fronteggAuth.loading&&!t.fronteggAuth.isAuthenticated)if(null==r?void 0:r.hostedLoginBox)t.fronteggAuth.loginActions.requestHostedLoginAuthorize();else{var n=t.fronteggAuth.routes.loginUrl;e.$router.push(n)}};function W(){this.$route.path.startsWith(t.fronteggAuth.routes.hostedLoginRedirectUrl)||(B.dispatch({type:"auth/setState",payload:{isLoading:!0}}),t.fronteggAuth.loginActions.requestHostedLoginAuthorize())}A||(z=t,A=!0,(t.fronteggPlugins||[]).forEach((function(t){return t.init(g,B)})),T(z,B),z.fronteggAuth=t.fronteggAuth,Z(z));var M=st.loadEntitlements.bind(st),V=st.stepUp.bind(st);if(_){t.provide(S,h);var $=function(t){var n=t.getState();if(t.subscribed)return{authState:t.previousAuthState,unsubscribe:t.previousUnsubscribe};var r=e.reactive(Object.assign({},n.auth)),o=t.subscribe((function(){t.subscribed=!0;var e=t.getState().auth;Object.entries(e).forEach((function(t){var n=p(t,2),o=n[0],i=n[1];r[o]!==e[o]&&(r[o]=i)}))})),i=function(){t.subscribed=!1,o()};return t.previousAuthState=r,t.previousUnsubscribe=i,{authState:r,unsubscribe:i}}(B),K=$.authState,Y=$.unsubscribe,X=e.reactive(Object.assign({},t.fronteggAuth));t.provide(y,K),t.provide(R,Y),t.provide(O,X),t.provide(j,d),t.provide(U,r),t.provide(I,B),t.provide(E,M),t.provide(P,V)}t.mixin({data:function(){return{fronteggLoaded:F}},beforeCreate:function(){T(this,B),this.fronteggAuth=t.fronteggAuth,this.loginWithRedirect=W.bind(this),this.getFeatureEntitlements=function(t,e,n){return st.getFeatureEntitlements(e,n)},this.getPermissionEntitlements=function(t,e,n){return st.getPermissionEntitlements(e,n)},this.getEntitlements=function(t,e,n){return st.getEntitlements(e,n)},this.loadEntitlements=M,this.isSteppedUp=function(t){return st.isSteppedUp()},Z(this)},updated:function(){q(this)},mounted:function(){q(this)},created:function(){var t,e;L(this)&&function(t,e){t.FRONTEGG_UNSUBSCRIBE=e}(this,B.subscribe((t=this,e=L(this),function(){var n=w(t).getState();Object.keys(e).forEach((function(r){Object.keys(e[r]).forEach((function(o){var i=e[r][o];if(i){var u,a=i(f.default(n,r)),s=Object.assign({},c);s.default&&(u=2),s.version&&"3"===s.version[0]&&(u=3),3===u&&l.default(t.$data,o,a),2===u&&l.default(t._data,o,a)}}))}))}))),function(t,e){t.FRONTEGG_LOADER_UNSUBSCRIBE=e}(this,function(t){var e=function(){t.fronteggLoaded=F};return N.add(e),function(){return N.delete(e)}}(this))},beforeDestroy:function(){!function(t){var e;null===(e=t.FRONTEGG_UNSUBSCRIBE)||void 0===e||e.call(t)}(this),function(t){var e;null===(e=t.FRONTEGG_LOADER_UNSUBSCRIBE)||void 0===e||e.call(t)}(this)}})}};return Object.defineProperty(t,"ContextHolder",{enumerable:!0,get:function(){return n.ContextHolder}}),Object.defineProperty(t,"AdminPortal",{enumerable:!0,get:function(){return u.AdminPortal}}),t.Frontegg=ct,t.closeAdminPortal=function(){return u.AdminPortal.hide()},t.isAuthenticatedGuard=function(t,e,n){var r,o,i=function(){var e,r=k.getStore().getState().auth;if(r.isAuthenticated)n();else{var o=null!==(e=k.getBasename())&&void 0!==e?e:"",i=o.endsWith("/")?o.substring(0,o.length-1):"";localStorage.setItem("FRONTEGG_AFTER_AUTH_REDIRECT_URL","".concat(i).concat(t.fullPath)),n({path:r.routes.loginUrl,replace:!0})}},u=null===(o=null===(r=k.getStore())||void 0===r?void 0:r.getState())||void 0===o?void 0:o.auth;if(!u||(null==u?void 0:u.isLoading))var a=setInterval((function(){var t,e;(u=null===(e=null===(t=k.getStore())||void 0===t?void 0:t.getState())||void 0===e?void 0:e.auth)&&!(null==u?void 0:u.isLoading)&&(clearInterval(a),i())}),1);else i()},t.mapAcceptInvitationActions=function(t){return tt(t)},t.mapActivateAccountActions=function(t){return tt(t)},t.mapApiTokensActions=function(t){return tt(t)},t.mapAuthActions=function(t){return tt(t)},t.mapForgotPasswordActions=function(t){return tt(t)},t.mapLoginActions=function(t){return tt("loginWithRedirect"===t?"requestHostedLoginAuthorize":t)},t.mapMfaActions=function(t){return tt(t)},t.mapProfileActions=function(t){return tt(t)},t.mapSecurityPolicyActions=function(t){return tt(t)},t.mapSignupActions=function(t){return tt(t)},t.mapSocialLoginActions=function(t){return tt(t)},t.mapSsoActions=function(t){return tt(t)},t.mapTeamActions=function(t){return tt(t)},t.openAdminPortal=function(){return u.AdminPortal.show()},t.useAuthState=nt,t.useEntitlements=function(t,n){return e.computed((function(){var e=at(n),r=e.entitlements,i=e.attributes;return o.getEntitlements(r,t,i,!0)}))},t.useFeatureEntitlements=function(t,n){return e.computed((function(){var e=at(n),r=e.entitlements,i=e.attributes;return o.getFeatureEntitlements(r,t,i,!0)}))},t.useFrontegg=function(){var t=et(),n=nt(),r=ot(),i=e.inject(E),u=e.inject(P),a=rt();return{fronteggLoaded:t,authState:n,fronteggAuth:r,loginWithRedirect:function(){var t,e;r.getCurrentRoute().startsWith(null!==(e=null!==(t=n.routes.hostedLoginRedirectUrl)&&void 0!==t?t:o.defaultFronteggRoutes.hostedLoginRedirectUrl)&&void 0!==e?e:"oauth/callback")||(a.dispatch({type:"auth/setState",payload:{isLoading:!0}}),r.loginActions.requestHostedLoginAuthorize())},loadEntitlements:i,stepUp:u}},t.useFronteggAuthGuard=function(t){var n=(null!=t?t:{}).redirectUrl,r=ot(),i=e.inject(U),u=nt(),a=e.inject(j),s=rt(),c=function(){var t=r.getCurrentRoute();r.isAuthRoutes(t)||u.isAuthenticated||u.isLoading||(i.hostedLoginBox?(s.dispatch({type:"auth/setState",payload:{isLoading:!0}}),n&&localStorage.setItem(o.FRONTEGG_AFTER_AUTH_REDIRECT_URL,n),r.loginActions.requestHostedLoginAuthorize()):a.push(u.routes.loginUrl))};e.onMounted(c),e.onUpdated(c)},t.useFronteggLoaded=et,t.useIsSteppedUp=function(t){return e.computed((function(){var n=e.inject(y).user;return o.isSteppedUp(n,t)}))},t.usePermissionEntitlements=function(t,n){return e.computed((function(){var e=at(n),r=e.entitlements,i=e.attributes;return o.getPermissionEntitlements(r,t,i,!0)}))},t.useUnsubscribeFronteggStore=function(){return e.inject(R)},Object.defineProperty(t,"__esModule",{value:!0}),t}({},Vue,fronteggRestApi,setValue,fronteggReduxStore,getValue,js);
|
package/dist/index.ssr.js
CHANGED
|
@@ -801,7 +801,7 @@ var useFronteggAuthGuard = function useFronteggAuthGuard(options) {
|
|
|
801
801
|
Vue.onMounted(checkGuard);
|
|
802
802
|
Vue.onUpdated(checkGuard);
|
|
803
803
|
};var sdkVersion = {
|
|
804
|
-
version: '4.10.
|
|
804
|
+
version: '4.10.2'
|
|
805
805
|
};var name = "vue";
|
|
806
806
|
var version = "2.6.12";
|
|
807
807
|
var description = "Reactive, component-oriented view layer for modern web interfaces.";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/vue",
|
|
3
|
-
"version": "4.10.
|
|
3
|
+
"version": "4.10.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.ssr.js",
|
|
6
6
|
"browser": "dist/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"build:unpkg": "cross-env NODE_ENV=production rollup --config rollup.config.js --format iife"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@frontegg/js": "7.
|
|
25
|
+
"@frontegg/js": "7.84.0",
|
|
26
26
|
"get-value": "^3.0.1",
|
|
27
27
|
"set-value": "^4.0.1"
|
|
28
28
|
},
|