Skip to content

Commit

Permalink
TW-1464 Prepare backend for new native ads
Browse files Browse the repository at this point in the history
  • Loading branch information
keshan3262 committed Jul 1, 2024
1 parent 02f98e3 commit 65e1ccd
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/advertising/external-ads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<StylePropName, string>;
divWrapperStyle?: Record<StylePropName, string>;
wrapperStyle?: Record<StylePropName, string>;
elementToMeasureSelector?: string;
stylesOverrides?: AdStylesOverrides[];
shouldHideOriginal?: boolean;
Expand Down
31 changes: 31 additions & 0 deletions src/routers/slise-ad-rules/ad-places.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,32 @@ const transformAdPlacesDictionary = <T extends ExtVersionConstraints>(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
Expand All @@ -243,6 +269,11 @@ const transformAdPlacesDictionary = <T extends ExtVersionConstraints>(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
Expand Down
7 changes: 6 additions & 1 deletion src/utils/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 65e1ccd

Please sign in to comment.