feat(SW-66, SW-348): search functionality and ui

This commit is contained in:
Simon Emanuelsson
2024-08-28 10:47:57 +02:00
parent b9dbcf7d90
commit af850c90e7
437 changed files with 7663 additions and 9881 deletions

View File

@@ -8,15 +8,17 @@ export namespace endpoints {
}
export const enum v1 {
profile = "profile/v1/Profile",
creditCards = `${profile}/creditCards`,
initiateSaveCard = `${creditCards}/initiateSaveCard`,
friendTransactions = "profile/v1/Transaction/friendTransactions",
upcomingStays = "booking/v1/Stays/future",
previousStays = "booking/v1/Stays/past",
hotels = "hotel/v1/Hotels",
intiateSaveCard = `${creditCards}/initiateSaveCard`,
deleteCreditCard = `${profile}/creditCards`,
booking = "booking/v1/Bookings",
creditCards = `${profile}/creditCards`,
city = "hotel/v1/Cities",
citiesCountry = `${city}/country`,
countries = "hotel/v1/Countries",
friendTransactions = "profile/v1/Transaction/friendTransactions",
hotels = "hotel/v1/Hotels",
initiateSaveCard = `${creditCards}/initiateSaveCard`,
locations = "hotel/v1/Locations",
previousStays = "booking/v1/Stays/past",
upcomingStays = "booking/v1/Stays/future",
}
}

View File

@@ -20,7 +20,7 @@ const defaultOptions: RequestInit = {
mode: "cors",
}
const fetch = fetchRetry(global.fetch, {
const wrappedFetch = fetchRetry(fetch, {
retries: 3,
retryDelay: function (attempt, error, response) {
return Math.pow(2, attempt) * 150 // 150, 300, 600
@@ -41,7 +41,10 @@ export async function get(
})
url.searchParams.sort()
}
return fetch(url, merge.all([defaultOptions, { method: "GET" }, options]))
return wrappedFetch(
url,
merge.all([defaultOptions, { method: "GET" }, options])
)
}
export async function patch(
@@ -59,7 +62,7 @@ export async function patch(
})
url.searchParams.sort()
}
return fetch(
return wrappedFetch(
url,
merge.all([
defaultOptions,
@@ -84,7 +87,7 @@ export async function post(
})
url.searchParams.sort()
}
return fetch(
return wrappedFetch(
url,
merge.all([
defaultOptions,
@@ -108,5 +111,8 @@ export async function remove(
})
url.searchParams.sort()
}
return fetch(url, merge.all([defaultOptions, { method: "DELETE" }, options]))
return wrappedFetch(
url,
merge.all([defaultOptions, { method: "DELETE" }, options])
)
}

48
lib/discriminatedUnion.ts Normal file
View File

@@ -0,0 +1,48 @@
import { z } from "zod"
import type {
DiscriminatedUnionError,
Option,
} from "@/types/discriminatedUnion"
/**
* This file is created to handle our discriminated unions
* validations primarily for union returns from Contentstacks
* GraphQL server.
*
* In the case of a new block being added to the union in Contenstack,
* Zod will throw because that typename is not expected ("invalid_union_discriminator").
* Therefore we add a safety that we return everytime we stumble upon
* the issue and then we filter it out in the transform.
*
* This replaces the `cleanEmptyObjects` function that would require
* everyone to never make a mistake in adding __typename to root
* anywhere (or any other potentially global fields in case the return type
* is an Interface e.g).
*/
export function discriminatedUnion<T extends Option>(options: T[]) {
return z
.discriminatedUnion("__typename", [
z.object({ __typename: z.literal(undefined) }),
...options,
])
.catch(({ error }: DiscriminatedUnionError) => {
if (
error.issues.find(
(issue) => issue.code === "invalid_union_discriminator"
)
) {
return { __typename: undefined }
}
throw new Error(error.message)
})
}
export function discriminatedUnionArray<T extends Option>(options: T[]) {
return z
.array(discriminatedUnion(options))
.transform((blocks) =>
blocks.filter((block) => !!block)
) as unknown as z.ZodEffects<z.ZodArray<T>>
}

View File

@@ -1,47 +1,53 @@
#import "../System.graphql"
#import "../PageLink/AccountPageLink.graphql"
#import "../PageLink/ContentPageLink.graphql"
#import "../PageLink/LoyaltyPageLink.graphql"
fragment CardBlock on Card {
is_content_card
heading
body_text
background_image
scripted_top_title
title
body_text
has_primary_button
has_secondary_button
has_sidepeek_button
heading
is_content_card
scripted_top_title
title
primary_button {
is_contentstack_link
cta_text
is_contentstack_link
open_in_new_tab
external_link {
title
href
title
}
linkConnection {
edges {
node {
__typename
...LoyaltyPageLink
...ContentPageLink
...AccountPageLink
...ContentPageLink
...LoyaltyPageLink
}
}
}
}
secondary_button {
is_contentstack_link
cta_text
is_contentstack_link
open_in_new_tab
external_link {
title
href
title
}
linkConnection {
edges {
node {
__typename
...LoyaltyPageLink
...ContentPageLink
...AccountPageLink
...ContentPageLink
...LoyaltyPageLink
}
}
}
@@ -50,7 +56,6 @@ fragment CardBlock on Card {
call_to_action_text
}
system {
locale
uid
...System
}
}

View File

@@ -0,0 +1,68 @@
#import "./Card.graphql"
#import "./LoyaltyCard.graphql"
#import "./Refs/Card.graphql"
#import "./Refs/LoyaltyCard.graphql"
fragment CardsGrid_ContentPage on ContentPageBlocksCardsGrid {
cards_grid {
layout
preamble
theme
title
cardConnection(limit: 10) {
edges {
node {
__typename
...CardBlock
...LoyaltyCardBlock
}
}
}
}
}
fragment CardsGrid_ContentPageRefs on ContentPageBlocksCardsGrid {
cards_grid {
cardConnection(limit: 10) {
edges {
node {
__typename
...CardBlockRef
...LoyaltyCardBlockRef
}
}
}
}
}
fragment CardsGrid_LoyaltyPage on LoyaltyPageBlocksCardsGrid {
cards_grid {
layout
preamble
theme
title
cardConnection(limit: 10) {
edges {
node {
__typename
...CardBlock
...LoyaltyCardBlock
}
}
}
}
}
fragment CardsGrid_LoyaltyPageRefs on LoyaltyPageBlocksCardsGrid {
cards_grid {
cardConnection(limit: 10) {
edges {
node {
__typename
...CardBlockRef
...LoyaltyCardBlockRef
}
}
}
}
}

View File

@@ -0,0 +1,87 @@
#import "../Image.graphql"
#import "../ImageContainer.graphql"
#import "../AccountPage/Ref.graphql"
#import "../ContentPage/Ref.graphql"
#import "../HotelPage/Ref.graphql"
#import "../LoyaltyPage/Ref.graphql"
#import "../PageLink/AccountPageLink.graphql"
#import "../PageLink/ContentPageLink.graphql"
#import "../PageLink/HotelPageLink.graphql"
#import "../PageLink/LoyaltyPageLink.graphql"
fragment Content_ContentPage on ContentPageBlocksContent {
content {
content {
embedded_itemsConnection {
edges {
node {
__typename
...AccountPageLink
...ContentPageLink
...HotelPageLink
...LoyaltyPageLink
}
}
}
json
}
}
}
fragment Content_ContentPageRefs on ContentPageBlocksContent {
content {
content {
embedded_itemsConnection {
edges {
node {
__typename
...AccountPageRef
...ContentPageRef
...HotelPageRef
...LoyaltyPageRef
}
}
}
}
}
}
fragment Content_LoyaltyPage on LoyaltyPageBlocksContent {
content {
content {
json
embedded_itemsConnection {
edges {
node {
__typename
...AccountPageLink
...ContentPageLink
...Image
...ImageContainer
...LoyaltyPageLink
}
}
}
}
}
}
fragment Content_LoyaltyPageRefs on LoyaltyPageBlocksContent {
content {
content {
embedded_itemsConnection {
edges {
node {
__typename
...AccountPageRef
...ContentPageRef
...ImageContainerRef
...LoyaltyPageRef
}
}
}
}
}
}

View File

@@ -0,0 +1,119 @@
#import "../AccountPage/Ref.graphql"
#import "../ContentPage/Ref.graphql"
#import "../HotelPage/Ref.graphql"
#import "../LoyaltyPage/Ref.graphql"
#import "../PageLink/AccountPageLink.graphql"
#import "../PageLink/ContentPageLink.graphql"
#import "../PageLink/HotelPageLink.graphql"
#import "../PageLink/LoyaltyPageLink.graphql"
fragment DynamicContent_AccountPage on AccountPageContentDynamicContent {
dynamic_content {
component
subtitle: preamble
title
link {
text: link_text
linkConnection {
edges {
node {
__typename
...AccountPageLink
...LoyaltyPageLink
}
}
}
}
}
}
fragment DynamicContent_AccountPageRefs on AccountPageContentDynamicContent {
dynamic_content {
link {
linkConnection {
edges {
node {
__typename
...AccountPageRef
...LoyaltyPageRef
}
}
}
}
}
}
fragment DynamicContent_ContentPage on ContentPageBlocksDynamicContent {
dynamic_content {
component
subtitle
title
link {
text
linkConnection: pageConnection {
edges {
node {
__typename
...ContentPageLink
...HotelPageLink
...LoyaltyPageLink
}
}
}
}
}
}
fragment DynamicContent_ContentPageRefs on ContentPageBlocksDynamicContent {
dynamic_content {
link {
linkConnection: pageConnection {
edges {
node {
__typename
...ContentPageRef
...HotelPageRef
...LoyaltyPageRef
}
}
}
}
}
}
fragment DynamicContent_LoyaltyPage on LoyaltyPageBlocksDynamicContent {
dynamic_content {
component
subtitle
title
link {
text
linkConnection: pageConnection {
edges {
node {
__typename
...ContentPageLink
...LoyaltyPageLink
}
}
}
}
}
}
fragment DynamicContent_LoyaltyPageRefs on LoyaltyPageBlocksDynamicContent {
dynamic_content {
link {
linkConnection: pageConnection {
edges {
node {
__typename
...ContentPageLink
...LoyaltyPageLink
}
}
}
}
}
}

View File

@@ -1,6 +1,8 @@
#import "../System.graphql"
fragment LoyaltyCardBlock on LoyaltyCard {
heading
body_text
heading
image
title
link {
@@ -22,7 +24,6 @@ fragment LoyaltyCardBlock on LoyaltyCard {
}
}
system {
locale
uid
...System
}
}

View File

@@ -1,5 +1,4 @@
fragment CardBlockRef on Card {
__typename
secondary_button {
linkConnection {
edges {

View File

@@ -1,5 +1,4 @@
fragment LoyaltyCardBlockRef on LoyaltyCard {
__typename
link {
linkConnection {
edges {

View File

@@ -0,0 +1,77 @@
#import "../AccountPage/Ref.graphql"
#import "../ContentPage/Ref.graphql"
#import "../LoyaltyPage/Ref.graphql"
#import "../PageLink/AccountPageLink.graphql"
#import "../PageLink/ContentPageLink.graphql"
#import "../PageLink/LoyaltyPageLink.graphql"
fragment Shortcuts on Shortcuts {
subtitle: preamble
title
shortcuts {
open_in_new_tab
text
linkConnection {
edges {
node {
__typename
...AccountPageLink
...ContentPageLink
...LoyaltyPageLink
}
}
}
}
}
fragment Shortcuts_AccountPage on AccountPageContentShortcuts {
shortcuts {
...Shortcuts
}
}
fragment Shortcuts_ContentPage on ContentPageBlocksShortcuts {
shortcuts {
...Shortcuts
}
}
fragment Shortcuts_LoyaltyPage on LoyaltyPageBlocksShortcuts {
shortcuts {
...Shortcuts
}
}
fragment ShortcutsRefs on Shortcuts {
shortcuts {
linkConnection {
edges {
node {
__typename
...AccountPageRef
...ContentPageRef
...LoyaltyPageRef
}
}
}
}
}
fragment Shortcuts_AccountPageRefs on AccountPageContentShortcuts {
shortcuts {
...ShortcutsRefs
}
}
fragment Shortcuts_ContentPageRefs on ContentPageBlocksShortcuts {
shortcuts {
...ShortcutsRefs
}
}
fragment Shortcuts_LoyaltyPageRefs on LoyaltyPageBlocksShortcuts {
shortcuts {
...ShortcutsRefs
}
}

View File

@@ -0,0 +1,49 @@
#import "../ContentPage/Ref.graphql"
#import "../HotelPage/Ref.graphql"
#import "../LoyaltyPage/Ref.graphql"
#import "../PageLink/ContentPageLink.graphql"
#import "../PageLink/HotelPageLink.graphql"
#import "../PageLink/LoyaltyPageLink.graphql"
fragment TextCols_ContentPage on ContentPageBlocksTextCols {
text_cols {
columns {
title
text {
json
embedded_itemsConnection {
edges {
node {
__typename
...ContentPageLink
...HotelPageLink
...LoyaltyPageLink
}
}
}
}
}
}
}
fragment TextCols_ContentPageRef on ContentPageBlocksTextCols {
text_cols {
columns {
title
text {
json
embedded_itemsConnection {
edges {
node {
__typename
...ContentPageRef
...HotelPageRef
...LoyaltyPageRef
}
}
}
}
}
}
}

View File

@@ -1,8 +1,9 @@
#import "../../Image.graphql"
#import "../Image.graphql"
fragment AccountPageContentTextContent on AccountPageContentTextContent {
fragment TextContent_AccountPage on AccountPageContentTextContent {
text_content {
content {
json
embedded_itemsConnection {
totalCount
edges {
@@ -12,7 +13,6 @@ fragment AccountPageContentTextContent on AccountPageContentTextContent {
}
}
}
json
}
}
}

View File

@@ -0,0 +1,24 @@
#import "../System.graphql"
fragment AccountPageBreadcrumb on AccountPage {
web {
breadcrumbs {
title
}
}
system {
...System
}
url
}
fragment AccountPageBreadcrumbRef on AccountPage {
web {
breadcrumbs {
title
}
}
system {
...System
}
}

View File

@@ -0,0 +1,31 @@
#import "./AccountPage.graphql"
#import "./ContentPage.graphql"
#import "./LoyaltyPage.graphql"
fragment Breadcrumbs on Breadcrumbs {
title
parentsConnection {
edges {
node {
__typename
...AccountPageBreadcrumb
...ContentPageBreadcrumb
...LoyaltyPageBreadcrumb
}
}
}
}
fragment BreadcrumbsRefs on Breadcrumbs {
title
parentsConnection {
edges {
node {
__typename
...AccountPageBreadcrumbRef
...ContentPageBreadcrumbRef
...LoyaltyPageBreadcrumbRef
}
}
}
}

View File

@@ -0,0 +1,24 @@
#import "../System.graphql"
fragment ContentPageBreadcrumb on ContentPage {
web {
breadcrumbs {
title
}
}
system {
...System
}
url
}
fragment ContentPageBreadcrumbRef on ContentPage {
web {
breadcrumbs {
title
}
}
system {
...System
}
}

View File

@@ -1,4 +1,4 @@
fragment Breadcrumbs on CurrentBlocksPage {
fragment CurrentBlocksPageBreadcrumbs on CurrentBlocksPage {
breadcrumbs {
parents {
href

View File

@@ -0,0 +1,24 @@
#import "../System.graphql"
fragment LoyaltyPageBreadcrumb on LoyaltyPage {
web {
breadcrumbs {
title
}
}
system {
...System
}
url
}
fragment LoyaltyPageBreadcrumbRef on LoyaltyPage {
web {
breadcrumbs {
title
}
}
system {
...System
}
}

View File

@@ -1,37 +0,0 @@
fragment ContentPageBreadcrumbs on ContentPage {
web {
breadcrumbs {
title
parentsConnection {
edges {
node {
... on ContentPage {
web {
breadcrumbs {
title
}
}
system {
locale
uid
}
url
}
... on LoyaltyPage {
web {
breadcrumbs {
title
}
}
system {
locale
uid
}
url
}
}
}
}
}
}
}

View File

@@ -1,6 +1,6 @@
#import "../Image.graphql"
fragment AppDownloads on CurrentFooter {
fragment CurrentFooterAppDownloads on CurrentFooter {
app_downloads {
title
app_store {

View File

@@ -1,4 +1,4 @@
fragment SocialMedia on CurrentFooter {
fragment CurrentFooterSocialMedia on CurrentFooter {
social_media {
title
facebook {

View File

@@ -0,0 +1,16 @@
#import "./System.graphql"
fragment ImageContainer on ImageContainer {
image_left
image_right
title
system {
...System
}
}
fragment ImageContainerRef on ImageContainer {
system {
...System
}
}

View File

@@ -1,37 +0,0 @@
fragment LoyaltyPageBreadcrumbs on LoyaltyPage {
web {
breadcrumbs {
title
parentsConnection {
edges {
node {
... on AccountPage {
web {
breadcrumbs {
title
}
}
system {
locale
uid
}
url
}
... on LoyaltyPage {
web {
breadcrumbs {
title
}
}
system {
locale
uid
}
url
}
}
}
}
}
}
}

View File

@@ -1,22 +0,0 @@
#import "../../PageLink/AccountPageLink.graphql"
#import "../../PageLink/LoyaltyPageLink.graphql"
fragment AccountPageContentDynamicContent on AccountPageContentDynamicContent {
dynamic_content {
component
title
preamble
link {
link_text
linkConnection {
totalCount
edges {
node {
...LoyaltyPageLink
...AccountPageLink
}
}
}
}
}
}

View File

@@ -1,25 +0,0 @@
#import "../../PageLink/AccountPageLink.graphql"
#import "../../PageLink/ContentPageLink.graphql"
#import "../../PageLink/LoyaltyPageLink.graphql"
fragment AccountPageContentShortcuts on AccountPageContentShortcuts {
shortcuts {
title
preamble
shortcuts {
text
open_in_new_tab
linkConnection {
edges {
node {
__typename
...AccountPageLink
...LoyaltyPageLink
...ContentPageLink
}
}
totalCount
}
}
}
}

View File

@@ -1,25 +0,0 @@
fragment MyPagesBreadcrumbs on AccountPage {
web {
breadcrumbs {
title
parentsConnection {
edges {
node {
... on AccountPage {
web {
breadcrumbs {
title
}
}
system {
locale
uid
}
url
}
}
}
}
}
}
}

View File

@@ -1,7 +1,8 @@
#import "../System.graphql"
fragment AccountPageLink on AccountPage {
system {
locale
uid
...System
}
title
url

View File

@@ -1,10 +1,11 @@
#import "../System.graphql"
fragment ContentPageLink on ContentPage {
system {
locale
uid
}
title
url
system {
...System
}
web {
original_url
}

View File

@@ -1,8 +1,9 @@
#import "../System.graphql"
fragment CurrentBlocksPageLink on CurrentBlocksPage {
system {
locale
uid
}
title
url
system {
...System
}
}

View File

@@ -1,8 +1,9 @@
#import "../System.graphql"
fragment CurrentBlocksPageLink on CurrentBlocksPage {
system {
locale
uid
}
title
url
system {
...System
}
}

View File

@@ -1,7 +1,8 @@
#import "../System.graphql"
fragment HotelPageLink on HotelPage {
system {
locale
uid
...System
}
title
url

View File

@@ -1,10 +1,11 @@
#import "../System.graphql"
fragment LoyaltyPageLink on LoyaltyPage {
system {
locale
uid
}
title
url
system {
...System
}
web {
original_url
}

View File

@@ -1,38 +0,0 @@
#import "../System.graphql"
fragment ContentPageBreadcrumbsRefs on ContentPage {
web {
breadcrumbs {
title
parentsConnection {
edges {
node {
... on ContentPage {
web {
breadcrumbs {
title
}
}
system {
...System
}
}
... on LoyaltyPage {
web {
breadcrumbs {
title
}
}
system {
...System
}
}
}
}
}
}
}
system {
...System
}
}

View File

@@ -1,38 +0,0 @@
#import "../System.graphql"
fragment LoyaltyPageBreadcrumbsRefs on LoyaltyPage {
web {
breadcrumbs {
title
parentsConnection {
edges {
node {
... on AccountPage {
web {
breadcrumbs {
title
}
}
system {
...System
}
}
... on LoyaltyPage {
web {
breadcrumbs {
title
}
}
system {
...System
}
}
}
}
}
}
}
system {
...System
}
}

View File

@@ -1,28 +0,0 @@
#import "../System.graphql"
fragment MyPagesBreadcrumbsRefs on AccountPage {
web {
breadcrumbs {
title
parentsConnection {
edges {
node {
... on AccountPage {
web {
breadcrumbs {
title
}
}
system {
...System
}
}
}
}
}
}
}
system {
...System
}
}

View File

@@ -0,0 +1,80 @@
#import "../Image.graphql"
#import "../ImageContainer.graphql"
#import "../ContentPage/Ref.graphql"
#import "../LoyaltyPage/Ref.graphql"
#import "../PageLink/ContentPageLink.graphql"
#import "../PageLink/LoyaltyPageLink.graphql"
fragment ContentSidebar_ContentPage on ContentPageSidebarContent {
content {
content {
json
embedded_itemsConnection {
edges {
node {
__typename
...ContentPageLink
...Image
...ImageContainer
...LoyaltyPageLink
}
}
}
}
}
}
fragment ContentSidebar_ContentPageRefs on ContentPageSidebarContent {
content {
content {
embedded_itemsConnection {
edges {
node {
__typename
...ContentPageRef
...ImageContainerRef
...LoyaltyPageRef
}
}
}
}
}
}
fragment ContentSidebar_LoyaltyPage on LoyaltyPageSidebarContent {
content {
content {
json
embedded_itemsConnection {
edges {
node {
__typename
...ContentPageLink
...Image
...ImageContainer
...LoyaltyPageLink
}
}
}
}
}
}
fragment ContentSidebar_LoyaltyPageRefs on LoyaltyPageSidebarContent {
content {
content {
embedded_itemsConnection {
edges {
node {
__typename
...ContentPageRef
...ImageContainerRef
...LoyaltyPageRef
}
}
}
}
}
}

View File

@@ -0,0 +1,11 @@
fragment DynamicContentSidebar_ContentPage on ContentPageSidebarDynamicContent {
dynamic_content {
component
}
}
fragment DynamicContentSidebar_LoyaltyPage on LoyaltyPageSidebarDynamicContent {
dynamic_content {
component
}
}

View File

@@ -0,0 +1,113 @@
#import "../AccountPage/Ref.graphql"
#import "../ContentPage/Ref.graphql"
#import "../LoyaltyPage/Ref.graphql"
#import "../PageLink/AccountPageLink.graphql"
#import "../PageLink/ContentPageLink.graphql"
#import "../PageLink/LoyaltyPageLink.graphql"
fragment ContactFields on ContactFields {
display_text
contact_field
footnote
}
fragment JoinLoyaltyContactSidebar_ContentPage on ContentPageSidebarJoinLoyaltyContact {
join_loyalty_contact {
preamble
title
button {
cta_text
open_in_new_tab
external_link {
href
title
}
linkConnection {
edges {
node {
__typename
...AccountPageLink
...ContentPageLink
...LoyaltyPageLink
}
}
}
}
contact {
__typename
... on ContentPageSidebarJoinLoyaltyContactBlockContactContact {
contact {
...ContactFields
}
}
}
}
}
fragment JoinLoyaltyContactSidebar_ContentPageRefs on ContentPageSidebarJoinLoyaltyContact {
join_loyalty_contact {
button {
linkConnection {
edges {
node {
__typename
...AccountPageRef
...ContentPageRef
...LoyaltyPageRef
}
}
}
}
}
}
fragment JoinLoyaltyContactSidebar_LoyaltyPage on LoyaltyPageSidebarJoinLoyaltyContact {
join_loyalty_contact {
preamble
title
button {
cta_text
open_in_new_tab
external_link {
href
title
}
linkConnection {
edges {
node {
__typename
...AccountPageLink
...ContentPageLink
...LoyaltyPageLink
}
}
}
}
contact {
__typename
... on LoyaltyPageSidebarJoinLoyaltyContactBlockContactContact {
contact {
...ContactFields
}
}
}
}
}
fragment JoinLoyaltyContactSidebar_LoyaltyPageRefs on LoyaltyPageSidebarJoinLoyaltyContact {
join_loyalty_contact {
button {
linkConnection {
edges {
node {
__typename
...AccountPageRef
...ContentPageRef
...LoyaltyPageRef
}
}
}
}
}
}

View File

@@ -1,4 +1,5 @@
fragment System on EntrySystemField {
content_type_uid
locale
uid
}

View File

@@ -1,107 +0,0 @@
#import "../Fragments/MyPages/AccountPage/AccountPageContentDynamicContent.graphql"
#import "../Fragments/MyPages/AccountPage/AccountPageContentShortcuts.graphql"
#import "../Fragments/MyPages/AccountPage/AccountPageContentTextContent.graphql"
#import "../Fragments/Refs/MyPages/AccountPage.graphql"
#import "../Fragments/Refs/ContentPage/ContentPage.graphql"
#import "../Fragments/Refs/LoyaltyPage/LoyaltyPage.graphql"
#import "../Fragments/Refs/System.graphql"
query GetAccountPage($locale: String!, $uid: String!) {
account_page(locale: $locale, uid: $uid) {
heading
url
title
content {
__typename
...AccountPageContentDynamicContent
...AccountPageContentShortcuts
...AccountPageContentTextContent
}
system {
uid
created_at
updated_at
locale
}
}
}
query GetAccountPageRefs($locale: String!, $uid: String!) {
account_page(locale: $locale, uid: $uid) {
content {
... on AccountPageContentDynamicContent {
__typename
dynamic_content {
link {
linkConnection {
edges {
node {
__typename
...AccountPageRef
...LoyaltyPageRef
}
}
}
}
}
}
... on AccountPageContentShortcuts {
__typename
shortcuts {
shortcuts {
linkConnection {
edges {
node {
__typename
...AccountPageRef
...ContentPageRef
...LoyaltyPageRef
}
}
}
}
}
}
}
system {
...System
}
}
}
query GetDaDeEnUrlsAccountPage($uid: String!) {
de: all_account_page(where: { uid: $uid }, locale: "de") {
items {
url
}
}
en: all_account_page(where: { uid: $uid }, locale: "en") {
items {
url
}
}
da: all_account_page(where: { uid: $uid }, locale: "da") {
items {
url
}
}
}
query GetFiNoSvUrlsAccountPage($uid: String!) {
fi: all_account_page(where: { uid: $uid }, locale: "fi") {
items {
url
}
}
no: all_account_page(where: { uid: $uid }, locale: "no") {
items {
url
}
}
sv: all_account_page(where: { uid: $uid }, locale: "sv") {
items {
url
}
}
}

View File

@@ -0,0 +1,61 @@
#import "../../Fragments/System.graphql"
#import "../../Fragments/Blocks/DynamicContent.graphql"
#import "../../Fragments/Blocks/Shortcuts.graphql"
#import "../../Fragments/Blocks/TextContent.graphql"
query GetAccountPage($locale: String!, $uid: String!) {
account_page(locale: $locale, uid: $uid) {
heading
title
url
content {
__typename
...DynamicContent_AccountPage
...Shortcuts_AccountPage
...TextContent_AccountPage
}
system {
...System
created_at
updated_at
}
}
}
query GetAccountPageRefs($locale: String!, $uid: String!) {
account_page(locale: $locale, uid: $uid) {
content {
__typename
...DynamicContent_AccountPageRefs
...Shortcuts_AccountPageRefs
}
system {
...System
}
}
}
query GetDaDeEnUrlsAccountPage($uid: String!) {
de: account_page(locale: "de", uid: $uid) {
url
}
en: account_page(locale: "en", uid: $uid) {
url
}
da: account_page(locale: "da", uid: $uid) {
url
}
}
query GetFiNoSvUrlsAccountPage($uid: String!) {
fi: account_page(locale: "fi", uid: $uid) {
url
}
no: account_page(locale: "no", uid: $uid) {
url
}
sv: account_page(locale: "sv", uid: $uid) {
url
}
}

View File

@@ -1,9 +1,10 @@
#import "../Fragments/Image.graphql"
#import "../../Fragments/Image.graphql"
#import "../../Fragments/System.graphql"
query GetMyPagesMetaData($locale: String!, $uid: String!) {
account_page(locale: $locale, uid: $uid) {
system {
uid
...System
}
web {
breadcrumbs {

View File

@@ -1,10 +1,10 @@
#import "../Fragments/PageLink/AccountPageLink.graphql"
#import "../Fragments/PageLink/ContentPageLink.graphql"
#import "../Fragments/PageLink/LoyaltyPageLink.graphql"
#import "../Fragments/Refs/MyPages/AccountPage.graphql"
#import "../Fragments/Refs/ContentPage/ContentPage.graphql"
#import "../Fragments/Refs/LoyaltyPage/LoyaltyPage.graphql"
#import "../Fragments/Refs/System.graphql"
#import "../../Fragments/PageLink/AccountPageLink.graphql"
#import "../../Fragments/PageLink/ContentPageLink.graphql"
#import "../../Fragments/PageLink/LoyaltyPageLink.graphql"
#import "../../Fragments/AccountPage/Ref.graphql"
#import "../../Fragments/ContentPage/Ref.graphql"
#import "../../Fragments/LoyaltyPage/Ref.graphql"
#import "../../Fragments/System.graphql"
query GetNavigationMyPages($locale: String!) {
all_navigation_my_pages(locale: $locale, limit: 1) {

View File

@@ -0,0 +1,28 @@
#import "../../Fragments/Breadcrumbs/Breadcrumbs.graphql"
#import "../../Fragments/System.graphql"
query GetMyPagesBreadcrumbs($locale: String!, $uid: String!) {
account_page(locale: $locale, uid: $uid) {
web {
breadcrumbs {
...Breadcrumbs
}
}
system {
...System
}
}
}
query GetMyPagesBreadcrumbsRefs($locale: String!, $uid: String!) {
account_page(locale: $locale, uid: $uid) {
web {
breadcrumbs {
...BreadcrumbsRefs
}
}
system {
...System
}
}
}

View File

@@ -0,0 +1,28 @@
#import "../../Fragments/Breadcrumbs/Breadcrumbs.graphql"
#import "../../Fragments/System.graphql"
query GetContentPageBreadcrumbs($locale: String!, $uid: String!) {
content_page(locale: $locale, uid: $uid) {
web {
breadcrumbs {
...Breadcrumbs
}
}
system {
...System
}
}
}
query GetContentPageBreadcrumbsRefs($locale: String!, $uid: String!) {
content_page(locale: $locale, uid: $uid) {
web {
breadcrumbs {
...BreadcrumbsRefs
}
}
system {
...System
}
}
}

View File

@@ -0,0 +1,28 @@
#import "../../Fragments/Breadcrumbs/Breadcrumbs.graphql"
#import "../../Fragments/System.graphql"
query GetLoyaltyPageBreadcrumbs($locale: String!, $uid: String!) {
loyalty_page(locale: $locale, uid: $uid) {
web {
breadcrumbs {
...Breadcrumbs
}
}
system {
...System
}
}
}
query GetLoyaltyPageBreadcrumbsRefs($locale: String!, $uid: String!) {
loyalty_page(locale: $locale, uid: $uid) {
web {
breadcrumbs {
...BreadcrumbsRefs
}
}
system {
...System
}
}
}

View File

@@ -1,21 +0,0 @@
#import "../Fragments/ContentPage/Breadcrumbs.graphql"
#import "../Fragments/Refs/ContentPage/Breadcrumbs.graphql"
query GetContentPageBreadcrumbs($locale: String!, $url: String!) {
all_content_page(locale: $locale, where: { url: $url }) {
items {
...ContentPageBreadcrumbs
system {
uid
}
}
}
}
query GetContentPageBreadcrumbsRefs($locale: String!, $url: String!) {
all_content_page(locale: $locale, where: { url: $url }) {
items {
...ContentPageBreadcrumbsRefs
}
}
}

View File

@@ -1,21 +0,0 @@
#import "../Fragments/LoyaltyPage/Breadcrumbs.graphql"
#import "../Fragments/Refs/LoyaltyPage/Breadcrumbs.graphql"
query GetLoyaltyPageBreadcrumbs($locale: String!, $url: String!) {
all_loyalty_page(locale: $locale, where: { url: $url }) {
items {
...LoyaltyPageBreadcrumbs
system {
uid
}
}
}
}
query GetLoyaltyPageBreadcrumbsRefs($locale: String!, $url: String!) {
all_loyalty_page(locale: $locale, where: { url: $url }) {
items {
...LoyaltyPageBreadcrumbsRefs
}
}
}

View File

@@ -1,21 +0,0 @@
#import "../Fragments/MyPages/Breadcrumbs.graphql"
#import "../Fragments/Refs/MyPages/Breadcrumbs.graphql"
query GetMyPagesBreadcrumbs($locale: String!, $url: String!) {
all_account_page(locale: $locale, where: { url: $url }) {
items {
...MyPagesBreadcrumbs
system {
uid
}
}
}
}
query GetMyPagesBreadcrumbsRefs($locale: String!, $url: String!) {
all_account_page(locale: $locale, where: { url: $url }) {
items {
...MyPagesBreadcrumbsRefs
}
}
}

View File

@@ -1,384 +0,0 @@
#import "../Fragments/Image.graphql"
#import "../Fragments/Blocks/Card.graphql"
#import "../Fragments/Blocks/LoyaltyCard.graphql"
#import "../Fragments/Blocks/Refs/Card.graphql"
#import "../Fragments/Blocks/Refs/LoyaltyCard.graphql"
#import "../Fragments/PageLink/AccountPageLink.graphql"
#import "../Fragments/PageLink/ContentPageLink.graphql"
#import "../Fragments/PageLink/HotelPageLink.graphql"
#import "../Fragments/PageLink/LoyaltyPageLink.graphql"
#import "../Fragments/Refs/MyPages/AccountPage.graphql"
#import "../Fragments/Refs/ContentPage/ContentPage.graphql"
#import "../Fragments/Refs/LoyaltyPage/LoyaltyPage.graphql"
#import "../Fragments/Refs/System.graphql"
query GetContentPage($locale: String!, $uid: String!) {
content_page(uid: $uid, locale: $locale) {
blocks {
... on ContentPageBlocksContent {
__typename
content {
content {
embedded_itemsConnection {
edges {
node {
__typename
...LoyaltyPageLink
...ContentPageLink
...AccountPageLink
...HotelPageLink
}
}
totalCount
}
json
}
}
}
... on ContentPageBlocksShortcuts {
__typename
shortcuts {
title
preamble
shortcuts {
open_in_new_tab
text
linkConnection {
totalCount
edges {
node {
...LoyaltyPageLink
...ContentPageLink
...AccountPageLink
}
}
}
}
}
}
... on ContentPageBlocksCardsGrid {
__typename
cards_grid {
title
preamble
layout
theme
cardConnection(limit: 10) {
edges {
node {
__typename
...CardBlock
...LoyaltyCardBlock
}
}
}
}
}
... on ContentPageBlocksDynamicContent {
__typename
dynamic_content {
title
subtitle
component
link {
text
pageConnection {
edges {
node {
...ContentPageLink
...LoyaltyPageLink
...HotelPageLink
}
}
totalCount
}
}
}
}
... on ContentPageBlocksTextCols {
__typename
text_cols {
columns {
title
text {
json
embedded_itemsConnection {
edges {
node {
__typename
...LoyaltyPageLink
...ContentPageLink
...HotelPageLink
}
}
totalCount
}
}
}
}
}
}
title
header {
heading
preamble
}
hero_image
sidebar {
__typename
... on ContentPageSidebarDynamicContent {
dynamic_content {
component
}
}
... on ContentPageSidebarJoinLoyaltyContact {
join_loyalty_contact {
title
preamble
button {
cta_text
external_link {
title
href
}
open_in_new_tab
linkConnection {
edges {
node {
__typename
...AccountPageLink
...ContentPageLink
...LoyaltyPageLink
}
}
}
}
contact {
... on ContentPageSidebarJoinLoyaltyContactBlockContactContact {
__typename
contact {
display_text
contact_field
footnote
}
}
}
}
}
... on ContentPageSidebarContent {
content {
content {
json
embedded_itemsConnection {
edges {
node {
__typename
...Image
...LoyaltyPageLink
...ContentPageLink
}
}
totalCount
}
}
}
}
}
system {
uid
created_at
updated_at
locale
}
}
}
query GetContentPageRefs($locale: String!, $uid: String!) {
content_page(locale: $locale, uid: $uid) {
blocks {
... on ContentPageBlocksContent {
__typename
content {
content {
embedded_itemsConnection {
edges {
node {
# No fragments used since we want to include __typename for each type to avoid fetching SystemAsset
... on ContentPage {
__typename
system {
...System
}
}
... on LoyaltyPage {
__typename
system {
...System
}
}
... on AccountPage {
__typename
system {
...System
}
}
}
}
}
}
}
}
... on ContentPageBlocksShortcuts {
__typename
shortcuts {
shortcuts {
linkConnection {
edges {
node {
__typename
...AccountPageRef
...ContentPageRef
...LoyaltyPageRef
}
}
}
}
}
}
... on ContentPageBlocksCardsGrid {
__typename
cards_grid {
cardConnection(limit: 10) {
edges {
node {
...CardBlockRef
...LoyaltyCardBlockRef
}
}
}
}
}
... on ContentPageBlocksDynamicContent {
__typename
dynamic_content {
link {
pageConnection {
edges {
node {
__typename
...ContentPageRef
...LoyaltyPageRef
}
}
}
}
}
}
}
sidebar {
... on ContentPageSidebarContent {
__typename
content {
content {
embedded_itemsConnection {
edges {
node {
# No fragments used since we want to include __typename for each type to avoid fetching SystemAsset
... on ContentPage {
__typename
system {
...System
}
}
... on LoyaltyPage {
__typename
system {
...System
}
}
}
}
}
}
}
}
... on ContentPageSidebarJoinLoyaltyContact {
__typename
join_loyalty_contact {
button {
linkConnection {
edges {
node {
__typename
...AccountPageRef
...ContentPageRef
...LoyaltyPageRef
}
}
}
}
}
}
}
system {
...System
}
}
}
query GetDaDeEnUrlsContentPage($uid: String!) {
de: all_content_page(where: { uid: $uid }, locale: "de") {
items {
web {
original_url
}
url
}
}
en: all_content_page(where: { uid: $uid }, locale: "en") {
items {
web {
original_url
}
url
}
}
da: all_content_page(where: { uid: $uid }, locale: "da") {
items {
web {
original_url
}
url
}
}
}
query GetFiNoSvUrlsContentPage($uid: String!) {
fi: all_content_page(where: { uid: $uid }, locale: "fi") {
items {
web {
original_url
}
url
}
}
no: all_content_page(where: { uid: $uid }, locale: "no") {
items {
web {
original_url
}
url
}
}
sv: all_content_page(where: { uid: $uid }, locale: "sv") {
items {
web {
original_url
}
url
}
}
}

View File

@@ -0,0 +1,86 @@
#import "../../Fragments/System.graphql"
#import "../../Fragments/Blocks/CardsGrid.graphql"
#import "../../Fragments/Blocks/Content.graphql"
#import "../../Fragments/Blocks/DynamicContent.graphql"
#import "../../Fragments/Blocks/Shortcuts.graphql"
#import "../../Fragments/Blocks/TextCols.graphql"
#import "../../Fragments/Sidebar/Content.graphql"
#import "../../Fragments/Sidebar/DynamicContent.graphql"
#import "../../Fragments/Sidebar/JoinLoyaltyContact.graphql"
query GetContentPage($locale: String!, $uid: String!) {
content_page(uid: $uid, locale: $locale) {
hero_image
title
header {
heading
preamble
}
blocks {
__typename
...CardsGrid_ContentPage
...Content_ContentPage
...DynamicContent_ContentPage
...Shortcuts_ContentPage
...TextCols_ContentPage
}
sidebar {
__typename
...ContentSidebar_ContentPage
...DynamicContentSidebar_ContentPage
...JoinLoyaltyContactSidebar_ContentPage
}
system {
...System
created_at
updated_at
}
}
}
query GetContentPageRefs($locale: String!, $uid: String!) {
content_page(locale: $locale, uid: $uid) {
blocks {
__typename
...CardsGrid_ContentPageRefs
...Content_ContentPageRefs
...DynamicContent_ContentPageRefs
...Shortcuts_ContentPageRefs
...TextCols_ContentPageRef
}
sidebar {
__typename
...ContentSidebar_ContentPageRefs
...JoinLoyaltyContactSidebar_ContentPageRefs
}
system {
...System
}
}
}
query GetDaDeEnUrlsContentPage($uid: String!) {
de: content_page(locale: "de", uid: $uid) {
url
}
en: content_page(locale: "en", uid: $uid) {
url
}
da: content_page(locale: "da", uid: $uid) {
url
}
}
query GetFiNoSvUrlsContentPage($uid: String!) {
fi: content_page(locale: "fi", uid: $uid) {
url
}
no: content_page(locale: "no", uid: $uid) {
url
}
sv: content_page(locale: "sv", uid: $uid) {
url
}
}

View File

@@ -1,11 +1,11 @@
#import "../Fragments/Aside/Contact.graphql"
#import "../Fragments/Aside/Puff.graphql"
#import "../Fragments/Blocks/List.graphql"
#import "../Fragments/Blocks/Puff.graphql"
#import "../Fragments/Blocks/Text.graphql"
#import "../Fragments/Breadcrumbs.graphql"
#import "../Fragments/Hero.graphql"
#import "../Fragments/Preamble.graphql"
#import "../../Fragments/Aside/Contact.graphql"
#import "../../Fragments/Aside/Puff.graphql"
#import "../../Fragments/Blocks/List.graphql"
#import "../../Fragments/Blocks/Puff.graphql"
#import "../../Fragments/Blocks/Text.graphql"
#import "../../Fragments/Breadcrumbs/CurrentBlocksPage.graphql"
#import "../../Fragments/Hero.graphql"
#import "../../Fragments/Preamble.graphql"
query GetCurrentBlockPage($locale: String!, $url: String!) {
all_current_blocks_page(limit: 1, locale: $locale, where: { url: $url }) {
@@ -21,7 +21,7 @@ query GetCurrentBlockPage($locale: String!, $url: String!) {
...PuffBlock
...TextBlock
}
...Breadcrumbs
...CurrentBlocksPageBreadcrumbs
hero {
...Hero
}

View File

@@ -0,0 +1,36 @@
#import "../../Fragments/CurrentFooter/AppDownloads.graphql"
#import "../../Fragments/CurrentFooter/Logo.graphql"
#import "../../Fragments/CurrentFooter/Navigation.graphql"
#import "../../Fragments/CurrentFooter/SocialMedia.graphql"
#import "../../Fragments/CurrentFooter/TripAdvisor.graphql"
#import "../../Fragments/System.graphql"
query GetCurrentFooter($locale: String!) {
all_current_footer(limit: 1, locale: $locale) {
items {
...CurrentFooterAppDownloads
...CurrentFooterSocialMedia
...Logo
...Navigation
...TripAdvisor
title
about {
text
title
}
system {
...System
}
}
}
}
query GetCurrentFooterRef($locale: String!) {
all_current_footer(limit: 1, locale: $locale) {
items {
system {
...System
}
}
}
}

View File

@@ -1,5 +1,5 @@
#import "../Fragments/Image.graphql"
#import "../Fragments/Refs/System.graphql"
#import "../../Fragments/Image.graphql"
#import "../../Fragments/System.graphql"
query GetCurrentHeader($locale: String!) {
all_current_header(limit: 1, locale: $locale) {

View File

@@ -1,37 +0,0 @@
#import "../Fragments/CurrentFooter/AppDownloads.graphql"
#import "../Fragments/CurrentFooter/Logo.graphql"
#import "../Fragments/CurrentFooter/Navigation.graphql"
#import "../Fragments/CurrentFooter/SocialMedia.graphql"
#import "../Fragments/CurrentFooter/TripAdvisor.graphql"
#import "../Fragments/Refs/System.graphql"
query GetCurrentFooter($locale: String!) {
all_current_footer(limit: 1, locale: $locale) {
items {
title
system {
locale
uid
}
about {
text
title
}
...AppDownloads
...Logo
...Navigation
...SocialMedia
...TripAdvisor
}
}
}
query GetCurrentFooterRef($locale: String!) {
all_current_footer(limit: 1, locale: $locale) {
items {
system {
...System
}
}
}
}

View File

@@ -1,14 +1,14 @@
#import "../Fragments/Refs/System.graphql"
#import "../Fragments/System.graphql"
#import "../Fragments/PageLink/AccountPageLink.graphql"
#import "../Fragments/PageLink/ContentPageLink.graphql"
#import "../Fragments/PageLink/HotelPageLink.graphql"
#import "../Fragments/PageLink/LoyaltyPageLink.graphql"
#import "../Fragments/Refs/ContentPage/ContentPage.graphql"
#import "../Fragments/Refs/HotelPage/HotelPage.graphql"
#import "../Fragments/Refs/LoyaltyPage/LoyaltyPage.graphql"
#import "../Fragments/Refs/MyPages/AccountPage.graphql"
#import "../Fragments/AccountPage/Ref.graphql"
#import "../Fragments/ContentPage/Ref.graphql"
#import "../Fragments/HotelPage/Ref.graphql"
#import "../Fragments/LoyaltyPage/Ref.graphql"
#import "../Fragments/Footer/AppDownloads.graphql"
#import "../Fragments/Footer/SocialMedia.graphql"

View File

@@ -1,4 +1,4 @@
#import "../Fragments/Refs/System.graphql"
#import "../Fragments/System.graphql"
#import "../Fragments/PageLink/AccountPageLink.graphql"
#import "../Fragments/PageLink/ContentPageLink.graphql"
@@ -7,10 +7,10 @@
#import "../Fragments/Blocks/Card.graphql"
#import "../Fragments/Blocks/Refs/Card.graphql"
#import "../Fragments/Refs/ContentPage/ContentPage.graphql"
#import "../Fragments/Refs/HotelPage/HotelPage.graphql"
#import "../Fragments/Refs/LoyaltyPage/LoyaltyPage.graphql"
#import "../Fragments/Refs/MyPages/AccountPage.graphql"
#import "../Fragments/AccountPage/Ref.graphql"
#import "../Fragments/ContentPage/Ref.graphql"
#import "../Fragments/HotelPage/Ref.graphql"
#import "../Fragments/LoyaltyPage/Ref.graphql"
query GetHeader($locale: String!) {
all_header(limit: 1, locale: $locale) {

View File

@@ -1,8 +1,8 @@
query GetHotelPage($locale: String!, $uid: String!) {
hotel_page(locale: $locale, uid: $uid) {
hotel_page_id
url
title
url
content {
... on HotelPageContentUpcomingActivitiesCard {
__typename
@@ -35,37 +35,25 @@ query GetHotelPage($locale: String!, $uid: String!) {
}
query GetDaDeEnUrlsHotelPage($uid: String!) {
de: all_hotel_page(where: { uid: $uid }, locale: "de") {
items {
url
}
de: hotel_page(locale: "de", uid: $uid) {
url
}
en: all_hotel_page(where: { uid: $uid }, locale: "en") {
items {
url
}
en: hotel_page(locale: "en", uid: $uid) {
url
}
da: all_hotel_page(where: { uid: $uid }, locale: "da") {
items {
url
}
da: hotel_page(locale: "da", uid: $uid) {
url
}
}
query GetFiNoSvUrlsHotelPage($uid: String!) {
fi: all_hotel_page(where: { uid: $uid }, locale: "fi") {
items {
url
}
fi: hotel_page(locale: "fi", uid: $uid) {
url
}
no: all_hotel_page(where: { uid: $uid }, locale: "no") {
items {
url
}
no: hotel_page(locale: "no", uid: $uid) {
url
}
sv: all_hotel_page(where: { uid: $uid }, locale: "sv") {
items {
url
}
sv: hotel_page(locale: "sv", uid: $uid) {
url
}
}

View File

@@ -1,372 +0,0 @@
#import "../Fragments/Image.graphql"
#import "../Fragments/Blocks/Card.graphql"
#import "../Fragments/Blocks/LoyaltyCard.graphql"
#import "../Fragments/Blocks/Refs/Card.graphql"
#import "../Fragments/Blocks/Refs/LoyaltyCard.graphql"
#import "../Fragments/PageLink/AccountPageLink.graphql"
#import "../Fragments/PageLink/ContentPageLink.graphql"
#import "../Fragments/PageLink/LoyaltyPageLink.graphql"
#import "../Fragments/Refs/MyPages/AccountPage.graphql"
#import "../Fragments/Refs/ContentPage/ContentPage.graphql"
#import "../Fragments/Refs/LoyaltyPage/LoyaltyPage.graphql"
#import "../Fragments/Refs/System.graphql"
query GetLoyaltyPage($locale: String!, $uid: String!) {
loyalty_page(uid: $uid, locale: $locale) {
blocks {
... on LoyaltyPageBlocksShortcuts {
__typename
shortcuts {
title
preamble
shortcuts {
text
open_in_new_tab
linkConnection {
edges {
node {
...LoyaltyPageLink
...ContentPageLink
...AccountPageLink
}
}
totalCount
}
}
}
}
... on LoyaltyPageBlocksDynamicContent {
__typename
dynamic_content {
title
subtitle
component
link {
text
pageConnection {
edges {
node {
...ContentPageLink
...LoyaltyPageLink
}
}
totalCount
}
}
}
}
... on LoyaltyPageBlocksContent {
__typename
content {
content {
json
embedded_itemsConnection {
edges {
node {
__typename
...LoyaltyPageLink
...ContentPageLink
...AccountPageLink
...Image
... on ImageContainer {
title
image_left
image_right
system {
uid
}
}
}
}
totalCount
}
}
}
}
... on LoyaltyPageBlocksCardsGrid {
__typename
cards_grid {
title
preamble
layout
theme
cardConnection(limit: 10) {
edges {
node {
__typename
...CardBlock
...LoyaltyCardBlock
}
}
}
}
}
}
title
heading
preamble
hero_image
sidebar {
__typename
... on LoyaltyPageSidebarDynamicContent {
dynamic_content {
component
}
}
... on LoyaltyPageSidebarJoinLoyaltyContact {
join_loyalty_contact {
title
preamble
button {
cta_text
external_link {
title
href
}
open_in_new_tab
linkConnection {
edges {
node {
__typename
...AccountPageLink
...ContentPageLink
...LoyaltyPageLink
}
}
}
}
contact {
... on LoyaltyPageSidebarJoinLoyaltyContactBlockContactContact {
__typename
contact {
display_text
contact_field
footnote
}
}
}
}
}
... on LoyaltyPageSidebarContent {
content {
content {
json
embedded_itemsConnection {
edges {
node {
__typename
...Image
...LoyaltyPageLink
...ContentPageLink
}
}
totalCount
}
}
}
}
}
system {
uid
created_at
updated_at
locale
}
}
}
query GetLoyaltyPageRefs($locale: String!, $uid: String!) {
loyalty_page(locale: $locale, uid: $uid) {
blocks {
... on LoyaltyPageBlocksShortcuts {
__typename
shortcuts {
shortcuts {
linkConnection {
edges {
node {
__typename
...AccountPageRef
...ContentPageRef
...LoyaltyPageRef
}
}
}
}
}
}
... on LoyaltyPageBlocksDynamicContent {
__typename
dynamic_content {
link {
pageConnection {
edges {
node {
__typename
...ContentPageRef
...LoyaltyPageRef
}
}
}
}
}
}
... on LoyaltyPageBlocksContent {
__typename
content {
content {
embedded_itemsConnection {
edges {
node {
# No fragments used since we want to include __typename for each type to avoid fetching SystemAsset
... on ContentPage {
__typename
system {
...System
}
}
... on LoyaltyPage {
__typename
system {
...System
}
}
... on AccountPage {
__typename
system {
...System
}
}
... on ImageContainer {
__typename
system {
...System
}
}
}
}
}
}
}
}
... on LoyaltyPageBlocksCardsGrid {
__typename
cards_grid {
cardConnection(limit: 10) {
edges {
node {
...CardBlockRef
...LoyaltyCardBlockRef
}
}
}
}
}
}
sidebar {
... on LoyaltyPageSidebarContent {
__typename
content {
content {
embedded_itemsConnection {
edges {
node {
# No fragments used since we want to include __typename for each type to avoid fetching SystemAsset
... on ContentPage {
__typename
system {
...System
}
}
... on LoyaltyPage {
__typename
system {
...System
}
}
}
}
}
}
}
}
... on LoyaltyPageSidebarJoinLoyaltyContact {
__typename
join_loyalty_contact {
button {
linkConnection {
edges {
node {
__typename
...AccountPageRef
...ContentPageRef
...LoyaltyPageRef
}
}
}
}
}
}
}
system {
...System
}
}
}
query GetDaDeEnUrlsLoyaltyPage($uid: String!) {
de: all_loyalty_page(where: { uid: $uid }, locale: "de") {
items {
web {
original_url
}
url
}
}
en: all_loyalty_page(where: { uid: $uid }, locale: "en") {
items {
web {
original_url
}
url
}
}
da: all_loyalty_page(where: { uid: $uid }, locale: "da") {
items {
web {
original_url
}
url
}
}
}
query GetFiNoSvUrlsLoyaltyPage($uid: String!) {
sv: all_loyalty_page(where: { uid: $uid }, locale: "sv") {
items {
web {
original_url
}
url
}
}
no: all_loyalty_page(where: { uid: $uid }, locale: "no") {
items {
web {
original_url
}
url
}
}
fi: all_loyalty_page(where: { uid: $uid }, locale: "fi") {
items {
web {
original_url
}
url
}
}
}

View File

@@ -0,0 +1,99 @@
#import "../../Fragments/System.graphql"
#import "../../Fragments/Blocks/CardsGrid.graphql"
#import "../../Fragments/Blocks/Content.graphql"
#import "../../Fragments/Blocks/DynamicContent.graphql"
#import "../../Fragments/Blocks/Shortcuts.graphql"
#import "../../Fragments/Sidebar/Content.graphql"
#import "../../Fragments/Sidebar/DynamicContent.graphql"
#import "../../Fragments/Sidebar/JoinLoyaltyContact.graphql"
query GetLoyaltyPage($locale: String!, $uid: String!) {
loyalty_page(uid: $uid, locale: $locale) {
heading
hero_image
preamble
title
blocks {
__typename
...CardsGrid_LoyaltyPage
...Content_LoyaltyPage
...DynamicContent_LoyaltyPage
...Shortcuts_LoyaltyPage
}
sidebar {
__typename
...ContentSidebar_LoyaltyPage
...DynamicContentSidebar_LoyaltyPage
...JoinLoyaltyContactSidebar_LoyaltyPage
}
system {
...System
created_at
updated_at
}
}
}
query GetLoyaltyPageRefs($locale: String!, $uid: String!) {
loyalty_page(locale: $locale, uid: $uid) {
blocks {
__typename
...CardsGrid_LoyaltyPageRefs
...Content_LoyaltyPageRefs
...DynamicContent_LoyaltyPageRefs
...Shortcuts_LoyaltyPageRefs
}
sidebar {
__typename
...ContentSidebar_LoyaltyPageRefs
...JoinLoyaltyContactSidebar_LoyaltyPageRefs
}
system {
...System
}
}
}
query GetDaDeEnUrlsLoyaltyPage($uid: String!) {
de: loyalty_page(locale: "de", uid: $uid) {
web {
original_url
}
url
}
en: loyalty_page(locale: "en", uid: $uid) {
web {
original_url
}
url
}
da: loyalty_page(locale: "da", uid: $uid) {
web {
original_url
}
url
}
}
query GetFiNoSvUrlsLoyaltyPage($uid: String!) {
sv: loyalty_page(locale: "sv", uid: $uid) {
web {
original_url
}
url
}
no: loyalty_page(locale: "no", uid: $uid) {
web {
original_url
}
url
}
fi: loyalty_page(locale: "fi", uid: $uid) {
web {
original_url
}
url
}
}

View File

@@ -1,9 +1,10 @@
#import "../Fragments/Image.graphql"
#import "../../Fragments/Image.graphql"
#import "../../Fragments/System.graphql"
query GetLoyaltyPageMetaData($locale: String!, $uid: String!) {
loyalty_page(locale: $locale, uid: $uid) {
system {
uid
...System
}
web {
seo_metadata {

View File

@@ -1,4 +1,4 @@
#import "../Fragments/Refs/System.graphql"
#import "../Fragments/System.graphql"
query ResolveEntryByUrl($locale: String!, $url: String!) {
all_account_page(where: { url: $url }, locale: $locale) {

View File

@@ -1,7 +1,8 @@
import "server-only"
import { GraphQLClient } from "graphql-request"
import { ClientError, GraphQLClient } from "graphql-request"
import { Lang } from "@/constants/languages"
import { env } from "@/env/server"
import type { DocumentNode } from "graphql"
@@ -74,8 +75,31 @@ export async function request<T>(
return { data: response }
} catch (error) {
console.error("Error in graphql request")
console.error(error)
if (error instanceof ClientError) {
if (error.response.errors?.length) {
const failedToFetchItem = error.response.errors.find(
(err) => err.message === "Failed to fetch item"
)
if (
failedToFetchItem &&
failedToFetchItem.extensions?.errors === "Object not found!" &&
failedToFetchItem.path?.find((p) => Lang[p as Lang])
) {
/**
* Because of Contentstacks totally obscure way of implementing
* GraphQL where they throw an error when you are querying for
* a single item that is nullable and doesn't exist. This leads
* to the issue where when we have a page that is missing a published
* version for one language, it throws an error which we have to recover
* from here since it isn't an error.
*/
return { data: error.response.data as T }
}
}
}
// console.error("Error in graphql request")
// console.error(error)
throw new Error("Something went wrong")
}
}

View File

@@ -14,7 +14,7 @@ const client = new GraphQLClient(env.CMS_URL, {
url: URL | RequestInfo,
params: RequestInit | undefined
) {
const wrappedFetch = fetchRetry(global.fetch, {
const wrappedFetch = fetchRetry(fetch, {
retries: 3,
retryDelay: function (attempt, error, response) {
return Math.pow(2, attempt) * 150 // 150, 300, 600

View File

@@ -0,0 +1,11 @@
import { cache } from "react"
import { serverClient } from "../server"
export const getLocations = cache(async function getMemoizedLocations() {
return serverClient().hotel.locations.get()
})
export const getProfile = cache(async function getMemoizedProfile() {
return serverClient().user.get()
})