Merge branch 'master' into feature/tracking

This commit is contained in:
Linus Flood
2024-11-25 10:14:12 +01:00
181 changed files with 3840 additions and 1723 deletions

View File

@@ -1,4 +1,5 @@
#import "./AccountPage.graphql"
#import "./CollectionPage.graphql"
#import "./ContentPage.graphql"
#import "./LoyaltyPage.graphql"
@@ -9,6 +10,7 @@ fragment Breadcrumbs on Breadcrumbs {
node {
__typename
...AccountPageBreadcrumb
...CollectionPageBreadcrumb
...ContentPageBreadcrumb
...LoyaltyPageBreadcrumb
}
@@ -23,6 +25,7 @@ fragment BreadcrumbsRefs on Breadcrumbs {
node {
__typename
...AccountPageBreadcrumbRef
...CollectionPageBreadcrumbRef
...ContentPageBreadcrumbRef
...LoyaltyPageBreadcrumbRef
}

View File

@@ -0,0 +1,24 @@
#import "../System.graphql"
fragment CollectionPageBreadcrumb on CollectionPage {
web {
breadcrumbs {
title
}
}
system {
...System
}
url
}
fragment CollectionPageBreadcrumbRef on CollectionPage {
web {
breadcrumbs {
title
}
}
system {
...System
}
}

View File

@@ -0,0 +1,6 @@
fragment Metadata on SeoMetadata {
noindex
description
title
seo_image
}

View File

@@ -1,26 +0,0 @@
#import "../../Fragments/Image.graphql"
#import "../../Fragments/System.graphql"
query GetMyPagesMetaData($locale: String!, $uid: String!) {
account_page(locale: $locale, uid: $uid) {
system {
...System
}
web {
breadcrumbs {
title
}
seo_metadata {
description
title
imageConnection {
edges {
node {
...Image
}
}
}
}
}
}
}

View File

@@ -0,0 +1,18 @@
#import "../../Fragments/Metadata.graphql"
#import "../../Fragments/System.graphql"
query GetAccountPageMetadata($locale: String!, $uid: String!) {
account_page(locale: $locale, uid: $uid) {
web {
breadcrumbs {
title
}
seo_metadata {
...Metadata
}
}
system {
...System
}
}
}

View File

@@ -0,0 +1,23 @@
#import "../../Fragments/Metadata.graphql"
#import "../../Fragments/System.graphql"
query GetCollectionPageMetadata($locale: String!, $uid: String!) {
collection_page(locale: $locale, uid: $uid) {
web {
breadcrumbs {
title
}
seo_metadata {
...Metadata
}
}
header {
heading
preamble
}
hero_image
system {
...System
}
}
}

View File

@@ -0,0 +1,32 @@
#import "../../Fragments/Metadata.graphql"
#import "../../Fragments/System.graphql"
query GetContentPageMetadata($locale: String!, $uid: String!) {
content_page(locale: $locale, uid: $uid) {
web {
breadcrumbs {
title
}
seo_metadata {
...Metadata
}
}
header {
heading
preamble
}
hero_image
blocks {
... on ContentPageBlocksContent {
content {
content {
json
}
}
}
}
system {
...System
}
}
}

View File

@@ -1,26 +0,0 @@
#import "../../Fragments/Image.graphql"
#import "../../Fragments/System.graphql"
query GetLoyaltyPageMetaData($locale: String!, $uid: String!) {
loyalty_page(locale: $locale, uid: $uid) {
system {
...System
}
web {
seo_metadata {
description
title
imageConnection {
edges {
node {
...Image
}
}
}
}
breadcrumbs {
title
}
}
}
}

View File

@@ -0,0 +1,31 @@
#import "../../Fragments/Metadata.graphql"
#import "../../Fragments/System.graphql"
query GetLoyaltyPageMetadata($locale: String!, $uid: String!) {
loyalty_page(locale: $locale, uid: $uid) {
web {
breadcrumbs {
title
}
seo_metadata {
...Metadata
}
}
heading
preamble
hero_image
blocks {
... on LoyaltyPageBlocksContent {
__typename
content {
content {
json
}
}
}
}
system {
...System
}
}
}

View File

@@ -2,30 +2,14 @@ import "server-only"
import deepmerge from "deepmerge"
import { arrayMerge } from "@/utils/merge"
import { request } from "./request"
import type { BatchRequestDocument } from "graphql-request"
import type { Data } from "@/types/request"
function arrayMerge(
target: any[],
source: any[],
options: deepmerge.ArrayMergeOptions | undefined
) {
const destination = target.slice()
source.forEach((item, index) => {
if (typeof destination[index] === "undefined") {
destination[index] = options?.cloneUnlessOtherwiseSpecified(item, options)
} else if (options?.isMergeableObject(item)) {
destination[index] = deepmerge(target[index], item, options)
} else if (target.indexOf(item) === -1) {
destination.push(item)
}
})
return destination
}
export async function batchRequest<T>(
queries: (BatchRequestDocument & { options?: RequestInit })[]
): Promise<Data<T>> {

View File

@@ -158,3 +158,9 @@ export const getBookingConfirmation = cache(
return serverClient().booking.confirmation({ confirmationNumber })
}
)
export const getCityCoordinates = cache(
async function getMemoizedCityCoordinates(input: { city: string }) {
return serverClient().hotel.map.city(input)
}
)