{"version":3,"file":"IDPContainer.mjs","sources":["../../../../../../../../web/src/ui/b2c/IDPContainer.tsx"],"sourcesContent":["import { logger, RUN_IN_DEV } from '@stytch/core';\nimport { StytchProjectConfigurationInput } from '@stytch/core/public';\nimport React, { useEffect } from 'react';\n\nimport { messages } from '../../messages/en';\nimport { DeprecatedSDKConfig, IDPSDKConfig, StytchLoginConfig } from '../../types';\nimport { readB2CInternals } from '../../utils/internal';\nimport { I18nProviderWrapper } from '../components/atoms/I18nProviderWrapper';\nimport { IDPContextProvider } from '../components/organisms/IDPContextProvider';\nimport { PresentationContext, usePresentationWithDefault } from '../components/PresentationConfig';\nimport { DEFAULT_STATE, GlobalContextProvider } from './GlobalContextProvider';\nimport { IDPConsentScreen } from './screens/IdentityProvider/IDPConsent';\n\nexport const IDPContainer = <TProjectConfiguration extends StytchProjectConfigurationInput>({\n  client,\n  presentation,\n  callbacks,\n  strings,\n  styles,\n  getIDPConsentManifest,\n  authTokenParams,\n}: IDPSDKConfig<TProjectConfiguration> & DeprecatedSDKConfig) => {\n  const presentationValue = usePresentationWithDefault(presentation, false, { products: [] });\n\n  useEffect(() => {\n    readB2CInternals(client)\n      .bootstrap.getAsync()\n      .then((data) => {\n        readB2CInternals(client).networkClient.logEvent({\n          name: 'render_idp_screen',\n          details: { bootstrap: data },\n        });\n      });\n  }, [client]);\n\n  RUN_IN_DEV(() => {\n    if (styles) {\n      logger.error(\n        'styles is deprecated and has no effect. Use the presentation prop instead.\\n' +\n          'See https://stytch.com/docs/api-reference/consumer/frontend-sdks/react/upgrade-guide#step-by-step-guide',\n      );\n    }\n  });\n\n  return (\n    <GlobalContextProvider\n      client={client}\n      config={{} as StytchLoginConfig}\n      callbacks={callbacks}\n      initialState={DEFAULT_STATE}\n    >\n      <IDPContextProvider consentManifestGenerator={getIDPConsentManifest} authTokenParams={authTokenParams}>\n        <PresentationContext.Provider value={presentationValue}>\n          <I18nProviderWrapper messages={messages} overrides={strings}>\n            <IDPConsentScreen />\n          </I18nProviderWrapper>\n        </PresentationContext.Provider>\n      </IDPContextProvider>\n    </GlobalContextProvider>\n  );\n};\n"],"names":["IDPContainer","client","presentation","callbacks","strings","styles","getIDPConsentManifest","authTokenParams","presentationValue","usePresentationWithDefault","products","useEffect","readB2CInternals","bootstrap","getAsync","then","data","networkClient","logEvent","name","details","React","GlobalContextProvider","config","initialState","DEFAULT_STATE","IDPContextProvider","consentManifestGenerator","PresentationContext","Provider","value","I18nProviderWrapper","messages","overrides","IDPConsentScreen"],"mappings":";;;;;;;;;;MAaaA,YAAAA,GAAe,CAAgE,EAC1FC,MAAM,EACNC,YAAY,EACZC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,qBAAqB,EACrBC,eAAe,EAC2C,GAAA;IAC1D,MAAMC,iBAAAA,GAAoBC,0BAAAA,CAA2BP,YAAAA,EAAc,KAAA,EAAO;AAAEQ,QAAAA,QAAAA,EAAU;AAAG,KAAA,CAAA;IAEzFC,CAAAA,CAAU,IAAA;AACRC,QAAAA,gBAAAA,CAAiBX,QACdY,SAAS,CAACC,QAAQ,EAAA,CAClBC,IAAI,CAAC,CAACC,IAAAA,GAAAA;AACLJ,YAAAA,gBAAAA,CAAiBX,MAAAA,CAAAA,CAAQgB,aAAa,CAACC,QAAQ,CAAC;gBAC9CC,IAAAA,EAAM,mBAAA;gBACNC,OAAAA,EAAS;oBAAEP,SAAAA,EAAWG;AAAK;AAC7B,aAAA,CAAA;AACF,QAAA,CAAA,CAAA;KACJ,EAAG;AAACf,QAAAA;AAAO,KAAA,CAAA;AAWX,IAAA,qBACEoB,EAAA,CAAA,aAAA,CAACC,qBAAAA,EAAAA;QACCrB,MAAAA,EAAQA,MAAAA;AACRsB,QAAAA,MAAAA,EAAQ,EAAC;QACTpB,SAAAA,EAAWA,SAAAA;QACXqB,YAAAA,EAAcC;qBAEdJ,EAAA,CAAA,aAAA,CAACK,kBAAAA,EAAAA;QAAmBC,wBAAAA,EAA0BrB,qBAAAA;QAAuBC,eAAAA,EAAiB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