Skip to content

Commit

Permalink
Merge branch 'master' into upgrade-admin-portal
Browse files Browse the repository at this point in the history
  • Loading branch information
doregg committed Apr 2, 2024
2 parents 5c8ed41 + 8f6a9f1 commit 0b7b003
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 32 deletions.
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
# Change Log

## [3.0.23](https://github.com/frontegg/frontegg-vue/compare/v3.0.22...v3.0.23) (2024-3-20)

- FR-15233 - Fix autocomplete popper


- FR-13828 - Add option to specify prompt consent from loginDirectAction
- FR-15315 - Added sort for role selections in Admin Portal



## [3.0.22](https://github.com/frontegg/frontegg-vue/compare/v3.0.21...v3.0.22) (2024-3-4)


# Change Log

## [3.0.21](https://github.com/frontegg/frontegg-vue/compare/v3.0.20...v3.0.21) (2024-3-3)

- FR-15270 - Added new roles page to the Admin Portal
- FR-15395 - Fixed tab tenant not cleared after logout

# Change Log

## [3.0.20](https://github.com/frontegg/frontegg-vue/compare/v3.0.19...v3.0.20) (2024-2-28)

- FR-15376 - fixed null group description exception
- FR-15305 - Fixed changed fields sent on edit group to support SCIM group update
- FR-15219 - Fixed missing row actions in users table when using MSP


# Change Log

## [3.0.19](https://github.com/frontegg/frontegg-vue/compare/v3.0.18...v3.0.19) (2024-2-8)
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"packages": [
"packages/*"
],
"version": "3.0.19",
"version": "3.0.23",
"npmClient": "yarn",
"useWorkspaces": true,
"publishConfig": {
Expand Down
4 changes: 2 additions & 2 deletions packages/demo-saas/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "vue-demo-saas",
"version": "3.0.19",
"version": "3.0.23",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"@frontegg/vue": "^3.0.19",
"@frontegg/vue": "^3.0.23",
"vue": "^2.6.11",
"vue-router": "^3.2.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/example/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "example-v3",
"version": "3.0.19",
"version": "3.0.23",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
Expand Down
4 changes: 2 additions & 2 deletions packages/nuxt/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "@frontegg/nuxt",
"version": "3.0.19",
"version": "3.0.23",
"description": "",
"main": "lib/module.js",
"types": "types/index.d.ts",
"files": [
"lib"
],
"dependencies": {
"@frontegg/vue": "^3.0.19"
"@frontegg/vue": "^3.0.23"
}
}
2 changes: 1 addition & 1 deletion packages/sanity-check/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "frontegg-angular-sanity-check",
"private": true,
"version": "3.0.19",
"version": "3.0.23",
"scripts": {
"build": "docker-compose build test",
"build:dev": "docker-compose build test --no-cache",
Expand Down
2 changes: 1 addition & 1 deletion packages/vue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@frontegg/vue",
"version": "3.0.19",
"version": "3.0.23",
"description": "",
"main": "dist/index.ssr.js",
"browser": "dist/index.js",
Expand Down
27 changes: 7 additions & 20 deletions packages/vue/src/auth/entitlements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ import {
AuthState,
} from '@frontegg/redux-store';

import { USE_ENTITLEMENTS_V2_ENDPOINT_FF } from '@frontegg/rest-api';

import { authStateKey } from '../constants';
import { useFeatureFlag } from '../auth/mapAuthState';

/**
* @returns user state
Expand All @@ -22,22 +19,13 @@ const useGetUserState = () => {
return authState.user;
};

/**
* @returns true when need to use entitlements V2 API
*/
const useIsV2API = () => {
const [useEntitlementsV2] = useFeatureFlag([USE_ENTITLEMENTS_V2_ENDPOINT_FF]);
return useEntitlementsV2;
};

/**
* @param customAttributes consumer attributes
* @returns is entitled query data including: entitltments state, final attributes (consumer and frontegg) and API version to use
* @returns is entitled query data including: entitlements state and final attributes (consumer and frontegg)
*/
const useEntitlementsQueryData = (customAttributes?: CustomAttributes) => {
const user = useGetUserState();
const entitlements = user?.entitlements;
const isV2 = useIsV2API();

const attributes: Attributes = {
custom: customAttributes,
Expand All @@ -47,7 +35,6 @@ const useEntitlementsQueryData = (customAttributes?: CustomAttributes) => {
return {
entitlements,
attributes,
isV2
};
};

Expand All @@ -59,8 +46,8 @@ const useEntitlementsQueryData = (customAttributes?: CustomAttributes) => {
*/
export const useFeatureEntitlements = (key: string, customAttributes?: CustomAttributes): ComputedRef<Entitlement> => {
return computed(() => {
const { entitlements, attributes, isV2 } = useEntitlementsQueryData(customAttributes);
return getFeatureEntitlements(entitlements, key, attributes, isV2)
const { entitlements, attributes } = useEntitlementsQueryData(customAttributes);
return getFeatureEntitlements(entitlements, key, attributes, true)
});
};

Expand All @@ -72,8 +59,8 @@ export const useFeatureEntitlements = (key: string, customAttributes?: CustomAtt
*/
export const usePermissionEntitlements = (key: string, customAttributes?: CustomAttributes): ComputedRef<Entitlement> => {
return computed(() => {
const { entitlements, attributes, isV2 } = useEntitlementsQueryData(customAttributes);
return getPermissionEntitlements(entitlements, key, attributes, isV2)
const { entitlements, attributes } = useEntitlementsQueryData(customAttributes);
return getPermissionEntitlements(entitlements, key, attributes, true)
});
};

Expand All @@ -85,7 +72,7 @@ export const usePermissionEntitlements = (key: string, customAttributes?: Custom
*/
export const useEntitlements = (entitledToOptions: EntitledToOptions, customAttributes?: CustomAttributes): ComputedRef<Entitlement> => {
return computed(() => {
const { entitlements, attributes, isV2 } = useEntitlementsQueryData(customAttributes);
return getEntitlements(entitlements as any, entitledToOptions, attributes, isV2)
const { entitlements, attributes } = useEntitlementsQueryData(customAttributes);
return getEntitlements(entitlements, entitledToOptions, attributes, true)
});
};
12 changes: 11 additions & 1 deletion packages/vue/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { StoreHolder } from './StoreHolder';
import * as Vue from 'vue';

export const setupOnRedirectTo = (router: VueRouter, routes?: Partial<AuthPageRoutes>) => {
const baseName = router.options.base || '';
const baseName = getRouterBaseName(router) || '';
StoreHolder.setBasename(baseName);
const onRedirectTo = (_path: string, opts?: RedirectOptions) => {
let path = _path;
Expand Down Expand Up @@ -109,3 +109,13 @@ export const simpleMappers = (subState: string, props: any, getter: any) => func

return slices.reduce((result, prop) => Object.assign({}, result, { [prop]: getter(prop)(state) }), {});
};


/**
* vue-router base name was changed in v4 from `base` to `history.base`
* @param router VueRouter v3 or v4
* @returns router base name
*/
export const getRouterBaseName = (router?: VueRouter): string | undefined => {
return router?.options.base ?? (router?.options as any).history?.base
}
4 changes: 2 additions & 2 deletions packages/vue/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import _Vue, { PluginObject, reactive, ref } from 'vue';
import { PluginOptions } from './interfaces';
import { User } from '@frontegg/redux-store';
import { setupOnRedirectTo, syncStateWithComponent } from './helpers';
import { getRouterBaseName, setupOnRedirectTo, syncStateWithComponent } from './helpers';
import {
getStoreBinding,
loadingUnsubscribe,
Expand Down Expand Up @@ -105,7 +105,7 @@ const Frontegg: PluginObject<PluginOptions> | any = {
fronteggApp = initialize({
...rest,
onRedirectTo,
basename: router?.options.base,
basename: getRouterBaseName(router),
} as any);

const store = fronteggApp.store;
Expand Down
2 changes: 1 addition & 1 deletion packages/vue/src/sdkVersion.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export default { version: '3.0.19' };
export default { version: '3.0.23' };

0 comments on commit 0b7b003

Please sign in to comment.