Skip to content

Commit e5d44b6

Browse files
lourenckeshan3262
andauthored
TW-1464 Prepare backend for new native ads (#165) (#166)
* TW-1464 Prepare backend for new native ads * TW-1464 Update API documentation * TW-1464 Enable adding native ads in replace-only mode Co-authored-by: Inokentii Mazhara <[email protected]>
1 parent 0776a75 commit e5d44b6

File tree

3 files changed

+49
-3
lines changed

3 files changed

+49
-3
lines changed

src/advertising/external-ads.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export interface AdPlacesRule extends ExtVersionConstraints {
9999
};
100100
stylesOverrides?: AdStylesOverrides[];
101101
shouldHideOriginal?: boolean;
102+
isNative?: boolean;
102103
}
103104

104105
export interface PermanentAdPlacesRule extends ExtVersionConstraints {
@@ -117,9 +118,14 @@ export interface PermanentAdPlacesRule extends ExtVersionConstraints {
117118
insertBeforeSelector?: string;
118119
insertAfterSelector?: string;
119120
insertionsCount?: number;
120-
shouldUseDivWrapper: boolean;
121+
shouldUseDivWrapper?: boolean;
122+
wrapperType?: string;
123+
colsBefore?: number;
124+
colspan?: number;
125+
colsAfter?: number;
121126
elementStyle?: Record<StylePropName, string>;
122127
divWrapperStyle?: Record<StylePropName, string>;
128+
wrapperStyle?: Record<StylePropName, string>;
123129
elementToMeasureSelector?: string;
124130
stylesOverrides?: AdStylesOverrides[];
125131
shouldHideOriginal?: boolean;

src/routers/slise-ad-rules/ad-places.ts

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ const transformAdPlacesDictionary = <T extends ExtVersionConstraints>(rules: Rec
108108
* type: boolean
109109
* description: Whether original ads banners should be hidden but not removed
110110
* default: false
111+
* isNative:
112+
* type: boolean
113+
* description: Whether the ad is native
114+
* default: false
111115
* example:
112116
* urlRegexes:
113117
* - '^https://goerli\.etherscan\.io/?$'
@@ -158,7 +162,6 @@ const transformAdPlacesDictionary = <T extends ExtVersionConstraints>(rules: Rec
158162
* - urlRegexes
159163
* - adSelector
160164
* - parentSelector
161-
* - shouldUseDivWrapper
162165
* properties:
163166
* urlRegexes:
164167
* type: array
@@ -233,6 +236,32 @@ const transformAdPlacesDictionary = <T extends ExtVersionConstraints>(rules: Rec
233236
* shouldUseDivWrapper:
234237
* type: boolean
235238
* description: Whether the ads banner should be wrapped in a div
239+
* wrapperType:
240+
* type: string
241+
* enum:
242+
* - div
243+
* - tbody
244+
* colsBefore:
245+
* type: number
246+
* integer: true
247+
* min: 0
248+
* description: >
249+
* If `wrapperType` is `tbody`, this property describes how many table columns should be inserted before
250+
* the new ads banner.
251+
* colspan:
252+
* type: number
253+
* integer: true
254+
* min: 1
255+
* description: >
256+
* If `wrapperType` is `tbody`, this property describes how many table columns should be spanned by the
257+
* new ads banner.
258+
* colsAfter:
259+
* type: number
260+
* integer: true
261+
* min: 0
262+
* description: >
263+
* If `wrapperType` is `tbody`, this property describes how many table columns should be inserted after
264+
* the new ads banner.
236265
* elementStyle:
237266
* type: object
238267
* description: Style of the new ad banner
@@ -243,6 +272,11 @@ const transformAdPlacesDictionary = <T extends ExtVersionConstraints>(rules: Rec
243272
* description: Style of the div wrapper
244273
* additionalProperties:
245274
* type: string
275+
* wrapperStyle:
276+
* type: object
277+
* description: Style of the new ad banner's wrapper
278+
* additionalProperties:
279+
* type: string
246280
* elementToMeasureSelector:
247281
* type: string
248282
* description: A selector of the element which should be measured to define banner size

src/utils/schemas.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ const adPlacesRulesSchema = arraySchema()
124124
.required(),
125125
stylesOverrides: arraySchema().of(adStylesOverridesSchema.clone().required()),
126126
shouldHideOriginal: booleanSchema(),
127+
isNative: booleanSchema(),
127128
extVersion: versionRangeSchema.clone().required()
128129
})
129130
.required()
@@ -158,9 +159,14 @@ const permanentAdPlacesRulesSchema = arraySchema()
158159
insertBeforeSelector: cssSelectorSchema,
159160
insertAfterSelector: cssSelectorSchema,
160161
insertionsCount: numberSchema().integer().min(1),
161-
shouldUseDivWrapper: booleanSchema().required(),
162+
shouldUseDivWrapper: booleanSchema(),
163+
wrapperType: stringSchema().oneOf(['div', 'tbody']),
164+
colsBefore: numberSchema().integer().min(0),
165+
colspan: numberSchema().integer().min(1),
166+
colsAfter: numberSchema().integer().min(0),
162167
elementStyle: styleSchema,
163168
divWrapperStyle: styleSchema,
169+
wrapperStyle: styleSchema,
164170
elementToMeasureSelector: cssSelectorSchema,
165171
stylesOverrides: arraySchema().of(adStylesOverridesSchema.clone().required()),
166172
shouldHideOriginal: booleanSchema(),

0 commit comments

Comments
 (0)