Skip to content

Commit

Permalink
Merge branch 'develop' into enhancement/9911-km-setup-banner-fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitrox committed Jan 28, 2025
2 parents 87b9239 + 4a4427f commit 16bc578
Show file tree
Hide file tree
Showing 57 changed files with 665 additions and 299 deletions.
6 changes: 0 additions & 6 deletions assets/js/googlesitekit/datastore/site/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ const fetchHTMLForURLStore = createFetchStore( {

// Actions
const RESET_HTML_FOR_URL = 'RESET_HTML_FOR_URL';
const WAIT_FOR_HTML_FOR_URL = 'WAIT_FOR_HTML_FOR_URL';
const CHECK_FOR_SETUP_TAG = 'CHECK_FOR_SETUP_TAG';

// Errors
Expand Down Expand Up @@ -132,11 +131,6 @@ const baseActions = {
};

const baseControls = {
[ WAIT_FOR_HTML_FOR_URL ]: createRegistryControl(
( registry ) =>
( { payload: { url } } ) =>
registry.resolveSelect( CORE_SITE ).getHTMLForURL( url )
),
[ CHECK_FOR_SETUP_TAG ]: createRegistryControl(
( registry ) => async () => {
let error;
Expand Down
62 changes: 31 additions & 31 deletions assets/js/modules/ads/components/settings/SettingsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,37 +92,6 @@ export default function SettingsView() {
<AdBlockerWarning moduleSlug="ads" />
</div>

<SettingsStatuses
statuses={
fpmEnabled
? [
{
label: __(
'Enhanced Conversion Tracking',
'google-site-kit'
),
status: isConversionTrackingEnabled,
},
{
label: __(
'First-party mode',
'google-site-kit'
),
status: isFPMEnabled,
},
]
: [
{
label: __(
'Conversion Tracking',
'google-site-kit'
),
status: isConversionTrackingEnabled,
},
]
}
/>

{ ! isAdBlockerActive && (
<div className="googlesitekit-settings-module__meta-item">
<h5 className="googlesitekit-settings-module__meta-item-type">
Expand Down Expand Up @@ -154,6 +123,37 @@ export default function SettingsView() {
</p>
</div>
) }

<SettingsStatuses
statuses={
fpmEnabled
? [
{
label: __(
'Enhanced Conversion Tracking',
'google-site-kit'
),
status: isConversionTrackingEnabled,
},
{
label: __(
'First-party mode',
'google-site-kit'
),
status: isFPMEnabled,
},
]
: [
{
label: __(
'Conversion Tracking',
'google-site-kit'
),
status: isConversionTrackingEnabled,
},
]
}
/>
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import { isInvalidCustomDimensionError } from '../../../../utils/custom-dimensio
import useViewContext from '../../../../../../hooks/useViewContext';
import useViewOnly from '../../../../../../hooks/useViewOnly';
import { trackEvent } from '../../../../../../util';
import { reportRowsWithSetValues } from '../../../../utils/report-rows-with-set-values';

const hasZeroDataForAudience = ( report, dimensionName ) => {
const audienceData = report?.rows?.find(
Expand Down Expand Up @@ -567,6 +568,11 @@ export default function AudienceTiles( { Widget, widgetLoading } ) {
isPartialData,
} = getAudienceTileData( audienceResourceName, index );

// Filter (not set) value from the top countries report if present.
const filteredTopCitiesRows = topCities?.rows
? reportRowsWithSetValues( topCities.rows )
: [];

// Return loading tile if data is not yet loaded.
if (
loading ||
Expand Down Expand Up @@ -633,19 +639,19 @@ export default function AudienceTiles( { Widget, widgetLoading } ) {
}
topCities={ {
dimensionValues: [
topCities?.rows?.[ 0 ]
filteredTopCitiesRows?.[ 0 ]
?.dimensionValues?.[ 0 ],
topCities?.rows?.[ 1 ]
filteredTopCitiesRows?.[ 1 ]
?.dimensionValues?.[ 0 ],
topCities?.rows?.[ 2 ]
filteredTopCitiesRows?.[ 2 ]
?.dimensionValues?.[ 0 ],
],
metricValues: [
topCities?.rows?.[ 0 ]
filteredTopCitiesRows?.[ 0 ]
?.metricValues?.[ 0 ],
topCities?.rows?.[ 1 ]
filteredTopCitiesRows?.[ 1 ]
?.metricValues?.[ 0 ],
topCities?.rows?.[ 2 ]
filteredTopCitiesRows?.[ 2 ]
?.metricValues?.[ 0 ],
],
total: visitors,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,12 @@ exports[`AudienceTilesWidget should not render audiences that are not available
<div
class="googlesitekit-audience-segmentation-tile-metric__cities-metric-name"
>
(not set)
New York
</div>
<div
class="googlesitekit-audience-segmentation-tile-metric__cities-metric-value"
>
99%
71.1%
</div>
</div>
<div
Expand Down Expand Up @@ -640,12 +640,12 @@ exports[`AudienceTilesWidget should render correctly when there is partial data
<div
class="googlesitekit-audience-segmentation-tile-metric__cities-metric-name"
>
(not set)
New York
</div>
<div
class="googlesitekit-audience-segmentation-tile-metric__cities-metric-value"
>
78.6%
392.9%
</div>
</div>
</div>
Expand Down Expand Up @@ -1153,12 +1153,12 @@ exports[`AudienceTilesWidget should render when all configured audiences are mat
<div
class="googlesitekit-audience-segmentation-tile-metric__cities-metric-name"
>
(not set)
New York
</div>
<div
class="googlesitekit-audience-segmentation-tile-metric__cities-metric-value"
>
106.7%
76.7%
</div>
</div>
<div
Expand Down Expand Up @@ -1513,12 +1513,12 @@ exports[`AudienceTilesWidget should render when configured audience is matching
<div
class="googlesitekit-audience-segmentation-tile-metric__cities-metric-name"
>
(not set)
New York
</div>
<div
class="googlesitekit-audience-segmentation-tile-metric__cities-metric-value"
>
145.5%
104.5%
</div>
</div>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const topCitiesReportOptions = {
desc: true,
},
],
limit: 3,
limit: 4,
};

const topContentReportOptions = {
Expand Down Expand Up @@ -127,9 +127,7 @@ Default.args = {
'properties/12345/audiences/4', // Returning visitors
],
};
Default.scenario = {
label: 'Modules/Analytics4/Components/AudienceSegmentation/Dashboard/AudienceTilesWidget/Default',
};
Default.scenario = {};

export const DefaultWithMissingCustomDimension = Template.bind( {} );
DefaultWithMissingCustomDimension.storyName =
Expand All @@ -146,9 +144,7 @@ DefaultWithMissingCustomDimension.args = {
} );
},
};
DefaultWithMissingCustomDimension.scenario = {
label: 'Modules/Analytics4/Components/AudienceSegmentation/Dashboard/AudienceTilesWidget/DefaultWithMissingCustomDimension',
};
DefaultWithMissingCustomDimension.scenario = {};

export const DefaultViewOnlyWithCustomDimensionError = Template.bind( {} );
DefaultViewOnlyWithCustomDimensionError.storyName =
Expand Down Expand Up @@ -245,9 +241,7 @@ DefaultWithZeroTile.args = {
} );
},
};
DefaultWithZeroTile.scenario = {
label: 'Modules/Analytics4/Components/AudienceSegmentation/Dashboard/AudienceTilesWidget/DefaultWithZeroTile',
};
DefaultWithZeroTile.scenario = {};

export const TwoTiles = Template.bind( {} );
TwoTiles.storyName = 'Two Tiles';
Expand All @@ -257,9 +251,7 @@ TwoTiles.args = {
'properties/12345/audiences/3', // New visitors
],
};
TwoTiles.scenario = {
label: 'Modules/Analytics4/Components/AudienceSegmentation/Dashboard/AudienceTilesWidget/TwoTiles',
};
TwoTiles.scenario = {};

export const TwoTilesWithMissingCustomDimension = Template.bind( {} );
TwoTilesWithMissingCustomDimension.storyName =
Expand Down Expand Up @@ -367,9 +359,7 @@ TwoTilesWithZeroTile.args = {
} );
},
};
TwoTilesWithZeroTile.scenario = {
label: 'Modules/Analytics4/Components/AudienceSegmentation/Dashboard/AudienceTilesWidget/TwoTilesWithZeroTile',
};
TwoTilesWithZeroTile.scenario = {};

export const ZeroTileWithPlaceholder = Template.bind( {} );
ZeroTileWithPlaceholder.storyName = 'ZeroTileWithPlaceholder';
Expand Down Expand Up @@ -426,9 +416,7 @@ ZeroTileWithPlaceholder.args = {
} );
},
};
ZeroTileWithPlaceholder.scenario = {
label: 'Modules/Analytics4/Components/AudienceSegmentation/Dashboard/AudienceTilesWidget/ZeroTileWithPlaceholder',
};
ZeroTileWithPlaceholder.scenario = {};

export const DefaultAudiencesPartialData = Template.bind( {} );
DefaultAudiencesPartialData.storyName = 'DefaultAudiencesPartialData';
Expand Down Expand Up @@ -625,7 +613,7 @@ SingleTileErrored.args = {
desc: true,
},
],
limit: 3,
limit: 4,
};

const errorReport = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ function provideAudienceTilesMockReport(
desc: true,
},
],
limit: 3,
limit: 4,
};

const topContentReportOptions = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,9 @@ function getPopularAuthorsWidgetReportOptions( select ) {
dimensionFilters: {
// Make sure that we select only rows without (not set) records.
'customEvent:googlesitekit_post_author': {
filterType: 'stringFilter',
matchType: 'EXACT',
value: '(not set)',
notExpression: true,
filterType: 'emptyFilter',
value: '',
notExpression: false,
},
},
metrics: [ { name: 'screenPageViews' } ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ export default function useAudienceTilesReports( {
desc: true,
},
],
limit: 3,
limit: 4, // Limit is set to 4 so that (not set) can be filtered out and 3 cities remain to display.
};

const topCitiesReport = useInViewSelect( ( select ) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
useBreakpoint,
} from '../../../../hooks/useBreakpoint';
import useActivateModuleCallback from '../../../../hooks/useActivateModuleCallback';
import { useFeature } from '../../../../hooks/useFeature';
import { CORE_USER } from '../../../../googlesitekit/datastore/user/constants';
import { READER_REVENUE_MANAGER_MODULE_SLUG } from '../../datastore/constants';
import SetupSVG from '../../../../../svg/graphics/reader-revenue-manager-setup.svg';
Expand All @@ -62,6 +63,7 @@ export default function ReaderRevenueManagerSetupCTABanner( {
Notification,
} ) {
const breakpoint = useBreakpoint();
const isRRMv2Enabled = useFeature( 'rrmModuleV2' );

const onSetupActivate = useActivateModuleCallback(
READER_REVENUE_MANAGER_MODULE_SLUG
Expand Down Expand Up @@ -133,10 +135,15 @@ export default function ReaderRevenueManagerSetupCTABanner( {
<div className="googlesitekit-setup-cta-banner__description">
<p>
{ createInterpolateElement(
__(
'Turn casual visitors into loyal readers and earn more from your content with voluntary contributions, surveys, newsletter sign-ups and reader insight tools. <a>Learn more</a>',
'google-site-kit'
),
isRRMv2Enabled
? __(
'Turn casual visitors into loyal readers and earn more from your content with paywalls, contributions, surveys, newsletter sign-ups and reader insight tools. <a>Learn more</a>',
'google-site-kit'
)
: __(
'Turn casual visitors into loyal readers and earn more from your content with voluntary contributions, surveys, newsletter sign-ups and reader insight tools. <a>Learn more</a>',
'google-site-kit'
),
{
a: (
<LearnMoreLink
Expand All @@ -150,11 +157,15 @@ export default function ReaderRevenueManagerSetupCTABanner( {
),
}
) }
<br />
<br />
{ __(
'* Support for subscriptions coming soon',
'google-site-kit'
{ ! isRRMv2Enabled && (
<Fragment>
<br />
<br />
{ __(
'* Support for subscriptions coming soon',
'google-site-kit'
) }
</Fragment>
) }
</p>
</div>
Expand Down
Loading

0 comments on commit 16bc578

Please sign in to comment.