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A,OAASC,WAAG,eAAEC,iBAAS,eAAE8B,4BAAoB,eAAEC,8BAAsB,eAAEC,YAAI,SAAEC,WAAWtB,EAAuBkB,mBAStHlC,EANkD,CACjDuC,WAAY,IACZC,QAAS,CAAEC,UAAW,wBAAyBC,SAAU,OAAQC,aAAc3B,EAAuB4B,SAAUC,aAAcpC,IAA0BqC,YACxJC,SAAU,CAAEC,SAAUhC,EAAuBiC,kBAAmBC,SAAUlC,EAAuBgB,QAAQkB,WAGtEnD,EAAaoD,QAE7CnC,EAAuBoC,cACoD,QAA9E,EAAAjD,OAAO8B,OAAOtB,SAASC,eAAe,gDAAwC,SAAEyC,WAnBhFrD,EALkD,CACjDsD,UAAU,EACVf,WAAY,IACZC,QAAS,CAAEC,UAAW,qBAAsBE,aAAc3B,EAAuB4B,SAAUC,aAAcpC,IAA0BqC,aAEhG/C,EAAawD,WAqBnD,EExBA,WACC,IACC,IAAIC,EEHN,SAAoCC,GACnC,IAAMC,EAAcD,aAAO,EAAPA,EAASE,QAAQC,SAErC,OAAIF,EACIG,KAAKC,MAAMJ,GAGZ,IACR,CAZQK,CAA2BN,QAAAA,EAAW9C,SAASC,eAAeE,IFSpE,IAAK0C,EACJ,OAGD,IAAMQ,EAA+B7D,OAAOC,IAAIO,SAASC,eAAeE,GAExE,GAAIkD,EACHA,EAA6BC,aAAa,gBAAiBJ,KAAKK,UAAUV,QAEtE,CACJ,IAAIW,EAAyBhE,OAAOC,IAAIO,SAASyD,cAAc,OAC/DD,EAAuBE,GAAKvD,EAC5BqD,EAAuBF,aAAa,gBAAiBJ,KAAKK,UAAUV,IACpErD,OAAOC,IAAIO,SAAS2D,KAAKC,YAAYJ,EACtC,CACD,CACA,MAAOK,GACNC,QAAQC,MAAMF,EACf,CE5BM,IAA4Bf,CF6BnC,CA1BAkB,E","sources":["/./Common/AuthenticationTypes.ts","/./Common/Logging.ts","/./SilentSignIn/SilentSignIn.ts","/./Common/Strings.ts","/./SilentSignIn/SilentSignIn.Main.ts","/./Common/Helpers.ts","/./Common/AdminPolicies/parseAdminPolicies.ts"],"sourcesContent":["// Copyright (C) Microsoft Corporation. All rights reserved.\r\n\r\nexport enum DataBoundary {\r\n\tNone = 'None',\r\n\tEU = 'EU'\r\n}\r\n\r\nexport enum UserAgeGroup {\r\n\tUndefined,\r\n\tMinorWithoutParentalConsent,\r\n\tMinorWithParentalConsent,\r\n\tAdult,\r\n\tNotAdult,\r\n\tMinorNoParentalConsentRequired,\r\n}\r\n\r\nexport interface MeControlAccount {\r\n\ttype: string,\r\n\ttenantId: string,\r\n\tmemberName: string,\r\n\tdisplayName: string,\r\n\tfirstName: string,\r\n\tlastName: string,\r\n\tauthenticatedState: string\r\n}\r\n\r\nexport interface SilentSignInProperties {\r\n\taccount: MeControlAccount,\r\n\tuserIsChild?: boolean,\r\n\tlocalTelemetryId: string,\r\n\ttelemetryAuthType: string,\r\n\tpuid: string,\r\n\tauthType: string,\r\n\tdataBoundary: string,\r\n\tageGroup?: UserAgeGroup\r\n}\r\n\r\nexport type MsShellObj = {\r\n\tmeControlOptions: { currentAccount: MeControlAccount }\r\n}\r\n\r\nexport interface IMsCommonShell {\r\n\tload: (msShellCurrentAccount: MsShellObj) => Promise;\r\n\tmeControlOptions: () => { currentAccount: MeControlAccount };\r\n}\r\n\r\n// Value Guidance Types\r\nexport interface ISignInCompletionObj {\r\n\teventType: string,\r\n\tauthType?: string,\r\n\tdataBoundary?: DataBoundary,\r\n\tmeControlAccount?: MeControlAccount\r\n}\r\n","// Copyright (C) Microsoft Corporation. All rights reserved.\r\n\r\nexport interface CaptureContentEventProperties {\r\n\tactionType: string,\r\n\tcontent: {\r\n\t\t[key: string]: string\r\n\t},\r\n\tpageTags?: {\r\n\t\t[key: string]: string\r\n\t},\r\n\tisManual?: boolean\r\n}\r\n\r\nexport function LogContentUpdateEvent(properties: CaptureContentEventProperties, behavior: BehaviorType) {\r\n\tif (typeof (window).top.analytics === 'object') {\r\n\t\tproperties['behavior'] = (window).top?.oneDS?.Behavior[behavior];\r\n\t\t(window).top?.analytics?.captureContentUpdate(properties);\r\n\t};\r\n}\r\n\r\nexport enum BehaviorType {\r\n\tImpression = 'IMPRESSION',\r\n\tSignIn = 'SIGNIN'\r\n}\r\n","// Copyright (C) Microsoft Corporation. All rights reserved.\r\n\r\nimport { SetMeControlAccount } from \"../Common/Helpers\";\r\nimport { SilentSignInProperties } from '../Common/AuthenticationTypes';\r\nimport { CaptureContentEventProperties, LogContentUpdateEvent, BehaviorType } from '../Common/Logging';\r\n\r\nexport function HandleSilentSignIn(silentSignInProperties: SilentSignInProperties, isUserAuthenticated: boolean) {\r\n\tDispatchSilentSignInAttemptedEvent(silentSignInProperties);\r\n\r\n\tif (!isUserAuthenticated) {\r\n\t\tvar captureEvent: CaptureContentEventProperties = {\r\n\t\t\tisManual: true,\r\n\t\t\tactionType: 'A',\r\n\t\t\tcontent: { contentId: 'silentSignInFailed', authProvider: silentSignInProperties.authType, multiAttempt: IsSilentSignInReAttempt().toString() }\r\n\t\t};\r\n\t\tLogContentUpdateEvent(captureEvent, BehaviorType.Impression);\r\n\t\treturn;\r\n\t}\r\n\r\n\tSetMeControlAccount(silentSignInProperties.account, (window).parent);\r\n\r\n\tif (silentSignInProperties?.localTelemetryId) {\r\n\t\t(window)?.top?.analytics?.getPropertyManager()?.getPropertiesContext()?.user?.setLocalId(silentSignInProperties.localTelemetryId);\r\n\t}\r\n\r\n\tvar captureEvent: CaptureContentEventProperties = {\r\n\t\tactionType: 'A',\r\n\t\tcontent: { contentId: 'silentSignInSucceeded', autoAuth: 'true', authProvider: silentSignInProperties.authType, multiAttempt: IsSilentSignInReAttempt().toString() },\r\n\t\tpageTags: { authtype: silentSignInProperties.telemetryAuthType, tenantId: silentSignInProperties.account.tenantId }\r\n\t}\r\n\r\n\tLogContentUpdateEvent(captureEvent, BehaviorType.SignIn)\r\n\r\n\tif (silentSignInProperties.userIsChild) {\r\n\t\twindow.parent.document.getElementById('supWrapperToPreventFeedbackFlickering')?.remove();\r\n\t}\r\n}\r\n\r\nfunction IsSilentSignInReAttempt() {\r\n\tconst silentSignInIframe = (window.top.document.getElementById('iframeOP'));\r\n\treturn silentSignInIframe?.getAttribute('isduplicateattempt') === 'true';\r\n}\r\n\r\nfunction DispatchSilentSignInAttemptedEvent(signInProperties: SilentSignInProperties) {\r\n\twindow.silentSigninProgress = true;\r\n\tconst eventType = 'silentSignInAttempted';\r\n\tconst silentSignInAttemptedEvent = new CustomEvent(eventType, {\r\n\t\tdetail: { ...signInProperties },\r\n\t\tbubbles: true,\r\n\t\tcancelable: false\r\n\t});\r\n\r\n\twindow.top.document.dispatchEvent(silentSignInAttemptedEvent);\r\n}\r\n","// Copyright (C) Microsoft Corporation. All rights reserved.\r\n\r\n// Silent Sign In\r\nexport const eventNameSilentSignInComplete = \"silentSignInComplete\";\r\n\r\n// Popup Sign In\r\nexport const eventNamePopupSignInComplete = \"popupSignInComplete\";\r\n\r\n// Value Guidance strings\r\nexport const eventNameVgSignInSuccess = \"vg.signin.success\";\r\nexport const eventNameVgSignInFailed = \"vg.signin.failed\";\r\n\r\nexport const vgComponentNames = {\r\n\tvgHero: 'vg-hero',\r\n\tvgExplore: 'vg-explore'\r\n}\r\n\r\nexport const HvcComponentType = {\r\n\t[vgComponentNames.vgHero]: 'ValueGuidanceV2HvcHero',\r\n\t[vgComponentNames.vgExplore]: 'ValueGuidanceV2HvcExplore'\r\n}\r\n\r\nexport const TenantAdminPoliciesElementId = \"TAP__SETTINGS\";\r\n","// Copyright (C) Microsoft Corporation. All rights reserved.\r\n\r\nimport { HandleSilentSignIn } from './SilentSignIn';\r\nimport { parseAdminPolicies } from '../Common/AdminPolicies/parseAdminPolicies';\r\nimport { TenantAdminPoliciesElementId } from '../Common/Strings';\r\n\r\n//Webpack will tree shake this function unless it is used somewhere in the source files.\r\n(window).CurrentSilentSignInAttempt = HandleSilentSignIn;\r\n\r\npropagateTenantAdminPoliciesToMainWindow();\r\n\r\n\r\nfunction propagateTenantAdminPoliciesToMainWindow(): void {\r\n\ttry {\r\n\t\tvar adminPolicy = parseAdminPolicies();\r\n\r\n\t\tif (!adminPolicy) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst parentPolicyDataModelElement = window.top.document.getElementById(TenantAdminPoliciesElementId);\r\n\r\n\t\tif (parentPolicyDataModelElement) {\r\n\t\t\tparentPolicyDataModelElement.setAttribute(\"data-settings\", JSON.stringify(adminPolicy));\r\n\t\t}\r\n\t\telse {\r\n\t\t\tvar policyDataModelElement = window.top.document.createElement(\"div\");\r\n\t\t\tpolicyDataModelElement.id = TenantAdminPoliciesElementId;\r\n\t\t\tpolicyDataModelElement.setAttribute(\"data-settings\", JSON.stringify(adminPolicy));\r\n\t\t\twindow.top.document.body.appendChild(policyDataModelElement);\r\n\t\t}\r\n\t}\r\n\tcatch (err) {\r\n\t\tconsole.error(err);\r\n\t}\r\n}\r\n","// Copyright (C) Microsoft Corporation. All rights reserved.\r\nimport { MeControlAccount, DataBoundary } from '../Common/AuthenticationTypes';\r\n\r\n/*\r\n * @param {string} authType - authentication type from user auth object\r\n * @returns {boolean} - true if user is authenticated, false otherwise\r\n */\r\nexport const isUserAuthenticated = (authType: string): boolean => (authType && (authType != '') ? authType.toLowerCase() != 'none' : false);\r\n\r\n/*\r\n * @returns {MeControlAccount} - returns current user account information if available\r\n */\r\nexport const getCurrUser = (): MeControlAccount => (window?.msCommonShell?.meControlOptions()?.currentAccount);\r\n\r\n/*\r\n * @param {string} authType - authentication type from user auth object\r\n * @returns {boolean} - true if user is AAD user, false otherwise\r\n */\r\nexport const isAadUser = (authType): boolean => !!authType && (authType.toLowerCase() === \"aad\");\r\n\r\n/*\r\n * @param {window} window - window to close\r\n */\r\nexport const closeWindow = (window: Window | undefined | null): void => window?.close();\r\n\r\n/*\r\n * Returns valid data source\r\n * @param {string} dataBoundary - data boundary from user auth object\r\n */\r\nexport const parseDataBoundary = (dataBoundary: string): DataBoundary => (dataBoundary === DataBoundary.EU ? DataBoundary.EU : DataBoundary.None);\r\n\r\n/*\r\n * @param {string} url - URL to open in pop up window\r\n * @param {string} width - width of the window\r\n * @param {string} height - height of the window\r\n * @returns {Window} - returns the window created\r\n */\r\nexport const createPopUpWindow = (url: string, width: number, height: number) : Window | null => {\r\n\tif (window) {\r\n\t\tconst wLeft = window.screenLeft ? window.screenLeft : window.screenX;\r\n\t\tconst wTop = window.screenTop ? window.screenTop : window.screenY;\r\n\r\n\t\tconst left = wLeft + (window.innerWidth / 2) - (width / 2);\r\n\t\tconst top = wTop + (window.innerHeight / 2) - (height / 2);\r\n\t\treturn window.open(url, '_blank', `popup=yes, width=${width}, height=${height}, top=${top}, left=${left}`);\r\n\t}\r\n\treturn null;\r\n}\r\n\r\n/*\r\n * @param {MeControlAccount} userAccount - sets MeControlAccount in msCommonShell\r\n * @param {window} win - window to set MeControlAccount in\r\n */\r\nexport const SetMeControlAccount = (userAccount: MeControlAccount, window: any): void => {\r\n\t// ToDo: pattri, #7729785 set type for window\r\n\twindow?.MeControl?.API?.setActiveAccount(userAccount);\r\n}\r\n","// Copyright (C) Microsoft Corporation. All rights reserved.\r\n\r\nimport { AdminPolicy } from './types';\r\nimport { TenantAdminPoliciesElementId } from '../Strings';\r\n\r\n\r\nexport function parseAdminPolicies(element?: HTMLElement): AdminPolicy {\r\n\treturn parseAdminPoliciesInternal(element ?? document.getElementById(TenantAdminPoliciesElementId));\r\n}\r\n\r\n\r\nfunction parseAdminPoliciesInternal(element: HTMLElement): AdminPolicy {\r\n\tconst jsonPayload = element?.dataset.settings;\r\n\r\n\tif (jsonPayload) {\r\n\t\treturn JSON.parse(jsonPayload) as AdminPolicy;\r\n\t}\r\n\r\n\treturn null;\r\n}\r\n"],"names":["UserAgeGroup","DataBoundary","BehaviorType","LogContentUpdateEvent","properties","behavior","window","top","analytics","oneDS","Behavior","captureContentUpdate","IsSilentSignInReAttempt","silentSignInIframe","document","getElementById","getAttribute","TenantAdminPoliciesElementId","CurrentSilentSignInAttempt","silentSignInProperties","isUserAuthenticated","signInProperties","silentSigninProgress","silentSignInAttemptedEvent","CustomEvent","detail","bubbles","cancelable","dispatchEvent","DispatchSilentSignInAttemptedEvent","userAccount","MeControl","API","setActiveAccount","SetMeControlAccount","account","parent","localTelemetryId","getPropertyManager","getPropertiesContext","user","setLocalId","actionType","content","contentId","autoAuth","authProvider","authType","multiAttempt","toString","pageTags","authtype","telemetryAuthType","tenantId","SignIn","userIsChild","remove","isManual","Impression","adminPolicy","element","jsonPayload","dataset","settings","JSON","parse","parseAdminPoliciesInternal","parentPolicyDataModelElement","setAttribute","stringify","policyDataModelElement","createElement","id","body","appendChild","err","console","error","propagateTenantAdminPoliciesToMainWindow"],"sourceRoot":""}