Giter Club home page Giter Club logo

Comments (4)

pahund avatar pahund commented on September 12, 2024 1

@juanpicado Let's start with just the definition file.

from react-advertising.

ahtcx avatar ahtcx commented on September 12, 2024 1

Here's a incomplete version I have for one of our projects, just put it in a .d.ts file in your project:

declare module "react-advertising" {
	export type Size = [width: number, height: number];

	export interface SizeMapping {
		/** The target view port size of the size mapping; array with two numbers for width and height */
		viewPortSize: Size;

		/**
		 * Array of ad sizes to be displayed in this view port; array of arrays with two numbers for width and height
		 *  - ⚠️ important: this needs to be an array, even if you have only one ad size to display for this viewport size
		 *  - If you want to display no ads for this size, specify an empty array (`[]`)
		 */
		sizes: Size[];
	}

	export interface Slot<SizeMappingName extends string> {
		/** slot ID */
		id: string;

		/** slot's ad unit path */
		path?: string;

		/** configuration for removing empty slots */
		collapseEmptyDivs?: boolean | boolean[];

		/** targeting parameters and other key-values specific to the slot */
		targeting?: Record<string, string>;

		/** slot size configuration for GPT */
		sizes?: unknown;

		/** slot size configuration for GPT */
		sizeMappingName?: SizeMappingName;

		/** configuration to lazy load this ad slot */
		enableLazyLoad?: unknown;

		/** array with slot's Prebid configuration objects */
		prebid?: unknown;
	}

	export interface AdvertisingConfiguration<
		SizeMappings extends Record<string, SizeMapping[]>,
	> {
		/** global ad unit path, used if not specified in a slot */
		path?: string;

		/** global GPT targeting parameters and other key-values */
		targeting?: Record<string, string>;

		/** GPT size mapping definitions */
		sizeMappings?: SizeMappings;

		/** global Prebid configuration */
		prebid?: unknown;

		/** Turn use of Prebid on or off */
		usePrebid?: boolean;

		/** configuration of custom events dispatched by the creatives */
		customEvents?: unknown;

		/** configuration to lazy load all ads */
		enableLazyLoad?: unknown;

		/** array of slot configurations */
		slots: Slot<keyof SizeMappings>[];

		/** array of outOfPageSlot configurations */
		outOfPageSlots?: { id: string }[];
	}

	export interface AdvertisingProviderProps {
		children?: React.ReactNode;
		config?: AdvertisingConfiguration;
	}

	export function AdvertisingProvider(
		props: AdvertisingProviderProps,
	): JSX.Element;

	export interface AdvertisingSlotProps {
		className?: string;
		id: string;
		style?: React.CSSProperties;
	}

	export function AdvertisingSlot(props: AdvertisingSlotProps): ReactElement;
}

from react-advertising.

juanpicado avatar juanpicado commented on September 12, 2024

Would this include migrate to TS? or just the definition file?

from react-advertising.

juanpicado avatar juanpicado commented on September 12, 2024

Please someone else take it, I won't be able to work on it this month, otherwise, I'll pick it up again next month if still open.

from react-advertising.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.