Merge branch 'develop' into feature/tracking

This commit is contained in:
Linus Flood
2024-10-15 07:46:54 +02:00
209 changed files with 4413 additions and 1046 deletions

View File

@@ -30,6 +30,45 @@ fragment TeaserCardBlockRef on TeaserCard {
}
}
}
sidepeek_content {
content {
embedded_itemsConnection {
edges {
node {
__typename
...AccountPageRef
...ContentPageRef
...LoyaltyPageRef
...HotelPageRef
}
}
}
}
primary_button {
linkConnection {
edges {
node {
__typename
...ContentPageRef
...LoyaltyPageRef
...HotelPageRef
}
}
}
}
secondary_button {
linkConnection {
edges {
node {
__typename
...ContentPageRef
...LoyaltyPageRef
...HotelPageRef
}
}
}
}
}
system {
...System
}

View File

@@ -9,6 +9,7 @@
fragment Shortcuts on Shortcuts {
subtitle: preamble
title
two_column_list
shortcuts {
open_in_new_tab
text

View File

@@ -28,6 +28,7 @@ fragment TeaserCardBlock on TeaserCard {
...LoyaltyPageLink
...ContentPageLink
...AccountPageLink
...HotelPageLink
}
}
}
@@ -55,6 +56,63 @@ fragment TeaserCardBlock on TeaserCard {
sidepeek_button {
call_to_action_text
}
sidepeek_content {
heading
content {
embedded_itemsConnection {
edges {
node {
__typename
...AccountPageLink
...ContentPageLink
...HotelPageLink
...LoyaltyPageLink
}
}
}
json
}
has_primary_button
primary_button {
is_contentstack_link
cta_text
open_in_new_tab
external_link {
title
href
}
linkConnection {
edges {
node {
__typename
...LoyaltyPageLink
...ContentPageLink
...HotelPageLink
}
}
}
}
has_secondary_button
secondary_button {
is_contentstack_link
cta_text
open_in_new_tab
external_link {
title
href
}
linkConnection {
edges {
node {
__typename
...LoyaltyPageLink
...ContentPageLink
...HotelPageLink
}
}
}
}
}
system {
...System
}

View File

@@ -23,16 +23,6 @@ query GetContentPage($locale: String!, $uid: String!) {
preamble
...NavigationLinks
}
blocks {
__typename
...CardsGrid_ContentPage
...Content_ContentPage
...DynamicContent_ContentPage
...Shortcuts_ContentPage
...Table_ContentPage
...TextCols_ContentPage
...UspGrid_ContentPage
}
sidebar {
__typename
...ContentSidebar_ContentPage
@@ -50,6 +40,21 @@ query GetContentPage($locale: String!, $uid: String!) {
}
}
query GetContentPageBlocks($locale: String!, $uid: String!) {
content_page(uid: $uid, locale: $locale) {
blocks {
__typename
...CardsGrid_ContentPage
...Content_ContentPage
...DynamicContent_ContentPage
...Shortcuts_ContentPage
...Table_ContentPage
...TextCols_ContentPage
...UspGrid_ContentPage
}
}
}
query GetContentPageRefs($locale: String!, $uid: String!) {
content_page(locale: $locale, uid: $uid) {
header {

View File

@@ -53,13 +53,28 @@ export async function request<T>(
}
}
const print = (await import("graphql/language/printer")).print
const nr = Math.random()
console.log(`START REQUEST ${nr}`)
console.time(`OUTGOING REQUEST ${nr}`)
console.log(`Sending reqeust to ${env.CMS_URL}`)
console.log(`Query:`, print(query as DocumentNode))
console.log(`Variables:`, variables)
try {
// @ts-expect-error: query can be undefined (?)
const operationName = (query as DocumentNode).definitions.find(
(d) => d.kind === "OperationDefinition" && d.operation === "query"
// @ts-expect-error: name does not exist (?)
).name.value
console.log(`[gql] Sending graphql request to ${env.CMS_URL}`, {
operationName,
variables,
})
} catch (e) {
console.error(`[gql] Unable to extract operation name from query`, {
query,
error: e,
})
console.log(`[gql] Sending graphql request to ${env.CMS_URL}`, {
operationName: "<Unable to extract>",
variables,
})
}
const response = await client.request<T>({
document: query,
@@ -70,8 +85,30 @@ export async function request<T>(
variables,
})
console.timeEnd(`OUTGOING REQUEST ${nr}`)
console.log({ response })
try {
// @ts-expect-error: query can be undefined (?)
const operationName = (query as DocumentNode).definitions.find(
(d) => d.kind === "OperationDefinition" && d.operation === "query"
// @ts-expect-error: name does not exist (?)
).name.value
console.log(`[gql] Response for ${env.CMS_URL}`, {
response,
operationName,
variables,
})
} catch (e) {
console.error(`[gql] Unable to extract operation name from query`, {
query,
error: e,
})
console.log(`[gql] Response for ${env.CMS_URL}`, {
response,
operationName: "<Unable to extract>",
variables,
})
}
return { data: response }
} catch (error) {
@@ -98,8 +135,10 @@ export async function request<T>(
}
}
// console.error("Error in graphql request")
// console.error(error)
console.error(
`[gql] Error sending graphql request to ${env.CMS_URL}`,
error
)
throw new Error("Something went wrong")
}
}

View File

@@ -50,8 +50,6 @@ export function serverClient() {
redirect(redirectUrl)
}
}
throw internalServerError()
},
})
}