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KAAAA,EAAAA,EAAW9C,GAAG,CAAC8D,GACd,IADDhB,CACC,KAACa,OAAAA,CAAyBI,KAAMD,EAASC,IAAI,CAAEC,QAASF,EAAS1D,KAAK,EAA3D0D,EAASC,IAAI,SAEzBhB,EAAAA,KAAAA,EAAAA,EAAW/C,GAAG,CAACiE,GACd,IADDlB,CACC,KAACY,OAAAA,CAA6BO,SAAUD,EAAaF,IAAI,CAAEC,QAASC,EAAa7D,KAAK,EAA3E6D,EAAaF,IAAI,GAE9B,UAACJ,OAAAA,CAAKI,KAAK,WAAWC,QAAQ,0CAC7BZ,GAAa,UAACX,OAAAA,CAAKoB,IAAI,YAAYxI,KAAM+H,IAC1C,UAACX,OAAAA,CAAKoB,IAAI,UAAUxI,KAAM,GAA4B2H,MAAAA,CAAzBQ,GAAsD,OAA7BR,GAAgCmB,GAAG,UACzF,UAAC1B,OAAAA,CAAKoB,IAAI,aAAaxI,KAAM,GAA4B2H,MAAAA,CAAzBQ,GAAsD,OAA7BR,KACzD,UAACP,OAAAA,CAAKoB,IAAI,aAAaxI,KAAM,GAA4B6H,MAAAA,CAAzBM,GAAiC,OAARN,WACxDI,EAAAA,KAAAA,EAAAA,EAActD,GAAG,CAAC,CAACoE,EAAMC,IACxB,UAAC5B,OAAAA,CAAKoB,IAAI,YAAYxI,IAAI,OAAE+I,EAAAA,KAAAA,EAAAA,EAAM/I,IAAI,CAAEiJ,CAAZF,OAAoB,OAAEA,EAAAA,KAAAA,EAAAA,EAAMG,MAANH,EAAc,EAAO,kBAAwB,OAANC,QAG7F,UAACG,OAAAA,CAAKC,GAAIlB,WAASX,IAClBK,GACC,UAACyB,SAAAA,CAAOC,IAAK,GAA4B1B,MAAAA,CAAzBO,GAAqD,OAA5BP,GAA+B2B,KAAK,QAIrF","sources":["webpack://_N_E/../../libs/shared/mi-apollo-client-utils/src/lib/apollo/hooks.ts","webpack://_N_E/../../libs/shared/mi-apollo-client-utils/src/lib/apollo/index.ts","webpack://_N_E/../../libs/shared/mi-headless-utils/src/components/Layout/index.tsx"],"sourcesContent":["import { OperationSignature, DeployedEnvType, LogType, UXLHttpHeader, UXLHttpHeaders, ApolloEnvVars } from './types';\nimport { useClientEnvVarsStore } from '@marriott/mi-store-utils';\n\n// Fetch env vars from webpack Dotenv\n// Must be destructured one at a time.\nconst { APOLLOGRAPHQL_FULL_NGINX_ENDPOINT } = process.env;\nconst { APOLLOGRAPHQL_PUBLIC_LOCAL_DEV } = process.env;\nconst { APOLLOGRAPHQL_PUBLIC_LOWER_ENV_PATH } = process.env;\nconst { APOLLOGRAPHQL_PUBLIC_HIGHER_ENV_PATH } = process.env;\nconst { APOLLOGRAPHQL_ACTIVE_IN_AEM_PREVIEW } = process.env;\nconst { APOLLOGRAPHQL_PUBLIC_DEBUG_LOG } = process.env;\n\n// Normalize destructured env vars.\n// TODO: This should be done for all vars to allow for use outside of NextJS/webpack-dotenv setup.\n\nexport const getEnvFullNginxEndpoint = () => {\n  return (\n    APOLLOGRAPHQL_FULL_NGINX_ENDPOINT ??\n    process.env['APOLLOGRAPHQL_FULL_NGINX_ENDPOINT'] ??\n    useClientEnvVarsStore.getState().envVarsObject['APOLLOGRAPHQL_FULL_NGINX_ENDPOINT'] ??\n    ''\n  );\n};\n\nexport const getEnvPublicLowerEnvPath = () => {\n  return (\n    APOLLOGRAPHQL_PUBLIC_LOWER_ENV_PATH ??\n    process.env['APOLLOGRAPHQL_PUBLIC_LOWER_ENV_PATH'] ??\n    useClientEnvVarsStore.getState().envVarsObject['APOLLOGRAPHQL_PUBLIC_LOWER_ENV_PATH'] ??\n    ''\n  );\n};\n\nexport const getEnvPublicLocalDev = () => {\n  return (\n    APOLLOGRAPHQL_PUBLIC_LOCAL_DEV ??\n    process.env['APOLLOGRAPHQL_PUBLIC_LOCAL_DEV'] ??\n    useClientEnvVarsStore.getState().envVarsObject['APOLLOGRAPHQL_PUBLIC_LOCAL_DEV'] ??\n    ''\n  );\n};\n\nexport const getEnvPublicHigherEnvPath = () => {\n  return (\n    APOLLOGRAPHQL_PUBLIC_HIGHER_ENV_PATH ??\n    process.env['APOLLOGRAPHQL_PUBLIC_HIGHER_ENV_PATH'] ??\n    useClientEnvVarsStore.getState().envVarsObject['APOLLOGRAPHQL_PUBLIC_HIGHER_ENV_PATH'] ??\n    ''\n  );\n};\n//For backward compatibility adding check for components making UXL call in preview mode\nexport const getActiveInAemPreview = () => {\n  return (\n    APOLLOGRAPHQL_ACTIVE_IN_AEM_PREVIEW ??\n    process.env['APOLLOGRAPHQL_ACTIVE_IN_AEM_PREVIEW'] ??\n    useClientEnvVarsStore.getState().envVarsObject['APOLLOGRAPHQL_ACTIVE_IN_AEM_PREVIEW'] ??\n    ''\n  );\n};\n/**\n * Check if UXL call is from preview mode\n */\nexport const isPreviewMode = () => {\n  const pathName = typeof window != 'undefined' ? window?.location?.href : '';\n  const paramWcmMode = pathName?.includes('?') ? pathName.split('?') : '';\n  const isPreview = paramWcmMode?.includes('wcmmode=disabled') && getActiveInAemPreview() === 'true';\n  return isPreview;\n};\n\nexport const isServer = !(typeof window != 'undefined' && window.document);\nexport const isLocalDev = getEnvPublicLocalDev() === 'true';\nexport const isLocalClientSide = !isServer && isLocalDev;\nexport const isDeployedClientSide = !isServer && !isLocalDev;\nexport const isPreview = isPreviewMode();\n\n/**\n * Normalize string input for deployed env type.\n * @param input\n * @returns\n */\nexport const normalizeDeployedEnvType = (input: string): DeployedEnvType => {\n  // doDebugLog(`normalizeDeployedEnvType: ' ${input}, ${process.env['DEPLOYED_ENV_TYPE']}`, 'info');\n  // doDebugLog(`DEPLOYED_ENV_TYPE: ' ${process.env['DEPLOYED_ENV_TYPE']}`, 'info');\n  return input === 'higher' ? 'higher' : 'lower';\n};\n\n/**\n * Retrieve deployed environment type from env variables during runtime.\n * @returns\n */\nexport const getDeployedEnvType = (): DeployedEnvType => {\n  return normalizeDeployedEnvType(\n    process.env['DEPLOYED_ENV_TYPE'] || useClientEnvVarsStore.getState().envVarsObject['DEPLOYED_ENV_TYPE'] || ''\n  );\n};\n\nexport const doLogging = () => {\n  return (\n    getDeployedEnvType() === 'lower' ||\n    APOLLOGRAPHQL_PUBLIC_DEBUG_LOG === 'true' ||\n    process.env['APOLLOGRAPHQL_PUBLIC_DEBUG_LOG'] === 'true' ||\n    useClientEnvVarsStore.getState().envVarsObject['APOLLOGRAPHQL_PUBLIC_DEBUG_LOG'] === 'true'\n  );\n};\n\n/**\n * Extremely small logger utility.\n *\n * Logs according to env variable APOLLOGRAPHQL_PUBLIC_FORCE_DEBUG_LOG.\n *\n * @param msg\n * @param msgType\n * @param deployedEnvType\n */\nexport const debugPreamble = '[mi-apollo-client-utils log]: ';\nexport const doDebugLog = (msg: string, msgType: LogType) => {\n  if (doLogging()) {\n    if (msgType === 'log') {\n      console.log(debugPreamble, msg);\n    }\n    if (msgType === 'error') {\n      console.error(debugPreamble, msg);\n    }\n    if (msgType === 'warn') {\n      console.warn(debugPreamble, msg);\n    }\n    if (msgType === 'info') {\n      console.info(debugPreamble, msg);\n    }\n    if (msgType === 'debug') {\n      console.debug(debugPreamble, msg);\n    }\n  }\n};\n\n/**\n * Constructs UXL endpoint.\n *\n * Assumptions:\n *  - Client-side from localhost for local dev, hit UXL endpoint directly.\n *  - SSR, hit full NGINX endpoint, NGINX attaches credentials.\n *  - Client-side from deployed environment:\n *    - Lower environments: /query\n *    - Higher environments: /mi/query\n *\n * @param operationName\n * @returns\n */\nexport const useGetUxlEndpoint = (operationName: string, envVars: ApolloEnvVars) => {\n  doDebugLog(\n    `useGetUxlEndpoint: isServer: ${isServer}, isLocalDev: ${isLocalDev}, isLocalClientSide: ${isLocalClientSide}, isDeployedClientSide: ${isDeployedClientSide}`,\n    'info'\n  );\n\n  // TODO: grab everything from envVars directly, remove all this fallback logic\n  const envVarsFromStore = useClientEnvVarsStore.getState().envVarsObject;\n  const fullNginxEndpoint = envVars?.APOLLOGRAPHQL_FULL_NGINX_ENDPOINT ?? getEnvFullNginxEndpoint();\n  const isPublicLocalDev = envVars?.APOLLOGRAPHQL_PUBLIC_LOCAL_DEV ?? getEnvPublicLocalDev();\n  const publicLowerEnvPath = envVars?.APOLLOGRAPHQL_PUBLIC_LOWER_ENV_PATH ?? getEnvPublicLowerEnvPath();\n  const publicHigherEnvPath = envVars?.APOLLOGRAPHQL_PUBLIC_HIGHER_ENV_PATH ?? getEnvPublicHigherEnvPath();\n\n  // We need custom endpoint for client-side localhost calls (but not server-side local dev calls).\n  let endpoint = '';\n\n  // Server-side, return full NGINX endpoint.\n  if (isServer || isPreview) {\n    if (!fullNginxEndpoint) {\n      doDebugLog(\n        '🚨 Unable to construct UXL endpoint. Environment variable APOLLOGRAPHQL_FULL_NGINX_ENDPOINT not provided.',\n        'error'\n      );\n      return;\n    } else {\n      endpoint = fullNginxEndpoint;\n    }\n  }\n\n  // Localhost client-side, hit UXL endpoint directly.\n  const localEndpoint =\n    envVars?.APOLLOGRAPHQL_LOCAL_ENDPOINT ||\n    process.env['APOLLOGRAPHQL_LOCAL_ENDPOINT'] ||\n    envVarsFromStore['APOLLOGRAPHQL_LOCAL_ENDPOINT'];\n  if (isLocalClientSide && !isPreview) {\n    if (!localEndpoint) {\n      doDebugLog(\n        '🚨 Unable to construct UXL endpoint for local client side dev. Environment variable APOLLOGRAPHQL_LOCAL_ENDPOINT not provided.',\n        'error'\n      );\n      return;\n    } else {\n      endpoint = localEndpoint;\n    }\n  }\n  //Localhost client-side AEM preview mode check\n  if (isLocalClientSide && isPreview) {\n    if (!localEndpoint) {\n      doDebugLog(\n        '🚨 Unable to construct UXL endpoint for local client side dev. Environment variable APOLLOGRAPHQL_LOCAL_ENDPOINT not provided.',\n        'error'\n      );\n      return;\n    } else {\n      endpoint = fullNginxEndpoint;\n    }\n  }\n  if (!isServer && isPublicLocalDev !== 'true' && !isPreview) {\n    // For lower environment, use lower env path.\n    // eslint-disable-next-line react-hooks/rules-of-hooks\n    const isLowerEnv = envVars.DEPLOYED_ENV_TYPE === 'lower';\n    if (isLowerEnv) {\n      if (!publicLowerEnvPath) {\n        doDebugLog(\n          '🚨 Unable to construct UXL endpoint for local client side dev. Environment variable APOLLOGRAPHQL_PUBLIC_LOWER_ENV_PATH not provided.',\n          'error'\n        );\n      } else {\n        endpoint = publicLowerEnvPath;\n      }\n    } else {\n      // For higher env, use higher env path.\n      if (!publicHigherEnvPath) {\n        doDebugLog(\n          '🚨 Unable to construct UXL endpoint for local client side dev. Environment variable APOLLOGRAPHQL_PUBLIC_HIGHER_ENV_PATH not provided.',\n          'error'\n        );\n      } else {\n        endpoint = publicHigherEnvPath;\n      }\n    }\n  }\n\n  if (!operationName) {\n    doDebugLog('🚨 Unable to construct UXL endpoint. operationName not provided.', 'error');\n    return;\n  }\n\n  doDebugLog(`useGetUxlEndpoint endpoint: ${endpoint}, operationName: ${operationName}`, 'info');\n\n  return `${endpoint}/${operationName}`;\n};\n\n// Returns operation signature from an array of OperationSignature objects.\nexport const useGetOperationSignature = (operationName: string, operationSignatures: OperationSignature[]) => {\n  const signature =\n    operationSignatures?.find((el: OperationSignature) => el.operationName === operationName)?.signature ?? '';\n  // eslint-disable-next-line no-extra-boolean-cast\n  if (!Boolean(signature)) {\n    doDebugLog(\n      `🚨 useGetOperationSignatures: Signature for operationName ${operationName} not found. Have you added this signature to your operationSignatures constants object?`,\n      'error'\n    );\n    return '';\n  }\n  return signature;\n};\n\nexport const validateOperationSignatures = (operationSignatures: OperationSignature[]) => {\n  const opSigNames = operationSignatures?.map((item: OperationSignature) => {\n    return item.operationName;\n  });\n  const opSigHashes = operationSignatures?.map((item: OperationSignature) => {\n    return item.signature;\n  });\n  // Check for duplicate operation names\n  const opSigNamesHasDuplicates = opSigNames?.length !== new Set(opSigNames).size;\n  // Check for duplicate signatures\n  const opSigHashesHasDuplicates = opSigHashes?.length !== new Set(opSigHashes).size;\n  if (opSigNamesHasDuplicates || opSigHashesHasDuplicates) {\n    if (opSigNamesHasDuplicates) {\n      doDebugLog(\n        '🚨 You have duplicate operation signature names!! Please check your operation signatures file.',\n        'error'\n      );\n    }\n    if (opSigHashesHasDuplicates) {\n      doDebugLog('🚨 You have duplicate operation signatures!! Please check your operation signatures file.', 'error');\n    }\n    return false;\n  }\n  return true;\n};\n\nexport const validateHeaders = (headers: Partial<UXLHttpHeaders>) => {\n  const validHeaders: Record<string, UXLHttpHeader> = {};\n  // For all keys in headers object...\n  for (const key in headers) {\n    // ... if not an empty string,\n    // copy over key and value.\n    if (headers[key] && String(headers[key])?.replace(/\\s+/g, '').length > 0) {\n      validHeaders[key] = headers[key] as UXLHttpHeader;\n    }\n  }\n  doDebugLog(`validateHeaders: ${JSON.stringify(validHeaders)}`, 'info');\n  return validHeaders;\n};\n\nexport const isEmptyObject = (obj: Record<string, unknown>): boolean => {\n  return Object.keys(obj).length === 0;\n};\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport {\n  ApolloClient,\n  InMemoryCache,\n  createHttpLink,\n  from,\n  ApolloLink,\n  NormalizedCacheObject,\n  ApolloCache,\n} from '@apollo/client';\nimport { setContext } from '@apollo/client/link/context';\nimport { onError } from '@apollo/client/link/error';\nimport { useClientEnvVarsStore } from '@marriott/mi-store-utils';\nimport { inspect } from 'util';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport {\n  useGetOperationSignature,\n  useGetUxlEndpoint,\n  isServer,\n  isLocalClientSide,\n  normalizeDeployedEnvType,\n  doDebugLog,\n  validateHeaders,\n  isEmptyObject,\n} from './hooks';\nimport { OperationSignature, DeployedEnvType, UXLHttpHeaders, NonEmptyString, ApolloEnvVars } from '../apollo/types';\n\n//VoidCache will replace InMemorycache methods with dummy data to avoid reading and writing operations on apollo client cache, Which will reduce TBT and improve performance.\nconst emptyCacheObj = {};\nexport class VoidCache extends ApolloCache<NormalizedCacheObject> {\n  read() {\n    return null;\n  }\n  write() {\n    return undefined;\n  }\n  diff() {\n    return {};\n  }\n  watch() {\n    return () => {\n      return null;\n    };\n  } // eslint-disable-line\n  evict() {\n    return false;\n  }\n  restore() {\n    return this;\n  }\n  reset: () => Promise<void> = async () => {\n    console.log('reset');\n  };\n  extract() {\n    return emptyCacheObj;\n  }\n  removeOptimistic() {\n    return null;\n  }\n  performTransaction() {\n    return;\n  }\n}\n\nconst miErrorLink = () => {\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  return onError(({ graphQLErrors, networkError }: any) => {\n    if (graphQLErrors)\n      graphQLErrors.forEach(({ message, locations, path }: any) =>\n        doDebugLog(`Message: ${message}, Location: ${locations}, Path: ${path}`, 'error')\n      );\n\n    if (networkError) doDebugLog(`[Network error]: ${networkError}`, 'error');\n  });\n};\n\nexport const miResHeaderLink = () => {\n  return new ApolloLink((operation, forward) => {\n    const headers = operation.getContext()['headers'] || {};\n    const isSessionStorageAvailable = typeof sessionStorage !== 'undefined';\n    const osdFlag = headers?.['osdFlag'];\n    const updatedHeaders = { ...headers };\n\n    let isAuthenticated = false;\n    let xRequestedByOsd = null;\n\n    // Only execute session-related logic if operationName is in operationArr\n    if (osdFlag) {\n      // getWindowSession is calculated only when condition matches\n      const canUseDOM = !!(typeof window !== 'undefined' && window.document);\n      const sessionObject =\n        typeof window !== 'undefined' && canUseDOM\n          ? (window as Record<string, any>)['sessionDataClient'] ?? (window as Record<string, any>)['sessionData'] ?? {}\n          : {};\n      isAuthenticated = sessionObject?.authenticated;\n      xRequestedByOsd = isSessionStorageAvailable ? sessionStorage.getItem('xRequestedByOsd') : null;\n\n      // Remove 'xRequestedByOsd' if authenticated\n      if (isSessionStorageAvailable && isAuthenticated && xRequestedByOsd) {\n        sessionStorage.removeItem('xRequestedByOsd');\n      }\n\n      // Set 'x-requested-by-osd' header if applicable\n      if (!isAuthenticated && xRequestedByOsd) {\n        updatedHeaders['x-requested-by-osd'] = xRequestedByOsd;\n      }\n    }\n\n    // Ensure 'Uxl-Migration-Status' is set when applicable\n    const migrationStatus = isSessionStorageAvailable ? sessionStorage.getItem('uxlMigrationStatus') : null;\n    if (migrationStatus && !headers['Uxl-Migration-Status']) {\n      updatedHeaders['Uxl-Migration-Status'] = migrationStatus;\n    }\n\n    // Apply updated headers only if they have changed\n    if (Object.keys(updatedHeaders).length !== Object.keys(headers).length) {\n      operation.setContext({ headers: updatedHeaders });\n    }\n\n    return forward(operation).map(data => {\n      const { response: httpResponse } = operation.getContext();\n\n      // Store new headers in sessionStorage if received\n      if (isSessionStorageAvailable && httpResponse?.headers) {\n        for (const [key, value] of httpResponse.headers.entries()) {\n          if (key.toLowerCase() === 'uxl-migration-status') {\n            sessionStorage.setItem('uxlMigrationStatus', value);\n            doDebugLog('uxl-migration-status header received: ', value);\n          }\n        }\n      }\n\n      return data;\n    });\n  });\n};\nexport const miConsoleLink = () => {\n  return new ApolloLink((operation, forward) => {\n    doDebugLog(`Operation Name ${operation.operationName}, ${JSON.stringify(operation)}`, 'info');\n    return forward(operation).map(data => {\n      doDebugLog(`Response Data ${inspect(inspect(operation.getContext()))}`, 'info');\n      return data;\n    });\n  });\n};\n\n// Returns headers to the context so httpLink can read them.\n// Reads operation signature in from an imported json file.\nexport const getAuthLink = (operationSignatures: OperationSignature[], envVars: ApolloEnvVars) => {\n  // eslint-disable-next-line react-hooks/rules-of-hooks\n  const isLowerEnv = envVars?.DEPLOYED_ENV_TYPE === 'lower';\n  const clientEnvVars = useClientEnvVarsStore.getState().envVarsObject;\n\n  return setContext((req, { headers }) => {\n    // Construct request headers by combining lib config and query headers.\n    const buildHeaders: UXLHttpHeaders = {\n      // Headers not unique to operation can be set when ApolloClient is initialized.\n      'accept-language': (envVars?.APOLLOGRAPHQL_PUBLIC_ACCEPT_LANG ||\n        process.env['APOLLOGRAPHQL_PUBLIC_ACCEPT_LANG'] ||\n        clientEnvVars['APOLLOGRAPHQL_PUBLIC_ACCEPT_LANG']) as NonEmptyString,\n      'apollographql-client-name': (envVars?.APOLLOGRAPHQL_PUBLIC_CLIENT_NAME ||\n        process.env['APOLLOGRAPHQL_PUBLIC_CLIENT_NAME'] ||\n        clientEnvVars['APOLLOGRAPHQL_PUBLIC_CLIENT_NAME']) as NonEmptyString,\n      'apollographql-client-version': (envVars?.APOLLOGRAPHQL_PUBLIC_CLIENT_VERSION ||\n        process.env['APOLLOGRAPHQL_PUBLIC_CLIENT_VERSION'] ||\n        clientEnvVars['APOLLOGRAPHQL_PUBLIC_CLIENT_VERSION']) as NonEmptyString,\n      // If a request ID is passed on the query context headers node, use that.\n      // Otherwise generate one.\n      'x-request-id':\n        headers['x-request-id'] ??\n        `${\n          envVars?.APOLLOGRAPHQL_PUBLIC_CLIENT_NAME ||\n          process.env['APOLLOGRAPHQL_PUBLIC_CLIENT_NAME'] ||\n          clientEnvVars['APOLLOGRAPHQL_PUBLIC_CLIENT_NAME']\n        }-${uuidv4()}`,\n      // Validate headers object by removing any values with empty strings.\n      // Headers passed on the query take precedence over default values.\n      ...(!isEmptyObject(headers) && validateHeaders(headers)),\n    };\n    doDebugLog(`buildHeaders: ${JSON.stringify(buildHeaders)}`, 'info');\n\n    // If application name provided in process.env, add to headers.\n    const hasApplicationName =\n      (envVars?.APOLLOGRAPHQL_PUBLIC_APPLICATION_NAME &&\n        envVars?.APOLLOGRAPHQL_PUBLIC_APPLICATION_NAME.trim().length > 0) ||\n      (process.env['APOLLOGRAPHQL_PUBLIC_APPLICATION_NAME'] &&\n        process.env['APOLLOGRAPHQL_PUBLIC_APPLICATION_NAME'].trim().length > 0) ||\n      clientEnvVars['APOLLOGRAPHQL_PUBLIC_APPLICATION_NAME'].trim().length > 0;\n    if (hasApplicationName) {\n      buildHeaders['application-name'] = (envVars?.APOLLOGRAPHQL_PUBLIC_APPLICATION_NAME ||\n        process.env['APOLLOGRAPHQL_PUBLIC_APPLICATION_NAME'] ||\n        clientEnvVars['APOLLOGRAPHQL_PUBLIC_APPLICATION_NAME']) as NonEmptyString;\n    }\n\n    // Disabled by default for dev and testing \"lower environments\".\n    // Can also be enabled via environment variable.\n    const requireSafelisting =\n      !isLowerEnv ||\n      envVars?.APOLLOGRAPHQL_PUBLIC_REQUIRE_SAFELISTING === 'true' ||\n      process.env['APOLLOGRAPHQL_PUBLIC_REQUIRE_SAFELISTING'] === 'true' ||\n      clientEnvVars['APOLLOGRAPHQL_PUBLIC_REQUIRE_SAFELISTING'] === 'true';\n    if (requireSafelisting) {\n      buildHeaders['graphql-require-safelisting'] = 'true' as NonEmptyString;\n      buildHeaders['graphql-operation-signature'] = useGetOperationSignature(\n        `${req.operationName}`,\n        operationSignatures\n      ) as NonEmptyString;\n    }\n    // Different endpoints and auth are used during local dev\n    // because of cors issues with NGINX endpoints.\n    if (isLocalClientSide || isServer) {\n      buildHeaders['Authorization'] = ((buildHeaders['Authorization'] ? buildHeaders['Authorization'] + ',' : '') +\n        `Basic ${\n          envVars?.APOLLOGRAPHQL_AUTH_TOKEN ||\n          process.env['APOLLOGRAPHQL_AUTH_TOKEN'] ||\n          clientEnvVars['APOLLOGRAPHQL_AUTH_TOKEN']\n        }`) as NonEmptyString;\n    }\n    return {\n      headers: buildHeaders,\n    };\n  });\n};\n\nexport const getAdditiveLink = (operationSignatures: OperationSignature[], envVars: ApolloEnvVars) => {\n  return from([\n    getAuthLink(operationSignatures, envVars),\n    miErrorLink(),\n    miConsoleLink(),\n    miResHeaderLink(),\n    createHttpLink({\n      uri: ({ operationName }): any => {\n        // eslint-disable-next-line react-hooks/rules-of-hooks\n        return useGetUxlEndpoint(operationName, envVars);\n      },\n    }),\n  ]);\n};\n\nexport const MiApolloClient = (operationSignatures: OperationSignature[], deployedEnvType: string) => {\n  const normalizedEnvType = normalizeDeployedEnvType(deployedEnvType);\n  return new ApolloClient({\n    ssrMode: isServer,\n    // TODO: Populate client-side cache with initial state passed from SSR Apollo instance if provided.\n    // cache: windowApolloState ? new InMemoryCache().restore(windowApolloState) : new InMemoryCache(),\n    cache: new InMemoryCache(),\n    link: getAdditiveLink(operationSignatures, { DEPLOYED_ENV_TYPE: normalizedEnvType }),\n  });\n};\n\n/**\n * Returns ApolloClient instance\n * @param operationSignatures Your array of operation signature objects, provided by UXL team.\n * @param deployedEnvType \"higher\" or \"lower\" based on deployed environment type.\n * @param inMemoryCacheConfig Any additional configuration for inMemoryCache: https://www.apollographql.com/docs/react/caching/cache-configuration/\n * @param initialState Initial state from SSR render, if provided.\n * @param envVars ApolloEnvVars object containing the client config values\n * @returns\n */\nexport const NextMiApolloClient = (\n  operationSignatures: OperationSignature[],\n  deployedEnvType: string, // TODO: require an ApolloEnvVars object, remove this\n  inMemoryCacheConfig = {},\n  initialState = {},\n  envVars?: ApolloEnvVars\n) => {\n  const normalizedEnvType: DeployedEnvType = normalizeDeployedEnvType(envVars?.DEPLOYED_ENV_TYPE || deployedEnvType);\n\n  doDebugLog(\n    `NextMiApolloClient: deployedEnvType: ${deployedEnvType}, normalizeDeployedEnvType: ${normalizedEnvType}, initialState: ${JSON.stringify(\n      initialState\n    )}, envVars: ${JSON.stringify(envVars)}`,\n    'log'\n  );\n\n  return new ApolloClient({\n    ssrMode: isServer,\n    cache: new InMemoryCache({ ...inMemoryCacheConfig }).restore(initialState),\n    link: getAdditiveLink(operationSignatures, { DEPLOYED_ENV_TYPE: normalizedEnvType, ...envVars }), // TODO: just pass envVars\n  });\n};\n\n/**\n * This method can be used by apps, where apollo caching is not required.\n * This function will disable the in-memory caching feature of the Apollo client.\n * Returns ApolloClient instance\n * @param operationSignatures Your array of operation signature objects, provided by UXL team.\n * @param deployedEnvType \"higher\" or \"lower\" based on deployed environment type.\n * @param initialState Initial state from SSR render, if provided.\n * @returns\n */\nexport const NextMiApolloClientWithoutCache = (\n  operationSignatures: OperationSignature[],\n  deployedEnvType: string, // TODO: require an ApolloEnvVars object, remove this\n  initialState = {}\n) => {\n  const normalizedEnvType: DeployedEnvType = normalizeDeployedEnvType(deployedEnvType);\n  doDebugLog(\n    `NextMiApolloClient: deployedEnvType: ${deployedEnvType}, normalizeDeployedEnvType: ${normalizedEnvType}, initialState: ${JSON.stringify(\n      initialState\n    )}`,\n    'log'\n  );\n\n  return new ApolloClient({\n    ssrMode: isServer,\n    cache: new VoidCache(), //new InMemoryCache({ ...inMemoryCacheConfig }).restore(initialState),\n    link: getAdditiveLink(operationSignatures, { DEPLOYED_ENV_TYPE: normalizedEnvType }),\n  });\n};\n\n// For use in non-SSR react contexts.\nexport const useMiApolloClient = MiApolloClient;\n// Non-hook, for use SSR side in utils like getServerSideProps.\nexport const getMiApolloClient = MiApolloClient;\n\n// For use with Next, React hook version.\nexport const useNextMiApolloClient = NextMiApolloClient;\n// Non-hook, for use SSR side in utils like getServerSideProps.\nexport const getNextMiApolloClient = NextMiApolloClient;\n\n// For use with Next, React hook version, without cache.\nexport const useNextMiApolloClientWithoutCache = NextMiApolloClientWithoutCache;\n","import Head from 'next/head';\nimport React, { ReactElement, useMemo } from 'react';\n\nexport const siteTitle = 'Marriott';\n\nexport function Layout({\n  children,\n  title,\n  metaNames,\n  metaProps,\n  staticComponentClientLibsCSS,\n  staticComponentClientLibsJS,\n  gridCss,\n  isAuthorMode,\n  canonical = '',\n  USE_MOCK_MODEL = false,\n  hreflangList = [],\n  mainID = '',\n}: {\n  children?: ReactElement | Array<ReactElement>;\n  title?: string;\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  metaNames: Array<any>;\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  metaProps?: Array<any>;\n  staticComponentClientLibsCSS?: string;\n  staticComponentClientLibsJS?: string;\n  gridCss?: string;\n  isAuthorMode?: boolean;\n  canonical?: string;\n  USE_MOCK_MODEL?: boolean;\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  hreflangList?: Array<any>;\n  mainID?: string;\n}) {\n  const generateClientLibsHost = useMemo(() => {\n    if (String(process.env['IS_LOCAL_DEV']) === 'true' && !isAuthorMode && !USE_MOCK_MODEL) {\n      return process.env['NEXT_PUBLIC_AEM_HOST'];\n    } else {\n      return '';\n    }\n  }, []);\n\n  return (\n    <>\n      <Head>\n        <meta charSet=\"UTF-8\" />\n        <link rel=\"icon\" href=\"/favicon.ico\" />\n        <title>{title}</title>\n        {metaNames?.map(metaName => (\n          <meta key={metaName.name} name={metaName.name} content={metaName.value}></meta>\n        ))}\n        {metaProps?.map(metaProperty => (\n          <meta key={metaProperty.name} property={metaProperty.name} content={metaProperty.value}></meta>\n        ))}\n        <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n        {canonical && <link rel=\"canonical\" href={canonical} />}\n        <link rel=\"preload\" href={`${generateClientLibsHost}${staticComponentClientLibsCSS}`} as=\"style\" />\n        <link rel=\"stylesheet\" href={`${generateClientLibsHost}${staticComponentClientLibsCSS}`} />\n        <link rel=\"stylesheet\" href={`${generateClientLibsHost}${gridCss}`} />\n        {hreflangList?.map((item, index) => (\n          <link rel=\"alternate\" href={item?.href} hrefLang={item?.hreflang} key={`href-lang-list-${index}`} />\n        ))}\n      </Head>\n      <main id={mainID}>{children}</main>\n      {staticComponentClientLibsJS && (\n        <script src={`${generateClientLibsHost}${staticComponentClientLibsJS}`} defer></script>\n      )}\n    </>\n  );\n}\n"],"names":["APOLLOGRAPHQL_FULL_NGINX_ENDPOINT","process","APOLLOGRAPHQL_PUBLIC_LOCAL_DEV","APOLLOGRAPHQL_PUBLIC_LOWER_ENV_PATH","APOLLOGRAPHQL_PUBLIC_HIGHER_ENV_PATH","APOLLOGRAPHQL_ACTIVE_IN_AEM_PREVIEW","APOLLOGRAPHQL_PUBLIC_DEBUG_LOG","getEnvFullNginxEndpoint","useClientEnvVarsStore","getState","envVarsObject","window","document","isLocalDev","getEnvPublicLocalDev","isLocalClientSide","isServer","isDeployedClientSide","isPreviewMode","pathName","location","href","paramWcmMode","includes","split","isPreview","getActiveInAemPreview","normalizeDeployedEnvType","input","getDeployedEnvType","doLogging","debugPreamble","msg","msgType","console","log","error","warn","info","debug","operationName","envVars","doDebugLog","envVarsFromStore","fullNginxEndpoint","isPublicLocalDev","publicLowerEnvPath","getEnvPublicLowerEnvPath","publicHigherEnvPath","getEnvPublicHigherEnvPath","endpoint","localEndpoint","APOLLOGRAPHQL_LOCAL_ENDPOINT","DEPLOYED_ENV_TYPE","operationSignatures","Boolean","signature","find","el","validHeaders","key","headers","String","replace","length","JSON","stringify","Object","keys","obj","miErrorLink","onError","graphQLErrors","networkError","forEach","message","locations","path","miResHeaderLink","ApolloLink","operation","forward","getContext","isSessionStorageAvailable","sessionStorage","osdFlag","updatedHeaders","isAuthenticated","xRequestedByOsd","sessionObject","canUseDOM","authenticated","getItem","removeItem","migrationStatus","setContext","map","data","response","httpResponse","value","entries","toLowerCase","setItem","miConsoleLink","inspect","getAuthLink","isLowerEnv","clientEnvVars","req","buildHeaders","APOLLOGRAPHQL_PUBLIC_ACCEPT_LANG","APOLLOGRAPHQL_PUBLIC_CLIENT_NAME","APOLLOGRAPHQL_PUBLIC_CLIENT_VERSION","uuidv4","isEmptyObject","validateHeaders","APOLLOGRAPHQL_PUBLIC_APPLICATION_NAME","trim","APOLLOGRAPHQL_PUBLIC_REQUIRE_SAFELISTING","useGetOperationSignature","APOLLOGRAPHQL_AUTH_TOKEN","from","createHttpLink","uri","useGetUxlEndpoint","useNextMiApolloClient","deployedEnvType","inMemoryCacheConfig","NextMiApolloClient","initialState","normalizedEnvType","ApolloClient","ssrMode","cache","InMemoryCache","restore","link","getAdditiveLink","Layout","children","title","metaNames","metaProps","staticComponentClientLibsCSS","staticComponentClientLibsJS","gridCss","isAuthorMode","canonical","USE_MOCK_MODEL","hreflangList","mainID","generateClientLibsHost","useMemo","Head","meta","charSet","rel","metaName","name","content","metaProperty","property","as","item","index","hrefLang","hreflang","main","id","script","src","defer"],"sourceRoot":"","ignoreList":[]}