Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f927527
feat: update settings and modify component rendering logic
Alessio-Caruso Aug 11, 2025
ace4e23
feat(REN-398): remove coupon block
suppa96 Aug 11, 2025
8ef658b
fix(REN-398): fix deploy and remove badge component
suppa96 Aug 12, 2025
a9a5a17
fix(REN-398): add server api
suppa96 Aug 12, 2025
a07c7a4
Refactor partner settings API and update fetching logic
Alessio-Caruso Aug 12, 2025
24df6b4
fix: update parameter destructuring in partner settings API
Alessio-Caruso Aug 12, 2025
7bfa788
feat(#REN-398): move server getPartnerSettings out of useSettingsOrIn…
suppa96 Aug 12, 2025
0b70f9a
chore(#REN-398): remove test api
suppa96 Aug 12, 2025
179e2e8
feat(REN-398): move server api into pages directory
suppa96 Aug 12, 2025
1973fa8
feat(REN-398): add partnerSettings mapping
suppa96 Aug 12, 2025
c6847e9
fix(REN-398): fix api rout content fetch
suppa96 Aug 12, 2025
fe6c8db
feat(#REN-398): add header component
suppa96 Aug 13, 2025
f307b9e
chore(REN-398): linting
suppa96 Aug 13, 2025
15bc6b8
chore(REN-398): linting
suppa96 Aug 13, 2025
c0c7d30
fix(REN-398): move partner-settings route back to app router
suppa96 Aug 13, 2025
3f7072e
fix(REN-398): build as standalone
suppa96 Aug 13, 2025
4cc6473
fix(REN-398): put server API in pages
suppa96 Aug 13, 2025
0fd2117
Merge branch 'custom-checkout' into REN-398-checkout-styling
suppa96 Aug 13, 2025
b25e397
fix(#REN-398): try fixing deploy
suppa96 Aug 13, 2025
3893d59
feat(#REN-398): add custom colors
suppa96 Aug 14, 2025
e5780ec
feat(#REN-398): add RenewUs header
suppa96 Aug 14, 2025
9d110f3
feat(#REN-398): remove commercelayer logo from error page
suppa96 Aug 14, 2025
e2ae038
feat(REN-398): replace font color all over the app
suppa96 Aug 14, 2025
e2e3b4c
feat(REN-398): fix background color
suppa96 Aug 14, 2025
0d28ee9
feat(REN-398): remove padding borron from button
suppa96 Aug 14, 2025
e1b78d4
feat(REN-398): add mapPartnerSettingsWithDefaults util
suppa96 Aug 14, 2025
ed2add1
fix(REN-398): fix import
suppa96 Aug 14, 2025
f4c7653
Merge branch 'custom-checkout' into REN-398-checkout-styling
suppa96 Aug 14, 2025
d75761b
test(REN-398): try moving logic to app router
suppa96 Aug 14, 2025
0149375
test(REN-398): try static build
suppa96 Aug 14, 2025
efccf12
feat(REN-398): remove dynamic param from route url
suppa96 Aug 14, 2025
d4707e8
test(REN-398): use route with query parameters
suppa96 Aug 14, 2025
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
6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.biome": "explicit"
}
},
"i18n-ally.localesPaths": [
"components/data/i18n",
"public/static/locales"
]
}
32 changes: 32 additions & 0 deletions @typings/checkout.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ interface CheckoutSettings {
slug: string
logoUrl: NullableType<string>
companyName: string
partnerId: string
language: string
primaryColor: string
favicon: string
Expand All @@ -34,6 +35,37 @@ interface CheckoutSettings {
config: Organization.DefaultConfig | null
}

interface BrandColors {
dark: string,
accent: string,
base: string
}

interface HeaderLogo {
image: string
alt: string
}

interface PartnerSettings {
// brandName: string
brandColors: BrandColors
headerLogo: HeaderLogo
// email: string
// phone: string
// linkPartner: string
// currency: string
// logoHeaderPath: string
// logoHeaderAlt: string
// logoFooterPath: string
// logoFooterAlt: string
// faviconIcoPath: string
// splashFilePath: string
// splashFileAlt: string
// splashFileType: string
// privacyPolicy: string
// termsAndConditions: string
}

interface InvalidCheckoutSettings {
validCheckout: false
retryOnError: boolean
Expand Down
265 changes: 265 additions & 0 deletions @typings/storyblok.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,265 @@
// This file was generated by the storyblok CLI.
// DO NOT MODIFY THIS FILE BY HAND.
export interface ComponentAccordionListStoryblok {
accordion_list?: FragmentAccordionStoryblok[]
component: 'ComponentAccordionList'
_uid: string
[k: string]: any
}

export interface AssetStoryblok {
alt: string | null
copyright?: string | null
fieldtype: 'asset'
id: number
filename: string | null
name: string
title: string | null
focus: string | null
meta_data?: {
[k: string]: any
}
source?: string | null
is_external_url?: boolean
is_private?: boolean
src?: string
updated_at?: string
width?: number | null
height?: number | null
aspect_ratio?: number | null
public_id?: string | null
content_type?: string
[k: string]: any
}

export interface FaviconsStoryblok {
apple_touch_favicon?: AssetStoryblok
favicon_96?: AssetStoryblok
favicon_ico?: AssetStoryblok
favicon_svg?: AssetStoryblok
favicon_192?: AssetStoryblok
favicon_512?: AssetStoryblok
component: 'favicons'
_uid: string
[k: string]: any
}

export interface RichtextStoryblok {
type: string
content?: RichtextStoryblok[]
marks?: RichtextStoryblok[]
attrs?: any
text?: string
[k: string]: any
}

export interface FragmentAccordionStoryblok {
question?: string
answer?: RichtextStoryblok
component: 'FragmentAccordion'
_uid: string
[k: string]: any
}

export type MultiassetStoryblok = {
alt: string | null
copyright?: string | null
fieldtype: 'asset'
id: number
filename: string | null
name: string
title: string | null
focus: string | null
meta_data?: {
[k: string]: any
}
source?: string | null
is_external_url?: boolean
is_private?: boolean
src?: string
updated_at?: string
width?: number | null
height?: number | null
aspect_ratio?: number | null
public_id?: string | null
content_type?: string
[k: string]: any
}[]

export interface HomepageStoryblok {
internal_title?: string
title?: string
subtitle?: string
content?: RichtextStoryblok
Image?: MultiassetStoryblok
component: 'Homepage'
_uid: string
[k: string]: any
}

export type MultilinkStoryblok =
| {
fieldtype: 'multilink'
id: string
url: string
cached_url: string
target?: '_blank' | '_self'
anchor?: string
rel?: string
title?: string
prep?: string
linktype: 'story'
story?: {
name: string
created_at?: string
published_at?: string
id: number
uuid: string
content?: {
[k: string]: any
}
slug: string
full_slug: string
sort_by_date?: null | string
position?: number
tag_list?: string[]
is_startpage?: boolean
parent_id?: null | number
meta_data?: null | {
[k: string]: any
}
group_id?: string
first_published_at?: string
release_id?: null | number
lang?: string
path?: null | string
alternates?: any[]
default_full_slug?: null | string
translated_slugs?: null | any[]
[k: string]: any
}
[k: string]: any
}
| {
fieldtype: 'multilink'
id: string
url: string
cached_url: string
target?: '_blank' | '_self'
linktype: 'url'
rel?: string
title?: string
[k: string]: any
}
| {
fieldtype: 'multilink'
id: string
url: string
cached_url: string
target?: '_blank' | '_self'
email?: string
linktype: 'email'
[k: string]: any
}
| {
fieldtype: 'multilink'
id: string
url: string
cached_url: string
target?: '_blank' | '_self'
linktype: 'asset'
[k: string]: any
}

export interface SettingsGlobalAppStoryblok {
internal_title?: string
name_brand?: string
phone?: string
email?: string
link_partner?: Exclude<
MultilinkStoryblok,
{ linktype?: 'email' } | { linktype?: 'asset' }
>
brand_colors?: any
brand_font: string
notify_pdp?: RichtextStoryblok
message_delivery_pdp?: RichtextStoryblok
logo?: AssetStoryblok
logo_footer?: AssetStoryblok
currency: 'USD' | 'EUR'
modal_need_help?: TopicModalStoryblok[]
modal_quit?: TopicModalStoryblok[]
Favicons?: FaviconsStoryblok[]
splash_page?: SplashPageStoryblok[]
dark?: string
accent?: string
base?: string
privacy_policy?: Exclude<
MultilinkStoryblok,
{ linktype?: 'email' } | { linktype?: 'asset' }
>
terms_and_conditions?: Exclude<
MultilinkStoryblok,
{ linktype?: 'email' } | { linktype?: 'asset' }
>
component: 'SettingsGlobalApp'
_uid: string
[k: string]: any
}

export interface StaticDataFilesStoryblok {
name?: string
product_descriptions?: AssetStoryblok
component: 'StaticDataFiles'
_uid: string
[k: string]: any
}

export interface SplashPageStoryblok {
type?: '' | 'Lottiefiles' | 'Image'
splash_file?: AssetStoryblok
component: 'splash_page'
_uid: string
[k: string]: any
}

export interface StepPageStoryblok {
title_primary: string
description_primary?: RichtextStoryblok
title_secondary?: string
description_secondary?: RichtextStoryblok
component: 'StepPage'
_uid: string
[k: string]: any
}

export interface TopicModalStoryblok {
internal_title?: string
type?: string
title?: string
subtitle?: string
description?: RichtextStoryblok
qa?: ComponentAccordionListStoryblok[]
component: 'TopicModal'
_uid: string
[k: string]: any
}

export interface TopicTutorialStoryblok {
internal_title?: string
title?: string
description?: string
video_tutorial?: AssetStoryblok
fullscreenVideo?: boolean
component: 'TopicTutorial'
_uid: string
[k: string]: any
}

export interface TutorialPageStoryblok {
internal_title?: string
steps?: TopicTutorialStoryblok[]
component: 'TutorialPage'
_uid: string
[k: string]: any
}
51 changes: 51 additions & 0 deletions app/api/partner-settings/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import type { NextRequest } from "next/server";
// export const runtime = "nodejs";

export async function GET(
req: NextRequest
) {
const searchParams = req.nextUrl.searchParams
const partnerId = searchParams.get('partner-id');
console.log("API partner-settings called with partnerId:", partnerId);

if (!partnerId) {
return new Response(JSON.stringify({ message: "Invalid partner ID" }), {
status: 400,
headers: { "Content-Type": "application/json" },
});
}

const token = process.env.SB_TOKEN;
const isProduction = process.env.NODE_ENV === "production";
const deliveryId = "_settings";
const url = `https://api-us.storyblok.com/v2/cdn/stories/${partnerId}/${deliveryId}?token=${token}&version=${isProduction ? "published" : "draft"}`;

try {
const res = await fetch(url, { headers: { "Content-Type": "application/json" } });
if (!res.ok) {
return new Response(JSON.stringify({ message: "Settings not found" }), {
status: 404,
headers: { "Content-Type": "application/json" },
});
}
const json = await res.json();

if (!json.story) {
return new Response(JSON.stringify({ message: "Settings not found" }), {
status: 404,
headers: { "Content-Type": "application/json" },
});
}

return new Response(JSON.stringify(json.story), {
status: 200,
headers: { "Content-Type": "application/json" },
});
} catch (error) {
console.error("Error fetching Storyblok settings:", error);
return new Response(JSON.stringify({ message: "Storyblok request error" }), {
status: 500,
headers: { "Content-Type": "application/json" },
});
}
}
Loading