{"version":3,"file":"index.cjs","names":["AccessContext","createContext","AuditContext","useReducer","mockState","useCallback","Ctx","useReducer","mockState","mergeDeep","useCallback","Ctx","useContext","AccessContext","AuditContext","forwardRef","useRef","useMemo","classNames","useState","useCallback","forwardRef","useRef","Children","cloneElement"],"sources":["../src/contexts.ts","../src/utils.ts","../src/AuditContext/index.tsx","../src/AccessContext/index.tsx","../src/hooks.ts","../src/Paywall/index.tsx","../src/Pixel/index.tsx","../src/RestrictedContent/index.tsx"],"sourcesContent":["import type { Poool } from 'poool-access';\nimport { createContext } from 'react';\n\nimport type { AccessEvents, AuditEvents } from './types';\n\nexport interface AccessContextValue {\n  /**\n   * Your poool app ID\n   *\n   * More infos:\n   * https://www.poool.dev/docs/access/javascript/access/installation\n   */\n  appId?: string;\n  /**\n   * Your poool access config options\n   *\n   * More infos:\n   * https://www.poool.dev/docs/access/javascript/access/configuration\n   */\n  config?: Omit<Poool.AccessConfigOptions, 'widget_container'>;\n  /**\n   * Your poool access texts ati_tag_options\n   *\n   * More infos: https://www.poool.dev/docs/access/javascript/access/texts\n   */\n  texts?: Record<string, string>;\n  /**\n   * Your poool access styles\n   *\n   * More infos: https://www.poool.dev/docs/access/javascript/access/styles\n   */\n  styles?: Poool.styles;\n  /**\n   * Your poool access events\n   *\n   * More infos: https://www.poool.dev/docs/access/javascript/access/events\n   */\n  events?: { [key in Poool.EventsList]?: AccessEvents[key] };\n  /**\n   * Your pool access variables\n   *\n   * More infos: https://www.poool.dev/docs/access/javascript/access/variables\n   */\n  variables?: Record<string, any>;\n  /**\n   * The poool access script url\n   *\n   * More infos:\n   * https://www.poool.dev/docs/access/javascript/access/installation\n   */\n  scriptUrl?: string;\n  /**\n   * The poool access sdk\n   *\n   * More infos: https://www.poool.dev/docs/access/react\n   */\n  lib?: Poool.Access;\n  /**\n   * Function to trigger a new access init, returns the created access instance,\n   * with passed options\n   *\n   * More infos: https://www.poool.dev/docs/access/react\n   */\n  createFactory?: (\n    opts?: Pick<\n      AccessContextValue,\n      'config' | 'texts' | 'styles' | 'variables' | 'events'\n    >\n  ) => Poool.AccessFactory;\n  /**\n   * Function to delete a factory\n   *\n   * More infos: https://www.poool.dev/docs/access/react\n   */\n  destroyFactory?: (factory: Poool.AccessFactory) => Promise<void>;\n}\n\nexport const AccessContext = createContext<AccessContextValue>({});\n\nexport interface AuditContextValue {\n  /**\n   * Your Poool App ID\n   *\n   * More infos: https://www.poool.dev/docs/access/javascript/audit/installation\n   */\n  appId?: string;\n  /**\n   * Your pool Audit configuration object\n   *\n   * More infos:\n   * https://www.poool.dev/docs/access/javascript/audit/configuration\n   */\n  config?: Poool.AuditConfigOptions;\n  /**\n   * Your pool Audit events\n   *\n   * More infos: https://www.poool.dev/docs/access/javascript/audit/events\n   */\n  events?: { [key in Poool.EventsList]: AuditEvents[key] };\n  /**\n   * The poool audit script url\n   *\n   * More infos: https://www.poool.dev/docs/access/javascript/audit/installation\n   */\n  scriptUrl?: string;\n  /**\n   * The poool audit sdk\n   *\n   * More infos: https://www.poool.dev/docs/access/react\n   */\n  lib?: Poool.Audit;\n}\n\nexport const AuditContext = createContext<AuditContextValue>({});\n","export const randomString = () =>\n  Math.random().toString(36).slice(2, 7);\n\nexport const generateId = () => {\n  let id;\n\n  while (!id) {\n    const temp = `poool-${randomString()}-${randomString()}`;\n\n    /* istanbul ignore else: virtually impossible to happen */\n    if (typeof document === 'undefined' || !document.getElementById?.(temp)) {\n      id = temp;\n    }\n  }\n\n  return id;\n};\n\nexport const loadScript = (\n  url: string,\n  id: string,\n  opts: { timeout?: number } = {}\n) => new Promise((resolve, reject) => {\n  /* istanbul ignore else: tested inside puppeteer */\n  if (process.env.NODE_ENV === 'test') {\n    return resolve(true);\n  }\n\n  const existing = globalThis.document.getElementById(id);\n\n  if (existing) {\n    return Promise.race([\n      new Promise(resolve => existing.addEventListener('load', resolve)),\n      new Promise(resolve => setTimeout(resolve, opts.timeout ?? 2000)),\n    ]);\n  }\n\n  const script = globalThis.document.createElement('script');\n  script.onload = resolve;\n  script.onerror = reject;\n  script.async = true;\n  script.src = url;\n  script.id = id;\n  globalThis.document.head.appendChild(script);\n});\n","import type { Poool } from 'poool-access';\nimport {\n  type ComponentPropsWithoutRef,\n  useCallback,\n  useEffect,\n  useReducer,\n} from 'react';\nimport { mockState } from '@junipero/core';\n\nimport type {\n  AuditEvents,\n  EventCallback,\n  EventCallbackFunction,\n  EventCallbackObject,\n} from '../types';\nimport { type AuditContextValue, AuditContext as Ctx } from '../contexts';\nimport { loadScript } from '../utils';\n\nexport interface AuditContextProps\n  extends AuditContextValue, ComponentPropsWithoutRef<any> {\n  /**\n   * Maximum time for the Audit script to load\n   * @default 2000\n   */\n  scriptLoadTimeout?: number;\n}\n\nexport interface AuditContextState {\n  lib?: Poool.Audit;\n}\n\nconst AuditContext = ({\n  appId,\n  config,\n  events,\n  scriptUrl = 'https://assets.poool.fr/audit.min.js',\n  scriptLoadTimeout = 2000,\n  ...rest\n}: AuditContextProps) => {\n  const [state, dispatch] = useReducer(mockState<AuditContextState>, {\n    lib: null,\n  });\n\n  useEffect(() => {\n    init();\n\n    return () => {\n      deinit();\n    };\n  // eslint-disable-next-line react-hooks/exhaustive-deps,@eslint-react/exhaustive-deps\n  }, [config?.cookies_enabled]);\n\n  const init = async () => {\n    if (\n      (!globalThis.Audit?.isPoool) &&\n      (!globalThis.PooolAudit?.isPoool)\n    ) {\n      await loadScript(scriptUrl, 'poool-react-audit-lib', {\n        timeout: scriptLoadTimeout,\n      });\n    }\n\n    const auditRef = globalThis.PooolAudit || globalThis.Audit;\n    const lib = auditRef.noConflict().init(appId).config(config);\n\n    Object\n      .entries(events || {})\n      .forEach(([\n        event,\n        callback,\n      ]: [\n        Poool.EventsList,\n        EventCallback<typeof events[keyof typeof events]>,\n      ]) => {\n        if ((callback as EventCallbackObject<typeof event>).once) {\n          lib.once(event,\n            (callback as EventCallbackObject<typeof event>).callback);\n        } else {\n          lib.on(event, callback as EventCallbackFunction<typeof event>);\n        }\n      });\n\n    lib.once('identityAvailable', onIdentityAvailable);\n\n    dispatch({ lib });\n  };\n\n  const deinit = () => {\n    Object\n      .entries(events || {})\n      .forEach(([\n        event,\n        callback,\n      ]: [\n        Poool.EventsList,\n        EventCallback<typeof events[keyof typeof events]>,\n      ]) => {\n        state.lib?.off(\n          event,\n          (callback as EventCallbackObject<typeof event>).callback ||\n            (callback as EventCallbackFunction<typeof event>)\n        );\n      });\n\n    state.lib?.off('identityAvailable', onIdentityAvailable);\n  };\n\n  const onIdentityAvailable = (\n    e: Parameters<\n      Extract<AuditEvents['identityAvailable'], EventCallbackFunction<any>>\n    >[0]\n  ) => {\n    try {\n      globalThis.document.dispatchEvent(new CustomEvent('$_poool.onMessage', {\n        detail: {\n          type: '$_poool.setUser',\n          data: e,\n        },\n      }));\n    } catch {}\n  };\n\n  const getContext = useCallback(() => ({\n    appId,\n    config,\n    events,\n    scriptUrl,\n    lib: state.lib,\n  // eslint-disable-next-line react-hooks/exhaustive-deps,@eslint-react/exhaustive-deps\n  }), [state.lib, config?.cookies_enabled]);\n\n  return (\n    <Ctx.Provider value={getContext()} { ...rest } />\n  );\n};\n\nAuditContext.displayName = 'AuditContext';\n\nexport default AuditContext;\n","import type { Poool } from 'poool-access';\nimport {\n  type ComponentPropsWithoutRef,\n  useCallback,\n  useEffect,\n  useReducer,\n} from 'react';\nimport { mockState, mergeDeep } from '@junipero/core';\n\nimport type {\n  AccessEvents,\n  EventCallback,\n  EventCallbackFunction,\n  EventCallbackObject,\n} from '../types';\nimport { type AccessContextValue, AccessContext as Ctx } from '../contexts';\nimport { loadScript } from '../utils';\nimport AuditContext from '../AuditContext';\n\nexport interface AccessContextProps\n  extends AccessContextValue, ComponentPropsWithoutRef<any> {\n  /**\n   * Maximum time for the Access script to load\n   * @default 2000\n   */\n  scriptLoadTimeout?: number;\n  /**\n   * Whether the access context should include audit or not\n   * @default false\n   *\n   * More infos:\n   * https://www.poool.dev/docs/access/javascript/access/installation\n   */\n  withAudit?: boolean;\n}\n\nexport interface AccessContextState {\n  lib?: Poool.Access;\n}\n\nconst AccessContext = ({\n  appId,\n  config,\n  texts,\n  styles,\n  events,\n  variables,\n  scriptUrl = 'https://assets.poool.fr/access.min.js',\n  scriptLoadTimeout = 2000,\n  withAudit = false,\n  ...rest\n}: AccessContextProps) => {\n  const [state, dispatch] = useReducer(mockState<AccessContextState>, {\n    lib: null,\n  });\n\n  useEffect(() => {\n    init();\n  // eslint-disable-next-line react-hooks/exhaustive-deps,@eslint-react/exhaustive-deps\n  }, []);\n\n  const init = async () => {\n    if (\n      (!globalThis.Access?.isPoool) &&\n      (!globalThis.PooolAccess?.isPoool)\n    ) {\n      await loadScript(scriptUrl, 'poool-react-access-lib', {\n        timeout: scriptLoadTimeout,\n      });\n    }\n\n    const accessRef = globalThis.PooolAccess || globalThis.Access;\n    const lib = accessRef.noConflict();\n    dispatch({ lib });\n  };\n\n  const createFactory = (\n    opts: Pick<\n      AccessContextValue,\n      'config' | 'texts' | 'styles' | 'variables' | 'events'\n    > = {}\n  ) => {\n    if (!state.lib) {\n      return;\n    }\n\n    const factory = state.lib\n      .init(appId)\n      .config(mergeDeep({}, config, opts.config))\n      .texts(mergeDeep({}, texts, opts.texts))\n      .styles(mergeDeep({}, styles, opts.styles))\n      .variables(mergeDeep({}, variables, opts.variables));\n\n    Object\n      .entries(events || {})\n      .concat(Object.entries(opts.events || {}))\n      .forEach(([\n        event,\n        callback,\n      ]: [\n        Poool.EventsList,\n        EventCallback<typeof events[keyof typeof events]>,\n      ]) => {\n        if ((callback as EventCallbackObject<typeof event>).once) {\n          factory.once(event,\n            (callback as EventCallbackObject<typeof event>).callback);\n        } else {\n          factory.on(event, callback as EventCallbackFunction<typeof event>);\n        }\n      });\n\n    return factory;\n  };\n\n  const destroyFactory = (factory: Poool.AccessFactory): Promise<void> => {\n    if (!factory) {\n      return;\n    }\n\n    Object.keys(events || {}).forEach((event: keyof AccessEvents) => {\n      factory?.off(event, events[event].callback || events[event]);\n    });\n\n    return factory.destroy();\n  };\n\n  const getContext = useCallback(() => ({\n    appId,\n    config,\n    texts,\n    styles,\n    events,\n    variables,\n    scriptUrl,\n    lib: state.lib,\n    createFactory,\n    destroyFactory,\n  // eslint-disable-next-line react-hooks/exhaustive-deps,@eslint-react/exhaustive-deps\n  }), [state.lib, config?.cookies_enabled]);\n\n  const content = (\n    <Ctx.Provider value={getContext()} { ...rest } />\n  );\n\n  if (withAudit) {\n    return (\n      <AuditContext appId={appId} config={config}>\n        { content }\n      </AuditContext>\n    );\n  }\n\n  return content;\n};\n\nAccessContext.displayName = 'AccessContext';\n\nexport default AccessContext;\n","import { useContext } from 'react';\n\nimport { AccessContext, AuditContext } from './contexts';\n\nexport const useAccess = () => useContext(AccessContext);\nexport const useAudit = () => useContext(AuditContext);\n","import type { Poool } from 'poool-access';\nimport {\n  type ComponentPropsWithoutRef,\n  type RefObject,\n  useEffect,\n  useMemo,\n  useRef,\n  useImperativeHandle,\n  forwardRef,\n} from 'react';\nimport { classNames } from '@junipero/core';\n\nimport type { AccessEvents, EventCallbackFunction } from '../types';\nimport type { AccessContextValue } from '../contexts';\nimport type { RestrictedContentRef } from '../RestrictedContent';\nimport { generateId } from '../utils';\nimport { useAccess } from '../hooks';\n\nexport declare interface PaywallRef {\n  containerRef: RefObject<HTMLElement>;\n  recreate: () => void;\n  create: () => void;\n  destroy: (container: HTMLElement) => void;\n}\n\nexport declare interface PaywallProps extends Pick<\n  AccessContextValue,\n  'events' | 'config' | 'texts' | 'styles' | 'variables'\n>, ComponentPropsWithoutRef<'div'> {\n  /**\n   * Ref to the paywall\n   */\n  ref?: RefObject<PaywallRef>;\n  /**\n   * Ref to the content\n   */\n  contentRef?: RefObject<RestrictedContentRef | null>;\n  /**\n   * Custom wrapper component ID\n   */\n  id?: string;\n  /**\n   * The current page type\n   *\n   * More infos:\n   * https://www.poool.dev/docs/access/javascript/access/installation\n   */\n  pageType?: Parameters<Poool.AccessFactory['createPaywall']>[0]['pageType'];\n}\n\nconst Paywall = forwardRef<PaywallRef, PaywallProps>(({\n  id,\n  events,\n  contentRef,\n  children,\n  className,\n  config,\n  texts,\n  styles,\n  variables,\n  pageType = 'premium',\n  ...rest\n}, ref) => {\n  const paywallRef = useRef<Poool.AccessFactory>(null);\n  const containerRef = useRef<HTMLDivElement>(null);\n  const {\n    lib,\n    createFactory,\n    destroyFactory,\n    config: globalConfig,\n  } = useAccess();\n\n  useImperativeHandle(ref, () => ({\n    containerRef,\n    recreate,\n    create,\n    destroy,\n  }));\n\n  useEffect(() => {\n    create();\n\n    const container = containerRef.current;\n\n    return () => {\n      destroy(container);\n    };\n  // eslint-disable-next-line react-hooks/exhaustive-deps,@eslint-react/exhaustive-deps\n  }, [lib, globalConfig?.cookies_enabled]);\n\n  const create = () => {\n    paywallRef.current = createFactory?.({\n      events,\n      config,\n      texts,\n      styles,\n      variables,\n    });\n\n    if (!paywallRef.current) {\n      return;\n    }\n\n    paywallRef.current.once('identityAvailable', onIdentityAvailable);\n\n    paywallRef.current.createPaywall({\n      pageType,\n      target: containerRef.current,\n      content: contentRef?.current?.contentRef?.current,\n      mode: contentRef?.current?.mode,\n      percent: contentRef?.current?.percent,\n    });\n  };\n\n  const destroy = async (container: HTMLElement) => {\n    if (!paywallRef.current) {\n      return;\n    }\n\n    container.innerHTML = '';\n    const factory = paywallRef.current;\n    factory.off('identityAvailable', onIdentityAvailable);\n    paywallRef.current = null;\n    await destroyFactory?.(factory);\n  };\n\n  const recreate = async () => {\n    await destroy(containerRef.current);\n    create();\n  };\n\n  const onIdentityAvailable = (\n    e: Parameters<\n      Extract<AccessEvents['identityAvailable'], EventCallbackFunction<any>>\n    >[0]\n  ) => {\n    try {\n      globalThis.document.dispatchEvent(new CustomEvent('$_poool.onMessage', {\n        detail: {\n          type: '$_poool.setUser',\n          data: e,\n        },\n      }));\n    } catch {}\n  };\n\n  const customId = useMemo(() => generateId(), []);\n\n  return (\n    <>\n      <div\n        id={id || customId}\n        ref={containerRef}\n        className={classNames('poool-widget', className)}\n        { ...rest }\n      />\n      { children }\n    </>\n  );\n});\n\nPaywall.displayName = 'Paywall';\n\nexport default Paywall;\n","import type { Poool } from 'poool-access';\nimport {\n  type ComponentPropsWithoutRef,\n  type ReactNode,\n  useCallback,\n  useEffect,\n  useState,\n} from 'react';\n\nimport { useAudit } from '../hooks';\n\nexport interface PixelProps extends ComponentPropsWithoutRef<any> {\n  /**\n   * The event type\n   *\n   * More infos: https://www.poool.dev/docs/access/javascript/audit/methods\n   */\n  type: Parameters<Poool.Audit['sendEvent']>[0];\n  /**\n   * The event data\n   *\n   * More infos: https://www.poool.dev/docs/access/javascript/audit/methods\n   */\n  data?: Parameters<Poool.Audit['sendEvent']>[1];\n  /**\n   * The audit config options\n   *\n   * More infos: https://www.poool.dev/docs/audit/javascript/audit/configuration\n   */\n  config?: Poool.AuditConfigOptions;\n  /**\n   * the event options\n   *\n   * more infos: https://www.poool.dev/docs/access/javascript/audit/methods\n   */\n  options?: Parameters<Poool.Audit['sendEvent']>[2];\n  /**\n   * Callback to execute when the event is done\n   *\n   * More infos: https://www.poool.dev/docs/access/react\n   */\n  onDone?: () => void;\n  /**\n   * Whether to reuse the same event or not\n   *\n   * More infos: https://www.poool.dev/docs/access/react\n   */\n  reuse?: boolean;\n}\n\nconst Pixel = ({\n  type,\n  data,\n  config,\n  options,\n  onDone,\n  reuse = false,\n}: PixelProps): ReactNode => {\n  const { lib: Audit_, config: auditConfig } = useAudit();\n  const [used, setUsed] = useState(false);\n\n  const send = useCallback(async () => {\n    if (!Audit_ || (used && !reuse)) {\n      return;\n    }\n\n    await Audit_.config(config || {}).sendEvent(type, data, options);\n    setUsed(true);\n    onDone?.();\n  // eslint-disable-next-line react-hooks/exhaustive-deps,@eslint-react/exhaustive-deps\n  }, [Audit_, used]);\n\n  useEffect(() => {\n    send();\n  }, [Audit_, auditConfig?.cookies_enabled, send]);\n\n  return null;\n};\n\nPixel.displayName = 'Pixel';\n\nexport default Pixel;\n","import type { Poool } from 'poool-access';\nimport {\n  type ComponentPropsWithoutRef,\n  type RefObject,\n  Children,\n  cloneElement,\n  forwardRef,\n  useRef,\n  useImperativeHandle,\n} from 'react';\n\nexport declare interface RestrictedContentRef {\n  contentRef: RefObject<HTMLElement>;\n  mode: Poool.AccessConfigOptions['mode'];\n  percent: Poool.AccessConfigOptions['percent'];\n}\n\nexport declare interface RestrictedContentProps extends Pick<\n  Poool.AccessConfigOptions,\n  'mode' | 'percent'\n>, ComponentPropsWithoutRef<any> {\n  ref?: RefObject<RestrictedContentRef>;\n}\n\nconst RestrictedContent = forwardRef<RestrictedContentRef, RestrictedContentProps>(({\n  mode,\n  percent,\n  children,\n}, ref) => {\n  const contentRef = useRef<HTMLDivElement>(null);\n\n  useImperativeHandle(ref, () => ({\n    contentRef,\n    mode,\n    percent,\n  }));\n\n  const child = Children.only(children);\n\n  if (child?.type === Symbol.for('react.fragment')) {\n    throw new Error('RestrictedContent cannot accept a Fragment as a child.');\n  }\n\n  return cloneElement(child, {\n    ref: contentRef,\n  });\n});\n\nRestrictedContent.displayName = 'RestrictedContent';\n\nexport default RestrictedContent;\n"],"mappings":";;;;;;AA6EA,MAAaA,mBAAAA,GAAgBC,MAAAA,cAAAA,CAAkC,CAAC,CAAC;AAoCjE,MAAaC,kBAAAA,GAAeD,MAAAA,cAAAA,CAAiC,CAAC,CAAC;;;ACjH/D,MAAa,qBACX,KAAK,OAAO,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC;AAEvC,MAAa,mBAAmB;CAC9B,IAAI;CAEJ,OAAO,CAAC,IAAI;EACV,MAAM,OAAO,SAAS,aAAa,EAAE,GAAG,aAAa;;EAGrD,IAAI,OAAO,aAAa,eAAe,CAAC,SAAS,iBAAiB,IAAI,GACpE,KAAK;CAET;CAEA,OAAO;AACT;AAEA,MAAa,cACX,KACA,IACA,OAA6B,CAAC,MAC3B,IAAI,SAAS,SAAS,WAAW;;CAEpC,IAAI,QAAQ,IAAI,aAAa,QAC3B,OAAO,QAAQ,IA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