Skip to content

Commit

Permalink
Merge pull request #1037 from adshares/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
m-pilarczyk authored Aug 7, 2023
2 parents b083427 + 7fb0922 commit 10e28d6
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 69 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.6.1] - 2023-08-07
### Added
- Direct deals for publisher

## [2.6.0] - 2023-07-25
### Added
- Custom logos support in dark mode
Expand Down Expand Up @@ -594,7 +598,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Publisher features (Sites & AdUnits)


[Unreleased]: https://github.com/adshares/adpanel/compare/v2.6.0...develop
[Unreleased]: https://github.com/adshares/adpanel/compare/v2.6.1...develop
[2.6.1]: https://github.com/adshares/adpanel/compare/v2.6.0...v2.6.1
[2.6.0]: https://github.com/adshares/adpanel/compare/v2.5.0...v2.6.0
[2.5.0]: https://github.com/adshares/adpanel/compare/v2.4.6...v2.5.0
[2.4.6]: https://github.com/adshares/adpanel/compare/v2.4.5...v2.4.6
Expand Down
1 change: 1 addition & 0 deletions src/app/models/initial-state/site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const siteInitialState: Site = {
medium: 'web',
vendor: null,
onlyAcceptedBanners: false,
onlyDirectDeals: false,
filtering: {
requires: {},
excludes: {},
Expand Down
1 change: 1 addition & 0 deletions src/app/models/site.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ interface Site {
medium: string;
vendor: string | null;
onlyAcceptedBanners: boolean;
onlyDirectDeals: boolean;
filtering: {
requires: object;
excludes: object;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,25 @@
<section class="homepage-view site-edit-additional-targeting container">
<div class="ap-box">
<h1 class="ap-heading ap-heading--h2 box-title">Classification</h1>
<div class="box-content">
<mat-checkbox
id="require-classified-checkbox"
[(ngModel)]="isCheckedOnlyAcceptedBanners"
data-test="publisher-edit-site-require-classified-checkbox">
<div class="col box-content">
<mat-checkbox [(ngModel)]="isCheckedOnlyAcceptedBanners" (change)="onChangeOnlyAcceptedBanners($event)">
Manual approval of banners
<fa-icon
[icon]="faQuestionCircle"
class="ap-icon ap-icon--append ap-copy--secondary"
matTooltip="After set this setting you will be able to approve banners for this particular site."
matTooltip="After setting this, you will be able to approve banners for this particular site."
matTooltipClass="ap-mat-tooltip"
matTooltipPosition="right"></fa-icon>
</mat-checkbox>
<mat-checkbox [(ngModel)]="isCheckedOnlyDirectDeals" (change)="onChangeOnlyDirectDeals($event)">
Only direct deals
</mat-checkbox>
</div>

<div class="box-content">
<mat-accordion
multi="true"
class="targeting-accordion"
data-test="publisher-edit-site-additional-targeting-accordion">
<mat-accordion multi="true" class="targeting-accordion">
<div *ngIf="showRequiresSection">
<mat-expansion-panel
(opened)="requirePanelOpenState = true"
(closed)="requirePanelOpenState = false"
data-test="publisher-edit-site-additional-targeting-accordion-panel-required">
<mat-expansion-panel (opened)="requirePanelOpenState = true" (closed)="requirePanelOpenState = false">
<mat-expansion-panel-header class="ap-heading ap-heading--h3">
<mat-panel-title>Targeting</mat-panel-title>
</mat-expansion-panel-header>
Expand Down Expand Up @@ -71,8 +65,7 @@ <h1 class="ap-heading ap-heading--h2 box-title">Classification</h1>
<mat-expansion-panel
(opened)="excludePanelOpenState = true"
(closed)="excludePanelOpenState = false"
[expanded]="true"
data-test="publisher-edit-site-additional-targeting-accordion-panel-excluded">
[expanded]="true">
<mat-expansion-panel-header class="ap-heading ap-heading--h3">
<mat-panel-title> Exclusions</mat-panel-title>
</mat-expansion-panel-header>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { MatCheckboxChange } from '@angular/material/checkbox';
import { ActivatedRoute, Router } from '@angular/router';
import { Store } from '@ngrx/store';
import { first } from 'rxjs/operators';
Expand All @@ -7,7 +8,7 @@ import {
AddSiteToSites,
ClearLastEditedSite,
SaveSiteFiltering,
SaveSiteOnlyAcceptedBanners,
SaveSiteOptions,
UPDATE_SITE_FAILURE,
UpdateSite,
} from 'store/publisher/publisher.actions';
Expand Down Expand Up @@ -40,6 +41,7 @@ export class EditSiteAdditionalTargetingComponent extends HandleSubscriptionComp
changesSaved: boolean = false;
showRequiresSection: boolean = false;
isCheckedOnlyAcceptedBanners: boolean;
isCheckedOnlyDirectDeals: boolean;
faQuestionCircle = faQuestionCircle;

constructor(
Expand Down Expand Up @@ -98,6 +100,7 @@ export class EditSiteAdditionalTargetingComponent extends HandleSubscriptionComp
...reducedSite,
filtering: parseTargetingForBackend(filtering),
onlyAcceptedBanners: this.isCheckedOnlyAcceptedBanners,
onlyDirectDeals: this.isCheckedOnlyDirectDeals,
};
}

Expand All @@ -122,6 +125,7 @@ export class EditSiteAdditionalTargetingComponent extends HandleSubscriptionComp
this.site = {
...this.site,
onlyAcceptedBanners: this.isCheckedOnlyAcceptedBanners,
onlyDirectDeals: this.isCheckedOnlyDirectDeals,
status: siteStatusEnum.DRAFT,
filteringArray: chosenTargeting,
};
Expand All @@ -132,7 +136,12 @@ export class EditSiteAdditionalTargetingComponent extends HandleSubscriptionComp
this.subscriptions.push(errorSubscription);
} else {
this.store.dispatch(new SaveSiteFiltering(chosenTargeting));
this.store.dispatch(new SaveSiteOnlyAcceptedBanners(this.isCheckedOnlyAcceptedBanners));
this.store.dispatch(
new SaveSiteOptions({
onlyAcceptedBanners: this.isCheckedOnlyAcceptedBanners,
onlyDirectDeals: this.isCheckedOnlyDirectDeals,
})
);
this.router.navigate(['/publisher', 'create-site', 'summary']);
}
}
Expand All @@ -159,7 +168,20 @@ export class EditSiteAdditionalTargetingComponent extends HandleSubscriptionComp
} else {
this.isCheckedOnlyAcceptedBanners = lastEditedSite.onlyAcceptedBanners;
}
this.isCheckedOnlyDirectDeals = lastEditedSite.onlyDirectDeals;
});
this.subscriptions.push(lastSiteSubscription);
}

onChangeOnlyAcceptedBanners($event: MatCheckboxChange) {
if (!$event.checked) {
this.isCheckedOnlyDirectDeals = false;
}
}

onChangeOnlyDirectDeals($event: MatCheckboxChange) {
if ($event.checked) {
this.isCheckedOnlyAcceptedBanners = true;
}
}
}
76 changes: 32 additions & 44 deletions src/app/publisher/site-details/site-details.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<div class="site-details container">
<div class="row justify-between">
<div class="row align-center breadcrumbs">
<a routerLink="/publisher/dashboard" data-test="publisher-navigate-to-dashboard">
<a routerLink="/publisher/dashboard">
<p class="ap-copy ap-copy--small">My sites</p>
</a>
<div class="ap-circle ap-circle--x-small ap-circle--navy breadcrumbs-divider"></div>
<p class="ap-copy ap-copy--small ap-copy--x-dark ap-copy--semi" data-test="publisher-site-url">
<p class="ap-copy ap-copy--small ap-copy--x-dark ap-copy--semi">
{{ site.name }}
</p>
</div>
Expand All @@ -15,8 +15,7 @@
*ngIf="site.onlyAcceptedBanners"
class="ap-btn ap-btn--primary"
(click)="navigateToClassification()"
[disabled]="!isSitePositivelyVerified"
data-test="publisher-site-navigate-to-classifier">
[disabled]="!isSitePositivelyVerified">
<fa-icon class="ap-icon ap-icon--prepend" [icon]="faEdit"></fa-icon>
Select banners for approval
</button>
Expand All @@ -25,8 +24,8 @@
<div *ngIf="site.needsAdsTxtConfirmation" class="ap-alert ap-alert--warning">
<h1 class="ap-heading--h4">Add ads.txt entry</h1>
<p>
This site needs specific ads.txt entry to display advertisements. Please add the following entry to your
ads.txt file:<br />
This site needs specific ads.txt entry to display advertisements. Please add the following entry to your ads.txt
file:<br />
<code>{{ adsTxtEntry }}</code>
</p>
<p>
Expand Down Expand Up @@ -77,7 +76,7 @@ <h1 class="ap-heading--h4">Add ads.txt entry</h1>

<div class="row justify-between align-start box-title">
<div class="col">
<h2 class="ap-heading ap-heading--h2" data-test="publisher-site-url">
<h2 class="ap-heading ap-heading--h2">
{{ site.name }}
<span class="ap-copy" *ngIf="!isMetaverse">
{{ site.domain }}
Expand All @@ -93,8 +92,7 @@ <h2 class="ap-heading ap-heading--h2" data-test="publisher-site-url">
<button
class="ap-btn ap-btn--text"
(click)="navigateToEditSite('basic-information')"
[disabled]="siteStatusEnum.PENDING === this.site.status"
data-test="publisher-site-edit-basic-info-button">
[disabled]="siteStatusEnum.PENDING === this.site.status">
<fa-icon [icon]="faEdit" class="ap-icon ap-icon--prepend"></fa-icon>
Edit basic info
</button>
Expand Down Expand Up @@ -129,12 +127,7 @@ <h1 class="ap-heading ap-heading--h2 box-title">Statistics</h1>
[barChartLabels]="barChartLabels"></app-chart>
</div>
<div class="row justify-end">
<button
(click)="downloadReport()"
class="ap-btn ap-btn--secondary ap-copy--dark"
data-test="publisher-site-download-report-button">
Generate a report
</button>
<button (click)="downloadReport()" class="ap-btn ap-btn--secondary ap-copy--dark">Generate a report</button>
</div>
</div>
</div>
Expand All @@ -146,8 +139,7 @@ <h1 class="ap-heading ap-heading--h2">Exclusions & Targeting</h1>
<button
class="ap-btn ap-btn--text"
(click)="navigateToEditSite('additional-filtering')"
[disabled]="!isSitePositivelyVerified"
data-test="publisher-site-edit-filtering-button">
[disabled]="!isSitePositivelyVerified">
<fa-icon [icon]="faEdit" class="ap-icon ap-icon--prepend"></fa-icon>
{{
!filtering.requires.length && !filtering.excludes.length && !site.onlyAcceptedBanners
Expand All @@ -157,18 +149,24 @@ <h1 class="ap-heading ap-heading--h2">Exclusions & Targeting</h1>
</button>
</div>
<div *ngIf="!!filtering.requires.length || !!filtering.excludes.length || site.onlyAcceptedBanners">
<div *ngIf="site.onlyAcceptedBanners" class="ap-copy row align-center box-content">
<mat-checkbox class="site-details__checkbox" checked="checked" disabled>
Manual approval of banners
</mat-checkbox>
<button
class="ap-btn ap-btn--text"
(click)="navigateToClassification()"
[disabled]="!isSitePositivelyVerified"
data-test="publisher-site-edit-filtering-button">
<fa-icon [icon]="faEdit" class="ap-icon ap-icon--prepend"></fa-icon>
Select banners for approval
</button>
<div class="ap-copy row align-center box-content">
<div class="col">
<mat-checkbox class="site-details__checkbox" checked="checked" disabled>
Manual approval of banners
</mat-checkbox>
<mat-checkbox *ngIf="site.onlyDirectDeals" class="site-details__checkbox" checked="checked" disabled>
Only direct deals
</mat-checkbox>
</div>
<div class="col">
<button
class="ap-btn ap-btn--text"
(click)="navigateToClassification()"
[disabled]="!isSitePositivelyVerified">
<fa-icon [icon]="faEdit" class="ap-icon ap-icon--prepend"></fa-icon>
Select banners for approval
</button>
</div>
</div>
</div>

Expand Down Expand Up @@ -201,8 +199,7 @@ <h2 class="ap-heading ap-heading--h2">List of enabled pops</h2>
<button
class="ap-btn ap-btn--text"
(click)="navigateToEditSite('pops-settings')"
[disabled]="!isSitePositivelyVerified"
data-test="publisher-site-edit-pops-button">
[disabled]="!isSitePositivelyVerified">
<fa-icon [icon]="faEdit" class="ap-icon ap-icon--prepend"></fa-icon>
Edit pops
</button>
Expand All @@ -222,11 +219,7 @@ <h2 class="ap-heading ap-heading--h2">List of enabled pops</h2>
</table>
</div>
<div *ngIf="!!popAdUnits.length" class="box-content row justify-center">
<button
class="ap-btn ap-btn--secondary"
[disabled]="!isSitePositivelyVerified"
(click)="openGetCodeDialog()"
data-test="publisher-get-code-button">
<button class="ap-btn ap-btn--secondary" [disabled]="!isSitePositivelyVerified" (click)="openGetCodeDialog()">
Get placement codes
</button>
</div>
Expand All @@ -239,8 +232,7 @@ <h2 class="ap-heading ap-heading--h2">List of placements</h2>
*ngIf="editAds"
class="ap-btn ap-btn--text ap-btn--edit ap-btn--no-border"
(click)="navigateToEditSite('create-ad-units')"
[disabled]="!isSitePositivelyVerified"
data-test="publisher-site-edit-ad-units-button">
[disabled]="!isSitePositivelyVerified">
<fa-icon [icon]="faEdit" class="ap-icon ap-icon--prepend"></fa-icon>
Edit placements
</button>
Expand All @@ -260,19 +252,15 @@ <h2 class="ap-heading ap-heading--h2">List of placements</h2>
</table>
</div>
<div *ngIf="!!displayAdUnits.length" class="box-content row justify-center">
<button
class="ap-btn ap-btn--secondary"
[disabled]="!isSitePositivelyVerified"
(click)="openGetCodeDialog()"
data-test="publisher-get-code-button">
<button class="ap-btn ap-btn--secondary" [disabled]="!isSitePositivelyVerified" (click)="openGetCodeDialog()">
Get placement codes
</button>
</div>
</div>

<div class="ap-box">
<div class="box-content row justify-center">
<button routerLink="/publisher/dashboard" class="ap-btn ap-btn--primary" data-test="publisher-get-code-button">
<button routerLink="/publisher/dashboard" class="ap-btn ap-btn--primary">
<fa-icon [icon]="faArrowLeft" class="ap-icon ap-icon--prepend"></fa-icon>
Dashboard
</button>
Expand Down
8 changes: 4 additions & 4 deletions src/app/store/publisher/publisher.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const CLEAR_LAST_EDITED_SITE = 'Last edited site cleared';
export const SET_LAST_EDITED_SITE = 'Last edited site set';
export const SAVE_LAST_EDITED_SITE = 'Basic site informations saved';
export const SAVE_LAST_EDITED_SITE_FILTERING = 'Site filtering saved';
export const SAVE_LAST_EDITED_SITE_ONLY_ACCEPTED_BANNERS = 'Site only accepted banners saved';
export const SAVE_LAST_EDITED_OPTIONS = 'Site options saved';
export const SAVE_LAST_EDITED_SITE_AD_UNITS = 'Site placements saved';

export const ADD_SITE_TO_SITES = 'Save site';
Expand Down Expand Up @@ -145,10 +145,10 @@ export class SaveSiteFiltering implements Action {
constructor(public payload: AssetTargeting) {}
}

export class SaveSiteOnlyAcceptedBanners implements Action {
readonly type: string = SAVE_LAST_EDITED_SITE_ONLY_ACCEPTED_BANNERS;
export class SaveSiteOptions implements Action {
readonly type: string = SAVE_LAST_EDITED_OPTIONS;

constructor(public payload: boolean) {}
constructor(public payload: object) {}
}

export class SaveLastEditedSiteAdUnits implements Action {
Expand Down
4 changes: 2 additions & 2 deletions src/app/store/publisher/publisher.reducers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ export function publisherReducers(state = initialState, action: PublisherActions
filteringArray: action.payload,
},
};
case PublisherActions.SAVE_LAST_EDITED_SITE_ONLY_ACCEPTED_BANNERS:
case PublisherActions.SAVE_LAST_EDITED_OPTIONS:
return {
...state,
lastEditedSite: {
...state.lastEditedSite,
onlyAcceptedBanners: action.payload,
...action.payload,
},
};
case PublisherActions.SAVE_LAST_EDITED_SITE_AD_UNITS:
Expand Down

0 comments on commit 10e28d6

Please sign in to comment.