{"version":3,"sources":["../src/react/provider/context.ts"],"sourcesContent":["\"use client\"\n\nimport { createContext, useContext } from \"react\"\nimport type { ContentstackRegion } from \"../../index.js\"\n\nexport interface ContentstackContextValue {\n  region: ContentstackRegion\n  proxyBasePath: string\n  apiKey?: string\n  organizationUid?: string\n  brandKitUid?: string\n  launchProxyBasePath?: string\n  brandKitProxyBasePath?: string\n  developerHubProxyBasePath?: string\n}\n\nexport const ContentstackContext = createContext<ContentstackContextValue | null>(null)\n\n/**\n * Hook to access the Contentstack context.\n * Throws a clear error if used outside of ContentstackProvider.\n */\nexport function useContentstackContext(): ContentstackContextValue {\n  const ctx = useContext(ContentstackContext)\n  if (!ctx) {\n    throw new Error(\n      \"useContentstackContext must be used within a <ContentstackProvider>. \" +\n        'Wrap your app with <ContentstackProvider region=\"...\" proxyBasePath=\"/api/cma\">.',\n    )\n  }\n  return ctx\n}\n"],"mappings":";AAEA,SAAS,eAAe,kBAAkB;AAcnC,IAAM,sBAAsB,cAA+C,IAAI;AAM/E,SAAS,yBAAmD;AACjE,QAAM,MAAM,WAAW,mBAAmB;AAC1C,MAAI,CAAC,KAAK;AACR,UAAM,IAAI;AAAA,MACR;AAAA,IAEF;AAAA,EACF;AACA,SAAO;AACT;","names":[]}