@adview/react 1.1.2 → 1.1.3

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.
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { A as AdViewUnitPropsBase, a as AdViewUnitClientChildren } from '../types-CTcZX5SL.cjs';
2
+ import { d as AdViewUnitPropsBase, a as AdViewUnitClientChildren } from '../types-Bb6Axy4u.cjs';
3
3
  import '@adview/core/typings';
4
4
 
5
5
  type AdViewUnitClientProps = AdViewUnitPropsBase & {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { A as AdViewUnitPropsBase, a as AdViewUnitClientChildren } from '../types-CTcZX5SL.js';
2
+ import { d as AdViewUnitPropsBase, a as AdViewUnitClientChildren } from '../types-Bb6Axy4u.js';
3
3
  import '@adview/core/typings';
4
4
 
5
5
  type AdViewUnitClientProps = AdViewUnitPropsBase & {
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { AdViewUnitClientProps } from './AdViewUnit.client.cjs';
3
3
  import { AdViewUnitServerProps } from './AdViewUnit.server.cjs';
4
- import '../types-CTcZX5SL.cjs';
4
+ import '../types-Bb6Axy4u.cjs';
5
5
  import '@adview/core/typings';
6
6
 
7
7
  type AdViewUnitProps = typeof window extends undefined ? AdViewUnitServerProps : AdViewUnitClientProps;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { AdViewUnitClientProps } from './AdViewUnit.client.js';
3
3
  import { AdViewUnitServerProps } from './AdViewUnit.server.js';
4
- import '../types-CTcZX5SL.js';
4
+ import '../types-Bb6Axy4u.js';
5
5
  import '@adview/core/typings';
6
6
 
7
7
  type AdViewUnitProps = typeof window extends undefined ? AdViewUnitServerProps : AdViewUnitClientProps;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { A as AdViewUnitPropsBase, a as AdViewUnitClientChildren } from '../types-CTcZX5SL.cjs';
2
+ import { d as AdViewUnitPropsBase, a as AdViewUnitClientChildren } from '../types-Bb6Axy4u.cjs';
3
3
  import '@adview/core/typings';
4
4
 
5
5
  type AdViewUnitServerProps = AdViewUnitPropsBase & {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { A as AdViewUnitPropsBase, a as AdViewUnitClientChildren } from '../types-CTcZX5SL.js';
2
+ import { d as AdViewUnitPropsBase, a as AdViewUnitClientChildren } from '../types-Bb6Axy4u.js';
3
3
  import '@adview/core/typings';
4
4
 
5
5
  type AdViewUnitServerProps = AdViewUnitPropsBase & {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { b as AdViewUnitTemplateTypeProps } from '../types-CTcZX5SL.cjs';
2
+ import { c as AdViewUnitTemplateTypeProps } from '../types-Bb6Axy4u.cjs';
3
3
  import '@adview/core/typings';
4
4
 
5
5
  type AdViewUnitBannerTemplateProps = Omit<AdViewUnitTemplateTypeProps, 'type'> & {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { b as AdViewUnitTemplateTypeProps } from '../types-CTcZX5SL.js';
2
+ import { c as AdViewUnitTemplateTypeProps } from '../types-Bb6Axy4u.js';
3
3
  import '@adview/core/typings';
4
4
 
5
5
  type AdViewUnitBannerTemplateProps = Omit<AdViewUnitTemplateTypeProps, 'type'> & {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { b as AdViewUnitTemplateTypeProps, c as AdViewOptionalDataProps } from '../types-CTcZX5SL.cjs';
2
+ import { c as AdViewUnitTemplateTypeProps, A as AdViewOptionalDataProps } from '../types-Bb6Axy4u.cjs';
3
3
  import '@adview/core/typings';
4
4
 
5
5
  type AdViewUnitDefaultTemplateProps = Omit<AdViewUnitTemplateTypeProps, 'type'> & {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { b as AdViewUnitTemplateTypeProps, c as AdViewOptionalDataProps } from '../types-CTcZX5SL.js';
2
+ import { c as AdViewUnitTemplateTypeProps, A as AdViewOptionalDataProps } from '../types-Bb6Axy4u.js';
3
3
  import '@adview/core/typings';
4
4
 
5
5
  type AdViewUnitDefaultTemplateProps = Omit<AdViewUnitTemplateTypeProps, 'type'> & {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { b as AdViewUnitTemplateTypeProps, d as AdViewStyleTokensNative } from '../types-CTcZX5SL.cjs';
2
+ import { c as AdViewUnitTemplateTypeProps, e as AdViewStyleTokensNative } from '../types-Bb6Axy4u.cjs';
3
3
  import '@adview/core/typings';
4
4
 
5
5
  type AdViewUnitNativeTemplateProps = Omit<AdViewUnitTemplateTypeProps, 'type'> & {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { b as AdViewUnitTemplateTypeProps, d as AdViewStyleTokensNative } from '../types-CTcZX5SL.js';
2
+ import { c as AdViewUnitTemplateTypeProps, e as AdViewStyleTokensNative } from '../types-Bb6Axy4u.js';
3
3
  import '@adview/core/typings';
4
4
 
5
5
  type AdViewUnitNativeTemplateProps = Omit<AdViewUnitTemplateTypeProps, 'type'> & {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { b as AdViewUnitTemplateTypeProps } from '../types-CTcZX5SL.cjs';
2
+ import { c as AdViewUnitTemplateTypeProps } from '../types-Bb6Axy4u.cjs';
3
3
  import '@adview/core/typings';
4
4
 
5
5
  type AdViewUnitProxyTemplateProps = Omit<AdViewUnitTemplateTypeProps, 'type'> & {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { b as AdViewUnitTemplateTypeProps } from '../types-CTcZX5SL.js';
2
+ import { c as AdViewUnitTemplateTypeProps } from '../types-Bb6Axy4u.js';
3
3
  import '@adview/core/typings';
4
4
 
5
5
  type AdViewUnitProxyTemplateProps = Omit<AdViewUnitTemplateTypeProps, 'type'> & {
@@ -1,5 +1,5 @@
1
1
  import React, { JSX } from 'react';
2
- import { e as AdViewUnitTemplateProps, b as AdViewUnitTemplateTypeProps } from '../types-CTcZX5SL.cjs';
2
+ import { b as AdViewUnitTemplateProps, c as AdViewUnitTemplateTypeProps } from '../types-Bb6Axy4u.cjs';
3
3
  import '@adview/core/typings';
4
4
 
5
5
  type TemplateListRender = (tmpls: TemplateElement[]) => React.ReactElement | JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import React, { JSX } from 'react';
2
- import { e as AdViewUnitTemplateProps, b as AdViewUnitTemplateTypeProps } from '../types-CTcZX5SL.js';
2
+ import { b as AdViewUnitTemplateProps, c as AdViewUnitTemplateTypeProps } from '../types-Bb6Axy4u.js';
3
3
  import '@adview/core/typings';
4
4
 
5
5
  type TemplateListRender = (tmpls: TemplateElement[]) => React.ReactElement | JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import { AdViewConfig, AdViewData } from '@adview/core/typings';
2
- import { f as AdLoadState } from '../types-CTcZX5SL.cjs';
2
+ import { f as AdLoadState } from '../types-Bb6Axy4u.cjs';
3
3
  import 'react';
4
4
 
5
5
  type UseAdViewControllerProps = [AdViewData | null, Error | null, AdLoadState];
@@ -1,5 +1,5 @@
1
1
  import { AdViewConfig, AdViewData } from '@adview/core/typings';
2
- import { f as AdLoadState } from '../types-CTcZX5SL.js';
2
+ import { f as AdLoadState } from '../types-Bb6Axy4u.js';
3
3
  import 'react';
4
4
 
5
5
  type UseAdViewControllerProps = [AdViewData | null, Error | null, AdLoadState];
@@ -1,4 +1,4 @@
1
- import { f as AdLoadState } from '../types-CTcZX5SL.cjs';
1
+ import { f as AdLoadState } from '../types-Bb6Axy4u.cjs';
2
2
  import '@adview/core/typings';
3
3
  import 'react';
4
4
 
@@ -1,4 +1,4 @@
1
- import { f as AdLoadState } from '../types-CTcZX5SL.js';
1
+ import { f as AdLoadState } from '../types-Bb6Axy4u.js';
2
2
  import '@adview/core/typings';
3
3
  import 'react';
4
4
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/AdViewUnit/AdViewProvider.tsx","../src/AdViewUnit/AdViewUnit.client.tsx","../src/AdViewUnit/AdViewUnitBannerTemplate.tsx","../src/AdViewUnit/utils.ts","../src/AdViewUnit/AdViewUnitNativeTemplate.tsx","../src/AdViewUnit/AdViewUnitProxyTemplate.tsx","../src/AdViewUnit/AdViewUnitTemplate.tsx","../src/AdViewUnit/AdViewUnitTracking.tsx","../src/AdViewUnit/useAdViewController.ts","../src/AdViewUnit/AdViewUnitDefaultTemplate.tsx"],"sourcesContent":["import AdViewProvider from './AdViewUnit/AdViewProvider';\nimport AdViewUnitClient from './AdViewUnit/AdViewUnit.client';\nimport AdViewUnitBannerTemplate from './AdViewUnit/AdViewUnitBannerTemplate';\nimport AdViewUnitDefaultTemplate from './AdViewUnit/AdViewUnitDefaultTemplate';\nimport AdViewUnitNativeTemplate from './AdViewUnit/AdViewUnitNativeTemplate';\nimport AdViewUnitProxyTemplate from './AdViewUnit/AdViewUnitProxyTemplate';\nimport AdViewUnitTemplate from './AdViewUnit/AdViewUnitTemplate';\n\nexport {\n AdViewProvider,\n AdViewUnitBannerTemplate,\n AdViewUnitClient,\n AdViewUnitDefaultTemplate,\n AdViewUnitNativeTemplate,\n AdViewUnitProxyTemplate,\n AdViewUnitTemplate,\n\n AdViewUnitBannerTemplate as BannerTemplate,\n AdViewUnitDefaultTemplate as DefaultTemplate,\n AdViewUnitNativeTemplate as NativeTemplate,\n AdViewProvider as Provider,\n AdViewUnitProxyTemplate as ProxyTemplate,\n AdViewUnitTemplate as Template,\n AdViewUnitClient as Unit\n};\n","'use client';\n\nimport React, { createContext } from 'react';\nimport { type AdViewConfig } from '../types';\n\ntype AdViewProviderContextProps = AdViewConfig;\n\nexport const AdViewProviderContext = createContext<AdViewProviderContextProps>(\n {} as AdViewProviderContextProps,\n);\n\ntype AdViewProviderProps = {\n children: React.ReactNode;\n} & AdViewProviderContextProps;\n\nconst AdViewProvider = ({ children, ...props }: AdViewProviderProps) => {\n return (\n <AdViewProviderContext.Provider value={props}>\n {children}\n </AdViewProviderContext.Provider>\n );\n};\n\nexport default AdViewProvider;\n","'use client';\n\nimport { AdViewGroupItem } from '@adview/core';\nimport React from 'react';\nimport { AdViewUnitClientChildren, AdViewUnitPropsBase } from '../types';\nimport AdViewUnitBannerTemplate from './AdViewUnitBannerTemplate';\nimport AdViewUnitNativeTemplate from './AdViewUnitNativeTemplate';\nimport AdViewUnitProxyTemplate from './AdViewUnitProxyTemplate';\nimport { renderAnyTemplates } from './AdViewUnitTemplate';\nimport AdViewUnitTracking from './AdViewUnitTracking';\nimport useAdViewController from './useAdViewController';\n\nexport type AdViewUnitClientProps = AdViewUnitPropsBase & {\n children?: AdViewUnitClientChildren;\n};\n\n// AdViewUnitClient is a client-side component that fetches ad data and renders it\n// using the provided children function. It handles loading, error states, and\n// tracks ad interactions.\n//\n// Example usage:\n// <AdView.Unit unitId=\"my-unit\" format=\"banner\" srcURL=\"https://api.example.com/ads/{<id>}\">\n// {({ data, state, error }) => (\n// <div>\n// {state.isLoading && <span>Loading...</span>}\n// {error && <span>Error: {error.message}</span>}\n// {data && <img src={data.imageUrl} alt={data.title} />\n// </div>\n// )}\n// </AdView.Unit>\n//\n// Note: This component is designed to be used in a client-side environment where\n// ad data can be fetched dynamically. It is not suitable for server-side rendering.\n// It uses the AdViewUnitTracking component to handle ad tracking and interactions.\nfunction AdViewUnitClient({\n unitId,\n limit = 1,\n format,\n children,\n ...config\n}: AdViewUnitClientProps) {\n const checkFormat = (f: string) => {\n if (!format) {\n return true;\n }\n return Array.isArray(format) ? format.includes(f) : f === format;\n };\n\n const [response, error, loadState] = useAdViewController(\n config,\n unitId,\n limit || 1,\n format,\n );\n\n const {\n responseGroup: _,\n customTracker,\n groupItems,\n } = error\n ? { responseGroup: null, customTracker: {}, groupItems: [] }\n : (() => {\n for (let responseGroup of response?.groups || []) {\n const customTracker = responseGroup?.custom_tracker ?? {};\n const groupItems = (responseGroup?.items || [])\n .map(it => (checkFormat(it.type) ? it : null))\n .filter(Boolean);\n if (groupItems && groupItems.length > 0) {\n return { responseGroup, customTracker, groupItems };\n }\n }\n return { responseGroup: null, customTracker: {}, groupItems: [] };\n })();\n\n if (!children) {\n children = [\n <AdViewUnitBannerTemplate />,\n <AdViewUnitNativeTemplate />,\n <AdViewUnitProxyTemplate />,\n ];\n }\n\n if (groupItems && groupItems?.length > 0) {\n return (groupItems as AdViewGroupItem[]).map(\n ({ tracker, ...data }, index) => {\n return (\n <AdViewUnitTracking key={data.id} {...tracker}>\n {renderAnyTemplates(children, {\n unitId,\n index,\n data,\n type: data.type || 'default',\n error,\n state: loadState,\n })}\n </AdViewUnitTracking>\n );\n },\n );\n }\n\n return (\n <AdViewUnitTracking {...customTracker}>\n {renderAnyTemplates(children, {\n unitId,\n index: -1,\n data: null,\n type: 'default',\n error,\n state: loadState,\n })}\n </AdViewUnitTracking>\n );\n}\n\nexport default AdViewUnitClient;\n","import {\n getAssetByName,\n getPrepareURL,\n getSrcSetCSSThumbs,\n} from '@adview/core/utils';\nimport React from 'react';\nimport { AdLoadState, AdViewUnitTemplateTypeProps } from '../types';\nimport { matchExpectedState } from './utils';\n\ntype AdViewUnitBannerTemplateProps = Omit<\n AdViewUnitTemplateTypeProps,\n 'type'\n> & {\n type?: 'banner';\n className?: string;\n style?: React.CSSProperties;\n};\n\nfunction AdViewUnitBannerTemplate({\n className = 'banner',\n style,\n data,\n state,\n ...props\n}: AdViewUnitBannerTemplateProps) {\n const expectState: AdLoadState =\n props?.isInitial || props?.isLoading || props?.isError || props?.isComplete\n ? {\n isInitial: props?.isInitial,\n isLoading: props?.isLoading,\n isError: props?.isError,\n isComplete: props?.isComplete,\n }\n : { isComplete: true };\n\n if (!data || !data.assets || !data.assets.length) {\n return null;\n }\n\n // Check if the expected state matches the current state\n if (!matchExpectedState(expectState, state)) {\n return null;\n }\n\n const asset = getAssetByName('main', data.assets);\n\n return (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(data.url)}\n className={className}\n style={{ fontSize: 0, ...style }}\n >\n {asset && (\n <img\n alt=\"main\"\n src={asset.path}\n srcSet={asset.thumbs ? getSrcSetCSSThumbs(asset.thumbs) : ''}\n style={{ maxWidth: '100%' }}\n />\n )}\n </a>\n );\n}\n\nAdViewUnitBannerTemplate.defaults = {\n type: 'banner',\n};\n\nexport default AdViewUnitBannerTemplate;\n","import { AdLoadState } from \"../types\";\n\nexport const matchExpectedState = (expectState?: AdLoadState, state?: AdLoadState) => {\n return !expectState || (\n (expectState.isInitial === undefined || expectState.isInitial === state?.isInitial) &&\n (expectState.isLoading === undefined || expectState.isLoading === state?.isLoading) &&\n (expectState.isError === undefined || expectState.isError === state?.isError) &&\n (expectState.isComplete === undefined || expectState.isComplete === state?.isComplete)\n );\n};\n","import { getAssetByName, getPrepareURL, getSrcSetCSSThumbs } from '@adview/core/utils';\nimport React from 'react';\nimport { AdLoadState, AdViewStyleTokensNative, AdViewUnitTemplateTypeProps } from '../types';\nimport { matchExpectedState } from './utils';\n\ntype AdViewUnitNativeTemplateProps = Omit<AdViewUnitTemplateTypeProps, 'type'> & {\n type?: 'native';\n classNames?: AdViewStyleTokensNative;\n};\n\nfunction AdViewUnitNativeTemplate({classNames, data, state, ...props}: AdViewUnitNativeTemplateProps) {\n if (!data || !data.assets || !data.assets.length) {\n return null;\n }\n\n const expectState: AdLoadState =\n (props?.isInitial || props?.isLoading || props?.isError || props?.isComplete) ? {\n isInitial: props?.isInitial,\n isLoading: props?.isLoading,\n isError: props?.isError,\n isComplete: props?.isComplete\n } : {isComplete: true};\n\n // Check if the expected state matches the current state\n if (!matchExpectedState(expectState, state)) {\n return null;\n }\n\n const { assets, url, fields } = data;\n const asset = getAssetByName('main', assets);\n\n if (!url) {\n return null;\n }\n\n return (\n <div className={classNames?.container}>\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n className={classNames?.imageLink}\n >\n {asset && (\n <img\n alt={fields?.title}\n title={fields?.title}\n src={asset.path}\n srcSet={asset.thumbs ? getSrcSetCSSThumbs(asset.thumbs) : undefined}\n className={classNames?.image}\n style={{ objectFit: 'cover', width: '100%', height: '100%' }}\n />\n )}\n </a>\n <div className={classNames?.label}>\n {fields?.title && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"titleLink\"\n className={classNames?.titleLink}\n >\n {fields.title}\n </a>\n )}\n {fields?.description && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"descriptionLink\"\n className={classNames?.descriptionLink}\n >\n {fields.description}\n </a>\n )}\n {fields?.brandname && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"brandNameLink\"\n className={classNames?.brandNameLink}\n >\n {fields.brandname}\n </a>\n )}\n {fields?.phone && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"phoneLink\"\n className={classNames?.phoneLink}\n >\n {fields.phone}\n </a>\n )}\n {fields?.url && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"urlLink\"\n className={classNames?.urlLink}\n >\n {fields?.url}\n </a>\n )}\n </div>\n </div>\n );\n}\n\nAdViewUnitNativeTemplate.defaults = {\n type: 'native',\n};\n\nexport default AdViewUnitNativeTemplate;\n","import React from 'react';\nimport { AdLoadState, AdViewUnitTemplateTypeProps } from '../types';\nimport { matchExpectedState } from './utils';\n\ntype AdViewUnitProxyTemplateProps = Omit<AdViewUnitTemplateTypeProps, 'type'> & {\n type?: 'proxy';\n className?: string;\n style?: React.CSSProperties;\n};\n\nfunction AdViewUnitProxyTemplate({className, style, data, state, ...props}: AdViewUnitProxyTemplateProps) {\n if (!data) {\n return null;\n }\n\n const expectState: AdLoadState =\n (props?.isInitial || props?.isLoading || props?.isError || props?.isComplete) ? {\n isInitial: props?.isInitial,\n isLoading: props?.isLoading,\n isError: props?.isError,\n isComplete: props?.isComplete\n } : {isComplete: true};\n\n // Check if the expected state matches the current state\n if (!matchExpectedState(expectState, state)) {\n return null;\n }\n\n const { url, fields } = data;\n const iframeSrc = fields?.url || url;\n\n if (!iframeSrc) {\n return null;\n }\n\n return (\n <iframe\n className={className}\n width=\"100%\"\n height=\"100%\"\n frameBorder=\"0\"\n marginWidth={0}\n marginHeight={0}\n allowTransparency={true}\n scrolling=\"no\"\n allowFullScreen={true}\n style={{ width: '100%', height: '100%', border: 'none', ...style }}\n src={iframeSrc}\n ></iframe>\n );\n}\n\nAdViewUnitProxyTemplate.defaults = {\n type: 'proxy',\n};\n\nexport default AdViewUnitProxyTemplate;\n","//\n// Example\n// <AdView.Unit>\n// <AdView.Template type=\"banner\">\n// <...>\n// </AdView.Template>\n// </AdView.Unit>\n//\n\nimport React, { JSX } from 'react';\nimport { AdLoadState, AdViewUnitClientChildrenProps, AdViewUnitTemplateProps, AdViewUnitTemplateTypeProps } from '../types';\nimport { matchExpectedState } from './utils';\n\n// TemplateListRender is a function that takes a list of TemplateType and returns a React element\nexport type TemplateListRender = (tmpls: TemplateElement[]) => React.ReactElement | JSX.Element;\n\n// TemplateType is a React component that can be used to render ad templates\nexport type TemplateType = React.Component<AdViewUnitTemplateProps>;\nexport type TemplateElement = React.ReactElement<AdViewUnitTemplateProps>;\n\n// TemplateTypeFunction is a function that takes AdViewUnitTemplateTypeProps and returns a React node or element\nexport type TemplateTypeFunction = (props: AdViewUnitTemplateTypeProps) => React.ReactNode | React.ReactElement;\n\n// templateFromListRender is a function that takes a list of TemplateType and returns a React element\nexport const templateFromListRender = (tmpls: TemplateElement[], data: AdViewUnitTemplateTypeProps, wrap?: (children: React.ReactNode) => React.ReactNode): JSX.Element | React.ReactElement => {\n let renderedRemplates = tmpls.map((tmpl, index) => {\n let tmp = renderTemplate(tmpl, data);\n return !!tmp && React.isValidElement(tmp)\n ? <React.Fragment key={index}>{!!wrap ? wrap(tmp) : tmp}</React.Fragment>\n : null;\n }).filter(it => !!it);\n\n if (!renderedRemplates.length) {\n renderedRemplates = tmpls.map((tmpl, index) => {\n let tmp = renderTemplate(tmpl, {...data, type: 'default'});\n return !!tmp && React.isValidElement(tmp)\n ? <React.Fragment key={index}>{!!wrap ? wrap(tmp) : tmp}</React.Fragment>\n : null;\n }).filter(it => !!it);\n }\n\n return (<>{renderedRemplates}</>);\n};\n\n// renderTemplate is a function that takes a TemplateType or a function and returns a React node\nexport const renderTemplate = (tmpl: TemplateElement | TemplateTypeFunction, data: AdViewUnitTemplateTypeProps): React.ReactNode => {\n const isFunction = typeof tmpl === 'function';\n const isReactElement = React.isValidElement(tmpl);\n\n if (isReactElement) {\n // Extract type and children from the React element\n let { type, children } = tmpl.props;\n if (!type && typeof tmpl.type !== 'string') {\n type = (tmpl.type as any)?.defaults?.type;\n }\n // If the type does not match, return null\n if (!!type && type !== '*' && data.type !== type) {\n return null;\n }\n // If children is a function, call it with the data\n if (typeof children === 'function') {\n return children(data as AdViewUnitClientChildrenProps);\n }\n // If children is a React element, clone it with the new props\n return React.cloneElement((tmpl as TemplateElement), {\n ...data,\n children: children,\n });\n }\n\n if (isFunction) {\n return tmpl(data);\n }\n\n return null;\n}\n\n// renderTemplates is a function that takes a list of TemplateType and returns a React element\nexport const renderTemplates = (tmpls: TemplateElement[], data: AdViewUnitTemplateTypeProps, listRender?: TemplateListRender): React.ReactNode | React.ReactElement | JSX.Element => {\n return listRender ? listRender(tmpls) : templateFromListRender(tmpls, data);\n};\n\nexport const renderAnyTemplates = (tmpls: any, data: AdViewUnitTemplateTypeProps, listRender?: TemplateListRender): React.ReactNode | React.ReactElement | JSX.Element | null => {\n if (!tmpls) {\n return null;\n }\n\n if (Array.isArray(tmpls)) {\n return renderTemplates(tmpls as TemplateElement[], data, listRender);\n }\n\n if (typeof tmpls === 'function') {\n return tmpls(data);\n }\n\n if (React.isValidElement(tmpls)) {\n return templateFromListRender([tmpls as TemplateElement], data);\n }\n\n return null;\n}\n\n// Template is a React component that renders a template based on the type and data provided\n// Example usage:\n// <AdView.Unit>\n// <AdView.Template type=\"banner\" data={{...}}>\n// </AdView.Unit>\nconst AdViewUnitTemplate = ({ type, state, children, ...props }: AdViewUnitTemplateProps) => {\n const tmplProps: AdViewUnitTemplateTypeProps = {\n type,\n state,\n ...props,\n };\n \n const expectState: AdLoadState =\n (props?.isInitial || props?.isLoading || props?.isError || props?.isComplete) ? {\n isInitial: props?.isInitial,\n isLoading: props?.isLoading,\n isError: props?.isError,\n isComplete: props?.isComplete\n } : {isComplete: true};\n\n // Check if the expected state matches the current state\n if (!matchExpectedState(expectState, state)) {\n return null;\n }\n\n // If children is a function, call it with the data\n if (typeof children === 'function') {\n return children(tmplProps as AdViewUnitClientChildrenProps) as React.ReactElement;\n }\n\n // If children is a React element, clone it with the new props\n if (React.isValidElement(children)) {\n return React.cloneElement(children, tmplProps);\n }\n\n // If no children are provided, return an empty fragment\n return <></>;\n}\n\nexport default AdViewUnitTemplate;\n","'use client';\n\nimport { executeImpressionsTracking } from '@adview/core/utils';\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react';\n\ntype AdViewUnitTrackingProps = {\n impressions?: string[];\n views?: string[];\n clicks?: string[];\n children: React.ReactNode;\n};\n\nfunction AdViewUnitTracking({\n impressions,\n views,\n clicks,\n children,\n}: AdViewUnitTrackingProps) {\n const isServer = typeof window === 'undefined';\n const wrapperRef = useRef<HTMLDivElement>(null);\n const executeImpressionsTrackingHandler = useCallback(\n () => executeImpressionsTracking(impressions),\n [impressions],\n );\n const trackingObserverInstanceHandler = useCallback(\n (entries: IntersectionObserverEntry[]) => {\n entries.forEach(entry => {\n if (entry.isIntersecting) {\n executeImpressionsTracking(views);\n trackingObserverInstance?.unobserve(wrapperRef.current!);\n }\n });\n },\n [views],\n );\n const trackingObserverInstance = useMemo<IntersectionObserver | null>(() => {\n return !isServer\n ? new IntersectionObserver(trackingObserverInstanceHandler)\n : null;\n }, [isServer, trackingObserverInstanceHandler]);\n const clickTrackerHandler = useCallback(() => {\n executeImpressionsTracking(clicks);\n\n wrapperRef.current?.removeEventListener('click', clickTrackerHandler);\n }, [clicks]);\n\n useEffect(() => {\n if (wrapperRef.current && trackingObserverInstance) {\n executeImpressionsTrackingHandler();\n wrapperRef.current?.addEventListener('click', clickTrackerHandler);\n trackingObserverInstance?.observe(wrapperRef.current);\n\n return () => {\n wrapperRef.current?.removeEventListener('click', clickTrackerHandler);\n if (wrapperRef.current)\n trackingObserverInstance?.unobserve(wrapperRef.current);\n };\n }\n\n return () => {};\n }, [\n trackingObserverInstance,\n executeImpressionsTrackingHandler,\n clickTrackerHandler,\n ]);\n\n return <div ref={wrapperRef}>{children}</div>;\n}\n\nexport default AdViewUnitTracking;\n","'use client';\n\nimport { AdViewData, AdViewDataLoader } from '@adview/core/typings';\nimport { getDataLoaderFromConfig, getResolveConfig } from '@adview/core/utils';\nimport { useContext, useEffect, useState } from 'react';\nimport { AdLoadState, AdViewConfig } from '../types';\nimport { AdViewProviderContext } from './AdViewProvider';\n\ntype UseAdViewControllerProps = [AdViewData | null, Error | null, AdLoadState];\n\nfunction useAdViewController(\n adUnitConfig: AdViewConfig,\n unitId: string,\n limit: number = 1,\n format?: string | string[],\n): UseAdViewControllerProps {\n const [adLoadState, setAdLoadState] = useState<string>('initial');\n const [adData, setAdData] = useState<AdViewData | null>(null);\n const [errorMessage, setErrorMessage] = useState<Error | null>(null);\n const globalConfig = useContext(AdViewProviderContext);\n const baseConfig = getResolveConfig({ ...adUnitConfig, ...globalConfig });\n const dataLoader: AdViewDataLoader = getDataLoaderFromConfig(baseConfig);\n\n const loadAd = async () => {\n setAdLoadState('loading');\n\n try {\n const response = await dataLoader.fetchAdData(\n unitId,\n limit,\n format || '',\n );\n\n if (response instanceof Error) {\n setAdLoadState('error');\n setErrorMessage(response);\n } else {\n setAdData(response);\n }\n setAdLoadState('complete');\n } catch (error) {\n setAdLoadState('error');\n setAdLoadState('complete');\n setErrorMessage(error as Error);\n }\n };\n\n const loadState = {\n isInitial: adLoadState === 'initial',\n isLoading: adLoadState === 'loading',\n isComplete: adLoadState === 'complete',\n isError: adLoadState === 'error',\n };\n\n useEffect(() => {\n loadAd();\n }, [unitId, limit, format]);\n\n return [adData, errorMessage, loadState];\n}\n\nexport default useAdViewController;\n","import React from \"react\";\nimport { AdLoadState, AdViewOptionalDataProps, AdViewUnitTemplateTypeProps } from \"../types\";\nimport { matchExpectedState } from \"./utils\";\n\ntype AdViewUnitDefaultTemplateProps = Omit<AdViewUnitTemplateTypeProps, 'type'> & {\n type?: 'default';\n children?: React.ReactNode | ((props: AdViewOptionalDataProps) => React.ReactNode);\n};\n\nfunction AdViewUnitDefaultTemplate({ type='default', data, state, children, ...props }: AdViewUnitDefaultTemplateProps) {\n if (data) {\n return null;\n }\n\n const expectState: AdLoadState =\n (props?.isInitial || props?.isLoading || props?.isError || props?.isComplete) ? {\n isInitial: props?.isInitial,\n isLoading: props?.isLoading,\n isError: props?.isError,\n isComplete: props?.isComplete\n } : {isComplete: true};\n\n // Check if the expected state matches the current state\n if (!matchExpectedState(expectState, state)) {\n return null;\n }\n\n if (typeof children === 'function') {\n return <>{children({ data, state, ...props })}</>;\n }\n\n return (\n children ? <>{children}</> : (\n <div style={{ padding: '1rem', textAlign: 'center', color: '#666' }}>\n <p>🔄 Default content for ad unit</p>\n <p>Data: {JSON.stringify(data)}</p>\n <p>State: {JSON.stringify(state)}</p>\n </div>\n )\n );\n}\n\nAdViewUnitDefaultTemplate.defaults = {\n type: 'default',\n};\n\nexport default AdViewUnitDefaultTemplate;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,mBAAqC;AAK9B,IAAM,4BAAwB;AAAA,EACnC,CAAC;AACH;AAMA,IAAM,iBAAiB,CAAC,EAAE,UAAU,GAAG,MAAM,MAA2B;AACtE,SACE,6BAAAA,QAAA,cAAC,sBAAsB,UAAtB,EAA+B,OAAO,SACpC,QACH;AAEJ;AAEA,IAAO,yBAAQ;;;ACpBf,IAAAC,gBAAk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Y,OAAO;AAAA,EACrB,IAAI,EAAC,YAAY,KAAI;AAGvB,MAAI,CAAC,mBAAmB,aAAa,KAAK,GAAG;AAC3C,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,aAAa,YAAY;AAClC,WAAO,8BAAAC,QAAA,4BAAAA,QAAA,gBAAG,SAAS,EAAE,MAAM,OAAO,GAAG,MAAM,CAAC,CAAE;AAAA,EAChD;AAEA,SACE,WAAW,8BAAAA,QAAA,4BAAAA,QAAA,gBAAG,QAAS,IACrB,8BAAAA,QAAA,cAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,WAAW,UAAU,OAAO,OAAO,KAChE,8BAAAA,QAAA,cAAC,WAAE,uCAA8B,GACjC,8BAAAA,QAAA,cAAC,WAAE,UAAO,KAAK,UAAU,IAAI,CAAE,GAC/B,8BAAAA,QAAA,cAAC,WAAE,WAAQ,KAAK,UAAU,KAAK,CAAE,CACnC;AAGN;AAEA,0BAA0B,WAAW;AAAA,EACnC,MAAM;AACR;AAEA,IAAO,oCAAQ;","names":["React","import_react","import_react","React","import_utils","import_react","React","import_react","React","import_react","React","import_utils","import_react","React","import_utils","import_react","customTracker","groupItems","React","import_react","React"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/AdViewUnit/AdViewProvider.tsx","../src/AdViewUnit/AdViewUnit.client.tsx","../src/AdViewUnit/AdViewUnitBannerTemplate.tsx","../src/AdViewUnit/utils.ts","../src/AdViewUnit/AdViewUnitNativeTemplate.tsx","../src/AdViewUnit/AdViewUnitProxyTemplate.tsx","../src/AdViewUnit/AdViewUnitTemplate.tsx","../src/AdViewUnit/AdViewUnitTracking.tsx","../src/AdViewUnit/useAdViewController.ts","../src/AdViewUnit/AdViewUnitDefaultTemplate.tsx"],"sourcesContent":["import AdViewProvider from './AdViewUnit/AdViewProvider';\nimport AdViewUnitClient from './AdViewUnit/AdViewUnit.client';\nimport AdViewUnitBannerTemplate from './AdViewUnit/AdViewUnitBannerTemplate';\nimport AdViewUnitDefaultTemplate from './AdViewUnit/AdViewUnitDefaultTemplate';\nimport AdViewUnitNativeTemplate from './AdViewUnit/AdViewUnitNativeTemplate';\nimport AdViewUnitProxyTemplate from './AdViewUnit/AdViewUnitProxyTemplate';\nimport AdViewUnitTemplate from './AdViewUnit/AdViewUnitTemplate';\nimport {\n AdViewOptionalDataProps,\n AdViewUnitClientChildren,\n AdViewUnitTemplateProps,\n AdViewUnitTemplateTypeProps,\n} from './types';\n\nexport {\n AdViewOptionalDataProps,\n AdViewProvider,\n AdViewUnitBannerTemplate,\n AdViewUnitClient,\n AdViewUnitClientChildren,\n AdViewUnitDefaultTemplate,\n AdViewUnitNativeTemplate,\n AdViewUnitProxyTemplate,\n AdViewUnitTemplate,\n AdViewUnitTemplateProps,\n AdViewUnitTemplateTypeProps,\n\n /**\n * Components renamed for easier imports\n */\n AdViewUnitBannerTemplate as BannerTemplate,\n AdViewUnitDefaultTemplate as DefaultTemplate,\n AdViewUnitNativeTemplate as NativeTemplate,\n AdViewProvider as Provider,\n AdViewUnitProxyTemplate as ProxyTemplate,\n AdViewUnitTemplate as Template,\n AdViewUnitClient as Unit\n};\n\n","'use client';\n\nimport React, { createContext } from 'react';\nimport { type AdViewConfig } from '../types';\n\ntype AdViewProviderContextProps = AdViewConfig;\n\nexport const AdViewProviderContext = createContext<AdViewProviderContextProps>(\n {} as AdViewProviderContextProps,\n);\n\ntype AdViewProviderProps = {\n children: React.ReactNode;\n} & AdViewProviderContextProps;\n\nconst AdViewProvider = ({ children, ...props }: AdViewProviderProps) => {\n return (\n <AdViewProviderContext.Provider value={props}>\n {children}\n </AdViewProviderContext.Provider>\n );\n};\n\nexport default AdViewProvider;\n","'use client';\n\nimport { AdViewGroupItem } from '@adview/core';\nimport React from 'react';\nimport { AdViewUnitClientChildren, AdViewUnitPropsBase } from '../types';\nimport AdViewUnitBannerTemplate from './AdViewUnitBannerTemplate';\nimport AdViewUnitNativeTemplate from './AdViewUnitNativeTemplate';\nimport AdViewUnitProxyTemplate from './AdViewUnitProxyTemplate';\nimport { renderAnyTemplates } from './AdViewUnitTemplate';\nimport AdViewUnitTracking from './AdViewUnitTracking';\nimport useAdViewController from './useAdViewController';\n\nexport type AdViewUnitClientProps = AdViewUnitPropsBase & {\n children?: AdViewUnitClientChildren;\n};\n\n// AdViewUnitClient is a client-side component that fetches ad data and renders it\n// using the provided children function. It handles loading, error states, and\n// tracks ad interactions.\n//\n// Example usage:\n// <AdView.Unit unitId=\"my-unit\" format=\"banner\" srcURL=\"https://api.example.com/ads/{<id>}\">\n// {({ data, state, error }) => (\n// <div>\n// {state.isLoading && <span>Loading...</span>}\n// {error && <span>Error: {error.message}</span>}\n// {data && <img src={data.imageUrl} alt={data.title} />\n// </div>\n// )}\n// </AdView.Unit>\n//\n// Note: This component is designed to be used in a client-side environment where\n// ad data can be fetched dynamically. It is not suitable for server-side rendering.\n// It uses the AdViewUnitTracking component to handle ad tracking and interactions.\nfunction AdViewUnitClient({\n unitId,\n limit = 1,\n format,\n children,\n ...config\n}: AdViewUnitClientProps) {\n const checkFormat = (f: string) => {\n if (!format) {\n return true;\n }\n return Array.isArray(format) ? format.includes(f) : f === format;\n };\n\n const [response, error, loadState] = useAdViewController(\n config,\n unitId,\n limit || 1,\n format,\n );\n\n const {\n responseGroup: _,\n customTracker,\n groupItems,\n } = error\n ? { responseGroup: null, customTracker: {}, groupItems: [] }\n : (() => {\n for (let responseGroup of response?.groups || []) {\n const customTracker = responseGroup?.custom_tracker ?? {};\n const groupItems = (responseGroup?.items || [])\n .map(it => (checkFormat(it.type) ? it : null))\n .filter(Boolean);\n if (groupItems && groupItems.length > 0) {\n return { responseGroup, customTracker, groupItems };\n }\n }\n return { responseGroup: null, customTracker: {}, groupItems: [] };\n })();\n\n if (!children) {\n children = [\n <AdViewUnitBannerTemplate />,\n <AdViewUnitNativeTemplate />,\n <AdViewUnitProxyTemplate />,\n ];\n }\n\n if (groupItems && groupItems?.length > 0) {\n return (groupItems as AdViewGroupItem[]).map(\n ({ tracker, ...data }, index) => {\n return (\n <AdViewUnitTracking key={data.id} {...tracker}>\n {renderAnyTemplates(children, {\n unitId,\n index,\n data,\n type: data.type || 'default',\n error,\n state: loadState,\n })}\n </AdViewUnitTracking>\n );\n },\n );\n }\n\n return (\n <AdViewUnitTracking {...customTracker}>\n {renderAnyTemplates(children, {\n unitId,\n index: -1,\n data: null,\n type: 'default',\n error,\n state: loadState,\n })}\n </AdViewUnitTracking>\n );\n}\n\nexport default AdViewUnitClient;\n","import {\n getAssetByName,\n getPrepareURL,\n getSrcSetCSSThumbs,\n} from '@adview/core/utils';\nimport React from 'react';\nimport { AdLoadState, AdViewUnitTemplateTypeProps } from '../types';\nimport { matchExpectedState } from './utils';\n\ntype AdViewUnitBannerTemplateProps = Omit<\n AdViewUnitTemplateTypeProps,\n 'type'\n> & {\n type?: 'banner';\n className?: string;\n style?: React.CSSProperties;\n};\n\nfunction AdViewUnitBannerTemplate({\n className = 'banner',\n style,\n data,\n state,\n ...props\n}: AdViewUnitBannerTemplateProps) {\n const expectState: AdLoadState =\n props?.isInitial || props?.isLoading || props?.isError || props?.isComplete\n ? {\n isInitial: props?.isInitial,\n isLoading: props?.isLoading,\n isError: props?.isError,\n isComplete: props?.isComplete,\n }\n : { isComplete: true };\n\n if (!data || !data.assets || !data.assets.length) {\n return null;\n }\n\n // Check if the expected state matches the current state\n if (!matchExpectedState(expectState, state)) {\n return null;\n }\n\n const asset = getAssetByName('main', data.assets);\n\n return (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(data.url)}\n className={className}\n style={{ fontSize: 0, ...style }}\n >\n {asset && (\n <img\n alt=\"main\"\n src={asset.path}\n srcSet={asset.thumbs ? getSrcSetCSSThumbs(asset.thumbs) : ''}\n style={{ maxWidth: '100%' }}\n />\n )}\n </a>\n );\n}\n\nAdViewUnitBannerTemplate.defaults = {\n type: 'banner',\n};\n\nexport default AdViewUnitBannerTemplate;\n","import { AdLoadState } from \"../types\";\n\nexport const matchExpectedState = (expectState?: AdLoadState, state?: AdLoadState) => {\n return !expectState || (\n (expectState.isInitial === undefined || expectState.isInitial === state?.isInitial) &&\n (expectState.isLoading === undefined || expectState.isLoading === state?.isLoading) &&\n (expectState.isError === undefined || expectState.isError === state?.isError) &&\n (expectState.isComplete === undefined || expectState.isComplete === state?.isComplete)\n );\n};\n","import { getAssetByName, getPrepareURL, getSrcSetCSSThumbs } from '@adview/core/utils';\nimport React from 'react';\nimport { AdLoadState, AdViewStyleTokensNative, AdViewUnitTemplateTypeProps } from '../types';\nimport { matchExpectedState } from './utils';\n\ntype AdViewUnitNativeTemplateProps = Omit<AdViewUnitTemplateTypeProps, 'type'> & {\n type?: 'native';\n classNames?: AdViewStyleTokensNative;\n};\n\nfunction AdViewUnitNativeTemplate({classNames, data, state, ...props}: AdViewUnitNativeTemplateProps) {\n if (!data || !data.assets || !data.assets.length) {\n return null;\n }\n\n const expectState: AdLoadState =\n (props?.isInitial || props?.isLoading || props?.isError || props?.isComplete) ? {\n isInitial: props?.isInitial,\n isLoading: props?.isLoading,\n isError: props?.isError,\n isComplete: props?.isComplete\n } : {isComplete: true};\n\n // Check if the expected state matches the current state\n if (!matchExpectedState(expectState, state)) {\n return null;\n }\n\n const { assets, url, fields } = data;\n const asset = getAssetByName('main', assets);\n\n if (!url) {\n return null;\n }\n\n return (\n <div className={classNames?.container}>\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n className={classNames?.imageLink}\n >\n {asset && (\n <img\n alt={fields?.title}\n title={fields?.title}\n src={asset.path}\n srcSet={asset.thumbs ? getSrcSetCSSThumbs(asset.thumbs) : undefined}\n className={classNames?.image}\n style={{ objectFit: 'cover', width: '100%', height: '100%' }}\n />\n )}\n </a>\n <div className={classNames?.label}>\n {fields?.title && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"titleLink\"\n className={classNames?.titleLink}\n >\n {fields.title}\n </a>\n )}\n {fields?.description && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"descriptionLink\"\n className={classNames?.descriptionLink}\n >\n {fields.description}\n </a>\n )}\n {fields?.brandname && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"brandNameLink\"\n className={classNames?.brandNameLink}\n >\n {fields.brandname}\n </a>\n )}\n {fields?.phone && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"phoneLink\"\n className={classNames?.phoneLink}\n >\n {fields.phone}\n </a>\n )}\n {fields?.url && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"urlLink\"\n className={classNames?.urlLink}\n >\n {fields?.url}\n </a>\n )}\n </div>\n </div>\n );\n}\n\nAdViewUnitNativeTemplate.defaults = {\n type: 'native',\n};\n\nexport default AdViewUnitNativeTemplate;\n","import React from 'react';\nimport { AdLoadState, AdViewUnitTemplateTypeProps } from '../types';\nimport { matchExpectedState } from './utils';\n\ntype AdViewUnitProxyTemplateProps = Omit<AdViewUnitTemplateTypeProps, 'type'> & {\n type?: 'proxy';\n className?: string;\n style?: React.CSSProperties;\n};\n\nfunction AdViewUnitProxyTemplate({className, style, data, state, ...props}: AdViewUnitProxyTemplateProps) {\n if (!data) {\n return null;\n }\n\n const expectState: AdLoadState =\n (props?.isInitial || props?.isLoading || props?.isError || props?.isComplete) ? {\n isInitial: props?.isInitial,\n isLoading: props?.isLoading,\n isError: props?.isError,\n isComplete: props?.isComplete\n } : {isComplete: true};\n\n // Check if the expected state matches the current state\n if (!matchExpectedState(expectState, state)) {\n return null;\n }\n\n const { url, fields } = data;\n const iframeSrc = fields?.url || url;\n\n if (!iframeSrc) {\n return null;\n }\n\n return (\n <iframe\n className={className}\n width=\"100%\"\n height=\"100%\"\n frameBorder=\"0\"\n marginWidth={0}\n marginHeight={0}\n allowTransparency={true}\n scrolling=\"no\"\n allowFullScreen={true}\n style={{ width: '100%', height: '100%', border: 'none', ...style }}\n src={iframeSrc}\n ></iframe>\n );\n}\n\nAdViewUnitProxyTemplate.defaults = {\n type: 'proxy',\n};\n\nexport default AdViewUnitProxyTemplate;\n","//\n// Example\n// <AdView.Unit>\n// <AdView.Template type=\"banner\">\n// <...>\n// </AdView.Template>\n// </AdView.Unit>\n//\n\nimport React, { JSX } from 'react';\nimport { AdLoadState, AdViewUnitClientChildrenProps, AdViewUnitTemplateProps, AdViewUnitTemplateTypeProps } from '../types';\nimport { matchExpectedState } from './utils';\n\n// TemplateListRender is a function that takes a list of TemplateType and returns a React element\nexport type TemplateListRender = (tmpls: TemplateElement[]) => React.ReactElement | JSX.Element;\n\n// TemplateType is a React component that can be used to render ad templates\nexport type TemplateType = React.Component<AdViewUnitTemplateProps>;\nexport type TemplateElement = React.ReactElement<AdViewUnitTemplateProps>;\n\n// TemplateTypeFunction is a function that takes AdViewUnitTemplateTypeProps and returns a React node or element\nexport type TemplateTypeFunction = (props: AdViewUnitTemplateTypeProps) => React.ReactNode | React.ReactElement;\n\n// templateFromListRender is a function that takes a list of TemplateType and returns a React element\nexport const templateFromListRender = (tmpls: TemplateElement[], data: AdViewUnitTemplateTypeProps, wrap?: (children: React.ReactNode) => React.ReactNode): JSX.Element | React.ReactElement => {\n let renderedRemplates = tmpls.map((tmpl, index) => {\n let tmp = renderTemplate(tmpl, data);\n return !!tmp && React.isValidElement(tmp)\n ? <React.Fragment key={index}>{!!wrap ? wrap(tmp) : tmp}</React.Fragment>\n : null;\n }).filter(it => !!it);\n\n if (!renderedRemplates.length) {\n renderedRemplates = tmpls.map((tmpl, index) => {\n let tmp = renderTemplate(tmpl, {...data, type: 'default'});\n return !!tmp && React.isValidElement(tmp)\n ? <React.Fragment key={index}>{!!wrap ? wrap(tmp) : tmp}</React.Fragment>\n : null;\n }).filter(it => !!it);\n }\n\n return (<>{renderedRemplates}</>);\n};\n\n// renderTemplate is a function that takes a TemplateType or a function and returns a React node\nexport const renderTemplate = (tmpl: TemplateElement | TemplateTypeFunction, data: AdViewUnitTemplateTypeProps): React.ReactNode => {\n const isFunction = typeof tmpl === 'function';\n const isReactElement = React.isValidElement(tmpl);\n\n if (isReactElement) {\n // Extract type and children from the React element\n let { type, children } = tmpl.props;\n if (!type && typeof tmpl.type !== 'string') {\n type = (tmpl.type as any)?.defaults?.type;\n }\n // If the type does not match, return null\n if (!!type && type !== '*' && data.type !== type) {\n return null;\n }\n // If children is a function, call it with the data\n if (typeof children === 'function') {\n return children(data as AdViewUnitClientChildrenProps);\n }\n // If children is a React element, clone it with the new props\n return React.cloneElement((tmpl as TemplateElement), {\n ...data,\n children: children,\n });\n }\n\n if (isFunction) {\n return tmpl(data);\n }\n\n return null;\n}\n\n// renderTemplates is a function that takes a list of TemplateType and returns a React element\nexport const renderTemplates = (tmpls: TemplateElement[], data: AdViewUnitTemplateTypeProps, listRender?: TemplateListRender): React.ReactNode | React.ReactElement | JSX.Element => {\n return listRender ? listRender(tmpls) : templateFromListRender(tmpls, data);\n};\n\nexport const renderAnyTemplates = (tmpls: any, data: AdViewUnitTemplateTypeProps, listRender?: TemplateListRender): React.ReactNode | React.ReactElement | JSX.Element | null => {\n if (!tmpls) {\n return null;\n }\n\n if (Array.isArray(tmpls)) {\n return renderTemplates(tmpls as TemplateElement[], data, listRender);\n }\n\n if (typeof tmpls === 'function') {\n return tmpls(data);\n }\n\n if (React.isValidElement(tmpls)) {\n return templateFromListRender([tmpls as TemplateElement], data);\n }\n\n return null;\n}\n\n// Template is a React component that renders a template based on the type and data provided\n// Example usage:\n// <AdView.Unit>\n// <AdView.Template type=\"banner\" data={{...}}>\n// </AdView.Unit>\nconst AdViewUnitTemplate = ({ type, state, children, ...props }: AdViewUnitTemplateProps) => {\n const tmplProps: AdViewUnitTemplateTypeProps = {\n type,\n state,\n ...props,\n };\n \n const expectState: AdLoadState =\n (props?.isInitial || props?.isLoading || props?.isError || props?.isComplete) ? {\n isInitial: props?.isInitial,\n isLoading: props?.isLoading,\n isError: props?.isError,\n isComplete: props?.isComplete\n } : {isComplete: true};\n\n // Check if the expected state matches the current state\n if (!matchExpectedState(expectState, state)) {\n return null;\n }\n\n // If children is a function, call it with the data\n if (typeof children === 'function') {\n return children(tmplProps as AdViewUnitClientChildrenProps) as React.ReactElement;\n }\n\n // If children is a React element, clone it with the new props\n if (React.isValidElement(children)) {\n return React.cloneElement(children, tmplProps);\n }\n\n // If no children are provided, return an empty fragment\n return <></>;\n}\n\nexport default AdViewUnitTemplate;\n","'use client';\n\nimport { executeImpressionsTracking } from '@adview/core/utils';\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react';\n\ntype AdViewUnitTrackingProps = {\n impressions?: string[];\n views?: string[];\n clicks?: string[];\n children: React.ReactNode;\n};\n\nfunction AdViewUnitTracking({\n impressions,\n views,\n clicks,\n children,\n}: AdViewUnitTrackingProps) {\n const isServer = typeof window === 'undefined';\n const wrapperRef = useRef<HTMLDivElement>(null);\n const executeImpressionsTrackingHandler = useCallback(\n () => executeImpressionsTracking(impressions),\n [impressions],\n );\n const trackingObserverInstanceHandler = useCallback(\n (entries: IntersectionObserverEntry[]) => {\n entries.forEach(entry => {\n if (entry.isIntersecting) {\n executeImpressionsTracking(views);\n trackingObserverInstance?.unobserve(wrapperRef.current!);\n }\n });\n },\n [views],\n );\n const trackingObserverInstance = useMemo<IntersectionObserver | null>(() => {\n return !isServer\n ? new IntersectionObserver(trackingObserverInstanceHandler)\n : null;\n }, [isServer, trackingObserverInstanceHandler]);\n const clickTrackerHandler = useCallback(() => {\n executeImpressionsTracking(clicks);\n\n wrapperRef.current?.removeEventListener('click', clickTrackerHandler);\n }, [clicks]);\n\n useEffect(() => {\n if (wrapperRef.current && trackingObserverInstance) {\n executeImpressionsTrackingHandler();\n wrapperRef.current?.addEventListener('click', clickTrackerHandler);\n trackingObserverInstance?.observe(wrapperRef.current);\n\n return () => {\n wrapperRef.current?.removeEventListener('click', clickTrackerHandler);\n if (wrapperRef.current)\n trackingObserverInstance?.unobserve(wrapperRef.current);\n };\n }\n\n return () => {};\n }, [\n trackingObserverInstance,\n executeImpressionsTrackingHandler,\n clickTrackerHandler,\n ]);\n\n return <div ref={wrapperRef}>{children}</div>;\n}\n\nexport default AdViewUnitTracking;\n","'use client';\n\nimport { AdViewData, AdViewDataLoader } from '@adview/core/typings';\nimport { getDataLoaderFromConfig, getResolveConfig } from '@adview/core/utils';\nimport { useContext, useEffect, useState } from 'react';\nimport { AdLoadState, AdViewConfig } from '../types';\nimport { AdViewProviderContext } from './AdViewProvider';\n\ntype UseAdViewControllerProps = [AdViewData | null, Error | null, AdLoadState];\n\nfunction useAdViewController(\n adUnitConfig: AdViewConfig,\n unitId: string,\n limit: number = 1,\n format?: string | string[],\n): UseAdViewControllerProps {\n const [adLoadState, setAdLoadState] = useState<string>('initial');\n const [adData, setAdData] = useState<AdViewData | null>(null);\n const [errorMessage, setErrorMessage] = useState<Error | null>(null);\n const globalConfig = useContext(AdViewProviderContext);\n const baseConfig = getResolveConfig({ ...adUnitConfig, ...globalConfig });\n const dataLoader: AdViewDataLoader = getDataLoaderFromConfig(baseConfig);\n\n const loadAd = async () => {\n setAdLoadState('loading');\n\n try {\n const response = await dataLoader.fetchAdData(\n unitId,\n limit,\n format || '',\n );\n\n if (response instanceof Error) {\n setAdLoadState('error');\n setErrorMessage(response);\n } else {\n setAdData(response);\n }\n setAdLoadState('complete');\n } catch (error) {\n setAdLoadState('error');\n setAdLoadState('complete');\n setErrorMessage(error as Error);\n }\n };\n\n const loadState = {\n isInitial: adLoadState === 'initial',\n isLoading: adLoadState === 'loading',\n isComplete: adLoadState === 'complete',\n isError: adLoadState === 'error',\n };\n\n useEffect(() => {\n loadAd();\n }, [unitId, limit, format]);\n\n return [adData, errorMessage, loadState];\n}\n\nexport default useAdViewController;\n","import React from \"react\";\nimport { AdLoadState, AdViewOptionalDataProps, AdViewUnitTemplateTypeProps } from \"../types\";\nimport { matchExpectedState } from \"./utils\";\n\ntype AdViewUnitDefaultTemplateProps = Omit<AdViewUnitTemplateTypeProps, 'type'> & {\n type?: 'default';\n children?: React.ReactNode | ((props: AdViewOptionalDataProps) => React.ReactNode);\n};\n\nfunction AdViewUnitDefaultTemplate({ type='default', data, state, children, ...props }: AdViewUnitDefaultTemplateProps) {\n if (data) {\n return null;\n }\n\n const expectState: AdLoadState =\n (props?.isInitial || props?.isLoading || props?.isError || props?.isComplete) ? {\n isInitial: props?.isInitial,\n isLoading: props?.isLoading,\n isError: props?.isError,\n isComplete: props?.isComplete\n } : {isComplete: true};\n\n // Check if the expected state matches the current state\n if (!matchExpectedState(expectState, state)) {\n return null;\n }\n\n if (typeof children === 'function') {\n return <>{children({ data, state, ...props })}</>;\n }\n\n return (\n children ? <>{children}</> : (\n <div style={{ padding: '1rem', textAlign: 'center', color: '#666' }}>\n <p>🔄 Default content for ad unit</p>\n <p>Data: {JSON.stringify(data)}</p>\n <p>State: {JSON.stringify(state)}</p>\n </div>\n )\n );\n}\n\nAdViewUnitDefaultTemplate.defaults = {\n type: 'default',\n};\n\nexport default AdViewUnitDefaultTemplate;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,mBAAqC;AAK9B,IAAM,4BAAwB;AAAA,EACnC,CAAC;AACH;AAMA,IAAM,iBAAiB,CAAC,EAAE,UAAU,GAAG,MAAM,MAA2B;AACtE,SACE,6BAAAA,QAAA,cAAC,sBAAsB,UAAtB,EAA+B,OAAO,SACpC,QACH;AAEJ;AAEA,IAAO,yBAAQ;;;ACpBf,IAAAC,gBAAkB;;;ACHlB,mBAIO;AACP,IAAAC,gBAAkB;;;ACHX,IAAM,qBAAqB,CAAC,aAA2B,UAAwB;AACpF,SAAO,CAAC,gBACL,YAAY,cAAc,UAAa,YAAY,cAAc,OAAO,eACxE,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,WAAO,8BAAAC,QAAA,4BAAAA,QAAA,gBAAG,SAAS,EAAE,MAAM,OAAO,GAAG,MAAM,CAAC,CAAE;AAAA,EAChD;AAEA,SACE,WAAW,8BAAAA,QAAA,4BAAAA,QAAA,gBAAG,QAAS,IACrB,8BAAAA,QAAA,cAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,WAAW,UAAU,OAAO,OAAO,KAChE,8BAAAA,QAAA,cAAC,WAAE,uCAA8B,GACjC,8BAAAA,QAAA,cAAC,WAAE,UAAO,KAAK,UAAU,IAAI,CAAE,GAC/B,8BAAAA,QAAA,cAAC,WAAE,WAAQ,KAAK,UAAU,KAAK,CAAE,CACnC;AAGN;AAEA,0BAA0B,WAAW;AAAA,EACnC,MAAM;AACR;AAEA,IAAO,oCAAQ;","names":["React","import_react","import_react","React","import_utils","import_react","React","import_react","React","import_react","React","import_utils","import_react","React","import_utils","import_react","customTracker","groupItems","React","import_react","React"]}
package/dist/index.d.cts CHANGED
@@ -5,6 +5,6 @@ export { default as AdViewUnitDefaultTemplate, default as DefaultTemplate } from
5
5
  export { default as AdViewUnitNativeTemplate, default as NativeTemplate } from './AdViewUnit/AdViewUnitNativeTemplate.cjs';
6
6
  export { default as AdViewUnitProxyTemplate, default as ProxyTemplate } from './AdViewUnit/AdViewUnitProxyTemplate.cjs';
7
7
  export { default as AdViewUnitTemplate, default as Template } from './AdViewUnit/AdViewUnitTemplate.cjs';
8
+ export { A as AdViewOptionalDataProps, a as AdViewUnitClientChildren, b as AdViewUnitTemplateProps, c as AdViewUnitTemplateTypeProps } from './types-Bb6Axy4u.cjs';
8
9
  import 'react';
9
10
  import '@adview/core/typings';
10
- import './types-CTcZX5SL.cjs';
package/dist/index.d.ts CHANGED
@@ -5,6 +5,6 @@ export { default as AdViewUnitDefaultTemplate, default as DefaultTemplate } from
5
5
  export { default as AdViewUnitNativeTemplate, default as NativeTemplate } from './AdViewUnit/AdViewUnitNativeTemplate.js';
6
6
  export { default as AdViewUnitProxyTemplate, default as ProxyTemplate } from './AdViewUnit/AdViewUnitProxyTemplate.js';
7
7
  export { default as AdViewUnitTemplate, default as Template } from './AdViewUnit/AdViewUnitTemplate.js';
8
+ export { A as AdViewOptionalDataProps, a as AdViewUnitClientChildren, b as AdViewUnitTemplateProps, c as AdViewUnitTemplateTypeProps } from './types-Bb6Axy4u.js';
8
9
  import 'react';
9
10
  import '@adview/core/typings';
10
- import './types-CTcZX5SL.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/server.ts","../src/AdViewUnit/AdViewUnit.server.tsx","../src/AdViewUnit/AdViewUnitBannerTemplate.tsx","../src/AdViewUnit/utils.ts","../src/AdViewUnit/AdViewUnitNativeTemplate.tsx","../src/AdViewUnit/AdViewUnitProxyTemplate.tsx","../src/AdViewUnit/AdViewUnitTemplate.tsx","../src/AdViewUnit/AdViewUnitTracking.tsx","../src/AdViewUnit/AdViewUnitDefaultTemplate.tsx"],"sourcesContent":["import AdViewUnitServer from './AdViewUnit/AdViewUnit.server';\nimport AdViewUnitBannerTemplate from './AdViewUnit/AdViewUnitBannerTemplate';\nimport AdViewUnitDefaultTemplate from './AdViewUnit/AdViewUnitDefaultTemplate';\nimport AdViewUnitNativeTemplate from './AdViewUnit/AdViewUnitNativeTemplate';\nimport AdViewUnitProxyTemplate from './AdViewUnit/AdViewUnitProxyTemplate';\nimport AdViewUnitTemplate from './AdViewUnit/AdViewUnitTemplate';\n\nexport {\n AdViewUnitBannerTemplate,\n AdViewUnitDefaultTemplate,\n AdViewUnitNativeTemplate,\n AdViewUnitProxyTemplate,\n AdViewUnitServer,\n AdViewUnitTemplate,\n\n AdViewUnitBannerTemplate as BannerTemplate,\n AdViewUnitDefaultTemplate as DefaultTemplate,\n AdViewUnitNativeTemplate as NativeTemplate,\n AdViewUnitProxyTemplate as ProxyTemplate,\n AdViewUnitTemplate as Template,\n AdViewUnitServer as Unit\n};\n","import React from 'react';\n\nimport { AdViewData, AdViewDataLoader } from '@adview/core';\nimport { AdViewGroupItem } from '@adview/core/typings';\nimport { getDataLoaderFromConfig, getResolveConfig } from '@adview/core/utils';\nimport { AdViewUnitClientChildren, AdViewUnitPropsBase } from '../types';\nimport AdViewUnitBannerTemplate from './AdViewUnitBannerTemplate';\nimport AdViewUnitNativeTemplate from './AdViewUnitNativeTemplate';\nimport AdViewUnitProxyTemplate from './AdViewUnitProxyTemplate';\nimport { renderAnyTemplates } from './AdViewUnitTemplate';\nimport AdViewUnitTracking from './AdViewUnitTracking';\n\nexport type AdViewUnitServerProps = AdViewUnitPropsBase & {\n children?: AdViewUnitClientChildren;\n};\n\nasync function AdViewUnitServer({\n unitId,\n format,\n children,\n ...config\n}: AdViewUnitServerProps) {\n const checkFormat = (f: string) => {\n if (!format) {\n return true;\n }\n return Array.isArray(format) ? format.includes(f) : f === format;\n };\n\n const baseConfig = getResolveConfig(config);\n const dataLoader: AdViewDataLoader = getDataLoaderFromConfig(baseConfig);\n const response = await dataLoader.fetchAdData(unitId, 1, format);\n const isLoadingError = response instanceof Error;\n const error = isLoadingError ? response : undefined;\n const state = {\n isLoading: true,\n isComplete: true,\n isInitial: false,\n isError: isLoadingError,\n };\n\n const {\n responseGroup: _,\n customTracker,\n groupItems,\n } = error\n ? { responseGroup: null, customTracker: {}, groupItems: [] }\n : (() => {\n for (let responseGroup of (response as AdViewData)?.groups || []) {\n const customTracker = responseGroup?.custom_tracker ?? {};\n const groupItems = (responseGroup?.items || [])\n .map(it => (checkFormat(it.type) ? it : null))\n .filter(Boolean) as AdViewGroupItem[];\n if (groupItems && groupItems.length > 0) {\n return { responseGroup, customTracker, groupItems };\n }\n }\n return { responseGroup: null, customTracker: {}, groupItems: [] };\n })();\n\n if (!children) {\n children = [\n <AdViewUnitBannerTemplate />,\n <AdViewUnitNativeTemplate />,\n <AdViewUnitProxyTemplate />,\n ];\n }\n\n if (groupItems && groupItems.length) {\n return groupItems.map(\n ({ tracker, ...data }: AdViewGroupItem, index: number) => {\n return (\n <AdViewUnitTracking key={data.id} {...tracker}>\n {renderAnyTemplates(children, {\n unitId,\n index,\n data,\n type: data.type || 'default',\n error,\n state: state,\n })}\n </AdViewUnitTracking>\n );\n },\n );\n }\n\n return (\n <AdViewUnitTracking {...customTracker}>\n {renderAnyTemplates(children, {\n unitId,\n index: -1,\n data: null,\n type: 'default',\n error,\n state: state,\n })}\n </AdViewUnitTracking>\n );\n}\n\nexport default AdViewUnitServer;\n","import {\n getAssetByName,\n getPrepareURL,\n getSrcSetCSSThumbs,\n} from '@adview/core/utils';\nimport React from 'react';\nimport { AdLoadState, AdViewUnitTemplateTypeProps } from '../types';\nimport { matchExpectedState } from './utils';\n\ntype AdViewUnitBannerTemplateProps = Omit<\n AdViewUnitTemplateTypeProps,\n 'type'\n> & {\n type?: 'banner';\n className?: string;\n style?: React.CSSProperties;\n};\n\nfunction AdViewUnitBannerTemplate({\n className = 'banner',\n style,\n data,\n state,\n ...props\n}: AdViewUnitBannerTemplateProps) {\n const expectState: AdLoadState =\n props?.isInitial || props?.isLoading || props?.isError || props?.isComplete\n ? {\n isInitial: props?.isInitial,\n isLoading: props?.isLoading,\n isError: props?.isError,\n isComplete: props?.isComplete,\n }\n : { isComplete: true };\n\n if (!data || !data.assets || !data.assets.length) {\n return null;\n }\n\n // Check if the expected state matches the current state\n if (!matchExpectedState(expectState, state)) {\n return null;\n }\n\n const asset = getAssetByName('main', data.assets);\n\n return (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(data.url)}\n className={className}\n style={{ fontSize: 0, ...style }}\n >\n {asset && (\n <img\n alt=\"main\"\n src={asset.path}\n srcSet={asset.thumbs ? getSrcSetCSSThumbs(asset.thumbs) : ''}\n style={{ maxWidth: '100%' }}\n />\n )}\n </a>\n );\n}\n\nAdViewUnitBannerTemplate.defaults = {\n type: 'banner',\n};\n\nexport default AdViewUnitBannerTemplate;\n","import { AdLoadState } from \"../types\";\n\nexport const matchExpectedState = (expectState?: AdLoadState, state?: AdLoadState) => {\n return !expectState || (\n (expectState.isInitial === undefined || expectState.isInitial === state?.isInitial) &&\n (expectState.isLoading === undefined || expectState.isLoading === state?.isLoading) &&\n (expectState.isError === undefined || expectState.isError === state?.isError) &&\n (expectState.isComplete === undefined || expectState.isComplete === state?.isComplete)\n );\n};\n","import { getAssetByName, getPrepareURL, getSrcSetCSSThumbs } from '@adview/core/utils';\nimport React from 'react';\nimport { AdLoadState, AdViewStyleTokensNative, AdViewUnitTemplateTypeProps } from '../types';\nimport { matchExpectedState } from './utils';\n\ntype AdViewUnitNativeTemplateProps = Omit<AdViewUnitTemplateTypeProps, 'type'> & {\n type?: 'native';\n classNames?: AdViewStyleTokensNative;\n};\n\nfunction AdViewUnitNativeTemplate({classNames, data, state, ...props}: AdViewUnitNativeTemplateProps) {\n if (!data || !data.assets || !data.assets.length) {\n return null;\n }\n\n const expectState: AdLoadState =\n (props?.isInitial || props?.isLoading || props?.isError || props?.isComplete) ? {\n isInitial: props?.isInitial,\n isLoading: props?.isLoading,\n isError: props?.isError,\n isComplete: props?.isComplete\n } : {isComplete: true};\n\n // Check if the expected state matches the current state\n if (!matchExpectedState(expectState, state)) {\n return null;\n }\n\n const { assets, url, fields } = data;\n const asset = getAssetByName('main', assets);\n\n if (!url) {\n return null;\n }\n\n return (\n <div className={classNames?.container}>\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n className={classNames?.imageLink}\n >\n {asset && (\n <img\n alt={fields?.title}\n title={fields?.title}\n src={asset.path}\n srcSet={asset.thumbs ? getSrcSetCSSThumbs(asset.thumbs) : undefined}\n className={classNames?.image}\n style={{ objectFit: 'cover', width: '100%', height: '100%' }}\n />\n )}\n </a>\n <div className={classNames?.label}>\n {fields?.title && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"titleLink\"\n className={classNames?.titleLink}\n >\n {fields.title}\n </a>\n )}\n {fields?.description && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"descriptionLink\"\n className={classNames?.descriptionLink}\n >\n {fields.description}\n </a>\n )}\n {fields?.brandname && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"brandNameLink\"\n className={classNames?.brandNameLink}\n >\n {fields.brandname}\n </a>\n )}\n {fields?.phone && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"phoneLink\"\n className={classNames?.phoneLink}\n >\n {fields.phone}\n </a>\n )}\n {fields?.url && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"urlLink\"\n className={classNames?.urlLink}\n >\n {fields?.url}\n </a>\n )}\n </div>\n </div>\n );\n}\n\nAdViewUnitNativeTemplate.defaults = {\n type: 'native',\n};\n\nexport default AdViewUnitNativeTemplate;\n","import React from 'react';\nimport { AdLoadState, AdViewUnitTemplateTypeProps } from '../types';\nimport { matchExpectedState } from './utils';\n\ntype AdViewUnitProxyTemplateProps = Omit<AdViewUnitTemplateTypeProps, 'type'> & {\n type?: 'proxy';\n className?: string;\n style?: React.CSSProperties;\n};\n\nfunction AdViewUnitProxyTemplate({className, style, data, state, ...props}: AdViewUnitProxyTemplateProps) {\n if (!data) {\n return null;\n }\n\n const expectState: AdLoadState =\n (props?.isInitial || props?.isLoading || props?.isError || props?.isComplete) ? {\n isInitial: props?.isInitial,\n isLoading: props?.isLoading,\n isError: props?.isError,\n isComplete: props?.isComplete\n } : {isComplete: true};\n\n // Check if the expected state matches the current state\n if (!matchExpectedState(expectState, state)) {\n return null;\n }\n\n const { url, fields } = data;\n const iframeSrc = fields?.url || url;\n\n if (!iframeSrc) {\n return null;\n }\n\n return (\n <iframe\n className={className}\n width=\"100%\"\n height=\"100%\"\n frameBorder=\"0\"\n marginWidth={0}\n marginHeight={0}\n allowTransparency={true}\n scrolling=\"no\"\n allowFullScreen={true}\n style={{ width: '100%', height: '100%', border: 'none', ...style }}\n src={iframeSrc}\n ></iframe>\n );\n}\n\nAdViewUnitProxyTemplate.defaults = {\n type: 'proxy',\n};\n\nexport default AdViewUnitProxyTemplate;\n","//\n// Example\n// <AdView.Unit>\n// <AdView.Template type=\"banner\">\n// <...>\n// </AdView.Template>\n// </AdView.Unit>\n//\n\nimport React, { JSX } from 'react';\nimport { AdLoadState, AdViewUnitClientChildrenProps, AdViewUnitTemplateProps, AdViewUnitTemplateTypeProps } from '../types';\nimport { matchExpectedState } from './utils';\n\n// TemplateListRender is a function that takes a list of TemplateType and returns a React element\nexport type TemplateListRender = (tmpls: TemplateElement[]) => React.ReactElement | JSX.Element;\n\n// TemplateType is a React component that can be used to render ad templates\nexport type TemplateType = React.Component<AdViewUnitTemplateProps>;\nexport type TemplateElement = React.ReactElement<AdViewUnitTemplateProps>;\n\n// TemplateTypeFunction is a function that takes AdViewUnitTemplateTypeProps and returns a React node or element\nexport type TemplateTypeFunction = (props: AdViewUnitTemplateTypeProps) => React.ReactNode | React.ReactElement;\n\n// templateFromListRender is a function that takes a list of TemplateType and returns a React element\nexport const templateFromListRender = (tmpls: TemplateElement[], data: AdViewUnitTemplateTypeProps, wrap?: (children: React.ReactNode) => React.ReactNode): JSX.Element | React.ReactElement => {\n let renderedRemplates = tmpls.map((tmpl, index) => {\n let tmp = renderTemplate(tmpl, data);\n return !!tmp && React.isValidElement(tmp)\n ? <React.Fragment key={index}>{!!wrap ? wrap(tmp) : tmp}</React.Fragment>\n : null;\n }).filter(it => !!it);\n\n if (!renderedRemplates.length) {\n renderedRemplates = tmpls.map((tmpl, index) => {\n let tmp = renderTemplate(tmpl, {...data, type: 'default'});\n return !!tmp && React.isValidElement(tmp)\n ? <React.Fragment key={index}>{!!wrap ? wrap(tmp) : tmp}</React.Fragment>\n : null;\n }).filter(it => !!it);\n }\n\n return (<>{renderedRemplates}</>);\n};\n\n// renderTemplate is a function that takes a TemplateType or a function and returns a React node\nexport const renderTemplate = (tmpl: TemplateElement | TemplateTypeFunction, data: AdViewUnitTemplateTypeProps): React.ReactNode => {\n const isFunction = typeof tmpl === 'function';\n const isReactElement = React.isValidElement(tmpl);\n\n if (isReactElement) {\n // Extract type and children from the React element\n let { type, children } = tmpl.props;\n if (!type && typeof tmpl.type !== 'string') {\n type = (tmpl.type as any)?.defaults?.type;\n }\n // If the type does not match, return null\n if (!!type && type !== '*' && data.type !== type) {\n return null;\n }\n // If children is a function, call it with the data\n if (typeof children === 'function') {\n return children(data as AdViewUnitClientChildrenProps);\n }\n // If children is a React element, clone it with the new props\n return React.cloneElement((tmpl as TemplateElement), {\n ...data,\n children: children,\n });\n }\n\n if (isFunction) {\n return tmpl(data);\n }\n\n return null;\n}\n\n// renderTemplates is a function that takes a list of TemplateType and returns a React element\nexport const renderTemplates = (tmpls: TemplateElement[], data: AdViewUnitTemplateTypeProps, listRender?: TemplateListRender): React.ReactNode | React.ReactElement | JSX.Element => {\n return listRender ? listRender(tmpls) : templateFromListRender(tmpls, data);\n};\n\nexport const renderAnyTemplates = (tmpls: any, data: AdViewUnitTemplateTypeProps, listRender?: TemplateListRender): React.ReactNode | React.ReactElement | JSX.Element | null => {\n if (!tmpls) {\n return null;\n }\n\n if (Array.isArray(tmpls)) {\n return renderTemplates(tmpls as TemplateElement[], data, listRender);\n }\n\n if (typeof tmpls === 'function') {\n return tmpls(data);\n }\n\n if (React.isValidElement(tmpls)) {\n return templateFromListRender([tmpls as TemplateElement], data);\n }\n\n return null;\n}\n\n// Template is a React component that renders a template based on the type and data provided\n// Example usage:\n// <AdView.Unit>\n// <AdView.Template type=\"banner\" data={{...}}>\n// </AdView.Unit>\nconst AdViewUnitTemplate = ({ type, state, children, ...props }: AdViewUnitTemplateProps) => {\n const tmplProps: AdViewUnitTemplateTypeProps = {\n type,\n state,\n ...props,\n };\n \n const expectState: AdLoadState =\n (props?.isInitial || props?.isLoading || props?.isError || props?.isComplete) ? {\n isInitial: props?.isInitial,\n isLoading: props?.isLoading,\n isError: props?.isError,\n isComplete: props?.isComplete\n } : {isComplete: true};\n\n // Check if the expected state matches the current state\n if (!matchExpectedState(expectState, state)) {\n return null;\n }\n\n // If children is a function, call it with the data\n if (typeof children === 'function') {\n return children(tmplProps as AdViewUnitClientChildrenProps) as React.ReactElement;\n }\n\n // If children is a React element, clone it with the new props\n if (React.isValidElement(children)) {\n return React.cloneElement(children, tmplProps);\n }\n\n // If no children are provided, return an empty fragment\n return <></>;\n}\n\nexport default AdViewUnitTemplate;\n","'use client';\n\nimport { executeImpressionsTracking } from '@adview/core/utils';\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react';\n\ntype AdViewUnitTrackingProps = {\n impressions?: string[];\n views?: string[];\n clicks?: string[];\n children: React.ReactNode;\n};\n\nfunction AdViewUnitTracking({\n impressions,\n views,\n clicks,\n children,\n}: AdViewUnitTrackingProps) {\n const isServer = typeof window === 'undefined';\n const wrapperRef = useRef<HTMLDivElement>(null);\n const executeImpressionsTrackingHandler = useCallback(\n () => executeImpressionsTracking(impressions),\n [impressions],\n );\n const trackingObserverInstanceHandler = useCallback(\n (entries: IntersectionObserverEntry[]) => {\n entries.forEach(entry => {\n if (entry.isIntersecting) {\n executeImpressionsTracking(views);\n trackingObserverInstance?.unobserve(wrapperRef.current!);\n }\n });\n },\n [views],\n );\n const trackingObserverInstance = useMemo<IntersectionObserver | null>(() => {\n return !isServer\n ? new IntersectionObserver(trackingObserverInstanceHandler)\n : null;\n }, [isServer, trackingObserverInstanceHandler]);\n const clickTrackerHandler = useCallback(() => {\n executeImpressionsTracking(clicks);\n\n wrapperRef.current?.removeEventListener('click', clickTrackerHandler);\n }, [clicks]);\n\n useEffect(() => {\n if (wrapperRef.current && trackingObserverInstance) {\n executeImpressionsTrackingHandler();\n wrapperRef.current?.addEventListener('click', clickTrackerHandler);\n trackingObserverInstance?.observe(wrapperRef.current);\n\n return () => {\n wrapperRef.current?.removeEventListener('click', clickTrackerHandler);\n if (wrapperRef.current)\n trackingObserverInstance?.unobserve(wrapperRef.current);\n };\n }\n\n return () => {};\n }, [\n trackingObserverInstance,\n executeImpressionsTrackingHandler,\n clickTrackerHandler,\n ]);\n\n return <div ref={wrapperRef}>{children}</div>;\n}\n\nexport default AdViewUnitTracking;\n","import React from \"react\";\nimport { AdLoadState, AdViewOptionalDataProps, AdViewUnitTemplateTypeProps } from \"../types\";\nimport { matchExpectedState } from \"./utils\";\n\ntype AdViewUnitDefaultTemplateProps = Omit<AdViewUnitTemplateTypeProps, 'type'> & {\n type?: 'default';\n children?: React.ReactNode | ((props: AdViewOptionalDataProps) => React.ReactNode);\n};\n\nfunction AdViewUnitDefaultTemplate({ type='default', data, state, children, ...props }: AdViewUnitDefaultTemplateProps) {\n if (data) {\n return null;\n }\n\n const expectState: AdLoadState =\n (props?.isInitial || props?.isLoading || props?.isError || props?.isComplete) ? {\n isInitial: props?.isInitial,\n isLoading: props?.isLoading,\n isError: props?.isError,\n isComplete: props?.isComplete\n } : {isComplete: true};\n\n // Check if the expected state matches the current state\n if (!matchExpectedState(expectState, state)) {\n return null;\n }\n\n if (typeof children === 'function') {\n return <>{children({ data, state, ...props })}</>;\n }\n\n return (\n children ? <>{children}</> : (\n <div style={{ padding: '1rem', textAlign: 'center', color: '#666' }}>\n <p>🔄 Default content for ad unit</p>\n <p>Data: {JSON.stringify(data)}</p>\n <p>State: {JSON.stringify(state)}</p>\n </div>\n )\n );\n}\n\nAdViewUnitDefaultTemplate.defaults = {\n type: 'default',\n};\n\nexport default AdViewUnitDefaultTemplate;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,gBAAkB;AAIlB,IAAAC,gBAA0D;;;ACJ1D,mBAIO;AACP,mBAAkB;;;ACHX,IAAM,qBAAqB,CAAC,aAA2B,UAAwB;AACpF,SAAO,CAAC,gBACL,YAAY,cAAc,UAAa,YAAY,cA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,GAAmC;AACtH,MAAI,MAAM;AACR,WAAO;AAAA,EACT;AAEA,QAAM,cACH,OAAO,aAAa,OAAO,aAAa,OAAO,WAAW,OAAO,aAAc;AAAA,IAC9E,WAAW,OAAO;AAAA,IAClB,WAAW,OAAO;AAAA,IAClB,SAAS,OAAO;AAAA,IAChB,YAAY,OAAO;AAAA,EACrB,IAAI,EAAC,YAAY,KAAI;AAGvB,MAAI,CAAC,mBAAmB,aAAa,KAAK,GAAG;AAC3C,WAAO;AAAA,EACT;AAEA,MAAI,OAAO,aAAa,YAAY;AAClC,WAAO,8BAAAC,QAAA,4BAAAA,QAAA,gBAAG,SAAS,EAAE,MAAM,OAAO,GAAG,MAAM,CAAC,CAAE;AAAA,EAChD;AAEA,SACE,WAAW,8BAAAA,QAAA,4BAAAA,QAAA,gBAAG,QAAS,IACrB,8BAAAA,QAAA,cAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,WAAW,UAAU,OAAO,OAAO,KAChE,8BAAAA,QAAA,cAAC,WAAE,uCAA8B,GACjC,8BAAAA,QAAA,cAAC,WAAE,UAAO,KAAK,UAAU,IAAI,CAAE,GAC/B,8BAAAA,QAAA,cAAC,WAAE,WAAQ,KAAK,UAAU,KAAK,CAAE,CACnC;AAGN;AAEA,0BAA0B,WAAW;AAAA,EACnC,MAAM;AACR;AAEA,IAAO,oCAAQ;","names":["import_react","import_utils","React","import_utils","import_react","React","import_react","React","import_react","React","import_utils","import_react","React","customTracker","groupItems","React","import_react","React"]}
1
+ {"version":3,"sources":["../src/server.ts","../src/AdViewUnit/AdViewUnit.server.tsx","../src/AdViewUnit/AdViewUnitBannerTemplate.tsx","../src/AdViewUnit/utils.ts","../src/AdViewUnit/AdViewUnitNativeTemplate.tsx","../src/AdViewUnit/AdViewUnitProxyTemplate.tsx","../src/AdViewUnit/AdViewUnitTemplate.tsx","../src/AdViewUnit/AdViewUnitTracking.tsx","../src/AdViewUnit/AdViewUnitDefaultTemplate.tsx"],"sourcesContent":["import AdViewUnitServer from './AdViewUnit/AdViewUnit.server';\nimport AdViewUnitBannerTemplate from './AdViewUnit/AdViewUnitBannerTemplate';\nimport AdViewUnitDefaultTemplate from './AdViewUnit/AdViewUnitDefaultTemplate';\nimport AdViewUnitNativeTemplate from './AdViewUnit/AdViewUnitNativeTemplate';\nimport AdViewUnitProxyTemplate from './AdViewUnit/AdViewUnitProxyTemplate';\nimport AdViewUnitTemplate from './AdViewUnit/AdViewUnitTemplate';\nimport {\n AdViewOptionalDataProps,\n AdViewUnitClientChildren,\n AdViewUnitTemplateProps,\n AdViewUnitTemplateTypeProps,\n} from './types';\n\nexport {\n AdViewOptionalDataProps,\n AdViewUnitBannerTemplate,\n AdViewUnitClientChildren,\n AdViewUnitDefaultTemplate,\n AdViewUnitNativeTemplate,\n AdViewUnitProxyTemplate,\n AdViewUnitServer,\n AdViewUnitTemplate,\n AdViewUnitTemplateProps,\n AdViewUnitTemplateTypeProps,\n\n /**\n * Components renamed for easier imports\n */\n AdViewUnitBannerTemplate as BannerTemplate,\n AdViewUnitDefaultTemplate as DefaultTemplate,\n AdViewUnitNativeTemplate as NativeTemplate,\n AdViewUnitProxyTemplate as ProxyTemplate,\n AdViewUnitTemplate as Template,\n AdViewUnitServer as Unit\n};\n\n","import React from 'react';\n\nimport { AdViewData, AdViewDataLoader } from '@adview/core';\nimport { AdViewGroupItem } from '@adview/core/typings';\nimport { getDataLoaderFromConfig, getResolveConfig } from '@adview/core/utils';\nimport { AdViewUnitClientChildren, AdViewUnitPropsBase } from '../types';\nimport AdViewUnitBannerTemplate from './AdViewUnitBannerTemplate';\nimport AdViewUnitNativeTemplate from './AdViewUnitNativeTemplate';\nimport AdViewUnitProxyTemplate from './AdViewUnitProxyTemplate';\nimport { renderAnyTemplates } from './AdViewUnitTemplate';\nimport AdViewUnitTracking from './AdViewUnitTracking';\n\nexport type AdViewUnitServerProps = AdViewUnitPropsBase & {\n children?: AdViewUnitClientChildren;\n};\n\nasync function AdViewUnitServer({\n unitId,\n format,\n children,\n ...config\n}: AdViewUnitServerProps) {\n const checkFormat = (f: string) => {\n if (!format) {\n return true;\n }\n return Array.isArray(format) ? format.includes(f) : f === format;\n };\n\n const baseConfig = getResolveConfig(config);\n const dataLoader: AdViewDataLoader = getDataLoaderFromConfig(baseConfig);\n const response = await dataLoader.fetchAdData(unitId, 1, format);\n const isLoadingError = response instanceof Error;\n const error = isLoadingError ? response : undefined;\n const state = {\n isLoading: true,\n isComplete: true,\n isInitial: false,\n isError: isLoadingError,\n };\n\n const {\n responseGroup: _,\n customTracker,\n groupItems,\n } = error\n ? { responseGroup: null, customTracker: {}, groupItems: [] }\n : (() => {\n for (let responseGroup of (response as AdViewData)?.groups || []) {\n const customTracker = responseGroup?.custom_tracker ?? {};\n const groupItems = (responseGroup?.items || [])\n .map(it => (checkFormat(it.type) ? it : null))\n .filter(Boolean) as AdViewGroupItem[];\n if (groupItems && groupItems.length > 0) {\n return { responseGroup, customTracker, groupItems };\n }\n }\n return { responseGroup: null, customTracker: {}, groupItems: [] };\n })();\n\n if (!children) {\n children = [\n <AdViewUnitBannerTemplate />,\n <AdViewUnitNativeTemplate />,\n <AdViewUnitProxyTemplate />,\n ];\n }\n\n if (groupItems && groupItems.length) {\n return groupItems.map(\n ({ tracker, ...data }: AdViewGroupItem, index: number) => {\n return (\n <AdViewUnitTracking key={data.id} {...tracker}>\n {renderAnyTemplates(children, {\n unitId,\n index,\n data,\n type: data.type || 'default',\n error,\n state: state,\n })}\n </AdViewUnitTracking>\n );\n },\n );\n }\n\n return (\n <AdViewUnitTracking {...customTracker}>\n {renderAnyTemplates(children, {\n unitId,\n index: -1,\n data: null,\n type: 'default',\n error,\n state: state,\n })}\n </AdViewUnitTracking>\n );\n}\n\nexport default AdViewUnitServer;\n","import {\n getAssetByName,\n getPrepareURL,\n getSrcSetCSSThumbs,\n} from '@adview/core/utils';\nimport React from 'react';\nimport { AdLoadState, AdViewUnitTemplateTypeProps } from '../types';\nimport { matchExpectedState } from './utils';\n\ntype AdViewUnitBannerTemplateProps = Omit<\n AdViewUnitTemplateTypeProps,\n 'type'\n> & {\n type?: 'banner';\n className?: string;\n style?: React.CSSProperties;\n};\n\nfunction AdViewUnitBannerTemplate({\n className = 'banner',\n style,\n data,\n state,\n ...props\n}: AdViewUnitBannerTemplateProps) {\n const expectState: AdLoadState =\n props?.isInitial || props?.isLoading || props?.isError || props?.isComplete\n ? {\n isInitial: props?.isInitial,\n isLoading: props?.isLoading,\n isError: props?.isError,\n isComplete: props?.isComplete,\n }\n : { isComplete: true };\n\n if (!data || !data.assets || !data.assets.length) {\n return null;\n }\n\n // Check if the expected state matches the current state\n if (!matchExpectedState(expectState, state)) {\n return null;\n }\n\n const asset = getAssetByName('main', data.assets);\n\n return (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(data.url)}\n className={className}\n style={{ fontSize: 0, ...style }}\n >\n {asset && (\n <img\n alt=\"main\"\n src={asset.path}\n srcSet={asset.thumbs ? getSrcSetCSSThumbs(asset.thumbs) : ''}\n style={{ maxWidth: '100%' }}\n />\n )}\n </a>\n );\n}\n\nAdViewUnitBannerTemplate.defaults = {\n type: 'banner',\n};\n\nexport default AdViewUnitBannerTemplate;\n","import { AdLoadState } from \"../types\";\n\nexport const matchExpectedState = (expectState?: AdLoadState, state?: AdLoadState) => {\n return !expectState || (\n (expectState.isInitial === undefined || expectState.isInitial === state?.isInitial) &&\n (expectState.isLoading === undefined || expectState.isLoading === state?.isLoading) &&\n (expectState.isError === undefined || expectState.isError === state?.isError) &&\n (expectState.isComplete === undefined || expectState.isComplete === state?.isComplete)\n );\n};\n","import { getAssetByName, getPrepareURL, getSrcSetCSSThumbs } from '@adview/core/utils';\nimport React from 'react';\nimport { AdLoadState, AdViewStyleTokensNative, AdViewUnitTemplateTypeProps } from '../types';\nimport { matchExpectedState } from './utils';\n\ntype AdViewUnitNativeTemplateProps = Omit<AdViewUnitTemplateTypeProps, 'type'> & {\n type?: 'native';\n classNames?: AdViewStyleTokensNative;\n};\n\nfunction AdViewUnitNativeTemplate({classNames, data, state, ...props}: AdViewUnitNativeTemplateProps) {\n if (!data || !data.assets || !data.assets.length) {\n return null;\n }\n\n const expectState: AdLoadState =\n (props?.isInitial || props?.isLoading || props?.isError || props?.isComplete) ? {\n isInitial: props?.isInitial,\n isLoading: props?.isLoading,\n isError: props?.isError,\n isComplete: props?.isComplete\n } : {isComplete: true};\n\n // Check if the expected state matches the current state\n if (!matchExpectedState(expectState, state)) {\n return null;\n }\n\n const { assets, url, fields } = data;\n const asset = getAssetByName('main', assets);\n\n if (!url) {\n return null;\n }\n\n return (\n <div className={classNames?.container}>\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n className={classNames?.imageLink}\n >\n {asset && (\n <img\n alt={fields?.title}\n title={fields?.title}\n src={asset.path}\n srcSet={asset.thumbs ? getSrcSetCSSThumbs(asset.thumbs) : undefined}\n className={classNames?.image}\n style={{ objectFit: 'cover', width: '100%', height: '100%' }}\n />\n )}\n </a>\n <div className={classNames?.label}>\n {fields?.title && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"titleLink\"\n className={classNames?.titleLink}\n >\n {fields.title}\n </a>\n )}\n {fields?.description && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"descriptionLink\"\n className={classNames?.descriptionLink}\n >\n {fields.description}\n </a>\n )}\n {fields?.brandname && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"brandNameLink\"\n className={classNames?.brandNameLink}\n >\n {fields.brandname}\n </a>\n )}\n {fields?.phone && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"phoneLink\"\n className={classNames?.phoneLink}\n >\n {fields.phone}\n </a>\n )}\n {fields?.url && (\n <a\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n href={getPrepareURL(url)}\n data-class=\"urlLink\"\n className={classNames?.urlLink}\n >\n {fields?.url}\n </a>\n )}\n </div>\n </div>\n );\n}\n\nAdViewUnitNativeTemplate.defaults = {\n type: 'native',\n};\n\nexport default AdViewUnitNativeTemplate;\n","import React from 'react';\nimport { AdLoadState, AdViewUnitTemplateTypeProps } from '../types';\nimport { matchExpectedState } from './utils';\n\ntype AdViewUnitProxyTemplateProps = Omit<AdViewUnitTemplateTypeProps, 'type'> & {\n type?: 'proxy';\n className?: string;\n style?: React.CSSProperties;\n};\n\nfunction AdViewUnitProxyTemplate({className, style, data, state, ...props}: AdViewUnitProxyTemplateProps) {\n if (!data) {\n return null;\n }\n\n const expectState: AdLoadState =\n (props?.isInitial || props?.isLoading || props?.isError || props?.isComplete) ? {\n isInitial: props?.isInitial,\n isLoading: props?.isLoading,\n isError: props?.isError,\n isComplete: props?.isComplete\n } : {isComplete: true};\n\n // Check if the expected state matches the current state\n if (!matchExpectedState(expectState, state)) {\n return null;\n }\n\n const { url, fields } = data;\n const iframeSrc = fields?.url || url;\n\n if (!iframeSrc) {\n return null;\n }\n\n return (\n <iframe\n className={className}\n width=\"100%\"\n height=\"100%\"\n frameBorder=\"0\"\n marginWidth={0}\n marginHeight={0}\n allowTransparency={true}\n scrolling=\"no\"\n allowFullScreen={true}\n style={{ width: '100%', height: '100%', border: 'none', ...style }}\n src={iframeSrc}\n ></iframe>\n );\n}\n\nAdViewUnitProxyTemplate.defaults = {\n type: 'proxy',\n};\n\nexport default AdViewUnitProxyTemplate;\n","//\n// Example\n// <AdView.Unit>\n// <AdView.Template type=\"banner\">\n// <...>\n// </AdView.Template>\n// </AdView.Unit>\n//\n\nimport React, { JSX } from 'react';\nimport { AdLoadState, AdViewUnitClientChildrenProps, AdViewUnitTemplateProps, AdViewUnitTemplateTypeProps } from '../types';\nimport { matchExpectedState } from './utils';\n\n// TemplateListRender is a function that takes a list of TemplateType and returns a React element\nexport type TemplateListRender = (tmpls: TemplateElement[]) => React.ReactElement | JSX.Element;\n\n// TemplateType is a React component that can be used to render ad templates\nexport type TemplateType = React.Component<AdViewUnitTemplateProps>;\nexport type TemplateElement = React.ReactElement<AdViewUnitTemplateProps>;\n\n// TemplateTypeFunction is a function that takes AdViewUnitTemplateTypeProps and returns a React node or element\nexport type TemplateTypeFunction = (props: AdViewUnitTemplateTypeProps) => React.ReactNode | React.ReactElement;\n\n// templateFromListRender is a function that takes a list of TemplateType and returns a React element\nexport const templateFromListRender = (tmpls: TemplateElement[], data: AdViewUnitTemplateTypeProps, wrap?: (children: React.ReactNode) => React.ReactNode): JSX.Element | React.ReactElement => {\n let renderedRemplates = tmpls.map((tmpl, index) => {\n let tmp = renderTemplate(tmpl, data);\n return !!tmp && React.isValidElement(tmp)\n ? <React.Fragment key={index}>{!!wrap ? wrap(tmp) : tmp}</React.Fragment>\n : null;\n }).filter(it => !!it);\n\n if (!renderedRemplates.length) {\n renderedRemplates = tmpls.map((tmpl, index) => {\n let tmp = renderTemplate(tmpl, {...data, type: 'default'});\n return !!tmp && React.isValidElement(tmp)\n ? <React.Fragment key={index}>{!!wrap ? wrap(tmp) : tmp}</React.Fragment>\n : null;\n }).filter(it => !!it);\n }\n\n return (<>{renderedRemplates}</>);\n};\n\n// renderTemplate is a function that takes a TemplateType or a function and returns a React node\nexport const renderTemplate = (tmpl: TemplateElement | TemplateTypeFunction, data: AdViewUnitTemplateTypeProps): React.ReactNode => {\n const isFunction = typeof tmpl === 'function';\n const isReactElement = React.isValidElement(tmpl);\n\n if (isReactElement) {\n // Extract type and children from the React element\n let { type, children } = tmpl.props;\n if (!type && typeof tmpl.type !== 'string') {\n type = (tmpl.type as any)?.defaults?.type;\n }\n // If the type does not match, return null\n if (!!type && type !== '*' && data.type !== type) {\n return null;\n }\n // If children is a function, call it with the data\n if (typeof children === 'function') {\n return children(data as AdViewUnitClientChildrenProps);\n }\n // If children is a React element, clone it with the new props\n return React.cloneElement((tmpl as TemplateElement), {\n ...data,\n children: children,\n });\n }\n\n if (isFunction) {\n return tmpl(data);\n }\n\n return null;\n}\n\n// renderTemplates is a function that takes a list of TemplateType and returns a React element\nexport const renderTemplates = (tmpls: TemplateElement[], data: AdViewUnitTemplateTypeProps, listRender?: TemplateListRender): React.ReactNode | React.ReactElement | JSX.Element => {\n return listRender ? listRender(tmpls) : templateFromListRender(tmpls, data);\n};\n\nexport const renderAnyTemplates = (tmpls: any, data: AdViewUnitTemplateTypeProps, listRender?: TemplateListRender): React.ReactNode | React.ReactElement | JSX.Element | null => {\n if (!tmpls) {\n return null;\n }\n\n if (Array.isArray(tmpls)) {\n return renderTemplates(tmpls as TemplateElement[], data, listRender);\n }\n\n if (typeof tmpls === 'function') {\n return tmpls(data);\n }\n\n if (React.isValidElement(tmpls)) {\n return templateFromListRender([tmpls as TemplateElement], data);\n }\n\n return null;\n}\n\n// Template is a React component that renders a template based on the type and data provided\n// Example usage:\n// <AdView.Unit>\n// <AdView.Template type=\"banner\" data={{...}}>\n// </AdView.Unit>\nconst AdViewUnitTemplate = ({ type, state, children, ...props }: AdViewUnitTemplateProps) => {\n const tmplProps: AdViewUnitTemplateTypeProps = {\n type,\n state,\n ...props,\n };\n \n const expectState: AdLoadState =\n (props?.isInitial || props?.isLoading || props?.isError || props?.isComplete) ? {\n isInitial: props?.isInitial,\n isLoading: props?.isLoading,\n isError: props?.isError,\n isComplete: props?.isComplete\n } : {isComplete: true};\n\n // Check if the expected state matches the current state\n if (!matchExpectedState(expectState, state)) {\n return null;\n }\n\n // If children is a function, call it with the data\n if (typeof children === 'function') {\n return children(tmplProps as AdViewUnitClientChildrenProps) as React.ReactElement;\n }\n\n // If children is a React element, clone it with the new props\n if (React.isValidElement(children)) {\n return React.cloneElement(children, tmplProps);\n }\n\n // If no children are provided, return an empty fragment\n return <></>;\n}\n\nexport default AdViewUnitTemplate;\n","'use client';\n\nimport { executeImpressionsTracking } from '@adview/core/utils';\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react';\n\ntype AdViewUnitTrackingProps = {\n impressions?: string[];\n views?: string[];\n clicks?: string[];\n children: React.ReactNode;\n};\n\nfunction AdViewUnitTracking({\n impressions,\n views,\n clicks,\n children,\n}: AdViewUnitTrackingProps) {\n const isServer = typeof window === 'undefined';\n const wrapperRef = useRef<HTMLDivElement>(null);\n const executeImpressionsTrackingHandler = useCallback(\n () => executeImpressionsTracking(impressions),\n [impressions],\n );\n const trackingObserverInstanceHandler = useCallback(\n (entries: IntersectionObserverEntry[]) => {\n entries.forEach(entry => {\n if (entry.isIntersecting) {\n executeImpressionsTracking(views);\n trackingObserverInstance?.unobserve(wrapperRef.current!);\n }\n });\n },\n [views],\n );\n const trackingObserverInstance = useMemo<IntersectionObserver | null>(() => {\n return !isServer\n ? new IntersectionObserver(trackingObserverInstanceHandler)\n : null;\n }, [isServer, trackingObserverInstanceHandler]);\n const clickTrackerHandler = useCallback(() => {\n executeImpressionsTracking(clicks);\n\n wrapperRef.current?.removeEventListener('click', clickTrackerHandler);\n }, [clicks]);\n\n useEffect(() => {\n if (wrapperRef.current && trackingObserverInstance) {\n executeImpressionsTrackingHandler();\n wrapperRef.current?.addEventListener('click', clickTrackerHandler);\n trackingObserverInstance?.observe(wrapperRef.current);\n\n return () => {\n wrapperRef.current?.removeEventListener('click', clickTrackerHandler);\n if (wrapperRef.current)\n trackingObserverInstance?.unobserve(wrapperRef.current);\n };\n }\n\n return () => {};\n }, [\n trackingObserverInstance,\n executeImpressionsTrackingHandler,\n clickTrackerHandler,\n ]);\n\n return <div ref={wrapperRef}>{children}</div>;\n}\n\nexport default AdViewUnitTracking;\n","import React from \"react\";\nimport { AdLoadState, AdViewOptionalDataProps, AdViewUnitTemplateTypeProps } from \"../types\";\nimport { matchExpectedState } from \"./utils\";\n\ntype AdViewUnitDefaultTemplateProps = Omit<AdViewUnitTemplateTypeProps, 'type'> & {\n type?: 'default';\n children?: React.ReactNode | ((props: AdViewOptionalDataProps) => React.ReactNode);\n};\n\nfunction AdViewUnitDefaultTemplate({ type='default', data, state, children, ...props }: AdViewUnitDefaultTemplateProps) {\n if (data) {\n return null;\n }\n\n const expectState: AdLoadState =\n (props?.isInitial || props?.isLoading || props?.isError || props?.isComplete) ? {\n isInitial: props?.isInitial,\n isLoading: props?.isLoading,\n isError: props?.isError,\n isComplete: props?.isComplete\n } : {isComplete: true};\n\n // Check if the expected state matches the current state\n if (!matchExpectedState(expectState, state)) {\n return null;\n }\n\n if (typeof children === 'function') {\n return <>{children({ data, state, ...props })}</>;\n }\n\n return (\n children ? <>{children}</> : (\n <div style={{ padding: '1rem', textAlign: 'center', color: '#666' }}>\n <p>🔄 Default content for ad unit</p>\n <p>Data: {JSON.stringify(data)}</p>\n <p>State: {JSON.stringify(state)}</p>\n </div>\n )\n );\n}\n\nAdViewUnitDefaultTemplate.defaults = {\n type: 'default',\n};\n\nexport default AdViewUnitDefaultTemplate;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,gBAAkB;AAIlB,IAAAC,gBAA0D;;;ACJ1D,mBAIO;AACP,mBAAkB;;;ACHX,IAAM,qBAAqB,CAAC,aAA2B,UAAwB;AACpF,SAAO,CAAC,gBACL,YAAY,cAAc,UAAa,YAAY,cAAc,OAAO,eACxE,YAAY,cAAc,UAAa,YAAY,cAAc,OAAO,eACxE,YAAY,YAAY,UAAa,YAAY,YAAY,OAAO,aACpE,YAAY,eAAe,UAAa,YAAY,eAAe,OAAO;AAE/E;;;ADSA,SAAS,yBAAyB;AAAA,EAChC,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAkC;AAChC,QAAM,cACJ,OAAO,aAAa,OAAO,aAAa,OAAO,WAAW,OAAO,aAC7D;AAAA,IACE,WAAW,OAAO;AAAA,IAClB,WAAW,OAAO;AAAA,IAClB,SAAS,OAAO;AAAA,IAChB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AAS,EAAE,MAAM,OAAO,GAAG,MAAM,CAAC,CAAE;AAAA,EAChD;AAEA,SACE,WAAW,8BAAAA,QAAA,4BAAAA,QAAA,gBAAG,QAAS,IACrB,8BAAAA,QAAA,cAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,WAAW,UAAU,OAAO,OAAO,KAChE,8BAAAA,QAAA,cAAC,WAAE,uCAA8B,GACjC,8BAAAA,QAAA,cAAC,WAAE,UAAO,KAAK,UAAU,IAAI,CAAE,GAC/B,8BAAAA,QAAA,cAAC,WAAE,WAAQ,KAAK,UAAU,KAAK,CAAE,CACnC;AAGN;AAEA,0BAA0B,WAAW;AAAA,EACnC,MAAM;AACR;AAEA,IAAO,oCAAQ;","names":["import_react","import_utils","React","import_utils","import_react","React","import_react","React","import_react","React","import_utils","import_react","React","customTracker","groupItems","React","import_react","React"]}
package/dist/server.d.cts CHANGED
@@ -4,6 +4,6 @@ export { default as AdViewUnitDefaultTemplate, default as DefaultTemplate } from
4
4
  export { default as AdViewUnitNativeTemplate, default as NativeTemplate } from './AdViewUnit/AdViewUnitNativeTemplate.cjs';
5
5
  export { default as AdViewUnitProxyTemplate, default as ProxyTemplate } from './AdViewUnit/AdViewUnitProxyTemplate.cjs';
6
6
  export { default as AdViewUnitTemplate, default as Template } from './AdViewUnit/AdViewUnitTemplate.cjs';
7
+ export { A as AdViewOptionalDataProps, a as AdViewUnitClientChildren, b as AdViewUnitTemplateProps, c as AdViewUnitTemplateTypeProps } from './types-Bb6Axy4u.cjs';
7
8
  import 'react';
8
- import './types-CTcZX5SL.cjs';
9
9
  import '@adview/core/typings';
package/dist/server.d.ts CHANGED
@@ -4,6 +4,6 @@ export { default as AdViewUnitDefaultTemplate, default as DefaultTemplate } from
4
4
  export { default as AdViewUnitNativeTemplate, default as NativeTemplate } from './AdViewUnit/AdViewUnitNativeTemplate.js';
5
5
  export { default as AdViewUnitProxyTemplate, default as ProxyTemplate } from './AdViewUnit/AdViewUnitProxyTemplate.js';
6
6
  export { default as AdViewUnitTemplate, default as Template } from './AdViewUnit/AdViewUnitTemplate.js';
7
+ export { A as AdViewOptionalDataProps, a as AdViewUnitClientChildren, b as AdViewUnitTemplateProps, c as AdViewUnitTemplateTypeProps } from './types-Bb6Axy4u.js';
7
8
  import 'react';
8
- import './types-CTcZX5SL.js';
9
9
  import '@adview/core/typings';
@@ -109,4 +109,4 @@ type AdLoadState = {
109
109
  isComplete?: boolean;
110
110
  };
111
111
 
112
- export type { AdViewUnitPropsBase as A, AdViewUnitClientChildren as a, AdViewUnitTemplateTypeProps as b, AdViewOptionalDataProps as c, AdViewStyleTokensNative as d, AdViewUnitTemplateProps as e, AdLoadState as f };
112
+ export type { AdViewOptionalDataProps as A, AdViewUnitClientChildren as a, AdViewUnitTemplateProps as b, AdViewUnitTemplateTypeProps as c, AdViewUnitPropsBase as d, AdViewStyleTokensNative as e, AdLoadState as f };
@@ -109,4 +109,4 @@ type AdLoadState = {
109
109
  isComplete?: boolean;
110
110
  };
111
111
 
112
- export type { AdViewUnitPropsBase as A, AdViewUnitClientChildren as a, AdViewUnitTemplateTypeProps as b, AdViewOptionalDataProps as c, AdViewStyleTokensNative as d, AdViewUnitTemplateProps as e, AdLoadState as f };
112
+ export type { AdViewOptionalDataProps as A, AdViewUnitClientChildren as a, AdViewUnitTemplateProps as b, AdViewUnitTemplateTypeProps as c, AdViewUnitPropsBase as d, AdViewStyleTokensNative as e, AdLoadState as f };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adview/react",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "AdView React",
5
5
  "scripts": {
6
6
  "build": "tsup",