@folklore/ads 0.0.124 → 0.0.127

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/types/Ad.d.ts DELETED
@@ -1,30 +0,0 @@
1
- import { Ref } from 'react';
2
- import AdSlot from './AdSlot';
3
- import { AdSize, AdSizeMapping, AdsTargeting } from './types';
4
- export interface AdProps {
5
- slot: string;
6
- path?: string | null;
7
- size?: AdSize[] | null;
8
- sizeMapping?: AdSizeMapping[] | null;
9
- viewport?: string | null;
10
- targeting?: AdsTargeting | null;
11
- refreshInterval?: number | null;
12
- alwaysRender?: boolean;
13
- disabled?: boolean;
14
- disableTracking?: boolean;
15
- shouldKeepSize?: boolean;
16
- withoutStyle?: boolean;
17
- withoutMinimumSize?: boolean;
18
- withReactId?: boolean;
19
- className?: string | null;
20
- emptyClassName?: string | null;
21
- adClassName?: string | null;
22
- richAdClassName?: string | null;
23
- richAdIframeClassName?: string | null;
24
- onRender?: ((event: any) => void) | null;
25
- onDestroy?: (() => void) | null;
26
- onRichAd?: ((richAd: any) => void) | null;
27
- slotRef?: Ref<AdSlot> | null;
28
- }
29
- declare function Ad({ slot: slotName, path: providedPath, size: providedSize, sizeMapping: providedSizeMapping, viewport: providedViewport, targeting: providedTargeting, refreshInterval: providedRefreshInterval, alwaysRender, disabled: providedDisabled, disableTracking, shouldKeepSize, withoutStyle, withoutMinimumSize, withReactId, className, emptyClassName, adClassName, richAdClassName, richAdIframeClassName, onRender, onDestroy, onRichAd, slotRef, }: AdProps): import("react/jsx-runtime").JSX.Element;
30
- export default Ad;
package/types/AdSlot.d.ts DELETED
@@ -1,57 +0,0 @@
1
- import EventEmitter from 'wolfy87-eventemitter';
2
- import { AdSizeMapping } from './types';
3
- export interface AdSlotOptions {
4
- sizeMapping?: null | AdSizeMapping[];
5
- targeting?: {
6
- [key: string]: string | Array<string>;
7
- };
8
- categoryExclusions?: Array<string>;
9
- visible?: boolean;
10
- }
11
- declare class AdSlot extends EventEmitter {
12
- options: AdSlotOptions;
13
- elementId: string;
14
- adPath: string;
15
- adSize: string | Array<string>;
16
- visible: boolean;
17
- wasVisible: boolean;
18
- adSlot: any;
19
- rendered: boolean;
20
- displayed: boolean;
21
- viewable: boolean;
22
- renderEvent: any;
23
- refreshDisabled: boolean;
24
- destroyed: boolean;
25
- constructor(id: any, path: any, size: any, opts?: {});
26
- updateAdSlot(): void;
27
- setAdSlot(slot: any): this;
28
- setRenderEvent(event: any): this;
29
- setViewable(viewable: any): void;
30
- setDisplayed(displayed: any): this;
31
- setVisible(visible: any): this;
32
- setRefreshDisabled(): void;
33
- setTargeting(targeting: any): void;
34
- destroy(): void;
35
- getElementId(): string;
36
- getAdSlot(): any;
37
- getAdPath(): string;
38
- getAdSize(): string | string[];
39
- getTargeting(): {
40
- [key: string]: string | string[];
41
- };
42
- isVisible(): boolean;
43
- isDefined(): boolean;
44
- isDisplayed(): boolean;
45
- isViewable(): boolean;
46
- isRendered(): boolean;
47
- isRefreshDisabled(): boolean;
48
- isDestroyed(): boolean;
49
- isEmpty(): any;
50
- canBeDisplayed(): boolean;
51
- getRenderedSize(): {
52
- width: any;
53
- height: any;
54
- isFluid: boolean;
55
- };
56
- }
57
- export default AdSlot;
@@ -1,37 +0,0 @@
1
- import React from 'react';
2
- import AdsManager from './AdsManager';
3
- import { Slots, SlotsDefinition, Viewports } from './types';
4
- interface AdsContextType {
5
- ready: boolean;
6
- ads?: AdsManager;
7
- viewports?: Viewports;
8
- viewport?: string | null;
9
- slots?: Slots;
10
- slotsPath?: Record<string, string>;
11
- trackingDisabled?: boolean;
12
- richAdComponents?: Record<string, React.ElementType>;
13
- }
14
- declare const AdsContext: React.Context<AdsContextType>;
15
- export declare const useAdsContext: () => AdsContextType;
16
- interface AdsProviderProps {
17
- children: React.ReactNode;
18
- defaultSlotPath?: string | null;
19
- slotsPath?: Record<string, string> | null;
20
- disableSingleRequest?: boolean;
21
- disableVideoAds?: boolean;
22
- disableLazyLoad?: boolean;
23
- autoInit?: boolean;
24
- resizeDebounceDelay?: number;
25
- refreshOnResize?: boolean;
26
- mobileScaling?: number;
27
- renderMarginPercent?: number;
28
- fetchMarginPercent?: number;
29
- viewport?: string | null;
30
- viewports?: Viewports;
31
- slots?: SlotsDefinition;
32
- richAdComponents?: Record<string, React.ElementType> | null;
33
- disabled?: boolean;
34
- disableTracking?: boolean;
35
- }
36
- export declare function AdsProvider({ children, defaultSlotPath, slotsPath, disableSingleRequest, disableVideoAds, disableLazyLoad, autoInit, resizeDebounceDelay, refreshOnResize, mobileScaling, renderMarginPercent, fetchMarginPercent, viewport, viewports, slots, richAdComponents, disabled, disableTracking, }: AdsProviderProps): import("react/jsx-runtime").JSX.Element;
37
- export default AdsContext;
@@ -1,72 +0,0 @@
1
- import EventEmitter from 'wolfy87-eventemitter';
2
- import AdSlot, { AdSlotOptions as BaseAdSlotOptions } from './AdSlot';
3
- import { AdSize } from './types';
4
- declare global {
5
- interface Window {
6
- googletag?: any;
7
- refreshDisabledLineItems?: string[];
8
- }
9
- }
10
- interface AdSlotOptions extends BaseAdSlotOptions {
11
- id?: string;
12
- }
13
- declare class AdsManager extends EventEmitter {
14
- static ID_PREFIX: string;
15
- disabled: boolean;
16
- personnalizedAdsDisabled: boolean;
17
- ready: boolean;
18
- enabled: boolean;
19
- googletag: any;
20
- slots: AdSlot[];
21
- index: number;
22
- options: {
23
- disabled: boolean;
24
- disablePersonnalizedAds: boolean;
25
- disableSingleRequest: boolean;
26
- disableLazyLoad: boolean;
27
- disableVideoAds: boolean;
28
- autoInit: boolean;
29
- mobileScaling?: number;
30
- renderMarginPercent?: number;
31
- fetchMarginPercent?: number;
32
- };
33
- static getArticleTargeting(article: any): {
34
- title: any;
35
- slug: any;
36
- postID: any;
37
- categories: any;
38
- authors: any;
39
- sponsors: any;
40
- GoogleSafeTargeting: any;
41
- };
42
- static getSectionTargeting(section: any): {
43
- section: any;
44
- };
45
- static getIndexTargeting(index: any): {
46
- index: any;
47
- };
48
- static getIndexItemTargeting(index: any, item: any): {
49
- [index.id]: any[];
50
- };
51
- constructor(opts?: {});
52
- createAdId(): string;
53
- init(): void;
54
- initGpt(): void;
55
- onSlotRenderEnded(event: any): void;
56
- onSlotImpressionViewable(event: any): void;
57
- onSlotVisibleChange(visible: any, slot: any): void;
58
- isReady(): boolean;
59
- isDisabled(): boolean;
60
- setDisabled(disabled: any): void;
61
- disablePersonnalizedAds(disablePersonnalizedAds: any): void;
62
- createSlot(path: string, size: AdSize, opts?: AdSlotOptions): AdSlot;
63
- defineSlot(slot: any): void;
64
- displaySlots(): boolean;
65
- displaySlot(slot: any): void;
66
- callDisplaySlot(slot: any): void;
67
- destroySlot(id: any): void;
68
- refreshSlot(id: any): void;
69
- refreshSlots(ids: any): void;
70
- refreshAllSlots(): void;
71
- }
72
- export default AdsManager;
@@ -1,11 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { AdsTargeting } from './types';
3
- interface AdsTargetingProviderProps {
4
- children: ReactNode;
5
- targeting?: AdsTargeting;
6
- replace?: boolean;
7
- }
8
- declare const AdsTargetingContext: import("react").Context<AdsTargeting>;
9
- export declare const useAdsTargeting: () => AdsTargeting | null;
10
- export declare function AdsTargetingProvider({ children, targeting, replace, }: AdsTargetingProviderProps): import("react/jsx-runtime").JSX.Element;
11
- export default AdsTargetingContext;
package/types/RichAd.d.ts DELETED
@@ -1,7 +0,0 @@
1
- import { RichAd as RichAdType } from './types';
2
- export interface RichAdProps {
3
- richAd: RichAdType;
4
- [key: string]: any;
5
- }
6
- declare function RichAd({ richAd, ...props }: RichAdProps): import("react/jsx-runtime").JSX.Element;
7
- export default RichAd;
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- import { SlotsDefinition, Viewports } from './types';
2
- export declare const viewports: Viewports;
3
- export declare const slots: SlotsDefinition;
package/types/index.d.ts DELETED
@@ -1,13 +0,0 @@
1
- export * as PropTypes from "./propTypes";
2
- export { default as Ad } from "./Ad";
3
- export { default as RichAd } from "./RichAd";
4
- export * from "./AdsContext";
5
- export * from "./AdsTargetingContext";
6
- export * from "./defaults";
7
- export * from "./utils";
8
- export * from "./types";
9
- export { default as AdSlot } from "./AdSlot";
10
- export { default as AdsManager } from "./AdsManager";
11
- export { default as useAd } from "./useAd";
12
- export { default as useAdsTracking } from "./useAdsTracking";
13
- export { default as useRichAd } from "./useRichAd";
@@ -1,7 +0,0 @@
1
- export const adPath: any;
2
- export const adSize: any;
3
- export const adSizeMapping: any;
4
- export const adViewports: any;
5
- export const adSlot: any;
6
- export const adSlots: any;
7
- export const adTargeting: any;
package/types/types.d.ts DELETED
@@ -1,34 +0,0 @@
1
- export type AdSize = [number, number] | 'fluid';
2
- export type Viewport = [number, number];
3
- export type AdSizeMapping = [Viewport, AdSize[]];
4
- export interface Size {
5
- width: number;
6
- height: number;
7
- }
8
- export interface Viewports {
9
- [name: string]: Viewport;
10
- }
11
- export interface SlotDefinition {
12
- sizeMapping?: Record<string, AdSize[]> | boolean | null | AdSizeMapping[] | null;
13
- size?: AdSize[];
14
- path?: string | null;
15
- }
16
- export interface Slot extends SlotDefinition {
17
- sizeMapping?: AdSizeMapping[] | null;
18
- }
19
- export interface Slots {
20
- [name: string]: Slot;
21
- }
22
- export interface SlotsDefinition {
23
- [name: string]: SlotDefinition;
24
- }
25
- export interface AdsTargeting {
26
- refreshAds?: 'inactive' | false | null | number;
27
- disabled?: boolean;
28
- viewport?: string | null;
29
- [key: string]: any;
30
- }
31
- export interface RichAd {
32
- type: string;
33
- [key: string]: any;
34
- }
package/types/useAd.d.ts DELETED
@@ -1,30 +0,0 @@
1
- import AdSlot from './AdSlot';
2
- import { AdSizeMapping, AdsTargeting } from './types';
3
- interface UseAdOptions {
4
- id?: string;
5
- sizeMapping?: AdSizeMapping[] | null;
6
- viewport?: string | null;
7
- targeting?: AdsTargeting | null;
8
- categoryExclusions?: string[] | null;
9
- refreshInterval?: number | null;
10
- alwaysRender?: boolean;
11
- onRender?: (event: any) => void | null;
12
- onDestroy?: (event: any) => void | null;
13
- disabled?: boolean;
14
- disableTracking?: boolean;
15
- rootMargin?: string;
16
- }
17
- declare function useAd(path: string, size: any, { id, sizeMapping, viewport, targeting, categoryExclusions, refreshInterval, alwaysRender, onRender, onDestroy, disabled, disableTracking, rootMargin, }?: UseAdOptions): {
18
- width: any;
19
- height: any;
20
- isFluid: boolean;
21
- refObserver: import("react").RefObject<any>;
22
- slot: AdSlot;
23
- disabled: boolean;
24
- id: string;
25
- isRendered: boolean;
26
- isEmpty: any;
27
- isVisible: boolean;
28
- renderEvent: any;
29
- };
30
- export default useAd;
@@ -1,2 +0,0 @@
1
- import AdSlot from './AdSlot';
2
- export default function useAdsTracking(): (action: string, slot?: AdSlot, renderEvent?: any) => void;
@@ -1,6 +0,0 @@
1
- import { RichAd } from './types';
2
- interface UseRichAdOptions {
3
- onRichAd?: (richAd: RichAd) => void | null;
4
- }
5
- declare function useRichAd(containerRef: any, id: string, opts?: UseRichAdOptions): any;
6
- export default useRichAd;
package/types/utils.d.ts DELETED
@@ -1,10 +0,0 @@
1
- import { AdSize, AdSizeMapping, Size, Slot, SlotDefinition, Viewport, Viewports } from './types';
2
- export declare function normalizeAdSizes(size: any): AdSize[];
3
- export declare function getAdSizes(sizes: any): AdSize[];
4
- export declare function getMinimumAdSize(sizes: any): Size;
5
- export declare function sizeFitsInViewport(size: AdSize, viewport: Viewport): boolean;
6
- export declare function getSortedViewports(viewports: Viewports): any;
7
- export declare function buildSizeMappingFromViewports(sizeMapping: any, viewports: any): AdSizeMapping[];
8
- export declare function buildSizeMappingFromSizes(sizes: any, viewports: any): AdSizeMapping[];
9
- export declare function getSizeMappingFromSlot({ size: allSizes, sizeMapping }: Slot | SlotDefinition, viewports: Viewports): AdSizeMapping[] | null;
10
- export declare function getSizeFromSizeMapping(sizeMapping: any): AdSize[] | null;