@phygitallabs/phygital-consent 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1,3 @@
1
+ 'use client'
2
+ "use strict";var N=Object.create;var v=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var Q=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var F=(e,t)=>{for(var n in t)v(e,n,{get:t[n],enumerable:!0})},U=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of T(t))!H.call(e,o)&&o!==n&&v(e,o,{get:()=>t[o],enumerable:!(s=M(t,o))||s.enumerable});return e};var V=(e,t,n)=>(n=e!=null?N(Q(e)):{},U(t||!e||!e.__esModule?v(n,"default",{value:e,enumerable:!0}):n,e)),$=e=>U(v({},"__esModule",{value:!0}),e);var se={};F(se,{COOKIE_CONSENT_NAME:()=>P,CookieConsentBanner:()=>ne,EntityStatus:()=>B,MediaType:()=>S,PhygitalConsentProvider:()=>z,consentQueryKeys:()=>a,consentService:()=>u,getConsentPreferenceCookie:()=>h,getCookie:()=>O,setConsentPreferenceCookie:()=>b,setCookie:()=>A,useConsentById:()=>J,useCreateDeviceCookieConsent:()=>D,useCreateUserConsent:()=>ee,useHealth:()=>j,useLatestConsentByUserId:()=>X,useLatestCookieConsentByDeviceId:()=>Z,useManyConsents:()=>Y,usePhygitalConsent:()=>W});module.exports=$(se);var S=(n=>(n.IMAGE="image",n.VIDEO="video",n))(S||{}),B=(n=>(n.ACTIVE="Active",n.INACTIVE="Inactive",n))(B||{});var p=require("react");var P="phygital_cookie_consent";function O(e){if(typeof document>"u")return null;let t=document.cookie.match(new RegExp("(?:^|; )"+encodeURIComponent(e)+"=([^;]*)"));return t?decodeURIComponent(t[1]):null}function A(e,t,n={}){if(typeof document>"u")return;let{maxAge:s=31536e3,path:o="/",sameSite:r="Lax",secure:c=!1}=n,d=`${encodeURIComponent(e)}=${encodeURIComponent(t)}; path=${o}; max-age=${s}; SameSite=${r}`;c&&(d+="; Secure"),document.cookie=d}function h(){let e=O(P);if(!e)return null;try{let t=JSON.parse(e);if(t&&typeof t=="object"&&"deviceId"in t&&"selected_preferences"in t&&typeof t.deviceId=="string"&&Array.isArray(t.selected_preferences))return t}catch{}return null}function b(e,t,n){A(P,JSON.stringify({deviceId:e,selected_preferences:t}),{maxAge:31536e3,path:"/",sameSite:"Lax",...n})}var x=require("@tanstack/react-query"),G=V(require("axios")),m=require("react"),k=require("react/jsx-runtime"),w=(0,m.createContext)(void 0),K=({baseURL:e="",axiosConfig:t={},requestInterceptors:n={},responseInterceptors:s={}})=>{let o=G.default.create({baseURL:e,...t});return o.interceptors.request.use(n.onFulfilled,n.onRejected),o.interceptors.response.use(s.onFulfilled,s.onRejected),{consentApi:o,updateHeaders:c=>{Object.entries(c).forEach(([d,g])=>{o.defaults.headers.common[d]=g})}}},E=({children:e,baseURL:t="",axiosConfig:n={},queryClient:s,queryClientConfig:o={},requestInterceptors:r={},responseInterceptors:c={}})=>{let d=(0,m.useMemo)(()=>s||new x.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!1,...o?.defaultOptions?.queries},mutations:{...o?.defaultOptions?.mutations}},queryCache:o?.queryCache,mutationCache:o?.mutationCache}),[s]),g=(0,m.useMemo)(()=>{let R=K({baseURL:t,axiosConfig:n,requestInterceptors:r,responseInterceptors:c});return{consentApi:R.consentApi,updateHeaders:R.updateHeaders,queryClient:d}},[t,d,n,r,c]);return(0,k.jsx)(w.Provider,{value:g,children:(0,k.jsx)(x.QueryClientProvider,{client:d,children:e})})},y=()=>{let e=(0,m.useContext)(w);if(!e)throw new Error("useConsentService must be used within a ConsentServiceProvider");return e};var I=require("react/jsx-runtime"),L=(0,p.createContext)(void 0);function z(e){let{children:t,...n}=e,[s,o]=(0,p.useState)(!1),r=(0,p.useCallback)(()=>{let d=h();o(!!d)},[]);(0,p.useEffect)(()=>{r()},[r]);let c={hasConsentPreference:s,refreshConsentPreference:r};return(0,I.jsx)(E,{...n,children:(0,I.jsx)(L.Provider,{value:c,children:t})})}function W(){let e=(0,p.useContext)(L);if(!e)throw new Error("usePhygitalConsent must be used within a PhygitalConsentProvider");return e}var f="/consent/v1",u=e=>({getHealth:async()=>{let{data:t}=await e.get("/health");return t},getManyConsents:async t=>{let{data:n}=await e.get(`${f}/consent`,{params:t?{type:t.type}:void 0});return n},getConsentById:async({id:t})=>{let{data:n}=await e.get(`${f}/consent/${t}`);return n},getLatestConsentByUserId:async({user_id:t})=>{let{data:n}=await e.get(`${f}/user-id`,{params:{user_id:t}});return n},createUserConsent:async t=>{let{data:n}=await e.post(`${f}/user-id`,t);return n},getLatestCookieConsentByDeviceId:async({device_id:t})=>{let{data:n}=await e.get(`${f}/cookies/device-id`,{params:{device_id:t}});return n},createDeviceCookieConsent:async t=>{let{data:n}=await e.post(`${f}/cookies/device-id`,t);return n}});var C=require("@tanstack/react-query");var a={all:["consent"],health:()=>[...a.all,"health"],list:e=>[...a.all,"list",e],detail:e=>[...a.all,"detail",e],latestByUserId:e=>[...a.all,"user-id",e],latestCookieByDeviceId:e=>[...a.all,"cookies","device-id",e]},j=e=>{let{consentApi:t}=y(),n=u(t);return(0,C.useQuery)({queryKey:a.health(),queryFn:()=>n.getHealth(),...e})},Y=(e,t)=>{let{consentApi:n}=y(),s=u(n);return(0,C.useQuery)({queryKey:a.list(e),queryFn:()=>s.getManyConsents(e),...t})},J=(e,t)=>{let{consentApi:n}=y(),s=u(n);return(0,C.useQuery)({queryKey:a.detail(e.id),queryFn:()=>s.getConsentById(e),enabled:!!e.id,...t})},X=(e,t)=>{let{consentApi:n}=y(),s=u(n);return(0,C.useQuery)({queryKey:a.latestByUserId(e.user_id),queryFn:()=>s.getLatestConsentByUserId(e),enabled:!!e.user_id,...t})},Z=(e,t)=>{let{consentApi:n}=y(),s=u(n);return(0,C.useQuery)({queryKey:a.latestCookieByDeviceId(e.device_id),queryFn:()=>s.getLatestCookieConsentByDeviceId(e),enabled:!!e.device_id,...t})},ee=e=>{let{consentApi:t}=y(),n=(0,C.useQueryClient)(),s=u(t);return(0,C.useMutation)({mutationFn:o=>s.createUserConsent(o),onSuccess:(o,r)=>{r.user_id&&n.invalidateQueries({queryKey:a.latestByUserId(r.user_id)}),n.invalidateQueries({queryKey:a.list()})},...e})},D=e=>{let{consentApi:t}=y(),n=(0,C.useQueryClient)(),s=u(t);return(0,C.useMutation)({mutationFn:o=>s.createDeviceCookieConsent(o),onSuccess:(o,r)=>{n.invalidateQueries({queryKey:a.latestCookieByDeviceId(r.device_id)}),n.invalidateQueries({queryKey:a.list()})},...e})};var _=require("react");var i=require("react/jsx-runtime"),te=["essential","analytics","advertising"],l={title:"Cookie preferences",description:"We use cookies to improve your experience, remember your settings, and understand how you use our site. You can accept all, or reject non-essential cookies.",essentialLabel:"Essential",essentialDesc:"Required for the site to work (e.g. security, preferences).",analyticsLabel:"Analytics",analyticsDesc:"Help us improve by collecting anonymous usage data.",advertisingLabel:"Advertising",advertisingDesc:"Used to show you relevant ads and measure campaigns."};function ne({deviceId:e,onSubmitted:t,onDismiss:n,className:s=""}){let[o,r]=(0,_.useState)(!1),c=D({onSuccess:(R,q)=>{b(e,q.selected_preferences??[]),t?.(),n?.(),r(!0)}}),d=()=>{c.mutate({device_id:e,status:"REJECTED",selected_preferences:["essential"]})},g=()=>{c.mutate({device_id:e,status:"ACCEPTED",selected_preferences:[...te]})};return o?null:(0,i.jsxs)("div",{role:"dialog","aria-label":l.title,className:`consent:fixed consent:bottom-0 consent:left-0 consent:right-0 consent:z-50 consent:flex consent:flex-col consent:gap-4 consent:rounded-t-xl consent:border consent:border-b-0 consent:border-gray-200 consent:bg-white consent:p-4 consent:shadow-lg consent:md:left-4 consent:md:right-auto consent:md:bottom-4 consent:md:max-w-md consent:md:rounded-xl consent:md:border consent:md:border-gray-200 ${s}`,style:{position:"fixed",bottom:0,left:0,right:0,zIndex:50,display:"flex",flexDirection:"column",gap:"1rem",borderRadius:"0.75rem 0.75rem 0 0",borderWidth:"1px 1px 0 1px",borderColor:"#e5e7eb",backgroundColor:"#fff",padding:"1rem",boxShadow:"0 -4px 6px -1px rgb(0 0 0 / 0.1)"},children:[(0,i.jsx)("h2",{className:"consent:text-lg consent:font-semibold consent:text-gray-900",style:{fontSize:"1.125rem",fontWeight:600,color:"#111827"},children:l.title}),(0,i.jsx)("p",{className:"consent:text-sm consent:text-gray-600",style:{fontSize:"0.875rem",color:"#4b5563"},children:l.description}),(0,i.jsxs)("ul",{className:"consent:text-sm consent:text-gray-600 consent:space-y-2",style:{fontSize:"0.875rem",color:"#4b5563",margin:0,paddingLeft:"1.25rem"},children:[(0,i.jsxs)("li",{children:[(0,i.jsx)("strong",{children:l.essentialLabel})," \u2014 ",l.essentialDesc]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("strong",{children:l.analyticsLabel})," \u2014 ",l.analyticsDesc]}),(0,i.jsxs)("li",{children:[(0,i.jsx)("strong",{children:l.advertisingLabel})," \u2014 ",l.advertisingDesc]})]}),(0,i.jsxs)("div",{className:"consent:flex consent:flex-wrap consent:gap-2",style:{display:"flex",flexWrap:"wrap",gap:"0.5rem"},children:[(0,i.jsx)("button",{type:"button",onClick:d,disabled:c.isPending,className:"consent:rounded-lg consent:border consent:border-gray-300 consent:bg-white consent:px-4 consent:py-2 consent:text-sm consent:font-medium consent:text-gray-700 consent:shadow-sm hover:consent:bg-gray-50 disabled:consent:opacity-50",style:{borderRadius:"0.5rem",border:"1px solid #d1d5db",background:"#fff",padding:"0.5rem 1rem",fontSize:"0.875rem",fontWeight:500,color:"#374151"},children:"Reject"}),(0,i.jsx)("button",{type:"button",onClick:g,disabled:c.isPending,className:"consent:rounded-lg consent:bg-gray-900 consent:px-4 consent:py-2 consent:text-sm consent:font-medium consent:text-white consent:shadow-sm hover:consent:bg-gray-800 disabled:consent:opacity-50",style:{borderRadius:"0.5rem",background:"#111827",padding:"0.5rem 1rem",fontSize:"0.875rem",fontWeight:500,color:"#fff"},children:"Accept"})]}),c.isError&&(0,i.jsx)("p",{className:"consent:text-sm consent:text-red-600",style:{fontSize:"0.875rem",color:"#dc2626"},children:"Something went wrong. Please try again."})]})}0&&(module.exports={COOKIE_CONSENT_NAME,CookieConsentBanner,EntityStatus,MediaType,PhygitalConsentProvider,consentQueryKeys,consentService,getConsentPreferenceCookie,getCookie,setConsentPreferenceCookie,setCookie,useConsentById,useCreateDeviceCookieConsent,useCreateUserConsent,useHealth,useLatestConsentByUserId,useLatestCookieConsentByDeviceId,useManyConsents,usePhygitalConsent});
3
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../index.ts","../src/types/common.ts","../src/provider/PhygitalConsentProvider.tsx","../src/helpers/cookie.ts","../src/provider/ConsentServiceProvider.tsx","../src/api/consent.ts","../src/hooks/useConsent.ts","../src/components/CookieConsentBanner.tsx"],"sourcesContent":["export * from \"./src\";\n","export enum MediaType {\n IMAGE = \"image\",\n VIDEO = \"video\",\n}\n\nexport type DateTimeNumber = number;\n\nexport interface Media {\n url: string;\n type: MediaType | string;\n thumbnail_url?: string;\n}\n\nexport enum EntityStatus {\n ACTIVE = \"Active\",\n INACTIVE = \"Inactive\",\n}\n\nexport interface CommonModel {\n id: string;\n status: EntityStatus;\n created_at: DateTimeNumber;\n updated_at: DateTimeNumber;\n created_by?: string;\n updated_by?: string;\n}\n","\"use client\";\n\nimport React, { createContext, useCallback, useContext, useEffect, useState } from \"react\";\nimport { getConsentPreferenceCookie } from \"../helpers/cookie\";\nimport { ConsentServiceProvider, ConsentServiceProviderProps } from \"./ConsentServiceProvider\";\n\nexport interface PhygitalConsentContextValue {\n /** True when cookie phygital_cookie_consent exists and has valid deviceId + selected_preferences. Use to show/hide cookie banner. */\n hasConsentPreference: boolean;\n /** Re-read cookie and update hasConsentPreference. Call after storing preference (e.g. from CookieConsentBanner onSuccess). */\n refreshConsentPreference: () => void;\n}\n\nconst PhygitalConsentContext = createContext<PhygitalConsentContextValue | undefined>(undefined);\n\nexport interface PhygitalConsentProviderProps extends ConsentServiceProviderProps {\n children: React.ReactNode;\n}\n\n/**\n * Main provider for consumer apps. Wraps ConsentServiceProvider and exposes\n * hasConsentPreference + refreshConsentPreference so the app can show/hide\n * the cookie banner based on whether the user has already chosen a preference.\n */\nexport function PhygitalConsentProvider(props: PhygitalConsentProviderProps) {\n const { children, ...consentServiceProps } = props;\n const [hasConsentPreference, setHasConsentPreference] = useState(false);\n\n const refreshConsentPreference = useCallback(() => {\n const stored = getConsentPreferenceCookie();\n setHasConsentPreference(!!stored);\n }, []);\n\n useEffect(() => {\n refreshConsentPreference();\n }, [refreshConsentPreference]);\n\n const value: PhygitalConsentContextValue = {\n hasConsentPreference,\n refreshConsentPreference,\n };\n\n return (\n <ConsentServiceProvider {...consentServiceProps}>\n <PhygitalConsentContext.Provider value={value}>\n {children}\n </PhygitalConsentContext.Provider>\n </ConsentServiceProvider>\n );\n}\n\nexport function usePhygitalConsent() {\n const context = useContext(PhygitalConsentContext);\n if (!context) {\n throw new Error(\"usePhygitalConsent must be used within a PhygitalConsentProvider\");\n }\n return context;\n}\n","/**\n * Browser cookie helpers for phygital-consent.\n * Cookie name for consent preference: phygital_cookie_consent.\n * Stored value: { deviceId: string, selected_preferences: string[] } (JSON).\n * Default: 1 year, path /, SameSite Lax.\n */\n\nexport const COOKIE_CONSENT_NAME = \"phygital_cookie_consent\";\n\nconst ONE_YEAR_SECONDS = 365 * 24 * 60 * 60;\n\nexport interface SetCookieOptions {\n maxAge?: number;\n path?: string;\n sameSite?: \"Strict\" | \"Lax\" | \"None\";\n secure?: boolean;\n}\n\n/**\n * Get a cookie value by name.\n */\nexport function getCookie(name: string): string | null {\n if (typeof document === \"undefined\") return null;\n const match = document.cookie.match(new RegExp(\"(?:^|; )\" + encodeURIComponent(name) + \"=([^;]*)\"));\n return match ? decodeURIComponent(match[1]) : null;\n}\n\n/**\n * Set a cookie.\n */\nexport function setCookie(\n name: string,\n value: string,\n options: SetCookieOptions = {}\n): void {\n if (typeof document === \"undefined\") return;\n const {\n maxAge = ONE_YEAR_SECONDS,\n path = \"/\",\n sameSite = \"Lax\",\n secure = false,\n } = options;\n let cookie = `${encodeURIComponent(name)}=${encodeURIComponent(value)}; path=${path}; max-age=${maxAge}; SameSite=${sameSite}`;\n if (secure) cookie += \"; Secure\";\n document.cookie = cookie;\n}\n\nexport interface ConsentPreferenceValue {\n deviceId: string;\n selected_preferences: string[];\n}\n\n/**\n * Read consent preference from cookie. Returns null if missing or invalid.\n */\nexport function getConsentPreferenceCookie(): ConsentPreferenceValue | null {\n const raw = getCookie(COOKIE_CONSENT_NAME);\n if (!raw) return null;\n try {\n const parsed = JSON.parse(raw) as unknown;\n if (\n parsed &&\n typeof parsed === \"object\" &&\n \"deviceId\" in parsed &&\n \"selected_preferences\" in parsed &&\n typeof (parsed as ConsentPreferenceValue).deviceId === \"string\" &&\n Array.isArray((parsed as ConsentPreferenceValue).selected_preferences)\n ) {\n return parsed as ConsentPreferenceValue;\n }\n } catch {\n // ignore\n }\n return null;\n}\n\n/**\n * Store consent preference in cookie (hashed device id + selected_preferences).\n * Uses 1 year max-age and SameSite Lax.\n */\nexport function setConsentPreferenceCookie(\n deviceId: string,\n selected_preferences: string[],\n options?: Partial<SetCookieOptions>\n): void {\n const value: ConsentPreferenceValue = { deviceId, selected_preferences };\n setCookie(COOKIE_CONSENT_NAME, JSON.stringify(value), {\n maxAge: ONE_YEAR_SECONDS,\n path: \"/\",\n sameSite: \"Lax\",\n ...options,\n });\n}\n","\"use client\";\n\nimport { QueryClient, QueryClientConfig, QueryClientProvider } from \"@tanstack/react-query\";\nimport axios, {\n AxiosInstance,\n AxiosRequestConfig,\n AxiosResponse,\n InternalAxiosRequestConfig,\n} from \"axios\";\nimport React, { createContext, useContext, useMemo } from \"react\";\n\nexport interface ConsentService {\n consentApi: AxiosInstance;\n queryClient: QueryClient;\n updateHeaders: (headers: Record<string, string>) => void;\n}\n\nconst ConsentServiceContext = createContext<ConsentService | undefined>(undefined);\n\ninterface RequestInterceptor {\n onFulfilled?: (\n config: InternalAxiosRequestConfig\n ) => InternalAxiosRequestConfig | Promise<InternalAxiosRequestConfig>;\n onRejected?: (error: unknown) => unknown;\n}\n\ninterface ResponseInterceptor {\n onFulfilled?: (\n response: AxiosResponse\n ) => AxiosResponse | Promise<AxiosResponse>;\n onRejected?: (error: unknown) => unknown;\n}\n\nexport interface ConsentServiceProviderProps {\n children: React.ReactNode;\n baseURL?: string;\n axiosConfig?: AxiosRequestConfig;\n queryClient?: QueryClient;\n queryClientConfig?: Partial<QueryClientConfig>;\n requestInterceptors?: RequestInterceptor;\n responseInterceptors?: ResponseInterceptor;\n}\n\ninterface CreateConsentServiceParams {\n baseURL?: string;\n axiosConfig?: AxiosRequestConfig;\n requestInterceptors?: RequestInterceptor;\n responseInterceptors?: ResponseInterceptor;\n}\n\nexport const createConsentService = ({\n baseURL = \"\",\n axiosConfig = {},\n requestInterceptors = {},\n responseInterceptors = {},\n}: CreateConsentServiceParams) => {\n const instance = axios.create({\n baseURL,\n ...axiosConfig,\n });\n\n instance.interceptors.request.use(\n requestInterceptors.onFulfilled,\n requestInterceptors.onRejected\n );\n\n instance.interceptors.response.use(\n responseInterceptors.onFulfilled,\n responseInterceptors.onRejected\n );\n\n const updateHeaders = (headers: Record<string, string>) => {\n Object.entries(headers).forEach(([key, value]) => {\n instance.defaults.headers.common[key] = value;\n });\n };\n\n return {\n consentApi: instance,\n updateHeaders,\n };\n};\n\nexport const ConsentServiceProvider: React.FC<ConsentServiceProviderProps> = ({\n children,\n baseURL = \"\",\n axiosConfig = {},\n queryClient,\n queryClientConfig = {},\n requestInterceptors = {},\n responseInterceptors = {},\n}) => {\n const queryClientInstance = useMemo(\n () =>\n queryClient ||\n new QueryClient({\n defaultOptions: {\n queries: {\n refetchOnWindowFocus: false,\n refetchOnMount: false,\n refetchOnReconnect: false,\n ...queryClientConfig?.defaultOptions?.queries,\n },\n mutations: {\n ...queryClientConfig?.defaultOptions?.mutations,\n },\n },\n queryCache: queryClientConfig?.queryCache,\n mutationCache: queryClientConfig?.mutationCache,\n }),\n [queryClient]\n );\n\n const consentService = useMemo(() => {\n const service = createConsentService({\n baseURL,\n axiosConfig,\n requestInterceptors,\n responseInterceptors,\n });\n\n return {\n consentApi: service.consentApi,\n updateHeaders: service.updateHeaders,\n queryClient: queryClientInstance,\n };\n }, [baseURL, queryClientInstance, axiosConfig, requestInterceptors, responseInterceptors]);\n\n return (\n <ConsentServiceContext.Provider value={consentService}>\n <QueryClientProvider client={queryClientInstance}>\n {children}\n </QueryClientProvider>\n </ConsentServiceContext.Provider>\n );\n};\n\nexport const useConsentService = () => {\n const context = useContext(ConsentServiceContext);\n if (!context) {\n throw new Error(\"useConsentService must be used within a ConsentServiceProvider\");\n }\n return context;\n};\n","import { AxiosInstance } from \"axios\";\nimport type {\n GetManyConsentParams,\n GetManyConsentResponse,\n GetConsentByIdParams,\n GetConsentByIdResponse,\n GetLatestConsentByUserIdParams,\n GetLatestConsentByUserIdResponse,\n GetLatestCookieConsentByDeviceIdParams,\n GetLatestCookieConsentByDeviceIdResponse,\n CreateUserConsentUpsertDTO,\n CreateUserConsentResponse,\n CreateDeviceCookieConsentUpsertDTO,\n CreateDeviceCookieConsentResponse,\n HealthResponse,\n} from \"../types\";\n\nconst CONSENT_V1 = \"/consent/v1\";\n\nexport const consentService = (axiosInstance: AxiosInstance) => {\n return {\n /**\n * Health check – GET /health\n */\n getHealth: async (): Promise<HealthResponse> => {\n const { data } = await axiosInstance.get<HealthResponse>(\"/health\");\n return data;\n },\n\n /**\n * Get all consent logs – GET /consent/v1/consent\n * @param params - Optional filter by policy type (ACCOUNT_REGISTER | COOKIE_PREFERENCE)\n */\n getManyConsents: async (\n params?: GetManyConsentParams\n ): Promise<GetManyConsentResponse> => {\n const { data } = await axiosInstance.get<GetManyConsentResponse>(\n `${CONSENT_V1}/consent`,\n { params: params ? { type: params.type } : undefined }\n );\n return data;\n },\n\n /**\n * Get consent log by ID – GET /consent/v1/consent/{id}\n */\n getConsentById: async ({\n id,\n }: GetConsentByIdParams): Promise<GetConsentByIdResponse> => {\n const { data } = await axiosInstance.get<GetConsentByIdResponse>(\n `${CONSENT_V1}/consent/${id}`\n );\n return data;\n },\n\n /**\n * Get latest consent for a user – GET /consent/v1/user-id?user_id=\n */\n getLatestConsentByUserId: async ({\n user_id,\n }: GetLatestConsentByUserIdParams): Promise<GetLatestConsentByUserIdResponse> => {\n const { data } = await axiosInstance.get<GetLatestConsentByUserIdResponse>(\n `${CONSENT_V1}/user-id`,\n { params: { user_id } }\n );\n return data;\n },\n\n /**\n * Create user consent (account register) – POST /consent/v1/user-id\n * Consumer app must hash user_id/device_id (e.g. SHA-256) before passing.\n */\n createUserConsent: async (\n body: CreateUserConsentUpsertDTO\n ): Promise<CreateUserConsentResponse> => {\n const { data } = await axiosInstance.post<CreateUserConsentResponse>(\n `${CONSENT_V1}/user-id`,\n body\n );\n return data;\n },\n\n /**\n * Get latest cookie consent for a device – GET /consent/v1/cookies/device-id?device_id=\n */\n getLatestCookieConsentByDeviceId: async ({\n device_id,\n }: GetLatestCookieConsentByDeviceIdParams): Promise<GetLatestCookieConsentByDeviceIdResponse> => {\n const { data } =\n await axiosInstance.get<GetLatestCookieConsentByDeviceIdResponse>(\n `${CONSENT_V1}/cookies/device-id`,\n { params: { device_id } }\n );\n return data;\n },\n\n /**\n * Create device cookie consent – POST /consent/v1/cookies/device-id\n * Consumer app must hash device_id (e.g. SHA-256) before passing.\n */\n createDeviceCookieConsent: async (\n body: CreateDeviceCookieConsentUpsertDTO\n ): Promise<CreateDeviceCookieConsentResponse> => {\n const { data } =\n await axiosInstance.post<CreateDeviceCookieConsentResponse>(\n `${CONSENT_V1}/cookies/device-id`,\n body\n );\n return data;\n },\n };\n};\n","import {\n useQuery,\n useMutation,\n useQueryClient,\n UseQueryOptions,\n UseMutationOptions,\n} from \"@tanstack/react-query\";\nimport { useConsentService } from \"../provider/ConsentServiceProvider\";\nimport { consentService } from \"../api/consent\";\nimport type {\n GetManyConsentParams,\n GetManyConsentResponse,\n GetConsentByIdParams,\n GetConsentByIdResponse,\n GetLatestConsentByUserIdParams,\n GetLatestConsentByUserIdResponse,\n GetLatestCookieConsentByDeviceIdParams,\n GetLatestCookieConsentByDeviceIdResponse,\n CreateUserConsentUpsertDTO,\n CreateUserConsentResponse,\n CreateDeviceCookieConsentUpsertDTO,\n CreateDeviceCookieConsentResponse,\n HealthResponse,\n} from \"../types\";\n\n/** Query keys for consent API */\nexport const consentQueryKeys = {\n all: [\"consent\"] as const,\n health: () => [...consentQueryKeys.all, \"health\"] as const,\n list: (params?: GetManyConsentParams) =>\n [...consentQueryKeys.all, \"list\", params] as const,\n detail: (id: string) => [...consentQueryKeys.all, \"detail\", id] as const,\n latestByUserId: (user_id: string) =>\n [...consentQueryKeys.all, \"user-id\", user_id] as const,\n latestCookieByDeviceId: (device_id: string) =>\n [...consentQueryKeys.all, \"cookies\", \"device-id\", device_id] as const,\n};\n\n// --- Queries ---\n\n/** Health check – GET /health */\nexport const useHealth = (\n options?: UseQueryOptions<HealthResponse>\n) => {\n const { consentApi } = useConsentService();\n const service = consentService(consentApi);\n\n return useQuery<HealthResponse>({\n queryKey: consentQueryKeys.health(),\n queryFn: () => service.getHealth(),\n ...options,\n });\n};\n\n/** Get all consent logs – GET /consent/v1/consent */\nexport const useManyConsents = (\n params?: GetManyConsentParams,\n options?: UseQueryOptions<GetManyConsentResponse>\n) => {\n const { consentApi } = useConsentService();\n const service = consentService(consentApi);\n\n return useQuery<GetManyConsentResponse>({\n queryKey: consentQueryKeys.list(params),\n queryFn: () => service.getManyConsents(params),\n ...options,\n });\n};\n\n/** Get consent log by ID – GET /consent/v1/consent/{id} */\nexport const useConsentById = (\n params: GetConsentByIdParams,\n options?: UseQueryOptions<GetConsentByIdResponse>\n) => {\n const { consentApi } = useConsentService();\n const service = consentService(consentApi);\n\n return useQuery<GetConsentByIdResponse>({\n queryKey: consentQueryKeys.detail(params.id),\n queryFn: () => service.getConsentById(params),\n enabled: !!params.id,\n ...options,\n });\n};\n\n/** Get latest consent for a user – GET /consent/v1/user-id */\nexport const useLatestConsentByUserId = (\n params: GetLatestConsentByUserIdParams,\n options?: UseQueryOptions<GetLatestConsentByUserIdResponse>\n) => {\n const { consentApi } = useConsentService();\n const service = consentService(consentApi);\n\n return useQuery<GetLatestConsentByUserIdResponse>({\n queryKey: consentQueryKeys.latestByUserId(params.user_id),\n queryFn: () => service.getLatestConsentByUserId(params),\n enabled: !!params.user_id,\n ...options,\n });\n};\n\n/** Get latest cookie consent for a device – GET /consent/v1/cookies/device-id */\nexport const useLatestCookieConsentByDeviceId = (\n params: GetLatestCookieConsentByDeviceIdParams,\n options?: UseQueryOptions<GetLatestCookieConsentByDeviceIdResponse>\n) => {\n const { consentApi } = useConsentService();\n const service = consentService(consentApi);\n\n return useQuery<GetLatestCookieConsentByDeviceIdResponse>({\n queryKey: consentQueryKeys.latestCookieByDeviceId(params.device_id),\n queryFn: () => service.getLatestCookieConsentByDeviceId(params),\n enabled: !!params.device_id,\n ...options,\n });\n};\n\n// --- Mutations ---\n\n/** Create user consent (account register) – POST /consent/v1/user-id */\nexport const useCreateUserConsent = (\n options?: UseMutationOptions<\n CreateUserConsentResponse,\n Error,\n CreateUserConsentUpsertDTO\n >\n) => {\n const { consentApi } = useConsentService();\n const queryClient = useQueryClient();\n const service = consentService(consentApi);\n\n return useMutation<CreateUserConsentResponse, Error, CreateUserConsentUpsertDTO>({\n mutationFn: (body: CreateUserConsentUpsertDTO) => service.createUserConsent(body),\n onSuccess: (\n _data: CreateUserConsentResponse,\n variables: CreateUserConsentUpsertDTO\n ) => {\n if (variables.user_id) {\n queryClient.invalidateQueries({\n queryKey: consentQueryKeys.latestByUserId(variables.user_id),\n });\n }\n queryClient.invalidateQueries({ queryKey: consentQueryKeys.list() });\n },\n ...options,\n });\n};\n\n/** Create device cookie consent – POST /consent/v1/cookies/device-id */\nexport const useCreateDeviceCookieConsent = (\n options?: UseMutationOptions<\n CreateDeviceCookieConsentResponse,\n Error,\n CreateDeviceCookieConsentUpsertDTO\n >\n) => {\n const { consentApi } = useConsentService();\n const queryClient = useQueryClient();\n const service = consentService(consentApi);\n\n return useMutation<\n CreateDeviceCookieConsentResponse,\n Error,\n CreateDeviceCookieConsentUpsertDTO\n >({\n mutationFn: (body: CreateDeviceCookieConsentUpsertDTO) =>\n service.createDeviceCookieConsent(body),\n onSuccess: (\n _data: CreateDeviceCookieConsentResponse,\n variables: CreateDeviceCookieConsentUpsertDTO\n ) => {\n queryClient.invalidateQueries({\n queryKey: consentQueryKeys.latestCookieByDeviceId(variables.device_id),\n });\n queryClient.invalidateQueries({ queryKey: consentQueryKeys.list() });\n },\n ...options,\n });\n};\n","\"use client\";\n\nimport { useState } from \"react\";\nimport { setConsentPreferenceCookie } from \"../helpers/cookie\";\nimport { useCreateDeviceCookieConsent } from \"../hooks/useConsent\";\n\nconst PREFERENCES = [\"essential\", \"analytics\", \"advertising\"] as const;\n\nconst MOCK_CONTENT = {\n title: \"Cookie preferences\",\n description:\n \"We use cookies to improve your experience, remember your settings, and understand how you use our site. You can accept all, or reject non-essential cookies.\",\n essentialLabel: \"Essential\",\n essentialDesc: \"Required for the site to work (e.g. security, preferences).\",\n analyticsLabel: \"Analytics\",\n analyticsDesc: \"Help us improve by collecting anonymous usage data.\",\n advertisingLabel: \"Advertising\",\n advertisingDesc: \"Used to show you relevant ads and measure campaigns.\",\n};\n\nexport interface CookieConsentBannerProps {\n /** Device ID (consumer app must provide; will be hashed by app before API if required). */\n deviceId: string;\n /** Called after consent is submitted successfully (Reject or Accept). */\n onSubmitted?: () => void;\n /** Called when the banner is dismissed (e.g. hide from UI). */\n onDismiss?: () => void;\n /** Optional class name for the root container. */\n className?: string;\n}\n\nexport function CookieConsentBanner({\n deviceId,\n onSubmitted,\n onDismiss,\n className = \"\",\n}: CookieConsentBannerProps) {\n const [dismissed, setDismissed] = useState(false);\n\n const createConsent = useCreateDeviceCookieConsent({\n onSuccess: (_data, variables) => {\n setConsentPreferenceCookie(deviceId, variables.selected_preferences ?? []);\n onSubmitted?.();\n onDismiss?.();\n setDismissed(true);\n },\n });\n\n const handleReject = () => {\n createConsent.mutate({\n device_id: deviceId,\n status: \"REJECTED\",\n selected_preferences: [\"essential\"],\n });\n };\n\n const handleAccept = () => {\n createConsent.mutate({\n device_id: deviceId,\n status: \"ACCEPTED\",\n selected_preferences: [...PREFERENCES],\n });\n };\n\n if (dismissed) return null;\n\n return (\n <div\n role=\"dialog\"\n aria-label={MOCK_CONTENT.title}\n className={`consent:fixed consent:bottom-0 consent:left-0 consent:right-0 consent:z-50 consent:flex consent:flex-col consent:gap-4 consent:rounded-t-xl consent:border consent:border-b-0 consent:border-gray-200 consent:bg-white consent:p-4 consent:shadow-lg consent:md:left-4 consent:md:right-auto consent:md:bottom-4 consent:md:max-w-md consent:md:rounded-xl consent:md:border consent:md:border-gray-200 ${className}`}\n style={{\n position: \"fixed\",\n bottom: 0,\n left: 0,\n right: 0,\n zIndex: 50,\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"1rem\",\n borderRadius: \"0.75rem 0.75rem 0 0\",\n borderWidth: \"1px 1px 0 1px\",\n borderColor: \"#e5e7eb\",\n backgroundColor: \"#fff\",\n padding: \"1rem\",\n boxShadow: \"0 -4px 6px -1px rgb(0 0 0 / 0.1)\",\n }}\n >\n <h2\n className=\"consent:text-lg consent:font-semibold consent:text-gray-900\"\n style={{ fontSize: \"1.125rem\", fontWeight: 600, color: \"#111827\" }}\n >\n {MOCK_CONTENT.title}\n </h2>\n <p\n className=\"consent:text-sm consent:text-gray-600\"\n style={{ fontSize: \"0.875rem\", color: \"#4b5563\" }}\n >\n {MOCK_CONTENT.description}\n </p>\n <ul\n className=\"consent:text-sm consent:text-gray-600 consent:space-y-2\"\n style={{ fontSize: \"0.875rem\", color: \"#4b5563\", margin: 0, paddingLeft: \"1.25rem\" }}\n >\n <li>\n <strong>{MOCK_CONTENT.essentialLabel}</strong> — {MOCK_CONTENT.essentialDesc}\n </li>\n <li>\n <strong>{MOCK_CONTENT.analyticsLabel}</strong> — {MOCK_CONTENT.analyticsDesc}\n </li>\n <li>\n <strong>{MOCK_CONTENT.advertisingLabel}</strong> — {MOCK_CONTENT.advertisingDesc}\n </li>\n </ul>\n <div\n className=\"consent:flex consent:flex-wrap consent:gap-2\"\n style={{ display: \"flex\", flexWrap: \"wrap\", gap: \"0.5rem\" }}\n >\n <button\n type=\"button\"\n onClick={handleReject}\n disabled={createConsent.isPending}\n className=\"consent:rounded-lg consent:border consent:border-gray-300 consent:bg-white consent:px-4 consent:py-2 consent:text-sm consent:font-medium consent:text-gray-700 consent:shadow-sm hover:consent:bg-gray-50 disabled:consent:opacity-50\"\n style={{\n borderRadius: \"0.5rem\",\n border: \"1px solid #d1d5db\",\n background: \"#fff\",\n padding: \"0.5rem 1rem\",\n fontSize: \"0.875rem\",\n fontWeight: 500,\n color: \"#374151\",\n }}\n >\n Reject\n </button>\n <button\n type=\"button\"\n onClick={handleAccept}\n disabled={createConsent.isPending}\n className=\"consent:rounded-lg consent:bg-gray-900 consent:px-4 consent:py-2 consent:text-sm consent:font-medium consent:text-white consent:shadow-sm hover:consent:bg-gray-800 disabled:consent:opacity-50\"\n style={{\n borderRadius: \"0.5rem\",\n background: \"#111827\",\n padding: \"0.5rem 1rem\",\n fontSize: \"0.875rem\",\n fontWeight: 500,\n color: \"#fff\",\n }}\n >\n Accept\n </button>\n </div>\n {createConsent.isError && (\n <p\n className=\"consent:text-sm consent:text-red-600\"\n style={{ fontSize: \"0.875rem\", color: \"#dc2626\" }}\n >\n Something went wrong. Please try again.\n </p>\n )}\n </div>\n );\n}\n"],"mappings":";0jBAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,yBAAAE,EAAA,wBAAAC,GAAA,iBAAAC,EAAA,cAAAC,EAAA,4BAAAC,EAAA,qBAAAC,EAAA,mBAAAC,EAAA,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,MAAO,CAAE,QAAS,OAAQ,SAAU,OAAQ,IAAK,QAAS,EAE1D,oBAAC,UACC,KAAK,SACL,QAASa,EACT,SAAUL,EAAc,UACxB,UAAU,wOACV,MAAO,CACL,aAAc,SACd,OAAQ,oBACR,WAAY,OACZ,QAAS,cACT,SAAU,WACV,WAAY,IACZ,MAAO,SACT,EACD,kBAED,KACA,OAAC,UACC,KAAK,SACL,QAASM,EACT,SAAUN,EAAc,UACxB,UAAU,kMACV,MAAO,CACL,aAAc,SACd,WAAY,UACZ,QAAS,cACT,SAAU,WACV,WAAY,IACZ,MAAO,MACT,EACD,kBAED,GACF,EACCA,EAAc,YACb,OAAC,KACC,UAAU,uCACV,MAAO,CAAE,SAAU,WAAY,MAAO,SAAU,EACjD,mDAED,GAEJ,CAEJ","names":["index_exports","__export","COOKIE_CONSENT_NAME","CookieConsentBanner","EntityStatus","MediaType","PhygitalConsentProvider","consentQueryKeys","consentService","getConsentPreferenceCookie","getCookie","setConsentPreferenceCookie","setCookie","useConsentById","useCreateDeviceCookieConsent","useCreateUserConsent","useHealth","useLatestConsentByUserId","useLatestCookieConsentByDeviceId","useManyConsents","usePhygitalConsent","__toCommonJS","MediaType","EntityStatus","import_react","COOKIE_CONSENT_NAME","getCookie","name","match","setCookie","value","options","maxAge","path","sameSite","secure","cookie","getConsentPreferenceCookie","raw","COOKIE_CONSENT_NAME","parsed","setConsentPreferenceCookie","deviceId","selected_preferences","import_react_query","import_axios","import_react","import_jsx_runtime","ConsentServiceContext","createConsentService","baseURL","axiosConfig","requestInterceptors","responseInterceptors","instance","axios","headers","key","value","ConsentServiceProvider","children","queryClient","queryClientConfig","queryClientInstance","consentService","service","useConsentService","context","import_jsx_runtime","PhygitalConsentContext","PhygitalConsentProvider","props","children","consentServiceProps","hasConsentPreference","setHasConsentPreference","refreshConsentPreference","stored","getConsentPreferenceCookie","value","ConsentServiceProvider","usePhygitalConsent","context","CONSENT_V1","consentService","axiosInstance","data","params","id","user_id","body","device_id","import_react_query","consentQueryKeys","params","id","user_id","device_id","useHealth","options","consentApi","useConsentService","service","consentService","useManyConsents","useConsentById","useLatestConsentByUserId","useLatestCookieConsentByDeviceId","useCreateUserConsent","queryClient","body","_data","variables","useCreateDeviceCookieConsent","import_react","import_jsx_runtime","PREFERENCES","MOCK_CONTENT","CookieConsentBanner","deviceId","onSubmitted","onDismiss","className","dismissed","setDismissed","createConsent","useCreateDeviceCookieConsent","_data","variables","setConsentPreferenceCookie","handleReject","handleAccept"]}
@@ -0,0 +1,278 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React from 'react';
3
+ import * as _tanstack_react_query from '@tanstack/react-query';
4
+ import { QueryClient, QueryClientConfig, UseQueryOptions, UseMutationOptions } from '@tanstack/react-query';
5
+ import { AxiosRequestConfig, InternalAxiosRequestConfig, AxiosResponse, AxiosInstance } from 'axios';
6
+
7
+ declare enum MediaType {
8
+ IMAGE = "image",
9
+ VIDEO = "video"
10
+ }
11
+ type DateTimeNumber = number;
12
+ interface Media {
13
+ url: string;
14
+ type: MediaType | string;
15
+ thumbnail_url?: string;
16
+ }
17
+ declare enum EntityStatus {
18
+ ACTIVE = "Active",
19
+ INACTIVE = "Inactive"
20
+ }
21
+ interface CommonModel {
22
+ id: string;
23
+ status: EntityStatus;
24
+ created_at: DateTimeNumber;
25
+ updated_at: DateTimeNumber;
26
+ created_by?: string;
27
+ updated_by?: string;
28
+ }
29
+
30
+ interface PaginationRequest {
31
+ page?: number;
32
+ limit?: number;
33
+ total?: number;
34
+ next_cursor?: string;
35
+ order_by?: string;
36
+ order_direction?: "desc" | "asc";
37
+ search?: string;
38
+ cursor?: string;
39
+ start_time?: number;
40
+ end_time?: number;
41
+ }
42
+ interface PaginationResponse {
43
+ order_by: string;
44
+ order_direction: string;
45
+ limit: number;
46
+ page: number;
47
+ total: number;
48
+ }
49
+ interface GetManyResponse<T> {
50
+ data: T[];
51
+ pagination: PaginationResponse;
52
+ }
53
+ interface GetOneResponse<T> {
54
+ data: T;
55
+ error: string;
56
+ }
57
+
58
+ /**
59
+ * Types aligned with Phygital Consent API (NCS) Swagger 2.0
60
+ */
61
+ type ConsentStatus = "ACCEPTED" | "REJECTED";
62
+ type PolicyType = "ACCOUNT_REGISTER" | "COOKIE_PREFERENCE";
63
+ type PolicyStatus = "ACTIVE" | "INACTIVE";
64
+ /** Document within a policy (e.g. Terms of Service, Privacy Policy) */
65
+ interface PolicyDocument {
66
+ name?: string;
67
+ version?: string;
68
+ effective_date?: string;
69
+ last_updated?: string;
70
+ meta_data?: Record<string, unknown>;
71
+ }
72
+ interface PolicyPreference {
73
+ id?: string;
74
+ name?: string;
75
+ description?: string;
76
+ is_mandatory?: boolean;
77
+ }
78
+ interface PolicyDetailDTO {
79
+ id?: string;
80
+ name?: string;
81
+ description?: string;
82
+ type?: PolicyType;
83
+ documents?: PolicyDocument[];
84
+ preferences?: PolicyPreference[];
85
+ version?: string;
86
+ meta_data?: Record<string, unknown>;
87
+ created_at?: string;
88
+ updated_at?: string;
89
+ status?: PolicyStatus;
90
+ }
91
+ interface ConsentLogDetailDTO {
92
+ id?: string;
93
+ user_id?: string;
94
+ device_uid?: string;
95
+ policy_id?: string;
96
+ policy?: PolicyDetailDTO;
97
+ selected_preferences?: string[];
98
+ status?: ConsentStatus;
99
+ created_at?: string;
100
+ }
101
+ /** Create user consent (account register) – body for POST /consent/v1/user-id */
102
+ interface CreateUserConsentUpsertDTO {
103
+ user_id?: string;
104
+ device_id?: string;
105
+ selected_preferences?: string[];
106
+ status: ConsentStatus;
107
+ }
108
+ /** Create device cookie consent – body for POST /consent/v1/cookies/device-id */
109
+ interface CreateDeviceCookieConsentUpsertDTO {
110
+ device_id: string;
111
+ selected_preferences?: string[];
112
+ status: ConsentStatus;
113
+ }
114
+ interface GetManyConsentParams {
115
+ /** Filter by policy type */
116
+ type?: PolicyType;
117
+ }
118
+ interface GetConsentByIdParams {
119
+ id: string;
120
+ }
121
+ interface GetLatestConsentByUserIdParams {
122
+ user_id: string;
123
+ }
124
+ interface GetLatestCookieConsentByDeviceIdParams {
125
+ device_id: string;
126
+ }
127
+ type GetManyConsentResponse = ConsentLogDetailDTO[];
128
+ type GetConsentByIdResponse = ConsentLogDetailDTO;
129
+ type GetLatestConsentByUserIdResponse = ConsentLogDetailDTO;
130
+ type GetLatestCookieConsentByDeviceIdResponse = ConsentLogDetailDTO;
131
+ type CreateUserConsentResponse = ConsentLogDetailDTO;
132
+ type CreateDeviceCookieConsentResponse = ConsentLogDetailDTO;
133
+ interface HealthResponse {
134
+ status?: string;
135
+ [key: string]: unknown;
136
+ }
137
+
138
+ interface RequestInterceptor {
139
+ onFulfilled?: (config: InternalAxiosRequestConfig) => InternalAxiosRequestConfig | Promise<InternalAxiosRequestConfig>;
140
+ onRejected?: (error: unknown) => unknown;
141
+ }
142
+ interface ResponseInterceptor {
143
+ onFulfilled?: (response: AxiosResponse) => AxiosResponse | Promise<AxiosResponse>;
144
+ onRejected?: (error: unknown) => unknown;
145
+ }
146
+ interface ConsentServiceProviderProps {
147
+ children: React.ReactNode;
148
+ baseURL?: string;
149
+ axiosConfig?: AxiosRequestConfig;
150
+ queryClient?: QueryClient;
151
+ queryClientConfig?: Partial<QueryClientConfig>;
152
+ requestInterceptors?: RequestInterceptor;
153
+ responseInterceptors?: ResponseInterceptor;
154
+ }
155
+
156
+ interface PhygitalConsentContextValue {
157
+ /** True when cookie phygital_cookie_consent exists and has valid deviceId + selected_preferences. Use to show/hide cookie banner. */
158
+ hasConsentPreference: boolean;
159
+ /** Re-read cookie and update hasConsentPreference. Call after storing preference (e.g. from CookieConsentBanner onSuccess). */
160
+ refreshConsentPreference: () => void;
161
+ }
162
+ interface PhygitalConsentProviderProps extends ConsentServiceProviderProps {
163
+ children: React.ReactNode;
164
+ }
165
+ /**
166
+ * Main provider for consumer apps. Wraps ConsentServiceProvider and exposes
167
+ * hasConsentPreference + refreshConsentPreference so the app can show/hide
168
+ * the cookie banner based on whether the user has already chosen a preference.
169
+ */
170
+ declare function PhygitalConsentProvider(props: PhygitalConsentProviderProps): react_jsx_runtime.JSX.Element;
171
+ declare function usePhygitalConsent(): PhygitalConsentContextValue;
172
+
173
+ declare const consentService: (axiosInstance: AxiosInstance) => {
174
+ /**
175
+ * Health check – GET /health
176
+ */
177
+ getHealth: () => Promise<HealthResponse>;
178
+ /**
179
+ * Get all consent logs – GET /consent/v1/consent
180
+ * @param params - Optional filter by policy type (ACCOUNT_REGISTER | COOKIE_PREFERENCE)
181
+ */
182
+ getManyConsents: (params?: GetManyConsentParams) => Promise<GetManyConsentResponse>;
183
+ /**
184
+ * Get consent log by ID – GET /consent/v1/consent/{id}
185
+ */
186
+ getConsentById: ({ id, }: GetConsentByIdParams) => Promise<GetConsentByIdResponse>;
187
+ /**
188
+ * Get latest consent for a user – GET /consent/v1/user-id?user_id=
189
+ */
190
+ getLatestConsentByUserId: ({ user_id, }: GetLatestConsentByUserIdParams) => Promise<GetLatestConsentByUserIdResponse>;
191
+ /**
192
+ * Create user consent (account register) – POST /consent/v1/user-id
193
+ * Consumer app must hash user_id/device_id (e.g. SHA-256) before passing.
194
+ */
195
+ createUserConsent: (body: CreateUserConsentUpsertDTO) => Promise<CreateUserConsentResponse>;
196
+ /**
197
+ * Get latest cookie consent for a device – GET /consent/v1/cookies/device-id?device_id=
198
+ */
199
+ getLatestCookieConsentByDeviceId: ({ device_id, }: GetLatestCookieConsentByDeviceIdParams) => Promise<GetLatestCookieConsentByDeviceIdResponse>;
200
+ /**
201
+ * Create device cookie consent – POST /consent/v1/cookies/device-id
202
+ * Consumer app must hash device_id (e.g. SHA-256) before passing.
203
+ */
204
+ createDeviceCookieConsent: (body: CreateDeviceCookieConsentUpsertDTO) => Promise<CreateDeviceCookieConsentResponse>;
205
+ };
206
+
207
+ /** Query keys for consent API */
208
+ declare const consentQueryKeys: {
209
+ all: readonly ["consent"];
210
+ health: () => readonly ["consent", "health"];
211
+ list: (params?: GetManyConsentParams) => readonly ["consent", "list", GetManyConsentParams | undefined];
212
+ detail: (id: string) => readonly ["consent", "detail", string];
213
+ latestByUserId: (user_id: string) => readonly ["consent", "user-id", string];
214
+ latestCookieByDeviceId: (device_id: string) => readonly ["consent", "cookies", "device-id", string];
215
+ };
216
+ /** Health check – GET /health */
217
+ declare const useHealth: (options?: UseQueryOptions<HealthResponse>) => _tanstack_react_query.UseQueryResult<HealthResponse, Error>;
218
+ /** Get all consent logs – GET /consent/v1/consent */
219
+ declare const useManyConsents: (params?: GetManyConsentParams, options?: UseQueryOptions<GetManyConsentResponse>) => _tanstack_react_query.UseQueryResult<GetManyConsentResponse, Error>;
220
+ /** Get consent log by ID – GET /consent/v1/consent/{id} */
221
+ declare const useConsentById: (params: GetConsentByIdParams, options?: UseQueryOptions<GetConsentByIdResponse>) => _tanstack_react_query.UseQueryResult<ConsentLogDetailDTO, Error>;
222
+ /** Get latest consent for a user – GET /consent/v1/user-id */
223
+ declare const useLatestConsentByUserId: (params: GetLatestConsentByUserIdParams, options?: UseQueryOptions<GetLatestConsentByUserIdResponse>) => _tanstack_react_query.UseQueryResult<ConsentLogDetailDTO, Error>;
224
+ /** Get latest cookie consent for a device – GET /consent/v1/cookies/device-id */
225
+ declare const useLatestCookieConsentByDeviceId: (params: GetLatestCookieConsentByDeviceIdParams, options?: UseQueryOptions<GetLatestCookieConsentByDeviceIdResponse>) => _tanstack_react_query.UseQueryResult<ConsentLogDetailDTO, Error>;
226
+ /** Create user consent (account register) – POST /consent/v1/user-id */
227
+ declare const useCreateUserConsent: (options?: UseMutationOptions<CreateUserConsentResponse, Error, CreateUserConsentUpsertDTO>) => _tanstack_react_query.UseMutationResult<ConsentLogDetailDTO, Error, CreateUserConsentUpsertDTO, unknown>;
228
+ /** Create device cookie consent – POST /consent/v1/cookies/device-id */
229
+ declare const useCreateDeviceCookieConsent: (options?: UseMutationOptions<CreateDeviceCookieConsentResponse, Error, CreateDeviceCookieConsentUpsertDTO>) => _tanstack_react_query.UseMutationResult<ConsentLogDetailDTO, Error, CreateDeviceCookieConsentUpsertDTO, unknown>;
230
+
231
+ /**
232
+ * Browser cookie helpers for phygital-consent.
233
+ * Cookie name for consent preference: phygital_cookie_consent.
234
+ * Stored value: { deviceId: string, selected_preferences: string[] } (JSON).
235
+ * Default: 1 year, path /, SameSite Lax.
236
+ */
237
+ declare const COOKIE_CONSENT_NAME = "phygital_cookie_consent";
238
+ interface SetCookieOptions {
239
+ maxAge?: number;
240
+ path?: string;
241
+ sameSite?: "Strict" | "Lax" | "None";
242
+ secure?: boolean;
243
+ }
244
+ /**
245
+ * Get a cookie value by name.
246
+ */
247
+ declare function getCookie(name: string): string | null;
248
+ /**
249
+ * Set a cookie.
250
+ */
251
+ declare function setCookie(name: string, value: string, options?: SetCookieOptions): void;
252
+ interface ConsentPreferenceValue {
253
+ deviceId: string;
254
+ selected_preferences: string[];
255
+ }
256
+ /**
257
+ * Read consent preference from cookie. Returns null if missing or invalid.
258
+ */
259
+ declare function getConsentPreferenceCookie(): ConsentPreferenceValue | null;
260
+ /**
261
+ * Store consent preference in cookie (hashed device id + selected_preferences).
262
+ * Uses 1 year max-age and SameSite Lax.
263
+ */
264
+ declare function setConsentPreferenceCookie(deviceId: string, selected_preferences: string[], options?: Partial<SetCookieOptions>): void;
265
+
266
+ interface CookieConsentBannerProps {
267
+ /** Device ID (consumer app must provide; will be hashed by app before API if required). */
268
+ deviceId: string;
269
+ /** Called after consent is submitted successfully (Reject or Accept). */
270
+ onSubmitted?: () => void;
271
+ /** Called when the banner is dismissed (e.g. hide from UI). */
272
+ onDismiss?: () => void;
273
+ /** Optional class name for the root container. */
274
+ className?: string;
275
+ }
276
+ declare function CookieConsentBanner({ deviceId, onSubmitted, onDismiss, className, }: CookieConsentBannerProps): react_jsx_runtime.JSX.Element | null;
277
+
278
+ export { COOKIE_CONSENT_NAME, type CommonModel, type ConsentLogDetailDTO, type ConsentPreferenceValue, type ConsentStatus, CookieConsentBanner, type CookieConsentBannerProps, type CreateDeviceCookieConsentResponse, type CreateDeviceCookieConsentUpsertDTO, type CreateUserConsentResponse, type CreateUserConsentUpsertDTO, type DateTimeNumber, EntityStatus, type GetConsentByIdParams, type GetConsentByIdResponse, type GetLatestConsentByUserIdParams, type GetLatestConsentByUserIdResponse, type GetLatestCookieConsentByDeviceIdParams, type GetLatestCookieConsentByDeviceIdResponse, type GetManyConsentParams, type GetManyConsentResponse, type GetManyResponse, type GetOneResponse, type HealthResponse, type Media, MediaType, type PaginationRequest, type PaginationResponse, type PhygitalConsentContextValue, PhygitalConsentProvider, type PhygitalConsentProviderProps, type PolicyDetailDTO, type PolicyDocument, type PolicyPreference, type PolicyStatus, type PolicyType, type SetCookieOptions, consentQueryKeys, consentService, getConsentPreferenceCookie, getCookie, setConsentPreferenceCookie, setCookie, useConsentById, useCreateDeviceCookieConsent, useCreateUserConsent, useHealth, useLatestConsentByUserId, useLatestCookieConsentByDeviceId, useManyConsents, usePhygitalConsent };