Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release: Prepare backend for new native ads #166

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/advertising/external-ads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export interface AdPlacesRule extends ExtVersionConstraints {
};
stylesOverrides?: AdStylesOverrides[];
shouldHideOriginal?: boolean;
isNative?: boolean;
}

export interface PermanentAdPlacesRule extends ExtVersionConstraints {
Expand All @@ -117,9 +118,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
36 changes: 35 additions & 1 deletion src/routers/slise-ad-rules/ad-places.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ const transformAdPlacesDictionary = <T extends ExtVersionConstraints>(rules: Rec
* type: boolean
* description: Whether original ads banners should be hidden but not removed
* default: false
* isNative:
* type: boolean
* description: Whether the ad is native
* default: false
* example:
* urlRegexes:
* - '^https://goerli\.etherscan\.io/?$'
Expand Down Expand Up @@ -158,7 +162,6 @@ const transformAdPlacesDictionary = <T extends ExtVersionConstraints>(rules: Rec
* - urlRegexes
* - adSelector
* - parentSelector
* - shouldUseDivWrapper
* properties:
* urlRegexes:
* type: array
Expand Down Expand Up @@ -233,6 +236,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 +272,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
8 changes: 7 additions & 1 deletion src/utils/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ const adPlacesRulesSchema = arraySchema()
.required(),
stylesOverrides: arraySchema().of(adStylesOverridesSchema.clone().required()),
shouldHideOriginal: booleanSchema(),
isNative: booleanSchema(),
extVersion: versionRangeSchema.clone().required()
})
.required()
Expand Down Expand Up @@ -158,9 +159,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
Loading