@frontegg/vue 1.0.7 → 1.0.8-alpha.1822970292

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.d.ts CHANGED
@@ -5,7 +5,7 @@ export * from './types';
5
5
  export { mapAuthActions, mapLoginActions, mapAcceptInvitationActions, mapActivateAccountActions, mapApiTokensActions, mapForgotPasswordActions, mapMfaActions, mapProfileActions, mapSecurityPolicyActions, mapSignupActions, mapSocialLoginActions, mapSsoActions, mapTeamActions, } from './auth/mapAuthState';
6
6
  export * from './auth/interfaces';
7
7
  export * from './auth/guards';
8
- declare const Frontegg: PluginObject<PluginOptions>;
8
+ declare const Frontegg: PluginObject<PluginOptions> | any;
9
9
  /**
10
10
  * @deprecated since version 2.0
11
11
  * use instead:
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ContextHolder } from '@frontegg/rest-api';
2
2
  import set from 'set-value';
3
3
  import get from 'get-value';
4
+ import * as Vue from 'vue';
4
5
  import { initialize, AdminPortal } from '@frontegg/admin-portal';
5
6
  export { AdminPortal } from '@frontegg/admin-portal';
6
7
  import { bindActionCreators } from '@frontegg/redux-store/toolkit';
@@ -128,7 +129,22 @@ const syncStateWithComponent = (component, bindings) => () => {
128
129
  return;
129
130
  }
130
131
 
131
- set(component._data, prop, getter(get(state, subState)));
132
+ const newData = getter(get(state, subState));
133
+ const vueObject = Object.assign({}, Vue);
134
+ let version;
135
+ if (vueObject.default) version = 2;
136
+
137
+ if (vueObject.version && vueObject.version[0] === '3') {
138
+ version = 3;
139
+ }
140
+
141
+ if (version === 3) {
142
+ set(component.$data, prop, newData);
143
+ }
144
+
145
+ if (version === 2) {
146
+ set(component._data, prop, newData);
147
+ }
132
148
  });
133
149
  });
134
150
  };
package/dist/index.min.js CHANGED
@@ -1,4 +1,4 @@
1
- var FronteggCore=function(t,n,e,r,o,i,a){"use strict";function u(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var c=u(e),s=u(r);function l(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function f(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function d(t,n,e){return n&&f(t.prototype,n),e&&f(t,e),t}function g(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function v(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var e=[],r=!0,o=!1,i=void 0;try{for(var a,u=t[Symbol.iterator]();!(r=(a=u.next()).done)&&(e.push(a.value),!n||e.length!==n);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return e}(t,n)||h(t,n)||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 h(t,n){if(t){if("string"==typeof t)return p(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?p(t,n):void 0}}function p(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e<n;e++)r[e]=t[e];return r}
1
+ var FronteggCore=function(t,n,e,r,o,i,a,u){"use strict";function c(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function s(t){if(t&&t.__esModule)return t;var n=Object.create(null);return t&&Object.keys(t).forEach((function(e){if("default"!==e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})}})),n.default=t,Object.freeze(n)}var f=c(e),l=c(r),d=s(o);function g(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function v(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function h(t,n,e){return n&&v(t.prototype,n),e&&v(t,e),t}function p(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function b(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var e=[],r=!0,o=!1,i=void 0;try{for(var a,u=t[Symbol.iterator]();!(r=(a=u.next()).done)&&(e.push(a.value),!n||e.length!==n);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return e}(t,n)||A(t,n)||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 A(t,n){if(t){if("string"==typeof t)return S(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?S(t,n):void 0}}function S(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e<n;e++)r[e]=t[e];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 A(t,n){var e={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&n.indexOf(r)<0&&(e[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(e[r[o]]=t[r[o]])}return e}var b=function(t,n){var e;return t.FRONTEGG_STORE_KEY=null!==(e=t.FRONTEGG_STORE_KEY)&&void 0!==e?e:n},S=function(t){return t.FRONTEGG_STORE_KEY},m=function(t){return t.FRONTEGG_REDUX_BINDINGS},y=function(){function t(){l(this,t)}return d(t,null,[{key:"getInstance",value:function(){return t.instance||(t.instance=new t),t.instance}},{key:"setStore",value:function(n){t.getInstance().store=n}},{key:"getStore",value:function(){return t.getInstance().store}},{key:"setBasename",value:function(n){t.getInstance().baseName=n}},{key:"getBasename",value:function(){return t.getInstance().baseName}}]),t}(),O=function(t){return function(n){return s.default(n,t)}},I=function(t,n,e){return function(){var r,o=this,i=Object.keys(n),a=s.default(S(o).getState(),t),u=function(t,n,e,r,o){return e.reduce((function(e,i){return Object.assign({},e,g({},n,Object.assign(Object.assign({},e[n]),g({},i,function(t,n,e){return"function"==typeof n?n.bind(t):e(n)}(t,r[i],o)))))}),m(t)||{})}(o,t,i,n,e);return r=u,o.FRONTEGG_REDUX_BINDINGS=r,i.reduce((function(t,r){return Object.assign({},t,g({},r,function(t,n,e,r){return"function"==typeof n?n.call(t,r):e(n)(r)}(o,n[r],e,a)))}),{})}},R=function(){function t(){l(this,t)}return d(t,null,[{key:"getInstance",value:function(){return t.instance||(t.instance=new t),t.instance}},{key:"setActions",value:function(n){t.getInstance().actions=n}},{key:"getAction",value:function(n){return t.getInstance().actions[n]}}]),t}(),E=function(){function t(n){var e=this;l(this,t);var r=n.router,o=A(n,["router"]);this.state=a.authInitialState,this.userRef=void 0,this.init=function(t,n){e.store=n,Object.entries({loginActions:a.loginActions,socialLoginsActions:a.socialLoginsActions,activateAccountActions:a.activateAccountActions,acceptInvitationActions:a.acceptInvitationActions,forgotPasswordActions:a.forgotPasswordActions,signUpActions:a.signUpActions,profileActions:a.profileActions,ssoActions:a.ssoActions,mfaActions:a.mfaActions,teamActions:a.teamActions,apiTokensActions:a.apiTokensActions,securityPolicyActions:a.securityPolicyActions,tenantsActions:a.tenantsActions}).forEach((function(t){var n=v(t,2),r=n[0],o=n[1];Object.assign(e,g({},r,i.bindActionCreators(o,e.store.dispatch)))}));var r=i.bindActionCreators(a.authActions,e.store.dispatch);R.setActions(r),t.hostedLoginBox||e.store.subscribe(e.storeSubscriber)},this.storeSubscriber=function(){e.state=e.store.getState().auth;var t=!1;e.state.user!==e.userRef&&(e.userRef=e.state.user,t=!0),e.state.isAuthenticated!==e.isAuthenticatedRef&&(e.isAuthenticatedRef=e.state.isAuthenticated,t=!0),e.userRef&&e.state.isAuthenticated?t&&e.accessTokenUpdater():clearInterval(e.accessTokenUpdaterRef)},this.accessTokenUpdater=function(){var t,n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(e.accessTokenUpdaterRef&&clearInterval(e.accessTokenUpdaterRef),n)e.loginActions.requestAuthorize(!0);else if(e.isAuthenticated){var r=1e3*((null===(t=e.user)||void 0===t?void 0:t.expiresIn)||20)*.8;e.accessTokenUpdaterRef=setInterval(e.loginActions.requestAuthorize,r)}},this._routes=Object.assign(Object.assign({},a.authInitialState.routes),o.routes),this.router=r}return d(t,[{key:"loading",get:function(){var t,n;return null===(n=null===(t=this.store)||void 0===t?void 0:t.getState().auth.isLoading)||void 0===n||n}},{key:"routes",get:function(){var t,n;return null!==(n=null===(t=this.store)||void 0===t?void 0:t.getState().auth.routes)&&void 0!==n?n:this._routes}},{key:"isAuthenticated",get:function(){var t,n;return null!==(n=null===(t=this.store)||void 0===t?void 0:t.getState().auth.isAuthenticated)&&void 0!==n&&n}},{key:"user",get:function(){var t;return null===(t=this.store)||void 0===t?void 0:t.getState().auth.user}}]),t}(),T=function(t,n){return function(){var e=g({},null!=n?n:t.substring("auth.".length),(function(t){return t}));return I(t,e,O).bind(this)()}},P=function(t){return T("auth","authState").bind(t)},j=function(t){return T("auth.loginState").bind(t)},k=function(t){return T("auth.acceptInvitationState").bind(t)},w=function(t){return T("auth.activateState").bind(t)},_=function(t){return T("auth.apiTokensState").bind(t)},U=function(t){return T("auth.forgotPasswordState").bind(t)},G=function(t){return T("auth.mfaState").bind(t)},N=function(t){return T("auth.profileState").bind(t)},L=function(t){return T("auth.securityPolicyState").bind(t)},C=function(t){return T("auth.signUpState").bind(t)},F=function(t){return T("auth.socialLoginState").bind(t)},B=function(t){return T("auth.ssoState").bind(t)},x=function(t){return T("auth.teamState").bind(t)},D=function(t){return T("auth.tenantsState").bind(t)},q=function(t){Object.assign(t,{mapAuthState:P(t),mapLoginState:j(t),mapAcceptInvitationState:k(t),mapActivateAccountState:w(t),mapApiTokensState:_(t),mapForgotPasswordState:U(t),mapMfaState:G(t),mapProfileState:N(t),mapSecurityPolicyState:L(t),mapSignUpState:C(t),mapSocialLoginState:F(t),mapSsoState:B(t),mapTeamState:x(t),mapTenantsState:D(t)})},z=function(t){return function(){return R.getAction(t).apply(void 0,arguments)}},H=null,M={install:function(t,e){var r,i=null!=e?e:{},a=i.router,u=A(i,["router"]),l=(null!=e?e:{}).contextOptions;if(null==l)throw Error("contextOptions must be passed to Vue.use(Frontegg, { /* OPTIONS */ })");l.requestCredentials=null!==(r=l.requestCredentials)&&void 0!==r?r:"include",n.ContextHolder.setContext(l);var f=!1,d=!1,g=new Set,v=a&&function(t){var e=t.options.base||"";y.setBasename(e);var r=function(n,r){var o=n;o.startsWith(e)&&"/"!==e&&(o=o.substring(e.length-1)),(null==r?void 0:r.refresh)?window.location.href=o:(null==r?void 0:r.replace)?t.replace(o):t.push(o)};return n.ContextHolder.setOnRedirectTo(r),r}(a),p=(H=o.initialize(Object.assign(Object.assign({},u),{onRedirectTo:v,basename:null==a?void 0:a.options.base}))).store;y.setStore(p),t.$fronteggApp=H,t.fronteggAuth||(t.fronteggAuth=new E({router:a}),function(t,n){var e;t.fronteggPlugins=null!==(e=t.fronteggPlugins)&&void 0!==e?e:[],t.fronteggPlugins.push(n)}(t,t.fronteggAuth));var O=function(){var n=(t.fronteggPlugins||[]).reduce((function(t,n){return t&&!n.loading}),!0);if(n!==d){d=n;var e,r=function(t,n){var e;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(e=h(t))||n&&t&&"number"==typeof t.length){e&&(t=e);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,a=!0,u=!1;return{s:function(){e=t[Symbol.iterator]()},n:function(){var t=e.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(u)throw i}}}}(g);try{for(r.s();!(e=r.n()).done;){(0,e.value)()}}catch(t){r.e(t)}finally{r.f()}}};null==a||a.getRoutes().map((function(t){var n=t.beforeEnter;t.beforeEnter=function(t,e,r){var o=function(){n?n(t,e,r):r()};if(d)o();else var i=setInterval((function(){O(),d&&(clearInterval(i),o())}),1)}}));var I,R=setInterval((function(){O(),d&&clearInterval(R)}),10);f||(I=t,f=!0,(t.fronteggPlugins||[]).forEach((function(t){return t.init(u,p)})),b(I,p),I.fronteggAuth=t.fronteggAuth,q(I)),t.mixin({data:function(){return{fronteggLoaded:d}},beforeCreate:function(){b(this,p),this.fronteggAuth=t.fronteggAuth,q(this)},created:function(){var t,n;m(this)&&function(t,n){t.FRONTEGG_UNSUBSCRIBE=n}(this,p.subscribe((t=this,n=m(this),function(){var e=S(t).getState();Object.keys(n).forEach((function(r){Object.keys(n[r]).forEach((function(o){var i=n[r][o];i&&c.default(t._data,o,i(s.default(e,r)))}))}))}))),function(t,n){t.FRONTEGG_LOADER_UNSUBSCRIBE=n}(this,function(t){var n=function(){t.fronteggLoaded=d};return g.add(n),function(){return g.delete(n)}}(this))},beforeDestroy:function(){!function(t){var n;null===(n=t.FRONTEGG_UNSUBSCRIBE)||void 0===n||n.call(t)}(this),function(t){var n;null===(n=t.FRONTEGG_LOADER_UNSUBSCRIBE)||void 0===n||n.call(t)}(this)}})}};return Object.defineProperty(t,"AdminPortal",{enumerable:!0,get:function(){return o.AdminPortal}}),t.Frontegg=M,t.closeAdminPortal=function(){return o.AdminPortal.hide()},t.isAuthenticatedGuard=function(t,n,e){var r,o,i=function(){var n,r=y.getStore().getState().auth;if(r.isAuthenticated)e();else{var o=null!==(n=y.getBasename())&&void 0!==n?n:"",i=o.endsWith("/")?o.substring(0,o.length-1):"";localStorage.setItem("FRONTEGG_AFTER_AUTH_REDIRECT_URL","".concat(i).concat(t.fullPath)),e({path:r.routes.loginUrl,replace:!0})}},a=null===(o=null===(r=y.getStore())||void 0===r?void 0:r.getState())||void 0===o?void 0:o.auth;if(!a||(null==a?void 0:a.isLoading))var u=setInterval((function(){var t,n;(a=null===(n=null===(t=y.getStore())||void 0===t?void 0:t.getState())||void 0===n?void 0:n.auth)&&!(null==a?void 0:a.isLoading)&&(clearInterval(u),i())}),1);else i()},t.mapAcceptInvitationActions=function(t){return z(t)},t.mapActivateAccountActions=function(t){return z(t)},t.mapApiTokensActions=function(t){return z(t)},t.mapAuthActions=function(t){return z(t)},t.mapForgotPasswordActions=function(t){return z(t)},t.mapLoginActions=function(t){return z("loginWithRedirect"===t?"requestHostedLoginAuthorize":t)},t.mapMfaActions=function(t){return z(t)},t.mapProfileActions=function(t){return z(t)},t.mapSecurityPolicyActions=function(t){return z(t)},t.mapSignupActions=function(t){return z(t)},t.mapSocialLoginActions=function(t){return z(t)},t.mapSsoActions=function(t){return z(t)},t.mapTeamActions=function(t){return z(t)},t.openAdminPortal=function(){return o.AdminPortal.show()},Object.defineProperty(t,"__esModule",{value:!0}),t}({},fronteggRestApi,setValue,getValue,adminPortal,toolkit,fronteggReduxStore);
16
+ function y(t,n){var e={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&n.indexOf(r)<0&&(e[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(e[r[o]]=t[r[o]])}return e}var m=function(t,n){var e;return t.FRONTEGG_STORE_KEY=null!==(e=t.FRONTEGG_STORE_KEY)&&void 0!==e?e:n},O=function(t){return t.FRONTEGG_STORE_KEY},I=function(t){return t.FRONTEGG_REDUX_BINDINGS},R=function(){function t(){g(this,t)}return h(t,null,[{key:"getInstance",value:function(){return t.instance||(t.instance=new t),t.instance}},{key:"setStore",value:function(n){t.getInstance().store=n}},{key:"getStore",value:function(){return t.getInstance().store}},{key:"setBasename",value:function(n){t.getInstance().baseName=n}},{key:"getBasename",value:function(){return t.getInstance().baseName}}]),t}(),E=function(t){return function(n){return l.default(n,t)}},T=function(t,n,e){return function(){var r,o=this,i=Object.keys(n),a=l.default(O(o).getState(),t),u=function(t,n,e,r,o){return e.reduce((function(e,i){return Object.assign({},e,p({},n,Object.assign(Object.assign({},e[n]),p({},i,function(t,n,e){return"function"==typeof n?n.bind(t):e(n)}(t,r[i],o)))))}),I(t)||{})}(o,t,i,n,e);return r=u,o.FRONTEGG_REDUX_BINDINGS=r,i.reduce((function(t,r){return Object.assign({},t,p({},r,function(t,n,e,r){return"function"==typeof n?n.call(t,r):e(n)(r)}(o,n[r],e,a)))}),{})}},P=function(){function t(){g(this,t)}return h(t,null,[{key:"getInstance",value:function(){return t.instance||(t.instance=new t),t.instance}},{key:"setActions",value:function(n){t.getInstance().actions=n}},{key:"getAction",value:function(n){return t.getInstance().actions[n]}}]),t}(),j=function(){function t(n){var e=this;g(this,t);var r=n.router,o=y(n,["router"]);this.state=u.authInitialState,this.userRef=void 0,this.init=function(t,n){e.store=n,Object.entries({loginActions:u.loginActions,socialLoginsActions:u.socialLoginsActions,activateAccountActions:u.activateAccountActions,acceptInvitationActions:u.acceptInvitationActions,forgotPasswordActions:u.forgotPasswordActions,signUpActions:u.signUpActions,profileActions:u.profileActions,ssoActions:u.ssoActions,mfaActions:u.mfaActions,teamActions:u.teamActions,apiTokensActions:u.apiTokensActions,securityPolicyActions:u.securityPolicyActions,tenantsActions:u.tenantsActions}).forEach((function(t){var n=b(t,2),r=n[0],o=n[1];Object.assign(e,p({},r,a.bindActionCreators(o,e.store.dispatch)))}));var r=a.bindActionCreators(u.authActions,e.store.dispatch);P.setActions(r),t.hostedLoginBox||e.store.subscribe(e.storeSubscriber)},this.storeSubscriber=function(){e.state=e.store.getState().auth;var t=!1;e.state.user!==e.userRef&&(e.userRef=e.state.user,t=!0),e.state.isAuthenticated!==e.isAuthenticatedRef&&(e.isAuthenticatedRef=e.state.isAuthenticated,t=!0),e.userRef&&e.state.isAuthenticated?t&&e.accessTokenUpdater():clearInterval(e.accessTokenUpdaterRef)},this.accessTokenUpdater=function(){var t,n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(e.accessTokenUpdaterRef&&clearInterval(e.accessTokenUpdaterRef),n)e.loginActions.requestAuthorize(!0);else if(e.isAuthenticated){var r=1e3*((null===(t=e.user)||void 0===t?void 0:t.expiresIn)||20)*.8;e.accessTokenUpdaterRef=setInterval(e.loginActions.requestAuthorize,r)}},this._routes=Object.assign(Object.assign({},u.authInitialState.routes),o.routes),this.router=r}return h(t,[{key:"loading",get:function(){var t,n;return null===(n=null===(t=this.store)||void 0===t?void 0:t.getState().auth.isLoading)||void 0===n||n}},{key:"routes",get:function(){var t,n;return null!==(n=null===(t=this.store)||void 0===t?void 0:t.getState().auth.routes)&&void 0!==n?n:this._routes}},{key:"isAuthenticated",get:function(){var t,n;return null!==(n=null===(t=this.store)||void 0===t?void 0:t.getState().auth.isAuthenticated)&&void 0!==n&&n}},{key:"user",get:function(){var t;return null===(t=this.store)||void 0===t?void 0:t.getState().auth.user}}]),t}(),k=function(t,n){return function(){var e=p({},null!=n?n:t.substring("auth.".length),(function(t){return t}));return T(t,e,E).bind(this)()}},w=function(t){return k("auth","authState").bind(t)},_=function(t){return k("auth.loginState").bind(t)},U=function(t){return k("auth.acceptInvitationState").bind(t)},G=function(t){return k("auth.activateState").bind(t)},N=function(t){return k("auth.apiTokensState").bind(t)},L=function(t){return k("auth.forgotPasswordState").bind(t)},C=function(t){return k("auth.mfaState").bind(t)},F=function(t){return k("auth.profileState").bind(t)},B=function(t){return k("auth.securityPolicyState").bind(t)},x=function(t){return k("auth.signUpState").bind(t)},D=function(t){return k("auth.socialLoginState").bind(t)},q=function(t){return k("auth.ssoState").bind(t)},z=function(t){return k("auth.teamState").bind(t)},M=function(t){return k("auth.tenantsState").bind(t)},H=function(t){Object.assign(t,{mapAuthState:w(t),mapLoginState:_(t),mapAcceptInvitationState:U(t),mapActivateAccountState:G(t),mapApiTokensState:N(t),mapForgotPasswordState:L(t),mapMfaState:C(t),mapProfileState:F(t),mapSecurityPolicyState:B(t),mapSignUpState:x(t),mapSocialLoginState:D(t),mapSsoState:q(t),mapTeamState:z(t),mapTenantsState:M(t)})},V=function(t){return function(){return P.getAction(t).apply(void 0,arguments)}},K=null,W={install:function(t,e){var r,o=null!=e?e:{},a=o.router,u=y(o,["router"]),c=(null!=e?e:{}).contextOptions;if(null==c)throw Error("contextOptions must be passed to Vue.use(Frontegg, { /* OPTIONS */ })");c.requestCredentials=null!==(r=c.requestCredentials)&&void 0!==r?r:"include",n.ContextHolder.setContext(c);var s=!1,g=!1,v=new Set,h=a&&function(t){var e=t.options.base||"";R.setBasename(e);var r=function(n,r){var o=n;o.startsWith(e)&&"/"!==e&&(o=o.substring(e.length-1)),(null==r?void 0:r.refresh)?window.location.href=o:(null==r?void 0:r.replace)?t.replace(o):t.push(o)};return n.ContextHolder.setOnRedirectTo(r),r}(a),p=(K=i.initialize(Object.assign(Object.assign({},u),{onRedirectTo:h,basename:null==a?void 0:a.options.base}))).store;R.setStore(p),t.$fronteggApp=K,t.fronteggAuth||(t.fronteggAuth=new j({router:a}),function(t,n){var e;t.fronteggPlugins=null!==(e=t.fronteggPlugins)&&void 0!==e?e:[],t.fronteggPlugins.push(n)}(t,t.fronteggAuth));var b=function(){var n=(t.fronteggPlugins||[]).reduce((function(t,n){return t&&!n.loading}),!0);if(n!==g){g=n;var e,r=function(t,n){var e;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(e=A(t))||n&&t&&"number"==typeof t.length){e&&(t=e);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,a=!0,u=!1;return{s:function(){e=t[Symbol.iterator]()},n:function(){var t=e.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(u)throw i}}}}(v);try{for(r.s();!(e=r.n()).done;){(0,e.value)()}}catch(t){r.e(t)}finally{r.f()}}};null==a||a.getRoutes().map((function(t){var n=t.beforeEnter;t.beforeEnter=function(t,e,r){var o=function(){n?n(t,e,r):r()};if(g)o();else var i=setInterval((function(){b(),g&&(clearInterval(i),o())}),1)}}));var S,E=setInterval((function(){b(),g&&clearInterval(E)}),10);s||(S=t,s=!0,(t.fronteggPlugins||[]).forEach((function(t){return t.init(u,p)})),m(S,p),S.fronteggAuth=t.fronteggAuth,H(S)),t.mixin({data:function(){return{fronteggLoaded:g}},beforeCreate:function(){m(this,p),this.fronteggAuth=t.fronteggAuth,H(this)},created:function(){var t,n;I(this)&&function(t,n){t.FRONTEGG_UNSUBSCRIBE=n}(this,p.subscribe((t=this,n=I(this),function(){var e=O(t).getState();Object.keys(n).forEach((function(r){Object.keys(n[r]).forEach((function(o){var i=n[r][o];if(i){var a,u=i(l.default(e,r)),c=Object.assign({},d);c.default&&(a=2),c.version&&"3"===c.version[0]&&(a=3),3===a&&f.default(t.$data,o,u),2===a&&f.default(t._data,o,u)}}))}))}))),function(t,n){t.FRONTEGG_LOADER_UNSUBSCRIBE=n}(this,function(t){var n=function(){t.fronteggLoaded=g};return v.add(n),function(){return v.delete(n)}}(this))},beforeDestroy:function(){!function(t){var n;null===(n=t.FRONTEGG_UNSUBSCRIBE)||void 0===n||n.call(t)}(this),function(t){var n;null===(n=t.FRONTEGG_LOADER_UNSUBSCRIBE)||void 0===n||n.call(t)}(this)}})}};return Object.defineProperty(t,"AdminPortal",{enumerable:!0,get:function(){return i.AdminPortal}}),t.Frontegg=W,t.closeAdminPortal=function(){return i.AdminPortal.hide()},t.isAuthenticatedGuard=function(t,n,e){var r,o,i=function(){var n,r=R.getStore().getState().auth;if(r.isAuthenticated)e();else{var o=null!==(n=R.getBasename())&&void 0!==n?n:"",i=o.endsWith("/")?o.substring(0,o.length-1):"";localStorage.setItem("FRONTEGG_AFTER_AUTH_REDIRECT_URL","".concat(i).concat(t.fullPath)),e({path:r.routes.loginUrl,replace:!0})}},a=null===(o=null===(r=R.getStore())||void 0===r?void 0:r.getState())||void 0===o?void 0:o.auth;if(!a||(null==a?void 0:a.isLoading))var u=setInterval((function(){var t,n;(a=null===(n=null===(t=R.getStore())||void 0===t?void 0:t.getState())||void 0===n?void 0:n.auth)&&!(null==a?void 0:a.isLoading)&&(clearInterval(u),i())}),1);else i()},t.mapAcceptInvitationActions=function(t){return V(t)},t.mapActivateAccountActions=function(t){return V(t)},t.mapApiTokensActions=function(t){return V(t)},t.mapAuthActions=function(t){return V(t)},t.mapForgotPasswordActions=function(t){return V(t)},t.mapLoginActions=function(t){return V("loginWithRedirect"===t?"requestHostedLoginAuthorize":t)},t.mapMfaActions=function(t){return V(t)},t.mapProfileActions=function(t){return V(t)},t.mapSecurityPolicyActions=function(t){return V(t)},t.mapSignupActions=function(t){return V(t)},t.mapSocialLoginActions=function(t){return V(t)},t.mapSsoActions=function(t){return V(t)},t.mapTeamActions=function(t){return V(t)},t.openAdminPortal=function(){return i.AdminPortal.show()},Object.defineProperty(t,"__esModule",{value:!0}),t}({},fronteggRestApi,setValue,getValue,Vue,adminPortal,toolkit,fronteggReduxStore);
package/dist/index.ssr.js CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var restApi=require('@frontegg/rest-api'),set=require('set-value'),get=require('get-value'),adminPortal=require('@frontegg/admin-portal'),toolkit=require('@frontegg/redux-store/toolkit'),reduxStore=require('@frontegg/redux-store');function _interopDefaultLegacy(e){return e&&typeof e==='object'&&'default'in e?e:{'default':e}}var set__default=/*#__PURE__*/_interopDefaultLegacy(set);var get__default=/*#__PURE__*/_interopDefaultLegacy(get);function _classCallCheck(instance, Constructor) {
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var restApi=require('@frontegg/rest-api'),set=require('set-value'),get=require('get-value'),Vue=require('vue'),adminPortal=require('@frontegg/admin-portal'),toolkit=require('@frontegg/redux-store/toolkit'),reduxStore=require('@frontegg/redux-store');function _interopDefaultLegacy(e){return e&&typeof e==='object'&&'default'in e?e:{'default':e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k];}});}});}n['default']=e;return Object.freeze(n);}var set__default=/*#__PURE__*/_interopDefaultLegacy(set);var get__default=/*#__PURE__*/_interopDefaultLegacy(get);var Vue__namespace=/*#__PURE__*/_interopNamespace(Vue);function _classCallCheck(instance, Constructor) {
2
2
  if (!(instance instanceof Constructor)) {
3
3
  throw new TypeError("Cannot call a class as a function");
4
4
  }
@@ -283,7 +283,22 @@ var syncStateWithComponent = function syncStateWithComponent(component, bindings
283
283
  return;
284
284
  }
285
285
 
286
- set__default['default'](component._data, prop, getter(get__default['default'](state, subState)));
286
+ var newData = getter(get__default['default'](state, subState));
287
+ var vueObject = Object.assign({}, Vue__namespace);
288
+ var version;
289
+ if (vueObject.default) version = 2;
290
+
291
+ if (vueObject.version && vueObject.version[0] === '3') {
292
+ version = 3;
293
+ }
294
+
295
+ if (version === 3) {
296
+ set__default['default'](component.$data, prop, newData);
297
+ }
298
+
299
+ if (version === 2) {
300
+ set__default['default'](component._data, prop, newData);
301
+ }
287
302
  });
288
303
  });
289
304
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontegg/vue",
3
- "version": "1.0.7",
3
+ "version": "1.0.8-alpha.1822970292",
4
4
  "description": "",
5
5
  "main": "dist/index.ssr.js",
6
6
  "browser": "dist/index.js",
@@ -56,10 +56,10 @@
56
56
  "vue-template-compiler": "^2.6.12"
57
57
  },
58
58
  "peerDependencies": {
59
- "vue": "^2.6.12",
60
- "vue-router": "^3.5.1"
59
+ "vue": "^2.0.0 || >=3.0.0",
60
+ "vue-router": "^3.0.0 || >=4.0.0"
61
61
  },
62
62
  "engines": {
63
63
  "node": ">=12"
64
64
  }
65
- }
65
+ }