Skip to content

Commit

Permalink
Merge branch 'trunk' into fix/copy-site-checkout-plan
Browse files Browse the repository at this point in the history
  • Loading branch information
rcrdortiz committed Nov 28, 2024
2 parents 6b6a16c + 3db330b commit 06524c4
Show file tree
Hide file tree
Showing 475 changed files with 7,722 additions and 3,312 deletions.
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ Both the PR author and reviewer are responsible for ensuring the checklist is co
- [ ] Have you checked for TypeScript, React or other console errors?
- [ ] Have you used memoizing on expensive computations? More info in [Memoizing with create-selector](https://github.com/Automattic/wp-calypso/blob/trunk/packages/state-utils/src/create-selector/README.md) and [Using memoizing selectors](https://react-redux.js.org/api/hooks#using-memoizing-selectors) and [Our Approach to Data](https://github.com/Automattic/wp-calypso/blob/trunk/docs/our-approach-to-data.md)
- [ ] Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
- [ ] For UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
- [ ] For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?
6 changes: 5 additions & 1 deletion apps/odyssey-stats/src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
purchase,
emailStats,
emailSummary,
redirectToDaySummary,
} from 'calypso/my-sites/stats/controller';
import {
SITE_REQUEST,
Expand Down Expand Up @@ -85,6 +86,7 @@ const redirectToSiteTrafficPage = () => {

export default function ( pageBase = '/' ) {
const validPeriods = [ 'day', 'week', 'month', 'year' ].join( '|' );
const validTrafficPagePeriods = [ 'hour', 'day', 'week', 'month', 'year' ].join( '|' );
const validEmailPeriods = [ 'hour', 'day' ].join( '|' );

const validModules = [
Expand Down Expand Up @@ -116,14 +118,16 @@ export default function ( pageBase = '/' ) {
statsPage( `/stats/subscribers/:period(${ validPeriods })/:site`, subscribers );

// Stat Site Pages
statsPage( `/stats/:period(${ validPeriods })/:site`, site );
statsPage( `/stats/:period(${ validTrafficPagePeriods })/:site`, site );

// Redirect this to default /stats/day/:module/:site view to
// keep the paths and page view reporting consistent.
statsPage( `/stats/:module(${ validModules })/:site`, redirectToDefaultModulePage );

// Stat Summary Pages
statsPage( `/stats/:period(${ validPeriods })/:module(${ validModules })/:site`, summary );
// No hourly stats for modules
statsPage( `/stats/hour/:module(${ validModules })/:site`, redirectToDaySummary );

// Stat Single Post Page
statsPage( '/stats/post/:post_id/:site', post );
Expand Down
5 changes: 5 additions & 0 deletions apps/odyssey-stats/src/styles/wp-admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@
& .inner-notice-container.has-odyssey-stats-bg-color {
background-color: var(--jetpack-white-off);
}
& .stats .navigation-header__main .jetpack-header {
@media (max-width: 600px) {
padding-left: 0;
}
}

// Offset margin of menu items set in Calypso.
ul.wp-submenu,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export default function MigrationContactSupportForm( { show, onClose }: Props )
name,
email,
product,
agency_id: agency?.id,
no_of_sites: site,
...( pressableContactType && { contact_type: pressableContactType } ),
...( pressable_id && { pressable_id } ),
Expand Down
15 changes: 9 additions & 6 deletions client/a8c-for-agencies/components/agency-site-tag/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@ import './style.scss';
interface Props {
tag: string;
onRemoveTag: ( tag: string ) => void;
isRemovable?: boolean;
}

export default function AgencySiteTag( { tag, onRemoveTag }: Props ) {
export default function AgencySiteTag( { tag, onRemoveTag, isRemovable = true }: Props ) {
return (
<Badge className="agency-site-tag" type="info">
<span className="agency-site-tag__text">{ tag }</span>
<Icon
className="agency-site-tag__close"
onClick={ () => onRemoveTag( tag ) }
icon={ closeSmall }
/>
{ isRemovable && (
<Icon
className="agency-site-tag__close"
onClick={ () => onRemoveTag( tag ) }
icon={ closeSmall }
/>
) }
</Badge>
);
}
9 changes: 7 additions & 2 deletions client/a8c-for-agencies/components/agency-site-tags/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,13 @@ export default function AgencySiteTags( { tags, isLoading, onAddTags, onRemoveTa
{ tags.length ? (
<Card tagName="ul" className="agency-site-tags__list">
{ tags.map( ( tag ) => (
<li>
<AgencySiteTag key={ tag } tag={ tag } onRemoveTag={ onRemoveTag } />
<li key={ tag }>
<AgencySiteTag
key={ tag }
tag={ tag }
onRemoveTag={ onRemoveTag }
isRemovable={ tag !== 'a4a_self_migrated_site' }
/>
</li>
) ) }
</Card>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
color: var(--color-neutral-50);
font-size: rem(14px);
line-height: 1.5;
align-items: center;


.dev-sites-label {
margin-top: 15px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export default function UserContactSupportModalForm( {
name,
email,
product,
agency_id: agency?.id,
...( site && { site } ),
...( pressableContactType && { contact_type: pressableContactType } ),
...( pressable_id && { pressable_id } ),
Expand Down
1 change: 1 addition & 0 deletions client/a8c-for-agencies/data/support/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface SubmitContactSupportParams {
email: string;
message: string;
product: string;
agency_id: number | undefined;
site?: string;
no_of_sites?: number;
contact_type?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface APIResponse {
function mutationSubmitSupportForm( params: SubmitContactSupportParams ): Promise< APIResponse > {
let path = '/agency/help/zendesk/create-ticket';

if ( params.product === 'pressable' ) {
if ( params.product === 'pressable' && params.contact_type === 'support' ) {
path = '/agency/help/pressable/support';
}

Expand Down
44 changes: 44 additions & 0 deletions client/a8c-for-agencies/data/team/use-transfer-ownership.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { useMutation, UseMutationOptions, UseMutationResult } from '@tanstack/react-query';
import wpcom from 'calypso/lib/wp';
import { useSelector } from 'calypso/state';
import { getActiveAgencyId } from 'calypso/state/a8c-for-agencies/agency/selectors';

interface APIError {
status: number;
code: string | null;
message: string;
}

export interface Params {
id: number;
}

interface APIResponse {
success: boolean;
}

function transferOwnershipMutation( params: Params, agencyId?: number ): Promise< APIResponse > {
if ( ! agencyId ) {
throw new Error( 'Agency ID is required to transfer ownership' );
}

return wpcom.req.post( {
apiNamespace: 'wpcom/v2',
path: `/agency/${ agencyId }/transfer-ownership`,
method: 'PUT',
body: {
new_owner_id: params.id,
},
} );
}

export default function useTransferOwnershipMutation< TContext = unknown >(
options?: UseMutationOptions< APIResponse, APIError, Params, TContext >
): UseMutationResult< APIResponse, APIError, Params, TContext > {
const agencyId = useSelector( getActiveAgencyId );

return useMutation< APIResponse, APIError, Params, TContext >( {
...options,
mutationFn: ( args ) => transferOwnershipMutation( args, agencyId ),
} );
}
42 changes: 42 additions & 0 deletions client/a8c-for-agencies/hooks/use-update-tags-for-sites.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { useMutation, UseMutationOptions, UseMutationResult } from '@tanstack/react-query';
import SiteTag from 'calypso/a8c-for-agencies/types/site-tag';
import wpcom from 'calypso/lib/wp';
import { useSelector } from 'calypso/state';
import { getActiveAgencyId } from 'calypso/state/a8c-for-agencies/agency/selectors';
import { APIError } from 'calypso/state/partner-portal/types';

interface UpdateTagsForSitesMutationOptions {
siteIds: number[];
tags: string[];
}

function mutationUpdateSiteTags( {
agencyId,
siteIds,
tags,
}: UpdateTagsForSitesMutationOptions & { agencyId: number | undefined } ): Promise< SiteTag[] > {
if ( ! agencyId ) {
throw new Error( 'Agency ID is required to update the tags' );
}

return wpcom.req.put( {
method: 'PUT',
apiNamespace: 'wpcom/v2',
path: `/agency/${ agencyId }/sites/tags`,
body: {
tags,
site_ids: siteIds,
},
} );
}

export default function useUpdateTagsForSitesMutation< TContext = unknown >(
options?: UseMutationOptions< SiteTag[], APIError, UpdateTagsForSitesMutationOptions, TContext >
): UseMutationResult< SiteTag[], APIError, UpdateTagsForSitesMutationOptions, TContext > {
const agencyId = useSelector( getActiveAgencyId );

return useMutation< SiteTag[], APIError, UpdateTagsForSitesMutationOptions, TContext >( {
...options,
mutationFn: ( args ) => mutationUpdateSiteTags( { ...args, agencyId } ),
} );
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,12 @@ export default function SubmitPaymentInfo( { disableButton }: { disableButton?:
if ( status === 'success' ) {
dispatch( recordTracksEvent( 'calypso_a4a_client_checkout_submit_payment_info_success' ) );
dispatch(
successNotice( translate( 'Thank you for your purchase!' ), {
displayOnNextPage: true,
} )
successNotice(
translate( 'Thank you for your purchase! Your agency can now set up your product.' ),
{
displayOnNextPage: true,
}
)
);
page.redirect( A4A_CLIENT_SUBSCRIPTIONS_LINK );
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export const FILTER_TYPE_INSTALL = 'install';
export const FILTER_TYPE_VISITS = 'visits';
export const PLAN_CATEGORY_STANDARD = 'standard';
export const PLAN_CATEGORY_ENTERPRISE = 'enterprise';
Loading

0 comments on commit 06524c4

Please sign in to comment.