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A,EAA4BE,EAE7B,CAQO,SAASC,EAAuBC,EAAuE,CACjFJ,EAAAI,CAC7B,CASW,IAAAC,EAA6BC,GAA2C,GAYnE,SAAAC,EACfC,EACAC,EACO,CACqBJ,EAAAG,CAG7B,CASW,IAAAE,EAAgB,CAACf,EAAgBgB,IAAgC,CAC3E,QAAQ,MAAM,CACb,KAAM,gBACN,MAAOhB,EACP,MAAO,oDAAoDgB,CAAY,GACvE,CAEF,EAKO,SAASC,EAAaJ,EAAwE,CACpFE,EAAAF,CAEjB,CAQW,IAAAK,EAAuBC,GAA2C,GAMtE,SAASC,EAAqBC,EAAgE,CAC9EH,EAAAG,CAEvB,CAqDO,IAAIC,EAOAC,EAKX,eAAsBC,GAAgC,CACrD,KAAM,CAAE,WAAAC,GAAe,MAAA9B,EAAA,2BAAA+B,CAAA,OAAM,QAAO,mBAAyB,OAAA9B,KAAA,sBAAA8B,CAAA,yEAC7DJ,EAAa,IAAIG,EACjBF,EAAU,IACLD,EACIA,EAAW,YAAY,GAE9B,QAAQ,MAAM,4DAA4D,EAEpE,QAAQ,QAAQ,MAAS,EAGlC,CAWO,IAAIK,EAMJ,SAASC,EAA8BC,EAAwC,CACrFF,EAAkBE,EAAwB,CAE3C,CAQO,IAAIC,EAAgC,SAAY,CAGvD,EAKO,SAASC,EAAgBC,EAA4C,CAChEF,EAAAE,CAEZ","names":["GlobalStateTemplate","globalTop","myWindow","proxyNestedHandler","options","currentPropPath","obj","prop","v","value","_GlobalStateSynced","observable","merge","oldValue","i","frame","receiveStateUpdate","path","_syncHold","defaultSyncGlobalStateEventHandler","event","GlobalState","Session","Permissions","Flags","Preferences","resetGlobalState","populateGlobalState","_a","populateUserSecurity","populateUserPreferences","_b","UserSecurityApi","__vitePreload","n","permissionResponse","Features","CRUD","error","SystemUserSettingApi","UserNameApi","miscResponse","preferenceResponse","_abortControllerConnector","onAbortControllerCreated","abortControllerLookup","connectAbortController","handler","registerToastNotification","_notif","connectToastNotification","registerHandler","removeHandler","registerError","extraMessage","connectError","updateNotifications","_commandOrId","connectNotifications","updateHandler","signalRApi","signalR","connectSignalR","SignalRApi","SignalRApi2","activeChatStore","connectActiveChatToSignalR","existingChatStoreLookup","onLogout","connectOnLogout","onLogoutHandler"],"ignoreList":[],"sources":["../../../libs/stores/src/lib/GlobalState/GlobalStateTemplate.ts","../../../libs/stores/src/lib/GlobalState/GlobalState.ts","../../../libs/stores/src/lib/GlobalState/Helpers.ts"],"sourcesContent":["import { AppIdType, ThemePreferenceOption } from './types';\nimport { DateTime } from 'luxon';\nimport { Features } from '@mst/api/models/UserSecurity';\nimport { IUserMiscellaneous } from '@mst/api//models/generated/UserMiscellaneous';\nimport { ePhoneSystem } from '@mst/api/models/generated/ePhoneSystem';\nimport { IPreference } from '@mst/api/models/generated/ePreference';\nimport { IConfiguredFields } from '@mst/api/api/ConfiguredFieldsApi';\n\n/**\n * This contains just the structured state to be shared among multiple libraries to access and update based upon.\n * It is a observable via mobx but is an object literal.\n * In order to work between iframes it will also be stored in the top windows so it can be initialized by watching that when this file is\n * initially imported.\n */\n\nexport const GlobalStateTemplate = {\n\t/**\n\t * enable syncing GlobalState to other frames\n\t */\n\tSync: false,\n\n\tSession: {\n\t\t/**\n\t\t * Current sessionId that is NOT ENCODED, see encodedSessionId for encoded version to use in URL\n\t\t * @todo: add helper for encodedSessionId in helpers called something like GetEncodedSessionId()\n\t\t */\n\t\tsessionId: '',\n\t\t/**\n\t\t *\n\t\t */\n\t\tsessionUrl: '',\n\t\t/**\n\t\t * Date of when session was created\n\t\t * */\n\t\tsessionTime: null as DateTime,\n\t\t/**\n\t\t * Current user associated with this session\n\t\t */\n\t\tusername: '',\n\t\t/**\n\t\t * Current database associated with this session\n\t\t */\n\t\tdatabaseId: '',\n\t\t/**\n\t\t * App ID to determine which product holds this session\n\t\t * has values like 'PCR9', 'PCR10', 'MOBILE', 'CAPTURE'\n\t\t */\n\t\tappId: 'NOAPP' as AppIdType,\n\t\t/**\n\t\t * This is a session cookie used for public guest users, such as chat or web extensions\n\t\t * @todo review this\n\t\t */\n\t\tpcrcookie: '',\n\t\t/**\n\t\t * A uniquely generated instance id\n\t\t * This is primarily used to differentiate the same user logged into two devices simultaneously\n\t\t * helps signalR notifications identify the source of the calls.\n\t\t * @note Generated at creation time.\n\t\t */\n\t\tinstanceId: `api_`.concat((Math.random() * 1000000000).toString().replace(/\\./, ''))\n\t},\n\n\t/**\n\t * Users may be limited to change these by an admin or our system.\n\t */\n\tPermissions: {\n\t\tActivity_Search: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tAdministrator: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tAllow_Change_Records_Username: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tAllow_Send_Private_Email: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tAuditing_Reports: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tAuto_Matching: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tAutomation_Plans: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tBackground_Checks: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tCampaign_Reports: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tChange_Company: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tCommissions_Transactions: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tCompanies: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tCompany_Activities: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tCompany_attachments: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tCompany_Attributes: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tCompany_Recent_Card: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tCompany_Reports: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tCompany_Text_Search: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tConfigure_Company_Layout: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tConfigure_Name_Layout: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tConfigure_Placements_Layout: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tConfigure_Position_Layout: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tContract_Reports: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tCustom_Fields: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tCustom_SQL_Reports: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tDashboard: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tData_Transfer: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tEEO_Reports: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tExport_Reports: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tForm_Letters: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tFyreSync: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tHRNX_Integration: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tHelp_Desk_Security_Flag: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tInterviews: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tKeyword_Tables: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tMain_Reports: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tMRIIOR_Candidate_Search: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tNONE: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tName_Activities: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tName_Attachments: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tName_Attributes: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tName_Groups: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tName_Recent_Card: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tName_Reports: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tName_Text_Search: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tNames: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tOnboarding: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tPeople_Answers: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tPipeline_Reports: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tPlacement_Reports: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tPlacements: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tPlanner_Enabled: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tPosition_Activities: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tPosition_attachments: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tPosition_Attributes: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tPosition_Details: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tPosition_Recent_Card: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tPosition_Reports: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tPosition_Text_Search: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tPositions: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tPresentation_Overall_List: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tPresentations: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tProfiles: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tRecord_Merging: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tResumes: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tRevenue_Boards: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tRollup_List: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tSQL_Workbench: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tScheduling: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tSequence_Tasks: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tSequencing: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tShare_Schedule: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tSynchronization: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tTimesheets: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tUser_Reports: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tWeb_Ext_Reports: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tWriteIncomingEmailActivities: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t},\n\t\tDeals: {\n\t\t\tCreate: false,\n\t\t\tRead: false,\n\t\t\tUpdate: false,\n\t\t\tDelete: false\n\t\t}\n\t},\n\n\t/**\n\t * Flags for enable/disable of features, apps, components, etc.\n\t * ADMIN or SYSTEM change these only\n\t */\n\tFlags: {\n\t\t/** Features From saved backend Securities */\n\t\tFeatures: {\n\t\t\tDashboard_Enabled: false,\n\t\t\tQuicksearch_Enabled: false,\n\t\t\tGeo_Enabled: false,\n\t\t\tSplitdesk: false,\n\t\t\tOnboarding: false,\n\t\t\tAISearch: false\n\t\t} as Features,\n\t\t/**\n\t\t * A/B Testing and UI flags\n\t\t * Saved within user settings table\n\t\t * @note this is an example for now, please do not use at the moment\n\t\t * @todo: should we group all flags into one user preference?\n\t\t */\n\t\tUI: {\n\t\t\t/** Enables the new design for action fields */\n\t\t\tActionFieldV2: false\n\t\t}\n\t},\n\n\t/** Users of all types can change these, they are specific to a user. */\n\tPreferences: {\n\t\tMisc: {\n\t\t\tSplitdeskShowOwnershipFields: false,\n\t\t\tMailType: '',\n\t\t\tControlsVersion: '',\n\t\t\tControlsVersion46: '',\n\t\t\tNewPipelineEnabled: false,\n\t\t\tSignalRHost: '',\n\t\t\tIs2FAenabled: false,\n\t\t\tHasDealsAvailable: false,\n\t\t\tPhoneSettings: {\n\t\t\t\tPreferredProvider: 'NONE' as ePhoneSystem,\n\t\t\t\tRingCentralPhoneNumber: '',\n\t\t\t\tShowMobileDialerOption: false,\n\t\t\t\tUseMobileDialer: false\n\t\t\t},\n\t\t\tAlwaysAddSignature: false\n\t\t} as IUserMiscellaneous,\n\t\t/**@todo: review if ui related preferences should be global or if we need a app layer obj */\n\t\t/** SYSTEM will be default eventually for Ten, for now we only do LIGHT */\n\t\tThemePreference: 'LIGHT' as ThemePreferenceOption,\n\t\tUser: {\n\t\t\tAutomatically_Place_Sendout_Followup_Activity_on_Schedule: 0,\n\t\t\tUse_Candidate_Name_for_attachment_when_emailing_resumes: 0,\n\t\t\tAlways_Place_Activities_on_Schedule: 0,\n\t\t\tOpen_Resumes_Notes_in_New_Windows: 0,\n\t\t\tAutomatically_Change_Work_Phone_When_Moving_Names_to_Other_Companies: 0,\n\t\t\tDo_Not_Update_Work_Number_During_Placement: 0,\n\t\t\tAutomatically_Write_Activities_When_Bulk_Emailing_Letters: 0,\n\t\t\tAutomatically_Write_Activities_When_Bulk_Emailing_Resumes: 0,\n\t\t\tAutomatically_Write_Activities_When_Adding_Notes: 0,\n\t\t\tPlace_Cursor_on_First_Name_When_Adding_a_New_Candidate_Record: 0,\n\t\t\tOpen_PCRecruiter_in_Full_Screen_Mode: 0,\n\t\t\tAutomatically_Write_Activity_When_Mail_Merging_Letters: 0,\n\t\t\tAutomatically_Write_Industry_Specialty_to_Names_From_Company_Records: 0,\n\t\t\tUse_Titles_Table_instead_of_On_The_Fly_Titles_Dropdown_Box: 0,\n\t\t\tDo_not_place_activity_type_description_as_default_activity_text_when_selected: 0,\n\t\t\tSort_By_Code_Instead_of_Description_on_Keyword_Dropdowns: 0,\n\t\t\tUse_International_Telephone_Format: 0,\n\t\t\tShow_Names_Instead_of_Activities_on_Company_Rollup_List: 0,\n\t\t\tLock_Status_on_Candidates: 0,\n\t\t\tAutomatically_Write_Sendout_Activity_To_All_Job_Order_Contacts: 0,\n\t\t\tDo_Not_Write_Activity_When_Name_Company_or_Job_Order_is_Entered: 0,\n\t\t\tUse_Simple_Numbering_for_Names_and_Job_Orders: 0,\n\t\t\tUse_RTF_Editor: 0,\n\t\t\tDo_Not_Copy_Name_Activities_to_Company_Activities_by_Default: 0,\n\t\t\tDo_Not_Automatically_Pull_Associated_Company_when_Pulling_up_a_Candidate: 0,\n\t\t\tDo_not_Create_Resume_Activities: 0,\n\t\t\tTime_Offset: 0,\n\t\t\tHide_Telephone_Switch_Info: 0,\n\t\t\tAuto_Display_Previous_Name_Company_Position: 0,\n\t\t\tRequest_Notation_When_Names_Companies_Positions_are_updated: 0,\n\t\t\tActiveX_Enabled: 0,\n\t\t\tAlarm_Control: 0,\n\t\t\tHTML_Control: 0,\n\t\t\tRTF_Control: 0,\n\t\t\tAltigen_Control: 0,\n\t\t\tOutlook_Control: 0,\n\t\t\tADDR_Control: 0,\n\t\t\tMail_Import_Control: 0,\n\t\t\tFileMan_Control: 0,\n\t\t\tQuickBooks_Control: 0,\n\t\t\tInline_RTF_Control: 0,\n\t\t\tUse_Fullscreen_Dashboard: 0,\n\t\t\tKeep_Status_When_Copying_Rollups: 0,\n\t\t\tDO_NOT_USE: 0,\n\t\t\tUse_Rollup_Stages_For_Pipeline_Automation: 0,\n\t\t\tFill_Country_Code_When_Unknown: 0,\n\t\t\tLoad_Contacts_For_Routing_From_Pipeline: 0,\n\t\t\tStickyNavigation_Candidates: 0,\n\t\t\tStickyNavigation_Positions: 0,\n\t\t\tStickyNavigation_Companies: 0,\n\t\t\tPCR_Action_Add_Record: 0,\n\t\t\tPCR_Action_Add_Activity: 0,\n\t\t\tPCR_Action_Add_Note: 0,\n\t\t\tPCR_Action_Send_Email: 0,\n\t\t\tPCR_Action_Submit_Profile: 0\n\t\t} as IPreference\n\t},\n\n\tConfiguredFields: {} as { [recordName: string]: IConfiguredFields }\n};\n","import { observable } from 'mobx';\nimport merge from 'lodash.merge';\nimport { GlobalStateTemplate } from './GlobalStateTemplate';\nimport { proxySyncGlobalState, syncGlobalStateEventHandler } from './Helpers';\n//import { proxyNestedHandler } from '@mst/utils/lib/Proxies/proxyNestedHandler';\n\n//Alias for top and window so that they dont break capture like scenarios with service workers that dont have top\nconst globalTop = globalThis.top;\nconst myWindow = globalThis.window;\n\n/**\n * TODOS:\n * - [ ] Implement necessary initialization logic for all keys in this store\n * - [x] Update core of SessionApi state to point to GlobalState values\n * - [x] Replace SessionApi -> isCaptureSession with Session.appId === 'CAPTURE'\n * - [x] Onboarding SessionApi -> instanceId and activeChatApi need review\n * - [x] Replace SessionApi -> isNineDarkMode with a new helper\n * - [x] What to do about SessionApi -> signalRApi ref\n * - [ ] Transition existing permission fetches to reference GlobalState.Permissions\n * - [ ] Transition existing feature flag lookups to reference GlobalState.Flags\n * - [x] Figure out what to do about / where to put UserSettings.ts values, maybe ui flags should live there as one setting\n */\n\n/**\n * THIS IS TEMPORARY UNTIL WE CAN REMOVE THE new ActiveSession() AS IT IS CAUSING A CIRCULAR REFERENCE WHEN WE IMPORT THIS FROM UTILS\n */\nexport const proxyNestedHandler = (\n\toptions: {\n\t\tgetHandler?: (obj: object, prop: string, v: any) => any;\n\t\tsetHandler?: (obj: object, prop: string, value: any, currentPropPath: string[]) => boolean;\n\t},\n\tcurrentPropPath: string[] = []\n): { get; set } => ({\n\tget: (obj: any, prop: string): any => {\n\t\tif (prop === '_isProxy') {\n\t\t\treturn true;\n\t\t}\n\t\tconst v = obj[prop];\n\t\tif (v && typeof v === 'object' && !v._isProxy) {\n\t\t\t//create nested Proxy handlers\n\t\t\treturn new Proxy(v, proxyNestedHandler(options, [...currentPropPath, prop]));\n\t\t}\n\t\tif (options.getHandler) {\n\t\t\treturn options.getHandler(obj, prop, v);\n\t\t} else {\n\t\t\treturn v;\n\t\t}\n\t},\n\tset: (obj: object, prop: string, value: any): boolean => {\n\t\tif (options.setHandler) {\n\t\t\treturn options.setHandler(obj, prop, value, currentPropPath);\n\t\t} else {\n\t\t\tobj[prop] = value;\n\t\t\treturn true;\n\t\t}\n\t}\n});\n\n/**\n * Add synchronization logic to a copy of GlobalStateTemplate\n */\nconst _GlobalStateSynced = new Proxy(\n\tobservable(merge({}, GlobalStateTemplate)),\n\tproxyNestedHandler({\n\t\tsetHandler: (obj: object, prop: string, value: any, currentPropPath: string[]) => {\n\t\t\tconst oldValue = obj[prop];\n\t\t\tif (\n\t\t\t\t(typeof oldValue !== 'object' && oldValue !== value) ||\n\t\t\t\t(Array.isArray(oldValue) && oldValue.toString() !== value?.toString())\n\t\t\t) {\n\t\t\t\tobj[prop] = value;\n\t\t\t\tif (_GlobalStateSynced.Sync && prop !== 'Sync') {\n\t\t\t\t\t//console.log(`LOCAL sync from: ${window.name}.GlobalState.${currentPropPath.join('.')}.${prop} = ${value?.toString()}`);\n\t\t\t\t\tif (proxySyncGlobalState) {\n\t\t\t\t\t\tproxySyncGlobalState([...currentPropPath, prop], JSON.parse(JSON.stringify(value)));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (myWindow !== globalTop) {\n\t\t\t\t\t\t\tglobalTop.postMessage(\n\t\t\t\t\t\t\t\t{ currentPropPath: [...currentPropPath, prop], value: JSON.parse(JSON.stringify(value)) },\n\t\t\t\t\t\t\t\tlocation.origin\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor (let i = 0; i < globalTop.frames.length; i++) {\n\t\t\t\t\t\t\tconst frame = globalTop.frames[i];\n\t\t\t\t\t\t\tif (frame !== myWindow) {\n\t\t\t\t\t\t\t\tframe.postMessage(\n\t\t\t\t\t\t\t\t\t{ currentPropPath: [...currentPropPath, prop], value: JSON.parse(JSON.stringify(value)) },\n\t\t\t\t\t\t\t\t\tlocation.origin\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t})\n);\n\n/**\n * Sets a value in GlobalState with sync DISABLED. Use when overriding default sync behavior for alternate messaging systems.\n * @param path an array of keys used to recursively reflect on the GlobalState object\n * @param value the value to set (must be a primitive type)\n */\nexport const receiveStateUpdate = (path: string[], value: unknown): void => {\n\t//console.log(`REMOTE sync to: ${GLOBAL_WINDOW.name}.GlobalState.${path.join('.')} = ${value?.toString()}`);\n\tconst _syncHold = _GlobalStateSynced.Sync; //store previous sync state so it can be restored\n\t_GlobalStateSynced.Sync = false;\n\tlet obj = _GlobalStateSynced;\n\tfor (let i = 0; i < path.length; i++) {\n\t\tif (i === path.length - 1) {\n\t\t\t//on the last property path entry, set the value\n\t\t\tobj[path[i]] = value;\n\t\t} else {\n\t\t\t//recurse through GlobalState until we find the nested property we want to set\n\t\t\tobj = obj[path[i]];\n\t\t}\n\t}\n\t_GlobalStateSynced.Sync = _syncHold;\n};\n\n/**\n * Default GlobalState handler that receives the postMessage from another frame and applies the update to the GlobalState on the current frame\n * @param event\n * @returns\n */\nconst defaultSyncGlobalStateEventHandler = (event: MessageEvent): void => {\n\tif (syncGlobalStateEventHandler) {\n\t\treturn syncGlobalStateEventHandler(event);\n\t}\n\n\tif (event.origin !== globalThis.origin) {\n\t\treturn;\n\t}\n\n\tif (event.data.hasOwnProperty('currentPropPath') && event.data.hasOwnProperty('value')) {\n\t\tconst { currentPropPath, value } = event.data;\n\t\treceiveStateUpdate(currentPropPath, value);\n\t}\n};\n\nif (globalTop) {\n\tglobalThis.addEventListener('message', defaultSyncGlobalStateEventHandler);\n}\n\nif (globalTop === myWindow) {\n\t//set GlobalState on the top browser window and service workers where top/window are both undefined\n\tglobalThis['GlobalState'] = _GlobalStateSynced;\n}\n\nexport type IGlobalState = typeof GlobalStateTemplate;\nexport const GlobalState = _GlobalStateSynced;\nexport const Session = _GlobalStateSynced.Session;\nexport const Permissions = _GlobalStateSynced.Permissions;\nexport const Flags = _GlobalStateSynced.Flags;\nexport const Preferences = _GlobalStateSynced.Preferences;\n","import { GlobalState, Permissions, Flags, Preferences, Session } from './GlobalState';\nimport { GlobalStateTemplate } from './GlobalStateTemplate';\nimport { AxiosResponse } from 'axios';\nimport { AxiosConfig } from '@mst/api/api/base/AxiosClient';\nimport type { ToastNotificationModel } from '@mst/api/models/ToastNotification';\nimport { PCRecruiterHub, SignalRApi } from '@mst/api/api/SignalRApi';\nimport merge from 'lodash.merge';\n\n/**\n * These are a bunch of helpers for mutating values in the GlobalState. The only import here\n * outside of any types should just be the GlobalState store parts themselves.\n */\n\n/**\n * Reset GlobalState back to a default state with high limits.\n */\nexport function resetGlobalState(): void {\n\t//turn off the sync and reset the state\n\tGlobalState.Sync = false;\n\tmerge(GlobalState, GlobalStateTemplate);\n\treturn;\n}\n\n/**\n * Loads data from the api to populate values in permissions, flags, and preferences of the GlobalState\n * @returns\n */\nexport async function populateGlobalState(): Promise {\n\tif (globalThis.window === globalThis.top) {\n\t\t//for top window, enable GlobalState sync then pull in user security/settings\n\t\tGlobalState.Sync = true;\n\t\tif (Session.sessionId?.length > 0) {\n\t\t\tawait Promise.all([populateUserSecurity(), populateUserPreferences()]);\n\t\t}\n\t} else {\n\t\t//for any other frame, pull GlobalState from top and then enable GlobalState sync\n\t\tGlobalState.Sync = false; //safety net, should already be false\n\t\tmerge(GlobalState, { ...globalThis?.top?.['GlobalState'], Sync: false }); //make sure sync remains false\n\t\tGlobalState.Sync = true;\n\t}\n\treturn;\n}\n\n/**\n * Calls the UserSecurity endpoint and populates user permissions, preferences, AND any feature flags in the 'Features' key of the response\n * This reorganizes the shape sent from the backend into the desired shape for the clientside.\n */\nexport async function populateUserSecurity(): Promise {\n\t//pull securities api for that set of permissions\n\ttry {\n\t\tconst { UserSecurityApi } = await import('@mst/api/api/UserSecurityApi');\n\t\tconst permissionResponse = await new UserSecurityApi().get();\n\n\t\tif (permissionResponse.data) {\n\t\t\t//some permissions are actually feature flags, they are under the Features key\n\t\t\tconst { Features, ...CRUD } = permissionResponse.data;\n\t\t\t//assign crud permissions based on securities\n\t\t\tmerge(Permissions, CRUD);\n\t\t\t//set our feature flags that came from securities\n\t\t\tmerge(Flags.Features, Features);\n\t\t}\n\t} catch (error: unknown) {\n\t\tconsole.error('Error retrieving securities (permissions and flags)', { error });\n\t}\n\treturn;\n}\n\n// --- Flags Helpers --- //\n/**\n * Call apis to retrieve preferences and populate preferences in global object\n * @returns\n */\nasync function populateUserPreferences(): Promise {\n\t//pull userMisc preferences\n\ttry {\n\t\tconst { SystemUserSettingApi } = await import('@mst/api/api/SystemUserSettingApi');\n\t\tconst { UserNameApi } = await import('@mst/api/api/UserNameApi');\n\t\tconst [miscResponse, preferenceResponse] = await Promise.all([\n\t\t\tnew SystemUserSettingApi().getUsersMisc(),\n\t\t\tnew UserNameApi().GetUserPreferences()\n\t\t]);\n\n\t\tif (miscResponse.data) {\n\t\t\tmerge(Preferences.Misc, miscResponse.data);\n\t\t}\n\t\tif (preferenceResponse.data) {\n\t\t\tmerge(Preferences.User, preferenceResponse.data);\n\t\t}\n\t} catch (error: unknown) {\n\t\tconsole.error('Error retrieving preferences', { error });\n\t}\n\treturn;\n}\n\n// --- AbortController Connector --- //\n/**\n * In general we create our abort controllers on request within the api lib.\n * If we want to be able to tie into this creation flow inside our application then this connector\n * allows us to do so. For example if we want to abort certain calls based on app route change.\n */\n/**\n * Local scope definition of a connector. Default is undefined. App needs to setup this\n * with \"setupConnectorForAbortControllerWithRouter\"\n * @RelatedTo AbortController Connector\n */\nlet _abortControllerConnector: (abortControllerLookup: () => AbortController) => void = undefined;\n/**\n * On AbortController created, we want to do side effects within the connector.\n * @param abortControllerLookup\n * @RelatedTo AbortController Connector\n */\nexport function onAbortControllerCreated(abortControllerLookup: () => AbortController): void {\n\t//if a connector has been defined then call it, otherwise do nothing.\n\t_abortControllerConnector?.(abortControllerLookup);\n\treturn;\n}\n/**\n * Use this to setup a definition of our connector so that on created it will pass through the\n * relevant abortControllerLookup through to the defined handler. Useful for collecting created\n * AbortControllers to manage per application state.\n * @param handler Application scoped function of what to do with recently generated AbortController\n * @RelatedTo AbortController Connector\n */\nexport function connectAbortController(handler: (abortControllerLookup: () => AbortController) => void): void {\n\t_abortControllerConnector = handler;\n}\n// ^^^ AbortController Connector ^^^ //\n\n// --- ToastNotification Connector --- //\n/**\n * A way to register a toast notification externally\n * @todo: REMOVE ME - toast controller should respond to changes in toast queue\n * @RelatedTo ToastNotification Connector\n */\nexport let registerToastNotification = (_notif: ToastNotificationModel): string => '';\n/**\n * A way to remove a toast notification externally\n * @todo: REMOVE ME - toast controller should respond to changes in toast queue\n * @RelatedTo ToastNotification Connector\n */\nexport let removeToastNotification = (_toastId: string): void => undefined;\n/**\n * Connects helpers for how to register and remove toast notifications per a given AppState instance\n * @todo: Simplify - may not be necessary. toast controller should respond to changes in toast queue\n * @RelatedTo ToastNotification Connector\n */\nexport function connectToastNotification(\n\tregisterHandler: (notif: unknown) => string,\n\tremoveHandler: (toastId: string) => void\n): void {\n\tregisterToastNotification = registerHandler;\n\tremoveToastNotification = removeHandler;\n\treturn;\n}\n// ^^^ ToastNotification Connector ^^^ //\n\n// --- Error Connector --- //\n/**\n * GlobalHelper - register an error to connect back to a particular app instance this\n * was called in context of\n * @RelatedTo Error Connector\n */\nexport let registerError = (error: unknown, extraMessage?: string): void => {\n\tconsole.error({\n\t\tFrom: 'registerError',\n\t\tError: error,\n\t\tExtra: `Error Connector not defined for this AppState -- ${extraMessage}`\n\t});\n\treturn;\n};\n/**\n * GlobalHelper - Connects a way to register an error externally for our libs to call errors and link back to an AppState\n * @RelatedTo Error Connector\n */\nexport function connectError(registerHandler: (error: unknown, extraMessage?: string) => void): void {\n\tregisterError = registerHandler;\n\treturn;\n}\n// ^^^ Error Connector ^^^ //\n\n// --- Notifications Connector --- //\n/**\n * Used to connect notifications to call an update\n * @RelatedTo Notifications Connector\n */\nexport let updateNotifications = (_commandOrId: number): Promise => undefined;\n/**\n * Connect your AppState notification manager to the updateNotifications state of the GlobalState connectors.\n * Use updateNotifications from GlobalState/Helpers after this is connected.\n * @RelatedTo Notifications Connector\n */\nexport function connectNotifications(updateHandler: (commandOrId: number) => Promise): void {\n\tupdateNotifications = updateHandler;\n\treturn;\n}\n// ^^^ Notifications Connector ^^^ //\n\n// --- ProxyApiCall Connector --- //\n/**\n * Allows for a proxy definition to be defined.\n * Primarily used to setup a transport to the Background scripts api calls in capture.\n * @RelatedTo ProxyApiCall Connector\n */\nexport let proxyApiCall: (request: AxiosConfig) => Promise = undefined;\n/**\n * Connect the proxyApiCall at entry point of application.\n * @RelatedTo ProxyApiCall Connector\n */\nexport function connectProxyApiCall(proxyHandler: (request: AxiosConfig) => Promise): void {\n\tproxyApiCall = proxyHandler;\n\treturn;\n}\n// ^^^ ProxyApiCall Connector ^^^ //\n\n/**\n * Allows for a GlobalState synchronization function to be defined when GlobalState needs to be synchronized elsewhere.\n * By default it uses the PostMessage and listener\n */\nexport let proxySyncGlobalState: (propPath: string[], value: any) => Promise = undefined;\n/**\n * Connect the proxyApiCall at entry point of application.\n */\nexport function connectSyncGlobalState(proxyHandler: (propPath: string[], value: any) => Promise): void {\n\tproxySyncGlobalState = proxyHandler;\n\treturn;\n}\n// ^^^ connectSyncGlobal Connector ^^^ //\n\n/**\n * Allows for a GlobalState synchronization function to be defined when GlobalState needs to be synchronized elsewhere.\n * By default it uses the PostMessage and listener\n */\nexport let syncGlobalStateEventHandler: (event: MessageEvent) => void = undefined;\n/**\n * Connect the proxyApiCall at entry point of application.\n */\nexport function connectSyncGlobalStateEventHandler(eventHandler: (event: MessageEvent) => void): void {\n\tsyncGlobalStateEventHandler = eventHandler;\n\treturn;\n}\n// ^^^ connectSyncGlobal Connector ^^^ //\n\n// --- SignalR Connector --- //\n/**\n * Api instance of the SignalRApi class, holds hub and helpers for disconnects\n * @RelatedTo SignalR Connector\n */\nexport let signalRApi: SignalRApi = undefined;\n/**\n * Retrieve SignalR PCRecruiter Hub asynchronousy, i.e. (await signalR()).\n * Remember that all SignalR functions are async, so if you need the return value, you'll need to await that as well.\n * Example Usage: const language = await (await signalR()).getLang();\n * @RelatedTo SignalR Connector\n */\nexport let signalR: () => Promise = undefined;\n/**\n * todo\n * @RelatedTo SignalR Connector\n */\nexport async function connectSignalR(): Promise {\n\tconst { SignalRApi } = await import('@mst/api/api/SignalRApi');\n\tsignalRApi = new SignalRApi();\n\tsignalR = (): Promise => {\n\t\tif (signalRApi) {\n\t\t\treturn signalRApi.PCRecruiter();\n\t\t} else {\n\t\t\tconsole.error('Please setup a connection to signalR for this client code.');\n\t\t}\n\t\treturn Promise.resolve(undefined);\n\t};\n\treturn;\n}\n\n/**\n * Temporary singleton to store an instance of a chat store\n * @todo Needs refactored to disconnect logic from renderstore and build out its own store.\n * @todo The renderstore connected also needs refactored in its uses as it has potential reinstantiations per\n * render. Needs total overview revisit.\n * @Note setting type to any just for now till its refactored.\n * @RelatedTo signalR chat recieved event\n * @RelatedTo SignalR Connector\n */\nexport let activeChatStore: any = undefined;\n/**\n * Connects\n * @RelatedTo signalR chat recieved event\n * @RelatedTo SignalR Connector\n */\nexport function connectActiveChatToSignalR(existingChatStoreLookup: () => T): void {\n\tactiveChatStore = existingChatStoreLookup();\n\treturn;\n}\n// ^^^ SignalR Connector ^^^ //\n\n// ^^^ Session Connector ^^^ //\n/**\n * Add extra side-effects to when logout is triggered from logout in sessionApi lib\n * @RelatedTo Session Connector\n */\nexport let onLogout: () => Promise = async () => {\n\t// console.log(`Override to add extra side-effects to when logout is triggered. `);\n\treturn;\n};\n/**\n * Connect the onLogout callback to be used to bridge sessionApi logout and AppState\n * @RelatedTo Session Connector\n */\nexport function connectOnLogout(onLogoutHandler: () => Promise): void {\n\tonLogout = onLogoutHandler;\n\treturn;\n}\n// --- Session Connector --- //\n"],"file":"assets/mst-libs-stores.js"}