@frontegg/vue 2.0.40 → 2.0.41-alpha.5461688806

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { FronteggAuthService } from './service';
2
- import { AcceptInvitationState, ActivateAccountState, ApiTokensState, AuthState, ForgotPasswordState, LoginState, MFAState, ProfileState, SecurityPolicyState, SignUpState, SocialLoginState, SSOState, TeamState, EntitlementsState } from '@frontegg/redux-store';
2
+ import { AcceptInvitationState, ActivateAccountState, ApiTokensState, AuthState, ForgotPasswordState, LoginState, MFAState, ProfileState, SecurityPolicyState, SignUpState, SocialLoginState, SSOState, TeamState } from '@frontegg/redux-store';
3
3
  import VueRouter from 'vue-router';
4
4
  import { TenantsState } from '@frontegg/redux-store';
5
5
  export declare type AuthPluginOptions = {
@@ -17,9 +17,6 @@ declare module 'vue/types/vue' {
17
17
  mapAuthState: () => {
18
18
  authState: AuthState;
19
19
  };
20
- mapEntitlementsState: () => {
21
- entitlements: EntitlementsState['entitlements'];
22
- };
23
20
  mapLoginState: () => {
24
21
  loginState: LoginState;
25
22
  };
@@ -1,8 +1,7 @@
1
- import { AcceptInvitationActions, ActivateAccountActions, ApiTokensActions, ForgotPasswordActions, LoginActions, MfaActions, ProfileActions, SecurityPolicyActions, SignUpActions, SocialLoginActions, SSOActions, TeamActions, TenantsActions, AuthActions, Entitlements } from '@frontegg/redux-store';
1
+ import { AcceptInvitationActions, ActivateAccountActions, ApiTokensActions, ForgotPasswordActions, LoginActions, MfaActions, ProfileActions, SecurityPolicyActions, SignUpActions, SocialLoginActions, SSOActions, TeamActions, TenantsActions, AuthActions } from '@frontegg/redux-store';
2
2
  import { AuthState, EnhancedStore } from '@frontegg/redux-store';
3
3
  import { FronteggAuthService } from './service';
4
4
  export declare const mapAuthState: (_this: any) => () => {};
5
- export declare const mapEntitlementsState: (_this: any) => () => {};
6
5
  export declare const mapLoginState: (_this: any) => () => {};
7
6
  export declare const mapAcceptInvitationState: (_this: any) => () => {};
8
7
  export declare const mapActivateAccountState: (_this: any) => () => {};
@@ -293,11 +292,6 @@ export declare const connectFronteggStoreV3: (store: EnhancedStore) => {
293
292
  unsubscribe: import("redux").Unsubscribe;
294
293
  };
295
294
  export declare const useFronteggLoaded: () => boolean;
296
- /**
297
- @param keys The requested entitlement keys
298
- @returns Entitlements contain state data for every key (inc if entitled)
299
- */
300
- export declare const useEntitlements: (keys: string[]) => Entitlements;
301
295
  export declare const useUnsubscribeFronteggStore: () => () => void;
302
296
  export declare const useAuthState: () => AuthState;
303
297
  export declare const useFronteggStore: () => any;
@@ -5,7 +5,6 @@ export declare const FRONTEGG_UNSUBSCRIBE = "FRONTEGG_UNSUBSCRIBE";
5
5
  export declare const FRONTEGG_LOADER_UNSUBSCRIBE = "FRONTEGG_LOADER_UNSUBSCRIBE";
6
6
  export declare const fronteggLoadedKey: unique symbol;
7
7
  export declare const authStateKey: unique symbol;
8
- export declare const entitlementsStateKey: unique symbol;
9
8
  export declare const unsubscribeFronteggStoreKey: unique symbol;
10
9
  export declare const fronteggAuthKey: unique symbol;
11
10
  export declare const routerKey: unique symbol;
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { PluginOptions } from './interfaces';
3
3
  import { AdminPortal } from '@frontegg/js';
4
4
  import { ContextHolder } from '@frontegg/rest-api';
5
5
  export * from './types';
6
- export { mapAuthActions, mapLoginActions, mapAcceptInvitationActions, mapActivateAccountActions, mapApiTokensActions, mapForgotPasswordActions, mapMfaActions, mapProfileActions, mapSecurityPolicyActions, mapSignupActions, mapSocialLoginActions, mapSsoActions, mapTeamActions, useAuthState, useUnsubscribeFronteggStore, useEntitlements, useFronteggLoaded, useFrontegg, useFronteggAuthGuard, } from './auth/mapAuthState';
6
+ export { mapAuthActions, mapLoginActions, mapAcceptInvitationActions, mapActivateAccountActions, mapApiTokensActions, mapForgotPasswordActions, mapMfaActions, mapProfileActions, mapSecurityPolicyActions, mapSignupActions, mapSocialLoginActions, mapSsoActions, mapTeamActions, useAuthState, useUnsubscribeFronteggStore, useFronteggLoaded, useFrontegg, useFronteggAuthGuard, } from './auth/mapAuthState';
7
7
  export * from './auth/interfaces';
8
8
  export * from './auth/guards';
9
9
  declare const Frontegg: PluginObject<PluginOptions> | any;
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as Vue from 'vue';
2
- import { inject, computed, onBeforeUnmount, onMounted, onUpdated, reactive, ref } from 'vue';
2
+ import { inject, onBeforeUnmount, onMounted, onUpdated, reactive, ref } from 'vue';
3
3
  import { ContextHolder, FronteggFrameworks } from '@frontegg/rest-api';
4
4
  export { ContextHolder } from '@frontegg/rest-api';
5
5
  import set from 'set-value';
6
- import { isAuthRoute, authInitialState, loginActions, socialLoginsActions, activateAccountActions, acceptInvitationActions, forgotPasswordActions, signUpActions, profileActions, ssoActions, mfaActions, teamActions, apiTokensActions, securityPolicyActions, tenantsActions, bindActionCreators, authActions, getEntitlements } from '@frontegg/redux-store';
6
+ import { isAuthRoute, authInitialState, loginActions, socialLoginsActions, activateAccountActions, acceptInvitationActions, forgotPasswordActions, signUpActions, profileActions, ssoActions, mfaActions, teamActions, apiTokensActions, securityPolicyActions, tenantsActions, bindActionCreators, authActions } from '@frontegg/redux-store';
7
7
  import get from 'get-value';
8
8
  import { initialize, AdminPortal } from '@frontegg/js';
9
9
  export { AdminPortal } from '@frontegg/js';
@@ -324,7 +324,6 @@ const mapSubState = (statePrefix, propertyName) => function () {
324
324
  };
325
325
 
326
326
  const mapAuthState = _this => mapSubState('auth', 'authState').bind(_this);
327
- const mapEntitlementsState = _this => mapSubState('auth.entitlementsState.entitlements', 'entitlements').bind(_this);
328
327
  const mapLoginState = _this => mapSubState('auth.loginState').bind(_this);
329
328
  const mapAcceptInvitationState = _this => mapSubState('auth.acceptInvitationState').bind(_this);
330
329
  const mapActivateAccountState = _this => mapSubState('auth.activateState').bind(_this);
@@ -341,7 +340,6 @@ const mapTenantsState = _this => mapSubState('auth.tenantsState').bind(_this);
341
340
  const connectMapState = _this => {
342
341
  Object.assign(_this, {
343
342
  mapAuthState: mapAuthState(_this),
344
- mapEntitlementsState: mapEntitlementsState(_this),
345
343
  mapLoginState: mapLoginState(_this),
346
344
  mapAcceptInvitationState: mapAcceptInvitationState(_this),
347
345
  mapActivateAccountState: mapActivateAccountState(_this),
@@ -399,25 +397,6 @@ const useFronteggLoaded = () => {
399
397
  const fronteggLoaded = inject(fronteggLoadedKey);
400
398
  return fronteggLoaded;
401
399
  };
402
- /**
403
- @param keys The requested entitlement keys
404
- @returns Entitlements contain state data for every key (inc if entitled)
405
- */
406
-
407
- const useEntitlements = keys => {
408
- const authState = inject(authStateKey);
409
- return computed(() => {
410
- var _a;
411
-
412
- return getEntitlements(((_a = authState.entitlementsState) === null || _a === void 0 ? void 0 : _a.entitlements) || {}, keys).reduce((entitlementsResult, {
413
- isEntitled
414
- }, i) => Object.assign(Object.assign({}, entitlementsResult), {
415
- [keys[i]]: {
416
- isEntitled
417
- }
418
- }), {});
419
- });
420
- };
421
400
  const useUnsubscribeFronteggStore = () => {
422
401
  const unsubscribeFronteggStore = inject(unsubscribeFronteggStoreKey);
423
402
  return unsubscribeFronteggStore;
@@ -741,10 +720,7 @@ const Frontegg = {
741
720
  beforeCreate() {
742
721
  setStoreKey(this, store);
743
722
  this.fronteggAuth = Vue.fronteggAuth;
744
- this.loginWithRedirect = loginWithRedirect.bind(this); // _entitlements was added for to make the computed property reactive, then it will get updated
745
-
746
- this.getEntitlements = (_entitlements, keys) => fronteggApp.getEntitlements(keys);
747
-
723
+ this.loginWithRedirect = loginWithRedirect.bind(this);
748
724
  connectMapState(this);
749
725
  },
750
726
 
@@ -791,4 +767,4 @@ const openAdminPortal = () => AdminPortal.show();
791
767
 
792
768
  const closeAdminPortal = () => AdminPortal.hide();
793
769
 
794
- export { Frontegg, closeAdminPortal, isAuthenticatedGuard, mapAcceptInvitationActions, mapActivateAccountActions, mapApiTokensActions, mapAuthActions, mapForgotPasswordActions, mapLoginActions, mapMfaActions, mapProfileActions, mapSecurityPolicyActions, mapSignupActions, mapSocialLoginActions, mapSsoActions, mapTeamActions, openAdminPortal, useAuthState, useEntitlements, useFrontegg, useFronteggAuthGuard, useFronteggLoaded, useUnsubscribeFronteggStore };
770
+ export { Frontegg, closeAdminPortal, isAuthenticatedGuard, mapAcceptInvitationActions, mapActivateAccountActions, mapApiTokensActions, mapAuthActions, mapForgotPasswordActions, mapLoginActions, mapMfaActions, mapProfileActions, mapSecurityPolicyActions, mapSignupActions, mapSocialLoginActions, mapSsoActions, mapTeamActions, openAdminPortal, useAuthState, useFrontegg, useFronteggAuthGuard, useFronteggLoaded, useUnsubscribeFronteggStore };
package/dist/index.min.js CHANGED
@@ -1,4 +1,4 @@
1
- var FronteggCore=function(t,e,n,r,o,i,u){"use strict";function a(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function s(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}var c=s(e),l=a(r),f=a(i);function d(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function g(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function h(t,e,n){return e&&g(t.prototype,e),n&&g(t,n),t}function v(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function p(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var u,a=t[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==a.return||a.return()}finally{if(o)throw i}}return n}(t,e)||b(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(t,e){if(t){if("string"==typeof t)return A(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?A(t,e):void 0}}function A(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}
1
+ var FronteggCore=function(t,e,n,r,o,i,u){"use strict";function a(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function c(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}var s=c(e),f=a(r),l=a(i);function d(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function g(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function h(t,e,n){return e&&g(t.prototype,e),n&&g(t,n),t}function v(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function p(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var u,a=t[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==a.return||a.return()}finally{if(o)throw i}}return n}(t,e)||b(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(t,e){if(t){if("string"==typeof t)return A(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?A(t,e):void 0}}function A(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}
2
2
  /*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -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 S(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 m=Symbol("fronteggLoade"),y=Symbol("authState"),O=Symbol("unsubscribeFronteggStore"),j=Symbol("fronteggAuth"),R=Symbol("router"),E=Symbol("fronteggOptions"),I=Symbol("fronteggStore"),P=function(t,e){var n;return t.FRONTEGG_STORE_KEY=null!==(n=t.FRONTEGG_STORE_KEY)&&void 0!==n?n:e},T=function(t){return t.FRONTEGG_STORE_KEY},w=function(t){return t.FRONTEGG_REDUX_BINDINGS},U=function(){function t(){d(this,t)}return h(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}(),L=function(t){return function(e){return f.default(e,t)}},k=function(t,e,n){return function(){var r,o=this,i=Object.keys(e),u=f.default(T(o).getState(),t),a=function(t,e,n,r,o){return n.reduce((function(n,i){return Object.assign({},n,v({},e,Object.assign(Object.assign({},n[e]),v({},i,function(t,e,n){return"function"==typeof e?e.bind(t):n(e)}(t,r[i],o)))))}),w(t)||{})}(o,t,i,e,n);return r=a,o.FRONTEGG_REDUX_BINDINGS=r,i.reduce((function(t,r){return Object.assign({},t,v({},r,function(t,e,n,r){return"function"==typeof e?e.call(t,r):n(e)(r)}(o,e[r],n,u)))}),{})}},_=function(){function t(){d(this,t)}return h(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}(),G=function(){function t(e){var n=this;d(this,t);var r=e.router,i=S(e,["router"]);this.state=o.authInitialState,this.userRef=void 0,this.init=function(t,e){n.store=e,Object.entries({loginActions:o.loginActions,socialLoginsActions:o.socialLoginsActions,activateAccountActions:o.activateAccountActions,acceptInvitationActions:o.acceptInvitationActions,forgotPasswordActions:o.forgotPasswordActions,signUpActions:o.signUpActions,profileActions:o.profileActions,ssoActions:o.ssoActions,mfaActions:o.mfaActions,teamActions:o.teamActions,apiTokensActions:o.apiTokensActions,securityPolicyActions:o.securityPolicyActions,tenantsActions:o.tenantsActions}).forEach((function(t){var e=p(t,2),r=e[0],i=e[1];Object.assign(n,v({},r,o.bindActionCreators(i,n.store.dispatch)))}));var r=o.bindActionCreators(o.authActions,n.store.dispatch);_.setActions(r),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._routes=Object.assign(Object.assign({},o.authInitialState.routes),i.routes),this.router=r}return h(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}(),F=function(t,e){return function(){var n=v({},null!=e?e:t.substring("auth.".length),(function(t){return t}));return k(t,n,L).bind(this)()}},N=function(t){return F("auth","authState").bind(t)},C=function(t){return F("auth.entitlementsState.entitlements","entitlements").bind(t)},B=function(t){return F("auth.loginState").bind(t)},x=function(t){return F("auth.acceptInvitationState").bind(t)},H=function(t){return F("auth.activateState").bind(t)},z=function(t){return F("auth.apiTokensState").bind(t)},q=function(t){return F("auth.forgotPasswordState").bind(t)},D=function(t){return F("auth.mfaState").bind(t)},W=function(t){return F("auth.profileState").bind(t)},M=function(t){return F("auth.securityPolicyState").bind(t)},V=function(t){return F("auth.signUpState").bind(t)},$=function(t){return F("auth.socialLoginState").bind(t)},K=function(t){return F("auth.ssoState").bind(t)},Y=function(t){return F("auth.teamState").bind(t)},X=function(t){return F("auth.tenantsState").bind(t)},Q=function(t){Object.assign(t,{mapAuthState:N(t),mapEntitlementsState:C(t),mapLoginState:B(t),mapAcceptInvitationState:x(t),mapActivateAccountState:H(t),mapApiTokensState:z(t),mapForgotPasswordState:q(t),mapMfaState:D(t),mapProfileState:W(t),mapSecurityPolicyState:M(t),mapSignUpState:V(t),mapSocialLoginState:$(t),mapSsoState:K(t),mapTeamState:Y(t),mapTenantsState:X(t)})},J=function(t){return function(){return _.getAction(t).apply(void 0,arguments)}},Z=function(){return e.inject(m)},tt=function(){return e.inject(O)},et=function(){return e.inject(y)},nt=function(){return e.inject(I)},rt=function(){return e.inject(j)},ot="2.0.40",it=null,ut={install:function(t,r){var i,a,s=null!=r?r:{},d=s.router,g=S(s,["router"]),h=(null!=r?r:{}).contextOptions;if(null==h)throw Error("contextOptions must be passed to Vue.use(Frontegg, { /* OPTIONS */ })");h.requestCredentials=null!==(i=h.requestCredentials)&&void 0!==i?i:"include",h.metadataHeaders={framework:n.FronteggFrameworks.Vuejs,fronteggSdkVersion:"@frontegg/vuejs@".concat(ot)},n.ContextHolder.setContext(h);var v,A=!1,L=!1,k="3"===t.version.charAt(0);k&&(v=e.ref(!1));var _=new Set,F=d&&function(t,e){var r=t.options.base||"";U.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),N=(it=u.initialize(Object.assign(Object.assign({},g),{onRedirectTo:F,basename:null==d?void 0:d.options.base}))).store;U.setStore(N),t.$fronteggApp=it,t.fronteggAuth||(t.fronteggAuth=new G({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 C=function(){var e=(t.fronteggPlugins||[]).reduce((function(t,e){return t&&!e.loading}),!0);if(e!==L){L=e,k&&(v.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}}}}(_);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(L)o();else var i=setInterval((function(){C(),L&&(clearInterval(i),o())}),1)}}));var B,x=setInterval((function(){C(),L&&clearInterval(x)}),10),H=function(e){var n,o;if(e.authorizedContent&&(n=e.$route.path,o=t.fronteggAuth.routes,!Object.values(o).filter((function(t){return t!=o.authenticatedUrl})).includes(n))&&(!t.fronteggAuth.loading&&!t.fronteggAuth.isAuthenticated))if(null==r?void 0:r.hostedLoginBox)t.fronteggAuth.loginActions.requestHostedLoginAuthorize();else{var i=t.fronteggAuth.routes.loginUrl;e.$router.push(i)}};function z(){this.$route.path.startsWith(t.fronteggAuth.routes.hostedLoginRedirectUrl)||(N.dispatch({type:"auth/setState",payload:{isLoading:!0}}),t.fronteggAuth.loginActions.requestHostedLoginAuthorize())}if(A||(B=t,A=!0,(t.fronteggPlugins||[]).forEach((function(t){return t.init(g,N)})),P(B,N),B.fronteggAuth=t.fronteggAuth,Q(B)),k){t.provide(m,v);var q=function(t){var n=t.getState(),r=e.reactive(Object.assign({},n.auth)),o=t.subscribe((function(){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)}))}));return{authState:r,unsubscribe:o}}(N),D=q.authState,W=q.unsubscribe,M=e.reactive(Object.assign({},t.fronteggAuth));t.provide(y,D),t.provide(O,W),t.provide(j,M),t.provide(R,d),t.provide(E,r),t.provide(I,N)}t.mixin({data:function(){return{fronteggLoaded:L}},beforeCreate:function(){P(this,N),this.fronteggAuth=t.fronteggAuth,this.loginWithRedirect=z.bind(this),this.getEntitlements=function(t,e){return it.getEntitlements(e)},Q(this)},updated:function(){H(this)},mounted:function(){H(this)},created:function(){var t,e;w(this)&&function(t,e){t.FRONTEGG_UNSUBSCRIBE=e}(this,N.subscribe((t=this,e=w(this),function(){var n=T(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=L};return _.add(e),function(){return _.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=ut,t.closeAdminPortal=function(){return u.AdminPortal.hide()},t.isAuthenticatedGuard=function(t,e,n){var r,o,i=function(){var e,r=U.getStore().getState().auth;if(r.isAuthenticated)n();else{var o=null!==(e=U.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=U.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=U.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 J(t)},t.mapActivateAccountActions=function(t){return J(t)},t.mapApiTokensActions=function(t){return J(t)},t.mapAuthActions=function(t){return J(t)},t.mapForgotPasswordActions=function(t){return J(t)},t.mapLoginActions=function(t){return J("loginWithRedirect"===t?"requestHostedLoginAuthorize":t)},t.mapMfaActions=function(t){return J(t)},t.mapProfileActions=function(t){return J(t)},t.mapSecurityPolicyActions=function(t){return J(t)},t.mapSignupActions=function(t){return J(t)},t.mapSocialLoginActions=function(t){return J(t)},t.mapSsoActions=function(t){return J(t)},t.mapTeamActions=function(t){return J(t)},t.openAdminPortal=function(){return u.AdminPortal.show()},t.useAuthState=et,t.useEntitlements=function(t){var n=e.inject(y);return e.computed((function(){var e;return o.getEntitlements((null===(e=n.entitlementsState)||void 0===e?void 0:e.entitlements)||{},t).reduce((function(e,n,r){var o=n.isEntitled;return Object.assign(Object.assign({},e),v({},t[r],{isEntitled:o}))}),{})}))},t.useFrontegg=function(){var t=Z(),n=tt(),r=et(),o=rt(),i=nt();return e.onBeforeUnmount((function(){n()})),{fronteggLoaded:t,authState:r,fronteggAuth:o,loginWithRedirect:function(){var t;(null===(t=o.router)||void 0===t?void 0:t.currentRoute.path.startsWith(r.routes.hostedLoginRedirectUrl))||(i.dispatch({type:"auth/setState",payload:{isLoading:!0}}),o.loginActions.requestHostedLoginAuthorize())}}},t.useFronteggAuthGuard=function(){var t=rt(),n=e.inject(E),r=et(),o=e.inject(R),i=nt(),u=function(){var e,u,a;u=null===(e=t.router)||void 0===e?void 0:e.currentRoute.path,a=r.routes,Object.values(a).filter((function(t){return t!==a.authenticatedUrl})).includes(u)||r.isAuthenticated||r.isLoading||(n.hostedLoginBox?(i.dispatch({type:"auth/setState",payload:{isLoading:!0}}),t.loginActions.requestHostedLoginAuthorize()):o.push(r.routes.loginUrl))};e.onMounted(u),e.onUpdated(u)},t.useFronteggLoaded=Z,t.useUnsubscribeFronteggStore=tt,Object.defineProperty(t,"__esModule",{value:!0}),t}({},Vue,fronteggRestApi,setValue,fronteggReduxStore,getValue,js);
16
+ function S(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 y=Symbol("fronteggLoade"),m=Symbol("authState"),O=Symbol("unsubscribeFronteggStore"),j=Symbol("fronteggAuth"),R=Symbol("router"),I=Symbol("fronteggOptions"),E=Symbol("fronteggStore"),P=function(t,e){var n;return t.FRONTEGG_STORE_KEY=null!==(n=t.FRONTEGG_STORE_KEY)&&void 0!==n?n:e},T=function(t){return t.FRONTEGG_STORE_KEY},w=function(t){return t.FRONTEGG_REDUX_BINDINGS},U=function(){function t(){d(this,t)}return h(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}(),L=function(t){return function(e){return l.default(e,t)}},k=function(t,e,n){return function(){var r,o=this,i=Object.keys(e),u=l.default(T(o).getState(),t),a=function(t,e,n,r,o){return n.reduce((function(n,i){return Object.assign({},n,v({},e,Object.assign(Object.assign({},n[e]),v({},i,function(t,e,n){return"function"==typeof e?e.bind(t):n(e)}(t,r[i],o)))))}),w(t)||{})}(o,t,i,e,n);return r=a,o.FRONTEGG_REDUX_BINDINGS=r,i.reduce((function(t,r){return Object.assign({},t,v({},r,function(t,e,n,r){return"function"==typeof e?e.call(t,r):n(e)(r)}(o,e[r],n,u)))}),{})}},_=function(){function t(){d(this,t)}return h(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}(),G=function(){function t(e){var n=this;d(this,t);var r=e.router,i=S(e,["router"]);this.state=o.authInitialState,this.userRef=void 0,this.init=function(t,e){n.store=e,Object.entries({loginActions:o.loginActions,socialLoginsActions:o.socialLoginsActions,activateAccountActions:o.activateAccountActions,acceptInvitationActions:o.acceptInvitationActions,forgotPasswordActions:o.forgotPasswordActions,signUpActions:o.signUpActions,profileActions:o.profileActions,ssoActions:o.ssoActions,mfaActions:o.mfaActions,teamActions:o.teamActions,apiTokensActions:o.apiTokensActions,securityPolicyActions:o.securityPolicyActions,tenantsActions:o.tenantsActions}).forEach((function(t){var e=p(t,2),r=e[0],i=e[1];Object.assign(n,v({},r,o.bindActionCreators(i,n.store.dispatch)))}));var r=o.bindActionCreators(o.authActions,n.store.dispatch);_.setActions(r),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._routes=Object.assign(Object.assign({},o.authInitialState.routes),i.routes),this.router=r}return h(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}(),F=function(t,e){return function(){var n=v({},null!=e?e:t.substring("auth.".length),(function(t){return t}));return k(t,n,L).bind(this)()}},N=function(t){return F("auth","authState").bind(t)},C=function(t){return F("auth.loginState").bind(t)},B=function(t){return F("auth.acceptInvitationState").bind(t)},x=function(t){return F("auth.activateState").bind(t)},H=function(t){return F("auth.apiTokensState").bind(t)},z=function(t){return F("auth.forgotPasswordState").bind(t)},q=function(t){return F("auth.mfaState").bind(t)},D=function(t){return F("auth.profileState").bind(t)},W=function(t){return F("auth.securityPolicyState").bind(t)},M=function(t){return F("auth.signUpState").bind(t)},V=function(t){return F("auth.socialLoginState").bind(t)},$=function(t){return F("auth.ssoState").bind(t)},K=function(t){return F("auth.teamState").bind(t)},Y=function(t){return F("auth.tenantsState").bind(t)},X=function(t){Object.assign(t,{mapAuthState:N(t),mapLoginState:C(t),mapAcceptInvitationState:B(t),mapActivateAccountState:x(t),mapApiTokensState:H(t),mapForgotPasswordState:z(t),mapMfaState:q(t),mapProfileState:D(t),mapSecurityPolicyState:W(t),mapSignUpState:M(t),mapSocialLoginState:V(t),mapSsoState:$(t),mapTeamState:K(t),mapTenantsState:Y(t)})},Q=function(t){return function(){return _.getAction(t).apply(void 0,arguments)}},J=function(){return e.inject(y)},Z=function(){return e.inject(O)},tt=function(){return e.inject(m)},et=function(){return e.inject(E)},nt=function(){return e.inject(j)},rt="2.0.40",ot=null,it={install:function(t,r){var i,a,c=null!=r?r:{},d=c.router,g=S(c,["router"]),h=(null!=r?r:{}).contextOptions;if(null==h)throw Error("contextOptions must be passed to Vue.use(Frontegg, { /* OPTIONS */ })");h.requestCredentials=null!==(i=h.requestCredentials)&&void 0!==i?i:"include",h.metadataHeaders={framework:n.FronteggFrameworks.Vuejs,fronteggSdkVersion:"@frontegg/vuejs@".concat(rt)},n.ContextHolder.setContext(h);var v,A=!1,L=!1,k="3"===t.version.charAt(0);k&&(v=e.ref(!1));var _=new Set,F=d&&function(t,e){var r=t.options.base||"";U.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),N=(ot=u.initialize(Object.assign(Object.assign({},g),{onRedirectTo:F,basename:null==d?void 0:d.options.base}))).store;U.setStore(N),t.$fronteggApp=ot,t.fronteggAuth||(t.fronteggAuth=new G({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 C=function(){var e=(t.fronteggPlugins||[]).reduce((function(t,e){return t&&!e.loading}),!0);if(e!==L){L=e,k&&(v.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}}}}(_);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(L)o();else var i=setInterval((function(){C(),L&&(clearInterval(i),o())}),1)}}));var B,x=setInterval((function(){C(),L&&clearInterval(x)}),10),H=function(e){var n,o;if(e.authorizedContent&&(n=e.$route.path,o=t.fronteggAuth.routes,!Object.values(o).filter((function(t){return t!=o.authenticatedUrl})).includes(n))&&(!t.fronteggAuth.loading&&!t.fronteggAuth.isAuthenticated))if(null==r?void 0:r.hostedLoginBox)t.fronteggAuth.loginActions.requestHostedLoginAuthorize();else{var i=t.fronteggAuth.routes.loginUrl;e.$router.push(i)}};function z(){this.$route.path.startsWith(t.fronteggAuth.routes.hostedLoginRedirectUrl)||(N.dispatch({type:"auth/setState",payload:{isLoading:!0}}),t.fronteggAuth.loginActions.requestHostedLoginAuthorize())}if(A||(B=t,A=!0,(t.fronteggPlugins||[]).forEach((function(t){return t.init(g,N)})),P(B,N),B.fronteggAuth=t.fronteggAuth,X(B)),k){t.provide(y,v);var q=function(t){var n=t.getState(),r=e.reactive(Object.assign({},n.auth)),o=t.subscribe((function(){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)}))}));return{authState:r,unsubscribe:o}}(N),D=q.authState,W=q.unsubscribe,M=e.reactive(Object.assign({},t.fronteggAuth));t.provide(m,D),t.provide(O,W),t.provide(j,M),t.provide(R,d),t.provide(I,r),t.provide(E,N)}t.mixin({data:function(){return{fronteggLoaded:L}},beforeCreate:function(){P(this,N),this.fronteggAuth=t.fronteggAuth,this.loginWithRedirect=z.bind(this),X(this)},updated:function(){H(this)},mounted:function(){H(this)},created:function(){var t,e;w(this)&&function(t,e){t.FRONTEGG_UNSUBSCRIBE=e}(this,N.subscribe((t=this,e=w(this),function(){var n=T(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(l.default(n,r)),c=Object.assign({},s);c.default&&(u=2),c.version&&"3"===c.version[0]&&(u=3),3===u&&f.default(t.$data,o,a),2===u&&f.default(t._data,o,a)}}))}))}))),function(t,e){t.FRONTEGG_LOADER_UNSUBSCRIBE=e}(this,function(t){var e=function(){t.fronteggLoaded=L};return _.add(e),function(){return _.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=it,t.closeAdminPortal=function(){return u.AdminPortal.hide()},t.isAuthenticatedGuard=function(t,e,n){var r,o,i=function(){var e,r=U.getStore().getState().auth;if(r.isAuthenticated)n();else{var o=null!==(e=U.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=U.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=U.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 Q(t)},t.mapActivateAccountActions=function(t){return Q(t)},t.mapApiTokensActions=function(t){return Q(t)},t.mapAuthActions=function(t){return Q(t)},t.mapForgotPasswordActions=function(t){return Q(t)},t.mapLoginActions=function(t){return Q("loginWithRedirect"===t?"requestHostedLoginAuthorize":t)},t.mapMfaActions=function(t){return Q(t)},t.mapProfileActions=function(t){return Q(t)},t.mapSecurityPolicyActions=function(t){return Q(t)},t.mapSignupActions=function(t){return Q(t)},t.mapSocialLoginActions=function(t){return Q(t)},t.mapSsoActions=function(t){return Q(t)},t.mapTeamActions=function(t){return Q(t)},t.openAdminPortal=function(){return u.AdminPortal.show()},t.useAuthState=tt,t.useFrontegg=function(){var t=J(),n=Z(),r=tt(),o=nt(),i=et();return e.onBeforeUnmount((function(){n()})),{fronteggLoaded:t,authState:r,fronteggAuth:o,loginWithRedirect:function(){var t;(null===(t=o.router)||void 0===t?void 0:t.currentRoute.path.startsWith(r.routes.hostedLoginRedirectUrl))||(i.dispatch({type:"auth/setState",payload:{isLoading:!0}}),o.loginActions.requestHostedLoginAuthorize())}}},t.useFronteggAuthGuard=function(){var t=nt(),n=e.inject(I),r=tt(),o=e.inject(R),i=et(),u=function(){var e,u,a;u=null===(e=t.router)||void 0===e?void 0:e.currentRoute.path,a=r.routes,Object.values(a).filter((function(t){return t!==a.authenticatedUrl})).includes(u)||r.isAuthenticated||r.isLoading||(n.hostedLoginBox?(i.dispatch({type:"auth/setState",payload:{isLoading:!0}}),t.loginActions.requestHostedLoginAuthorize()):o.push(r.routes.loginUrl))};e.onMounted(u),e.onUpdated(u)},t.useFronteggLoaded=J,t.useUnsubscribeFronteggStore=Z,Object.defineProperty(t,"__esModule",{value:!0}),t}({},Vue,fronteggRestApi,setValue,fronteggReduxStore,getValue,js);
package/dist/index.ssr.js CHANGED
@@ -502,9 +502,6 @@ var objectMappers = function objectMappers(subState, obj, fallbackGetter) {
502
502
  var mapAuthState = function mapAuthState(_this) {
503
503
  return mapSubState('auth', 'authState').bind(_this);
504
504
  };
505
- var mapEntitlementsState = function mapEntitlementsState(_this) {
506
- return mapSubState('auth.entitlementsState.entitlements', 'entitlements').bind(_this);
507
- };
508
505
  var mapLoginState = function mapLoginState(_this) {
509
506
  return mapSubState('auth.loginState').bind(_this);
510
507
  };
@@ -547,7 +544,6 @@ var mapTenantsState = function mapTenantsState(_this) {
547
544
  var connectMapState = function connectMapState(_this) {
548
545
  Object.assign(_this, {
549
546
  mapAuthState: mapAuthState(_this),
550
- mapEntitlementsState: mapEntitlementsState(_this),
551
547
  mapLoginState: mapLoginState(_this),
552
548
  mapAcceptInvitationState: mapAcceptInvitationState(_this),
553
549
  mapActivateAccountState: mapActivateAccountState(_this),
@@ -637,24 +633,6 @@ var useFronteggLoaded = function useFronteggLoaded() {
637
633
  var fronteggLoaded = Vue.inject(fronteggLoadedKey);
638
634
  return fronteggLoaded;
639
635
  };
640
- /**
641
- @param keys The requested entitlement keys
642
- @returns Entitlements contain state data for every key (inc if entitled)
643
- */
644
-
645
- var useEntitlements = function useEntitlements(keys) {
646
- var authState = Vue.inject(authStateKey);
647
- return Vue.computed(function () {
648
- var _a;
649
-
650
- return reduxStore.getEntitlements(((_a = authState.entitlementsState) === null || _a === void 0 ? void 0 : _a.entitlements) || {}, keys).reduce(function (entitlementsResult, _ref3, i) {
651
- var isEntitled = _ref3.isEntitled;
652
- return Object.assign(Object.assign({}, entitlementsResult), _defineProperty({}, keys[i], {
653
- isEntitled: isEntitled
654
- }));
655
- }, {});
656
- });
657
- };
658
636
  var useUnsubscribeFronteggStore = function useUnsubscribeFronteggStore() {
659
637
  var unsubscribeFronteggStore = Vue.inject(unsubscribeFronteggStoreKey);
660
638
  return unsubscribeFronteggStore;
@@ -985,12 +963,7 @@ var Frontegg = {
985
963
  beforeCreate: function beforeCreate() {
986
964
  setStoreKey(this, store);
987
965
  this.fronteggAuth = Vue$1.fronteggAuth;
988
- this.loginWithRedirect = loginWithRedirect.bind(this); // _entitlements was added for to make the computed property reactive, then it will get updated
989
-
990
- this.getEntitlements = function (_entitlements, keys) {
991
- return fronteggApp.getEntitlements(keys);
992
- };
993
-
966
+ this.loginWithRedirect = loginWithRedirect.bind(this);
994
967
  connectMapState(this);
995
968
  },
996
969
  updated: function updated() {
@@ -1033,4 +1006,4 @@ var openAdminPortal = function openAdminPortal() {
1033
1006
 
1034
1007
  var closeAdminPortal = function closeAdminPortal() {
1035
1008
  return js.AdminPortal.hide();
1036
- };Object.defineProperty(exports,'ContextHolder',{enumerable:true,get:function(){return restApi.ContextHolder;}});Object.defineProperty(exports,'AdminPortal',{enumerable:true,get:function(){return js.AdminPortal;}});exports.Frontegg=Frontegg;exports.closeAdminPortal=closeAdminPortal;exports.isAuthenticatedGuard=isAuthenticatedGuard;exports.mapAcceptInvitationActions=mapAcceptInvitationActions;exports.mapActivateAccountActions=mapActivateAccountActions;exports.mapApiTokensActions=mapApiTokensActions;exports.mapAuthActions=mapAuthActions;exports.mapForgotPasswordActions=mapForgotPasswordActions;exports.mapLoginActions=mapLoginActions;exports.mapMfaActions=mapMfaActions;exports.mapProfileActions=mapProfileActions;exports.mapSecurityPolicyActions=mapSecurityPolicyActions;exports.mapSignupActions=mapSignupActions;exports.mapSocialLoginActions=mapSocialLoginActions;exports.mapSsoActions=mapSsoActions;exports.mapTeamActions=mapTeamActions;exports.openAdminPortal=openAdminPortal;exports.useAuthState=useAuthState;exports.useEntitlements=useEntitlements;exports.useFrontegg=useFrontegg;exports.useFronteggAuthGuard=useFronteggAuthGuard;exports.useFronteggLoaded=useFronteggLoaded;exports.useUnsubscribeFronteggStore=useUnsubscribeFronteggStore;
1009
+ };Object.defineProperty(exports,'ContextHolder',{enumerable:true,get:function(){return restApi.ContextHolder;}});Object.defineProperty(exports,'AdminPortal',{enumerable:true,get:function(){return js.AdminPortal;}});exports.Frontegg=Frontegg;exports.closeAdminPortal=closeAdminPortal;exports.isAuthenticatedGuard=isAuthenticatedGuard;exports.mapAcceptInvitationActions=mapAcceptInvitationActions;exports.mapActivateAccountActions=mapActivateAccountActions;exports.mapApiTokensActions=mapApiTokensActions;exports.mapAuthActions=mapAuthActions;exports.mapForgotPasswordActions=mapForgotPasswordActions;exports.mapLoginActions=mapLoginActions;exports.mapMfaActions=mapMfaActions;exports.mapProfileActions=mapProfileActions;exports.mapSecurityPolicyActions=mapSecurityPolicyActions;exports.mapSignupActions=mapSignupActions;exports.mapSocialLoginActions=mapSocialLoginActions;exports.mapSsoActions=mapSsoActions;exports.mapTeamActions=mapTeamActions;exports.openAdminPortal=openAdminPortal;exports.useAuthState=useAuthState;exports.useFrontegg=useFrontegg;exports.useFronteggAuthGuard=useFronteggAuthGuard;exports.useFronteggLoaded=useFronteggLoaded;exports.useUnsubscribeFronteggStore=useUnsubscribeFronteggStore;
package/dist/types.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { EnhancedStore } from '@reduxjs/toolkit';
2
2
  import { Unsubscribe } from 'redux';
3
- import { Entitlements } from '@frontegg/redux-store';
4
3
  import { FronteggPluginService } from './interfaces';
5
4
  declare module 'vue/types/vue' {
6
5
  interface VueConstructor {
@@ -15,11 +14,5 @@ declare module 'vue/types/vue' {
15
14
  _data?: any;
16
15
  fronteggLoaded: boolean;
17
16
  loginWithRedirect: () => void;
18
- /**
19
- @param _entitlements
20
- @param keys The requested entitlement keys
21
- @returns Entitlements contain true/false for every key (state of is key entitled)
22
- */
23
- getEntitlements: (_entitlements: any, keys: string[]) => Entitlements;
24
17
  }
25
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontegg/vue",
3
- "version": "2.0.40",
3
+ "version": "2.0.41-alpha.5461688806",
4
4
  "description": "",
5
5
  "main": "dist/index.ssr.js",
6
6
  "browser": "dist/index.js",
@@ -61,4 +61,4 @@
61
61
  "engines": {
62
62
  "node": ">=12"
63
63
  }
64
- }
64
+ }