File tree Expand file tree Collapse file tree
app/(ee)/partners.dub.co/(apply)/[programSlug]/(default)
ui/program-marketplace/external Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,8 +29,14 @@ export default async function ApplicationPage(props: {
2929 ! program . group . applicationFormData ||
3030 ! program . group . applicationFormPublishedAt
3131 ) {
32- // throw 404 if it's the default group, else redirect to the default group page
32+ // for the default group:
33+ // - if the program is found, redirect to the marketplace program page
34+ // - otherwise, throw 404
35+ // for other groups: redirect to the default group variant
3336 if ( partnerGroupSlug === DEFAULT_PARTNER_GROUP . slug ) {
37+ if ( program ) {
38+ redirect ( `/marketplace/${ programSlug } ` ) ;
39+ }
3440 notFound ( ) ;
3541 } else {
3642 redirect ( `/${ programSlug } /apply` ) ;
Original file line number Diff line number Diff line change @@ -65,8 +65,14 @@ export default async function SuccessPage(props: {
6565 ! program . group . applicationFormData ||
6666 ! program . group . applicationFormPublishedAt
6767 ) {
68- // throw 404 if it's the default group, else redirect to the default group page
68+ // for the default group:
69+ // - if the program is found, redirect to the marketplace program page
70+ // - otherwise, throw 404
71+ // for other groups: redirect to the default group variant
6972 if ( partnerGroupSlug === DEFAULT_PARTNER_GROUP . slug ) {
73+ if ( program ) {
74+ redirect ( `/marketplace/${ programSlug } ` ) ;
75+ }
7076 notFound ( ) ;
7177 } else {
7278 redirect ( `/${ programSlug } /apply` ) ;
Original file line number Diff line number Diff line change @@ -28,8 +28,14 @@ export default async function ApplyPage(props: {
2828 ! program . group . landerData ||
2929 ! program . group . landerPublishedAt
3030 ) {
31- // throw 404 if it's the default group, else redirect to the default group page
31+ // for the default group:
32+ // - if the program is found, redirect to the marketplace program page
33+ // - otherwise, throw 404
34+ // for other groups: redirect to the default group variant
3235 if ( partnerGroupSlug === DEFAULT_PARTNER_GROUP . slug ) {
36+ if ( program ) {
37+ redirect ( `/marketplace/${ programSlug } ` ) ;
38+ }
3339 notFound ( ) ;
3440 } else {
3541 redirect ( `/${ programSlug } ` ) ;
Original file line number Diff line number Diff line change @@ -49,26 +49,25 @@ export const getPublicNetworkPrograms = cache(
4949 } ,
5050 } ,
5151 } ) ,
52- groups : {
53- some : {
54- slug : DEFAULT_PARTNER_GROUP . slug ,
55- applicationFormPublishedAt : {
56- not : null ,
52+ ...( rewardType && {
53+ groups : {
54+ some : {
55+ slug : DEFAULT_PARTNER_GROUP . slug ,
56+ ...( rewardType === "sale" && {
57+ saleRewardId : { not : null } ,
58+ } ) ,
59+ ...( rewardType === "lead" && {
60+ leadRewardId : { not : null } ,
61+ } ) ,
62+ ...( rewardType === "click" && {
63+ clickRewardId : { not : null } ,
64+ } ) ,
65+ ...( rewardType === "discount" && {
66+ discountId : { not : null } ,
67+ } ) ,
5768 } ,
58- ...( rewardType === "sale" && {
59- saleRewardId : { not : null } ,
60- } ) ,
61- ...( rewardType === "lead" && {
62- leadRewardId : { not : null } ,
63- } ) ,
64- ...( rewardType === "click" && {
65- clickRewardId : { not : null } ,
66- } ) ,
67- ...( rewardType === "discount" && {
68- discountId : { not : null } ,
69- } ) ,
7069 } ,
71- } ,
70+ } ) ,
7271 } ,
7372 include : {
7473 groups : {
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ async function fetchHomePrograms(
1818
1919export async function MarketplaceExternalHomePage ( ) {
2020 const [ featuredPrograms , ...rowPrograms ] = await Promise . all ( [
21- fetchHomePrograms ( { featured : true , pageSize : 6 } ) ,
21+ fetchHomePrograms ( { featured : true } ) ,
2222 ...MARKETPLACE_HOME_ROWS . map ( ( row ) => fetchHomePrograms ( row . fetchParams ) ) ,
2323 ] ) ;
2424
You can’t perform that action at this time.
0 commit comments