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AAeC,EAAAA,GACfC,aAAcD,EAAAA,GACdE,oBAAmBC,EAAAC,GACnBpG,mBAAkBmG,EAAAE,GAClBC,mBAAkBH,EAAAI,GAClBC,kCAAiCL,EAAAM,GACjCC,iBAAkB,IAAIC,EAAAA,EACtB3I,kBAAiBA,EAAAA,IAErB4I,EAAAA,EAAKC,UAAUjH,OAAOkH,gBAEtB,MAAMC,EAAsBC,SAASC,eAAe,kBAChDF,IACsBG,EAAAA,EAAAA,GAAWH,GACnB9E,QACVI,EAAAA,EAAAA,KAAC8E,EAAAA,EAAQ,CAACC,YAAcjC,EAAwBpH,SAAWA,EAAQqE,UAC/DC,EAAAA,EAAAA,KAACsC,EAAqB,OAKlC,MAAM0C,EAAuBL,SAASC,eAAe,yBACjDI,IACuBH,EAAAA,EAAAA,GAAWG,GACnBpF,QACXI,EAAAA,EAAAA,KAAC8E,EAAAA,EAAQ,CAACC,YAAcjC,EAAwBpH,SAAWA,EAAQqE,UAC/DC,EAAAA,EAAAA,KAACiF,EAAAA,EAAsB,OAKnC,MAAMC,EAAuBP,SAASC,eAAe,mBACjDM,IACuBL,EAAAA,EAAAA,GAAWK,GACnBtF,QACXI,EAAAA,EAAAA,KAAC8E,EAAAA,EAAQ,CAACC,YAAcjC,EAAwBpH,SAAWA,EAAQqE,UAC/DC,EAAAA,EAAAA,KAAC6C,EAAsB,OAKnC,MAAMsC,EAAmBR,SAASC,eAAe,cAC7CO,IACsBN,EAAAA,EAAAA,GAAWM,GACnBvF,QACVI,EAAAA,EAAAA,KAAC8E,EAAAA,EAAQ,CAACC,YAAc5B,EAAiBzH,SAAWA,EAAQqE,UACxDC,EAAAA,EAAAA,KAACqB,EAAkB","sources":["webpack://bevspot/./src/main/web/typescript/apps/UserSessionApp/inviteReducers.ts","webpack://bevspot/./src/main/web/typescript/apps/UserSessionApp/InviteApp.tsx","webpack://bevspot/./src/main/web/typescript/apps/UserSessionApp/inviteActions.ts","webpack://bevspot/./src/main/web/typescript/apps/UserSessionApp/UserLoginApp.tsx","webpack://bevspot/./src/main/web/typescript/shared/components/LogoutView.tsx","webpack://bevspot/./src/main/web/typescript/apps/UserSessionApp/UserLogoutApp.tsx","webpack://bevspot/./src/main/web/typescript/apps/UserSessionApp/index.tsx"],"sourcesContent":["import { combineReducers } from '@reduxjs/toolkit';\n\nimport { ISignUpFormState, SignUpFormReducers } from 'shared/components/SignUpOrSignIn/SignUpForm/reducers';\nimport { IThanksForRegisteringState, ThanksForRegisteringReducers } from 'shared/components/SignUpOrSignIn/ThanksForRegistering/reducers';\n\nexport interface IInviteState { // Should mirror InviteReducers\n    signUpFormState : ISignUpFormState;\n    thanksForRegisteringState : IThanksForRegisteringState;\n}\n\nexport const InviteReducers = combineReducers({\n    signUpFormState: SignUpFormReducers,\n    thanksForRegisteringState: ThanksForRegisteringReducers,\n});\n","import React from 'react';\nimport { connect } from 'react-redux';\n\nimport { InvalidInviteException } from 'api/UserAccount/exceptions/InvalidInviteException';\nimport { UserAccountId } from 'api/UserAccount/model/UserAccountId';\n\nimport { Button } from 'shared/components/Button';\nimport { LoadingCover } from 'shared/components/LoadingCover';\nimport { ISignUpData } from 'shared/components/SignUpOrSignIn/ISignUpData';\nimport { SignUpFormDispatch, SignUpFormActions } from 'shared/components/SignUpOrSignIn/SignUpForm/actions';\nimport { ISignUpFormState } from 'shared/components/SignUpOrSignIn/SignUpForm/reducers';\nimport { SignUpOptionsFormActions } from 'shared/components/SignUpOrSignIn/SignUpOptions/actions';\nimport { ConnectedSignUpOptions } from 'shared/components/SignUpOrSignIn/SignUpOptions/SignUpOptions';\nimport { ThanksForRegisteringDispatch, ThanksForRegisteringActions } from 'shared/components/SignUpOrSignIn/ThanksForRegistering/actions';\nimport { IThanksForRegisteringState } from 'shared/components/SignUpOrSignIn/ThanksForRegistering/reducers';\nimport { ThanksForRegistering } from 'shared/components/SignUpOrSignIn/ThanksForRegistering/ThanksForRegistering';\nimport { URLStringUtils } from 'shared/utils/urlStringUtils';\n\nimport { UserSessionActions } from './actions';\nimport { UserSessionInviteActions } from './inviteActions';\nimport { IInviteState } from './inviteReducers';\nimport { SignUpOptionsDispatch } from './types';\n\nimport 'shared/css/SignUpOptionsForm.scss';\nimport './userSession.scss';\n\ninterface IInviteAppProps {\n    signUpFormState : ISignUpFormState;\n    thanksForRegisteringState : IThanksForRegisteringState;\n}\n\ninterface IBoundInviteAppProps extends IInviteAppProps {\n    dispatch : SignUpOptionsDispatch & ThanksForRegisteringDispatch & SignUpFormDispatch;\n}\n\ninterface IInviteAppState {\n    hasUserJoinedEstablishment : boolean;\n    inviteBannerText : string | null;\n    inviteLinkValue : string;\n    inviteTargetId : string | null;\n    inviteTargetName : string;\n    isAdmin : boolean;\n    isInviteActive : boolean;\n    isLoading : boolean;\n    isLoggedIn : boolean;\n}\n\n// todo: rename this to AcceptInviteApp?\nexport class InviteApp extends React.Component<IBoundInviteAppProps, IInviteAppState> {\n    private readonly currentUser : string;\n    constructor(props : IBoundInviteAppProps) {\n        super(props);\n        this.state = {\n            hasUserJoinedEstablishment: false,\n            inviteBannerText: null,\n            inviteLinkValue: URLStringUtils.getQueryParameterFromUrl('invite_link'),\n            inviteTargetId: null,\n            inviteTargetName: '',\n            isAdmin: window.GLOBAL_USER_IS_ADMIN,\n            isInviteActive: false,\n            isLoading: false,\n            isLoggedIn: window.GLOBAL_USER_ID !== '',\n        };\n        this.currentUser = window.GLOBAL_USER_NAME;\n    }\n\n    public UNSAFE_componentWillMount() {\n        // if we have an invitation, fetch relevant information\n        this.props.dispatch(SignUpOptionsFormActions.onSetActiveForm('signUpForm'));\n        void this.fetchUserInviteInfo();\n    }\n\n    public render() {\n        const {\n            signUpFormState,\n            thanksForRegisteringState,\n        } = this.props;\n\n        const {\n            hasUserJoinedEstablishment,\n            inviteBannerText,\n            inviteLinkValue,\n            isAdmin,\n            isInviteActive,\n            isLoading,\n            isLoggedIn,\n        } = this.state;\n\n        let headerTitle : string = '';\n        if (inviteLinkValue) {\n            if (hasUserJoinedEstablishment && isLoggedIn) {\n                headerTitle = 'You are already a member of this establishment';\n            }\n        }\n\n        const getFormdDisplayContents = () : JSX.Element | null => {\n            // 1. bevspot admin creating a new user\n            if (isAdmin && !isInviteActive) {\n                // NOTE: `UNSAFE_componentWillMount` sets `signUpForm` as the active\n                // form already, but if that ever changes, we need to ensure\n                // for this case it is made active\n                return (\n                    <React.Fragment>\n                        <div className=\"form-section\">\n                            <h4>BevSpot Admin User Creation</h4>\n                            <h5>{ inviteBannerText }</h5>\n                            <p>You are logged in as { window.GLOBAL_USER_NAME }</p>\n                        </div>\n                        <ConnectedSignUpOptions\n                            availableFormOptions={ ['signUpForm'] }\n                            isEmbeddedInModal={ false }\n                            isDismissible={ true }\n                            formIsVisibleOnLoad={ true }\n                            additionalUserFieldsAreShown={ true }\n                            additionalRetailerFieldsAreShown={ false }\n                            additionalRetailerFieldsAreRequired={ false }\n                            onSuccessfulSignUp={ this.onSuccessfulAdminSignUp }\n                            onSuccessfulSignIn={ this.onSuccessfulSignIn }\n                        />\n                    </React.Fragment>\n                );\n\n            // 2. a non-bevspot admin following an invalidated invite link, or the `invite_link` is missing\n            } else if (!isAdmin && !isInviteActive) {\n                return (\n                    <div className=\"form-section\">\n                        <div className=\"invite-banner-wrapper\">\n                            <h4 className=\"invite-error\">This invitation is no longer valid</h4>\n                        </div>\n                    </div>\n                );\n\n            // 3. a logged in, non-bevspot admin user accepting an invite to a retailer they don't yet belong to\n            } else if (isLoggedIn && !hasUserJoinedEstablishment) {\n                return (\n                    <div className=\"form-section\">\n                        <h5>{ inviteBannerText }</h5>\n                        <p>You are logged in as { window.GLOBAL_USER_NAME }</p>\n                        <Button\n                            buttonClassName=\"primary\"\n                            isDisabled={ false }\n                            isLoading={ this.state.isLoading }\n                            onClick={ this.onLoggedInUserAcceptInvite }\n                        >\n                            Accept Invitation\n                        </Button>\n                        <Button\n                            buttonClassName=\"primary flat normal large\"\n                            isDisabled={ false }\n                            isLoading={ this.state.isLoading }\n                            onClick={ this.notUserLogout }\n                        >\n                            Not { this.currentUser }?\n                        </Button>\n                    </div>\n                );\n\n            // 4. a logged in, non-bevspot admin user accepting an invite to a retailer they already belong to\n            } else if (isLoggedIn && hasUserJoinedEstablishment) {\n                return(\n                    <div className=\"form-section\">\n                        <h5>{ headerTitle }</h5>\n                        <p>You are logged in as { this.currentUser }</p>\n                        <Button\n                            buttonClassName=\"primary\"\n                            isDisabled={ false }\n                            isLoading={ isLoading }\n                            onClick={ this.redirectToUrl }\n                        >\n                            Continue\n                        </Button>\n                        <Button\n                            buttonClassName=\"primary flat normal large\"\n                            isDisabled={ false }\n                            isLoading={ this.state.isLoading }\n                            onClick={ this.notUserLogout }\n                        >\n                            Not { this.currentUser }?\n                        </Button>\n                    </div>\n                );\n            }\n\n            // 5. a not logged in user accepting an invite who must first either sign up or sign in\n            if (!signUpFormState.hasSuccessfullySubmitted) {\n                return (\n                    <ConnectedSignUpOptions\n                        availableFormOptions={ ['signUpForm', 'signInForm'] }\n                        isEmbeddedInModal={ false }\n                        isDismissible={ true }\n                        formIsVisibleOnLoad={ true }\n                        additionalUserFieldsAreShown={ true }\n                        additionalRetailerFieldsAreShown={ false }\n                        additionalRetailerFieldsAreRequired={ false }\n                        onSuccessfulSignUp={ this.onSuccessfulSignUp }\n                        onSuccessfulSignIn={ this.onSuccessfulSignIn }\n                    />\n                );\n\n            // 5a. a not logged in user who just signed up for a new account\n            } else {\n                return (\n                    <ThanksForRegistering\n                        isEmbeddedInModal={ false }\n                        onSendEmailAgainClick={ this.onSendEmailAgainClick }\n                        onCloseButtonClick={ this.onCloseButtonClick }\n                        isResendingEmail={ thanksForRegisteringState.isResendingEmail }\n                        isEmailResent={ thanksForRegisteringState.isEmailResent }\n                    />\n                );\n            }\n        };\n\n        return (\n            <div>\n                <header className=\"logo-header\">\n                    <a href=\"https://www.bevspot.com\" className=\"brand-logo dark transition\">\n                        <span className=\"bevicon bevico-bevspot-logo transition\" />\n                        <span className=\"bevicon bevico-logo-text transition\" />\n                    </a>\n                </header>\n                { isLoading &&\n                    <LoadingCover\n                        className=\"overlay-light\"\n                        hasLoadingIcon={ true }\n                    />\n                }\n                { !isLoading &&\n                    <div className=\"login-container\">\n                        <div className=\"sign-up-or-sign-in-form\">\n                            { getFormdDisplayContents() }\n                        </div>\n                    </div>\n                }\n            </div>\n        );\n    }\n\n    private readonly fetchUserInviteInfo = () => {\n        // if we have an invitation, fetch relevant information\n        if (this.state.inviteLinkValue) {\n            this.setState({\n                isLoading: true\n            });\n            return this.props.dispatch(UserSessionInviteActions.getInvite(this.state.inviteLinkValue))\n                .then((inviteInfo) => {\n                    this.setState({\n                        inviteBannerText: inviteInfo.getInvitedByUserName() + ' has invited you to join ' + inviteInfo.getInvitedToName(),\n                        isInviteActive: true,\n                        // NOTE: this is null when the invite is to a group\n                        inviteTargetId: inviteInfo.getInvitationType() === 'retailer' ? inviteInfo.getInvitedToId().getValue() : null,\n                        inviteTargetName: inviteInfo.getInvitationType() === 'retailer' ? inviteInfo.getInvitedToName() : '',\n                        hasUserJoinedEstablishment: inviteInfo.hasUserJoinedEstablishment(),\n                    });\n                })\n                .catch((error) => {\n                    if (error instanceof InvalidInviteException) {\n                        this.setState({\n                            isInviteActive: false\n                        });\n                    } else {\n                        throw new Error(`unexpected ${error}`);\n                    }\n                })\n                .then(() => {\n                    this.setState({\n                        isLoading: false\n                    });\n                });\n        }\n        return Promise.resolve();\n    }\n\n    private readonly onSuccessfulSignUp = (userAccountIdentifier : UserAccountId, signUpData : ISignUpData) => {\n        return this.props.dispatch(UserSessionActions.onSuccessfulSignUp(userAccountIdentifier, signUpData, this.state.inviteTargetId, this.state.isAdmin))\n        .then(() => {\n            void this.fetchUserInviteInfo()\n            .then(() => {\n                void this.onAcceptInvitation(userAccountIdentifier, false);\n            });\n        });\n    }\n\n    private readonly onSuccessfulAdminSignUp = (userAccountIdentifier : UserAccountId, signUpData : ISignUpData) => {\n        return this.props.dispatch(UserSessionActions.onSuccessfulSignUp(userAccountIdentifier, signUpData, this.state.inviteTargetId, this.state.isAdmin))\n        .then((userAccountId) => {\n            window.location.href = `/admin_tools/manage/user/${ userAccountId.getValue() }`;\n        });\n    }\n\n    private readonly onSuccessfulSignIn = () => {\n        return this.props.dispatch(UserSessionInviteActions.onSuccessfulSignIn())\n        .then((userAccountIdentifier) => {\n            if (userAccountIdentifier) {\n                void this.fetchUserInviteInfo()\n                .then(() => {\n                    if (this.state.hasUserJoinedEstablishment) {\n                        void this.redirectToUrl();\n                    } else {\n                        void this.onAcceptInvitation(userAccountIdentifier, true);\n                    }\n                });\n            }\n        });\n    }\n\n    private readonly onSendEmailAgainClick = () => {\n        this.props.dispatch(ThanksForRegisteringActions.onResendEmail(this.props.signUpFormState.validationInputDataByFieldName.emailAddress.value));\n    }\n\n    private readonly onCloseButtonClick = () => {\n        this.props.dispatch(SignUpFormActions.onResetForm());\n    }\n\n    private readonly onLoggedInUserAcceptInvite = () => {\n        return this.onAcceptInvitation(new UserAccountId(window.GLOBAL_USER_ID), true);\n    }\n\n    private readonly onAcceptInvitation = (userID : UserAccountId, redirect : boolean) => {\n        return this.props.dispatch(UserSessionInviteActions.acceptInvite(userID, this.state.inviteLinkValue))\n        .then((url) => {\n            if (redirect) {\n                window.location.href = url;\n            }\n        });\n    }\n\n    private readonly notUserLogout = () => {\n        return this.props.dispatch(UserSessionInviteActions.logoutUser())\n        .then(() => {\n            this.setState({\n                isLoggedIn: false,\n                hasUserJoinedEstablishment: false\n            });\n            this.props.dispatch(SignUpOptionsFormActions.onSetActiveForm('signInForm'));\n        });\n    }\n\n    private readonly redirectToUrl = () => {\n        return this.props.dispatch(UserSessionInviteActions.invalidateInvite(this.state.inviteLinkValue))\n        .then((url) => {\n            window.location.href = url;\n        });\n    }\n}\n\ninterface IState {\n    inviteState : IInviteState;\n}\n\nconst mapStateToProps = (state : IState) : IInviteAppProps => {\n    return {\n        signUpFormState: state.inviteState.signUpFormState,\n        thanksForRegisteringState: state.inviteState.thanksForRegisteringState,\n    };\n};\n\nexport const ConnectedInviteApp = connect<IInviteAppProps, object, object, IState>(mapStateToProps)(InviteApp);\n","import { ThunkAction, IActionCreatorsMapObject } from 'shared/models/IAction';\n\nimport { ICookieReader } from 'shared/lib/cookie/interfaces/ICookieReader';\n\nimport { IUserInviteService } from 'api/UserAccount/interfaces/IUserInviteService';\nimport { InviteInfo } from 'api/UserAccount/model/InviteInfo';\nimport { UserAccountId } from 'api/UserAccount/model/UserAccountId';\nimport { UserSessionId } from 'api/UserAccount/model/UserSessionId';\nimport { IAccountSessionTerminator } from 'shared/lib/account/interfaces/IAccountSessionTerminator';\nimport { IUnauthenticatedUserSessionReader } from 'shared/lib/unauthenticated_user_session/interfaces/IUnauthenticatedUserSessionReader';\nimport { IAccountSessionReader } from 'shared/lib/account/interfaces/IAccountSessionReader';\n\nexport namespace ActionInterfaces {\n    export interface IUserSessionInviteActionCreatorsMapObject extends IActionCreatorsMapObject {\n        getInvite : (\n            inviteLink : string,\n        ) => ThunkAction<Promise<InviteInfo>, object, {services : ActionInterfaces.IServices}>;\n        acceptInvite : (\n            userAccountIdentifier : UserAccountId,\n            inviteLink : string,\n        ) => ThunkAction<Promise<string>, object, {services : ActionInterfaces.IServices}>;\n        invalidateInvite : (inviteLink : string) => ThunkAction<Promise<string>, object, {services : ActionInterfaces.IServices}>;\n        onSuccessfulSignIn : () => ThunkAction<Promise<UserAccountId | null>, object, { services : ActionInterfaces.IServices }> ;\n        logoutUser : () => ThunkAction<Promise<void>, object, { services : ActionInterfaces.IServices }>;\n    }\n\n    export interface IServices {\n        userInviteService : IUserInviteService;\n        cookieReader : ICookieReader;\n        userSessionTerminator : IAccountSessionTerminator;\n        userSessionManager : IAccountSessionReader<UserSessionId, UserAccountId>;\n        unauthenticatedUserSessionManager : IUnauthenticatedUserSessionReader;\n    }\n}\n\nconst getInvite = (\n    inviteLink : string,\n) : ThunkAction<Promise<InviteInfo>, object, {services : ActionInterfaces.IServices}> => {\n    return (dispatch, getState, extraArguments) : Promise<InviteInfo> => {\n        return extraArguments.services.userInviteService.getInvite(inviteLink);\n    };\n};\n\nconst acceptInvite = (\n    userAccountIdentifier : UserAccountId,\n    inviteLink : string,\n) : ThunkAction<Promise<string>, object, {services : ActionInterfaces.IServices}> => {\n    return (dispatch, getState, extraArguments) : Promise<string> => {\n        return extraArguments.services.userInviteService.addCustomerToRetailer(userAccountIdentifier, inviteLink);\n    };\n};\n\nconst invalidateInvite = (\n    inviteLink : string,\n) : ThunkAction<Promise<string>, object, { services : ActionInterfaces.IServices }> => {\n    return (dispatch, getState, extraArguments) : Promise<string> => {\n        return extraArguments.services.userInviteService.invalidateInvite(inviteLink);\n    };\n};\n\nconst onSuccessfulSignIn = () : ThunkAction<Promise<UserAccountId | null>, object, { services : ActionInterfaces.IServices }> => {\n    return (dispatch, getState, extraArguments) : Promise<UserAccountId | null> => {\n        const authenticatedUserSessionId : UserSessionId = extraArguments.services.userSessionManager.getSessionId();\n        if (authenticatedUserSessionId !== null) {\n            return extraArguments.services.userSessionManager.getAccountId();\n        }\n        return Promise.resolve(null);\n    };\n};\n\nconst logoutUser = () : ThunkAction<Promise<void>, object, { services : ActionInterfaces.IServices }> => {\n    return (dispatch, getState, extraArguments) : Promise<void> => {\n        return extraArguments.services.userSessionTerminator.terminateSession();\n    };\n};\n\nexport const UserSessionInviteActions : ActionInterfaces.IUserSessionInviteActionCreatorsMapObject = {\n    getInvite,\n    acceptInvite,\n    invalidateInvite,\n    onSuccessfulSignIn,\n    logoutUser\n};\n","import React from 'react';\nimport { connect } from 'react-redux';\n\nimport Cookies from 'js-cookie';\nimport { UserSessionActions } from './actions';\n\nimport { refreshToken } from \"shared/global/refreshJWT\";\nimport { SignUpOptionsDispatch } from './types';\nimport { USER_SESSION_COOKIE_NAME } from 'shared/lib/cookie/impl/CookieManagerImpl';\n\ninterface IUserLoginAppProps {\n    dispatch : SignUpOptionsDispatch;\n}\n\ninterface IUserLoginAppState {\n    hasJWT : boolean;\n    hasRefreshToken : boolean;\n}\n\nexport class UserLoginApp extends React.Component<IUserLoginAppProps, IUserLoginAppState> {\n    constructor(props : IUserLoginAppProps) {\n        super(props);\n        this.state = {\n            hasJWT: false,\n            hasRefreshToken: true,\n        };\n    }\n\n    public UNSAFE_componentWillMount() {\n        void refreshToken(() => null, true);\n    }\n\n    public componentDidMount() {\n        // keep checking if cookie has been set by refreshJWT.ts by forcing the app to periodically re-render...\n        setInterval(() => {\n            this.setState({\n                hasJWT: !!Cookies.get(USER_SESSION_COOKIE_NAME)\n            });\n        }, 10000); // was 3000\n    }\n\n    public render() {\n        const { dispatch } = this.props;\n        const { hasJWT } = this.state;\n\n        if (hasJWT) {\n            void dispatch(UserSessionActions.onSuccessfulSignIn());\n            return null;\n        } else {\n            return (\n                <div style={ { display: 'flex', width: '100vw', height: '100vh', justifyContent: 'center', alignItems: 'center' } }>\n                    <h2>Retrieving User Info...</h2>\n                </div>\n            );\n        }\n    }\n}\n\nconst mapStateToProps = () => ({});\n\nexport const ConnectedUserLoginApp = connect<object, object, object>(mapStateToProps)(UserLoginApp);\n","import React from 'react';\n\ninterface ILogoutViewProps {\n    submit : () => void;\n}\n\nexport class LogoutView extends React.Component<ILogoutViewProps, object> {\n    public render() {\n        const {\n            submit,\n        } = this.props;\n        return (\n            <a onClick={ submit }>\n                Log Out\n            </a>\n        );\n    }\n}\n","import React from 'react';\nimport { connect } from 'react-redux';\n\nimport { LogoutView } from 'shared/components/LogoutView';\nimport { UserSessionActions } from './actions';\nimport { SignUpOptionsDispatch } from './types';\n\ninterface IUserLogoutAppProps {\n    dispatch : SignUpOptionsDispatch;\n}\n\nexport class UserLogoutApp extends React.Component<IUserLogoutAppProps, object> {\n\n    private handleSubmit : () => void;\n\n    constructor(props : IUserLogoutAppProps) {\n        super(props);\n\n        this.handleSubmit = () => {\n            props.dispatch(UserSessionActions.logoutUser());\n        };\n    }\n\n    public render() {\n        return (\n            <div>\n                <LogoutView\n                    submit={ this.handleSubmit }\n                />\n            </div>\n        );\n    }\n}\n\nconst mapStateToProps = () => ({\n});\n\nexport const ConnectedUserLogoutApp = connect<object, object, object>(mapStateToProps)(UserLogoutApp);\n","import { createRoot } from \"react-dom/client\";\nimport { combineReducers } from '@reduxjs/toolkit';\n\nimport { Auth } from 'aws-amplify';\nimport { Provider } from 'shared/components/Provider';\n\nimport { SignUpOptionsReducers } from 'shared/components/SignUpOrSignIn/SignUpOptions/reducers';\nimport { InviteReducers } from './inviteReducers';\nimport { UserSessionReducers } from './reducers';\n\nimport { ConnectedInviteApp } from './InviteApp';\nimport { ConnectedUserButtonApp } from './UserButtonApp';\nimport { ConnectedUserLoginApp } from './UserLoginApp';\nimport { ConnectedUserLogoutApp } from './UserLogoutApp';\n\nimport { DjangoApiManager } from 'shared/api/DjangoApiManager';\n\nimport {\n    cookieManager,\n    queryStringManager,\n    unauthenticatedUserSessionManager,\n    userAccountInfoService,\n    userAccountManager,\n    userInviteService,\n    userPasswordManager,\n    userSessionManager,\n} from 'shared/lib/manager';\nimport { SignUpOptionsServices } from \"./types\";\n\nconst signUpOptionsReducers = combineReducers({\n    userSession: UserSessionReducers,\n    signUpOptionsState: SignUpOptionsReducers,\n});\n\nconst inviteReducers = combineReducers({\n    userSession: UserSessionReducers,\n    inviteState: InviteReducers,\n    signUpOptionsState: SignUpOptionsReducers, // used by ConnectedSignupOptions in InviteApp–\n});\n\n// TODO 02/10/2025: is this used at all?? can we get rid of this set of code??\n// TODO what about the amplify config we configure on all of the index pages\n\n// MAIN\nconst services : SignUpOptionsServices = {\n    userSessionCreator: userSessionManager,\n    userSessionReader: userSessionManager,\n    userSessionTerminator: userSessionManager,\n    userAccountInfoReader: userAccountInfoService,\n    queryStringReader: queryStringManager,\n    cookieDeleter: cookieManager,\n    cookieReader: cookieManager,\n    userPasswordManager,\n    userSessionManager,\n    userAccountManager,\n    unauthenticatedUserSessionManager,\n    djangoApiManager: new DjangoApiManager(),\n    userInviteService\n};\nAuth.configure(window.AMPLIFY_CONFIG);\n\nconst userLoginAppElement = document.getElementById('user-login-app');\nif (userLoginAppElement) {\n    const userLoginRoot = createRoot(userLoginAppElement);\n    userLoginRoot.render(\n        <Provider appReducers={ signUpOptionsReducers } services={ services }>\n            <ConnectedUserLoginApp />\n        </Provider>\n    );\n}\n\nconst userButtonAppElement = document.getElementById('user-button-app-mount');\nif (userButtonAppElement) {\n    const userButtonRoot = createRoot(userButtonAppElement);\n    userButtonRoot.render(\n        <Provider appReducers={ signUpOptionsReducers } services={ services }>\n            <ConnectedUserButtonApp />\n        </Provider>\n    );\n}\n\nconst userLogoutAppElement = document.getElementById('user-logout-app');\nif (userLogoutAppElement) {\n    const userLogoutRoot = createRoot(userLogoutAppElement);\n    userLogoutRoot.render(\n        <Provider appReducers={ signUpOptionsReducers } services={ services }>\n            <ConnectedUserLogoutApp />\n        </Provider>\n    );\n}\n\nconst inviteAppElement = document.getElementById('invite-app');\nif (inviteAppElement) {\n    const inviteAppRoot = createRoot(inviteAppElement);\n    inviteAppRoot.render(\n        <Provider appReducers={ inviteReducers } services={ services }>\n            <ConnectedInviteApp />\n        </Provider>\n    );\n}\n"],"names":["InviteReducers","combineReducers","signUpFormState","SignUpFormReducers","thanksForRegisteringState","ThanksForRegisteringReducers","InviteApp","React","constructor","props","super","this","currentUser","fetchUserInviteInfo","state","inviteLinkValue","setState","isLoading","dispatch","inviteLink","getState","extraArguments","services","userInviteService","getInvite","then","inviteInfo","inviteBannerText","getInvitedByUserName","getInvitedToName","isInviteActive","inviteTargetId","getInvitationType","getInvitedToId","getValue","inviteTargetName","hasUserJoinedEstablishment","catch","error","InvalidInviteException","Error","Promise","resolve","onSuccessfulSignUp","userAccountIdentifier","signUpData","UserSessionActions","isAdmin","onAcceptInvitation","onSuccessfulAdminSignUp","userAccountId","window","location","href","onSuccessfulSignIn","userSessionManager","getSessionId","getAccountId","redirectToUrl","onSendEmailAgainClick","ThanksForRegisteringActions","onResendEmail","validationInputDataByFieldName","emailAddress","value","onCloseButtonClick","SignUpFormActions","onResetForm","onLoggedInUserAcceptInvite","UserAccountId","GLOBAL_USER_ID","userID","redirect","addCustomerToRetailer","url","acceptInvite","notUserLogout","userSessionTerminator","terminateSession","isLoggedIn","SignUpOptionsFormActions","onSetActiveForm","invalidateInvite","URLStringUtils","getQueryParameterFromUrl","GLOBAL_USER_IS_ADMIN","GLOBAL_USER_NAME","UNSAFE_componentWillMount","render","headerTitle","_jsxs","children","_jsx","className","LoadingCover","hasLoadingIcon","getFormdDisplayContents","ConnectedSignUpOptions","availableFormOptions","isEmbeddedInModal","isDismissible","formIsVisibleOnLoad","additionalUserFieldsAreShown","additionalRetailerFieldsAreShown","additionalRetailerFieldsAreRequired","Button","buttonClassName","isDisabled","onClick","hasSuccessfullySubmitted","ThanksForRegistering","isResendingEmail","isEmailResent","ConnectedInviteApp","connect","inviteState","UserLoginApp","hasJWT","hasRefreshToken","refreshToken","componentDidMount","setInterval","Cookies","USER_SESSION_COOKIE_NAME","style","display","width","height","justifyContent","alignItems","ConnectedUserLoginApp","mapStateToProps","LogoutView","submit","UserLogoutApp","handleSubmit","logoutUser","ConnectedUserLogoutApp","signUpOptionsReducers","userSession","UserSessionReducers","signUpOptionsState","SignUpOptionsReducers","inviteReducers","userSessionCreator","userSessionReader","userAccountInfoReader","userAccountInfoService","queryStringReader","queryStringManager","cookieDeleter","cookieManager","cookieReader","userPasswordManager","manager","ci","Pr","userAccountManager","kZ","unauthenticatedUserSessionManager","zh","djangoApiManager","DjangoApiManager","Auth","configure","AMPLIFY_CONFIG","userLoginAppElement","document","getElementById","createRoot","Provider","appReducers","userButtonAppElement","ConnectedUserButtonApp","userLogoutAppElement","inviteAppElement"],"sourceRoot":""}