From 65e1ccd3594cb8f4da00a5e3c1c55777d47abb0d Mon Sep 17 00:00:00 2001 From: Inokentii Mazhara Date: Mon, 1 Jul 2024 16:11:00 +0300 Subject: [PATCH] TW-1464 Prepare backend for new native ads --- src/advertising/external-ads.ts | 7 +++++- src/routers/slise-ad-rules/ad-places.ts | 31 +++++++++++++++++++++++++ src/utils/schemas.ts | 7 +++++- 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/src/advertising/external-ads.ts b/src/advertising/external-ads.ts index a735339..511b963 100644 --- a/src/advertising/external-ads.ts +++ b/src/advertising/external-ads.ts @@ -117,9 +117,14 @@ export interface PermanentAdPlacesRule extends ExtVersionConstraints { insertBeforeSelector?: string; insertAfterSelector?: string; insertionsCount?: number; - shouldUseDivWrapper: boolean; + shouldUseDivWrapper?: boolean; + wrapperType?: string; + colsBefore?: number; + colspan?: number; + colsAfter?: number; elementStyle?: Record; divWrapperStyle?: Record; + wrapperStyle?: Record; elementToMeasureSelector?: string; stylesOverrides?: AdStylesOverrides[]; shouldHideOriginal?: boolean; diff --git a/src/routers/slise-ad-rules/ad-places.ts b/src/routers/slise-ad-rules/ad-places.ts index 169fd29..049fe7e 100644 --- a/src/routers/slise-ad-rules/ad-places.ts +++ b/src/routers/slise-ad-rules/ad-places.ts @@ -233,6 +233,32 @@ const transformAdPlacesDictionary = (rules: Rec * shouldUseDivWrapper: * type: boolean * description: Whether the ads banner should be wrapped in a div + * wrapperType: + * type: string + * enum: + * - div + * - tbody + * colsBefore: + * type: number + * integer: true + * min: 0 + * description: > + * If `wrapperType` is `tbody`, this property describes how many table columns should be inserted before + * the new ads banner. + * colspan: + * type: number + * integer: true + * min: 1 + * description: > + * If `wrapperType` is `tbody`, this property describes how many table columns should be spanned by the + * new ads banner. + * colsAfter: + * type: number + * integer: true + * min: 0 + * description: > + * If `wrapperType` is `tbody`, this property describes how many table columns should be inserted after + * the new ads banner. * elementStyle: * type: object * description: Style of the new ad banner @@ -243,6 +269,11 @@ const transformAdPlacesDictionary = (rules: Rec * description: Style of the div wrapper * additionalProperties: * type: string + * wrapperStyle: + * type: object + * description: Style of the new ad banner's wrapper + * additionalProperties: + * type: string * elementToMeasureSelector: * type: string * description: A selector of the element which should be measured to define banner size diff --git a/src/utils/schemas.ts b/src/utils/schemas.ts index 21e0253..6b8065c 100644 --- a/src/utils/schemas.ts +++ b/src/utils/schemas.ts @@ -163,9 +163,14 @@ const permanentAdPlacesRulesSchema = arraySchema() insertBeforeSelector: cssSelectorSchema, insertAfterSelector: cssSelectorSchema, insertionsCount: numberSchema().integer().min(1), - shouldUseDivWrapper: booleanSchema().required(), + shouldUseDivWrapper: booleanSchema(), + wrapperType: stringSchema().oneOf(['div', 'tbody']), + colsBefore: numberSchema().integer().min(0), + colspan: numberSchema().integer().min(1), + colsAfter: numberSchema().integer().min(0), elementStyle: styleSchema, divWrapperStyle: styleSchema, + wrapperStyle: styleSchema, elementToMeasureSelector: cssSelectorSchema, stylesOverrides: arraySchema().of(adStylesOverridesSchema.clone().required()), shouldHideOriginal: booleanSchema(),