@frontegg/vue 3.0.14 → 3.0.15-alpha.7540884317
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/auth/interfaces.d.ts +9 -1
- package/dist/auth/mapAuthState.d.ts +16 -5
- package/dist/constants.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +64 -13
- package/dist/index.min.js +2 -2
- package/dist/index.ssr.js +65 -12
- package/dist/types.d.ts +4 -0
- package/package.json +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FronteggAuthService } from './service';
|
|
2
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
|
-
import { TenantsState } from '@frontegg/redux-store';
|
|
4
|
+
import { TenantsState, EnhancedStore } from '@frontegg/redux-store';
|
|
5
5
|
export declare type AuthPluginOptions = {
|
|
6
6
|
headerImage?: string;
|
|
7
7
|
router?: VueRouter | null;
|
|
@@ -61,3 +61,11 @@ declare module 'vue/types/vue' {
|
|
|
61
61
|
export declare type FronteggAuthGuardOptions = {
|
|
62
62
|
redirectUrl?: string;
|
|
63
63
|
};
|
|
64
|
+
/**
|
|
65
|
+
* Using for managing the store resubscription / unsubscribing to make sure we have only one subscription
|
|
66
|
+
*/
|
|
67
|
+
export declare type CachedEnhancedStore = EnhancedStore & {
|
|
68
|
+
subscribed?: boolean;
|
|
69
|
+
previousAuthState: AuthState;
|
|
70
|
+
previousUnsubscribe: () => void;
|
|
71
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AcceptInvitationActions, ActivateAccountActions, ApiTokensActions, ForgotPasswordActions, LoginActions, MfaActions, ProfileActions, SecurityPolicyActions, SignUpActions, SocialLoginActions, SSOActions, TeamActions, TenantsActions, AuthActions } from '@frontegg/redux-store';
|
|
2
|
-
import { AuthState,
|
|
2
|
+
import { AuthState, IsSteppedUpOptions } from '@frontegg/redux-store';
|
|
3
3
|
import { FronteggAuthService } from './service';
|
|
4
|
-
import { FronteggAuthGuardOptions } from './interfaces';
|
|
4
|
+
import { CachedEnhancedStore, FronteggAuthGuardOptions } from './interfaces';
|
|
5
5
|
export declare const mapAuthState: (_this: any) => () => {};
|
|
6
6
|
export declare const mapLoginState: (_this: any) => () => {};
|
|
7
7
|
export declare const mapAcceptInvitationState: (_this: any) => () => {};
|
|
@@ -20,7 +20,7 @@ export declare const connectMapState: (_this: any) => void;
|
|
|
20
20
|
declare type MapLoginActions = LoginActions & {
|
|
21
21
|
loginWithRedirect: LoginActions['requestHostedLoginAuthorize'];
|
|
22
22
|
};
|
|
23
|
-
export declare const mapAuthActions: <K extends "requestHostedLoginAuthorize" | "setState" | "resetState" | "setUser" | "setEntitlements" | "loadEntitlements" | "setLoginState" | "resetLoginState" | "requestAuthorize" | "requestAuthorizeSSR" | "requestHostedLoginAuthorizeV2" | "handleHostedLoginCallback" | "afterAuthNavigation" | "preLogin" | "postLogin" | "login" | "loginWithMfa" | "recoverMfa" | "logout" | "silentLogout" | "checkIfAllowToRememberMfaDevice" | "changePhoneNumberWithVerification" | "verifyChangePhoneNumber" | "quickSmsPasswordlessPreLogin" | "passwordlessPreLogin" | "passwordlessPostLogin" | "verifyInviteToken" | "webAuthnPrelogin" | "webAuthnPostLogin" | "webAuthnCreateNewDeviceSession" | "webAuthnVerifyNewDeviceSession" | "getUserIP" | "preEnrollMFAWebAuthnForLogin" | "enrollMFAWebAuthnForLogin" | "enrollMFAAuthenticatorAppForLogin" | "preEnrollMFASMSForLogin" | "enrollMFASMSForLogin" | "preVerifyMFAWebAuthnForLogin" | "verifyMFAWebAuthnForLogin" | "preVerifyMFASMSForLogin" | "verifyMFASMSForLogin" | "preVerifyMFAEmailCode" | "verifyMFAEmailCode" | "resetBreachedPassword" | "setStepUpState" | "resetStepUpState" | "generateStepUpSession" | "stepUpWithAuthenticator" | "preVerifyMFASMSForStepUp" | "verifyMFASMSForStepUp" | "preVerifyMFAWebAuthnForStepUp" | "verifyMFAWebAuthnForStepUp" | "preVerifyMFAEmailCodeForStepUp" | "verifyMFAEmailCodeForStepUp" | "setSocialLoginsState" | "resetSocialLoginsState" | "loadSocialLoginsConfiguration" | "loadSocialLoginsConfigurationV2" | "loginViaSocialLogin" | "setSocialLoginError" | "setActivateState" | "resetActivateState" | "setActivateStrategyState" | "activateAccount" | "preActivateAccount" | "resendActivationEmail" | "getActivateAccountStrategy" | "setImpersonateState" | "resetImpersonateState" | "impersonate" | "setAcceptInvitationState" | "resetAcceptInvitationState" | "acceptInvitation" | "setForgotPasswordState" | "resetForgotPasswordState" | "forgotPassword" | "resetPassword" | "loadPasswordConfig" | "setResetPhoneNumberState" | "resetResetPhoneNumberState" | "resetPhoneNumber" | "verifyResetPhoneNumber" | "changePhoneNumber" | "setSignUpState" | "resetSignUpState" | "signUpUser" | "resetSignUpStateSoft" | "setProfileState" | "resetProfileState" | "loadProfile" | "saveProfile" | "changePassword" | "setCustomLoginState" | "resetCustomLoginState" | "loadTenantMetadata" | "updateTenantMetadata" | "loadSSOConfigurationsV2" | "saveSSOConfigurationV2" | "updateSSOConfiguration" | "deleteSSOConfiguration" | "deleteSSODomain" | "saveSSODomain" | "validateSSODomainV2" | "setSSODefaultRoles" | "setSSOGroups" | "updateSSOGroups" | "saveSSOConfigurationByMetadata" | "updateSSOConfigurationByMetadata" | "saveSSOConfigurationByData" | "saveSSOConfigurationByUrl" | "setSSOLoader" | "setSSOError" | "setSSOState" | "resetSSOState" | "loadSSOConfigurations" | "loadSSOAuthorizationRoles" | "saveSSOConfigurations" | "saveSSOConfigurationsFile" | "saveSSOConfigurationsFileWithCallback" | "validateSSODomain" | "updateSSOAuthorizationRoles" | "deleteSamlGroup" | "createSamlGroup" | "oidcPostlogin" | "setMfaState" | "resetMfaState" | "enrollMfa" | "getMFADevices" | "getMFAStrategies" | "verifyMfa" | "verifyMfaAfterForce" | "disableMfa" | "preDisableMfaSms" | "disableMfaSms" | "preEnrollMfaSms" | "enrollMfaSms" | "preEnrollMfaWebAuthn" | "enrollMfaWebAuthn" | "preDisableMfaWebAuthn" | "disableMfaWebAuthn" | "setTeamLoader" | "setTeamError" | "setTeamState" | "resetTeamState" | "loadUsersV2" | "loadUsers" | "loadAllSubTenantsUsers" | "loadRoles" | "addUsersBulk" | "addUser" | "addUserToSubTenants" | "setUserRolesForSubTenants" | "updateUser" | "deleteUser" | "deleteUserFromSubTenants" | "lockUser" | "resendActivationLink" | "resendInvitationLink" | "resendInvitationEmail" | "resendInvitationLinkToAllSubTenants" | "getTemporaryUsersConfig" | "updateUserExpirationTime" | "setUserAsPermanent" | "getInvitationLink" | "createInvitationLink" | "updateInvitationLink" | "deleteInvitationLink" | "openAddUserDialog" | "closeAddUserDialog" | "openDeleteUserDialog" | "closeDeleteUserDialog" | "openLockUserDialog" | "closeLockUserDialog" | "setUsersGroupsLoader" | "setUsersGroupsError" | "setGroupsState" | "resetUsersGroupsState" | "loadGroups" | "getGroupById" | "createGroup" | "updateGroup" | "deleteGroup" | "addRolesToGroup" | "deleteRolesFromGroup" | "addUsersToGroup" | "deleteUsersFromGroup" | "getGroupConfiguration" | "updateGroupConfiguration" | "getTeamUsers" | "setGroupsDialogsState" | "resetGroupsDialogsState" | "openAddGroupDialog" | "openAddMembersToGroupDialog" | "openEditGroupDialog" | "openDeleteGroupDialog" | "openDeleteMemberFromGroupDialog" | "closeAddGroupDialog" | "closeAddMembersToGroupDialog" | "closeEditGroupDialog" | "closeDeleteGroupDialog" | "closeDeleteMemberFromGroupDialog" | "setApiTokensLoader" | "setApiTokensError" | "setApiTokensState" | "resetApiTokensState" | "loadApiTokens" | "loadUserApiTokens" | "loadTenantApiTokens" | "initApiTokensData" | "addTenantApiToken" | "addUserApiToken" | "deleteUserApiToken" | "deleteTenantApiToken" | "setSecurityPolicyState" | "setSecurityPolicyGlobalState" | "setSecurityPolicyPublicState" | "setSecurityPolicyMfaState" | "setSecurityPolicyVendorMfaState" | "setSecurityPolicyLockoutState" | "setSecurityPolicyVendorLockoutState" | "setSecurityPolicyCaptchaState" | "setSecurityPolicyPasswordHistoryState" | "setSecurityPolicyVendorPasswordHistoryState" | "resetSecurityPolicyState" | "setSecurityPolicyPasswordState" | "setSecurityPolicyAuthStrategyPublicState" | "loadSecurityPolicy" | "loadPublicSecurityPolicy" | "loadVendorPasswordConfig" | "loadSecurityPolicyMfa" | "loadSecurityPolicyVendorMfa" | "saveSecurityPolicyMfa" | "loadSecurityPolicyLockout" | "loadSecurityPolicyVendorLockout" | "saveSecurityPolicyLockout" | "loadSecurityPolicyCaptcha" | "loadSecurityPolicyPasswordHistory" | "loadSecurityPolicyVendorPasswordHistory" | "saveSecurityPolicyPasswordHistory" | "loadPublicAuthStrategiesPolicy" | "setAccountSettingsState" | "resetAccountSettingsState" | "loadAccountSettings" | "saveAccountSettings" | "setTenantsState" | "resetTenantsState" | "switchTenant" | "loadTenants" | "loadSubTenants" | "loadSubTenantsTree" | "setRolesState" | "resetRolesState" | "loadRolesAndPermissions" | "addRole" | "updateRole" | "deleteRole" | "attachPermissionsToRole" | "attachPermissionToRoles" | "loadUserSessions" | "loadCurrentUserSession" | "setSessionsState" | "resetSessionsState" | "deleteUserSession" | "deleteAllUserSessions" | "revokeUserSessions" | "setRestrictionsState" | "setIpRestrictionsState" | "loadIpRestrictions" | "saveIpRestriction" | "saveIpRestrictionsConfig" | "deleteIpRestriction" | "checkIfUserIpValid" | "addCurrentUserIpAndActivate" | "setEmailDomainRestrictionsState" | "loadEmailDomainRestrictions" | "saveEmailDomainRestriction" | "saveEmailDomainRestrictionsConfig" | "deleteEmailDomainRestriction" | "setProvisioningState" | "resetProvisioningState" | "loadProvisionConnections" | "createProvisionConnection" | "deleteProvisionConnection" | "updateProvisionConnection" | "setPasskeysState" | "resetPasskeysState" | "loadWebAuthnDevices" | "deleteWebAuthnDevice" | "setAllAccountsLoader" | "setAllAccountsError" | "setAllAccountsState" | "setSelectedAccountState" | "resetAllAccountsState" | "loadAccounts" | "searchAccounts" | "updateSubAccountAccessForUser" | "createSubAccount" | "updateSubAccount" | "deleteSubAccount" | "updateSubAccountSettings" | "addUsersToAccount" | "getAccountUsers" | "deleteUsersFromAccount" | "setUserRolesForSubAccount" | "getUserJwtForSubAccount" | "setRootAccountData" | "setSelectedSubAccountData" | "loadNumberOfUsersForSelectedSubAccount" | "setAllAccountDialogsState" | "resetAllAccountDialogsState" | "openCreateSubAccountDialog" | "closeCreateSubAccountDialog" | "openUpdateSubAccountDialog" | "closeUpdateSubAccountDialog" | "openDeleteSubAccountDialog" | "closeDeleteSubAccountDialog" | "openAddUsersToAccountDialog" | "closeAddUsersToAccountDialog" | "openDeleteUserFromAccountDialog" | "closeDeleteUserFromAccountDialog" | "openEditUserRolesDialog" | "closeEditUserRolesDialog" | "setSecurityCenterState" | "resetSecurityCenterState" | "setSecurityCenterStateLoader" | "setSecurityCenterStateError" | "loadRecommendations" | "loadInsights" | "sendResetBreachedPasswordEmail" | "sendBulkResetBreachedPasswordEmails" | "loadBreachedPasswordUsers" | "loadUnenrolledMfaUsers" | "loadInactiveUsers" | "setSmsState" | "resetSmsState" | "loadPhoneNumbers" | "setUpPhoneNumber" | "verifyPhoneNumber" | "deletePhoneNumber" | "verifyDeletePhoneNumber" | "preVerifyPhoneNumber">(action: K) => AuthActions[K];
|
|
23
|
+
export declare const mapAuthActions: <K extends "requestHostedLoginAuthorize" | "setState" | "resetState" | "setUser" | "setEntitlements" | "loadEntitlements" | "setLoginState" | "resetLoginState" | "requestAuthorize" | "requestAuthorizeSSR" | "requestHostedLoginAuthorizeV2" | "handleHostedLoginCallback" | "afterAuthNavigation" | "preLogin" | "postLogin" | "login" | "loginWithMfa" | "recoverMfa" | "logout" | "silentLogout" | "checkIfAllowToRememberMfaDevice" | "changePhoneNumberWithVerification" | "verifyChangePhoneNumber" | "quickSmsPasswordlessPreLogin" | "passwordlessPreLogin" | "passwordlessPostLogin" | "verifyInviteToken" | "webAuthnPrelogin" | "webAuthnPostLogin" | "webAuthnCreateNewDeviceSession" | "webAuthnVerifyNewDeviceSession" | "getUserIP" | "preEnrollMFAWebAuthnForLogin" | "enrollMFAWebAuthnForLogin" | "enrollMFAAuthenticatorAppForLogin" | "preEnrollMFASMSForLogin" | "enrollMFASMSForLogin" | "preVerifyMFAWebAuthnForLogin" | "verifyMFAWebAuthnForLogin" | "preVerifyMFASMSForLogin" | "verifyMFASMSForLogin" | "preVerifyMFAEmailCode" | "verifyMFAEmailCode" | "resetBreachedPassword" | "setStepUpState" | "resetStepUpState" | "generateStepUpSession" | "stepUpHostedLogin" | "stepUpWithAuthenticator" | "preVerifyMFASMSForStepUp" | "verifyMFASMSForStepUp" | "preVerifyMFAWebAuthnForStepUp" | "verifyMFAWebAuthnForStepUp" | "preVerifyMFAEmailCodeForStepUp" | "verifyMFAEmailCodeForStepUp" | "setSocialLoginsState" | "resetSocialLoginsState" | "loadSocialLoginsConfiguration" | "loadSocialLoginsConfigurationV2" | "loginViaSocialLogin" | "setSocialLoginError" | "setActivateState" | "resetActivateState" | "setActivateStrategyState" | "activateAccount" | "preActivateAccount" | "resendActivationEmail" | "getActivateAccountStrategy" | "setImpersonateState" | "resetImpersonateState" | "impersonate" | "setAcceptInvitationState" | "resetAcceptInvitationState" | "acceptInvitation" | "setForgotPasswordState" | "resetForgotPasswordState" | "forgotPassword" | "resetPassword" | "loadPasswordConfig" | "setResetPhoneNumberState" | "resetResetPhoneNumberState" | "resetPhoneNumber" | "verifyResetPhoneNumber" | "changePhoneNumber" | "setSignUpState" | "resetSignUpState" | "signUpUser" | "resetSignUpStateSoft" | "setProfileState" | "resetProfileState" | "loadProfile" | "saveProfile" | "changePassword" | "setCustomLoginState" | "resetCustomLoginState" | "loadTenantMetadata" | "updateTenantMetadata" | "loadSSOConfigurationsV2" | "saveSSOConfigurationV2" | "updateSSOConfiguration" | "deleteSSOConfiguration" | "deleteSSODomain" | "saveSSODomain" | "validateSSODomainV2" | "setSSODefaultRoles" | "setSSOGroups" | "updateSSOGroups" | "saveSSOConfigurationByMetadata" | "updateSSOConfigurationByMetadata" | "saveSSOConfigurationByData" | "saveSSOConfigurationByUrl" | "setSSOLoader" | "setSSOError" | "setSSOState" | "resetSSOState" | "loadSSOConfigurations" | "loadSSOAuthorizationRoles" | "saveSSOConfigurations" | "saveSSOConfigurationsFile" | "saveSSOConfigurationsFileWithCallback" | "validateSSODomain" | "updateSSOAuthorizationRoles" | "deleteSamlGroup" | "createSamlGroup" | "oidcPostlogin" | "setMfaState" | "resetMfaState" | "enrollMfa" | "getMFADevices" | "getMFAStrategies" | "verifyMfa" | "verifyMfaAfterForce" | "disableMfa" | "preDisableMfaSms" | "disableMfaSms" | "preEnrollMfaSms" | "enrollMfaSms" | "preEnrollMfaWebAuthn" | "enrollMfaWebAuthn" | "preDisableMfaWebAuthn" | "disableMfaWebAuthn" | "setTeamLoader" | "setTeamError" | "setTeamState" | "resetTeamState" | "loadUsersV2" | "loadUsers" | "loadAllSubTenantsUsers" | "loadRoles" | "addUsersBulk" | "addUser" | "addUserToSubTenants" | "setUserRolesForSubTenants" | "updateUser" | "deleteUser" | "deleteUserFromSubTenants" | "lockUser" | "resendActivationLink" | "resendInvitationLink" | "resendInvitationEmail" | "resendInvitationLinkToAllSubTenants" | "getTemporaryUsersConfig" | "updateUserExpirationTime" | "setUserAsPermanent" | "getInvitationLink" | "createInvitationLink" | "updateInvitationLink" | "deleteInvitationLink" | "openAddUserDialog" | "closeAddUserDialog" | "openDeleteUserDialog" | "closeDeleteUserDialog" | "openLockUserDialog" | "closeLockUserDialog" | "setUsersGroupsLoader" | "setUsersGroupsError" | "setGroupsState" | "resetUsersGroupsState" | "loadGroups" | "getGroupById" | "createGroup" | "updateGroup" | "deleteGroup" | "addRolesToGroup" | "deleteRolesFromGroup" | "addUsersToGroup" | "deleteUsersFromGroup" | "getGroupConfiguration" | "updateGroupConfiguration" | "getTeamUsers" | "setGroupsDialogsState" | "resetGroupsDialogsState" | "openAddGroupDialog" | "openAddMembersToGroupDialog" | "openEditGroupDialog" | "openDeleteGroupDialog" | "openDeleteMemberFromGroupDialog" | "closeAddGroupDialog" | "closeAddMembersToGroupDialog" | "closeEditGroupDialog" | "closeDeleteGroupDialog" | "closeDeleteMemberFromGroupDialog" | "setApiTokensLoader" | "setApiTokensError" | "setApiTokensState" | "resetApiTokensState" | "loadApiTokens" | "loadUserApiTokens" | "loadTenantApiTokens" | "initApiTokensData" | "addTenantApiToken" | "addUserApiToken" | "deleteUserApiToken" | "deleteTenantApiToken" | "setSecurityPolicyState" | "setSecurityPolicyGlobalState" | "setSecurityPolicyPublicState" | "setSecurityPolicyMfaState" | "setSecurityPolicyVendorMfaState" | "setSecurityPolicyLockoutState" | "setSecurityPolicyVendorLockoutState" | "setSecurityPolicyCaptchaState" | "setSecurityPolicyPasswordHistoryState" | "setSecurityPolicyVendorPasswordHistoryState" | "resetSecurityPolicyState" | "setSecurityPolicyPasswordState" | "setSecurityPolicyAuthStrategyPublicState" | "loadSecurityPolicy" | "loadPublicSecurityPolicy" | "loadVendorPasswordConfig" | "loadSecurityPolicyMfa" | "loadSecurityPolicyVendorMfa" | "saveSecurityPolicyMfa" | "loadSecurityPolicyLockout" | "loadSecurityPolicyVendorLockout" | "saveSecurityPolicyLockout" | "loadSecurityPolicyCaptcha" | "loadSecurityPolicyPasswordHistory" | "loadSecurityPolicyVendorPasswordHistory" | "saveSecurityPolicyPasswordHistory" | "loadPublicAuthStrategiesPolicy" | "setAccountSettingsState" | "resetAccountSettingsState" | "loadAccountSettings" | "saveAccountSettings" | "setTenantsState" | "resetTenantsState" | "switchTenant" | "loadTenants" | "loadSubTenants" | "loadSubTenantsTree" | "setRolesState" | "resetRolesState" | "loadRolesAndPermissions" | "addRole" | "updateRole" | "deleteRole" | "attachPermissionsToRole" | "attachPermissionToRoles" | "loadUserSessions" | "loadCurrentUserSession" | "setSessionsState" | "resetSessionsState" | "deleteUserSession" | "deleteAllUserSessions" | "revokeUserSessions" | "setRestrictionsState" | "setIpRestrictionsState" | "loadIpRestrictions" | "saveIpRestriction" | "saveIpRestrictionsConfig" | "deleteIpRestriction" | "checkIfUserIpValid" | "addCurrentUserIpAndActivate" | "setEmailDomainRestrictionsState" | "loadEmailDomainRestrictions" | "saveEmailDomainRestriction" | "saveEmailDomainRestrictionsConfig" | "deleteEmailDomainRestriction" | "setProvisioningState" | "resetProvisioningState" | "loadProvisionConnections" | "createProvisionConnection" | "deleteProvisionConnection" | "updateProvisionConnection" | "setPasskeysState" | "resetPasskeysState" | "loadWebAuthnDevices" | "deleteWebAuthnDevice" | "setAllAccountsLoader" | "setAllAccountsError" | "setAllAccountsState" | "setSelectedAccountState" | "resetAllAccountsState" | "loadAccounts" | "searchAccounts" | "updateSubAccountAccessForUser" | "createSubAccount" | "updateSubAccount" | "deleteSubAccount" | "updateSubAccountSettings" | "addUsersToAccount" | "getAccountUsers" | "deleteUsersFromAccount" | "setUserRolesForSubAccount" | "getUserJwtForSubAccount" | "setRootAccountData" | "setSelectedSubAccountData" | "loadNumberOfUsersForSelectedSubAccount" | "setAllAccountDialogsState" | "resetAllAccountDialogsState" | "openCreateSubAccountDialog" | "closeCreateSubAccountDialog" | "openUpdateSubAccountDialog" | "closeUpdateSubAccountDialog" | "openDeleteSubAccountDialog" | "closeDeleteSubAccountDialog" | "openAddUsersToAccountDialog" | "closeAddUsersToAccountDialog" | "openDeleteUserFromAccountDialog" | "closeDeleteUserFromAccountDialog" | "openEditUserRolesDialog" | "closeEditUserRolesDialog" | "setSecurityCenterState" | "resetSecurityCenterState" | "setSecurityCenterStateLoader" | "setSecurityCenterStateError" | "loadRecommendations" | "loadInsights" | "sendResetBreachedPasswordEmail" | "sendBulkResetBreachedPasswordEmails" | "loadBreachedPasswordUsers" | "loadUnenrolledMfaUsers" | "loadInactiveUsers" | "setSmsState" | "resetSmsState" | "loadPhoneNumbers" | "setUpPhoneNumber" | "verifyPhoneNumber" | "deletePhoneNumber" | "verifyDeletePhoneNumber" | "preVerifyPhoneNumber">(action: K) => AuthActions[K];
|
|
24
24
|
export declare const mapLoginActions: <K extends "requestHostedLoginAuthorize" | "setLoginState" | "resetLoginState" | "requestAuthorize" | "requestAuthorizeSSR" | "requestHostedLoginAuthorizeV2" | "handleHostedLoginCallback" | "afterAuthNavigation" | "preLogin" | "postLogin" | "login" | "loginWithMfa" | "recoverMfa" | "logout" | "silentLogout" | "checkIfAllowToRememberMfaDevice" | "changePhoneNumberWithVerification" | "verifyChangePhoneNumber" | "quickSmsPasswordlessPreLogin" | "passwordlessPreLogin" | "passwordlessPostLogin" | "verifyInviteToken" | "webAuthnPrelogin" | "webAuthnPostLogin" | "webAuthnCreateNewDeviceSession" | "webAuthnVerifyNewDeviceSession" | "getUserIP" | "preEnrollMFAWebAuthnForLogin" | "enrollMFAWebAuthnForLogin" | "enrollMFAAuthenticatorAppForLogin" | "preEnrollMFASMSForLogin" | "enrollMFASMSForLogin" | "preVerifyMFAWebAuthnForLogin" | "verifyMFAWebAuthnForLogin" | "preVerifyMFASMSForLogin" | "verifyMFASMSForLogin" | "preVerifyMFAEmailCode" | "verifyMFAEmailCode" | "resetBreachedPassword" | "loginWithRedirect">(action: K) => MapLoginActions[K];
|
|
25
25
|
export declare const mapAcceptInvitationActions: <K extends "setAcceptInvitationState" | "resetAcceptInvitationState" | "acceptInvitation">(action: K) => {
|
|
26
26
|
setAcceptInvitationState: (state: Partial<import("@frontegg/redux-store").AcceptInvitationState>) => void;
|
|
@@ -294,9 +294,9 @@ export declare const mapTenantsActions: <K extends "setTenantsState" | "resetTen
|
|
|
294
294
|
callback?: import("@frontegg/redux-store").CallbackMethod<boolean> | undefined;
|
|
295
295
|
} | undefined) => void;
|
|
296
296
|
}[K];
|
|
297
|
-
export declare const connectFronteggStoreV3: (store:
|
|
297
|
+
export declare const connectFronteggStoreV3: (store: CachedEnhancedStore) => {
|
|
298
298
|
authState: any;
|
|
299
|
-
unsubscribe:
|
|
299
|
+
unsubscribe: () => void;
|
|
300
300
|
};
|
|
301
301
|
export declare const useFronteggLoaded: () => boolean;
|
|
302
302
|
export declare const useUnsubscribeFronteggStore: () => () => void;
|
|
@@ -304,6 +304,16 @@ export declare const useAuthState: () => AuthState;
|
|
|
304
304
|
export declare const useFronteggStore: () => any;
|
|
305
305
|
export declare const useFronteggAuth: () => FronteggAuthService;
|
|
306
306
|
export declare const useLoadEntitlements: () => any;
|
|
307
|
+
/**
|
|
308
|
+
@param options.maxAge max time in seconds for a valid login authentication session. The user will be require to re-login if the maxAge is not valid
|
|
309
|
+
@returns whether the user is stepped up
|
|
310
|
+
*/
|
|
311
|
+
export declare const useIsSteppedUp: (options?: IsSteppedUpOptions | undefined) => any;
|
|
312
|
+
/**
|
|
313
|
+
@param options.maxAge max time in seconds for a valid login authentication session. The user will be require to re-login if the maxAge is not valid
|
|
314
|
+
@returns step up function that triggers the flow to step up the user if needed
|
|
315
|
+
*/
|
|
316
|
+
export declare const useStepUp: () => any;
|
|
307
317
|
export declare const useFeatureFlag: (keys: string[]) => boolean[];
|
|
308
318
|
export declare const useFrontegg: () => {
|
|
309
319
|
fronteggLoaded: boolean;
|
|
@@ -311,6 +321,7 @@ export declare const useFrontegg: () => {
|
|
|
311
321
|
fronteggAuth: FronteggAuthService;
|
|
312
322
|
loginWithRedirect: () => void;
|
|
313
323
|
loadEntitlements: any;
|
|
324
|
+
stepUp: any;
|
|
314
325
|
};
|
|
315
326
|
/**
|
|
316
327
|
* Redirect to login page if the user is not authenticated
|
package/dist/constants.d.ts
CHANGED
|
@@ -11,3 +11,4 @@ export declare const loadEntitlementsKey: unique symbol;
|
|
|
11
11
|
export declare const routerKey: unique symbol;
|
|
12
12
|
export declare const fronteggOptionsKey: unique symbol;
|
|
13
13
|
export declare const fronteggStoreKey: unique symbol;
|
|
14
|
+
export declare const stepUpKey: 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, 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, useIsSteppedUp, } from './auth/mapAuthState';
|
|
7
7
|
export { useFeatureEntitlements, usePermissionEntitlements, useEntitlements, } from './auth/entitlements';
|
|
8
8
|
export * from './auth/interfaces';
|
|
9
9
|
export * from './auth/guards';
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as Vue from 'vue';
|
|
2
|
-
import { inject,
|
|
2
|
+
import { inject, computed, onMounted, onUpdated, reactive, ref } from 'vue';
|
|
3
3
|
import { ContextHolder, FeatureFlags, USE_ENTITLEMENTS_V2_ENDPOINT_FF, 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, FRONTEGG_AFTER_AUTH_REDIRECT_URL, getFeatureEntitlements, getPermissionEntitlements, getEntitlements } from '@frontegg/redux-store';
|
|
6
|
+
import { isAuthRoute, authInitialState, loginActions, socialLoginsActions, activateAccountActions, acceptInvitationActions, forgotPasswordActions, signUpActions, profileActions, ssoActions, mfaActions, teamActions, apiTokensActions, securityPolicyActions, tenantsActions, bindActionCreators, authActions, isSteppedUp, FRONTEGG_AFTER_AUTH_REDIRECT_URL, getFeatureEntitlements, getPermissionEntitlements, getEntitlements } 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';
|
|
@@ -47,6 +47,7 @@ const loadEntitlementsKey = Symbol('loadEntitlements');
|
|
|
47
47
|
const routerKey = Symbol('router');
|
|
48
48
|
const fronteggOptionsKey = Symbol('fronteggOptions');
|
|
49
49
|
const fronteggStoreKey = Symbol('fronteggStore');
|
|
50
|
+
const stepUpKey = Symbol('stepUp');
|
|
50
51
|
|
|
51
52
|
const setStoreKey = (instance, store) => {
|
|
52
53
|
var _a;
|
|
@@ -379,9 +380,19 @@ const mapSocialLoginActions = action => actionGetter(action);
|
|
|
379
380
|
const mapSsoActions = action => actionGetter(action);
|
|
380
381
|
const mapTeamActions = action => actionGetter(action);
|
|
381
382
|
const connectFronteggStoreV3 = store => {
|
|
382
|
-
const initialState = store.getState();
|
|
383
|
+
const initialState = store.getState(); // Using for managing the store resubscription / unsubscribing to make sure we have only one subscription. Subscribe only when store unsubscribed
|
|
384
|
+
|
|
385
|
+
if (store.subscribed) {
|
|
386
|
+
// David suggestion: return the previous state and unsubscribe function if the store is already subscribed to fix unsubscribe issue when working with router-view
|
|
387
|
+
return {
|
|
388
|
+
authState: store.previousAuthState,
|
|
389
|
+
unsubscribe: store.previousUnsubscribe
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
|
|
383
393
|
const authState = reactive(Object.assign({}, initialState.auth));
|
|
384
394
|
const unsubscribe = store.subscribe(() => {
|
|
395
|
+
store.subscribed = true;
|
|
385
396
|
const state = store.getState().auth;
|
|
386
397
|
Object.entries(state).forEach(([key, value]) => {
|
|
387
398
|
if (authState[key] !== state[key]) {
|
|
@@ -389,9 +400,17 @@ const connectFronteggStoreV3 = store => {
|
|
|
389
400
|
}
|
|
390
401
|
});
|
|
391
402
|
});
|
|
403
|
+
|
|
404
|
+
const unsubscribeWrapper = () => {
|
|
405
|
+
store.subscribed = false;
|
|
406
|
+
unsubscribe();
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
store.previousAuthState = authState;
|
|
410
|
+
store.previousUnsubscribe = unsubscribeWrapper;
|
|
392
411
|
return {
|
|
393
412
|
authState,
|
|
394
|
-
unsubscribe
|
|
413
|
+
unsubscribe: unsubscribeWrapper
|
|
395
414
|
};
|
|
396
415
|
};
|
|
397
416
|
const useFronteggLoaded = () => {
|
|
@@ -417,6 +436,34 @@ const useFronteggAuth = () => {
|
|
|
417
436
|
const useLoadEntitlements = () => {
|
|
418
437
|
return inject(loadEntitlementsKey);
|
|
419
438
|
};
|
|
439
|
+
/**
|
|
440
|
+
* @returns user state
|
|
441
|
+
*/
|
|
442
|
+
|
|
443
|
+
const useGetUserState = () => {
|
|
444
|
+
const authState = inject(authStateKey);
|
|
445
|
+
return authState.user;
|
|
446
|
+
};
|
|
447
|
+
/**
|
|
448
|
+
@param options.maxAge max time in seconds for a valid login authentication session. The user will be require to re-login if the maxAge is not valid
|
|
449
|
+
@returns whether the user is stepped up
|
|
450
|
+
*/
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
const useIsSteppedUp = options => {
|
|
454
|
+
return computed(() => {
|
|
455
|
+
const user = useGetUserState();
|
|
456
|
+
return isSteppedUp(user, options);
|
|
457
|
+
});
|
|
458
|
+
};
|
|
459
|
+
/**
|
|
460
|
+
@param options.maxAge max time in seconds for a valid login authentication session. The user will be require to re-login if the maxAge is not valid
|
|
461
|
+
@returns step up function that triggers the flow to step up the user if needed
|
|
462
|
+
*/
|
|
463
|
+
|
|
464
|
+
const useStepUp = () => {
|
|
465
|
+
return inject(stepUpKey);
|
|
466
|
+
};
|
|
420
467
|
const useFeatureFlag = keys => {
|
|
421
468
|
const {
|
|
422
469
|
appName
|
|
@@ -425,10 +472,10 @@ const useFeatureFlag = keys => {
|
|
|
425
472
|
};
|
|
426
473
|
const useFrontegg = () => {
|
|
427
474
|
const fronteggLoaded = useFronteggLoaded();
|
|
428
|
-
const unsubscribeFronteggStore = useUnsubscribeFronteggStore();
|
|
429
475
|
const authState = useAuthState();
|
|
430
476
|
const fronteggAuth = useFronteggAuth();
|
|
431
477
|
const loadEntitlements = useLoadEntitlements();
|
|
478
|
+
const stepUp = useStepUp();
|
|
432
479
|
const fronteggStore = useFronteggStore();
|
|
433
480
|
|
|
434
481
|
const loginWithRedirect = () => {
|
|
@@ -446,15 +493,13 @@ const useFrontegg = () => {
|
|
|
446
493
|
}
|
|
447
494
|
};
|
|
448
495
|
|
|
449
|
-
onBeforeUnmount(() => {
|
|
450
|
-
unsubscribeFronteggStore();
|
|
451
|
-
});
|
|
452
496
|
return {
|
|
453
497
|
fronteggLoaded,
|
|
454
498
|
authState,
|
|
455
499
|
fronteggAuth,
|
|
456
500
|
loginWithRedirect,
|
|
457
|
-
loadEntitlements
|
|
501
|
+
loadEntitlements,
|
|
502
|
+
stepUp
|
|
458
503
|
};
|
|
459
504
|
};
|
|
460
505
|
/**
|
|
@@ -686,7 +731,7 @@ var VuePkg = {
|
|
|
686
731
|
* @returns user state
|
|
687
732
|
*/
|
|
688
733
|
|
|
689
|
-
const useGetUserState = () => {
|
|
734
|
+
const useGetUserState$1 = () => {
|
|
690
735
|
const authState = inject(authStateKey);
|
|
691
736
|
return authState.user;
|
|
692
737
|
};
|
|
@@ -706,7 +751,7 @@ const useIsV2API = () => {
|
|
|
706
751
|
|
|
707
752
|
|
|
708
753
|
const useEntitlementsQueryData = customAttributes => {
|
|
709
|
-
const user = useGetUserState();
|
|
754
|
+
const user = useGetUserState$1();
|
|
710
755
|
const entitlements = user === null || user === void 0 ? void 0 : user.entitlements;
|
|
711
756
|
const isV2 = useIsV2API();
|
|
712
757
|
const attributes = {
|
|
@@ -980,6 +1025,7 @@ const Frontegg = {
|
|
|
980
1025
|
}
|
|
981
1026
|
|
|
982
1027
|
const loadEntitlements = fronteggApp.loadEntitlements.bind(fronteggApp);
|
|
1028
|
+
const stepUp = fronteggApp.stepUp.bind(fronteggApp);
|
|
983
1029
|
|
|
984
1030
|
if (isVue3) {
|
|
985
1031
|
// @ts-ignore - provide will exist only in vue 3 app
|
|
@@ -1002,7 +1048,9 @@ const Frontegg = {
|
|
|
1002
1048
|
|
|
1003
1049
|
Vue.provide(fronteggStoreKey, store); // @ts-ignore
|
|
1004
1050
|
|
|
1005
|
-
Vue.provide(loadEntitlementsKey, loadEntitlements);
|
|
1051
|
+
Vue.provide(loadEntitlementsKey, loadEntitlements); // @ts-ignore
|
|
1052
|
+
|
|
1053
|
+
Vue.provide(stepUpKey, stepUp);
|
|
1006
1054
|
}
|
|
1007
1055
|
|
|
1008
1056
|
Vue.mixin({
|
|
@@ -1022,6 +1070,9 @@ const Frontegg = {
|
|
|
1022
1070
|
this.getEntitlements = (_user, entitledToOptions, customAttributes) => fronteggApp.getEntitlements(entitledToOptions, customAttributes);
|
|
1023
1071
|
|
|
1024
1072
|
this.loadEntitlements = loadEntitlements;
|
|
1073
|
+
|
|
1074
|
+
this.isSteppedUp = _user => fronteggApp.isSteppedUp();
|
|
1075
|
+
|
|
1025
1076
|
connectMapState(this);
|
|
1026
1077
|
},
|
|
1027
1078
|
|
|
@@ -1068,4 +1119,4 @@ const openAdminPortal = () => AdminPortal.show();
|
|
|
1068
1119
|
|
|
1069
1120
|
const closeAdminPortal = () => AdminPortal.hide();
|
|
1070
1121
|
|
|
1071
|
-
export { Frontegg, closeAdminPortal, isAuthenticatedGuard, mapAcceptInvitationActions, mapActivateAccountActions, mapApiTokensActions, mapAuthActions, mapForgotPasswordActions, mapLoginActions, mapMfaActions, mapProfileActions, mapSecurityPolicyActions, mapSignupActions, mapSocialLoginActions, mapSsoActions, mapTeamActions, openAdminPortal, useAuthState, useEntitlements, useFeatureEntitlements, useFrontegg, useFronteggAuthGuard, useFronteggLoaded, usePermissionEntitlements, useUnsubscribeFronteggStore };
|
|
1122
|
+
export { Frontegg, closeAdminPortal, isAuthenticatedGuard, mapAcceptInvitationActions, mapActivateAccountActions, mapApiTokensActions, mapAuthActions, mapForgotPasswordActions, mapLoginActions, mapMfaActions, mapProfileActions, mapSecurityPolicyActions, mapSignupActions, mapSocialLoginActions, mapSsoActions, mapTeamActions, openAdminPortal, useAuthState, useEntitlements, useFeatureEntitlements, useFrontegg, useFronteggAuthGuard, useFronteggLoaded, useIsSteppedUp, usePermissionEntitlements, useUnsubscribeFronteggStore };
|
package/dist/index.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var FronteggCore=function(t,e,n,r,o,
|
|
1
|
+
var FronteggCore=function(t,e,n,r,i,o,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(o);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,i=!1,o=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){i=!0,o=t}finally{try{r||null==a.return||a.return()}finally{if(i)throw o}}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 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"),O=Symbol("unsubscribeFronteggStore"),E=Symbol("fronteggAuth"),j=Symbol("loadEntitlements"),R=Symbol("router"),I=Symbol("fronteggOptions"),T=Symbol("fronteggStore"),P=function(t,e){var n;return t.FRONTEGG_STORE_KEY=null!==(n=t.FRONTEGG_STORE_KEY)&&void 0!==n?n:e},U=function(t){return t.FRONTEGG_STORE_KEY},F=function(t){return t.FRONTEGG_REDUX_BINDINGS},_=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}(),w=function(t){return function(e){return f.default(e,t)}},L=function(t,e,n){return function(){var r,o=this,i=Object.keys(e),u=f.default(U(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)))))}),F(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)))}),{})}},k=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}(),N=function(){function t(e){var n=this;d(this,t);var r=e.router,i=m(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);k.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}(),G=function(t,e){return function(){var n=v({},null!=e?e:t.substring("auth.".length),(function(t){return t}));return L(t,n,w).bind(this)()}},C=function(t){return G("auth","authState").bind(t)},B=function(t){return G("auth.loginState").bind(t)},x=function(t){return G("auth.acceptInvitationState").bind(t)},H=function(t){return G("auth.activateState").bind(t)},D=function(t){return G("auth.apiTokensState").bind(t)},V=function(t){return G("auth.forgotPasswordState").bind(t)},z=function(t){return G("auth.mfaState").bind(t)},q=function(t){return G("auth.profileState").bind(t)},M=function(t){return G("auth.securityPolicyState").bind(t)},W=function(t){return G("auth.signUpState").bind(t)},$=function(t){return G("auth.socialLoginState").bind(t)},K=function(t){return G("auth.ssoState").bind(t)},Y=function(t){return G("auth.teamState").bind(t)},X=function(t){return G("auth.tenantsState").bind(t)},Q=function(t){Object.assign(t,{mapAuthState:C(t),mapLoginState:B(t),mapAcceptInvitationState:x(t),mapActivateAccountState:H(t),mapApiTokensState:D(t),mapForgotPasswordState:V(t),mapMfaState:z(t),mapProfileState:q(t),mapSecurityPolicyState:M(t),mapSignUpState:W(t),mapSocialLoginState:$(t),mapSsoState:K(t),mapTeamState:Y(t),mapTenantsState:X(t)})},J=function(t){return function(){return k.getAction(t).apply(void 0,arguments)}},Z=function(){return e.inject(S)},tt=function(){return e.inject(O)},et=function(){return e.inject(y)},nt=function(){return e.inject(T)},rt=function(){return e.inject(E)},ot="3.0.14",it="2.6.12",ut=function(){var t,e;return p((t=[n.USE_ENTITLEMENTS_V2_ENDPOINT_FF],e=nt().appName,n.FeatureFlags.getFeatureFlags(t,e)),1)[0]},at=function(t){var n=e.inject(y).user;return{entitlements:null==n?void 0:n.entitlements,attributes:{custom:t,jwt:n},isV2:ut()}},st=null,ct={install:function(t,r){var i,a,s=null!=r?r:{},d=s.router,g=m(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:"".concat(n.FronteggFrameworks.Vuejs,"@").concat(it),fronteggSdkVersion:"@frontegg/vuejs@".concat(ot)},n.ContextHolder.setContext(h);var v,A=!1,w=!1,L="3"===t.version.charAt(0);L&&(v=e.ref(!1));var k=new Set,G=d&&function(t,e){var r=t.options.base||"";_.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),C=(st=u.initialize(Object.assign(Object.assign({},g),{onRedirectTo:G,basename:null==d?void 0:d.options.base}))).store;_.setStore(C),t.$fronteggApp=st,t.fronteggAuth||(t.fronteggAuth=new N({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 B=function(){var e=(t.fronteggPlugins||[]).reduce((function(t,e){return t&&!e.loading}),!0);if(e!==w){w=e,L&&(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}}}}(k);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(w)o();else var i=setInterval((function(){B(),w&&(clearInterval(i),o())}),1)}}));var x,H=setInterval((function(){B(),w&&clearInterval(H)}),10),D=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 V(){this.$route.path.startsWith(t.fronteggAuth.routes.hostedLoginRedirectUrl)||(C.dispatch({type:"auth/setState",payload:{isLoading:!0}}),t.fronteggAuth.loginActions.requestHostedLoginAuthorize())}A||(x=t,A=!0,(t.fronteggPlugins||[]).forEach((function(t){return t.init(g,C)})),P(x,C),x.fronteggAuth=t.fronteggAuth,Q(x));var z=st.loadEntitlements.bind(st);if(L){t.provide(S,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}}(C),M=q.authState,W=q.unsubscribe,$=e.reactive(Object.assign({},t.fronteggAuth));t.provide(y,M),t.provide(O,W),t.provide(E,$),t.provide(R,d),t.provide(I,r),t.provide(T,C),t.provide(j,z)}t.mixin({data:function(){return{fronteggLoaded:w}},beforeCreate:function(){P(this,C),this.fronteggAuth=t.fronteggAuth,this.loginWithRedirect=V.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=z,Q(this)},updated:function(){D(this)},mounted:function(){D(this)},created:function(){var t,e;F(this)&&function(t,e){t.FRONTEGG_UNSUBSCRIBE=e}(this,C.subscribe((t=this,e=F(this),function(){var n=U(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=w};return k.add(e),function(){return k.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=_.getStore().getState().auth;if(r.isAuthenticated)n();else{var o=null!==(e=_.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=_.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=_.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,n){return e.computed((function(){var e=at(n),r=e.entitlements,i=e.attributes,u=e.isV2;return o.getEntitlements(r,t,i,u)}))},t.useFeatureEntitlements=function(t,n){return e.computed((function(){var e=at(n),r=e.entitlements,i=e.attributes,u=e.isV2;return o.getFeatureEntitlements(r,t,i,u)}))},t.useFrontegg=function(){var t=Z(),n=tt(),r=et(),o=rt(),i=e.inject(j),u=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))||(u.dispatch({type:"auth/setState",payload:{isLoading:!0}}),o.loginActions.requestHostedLoginAuthorize())},loadEntitlements:i}},t.useFronteggAuthGuard=function(t){var n=(null!=t?t:{}).redirectUrl,r=rt(),i=e.inject(I),u=et(),a=e.inject(R),s=nt(),c=function(){var t,e,c;e=null===(t=r.router)||void 0===t?void 0:t.currentRoute.path,c=u.routes,Object.values(c).filter((function(t){return t!==c.authenticatedUrl})).includes(e)||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=Z,t.usePermissionEntitlements=function(t,n){return e.computed((function(){var e=at(n),r=e.entitlements,i=e.attributes,u=e.isV2;return o.getPermissionEntitlements(r,t,i,u)}))},t.useUnsubscribeFronteggStore=tt,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 i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}var S=Symbol("fronteggLoade"),y=Symbol("authState"),O=Symbol("unsubscribeFronteggStore"),E=Symbol("fronteggAuth"),j=Symbol("loadEntitlements"),R=Symbol("router"),I=Symbol("fronteggOptions"),U=Symbol("fronteggStore"),T=Symbol("stepUp"),P=function(t,e){var n;return t.FRONTEGG_STORE_KEY=null!==(n=t.FRONTEGG_STORE_KEY)&&void 0!==n?n:e},F=function(t){return t.FRONTEGG_STORE_KEY},_=function(t){return t.FRONTEGG_REDUX_BINDINGS},w=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,i=this,o=Object.keys(e),u=f.default(F(i).getState(),t),a=function(t,e,n,r,i){return n.reduce((function(n,o){return Object.assign({},n,v({},e,Object.assign(Object.assign({},n[e]),v({},o,function(t,e,n){return"function"==typeof e?e.bind(t):n(e)}(t,r[o],i)))))}),_(t)||{})}(i,t,o,e,n);return r=a,i.FRONTEGG_REDUX_BINDINGS=r,o.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)}(i,e[r],n,u)))}),{})}},N=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,o=m(e,["router"]);this.state=i.authInitialState,this.userRef=void 0,this.init=function(t,e){n.store=e,Object.entries({loginActions:i.loginActions,socialLoginsActions:i.socialLoginsActions,activateAccountActions:i.activateAccountActions,acceptInvitationActions:i.acceptInvitationActions,forgotPasswordActions:i.forgotPasswordActions,signUpActions:i.signUpActions,profileActions:i.profileActions,ssoActions:i.ssoActions,mfaActions:i.mfaActions,teamActions:i.teamActions,apiTokensActions:i.apiTokensActions,securityPolicyActions:i.securityPolicyActions,tenantsActions:i.tenantsActions}).forEach((function(t){var e=p(t,2),r=e[0],o=e[1];Object.assign(n,v({},r,i.bindActionCreators(o,n.store.dispatch)))}));var r=i.bindActionCreators(i.authActions,n.store.dispatch);N.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({},i.authInitialState.routes),o.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}(),C=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)()}},x=function(t){return C("auth","authState").bind(t)},B=function(t){return C("auth.loginState").bind(t)},H=function(t){return C("auth.acceptInvitationState").bind(t)},D=function(t){return C("auth.activateState").bind(t)},V=function(t){return C("auth.apiTokensState").bind(t)},z=function(t){return C("auth.forgotPasswordState").bind(t)},q=function(t){return C("auth.mfaState").bind(t)},M=function(t){return C("auth.profileState").bind(t)},W=function(t){return C("auth.securityPolicyState").bind(t)},$=function(t){return C("auth.signUpState").bind(t)},K=function(t){return C("auth.socialLoginState").bind(t)},Y=function(t){return C("auth.ssoState").bind(t)},X=function(t){return C("auth.teamState").bind(t)},Q=function(t){return C("auth.tenantsState").bind(t)},J=function(t){Object.assign(t,{mapAuthState:x(t),mapLoginState:B(t),mapAcceptInvitationState:H(t),mapActivateAccountState:D(t),mapApiTokensState:V(t),mapForgotPasswordState:z(t),mapMfaState:q(t),mapProfileState:M(t),mapSecurityPolicyState:W(t),mapSignUpState:$(t),mapSocialLoginState:K(t),mapSsoState:Y(t),mapTeamState:X(t),mapTenantsState:Q(t)})},Z=function(t){return function(){return N.getAction(t).apply(void 0,arguments)}},tt=function(){return e.inject(S)},et=function(){return e.inject(y)},nt=function(){return e.inject(U)},rt=function(){return e.inject(E)},it="3.0.14",ot="2.6.12",ut=function(){var t,e;return p((t=[n.USE_ENTITLEMENTS_V2_ENDPOINT_FF],e=nt().appName,n.FeatureFlags.getFeatureFlags(t,e)),1)[0]},at=function(t){var n=e.inject(y).user;return{entitlements:null==n?void 0:n.entitlements,attributes:{custom:t,jwt:n},isV2:ut()}},st=null,ct={install:function(t,r){var o,a,s=null!=r?r:{},d=s.router,g=m(s,["router"]),h=(null!=r?r:{}).contextOptions;if(null==h)throw Error("contextOptions must be passed to Vue.use(Frontegg, { /* OPTIONS */ })");h.requestCredentials=null!==(o=h.requestCredentials)&&void 0!==o?o:"include",h.metadataHeaders={framework:"".concat(n.FronteggFrameworks.Vuejs,"@").concat(ot),fronteggSdkVersion:"@frontegg/vuejs@".concat(it)},n.ContextHolder.setContext(h);var v,A=!1,L=!1,k="3"===t.version.charAt(0);k&&(v=e.ref(!1));var N=new Set,C=d&&function(t,e){var r=t.options.base||"";w.setBasename(r);var o=function(n,o){var u=n;u.startsWith(r)&&"/"!==r&&(u=u.substring(r.length-1)),((null==o?void 0:o.preserveQueryParams)||i.isAuthRoute(u,e))&&(u="".concat(u).concat(window.location.search)),(null==o?void 0:o.refresh)?window.location.href=u:(null==o?void 0:o.replace)?t.replace(u):t.push(u)};return n.ContextHolder.setOnRedirectTo(o),o}(d,null===(a=null==r?void 0:r.authOptions)||void 0===a?void 0:a.routes),x=(st=u.initialize(Object.assign(Object.assign({},g),{onRedirectTo:C,basename:null==d?void 0:d.options.base}))).store;w.setStore(x),t.$fronteggApp=st,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 B=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,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}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 o,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,o=t},f:function(){try{u||null==n.return||n.return()}finally{if(a)throw o}}}}(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 i=function(){e?e(t,n,r):r()};if(L)i();else var o=setInterval((function(){B(),L&&(clearInterval(o),i())}),1)}}));var H,D=setInterval((function(){B(),L&&clearInterval(D)}),10),V=function(e){var n,i;if(e.authorizedContent&&(n=e.$route.path,i=t.fronteggAuth.routes,!Object.values(i).filter((function(t){return t!=i.authenticatedUrl})).includes(n))&&(!t.fronteggAuth.loading&&!t.fronteggAuth.isAuthenticated))if(null==r?void 0:r.hostedLoginBox)t.fronteggAuth.loginActions.requestHostedLoginAuthorize();else{var o=t.fronteggAuth.routes.loginUrl;e.$router.push(o)}};function z(){this.$route.path.startsWith(t.fronteggAuth.routes.hostedLoginRedirectUrl)||(x.dispatch({type:"auth/setState",payload:{isLoading:!0}}),t.fronteggAuth.loginActions.requestHostedLoginAuthorize())}A||(H=t,A=!0,(t.fronteggPlugins||[]).forEach((function(t){return t.init(g,x)})),P(H,x),H.fronteggAuth=t.fronteggAuth,J(H));var q=st.loadEntitlements.bind(st),M=st.stepUp.bind(st);if(k){t.provide(S,v);var W=function(t){var n=t.getState();if(t.subscribed)return{authState:t.previousAuthState,unsubscribe:t.previousUnsubscribe};var r=e.reactive(Object.assign({},n.auth)),i=t.subscribe((function(){t.subscribed=!0;var e=t.getState().auth;Object.entries(e).forEach((function(t){var n=p(t,2),i=n[0],o=n[1];r[i]!==e[i]&&(r[i]=o)}))})),o=function(){t.subscribed=!1,i()};return t.previousAuthState=r,t.previousUnsubscribe=o,{authState:r,unsubscribe:o}}(x),$=W.authState,K=W.unsubscribe,Y=e.reactive(Object.assign({},t.fronteggAuth));t.provide(y,$),t.provide(O,K),t.provide(E,Y),t.provide(R,d),t.provide(I,r),t.provide(U,x),t.provide(j,q),t.provide(T,M)}t.mixin({data:function(){return{fronteggLoaded:L}},beforeCreate:function(){P(this,x),this.fronteggAuth=t.fronteggAuth,this.loginWithRedirect=z.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=q,this.isSteppedUp=function(t){return st.isSteppedUp()},J(this)},updated:function(){V(this)},mounted:function(){V(this)},created:function(){var t,e;_(this)&&function(t,e){t.FRONTEGG_UNSUBSCRIBE=e}(this,x.subscribe((t=this,e=_(this),function(){var n=F(t).getState();Object.keys(e).forEach((function(r){Object.keys(e[r]).forEach((function(i){var o=e[r][i];if(o){var u,a=o(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,i,a),2===u&&l.default(t._data,i,a)}}))}))}))),function(t,e){t.FRONTEGG_LOADER_UNSUBSCRIBE=e}(this,function(t){var e=function(){t.fronteggLoaded=L};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,i,o=function(){var e,r=w.getStore().getState().auth;if(r.isAuthenticated)n();else{var i=null!==(e=w.getBasename())&&void 0!==e?e:"",o=i.endsWith("/")?i.substring(0,i.length-1):"";localStorage.setItem("FRONTEGG_AFTER_AUTH_REDIRECT_URL","".concat(o).concat(t.fullPath)),n({path:r.routes.loginUrl,replace:!0})}},u=null===(i=null===(r=w.getStore())||void 0===r?void 0:r.getState())||void 0===i?void 0:i.auth;if(!u||(null==u?void 0:u.isLoading))var a=setInterval((function(){var t,e;(u=null===(e=null===(t=w.getStore())||void 0===t?void 0:t.getState())||void 0===e?void 0:e.auth)&&!(null==u?void 0:u.isLoading)&&(clearInterval(a),o())}),1);else o()},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 u.AdminPortal.show()},t.useAuthState=et,t.useEntitlements=function(t,n){return e.computed((function(){var e=at(n),r=e.entitlements,o=e.attributes,u=e.isV2;return i.getEntitlements(r,t,o,u)}))},t.useFeatureEntitlements=function(t,n){return e.computed((function(){var e=at(n),r=e.entitlements,o=e.attributes,u=e.isV2;return i.getFeatureEntitlements(r,t,o,u)}))},t.useFrontegg=function(){var t=tt(),n=et(),r=rt(),i=e.inject(j),o=e.inject(T),u=nt();return{fronteggLoaded:t,authState:n,fronteggAuth:r,loginWithRedirect:function(){var t;(null===(t=r.router)||void 0===t?void 0:t.currentRoute.path.startsWith(n.routes.hostedLoginRedirectUrl))||(u.dispatch({type:"auth/setState",payload:{isLoading:!0}}),r.loginActions.requestHostedLoginAuthorize())},loadEntitlements:i,stepUp:o}},t.useFronteggAuthGuard=function(t){var n=(null!=t?t:{}).redirectUrl,r=rt(),o=e.inject(I),u=et(),a=e.inject(R),s=nt(),c=function(){var t,e,c;e=null===(t=r.router)||void 0===t?void 0:t.currentRoute.path,c=u.routes,Object.values(c).filter((function(t){return t!==c.authenticatedUrl})).includes(e)||u.isAuthenticated||u.isLoading||(o.hostedLoginBox?(s.dispatch({type:"auth/setState",payload:{isLoading:!0}}),n&&localStorage.setItem(i.FRONTEGG_AFTER_AUTH_REDIRECT_URL,n),r.loginActions.requestHostedLoginAuthorize()):a.push(u.routes.loginUrl))};e.onMounted(c),e.onUpdated(c)},t.useFronteggLoaded=tt,t.useIsSteppedUp=function(t){return e.computed((function(){var n=e.inject(y).user;return i.isSteppedUp(n,t)}))},t.usePermissionEntitlements=function(t,n){return e.computed((function(){var e=at(n),r=e.entitlements,o=e.attributes,u=e.isV2;return i.getPermissionEntitlements(r,t,o,u)}))},t.useUnsubscribeFronteggStore=function(){return e.inject(O)},Object.defineProperty(t,"__esModule",{value:!0}),t}({},Vue,fronteggRestApi,setValue,fronteggReduxStore,getValue,js);
|
package/dist/index.ssr.js
CHANGED
|
@@ -182,7 +182,8 @@ var fronteggAuthKey = Symbol('fronteggAuth');
|
|
|
182
182
|
var loadEntitlementsKey = Symbol('loadEntitlements');
|
|
183
183
|
var routerKey = Symbol('router');
|
|
184
184
|
var fronteggOptionsKey = Symbol('fronteggOptions');
|
|
185
|
-
var fronteggStoreKey = Symbol('fronteggStore');
|
|
185
|
+
var fronteggStoreKey = Symbol('fronteggStore');
|
|
186
|
+
var stepUpKey = Symbol('stepUp');var setStoreKey = function setStoreKey(instance, store) {
|
|
186
187
|
var _a;
|
|
187
188
|
|
|
188
189
|
return instance[FRONTEGG_STORE_KEY] = (_a = instance[FRONTEGG_STORE_KEY]) !== null && _a !== void 0 ? _a : store;
|
|
@@ -611,9 +612,19 @@ var mapTeamActions = function mapTeamActions(action) {
|
|
|
611
612
|
return actionGetter(action);
|
|
612
613
|
};
|
|
613
614
|
var connectFronteggStoreV3 = function connectFronteggStoreV3(store) {
|
|
614
|
-
var initialState = store.getState();
|
|
615
|
+
var initialState = store.getState(); // Using for managing the store resubscription / unsubscribing to make sure we have only one subscription. Subscribe only when store unsubscribed
|
|
616
|
+
|
|
617
|
+
if (store.subscribed) {
|
|
618
|
+
// David suggestion: return the previous state and unsubscribe function if the store is already subscribed to fix unsubscribe issue when working with router-view
|
|
619
|
+
return {
|
|
620
|
+
authState: store.previousAuthState,
|
|
621
|
+
unsubscribe: store.previousUnsubscribe
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
|
|
615
625
|
var authState = Vue.reactive(Object.assign({}, initialState.auth));
|
|
616
626
|
var unsubscribe = store.subscribe(function () {
|
|
627
|
+
store.subscribed = true;
|
|
617
628
|
var state = store.getState().auth;
|
|
618
629
|
Object.entries(state).forEach(function (_ref) {
|
|
619
630
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
@@ -625,9 +636,17 @@ var connectFronteggStoreV3 = function connectFronteggStoreV3(store) {
|
|
|
625
636
|
}
|
|
626
637
|
});
|
|
627
638
|
});
|
|
639
|
+
|
|
640
|
+
var unsubscribeWrapper = function unsubscribeWrapper() {
|
|
641
|
+
store.subscribed = false;
|
|
642
|
+
unsubscribe();
|
|
643
|
+
};
|
|
644
|
+
|
|
645
|
+
store.previousAuthState = authState;
|
|
646
|
+
store.previousUnsubscribe = unsubscribeWrapper;
|
|
628
647
|
return {
|
|
629
648
|
authState: authState,
|
|
630
|
-
unsubscribe:
|
|
649
|
+
unsubscribe: unsubscribeWrapper
|
|
631
650
|
};
|
|
632
651
|
};
|
|
633
652
|
var useFronteggLoaded = function useFronteggLoaded() {
|
|
@@ -653,6 +672,34 @@ var useFronteggAuth = function useFronteggAuth() {
|
|
|
653
672
|
var useLoadEntitlements = function useLoadEntitlements() {
|
|
654
673
|
return Vue.inject(loadEntitlementsKey);
|
|
655
674
|
};
|
|
675
|
+
/**
|
|
676
|
+
* @returns user state
|
|
677
|
+
*/
|
|
678
|
+
|
|
679
|
+
var useGetUserState = function useGetUserState() {
|
|
680
|
+
var authState = Vue.inject(authStateKey);
|
|
681
|
+
return authState.user;
|
|
682
|
+
};
|
|
683
|
+
/**
|
|
684
|
+
@param options.maxAge max time in seconds for a valid login authentication session. The user will be require to re-login if the maxAge is not valid
|
|
685
|
+
@returns whether the user is stepped up
|
|
686
|
+
*/
|
|
687
|
+
|
|
688
|
+
|
|
689
|
+
var useIsSteppedUp = function useIsSteppedUp(options) {
|
|
690
|
+
return Vue.computed(function () {
|
|
691
|
+
var user = useGetUserState();
|
|
692
|
+
return reduxStore.isSteppedUp(user, options);
|
|
693
|
+
});
|
|
694
|
+
};
|
|
695
|
+
/**
|
|
696
|
+
@param options.maxAge max time in seconds for a valid login authentication session. The user will be require to re-login if the maxAge is not valid
|
|
697
|
+
@returns step up function that triggers the flow to step up the user if needed
|
|
698
|
+
*/
|
|
699
|
+
|
|
700
|
+
var useStepUp = function useStepUp() {
|
|
701
|
+
return Vue.inject(stepUpKey);
|
|
702
|
+
};
|
|
656
703
|
var useFeatureFlag = function useFeatureFlag(keys) {
|
|
657
704
|
var _useFronteggStore = useFronteggStore(),
|
|
658
705
|
appName = _useFronteggStore.appName;
|
|
@@ -661,10 +708,10 @@ var useFeatureFlag = function useFeatureFlag(keys) {
|
|
|
661
708
|
};
|
|
662
709
|
var useFrontegg = function useFrontegg() {
|
|
663
710
|
var fronteggLoaded = useFronteggLoaded();
|
|
664
|
-
var unsubscribeFronteggStore = useUnsubscribeFronteggStore();
|
|
665
711
|
var authState = useAuthState();
|
|
666
712
|
var fronteggAuth = useFronteggAuth();
|
|
667
713
|
var loadEntitlements = useLoadEntitlements();
|
|
714
|
+
var stepUp = useStepUp();
|
|
668
715
|
var fronteggStore = useFronteggStore();
|
|
669
716
|
|
|
670
717
|
var loginWithRedirect = function loginWithRedirect() {
|
|
@@ -682,15 +729,13 @@ var useFrontegg = function useFrontegg() {
|
|
|
682
729
|
}
|
|
683
730
|
};
|
|
684
731
|
|
|
685
|
-
Vue.onBeforeUnmount(function () {
|
|
686
|
-
unsubscribeFronteggStore();
|
|
687
|
-
});
|
|
688
732
|
return {
|
|
689
733
|
fronteggLoaded: fronteggLoaded,
|
|
690
734
|
authState: authState,
|
|
691
735
|
fronteggAuth: fronteggAuth,
|
|
692
736
|
loginWithRedirect: loginWithRedirect,
|
|
693
|
-
loadEntitlements: loadEntitlements
|
|
737
|
+
loadEntitlements: loadEntitlements,
|
|
738
|
+
stepUp: stepUp
|
|
694
739
|
};
|
|
695
740
|
};
|
|
696
741
|
/**
|
|
@@ -915,7 +960,7 @@ var VuePkg = {
|
|
|
915
960
|
* @returns user state
|
|
916
961
|
*/
|
|
917
962
|
|
|
918
|
-
var useGetUserState = function useGetUserState() {
|
|
963
|
+
var useGetUserState$1 = function useGetUserState() {
|
|
919
964
|
var authState = Vue.inject(authStateKey);
|
|
920
965
|
return authState.user;
|
|
921
966
|
};
|
|
@@ -938,7 +983,7 @@ var useIsV2API = function useIsV2API() {
|
|
|
938
983
|
|
|
939
984
|
|
|
940
985
|
var useEntitlementsQueryData = function useEntitlementsQueryData(customAttributes) {
|
|
941
|
-
var user = useGetUserState();
|
|
986
|
+
var user = useGetUserState$1();
|
|
942
987
|
var entitlements = user === null || user === void 0 ? void 0 : user.entitlements;
|
|
943
988
|
var isV2 = useIsV2API();
|
|
944
989
|
var attributes = {
|
|
@@ -1219,6 +1264,7 @@ var Frontegg = {
|
|
|
1219
1264
|
}
|
|
1220
1265
|
|
|
1221
1266
|
var loadEntitlements = fronteggApp.loadEntitlements.bind(fronteggApp);
|
|
1267
|
+
var stepUp = fronteggApp.stepUp.bind(fronteggApp);
|
|
1222
1268
|
|
|
1223
1269
|
if (isVue3) {
|
|
1224
1270
|
// @ts-ignore - provide will exist only in vue 3 app
|
|
@@ -1242,7 +1288,9 @@ var Frontegg = {
|
|
|
1242
1288
|
|
|
1243
1289
|
Vue$1.provide(fronteggStoreKey, store); // @ts-ignore
|
|
1244
1290
|
|
|
1245
|
-
Vue$1.provide(loadEntitlementsKey, loadEntitlements);
|
|
1291
|
+
Vue$1.provide(loadEntitlementsKey, loadEntitlements); // @ts-ignore
|
|
1292
|
+
|
|
1293
|
+
Vue$1.provide(stepUpKey, stepUp);
|
|
1246
1294
|
}
|
|
1247
1295
|
|
|
1248
1296
|
Vue$1.mixin({
|
|
@@ -1269,6 +1317,11 @@ var Frontegg = {
|
|
|
1269
1317
|
};
|
|
1270
1318
|
|
|
1271
1319
|
this.loadEntitlements = loadEntitlements;
|
|
1320
|
+
|
|
1321
|
+
this.isSteppedUp = function (_user) {
|
|
1322
|
+
return fronteggApp.isSteppedUp();
|
|
1323
|
+
};
|
|
1324
|
+
|
|
1272
1325
|
connectMapState(this);
|
|
1273
1326
|
},
|
|
1274
1327
|
updated: function updated() {
|
|
@@ -1311,4 +1364,4 @@ var openAdminPortal = function openAdminPortal() {
|
|
|
1311
1364
|
|
|
1312
1365
|
var closeAdminPortal = function closeAdminPortal() {
|
|
1313
1366
|
return js.AdminPortal.hide();
|
|
1314
|
-
};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.useFeatureEntitlements=useFeatureEntitlements;exports.useFrontegg=useFrontegg;exports.useFronteggAuthGuard=useFronteggAuthGuard;exports.useFronteggLoaded=useFronteggLoaded;exports.usePermissionEntitlements=usePermissionEntitlements;exports.useUnsubscribeFronteggStore=useUnsubscribeFronteggStore;
|
|
1367
|
+
};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.useFeatureEntitlements=useFeatureEntitlements;exports.useFrontegg=useFrontegg;exports.useFronteggAuthGuard=useFronteggAuthGuard;exports.useFronteggLoaded=useFronteggLoaded;exports.useIsSteppedUp=useIsSteppedUp;exports.usePermissionEntitlements=usePermissionEntitlements;exports.useUnsubscribeFronteggStore=useUnsubscribeFronteggStore;
|
package/dist/types.d.ts
CHANGED
|
@@ -42,5 +42,9 @@ declare module 'vue/types/vue' {
|
|
|
42
42
|
* @param callback called on request completed with true if succeeded, false if failed
|
|
43
43
|
*/
|
|
44
44
|
loadEntitlements: (callback?: LoadEntitlementsCallback) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Returns true when user is stepped up, o.w false
|
|
47
|
+
*/
|
|
48
|
+
isSteppedUp: (_user: User | undefined | null) => boolean;
|
|
45
49
|
}
|
|
46
50
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/vue",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.15-alpha.7540884317",
|
|
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": "6.
|
|
25
|
+
"@frontegg/js": "6.172.0",
|
|
26
26
|
"get-value": "^3.0.1",
|
|
27
27
|
"set-value": "^4.0.1"
|
|
28
28
|
},
|
|
@@ -62,4 +62,4 @@
|
|
|
62
62
|
"engines": {
|
|
63
63
|
"node": ">=12"
|
|
64
64
|
}
|
|
65
|
-
}
|
|
65
|
+
}
|