From 5fc93472f4c029c2901bf3a00d6d19c106c2e661 Mon Sep 17 00:00:00 2001 From: Linus Flood Date: Tue, 27 Jan 2026 12:38:36 +0000 Subject: [PATCH] Merged in feat/rework-contentstack (pull request #3493) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Feat(SW-3708): refactor contentstack fetching (removing all refs) and cache invalidation * Remove all REFS * Revalidate correct language * PR fixes * PR fixes * Throw when errors from contentstack api Approved-by: Joakim Jäderberg --- .vscode/settings.json | 8 +- apps/scandic-web/.env.local.example | 1 + .../app/api/web/revalidate/route.ts | 71 ++- apps/scandic-web/env/server.ts | 2 + .../lib/contentstack/fetchEntryReferences.ts | 86 +++ .../Fragments/AccountPage/Ref.graphql.ts | 12 - .../lib/graphql/Fragments/Alert.graphql.ts | 80 --- .../lib/graphql/Fragments/Banner.graphql.ts | 54 -- .../Fragments/Blocks/Accordion.graphql.ts | 508 ------------------ .../Fragments/Blocks/AllCampaigns.graphql.ts | 21 - .../Fragments/Blocks/CardGallery.graphql.ts | 64 +-- .../Fragments/Blocks/CardsGrid.graphql.ts | 123 ----- .../Fragments/Blocks/CarouselCards.graphql.ts | 95 +--- .../Fragments/Blocks/Content.graphql.ts | 264 +-------- .../Fragments/Blocks/ContentCard.graphql.ts | 55 -- .../Blocks/DynamicContent.graphql.ts | 172 ------ .../Blocks/FullWidthCampaign.graphql.ts | 70 --- .../Blocks/JoinScandicFriends.graphql.ts | 49 -- .../Fragments/Blocks/Jotform.graphql.ts | 18 +- .../Blocks/Refs/Accordion.graphql.ts | 94 ---- .../Fragments/Blocks/Refs/Card.graphql.ts | 78 --- .../Fragments/Blocks/Refs/InfoCard.graphql.ts | 76 --- .../Blocks/Refs/LoyaltyCard.graphql.ts | 57 -- .../Blocks/Refs/TeaserCard.graphql.ts | 141 ----- .../Fragments/Blocks/Shortcuts.graphql.ts | 86 --- .../Fragments/Blocks/TextCols.graphql.ts | 56 -- .../Fragments/Blocks/UspGrid.graphql.ts | 111 ---- .../graphql/Fragments/Blocks/Video.graphql.ts | 12 +- .../Fragments/Blocks/VideoCard.graphql.ts | 83 +-- .../Breadcrumbs/AccountPage.graphql.ts | 14 - .../Breadcrumbs/Breadcrumbs.graphql.ts | 83 +-- .../CampaignOverviewPage.graphql.ts | 14 - .../Breadcrumbs/CampaignPage.graphql.ts | 14 - .../Breadcrumbs/CollectionPage.graphql.ts | 14 - .../Breadcrumbs/ContentPage.graphql.ts | 14 - .../DestinationCityPage.graphql.ts | 14 - .../DestinationCountryPage.graphql.ts | 14 - .../DestinationOverviewPage.graphql.ts | 14 - .../Breadcrumbs/HotelPage.graphql.ts | 14 - .../Breadcrumbs/LoyaltyPage.graphql.ts | 14 - .../NavigationLinks.graphql.ts | 50 -- .../CampaignOverviewPage/Ref.graphql.ts | 12 - .../TopCampaign.graphql.ts | 19 - .../Fragments/CampaignPage/Hero.graphql.ts | 52 -- .../Fragments/CampaignPage/Ref.graphql.ts | 12 - .../CollectionPage/NavigationLinks.graphql.ts | 50 -- .../Fragments/CollectionPage/Ref.graphql.ts | 12 - .../TopPrimaryButton.graphql.ts | 50 -- .../ContentPage/NavigationLinks.graphql.ts | 50 -- .../Fragments/ContentPage/Ref.graphql.ts | 12 - .../ContentPage/TopPrimaryButton.graphql.ts | 50 -- .../DestinationCityPage/Ref.graphql.ts | 12 - .../DestinationCountryPage/Ref.graphql.ts | 12 - .../Fragments/DestinationFilter.graphql.ts | 32 +- .../DestinationOverviewPage/Ref.graphql.ts | 12 - .../graphql/Fragments/HotelFilter.graphql.ts | 11 - .../Fragments/ImageContainer.graphql.ts | 9 - .../lib/graphql/Fragments/Jotform.graphql.ts | 11 - .../Fragments/LoyaltyPage/Ref.graphql.ts | 12 - .../PromoCampaignPage/Ref.graphql.ts | 12 - .../Fragments/Sidebar/Content.graphql.ts | 104 +--- .../Sidebar/JoinLoyaltyContact.graphql.ts | 92 ---- .../Fragments/Sidebar/QuickLinks.graphql.ts | 12 +- .../Fragments/Sidebar/ScriptedCard.graphql.ts | 17 - .../Fragments/Sidebar/TeaserCard.graphql.ts | 17 - .../Fragments/StartPage/Ref.graphql.ts | 12 - .../lib/graphql/Fragments/SysAsset.graphql.ts | 11 - .../lib/graphql/Fragments/Video.graphql.ts | 18 - .../Query/AccountPage/AccountPage.graphql.ts | 35 +- .../Query/Breadcrumbs/AccountPage.graphql.ts | 22 +- .../CampaignOverviewPage.graphql.ts | 25 +- .../Query/Breadcrumbs/CampaignPage.graphql.ts | 22 +- .../Breadcrumbs/CollectionPage.graphql.ts | 22 +- .../Query/Breadcrumbs/ContentPage.graphql.ts | 22 +- .../DestinationCityPage.graphql.ts | 22 +- .../DestinationCountryPage.graphql.ts | 25 +- .../DestinationOverviewPage.graphql.ts | 25 +- .../Query/Breadcrumbs/HotelPage.graphql.ts | 22 +- .../Query/Breadcrumbs/LoyaltyPage.graphql.ts | 22 +- .../Breadcrumbs/PromoCampaignPage.graphql.ts | 22 +- .../CampaignOverviewPage.graphql.ts | 51 +- .../CampaignPage/CampaignPage.graphql.ts | 35 +- .../CampaignPagesByHotelUid.graphql.ts | 33 -- .../CollectionPage/CollectionPage.graphql.ts | 71 +-- .../Query/ContentPage/ContentPage.graphql.ts | 154 +----- .../DestinationCityPage.graphql.ts | 97 +--- .../DestinationCountryPage.graphql.ts | 84 +-- .../DestinationOverviewPage.graphql.ts | 21 +- .../trpc/lib/graphql/Query/Footer.graphql.ts | 100 ---- .../trpc/lib/graphql/Query/Header.graphql.ts | 157 ------ .../Query/HotelPage/HotelPage.graphql.ts | 52 -- .../Query/LoyaltyPage/LoyaltyPage.graphql.ts | 59 +- .../PromoCampaignPage.graphql.ts | 28 +- .../Query/RewardsWithRedeem.graphql.ts | 59 -- .../lib/graphql/Query/SiteConfig.graphql.ts | 28 +- .../Query/SitewideCampaignBanner.graphql.ts | 24 +- .../Query/StartPage/StartPage.graphql.ts | 59 +- .../graphql/Query/UsePointsModal.graphql.ts | 58 -- .../contentstack/UsePointsModal/output.ts | 20 +- .../contentstack/UsePointsModal/query.ts | 66 +-- .../contentstack/UsePointsModal/utils.ts | 17 - .../contentstack/accountPage/output.ts | 49 +- .../routers/contentstack/accountPage/query.ts | 63 +-- .../routers/contentstack/accountPage/utils.ts | 29 - .../lib/routers/contentstack/base/output.ts | 241 --------- .../lib/routers/contentstack/base/query.ts | 233 +------- .../lib/routers/contentstack/base/utils.ts | 123 +---- .../contentstack/breadcrumbs/output.ts | 22 - .../routers/contentstack/breadcrumbs/query.ts | 113 +--- .../routers/contentstack/breadcrumbs/utils.ts | 23 - .../campaignOverviewPage/output.ts | 61 +-- .../campaignOverviewPage/query.ts | 64 +-- .../campaignOverviewPage/utils.ts | 63 --- .../contentstack/campaignPage/output.ts | 58 +- .../contentstack/campaignPage/query.ts | 56 +- .../contentstack/campaignPage/utils.ts | 126 +---- .../contentstack/collectionPage/output.ts | 86 +-- .../contentstack/collectionPage/query.ts | 20 +- .../contentstack/collectionPage/utils.ts | 144 ----- .../contentstack/contentPage/output.ts | 209 +------ .../routers/contentstack/contentPage/query.ts | 17 +- .../routers/contentstack/contentPage/utils.ts | 218 -------- .../destinationCityPage/output.ts | 62 +-- .../contentstack/destinationCityPage/query.ts | 59 +- .../contentstack/destinationCityPage/utils.ts | 58 -- .../destinationCountryPage/output.ts | 62 +-- .../destinationCountryPage/query.ts | 62 +-- .../destinationCountryPage/utils.ts | 58 +- .../destinationOverviewPage/output.ts | 25 +- .../destinationOverviewPage/query.ts | 61 +-- .../routers/contentstack/hotelPage/output.ts | 38 +- .../contentstack/loyaltyPage/output.ts | 103 +--- .../routers/contentstack/loyaltyPage/query.ts | 71 +-- .../routers/contentstack/loyaltyPage/utils.ts | 72 --- .../contentstack/promoCampaignPage/output.ts | 37 +- .../contentstack/promoCampaignPage/query.ts | 56 +- .../contentstack/promoCampaignPage/utils.ts | 54 -- .../lib/routers/contentstack/reward/output.ts | 33 +- .../lib/routers/contentstack/reward/utils.ts | 61 +-- .../contentstack/schemas/blocks/accordion.ts | 98 +--- .../schemas/blocks/activitiesCard.ts | 30 +- .../schemas/blocks/allCampaigns.ts | 16 - .../schemas/blocks/cardGallery.ts | 28 +- .../schemas/blocks/cards/contentCard.ts | 7 - .../schemas/blocks/cards/infoCardWithImage.ts | 8 - .../schemas/blocks/cards/loyaltyCard.ts | 7 - .../schemas/blocks/cards/teaserCard.ts | 8 - .../contentstack/schemas/blocks/cardsGrid.ts | 69 +-- .../schemas/blocks/carouselCards.ts | 28 +- .../contentstack/schemas/blocks/content.ts | 50 +- .../schemas/blocks/dynamicContent.ts | 27 +- .../schemas/blocks/fullWidthCampaign.ts | 22 - .../contentstack/schemas/blocks/hotelFaq.ts | 37 +- .../schemas/blocks/imageContainer.ts | 5 - .../schemas/blocks/joinScandicFriends.ts | 7 - .../contentstack/schemas/blocks/jotform.ts | 17 - .../contentstack/schemas/blocks/shortcuts.ts | 30 +- .../contentstack/schemas/blocks/spaPage.ts | 20 - .../contentstack/schemas/blocks/sysAsset.ts | 10 - .../contentstack/schemas/blocks/textCols.ts | 47 +- .../contentstack/schemas/blocks/uspGrid.ts | 42 +- .../schemas/blocks/utils/linkConnection.ts | 21 - .../contentstack/schemas/blocks/video.ts | 7 +- .../contentstack/schemas/blocks/videoCard.ts | 32 +- .../schemas/destinationFilters.ts | 17 - .../schemas/headers/dynamicContent.ts | 4 - .../contentstack/schemas/linkConnection.ts | 32 +- .../routers/contentstack/schemas/pageLinks.ts | 112 ---- .../contentstack/schemas/sidebar/content.ts | 51 +- .../schemas/sidebar/joinLoyaltyContact.ts | 7 - .../schemas/sidebar/quickLinks.ts | 4 +- .../schemas/sidebar/scriptedCard.ts | 24 - .../schemas/sidebar/teaserCard.ts | 22 - .../routers/contentstack/startPage/output.ts | 71 +-- .../routers/contentstack/startPage/query.ts | 66 +-- .../routers/contentstack/startPage/utils.ts | 62 --- packages/trpc/lib/types/accountPage.ts | 12 +- packages/trpc/lib/types/breadcrumbs.ts | 9 +- .../trpc/lib/types/campaignOverviewPage.ts | 8 - packages/trpc/lib/types/campaignPage.ts | 30 +- packages/trpc/lib/types/collectionPage.ts | 9 - packages/trpc/lib/types/contentPage.ts | 9 - .../trpc/lib/types/destinationCityPage.ts | 37 +- .../trpc/lib/types/destinationCountryPage.ts | 22 +- .../trpc/lib/types/destinationOverviewPage.ts | 17 +- packages/trpc/lib/types/footer.ts | 2 - packages/trpc/lib/types/header.ts | 4 - packages/trpc/lib/types/hotelPage.ts | 15 +- packages/trpc/lib/types/loyaltyPage.ts | 12 +- packages/trpc/lib/types/promoCampaignPage.ts | 18 +- packages/trpc/lib/types/reward.ts | 4 - packages/trpc/lib/types/siteConfig.ts | 7 - packages/trpc/lib/utils/generateTag.ts | 53 -- 193 files changed, 489 insertions(+), 9018 deletions(-) create mode 100644 apps/scandic-web/lib/contentstack/fetchEntryReferences.ts delete mode 100644 packages/trpc/lib/graphql/Fragments/AccountPage/Ref.graphql.ts delete mode 100644 packages/trpc/lib/graphql/Fragments/Blocks/Refs/Accordion.graphql.ts delete mode 100644 packages/trpc/lib/graphql/Fragments/Blocks/Refs/Card.graphql.ts delete mode 100644 packages/trpc/lib/graphql/Fragments/Blocks/Refs/InfoCard.graphql.ts delete mode 100644 packages/trpc/lib/graphql/Fragments/Blocks/Refs/LoyaltyCard.graphql.ts delete mode 100644 packages/trpc/lib/graphql/Fragments/Blocks/Refs/TeaserCard.graphql.ts delete mode 100644 packages/trpc/lib/graphql/Fragments/CampaignOverviewPage/Ref.graphql.ts delete mode 100644 packages/trpc/lib/graphql/Fragments/CampaignPage/Ref.graphql.ts delete mode 100644 packages/trpc/lib/graphql/Fragments/CollectionPage/Ref.graphql.ts delete mode 100644 packages/trpc/lib/graphql/Fragments/ContentPage/Ref.graphql.ts delete mode 100644 packages/trpc/lib/graphql/Fragments/DestinationCityPage/Ref.graphql.ts delete mode 100644 packages/trpc/lib/graphql/Fragments/DestinationCountryPage/Ref.graphql.ts delete mode 100644 packages/trpc/lib/graphql/Fragments/DestinationOverviewPage/Ref.graphql.ts delete mode 100644 packages/trpc/lib/graphql/Fragments/LoyaltyPage/Ref.graphql.ts delete mode 100644 packages/trpc/lib/graphql/Fragments/PromoCampaignPage/Ref.graphql.ts delete mode 100644 packages/trpc/lib/graphql/Fragments/StartPage/Ref.graphql.ts delete mode 100644 packages/trpc/lib/routers/contentstack/UsePointsModal/utils.ts delete mode 100644 packages/trpc/lib/routers/contentstack/accountPage/utils.ts delete mode 100644 packages/trpc/lib/routers/contentstack/campaignOverviewPage/utils.ts delete mode 100644 packages/trpc/lib/routers/contentstack/collectionPage/utils.ts delete mode 100644 packages/trpc/lib/routers/contentstack/contentPage/utils.ts delete mode 100644 packages/trpc/lib/routers/contentstack/loyaltyPage/utils.ts delete mode 100644 packages/trpc/lib/routers/contentstack/promoCampaignPage/utils.ts delete mode 100644 packages/trpc/lib/routers/contentstack/schemas/blocks/utils/linkConnection.ts diff --git a/.vscode/settings.json b/.vscode/settings.json index bb1ea9114..aa697e947 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,8 @@ { - "typescript.tsdk": "node_modules/typescript/lib", - "typescript.experimental.useTsgo": false + "typescript.tsdk": "node_modules/typescript/lib", + "typescript.experimental.useTsgo": false, + "chat.tools.terminal.autoApprove": { + "yarn test": true, + "yarn check-types": true + } } diff --git a/apps/scandic-web/.env.local.example b/apps/scandic-web/.env.local.example index 599f39ea1..02ea34749 100644 --- a/apps/scandic-web/.env.local.example +++ b/apps/scandic-web/.env.local.example @@ -3,6 +3,7 @@ CMS_ACCESS_TOKEN="" CMS_BRANCH="development" CMS_API_KEY="" CMS_ENVIRONMENT="development" +CMS_MANAGEMENT_TOKEN="csddab1f1520ce77a1312af5d3" CMS_PREVIEW_TOKEN="" CMS_PREVIEW_URL="" CMS_URL="https://eu-graphql.contentstack.com/stacks/${CMS_API_KEY}?environment=${CMS_ENVIRONMENT}" diff --git a/apps/scandic-web/app/api/web/revalidate/route.ts b/apps/scandic-web/app/api/web/revalidate/route.ts index f017c7530..3955dcfc4 100644 --- a/apps/scandic-web/app/api/web/revalidate/route.ts +++ b/apps/scandic-web/app/api/web/revalidate/route.ts @@ -11,13 +11,10 @@ import { languageSwitcherAffix } from "@scandic-hotels/trpc/routers/contentstack import { affix as metadataAffix } from "@scandic-hotels/trpc/routers/contentstack/metadata/utils" import { affix as pageSettingsAffix } from "@scandic-hotels/trpc/routers/contentstack/pageSettings/utils" import { resolveEntryCacheKey } from "@scandic-hotels/trpc/utils/entry" -import { - generateRefsResponseTag, - generateRefTag, - generateTag, -} from "@scandic-hotels/trpc/utils/generateTag" +import { generateTag } from "@scandic-hotels/trpc/utils/generateTag" import { env } from "@/env/server" +import { fetchEntryReferences } from "@/lib/contentstack/fetchEntryReferences" import { badRequest, internalServerError } from "@/server/errors/next" import type { NextRequest } from "next/server" @@ -28,11 +25,6 @@ const validateJsonBody = z.object({ uid: z.string(), }), entry: z.object({ - breadcrumbs: z - .object({ - title: z.string(), - }) - .optional(), locale: z.nativeEnum(Lang), publish_details: z.object({ locale: z.nativeEnum(Lang) }).optional(), uid: z.string(), @@ -44,6 +36,15 @@ const validateJsonBody = z.object({ .optional(), destination_settings: destinationCityPageDestinationSettingsSchema.optional(), + web: z + .object({ + breadcrumbs: z + .object({ + title: z.string(), + }) + .optional(), + }) + .optional(), }), }), }) @@ -81,12 +82,6 @@ export async function POST(request: NextRequest) { // The publish_details.locale is the locale that the entry is published in, regardless if it is "localized" or not const entryLocale = entry.publish_details?.locale ?? entry.locale - const refsTag = generateRefsResponseTag(entryLocale, entry.uid) - const contentEntryTag = generateRefsResponseTag( - entryLocale, - content_type.uid - ) - const refTag = generateRefTag(entryLocale, content_type.uid, entry.uid) const tag = generateTag(entryLocale, entry.uid) const languageSwitcherTag = generateTag( "" as Lang, // We want to clear all languages when unpublishing a page @@ -106,14 +101,6 @@ export async function POST(request: NextRequest) { revalidateTag(contentTypeUidTag, { expire: 0 }) keysToDelete.push(contentTypeUidTag) - revalidateLogger.debug(`Revalidating refsTag: ${refsTag}`) - revalidateTag(refsTag, { expire: 0 }) - keysToDelete.push(refsTag) - - revalidateLogger.debug(`Revalidating refTag: ${refTag}`) - revalidateTag(refTag, { expire: 0 }) - keysToDelete.push(refTag) - revalidateLogger.debug(`Revalidating tag: ${tag}`) revalidateTag(tag, { expire: 0 }) keysToDelete.push(tag) @@ -126,9 +113,6 @@ export async function POST(request: NextRequest) { revalidateLogger.debug(`Revalidating metadataTag: ${metadataTag}`) revalidateTag(metadataTag, { expire: 0 }) keysToDelete.push(metadataTag) - revalidateLogger.debug(`Revalidating contentEntryTag: ${contentEntryTag}`) - revalidateTag(contentEntryTag, { expire: 0 }) - keysToDelete.push(contentEntryTag) if (entry.url) { const resolveEntryTag = resolveEntryCacheKey(entryLocale, entry.url) @@ -136,24 +120,13 @@ export async function POST(request: NextRequest) { keysToDelete.push(resolveEntryTag) } - if (entry.breadcrumbs) { - const breadcrumbsRefsTag = generateRefsResponseTag( - entryLocale, - entry.uid, - breadcrumbsAffix - ) + if (entry.web?.breadcrumbs) { const breadcrumbsTag = generateTag( entryLocale, entry.uid, breadcrumbsAffix ) - revalidateLogger.debug( - `Revalidating breadcrumbsRefsTag: ${breadcrumbsRefsTag}` - ) - revalidateTag(breadcrumbsRefsTag, { expire: 0 }) - keysToDelete.push(breadcrumbsRefsTag) - revalidateLogger.debug(`Revalidating breadcrumbsTag: ${breadcrumbsTag}`) revalidateTag(breadcrumbsTag, { expire: 0 }) keysToDelete.push(breadcrumbsTag) @@ -183,6 +156,26 @@ export async function POST(request: NextRequest) { } } + // Fetch entries that REFERENCE this entry (parent pages that embed this content) + // This allows us to invalidate parent page caches when a referenced child is updated + const references = await fetchEntryReferences(content_type.uid, entry.uid) + + for (const ref of references) { + // Use the entry's locale (from the webhook payload), not the reference's locale + // The API returns references with their base locale, but we only want to + // invalidate caches for the locale that was actually published + const parentTag = generateTag(entryLocale, ref.entry_uid) + revalidateLogger.debug( + `Revalidating parent reference tag: ${parentTag} (from ${ref.content_type_uid})` + ) + revalidateTag(parentTag, { expire: 0 }) + keysToDelete.push(parentTag) + } + + revalidateLogger.debug( + `Deleting ${keysToDelete.length} keys (including ${references.length} parent references)` + ) + await cacheClient.deleteKeys(keysToDelete, { fuzzy: true }) return Response.json({ revalidated: true, now: Date.now() }) diff --git a/apps/scandic-web/env/server.ts b/apps/scandic-web/env/server.ts index 94576babd..591674482 100644 --- a/apps/scandic-web/env/server.ts +++ b/apps/scandic-web/env/server.ts @@ -24,6 +24,7 @@ export const env = createEnv({ CMS_API_KEY: z.string(), CMS_ENVIRONMENT: z.enum(["development", "production", "stage", "test"]), CMS_BRANCH: z.enum(["development", "production"]), + CMS_MANAGEMENT_TOKEN: z.string().optional(), CURITY_CLIENT_ID_USER: z.string().default("scandichotels-web"), CURITY_CLIENT_ID_SERVICE: z.string().default("scandichotels-web-backend"), CURITY_CLIENT_SECRET_SERVICE: z.string(), @@ -123,6 +124,7 @@ export const env = createEnv({ CMS_API_KEY: process.env.CMS_API_KEY, CMS_ENVIRONMENT: process.env.CMS_ENVIRONMENT, CMS_BRANCH: process.env.CMS_BRANCH, + CMS_MANAGEMENT_TOKEN: process.env.CMS_MANAGEMENT_TOKEN, CURITY_CLIENT_ID_USER: process.env.CURITY_CLIENT_ID_USER, CURITY_CLIENT_ID_SERVICE: process.env.CURITY_CLIENT_ID_SERVICE, CURITY_CLIENT_SECRET_SERVICE: process.env.CURITY_CLIENT_SECRET_SERVICE, diff --git a/apps/scandic-web/lib/contentstack/fetchEntryReferences.ts b/apps/scandic-web/lib/contentstack/fetchEntryReferences.ts new file mode 100644 index 000000000..9fc673f6e --- /dev/null +++ b/apps/scandic-web/lib/contentstack/fetchEntryReferences.ts @@ -0,0 +1,86 @@ +import { z } from "zod" + +import { createLogger } from "@scandic-hotels/common/logger/createLogger" + +import { env } from "@/env/server" + +const logger = createLogger("contentstack-references") + +/** + * Schema for validating Contentstack Management API references response + */ +const entryReferenceSchema = z.object({ + uid: z.string().optional(), + entry_uid: z.string(), + content_type_uid: z.string(), + locale: z.string(), + title: z.string(), + _version: z.number().optional(), + content_type_title: z.string().optional(), +}) + +const referencesResponseSchema = z.object({ + references: z.array(entryReferenceSchema).optional().default([]), +}) + +export type EntryReference = z.infer + +/** + * Fetches all entries that reference the given entry from Contentstack Management API. + * + * This is used during cache invalidation to find parent pages that embed/reference + * the changed entry, so we can invalidate their caches as well. + * + * @see https://www.contentstack.com/docs/developers/apis/content-management-api#entry-references + */ +export async function fetchEntryReferences( + contentTypeUid: string, + entryUid: string +): Promise { + const managementToken = env.CMS_MANAGEMENT_TOKEN + + if (!managementToken) { + throw new Error("CMS_MANAGEMENT_TOKEN not configured") + } + + // Contentstack EU region base URL + const baseUrl = "https://eu-api.contentstack.com" + const url = `${baseUrl}/v3/content_types/${contentTypeUid}/entries/${entryUid}/references` + + const response = await fetch(url, { + method: "GET", + headers: { + api_key: env.CMS_API_KEY, + authorization: managementToken, + branch: env.CMS_BRANCH, + "Content-Type": "application/json", + }, + // Don't cache this request - we need fresh data + cache: "no-store", + }) + + if (!response.ok) { + const errorText = await response.text() + throw new Error( + `Failed to fetch entry references: ${response.status} ${errorText}`, + { + cause: response, + } + ) + } + + const data = await response.json() + const parsed = referencesResponseSchema.safeParse(data) + + if (!parsed.success) { + throw new Error("Invalid response from Contentstack references API", { + cause: parsed.error, + }) + } + + logger.debug( + `Found ${parsed.data.references.length} references for ${contentTypeUid}/${entryUid}` + ) + + return parsed.data.references +} diff --git a/packages/trpc/lib/graphql/Fragments/AccountPage/Ref.graphql.ts b/packages/trpc/lib/graphql/Fragments/AccountPage/Ref.graphql.ts deleted file mode 100644 index 7109851c2..000000000 --- a/packages/trpc/lib/graphql/Fragments/AccountPage/Ref.graphql.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { gql } from "graphql-tag" - -import { System } from "../System.graphql" - -export const AccountPageRef = gql` - fragment AccountPageRef on AccountPage { - system { - ...System - } - } - ${System} -` diff --git a/packages/trpc/lib/graphql/Fragments/Alert.graphql.ts b/packages/trpc/lib/graphql/Fragments/Alert.graphql.ts index 0367fd80c..43191b2b7 100644 --- a/packages/trpc/lib/graphql/Fragments/Alert.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Alert.graphql.ts @@ -1,15 +1,5 @@ import { gql } from "graphql-tag" -import { AccountPageRef } from "./AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "./CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "./CampaignPage/Ref.graphql" -import { CollectionPageRef } from "./CollectionPage/Ref.graphql" -import { ContentPageRef } from "./ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "./DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "./DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "./DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "./HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "./LoyaltyPage/Ref.graphql" import { AccountPageLink } from "./PageLink/AccountPageLink.graphql" import { CampaignOverviewPageLink } from "./PageLink/CampaignOverviewPageLink.graphql" import { CampaignPageLink } from "./PageLink/CampaignPageLink.graphql" @@ -22,9 +12,6 @@ import { HotelPageLink } from "./PageLink/HotelPageLink.graphql" import { LoyaltyPageLink } from "./PageLink/LoyaltyPageLink.graphql" import { PromoCampaignPageLink } from "./PageLink/PromoCampaignPageLink.graphql" import { StartPageLink } from "./PageLink/StartPageLink.graphql" -import { PromoCampaignPageRef } from "./PromoCampaignPage/Ref.graphql" -import { StartPageRef } from "./StartPage/Ref.graphql" -import { System } from "./System.graphql" export const Alert = gql` fragment Alert on Alert { @@ -104,70 +91,3 @@ export const Alert = gql` ${StartPageLink} ${PromoCampaignPageLink} ` - -export const AlertRef = gql` - fragment AlertRef on Alert { - link { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - sidepeek_content { - content { - embedded_itemsConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - json - } - } - system { - ...System - } - visible_on - } - ${System} - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/Banner.graphql.ts b/packages/trpc/lib/graphql/Fragments/Banner.graphql.ts index a67a9ea46..52eb7cfcc 100644 --- a/packages/trpc/lib/graphql/Fragments/Banner.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Banner.graphql.ts @@ -1,15 +1,5 @@ import { gql } from "graphql-tag" -import { AccountPageRef } from "./AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "./CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "./CampaignPage/Ref.graphql" -import { CollectionPageRef } from "./CollectionPage/Ref.graphql" -import { ContentPageRef } from "./ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "./DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "./DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "./DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "./HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "./LoyaltyPage/Ref.graphql" import { AccountPageLink } from "./PageLink/AccountPageLink.graphql" import { CampaignOverviewPageLink } from "./PageLink/CampaignOverviewPageLink.graphql" import { CampaignPageLink } from "./PageLink/CampaignPageLink.graphql" @@ -22,8 +12,6 @@ import { HotelPageLink } from "./PageLink/HotelPageLink.graphql" import { LoyaltyPageLink } from "./PageLink/LoyaltyPageLink.graphql" import { PromoCampaignPageLink } from "./PageLink/PromoCampaignPageLink.graphql" import { StartPageLink } from "./PageLink/StartPageLink.graphql" -import { PromoCampaignPageRef } from "./PromoCampaignPage/Ref.graphql" -import { StartPageRef } from "./StartPage/Ref.graphql" export const Banner = gql` fragment Banner on Banner { @@ -67,45 +55,3 @@ export const Banner = gql` ${StartPageLink} ${PromoCampaignPageLink} ` - -export const BannerRef = gql` - fragment BannerRef on Banner { - link { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - visible_on - system { - ...System - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/Blocks/Accordion.graphql.ts b/packages/trpc/lib/graphql/Fragments/Blocks/Accordion.graphql.ts index b51dbce6e..f0af533d3 100644 --- a/packages/trpc/lib/graphql/Fragments/Blocks/Accordion.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Blocks/Accordion.graphql.ts @@ -1,15 +1,5 @@ import { gql } from "graphql-tag" -import { AccountPageRef } from "../AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "../CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../CollectionPage/Ref.graphql" -import { ContentPageRef } from "../ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "../DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "../LoyaltyPage/Ref.graphql" import { AccountPageLink } from "../PageLink/AccountPageLink.graphql" import { CampaignOverviewPageLink } from "../PageLink/CampaignOverviewPageLink.graphql" import { CampaignPageLink } from "../PageLink/CampaignPageLink.graphql" @@ -22,10 +12,7 @@ import { HotelPageLink } from "../PageLink/HotelPageLink.graphql" import { LoyaltyPageLink } from "../PageLink/LoyaltyPageLink.graphql" import { PromoCampaignPageLink } from "../PageLink/PromoCampaignPageLink.graphql" import { StartPageLink } from "../PageLink/StartPageLink.graphql" -import { PromoCampaignPageRef } from "../PromoCampaignPage/Ref.graphql" -import { StartPageRef } from "../StartPage/Ref.graphql" import { SysAsset } from "../SysAsset.graphql" -import { AccordionBlockRefs } from "./Refs/Accordion.graphql" export const AccordionBlock = gql` fragment AccordionBlock on Accordion { @@ -196,76 +183,6 @@ export const Accordion_AccountPage = gql` ${SpecificAccordion_AccountPage} ` -const GlobalAccordion_AccountPageRefs = gql` - fragment GlobalAccordion_AccountPageRefs on AccountPageContentAccordionBlockAccordionsGlobalAccordion { - global_accordion { - global_accordionConnection { - edges { - node { - ...AccordionBlockRefs - } - } - } - } - } - ${AccordionBlockRefs} -` - -const SpecificAccordion_AccountPageRefs = gql` - fragment SpecificAccordion_AccountPageRefs on AccountPageContentAccordionBlockAccordionsSpecificAccordion { - specific_accordion { - questions { - answer { - embedded_itemsConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` -export const Accordion_AccountPageRefs = gql` - fragment Accordion_AccountPageRefs on AccountPageContentAccordion { - accordion { - accordions { - __typename - ...GlobalAccordion_AccountPageRefs - ...SpecificAccordion_AccountPageRefs - } - } - } - ${GlobalAccordion_AccountPageRefs} - ${SpecificAccordion_AccountPageRefs} -` - const GlobalAccordion_ContentPage = gql` fragment GlobalAccordion_ContentPage on ContentPageBlocksAccordionBlockAccordionsGlobalAccordion { __typename @@ -345,65 +262,6 @@ export const Accordion_ContentPage = gql` ${SpecificAccordion_ContentPage} ` -const GlobalAccordion_ContentPageRefs = gql` - fragment GlobalAccordion_ContentPageRefs on ContentPageBlocksAccordionBlockAccordionsGlobalAccordion { - global_accordion { - global_accordionConnection { - edges { - node { - ...AccordionBlockRefs - } - } - } - } - } - - ${AccordionBlockRefs} -` - -const SpecificAccordion_ContentPageRefs = gql` - fragment SpecificAccordion_ContentPageRefs on ContentPageBlocksAccordionBlockAccordionsSpecificAccordion { - specific_accordion { - questions { - answer { - embedded_itemsConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - } - - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` - const GlobalAccordion_DestinationCityPage = gql` fragment GlobalAccordion_DestinationCityPage on DestinationCityPageBlocksAccordionBlockAccordionsGlobalAccordion { __typename @@ -467,90 +325,6 @@ const SpecificAccordion_DestinationCityPage = gql` ${PromoCampaignPageLink} ` -const GlobalAccordion_DestinationCityPageRefs = gql` - fragment GlobalAccordion_DestinationCityPageRefs on DestinationCityPageBlocksAccordionBlockAccordionsGlobalAccordion { - global_accordion { - global_accordionConnection { - edges { - node { - ...AccordionBlockRefs - } - } - } - } - } - - ${AccordionBlockRefs} -` -export const Accordion_ContentPageRefs = gql` - fragment Accordion_ContentPageRefs on ContentPageBlocksAccordion { - accordion { - accordions { - __typename - ...GlobalAccordion_ContentPageRefs - ...SpecificAccordion_ContentPageRefs - } - } - } - ${GlobalAccordion_ContentPageRefs} - ${SpecificAccordion_ContentPageRefs} -` - -const SpecificAccordion_DestinationCityPageRefs = gql` - fragment SpecificAccordion_DestinationCityPageRefs on DestinationCityPageBlocksAccordionBlockAccordionsSpecificAccordion { - specific_accordion { - questions { - answer { - embedded_itemsConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` -export const Accordion_DestinationCityPageRefs = gql` - fragment Accordion_DestinationCityPageRefs on DestinationCityPageBlocksAccordion { - accordion { - accordions { - __typename - ...GlobalAccordion_DestinationCityPageRefs - ...SpecificAccordion_DestinationCityPageRefs - } - } - } - ${GlobalAccordion_DestinationCityPageRefs} - ${SpecificAccordion_DestinationCityPageRefs} -` - const GlobalAccordion_DestinationCountryPage = gql` fragment GlobalAccordion_DestinationCountryPage on DestinationCountryPageBlocksAccordionBlockAccordionsGlobalAccordion { __typename @@ -630,77 +404,6 @@ export const Accordion_DestinationCountryPage = gql` ${SpecificAccordion_DestinationCountryPage} ` -const GlobalAccordion_DestinationCountryPageRefs = gql` - fragment GlobalAccordion_DestinationCountryPageRefs on DestinationCountryPageBlocksAccordionBlockAccordionsGlobalAccordion { - global_accordion { - global_accordionConnection { - edges { - node { - ...AccordionBlockRefs - } - } - } - } - } - ${AccordionBlockRefs} -` - -const SpecificAccordion_DestinationCountryPageRefs = gql` - fragment SpecificAccordion_DestinationCountryPageRefs on DestinationCountryPageBlocksAccordionBlockAccordionsSpecificAccordion { - specific_accordion { - questions { - answer { - embedded_itemsConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` - -export const Accordion_DestinationCountryPageRefs = gql` - fragment Accordion_DestinationCountryPageRefs on DestinationCountryPageBlocksAccordion { - accordion { - accordions { - __typename - ...GlobalAccordion_DestinationCountryPageRefs - ...SpecificAccordion_DestinationCountryPageRefs - } - } - } - ${GlobalAccordion_DestinationCountryPageRefs} - ${SpecificAccordion_DestinationCountryPageRefs} -` - const GlobalAccordion_CampaignPage = gql` fragment GlobalAccordion_CampaignPage on CampaignPageBlocksAccordionBlockAccordionsGlobalAccordion { __typename @@ -779,76 +482,6 @@ export const Accordion_CampaignPage = gql` ${SpecificAccordion_CampaignPage} ` -const GlobalAccordion_CampaignPageRefs = gql` - fragment GlobalAccordion_CampaignPageRefs on CampaignPageBlocksAccordionBlockAccordionsGlobalAccordion { - global_accordion { - global_accordionConnection { - edges { - node { - ...AccordionBlockRefs - } - } - } - } - } - ${AccordionBlockRefs} -` - -const SpecificAccordion_CampaignPageRefs = gql` - fragment SpecificAccordion_CampaignPageRefs on CampaignPageBlocksAccordionBlockAccordionsSpecificAccordion { - specific_accordion { - questions { - answer { - embedded_itemsConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` -export const Accordion_CampaignPageRefs = gql` - fragment Accordion_CampaignPageRefs on CampaignPageBlocksAccordion { - accordion { - accordions { - __typename - ...GlobalAccordion_CampaignPageRefs - ...SpecificAccordion_CampaignPageRefs - } - } - } - ${GlobalAccordion_CampaignPageRefs} - ${SpecificAccordion_CampaignPageRefs} -` - const GlobalAccordion_DestinationFilterBlocks = gql` fragment GlobalAccordion_DestinationFilterBlocks on DestinationFilterBlocksAccordionBlockAccordionsGlobalAccordion { __typename @@ -927,76 +560,6 @@ export const Accordion_DestinationFilterBlocks = gql` ${SpecificAccordion_DestinationFilterBlocks} ` -const GlobalAccordion_DestinationFilterBlocksRefs = gql` - fragment GlobalAccordion_DestinationFilterBlocksRefs on DestinationFilterBlocksAccordionBlockAccordionsGlobalAccordion { - global_accordion { - global_accordionConnection { - edges { - node { - ...AccordionBlockRefs - } - } - } - } - } - ${AccordionBlockRefs} -` - -const SpecificAccordion_DestinationFilterBlocksRefs = gql` - fragment SpecificAccordion_DestinationFilterBlocksRefs on DestinationFilterBlocksAccordionBlockAccordionsSpecificAccordion { - specific_accordion { - questions { - answer { - embedded_itemsConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` -export const Accordion_DestinationFilterBlocksRefs = gql` - fragment Accordion_DestinationFilterBlocksRefs on DestinationFilterBlocksAccordion { - accordion { - accordions { - __typename - ...GlobalAccordion_DestinationFilterBlocksRefs - ...SpecificAccordion_DestinationFilterBlocksRefs - } - } - } - ${GlobalAccordion_DestinationFilterBlocksRefs} - ${SpecificAccordion_DestinationFilterBlocksRefs} -` - const GlobalAccordion_PromoCampaignPage = gql` fragment GlobalAccordion_PromoCampaignPage on PromoCampaignPageBlocksAccordionBlockAccordionsGlobalAccordion { __typename @@ -1074,77 +637,6 @@ export const Accordion_PromoCampaignPage = gql` ${SpecificAccordion_PromoCampaignPage} ` -const GlobalAccordion_PromoCampaignPageRefs = gql` - fragment GlobalAccordion_PromoCampaignPageRefs on PromoCampaignPageBlocksAccordionBlockAccordionsGlobalAccordion { - global_accordion { - global_accordionConnection { - edges { - node { - ...AccordionBlockRefs - } - } - } - } - } - ${AccordionBlockRefs} -` - -const SpecificAccordion_PromoCampaignPageRefs = gql` - fragment SpecificAccordion_PromoCampaignPageRefs on PromoCampaignPageBlocksAccordionBlockAccordionsSpecificAccordion { - specific_accordion { - questions { - answer { - embedded_itemsConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` - -export const Accordion_PromoCampaignPageRefs = gql` - fragment Accordion_PromoCampaignPageRefs on PromoCampaignPageBlocksAccordion { - accordion { - accordions { - __typename - ...GlobalAccordion_PromoCampaignPageRefs - ...SpecificAccordion_PromoCampaignPageRefs - } - } - } - ${GlobalAccordion_PromoCampaignPageRefs} - ${SpecificAccordion_PromoCampaignPageRefs} -` - export const Accordion_DestinationCityPage = gql` fragment Accordion_DestinationCityPage on DestinationCityPageBlocksAccordion { __typename diff --git a/packages/trpc/lib/graphql/Fragments/Blocks/AllCampaigns.graphql.ts b/packages/trpc/lib/graphql/Fragments/Blocks/AllCampaigns.graphql.ts index 80c695f51..1ddb8ac54 100644 --- a/packages/trpc/lib/graphql/Fragments/Blocks/AllCampaigns.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Blocks/AllCampaigns.graphql.ts @@ -1,8 +1,5 @@ import { gql } from "graphql-tag" -import { CampaignPageRef } from "../CampaignPage/Ref.graphql" -import { PromoCampaignPageRef } from "../PromoCampaignPage/Ref.graphql" - export const AllCampaigns = gql` fragment AllCampaigns on CampaignOverviewPageBlocksAllCampaigns { all_campaigns { @@ -39,21 +36,3 @@ export const AllCampaigns = gql` } } ` - -export const AllCampaignsRefs = gql` - fragment AllCampaignsRefs on CampaignOverviewPageBlocksAllCampaigns { - all_campaigns { - campaignsConnection { - edges { - node { - __typename - ...CampaignPageRef - ...PromoCampaignPageRef - } - } - } - } - } - ${CampaignPageRef} - ${PromoCampaignPageRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/Blocks/CardGallery.graphql.ts b/packages/trpc/lib/graphql/Fragments/Blocks/CardGallery.graphql.ts index 370908791..014617888 100644 --- a/packages/trpc/lib/graphql/Fragments/Blocks/CardGallery.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Blocks/CardGallery.graphql.ts @@ -1,15 +1,5 @@ import { gql } from "graphql-tag" -import { AccountPageRef } from "../AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "../CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../CollectionPage/Ref.graphql" -import { ContentPageRef } from "../ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "../DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "../LoyaltyPage/Ref.graphql" import { AccountPageLink } from "../PageLink/AccountPageLink.graphql" import { CampaignOverviewPageLink } from "../PageLink/CampaignOverviewPageLink.graphql" import { CampaignPageLink } from "../PageLink/CampaignPageLink.graphql" @@ -22,10 +12,8 @@ import { HotelPageLink } from "../PageLink/HotelPageLink.graphql" import { LoyaltyPageLink } from "../PageLink/LoyaltyPageLink.graphql" import { PromoCampaignPageLink } from "../PageLink/PromoCampaignPageLink.graphql" import { StartPageLink } from "../PageLink/StartPageLink.graphql" -import { PromoCampaignPageRef } from "../PromoCampaignPage/Ref.graphql" -import { StartPageRef } from "../StartPage/Ref.graphql" import { System } from "../System.graphql" -import { ContentCardBlock, ContentCardBlockRef } from "./ContentCard.graphql" +import { ContentCardBlock } from "./ContentCard.graphql" export const CardGallery_DestinationOverviewPage = gql` fragment CardGallery_DestinationOverviewPage on DestinationOverviewPageBlocksCardGallery { @@ -87,53 +75,3 @@ export const CardGallery_DestinationOverviewPage = gql` ${StartPageLink} ${PromoCampaignPageLink} ` - -export const CardGallery_DestinationOverviewPageRefs = gql` - fragment CardGallery_DestinationOverviewPageRefs on DestinationOverviewPageBlocksCardGallery { - card_gallery { - card_groups { - cardsConnection { - edges { - node { - ...ContentCardBlockRef - } - } - } - } - link { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - ${ContentCardBlockRef} - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/Blocks/CardsGrid.graphql.ts b/packages/trpc/lib/graphql/Fragments/Blocks/CardsGrid.graphql.ts index eaed17ebc..8ea6cbae3 100644 --- a/packages/trpc/lib/graphql/Fragments/Blocks/CardsGrid.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Blocks/CardsGrid.graphql.ts @@ -1,15 +1,5 @@ import { gql } from "graphql-tag" -import { AccountPageRef } from "../AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "../CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../CollectionPage/Ref.graphql" -import { ContentPageRef } from "../ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "../DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "../LoyaltyPage/Ref.graphql" import { AccountPageLink } from "../PageLink/AccountPageLink.graphql" import { CampaignOverviewPageLink } from "../PageLink/CampaignOverviewPageLink.graphql" import { CampaignPageLink } from "../PageLink/CampaignPageLink.graphql" @@ -22,11 +12,6 @@ import { HotelPageLink } from "../PageLink/HotelPageLink.graphql" import { LoyaltyPageLink } from "../PageLink/LoyaltyPageLink.graphql" import { PromoCampaignPageLink } from "../PageLink/PromoCampaignPageLink.graphql" import { StartPageLink } from "../PageLink/StartPageLink.graphql" -import { PromoCampaignPageRef } from "../PromoCampaignPage/Ref.graphql" -import { CardBlockRef } from "./Refs/Card.graphql" -import { InfoCardBlockRef } from "./Refs/InfoCard.graphql" -import { LoyaltyCardBlockRef } from "./Refs/LoyaltyCard.graphql" -import { TeaserCardBlockRef } from "./Refs/TeaserCard.graphql" import { CardBlock } from "./Card.graphql" import { InfoCardBlock } from "./InfoCard.graphql" import { LoyaltyCardBlock } from "./LoyaltyCard.graphql" @@ -56,26 +41,6 @@ export const CardsGrid_ContentPage = gql` ${TeaserCardBlock} ` -export const CardsGrid_ContentPageRefs = gql` - fragment CardsGrid_ContentPageRefs on ContentPageBlocksCardsGrid { - cards_grid { - cardConnection(limit: 10) { - edges { - node { - __typename - ...CardBlockRef - ...LoyaltyCardBlockRef - ...TeaserCardBlockRef - } - } - } - } - } - ${CardBlockRef} - ${LoyaltyCardBlockRef} - ${TeaserCardBlockRef} -` - export const CardsGrid_CollectionPage = gql` fragment CardsGrid_CollectionPage on CollectionPageBlocksCardsGrid { cards_grid { @@ -98,24 +63,6 @@ export const CardsGrid_CollectionPage = gql` ${TeaserCardBlock} ` -export const CardsGrid_CollectionPageRefs = gql` - fragment CardsGrid_CollectionPageRefs on CollectionPageBlocksCardsGrid { - cards_grid { - cardConnection(limit: 10) { - edges { - node { - __typename - ...CardBlockRef - ...TeaserCardBlockRef - } - } - } - } - } - ${CardBlockRef} - ${TeaserCardBlockRef} -` - export const CardsGrid_LoyaltyPage = gql` fragment CardsGrid_LoyaltyPage on LoyaltyPageBlocksCardsGrid { cards_grid { @@ -138,24 +85,6 @@ export const CardsGrid_LoyaltyPage = gql` ${LoyaltyCardBlock} ` -export const CardsGrid_LoyaltyPageRefs = gql` - fragment CardsGrid_LoyaltyPageRefs on LoyaltyPageBlocksCardsGrid { - cards_grid { - cardConnection(limit: 10) { - edges { - node { - __typename - ...CardBlockRef - ...LoyaltyCardBlockRef - } - } - } - } - } - ${CardBlockRef} - ${LoyaltyCardBlockRef} -` - export const CardsGrid_StartPage = gql` fragment CardsGrid_StartPage on StartPageBlocksCardsGrid { cards_grid { @@ -219,55 +148,3 @@ export const CardsGrid_StartPage = gql` ${StartPageLink} ${PromoCampaignPageLink} ` - -export const CardsGrid_StartPageRefs = gql` - fragment CardsGrid_StartPageRefs on StartPageBlocksCardsGrid { - cards_grid { - cardConnection(limit: 10) { - edges { - node { - __typename - ...CardBlockRef - ...TeaserCardBlockRef - ...InfoCardBlockRef - } - } - } - link { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - ${CardBlockRef} - ${InfoCardBlockRef} - ${TeaserCardBlockRef} - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${ContentPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${CollectionPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${PromoCampaignPageRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/Blocks/CarouselCards.graphql.ts b/packages/trpc/lib/graphql/Fragments/Blocks/CarouselCards.graphql.ts index 5a6d02f95..6be4026c9 100644 --- a/packages/trpc/lib/graphql/Fragments/Blocks/CarouselCards.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Blocks/CarouselCards.graphql.ts @@ -1,15 +1,5 @@ import { gql } from "graphql-tag" -import { AccountPageRef } from "../AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "../CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../CollectionPage/Ref.graphql" -import { ContentPageRef } from "../ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "../DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "../LoyaltyPage/Ref.graphql" import { AccountPageLink } from "../PageLink/AccountPageLink.graphql" import { CampaignOverviewPageLink } from "../PageLink/CampaignOverviewPageLink.graphql" import { CampaignPageLink } from "../PageLink/CampaignPageLink.graphql" @@ -21,8 +11,7 @@ import { DestinationOverviewPageLink } from "../PageLink/DestinationOverviewPage import { HotelPageLink } from "../PageLink/HotelPageLink.graphql" import { LoyaltyPageLink } from "../PageLink/LoyaltyPageLink.graphql" import { PromoCampaignPageLink } from "../PageLink/PromoCampaignPageLink.graphql" -import { PromoCampaignPageRef } from "../PromoCampaignPage/Ref.graphql" -import { ContentCardBlock, ContentCardBlockRef } from "./ContentCard.graphql" +import { ContentCardBlock } from "./ContentCard.graphql" export const CarouselCards_StartPage = gql` fragment CarouselCards_StartPage on StartPageBlocksCarouselCards { @@ -83,54 +72,6 @@ export const CarouselCards_StartPage = gql` ${PromoCampaignPageLink} ` -export const CarouselCards_StartPageRefs = gql` - fragment CarouselCards_StartPageRefs on StartPageBlocksCarouselCards { - carousel_cards { - card_groups { - cardConnection { - edges { - node { - ...ContentCardBlockRef - } - } - } - } - link { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - ${ContentCardBlockRef} - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${ContentPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${CollectionPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${PromoCampaignPageRef} -` - export const CarouselCards_CampaignPage = gql` fragment CarouselCards_CampaignPage on CampaignPageBlocksCarouselCards { carousel_cards { @@ -153,23 +94,6 @@ export const CarouselCards_CampaignPage = gql` ${ContentCardBlock} ` -export const CarouselCards_CampaignPageRefs = gql` - fragment CarouselCards_CampaignPageRefs on CampaignPageBlocksCarouselCards { - carousel_cards { - card_groups { - cardConnection { - edges { - node { - ...ContentCardBlockRef - } - } - } - } - } - } - ${ContentCardBlockRef} -` - export const CarouselCards_CampaignOverviewPage = gql` fragment CarouselCards_CampaignOverviewPage on CampaignOverviewPageBlocksCarouselCards { carousel_cards { @@ -190,20 +114,3 @@ export const CarouselCards_CampaignOverviewPage = gql` } ${ContentCardBlock} ` - -export const CarouselCards_CampaignOverviewPageRefs = gql` - fragment CarouselCards_CampaignOverviewPageRefs on CampaignOverviewPageBlocksCarouselCards { - carousel_cards { - card_groups { - cardConnection { - edges { - node { - ...ContentCardBlockRef - } - } - } - } - } - } - ${ContentCardBlockRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/Blocks/Content.graphql.ts b/packages/trpc/lib/graphql/Fragments/Blocks/Content.graphql.ts index 5b497a5b8..d2e99bf39 100644 --- a/packages/trpc/lib/graphql/Fragments/Blocks/Content.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Blocks/Content.graphql.ts @@ -1,16 +1,6 @@ import { gql } from "graphql-tag" -import { AccountPageRef } from "../AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "../CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../CollectionPage/Ref.graphql" -import { ContentPageRef } from "../ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "../DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../HotelPage/Ref.graphql" -import { ImageContainer, ImageContainerRef } from "../ImageContainer.graphql" -import { LoyaltyPageRef } from "../LoyaltyPage/Ref.graphql" +import { ImageContainer } from "../ImageContainer.graphql" import { AccountPageLink } from "../PageLink/AccountPageLink.graphql" import { CampaignOverviewPageLink } from "../PageLink/CampaignOverviewPageLink.graphql" import { CampaignPageLink } from "../PageLink/CampaignPageLink.graphql" @@ -23,9 +13,7 @@ import { HotelPageLink } from "../PageLink/HotelPageLink.graphql" import { LoyaltyPageLink } from "../PageLink/LoyaltyPageLink.graphql" import { PromoCampaignPageLink } from "../PageLink/PromoCampaignPageLink.graphql" import { StartPageLink } from "../PageLink/StartPageLink.graphql" -import { PromoCampaignPageRef } from "../PromoCampaignPage/Ref.graphql" -import { StartPageRef } from "../StartPage/Ref.graphql" -import { SysAsset, SysAssetRef } from "../SysAsset.graphql" +import { SysAsset } from "../SysAsset.graphql" export const Content_ContentPage = gql` fragment Content_ContentPage on ContentPageBlocksContent { @@ -72,50 +60,6 @@ export const Content_ContentPage = gql` ${PromoCampaignPageLink} ` -export const Content_ContentPageRefs = gql` - fragment Content_ContentPageRefs on ContentPageBlocksContent { - content { - content { - embedded_itemsConnection { - edges { - node { - __typename - ...SysAssetRef - ...ImageContainerRef - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - ${SysAssetRef} - ${ImageContainerRef} - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` - export const Content_LoyaltyPage = gql` fragment Content_LoyaltyPage on LoyaltyPageBlocksContent { content { @@ -161,48 +105,6 @@ export const Content_LoyaltyPage = gql` ${PromoCampaignPageLink} ` -export const Content_LoyaltyPageRefs = gql` - fragment Content_LoyaltyPageRefs on LoyaltyPageBlocksContent { - content { - content { - embedded_itemsConnection { - edges { - node { - __typename - ...SysAssetRef - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - ${SysAssetRef} - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` - export const Content_DestinationCityPage = gql` fragment Content_DestinationCityPage on DestinationCityPageBlocksContent { content { @@ -244,46 +146,6 @@ export const Content_DestinationCityPage = gql` ${PromoCampaignPageLink} ` -export const Content_DestinationCityPageRefs = gql` - fragment Content_DestinationCityPageRefs on DestinationCityPageBlocksContent { - content { - content { - embedded_itemsConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` - export const Content_DestinationCountryPage = gql` fragment Content_DestinationCountryPage on DestinationCountryPageBlocksContent { content { @@ -325,46 +187,6 @@ export const Content_DestinationCountryPage = gql` ${PromoCampaignPageLink} ` -export const Content_DestinationCountryPageRefs = gql` - fragment Content_DestinationCountryPageRefs on DestinationCountryPageBlocksContent { - content { - content { - embedded_itemsConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` - export const Content_DestinationFilterBlocks = gql` fragment Content_DestinationFilterBlocks on DestinationFilterBlocksContent { content { @@ -406,46 +228,6 @@ export const Content_DestinationFilterBlocks = gql` ${PromoCampaignPageLink} ` -export const Content_DestinationFilterBlocksRefs = gql` - fragment Content_DestinationFilterBlocksRefs on DestinationFilterBlocksContent { - content { - content { - embedded_itemsConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` - export const Content_PromoCampaignPage = gql` fragment Content_PromoCampaignPage on PromoCampaignPageBlocksContent { content { @@ -488,45 +270,3 @@ export const Content_PromoCampaignPage = gql` ${StartPageLink} ${PromoCampaignPageLink} ` - -export const Content_PromoCampaignPageRefs = gql` - fragment Content_PromoCampaignPageRefs on PromoCampaignPageBlocksContent { - content { - content { - embedded_itemsConnection { - edges { - node { - __typename - ...SysAssetRef - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - ${SysAssetRef} - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/Blocks/ContentCard.graphql.ts b/packages/trpc/lib/graphql/Fragments/Blocks/ContentCard.graphql.ts index 68982aefa..4a6900738 100644 --- a/packages/trpc/lib/graphql/Fragments/Blocks/ContentCard.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Blocks/ContentCard.graphql.ts @@ -1,15 +1,5 @@ import { gql } from "graphql-tag" -import { AccountPageRef } from "../AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "../CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../CollectionPage/Ref.graphql" -import { ContentPageRef } from "../ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "../DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "../LoyaltyPage/Ref.graphql" import { AccountPageLink } from "../PageLink/AccountPageLink.graphql" import { CampaignOverviewPageLink } from "../PageLink/CampaignOverviewPageLink.graphql" import { CampaignPageLink } from "../PageLink/CampaignPageLink.graphql" @@ -22,8 +12,6 @@ import { HotelPageLink } from "../PageLink/HotelPageLink.graphql" import { LoyaltyPageLink } from "../PageLink/LoyaltyPageLink.graphql" import { PromoCampaignPageLink } from "../PageLink/PromoCampaignPageLink.graphql" import { StartPageLink } from "../PageLink/StartPageLink.graphql" -import { PromoCampaignPageRef } from "../PromoCampaignPage/Ref.graphql" -import { StartPageRef } from "../StartPage/Ref.graphql" import { System } from "../System.graphql" export const ContentCardBlock = gql` @@ -80,46 +68,3 @@ export const ContentCardBlock = gql` ${StartPageLink} ${PromoCampaignPageLink} ` - -export const ContentCardBlockRef = gql` - fragment ContentCardBlockRef on ContentCard { - __typename - card_link { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - system { - ...System - } - } - ${System} - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${ContentPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${CollectionPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/Blocks/DynamicContent.graphql.ts b/packages/trpc/lib/graphql/Fragments/Blocks/DynamicContent.graphql.ts index f7bb40a24..6b863d352 100644 --- a/packages/trpc/lib/graphql/Fragments/Blocks/DynamicContent.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Blocks/DynamicContent.graphql.ts @@ -1,15 +1,5 @@ import { gql } from "graphql-tag" -import { AccountPageRef } from "../AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "../CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../CollectionPage/Ref.graphql" -import { ContentPageRef } from "../ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "../DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "../LoyaltyPage/Ref.graphql" import { AccountPageLink } from "../PageLink/AccountPageLink.graphql" import { CampaignOverviewPageLink } from "../PageLink/CampaignOverviewPageLink.graphql" import { CampaignPageLink } from "../PageLink/CampaignPageLink.graphql" @@ -22,8 +12,6 @@ import { HotelPageLink } from "../PageLink/HotelPageLink.graphql" import { LoyaltyPageLink } from "../PageLink/LoyaltyPageLink.graphql" import { PromoCampaignPageLink } from "../PageLink/PromoCampaignPageLink.graphql" import { StartPageLink } from "../PageLink/StartPageLink.graphql" -import { PromoCampaignPageRef } from "../PromoCampaignPage/Ref.graphql" -import { StartPageRef } from "../StartPage/Ref.graphql" export const DynamicContent_AccountPage = gql` fragment DynamicContent_AccountPage on AccountPageContentDynamicContent { @@ -69,46 +57,6 @@ export const DynamicContent_AccountPage = gql` ${PromoCampaignPageLink} ` -export const DynamicContent_AccountPageRefs = gql` - fragment DynamicContent_AccountPageRefs on AccountPageContentDynamicContent { - dynamic_content { - link { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` - export const DynamicContent_CollectionPage = gql` fragment DynamicContent_CollectionPage on CollectionPageBlocksDynamicContent { dynamic_content { @@ -153,46 +101,6 @@ export const DynamicContent_CollectionPage = gql` ${PromoCampaignPageLink} ` -export const DynamicContent_CollectionPageRefs = gql` - fragment DynamicContent_CollectionPageRefs on CollectionPageBlocksDynamicContent { - dynamic_content { - link { - linkConnection: pageConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` - export const DynamicContent_ContentPage = gql` fragment DynamicContent_ContentPage on ContentPageBlocksDynamicContent { dynamic_content { @@ -237,46 +145,6 @@ export const DynamicContent_ContentPage = gql` ${PromoCampaignPageLink} ` -export const DynamicContent_ContentPageRefs = gql` - fragment DynamicContent_ContentPageRefs on ContentPageBlocksDynamicContent { - dynamic_content { - link { - linkConnection: pageConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` - export const DynamicContent_LoyaltyPage = gql` fragment DynamicContent_LoyaltyPage on LoyaltyPageBlocksDynamicContent { dynamic_content { @@ -320,43 +188,3 @@ export const DynamicContent_LoyaltyPage = gql` ${StartPageLink} ${PromoCampaignPageLink} ` - -export const DynamicContent_LoyaltyPageRefs = gql` - fragment DynamicContent_LoyaltyPageRefs on LoyaltyPageBlocksDynamicContent { - dynamic_content { - link { - linkConnection: pageConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/Blocks/FullWidthCampaign.graphql.ts b/packages/trpc/lib/graphql/Fragments/Blocks/FullWidthCampaign.graphql.ts index 57a0368dd..cebe4cb58 100644 --- a/packages/trpc/lib/graphql/Fragments/Blocks/FullWidthCampaign.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Blocks/FullWidthCampaign.graphql.ts @@ -1,15 +1,5 @@ import { gql } from "graphql-tag" -import { AccountPageRef } from "../AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "../CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../CollectionPage/Ref.graphql" -import { ContentPageRef } from "../ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "../DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "../LoyaltyPage/Ref.graphql" import { AccountPageLink } from "../PageLink/AccountPageLink.graphql" import { CampaignOverviewPageLink } from "../PageLink/CampaignOverviewPageLink.graphql" import { CampaignPageLink } from "../PageLink/CampaignPageLink.graphql" @@ -21,7 +11,6 @@ import { DestinationOverviewPageLink } from "../PageLink/DestinationOverviewPage import { HotelPageLink } from "../PageLink/HotelPageLink.graphql" import { LoyaltyPageLink } from "../PageLink/LoyaltyPageLink.graphql" import { PromoCampaignPageLink } from "../PageLink/PromoCampaignPageLink.graphql" -import { PromoCampaignPageRef } from "../PromoCampaignPage/Ref.graphql" export const FullWidthCampaign = gql` fragment FullWidthCampaign on FullWidthCampaign { @@ -101,62 +90,3 @@ export const FullWidthCampaign = gql` ${DestinationOverviewPageLink} ${PromoCampaignPageLink} ` - -export const FullWidthCampaignRefs = gql` - fragment FullWidthCampaignRefs on FullWidthCampaign { - primary_button { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...PromoCampaignPageRef - } - } - } - } - secondary_button { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...PromoCampaignPageRef - } - } - } - } - system { - ...System - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${ContentPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${CollectionPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${PromoCampaignPageRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/Blocks/JoinScandicFriends.graphql.ts b/packages/trpc/lib/graphql/Fragments/Blocks/JoinScandicFriends.graphql.ts index 90055862c..3bd555bf2 100644 --- a/packages/trpc/lib/graphql/Fragments/Blocks/JoinScandicFriends.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Blocks/JoinScandicFriends.graphql.ts @@ -1,15 +1,5 @@ import { gql } from "graphql-tag" -import { AccountPageRef } from "../AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "../CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../CollectionPage/Ref.graphql" -import { ContentPageRef } from "../ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "../DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "../LoyaltyPage/Ref.graphql" import { AccountPageLink } from "../PageLink/AccountPageLink.graphql" import { CampaignOverviewPageLink } from "../PageLink/CampaignOverviewPageLink.graphql" import { CampaignPageLink } from "../PageLink/CampaignPageLink.graphql" @@ -21,7 +11,6 @@ import { DestinationOverviewPageLink } from "../PageLink/DestinationOverviewPage import { HotelPageLink } from "../PageLink/HotelPageLink.graphql" import { LoyaltyPageLink } from "../PageLink/LoyaltyPageLink.graphql" import { PromoCampaignPageLink } from "../PageLink/PromoCampaignPageLink.graphql" -import { PromoCampaignPageRef } from "../PromoCampaignPage/Ref.graphql" export const JoinScandicFriends_StartPage = gql` fragment JoinScandicFriends_StartPage on StartPageBlocksJoinScandicFriends { @@ -76,41 +65,3 @@ export const JoinScandicFriends_StartPage = gql` ${LoyaltyPageLink} ${PromoCampaignPageLink} ` - -export const JoinScandicFriends_StartPageRefs = gql` - fragment JoinScandicFriends_StartPageRefs on StartPageBlocksJoinScandicFriends { - join_scandic_friends { - primary_button { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${PromoCampaignPageRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/Blocks/Jotform.graphql.ts b/packages/trpc/lib/graphql/Fragments/Blocks/Jotform.graphql.ts index bc29d6884..ca64f66d1 100644 --- a/packages/trpc/lib/graphql/Fragments/Blocks/Jotform.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Blocks/Jotform.graphql.ts @@ -1,6 +1,6 @@ import { gql } from "graphql-tag" -import { Jotform, JotformRef } from "../Jotform.graphql" +import { Jotform } from "../Jotform.graphql" export const Jotform_ContentPage = gql` fragment Jotform_ContentPage on ContentPageBlocksJotform { __typename @@ -16,19 +16,3 @@ export const Jotform_ContentPage = gql` } ${Jotform} ` - -export const Jotform_ContentPageRefs = gql` - fragment Jotform_ContentPageRefs on ContentPageBlocksJotform { - __typename - jotform { - formConnection { - edges { - node { - ...JotformRef - } - } - } - } - } - ${JotformRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/Blocks/Refs/Accordion.graphql.ts b/packages/trpc/lib/graphql/Fragments/Blocks/Refs/Accordion.graphql.ts deleted file mode 100644 index a0d00e923..000000000 --- a/packages/trpc/lib/graphql/Fragments/Blocks/Refs/Accordion.graphql.ts +++ /dev/null @@ -1,94 +0,0 @@ -import { gql } from "graphql-tag" - -import { AccountPageRef } from "../../AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "../../CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../../CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../../CollectionPage/Ref.graphql" -import { ContentPageRef } from "../../ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../../DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../../DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "../../DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../../HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "../../LoyaltyPage/Ref.graphql" -import { PromoCampaignPageRef } from "../../PromoCampaignPage/Ref.graphql" -import { StartPageRef } from "../../StartPage/Ref.graphql" - -export const AccordionBlockRefs = gql` - fragment AccordionBlockRefs on Accordion { - questions { - answer { - embedded_itemsConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` - -export const GlobalAccordionBlockRefs = gql` - fragment GlobalAccordionBlockRefs on GlobalAccordion { - questions { - answer { - embedded_itemsConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/Blocks/Refs/Card.graphql.ts b/packages/trpc/lib/graphql/Fragments/Blocks/Refs/Card.graphql.ts deleted file mode 100644 index 1326105e9..000000000 --- a/packages/trpc/lib/graphql/Fragments/Blocks/Refs/Card.graphql.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { gql } from "graphql-tag" - -import { AccountPageRef } from "../../AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "../../CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../../CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../../CollectionPage/Ref.graphql" -import { ContentPageRef } from "../../ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../../DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../../DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "../../DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../../HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "../../LoyaltyPage/Ref.graphql" -import { PromoCampaignPageRef } from "../../PromoCampaignPage/Ref.graphql" -import { StartPageRef } from "../../StartPage/Ref.graphql" -import { System } from "../../System.graphql" - -export const CardBlockRef = gql` - fragment CardBlockRef on Card { - secondary_button { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - primary_button { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - system { - ...System - } - } - ${System} - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/Blocks/Refs/InfoCard.graphql.ts b/packages/trpc/lib/graphql/Fragments/Blocks/Refs/InfoCard.graphql.ts deleted file mode 100644 index f329a1285..000000000 --- a/packages/trpc/lib/graphql/Fragments/Blocks/Refs/InfoCard.graphql.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { gql } from "graphql-tag" - -import { AccountPageRef } from "../../AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "../../CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../../CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../../CollectionPage/Ref.graphql" -import { ContentPageRef } from "../../ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../../DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../../DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "../../DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../../HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "../../LoyaltyPage/Ref.graphql" -import { PromoCampaignPageRef } from "../../PromoCampaignPage/Ref.graphql" -import { StartPageRef } from "../../StartPage/Ref.graphql" - -export const InfoCardBlockRef = gql` - fragment InfoCardBlockRef on InfoCard { - secondary_button { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - primary_button { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - system { - ...System - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/Blocks/Refs/LoyaltyCard.graphql.ts b/packages/trpc/lib/graphql/Fragments/Blocks/Refs/LoyaltyCard.graphql.ts deleted file mode 100644 index b6313a366..000000000 --- a/packages/trpc/lib/graphql/Fragments/Blocks/Refs/LoyaltyCard.graphql.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { gql } from "graphql-tag" - -import { AccountPageRef } from "../../AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "../../CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../../CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../../CollectionPage/Ref.graphql" -import { ContentPageRef } from "../../ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../../DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../../DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "../../DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../../HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "../../LoyaltyPage/Ref.graphql" -import { PromoCampaignPageRef } from "../../PromoCampaignPage/Ref.graphql" -import { StartPageRef } from "../../StartPage/Ref.graphql" -import { System } from "../../System.graphql" - -export const LoyaltyCardBlockRef = gql` - fragment LoyaltyCardBlockRef on LoyaltyCard { - link { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - system { - ...System - } - } - ${System} - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/Blocks/Refs/TeaserCard.graphql.ts b/packages/trpc/lib/graphql/Fragments/Blocks/Refs/TeaserCard.graphql.ts deleted file mode 100644 index c1e15fc49..000000000 --- a/packages/trpc/lib/graphql/Fragments/Blocks/Refs/TeaserCard.graphql.ts +++ /dev/null @@ -1,141 +0,0 @@ -import { gql } from "graphql-tag" - -import { AccountPageRef } from "../../AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "../../CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../../CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../../CollectionPage/Ref.graphql" -import { ContentPageRef } from "../../ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../../DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../../DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "../../DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../../HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "../../LoyaltyPage/Ref.graphql" -import { PromoCampaignPageRef } from "../../PromoCampaignPage/Ref.graphql" -import { StartPageRef } from "../../StartPage/Ref.graphql" - -export const TeaserCardBlockRef = gql` - fragment TeaserCardBlockRef on TeaserCard { - secondary_button { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - primary_button { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - sidepeek_content { - content { - embedded_itemsConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - primary_button { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - secondary_button { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - system { - ...System - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/Blocks/Shortcuts.graphql.ts b/packages/trpc/lib/graphql/Fragments/Blocks/Shortcuts.graphql.ts index 6cf58aa8a..63e23f3f1 100644 --- a/packages/trpc/lib/graphql/Fragments/Blocks/Shortcuts.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Blocks/Shortcuts.graphql.ts @@ -1,15 +1,5 @@ import { gql } from "graphql-tag" -import { AccountPageRef } from "../AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "../CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../CollectionPage/Ref.graphql" -import { ContentPageRef } from "../ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "../DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "../LoyaltyPage/Ref.graphql" import { AccountPageLink } from "../PageLink/AccountPageLink.graphql" import { CampaignOverviewPageLink } from "../PageLink/CampaignOverviewPageLink.graphql" import { CampaignPageLink } from "../PageLink/CampaignPageLink.graphql" @@ -22,8 +12,6 @@ import { HotelPageLink } from "../PageLink/HotelPageLink.graphql" import { LoyaltyPageLink } from "../PageLink/LoyaltyPageLink.graphql" import { PromoCampaignPageLink } from "../PageLink/PromoCampaignPageLink.graphql" import { StartPageLink } from "../PageLink/StartPageLink.graphql" -import { PromoCampaignPageRef } from "../PromoCampaignPage/Ref.graphql" -import { StartPageRef } from "../StartPage/Ref.graphql" export const Shortcuts = gql` fragment Shortcuts on Shortcuts { @@ -108,77 +96,3 @@ export const Shortcuts_LoyaltyPage = gql` } ${Shortcuts} ` - -export const ShortcutsRefs = gql` - fragment ShortcutsRefs on Shortcuts { - shortcuts { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` - -export const Shortcuts_AccountPageRefs = gql` - fragment Shortcuts_AccountPageRefs on AccountPageContentShortcuts { - shortcuts { - ...ShortcutsRefs - } - } - ${ShortcutsRefs} -` - -export const Shortcuts_CollectionPageRefs = gql` - fragment Shortcuts_CollectionPageRefs on CollectionPageBlocksShortcuts { - shortcuts { - ...ShortcutsRefs - } - } - ${ShortcutsRefs} -` - -export const Shortcuts_ContentPageRefs = gql` - fragment Shortcuts_ContentPageRefs on ContentPageBlocksShortcuts { - shortcuts { - ...ShortcutsRefs - } - } - ${ShortcutsRefs} -` - -export const Shortcuts_LoyaltyPageRefs = gql` - fragment Shortcuts_LoyaltyPageRefs on LoyaltyPageBlocksShortcuts { - shortcuts { - ...ShortcutsRefs - } - } - ${ShortcutsRefs} -` diff --git a/packages/trpc/lib/graphql/Fragments/Blocks/TextCols.graphql.ts b/packages/trpc/lib/graphql/Fragments/Blocks/TextCols.graphql.ts index e3ec81c54..1d500e198 100644 --- a/packages/trpc/lib/graphql/Fragments/Blocks/TextCols.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Blocks/TextCols.graphql.ts @@ -1,15 +1,5 @@ import { gql } from "graphql-tag" -import { AccountPageRef } from "../AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "../CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../CollectionPage/Ref.graphql" -import { ContentPageRef } from "../ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "../DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "../LoyaltyPage/Ref.graphql" import { AccountPageLink } from "../PageLink/AccountPageLink.graphql" import { CampaignOverviewPageLink } from "../PageLink/CampaignOverviewPageLink.graphql" import { CampaignPageLink } from "../PageLink/CampaignPageLink.graphql" @@ -22,8 +12,6 @@ import { HotelPageLink } from "../PageLink/HotelPageLink.graphql" import { LoyaltyPageLink } from "../PageLink/LoyaltyPageLink.graphql" import { PromoCampaignPageLink } from "../PageLink/PromoCampaignPageLink.graphql" import { StartPageLink } from "../PageLink/StartPageLink.graphql" -import { PromoCampaignPageRef } from "../PromoCampaignPage/Ref.graphql" -import { StartPageRef } from "../StartPage/Ref.graphql" export const TextCols_ContentPage = gql` fragment TextCols_ContentPage on ContentPageBlocksTextCols { @@ -68,47 +56,3 @@ export const TextCols_ContentPage = gql` ${StartPageLink} ${PromoCampaignPageLink} ` - -export const TextCols_ContentPageRef = gql` - fragment TextCols_ContentPageRef on ContentPageBlocksTextCols { - text_cols { - columns { - title - text { - json - embedded_itemsConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/Blocks/UspGrid.graphql.ts b/packages/trpc/lib/graphql/Fragments/Blocks/UspGrid.graphql.ts index 79d82f72d..45365c986 100644 --- a/packages/trpc/lib/graphql/Fragments/Blocks/UspGrid.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Blocks/UspGrid.graphql.ts @@ -1,15 +1,5 @@ import { gql } from "graphql-tag" -import { AccountPageRef } from "../AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "../CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../CollectionPage/Ref.graphql" -import { ContentPageRef } from "../ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "../DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "../LoyaltyPage/Ref.graphql" import { AccountPageLink } from "../PageLink/AccountPageLink.graphql" import { CampaignOverviewPageLink } from "../PageLink/CampaignOverviewPageLink.graphql" import { CampaignPageLink } from "../PageLink/CampaignPageLink.graphql" @@ -22,8 +12,6 @@ import { HotelPageLink } from "../PageLink/HotelPageLink.graphql" import { LoyaltyPageLink } from "../PageLink/LoyaltyPageLink.graphql" import { PromoCampaignPageLink } from "../PageLink/PromoCampaignPageLink.graphql" import { StartPageLink } from "../PageLink/StartPageLink.graphql" -import { PromoCampaignPageRef } from "../PromoCampaignPage/Ref.graphql" -import { StartPageRef } from "../StartPage/Ref.graphql" export const UspGrid_ContentPage = gql` fragment UspGrid_ContentPage on ContentPageBlocksUspGrid { @@ -80,56 +68,6 @@ export const UspGrid_ContentPage = gql` ${PromoCampaignPageLink} ` -export const UspGrid_ContentPageRefs = gql` - fragment UspGrid_ContentPageRefs on ContentPageBlocksUspGrid { - usp_grid { - cardsConnection { - edges { - node { - ... on UspGrid { - usp_card { - text { - embedded_itemsConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - } - } - } - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` - export const UspGrid_CollectionPage = gql` fragment UspGrid_CollectionPage on CollectionPageBlocksUspGrid { __typename @@ -183,52 +121,3 @@ export const UspGrid_CollectionPage = gql` ${StartPageLink} ${PromoCampaignPageLink} ` - -export const UspGrid_CollectionPageRefs = gql` - fragment UspGrid_CollectionPageRefs on CollectionPageBlocksUspGrid { - usp_grid { - cardsConnection { - edges { - node { - ... on UspGrid { - usp_card { - text { - embedded_itemsConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - } - } - } - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/Blocks/Video.graphql.ts b/packages/trpc/lib/graphql/Fragments/Blocks/Video.graphql.ts index 83a31bd94..580fb532e 100644 --- a/packages/trpc/lib/graphql/Fragments/Blocks/Video.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Blocks/Video.graphql.ts @@ -1,6 +1,6 @@ import { gql } from "graphql-tag" -import { Video, VideoRef } from "../Video.graphql" +import { Video } from "../Video.graphql" export const Video_ContentPage = gql` fragment Video_ContentPage on ContentPageBlocksVideo { @@ -11,13 +11,3 @@ export const Video_ContentPage = gql` } ${Video} ` - -export const Video_ContentPageRefs = gql` - fragment Video_ContentPageRefs on ContentPageBlocksVideo { - __typename - video { - ...VideoRef - } - } - ${VideoRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/Blocks/VideoCard.graphql.ts b/packages/trpc/lib/graphql/Fragments/Blocks/VideoCard.graphql.ts index fc4e9ab86..88c8b09cd 100644 --- a/packages/trpc/lib/graphql/Fragments/Blocks/VideoCard.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Blocks/VideoCard.graphql.ts @@ -1,7 +1,6 @@ import { gql } from "graphql-tag" -import { System } from "../System.graphql" -import { Video, VideoRef } from "../Video.graphql" +import { Video } from "../Video.graphql" const VideoQuoteCard = gql` fragment VideoQuoteCard on VideoQuoteCard { @@ -84,83 +83,3 @@ export const VideoCard_StartPage = gql` ${VideoQuoteCard} ${VideoTextCard} ` - -const VideoQuoteCardRef = gql` - fragment VideoQuoteCardRef on VideoQuoteCard { - video { - ...VideoRef - } - system { - ...System - } - } - ${VideoRef} - ${System} -` - -const VideoTextCardRef = gql` - fragment VideoTextCardRef on VideoTextCard { - video { - ...VideoRef - } - system { - ...System - } - } - ${VideoRef} - ${System} -` - -export const VideoCard_ContentPageRefs = gql` - fragment VideoCard_ContentPageRefs on ContentPageBlocksVideoCard { - video_card { - video_cardConnection { - edges { - node { - __typename - ...VideoQuoteCardRef - ...VideoTextCardRef - } - } - } - } - } - ${VideoQuoteCardRef} - ${VideoTextCardRef} -` - -export const VideoCard_CollectionPageRefs = gql` - fragment VideoCard_CollectionPageRefs on CollectionPageBlocksVideoCard { - video_card { - video_cardConnection { - edges { - node { - __typename - ...VideoQuoteCardRef - ...VideoTextCardRef - } - } - } - } - } - ${VideoQuoteCardRef} - ${VideoTextCardRef} -` - -export const VideoCard_StartPageRefs = gql` - fragment VideoCard_StartPageRefs on StartPageBlocksVideoCard { - video_card { - video_cardConnection { - edges { - node { - __typename - ...VideoQuoteCardRef - ...VideoTextCardRef - } - } - } - } - } - ${VideoQuoteCardRef} - ${VideoTextCardRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/Breadcrumbs/AccountPage.graphql.ts b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/AccountPage.graphql.ts index a2deca746..5001e9d26 100644 --- a/packages/trpc/lib/graphql/Fragments/Breadcrumbs/AccountPage.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/AccountPage.graphql.ts @@ -16,17 +16,3 @@ export const AccountPageBreadcrumb = gql` } ${System} ` - -export const AccountPageBreadcrumbRef = gql` - fragment AccountPageBreadcrumbRef on AccountPage { - web { - breadcrumbs { - title - } - } - system { - ...System - } - } - ${System} -` diff --git a/packages/trpc/lib/graphql/Fragments/Breadcrumbs/Breadcrumbs.graphql.ts b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/Breadcrumbs.graphql.ts index b11fb87d9..ebcf24256 100644 --- a/packages/trpc/lib/graphql/Fragments/Breadcrumbs/Breadcrumbs.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/Breadcrumbs.graphql.ts @@ -1,45 +1,15 @@ import { gql } from "graphql-tag" -import { - AccountPageBreadcrumb, - AccountPageBreadcrumbRef, -} from "./AccountPage.graphql" -import { - CampaignOverviewPageBreadcrumb, - CampaignOverviewPageBreadcrumbRef, -} from "./CampaignOverviewPage.graphql" -import { - CampaignPageBreadcrumb, - CampaignPageBreadcrumbRef, -} from "./CampaignPage.graphql" -import { - CollectionPageBreadcrumb, - CollectionPageBreadcrumbRef, -} from "./CollectionPage.graphql" -import { - ContentPageBreadcrumb, - ContentPageBreadcrumbRef, -} from "./ContentPage.graphql" -import { - DestinationCityPageBreadcrumb, - DestinationCityPageBreadcrumbRef, -} from "./DestinationCityPage.graphql" -import { - DestinationCountryPageBreadcrumb, - DestinationCountryPageBreadcrumbRef, -} from "./DestinationCountryPage.graphql" -import { - DestinationOverviewPageBreadcrumb, - DestinationOverviewPageBreadcrumbRef, -} from "./DestinationOverviewPage.graphql" -import { - HotelPageBreadcrumb, - HotelPageBreadcrumbRef, -} from "./HotelPage.graphql" -import { - LoyaltyPageBreadcrumb, - LoyaltyPageBreadcrumbRef, -} from "./LoyaltyPage.graphql" +import { AccountPageBreadcrumb } from "./AccountPage.graphql" +import { CampaignOverviewPageBreadcrumb } from "./CampaignOverviewPage.graphql" +import { CampaignPageBreadcrumb } from "./CampaignPage.graphql" +import { CollectionPageBreadcrumb } from "./CollectionPage.graphql" +import { ContentPageBreadcrumb } from "./ContentPage.graphql" +import { DestinationCityPageBreadcrumb } from "./DestinationCityPage.graphql" +import { DestinationCountryPageBreadcrumb } from "./DestinationCountryPage.graphql" +import { DestinationOverviewPageBreadcrumb } from "./DestinationOverviewPage.graphql" +import { HotelPageBreadcrumb } from "./HotelPage.graphql" +import { LoyaltyPageBreadcrumb } from "./LoyaltyPage.graphql" export const Breadcrumbs = gql` fragment Breadcrumbs on Breadcrumbs { @@ -73,36 +43,3 @@ export const Breadcrumbs = gql` ${HotelPageBreadcrumb} ${LoyaltyPageBreadcrumb} ` - -export const BreadcrumbsRefs = gql` - fragment BreadcrumbsRefs on Breadcrumbs { - title - parentsConnection { - edges { - node { - __typename - ...AccountPageBreadcrumbRef - ...CampaignOverviewPageBreadcrumbRef - ...CampaignPageBreadcrumbRef - ...CollectionPageBreadcrumbRef - ...ContentPageBreadcrumbRef - ...DestinationCityPageBreadcrumbRef - ...DestinationCountryPageBreadcrumbRef - ...DestinationOverviewPageBreadcrumbRef - ...HotelPageBreadcrumbRef - ...LoyaltyPageBreadcrumbRef - } - } - } - } - ${AccountPageBreadcrumbRef} - ${CampaignOverviewPageBreadcrumbRef} - ${CampaignPageBreadcrumbRef} - ${CollectionPageBreadcrumbRef} - ${ContentPageBreadcrumbRef} - ${DestinationCityPageBreadcrumbRef} - ${DestinationCountryPageBreadcrumbRef} - ${DestinationOverviewPageBreadcrumbRef} - ${HotelPageBreadcrumbRef} - ${LoyaltyPageBreadcrumbRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/Breadcrumbs/CampaignOverviewPage.graphql.ts b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/CampaignOverviewPage.graphql.ts index c351c0fc1..b38a93de2 100644 --- a/packages/trpc/lib/graphql/Fragments/Breadcrumbs/CampaignOverviewPage.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/CampaignOverviewPage.graphql.ts @@ -16,17 +16,3 @@ export const CampaignOverviewPageBreadcrumb = gql` } ${System} ` - -export const CampaignOverviewPageBreadcrumbRef = gql` - fragment CampaignOverviewPageBreadcrumbRef on CampaignOverviewPage { - web { - breadcrumbs { - title - } - } - system { - ...System - } - } - ${System} -` diff --git a/packages/trpc/lib/graphql/Fragments/Breadcrumbs/CampaignPage.graphql.ts b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/CampaignPage.graphql.ts index 02f763287..857a4d469 100644 --- a/packages/trpc/lib/graphql/Fragments/Breadcrumbs/CampaignPage.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/CampaignPage.graphql.ts @@ -16,17 +16,3 @@ export const CampaignPageBreadcrumb = gql` } ${System} ` - -export const CampaignPageBreadcrumbRef = gql` - fragment CampaignPageBreadcrumbRef on CampaignPage { - web { - breadcrumbs { - title - } - } - system { - ...System - } - } - ${System} -` diff --git a/packages/trpc/lib/graphql/Fragments/Breadcrumbs/CollectionPage.graphql.ts b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/CollectionPage.graphql.ts index fc8e15953..f7a84167c 100644 --- a/packages/trpc/lib/graphql/Fragments/Breadcrumbs/CollectionPage.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/CollectionPage.graphql.ts @@ -16,17 +16,3 @@ export const CollectionPageBreadcrumb = gql` } ${System} ` - -export const CollectionPageBreadcrumbRef = gql` - fragment CollectionPageBreadcrumbRef on CollectionPage { - web { - breadcrumbs { - title - } - } - system { - ...System - } - } - ${System} -` diff --git a/packages/trpc/lib/graphql/Fragments/Breadcrumbs/ContentPage.graphql.ts b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/ContentPage.graphql.ts index 58e33de3a..b4f6e2659 100644 --- a/packages/trpc/lib/graphql/Fragments/Breadcrumbs/ContentPage.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/ContentPage.graphql.ts @@ -16,17 +16,3 @@ export const ContentPageBreadcrumb = gql` } ${System} ` - -export const ContentPageBreadcrumbRef = gql` - fragment ContentPageBreadcrumbRef on ContentPage { - web { - breadcrumbs { - title - } - } - system { - ...System - } - } - ${System} -` diff --git a/packages/trpc/lib/graphql/Fragments/Breadcrumbs/DestinationCityPage.graphql.ts b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/DestinationCityPage.graphql.ts index 1fbd91f26..adf75f5d5 100644 --- a/packages/trpc/lib/graphql/Fragments/Breadcrumbs/DestinationCityPage.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/DestinationCityPage.graphql.ts @@ -16,17 +16,3 @@ export const DestinationCityPageBreadcrumb = gql` } ${System} ` - -export const DestinationCityPageBreadcrumbRef = gql` - fragment DestinationCityPageBreadcrumbRef on DestinationCityPage { - web { - breadcrumbs { - title - } - } - system { - ...System - } - } - ${System} -` diff --git a/packages/trpc/lib/graphql/Fragments/Breadcrumbs/DestinationCountryPage.graphql.ts b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/DestinationCountryPage.graphql.ts index ee83ef99b..7dd36b632 100644 --- a/packages/trpc/lib/graphql/Fragments/Breadcrumbs/DestinationCountryPage.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/DestinationCountryPage.graphql.ts @@ -16,17 +16,3 @@ export const DestinationCountryPageBreadcrumb = gql` } ${System} ` - -export const DestinationCountryPageBreadcrumbRef = gql` - fragment DestinationCountryPageBreadcrumbRef on DestinationCountryPage { - web { - breadcrumbs { - title - } - } - system { - ...System - } - } - ${System} -` diff --git a/packages/trpc/lib/graphql/Fragments/Breadcrumbs/DestinationOverviewPage.graphql.ts b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/DestinationOverviewPage.graphql.ts index bda43e2c3..ed2a1fcd1 100644 --- a/packages/trpc/lib/graphql/Fragments/Breadcrumbs/DestinationOverviewPage.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/DestinationOverviewPage.graphql.ts @@ -16,17 +16,3 @@ export const DestinationOverviewPageBreadcrumb = gql` } ${System} ` - -export const DestinationOverviewPageBreadcrumbRef = gql` - fragment DestinationOverviewPageBreadcrumbRef on DestinationOverviewPage { - web { - breadcrumbs { - title - } - } - system { - ...System - } - } - ${System} -` diff --git a/packages/trpc/lib/graphql/Fragments/Breadcrumbs/HotelPage.graphql.ts b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/HotelPage.graphql.ts index c7e1764cf..52b5ef95c 100644 --- a/packages/trpc/lib/graphql/Fragments/Breadcrumbs/HotelPage.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/HotelPage.graphql.ts @@ -16,17 +16,3 @@ export const HotelPageBreadcrumb = gql` } ${System} ` - -export const HotelPageBreadcrumbRef = gql` - fragment HotelPageBreadcrumbRef on HotelPage { - web { - breadcrumbs { - title - } - } - system { - ...System - } - } - ${System} -` diff --git a/packages/trpc/lib/graphql/Fragments/Breadcrumbs/LoyaltyPage.graphql.ts b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/LoyaltyPage.graphql.ts index 1903e6a02..e2a257e97 100644 --- a/packages/trpc/lib/graphql/Fragments/Breadcrumbs/LoyaltyPage.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Breadcrumbs/LoyaltyPage.graphql.ts @@ -16,17 +16,3 @@ export const LoyaltyPageBreadcrumb = gql` } ${System} ` - -export const LoyaltyPageBreadcrumbRef = gql` - fragment LoyaltyPageBreadcrumbRef on LoyaltyPage { - web { - breadcrumbs { - title - } - } - system { - ...System - } - } - ${System} -` diff --git a/packages/trpc/lib/graphql/Fragments/CampaignOverviewPage/NavigationLinks.graphql.ts b/packages/trpc/lib/graphql/Fragments/CampaignOverviewPage/NavigationLinks.graphql.ts index 890925293..422a16ea1 100644 --- a/packages/trpc/lib/graphql/Fragments/CampaignOverviewPage/NavigationLinks.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/CampaignOverviewPage/NavigationLinks.graphql.ts @@ -1,15 +1,5 @@ import { gql } from "graphql-tag" -import { AccountPageRef } from "../AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "../CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../CollectionPage/Ref.graphql" -import { ContentPageRef } from "../ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "../DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "../LoyaltyPage/Ref.graphql" import { AccountPageLink } from "../PageLink/AccountPageLink.graphql" import { CampaignOverviewPageLink } from "../PageLink/CampaignOverviewPageLink.graphql" import { CampaignPageLink } from "../PageLink/CampaignPageLink.graphql" @@ -22,8 +12,6 @@ import { HotelPageLink } from "../PageLink/HotelPageLink.graphql" import { LoyaltyPageLink } from "../PageLink/LoyaltyPageLink.graphql" import { PromoCampaignPageLink } from "../PageLink/PromoCampaignPageLink.graphql" import { StartPageLink } from "../PageLink/StartPageLink.graphql" -import { PromoCampaignPageRef } from "../PromoCampaignPage/Ref.graphql" -import { StartPageRef } from "../StartPage/Ref.graphql" export const NavigationLinks_CampaignOverviewPage = gql` fragment NavigationLinks_CampaignOverviewPage on CampaignOverviewPageHeader { @@ -63,41 +51,3 @@ export const NavigationLinks_CampaignOverviewPage = gql` ${StartPageLink} ${PromoCampaignPageLink} ` - -export const NavigationLinksRef_CampaignOverviewPage = gql` - fragment NavigationLinksRef_CampaignOverviewPage on CampaignOverviewPageHeader { - navigation_links { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/CampaignOverviewPage/Ref.graphql.ts b/packages/trpc/lib/graphql/Fragments/CampaignOverviewPage/Ref.graphql.ts deleted file mode 100644 index 8f7296b02..000000000 --- a/packages/trpc/lib/graphql/Fragments/CampaignOverviewPage/Ref.graphql.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { gql } from "graphql-tag" - -import { System } from "../System.graphql" - -export const CampaignOverviewPageRef = gql` - fragment CampaignOverviewPageRef on CampaignOverviewPage { - system { - ...System - } - } - ${System} -` diff --git a/packages/trpc/lib/graphql/Fragments/CampaignOverviewPage/TopCampaign.graphql.ts b/packages/trpc/lib/graphql/Fragments/CampaignOverviewPage/TopCampaign.graphql.ts index 2e6336194..e1f4dd642 100644 --- a/packages/trpc/lib/graphql/Fragments/CampaignOverviewPage/TopCampaign.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/CampaignOverviewPage/TopCampaign.graphql.ts @@ -3,7 +3,6 @@ import { gql } from "graphql-tag" import { HotelListing_CampaignPage } from "../Blocks/HotelListing.graphql" import { Hero_CampaignPage } from "../CampaignPage/Hero.graphql" import { CampaignPageIncludedHotels } from "../CampaignPage/IncludedHotels.graphql" -import { System } from "../System.graphql" export const TopCampaign = gql` fragment TopCampaign on CampaignPage { @@ -22,15 +21,6 @@ export const TopCampaign = gql` ${Hero_CampaignPage} ` -export const TopCampaignRef = gql` - fragment TopCampaignRef on CampaignPage { - system { - ...System - } - } - ${System} -` - export const TopPromoCampaign = gql` fragment TopPromoCampaign on PromoCampaignPage { url @@ -41,12 +31,3 @@ export const TopPromoCampaign = gql` } } ` - -export const TopPromoCampaignRef = gql` - fragment TopPromoCampaignRef on PromoCampaignPage { - system { - ...System - } - } - ${System} -` diff --git a/packages/trpc/lib/graphql/Fragments/CampaignPage/Hero.graphql.ts b/packages/trpc/lib/graphql/Fragments/CampaignPage/Hero.graphql.ts index 7063c987f..42b063124 100644 --- a/packages/trpc/lib/graphql/Fragments/CampaignPage/Hero.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/CampaignPage/Hero.graphql.ts @@ -1,15 +1,5 @@ import { gql } from "graphql-tag" -import { AccountPageRef } from "../AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "../CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../CollectionPage/Ref.graphql" -import { ContentPageRef } from "../ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "../DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "../LoyaltyPage/Ref.graphql" import { AccountPageLink } from "../PageLink/AccountPageLink.graphql" import { CampaignOverviewPageLink } from "../PageLink/CampaignOverviewPageLink.graphql" import { CampaignPageLink } from "../PageLink/CampaignPageLink.graphql" @@ -22,8 +12,6 @@ import { HotelPageLink } from "../PageLink/HotelPageLink.graphql" import { LoyaltyPageLink } from "../PageLink/LoyaltyPageLink.graphql" import { PromoCampaignPageLink } from "../PageLink/PromoCampaignPageLink.graphql" import { StartPageLink } from "../PageLink/StartPageLink.graphql" -import { PromoCampaignPageRef } from "../PromoCampaignPage/Ref.graphql" -import { StartPageRef } from "../StartPage/Ref.graphql" export const Hero_CampaignPage = gql` fragment Hero_CampaignPage on CampaignPage { @@ -77,43 +65,3 @@ export const Hero_CampaignPage = gql` ${StartPageLink} ${PromoCampaignPageLink} ` - -export const HeroRef_CampaignPage = gql` - fragment HeroRef_CampaignPage on CampaignPage { - hero { - button { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/CampaignPage/Ref.graphql.ts b/packages/trpc/lib/graphql/Fragments/CampaignPage/Ref.graphql.ts deleted file mode 100644 index 3f3a7dd30..000000000 --- a/packages/trpc/lib/graphql/Fragments/CampaignPage/Ref.graphql.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { gql } from "graphql-tag" - -import { System } from "../System.graphql" - -export const CampaignPageRef = gql` - fragment CampaignPageRef on CampaignPage { - system { - ...System - } - } - ${System} -` diff --git a/packages/trpc/lib/graphql/Fragments/CollectionPage/NavigationLinks.graphql.ts b/packages/trpc/lib/graphql/Fragments/CollectionPage/NavigationLinks.graphql.ts index 18ba56d20..12994cdf7 100644 --- a/packages/trpc/lib/graphql/Fragments/CollectionPage/NavigationLinks.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/CollectionPage/NavigationLinks.graphql.ts @@ -1,15 +1,5 @@ import { gql } from "graphql-tag" -import { AccountPageRef } from "../AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "../CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../CollectionPage/Ref.graphql" -import { ContentPageRef } from "../ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "../DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "../LoyaltyPage/Ref.graphql" import { AccountPageLink } from "../PageLink/AccountPageLink.graphql" import { CampaignOverviewPageLink } from "../PageLink/CampaignOverviewPageLink.graphql" import { CampaignPageLink } from "../PageLink/CampaignPageLink.graphql" @@ -22,8 +12,6 @@ import { HotelPageLink } from "../PageLink/HotelPageLink.graphql" import { LoyaltyPageLink } from "../PageLink/LoyaltyPageLink.graphql" import { PromoCampaignPageLink } from "../PageLink/PromoCampaignPageLink.graphql" import { StartPageLink } from "../PageLink/StartPageLink.graphql" -import { PromoCampaignPageRef } from "../PromoCampaignPage/Ref.graphql" -import { StartPageRef } from "../StartPage/Ref.graphql" export const NavigationLinks_CollectionPage = gql` fragment NavigationLinks_CollectionPage on CollectionPageHeader { @@ -63,41 +51,3 @@ export const NavigationLinks_CollectionPage = gql` ${StartPageLink} ${PromoCampaignPageLink} ` - -export const NavigationLinksRef_CollectionPage = gql` - fragment NavigationLinksRef_CollectionPage on CollectionPageHeader { - navigation_links { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/CollectionPage/Ref.graphql.ts b/packages/trpc/lib/graphql/Fragments/CollectionPage/Ref.graphql.ts deleted file mode 100644 index 9c736ceaa..000000000 --- a/packages/trpc/lib/graphql/Fragments/CollectionPage/Ref.graphql.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { gql } from "graphql-tag" - -import { System } from "../System.graphql" - -export const CollectionPageRef = gql` - fragment CollectionPageRef on CollectionPage { - system { - ...System - } - } - ${System} -` diff --git a/packages/trpc/lib/graphql/Fragments/CollectionPage/TopPrimaryButton.graphql.ts b/packages/trpc/lib/graphql/Fragments/CollectionPage/TopPrimaryButton.graphql.ts index 9a0d18d78..b24f5390a 100644 --- a/packages/trpc/lib/graphql/Fragments/CollectionPage/TopPrimaryButton.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/CollectionPage/TopPrimaryButton.graphql.ts @@ -1,15 +1,5 @@ import { gql } from "graphql-tag" -import { AccountPageRef } from "../AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "../CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../CollectionPage/Ref.graphql" -import { ContentPageRef } from "../ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "../DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "../LoyaltyPage/Ref.graphql" import { AccountPageLink } from "../PageLink/AccountPageLink.graphql" import { CampaignOverviewPageLink } from "../PageLink/CampaignOverviewPageLink.graphql" import { CampaignPageLink } from "../PageLink/CampaignPageLink.graphql" @@ -22,8 +12,6 @@ import { HotelPageLink } from "../PageLink/HotelPageLink.graphql" import { LoyaltyPageLink } from "../PageLink/LoyaltyPageLink.graphql" import { PromoCampaignPageLink } from "../PageLink/PromoCampaignPageLink.graphql" import { StartPageLink } from "../PageLink/StartPageLink.graphql" -import { PromoCampaignPageRef } from "../PromoCampaignPage/Ref.graphql" -import { StartPageRef } from "../StartPage/Ref.graphql" export const TopPrimaryButton_CollectionPage = gql` fragment TopPrimaryButton_CollectionPage on CollectionPageHeader { @@ -68,41 +56,3 @@ export const TopPrimaryButton_CollectionPage = gql` ${StartPageLink} ${PromoCampaignPageLink} ` - -export const TopPrimaryButtonRef_CollectionPage = gql` - fragment TopPrimaryButtonRef_CollectionPage on CollectionPageHeader { - top_primary_button { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/ContentPage/NavigationLinks.graphql.ts b/packages/trpc/lib/graphql/Fragments/ContentPage/NavigationLinks.graphql.ts index 098b84a3a..8523c28af 100644 --- a/packages/trpc/lib/graphql/Fragments/ContentPage/NavigationLinks.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/ContentPage/NavigationLinks.graphql.ts @@ -1,15 +1,5 @@ import { gql } from "graphql-tag" -import { AccountPageRef } from "../AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "../CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../CollectionPage/Ref.graphql" -import { ContentPageRef } from "../ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "../DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "../LoyaltyPage/Ref.graphql" import { AccountPageLink } from "../PageLink/AccountPageLink.graphql" import { CampaignOverviewPageLink } from "../PageLink/CampaignOverviewPageLink.graphql" import { CampaignPageLink } from "../PageLink/CampaignPageLink.graphql" @@ -22,8 +12,6 @@ import { HotelPageLink } from "../PageLink/HotelPageLink.graphql" import { LoyaltyPageLink } from "../PageLink/LoyaltyPageLink.graphql" import { PromoCampaignPageLink } from "../PageLink/PromoCampaignPageLink.graphql" import { StartPageLink } from "../PageLink/StartPageLink.graphql" -import { PromoCampaignPageRef } from "../PromoCampaignPage/Ref.graphql" -import { StartPageRef } from "../StartPage/Ref.graphql" export const NavigationLinks_ContentPage = gql` fragment NavigationLinks_ContentPage on ContentPageHeader { @@ -63,41 +51,3 @@ export const NavigationLinks_ContentPage = gql` ${StartPageLink} ${PromoCampaignPageLink} ` - -export const NavigationLinksRef_ContentPage = gql` - fragment NavigationLinksRef_ContentPage on ContentPageHeader { - navigation_links { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/ContentPage/Ref.graphql.ts b/packages/trpc/lib/graphql/Fragments/ContentPage/Ref.graphql.ts deleted file mode 100644 index 411120c2e..000000000 --- a/packages/trpc/lib/graphql/Fragments/ContentPage/Ref.graphql.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { gql } from "graphql-tag" - -import { System } from "../System.graphql" - -export const ContentPageRef = gql` - fragment ContentPageRef on ContentPage { - system { - ...System - } - } - ${System} -` diff --git a/packages/trpc/lib/graphql/Fragments/ContentPage/TopPrimaryButton.graphql.ts b/packages/trpc/lib/graphql/Fragments/ContentPage/TopPrimaryButton.graphql.ts index 0a0be9a08..23fb877e7 100644 --- a/packages/trpc/lib/graphql/Fragments/ContentPage/TopPrimaryButton.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/ContentPage/TopPrimaryButton.graphql.ts @@ -1,15 +1,5 @@ import { gql } from "graphql-tag" -import { AccountPageRef } from "../AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "../CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../CollectionPage/Ref.graphql" -import { ContentPageRef } from "../ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "../DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "../LoyaltyPage/Ref.graphql" import { AccountPageLink } from "../PageLink/AccountPageLink.graphql" import { CampaignOverviewPageLink } from "../PageLink/CampaignOverviewPageLink.graphql" import { CampaignPageLink } from "../PageLink/CampaignPageLink.graphql" @@ -22,8 +12,6 @@ import { HotelPageLink } from "../PageLink/HotelPageLink.graphql" import { LoyaltyPageLink } from "../PageLink/LoyaltyPageLink.graphql" import { PromoCampaignPageLink } from "../PageLink/PromoCampaignPageLink.graphql" import { StartPageLink } from "../PageLink/StartPageLink.graphql" -import { PromoCampaignPageRef } from "../PromoCampaignPage/Ref.graphql" -import { StartPageRef } from "../StartPage/Ref.graphql" export const TopPrimaryButton_ContentPage = gql` fragment TopPrimaryButton_ContentPage on ContentPageHeader { @@ -68,41 +56,3 @@ export const TopPrimaryButton_ContentPage = gql` ${StartPageLink} ${PromoCampaignPageLink} ` - -export const TopPrimaryButtonRef_ContentPage = gql` - fragment TopPrimaryButtonRef_ContentPage on ContentPageHeader { - top_primary_button { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/DestinationCityPage/Ref.graphql.ts b/packages/trpc/lib/graphql/Fragments/DestinationCityPage/Ref.graphql.ts deleted file mode 100644 index e8cd0d504..000000000 --- a/packages/trpc/lib/graphql/Fragments/DestinationCityPage/Ref.graphql.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { gql } from "graphql-tag" - -import { System } from "../System.graphql" - -export const DestinationCityPageRef = gql` - fragment DestinationCityPageRef on DestinationCityPage { - system { - ...System - } - } - ${System} -` diff --git a/packages/trpc/lib/graphql/Fragments/DestinationCountryPage/Ref.graphql.ts b/packages/trpc/lib/graphql/Fragments/DestinationCountryPage/Ref.graphql.ts deleted file mode 100644 index 0a76a7337..000000000 --- a/packages/trpc/lib/graphql/Fragments/DestinationCountryPage/Ref.graphql.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { gql } from "graphql-tag" - -import { System } from "../System.graphql" - -export const DestinationCountryPageRef = gql` - fragment DestinationCountryPageRef on DestinationCountryPage { - system { - ...System - } - } - ${System} -` diff --git a/packages/trpc/lib/graphql/Fragments/DestinationFilter.graphql.ts b/packages/trpc/lib/graphql/Fragments/DestinationFilter.graphql.ts index ca1293111..f1b1e3bd4 100644 --- a/packages/trpc/lib/graphql/Fragments/DestinationFilter.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/DestinationFilter.graphql.ts @@ -1,14 +1,8 @@ import { gql } from "graphql-tag" -import { - Accordion_DestinationFilterBlocks, - Accordion_DestinationFilterBlocksRefs, -} from "./Blocks/Accordion.graphql" -import { - Content_DestinationFilterBlocks, - Content_DestinationFilterBlocksRefs, -} from "./Blocks/Content.graphql" -import { HotelFilter, HotelFilterRef } from "./HotelFilter.graphql" +import { Accordion_DestinationFilterBlocks } from "./Blocks/Accordion.graphql" +import { Content_DestinationFilterBlocks } from "./Blocks/Content.graphql" +import { HotelFilter } from "./HotelFilter.graphql" export const DestinationFilter = gql` fragment DestinationFilter on DestinationFilter { @@ -31,23 +25,3 @@ export const DestinationFilter = gql` ${Accordion_DestinationFilterBlocks} ${Content_DestinationFilterBlocks} ` - -export const DestinationFilterRef = gql` - fragment DestinationFilterRef on DestinationFilter { - blocks { - __typename - ...Accordion_DestinationFilterBlocksRefs - ...Content_DestinationFilterBlocksRefs - } - filterConnection { - edges { - node { - ...HotelFilterRef - } - } - } - } - ${Accordion_DestinationFilterBlocksRefs} - ${Content_DestinationFilterBlocksRefs} - ${HotelFilterRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/DestinationOverviewPage/Ref.graphql.ts b/packages/trpc/lib/graphql/Fragments/DestinationOverviewPage/Ref.graphql.ts deleted file mode 100644 index a49b1a964..000000000 --- a/packages/trpc/lib/graphql/Fragments/DestinationOverviewPage/Ref.graphql.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { gql } from "graphql-tag" - -import { System } from "../System.graphql" - -export const DestinationOverviewPageRef = gql` - fragment DestinationOverviewPageRef on DestinationOverviewPage { - system { - ...System - } - } - ${System} -` diff --git a/packages/trpc/lib/graphql/Fragments/HotelFilter.graphql.ts b/packages/trpc/lib/graphql/Fragments/HotelFilter.graphql.ts index 536e51a11..92e20ad21 100644 --- a/packages/trpc/lib/graphql/Fragments/HotelFilter.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/HotelFilter.graphql.ts @@ -1,7 +1,5 @@ import { gql } from "graphql-tag" -import { System } from "./System.graphql" - export const HotelFilter = gql` fragment HotelFilter on HotelFilter { title @@ -11,12 +9,3 @@ export const HotelFilter = gql` sort_order } ` - -export const HotelFilterRef = gql` - fragment HotelFilterRef on HotelFilter { - system { - ...System - } - } - ${System} -` diff --git a/packages/trpc/lib/graphql/Fragments/ImageContainer.graphql.ts b/packages/trpc/lib/graphql/Fragments/ImageContainer.graphql.ts index 44955d51d..e314aea2a 100644 --- a/packages/trpc/lib/graphql/Fragments/ImageContainer.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/ImageContainer.graphql.ts @@ -13,12 +13,3 @@ export const ImageContainer = gql` } ${System} ` - -export const ImageContainerRef = gql` - fragment ImageContainerRef on ImageContainer { - system { - ...System - } - } - ${System} -` diff --git a/packages/trpc/lib/graphql/Fragments/Jotform.graphql.ts b/packages/trpc/lib/graphql/Fragments/Jotform.graphql.ts index 30d3cc2fe..996736ec0 100644 --- a/packages/trpc/lib/graphql/Fragments/Jotform.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Jotform.graphql.ts @@ -1,18 +1,7 @@ import { gql } from "graphql-tag" -import { System } from "./System.graphql" - export const Jotform = gql` fragment Jotform on Jotform { form_id } ` - -export const JotformRef = gql` - fragment JotformRef on Jotform { - system { - ...System - } - } - ${System} -` diff --git a/packages/trpc/lib/graphql/Fragments/LoyaltyPage/Ref.graphql.ts b/packages/trpc/lib/graphql/Fragments/LoyaltyPage/Ref.graphql.ts deleted file mode 100644 index fcd5a4d17..000000000 --- a/packages/trpc/lib/graphql/Fragments/LoyaltyPage/Ref.graphql.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { gql } from "graphql-tag" - -import { System } from "../System.graphql" - -export const LoyaltyPageRef = gql` - fragment LoyaltyPageRef on LoyaltyPage { - system { - ...System - } - } - ${System} -` diff --git a/packages/trpc/lib/graphql/Fragments/PromoCampaignPage/Ref.graphql.ts b/packages/trpc/lib/graphql/Fragments/PromoCampaignPage/Ref.graphql.ts deleted file mode 100644 index 14015d8e7..000000000 --- a/packages/trpc/lib/graphql/Fragments/PromoCampaignPage/Ref.graphql.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { gql } from "graphql-tag" - -import { System } from "../System.graphql" - -export const PromoCampaignPageRef = gql` - fragment PromoCampaignPageRef on PromoCampaignPage { - system { - ...System - } - } - ${System} -` diff --git a/packages/trpc/lib/graphql/Fragments/Sidebar/Content.graphql.ts b/packages/trpc/lib/graphql/Fragments/Sidebar/Content.graphql.ts index 587fe27e6..81bdaed63 100644 --- a/packages/trpc/lib/graphql/Fragments/Sidebar/Content.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Sidebar/Content.graphql.ts @@ -1,16 +1,6 @@ import { gql } from "graphql-tag" -import { AccountPageRef } from "../AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "../CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../CollectionPage/Ref.graphql" -import { ContentPageRef } from "../ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "../DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../HotelPage/Ref.graphql" -import { ImageContainer, ImageContainerRef } from "../ImageContainer.graphql" -import { LoyaltyPageRef } from "../LoyaltyPage/Ref.graphql" +import { ImageContainer } from "../ImageContainer.graphql" import { AccountPageLink } from "../PageLink/AccountPageLink.graphql" import { CampaignOverviewPageLink } from "../PageLink/CampaignOverviewPageLink.graphql" import { CampaignPageLink } from "../PageLink/CampaignPageLink.graphql" @@ -23,9 +13,7 @@ import { HotelPageLink } from "../PageLink/HotelPageLink.graphql" import { LoyaltyPageLink } from "../PageLink/LoyaltyPageLink.graphql" import { PromoCampaignPageLink } from "../PageLink/PromoCampaignPageLink.graphql" import { StartPageLink } from "../PageLink/StartPageLink.graphql" -import { PromoCampaignPageRef } from "../PromoCampaignPage/Ref.graphql" -import { StartPageRef } from "../StartPage/Ref.graphql" -import { SysAsset, SysAssetRef } from "../SysAsset.graphql" +import { SysAsset } from "../SysAsset.graphql" export const ContentSidebar_ContentPage = gql` fragment ContentSidebar_ContentPage on ContentPageSidebarContent { @@ -72,50 +60,6 @@ export const ContentSidebar_ContentPage = gql` ${PromoCampaignPageLink} ` -export const ContentSidebar_ContentPageRefs = gql` - fragment ContentSidebar_ContentPageRefs on ContentPageSidebarContent { - content { - content { - embedded_itemsConnection { - edges { - node { - __typename - ...SysAssetRef - ...ImageContainerRef - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - ${SysAssetRef} - ${ImageContainerRef} - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` - export const ContentSidebar_LoyaltyPage = gql` fragment ContentSidebar_LoyaltyPage on LoyaltyPageSidebarContent { content { @@ -160,47 +104,3 @@ export const ContentSidebar_LoyaltyPage = gql` ${StartPageLink} ${PromoCampaignPageLink} ` - -export const ContentSidebar_LoyaltyPageRefs = gql` - fragment ContentSidebar_LoyaltyPageRefs on LoyaltyPageSidebarContent { - content { - content { - embedded_itemsConnection { - edges { - node { - __typename - ...SysAssetRef - ...ImageContainerRef - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - ${SysAssetRef} - ${ImageContainerRef} - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/Sidebar/JoinLoyaltyContact.graphql.ts b/packages/trpc/lib/graphql/Fragments/Sidebar/JoinLoyaltyContact.graphql.ts index 1c5ca14de..264974e45 100644 --- a/packages/trpc/lib/graphql/Fragments/Sidebar/JoinLoyaltyContact.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Sidebar/JoinLoyaltyContact.graphql.ts @@ -1,15 +1,5 @@ import { gql } from "graphql-tag" -import { AccountPageRef } from "../AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "../CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../CollectionPage/Ref.graphql" -import { ContentPageRef } from "../ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "../DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "../LoyaltyPage/Ref.graphql" import { AccountPageLink } from "../PageLink/AccountPageLink.graphql" import { CampaignOverviewPageLink } from "../PageLink/CampaignOverviewPageLink.graphql" import { CampaignPageLink } from "../PageLink/CampaignPageLink.graphql" @@ -22,8 +12,6 @@ import { HotelPageLink } from "../PageLink/HotelPageLink.graphql" import { LoyaltyPageLink } from "../PageLink/LoyaltyPageLink.graphql" import { PromoCampaignPageLink } from "../PageLink/PromoCampaignPageLink.graphql" import { StartPageLink } from "../PageLink/StartPageLink.graphql" -import { PromoCampaignPageRef } from "../PromoCampaignPage/Ref.graphql" -import { StartPageRef } from "../StartPage/Ref.graphql" const ContactFields = gql` fragment ContactFields on ContactFields { @@ -90,46 +78,6 @@ export const JoinLoyaltyContactSidebar_ContentPage = gql` ${PromoCampaignPageLink} ` -export const JoinLoyaltyContactSidebar_ContentPageRefs = gql` - fragment JoinLoyaltyContactSidebar_ContentPageRefs on ContentPageSidebarJoinLoyaltyContact { - join_loyalty_contact { - button { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` - export const JoinLoyaltyContactSidebar_LoyaltyPage = gql` fragment JoinLoyaltyContactSidebar_LoyaltyPage on LoyaltyPageSidebarJoinLoyaltyContact { join_loyalty_contact { @@ -186,43 +134,3 @@ export const JoinLoyaltyContactSidebar_LoyaltyPage = gql` ${StartPageLink} ${PromoCampaignPageLink} ` - -export const JoinLoyaltyContactSidebar_LoyaltyPageRefs = gql` - fragment JoinLoyaltyContactSidebar_LoyaltyPageRefs on LoyaltyPageSidebarJoinLoyaltyContact { - join_loyalty_contact { - button { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/Sidebar/QuickLinks.graphql.ts b/packages/trpc/lib/graphql/Fragments/Sidebar/QuickLinks.graphql.ts index 7e377718f..3335c52d0 100644 --- a/packages/trpc/lib/graphql/Fragments/Sidebar/QuickLinks.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Sidebar/QuickLinks.graphql.ts @@ -1,6 +1,6 @@ import { gql } from "graphql-tag" -import { Shortcuts, ShortcutsRefs } from "../Blocks/Shortcuts.graphql" +import { Shortcuts } from "../Blocks/Shortcuts.graphql" export const QuickLinksSidebar_ContentPage = gql` fragment QuickLinksSidebar_ContentPage on ContentPageSidebarShortcuts { @@ -11,13 +11,3 @@ export const QuickLinksSidebar_ContentPage = gql` } ${Shortcuts} ` - -export const QuickLinksSidebar_ContentPageRefs = gql` - fragment QuickLinksSidebar_ContentPageRefs on ContentPageSidebarShortcuts { - shortcuts { - __typename - ...ShortcutsRefs - } - } - ${ShortcutsRefs} -` diff --git a/packages/trpc/lib/graphql/Fragments/Sidebar/ScriptedCard.graphql.ts b/packages/trpc/lib/graphql/Fragments/Sidebar/ScriptedCard.graphql.ts index 318b86f8e..347d99c60 100644 --- a/packages/trpc/lib/graphql/Fragments/Sidebar/ScriptedCard.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Sidebar/ScriptedCard.graphql.ts @@ -1,7 +1,6 @@ import { gql } from "graphql-tag" import { CardBlock } from "../Blocks/Card.graphql" -import { CardBlockRef } from "../Blocks/Refs/Card.graphql" export const ScriptedCardSidebar_ContentPage = gql` fragment ScriptedCardSidebar_ContentPage on ContentPageSidebarScriptedCard { @@ -20,19 +19,3 @@ export const ScriptedCardSidebar_ContentPage = gql` } ${CardBlock} ` - -export const ScriptedCardSidebar_ContentPageRefs = gql` - fragment ScriptedCardSidebar_ContentPageRefs on ContentPageSidebarScriptedCard { - scripted_card { - scripted_cardConnection { - edges { - node { - __typename - ...CardBlockRef - } - } - } - } - } - ${CardBlockRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/Sidebar/TeaserCard.graphql.ts b/packages/trpc/lib/graphql/Fragments/Sidebar/TeaserCard.graphql.ts index aa7840b80..f084711f4 100644 --- a/packages/trpc/lib/graphql/Fragments/Sidebar/TeaserCard.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Sidebar/TeaserCard.graphql.ts @@ -1,6 +1,5 @@ import { gql } from "graphql-tag" -import { TeaserCardBlockRef } from "../Blocks/Refs/TeaserCard.graphql" import { TeaserCardBlock } from "../Blocks/TeaserCard.graphql" export const TeaserCardSidebar_ContentPage = gql` @@ -20,19 +19,3 @@ export const TeaserCardSidebar_ContentPage = gql` } ${TeaserCardBlock} ` - -export const TeaserCardSidebar_ContentPageRefs = gql` - fragment TeaserCardSidebar_ContentPageRefs on ContentPageSidebarTeaserCard { - teaser_card { - teaser_cardConnection { - edges { - node { - __typename - ...TeaserCardBlockRef - } - } - } - } - } - ${TeaserCardBlockRef} -` diff --git a/packages/trpc/lib/graphql/Fragments/StartPage/Ref.graphql.ts b/packages/trpc/lib/graphql/Fragments/StartPage/Ref.graphql.ts deleted file mode 100644 index 91810c68e..000000000 --- a/packages/trpc/lib/graphql/Fragments/StartPage/Ref.graphql.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { gql } from "graphql-tag" - -import { System } from "../System.graphql" - -export const StartPageRef = gql` - fragment StartPageRef on StartPage { - system { - ...System - } - } - ${System} -` diff --git a/packages/trpc/lib/graphql/Fragments/SysAsset.graphql.ts b/packages/trpc/lib/graphql/Fragments/SysAsset.graphql.ts index 1e528d27b..43cc780da 100644 --- a/packages/trpc/lib/graphql/Fragments/SysAsset.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/SysAsset.graphql.ts @@ -20,14 +20,3 @@ export const SysAsset = gql` } ${AssetSystem} ` - -export const SysAssetRef = gql` - fragment SysAssetRef on SysAsset { - system { - ...AssetSystem - } - url - permanent_url - } - ${AssetSystem} -` diff --git a/packages/trpc/lib/graphql/Fragments/Video.graphql.ts b/packages/trpc/lib/graphql/Fragments/Video.graphql.ts index 87f4aa5dc..b2db39105 100644 --- a/packages/trpc/lib/graphql/Fragments/Video.graphql.ts +++ b/packages/trpc/lib/graphql/Fragments/Video.graphql.ts @@ -1,7 +1,5 @@ import { gql } from "graphql-tag" -import { AssetSystem } from "./System.graphql" - export const Video = gql` fragment Video on Video { sourceConnection { @@ -30,19 +28,3 @@ export const Video = gql` } } ` - -export const VideoRef = gql` - fragment VideoRef on Video { - sourceConnection { - edges { - node { - system { - ...AssetSystem - } - url - } - } - } - } - ${AssetSystem} -` diff --git a/packages/trpc/lib/graphql/Query/AccountPage/AccountPage.graphql.ts b/packages/trpc/lib/graphql/Query/AccountPage/AccountPage.graphql.ts index e4a5ac122..f56af1d79 100644 --- a/packages/trpc/lib/graphql/Query/AccountPage/AccountPage.graphql.ts +++ b/packages/trpc/lib/graphql/Query/AccountPage/AccountPage.graphql.ts @@ -1,17 +1,8 @@ import { gql } from "graphql-tag" -import { - Accordion_AccountPage, - Accordion_AccountPageRefs, -} from "../../Fragments/Blocks/Accordion.graphql" -import { - DynamicContent_AccountPage, - DynamicContent_AccountPageRefs, -} from "../../Fragments/Blocks/DynamicContent.graphql" -import { - Shortcuts_AccountPage, - Shortcuts_AccountPageRefs, -} from "../../Fragments/Blocks/Shortcuts.graphql" +import { Accordion_AccountPage } from "../../Fragments/Blocks/Accordion.graphql" +import { DynamicContent_AccountPage } from "../../Fragments/Blocks/DynamicContent.graphql" +import { Shortcuts_AccountPage } from "../../Fragments/Blocks/Shortcuts.graphql" import { TextContent_AccountPage } from "../../Fragments/Blocks/TextContent.graphql" import { System } from "../../Fragments/System.graphql" @@ -48,26 +39,6 @@ export const GetAccountPage = gql` ${TextContent_AccountPage} ` -export const GetAccountPageRefs = gql` - query GetAccountPageRefs($locale: String!, $uid: String!) { - account_page(locale: $locale, uid: $uid) { - content { - __typename - ...Accordion_AccountPageRefs - ...DynamicContent_AccountPageRefs - ...Shortcuts_AccountPageRefs - } - system { - ...System - } - } - } - ${System} - ${Accordion_AccountPageRefs} - ${DynamicContent_AccountPageRefs} - ${Shortcuts_AccountPageRefs} -` - export const GetDaDeEnUrlsAccountPage = gql` query GetDaDeEnUrlsAccountPage($uid: String!) { de: account_page(locale: "de", uid: $uid) { diff --git a/packages/trpc/lib/graphql/Query/Breadcrumbs/AccountPage.graphql.ts b/packages/trpc/lib/graphql/Query/Breadcrumbs/AccountPage.graphql.ts index 680fbd1fc..21cbf76e9 100644 --- a/packages/trpc/lib/graphql/Query/Breadcrumbs/AccountPage.graphql.ts +++ b/packages/trpc/lib/graphql/Query/Breadcrumbs/AccountPage.graphql.ts @@ -1,9 +1,6 @@ import { gql } from "graphql-tag" -import { - Breadcrumbs, - BreadcrumbsRefs, -} from "../../Fragments/Breadcrumbs/Breadcrumbs.graphql" +import { Breadcrumbs } from "../../Fragments/Breadcrumbs/Breadcrumbs.graphql" import { System } from "../../Fragments/System.graphql" export const GetMyPagesBreadcrumbs = gql` @@ -23,20 +20,3 @@ export const GetMyPagesBreadcrumbs = gql` ${Breadcrumbs} ${System} ` - -export const GetMyPagesBreadcrumbsRefs = gql` - query GetMyPagesBreadcrumbsRefs($locale: String!, $uid: String!) { - account_page(locale: $locale, uid: $uid) { - web { - breadcrumbs { - ...BreadcrumbsRefs - } - } - system { - ...System - } - } - } - ${BreadcrumbsRefs} - ${System} -` diff --git a/packages/trpc/lib/graphql/Query/Breadcrumbs/CampaignOverviewPage.graphql.ts b/packages/trpc/lib/graphql/Query/Breadcrumbs/CampaignOverviewPage.graphql.ts index 619c5bf0b..15b179baf 100644 --- a/packages/trpc/lib/graphql/Query/Breadcrumbs/CampaignOverviewPage.graphql.ts +++ b/packages/trpc/lib/graphql/Query/Breadcrumbs/CampaignOverviewPage.graphql.ts @@ -1,9 +1,6 @@ import { gql } from "graphql-tag" -import { - Breadcrumbs, - BreadcrumbsRefs, -} from "../../Fragments/Breadcrumbs/Breadcrumbs.graphql" +import { Breadcrumbs } from "../../Fragments/Breadcrumbs/Breadcrumbs.graphql" import { System } from "../../Fragments/System.graphql" export const GetCampaignOverviewPageBreadcrumbs = gql` @@ -23,23 +20,3 @@ export const GetCampaignOverviewPageBreadcrumbs = gql` ${Breadcrumbs} ${System} ` - -export const GetCampaignOverviewPageBreadcrumbsRefs = gql` - query GetCampaignOverviewPageBreadcrumbsRefs( - $locale: String! - $uid: String! - ) { - campaign_overview_page(locale: $locale, uid: $uid) { - web { - breadcrumbs { - ...BreadcrumbsRefs - } - } - system { - ...System - } - } - } - ${BreadcrumbsRefs} - ${System} -` diff --git a/packages/trpc/lib/graphql/Query/Breadcrumbs/CampaignPage.graphql.ts b/packages/trpc/lib/graphql/Query/Breadcrumbs/CampaignPage.graphql.ts index fea9fa560..b4b8844ae 100644 --- a/packages/trpc/lib/graphql/Query/Breadcrumbs/CampaignPage.graphql.ts +++ b/packages/trpc/lib/graphql/Query/Breadcrumbs/CampaignPage.graphql.ts @@ -1,9 +1,6 @@ import { gql } from "graphql-tag" -import { - Breadcrumbs, - BreadcrumbsRefs, -} from "../../Fragments/Breadcrumbs/Breadcrumbs.graphql" +import { Breadcrumbs } from "../../Fragments/Breadcrumbs/Breadcrumbs.graphql" import { System } from "../../Fragments/System.graphql" export const GetCampaignPageBreadcrumbs = gql` @@ -23,20 +20,3 @@ export const GetCampaignPageBreadcrumbs = gql` ${Breadcrumbs} ${System} ` - -export const GetCampaignPageBreadcrumbsRefs = gql` - query GetCampaignPageBreadcrumbsRefs($locale: String!, $uid: String!) { - campaign_page(locale: $locale, uid: $uid) { - web { - breadcrumbs { - ...BreadcrumbsRefs - } - } - system { - ...System - } - } - } - ${BreadcrumbsRefs} - ${System} -` diff --git a/packages/trpc/lib/graphql/Query/Breadcrumbs/CollectionPage.graphql.ts b/packages/trpc/lib/graphql/Query/Breadcrumbs/CollectionPage.graphql.ts index 4da03602d..455e6f8cd 100644 --- a/packages/trpc/lib/graphql/Query/Breadcrumbs/CollectionPage.graphql.ts +++ b/packages/trpc/lib/graphql/Query/Breadcrumbs/CollectionPage.graphql.ts @@ -1,9 +1,6 @@ import { gql } from "graphql-tag" -import { - Breadcrumbs, - BreadcrumbsRefs, -} from "../../Fragments/Breadcrumbs/Breadcrumbs.graphql" +import { Breadcrumbs } from "../../Fragments/Breadcrumbs/Breadcrumbs.graphql" import { System } from "../../Fragments/System.graphql" export const GetCollectionPageBreadcrumbs = gql` @@ -23,20 +20,3 @@ export const GetCollectionPageBreadcrumbs = gql` ${Breadcrumbs} ${System} ` - -export const GetCollectionPageBreadcrumbsRefs = gql` - query GetCollectionPageBreadcrumbsRefs($locale: String!, $uid: String!) { - collection_page(locale: $locale, uid: $uid) { - web { - breadcrumbs { - ...BreadcrumbsRefs - } - } - system { - ...System - } - } - } - ${BreadcrumbsRefs} - ${System} -` diff --git a/packages/trpc/lib/graphql/Query/Breadcrumbs/ContentPage.graphql.ts b/packages/trpc/lib/graphql/Query/Breadcrumbs/ContentPage.graphql.ts index 94d11e032..06308bd53 100644 --- a/packages/trpc/lib/graphql/Query/Breadcrumbs/ContentPage.graphql.ts +++ b/packages/trpc/lib/graphql/Query/Breadcrumbs/ContentPage.graphql.ts @@ -1,9 +1,6 @@ import { gql } from "graphql-tag" -import { - Breadcrumbs, - BreadcrumbsRefs, -} from "../../Fragments/Breadcrumbs/Breadcrumbs.graphql" +import { Breadcrumbs } from "../../Fragments/Breadcrumbs/Breadcrumbs.graphql" import { System } from "../../Fragments/System.graphql" export const GetContentPageBreadcrumbs = gql` @@ -23,20 +20,3 @@ export const GetContentPageBreadcrumbs = gql` ${Breadcrumbs} ${System} ` - -export const GetContentPageBreadcrumbsRefs = gql` - query GetContentPageBreadcrumbsRefs($locale: String!, $uid: String!) { - content_page(locale: $locale, uid: $uid) { - web { - breadcrumbs { - ...BreadcrumbsRefs - } - } - system { - ...System - } - } - } - ${BreadcrumbsRefs} - ${System} -` diff --git a/packages/trpc/lib/graphql/Query/Breadcrumbs/DestinationCityPage.graphql.ts b/packages/trpc/lib/graphql/Query/Breadcrumbs/DestinationCityPage.graphql.ts index 4afe57426..4a3c17488 100644 --- a/packages/trpc/lib/graphql/Query/Breadcrumbs/DestinationCityPage.graphql.ts +++ b/packages/trpc/lib/graphql/Query/Breadcrumbs/DestinationCityPage.graphql.ts @@ -1,9 +1,6 @@ import { gql } from "graphql-tag" -import { - Breadcrumbs, - BreadcrumbsRefs, -} from "../../Fragments/Breadcrumbs/Breadcrumbs.graphql" +import { Breadcrumbs } from "../../Fragments/Breadcrumbs/Breadcrumbs.graphql" import { System } from "../../Fragments/System.graphql" export const GetDestinationCityPageBreadcrumbs = gql` @@ -23,20 +20,3 @@ export const GetDestinationCityPageBreadcrumbs = gql` ${Breadcrumbs} ${System} ` - -export const GetDestinationCityPageBreadcrumbsRefs = gql` - query GetDestinationCityPageBreadcrumbsRefs($locale: String!, $uid: String!) { - destination_city_page(locale: $locale, uid: $uid) { - web { - breadcrumbs { - ...BreadcrumbsRefs - } - } - system { - ...System - } - } - } - ${BreadcrumbsRefs} - ${System} -` diff --git a/packages/trpc/lib/graphql/Query/Breadcrumbs/DestinationCountryPage.graphql.ts b/packages/trpc/lib/graphql/Query/Breadcrumbs/DestinationCountryPage.graphql.ts index 8594d75f6..e57d15712 100644 --- a/packages/trpc/lib/graphql/Query/Breadcrumbs/DestinationCountryPage.graphql.ts +++ b/packages/trpc/lib/graphql/Query/Breadcrumbs/DestinationCountryPage.graphql.ts @@ -1,9 +1,6 @@ import { gql } from "graphql-tag" -import { - Breadcrumbs, - BreadcrumbsRefs, -} from "../../Fragments/Breadcrumbs/Breadcrumbs.graphql" +import { Breadcrumbs } from "../../Fragments/Breadcrumbs/Breadcrumbs.graphql" import { System } from "../../Fragments/System.graphql" export const GetDestinationCountryPageBreadcrumbs = gql` @@ -23,23 +20,3 @@ export const GetDestinationCountryPageBreadcrumbs = gql` ${Breadcrumbs} ${System} ` - -export const GetDestinationCountryPageBreadcrumbsRefs = gql` - query GetDestinationCountryPageBreadcrumbsRefs( - $locale: String! - $uid: String! - ) { - destination_country_page(locale: $locale, uid: $uid) { - web { - breadcrumbs { - ...BreadcrumbsRefs - } - } - system { - ...System - } - } - } - ${BreadcrumbsRefs} - ${System} -` diff --git a/packages/trpc/lib/graphql/Query/Breadcrumbs/DestinationOverviewPage.graphql.ts b/packages/trpc/lib/graphql/Query/Breadcrumbs/DestinationOverviewPage.graphql.ts index ca0c4fcaf..b73cccb16 100644 --- a/packages/trpc/lib/graphql/Query/Breadcrumbs/DestinationOverviewPage.graphql.ts +++ b/packages/trpc/lib/graphql/Query/Breadcrumbs/DestinationOverviewPage.graphql.ts @@ -1,9 +1,6 @@ import { gql } from "graphql-tag" -import { - Breadcrumbs, - BreadcrumbsRefs, -} from "../../Fragments/Breadcrumbs/Breadcrumbs.graphql" +import { Breadcrumbs } from "../../Fragments/Breadcrumbs/Breadcrumbs.graphql" import { System } from "../../Fragments/System.graphql" export const GetDestinationOverviewPageBreadcrumbs = gql` @@ -23,23 +20,3 @@ export const GetDestinationOverviewPageBreadcrumbs = gql` ${Breadcrumbs} ${System} ` - -export const GetDestinationOverviewPageBreadcrumbsRefs = gql` - query GetDestinationOverviewPageBreadcrumbsRefs( - $locale: String! - $uid: String! - ) { - destination_overview_page(locale: $locale, uid: $uid) { - web { - breadcrumbs { - ...BreadcrumbsRefs - } - } - system { - ...System - } - } - } - ${BreadcrumbsRefs} - ${System} -` diff --git a/packages/trpc/lib/graphql/Query/Breadcrumbs/HotelPage.graphql.ts b/packages/trpc/lib/graphql/Query/Breadcrumbs/HotelPage.graphql.ts index ae2ff3e53..a013c52ae 100644 --- a/packages/trpc/lib/graphql/Query/Breadcrumbs/HotelPage.graphql.ts +++ b/packages/trpc/lib/graphql/Query/Breadcrumbs/HotelPage.graphql.ts @@ -1,9 +1,6 @@ import { gql } from "graphql-tag" -import { - Breadcrumbs, - BreadcrumbsRefs, -} from "../../Fragments/Breadcrumbs/Breadcrumbs.graphql" +import { Breadcrumbs } from "../../Fragments/Breadcrumbs/Breadcrumbs.graphql" import { System } from "../../Fragments/System.graphql" export const GetHotelPageBreadcrumbs = gql` @@ -23,20 +20,3 @@ export const GetHotelPageBreadcrumbs = gql` ${Breadcrumbs} ${System} ` - -export const GetHotelPageBreadcrumbsRefs = gql` - query GetHotelPageBreadcrumbsRefs($locale: String!, $uid: String!) { - hotel_page(locale: $locale, uid: $uid) { - web { - breadcrumbs { - ...BreadcrumbsRefs - } - } - system { - ...System - } - } - } - ${BreadcrumbsRefs} - ${System} -` diff --git a/packages/trpc/lib/graphql/Query/Breadcrumbs/LoyaltyPage.graphql.ts b/packages/trpc/lib/graphql/Query/Breadcrumbs/LoyaltyPage.graphql.ts index 6656bf118..30e67050b 100644 --- a/packages/trpc/lib/graphql/Query/Breadcrumbs/LoyaltyPage.graphql.ts +++ b/packages/trpc/lib/graphql/Query/Breadcrumbs/LoyaltyPage.graphql.ts @@ -1,9 +1,6 @@ import { gql } from "graphql-tag" -import { - Breadcrumbs, - BreadcrumbsRefs, -} from "../../Fragments/Breadcrumbs/Breadcrumbs.graphql" +import { Breadcrumbs } from "../../Fragments/Breadcrumbs/Breadcrumbs.graphql" import { System } from "../../Fragments/System.graphql" export const GetLoyaltyPageBreadcrumbs = gql` @@ -23,20 +20,3 @@ export const GetLoyaltyPageBreadcrumbs = gql` ${Breadcrumbs} ${System} ` - -export const GetLoyaltyPageBreadcrumbsRefs = gql` - query GetLoyaltyPageBreadcrumbsRefs($locale: String!, $uid: String!) { - loyalty_page(locale: $locale, uid: $uid) { - web { - breadcrumbs { - ...BreadcrumbsRefs - } - } - system { - ...System - } - } - } - ${BreadcrumbsRefs} - ${System} -` diff --git a/packages/trpc/lib/graphql/Query/Breadcrumbs/PromoCampaignPage.graphql.ts b/packages/trpc/lib/graphql/Query/Breadcrumbs/PromoCampaignPage.graphql.ts index 2abc78531..5eb523764 100644 --- a/packages/trpc/lib/graphql/Query/Breadcrumbs/PromoCampaignPage.graphql.ts +++ b/packages/trpc/lib/graphql/Query/Breadcrumbs/PromoCampaignPage.graphql.ts @@ -1,9 +1,6 @@ import { gql } from "graphql-tag" -import { - Breadcrumbs, - BreadcrumbsRefs, -} from "../../Fragments/Breadcrumbs/Breadcrumbs.graphql" +import { Breadcrumbs } from "../../Fragments/Breadcrumbs/Breadcrumbs.graphql" import { System } from "../../Fragments/System.graphql" export const GetPromoCampaignPageBreadcrumbs = gql` @@ -23,20 +20,3 @@ export const GetPromoCampaignPageBreadcrumbs = gql` ${Breadcrumbs} ${System} ` - -export const GetPromoCampaignPageBreadcrumbsRefs = gql` - query GetPromoCampaignPageBreadcrumbsRefs($locale: String!, $uid: String!) { - promo_campaign_page(locale: $locale, uid: $uid) { - web { - breadcrumbs { - ...BreadcrumbsRefs - } - } - system { - ...System - } - } - } - ${BreadcrumbsRefs} - ${System} -` diff --git a/packages/trpc/lib/graphql/Query/CampaignOverviewPage/CampaignOverviewPage.graphql.ts b/packages/trpc/lib/graphql/Query/CampaignOverviewPage/CampaignOverviewPage.graphql.ts index a9b524910..06dc51910 100644 --- a/packages/trpc/lib/graphql/Query/CampaignOverviewPage/CampaignOverviewPage.graphql.ts +++ b/packages/trpc/lib/graphql/Query/CampaignOverviewPage/CampaignOverviewPage.graphql.ts @@ -1,23 +1,12 @@ import { gql } from "graphql-tag" -import { - AllCampaigns, - AllCampaignsRefs, -} from "../../Fragments/Blocks/AllCampaigns.graphql" -import { - CarouselCards_CampaignOverviewPage, - CarouselCards_CampaignOverviewPageRefs, -} from "../../Fragments/Blocks/CarouselCards.graphql" +import { AllCampaigns } from "../../Fragments/Blocks/AllCampaigns.graphql" +import { CarouselCards_CampaignOverviewPage } from "../../Fragments/Blocks/CarouselCards.graphql" import { HotelListing_CampaignOverviewPage } from "../../Fragments/Blocks/HotelListing.graphql" -import { - NavigationLinks_CampaignOverviewPage, - NavigationLinksRef_CampaignOverviewPage, -} from "../../Fragments/CampaignOverviewPage/NavigationLinks.graphql" +import { NavigationLinks_CampaignOverviewPage } from "../../Fragments/CampaignOverviewPage/NavigationLinks.graphql" import { TopCampaign, - TopCampaignRef, TopPromoCampaign, - TopPromoCampaignRef, } from "../../Fragments/CampaignOverviewPage/TopCampaign.graphql" import { System } from "../../Fragments/System.graphql" @@ -67,40 +56,6 @@ export const GetCampaignOverviewPage = gql` ${HotelListing_CampaignOverviewPage} ` -export const GetCampaignOverviewPageRefs = gql` - query GetCampaignOverviewPageRefs($locale: String!, $uid: String!) { - campaign_overview_page(locale: $locale, uid: $uid) { - header { - ...NavigationLinksRef_CampaignOverviewPage - } - top_campaign_block { - campaignConnection { - edges { - node { - ...TopCampaignRef - ...TopPromoCampaignRef - } - } - } - } - blocks { - __typename - ...CarouselCards_CampaignOverviewPageRefs - ...AllCampaignsRefs - } - system { - ...System - } - } - } - ${System} - ${NavigationLinksRef_CampaignOverviewPage} - ${TopCampaignRef} - ${TopPromoCampaignRef} - ${CarouselCards_CampaignOverviewPageRefs} - ${AllCampaignsRefs} -` - export const GetDaDeEnUrlsCampaignOverviewPage = gql` query GetDaDeEnUrlsCampaignOverviewPage($uid: String!) { de: campaign_overview_page(locale: "de", uid: $uid) { diff --git a/packages/trpc/lib/graphql/Query/CampaignPage/CampaignPage.graphql.ts b/packages/trpc/lib/graphql/Query/CampaignPage/CampaignPage.graphql.ts index 38c1ce4ed..246e07385 100644 --- a/packages/trpc/lib/graphql/Query/CampaignPage/CampaignPage.graphql.ts +++ b/packages/trpc/lib/graphql/Query/CampaignPage/CampaignPage.graphql.ts @@ -1,19 +1,10 @@ import { gql } from "graphql-tag" -import { - Accordion_CampaignPage, - Accordion_CampaignPageRefs, -} from "../../Fragments/Blocks/Accordion.graphql" -import { - CarouselCards_CampaignPage, - CarouselCards_CampaignPageRefs, -} from "../../Fragments/Blocks/CarouselCards.graphql" +import { Accordion_CampaignPage } from "../../Fragments/Blocks/Accordion.graphql" +import { CarouselCards_CampaignPage } from "../../Fragments/Blocks/CarouselCards.graphql" import { Essentials_CampaignPage } from "../../Fragments/Blocks/Essentials.graphql" import { HotelListing_CampaignPage } from "../../Fragments/Blocks/HotelListing.graphql" -import { - Hero_CampaignPage, - HeroRef_CampaignPage, -} from "../../Fragments/CampaignPage/Hero.graphql" +import { Hero_CampaignPage } from "../../Fragments/CampaignPage/Hero.graphql" import { CampaignPageIncludedHotels } from "../../Fragments/CampaignPage/IncludedHotels.graphql" import { System } from "../../Fragments/System.graphql" @@ -61,26 +52,6 @@ export const GetCampaignPage = gql` ${Hero_CampaignPage} ` -export const GetCampaignPageRefs = gql` - query GetCampaignPageRefs($locale: String!, $uid: String!) { - campaign_page(locale: $locale, uid: $uid) { - blocks { - __typename - ...CarouselCards_CampaignPageRefs - ...Accordion_CampaignPageRefs - } - ...HeroRef_CampaignPage - system { - ...System - } - } - } - ${System} - ${CarouselCards_CampaignPageRefs} - ${Accordion_CampaignPageRefs} - ${HeroRef_CampaignPage} -` - export const GetDaDeEnUrlsCampaignPage = gql` query GetDaDeEnUrlsCampaignPage($uid: String!) { de: campaign_page(locale: "de", uid: $uid) { diff --git a/packages/trpc/lib/graphql/Query/CampaignPage/CampaignPagesByHotelUid.graphql.ts b/packages/trpc/lib/graphql/Query/CampaignPage/CampaignPagesByHotelUid.graphql.ts index ebe6222ee..09c2c7bcc 100644 --- a/packages/trpc/lib/graphql/Query/CampaignPage/CampaignPagesByHotelUid.graphql.ts +++ b/packages/trpc/lib/graphql/Query/CampaignPage/CampaignPagesByHotelUid.graphql.ts @@ -1,7 +1,6 @@ import { gql } from "graphql-tag" import { Hero_CampaignPage } from "../../Fragments/CampaignPage/Hero.graphql" -import { CampaignPageRef } from "../../Fragments/CampaignPage/Ref.graphql" import { System } from "../../Fragments/System.graphql" export const GetCampaignPagesByHotelUid = gql` @@ -47,35 +46,3 @@ export const GetCampaignPagesByHotelUid = gql` ${System} ${Hero_CampaignPage} ` - -export const GetCampaignPagesByHotelUidRefs = gql` - query GetCampaignPagesByHotelUidRefs( - $locale: String! - $hotelPageUid: String! - $today: DateTime! - ) { - all_campaign_page( - where: { - OR: [ - { - included_hotels: { list_1: { hotel_page: { uid: $hotelPageUid } } } - } - { - included_hotels: { list_2: { hotel_page: { uid: $hotelPageUid } } } - } - ] - AND: [ - { OR: [{ startdate: null }, { startdate_lte: $today }] } - { OR: [{ enddate: null }, { enddate_gte: $today }] } - ] - } - locale: $locale - limit: 100 - ) { - items { - ...CampaignPageRef - } - } - } - ${CampaignPageRef} -` diff --git a/packages/trpc/lib/graphql/Query/CollectionPage/CollectionPage.graphql.ts b/packages/trpc/lib/graphql/Query/CollectionPage/CollectionPage.graphql.ts index 3db893217..c40746c40 100644 --- a/packages/trpc/lib/graphql/Query/CollectionPage/CollectionPage.graphql.ts +++ b/packages/trpc/lib/graphql/Query/CollectionPage/CollectionPage.graphql.ts @@ -1,35 +1,14 @@ import { gql } from "graphql-tag" -import { - CardsGrid_CollectionPage, - CardsGrid_CollectionPageRefs, -} from "../../Fragments/Blocks/CardsGrid.graphql" -import { - DynamicContent_CollectionPage, - DynamicContent_CollectionPageRefs, -} from "../../Fragments/Blocks/DynamicContent.graphql" -import { - Shortcuts_CollectionPage, - Shortcuts_CollectionPageRefs, -} from "../../Fragments/Blocks/Shortcuts.graphql" -import { - UspGrid_CollectionPage, - UspGrid_CollectionPageRefs, -} from "../../Fragments/Blocks/UspGrid.graphql" -import { - VideoCard_CollectionPage, - VideoCard_CollectionPageRefs, -} from "../../Fragments/Blocks/VideoCard.graphql" -import { - NavigationLinks_CollectionPage, - NavigationLinksRef_CollectionPage, -} from "../../Fragments/CollectionPage/NavigationLinks.graphql" -import { - TopPrimaryButton_CollectionPage, - TopPrimaryButtonRef_CollectionPage, -} from "../../Fragments/CollectionPage/TopPrimaryButton.graphql" +import { CardsGrid_CollectionPage } from "../../Fragments/Blocks/CardsGrid.graphql" +import { DynamicContent_CollectionPage } from "../../Fragments/Blocks/DynamicContent.graphql" +import { Shortcuts_CollectionPage } from "../../Fragments/Blocks/Shortcuts.graphql" +import { UspGrid_CollectionPage } from "../../Fragments/Blocks/UspGrid.graphql" +import { VideoCard_CollectionPage } from "../../Fragments/Blocks/VideoCard.graphql" +import { NavigationLinks_CollectionPage } from "../../Fragments/CollectionPage/NavigationLinks.graphql" +import { TopPrimaryButton_CollectionPage } from "../../Fragments/CollectionPage/TopPrimaryButton.graphql" import { System } from "../../Fragments/System.graphql" -import { Video, VideoRef } from "../../Fragments/Video.graphql" +import { Video } from "../../Fragments/Video.graphql" export const GetCollectionPage = gql` query GetCollectionPage($locale: String!, $uid: String!) { @@ -78,40 +57,6 @@ export const GetCollectionPage = gql` ${Video} ` -export const GetCollectionPageRefs = gql` - query GetCollectionPageRefs($locale: String!, $uid: String!) { - collection_page(locale: $locale, uid: $uid) { - hero_video { - ...VideoRef - } - header { - ...TopPrimaryButtonRef_CollectionPage - ...NavigationLinksRef_CollectionPage - } - blocks { - __typename - ...CardsGrid_CollectionPageRefs - ...Shortcuts_CollectionPageRefs - ...UspGrid_CollectionPageRefs - ...DynamicContent_CollectionPageRefs - ...VideoCard_CollectionPageRefs - } - system { - ...System - } - } - } - ${System} - ${TopPrimaryButtonRef_CollectionPage} - ${NavigationLinksRef_CollectionPage} - ${CardsGrid_CollectionPageRefs} - ${Shortcuts_CollectionPageRefs} - ${UspGrid_CollectionPageRefs} - ${DynamicContent_CollectionPageRefs} - ${VideoRef} - ${VideoCard_CollectionPageRefs} -` - export const GetDaDeEnUrlsCollectionPage = gql` query GetDaDeEnUrlsCollectionPage($uid: String!) { de: collection_page(locale: "de", uid: $uid) { diff --git a/packages/trpc/lib/graphql/Query/ContentPage/ContentPage.graphql.ts b/packages/trpc/lib/graphql/Query/ContentPage/ContentPage.graphql.ts index 88b922fd5..08badfc04 100644 --- a/packages/trpc/lib/graphql/Query/ContentPage/ContentPage.graphql.ts +++ b/packages/trpc/lib/graphql/Query/ContentPage/ContentPage.graphql.ts @@ -1,78 +1,27 @@ import { gql } from "graphql-tag" -import { - Accordion_ContentPage, - Accordion_ContentPageRefs, -} from "../../Fragments/Blocks/Accordion.graphql" -import { - CardsGrid_ContentPage, - CardsGrid_ContentPageRefs, -} from "../../Fragments/Blocks/CardsGrid.graphql" -import { - Content_ContentPage, - Content_ContentPageRefs, -} from "../../Fragments/Blocks/Content.graphql" -import { - DynamicContent_ContentPage, - DynamicContent_ContentPageRefs, -} from "../../Fragments/Blocks/DynamicContent.graphql" +import { Accordion_ContentPage } from "../../Fragments/Blocks/Accordion.graphql" +import { CardsGrid_ContentPage } from "../../Fragments/Blocks/CardsGrid.graphql" +import { Content_ContentPage } from "../../Fragments/Blocks/Content.graphql" +import { DynamicContent_ContentPage } from "../../Fragments/Blocks/DynamicContent.graphql" import { HotelListing_ContentPage } from "../../Fragments/Blocks/HotelListing.graphql" -import { - Jotform_ContentPage, - Jotform_ContentPageRefs, -} from "../../Fragments/Blocks/Jotform.graphql" -import { - Shortcuts_ContentPage, - Shortcuts_ContentPageRefs, -} from "../../Fragments/Blocks/Shortcuts.graphql" +import { Jotform_ContentPage } from "../../Fragments/Blocks/Jotform.graphql" +import { Shortcuts_ContentPage } from "../../Fragments/Blocks/Shortcuts.graphql" import { Table_ContentPage } from "../../Fragments/Blocks/Table.graphql" -import { - TextCols_ContentPage, - TextCols_ContentPageRef, -} from "../../Fragments/Blocks/TextCols.graphql" -import { - UspGrid_ContentPage, - UspGrid_ContentPageRefs, -} from "../../Fragments/Blocks/UspGrid.graphql" -import { - Video_ContentPage, - Video_ContentPageRefs, -} from "../../Fragments/Blocks/Video.graphql" -import { - VideoCard_ContentPage, - VideoCard_ContentPageRefs, -} from "../../Fragments/Blocks/VideoCard.graphql" -import { - NavigationLinks_ContentPage, - NavigationLinksRef_ContentPage, -} from "../../Fragments/ContentPage/NavigationLinks.graphql" -import { - TopPrimaryButton_ContentPage, - TopPrimaryButtonRef_ContentPage, -} from "../../Fragments/ContentPage/TopPrimaryButton.graphql" -import { - ContentSidebar_ContentPage, - ContentSidebar_ContentPageRefs, -} from "../../Fragments/Sidebar/Content.graphql" +import { TextCols_ContentPage } from "../../Fragments/Blocks/TextCols.graphql" +import { UspGrid_ContentPage } from "../../Fragments/Blocks/UspGrid.graphql" +import { Video_ContentPage } from "../../Fragments/Blocks/Video.graphql" +import { VideoCard_ContentPage } from "../../Fragments/Blocks/VideoCard.graphql" +import { NavigationLinks_ContentPage } from "../../Fragments/ContentPage/NavigationLinks.graphql" +import { TopPrimaryButton_ContentPage } from "../../Fragments/ContentPage/TopPrimaryButton.graphql" +import { ContentSidebar_ContentPage } from "../../Fragments/Sidebar/Content.graphql" import { DynamicContentSidebar_ContentPage } from "../../Fragments/Sidebar/DynamicContent.graphql" -import { - JoinLoyaltyContactSidebar_ContentPage, - JoinLoyaltyContactSidebar_ContentPageRefs, -} from "../../Fragments/Sidebar/JoinLoyaltyContact.graphql" -import { - QuickLinksSidebar_ContentPage, - QuickLinksSidebar_ContentPageRefs, -} from "../../Fragments/Sidebar/QuickLinks.graphql" -import { - ScriptedCardSidebar_ContentPage, - ScriptedCardSidebar_ContentPageRefs, -} from "../../Fragments/Sidebar/ScriptedCard.graphql" -import { - TeaserCardSidebar_ContentPage, - TeaserCardSidebar_ContentPageRefs, -} from "../../Fragments/Sidebar/TeaserCard.graphql" +import { JoinLoyaltyContactSidebar_ContentPage } from "../../Fragments/Sidebar/JoinLoyaltyContact.graphql" +import { QuickLinksSidebar_ContentPage } from "../../Fragments/Sidebar/QuickLinks.graphql" +import { ScriptedCardSidebar_ContentPage } from "../../Fragments/Sidebar/ScriptedCard.graphql" +import { TeaserCardSidebar_ContentPage } from "../../Fragments/Sidebar/TeaserCard.graphql" import { System } from "../../Fragments/System.graphql" -import { Video, VideoRef } from "../../Fragments/Video.graphql" +import { Video } from "../../Fragments/Video.graphql" export const GetContentPage = gql` query GetContentPage($locale: String!, $uid: String!) { @@ -173,73 +122,6 @@ export const GetContentPageBlocksBatch2 = gql` ${UspGrid_ContentPage} ` -export const GetContentPageRefs = gql` - query GetContentPageRefs($locale: String!, $uid: String!) { - content_page(locale: $locale, uid: $uid) { - hero_video { - ...VideoRef - } - header { - dynamic_content { - component - } - ...NavigationLinksRef_ContentPage - ...TopPrimaryButtonRef_ContentPage - } - sidebar { - __typename - ...ContentSidebar_ContentPageRefs - ...JoinLoyaltyContactSidebar_ContentPageRefs - ...ScriptedCardSidebar_ContentPageRefs - ...TeaserCardSidebar_ContentPageRefs - ...QuickLinksSidebar_ContentPageRefs - } - system { - ...System - } - } - } - ${System} - ${NavigationLinksRef_ContentPage} - ${TopPrimaryButtonRef_ContentPage} - ${ContentSidebar_ContentPageRefs} - ${JoinLoyaltyContactSidebar_ContentPageRefs} - ${ScriptedCardSidebar_ContentPageRefs} - ${TeaserCardSidebar_ContentPageRefs} - ${QuickLinksSidebar_ContentPageRefs} - ${VideoRef} -` - -export const GetContentPageBlocksRefs = gql` - query GetContentPageBlocksRefs($locale: String!, $uid: String!) { - content_page(locale: $locale, uid: $uid) { - blocks { - __typename - ...Accordion_ContentPageRefs - ...CardsGrid_ContentPageRefs - ...Content_ContentPageRefs - ...DynamicContent_ContentPageRefs - ...Shortcuts_ContentPageRefs - ...TextCols_ContentPageRef - ...UspGrid_ContentPageRefs - ...Jotform_ContentPageRefs - ...VideoCard_ContentPageRefs - ...Video_ContentPageRefs - } - } - } - ${Accordion_ContentPageRefs} - ${CardsGrid_ContentPageRefs} - ${Content_ContentPageRefs} - ${DynamicContent_ContentPageRefs} - ${Shortcuts_ContentPageRefs} - ${TextCols_ContentPageRef} - ${UspGrid_ContentPageRefs} - ${Jotform_ContentPageRefs} - ${VideoCard_ContentPageRefs} - ${Video_ContentPageRefs} -` - export const GetDaDeEnUrlsContentPage = gql` query GetDaDeEnUrlsContentPage($uid: String!) { de: content_page(locale: "de", uid: $uid) { diff --git a/packages/trpc/lib/graphql/Query/DestinationCityPage/DestinationCityPage.graphql.ts b/packages/trpc/lib/graphql/Query/DestinationCityPage/DestinationCityPage.graphql.ts index abba3613c..2f3571b0e 100644 --- a/packages/trpc/lib/graphql/Query/DestinationCityPage/DestinationCityPage.graphql.ts +++ b/packages/trpc/lib/graphql/Query/DestinationCityPage/DestinationCityPage.graphql.ts @@ -1,27 +1,8 @@ import { gql } from "graphql-tag" -import { AccountPageRef } from "../../Fragments/AccountPage/Ref.graphql" -import { - Accordion_DestinationCityPage, - Accordion_DestinationCityPageRefs, -} from "../../Fragments/Blocks/Accordion.graphql" -import { - Content_DestinationCityPage, - Content_DestinationCityPageRefs, -} from "../../Fragments/Blocks/Content.graphql" -import { CampaignOverviewPageRef } from "../../Fragments/CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../../Fragments/CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../../Fragments/CollectionPage/Ref.graphql" -import { ContentPageRef } from "../../Fragments/ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../../Fragments/DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../../Fragments/DestinationCountryPage/Ref.graphql" -import { - DestinationFilter, - DestinationFilterRef, -} from "../../Fragments/DestinationFilter.graphql" -import { DestinationOverviewPageRef } from "../../Fragments/DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../../Fragments/HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "../../Fragments/LoyaltyPage/Ref.graphql" +import { Accordion_DestinationCityPage } from "../../Fragments/Blocks/Accordion.graphql" +import { Content_DestinationCityPage } from "../../Fragments/Blocks/Content.graphql" +import { DestinationFilter } from "../../Fragments/DestinationFilter.graphql" import { AccountPageLink } from "../../Fragments/PageLink/AccountPageLink.graphql" import { CampaignOverviewPageLink } from "../../Fragments/PageLink/CampaignOverviewPageLink.graphql" import { CampaignPageLink } from "../../Fragments/PageLink/CampaignPageLink.graphql" @@ -34,8 +15,6 @@ import { HotelPageLink } from "../../Fragments/PageLink/HotelPageLink.graphql" import { LoyaltyPageLink } from "../../Fragments/PageLink/LoyaltyPageLink.graphql" import { PromoCampaignPageLink } from "../../Fragments/PageLink/PromoCampaignPageLink.graphql" import { StartPageLink } from "../../Fragments/PageLink/StartPageLink.graphql" -import { PromoCampaignPageRef } from "../../Fragments/PromoCampaignPage/Ref.graphql" -import { StartPageRef } from "../../Fragments/StartPage/Ref.graphql" import { System } from "../../Fragments/System.graphql" export const GetDestinationCityPage = gql` @@ -126,76 +105,6 @@ export const GetDestinationCityPage = gql` ${PromoCampaignPageLink} ` -export const GetDestinationCityPageRefs = gql` - query GetDestinationCityPageRefs($locale: String!, $uid: String!) { - destination_city_page(locale: $locale, uid: $uid) { - destination_settings { - city_denmark - city_finland - city_germany - city_norway - city_poland - city_sweden - location { - longitude - latitude - default_zoom - } - } - sidepeek_content { - content { - embedded_itemsConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - blocks { - __typename - ...Accordion_DestinationCityPageRefs - ...Content_DestinationCityPageRefs - } - seo_filters { - ...DestinationFilterRef - } - system { - ...System - } - } - } - ${System} - ${Accordion_DestinationCityPageRefs} - ${Content_DestinationCityPageRefs} - ${DestinationFilterRef} - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` - export const GetDaDeEnUrlsDestinationCityPage = gql` query GetDaDeEnUrlsDestinationCityPage($uid: String!) { de: destination_city_page(locale: "de", uid: $uid) { diff --git a/packages/trpc/lib/graphql/Query/DestinationCountryPage/DestinationCountryPage.graphql.ts b/packages/trpc/lib/graphql/Query/DestinationCountryPage/DestinationCountryPage.graphql.ts index 9ca52fec2..2a2fc67e0 100644 --- a/packages/trpc/lib/graphql/Query/DestinationCountryPage/DestinationCountryPage.graphql.ts +++ b/packages/trpc/lib/graphql/Query/DestinationCountryPage/DestinationCountryPage.graphql.ts @@ -1,27 +1,8 @@ import { gql } from "graphql-tag" -import { AccountPageRef } from "../../Fragments/AccountPage/Ref.graphql" -import { - Accordion_DestinationCountryPage, - Accordion_DestinationCountryPageRefs, -} from "../../Fragments/Blocks/Accordion.graphql" -import { - Content_DestinationCountryPage, - Content_DestinationCountryPageRefs, -} from "../../Fragments/Blocks/Content.graphql" -import { CampaignOverviewPageRef } from "../../Fragments/CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../../Fragments/CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../../Fragments/CollectionPage/Ref.graphql" -import { ContentPageRef } from "../../Fragments/ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../../Fragments/DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../../Fragments/DestinationCountryPage/Ref.graphql" -import { - DestinationFilter, - DestinationFilterRef, -} from "../../Fragments/DestinationFilter.graphql" -import { DestinationOverviewPageRef } from "../../Fragments/DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../../Fragments/HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "../../Fragments/LoyaltyPage/Ref.graphql" +import { Accordion_DestinationCountryPage } from "../../Fragments/Blocks/Accordion.graphql" +import { Content_DestinationCountryPage } from "../../Fragments/Blocks/Content.graphql" +import { DestinationFilter } from "../../Fragments/DestinationFilter.graphql" import { AccountPageLink } from "../../Fragments/PageLink/AccountPageLink.graphql" import { CampaignOverviewPageLink } from "../../Fragments/PageLink/CampaignOverviewPageLink.graphql" import { CampaignPageLink } from "../../Fragments/PageLink/CampaignPageLink.graphql" @@ -34,8 +15,6 @@ import { HotelPageLink } from "../../Fragments/PageLink/HotelPageLink.graphql" import { LoyaltyPageLink } from "../../Fragments/PageLink/LoyaltyPageLink.graphql" import { PromoCampaignPageLink } from "../../Fragments/PageLink/PromoCampaignPageLink.graphql" import { StartPageLink } from "../../Fragments/PageLink/StartPageLink.graphql" -import { PromoCampaignPageRef } from "../../Fragments/PromoCampaignPage/Ref.graphql" -import { StartPageRef } from "../../Fragments/StartPage/Ref.graphql" import { System } from "../../Fragments/System.graphql" export const GetDestinationCountryPage = gql` @@ -121,63 +100,6 @@ export const GetDestinationCountryPage = gql` ${Content_DestinationCountryPage} ` -export const GetDestinationCountryPageRefs = gql` - query GetDestinationCountryPageRefs($locale: String!, $uid: String!) { - destination_country_page(locale: $locale, uid: $uid) { - sidepeek_content { - content { - embedded_itemsConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - blocks { - __typename - ...Accordion_DestinationCountryPageRefs - ...Content_DestinationCountryPageRefs - } - seo_filters { - ...DestinationFilterRef - } - system { - ...System - } - } - } - ${System} - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} - ${Accordion_DestinationCountryPageRefs} - ${Content_DestinationCountryPageRefs} - ${DestinationFilterRef} -` - export const GetDaDeEnUrlsDestinationCountryPage = gql` query GetDaDeEnUrlsDestinationCountryPage($uid: String!) { de: destination_country_page(locale: "de", uid: $uid) { diff --git a/packages/trpc/lib/graphql/Query/DestinationOverviewPage/DestinationOverviewPage.graphql.ts b/packages/trpc/lib/graphql/Query/DestinationOverviewPage/DestinationOverviewPage.graphql.ts index 2a450b42f..831887fb2 100644 --- a/packages/trpc/lib/graphql/Query/DestinationOverviewPage/DestinationOverviewPage.graphql.ts +++ b/packages/trpc/lib/graphql/Query/DestinationOverviewPage/DestinationOverviewPage.graphql.ts @@ -1,9 +1,6 @@ import { gql } from "graphql-tag" -import { - CardGallery_DestinationOverviewPage, - CardGallery_DestinationOverviewPageRefs, -} from "../../Fragments/Blocks/CardGallery.graphql" +import { CardGallery_DestinationOverviewPage } from "../../Fragments/Blocks/CardGallery.graphql" import { System } from "../../Fragments/System.graphql" export const GetDestinationOverviewPage = gql` @@ -34,22 +31,6 @@ export const GetDestinationOverviewPage = gql` ${CardGallery_DestinationOverviewPage} ` -export const GetDestinationOverviewPageRefs = gql` - query GetDestinationOverviewPageRefs($locale: String!, $uid: String!) { - destination_overview_page(locale: $locale, uid: $uid) { - blocks { - __typename - ...CardGallery_DestinationOverviewPageRefs - } - system { - ...System - } - } - } - ${System} - ${CardGallery_DestinationOverviewPageRefs} -` - export const GetDaDeEnUrlsDestinationOverviewPage = gql` query GetDaDeEnUrlsDestinationOverviewPage($uid: String!) { de: destination_overview_page(locale: "de", uid: $uid) { diff --git a/packages/trpc/lib/graphql/Query/Footer.graphql.ts b/packages/trpc/lib/graphql/Query/Footer.graphql.ts index c1b268891..b9c964a6b 100644 --- a/packages/trpc/lib/graphql/Query/Footer.graphql.ts +++ b/packages/trpc/lib/graphql/Query/Footer.graphql.ts @@ -1,17 +1,7 @@ import { gql } from "graphql-tag" -import { AccountPageRef } from "../Fragments/AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "../Fragments/CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../Fragments/CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../Fragments/CollectionPage/Ref.graphql" -import { ContentPageRef } from "../Fragments/ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../Fragments/DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../Fragments/DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "../Fragments/DestinationOverviewPage/Ref.graphql" import { AppDownloads } from "../Fragments/Footer/AppDownloads.graphql" import { SocialMedia } from "../Fragments/Footer/SocialMedia.graphql" -import { HotelPageRef } from "../Fragments/HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "../Fragments/LoyaltyPage/Ref.graphql" import { AccountPageLink } from "../Fragments/PageLink/AccountPageLink.graphql" import { CampaignOverviewPageLink } from "../Fragments/PageLink/CampaignOverviewPageLink.graphql" import { CampaignPageLink } from "../Fragments/PageLink/CampaignPageLink.graphql" @@ -24,9 +14,6 @@ import { HotelPageLink } from "../Fragments/PageLink/HotelPageLink.graphql" import { LoyaltyPageLink } from "../Fragments/PageLink/LoyaltyPageLink.graphql" import { PromoCampaignPageLink } from "../Fragments/PageLink/PromoCampaignPageLink.graphql" import { StartPageLink } from "../Fragments/PageLink/StartPageLink.graphql" -import { PromoCampaignPageRef } from "../Fragments/PromoCampaignPage/Ref.graphql" -import { StartPageRef } from "../Fragments/StartPage/Ref.graphql" -import { System } from "../Fragments/System.graphql" export const GetFooter = gql` query GetFooter($locale: String!) { @@ -133,90 +120,3 @@ export const GetFooter = gql` ${AppDownloads} ${SocialMedia} ` - -export const GetFooterRef = gql` - query GetFooterRef($locale: String!) { - all_footer(limit: 1, locale: $locale) { - items { - main_links { - pageConnection { - edges { - node { - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - secondary_links { - links { - pageConnection { - edges { - node { - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - tertiary_links { - pageConnection { - edges { - node { - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - system { - ...System - } - } - } - } - ${System} - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` diff --git a/packages/trpc/lib/graphql/Query/Header.graphql.ts b/packages/trpc/lib/graphql/Query/Header.graphql.ts index d9c6f1f6f..c7b1eb1a3 100644 --- a/packages/trpc/lib/graphql/Query/Header.graphql.ts +++ b/packages/trpc/lib/graphql/Query/Header.graphql.ts @@ -1,17 +1,6 @@ import { gql } from "graphql-tag" -import { AccountPageRef } from "../Fragments/AccountPage/Ref.graphql" import { CardBlock } from "../Fragments/Blocks/Card.graphql" -import { CardBlockRef } from "../Fragments/Blocks/Refs/Card.graphql" -import { CampaignOverviewPageRef } from "../Fragments/CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../Fragments/CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../Fragments/CollectionPage/Ref.graphql" -import { ContentPageRef } from "../Fragments/ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../Fragments/DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../Fragments/DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "../Fragments/DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../Fragments/HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "../Fragments/LoyaltyPage/Ref.graphql" import { AccountPageLink } from "../Fragments/PageLink/AccountPageLink.graphql" import { CampaignOverviewPageLink } from "../Fragments/PageLink/CampaignOverviewPageLink.graphql" import { CampaignPageLink } from "../Fragments/PageLink/CampaignPageLink.graphql" @@ -24,9 +13,6 @@ import { HotelPageLink } from "../Fragments/PageLink/HotelPageLink.graphql" import { LoyaltyPageLink } from "../Fragments/PageLink/LoyaltyPageLink.graphql" import { PromoCampaignPageLink } from "../Fragments/PageLink/PromoCampaignPageLink.graphql" import { StartPageLink } from "../Fragments/PageLink/StartPageLink.graphql" -import { PromoCampaignPageRef } from "../Fragments/PromoCampaignPage/Ref.graphql" -import { StartPageRef } from "../Fragments/StartPage/Ref.graphql" -import { System } from "../Fragments/System.graphql" export const GetHeader = gql` query GetHeader($locale: String!) { @@ -199,146 +185,3 @@ export const GetHeader = gql` ${StartPageLink} ${PromoCampaignPageLink} ` - -export const GetHeaderRef = gql` - query GetHeaderRef($locale: String!) { - all_header(limit: 1, locale: $locale) { - items { - top_link { - logged_in { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - logged_out { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - menu_items { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - see_all_link { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - submenu { - links { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - } - cardConnection { - edges { - node { - __typename - ...CardBlockRef - } - } - } - } - system { - ...System - } - } - } - } - ${System} - ${CardBlockRef} - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` diff --git a/packages/trpc/lib/graphql/Query/HotelPage/HotelPage.graphql.ts b/packages/trpc/lib/graphql/Query/HotelPage/HotelPage.graphql.ts index 879d3a883..8da62d843 100644 --- a/packages/trpc/lib/graphql/Query/HotelPage/HotelPage.graphql.ts +++ b/packages/trpc/lib/graphql/Query/HotelPage/HotelPage.graphql.ts @@ -4,12 +4,6 @@ import { AccordionBlock, GlobalAccordionBlock, } from "../../Fragments/Blocks/Accordion.graphql" -import { - AccordionBlockRefs, - GlobalAccordionBlockRefs, -} from "../../Fragments/Blocks/Refs/Accordion.graphql" -import { CollectionPageRef } from "../../Fragments/CollectionPage/Ref.graphql" -import { ContentPageRef } from "../../Fragments/ContentPage/Ref.graphql" import { CollectionPageLink } from "../../Fragments/PageLink/CollectionPageLink.graphql" import { ContentPageLink } from "../../Fragments/PageLink/ContentPageLink.graphql" import { System } from "../../Fragments/System.graphql" @@ -121,52 +115,6 @@ export const GetHotelPage = gql` ${CollectionPageLink} ` -export const GetHotelPageRefs = gql` - query GetHotelPageRefs($locale: String!, $uid: String!) { - hotel_page(locale: $locale, uid: $uid) { - faq { - global_faqConnection { - edges { - node { - ...AccordionBlockRefs - } - } - } - specific_faq { - ...GlobalAccordionBlockRefs - } - } - content { - __typename - ... on HotelPageContentUpcomingActivitiesCard { - upcoming_activities_card { - hotel_page_activities_content_pageConnection { - edges { - node { - __typename - ...CollectionPageRef - ...ContentPageRef - } - } - } - } - } - } - system { - ...System - } - } - trackingProps: hotel_page(locale: "en", uid: $uid) { - url - } - } - ${CollectionPageRef} - ${ContentPageRef} - ${AccordionBlockRefs} - ${GlobalAccordionBlockRefs} - ${System} -` - export const GetDaDeEnUrlsHotelPage = gql` query GetDaDeEnUrlsHotelPage($uid: String!) { de: hotel_page(locale: "de", uid: $uid) { diff --git a/packages/trpc/lib/graphql/Query/LoyaltyPage/LoyaltyPage.graphql.ts b/packages/trpc/lib/graphql/Query/LoyaltyPage/LoyaltyPage.graphql.ts index 9a99a1f07..8a9d6e9fd 100644 --- a/packages/trpc/lib/graphql/Query/LoyaltyPage/LoyaltyPage.graphql.ts +++ b/packages/trpc/lib/graphql/Query/LoyaltyPage/LoyaltyPage.graphql.ts @@ -1,30 +1,12 @@ import { gql } from "graphql-tag" -import { - CardsGrid_LoyaltyPage, - CardsGrid_LoyaltyPageRefs, -} from "../../Fragments/Blocks/CardsGrid.graphql" -import { - Content_LoyaltyPage, - Content_LoyaltyPageRefs, -} from "../../Fragments/Blocks/Content.graphql" -import { - DynamicContent_LoyaltyPage, - DynamicContent_LoyaltyPageRefs, -} from "../../Fragments/Blocks/DynamicContent.graphql" -import { - Shortcuts_LoyaltyPage, - Shortcuts_LoyaltyPageRefs, -} from "../../Fragments/Blocks/Shortcuts.graphql" -import { - ContentSidebar_LoyaltyPage, - ContentSidebar_LoyaltyPageRefs, -} from "../../Fragments/Sidebar/Content.graphql" +import { CardsGrid_LoyaltyPage } from "../../Fragments/Blocks/CardsGrid.graphql" +import { Content_LoyaltyPage } from "../../Fragments/Blocks/Content.graphql" +import { DynamicContent_LoyaltyPage } from "../../Fragments/Blocks/DynamicContent.graphql" +import { Shortcuts_LoyaltyPage } from "../../Fragments/Blocks/Shortcuts.graphql" +import { ContentSidebar_LoyaltyPage } from "../../Fragments/Sidebar/Content.graphql" import { DynamicContentSidebar_LoyaltyPage } from "../../Fragments/Sidebar/DynamicContent.graphql" -import { - JoinLoyaltyContactSidebar_LoyaltyPage, - JoinLoyaltyContactSidebar_LoyaltyPageRefs, -} from "../../Fragments/Sidebar/JoinLoyaltyContact.graphql" +import { JoinLoyaltyContactSidebar_LoyaltyPage } from "../../Fragments/Sidebar/JoinLoyaltyContact.graphql" import { System } from "../../Fragments/System.graphql" export const GetLoyaltyPage = gql` @@ -67,35 +49,6 @@ export const GetLoyaltyPage = gql` ${JoinLoyaltyContactSidebar_LoyaltyPage} ` -export const GetLoyaltyPageRefs = gql` - 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 - } - } - } - ${System} - ${CardsGrid_LoyaltyPageRefs} - ${Content_LoyaltyPageRefs} - ${DynamicContent_LoyaltyPageRefs} - ${Shortcuts_LoyaltyPageRefs} - ${ContentSidebar_LoyaltyPageRefs} - ${JoinLoyaltyContactSidebar_LoyaltyPageRefs} -` - export const GetDaDeEnUrlsLoyaltyPage = gql` query GetDaDeEnUrlsLoyaltyPage($uid: String!) { de: loyalty_page(locale: "de", uid: $uid) { diff --git a/packages/trpc/lib/graphql/Query/PromoCampaignPage/PromoCampaignPage.graphql.ts b/packages/trpc/lib/graphql/Query/PromoCampaignPage/PromoCampaignPage.graphql.ts index 36bf48471..baaf09a0e 100644 --- a/packages/trpc/lib/graphql/Query/PromoCampaignPage/PromoCampaignPage.graphql.ts +++ b/packages/trpc/lib/graphql/Query/PromoCampaignPage/PromoCampaignPage.graphql.ts @@ -1,13 +1,7 @@ import { gql } from "graphql-tag" -import { - Accordion_PromoCampaignPage, - Accordion_PromoCampaignPageRefs, -} from "../../Fragments/Blocks/Accordion.graphql" -import { - Content_PromoCampaignPage, - Content_PromoCampaignPageRefs, -} from "../../Fragments/Blocks/Content.graphql" +import { Accordion_PromoCampaignPage } from "../../Fragments/Blocks/Accordion.graphql" +import { Content_PromoCampaignPage } from "../../Fragments/Blocks/Content.graphql" import { System } from "../../Fragments/System.graphql" export const GetPromoCampaignPage = gql` @@ -49,24 +43,6 @@ export const GetPromoCampaignPage = gql` ${Content_PromoCampaignPage} ` -export const GetPromoCampaignPageRefs = gql` - query GetPromoCampaignPageRefs($locale: String!, $uid: String!) { - promo_campaign_page(locale: $locale, uid: $uid) { - blocks { - __typename - ...Accordion_PromoCampaignPageRefs - ...Content_PromoCampaignPageRefs - } - system { - ...System - } - } - } - ${System} - ${Accordion_PromoCampaignPageRefs} - ${Content_PromoCampaignPageRefs} -` - export const GetDaDeEnUrlsPromoCampaignPage = gql` query GetDaDeEnUrlsPromoCampaignPage($uid: String!) { de: promo_campaign_page(locale: "de", uid: $uid) { diff --git a/packages/trpc/lib/graphql/Query/RewardsWithRedeem.graphql.ts b/packages/trpc/lib/graphql/Query/RewardsWithRedeem.graphql.ts index 98d8abb16..3877efc99 100644 --- a/packages/trpc/lib/graphql/Query/RewardsWithRedeem.graphql.ts +++ b/packages/trpc/lib/graphql/Query/RewardsWithRedeem.graphql.ts @@ -1,15 +1,5 @@ import { gql } from "graphql-tag" -import { AccountPageRef } from "../Fragments/AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "../Fragments/CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../Fragments/CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../Fragments/CollectionPage/Ref.graphql" -import { ContentPageRef } from "../Fragments/ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../Fragments/DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../Fragments/DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "../Fragments/DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../Fragments/HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "../Fragments/LoyaltyPage/Ref.graphql" import { AccountPageLink } from "../Fragments/PageLink/AccountPageLink.graphql" import { CampaignOverviewPageLink } from "../Fragments/PageLink/CampaignOverviewPageLink.graphql" import { CampaignPageLink } from "../Fragments/PageLink/CampaignPageLink.graphql" @@ -22,9 +12,6 @@ import { HotelPageLink } from "../Fragments/PageLink/HotelPageLink.graphql" import { LoyaltyPageLink } from "../Fragments/PageLink/LoyaltyPageLink.graphql" import { PromoCampaignPageLink } from "../Fragments/PageLink/PromoCampaignPageLink.graphql" import { StartPageLink } from "../Fragments/PageLink/StartPageLink.graphql" -import { PromoCampaignPageRef } from "../Fragments/PromoCampaignPage/Ref.graphql" -import { StartPageRef } from "../Fragments/StartPage/Ref.graphql" -import { System } from "../Fragments/System.graphql" export const GetRewards = gql` query GetRewards($locale: String!, $rewardIds: [String!]) { @@ -77,49 +64,3 @@ export const GetRewards = gql` ${StartPageLink} ${PromoCampaignPageLink} ` - -export const GetRewardsRef = gql` - query GetRewardsRef($locale: String!, $rewardIds: [String!]) { - all_reward(locale: $locale, where: { reward_id_in: $rewardIds }) { - items { - redeem_description { - embedded_itemsConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - system { - ...System - } - } - } - } - ${System} - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} -` diff --git a/packages/trpc/lib/graphql/Query/SiteConfig.graphql.ts b/packages/trpc/lib/graphql/Query/SiteConfig.graphql.ts index 3f74aab97..0f3b53299 100644 --- a/packages/trpc/lib/graphql/Query/SiteConfig.graphql.ts +++ b/packages/trpc/lib/graphql/Query/SiteConfig.graphql.ts @@ -1,7 +1,6 @@ import { gql } from "graphql-tag" -import { Alert, AlertRef } from "../Fragments/Alert.graphql" -import { System } from "../Fragments/System.graphql" +import { Alert } from "../Fragments/Alert.graphql" export const GetSiteConfig = gql` query GetSiteConfig($locale: String!) { @@ -24,28 +23,3 @@ export const GetSiteConfig = gql` } ${Alert} ` - -export const GetSiteConfigRef = gql` - query GetSiteConfigRef($locale: String!) { - all_site_config(limit: 1, locale: $locale) { - items { - sitewide_alert { - alerts { - alertConnection { - edges { - node { - ...AlertRef - } - } - } - } - } - system { - ...System - } - } - } - } - ${System} - ${AlertRef} -` diff --git a/packages/trpc/lib/graphql/Query/SitewideCampaignBanner.graphql.ts b/packages/trpc/lib/graphql/Query/SitewideCampaignBanner.graphql.ts index f17b3cdd7..eb0dbe608 100644 --- a/packages/trpc/lib/graphql/Query/SitewideCampaignBanner.graphql.ts +++ b/packages/trpc/lib/graphql/Query/SitewideCampaignBanner.graphql.ts @@ -1,7 +1,6 @@ import { gql } from "graphql-tag" -import { Banner, BannerRef } from "../Fragments/Banner.graphql" -import { System } from "../Fragments/System.graphql" +import { Banner } from "../Fragments/Banner.graphql" export const GetSitewideCampaignBanner = gql` query GetSitewideCampaignBanner($locale: String!) { @@ -19,24 +18,3 @@ export const GetSitewideCampaignBanner = gql` } ${Banner} ` - -export const GetSitewideCampaignBannerRef = gql` - query GetSitewideCampaignBannerRef($locale: String!) { - all_sitewide_campaign_banner(limit: 1, locale: $locale) { - items { - bannerConnection { - edges { - node { - ...BannerRef - } - } - } - system { - ...System - } - } - } - } - ${System} - ${BannerRef} -` diff --git a/packages/trpc/lib/graphql/Query/StartPage/StartPage.graphql.ts b/packages/trpc/lib/graphql/Query/StartPage/StartPage.graphql.ts index f89d229e7..905bbacbe 100644 --- a/packages/trpc/lib/graphql/Query/StartPage/StartPage.graphql.ts +++ b/packages/trpc/lib/graphql/Query/StartPage/StartPage.graphql.ts @@ -1,25 +1,10 @@ import { gql } from "graphql-tag" -import { - CardsGrid_StartPage, - CardsGrid_StartPageRefs, -} from "../../Fragments/Blocks/CardsGrid.graphql" -import { - CarouselCards_StartPage, - CarouselCards_StartPageRefs, -} from "../../Fragments/Blocks/CarouselCards.graphql" -import { - FullWidthCampaign, - FullWidthCampaignRefs, -} from "../../Fragments/Blocks/FullWidthCampaign.graphql" -import { - JoinScandicFriends_StartPage, - JoinScandicFriends_StartPageRefs, -} from "../../Fragments/Blocks/JoinScandicFriends.graphql" -import { - VideoCard_StartPage, - VideoCard_StartPageRefs, -} from "../../Fragments/Blocks/VideoCard.graphql" +import { CardsGrid_StartPage } from "../../Fragments/Blocks/CardsGrid.graphql" +import { CarouselCards_StartPage } from "../../Fragments/Blocks/CarouselCards.graphql" +import { FullWidthCampaign } from "../../Fragments/Blocks/FullWidthCampaign.graphql" +import { JoinScandicFriends_StartPage } from "../../Fragments/Blocks/JoinScandicFriends.graphql" +import { VideoCard_StartPage } from "../../Fragments/Blocks/VideoCard.graphql" import { System } from "../../Fragments/System.graphql" export const GetStartPage = gql` @@ -68,40 +53,6 @@ export const GetStartPage = gql` ${VideoCard_StartPage} ` -export const GetStartPageRefs = gql` - query GetStartPageRefs($locale: String!, $uid: String!) { - start_page(locale: $locale, uid: $uid) { - blocks { - __typename - ...CardsGrid_StartPageRefs - ...CarouselCards_StartPageRefs - ... on StartPageBlocksFullWidthCampaign { - full_width_campaign { - full_width_campaignConnection { - edges { - node { - ...FullWidthCampaignRefs - } - } - } - } - } - ...JoinScandicFriends_StartPageRefs - ...VideoCard_StartPageRefs - } - system { - ...System - } - } - } - ${System} - ${CardsGrid_StartPageRefs} - ${FullWidthCampaignRefs} - ${CarouselCards_StartPageRefs} - ${JoinScandicFriends_StartPageRefs} - ${VideoCard_StartPageRefs} -` - export const GetDaDeEnUrlsStartPage = gql` query GetDaDeEnUrlsStartPage($uid: String!) { de: start_page(locale: "de", uid: $uid) { diff --git a/packages/trpc/lib/graphql/Query/UsePointsModal.graphql.ts b/packages/trpc/lib/graphql/Query/UsePointsModal.graphql.ts index a59618f10..6b2a65455 100644 --- a/packages/trpc/lib/graphql/Query/UsePointsModal.graphql.ts +++ b/packages/trpc/lib/graphql/Query/UsePointsModal.graphql.ts @@ -1,15 +1,5 @@ import { gql } from "graphql-tag" -import { AccountPageRef } from "../Fragments/AccountPage/Ref.graphql" -import { CampaignOverviewPageRef } from "../Fragments/CampaignOverviewPage/Ref.graphql" -import { CampaignPageRef } from "../Fragments/CampaignPage/Ref.graphql" -import { CollectionPageRef } from "../Fragments/CollectionPage/Ref.graphql" -import { ContentPageRef } from "../Fragments/ContentPage/Ref.graphql" -import { DestinationCityPageRef } from "../Fragments/DestinationCityPage/Ref.graphql" -import { DestinationCountryPageRef } from "../Fragments/DestinationCountryPage/Ref.graphql" -import { DestinationOverviewPageRef } from "../Fragments/DestinationOverviewPage/Ref.graphql" -import { HotelPageRef } from "../Fragments/HotelPage/Ref.graphql" -import { LoyaltyPageRef } from "../Fragments/LoyaltyPage/Ref.graphql" import { AccountPageLink } from "../Fragments/PageLink/AccountPageLink.graphql" import { CampaignOverviewPageLink } from "../Fragments/PageLink/CampaignOverviewPageLink.graphql" import { CampaignPageLink } from "../Fragments/PageLink/CampaignPageLink.graphql" @@ -22,9 +12,6 @@ import { HotelPageLink } from "../Fragments/PageLink/HotelPageLink.graphql" import { LoyaltyPageLink } from "../Fragments/PageLink/LoyaltyPageLink.graphql" import { PromoCampaignPageLink } from "../Fragments/PageLink/PromoCampaignPageLink.graphql" import { StartPageLink } from "../Fragments/PageLink/StartPageLink.graphql" -import { PromoCampaignPageRef } from "../Fragments/PromoCampaignPage/Ref.graphql" -import { StartPageRef } from "../Fragments/StartPage/Ref.graphql" -import { System } from "../Fragments/System.graphql" export const GetUsePointsModal = gql` query GetUsePointsModal($locale: String!) { @@ -75,48 +62,3 @@ export const GetUsePointsModal = gql` ${StartPageLink} ${PromoCampaignPageLink} ` -export const GetUsePointsModalRefs = gql` - query GetUsePointsModalRefs($locale: String!) { - all_usepointsmodal(locale: $locale) { - items { - link_group { - linkConnection { - edges { - node { - __typename - ...AccountPageRef - ...CampaignOverviewPageRef - ...CampaignPageRef - ...CollectionPageRef - ...ContentPageRef - ...DestinationCityPageRef - ...DestinationCountryPageRef - ...DestinationOverviewPageRef - ...HotelPageRef - ...LoyaltyPageRef - ...StartPageRef - ...PromoCampaignPageRef - } - } - } - } - system { - ...System - } - } - } - } - ${AccountPageRef} - ${CampaignOverviewPageRef} - ${CampaignPageRef} - ${CollectionPageRef} - ${ContentPageRef} - ${DestinationCityPageRef} - ${DestinationCountryPageRef} - ${DestinationOverviewPageRef} - ${HotelPageRef} - ${LoyaltyPageRef} - ${StartPageRef} - ${PromoCampaignPageRef} - ${System} -` diff --git a/packages/trpc/lib/routers/contentstack/UsePointsModal/output.ts b/packages/trpc/lib/routers/contentstack/UsePointsModal/output.ts index 7d9a4919c..80900cbc7 100644 --- a/packages/trpc/lib/routers/contentstack/UsePointsModal/output.ts +++ b/packages/trpc/lib/routers/contentstack/UsePointsModal/output.ts @@ -3,14 +3,9 @@ import { z } from "zod" import { transformedImageVaultAssetSchema } from "@scandic-hotels/common/utils/imageVault" import { IconName } from "@scandic-hotels/design-system/Icons/iconName" -import { - linkConnectionRefs, - linkConnectionSchema, -} from "../schemas/linkConnection" -import { systemSchema } from "../schemas/system" +import { linkConnectionSchema } from "../schemas/linkConnection" export type UsePointsModalData = z.output -export type UsePointsModalRefsData = z.output type LinkGroupItem = z.infer const linkGroupItemSchema = z.intersection( @@ -57,16 +52,3 @@ export const usePointsModalSchema = z.object({ }) .optional(), }) - -export const usePointsModalRefsSchema = z.object({ - all_usepointsmodal: z - .object({ - items: z.array( - z.object({ - link_group: z.array(linkConnectionRefs), - system: systemSchema, - }) - ), - }) - .optional(), -}) diff --git a/packages/trpc/lib/routers/contentstack/UsePointsModal/query.ts b/packages/trpc/lib/routers/contentstack/UsePointsModal/query.ts index e3244235f..ad58b27b2 100644 --- a/packages/trpc/lib/routers/contentstack/UsePointsModal/query.ts +++ b/packages/trpc/lib/routers/contentstack/UsePointsModal/query.ts @@ -2,66 +2,15 @@ import { createCounter } from "@scandic-hotels/common/telemetry" import { router } from "../../.." import { notFoundError } from "../../../errors" -import { - GetUsePointsModal, - GetUsePointsModalRefs, -} from "../../../graphql/Query/UsePointsModal.graphql" +import { GetUsePointsModal } from "../../../graphql/Query/UsePointsModal.graphql" import { request } from "../../../graphql/request" import { contentstackBaseProcedure } from "../../../procedures" -import { - generateRefsResponseTag, - generateTag, - generateTagsFromSystem, -} from "../../../utils/generateTag" -import { - type UsePointsModalData, - type UsePointsModalRefsData, - usePointsModalRefsSchema, - usePointsModalSchema, -} from "./output" -import { getConnections } from "./utils" +import { generateTag } from "../../../utils/generateTag" +import { type UsePointsModalData, usePointsModalSchema } from "./output" export const usePointsModalQueryRouter = router({ get: contentstackBaseProcedure.query(async ({ ctx }) => { const { lang, uid } = ctx - const getRefsCounter = createCounter( - "trpc.contentstack.usePointsModal.get.refs" - ) - const metricsRefs = getRefsCounter.init({ - lang, - uid, - }) - - metricsRefs.start() - const refsTag = generateRefsResponseTag(lang, "usepointsmodal") - - const variables = { locale: lang } - const refsResponse = await request( - GetUsePointsModalRefs, - variables, - { - key: refsTag, - ttl: "max", - } - ) - if (!refsResponse.data) { - metricsRefs.noDataError() - throw notFoundError({ - message: "GetUsePointsModalRefs returned no data", - errorDetails: variables, - }) - } - - const validatedRefsData = usePointsModalRefsSchema.safeParse( - refsResponse.data - ) - - if (!validatedRefsData.success) { - metricsRefs.validationError(validatedRefsData.error) - return null - } - - metricsRefs.success() const getCounter = createCounter("trpc.contentstack.usePointsModal.get") @@ -71,18 +20,13 @@ export const usePointsModalQueryRouter = router({ }) metrics.start() - const connections = getConnections(validatedRefsData.data) - - const tags = [ - generateTagsFromSystem(lang, connections), - generateTag(lang, "usepointsmodal"), - ].flat() + const variables = { locale: lang } const response = await request( GetUsePointsModal, variables, { - key: tags, + key: generateTag(lang, "usepointsmodal"), ttl: "max", } ) diff --git a/packages/trpc/lib/routers/contentstack/UsePointsModal/utils.ts b/packages/trpc/lib/routers/contentstack/UsePointsModal/utils.ts deleted file mode 100644 index 440c40f4a..000000000 --- a/packages/trpc/lib/routers/contentstack/UsePointsModal/utils.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { System } from "../schemas/system" -import type { UsePointsModalRefsData } from "./output" - -export function getConnections({ all_usepointsmodal }: UsePointsModalRefsData) { - const connections: System["system"][] = all_usepointsmodal?.items?.[0] - ? [all_usepointsmodal?.items?.[0]?.system] - : [] - - if (all_usepointsmodal && all_usepointsmodal.items) { - all_usepointsmodal?.items.forEach((item) => { - item.link_group.forEach((link) => { - link.link?.uid && connections.push(link.link) - }) - }) - } - return connections -} diff --git a/packages/trpc/lib/routers/contentstack/accountPage/output.ts b/packages/trpc/lib/routers/contentstack/accountPage/output.ts index 537ae82fe..0b4b7c666 100644 --- a/packages/trpc/lib/routers/contentstack/accountPage/output.ts +++ b/packages/trpc/lib/routers/contentstack/accountPage/output.ts @@ -4,18 +4,9 @@ import { transformedImageVaultAssetSchema } from "@scandic-hotels/common/utils/i import { AccountPageEnum } from "../../../types/accountPageEnum" import { discriminatedUnionArray } from "../../../utils/discriminatedUnion" -import { - accordionRefsSchema, - accordionSchema, -} from "../schemas/blocks/accordion" -import { - dynamicContentRefsSchema, - dynamicContentSchema, -} from "../schemas/blocks/dynamicContent" -import { - shortcutsRefsSchema, - shortcutsSchema, -} from "../schemas/blocks/shortcuts" +import { accordionSchema } from "../schemas/blocks/accordion" +import { dynamicContentSchema } from "../schemas/blocks/dynamicContent" +import { shortcutsSchema } from "../schemas/blocks/shortcuts" import { textContentSchema } from "../schemas/blocks/textContent" import { systemSchema } from "../schemas/system" @@ -73,37 +64,3 @@ export const accountPageSchema = z.object({ url: z.string(), }), }) - -const accountPageAccordionRefs = z - .object({ - __typename: z.literal(AccountPageEnum.ContentStack.blocks.Accordion), - }) - .merge(accordionRefsSchema) - -const accountPageDynamicContentRefs = z - .object({ - __typename: z.literal(AccountPageEnum.ContentStack.blocks.DynamicContent), - }) - .merge(dynamicContentRefsSchema) - -const accountPageShortcutsRefs = z - .object({ - __typename: z.literal(AccountPageEnum.ContentStack.blocks.ShortCuts), - }) - .merge(shortcutsRefsSchema) - -const accountPageContentItemRefs = z.discriminatedUnion("__typename", [ - z.object({ - __typename: z.literal(AccountPageEnum.ContentStack.blocks.TextContent), - }), - accountPageAccordionRefs, - accountPageDynamicContentRefs, - accountPageShortcutsRefs, -]) - -export const accountPageRefsSchema = z.object({ - account_page: z.object({ - content: discriminatedUnionArray(accountPageContentItemRefs.options), - system: systemSchema, - }), -}) diff --git a/packages/trpc/lib/routers/contentstack/accountPage/query.ts b/packages/trpc/lib/routers/contentstack/accountPage/query.ts index 55f7b8f33..28079fcc9 100644 --- a/packages/trpc/lib/routers/contentstack/accountPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/accountPage/query.ts @@ -2,82 +2,31 @@ import { createCounter } from "@scandic-hotels/common/telemetry" import { router } from "../../.." import { notFoundError } from "../../../errors" -import { - GetAccountPage, - GetAccountPageRefs, -} from "../../../graphql/Query/AccountPage/AccountPage.graphql" +import { GetAccountPage } from "../../../graphql/Query/AccountPage/AccountPage.graphql" import { request } from "../../../graphql/request" import { contentstackExtendedProcedureUID } from "../../../procedures" -import { - generateRefsResponseTag, - generateTag, - generateTagsFromSystem, -} from "../../../utils/generateTag" -import { accountPageRefsSchema, accountPageSchema } from "./output" -import { getConnections } from "./utils" +import { generateTag } from "../../../utils/generateTag" +import { accountPageSchema } from "./output" -import type { - GetAccountPageRefsSchema, - GetAccountPageSchema, -} from "../../../types/accountPage" +import type { GetAccountPageSchema } from "../../../types/accountPage" import type { TrackingPageData } from "../../types" export const accountPageQueryRouter = router({ get: contentstackExtendedProcedureUID.query(async ({ ctx }) => { const { lang, uid } = ctx - const getAccountPageRefsCounter = createCounter( - "trpc.contentstack.accountPage.get.refs" - ) - const metricsRefs = getAccountPageRefsCounter.init({ lang, uid }) - metricsRefs.start() - - const variables = { locale: lang, uid } - const refsResponse = await request( - GetAccountPageRefs, - variables, - { - key: generateRefsResponseTag(lang, uid), - ttl: "max", - } - ) - - if (!refsResponse.data) { - metricsRefs.noDataError() - throw notFoundError({ - message: "GetAccountPageRefs returned no data", - errorDetails: variables, - }) - } - - const validatedAccountPageRefs = accountPageRefsSchema.safeParse( - refsResponse.data - ) - if (!validatedAccountPageRefs.success) { - metricsRefs.validationError(validatedAccountPageRefs.error) - return null - } - - const connections = getConnections(validatedAccountPageRefs.data) - - const tags = [ - generateTagsFromSystem(lang, connections), - generateTag(lang, validatedAccountPageRefs.data.account_page.system.uid), - ].flat() - - metricsRefs.success() - const getAccountPageCounter = createCounter( "trpc.contentstack.accountPage.get" ) const metrics = getAccountPageCounter.init({ lang, uid }) metrics.start() + const variables = { locale: lang, uid } const response = await request( GetAccountPage, variables, { - key: tags, + key: generateTag(lang, uid), ttl: "max", } ) diff --git a/packages/trpc/lib/routers/contentstack/accountPage/utils.ts b/packages/trpc/lib/routers/contentstack/accountPage/utils.ts deleted file mode 100644 index 14e0abbb6..000000000 --- a/packages/trpc/lib/routers/contentstack/accountPage/utils.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { AccountPageEnum } from "../../../types/accountPageEnum" - -import type { AccountPageRefs } from "../../../types/accountPage" -import type { System } from "../schemas/system" - -export function getConnections({ account_page }: AccountPageRefs) { - const connections: System["system"][] = [account_page.system] - - if (account_page.content) { - account_page.content.forEach((block) => { - switch (block.__typename) { - case AccountPageEnum.ContentStack.blocks.ShortCuts: { - if (block.shortcuts.shortcuts.length) { - connections.push(...block.shortcuts.shortcuts.filter((c) => !!c)) - } - break - } - case AccountPageEnum.ContentStack.blocks.DynamicContent: { - if (block.dynamic_content.link) { - connections.push(block.dynamic_content.link) - } - break - } - } - }) - } - - return connections -} diff --git a/packages/trpc/lib/routers/contentstack/base/output.ts b/packages/trpc/lib/routers/contentstack/base/output.ts index af494d16e..c05b5ea63 100644 --- a/packages/trpc/lib/routers/contentstack/base/output.ts +++ b/packages/trpc/lib/routers/contentstack/base/output.ts @@ -11,20 +11,14 @@ import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/string import { discriminatedUnion } from "../../../utils/discriminatedUnion" import { - infoCardBlockRefsSchema, infoCardBlockSchema, - transformCardBlockRefs, transformInfoCardBlock, } from "../schemas/blocks/cardsGrid" -import { linkConnectionRefsSchema } from "../schemas/blocks/utils/linkConnection" import { - linkRefsUnionSchema, linkUnionSchema, rawLinkUnionSchema, transformPageLink, - transformPageLinkRef, } from "../schemas/pageLinks" -import { systemSchema } from "../schemas/system" // Help me write this zod schema based on the type ContactConfig export const validateContactConfigSchema = z.object({ @@ -218,150 +212,6 @@ export const validateFooterConfigSchema = z } }) -const pageConnectionRefs = z.object({ - edges: z - .array( - z.object({ - node: z.object({ - system: systemSchema, - }), - }) - ) - .max(1), -}) - -export const validateFooterRefConfigSchema = z.object({ - all_footer: z.object({ - items: z - .array( - z.object({ - main_links: z - .array( - z.object({ - pageConnection: pageConnectionRefs, - }) - ) - .nullable(), - secondary_links: z - .array( - z.object({ - links: z.array( - z.object({ - pageConnection: pageConnectionRefs, - }) - ), - }) - ) - .nullable(), - tertiary_links: z - .array( - z.object({ - pageConnection: pageConnectionRefs, - }) - ) - .nullable(), - system: systemSchema, - }) - ) - .length(1), - }), -}) - -/** - * New Header Validation - */ - -const linkRefsSchema = z - .object({ - linkConnection: z.object({ - edges: z.array( - z.object({ - node: linkRefsUnionSchema, - }) - ), - }), - }) - .transform((data) => { - if (data.linkConnection.edges.length) { - const link = transformPageLinkRef(data.linkConnection.edges[0].node) - if (link) { - return { - link, - } - } - } - return { link: null } - }) - -const menuItemsRefsSchema = z.intersection( - linkRefsSchema, - z - .object({ - cardConnection: z.object({ - edges: z.array( - z.object({ - node: infoCardBlockRefsSchema, - }) - ), - }), - see_all_link: linkRefsSchema, - submenu: z.array( - z.object({ - links: z.array(linkRefsSchema), - }) - ), - }) - .transform((data) => { - let card = null - if (data.cardConnection.edges.length) { - card = transformCardBlockRefs(data.cardConnection.edges[0].node) - } - - return { - card, - see_all_link: data.see_all_link, - submenu: data.submenu, - } - }) -) - -const topLinkRefsSchema = z.object({ - logged_in: linkRefsSchema.nullable(), - logged_out: linkRefsSchema.nullable(), -}) - -export const headerRefsSchema = z - .object({ - all_header: z.object({ - items: z - .array( - z.object({ - menu_items: z.array(menuItemsRefsSchema), - system: systemSchema, - top_link: topLinkRefsSchema, - }) - ) - .max(1), - }), - }) - .transform((data) => { - if (!data.all_header.items.length) { - logger.error(`Zod Error - No header returned in refs request`) - throw new ZodError([ - { - code: ZodIssueCode.custom, - fatal: true, - message: "No header returned (Refs)", - path: ["all_header.items"], - }, - ]) - } - - return { - header: data.all_header.items[0], - } - }) - const internalOrExternalLinkSchema = z .object({ is_contentstack_link: z.boolean().nullish(), @@ -687,57 +537,6 @@ export const siteConfigSchema = z } }) -const sidepeekContentRefSchema = z.object({ - content: z.object({ - embedded_itemsConnection: z.object({ - edges: z.array( - z.object({ - node: linkRefsUnionSchema, - }) - ), - }), - }), -}) - -const alertConnectionRefSchema = z.object({ - edges: z.array( - z.object({ - node: z.object({ - link: linkRefsSchema, - sidepeek_content: sidepeekContentRefSchema, - system: systemSchema, - }), - }) - ), - visible_on: z.array(z.string()).nullish().default([]), -}) - -export const siteConfigRefSchema = z.object({ - all_site_config: z.object({ - items: z.array( - z.object({ - sitewide_alert: z - .object({ - alerts: z - .array( - z.object({ - alertConnection: alertConnectionRefSchema, - }) - ) - .nullable(), - }) - .transform((data) => { - const sitewideAlertWeb = data.alerts?.find((alert) => - alert.alertConnection.visible_on?.includes(AlertVisibleOnEnum.WEB) - ) - return { alert: sitewideAlertWeb || null } - }), - system: systemSchema, - }) - ), - }), -}) - const bannerSchema = z .object({ tag: z.string(), @@ -762,20 +561,6 @@ const bannerSchema = z } }) -const bannerRefSchema = z - .object({ - link: linkConnectionRefsSchema, - visible_on: z.array(z.string()).nullish().default([]), - system: systemSchema, - }) - .transform(({ link, visible_on, system }) => { - return { - linkSystem: link, - visible_on, - system, - } - }) - export const sitewideCampaignBannerSchema = z .object({ all_sitewide_campaign_banner: z.object({ @@ -806,29 +591,3 @@ export const sitewideCampaignBannerSchema = z return sitewideCampaignBannerWeb?.node ?? null }) - -export const sitewideCampaignBannerRefSchema = z.object({ - all_sitewide_campaign_banner: z - .object({ - items: z.array( - z.object({ - bannerConnection: z.object({ - edges: z.array( - z.object({ - node: bannerRefSchema, - }) - ), - }), - system: systemSchema, - }) - ), - }) - .transform((data) => { - const webBanner = data.items.find((item) => { - const bannerNode = item.bannerConnection.edges[0]?.node - return bannerNode?.visible_on?.includes(AlertVisibleOnEnum.WEB) - }) - - return webBanner ?? null - }), -}) diff --git a/packages/trpc/lib/routers/contentstack/base/query.ts b/packages/trpc/lib/routers/contentstack/base/query.ts index 5726485c9..31986144d 100644 --- a/packages/trpc/lib/routers/contentstack/base/query.ts +++ b/packages/trpc/lib/routers/contentstack/base/query.ts @@ -5,57 +5,31 @@ import { createCounter } from "@scandic-hotels/common/telemetry" import { router } from "../../.." import { notFoundError } from "../../../errors" import { GetContactConfig } from "../../../graphql/Query/ContactConfig.graphql" -import { GetFooter, GetFooterRef } from "../../../graphql/Query/Footer.graphql" -import { GetHeader, GetHeaderRef } from "../../../graphql/Query/Header.graphql" -import { - GetSiteConfig, - GetSiteConfigRef, -} from "../../../graphql/Query/SiteConfig.graphql" -import { - GetSitewideCampaignBanner, - GetSitewideCampaignBannerRef, -} from "../../../graphql/Query/SitewideCampaignBanner.graphql" +import { GetFooter } from "../../../graphql/Query/Footer.graphql" +import { GetHeader } from "../../../graphql/Query/Header.graphql" +import { GetSiteConfig } from "../../../graphql/Query/SiteConfig.graphql" +import { GetSitewideCampaignBanner } from "../../../graphql/Query/SitewideCampaignBanner.graphql" import { request } from "../../../graphql/request" import { contentstackBaseProcedure } from "../../../procedures" import { langInput } from "../../../utils" -import { - generateRefsResponseTag, - generateTag, - generateTags, - generateTagsFromSystem, -} from "../../../utils/generateTag" +import { generateTag } from "../../../utils/generateTag" import { type ContactConfigData, - headerRefsSchema, headerSchema, - siteConfigRefSchema, siteConfigSchema, - sitewideCampaignBannerRefSchema, sitewideCampaignBannerSchema, validateContactConfigSchema, validateFooterConfigSchema, - validateFooterRefConfigSchema, } from "./output" -import { - getAlertPhoneContactData, - getConnections, - getFooterConnections, - getSiteConfigConnections, - getSitewideCampaignBannerConnections, -} from "./utils" +import { getAlertPhoneContactData } from "./utils" import type { Lang } from "@scandic-hotels/common/constants/language" -import type { FooterDataRaw, FooterRefDataRaw } from "../../../types/footer" -import type { - GetHeader as GetHeaderData, - GetHeaderRefs, -} from "../../../types/header" +import type { FooterDataRaw } from "../../../types/footer" +import type { GetHeader as GetHeaderData } from "../../../types/header" import type { GetSiteConfigData, - GetSiteConfigRefData, GetSitewideCampaignBannerData, - GetSitewideCampaignBannerRefData, } from "../../../types/siteConfig" const getContactConfig = cache(async (lang: Lang) => { @@ -103,51 +77,13 @@ export const baseQueryRouter = router({ }), header: contentstackBaseProcedure.query(async ({ ctx }) => { const { lang } = ctx - - const getHeaderRefsCounter = createCounter( - "trpc.contentstack.header.get.refs" - ) - const metricsGetHeaderRefs = getHeaderRefsCounter.init({ lang }) - - metricsGetHeaderRefs.start() - - const variables = { locale: lang } - const responseRef = await request(GetHeaderRef, variables, { - key: generateRefsResponseTag(lang, "header"), - ttl: "max", - }) - - if (!responseRef.data) { - metricsGetHeaderRefs.noDataError() - throw notFoundError({ - message: "GetHeaderRef returned no data", - errorDetails: variables, - }) - } - - const validatedHeaderRefs = headerRefsSchema.safeParse(responseRef.data) - - if (!validatedHeaderRefs.success) { - metricsGetHeaderRefs.validationError(validatedHeaderRefs.error) - return null - } - - metricsGetHeaderRefs.success() - - const connections = getConnections(validatedHeaderRefs.data) - const getHeaderCounter = createCounter("trpc.contentstack.header.get") const metricsGetHeader = getHeaderCounter.init({ lang }) - metricsGetHeader.start() - const tags = [ - generateTagsFromSystem(lang, connections), - generateTag(lang, validatedHeaderRefs.data.header.system.uid), - ].flat() - + const variables = { locale: lang } const response = await request(GetHeader, variables, { - key: tags, + key: generateTag(lang, "header"), ttl: "max", }) @@ -168,64 +104,17 @@ export const baseQueryRouter = router({ metricsGetHeader.success() - return { - data: validatedHeaderConfig.data.header, - } + return { data: validatedHeaderConfig.data.header } }), footer: contentstackBaseProcedure.query(async ({ ctx }) => { const { lang } = ctx - - const getFooterRefsCounter = createCounter( - "trpc.contentstack.footer.get.refs" - ) - const metricsGetFooterRefs = getFooterRefsCounter.init({ lang }) - - metricsGetFooterRefs.start() - - const variables = { locale: lang } - const responseRef = await request( - GetFooterRef, - variables, - { - key: generateRefsResponseTag(lang, "footer"), - ttl: "max", - } - ) - - if (!responseRef.data) { - metricsGetFooterRefs.noDataError() - throw notFoundError({ - message: "GetFooterRef returned no data", - errorDetails: variables, - }) - } - - const validatedFooterRefs = validateFooterRefConfigSchema.safeParse( - responseRef.data - ) - - if (!validatedFooterRefs.success) { - metricsGetFooterRefs.validationError(validatedFooterRefs.error) - return null - } - - metricsGetFooterRefs.success() - - const connections = getFooterConnections(validatedFooterRefs.data) - const footerUID = responseRef.data.all_footer.items[0].system.uid - const getFooterCounter = createCounter("trpc.contentstack.footer.get") const metricsGetFooter = getFooterCounter.init({ lang }) - metricsGetFooter.start() - const tags = [ - generateTags(lang, connections), - generateTag(lang, footerUID), - ].flat() - + const variables = { locale: lang } const response = await request(GetFooter, variables, { - key: tags, + key: generateTag(lang, "footer"), ttl: "max", }) @@ -256,52 +145,6 @@ export const baseQueryRouter = router({ .query(async ({ input, ctx }) => { const lang = input.lang ?? ctx.lang - const getSitewideCampaignBannerRefsCounter = createCounter( - "trpc.contentstack.sitewideCampaignBanner.get.refs" - ) - const metricsGetSitewideCampaignBannerRefs = - getSitewideCampaignBannerRefsCounter.init({ - lang, - }) - - metricsGetSitewideCampaignBannerRefs.start() - - const refVariables = { locale: lang } - const responseRef = await request( - GetSitewideCampaignBannerRef, - refVariables, - { - key: generateRefsResponseTag(lang, "sitewide_campaign_banner"), - ttl: "max", - } - ) - - if (!responseRef.data) { - metricsGetSitewideCampaignBannerRefs.noDataError() - throw notFoundError({ - message: "GetSitewideCampaignBannerRef returned no data", - errorDetails: refVariables, - }) - } - - const validatedSitewideCampaignBannerRef = - sitewideCampaignBannerRefSchema.safeParse(responseRef.data) - - if (!validatedSitewideCampaignBannerRef.success) { - metricsGetSitewideCampaignBannerRefs.validationError( - validatedSitewideCampaignBannerRef.error - ) - return null - } - - const connections = getSitewideCampaignBannerConnections( - validatedSitewideCampaignBannerRef.data - ) - - const tags = [generateTagsFromSystem(lang, connections)].flat() - - metricsGetSitewideCampaignBannerRefs.success() - const getSitewideCampaignBannerCounter = createCounter( "trpc.contentstack.sitewideCampaignBanner.get" ) @@ -317,7 +160,7 @@ export const baseQueryRouter = router({ await request( GetSitewideCampaignBanner, variables, - { key: tags, ttl: "max" } + { key: generateTag(lang, "sitewide_campaign_banner"), ttl: "max" } ) if (!sitewideCampaignBannerResponse.data) { @@ -351,52 +194,6 @@ export const baseQueryRouter = router({ .query(async ({ input, ctx }) => { const lang = input.lang ?? ctx.lang - const getSiteConfigRefsCounter = createCounter( - "trpc.contentstack.siteConfig.get.refs" - ) - const metricsGetSiteConfigRefs = getSiteConfigRefsCounter.init({ lang }) - - metricsGetSiteConfigRefs.start() - - const refVariables = { - locale: lang, - } - const responseRef = await request( - GetSiteConfigRef, - refVariables, - { - key: generateRefsResponseTag(lang, "site_config"), - ttl: "max", - } - ) - - if (!responseRef.data) { - metricsGetSiteConfigRefs.noDataError() - throw notFoundError({ - message: "SiteConfigRefs returned no data", - errorDetails: refVariables, - }) - } - - const validatedSiteConfigRef = siteConfigRefSchema.safeParse( - responseRef.data - ) - - if (!validatedSiteConfigRef.success) { - metricsGetSiteConfigRefs.validationError(validatedSiteConfigRef.error) - return null - } - - const connections = getSiteConfigConnections(validatedSiteConfigRef.data) - const siteConfigUid = responseRef.data.all_site_config.items[0].system.uid - - const tags = [ - generateTagsFromSystem(lang, connections), - generateTag(lang, siteConfigUid), - ].flat() - - metricsGetSiteConfigRefs.success() - const getSiteConfigCounter = createCounter( "trpc.contentstack.siteConfig.get" ) @@ -407,7 +204,7 @@ export const baseQueryRouter = router({ const variables = { locale: lang } const [siteConfigResponse, contactConfig] = await Promise.all([ request(GetSiteConfig, variables, { - key: tags, + key: generateTag(lang, "site_config"), ttl: "max", }), getContactConfig(lang), diff --git a/packages/trpc/lib/routers/contentstack/base/utils.ts b/packages/trpc/lib/routers/contentstack/base/utils.ts index 2b0599817..e385c69de 100644 --- a/packages/trpc/lib/routers/contentstack/base/utils.ts +++ b/packages/trpc/lib/routers/contentstack/base/utils.ts @@ -5,112 +5,9 @@ import { logger } from "@scandic-hotels/common/logger" import { getValueFromContactConfig } from "../../../utils/contactConfig" -import type { Edges } from "../../../types/edges" -import type { FooterRefDataRaw } from "../../../types/footer" -import type { HeaderRefs } from "../../../types/header" -import type { NodeRefs } from "../../../types/refs" -import type { - AlertOutput, - GetSiteConfigRefData, - GetSitewideCampaignBannerRefData, -} from "../../../types/siteConfig" -import type { System } from "../schemas/system" +import type { AlertOutput } from "../../../types/siteConfig" import type { ContactConfig } from "./output" -export function getConnections({ header }: HeaderRefs) { - const connections: System["system"][] = [header.system] - - if (header.top_link) { - if (header.top_link.logged_in?.link) { - connections.push(header.top_link.logged_in.link) - } - if (header.top_link.logged_out?.link) { - connections.push(header.top_link.logged_out.link) - } - } - - if (header.menu_items.length) { - header.menu_items.forEach((menuItem) => { - if (menuItem.card) { - connections.push(...menuItem.card) - } - if (menuItem.link) { - connections.push(menuItem.link) - } - if (menuItem.see_all_link?.link) { - connections.push(menuItem.see_all_link.link) - } - if (menuItem.submenu.length) { - menuItem.submenu.forEach((subMenuItem) => { - if (subMenuItem.links.length) { - subMenuItem.links.forEach((link) => { - if (link?.link) { - connections.push(link.link) - } - }) - } - }) - } - }) - } - - return connections -} - -export function getFooterConnections(refs: FooterRefDataRaw) { - const connections: Edges[] = [] - const footerData = refs.all_footer.items[0] - const mainLinks = footerData.main_links - const secondaryLinks = footerData.secondary_links - const tertiaryLinks = footerData.tertiary_links - if (mainLinks) { - mainLinks.forEach(({ pageConnection }) => { - connections.push(pageConnection) - }) - } - secondaryLinks?.forEach(({ links }) => { - if (links) { - links.forEach(({ pageConnection }) => { - connections.push(pageConnection) - }) - } - }) - if (tertiaryLinks) { - tertiaryLinks.forEach(({ pageConnection }) => { - connections.push(pageConnection) - }) - } - - return connections -} - -export function getSiteConfigConnections(refs: GetSiteConfigRefData) { - const siteConfigData = refs.all_site_config.items[0] - const connections: System["system"][] = [] - - if (!siteConfigData.sitewide_alert.alert) return connections - - const alertConnection = siteConfigData.sitewide_alert.alert.alertConnection - - alertConnection.edges.forEach(({ node }) => { - connections.push(node.system) - - const link = node.link.link - if (link) { - connections.push(link) - } - node.sidepeek_content.content.embedded_itemsConnection.edges.forEach( - ({ node }) => { - if (node.system) { - connections.push(node.system) - } - } - ) - }) - - return connections -} - export function getAlertPhoneContactData( alert: AlertOutput, contactConfig: ContactConfig @@ -139,21 +36,3 @@ export const safeUnion = (schema: T) => return null } }, schema) - -export function getSitewideCampaignBannerConnections( - refs: GetSitewideCampaignBannerRefData -) { - const system = refs.all_sitewide_campaign_banner?.system - const banner = - refs.all_sitewide_campaign_banner?.bannerConnection.edges[0]?.node - const connections: System["system"][] = [] - - if (system) { - connections.push(system) - } - if (banner?.system) { - connections.push(banner.system) - } - - return connections -} diff --git a/packages/trpc/lib/routers/contentstack/breadcrumbs/output.ts b/packages/trpc/lib/routers/contentstack/breadcrumbs/output.ts index 52c0f9cd4..c40dcfc4c 100644 --- a/packages/trpc/lib/routers/contentstack/breadcrumbs/output.ts +++ b/packages/trpc/lib/routers/contentstack/breadcrumbs/output.ts @@ -5,28 +5,6 @@ import { removeMultipleSlashes } from "@scandic-hotels/common/utils/url" import { systemSchema } from "../schemas/system" import { homeBreadcrumbs } from "./utils" -export const breadcrumbsRefsSchema = z.object({ - web: z - .object({ - breadcrumbs: z - .object({ - title: z.string(), - parentsConnection: z.object({ - edges: z.array( - z.object({ - node: z.object({ - system: systemSchema, - }), - }) - ), - }), - }) - .optional(), - }) - .optional(), - system: systemSchema, -}) - export const rawBreadcrumbsDataSchema = z.object({ url: z.string(), web: z.object({ diff --git a/packages/trpc/lib/routers/contentstack/breadcrumbs/query.ts b/packages/trpc/lib/routers/contentstack/breadcrumbs/query.ts index 745c3086b..ce80d40ec 100644 --- a/packages/trpc/lib/routers/contentstack/breadcrumbs/query.ts +++ b/packages/trpc/lib/routers/contentstack/breadcrumbs/query.ts @@ -6,105 +6,35 @@ import { createCounter } from "@scandic-hotels/common/telemetry" import { router } from "../../.." import { PageContentTypeEnum } from "../../../enums/contentType" import { notFoundError } from "../../../errors" -import { - GetMyPagesBreadcrumbs, - GetMyPagesBreadcrumbsRefs, -} from "../../../graphql/Query/Breadcrumbs/AccountPage.graphql" -import { - GetCampaignOverviewPageBreadcrumbs, - GetCampaignOverviewPageBreadcrumbsRefs, -} from "../../../graphql/Query/Breadcrumbs/CampaignOverviewPage.graphql" -import { - GetCampaignPageBreadcrumbs, - GetCampaignPageBreadcrumbsRefs, -} from "../../../graphql/Query/Breadcrumbs/CampaignPage.graphql" -import { - GetCollectionPageBreadcrumbs, - GetCollectionPageBreadcrumbsRefs, -} from "../../../graphql/Query/Breadcrumbs/CollectionPage.graphql" -import { - GetContentPageBreadcrumbs, - GetContentPageBreadcrumbsRefs, -} from "../../../graphql/Query/Breadcrumbs/ContentPage.graphql" -import { - GetDestinationCityPageBreadcrumbs, - GetDestinationCityPageBreadcrumbsRefs, -} from "../../../graphql/Query/Breadcrumbs/DestinationCityPage.graphql" -import { - GetDestinationCountryPageBreadcrumbs, - GetDestinationCountryPageBreadcrumbsRefs, -} from "../../../graphql/Query/Breadcrumbs/DestinationCountryPage.graphql" -import { - GetDestinationOverviewPageBreadcrumbs, - GetDestinationOverviewPageBreadcrumbsRefs, -} from "../../../graphql/Query/Breadcrumbs/DestinationOverviewPage.graphql" -import { - GetHotelPageBreadcrumbs, - GetHotelPageBreadcrumbsRefs, -} from "../../../graphql/Query/Breadcrumbs/HotelPage.graphql" -import { - GetLoyaltyPageBreadcrumbs, - GetLoyaltyPageBreadcrumbsRefs, -} from "../../../graphql/Query/Breadcrumbs/LoyaltyPage.graphql" -import { - GetPromoCampaignPageBreadcrumbs, - GetPromoCampaignPageBreadcrumbsRefs, -} from "../../../graphql/Query/Breadcrumbs/PromoCampaignPage.graphql" +import { GetMyPagesBreadcrumbs } from "../../../graphql/Query/Breadcrumbs/AccountPage.graphql" +import { GetCampaignOverviewPageBreadcrumbs } from "../../../graphql/Query/Breadcrumbs/CampaignOverviewPage.graphql" +import { GetCampaignPageBreadcrumbs } from "../../../graphql/Query/Breadcrumbs/CampaignPage.graphql" +import { GetCollectionPageBreadcrumbs } from "../../../graphql/Query/Breadcrumbs/CollectionPage.graphql" +import { GetContentPageBreadcrumbs } from "../../../graphql/Query/Breadcrumbs/ContentPage.graphql" +import { GetDestinationCityPageBreadcrumbs } from "../../../graphql/Query/Breadcrumbs/DestinationCityPage.graphql" +import { GetDestinationCountryPageBreadcrumbs } from "../../../graphql/Query/Breadcrumbs/DestinationCountryPage.graphql" +import { GetDestinationOverviewPageBreadcrumbs } from "../../../graphql/Query/Breadcrumbs/DestinationOverviewPage.graphql" +import { GetHotelPageBreadcrumbs } from "../../../graphql/Query/Breadcrumbs/HotelPage.graphql" +import { GetLoyaltyPageBreadcrumbs } from "../../../graphql/Query/Breadcrumbs/LoyaltyPage.graphql" +import { GetPromoCampaignPageBreadcrumbs } from "../../../graphql/Query/Breadcrumbs/PromoCampaignPage.graphql" import { request } from "../../../graphql/request" import { contentstackExtendedProcedureUID } from "../../../procedures" -import { generateRefsResponseTag } from "../../../utils/generateTag" -import { breadcrumbsRefsSchema, breadcrumbsSchema } from "./output" -import { getTags } from "./utils" +import { generateTag } from "../../../utils/generateTag" +import { breadcrumbsSchema } from "./output" import type { Lang } from "@scandic-hotels/common/constants/language" -import type { - BreadcrumbsRefsSchema, - RawBreadcrumbsSchema, -} from "../../../types/breadcrumbs" +import type { RawBreadcrumbsSchema } from "../../../types/breadcrumbs" interface BreadcrumbsPageData { dataKey: keyof T - refQuery: string | DocumentNode query: string | DocumentNode } const getBreadcrumbs = cache(async function fetchMemoizedBreadcrumbs( - { dataKey, refQuery, query }: BreadcrumbsPageData, + { dataKey, query }: BreadcrumbsPageData, { uid, lang }: { uid: string; lang: Lang } ) { - const getBreadcrumbsRefsCounter = createCounter( - "trpc.contentstack.breadcrumbs.get.refs" - ) - const metricsGetBreadcrumbsRefs = getBreadcrumbsRefsCounter.init({ - lang, - uid, - }) - - metricsGetBreadcrumbsRefs.start() - - const refsResponse = await request<{ [K in keyof T]: BreadcrumbsRefsSchema }>( - refQuery, - { locale: lang, uid }, - { - key: generateRefsResponseTag(lang, uid, "breadcrumbs"), - ttl: "max", - } - ) - - const validatedRefsData = breadcrumbsRefsSchema.safeParse( - refsResponse.data[dataKey] - ) - - if (!validatedRefsData.success) { - metricsGetBreadcrumbsRefs.validationError(validatedRefsData.error) - return [] - } - - metricsGetBreadcrumbsRefs.success() - - const tags = getTags(validatedRefsData.data, lang) - const getBreadcrumbsCounter = createCounter( "trpc.contentstack.breadcrumbs.get" ) @@ -117,7 +47,7 @@ const getBreadcrumbs = cache(async function fetchMemoizedBreadcrumbs( const variables = { locale: lang, uid } const response = await request(query, variables, { - key: tags, + key: generateTag(lang, uid), ttl: "max", }) @@ -158,7 +88,6 @@ export const breadcrumbsQueryRouter = router({ }>( { dataKey: "account_page", - refQuery: GetMyPagesBreadcrumbsRefs, query: GetMyPagesBreadcrumbs, }, variables @@ -169,7 +98,6 @@ export const breadcrumbsQueryRouter = router({ }>( { dataKey: "campaign_overview_page", - refQuery: GetCampaignOverviewPageBreadcrumbsRefs, query: GetCampaignOverviewPageBreadcrumbs, }, variables @@ -180,7 +108,6 @@ export const breadcrumbsQueryRouter = router({ }>( { dataKey: "campaign_page", - refQuery: GetCampaignPageBreadcrumbsRefs, query: GetCampaignPageBreadcrumbs, }, variables @@ -191,7 +118,6 @@ export const breadcrumbsQueryRouter = router({ }>( { dataKey: "collection_page", - refQuery: GetCollectionPageBreadcrumbsRefs, query: GetCollectionPageBreadcrumbs, }, variables @@ -202,7 +128,6 @@ export const breadcrumbsQueryRouter = router({ }>( { dataKey: "content_page", - refQuery: GetContentPageBreadcrumbsRefs, query: GetContentPageBreadcrumbs, }, variables @@ -213,7 +138,6 @@ export const breadcrumbsQueryRouter = router({ }>( { dataKey: "destination_overview_page", - refQuery: GetDestinationOverviewPageBreadcrumbsRefs, query: GetDestinationOverviewPageBreadcrumbs, }, variables @@ -224,7 +148,6 @@ export const breadcrumbsQueryRouter = router({ }>( { dataKey: "destination_country_page", - refQuery: GetDestinationCountryPageBreadcrumbsRefs, query: GetDestinationCountryPageBreadcrumbs, }, variables @@ -235,7 +158,6 @@ export const breadcrumbsQueryRouter = router({ }>( { dataKey: "destination_city_page", - refQuery: GetDestinationCityPageBreadcrumbsRefs, query: GetDestinationCityPageBreadcrumbs, }, variables @@ -246,7 +168,6 @@ export const breadcrumbsQueryRouter = router({ }>( { dataKey: "hotel_page", - refQuery: GetHotelPageBreadcrumbsRefs, query: GetHotelPageBreadcrumbs, }, variables @@ -257,7 +178,6 @@ export const breadcrumbsQueryRouter = router({ }>( { dataKey: "loyalty_page", - refQuery: GetLoyaltyPageBreadcrumbsRefs, query: GetLoyaltyPageBreadcrumbs, }, variables @@ -268,7 +188,6 @@ export const breadcrumbsQueryRouter = router({ }>( { dataKey: "promo_campaign_page", - refQuery: GetPromoCampaignPageBreadcrumbsRefs, query: GetPromoCampaignPageBreadcrumbs, }, variables diff --git a/packages/trpc/lib/routers/contentstack/breadcrumbs/utils.ts b/packages/trpc/lib/routers/contentstack/breadcrumbs/utils.ts index 3ec45f962..510976894 100644 --- a/packages/trpc/lib/routers/contentstack/breadcrumbs/utils.ts +++ b/packages/trpc/lib/routers/contentstack/breadcrumbs/utils.ts @@ -1,11 +1,5 @@ import { Lang } from "@scandic-hotels/common/constants/language" -import { generateTag, generateTags } from "../../../utils/generateTag" - -import type { BreadcrumbsRefsSchema } from "../../../types/breadcrumbs" -import type { Edges } from "../../../types/edges" -import type { NodeRefs } from "../../../types/refs" - export const affix = "breadcrumbs" // TODO: Make these editable in CMS? @@ -43,20 +37,3 @@ export const homeBreadcrumbs: { uid: "sv", }, } - -export function getConnections(data: BreadcrumbsRefsSchema) { - const connections: Edges[] = [] - - if (data.web?.breadcrumbs) { - connections.push(data.web.breadcrumbs.parentsConnection) - } - - return connections -} - -export function getTags(data: BreadcrumbsRefsSchema, lang: Lang) { - const connections = getConnections(data) - const tags = generateTags(lang, connections) - tags.push(generateTag(lang, data.system.uid, affix)) - return tags -} diff --git a/packages/trpc/lib/routers/contentstack/campaignOverviewPage/output.ts b/packages/trpc/lib/routers/contentstack/campaignOverviewPage/output.ts index 398c37c86..3bbdccb6e 100644 --- a/packages/trpc/lib/routers/contentstack/campaignOverviewPage/output.ts +++ b/packages/trpc/lib/routers/contentstack/campaignOverviewPage/output.ts @@ -10,19 +10,10 @@ import { includedHotelsSchema, } from "../campaignPage/output" import { promoHeroSchema } from "../promoCampaignPage/output" -import { - allCampaignsRefsSchema, - allCampaignsSchema, -} from "../schemas/blocks/allCampaigns" -import { - carouselCardsRefsSchema, - carouselCardsSchema, -} from "../schemas/blocks/carouselCards" +import { allCampaignsSchema } from "../schemas/blocks/allCampaigns" +import { carouselCardsSchema } from "../schemas/blocks/carouselCards" import { campaignOverviewPageHotelListingSchema } from "../schemas/blocks/hotelListing" -import { - linkAndTitleSchema, - linkConnectionRefs, -} from "../schemas/linkConnection" +import { linkAndTitleSchema } from "../schemas/linkConnection" import { systemSchema } from "../schemas/system" const navigationLinksSchema = z @@ -196,49 +187,3 @@ export const campaignOverviewPageSchema = z.object({ url: z.string(), }), }) - -/** REFS */ - -const campaignOverviewPageHeaderRefs = z.object({ - navigation_links: z.array(linkConnectionRefs), -}) - -const campaignOverviewPageCarouselCardsRef = z - .object({ - __typename: z.literal( - CampaignOverviewPageEnum.ContentStack.blocks.CarouselCards - ), - }) - .merge(carouselCardsRefsSchema) - -const campaignOverviewPageAllCampaignsRef = z - .object({ - __typename: z.literal( - CampaignOverviewPageEnum.ContentStack.blocks.AllCampaigns - ), - }) - .merge(allCampaignsRefsSchema) - -const blockRefsSchema = z.discriminatedUnion("__typename", [ - campaignOverviewPageAllCampaignsRef, - campaignOverviewPageCarouselCardsRef, -]) - -export const campaignOverviewPageRefsSchema = z.object({ - campaign_overview_page: z.object({ - header: campaignOverviewPageHeaderRefs, - top_campaign_block: z.object({ - campaignConnection: z.object({ - edges: z.array( - z.object({ - node: z.object({ - system: systemSchema, - }), - }) - ), - }), - }), - blocks: discriminatedUnionArray(blockRefsSchema.options).nullable(), - system: systemSchema, - }), -}) diff --git a/packages/trpc/lib/routers/contentstack/campaignOverviewPage/query.ts b/packages/trpc/lib/routers/contentstack/campaignOverviewPage/query.ts index dd09dd460..ffc72eec6 100644 --- a/packages/trpc/lib/routers/contentstack/campaignOverviewPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/campaignOverviewPage/query.ts @@ -2,72 +2,20 @@ import { createCounter } from "@scandic-hotels/common/telemetry" import { router } from "../../.." import { notFoundError } from "../../../errors" -import { - GetCampaignOverviewPage, - GetCampaignOverviewPageRefs, -} from "../../../graphql/Query/CampaignOverviewPage/CampaignOverviewPage.graphql" +import { GetCampaignOverviewPage } from "../../../graphql/Query/CampaignOverviewPage/CampaignOverviewPage.graphql" import { request } from "../../../graphql/request" import { contentStackUidWithServiceProcedure } from "../../../procedures" -import { generateRefsResponseTag } from "../../../utils/generateTag" -import { - campaignOverviewPageRefsSchema, - campaignOverviewPageSchema, -} from "./output" -import { generatePageTags } from "./utils" +import { generateTag } from "../../../utils/generateTag" +import { campaignOverviewPageSchema } from "./output" -import type { - GetCampaignOverviewPageData, - GetCampaignOverviewPageRefsData, -} from "../../../types/campaignOverviewPage" +import type { GetCampaignOverviewPageData } from "../../../types/campaignOverviewPage" import type { TrackingPageData } from "../../types" export const campaignOverviewPageQueryRouter = router({ get: contentStackUidWithServiceProcedure.query(async ({ ctx }) => { const { lang, uid } = ctx - const getCampaignOverviewPageRefsCounter = createCounter( - "trpc.contentstack.campaignOverviewPage.get.refs" - ) - const metricsGetCampaignOverviewPageRefs = - getCampaignOverviewPageRefsCounter.init({ - lang, - uid, - }) - - metricsGetCampaignOverviewPageRefs.start() - - const refVariables = { locale: lang, uid } - const refsResponse = await request( - GetCampaignOverviewPageRefs, - refVariables, - { - key: generateRefsResponseTag(lang, uid), - ttl: "max", - } - ) - - if (!refsResponse.data) { - metricsGetCampaignOverviewPageRefs.noDataError() - - throw notFoundError({ - message: "GetCampaignOverviewPageRefs returned no data", - errorDetails: refVariables, - }) - } - - const validatedRefsData = campaignOverviewPageRefsSchema.safeParse( - refsResponse.data - ) - if (!validatedRefsData.success) { - metricsGetCampaignOverviewPageRefs.validationError( - validatedRefsData.error - ) - return null - } - - metricsGetCampaignOverviewPageRefs.success() - - const tags = generatePageTags(validatedRefsData.data, lang) + const cacheKey = generateTag(lang, uid) const getCampaignOverviewPageCounter = createCounter( "trpc.contentstack.campaignOverviewPage.get" @@ -84,7 +32,7 @@ export const campaignOverviewPageQueryRouter = router({ GetCampaignOverviewPage, variables, { - key: tags, + key: `${cacheKey}:campaignOverviewPage`, ttl: "max", } ) diff --git a/packages/trpc/lib/routers/contentstack/campaignOverviewPage/utils.ts b/packages/trpc/lib/routers/contentstack/campaignOverviewPage/utils.ts deleted file mode 100644 index 6a9ea07b2..000000000 --- a/packages/trpc/lib/routers/contentstack/campaignOverviewPage/utils.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { CampaignOverviewPageEnum } from "../../../types/campaignOverviewPageEnum" -import { generateTag, generateTagsFromSystem } from "../../../utils/generateTag" - -import type { Lang } from "@scandic-hotels/common/constants/language" - -import type { System } from "../../../routers/contentstack/schemas/system" -import type { CampaignOverviewPageRefs } from "../../../types/campaignOverviewPage" - -export function generatePageTags( - validatedData: CampaignOverviewPageRefs, - lang: Lang -): string[] { - const connections = getConnections(validatedData) - return [ - generateTagsFromSystem(lang, connections), - generateTag(lang, validatedData.campaign_overview_page.system.uid), - ].flat() -} - -export function getConnections({ - campaign_overview_page, -}: CampaignOverviewPageRefs) { - const connections: System["system"][] = [campaign_overview_page.system] - - if (campaign_overview_page.header.navigation_links) { - campaign_overview_page.header.navigation_links.forEach((link) => { - if (link.link) { - connections.push(link.link) - } - }) - } - if (campaign_overview_page.top_campaign_block.campaignConnection) { - campaign_overview_page.top_campaign_block.campaignConnection.edges.forEach( - ({ node }) => { - connections.push(node.system) - } - ) - } - if (campaign_overview_page.blocks) { - campaign_overview_page.blocks.forEach((block) => { - switch (block.__typename) { - case CampaignOverviewPageEnum.ContentStack.blocks.CarouselCards: { - block.carousel_cards.card_groups.forEach((group) => { - group.cardConnection.edges.forEach(({ node }) => { - connections.push(node.system) - }) - }) - break - } - case CampaignOverviewPageEnum.ContentStack.blocks.AllCampaigns: { - block.all_campaigns.campaignsConnection.edges.forEach(({ node }) => { - if (node.system) { - connections.push(node.system) - } - }) - break - } - } - }) - } - - return connections -} diff --git a/packages/trpc/lib/routers/contentstack/campaignPage/output.ts b/packages/trpc/lib/routers/contentstack/campaignPage/output.ts index b28442a85..ae2887585 100644 --- a/packages/trpc/lib/routers/contentstack/campaignPage/output.ts +++ b/packages/trpc/lib/routers/contentstack/campaignPage/output.ts @@ -5,20 +5,11 @@ import { removeMultipleSlashes } from "@scandic-hotels/common/utils/url" import { CampaignPageEnum } from "../../../types/campaignPage" import { discriminatedUnionArray } from "../../../utils/discriminatedUnion" -import { - accordionRefsSchema, - accordionSchema, -} from "../schemas/blocks/accordion" -import { - carouselCardsRefsSchema, - carouselCardsSchema, -} from "../schemas/blocks/carouselCards" +import { accordionSchema } from "../schemas/blocks/accordion" +import { carouselCardsSchema } from "../schemas/blocks/carouselCards" import { essentialsBlockSchema } from "../schemas/blocks/essentials" import { campaignPageHotelListingSchema } from "../schemas/blocks/hotelListing" -import { - linkConnectionRefs, - linkConnectionSchema, -} from "../schemas/linkConnection" +import { linkConnectionSchema } from "../schemas/linkConnection" import { systemSchema } from "../schemas/system" import { getCarouselCardsBlockWithBookingCodeLinks } from "./utils" @@ -258,46 +249,3 @@ export const campaignPagesByHotelUidSchema = z }), }) .transform((data) => data.all_campaign_page.items) - -/** REFS */ -const campaignPageCarouselCardsRef = z - .object({ - __typename: z.literal(CampaignPageEnum.ContentStack.blocks.CarouselCards), - }) - .merge(carouselCardsRefsSchema) - -const campaignPageAccordionRefs = z - .object({ - __typename: z.literal(CampaignPageEnum.ContentStack.blocks.Accordion), - }) - .merge(accordionRefsSchema) - -const campaignPageBlockRefsItem = z.discriminatedUnion("__typename", [ - campaignPageCarouselCardsRef, - campaignPageAccordionRefs, -]) -const heroRefsSchema = z.object({ - button: linkConnectionRefs, -}) - -export const campaignPageRefsSchema = z.object({ - campaign_page: z.object({ - hero: heroRefsSchema, - blocks: discriminatedUnionArray( - campaignPageBlockRefsItem.options - ).nullable(), - system: systemSchema, - }), -}) - -export const campaignPagesByHotelUidRefsSchema = z - .object({ - all_campaign_page: z.object({ - items: z.array( - z.object({ - system: systemSchema, - }) - ), - }), - }) - .transform((data) => data.all_campaign_page.items.map((item) => item.system)) diff --git a/packages/trpc/lib/routers/contentstack/campaignPage/query.ts b/packages/trpc/lib/routers/contentstack/campaignPage/query.ts index 255866079..3c61d5607 100644 --- a/packages/trpc/lib/routers/contentstack/campaignPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/campaignPage/query.ts @@ -2,64 +2,20 @@ import { createCounter } from "@scandic-hotels/common/telemetry" import { router } from "../../.." import { notFoundError } from "../../../errors" -import { - GetCampaignPage, - GetCampaignPageRefs, -} from "../../../graphql/Query/CampaignPage/CampaignPage.graphql" +import { GetCampaignPage } from "../../../graphql/Query/CampaignPage/CampaignPage.graphql" import { request } from "../../../graphql/request" import { contentStackUidWithServiceProcedure } from "../../../procedures" -import { generateRefsResponseTag } from "../../../utils/generateTag" -import { campaignPageRefsSchema, campaignPageSchema } from "./output" -import { generatePageTags } from "./utils" +import { generateTag } from "../../../utils/generateTag" +import { campaignPageSchema } from "./output" -import type { - GetCampaignPageData, - GetCampaignPageRefsData, -} from "../../../types/campaignPage" +import type { GetCampaignPageData } from "../../../types/campaignPage" import type { TrackingPageData } from "../../types" export const campaignPageQueryRouter = router({ get: contentStackUidWithServiceProcedure.query(async ({ ctx }) => { const { lang, uid } = ctx - const getCampaignPageRefsCounter = createCounter( - "trpc.contentstack.campaignPage.get.refs" - ) - const metricsGetCampaignPageRefs = getCampaignPageRefsCounter.init({ - lang, - uid, - }) - - metricsGetCampaignPageRefs.start() - - const refVariables = { locale: lang, uid } - const refsResponse = await request( - GetCampaignPageRefs, - refVariables, - { - key: generateRefsResponseTag(lang, uid), - ttl: "max", - } - ) - if (!refsResponse.data) { - metricsGetCampaignPageRefs.noDataError() - throw notFoundError({ - message: "GetCampaignPageRefs returned no data", - errorDetails: refVariables, - }) - } - - const validatedRefsData = campaignPageRefsSchema.safeParse( - refsResponse.data - ) - if (!validatedRefsData.success) { - metricsGetCampaignPageRefs.validationError(validatedRefsData.error) - return null - } - - metricsGetCampaignPageRefs.success() - - const tags = generatePageTags(validatedRefsData.data, lang) + const cacheKey = generateTag(lang, uid) const getCampaignPageCounter = createCounter( "trpc.contentstack.campaignPage.get" @@ -76,7 +32,7 @@ export const campaignPageQueryRouter = router({ GetCampaignPage, variables, { - key: tags, + key: `${cacheKey}:campaignPage`, ttl: "max", } ) diff --git a/packages/trpc/lib/routers/contentstack/campaignPage/utils.ts b/packages/trpc/lib/routers/contentstack/campaignPage/utils.ts index ec014d60c..479e3a982 100644 --- a/packages/trpc/lib/routers/contentstack/campaignPage/utils.ts +++ b/packages/trpc/lib/routers/contentstack/campaignPage/utils.ts @@ -1,72 +1,17 @@ import { dt } from "@scandic-hotels/common/dt" import { createCounter } from "@scandic-hotels/common/telemetry" -import { notFoundError } from "../../../errors" -import { - GetCampaignPagesByHotelUid, - GetCampaignPagesByHotelUidRefs, -} from "../../../graphql/Query/CampaignPage/CampaignPagesByHotelUid.graphql" +import { GetCampaignPagesByHotelUid } from "../../../graphql/Query/CampaignPage/CampaignPagesByHotelUid.graphql" import { request } from "../../../graphql/request" -import { - CampaignPageEnum, - type CampaignPageRefs, -} from "../../../types/campaignPage" -import { - generateRefsResponseTag, - generateTag, - generateTagsFromSystem, -} from "../../../utils/generateTag" -import { - campaignPagesByHotelUidRefsSchema, - campaignPagesByHotelUidSchema, -} from "./output" +import { generateTag } from "../../../utils/generateTag" +import { campaignPagesByHotelUidSchema } from "./output" import type { Lang } from "@scandic-hotels/common/constants/language" import type { CarouselCardsBlock, GetCampaignPagesByHotelUidData, - GetCampaignPagesByHotelUidRefsData, } from "../../../types/campaignPage" -import type { System } from "../schemas/system" - -export function generatePageTags( - validatedData: CampaignPageRefs, - lang: Lang -): string[] { - const connections = getConnections(validatedData) - return [ - generateTagsFromSystem(lang, connections), - generateTag(lang, validatedData.campaign_page.system.uid), - ].flat() -} - -export function getConnections({ campaign_page }: CampaignPageRefs) { - const connections: System["system"][] = [campaign_page.system] - - if (campaign_page.blocks) { - campaign_page.blocks.forEach((block) => { - switch (block.__typename) { - case CampaignPageEnum.ContentStack.blocks.CarouselCards: { - block.carousel_cards.card_groups.forEach((group) => { - group.cardConnection.edges.forEach(({ node }) => { - connections.push(node.system) - }) - }) - break - } - case CampaignPageEnum.ContentStack.blocks.Accordion: { - if (block.accordion.length) { - connections.push(...block.accordion.filter((c) => !!c)) - } - break - } - } - }) - } - - return connections -} export function getCarouselCardsBlockWithBookingCodeLinks( block: CarouselCardsBlock, @@ -105,57 +50,6 @@ export async function getCampaignPagesByHotelPageUid( lang: Lang ) { const today = dt().format("YYYY-MM-DD") - const getCampaignPagesByHotelUidRefsCounter = createCounter( - "trpc.contentstack.campaignPage.byHotelUid.get.refs" - ) - const metricsGetCampaignPagesByHotelUidRefs = - getCampaignPagesByHotelUidRefsCounter.init({ - lang, - hotelPageUid, - today, - }) - - metricsGetCampaignPagesByHotelUidRefs.start() - const refsTag = generateRefsResponseTag( - lang, - `${hotelPageUid}-${today}`, - "hotel_page_campaigns" - ) - const variables = { - locale: lang, - hotelPageUid, - today, - } - const refsResponse = await request( - GetCampaignPagesByHotelUidRefs, - variables, - { - key: refsTag, - ttl: "1d", - } - ) - - if (!refsResponse.data) { - metricsGetCampaignPagesByHotelUidRefs.noDataError() - throw notFoundError({ - message: "GetCampaignPagesByHotelUidRefs returned no data", - errorDetails: variables, - }) - } - - const validatedRefsData = campaignPagesByHotelUidRefsSchema.safeParse( - refsResponse.data - ) - if (!validatedRefsData.success) { - metricsGetCampaignPagesByHotelUidRefs.validationError( - validatedRefsData.error - ) - return null - } - - metricsGetCampaignPagesByHotelUidRefs.success() - - const tags = generateTagsFromSystem(lang, validatedRefsData.data) const getCampaignPagesByHotelUidCounter = createCounter( "trpc.contentstack.campaignPage.byHotelUid.get" @@ -169,15 +63,17 @@ export async function getCampaignPagesByHotelPageUid( metricsGetCampaignPagesByHotelUid.start() + const variables = { + locale: lang, + hotelPageUid, + today, + } + const response = await request( GetCampaignPagesByHotelUid, + variables, { - locale: lang, - hotelPageUid, - today, - }, - { - key: [...tags, refsTag], + key: generateTag(lang, `${hotelPageUid}-${today}`), ttl: "1d", } ) diff --git a/packages/trpc/lib/routers/contentstack/collectionPage/output.ts b/packages/trpc/lib/routers/contentstack/collectionPage/output.ts index c4565122a..2270511b8 100644 --- a/packages/trpc/lib/routers/contentstack/collectionPage/output.ts +++ b/packages/trpc/lib/routers/contentstack/collectionPage/output.ts @@ -4,30 +4,15 @@ import { transformedImageVaultAssetSchema } from "@scandic-hotels/common/utils/i import { CollectionPageEnum } from "../../../types/collectionPage" import { discriminatedUnionArray } from "../../../utils/discriminatedUnion" -import { - cardGridRefsSchema, - cardsGridSchema, -} from "../schemas/blocks/cardsGrid" -import { - dynamicContentRefsSchema, - dynamicContentSchema as blockDynamicContentSchema, -} from "../schemas/blocks/dynamicContent" -import { - shortcutsRefsSchema, - shortcutsSchema, -} from "../schemas/blocks/shortcuts" -import { uspGridRefsSchema, uspGridSchema } from "../schemas/blocks/uspGrid" -import { - videoCardRefsSchema, - videoCardSchema, -} from "../schemas/blocks/videoCard" -import { - linkAndTitleSchema, - linkConnectionRefs, -} from "../schemas/linkConnection" +import { cardsGridSchema } from "../schemas/blocks/cardsGrid" +import { dynamicContentSchema as blockDynamicContentSchema } from "../schemas/blocks/dynamicContent" +import { shortcutsSchema } from "../schemas/blocks/shortcuts" +import { uspGridSchema } from "../schemas/blocks/uspGrid" +import { videoCardSchema } from "../schemas/blocks/videoCard" +import { linkAndTitleSchema } from "../schemas/linkConnection" import { internalOrExternalLinkSchema } from "../schemas/pageLinks" import { systemSchema } from "../schemas/system" -import { transformedVideoSchema, videoRefSchema } from "../schemas/video" +import { transformedVideoSchema } from "../schemas/video" // Block schemas export const collectionPageCards = z @@ -116,60 +101,3 @@ export const collectionPageSchema = z.object({ url: z.string(), }), }) - -/** REFS */ -const collectionPageCardsRefs = z - .object({ - __typename: z.literal(CollectionPageEnum.ContentStack.blocks.CardsGrid), - }) - .merge(cardGridRefsSchema) - -const collectionPageShortcutsRefs = z - .object({ - __typename: z.literal(CollectionPageEnum.ContentStack.blocks.Shortcuts), - }) - .merge(shortcutsRefsSchema) - -const collectionPageUspGridRefs = z - .object({ - __typename: z.literal(CollectionPageEnum.ContentStack.blocks.UspGrid), - }) - .merge(uspGridRefsSchema) - -const collectionPageDynamicContentRefs = z - .object({ - __typename: z.literal( - CollectionPageEnum.ContentStack.blocks.DynamicContent - ), - }) - .merge(dynamicContentRefsSchema) - -const collectionPageVideoCardRefs = z - .object({ - __typename: z.literal(CollectionPageEnum.ContentStack.blocks.VideoCard), - }) - .merge(videoCardRefsSchema) - -const collectionPageBlockRefsItem = z.discriminatedUnion("__typename", [ - collectionPageShortcutsRefs, - collectionPageDynamicContentRefs, - collectionPageCardsRefs, - collectionPageUspGridRefs, - collectionPageVideoCardRefs, -]) - -const collectionPageHeaderRefs = z.object({ - navigation_links: z.array(linkConnectionRefs), - top_primary_button: linkConnectionRefs.nullable(), -}) - -export const collectionPageRefsSchema = z.object({ - collection_page: z.object({ - hero_video: videoRefSchema.nullish(), - header: collectionPageHeaderRefs, - blocks: discriminatedUnionArray( - collectionPageBlockRefsItem.options - ).nullable(), - system: systemSchema, - }), -}) diff --git a/packages/trpc/lib/routers/contentstack/collectionPage/query.ts b/packages/trpc/lib/routers/contentstack/collectionPage/query.ts index aeeb90935..c21720a8e 100644 --- a/packages/trpc/lib/routers/contentstack/collectionPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/collectionPage/query.ts @@ -4,12 +4,8 @@ import { router } from "../../.." import { GetCollectionPage } from "../../../graphql/Query/CollectionPage/CollectionPage.graphql" import { request } from "../../../graphql/request" import { contentstackExtendedProcedureUID } from "../../../procedures" +import { generateTag } from "../../../utils/generateTag" import { collectionPageSchema } from "./output" -import { - fetchCollectionPageRefs, - generatePageTags, - validateCollectionPageRefs, -} from "./utils" import type { GetCollectionPageSchema } from "../../../types/collectionPage" import type { TrackingPageData } from "../../types" @@ -18,17 +14,7 @@ export const collectionPageQueryRouter = router({ get: contentstackExtendedProcedureUID.query(async ({ ctx }) => { const { lang, uid } = ctx - const collectionPageRefsData = await fetchCollectionPageRefs(lang, uid) - - const collectionPageRefs = validateCollectionPageRefs( - collectionPageRefsData, - lang, - uid - ) - if (!collectionPageRefs) { - return null - } - const tags = generatePageTags(collectionPageRefs, lang) + const cacheKey = generateTag(lang, uid) const getCollectionPageCounter = createCounter( "trpc.contentstack.collectionPage.get" @@ -44,7 +30,7 @@ export const collectionPageQueryRouter = router({ GetCollectionPage, { locale: lang, uid }, { - key: tags, + key: `${cacheKey}:collectionPage`, ttl: "max", } ) diff --git a/packages/trpc/lib/routers/contentstack/collectionPage/utils.ts b/packages/trpc/lib/routers/contentstack/collectionPage/utils.ts deleted file mode 100644 index 0d44ad617..000000000 --- a/packages/trpc/lib/routers/contentstack/collectionPage/utils.ts +++ /dev/null @@ -1,144 +0,0 @@ -import { createCounter } from "@scandic-hotels/common/telemetry" - -import { notFoundError } from "../../../errors" -import { GetCollectionPageRefs } from "../../../graphql/Query/CollectionPage/CollectionPage.graphql" -import { request } from "../../../graphql/request" -import { - CollectionPageEnum, - type CollectionPageRefs, - type GetCollectionPageRefsSchema, -} from "../../../types/collectionPage" -import { - generateRefsResponseTag, - generateTag, - generateTagsFromAssetSystem, - generateTagsFromSystem, -} from "../../../utils/generateTag" -import { collectionPageRefsSchema } from "./output" - -import type { Lang } from "@scandic-hotels/common/constants/language" - -import type { AssetSystem, System } from "../schemas/system" - -export async function fetchCollectionPageRefs(lang: Lang, uid: string) { - const getCollectionPageRefsCounter = createCounter( - "trpc.contentstack.collectionPage.get.refs" - ) - const metricsGetCollectionPageRefs = getCollectionPageRefsCounter.init({ - lang, - uid, - }) - - metricsGetCollectionPageRefs.start() - - const cacheKey = generateRefsResponseTag(lang, uid) - const variables = { - locale: lang, - uid, - } - const refsResponse = await request( - GetCollectionPageRefs, - variables, - { - key: cacheKey, - ttl: "max", - } - ) - - if (!refsResponse.data) { - metricsGetCollectionPageRefs.noDataError() - throw notFoundError({ - message: "GetCollectionPageRefs returned no data", - errorDetails: variables, - }) - } - - return refsResponse.data -} - -export function validateCollectionPageRefs( - data: GetCollectionPageRefsSchema, - lang: Lang, - uid: string -) { - const getCollectionPageRefsCounter = createCounter( - "trpc.contentstack.collectionPage.get.refs" - ) - const metricsGetCollectionPageRefs = getCollectionPageRefsCounter.init({ - lang, - uid, - }) - - const validatedData = collectionPageRefsSchema.safeParse(data) - if (!validatedData.success) { - metricsGetCollectionPageRefs.validationError(validatedData.error) - return null - } - - metricsGetCollectionPageRefs.success() - - return validatedData.data -} - -export function generatePageTags( - validatedData: CollectionPageRefs, - lang: Lang -): string[] { - const { connections, assetConnections } = getConnections(validatedData) - return [ - generateTagsFromSystem(lang, connections), - generateTagsFromAssetSystem(assetConnections), - generateTag(lang, validatedData.collection_page.system.uid), - ].flat() -} - -export function getConnections({ collection_page }: CollectionPageRefs) { - const connections: System["system"][] = [collection_page.system] - const assetConnections: AssetSystem[] = [] - - if (collection_page.hero_video?.sourceConnection.edges[0]) { - assetConnections.push( - collection_page.hero_video.sourceConnection.edges[0].node - ) - } - - if (collection_page.blocks) { - collection_page.blocks.forEach((block) => { - const typeName = block.__typename - switch (typeName) { - case CollectionPageEnum.ContentStack.blocks.Shortcuts: - if (block.shortcuts.shortcuts.length) { - connections.push(...block.shortcuts.shortcuts.filter((c) => !!c)) - } - break - case CollectionPageEnum.ContentStack.blocks.CardsGrid: - if (block.cards_grid.length) { - connections.push(...block.cards_grid) - } - break - case CollectionPageEnum.ContentStack.blocks.UspGrid: - if (block.usp_grid.length) { - connections.push(...block.usp_grid.filter((c) => !!c)) - } - break - case CollectionPageEnum.ContentStack.blocks.VideoCard: - if (block.video_card?.system) { - connections.push(block.video_card.system) - } - if (block.video_card?.video.sourceConnection.edges[0]) { - assetConnections.push( - block.video_card.video.sourceConnection.edges[0].node - ) - } - break - case CollectionPageEnum.ContentStack.blocks.DynamicContent: - break - default: - const _exhaustiveCheck: never = typeName - break - } - }) - } - - return { connections, assetConnections } -} diff --git a/packages/trpc/lib/routers/contentstack/contentPage/output.ts b/packages/trpc/lib/routers/contentstack/contentPage/output.ts index 050303179..25d4bc559 100644 --- a/packages/trpc/lib/routers/contentstack/contentPage/output.ts +++ b/packages/trpc/lib/routers/contentstack/contentPage/output.ts @@ -4,68 +4,29 @@ import { transformedImageVaultAssetSchema } from "@scandic-hotels/common/utils/i import { ContentPageEnum } from "../../../types/contentPage" import { discriminatedUnionArray } from "../../../utils/discriminatedUnion" -import { - accordionRefsSchema, - accordionSchema, -} from "../schemas/blocks/accordion" -import { - cardGridRefsSchema, - cardsGridSchema, -} from "../schemas/blocks/cardsGrid" -import { - contentRefsSchema as blockContentRefsSchema, - contentSchema as blockContentSchema, -} from "../schemas/blocks/content" -import { - dynamicContentRefsSchema, - dynamicContentSchema as blockDynamicContentSchema, -} from "../schemas/blocks/dynamicContent" +import { accordionSchema } from "../schemas/blocks/accordion" +import { cardsGridSchema } from "../schemas/blocks/cardsGrid" +import { contentSchema as blockContentSchema } from "../schemas/blocks/content" +import { dynamicContentSchema as blockDynamicContentSchema } from "../schemas/blocks/dynamicContent" import { contentPageHotelListingSchema } from "../schemas/blocks/hotelListing" -import { jotformRefsSchema, jotformSchema } from "../schemas/blocks/jotform" -import { - shortcutsRefsSchema, - shortcutsSchema, -} from "../schemas/blocks/shortcuts" +import { jotformSchema } from "../schemas/blocks/jotform" +import { shortcutsSchema } from "../schemas/blocks/shortcuts" import { tableSchema } from "../schemas/blocks/table" -import { textColsRefsSchema, textColsSchema } from "../schemas/blocks/textCols" -import { uspGridRefsSchema, uspGridSchema } from "../schemas/blocks/uspGrid" -import { videoBlockRefsSchema, videoBlockSchema } from "../schemas/blocks/video" -import { - videoCardRefsSchema, - videoCardSchema, -} from "../schemas/blocks/videoCard" -import { - dynamicContentRefsSchema as headerDynamicContentRefsSchema, - dynamicContentSchema as headerDynamicContentSchema, -} from "../schemas/headers/dynamicContent" -import { - linkAndTitleSchema, - linkConnectionRefs, -} from "../schemas/linkConnection" +import { textColsSchema } from "../schemas/blocks/textCols" +import { uspGridSchema } from "../schemas/blocks/uspGrid" +import { videoBlockSchema } from "../schemas/blocks/video" +import { videoCardSchema } from "../schemas/blocks/videoCard" +import { dynamicContentSchema as headerDynamicContentSchema } from "../schemas/headers/dynamicContent" +import { linkAndTitleSchema } from "../schemas/linkConnection" import { internalOrExternalLinkSchema } from "../schemas/pageLinks" -import { - contentRefsSchema as sidebarContentRefsSchema, - contentSchema as sidebarContentSchema, -} from "../schemas/sidebar/content" +import { contentSchema as sidebarContentSchema } from "../schemas/sidebar/content" import { dynamicContentSchema as sidebarDynamicContentSchema } from "../schemas/sidebar/dynamicContent" -import { - joinLoyaltyContactRefsSchema, - joinLoyaltyContactSchema, -} from "../schemas/sidebar/joinLoyaltyContact" -import { - quickLinksRefschema, - quickLinksSchema, -} from "../schemas/sidebar/quickLinks" -import { - scriptedCardRefschema, - scriptedCardsSchema, -} from "../schemas/sidebar/scriptedCard" -import { - teaserCardRefschema, - teaserCardsSchema, -} from "../schemas/sidebar/teaserCard" +import { joinLoyaltyContactSchema } from "../schemas/sidebar/joinLoyaltyContact" +import { quickLinksSchema } from "../schemas/sidebar/quickLinks" +import { scriptedCardsSchema } from "../schemas/sidebar/scriptedCard" +import { teaserCardsSchema } from "../schemas/sidebar/teaserCard" import { systemSchema } from "../schemas/system" -import { transformedVideoSchema, videoRefSchema } from "../schemas/video" +import { transformedVideoSchema } from "../schemas/video" // Block schemas export const contentPageCards = z @@ -250,137 +211,3 @@ export const contentPageSchema = z.object({ url: z.string(), }), }) - -/** REFS */ -const contentPageCardsRefs = z - .object({ - __typename: z.literal(ContentPageEnum.ContentStack.blocks.CardsGrid), - }) - .merge(cardGridRefsSchema) - -const contentPageBlockContentRefs = z - .object({ - __typename: z.literal(ContentPageEnum.ContentStack.blocks.Content), - }) - .merge(blockContentRefsSchema) - -const contentPageDynamicContentRefs = z - .object({ - __typename: z.literal(ContentPageEnum.ContentStack.blocks.DynamicContent), - }) - .merge(dynamicContentRefsSchema) - -const contentPageShortcutsRefs = z - .object({ - __typename: z.literal(ContentPageEnum.ContentStack.blocks.Shortcuts), - }) - .merge(shortcutsRefsSchema) - -const contentPageTextColsRefs = z - .object({ - __typename: z.literal(ContentPageEnum.ContentStack.blocks.TextCols), - }) - .merge(textColsRefsSchema) - -const contentPageUspGridRefs = z - .object({ - __typename: z.literal(ContentPageEnum.ContentStack.blocks.UspGrid), - }) - .merge(uspGridRefsSchema) - -const contentPageAccordionRefs = z - .object({ - __typename: z.literal(ContentPageEnum.ContentStack.blocks.Accordion), - }) - .merge(accordionRefsSchema) - -const contentPageVideoCardRefs = z - .object({ - __typename: z.literal(ContentPageEnum.ContentStack.blocks.VideoCard), - }) - .merge(videoCardRefsSchema) - -const contentPageVideoRefs = z - .object({ - __typename: z.literal(ContentPageEnum.ContentStack.blocks.Video), - }) - .merge(videoBlockRefsSchema) - -const contentPageJotformRefs = z - .object({ - __typename: z.literal(ContentPageEnum.ContentStack.blocks.Jotform), - }) - .merge(jotformRefsSchema) - -const contentPageBlockRefsItem = z.discriminatedUnion("__typename", [ - contentPageAccordionRefs, - contentPageBlockContentRefs, - contentPageShortcutsRefs, - contentPageCardsRefs, - contentPageDynamicContentRefs, - contentPageTextColsRefs, - contentPageUspGridRefs, - contentPageVideoCardRefs, - contentPageJotformRefs, - contentPageVideoRefs, -]) - -const contentPageSidebarContentRef = z - .object({ - __typename: z.literal(ContentPageEnum.ContentStack.sidebar.Content), - }) - .merge(sidebarContentRefsSchema) - -const contentPageSidebarJoinLoyaltyContactRef = z - .object({ - __typename: z.literal( - ContentPageEnum.ContentStack.sidebar.JoinLoyaltyContact - ), - }) - .merge(joinLoyaltyContactRefsSchema) - -const contentPageSidebarScriptedCardRef = z - .object({ - __typename: z.literal(ContentPageEnum.ContentStack.sidebar.ScriptedCard), - }) - .merge(scriptedCardRefschema) - -const contentPageSidebarTeaserCardRef = z - .object({ - __typename: z.literal(ContentPageEnum.ContentStack.sidebar.TeaserCard), - }) - .merge(teaserCardRefschema) - -const contentPageSidebarQuickLinksRef = z - .object({ - __typename: z.literal(ContentPageEnum.ContentStack.sidebar.QuickLinks), - }) - .merge(quickLinksRefschema) - -const contentPageSidebarRefsItem = z.discriminatedUnion("__typename", [ - contentPageSidebarContentRef, - contentPageSidebarJoinLoyaltyContactRef, - contentPageSidebarScriptedCardRef, - contentPageSidebarTeaserCardRef, - contentPageSidebarQuickLinksRef, -]) - -const contentPageHeaderRefs = z.object({ - navigation_links: z.array(linkConnectionRefs), - top_primary_button: linkConnectionRefs.nullable(), - dynamic_content: headerDynamicContentRefsSchema.nullish(), -}) - -export const contentPageRefsSchema = z.object({ - content_page: z.object({ - hero_video: videoRefSchema.nullish(), - header: contentPageHeaderRefs, - blocks: discriminatedUnionArray( - contentPageBlockRefsItem.options - ).nullable(), - sidebar: discriminatedUnionArray( - contentPageSidebarRefsItem.options - ).nullable(), - system: systemSchema, - }), -}) diff --git a/packages/trpc/lib/routers/contentstack/contentPage/query.ts b/packages/trpc/lib/routers/contentstack/contentPage/query.ts index 64432a09b..df01e0e2a 100644 --- a/packages/trpc/lib/routers/contentstack/contentPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/contentPage/query.ts @@ -8,8 +8,8 @@ import { GetContentPageBlocksBatch2, } from "../../../graphql/Query/ContentPage/ContentPage.graphql" import { contentstackExtendedProcedureUID } from "../../../procedures" +import { generateTag } from "../../../utils/generateTag" import { contentPageSchema } from "./output" -import { fetchContentPageRefs, generatePageTags } from "./utils" import type { GetContentPageSchema } from "../../../types/contentPage" import type { TrackingPageData } from "../../types" @@ -18,13 +18,8 @@ export const contentPageQueryRouter = router({ get: contentstackExtendedProcedureUID.query(async ({ ctx }) => { const { lang, uid } = ctx - const contentPageRefs = await fetchContentPageRefs(lang, uid) - - if (!contentPageRefs) { - return null - } - - const tags = generatePageTags(contentPageRefs, lang) + // by fetching references when a child entry is published + const cacheKey = generateTag(lang, uid) const getContentPageCounter = createCounter( "trpc.contentstack.contentPage.get" @@ -41,7 +36,7 @@ export const contentPageQueryRouter = router({ document: GetContentPage, variables: { locale: lang, uid }, cacheOptions: { - key: `${tags.join(",")}:contentPage`, + key: `${cacheKey}:contentPage`, ttl: "max", }, }, @@ -50,7 +45,7 @@ export const contentPageQueryRouter = router({ document: GetContentPageBlocksBatch1, variables: { locale: lang, uid }, cacheOptions: { - key: `${tags.join(",")}:contentPageBlocksBatch1`, + key: `${cacheKey}:contentPageBlocksBatch1`, ttl: "max", }, }, @@ -59,7 +54,7 @@ export const contentPageQueryRouter = router({ document: GetContentPageBlocksBatch2, variables: { locale: lang, uid }, cacheOptions: { - key: `${tags.join(",")}:contentPageBlocksBatch2`, + key: `${cacheKey}:contentPageBlocksBatch2`, ttl: "max", }, }, diff --git a/packages/trpc/lib/routers/contentstack/contentPage/utils.ts b/packages/trpc/lib/routers/contentstack/contentPage/utils.ts deleted file mode 100644 index 037e0f743..000000000 --- a/packages/trpc/lib/routers/contentstack/contentPage/utils.ts +++ /dev/null @@ -1,218 +0,0 @@ -import { createCounter } from "@scandic-hotels/common/telemetry" - -import { notFoundError } from "../../../errors" -import { batchRequest } from "../../../graphql/batchRequest" -import { - GetContentPageBlocksRefs, - GetContentPageRefs, -} from "../../../graphql/Query/ContentPage/ContentPage.graphql" -import { ContentPageEnum } from "../../../types/contentPage" -import { - generateRefsResponseTag, - generateTag, - generateTagsFromAssetSystem, - generateTagsFromSystem, -} from "../../../utils/generateTag" -import { contentPageRefsSchema } from "./output" - -import type { Lang } from "@scandic-hotels/common/constants/language" - -import type { - ContentPageRefs, - GetContentPageRefsSchema, -} from "../../../types/contentPage" -import type { AssetSystem, System } from "../schemas/system" - -export async function fetchContentPageRefs(lang: Lang, uid: string) { - const getContentPageRefsCounter = createCounter( - "trpc.contentstack.contentPage.get.refs" - ) - const metricsGetContentPageRefs = getContentPageRefsCounter.init({ - lang, - uid, - }) - - metricsGetContentPageRefs.start() - - const variables = { locale: lang, uid } - const res = await batchRequest([ - { - document: GetContentPageRefs, - variables, - cacheOptions: { - key: generateRefsResponseTag(lang, uid), - ttl: "max", - }, - }, - { - document: GetContentPageBlocksRefs, - variables, - cacheOptions: { - key: generateTag(lang, uid + 1), - ttl: "max", - }, - }, - ]) - if (!res.data) { - metricsGetContentPageRefs.noDataError() - throw notFoundError({ - message: "GetContentPageRefs/GetContentPageBlocksRefs returned no data", - errorDetails: variables, - }) - } - - const validatedData = contentPageRefsSchema.safeParse(res.data) - if (!validatedData.success) { - metricsGetContentPageRefs.validationError(validatedData.error) - return null - } - - metricsGetContentPageRefs.success() - - return validatedData.data -} - -export function generatePageTags( - validatedData: ContentPageRefs, - lang: Lang -): string[] { - const { connections, assetConnections } = getConnections(validatedData) - return [ - generateTagsFromSystem(lang, connections), - generateTagsFromAssetSystem(assetConnections), - generateTag(lang, validatedData.content_page.system.uid), - ].flat() -} - -export function getConnections({ content_page }: ContentPageRefs) { - const connections: System["system"][] = [content_page.system] - const assetConnections: AssetSystem[] = [] - - if (content_page.hero_video?.sourceConnection.edges[0]) { - assetConnections.push( - content_page.hero_video.sourceConnection.edges[0].node - ) - } - - if (content_page.blocks) { - content_page.blocks.forEach((block) => { - const typeName = block.__typename - switch (typeName) { - case ContentPageEnum.ContentStack.blocks.Accordion: - if (block.accordion.length) { - connections.push(...block.accordion.filter((c) => !!c)) - } - break - case ContentPageEnum.ContentStack.blocks.Content: - if (block?.content?.length) { - block.content.forEach((contentBlock) => { - if ("system" in contentBlock) { - assetConnections.push(contentBlock) - } else { - connections.push(contentBlock) - } - }) - } - break - case ContentPageEnum.ContentStack.blocks.CardsGrid: - if (block.cards_grid.length) { - connections.push(...block.cards_grid) - } - break - case ContentPageEnum.ContentStack.blocks.DynamicContent: - if (block.dynamic_content.link) { - connections.push(block.dynamic_content.link) - } - break - case ContentPageEnum.ContentStack.blocks.Shortcuts: - if (block.shortcuts.shortcuts.length) { - connections.push(...block.shortcuts.shortcuts.filter((c) => !!c)) - } - break - case ContentPageEnum.ContentStack.blocks.TextCols: - if (block.text_cols.length) { - connections.push(...block.text_cols) - } - break - case ContentPageEnum.ContentStack.blocks.UspGrid: - if (block.usp_grid.length) { - connections.push(...block.usp_grid.filter((c) => !!c)) - } - break - case ContentPageEnum.ContentStack.blocks.CardsGrid: - if (block.cards_grid.length) { - block.cards_grid.forEach((card) => { - connections.push(card) - }) - } - break - case ContentPageEnum.ContentStack.blocks.VideoCard: - if (block.video_card) { - connections.push(block.video_card.system) - } - if (block.video_card?.video.sourceConnection.edges[0]) { - assetConnections.push( - block.video_card.video.sourceConnection.edges[0].node - ) - } - break - case ContentPageEnum.ContentStack.blocks.Video: - if (block.video?.sourceConnection.edges[0]) { - assetConnections.push(block.video.sourceConnection.edges[0].node) - } - break - case ContentPageEnum.ContentStack.blocks.Jotform: - if (block.jotform) { - connections.push(block.jotform.system) - } - break - default: - const _exhaustiveCheck: never = typeName - break - } - }) - } - - if (content_page.sidebar) { - content_page.sidebar.forEach((block) => { - const typeName = block.__typename - switch (typeName) { - case ContentPageEnum.ContentStack.sidebar.Content: - if (block.content?.length) { - block.content.forEach((contentBlock) => { - if ("system" in contentBlock) { - assetConnections.push(contentBlock) - } else { - connections.push(contentBlock) - } - }) - } - break - case ContentPageEnum.ContentStack.sidebar.JoinLoyaltyContact: - if (block.join_loyalty_contact?.button) { - connections.push(block.join_loyalty_contact.button) - } - break - case ContentPageEnum.ContentStack.sidebar.ScriptedCard: - if (block.scripted_card?.length) { - connections.push(...block.scripted_card) - } - break - case ContentPageEnum.ContentStack.sidebar.TeaserCard: - if (block.teaser_card?.length) { - connections.push(...block.teaser_card) - } - break - case ContentPageEnum.ContentStack.sidebar.QuickLinks: - if (block.shortcuts.shortcuts.length) { - connections.push(...block.shortcuts.shortcuts.filter((c) => !!c)) - } - break - default: - const _exhaustiveCheck: never = typeName - break - } - }) - } - return { connections, assetConnections } -} diff --git a/packages/trpc/lib/routers/contentstack/destinationCityPage/output.ts b/packages/trpc/lib/routers/contentstack/destinationCityPage/output.ts index d90772544..2d3d72863 100644 --- a/packages/trpc/lib/routers/contentstack/destinationCityPage/output.ts +++ b/packages/trpc/lib/routers/contentstack/destinationCityPage/output.ts @@ -6,21 +6,11 @@ import { removeMultipleSlashes } from "@scandic-hotels/common/utils/url" import { DestinationCityPageEnum } from "../../../types/destinationCityPage" import { isDefined } from "../../../utils" import { discriminatedUnionArray } from "../../../utils/discriminatedUnion" -import { - accordionRefsSchema, - accordionSchema, -} from "../schemas/blocks/accordion" -import { contentRefsSchema, contentSchema } from "../schemas/blocks/content" -import { - destinationFiltersRefsSchema, - transformedDestinationFiltersSchema, -} from "../schemas/destinationFilters" +import { accordionSchema } from "../schemas/blocks/accordion" +import { contentSchema } from "../schemas/blocks/content" +import { transformedDestinationFiltersSchema } from "../schemas/destinationFilters" import { mapLocationSchema } from "../schemas/mapLocation" -import { - linkRefsUnionSchema, - linkUnionSchema, - transformPageLink, -} from "../schemas/pageLinks" +import { linkUnionSchema, transformPageLink } from "../schemas/pageLinks" import { systemSchema } from "../schemas/system" import type { ImageVaultAsset } from "@scandic-hotels/common/utils/imageVault" @@ -227,47 +217,3 @@ export const batchedCityPageUrlsSchema = z .transform((allItems) => { return allItems.flatMap((item) => item.data) }) - -/** REFS */ -const destinationCityPageContentRefs = z - .object({ - __typename: z.literal(DestinationCityPageEnum.ContentStack.blocks.Content), - }) - .merge(contentRefsSchema) - -const destinationCityPageAccordionRefs = z - .object({ - __typename: z.literal( - DestinationCityPageEnum.ContentStack.blocks.Accordion - ), - }) - .merge(accordionRefsSchema) - -const blocksRefsSchema = z.discriminatedUnion("__typename", [ - destinationCityPageAccordionRefs, - destinationCityPageContentRefs, -]) - -export const destinationCityPageRefsSchema = z.object({ - destination_city_page: z.object({ - destination_settings: destinationCityPageDestinationSettingsSchema, - sidepeek_content: z - .object({ - content: z - .object({ - embedded_itemsConnection: z.object({ - edges: z.array( - z.object({ - node: linkRefsUnionSchema, - }) - ), - }), - }) - .nullish(), - }) - .nullish(), - blocks: discriminatedUnionArray(blocksRefsSchema.options).nullable(), - seo_filters: destinationFiltersRefsSchema, - system: systemSchema, - }), -}) diff --git a/packages/trpc/lib/routers/contentstack/destinationCityPage/query.ts b/packages/trpc/lib/routers/contentstack/destinationCityPage/query.ts index 31831de2c..99de02e5a 100644 --- a/packages/trpc/lib/routers/contentstack/destinationCityPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/destinationCityPage/query.ts @@ -2,67 +2,21 @@ import { createCounter } from "@scandic-hotels/common/telemetry" import { router } from "../../.." import { notFoundError } from "../../../errors" -import { - GetDestinationCityPage, - GetDestinationCityPageRefs, -} from "../../../graphql/Query/DestinationCityPage/DestinationCityPage.graphql" +import { GetDestinationCityPage } from "../../../graphql/Query/DestinationCityPage/DestinationCityPage.graphql" import { request } from "../../../graphql/request" import { contentStackUidWithServiceProcedure } from "../../../procedures" -import { generateRefsResponseTag } from "../../../utils/generateTag" +import { generateTag } from "../../../utils/generateTag" import { getCityByCityIdentifier } from "../../hotels/services/getCityByCityIdentifier" -import { - destinationCityPageRefsSchema, - destinationCityPageSchema, -} from "./output" -import { generatePageTags } from "./utils" +import { destinationCityPageSchema } from "./output" -import type { - GetDestinationCityPageData, - GetDestinationCityPageRefsSchema, -} from "../../../types/destinationCityPage" +import type { GetDestinationCityPageData } from "../../../types/destinationCityPage" import type { TrackingPageData } from "../../types" export const destinationCityPageQueryRouter = router({ get: contentStackUidWithServiceProcedure.query(async ({ ctx }) => { const { lang, uid, serviceToken } = ctx - const getDestinationCityPageRefsCounter = createCounter( - "trpc.contentstack.destinationCityPage.get.refs" - ) - const metricsGetDestinationCityPageRefs = - getDestinationCityPageRefsCounter.init({ lang, uid }) - - metricsGetDestinationCityPageRefs.start() - - const variables = { locale: lang, uid } - const refsResponse = await request( - GetDestinationCityPageRefs, - variables, - { - key: generateRefsResponseTag(lang, uid), - ttl: "max", - } - ) - - if (!refsResponse.data) { - metricsGetDestinationCityPageRefs.noDataError() - throw notFoundError({ - message: "GetDestinationCityPageRefs returned no data", - errorDetails: variables, - }) - } - - const validatedRefsData = destinationCityPageRefsSchema.safeParse( - refsResponse.data - ) - if (!validatedRefsData.success) { - metricsGetDestinationCityPageRefs.validationError(validatedRefsData.error) - return null - } - - metricsGetDestinationCityPageRefs.success() - - const tags = generatePageTags(validatedRefsData.data, lang) + const cacheKey = generateTag(lang, uid) const getDestinationCityPageCounter = createCounter( "trpc.contentstack.destinationCityPage.get" @@ -74,11 +28,12 @@ export const destinationCityPageQueryRouter = router({ metricsGetDestinationCityPage.start() + const variables = { locale: lang, uid } const response = await request( GetDestinationCityPage, variables, { - key: tags, + key: `${cacheKey}:destinationCityPage`, ttl: "max", } ) diff --git a/packages/trpc/lib/routers/contentstack/destinationCityPage/utils.ts b/packages/trpc/lib/routers/contentstack/destinationCityPage/utils.ts index 605f43b3c..2ff3ada46 100644 --- a/packages/trpc/lib/routers/contentstack/destinationCityPage/utils.ts +++ b/packages/trpc/lib/routers/contentstack/destinationCityPage/utils.ts @@ -3,72 +3,14 @@ import { createCounter } from "@scandic-hotels/common/telemetry" import { GetCityPageCount } from "../../../graphql/Query/DestinationCityPage/DestinationCityPageCount.graphql" import { GetCityPageUrls } from "../../../graphql/Query/DestinationCityPage/DestinationCityPageUrl.graphql" import { request } from "../../../graphql/request" -import { DestinationCityPageEnum } from "../../../types/destinationCityPage" -import { generateTag, generateTagsFromSystem } from "../../../utils/generateTag" import { batchedCityPageUrlsSchema, cityPageCountSchema } from "./output" import type { Lang } from "@scandic-hotels/common/constants/language" import type { - DestinationCityPageRefs, GetCityPageCountData, GetCityPageUrlsData, } from "../../../types/destinationCityPage" -import type { System } from "../schemas/system" - -export function generatePageTags( - validatedData: DestinationCityPageRefs, - lang: Lang -): string[] { - const connections = getConnections(validatedData) - return [ - // This tag is added for the city list data on country pages to invalidate the list when city page changes. - generateTag( - lang, - `city_list_data:${validatedData.destination_city_page.destination_settings.city}` - ), - generateTagsFromSystem(lang, connections), - generateTag(lang, validatedData.destination_city_page.system.uid), - ].flat() -} - -export function getConnections({ - destination_city_page, -}: DestinationCityPageRefs) { - const connections: System["system"][] = [destination_city_page.system] - if (destination_city_page.blocks) { - destination_city_page.blocks.forEach((block) => { - switch (block.__typename) { - case DestinationCityPageEnum.ContentStack.blocks.Accordion: { - if (block.accordion.length) { - connections.push(...block.accordion.filter((c) => !!c)) - } - break - } - case DestinationCityPageEnum.ContentStack.blocks.Content: - { - if (block?.content?.length) { - // TS has trouble infering the filtered types - // @ts-ignore - connections.push(...block.content) - } - } - break - } - }) - } - if (destination_city_page.sidepeek_content) { - destination_city_page.sidepeek_content?.content?.embedded_itemsConnection.edges.forEach( - ({ node }) => { - if (node.system) { - connections.push(node.system) - } - } - ) - } - - return connections -} export async function getCityPageCount(lang: Lang) { const getCityPageCountCounter = createCounter( diff --git a/packages/trpc/lib/routers/contentstack/destinationCountryPage/output.ts b/packages/trpc/lib/routers/contentstack/destinationCountryPage/output.ts index f6b0b2d66..2b9da8f8d 100644 --- a/packages/trpc/lib/routers/contentstack/destinationCountryPage/output.ts +++ b/packages/trpc/lib/routers/contentstack/destinationCountryPage/output.ts @@ -6,21 +6,11 @@ import { removeMultipleSlashes } from "@scandic-hotels/common/utils/url" import { DestinationCountryPageEnum } from "../../../types/destinationCountryPage" import { discriminatedUnionArray } from "../../../utils/discriminatedUnion" -import { - accordionRefsSchema, - accordionSchema, -} from "../schemas/blocks/accordion" -import { contentRefsSchema, contentSchema } from "../schemas/blocks/content" -import { - destinationFiltersRefsSchema, - transformedDestinationFiltersSchema, -} from "../schemas/destinationFilters" +import { accordionSchema } from "../schemas/blocks/accordion" +import { contentSchema } from "../schemas/blocks/content" +import { transformedDestinationFiltersSchema } from "../schemas/destinationFilters" import { mapLocationSchema } from "../schemas/mapLocation" -import { - linkRefsUnionSchema, - linkUnionSchema, - transformPageLink, -} from "../schemas/pageLinks" +import { linkUnionSchema, transformPageLink } from "../schemas/pageLinks" import { systemSchema } from "../schemas/system" import type { ImageVaultAsset } from "@scandic-hotels/common/utils/imageVault" @@ -131,47 +121,3 @@ export const countryPageUrlsSchema = z .transform( ({ all_destination_country_page }) => all_destination_country_page.items ) - -/** REFS */ -const destinationCountryPageContentRefs = z - .object({ - __typename: z.literal( - DestinationCountryPageEnum.ContentStack.blocks.Content - ), - }) - .merge(contentRefsSchema) - -const destinationCountryPageAccordionRefs = z - .object({ - __typename: z.literal( - DestinationCountryPageEnum.ContentStack.blocks.Accordion - ), - }) - .merge(accordionRefsSchema) - -const blocksRefsSchema = z.discriminatedUnion("__typename", [ - destinationCountryPageAccordionRefs, - destinationCountryPageContentRefs, -]) -export const destinationCountryPageRefsSchema = z.object({ - destination_country_page: z.object({ - sidepeek_content: z - .object({ - content: z - .object({ - embedded_itemsConnection: z.object({ - edges: z.array( - z.object({ - node: linkRefsUnionSchema, - }) - ), - }), - }) - .nullish(), - }) - .nullish(), - blocks: discriminatedUnionArray(blocksRefsSchema.options).nullable(), - seo_filters: destinationFiltersRefsSchema, - system: systemSchema, - }), -}) diff --git a/packages/trpc/lib/routers/contentstack/destinationCountryPage/query.ts b/packages/trpc/lib/routers/contentstack/destinationCountryPage/query.ts index 47681ad08..ed08505eb 100644 --- a/packages/trpc/lib/routers/contentstack/destinationCountryPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/destinationCountryPage/query.ts @@ -2,73 +2,26 @@ import { createCounter } from "@scandic-hotels/common/telemetry" import { router } from "../../.." import { notFoundError } from "../../../errors" -import { - GetDestinationCountryPage, - GetDestinationCountryPageRefs, -} from "../../../graphql/Query/DestinationCountryPage/DestinationCountryPage.graphql" +import { GetDestinationCountryPage } from "../../../graphql/Query/DestinationCountryPage/DestinationCountryPage.graphql" import { request } from "../../../graphql/request" import { contentStackBaseWithServiceProcedure, contentstackExtendedProcedureUID, } from "../../../procedures" import { ApiCountry } from "../../../types/country" -import { generateRefsResponseTag } from "../../../utils/generateTag" +import { generateTag } from "../../../utils/generateTag" import { getCityPagesInput } from "./input" -import { - destinationCountryPageRefsSchema, - destinationCountryPageSchema, -} from "./output" -import { generatePageTags, getCityPages } from "./utils" +import { destinationCountryPageSchema } from "./output" +import { getCityPages } from "./utils" -import type { - GetDestinationCountryPageData, - GetDestinationCountryPageRefsSchema, -} from "../../../types/destinationCountryPage" +import type { GetDestinationCountryPageData } from "../../../types/destinationCountryPage" import type { TrackingPageData } from "../../types" export const destinationCountryPageQueryRouter = router({ get: contentstackExtendedProcedureUID.query(async ({ ctx }) => { const { lang, uid } = ctx - const getDestinationCountryPageRefsCounter = createCounter( - "trpc.contentstack.destinationCountryPage.get.refs" - ) - const metricsGetDestinationCountryPageRefs = - getDestinationCountryPageRefsCounter.init({ lang, uid }) - - metricsGetDestinationCountryPageRefs.start() - - const variables = { locale: lang, uid } - const refsResponse = await request( - GetDestinationCountryPageRefs, - variables, - { - key: generateRefsResponseTag(lang, uid), - ttl: "max", - } - ) - - if (!refsResponse.data) { - metricsGetDestinationCountryPageRefs.noDataError() - throw notFoundError({ - message: "GetDestinationCountryPageRefs returned no data", - errorDetails: variables, - }) - } - - const validatedRefsData = destinationCountryPageRefsSchema.safeParse( - refsResponse.data - ) - if (!validatedRefsData.success) { - metricsGetDestinationCountryPageRefs.validationError( - validatedRefsData.error - ) - return null - } - - metricsGetDestinationCountryPageRefs.success() - - const tags = generatePageTags(validatedRefsData.data, lang) + const cacheKey = generateTag(lang, uid) const getDestinationCountryPageCounter = createCounter( "trpc.contentstack.destinationCountryPage.get" @@ -78,11 +31,12 @@ export const destinationCountryPageQueryRouter = router({ metricsGetDestinationCountryPage.start() + const variables = { locale: lang, uid } const response = await request( GetDestinationCountryPage, variables, { - key: tags, + key: `${cacheKey}:destinationCountryPage`, ttl: "max", } ) diff --git a/packages/trpc/lib/routers/contentstack/destinationCountryPage/utils.ts b/packages/trpc/lib/routers/contentstack/destinationCountryPage/utils.ts index ccc60fa00..e39a24403 100644 --- a/packages/trpc/lib/routers/contentstack/destinationCountryPage/utils.ts +++ b/packages/trpc/lib/routers/contentstack/destinationCountryPage/utils.ts @@ -4,8 +4,7 @@ import { GetDestinationCityListData } from "../../../graphql/Query/DestinationCi import { GetCountryPageUrls } from "../../../graphql/Query/DestinationCountryPage/DestinationCountryPageUrl.graphql" import { request } from "../../../graphql/request" import { ApiCountry } from "../../../types/country" -import { DestinationCountryPageEnum } from "../../../types/destinationCountryPage" -import { generateTag, generateTagsFromSystem } from "../../../utils/generateTag" +import { generateTag } from "../../../utils/generateTag" import { getCitiesByCountry } from "../../hotels/services/getCitiesByCountry" import { destinationCityListDataSchema } from "../destinationCityPage/output" import { countryPageUrlsSchema } from "./output" @@ -14,60 +13,7 @@ import type { Country } from "@scandic-hotels/common/constants/country" import type { Lang } from "@scandic-hotels/common/constants/language" import type { GetDestinationCityListDataResponse } from "../../../types/destinationCityPage" -import type { - DestinationCountryPageRefs, - GetCountryPageUrlsData, -} from "../../../types/destinationCountryPage" -import type { System } from "../schemas/system" - -export function generatePageTags( - validatedData: DestinationCountryPageRefs, - lang: Lang -): string[] { - const connections = getConnections(validatedData) - return [ - generateTagsFromSystem(lang, connections), - generateTag(lang, validatedData.destination_country_page.system.uid), - ].flat() -} - -export function getConnections({ - destination_country_page, -}: DestinationCountryPageRefs) { - const connections: System["system"][] = [destination_country_page.system] - if (destination_country_page.blocks) { - destination_country_page.blocks.forEach((block) => { - switch (block.__typename) { - case DestinationCountryPageEnum.ContentStack.blocks.Accordion: { - if (block.accordion.length) { - connections.push(...block.accordion.filter((c) => !!c)) - } - break - } - case DestinationCountryPageEnum.ContentStack.blocks.Content: - { - if (block?.content?.length) { - // TS has trouble infering the filtered types - // @ts-ignore - connections.push(...block.content) - } - } - break - } - }) - } - if (destination_country_page.sidepeek_content) { - destination_country_page.sidepeek_content?.content?.embedded_itemsConnection.edges.forEach( - ({ node }) => { - if (node.system) { - connections.push(node.system) - } - } - ) - } - - return connections -} +import type { GetCountryPageUrlsData } from "../../../types/destinationCountryPage" export async function getCityListDataByCityIdentifier( lang: Lang, diff --git a/packages/trpc/lib/routers/contentstack/destinationOverviewPage/output.ts b/packages/trpc/lib/routers/contentstack/destinationOverviewPage/output.ts index 14db8b9fb..7b7310439 100644 --- a/packages/trpc/lib/routers/contentstack/destinationOverviewPage/output.ts +++ b/packages/trpc/lib/routers/contentstack/destinationOverviewPage/output.ts @@ -2,10 +2,7 @@ import { z } from "zod" import { DestinationOverviewPageEnum } from "../../../types/destinationOverviewPage" import { discriminatedUnionArray } from "../../../utils/discriminatedUnion" -import { - cardGalleryRefsSchema, - cardGallerySchema, -} from "../schemas/blocks/cardGallery" +import { cardGallerySchema } from "../schemas/blocks/cardGallery" import { mapLocationSchema } from "../schemas/mapLocation" import { systemSchema } from "../schemas/system" @@ -37,23 +34,3 @@ export const destinationOverviewPageSchema = z.object({ url: z.string(), }), }) - -/** REFS */ -const destinationOverviewPageCardGalleryRef = z - .object({ - __typename: z.literal( - DestinationOverviewPageEnum.ContentStack.blocks.CardGallery - ), - }) - .merge(cardGalleryRefsSchema) - -const blocksRefsSchema = z.discriminatedUnion("__typename", [ - destinationOverviewPageCardGalleryRef, -]) - -export const destinationOverviewPageRefsSchema = z.object({ - destination_overview_page: z.object({ - blocks: discriminatedUnionArray(blocksRefsSchema.options).nullable(), - system: systemSchema, - }), -}) diff --git a/packages/trpc/lib/routers/contentstack/destinationOverviewPage/query.ts b/packages/trpc/lib/routers/contentstack/destinationOverviewPage/query.ts index 925ce2016..f16add5d9 100644 --- a/packages/trpc/lib/routers/contentstack/destinationOverviewPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/destinationOverviewPage/query.ts @@ -3,37 +3,25 @@ import { safeTry } from "@scandic-hotels/common/utils/safeTry" import { router } from "../../.." import { notFoundError } from "../../../errors" -import { - GetDestinationOverviewPage, - GetDestinationOverviewPageRefs, -} from "../../../graphql/Query/DestinationOverviewPage/DestinationOverviewPage.graphql" +import { GetDestinationOverviewPage } from "../../../graphql/Query/DestinationOverviewPage/DestinationOverviewPage.graphql" import { request } from "../../../graphql/request" import { contentstackExtendedProcedureUID, serviceProcedure, } from "../../../procedures" import { ApiCountry } from "../../../types/country" -import { - generateRefsResponseTag, - generateTag, -} from "../../../utils/generateTag" +import { generateTag } from "../../../utils/generateTag" import { getCitiesByCountry } from "../../hotels/services/getCitiesByCountry" import { getCountries } from "../../hotels/services/getCountries" import { getHotelIdsByCityId } from "../../hotels/services/getHotelIdsByCityId" import { getCityPageUrls } from "../destinationCityPage/utils" import { getCountryPageUrls } from "../destinationCountryPage/utils" -import { - destinationOverviewPageRefsSchema, - destinationOverviewPageSchema, -} from "./output" +import { destinationOverviewPageSchema } from "./output" import { getSortedDestinationsByLanguage } from "./utils" import type { Country } from "@scandic-hotels/common/constants/country" -import type { - GetDestinationOverviewPageData, - GetDestinationOverviewPageRefsSchema, -} from "../../../types/destinationOverviewPage" +import type { GetDestinationOverviewPageData } from "../../../types/destinationOverviewPage" import type { City, DestinationsData } from "../../../types/destinationsData" import type { TrackingPageData } from "../../types" @@ -41,43 +29,7 @@ export const destinationOverviewPageQueryRouter = router({ get: contentstackExtendedProcedureUID.query(async ({ ctx }) => { const { lang, uid } = ctx - const getDestinationOverviewPageRefsCounter = createCounter( - "trpc.contentstack.destinationOverviewPage.get.refs" - ) - const metricsGetDestinationOverviewPageRefs = - getDestinationOverviewPageRefsCounter.init({ lang, uid }) - - metricsGetDestinationOverviewPageRefs.start() - - const variables = { locale: lang, uid } - const refsResponse = await request( - GetDestinationOverviewPageRefs, - variables, - { - key: generateRefsResponseTag(lang, uid), - ttl: "max", - } - ) - if (!refsResponse.data) { - metricsGetDestinationOverviewPageRefs.noDataError() - throw notFoundError({ - message: "GetDestinationOverviewPageRefs returned no data", - errorDetails: variables, - }) - } - - const validatedRefsData = destinationOverviewPageRefsSchema.safeParse( - refsResponse.data - ) - - if (!validatedRefsData.success) { - metricsGetDestinationOverviewPageRefs.validationError( - validatedRefsData.error - ) - return null - } - - metricsGetDestinationOverviewPageRefs.success() + const cacheKey = generateTag(lang, uid) const getDestinationOverviewPageCounter = createCounter( "trpc.contentstack.destinationOverviewPage.get" @@ -87,11 +39,12 @@ export const destinationOverviewPageQueryRouter = router({ metricsGetDestinationOverviewPage.start() + const variables = { locale: lang, uid } const response = await request( GetDestinationOverviewPage, variables, { - key: generateTag(lang, uid), + key: `${cacheKey}:destinationOverviewPage`, ttl: "max", } ) diff --git a/packages/trpc/lib/routers/contentstack/hotelPage/output.ts b/packages/trpc/lib/routers/contentstack/hotelPage/output.ts index 4052d43a8..19083bfa9 100644 --- a/packages/trpc/lib/routers/contentstack/hotelPage/output.ts +++ b/packages/trpc/lib/routers/contentstack/hotelPage/output.ts @@ -5,12 +5,9 @@ import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/string import { HotelPageEnum } from "../../../types/hotelPageEnum" import { discriminatedUnionArray } from "../../../utils/discriminatedUnion" -import { - activitiesCardRefSchema, - activitiesCardSchema, -} from "../schemas/blocks/activitiesCard" -import { hotelFaqRefsSchema, hotelFaqSchema } from "../schemas/blocks/hotelFaq" -import { spaPageRefSchema, spaPageSchema } from "../schemas/blocks/spaPage" +import { activitiesCardSchema } from "../schemas/blocks/activitiesCard" +import { hotelFaqSchema } from "../schemas/blocks/hotelFaq" +import { spaPageSchema } from "../schemas/blocks/spaPage" import { systemSchema } from "../schemas/system" import type { ActivitiesCard, SpaPage } from "../../../types/hotelPage" @@ -112,35 +109,6 @@ export const hotelPageSchema = z.object({ })), }) -/** REFS */ -const hotelPageActivitiesCardRefs = z - .object({ - __typename: z.literal(HotelPageEnum.ContentStack.blocks.ActivitiesCard), - }) - .merge(activitiesCardRefSchema) - -const hotelPageSpaPageRefs = z - .object({ - __typename: z.literal(HotelPageEnum.ContentStack.blocks.SpaPage), - }) - .merge(spaPageRefSchema) - -const hotelPageBlockRefsItem = z.discriminatedUnion("__typename", [ - hotelPageActivitiesCardRefs, - hotelPageSpaPageRefs, -]) - -export const hotelPageRefsSchema = z.object({ - hotel_page: z.object({ - content: discriminatedUnionArray(hotelPageBlockRefsItem.options).nullable(), - faq: hotelFaqRefsSchema.nullable(), - system: systemSchema, - }), - trackingProps: z.object({ - url: z.string(), - }), -}) - export const hotelPageUrlsSchema = z .object({ all_hotel_page: z.object({ diff --git a/packages/trpc/lib/routers/contentstack/loyaltyPage/output.ts b/packages/trpc/lib/routers/contentstack/loyaltyPage/output.ts index feadcc938..129f1d25e 100644 --- a/packages/trpc/lib/routers/contentstack/loyaltyPage/output.ts +++ b/packages/trpc/lib/routers/contentstack/loyaltyPage/output.ts @@ -4,106 +4,15 @@ import { transformedImageVaultAssetSchema } from "@scandic-hotels/common/utils/i import { LoyaltyPageEnum } from "../../../enums/loyaltyPage" import { discriminatedUnionArray } from "../../../utils/discriminatedUnion" -import { - cardGridRefsSchema, - cardsGridSchema, -} from "../schemas/blocks/cardsGrid" -import { - contentRefsSchema as blockContentRefsSchema, - contentSchema as blockContentSchema, -} from "../schemas/blocks/content" -import { - dynamicContentRefsSchema, - dynamicContentSchema as blockDynamicContentSchema, -} from "../schemas/blocks/dynamicContent" -import { - shortcutsRefsSchema, - shortcutsSchema, -} from "../schemas/blocks/shortcuts" -import { - contentRefsSchema as sidebarContentRefsSchema, - contentSchema as sidebarContentSchema, -} from "../schemas/sidebar/content" +import { cardsGridSchema } from "../schemas/blocks/cardsGrid" +import { contentSchema as blockContentSchema } from "../schemas/blocks/content" +import { dynamicContentSchema as blockDynamicContentSchema } from "../schemas/blocks/dynamicContent" +import { shortcutsSchema } from "../schemas/blocks/shortcuts" +import { contentSchema as sidebarContentSchema } from "../schemas/sidebar/content" import { dynamicContentSchema as sidebarDynamicContentSchema } from "../schemas/sidebar/dynamicContent" -import { - joinLoyaltyContactRefsSchema, - joinLoyaltyContactSchema, -} from "../schemas/sidebar/joinLoyaltyContact" +import { joinLoyaltyContactSchema } from "../schemas/sidebar/joinLoyaltyContact" import { systemSchema } from "../schemas/system" -// LoyaltyPage Refs -const extendedCardGridRefsSchema = z - .object({ - __typename: z.literal(LoyaltyPageEnum.ContentStack.blocks.CardsGrid), - }) - .merge(cardGridRefsSchema) - -const extendedContentRefsSchema = z - .object({ - __typename: z.literal(LoyaltyPageEnum.ContentStack.blocks.Content), - }) - .merge(blockContentRefsSchema) - -const extendedDynamicContentRefsSchema = z - .object({ - __typename: z.literal(LoyaltyPageEnum.ContentStack.blocks.DynamicContent), - }) - .merge(dynamicContentRefsSchema) - -const extendedShortcutsRefsSchema = z - .object({ - __typename: z.literal(LoyaltyPageEnum.ContentStack.blocks.Shortcuts), - }) - .merge(shortcutsRefsSchema) - -const blocksRefsSchema = z.discriminatedUnion("__typename", [ - extendedCardGridRefsSchema, - extendedContentRefsSchema, - extendedDynamicContentRefsSchema, - extendedShortcutsRefsSchema, -]) - -const contentSidebarRefsSchema = z - .object({ - __typename: z.literal(LoyaltyPageEnum.ContentStack.sidebar.Content), - }) - .merge(sidebarContentRefsSchema) - -const extendedJoinLoyaltyContactRefsSchema = z - .object({ - __typename: z.literal( - LoyaltyPageEnum.ContentStack.sidebar.JoinLoyaltyContact - ), - }) - .merge(joinLoyaltyContactRefsSchema) - -const sidebarRefsSchema = z.discriminatedUnion("__typename", [ - contentSidebarRefsSchema, - extendedJoinLoyaltyContactRefsSchema, - z.object({ - __typename: z.literal(LoyaltyPageEnum.ContentStack.sidebar.DynamicContent), - }), -]) - -export const loyaltyPageRefsSchema = z.object({ - loyalty_page: z.object({ - blocks: discriminatedUnionArray(blocksRefsSchema.options).optional(), - sidebar: discriminatedUnionArray(sidebarRefsSchema.options) - .optional() - .transform((data) => { - if (data) { - return data.filter( - (block) => - block.__typename !== - LoyaltyPageEnum.ContentStack.sidebar.DynamicContent - ) - } - return data - }), - system: systemSchema, - }), -}) - // LoyaltyPage export const extendedCardsGridSchema = z .object({ diff --git a/packages/trpc/lib/routers/contentstack/loyaltyPage/query.ts b/packages/trpc/lib/routers/contentstack/loyaltyPage/query.ts index 1bbb69d22..04070c10b 100644 --- a/packages/trpc/lib/routers/contentstack/loyaltyPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/loyaltyPage/query.ts @@ -2,78 +2,20 @@ import { createCounter } from "@scandic-hotels/common/telemetry" import { router } from "../../.." import { notFoundError } from "../../../errors" -import { - GetLoyaltyPage, - GetLoyaltyPageRefs, -} from "../../../graphql/Query/LoyaltyPage/LoyaltyPage.graphql" +import { GetLoyaltyPage } from "../../../graphql/Query/LoyaltyPage/LoyaltyPage.graphql" import { request } from "../../../graphql/request" import { contentstackExtendedProcedureUID } from "../../../procedures" -import { - generateRefsResponseTag, - generateTag, - generateTagsFromAssetSystem, - generateTagsFromSystem, -} from "../../../utils/generateTag" -import { loyaltyPageRefsSchema, loyaltyPageSchema } from "./output" -import { getConnections } from "./utils" +import { generateTag } from "../../../utils/generateTag" +import { loyaltyPageSchema } from "./output" -import type { - GetLoyaltyPageRefsSchema, - GetLoyaltyPageSchema, -} from "../../../types/loyaltyPage" +import type { GetLoyaltyPageSchema } from "../../../types/loyaltyPage" import type { TrackingPageData } from "../../types" export const loyaltyPageQueryRouter = router({ get: contentstackExtendedProcedureUID.query(async ({ ctx }) => { const { lang, uid } = ctx - const getLoyaltyPageRefsCounter = createCounter( - "trpc.contentstack.loyaltyPage.get.refs" - ) - const metricsGetLoyaltyPageRefs = getLoyaltyPageRefsCounter.init({ - lang, - uid, - }) - - metricsGetLoyaltyPageRefs.start() - - const variables = { locale: lang, uid } - const refsResponse = await request( - GetLoyaltyPageRefs, - variables, - { - key: generateRefsResponseTag(lang, uid), - ttl: "max", - } - ) - - if (!refsResponse.data) { - metricsGetLoyaltyPageRefs.noDataError() - throw notFoundError({ - message: "GetLoyaltyPageRefs returned no data", - errorDetails: { ...variables }, - }) - } - - const validatedLoyaltyPageRefs = loyaltyPageRefsSchema.safeParse( - refsResponse.data - ) - if (!validatedLoyaltyPageRefs.success) { - metricsGetLoyaltyPageRefs.validationError(validatedLoyaltyPageRefs.error) - return null - } - - metricsGetLoyaltyPageRefs.success() - - const { connections, assetConnections } = getConnections( - validatedLoyaltyPageRefs.data - ) - - const tags = [ - generateTagsFromSystem(lang, connections), - generateTagsFromAssetSystem(assetConnections), - generateTag(lang, validatedLoyaltyPageRefs.data.loyalty_page.system.uid), - ].flat() + const cacheKey = generateTag(lang, uid) const getLoyaltyPageCounter = createCounter( "trpc.contentstack.loyaltyPage.get" @@ -82,11 +24,12 @@ export const loyaltyPageQueryRouter = router({ metricsGetLoyaltyPage.start() + const variables = { locale: lang, uid } const response = await request( GetLoyaltyPage, variables, { - key: tags, + key: `${cacheKey}:loyaltyPage`, ttl: "max", } ) diff --git a/packages/trpc/lib/routers/contentstack/loyaltyPage/utils.ts b/packages/trpc/lib/routers/contentstack/loyaltyPage/utils.ts deleted file mode 100644 index 6fb09d990..000000000 --- a/packages/trpc/lib/routers/contentstack/loyaltyPage/utils.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { LoyaltyPageEnum } from "../../../enums/loyaltyPage" - -import type { LoyaltyPageRefs } from "../../../types/loyaltyPage" -import type { AssetSystem, System } from "../schemas/system" - -export function getConnections({ loyalty_page }: LoyaltyPageRefs) { - const connections: System["system"][] = [loyalty_page.system] - const assetConnections: AssetSystem[] = [] - - if (loyalty_page.blocks) { - loyalty_page.blocks.forEach((block) => { - switch (block.__typename) { - case LoyaltyPageEnum.ContentStack.blocks.CardsGrid: - if (block.cards_grid.length) { - connections.push(...block.cards_grid) - } - break - case LoyaltyPageEnum.ContentStack.blocks.Content: - if (block?.content?.length) { - block.content.forEach((contentBlock) => { - if ("system" in contentBlock) { - assetConnections.push(contentBlock) - } else { - connections.push(contentBlock) - } - }) - } - break - case LoyaltyPageEnum.ContentStack.blocks.DynamicContent: - if (block.dynamic_content.link) { - connections.push(block.dynamic_content.link) - } - break - case LoyaltyPageEnum.ContentStack.blocks.Shortcuts: - if (block.shortcuts.shortcuts.length) { - connections.push(...block.shortcuts.shortcuts.filter((c) => !!c)) - } - break - default: - break - } - }) - } - - if (loyalty_page.sidebar) { - loyalty_page.sidebar.forEach((block) => { - switch (block?.__typename) { - case LoyaltyPageEnum.ContentStack.sidebar.Content: - if (block?.content?.length) { - block.content.forEach((contentBlock) => { - if ("system" in contentBlock) { - assetConnections.push(contentBlock) - } else { - connections.push(contentBlock) - } - }) - } - break - case LoyaltyPageEnum.ContentStack.sidebar.JoinLoyaltyContact: - if (block.join_loyalty_contact?.button) { - connections.push(block.join_loyalty_contact.button) - } - break - - default: - break - } - }) - } - - return { connections, assetConnections } -} diff --git a/packages/trpc/lib/routers/contentstack/promoCampaignPage/output.ts b/packages/trpc/lib/routers/contentstack/promoCampaignPage/output.ts index 3243c1dd8..1f6af70f4 100644 --- a/packages/trpc/lib/routers/contentstack/promoCampaignPage/output.ts +++ b/packages/trpc/lib/routers/contentstack/promoCampaignPage/output.ts @@ -6,14 +6,8 @@ import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/string import { PromoCampaignPageEnum } from "../../../types/promoCampaignPage" import { discriminatedUnionArray } from "../../../utils/discriminatedUnion" -import { - accordionRefsSchema, - accordionSchema, -} from "../schemas/blocks/accordion" -import { - contentRefsSchema as blockContentRefsSchema, - contentSchema as blockContentSchema, -} from "../schemas/blocks/content" +import { accordionSchema } from "../schemas/blocks/accordion" +import { contentSchema as blockContentSchema } from "../schemas/blocks/content" import { systemSchema } from "../schemas/system" export const promoCampaignPageContent = z @@ -96,30 +90,3 @@ export const promoCampaignPageSchema = z }, } }) - -/** REFS */ -const promoCampaignPageBlockContentRefs = z - .object({ - __typename: z.literal(PromoCampaignPageEnum.ContentStack.blocks.Content), - }) - .merge(blockContentRefsSchema) - -const promoCampaignPageAccordionRefs = z - .object({ - __typename: z.literal(PromoCampaignPageEnum.ContentStack.blocks.Accordion), - }) - .merge(accordionRefsSchema) - -const promoCampaignPageBlockRefsItem = z.discriminatedUnion("__typename", [ - promoCampaignPageAccordionRefs, - promoCampaignPageBlockContentRefs, -]) - -export const promoCampaignPageRefsSchema = z.object({ - promo_campaign_page: z.object({ - blocks: discriminatedUnionArray( - promoCampaignPageBlockRefsItem.options - ).nullable(), - system: systemSchema, - }), -}) diff --git a/packages/trpc/lib/routers/contentstack/promoCampaignPage/query.ts b/packages/trpc/lib/routers/contentstack/promoCampaignPage/query.ts index 667972b8a..23e4278e3 100644 --- a/packages/trpc/lib/routers/contentstack/promoCampaignPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/promoCampaignPage/query.ts @@ -2,64 +2,20 @@ import { createCounter } from "@scandic-hotels/common/telemetry" import { router } from "../../.." import { notFoundError } from "../../../errors" -import { - GetPromoCampaignPage, - GetPromoCampaignPageRefs, -} from "../../../graphql/Query/PromoCampaignPage/PromoCampaignPage.graphql" +import { GetPromoCampaignPage } from "../../../graphql/Query/PromoCampaignPage/PromoCampaignPage.graphql" import { request } from "../../../graphql/request" import { contentStackUidWithServiceProcedure } from "../../../procedures" -import { generateRefsResponseTag } from "../../../utils/generateTag" -import { promoCampaignPageRefsSchema, promoCampaignPageSchema } from "./output" -import { generatePageTags } from "./utils" +import { generateTag } from "../../../utils/generateTag" +import { promoCampaignPageSchema } from "./output" -import type { - GetPromoCampaignPageData, - GetPromoCampaignPageRefsData, -} from "../../../types/promoCampaignPage" +import type { GetPromoCampaignPageData } from "../../../types/promoCampaignPage" import type { TrackingPageData } from "../../types" export const promoCampaignPageQueryRouter = router({ get: contentStackUidWithServiceProcedure.query(async ({ ctx }) => { const { lang, uid } = ctx - const getPromoCampaignPageRefsCounter = createCounter( - "trpc.contentstack.promoCampaignPage.get.refs" - ) - const metricsGetPromoCampaignPageRefs = - getPromoCampaignPageRefsCounter.init({ - lang, - uid, - }) - - metricsGetPromoCampaignPageRefs.start() - - const refsResponse = await request( - GetPromoCampaignPageRefs, - { locale: lang, uid }, - { - key: generateRefsResponseTag(lang, uid), - ttl: "max", - } - ) - if (!refsResponse.data) { - metricsGetPromoCampaignPageRefs.noDataError() - throw notFoundError({ - message: "GetPromoCampaignPageRefs returned no data", - errorDetails: { lang, uid }, - }) - } - - const validatedRefsData = promoCampaignPageRefsSchema.safeParse( - refsResponse.data - ) - if (!validatedRefsData.success) { - metricsGetPromoCampaignPageRefs.validationError(validatedRefsData.error) - return null - } - - metricsGetPromoCampaignPageRefs.success() - - const tags = generatePageTags(validatedRefsData.data, lang) + const cacheKey = generateTag(lang, uid) const getPromoCampaignPageCounter = createCounter( "trpc.contentstack.promoCampaignPage.get" @@ -78,7 +34,7 @@ export const promoCampaignPageQueryRouter = router({ uid, }, { - key: tags, + key: `${cacheKey}:promoCampaignPage`, ttl: "max", } ) diff --git a/packages/trpc/lib/routers/contentstack/promoCampaignPage/utils.ts b/packages/trpc/lib/routers/contentstack/promoCampaignPage/utils.ts deleted file mode 100644 index 408c7b93f..000000000 --- a/packages/trpc/lib/routers/contentstack/promoCampaignPage/utils.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { - PromoCampaignPageEnum, - type PromoCampaignPageRefs, -} from "../../../types/promoCampaignPage" -import { - generateTag, - generateTagsFromAssetSystem, - generateTagsFromSystem, -} from "../../../utils/generateTag" - -import type { Lang } from "@scandic-hotels/common/constants/language" - -import type { AssetSystem, System } from "../schemas/system" - -export function generatePageTags( - validatedData: PromoCampaignPageRefs, - lang: Lang -): string[] { - const { connections, assetConnections } = getConnections(validatedData) - return [ - generateTagsFromSystem(lang, connections), - generateTagsFromAssetSystem(assetConnections), - generateTag(lang, validatedData.promo_campaign_page.system.uid), - ].flat() -} - -export function getConnections({ promo_campaign_page }: PromoCampaignPageRefs) { - const connections: System["system"][] = [promo_campaign_page.system] - const assetConnections: AssetSystem[] = [] - - if (promo_campaign_page.blocks) { - promo_campaign_page.blocks.forEach((block) => { - switch (block.__typename) { - case PromoCampaignPageEnum.ContentStack.blocks.Accordion: - if (block.accordion.length) { - connections.push(...block.accordion.filter((c) => !!c)) - } - break - case PromoCampaignPageEnum.ContentStack.blocks.Content: - if (block?.content?.length) { - block.content.forEach((contentBlock) => { - if ("system" in contentBlock) { - assetConnections.push(contentBlock) - } else { - connections.push(contentBlock) - } - }) - } - break - } - }) - } - return { connections, assetConnections } -} diff --git a/packages/trpc/lib/routers/contentstack/reward/output.ts b/packages/trpc/lib/routers/contentstack/reward/output.ts index b4224f89d..000257edc 100644 --- a/packages/trpc/lib/routers/contentstack/reward/output.ts +++ b/packages/trpc/lib/routers/contentstack/reward/output.ts @@ -2,12 +2,7 @@ import { z } from "zod" import { MembershipLevelEnum } from "@scandic-hotels/common/constants/membershipLevels" -import { - linkRefsUnionSchema, - linkUnionSchema, - transformPageLink, -} from "../schemas/pageLinks" -import { systemSchema } from "../schemas/system" +import { linkUnionSchema, transformPageLink } from "../schemas/pageLinks" export { BenefitReward, @@ -15,7 +10,6 @@ export { CouponReward, REDEEM_LOCATIONS, REWARD_TYPES, - rewardRefsSchema, validateApiAllTiersSchema, validateCategorizedRewardsSchema, validateCmsRewardsSchema, @@ -65,31 +59,6 @@ const validateCmsRewardsSchema = z }) .transform((data) => data.data.all_reward.items) -const rewardRefsSchema = z.object({ - data: z.object({ - all_reward: z.object({ - items: z.array( - z.object({ - redeem_description: z - .object({ - embedded_itemsConnection: z.object({ - edges: z.array( - z.object({ - node: linkRefsUnionSchema, - }) - ), - }), - }) - // This is primarily added in order to handle a transition - // switching from string to RTE - .nullable(), - system: systemSchema, - }) - ), - }), - }), -}) - const REDEEM_LOCATIONS = ["Non-redeemable", "On-site", "Online"] as const const REWARD_CATEGORIES = [ "Restaurants", diff --git a/packages/trpc/lib/routers/contentstack/reward/utils.ts b/packages/trpc/lib/routers/contentstack/reward/utils.ts index 05bf1439e..a60ffb009 100644 --- a/packages/trpc/lib/routers/contentstack/reward/utils.ts +++ b/packages/trpc/lib/routers/contentstack/reward/utils.ts @@ -3,27 +3,14 @@ import { createCounter } from "@scandic-hotels/common/telemetry" import * as api from "../../../api" import { notFoundError } from "../../../errors" -import { - GetRewards as GetRewards, - GetRewardsRef as GetRewardsRef, -} from "../../../graphql/Query/RewardsWithRedeem.graphql" +import { GetRewards } from "../../../graphql/Query/RewardsWithRedeem.graphql" import { request } from "../../../graphql/request" -import { - generateLoyaltyConfigTag, - generateRefsResponseTag, -} from "../../../utils/generateTag" -import { - rewardRefsSchema, - validateApiAllTiersSchema, - validateCmsRewardsSchema, -} from "./output" +import { generateLoyaltyConfigTag } from "../../../utils/generateTag" +import { validateApiAllTiersSchema, validateCmsRewardsSchema } from "./output" import type { Lang } from "@scandic-hotels/common/constants/language" -import type { - CMSRewardsResponse, - GetRewardRefsSchema, -} from "../../../types/reward" +import type { CMSRewardsResponse } from "../../../types/reward" export function getUniqueRewardIds(rewardIds: string[]) { const uniqueRewardIds = new Set(rewardIds) @@ -88,44 +75,6 @@ export async function getCmsRewards(lang: Lang, rewardIds: string[]) { generateLoyaltyConfigTag(lang, "reward", id) ) - const getContentstackRewardAllRefsCounter = createCounter( - "trpc.contentstack.reward.all.refs" - ) - const metricsGetContentstackRewardAllRefs = - getContentstackRewardAllRefsCounter.init({ lang, rewardIds }) - - metricsGetContentstackRewardAllRefs.start() - - const refsResponse = await request( - GetRewardsRef, - { - locale: lang, - rewardIds, - }, - { - key: rewardIds.map((rewardId) => generateRefsResponseTag(lang, rewardId)), - ttl: "max", - } - ) - - if (!refsResponse.data) { - metricsGetContentstackRewardAllRefs.noDataError() - - throw notFoundError({ - message: "GetRewardsRef returned no data", - errorDetails: { lang, rewardIds }, - }) - } - - const validatedRefsData = rewardRefsSchema.safeParse(refsResponse) - - if (!validatedRefsData.success) { - metricsGetContentstackRewardAllRefs.validationError(validatedRefsData.error) - return null - } - - metricsGetContentstackRewardAllRefs.success() - const getContentstackRewardAllCounter = createCounter( "trpc.contentstack.reward.all" ) @@ -134,6 +83,8 @@ export async function getCmsRewards(lang: Lang, rewardIds: string[]) { rewardIds, }) + metricsGetContentstackRewardAll.start() + const cmsRewardsResponse = await request( GetRewards, { diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/accordion.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/accordion.ts index a09691195..9ede67165 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/accordion.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/accordion.ts @@ -1,11 +1,7 @@ import { z } from "zod" import { BlocksEnums } from "../../../../types/blocksEnum" -import { - linkRefsUnionSchema, - linkUnionSchema, - transformPageLink, -} from "../pageLinks" +import { linkUnionSchema, transformPageLink } from "../pageLinks" import { sysAssetSchema } from "./sysAsset" export const embeddedContentSchema = z.union([linkUnionSchema, sysAssetSchema]) @@ -117,95 +113,3 @@ export const accordionSchema = z.object({ } }), }) - -export const globalAccordionConnectionRefs = z.object({ - edges: z.array( - z.object({ - node: z.object({ - questions: z.array( - z.object({ - answer: z.object({ - embedded_itemsConnection: z.object({ - edges: z.array( - z.object({ - node: linkRefsUnionSchema, - }) - ), - }), - }), - }) - ), - }), - }) - ), -}) - -export const specificAccordionConnectionRefs = z.object({ - questions: z.array( - z.object({ - answer: z.object({ - embedded_itemsConnection: z.object({ - edges: z.array( - z.object({ - node: linkRefsUnionSchema, - }) - ), - }), - }), - }) - ), -}) - -export const accordionRefsSchema = z.object({ - accordion: z - .object({ - accordions: z.array( - z.object({ - __typename: z.nativeEnum(AccordionEnum), - global_accordion: z - .object({ - global_accordionConnection: globalAccordionConnectionRefs, - }) - .optional(), - specific_accordion: specificAccordionConnectionRefs.optional(), - }) - ), - }) - .transform((data) => { - return data.accordions.flatMap((accordion) => { - switch (accordion.__typename) { - case AccordionEnum.CampaignPageBlocksAccordionBlockAccordionsGlobalAccordion: - case AccordionEnum.ContentPageBlocksAccordionBlockAccordionsGlobalAccordion: - case AccordionEnum.DestinationCityPageBlocksAccordionBlockAccordionsGlobalAccordion: - case AccordionEnum.DestinationCountryPageBlocksAccordionBlockAccordionsGlobalAccordion: - case AccordionEnum.DestinationFilterBlocksAccordionBlockAccordionsGlobalAccordion: - case AccordionEnum.PromoCampaignPageBlocksAccordionBlockAccordionsGlobalAccordion: - return ( - accordion.global_accordion?.global_accordionConnection.edges.flatMap( - ({ node: accordionConnection }) => { - return accordionConnection.questions.flatMap((question) => - question.answer.embedded_itemsConnection.edges.flatMap( - ({ node }) => node.system - ) - ) - } - ) || [] - ) - case AccordionEnum.CampaignPageBlocksAccordionBlockAccordionsSpecificAccordion: - case AccordionEnum.DestinationCityPageBlocksAccordionBlockAccordionsSpecificAccordion: - case AccordionEnum.DestinationCountryPageBlocksAccordionBlockAccordionsSpecificAccordion: - case AccordionEnum.DestinationFilterBlocksAccordionBlockAccordionsSpecificAccordion: - case AccordionEnum.PromoCampaignPageBlocksAccordionBlockAccordionsSpecificAccordion: - return ( - accordion.specific_accordion?.questions.flatMap((question) => - question.answer.embedded_itemsConnection.edges.flatMap( - ({ node }) => node.system - ) - ) || [] - ) - default: - return [] - } - }) - }), -}) diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/activitiesCard.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/activitiesCard.ts index f2ad59866..3045f8952 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/activitiesCard.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/activitiesCard.ts @@ -4,12 +4,7 @@ import { transformedImageVaultAssetSchema } from "@scandic-hotels/common/utils/i import { removeMultipleSlashes } from "@scandic-hotels/common/utils/url" import { HotelPageEnum } from "../../../../types/hotelPageEnum" -import { - collectionPageRefSchema, - collectionPageSchema, - contentPageRefSchema, - contentPageSchema, -} from "../pageLinks" +import { collectionPageSchema, contentPageSchema } from "../pageLinks" export const activitiesCardSchema = z.object({ typename: z @@ -70,26 +65,3 @@ export const activitiesCardSchema = z.object({ } }), }) - -export const activitiesCardRefSchema = z.object({ - upcoming_activities_card: z - .object({ - hotel_page_activities_content_pageConnection: z.object({ - edges: z.array( - z.object({ - node: z.discriminatedUnion("__typename", [ - contentPageRefSchema, - collectionPageRefSchema, - ]), - }) - ), - }), - }) - .transform((data) => { - return ( - data.hotel_page_activities_content_pageConnection.edges.flatMap( - ({ node }) => node.system - ) || [] - ) - }), -}) diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/allCampaigns.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/allCampaigns.ts index b0af5263e..fa5fba409 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/allCampaigns.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/allCampaigns.ts @@ -4,7 +4,6 @@ import { transformedImageVaultAssetSchema } from "@scandic-hotels/common/utils/i import { removeMultipleSlashes } from "@scandic-hotels/common/utils/url" import { BlocksEnums } from "../../../../types/blocksEnum" -import { campaignPageRefSchema, promoCampaignPageRefSchema } from "../pageLinks" export const campaignPageCardSchema = z.object({ image: transformedImageVaultAssetSchema, @@ -66,18 +65,3 @@ export const allCampaignsSchema = z.object({ } }), }) - -export const allCampaignsRefsSchema = z.object({ - all_campaigns: z.object({ - campaignsConnection: z.object({ - edges: z.array( - z.object({ - node: z.discriminatedUnion("__typename", [ - campaignPageRefSchema, - promoCampaignPageRefSchema, - ]), - }) - ), - }), - }), -}) diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/cardGallery.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/cardGallery.ts index 306951a2f..a8b5c6fd5 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/cardGallery.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/cardGallery.ts @@ -1,13 +1,8 @@ import { z } from "zod" import { BlocksEnums } from "../../../../types/blocksEnum" -import { - contentCardRefSchema, - contentCardSchema, - transformContentCard, -} from "./cards/contentCard" +import { contentCardSchema, transformContentCard } from "./cards/contentCard" import { buttonSchema } from "./utils/buttonLinkSchema" -import { linkConnectionRefsSchema } from "./utils/linkConnection" export const cardGallerySchema = z.object({ typename: z @@ -77,24 +72,3 @@ export const cardGallerySchema = z.object({ } }), }) - -export const cardGalleryRefsSchema = z.object({ - typename: z - .literal(BlocksEnums.block.CardGallery) - .optional() - .default(BlocksEnums.block.CardGallery), - card_gallery: z.object({ - card_groups: z.array( - z.object({ - cardsConnection: z.object({ - edges: z.array( - z.object({ - node: contentCardRefSchema, - }) - ), - }), - }) - ), - link: linkConnectionRefsSchema.optional(), - }), -}) diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/cards/contentCard.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/cards/contentCard.ts index a77b3b11d..b9d4f7bca 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/cards/contentCard.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/cards/contentCard.ts @@ -5,7 +5,6 @@ import { transformedImageVaultAssetSchema } from "@scandic-hotels/common/utils/i import { CardsEnum } from "../../../../../types/cardsEnum" import { systemSchema } from "../../system" import { buttonSchema } from "../utils/buttonLinkSchema" -import { linkConnectionRefsSchema } from "../utils/linkConnection" export const contentCardSchema = z.object({ __typename: z.literal(CardsEnum.ContentCard), @@ -19,12 +18,6 @@ export const contentCardSchema = z.object({ system: systemSchema, }) -export const contentCardRefSchema = z.object({ - __typename: z.literal(CardsEnum.ContentCard), - card_link: linkConnectionRefsSchema, - system: systemSchema, -}) - export function transformContentCard(card: typeof contentCardSchema._type) { // Return null if image or image URL is missing if (!card.image?.url) return null diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/cards/infoCardWithImage.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/cards/infoCardWithImage.ts index ba52deb70..a4871dd33 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/cards/infoCardWithImage.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/cards/infoCardWithImage.ts @@ -6,7 +6,6 @@ import { CardsEnum } from "../../../../../types/cardsEnum" import { systemSchema } from "../../system" import { getInfoCardThemeFromDeprecatedCardTheme } from "../cardsGrid" import { buttonSchema } from "../utils/buttonLinkSchema" -import { linkConnectionRefsSchema } from "../utils/linkConnection" const INFO_CARD_WITH_IMAGE_THEMES = [ "one", @@ -62,10 +61,3 @@ export function transformInfoCardWithImageBlock( system: card.system, } } - -export const infoCardWithImageBlockRefsSchema = z.object({ - __typename: z.literal(CardsEnum.InfoCardWithImage), - primary_button: linkConnectionRefsSchema, - secondary_button: linkConnectionRefsSchema, - system: systemSchema, -}) diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/cards/loyaltyCard.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/cards/loyaltyCard.ts index ca3fb3b37..42c7d1cb7 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/cards/loyaltyCard.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/cards/loyaltyCard.ts @@ -5,7 +5,6 @@ import { transformedImageVaultAssetSchema } from "@scandic-hotels/common/utils/i import { CardsEnum } from "../../../../../types/cardsEnum" import { systemSchema } from "../../system" import { buttonSchema } from "../utils/buttonLinkSchema" -import { linkConnectionRefsSchema } from "../utils/linkConnection" export const loyaltyCardBlockSchema = z.object({ __typename: z.literal(CardsEnum.LoyaltyCard), @@ -17,9 +16,3 @@ export const loyaltyCardBlockSchema = z.object({ system: systemSchema, title: z.string().optional(), }) - -export const loyaltyCardBlockRefsSchema = z.object({ - __typename: z.literal(CardsEnum.LoyaltyCard), - link: linkConnectionRefsSchema, - system: systemSchema, -}) diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/cards/teaserCard.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/cards/teaserCard.ts index 0027952e1..1302f865e 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/cards/teaserCard.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/cards/teaserCard.ts @@ -21,7 +21,6 @@ import { systemSchema } from "../../system" import { imageContainerSchema } from "../imageContainer" import { sysAssetSchema } from "../sysAsset" import { buttonSchema } from "../utils/buttonLinkSchema" -import { linkConnectionRefsSchema } from "../utils/linkConnection" export const teaserCardBlockSchema = z.object({ __typename: z.literal(CardsEnum.TeaserCard), @@ -118,10 +117,3 @@ export function transformTeaserCardBlock( system: card.system, } } - -export const teaserCardBlockRefsSchema = z.object({ - __typename: z.literal(CardsEnum.TeaserCard), - primary_button: linkConnectionRefsSchema, - secondary_button: linkConnectionRefsSchema, - system: systemSchema, -}) diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/cardsGrid.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/cardsGrid.ts index 730c600b1..4fb2d9875 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/cardsGrid.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/cardsGrid.ts @@ -10,21 +10,15 @@ import { } from "../../../../types/cardsGridEnum" import { systemSchema } from "../system" import { - infoCardWithImageBlockRefsSchema, infoCardWithImageBlockSchema, transformInfoCardWithImageBlock, } from "./cards/infoCardWithImage" +import { loyaltyCardBlockSchema } from "./cards/loyaltyCard" import { - loyaltyCardBlockRefsSchema, - loyaltyCardBlockSchema, -} from "./cards/loyaltyCard" -import { - teaserCardBlockRefsSchema, teaserCardBlockSchema, transformTeaserCardBlock, } from "./cards/teaserCard" import { buttonSchema } from "./utils/buttonLinkSchema" -import { linkConnectionRefsSchema } from "./utils/linkConnection" export const infoCardBlockSchema = z.object({ __typename: z.literal(CardsGridEnum.cards.InfoCard), @@ -140,67 +134,6 @@ export const cardsGridSchema = z.object({ }), }) -export const infoCardBlockRefsSchema = z.object({ - __typename: z.literal(CardsGridEnum.cards.InfoCard), - primary_button: linkConnectionRefsSchema, - secondary_button: linkConnectionRefsSchema, - system: systemSchema, -}) - -export function transformCardBlockRefs( - card: - | typeof infoCardBlockRefsSchema._type - | typeof teaserCardBlockRefsSchema._type - | typeof infoCardWithImageBlockRefsSchema._type -) { - const cards = [card.system] - if (card.primary_button) { - cards.push(card.primary_button) - } - if (card.secondary_button) { - cards.push(card.secondary_button) - } - return cards -} - -export const cardGridRefsSchema = z.object({ - cards_grid: z - .object({ - cardConnection: z.object({ - edges: z.array( - z.object({ - node: z.discriminatedUnion("__typename", [ - infoCardBlockRefsSchema, - loyaltyCardBlockRefsSchema, - teaserCardBlockRefsSchema, - infoCardWithImageBlockRefsSchema, - ]), - }) - ), - }), - link: linkConnectionRefsSchema.nullish(), - }) - .transform((data) => { - return data.cardConnection.edges - .map(({ node }) => { - if ( - node.__typename === CardsGridEnum.cards.InfoCard || - node.__typename === CardsGridEnum.cards.TeaserCard || - node.__typename === CardsGridEnum.cards.InfoCardWithImage - ) { - return transformCardBlockRefs(node) - } else { - const loyaltyCards = [node.system] - if (node.link) { - loyaltyCards.push(node.link) - } - return loyaltyCards - } - }) - .flat() - }), -}) - export function getInfoCardThemeFromDeprecatedCardTheme(theme?: string | null) { if (!theme) { return null diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/carouselCards.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/carouselCards.ts index 8acd08ff7..78b87db40 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/carouselCards.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/carouselCards.ts @@ -1,13 +1,8 @@ import { z } from "zod" import { BlocksEnums } from "../../../../types/blocksEnum" -import { - contentCardRefSchema, - contentCardSchema, - transformContentCard, -} from "./cards/contentCard" +import { contentCardSchema, transformContentCard } from "./cards/contentCard" import { buttonSchema } from "./utils/buttonLinkSchema" -import { linkConnectionRefsSchema } from "./utils/linkConnection" const commonFields = { heading: z.string().optional(), @@ -135,24 +130,3 @@ export const carouselCardsSchema = z.object({ } }), }) - -export const carouselCardsRefsSchema = z.object({ - typename: z - .literal(BlocksEnums.block.CarouselCards) - .optional() - .default(BlocksEnums.block.CarouselCards), - carousel_cards: z.object({ - card_groups: z.array( - z.object({ - cardConnection: z.object({ - edges: z.array( - z.object({ - node: contentCardRefSchema, - }) - ), - }), - }) - ), - link: linkConnectionRefsSchema.nullish(), - }), -}) diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/content.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/content.ts index 3d69b2b3d..51f09afed 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/content.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/content.ts @@ -1,17 +1,9 @@ import { z } from "zod" import { BlocksEnums } from "../../../../types/blocksEnum" -import { ContentEnum } from "../../../../types/content" -import { - rawLinkRefsUnionSchema, - rawLinkUnionSchema, - transformPageLink, -} from "../pageLinks" -import { - imageContainerRefsSchema, - imageContainerSchema, -} from "./imageContainer" -import { sysAssetRefsSchema, sysAssetSchema } from "./sysAsset" +import { rawLinkUnionSchema, transformPageLink } from "../pageLinks" +import { imageContainerSchema } from "./imageContainer" +import { sysAssetSchema } from "./sysAsset" export const contentSchema = z.object({ typename: z @@ -50,39 +42,3 @@ export const contentSchema = z.object({ return data?.content }), }) - -export const contentRefsSchema = z.object({ - content: z - .object({ - content: z - .object({ - embedded_itemsConnection: z.object({ - edges: z.array( - z.object({ - node: z.discriminatedUnion("__typename", [ - sysAssetRefsSchema, - imageContainerRefsSchema, - ...rawLinkRefsUnionSchema.options, - ]), - }) - ), - }), - }) - .nullish(), - }) - .nullish() - .transform((data) => { - return data?.content?.embedded_itemsConnection.edges - .map(({ node }) => { - switch (node.__typename) { - case ContentEnum.blocks.SysAsset: - return node.system && (node.permanent_url || node.url) - ? { system: node.system, url: node.permanent_url || node.url } - : null - default: - return node.system - } - }) - .filter((node) => !!node) - }), -}) diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/dynamicContent.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/dynamicContent.ts index 15e45de78..f16215ac8 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/dynamicContent.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/dynamicContent.ts @@ -2,11 +2,7 @@ import { z } from "zod" import { BlocksEnums } from "../../../../types/blocksEnum" import { DynamicContentEnum } from "../../../../types/dynamicContent" -import { - linkRefsUnionSchema, - linkUnionSchema, - transformPageLink, -} from "../pageLinks" +import { linkUnionSchema, transformPageLink } from "../pageLinks" export const dynamicContentSchema = z.object({ typename: z @@ -47,24 +43,3 @@ export const dynamicContentSchema = z.object({ }), }), }) - -export const dynamicContentRefsSchema = z.object({ - dynamic_content: z.object({ - link: z - .object({ - linkConnection: z.object({ - edges: z.array( - z.object({ - node: linkRefsUnionSchema, - }) - ), - }), - }) - .transform((data) => { - if (data.linkConnection?.edges.length) { - return data.linkConnection.edges[0].node.system - } - return null - }), - }), -}) diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/fullWidthCampaign.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/fullWidthCampaign.ts index 3da1ef7c3..489a03214 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/fullWidthCampaign.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/fullWidthCampaign.ts @@ -2,7 +2,6 @@ import { z } from "zod" import { transformedImageVaultAssetSchema } from "@scandic-hotels/common/utils/imageVault" -import * as pageLinks from "../../../../routers/contentstack/schemas/pageLinks" import { BlocksEnums } from "../../../../types/blocksEnum" import { systemSchema } from "../system" import { buttonSchema } from "./utils/buttonLinkSchema" @@ -41,24 +40,3 @@ export const fullWidthCampaignBlockSchema = z .default(BlocksEnums.block.FullWidthCampaign), }) .merge(fullWidthCampaignSchema) - -export const fullWidthCampaignBlockRefsSchema = z.object({ - full_width_campaign: z.object({ - full_width_campaignConnection: z.object({ - edges: z.array( - z.object({ - node: z.discriminatedUnion("__typename", [ - pageLinks.accountPageRefSchema, - pageLinks.contentPageRefSchema, - pageLinks.loyaltyPageRefSchema, - pageLinks.collectionPageRefSchema, - pageLinks.hotelPageRefSchema, - pageLinks.destinationCityPageRefSchema, - pageLinks.destinationCountryPageRefSchema, - pageLinks.destinationOverviewPageRefSchema, - ]), - }) - ), - }), - }), -}) diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/hotelFaq.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/hotelFaq.ts index 8fea237ef..1da7ce77b 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/hotelFaq.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/hotelFaq.ts @@ -1,12 +1,7 @@ import { z } from "zod" import { BlocksEnums } from "../../../../types/blocksEnum" -import { HotelPageEnum } from "../../../../types/hotelPageEnum" -import { - accordionItemsSchema, - globalAccordionConnectionRefs, - specificAccordionConnectionRefs, -} from "./accordion" +import { accordionItemsSchema } from "./accordion" export const hotelFaqSchema = z .object({ @@ -43,33 +38,3 @@ export const hotelFaqSchema = z array.push(data.specific_faq?.questions || []) return { ...data, accordions: array.flat(2) } }) - -export const hotelFaqRefsSchema = z - .object({ - __typename: z - .literal(HotelPageEnum.ContentStack.blocks.Faq) - .optional() - .default(HotelPageEnum.ContentStack.blocks.Faq), - global_faqConnection: globalAccordionConnectionRefs.optional(), - specific_faq: specificAccordionConnectionRefs.optional().nullable(), - }) - .transform((data) => { - const array = [] - array.push( - data.global_faqConnection?.edges.flatMap(({ node: faqConnection }) => { - return faqConnection.questions.flatMap((question) => - question.answer.embedded_itemsConnection.edges.flatMap( - ({ node }) => node.system - ) - ) - }) || [] - ) - array.push( - data.specific_faq?.questions.flatMap((question) => - question.answer.embedded_itemsConnection.edges.flatMap( - ({ node }) => node.system - ) - ) || [] - ) - return array.flat(2) - }) diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/imageContainer.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/imageContainer.ts index ad51a9b1e..1e42ff240 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/imageContainer.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/imageContainer.ts @@ -12,8 +12,3 @@ export const imageContainerSchema = z.object({ system: systemSchema, title: z.string().optional(), }) - -export const imageContainerRefsSchema = z.object({ - __typename: z.literal(ContentEnum.blocks.ImageContainer), - system: systemSchema, -}) diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/joinScandicFriends.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/joinScandicFriends.ts index cc5bf3796..4f828fd2e 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/joinScandicFriends.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/joinScandicFriends.ts @@ -4,7 +4,6 @@ import { transformedImageVaultAssetSchema } from "@scandic-hotels/common/utils/i import { BlocksEnums } from "../../../../types/blocksEnum" import { buttonSchema } from "./utils/buttonLinkSchema" -import { linkConnectionRefsSchema } from "./utils/linkConnection" export const joinScandicFriendsSchema = z.object({ join_scandic_friends: z.object({ @@ -28,9 +27,3 @@ export const joinScandicFriendsBlockSchema = z .default(BlocksEnums.block.JoinScandicFriends), }) .merge(joinScandicFriendsSchema) - -export const joinScandicFriendsBlockRefsSchema = z.object({ - join_scandic_friends: z.object({ - primary_button: linkConnectionRefsSchema, - }), -}) diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/jotform.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/jotform.ts index 001537fc7..635ed9910 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/jotform.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/jotform.ts @@ -1,7 +1,6 @@ import { z } from "zod" import { BlocksEnums } from "../../../../types/blocksEnum" -import { systemSchema } from "../system" export const jotformSchema = z.object({ typename: z @@ -24,19 +23,3 @@ export const jotformSchema = z.object({ return data.formConnection.edges[0]?.node || null }), }) - -export const jotformRefsSchema = z.object({ - jotform: z - .object({ - formConnection: z.object({ - edges: z.array( - z.object({ - node: z.object({ system: systemSchema }), - }) - ), - }), - }) - .transform((data) => { - return data.formConnection.edges[0]?.node || null - }), -}) diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/shortcuts.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/shortcuts.ts index a9d6c321a..2232fbdb1 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/shortcuts.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/shortcuts.ts @@ -1,11 +1,7 @@ import { z } from "zod" import { BlocksEnums } from "../../../../types/blocksEnum" -import { - linkRefsUnionSchema, - linkUnionSchema, - transformPageLink, -} from "../pageLinks" +import { linkUnionSchema, transformPageLink } from "../pageLinks" export const shortcutsBlockSchema = z.object({ shortcuts: z @@ -91,27 +87,3 @@ export const shortcutsSchema = z .default(BlocksEnums.block.Shortcuts), }) .merge(shortcutsBlockSchema) - -export const shortcutsRefsSchema = z.object({ - shortcuts: z.object({ - shortcuts: z - .array( - z.object({ - linkConnection: z.object({ - edges: z.array( - z.object({ - node: linkRefsUnionSchema, - }) - ), - }), - }) - ) - .transform((data) => - data - .map((shortcut) => { - return shortcut.linkConnection.edges.map(({ node }) => node.system) - }) - .flat() - ), - }), -}) diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/spaPage.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/spaPage.ts index 831c1b179..403b401fd 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/spaPage.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/spaPage.ts @@ -3,7 +3,6 @@ import { z } from "zod" import { removeMultipleSlashes } from "@scandic-hotels/common/utils/url" import { HotelPageEnum } from "../../../../types/hotelPageEnum" -import { collectionPageRefSchema, contentPageRefSchema } from "../pageLinks" export const spaPageSchema = z.object({ typename: z @@ -46,22 +45,3 @@ export const spaPageSchema = z.object({ } }), }) - -export const spaPageRefSchema = z.object({ - spa_page: z - .object({ - pageConnection: z.object({ - edges: z.array( - z.object({ - node: z.discriminatedUnion("__typename", [ - contentPageRefSchema, - collectionPageRefSchema, - ]), - }) - ), - }), - }) - .transform((data) => { - return data.pageConnection.edges.flatMap(({ node }) => node.system) || [] - }), -}) diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/sysAsset.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/sysAsset.ts index 2fb1f18c5..526e089af 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/sysAsset.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/sysAsset.ts @@ -31,13 +31,3 @@ export const sysAssetSchema = z.object({ .nullish() .transform((val) => (val === "Permanent URL Not Defined!" ? null : val)), // ContentStack returns this string when permanent_url is not defined }) - -export const sysAssetRefsSchema = z.object({ - __typename: z.literal(ContentEnum.blocks.SysAsset), - url: z.string().nullish(), - permanent_url: z - .string() - .nullish() - .transform((val) => (val === "Permanent URL Not Defined!" ? null : val)), // ContentStack returns this string when permanent_url is not defined - system: assetSystemSchema.nullish(), -}) diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/textCols.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/textCols.ts index 236b49ebc..f5f9785b3 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/textCols.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/textCols.ts @@ -1,15 +1,8 @@ import { z } from "zod" import { BlocksEnums } from "../../../../types/blocksEnum" -import { ContentEnum } from "../../../../types/content" -import { - rawLinkRefsUnionSchema, - rawLinkUnionSchema, - transformPageLink, -} from "../pageLinks" -import { sysAssetRefsSchema, sysAssetSchema } from "./sysAsset" - -import type { linkUnionSchema } from "../pageLinks" +import { rawLinkUnionSchema, transformPageLink } from "../pageLinks" +import { sysAssetSchema } from "./sysAsset" export const textColsSchema = z.object({ typename: z @@ -45,39 +38,3 @@ export const textColsSchema = z.object({ ), }), }) - -type Refs = { - node: z.TypeOf -} - -export const textColsRefsSchema = z.object({ - text_cols: z - .object({ - columns: z.array( - z.object({ - text: z.object({ - embedded_itemsConnection: z.object({ - edges: z.array( - z.object({ - node: z.discriminatedUnion("__typename", [ - sysAssetRefsSchema, - ...rawLinkRefsUnionSchema.options, - ]), - }) - ), - }), - }), - }) - ), - }) - .transform((data) => { - return data.columns - .map((column) => { - const filtered = column.text.embedded_itemsConnection.edges.filter( - (block) => block.node.__typename !== ContentEnum.blocks.SysAsset - ) as unknown as Refs[] // TS issue with filtered out types - return filtered.map(({ node }) => node.system) - }) - .flat() - }), -}) diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/uspGrid.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/uspGrid.ts index 6258f73cc..d3bc77468 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/uspGrid.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/uspGrid.ts @@ -2,11 +2,7 @@ import { z } from "zod" import { BlocksEnums } from "../../../../types/blocksEnum" import { UspGridEnum } from "../../../../types/uspGrid" -import { - linkRefsUnionSchema, - linkUnionSchema, - transformPageLink, -} from "../pageLinks" +import { linkUnionSchema, transformPageLink } from "../pageLinks" const uspCardSchema = z.object({ icon: UspGridEnum.uspIcons, @@ -53,39 +49,3 @@ export const uspGridSchema = z.object({ } }), }) - -export const uspGridRefsSchema = z.object({ - usp_grid: z - .object({ - cardsConnection: z.object({ - edges: z.array( - z.object({ - node: z.object({ - usp_card: z.array( - z.object({ - text: z.object({ - embedded_itemsConnection: z.object({ - edges: z.array( - z.object({ - node: linkRefsUnionSchema, - }) - ), - }), - }), - }) - ), - }), - }) - ), - }), - }) - .transform((data) => { - return data.cardsConnection.edges.flatMap(({ node }) => - node.usp_card.flatMap((card) => - card.text.embedded_itemsConnection.edges.map( - ({ node }) => node.system - ) - ) - ) - }), -}) diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/utils/linkConnection.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/utils/linkConnection.ts deleted file mode 100644 index 31a24a96b..000000000 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/utils/linkConnection.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { z } from "zod" - -import { linkRefsUnionSchema } from "../../pageLinks" - -export const linkConnectionRefsSchema = z - .object({ - linkConnection: z.object({ - edges: z.array( - z.object({ - node: linkRefsUnionSchema, - }) - ), - }), - }) - .transform((data) => { - if (!data.linkConnection.edges.length) { - return null - } - - return data.linkConnection.edges[0].node?.system - }) diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/video.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/video.ts index 3326a58e7..6f212a940 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/video.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/video.ts @@ -1,14 +1,9 @@ import { z } from "zod" import { BlocksEnums } from "../../../../types/blocksEnum" -import { transformedVideoSchema, videoRefSchema } from "../video" +import { transformedVideoSchema } from "../video" export const videoBlockSchema = z.object({ typename: z.literal(BlocksEnums.block.Video).default(BlocksEnums.block.Video), video: transformedVideoSchema, }) - -export const videoBlockRefsSchema = z.object({ - typename: z.literal(BlocksEnums.block.Video).default(BlocksEnums.block.Video), - video: videoRefSchema, -}) diff --git a/packages/trpc/lib/routers/contentstack/schemas/blocks/videoCard.ts b/packages/trpc/lib/routers/contentstack/schemas/blocks/videoCard.ts index ca881c1b3..624cb4ec0 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/blocks/videoCard.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/blocks/videoCard.ts @@ -3,8 +3,7 @@ import { z } from "zod" import { logger } from "@scandic-hotels/common/logger" import { BlocksEnums } from "../../../../types/blocksEnum" -import { systemSchema } from "../system" -import { transformedVideoSchema, videoRefSchema } from "../video" +import { transformedVideoSchema } from "../video" const cardStyleSchema = z .string() @@ -86,32 +85,3 @@ export const videoCardSchema = z.object({ } }), }) - -const videoCardRefSchema = z.object({ - video: videoRefSchema, - system: systemSchema, -}) - -export const videoCardRefsSchema = z.object({ - typename: z - .literal(BlocksEnums.block.VideoCard) - .default(BlocksEnums.block.VideoCard), - video_card: z - .object({ - video_cardConnection: z.object({ - edges: z.array( - z.object({ - node: videoCardRefSchema, - }) - ), - }), - }) - .transform((data) => { - const videoCard = data.video_cardConnection.edges[0]?.node - if (!videoCard?.video) { - return null - } - - return videoCard - }), -}) diff --git a/packages/trpc/lib/routers/contentstack/schemas/destinationFilters.ts b/packages/trpc/lib/routers/contentstack/schemas/destinationFilters.ts index ebd573e85..fe64ceed8 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/destinationFilters.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/destinationFilters.ts @@ -7,7 +7,6 @@ import { discriminatedUnionArray } from "../../../utils/discriminatedUnion" import { hotelFilterSchema } from "../../hotels/filters/output" import { accordionSchema } from "./blocks/accordion" import { contentSchema } from "./blocks/content" -import { systemSchema } from "./system" export const destinationFilterBlockContent = z .object({ @@ -50,22 +49,6 @@ export const transformedDestinationFiltersSchema = transformDestinationFiltersResponse(data) ) -export const destinationFiltersRefsSchema = z - .array( - z.object({ - filterConnection: z.object({ - edges: z.array( - z.object({ - node: z.object({ - system: systemSchema, - }), - }) - ), - }), - }) - ) - .nullish() - export function transformDestinationFiltersResponse( data: typeof destinationFiltersSchema._type ) { diff --git a/packages/trpc/lib/routers/contentstack/schemas/headers/dynamicContent.ts b/packages/trpc/lib/routers/contentstack/schemas/headers/dynamicContent.ts index e5e24eb13..c4782082b 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/headers/dynamicContent.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/headers/dynamicContent.ts @@ -5,7 +5,3 @@ import { DynamicContentEnum } from "../../../../types/dynamicContent" export const dynamicContentSchema = z.object({ component: z.enum(DynamicContentEnum.Headers.enums).nullish(), }) - -export const dynamicContentRefsSchema = z.object({ - component: z.enum(DynamicContentEnum.Headers.enums).nullish(), -}) diff --git a/packages/trpc/lib/routers/contentstack/schemas/linkConnection.ts b/packages/trpc/lib/routers/contentstack/schemas/linkConnection.ts index c7a975789..26535f381 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/linkConnection.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/linkConnection.ts @@ -2,12 +2,7 @@ import { z } from "zod" import { nullableStringValidator } from "@scandic-hotels/common/utils/zod/stringValidator" -import { - linkRefsUnionSchema, - linkUnionSchema, - transformPageLink, - transformPageLinkRef, -} from "./pageLinks" +import { linkUnionSchema, transformPageLink } from "./pageLinks" const titleSchema = z.object({ title: nullableStringValidator, @@ -45,28 +40,3 @@ export const linkAndTitleSchema = z.intersection( linkConnectionSchema, titleSchema ) - -export const linkConnectionRefs = z - .object({ - linkConnection: z.object({ - edges: z.array( - z.object({ - node: linkRefsUnionSchema, - }) - ), - }), - }) - .transform((data) => { - if (data.linkConnection.edges.length) { - const linkNode = data.linkConnection.edges[0].node - if (linkNode) { - const link = transformPageLinkRef(linkNode) - if (link) { - return { - link, - } - } - } - } - return { link: null } - }) diff --git a/packages/trpc/lib/routers/contentstack/schemas/pageLinks.ts b/packages/trpc/lib/routers/contentstack/schemas/pageLinks.ts index 77cb28283..8f61b5378 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/pageLinks.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/pageLinks.ts @@ -19,11 +19,6 @@ export const accountPageSchema = z }) .merge(pageLinkSchema) -export const accountPageRefSchema = z.object({ - __typename: z.literal(ContentEnum.blocks.AccountPage), - system: systemSchema.nullable(), -}) - export const extendedPageLinkSchema = pageLinkSchema.merge( z.object({ web: z @@ -40,121 +35,66 @@ export const campaignOverviewPageSchema = z }) .merge(extendedPageLinkSchema) -export const campaignOverviewPageRefSchema = z.object({ - __typename: z.literal(ContentEnum.blocks.CampaignOverviewPage), - system: systemSchema.nullable(), -}) - export const collectionPageSchema = z .object({ __typename: z.literal(ContentEnum.blocks.CollectionPage), }) .merge(extendedPageLinkSchema) -export const collectionPageRefSchema = z.object({ - __typename: z.literal(ContentEnum.blocks.CollectionPage), - system: systemSchema.nullable(), -}) - export const contentPageSchema = z .object({ __typename: z.literal(ContentEnum.blocks.ContentPage), }) .merge(extendedPageLinkSchema) -export const contentPageRefSchema = z.object({ - __typename: z.literal(ContentEnum.blocks.ContentPage), - system: systemSchema.nullable(), -}) - export const destinationCityPageSchema = z .object({ __typename: z.literal(ContentEnum.blocks.DestinationCityPage), }) .merge(pageLinkSchema) -export const destinationCityPageRefSchema = z.object({ - __typename: z.literal(ContentEnum.blocks.DestinationCityPage), - system: systemSchema.nullable(), -}) - export const campaignPageSchema = z .object({ __typename: z.literal(ContentEnum.blocks.CampaignPage), }) .merge(pageLinkSchema) -export const campaignPageRefSchema = z.object({ - __typename: z.literal(ContentEnum.blocks.CampaignPage), - system: systemSchema.nullable(), -}) - export const destinationCountryPageSchema = z .object({ __typename: z.literal(ContentEnum.blocks.DestinationCountryPage), }) .merge(pageLinkSchema) -export const destinationCountryPageRefSchema = z.object({ - __typename: z.literal(ContentEnum.blocks.DestinationCountryPage), - system: systemSchema.nullable(), -}) - export const destinationOverviewPageSchema = z .object({ __typename: z.literal(ContentEnum.blocks.DestinationOverviewPage), }) .merge(pageLinkSchema) -export const destinationOverviewPageRefSchema = z.object({ - __typename: z.literal(ContentEnum.blocks.DestinationOverviewPage), - system: systemSchema.nullable(), -}) - export const hotelPageSchema = z .object({ __typename: z.literal(ContentEnum.blocks.HotelPage), }) .merge(pageLinkSchema) -export const hotelPageRefSchema = z.object({ - __typename: z.literal(ContentEnum.blocks.HotelPage), - system: systemSchema.nullable(), -}) - export const loyaltyPageSchema = z .object({ __typename: z.literal(ContentEnum.blocks.LoyaltyPage), }) .merge(extendedPageLinkSchema) -export const loyaltyPageRefSchema = z.object({ - __typename: z.literal(ContentEnum.blocks.LoyaltyPage), - system: systemSchema.nullable(), -}) - export const startPageSchema = z .object({ __typename: z.literal(ContentEnum.blocks.StartPage), }) .merge(pageLinkSchema) -export const startPageRefSchema = z.object({ - __typename: z.literal(ContentEnum.blocks.StartPage), - system: systemSchema.nullable(), -}) - export const promoCampaignPageSchema = z .object({ __typename: z.literal(ContentEnum.blocks.PromoCampaignPage), }) .merge(pageLinkSchema) -export const promoCampaignPageRefSchema = z.object({ - __typename: z.literal(ContentEnum.blocks.PromoCampaignPage), - system: systemSchema.nullable(), -}) - export const rawLinkUnionSchema = z.discriminatedUnion("__typename", [ accountPageSchema, campaignOverviewPageSchema, @@ -263,55 +203,3 @@ export const internalOrExternalLinkSchema = z } } ) - -export const rawLinkRefsUnionSchema = z.discriminatedUnion("__typename", [ - accountPageRefSchema, - campaignOverviewPageRefSchema, - campaignPageRefSchema, - collectionPageRefSchema, - contentPageRefSchema, - destinationCityPageRefSchema, - destinationCountryPageRefSchema, - destinationOverviewPageRefSchema, - hotelPageRefSchema, - loyaltyPageRefSchema, - startPageRefSchema, - promoCampaignPageRefSchema, -]) - -export const linkRefsUnionSchema = safeUnion(rawLinkRefsUnionSchema) - -type RefData = - | z.output - | z.output - | z.output - | z.output - | z.output - | z.output - | z.output - | z.output - | z.output - | z.output - | z.output - | z.output - | Object - -export function transformPageLinkRef(data: RefData) { - if (data && "__typename" in data) { - switch (data.__typename) { - case ContentEnum.blocks.AccountPage: - case ContentEnum.blocks.CampaignOverviewPage: - case ContentEnum.blocks.CampaignPage: - case ContentEnum.blocks.CollectionPage: - case ContentEnum.blocks.ContentPage: - case ContentEnum.blocks.DestinationCityPage: - case ContentEnum.blocks.DestinationCountryPage: - case ContentEnum.blocks.DestinationOverviewPage: - case ContentEnum.blocks.HotelPage: - case ContentEnum.blocks.LoyaltyPage: - case ContentEnum.blocks.StartPage: - case ContentEnum.blocks.PromoCampaignPage: - return data.system - } - } -} diff --git a/packages/trpc/lib/routers/contentstack/schemas/sidebar/content.ts b/packages/trpc/lib/routers/contentstack/schemas/sidebar/content.ts index 1e1b770c0..a470ec3d0 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/sidebar/content.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/sidebar/content.ts @@ -1,17 +1,9 @@ import { z } from "zod" -import { ContentEnum } from "../../../../types/content" import { SidebarEnums } from "../../../../types/sidebar" -import { - imageContainerRefsSchema, - imageContainerSchema, -} from "../blocks/imageContainer" -import { sysAssetRefsSchema, sysAssetSchema } from "../blocks/sysAsset" -import { - rawLinkRefsUnionSchema, - rawLinkUnionSchema, - transformPageLink, -} from "../pageLinks" +import { imageContainerSchema } from "../blocks/imageContainer" +import { sysAssetSchema } from "../blocks/sysAsset" +import { rawLinkUnionSchema, transformPageLink } from "../pageLinks" export const contentSchema = z.object({ typename: z @@ -50,40 +42,3 @@ export const contentSchema = z.object({ } }), }) - -const actualRefs = z.discriminatedUnion("__typename", [ - imageContainerRefsSchema, - ...rawLinkRefsUnionSchema.options, -]) - -export const contentRefsSchema = z.object({ - content: z - .object({ - content: z.object({ - embedded_itemsConnection: z.object({ - edges: z.array( - z.object({ - node: z.discriminatedUnion("__typename", [ - sysAssetRefsSchema, - ...actualRefs.options, - ]), - }) - ), - }), - }), - }) - .transform((data) => { - return data?.content?.embedded_itemsConnection.edges - .map(({ node }) => { - switch (node.__typename) { - case ContentEnum.blocks.SysAsset: - return node.system && (node.permanent_url || node.url) - ? { system: node.system, url: node.permanent_url || node.url } - : null - default: - return node.system - } - }) - .filter((node) => !!node) - }), -}) diff --git a/packages/trpc/lib/routers/contentstack/schemas/sidebar/joinLoyaltyContact.ts b/packages/trpc/lib/routers/contentstack/schemas/sidebar/joinLoyaltyContact.ts index 39c28197a..5cd4f7de1 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/sidebar/joinLoyaltyContact.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/sidebar/joinLoyaltyContact.ts @@ -3,7 +3,6 @@ import { z } from "zod" import { JoinLoyaltyContactEnums } from "../../../../types/joinLoyaltyContact" import { SidebarEnums } from "../../../../types/sidebar" import { buttonSchema } from "../blocks/utils/buttonLinkSchema" -import { linkConnectionRefsSchema } from "../blocks/utils/linkConnection" export const contactSchema = z.object({ contact: z.array( @@ -49,9 +48,3 @@ export const joinLoyaltyContactSchema = z.object({ }) .merge(contactSchema), }) - -export const joinLoyaltyContactRefsSchema = z.object({ - join_loyalty_contact: z.object({ - button: linkConnectionRefsSchema, - }), -}) diff --git a/packages/trpc/lib/routers/contentstack/schemas/sidebar/quickLinks.ts b/packages/trpc/lib/routers/contentstack/schemas/sidebar/quickLinks.ts index b45c4cc86..e0f0063f7 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/sidebar/quickLinks.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/sidebar/quickLinks.ts @@ -1,7 +1,7 @@ import { z } from "zod" import { SidebarEnums } from "../../../../types/sidebar" -import { shortcutsBlockSchema, shortcutsRefsSchema } from "../blocks/shortcuts" +import { shortcutsBlockSchema } from "../blocks/shortcuts" export const quickLinksSchema = z .object({ @@ -11,5 +11,3 @@ export const quickLinksSchema = z .default(SidebarEnums.blocks.QuickLinks), }) .merge(shortcutsBlockSchema) - -export const quickLinksRefschema = shortcutsRefsSchema diff --git a/packages/trpc/lib/routers/contentstack/schemas/sidebar/scriptedCard.ts b/packages/trpc/lib/routers/contentstack/schemas/sidebar/scriptedCard.ts index ddf53c8a2..13cf01218 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/sidebar/scriptedCard.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/sidebar/scriptedCard.ts @@ -4,9 +4,7 @@ import { scriptedCardThemeEnum } from "../../../../enums/scriptedCard" import { SidebarEnums } from "../../../../types/sidebar" import { getInfoCardThemeFromDeprecatedCardTheme, - infoCardBlockRefsSchema, infoCardBlockSchema, - transformCardBlockRefs, transformInfoCardBlock, } from "../blocks/cardsGrid" @@ -41,25 +39,3 @@ export const scriptedCardsSchema = z.object({ } }), }) - -export const scriptedCardRefschema = z.object({ - scripted_card: z - .object({ - scripted_cardConnection: z.object({ - edges: z.array( - z.object({ - node: infoCardBlockRefsSchema, - }) - ), - }), - }) - .transform((data) => { - let card = null - if (data.scripted_cardConnection.edges.length) { - card = transformCardBlockRefs( - data.scripted_cardConnection.edges[0].node - ) - } - return card - }), -}) diff --git a/packages/trpc/lib/routers/contentstack/schemas/sidebar/teaserCard.ts b/packages/trpc/lib/routers/contentstack/schemas/sidebar/teaserCard.ts index ba5b48143..96524bb36 100644 --- a/packages/trpc/lib/routers/contentstack/schemas/sidebar/teaserCard.ts +++ b/packages/trpc/lib/routers/contentstack/schemas/sidebar/teaserCard.ts @@ -2,11 +2,9 @@ import { z } from "zod" import { SidebarEnums } from "../../../../types/sidebar" import { - teaserCardBlockRefsSchema, teaserCardBlockSchema, transformTeaserCardBlock, } from "../blocks/cards/teaserCard" -import { transformCardBlockRefs } from "../blocks/cardsGrid" export const teaserCardsSchema = z.object({ typename: z @@ -36,23 +34,3 @@ export const teaserCardsSchema = z.object({ } }), }) - -export const teaserCardRefschema = z.object({ - teaser_card: z - .object({ - teaser_cardConnection: z.object({ - edges: z.array( - z.object({ - node: teaserCardBlockRefsSchema, - }) - ), - }), - }) - .transform((data) => { - let card = null - if (data.teaser_cardConnection.edges.length) { - card = transformCardBlockRefs(data.teaser_cardConnection.edges[0].node) - } - return card - }), -}) diff --git a/packages/trpc/lib/routers/contentstack/startPage/output.ts b/packages/trpc/lib/routers/contentstack/startPage/output.ts index 7c3b125d6..94bd523e9 100644 --- a/packages/trpc/lib/routers/contentstack/startPage/output.ts +++ b/packages/trpc/lib/routers/contentstack/startPage/output.ts @@ -3,26 +3,11 @@ import { z } from "zod" import { transformedImageVaultAssetSchema } from "@scandic-hotels/common/utils/imageVault" import { discriminatedUnionArray } from "../../../utils/discriminatedUnion" -import { - cardGridRefsSchema, - cardsGridSchema, -} from "../schemas/blocks/cardsGrid" -import { - carouselCardsRefsSchema, - carouselCardsSchema, -} from "../schemas/blocks/carouselCards" -import { - fullWidthCampaignBlockRefsSchema, - fullWidthCampaignBlockSchema, -} from "../schemas/blocks/fullWidthCampaign" -import { - joinScandicFriendsBlockRefsSchema, - joinScandicFriendsBlockSchema, -} from "../schemas/blocks/joinScandicFriends" -import { - videoCardRefsSchema, - videoCardSchema, -} from "../schemas/blocks/videoCard" +import { cardsGridSchema } from "../schemas/blocks/cardsGrid" +import { carouselCardsSchema } from "../schemas/blocks/carouselCards" +import { fullWidthCampaignBlockSchema } from "../schemas/blocks/fullWidthCampaign" +import { joinScandicFriendsBlockSchema } from "../schemas/blocks/joinScandicFriends" +import { videoCardSchema } from "../schemas/blocks/videoCard" import { systemSchema } from "../schemas/system" import { StartPageEnum } from "./utils" @@ -85,49 +70,3 @@ export const startPageSchema = z.object({ url: z.string(), }), }) - -/** REFS */ -const startPageCardsRefs = z - .object({ - __typename: z.literal(StartPageEnum.ContentStack.blocks.CardsGrid), - }) - .merge(cardGridRefsSchema) - -const startPageFullWidthCampaignRef = z - .object({ - __typename: z.literal(StartPageEnum.ContentStack.blocks.FullWidthCampaign), - }) - .merge(fullWidthCampaignBlockRefsSchema) - -const startPageCarouselCardsRef = z - .object({ - __typename: z.literal(StartPageEnum.ContentStack.blocks.CarouselCards), - }) - .merge(carouselCardsRefsSchema) - -const startPageJoinScandicFriendsRef = z - .object({ - __typename: z.literal(StartPageEnum.ContentStack.blocks.JoinScandicFriends), - }) - .merge(joinScandicFriendsBlockRefsSchema) - -const startPageVideoCardRef = z - .object({ - __typename: z.literal(StartPageEnum.ContentStack.blocks.VideoCard), - }) - .merge(videoCardRefsSchema) - -const startPageBlockRefsItem = z.discriminatedUnion("__typename", [ - startPageCardsRefs, - startPageFullWidthCampaignRef, - startPageCarouselCardsRef, - startPageJoinScandicFriendsRef, - startPageVideoCardRef, -]) - -export const startPageRefsSchema = z.object({ - start_page: z.object({ - blocks: discriminatedUnionArray(startPageBlockRefsItem.options).nullable(), - system: systemSchema, - }), -}) diff --git a/packages/trpc/lib/routers/contentstack/startPage/query.ts b/packages/trpc/lib/routers/contentstack/startPage/query.ts index f9123fa74..1da751829 100644 --- a/packages/trpc/lib/routers/contentstack/startPage/query.ts +++ b/packages/trpc/lib/routers/contentstack/startPage/query.ts @@ -2,20 +2,11 @@ import { createCounter } from "@scandic-hotels/common/telemetry" import { router } from "../../.." import { notFoundError } from "../../../errors" -import { - GetStartPage, - GetStartPageRefs, -} from "../../../graphql/Query/StartPage/StartPage.graphql" +import { GetStartPage } from "../../../graphql/Query/StartPage/StartPage.graphql" import { request } from "../../../graphql/request" import { contentstackExtendedProcedureUID } from "../../../procedures" -import { - generateRefsResponseTag, - generateTag, - generateTagsFromAssetSystem, - generateTagsFromSystem, -} from "../../../utils/generateTag" -import { startPageRefsSchema, startPageSchema } from "./output" -import { getConnections } from "./utils" +import { generateTag } from "../../../utils/generateTag" +import { startPageSchema } from "./output" import type { z } from "zod" @@ -25,66 +16,19 @@ import type { blocksSchema } from "./output" export interface GetStartPageData extends z.input {} export interface StartPage extends z.output {} -export interface GetStartPageRefsSchema extends z.input< - typeof startPageRefsSchema -> {} - export type Block = z.output export const startPageQueryRouter = router({ get: contentstackExtendedProcedureUID.query(async ({ ctx }) => { const { lang, uid } = ctx - const getStartPageRefsCounter = createCounter( - "trpc.contentstack.startPage.get.refs" - ) - const metricsGetStartPageRefs = getStartPageRefsCounter.init({ lang, uid }) - - metricsGetStartPageRefs.start() - - const refsResponse = await request( - GetStartPageRefs, - { - locale: lang, - uid, - }, - { - key: generateRefsResponseTag(lang, uid), - ttl: "max", - } - ) - if (!refsResponse.data) { - metricsGetStartPageRefs.noDataError() - throw notFoundError({ - message: "StartPage refs returned no data", - errorDetails: { lang, uid }, - }) - } - - const validatedRefsData = startPageRefsSchema.safeParse(refsResponse.data) - - if (!validatedRefsData.success) { - metricsGetStartPageRefs.validationError(validatedRefsData.error) - return null - } - - metricsGetStartPageRefs.success() + const cacheKey = generateTag(lang, uid) const getStartPageCounter = createCounter("trpc.contentstack.startPage.get") const metricsGetStartPage = getStartPageCounter.init({ lang, uid }) metricsGetStartPage.start() - const { connections, assetConnections } = getConnections( - validatedRefsData.data - ) - - const tags = [ - generateTagsFromSystem(lang, connections), - generateTagsFromAssetSystem(assetConnections), - generateTag(lang, validatedRefsData.data.start_page.system.uid), - ].flat() - const response = await request( GetStartPage, { @@ -92,7 +36,7 @@ export const startPageQueryRouter = router({ uid, }, { - key: tags, + key: `${cacheKey}`, ttl: "max", } ) diff --git a/packages/trpc/lib/routers/contentstack/startPage/utils.ts b/packages/trpc/lib/routers/contentstack/startPage/utils.ts index e2fb577a0..d68c8dcf4 100644 --- a/packages/trpc/lib/routers/contentstack/startPage/utils.ts +++ b/packages/trpc/lib/routers/contentstack/startPage/utils.ts @@ -1,8 +1,3 @@ -import type { z } from "zod" - -import type { AssetSystem, System } from "../schemas/system" -import type { startPageRefsSchema } from "./output" - export namespace StartPageEnum { export namespace ContentStack { export const enum blocks { @@ -14,60 +9,3 @@ export namespace StartPageEnum { } } } - -export interface StartPageRefs extends z.output {} - -export function getConnections({ start_page }: StartPageRefs) { - const connections: System["system"][] = [start_page.system] - const assetConnections: AssetSystem[] = [] - - if (start_page.blocks) { - start_page.blocks.forEach((block) => { - const typeName = block.__typename - switch (typeName) { - case StartPageEnum.ContentStack.blocks.FullWidthCampaign: - block.full_width_campaign.full_width_campaignConnection.edges.forEach( - ({ node }) => { - if (node.system) { - connections.push(node.system) - } - } - ) - break - case StartPageEnum.ContentStack.blocks.CardsGrid: - block.cards_grid.forEach((card) => { - connections.push(card) - }) - break - case StartPageEnum.ContentStack.blocks.CarouselCards: - block.carousel_cards.card_groups.forEach((group) => { - group.cardConnection.edges.forEach((node) => { - connections.push(node.node.system) - }) - }) - break - case StartPageEnum.ContentStack.blocks.JoinScandicFriends: - if (block.join_scandic_friends.primary_button) { - connections.push(block.join_scandic_friends.primary_button) - } - break - case StartPageEnum.ContentStack.blocks.VideoCard: { - if (block.video_card?.system) { - connections.push(block.video_card.system) - } - if (block.video_card?.video.sourceConnection.edges[0]) { - assetConnections.push( - block.video_card.video.sourceConnection.edges[0].node - ) - } - break - } - default: - const _exhaustiveCheck: never = typeName - break - } - }) - } - - return { connections, assetConnections } -} diff --git a/packages/trpc/lib/types/accountPage.ts b/packages/trpc/lib/types/accountPage.ts index b6461ab57..f47bb0255 100644 --- a/packages/trpc/lib/types/accountPage.ts +++ b/packages/trpc/lib/types/accountPage.ts @@ -1,19 +1,13 @@ import type { z } from "zod" import type { - accountPageRefsSchema, accountPageSchema, blocksSchema, } from "../routers/contentstack/accountPage/output" -export interface GetAccountPageRefsSchema - extends z.input {} - -export interface AccountPageRefs - extends z.output {} - -export interface GetAccountPageSchema - extends z.input {} +export interface GetAccountPageSchema extends z.input< + typeof accountPageSchema +> {} export interface AccountPage extends z.output {} diff --git a/packages/trpc/lib/types/breadcrumbs.ts b/packages/trpc/lib/types/breadcrumbs.ts index 31f5b949c..b85abd0d3 100644 --- a/packages/trpc/lib/types/breadcrumbs.ts +++ b/packages/trpc/lib/types/breadcrumbs.ts @@ -1,15 +1,12 @@ import type { z } from "zod" import type { - breadcrumbsRefsSchema, breadcrumbsSchema, rawBreadcrumbsDataSchema, } from "../routers/contentstack/breadcrumbs/output" -export interface BreadcrumbsRefsSchema - extends z.input {} - -export interface RawBreadcrumbsSchema - extends z.input {} +export interface RawBreadcrumbsSchema extends z.input< + typeof rawBreadcrumbsDataSchema +> {} export interface Breadcrumbs extends z.output {} diff --git a/packages/trpc/lib/types/campaignOverviewPage.ts b/packages/trpc/lib/types/campaignOverviewPage.ts index 8ac996b8a..cc3a35474 100644 --- a/packages/trpc/lib/types/campaignOverviewPage.ts +++ b/packages/trpc/lib/types/campaignOverviewPage.ts @@ -1,7 +1,6 @@ import type { z } from "zod" import type { - campaignOverviewPageRefsSchema, campaignOverviewPageSchema, transformedTopCampaign, transformedTopPromoCampaign, @@ -18,12 +17,5 @@ export type CampaignOverviewPageData = export type TopCampaign = z.output export type TopPromoCampaign = z.output -export interface GetCampaignOverviewPageRefsData extends z.input< - typeof campaignOverviewPageRefsSchema -> {} - -export interface CampaignOverviewPageRefs extends z.output< - typeof campaignOverviewPageRefsSchema -> {} export type Block = CampaignOverviewPageData["blocks"][number] diff --git a/packages/trpc/lib/types/campaignPage.ts b/packages/trpc/lib/types/campaignPage.ts index fde238038..99a57bd3a 100644 --- a/packages/trpc/lib/types/campaignPage.ts +++ b/packages/trpc/lib/types/campaignPage.ts @@ -1,8 +1,6 @@ import type { z } from "zod" import type { - campaignPageRefsSchema, - campaignPagesByHotelUidRefsSchema, campaignPagesByHotelUidSchema, campaignPageSchema, heroSchema, @@ -21,29 +19,25 @@ export namespace CampaignPageEnum { } } -export interface GetCampaignPageData - extends z.input {} +export interface GetCampaignPageData extends z.input< + typeof campaignPageSchema +> {} export interface CampaignPage extends z.output {} export type CampaignPageData = CampaignPage["campaign_page"] -export interface GetCampaignPageRefsData - extends z.input {} - -export interface CampaignPageRefs - extends z.output {} - export type Block = CampaignPageData["blocks"][number] -export interface CarouselCardsBlock - extends z.output {} +export interface CarouselCardsBlock extends z.output< + typeof carouselCardsSchema +> {} export type EssentialsBlock = z.output["essentials"] export type Hero = z.output -export interface GetCampaignPagesByHotelUidData - extends z.input {} -export interface GetCampaignPagesByHotelUidRefsData - extends z.input {} +export interface GetCampaignPagesByHotelUidData extends z.input< + typeof campaignPagesByHotelUidSchema +> {} -export interface Campaigns - extends z.output {} +export interface Campaigns extends z.output< + typeof campaignPagesByHotelUidSchema +> {} diff --git a/packages/trpc/lib/types/collectionPage.ts b/packages/trpc/lib/types/collectionPage.ts index 9ed8dc040..2adfcc4b2 100644 --- a/packages/trpc/lib/types/collectionPage.ts +++ b/packages/trpc/lib/types/collectionPage.ts @@ -2,18 +2,9 @@ import type { z } from "zod" import type { blocksSchema, - collectionPageRefsSchema, collectionPageSchema, } from "../routers/contentstack/collectionPage/output" -export interface GetCollectionPageRefsSchema extends z.input< - typeof collectionPageRefsSchema -> {} - -export interface CollectionPageRefs extends z.output< - typeof collectionPageRefsSchema -> {} - export interface GetCollectionPageSchema extends z.input< typeof collectionPageSchema > {} diff --git a/packages/trpc/lib/types/contentPage.ts b/packages/trpc/lib/types/contentPage.ts index 87829febc..767a2c7c5 100644 --- a/packages/trpc/lib/types/contentPage.ts +++ b/packages/trpc/lib/types/contentPage.ts @@ -2,19 +2,10 @@ import type { z } from "zod" import type { blocksSchema, - contentPageRefsSchema, contentPageSchema, sidebarSchema, } from "../routers/contentstack/contentPage/output" -export interface GetContentPageRefsSchema extends z.input< - typeof contentPageRefsSchema -> {} - -export interface ContentPageRefs extends z.output< - typeof contentPageRefsSchema -> {} - export interface GetContentPageSchema extends z.input< typeof contentPageSchema > {} diff --git a/packages/trpc/lib/types/destinationCityPage.ts b/packages/trpc/lib/types/destinationCityPage.ts index 0f032394a..59bcf4324 100644 --- a/packages/trpc/lib/types/destinationCityPage.ts +++ b/packages/trpc/lib/types/destinationCityPage.ts @@ -5,7 +5,6 @@ import type { cityPageCountSchema, cityPageUrlsSchema, destinationCityListDataSchema, - destinationCityPageRefsSchema, destinationCityPageSchema, } from "../routers/contentstack/destinationCityPage/output" @@ -18,22 +17,28 @@ export namespace DestinationCityPageEnum { } } -export interface GetDestinationCityPageData - extends z.input {} -export interface DestinationCityPage - extends z.output {} +export interface GetDestinationCityPageData extends z.input< + typeof destinationCityPageSchema +> {} +export interface DestinationCityPage extends z.output< + typeof destinationCityPageSchema +> {} export type DestinationCityPageData = DestinationCityPage["destination_city_page"] -export interface GetDestinationCityListDataResponse - extends z.input {} +export interface GetDestinationCityListDataResponse extends z.input< + typeof destinationCityListDataSchema +> {} -export interface DestinationCityListData - extends z.output {} -export interface GetCityPageCountData - extends z.input {} -export interface GetCityPageUrlsData - extends z.input {} +export interface DestinationCityListData extends z.output< + typeof destinationCityListDataSchema +> {} +export interface GetCityPageCountData extends z.input< + typeof cityPageCountSchema +> {} +export interface GetCityPageUrlsData extends z.input< + typeof cityPageUrlsSchema +> {} export interface CityPageUrlsData extends z.output {} @@ -43,9 +48,3 @@ export interface DestinationCityListItem extends DestinationCityListData { hotelsCount?: number } export type Block = z.output - -export interface GetDestinationCityPageRefsSchema - extends z.input {} - -export interface DestinationCityPageRefs - extends z.output {} diff --git a/packages/trpc/lib/types/destinationCountryPage.ts b/packages/trpc/lib/types/destinationCountryPage.ts index 75e812854..46bdbbc94 100644 --- a/packages/trpc/lib/types/destinationCountryPage.ts +++ b/packages/trpc/lib/types/destinationCountryPage.ts @@ -3,7 +3,6 @@ import type { z } from "zod" import type { blocksSchema, countryPageUrlsSchema, - destinationCountryPageRefsSchema, destinationCountryPageSchema, } from "../routers/contentstack/destinationCountryPage/output" @@ -16,19 +15,16 @@ export namespace DestinationCountryPageEnum { } } -export interface GetDestinationCountryPageData - extends z.input {} -interface DestinationCountryPage - extends z.output {} +export interface GetDestinationCountryPageData extends z.input< + typeof destinationCountryPageSchema +> {} +interface DestinationCountryPage extends z.output< + typeof destinationCountryPageSchema +> {} export type DestinationCountryPageData = DestinationCountryPage["destination_country_page"] export type Block = z.output -export interface GetDestinationCountryPageRefsSchema - extends z.input {} - -export interface DestinationCountryPageRefs - extends z.output {} - -export interface GetCountryPageUrlsData - extends z.input {} +export interface GetCountryPageUrlsData extends z.input< + typeof countryPageUrlsSchema +> {} diff --git a/packages/trpc/lib/types/destinationOverviewPage.ts b/packages/trpc/lib/types/destinationOverviewPage.ts index d26382366..5f2e21034 100644 --- a/packages/trpc/lib/types/destinationOverviewPage.ts +++ b/packages/trpc/lib/types/destinationOverviewPage.ts @@ -2,7 +2,6 @@ import type { z } from "zod" import type { blocksSchema, - destinationOverviewPageRefsSchema, destinationOverviewPageSchema, } from "../routers/contentstack/destinationOverviewPage/output" @@ -14,15 +13,11 @@ export namespace DestinationOverviewPageEnum { } } -export interface GetDestinationOverviewPageData - extends z.input {} -export interface DestinationOverviewPage - extends z.output {} - -export interface GetDestinationOverviewPageRefsSchema - extends z.input {} - -export interface DestinationOverviewPageRefs - extends z.output {} +export interface GetDestinationOverviewPageData extends z.input< + typeof destinationOverviewPageSchema +> {} +export interface DestinationOverviewPage extends z.output< + typeof destinationOverviewPageSchema +> {} export type Block = z.output diff --git a/packages/trpc/lib/types/footer.ts b/packages/trpc/lib/types/footer.ts index 93a85052c..61d02b951 100644 --- a/packages/trpc/lib/types/footer.ts +++ b/packages/trpc/lib/types/footer.ts @@ -2,10 +2,8 @@ import type { z } from "zod" import type { validateFooterConfigSchema, - validateFooterRefConfigSchema, validateLinkItem, } from "../routers/contentstack/base/output" -export type FooterRefDataRaw = z.infer export type FooterDataRaw = z.infer export type FooterLinkItem = z.infer diff --git a/packages/trpc/lib/types/header.ts b/packages/trpc/lib/types/header.ts index 30a1e5c9d..13aafee3c 100644 --- a/packages/trpc/lib/types/header.ts +++ b/packages/trpc/lib/types/header.ts @@ -1,14 +1,10 @@ import type { z } from "zod" import type { - headerRefsSchema, headerSchema, menuItemSchema, } from "../routers/contentstack/base/output" -export type GetHeaderRefs = z.input -export type HeaderRefs = NonNullable> - export type GetHeader = z.input export type Header = z.output diff --git a/packages/trpc/lib/types/hotelPage.ts b/packages/trpc/lib/types/hotelPage.ts index 09455f908..62da9490e 100644 --- a/packages/trpc/lib/types/hotelPage.ts +++ b/packages/trpc/lib/types/hotelPage.ts @@ -3,7 +3,6 @@ import type { z } from "zod" import type { contentBlock, hotelPageCountSchema, - hotelPageRefsSchema, hotelPageSchema, hotelPageUrlsSchema, } from "../routers/contentstack/hotelPage/output" @@ -20,14 +19,12 @@ export type ActivityCard = ActivitiesCard["upcoming_activities_card"] export interface SpaPage extends z.output {} export type ContentBlock = z.output -export interface GetHotelPageRefsSchema - extends z.input {} - -export interface HotelPageRefs extends z.output {} -export interface GetHotelPageUrlsData - extends z.input {} -export interface GetHotelPageCountData - extends z.input {} +export interface GetHotelPageUrlsData extends z.input< + typeof hotelPageUrlsSchema +> {} +export interface GetHotelPageCountData extends z.input< + typeof hotelPageCountSchema +> {} export type HotelPageUrls = z.output export type HotelPageData = HotelPage["hotel_page"] & { diff --git a/packages/trpc/lib/types/loyaltyPage.ts b/packages/trpc/lib/types/loyaltyPage.ts index 1b196e559..543043d86 100644 --- a/packages/trpc/lib/types/loyaltyPage.ts +++ b/packages/trpc/lib/types/loyaltyPage.ts @@ -2,19 +2,13 @@ import type { z } from "zod" import type { blocksSchema, - loyaltyPageRefsSchema, loyaltyPageSchema, sidebarSchema, } from "../routers/contentstack/loyaltyPage/output" -export interface GetLoyaltyPageRefsSchema - extends z.input {} - -export interface LoyaltyPageRefs - extends z.output {} - -export interface GetLoyaltyPageSchema - extends z.input {} +export interface GetLoyaltyPageSchema extends z.input< + typeof loyaltyPageSchema +> {} export interface LoyaltyPage extends z.output {} diff --git a/packages/trpc/lib/types/promoCampaignPage.ts b/packages/trpc/lib/types/promoCampaignPage.ts index fa43bb7d7..cc9768b36 100644 --- a/packages/trpc/lib/types/promoCampaignPage.ts +++ b/packages/trpc/lib/types/promoCampaignPage.ts @@ -2,7 +2,6 @@ import type { z } from "zod" import type { blocksSchema, - promoCampaignPageRefsSchema, promoCampaignPageSchema, } from "../routers/contentstack/promoCampaignPage/output" @@ -17,20 +16,15 @@ export namespace PromoCampaignPageEnum { export type Block = z.output -export interface GetPromoCampaignPageData - extends z.input {} +export interface GetPromoCampaignPageData extends z.input< + typeof promoCampaignPageSchema +> {} -export interface PromoCampaignPage - extends z.output {} +export interface PromoCampaignPage extends z.output< + typeof promoCampaignPageSchema +> {} export type PromoCampaignPageData = PromoCampaignPage["promo_campaign_page"] export type PromoHero = NonNullable export type PromoCode = NonNullable - -/* REFS */ -export interface GetPromoCampaignPageRefsData - extends z.input {} - -export interface PromoCampaignPageRefs - extends z.output {} diff --git a/packages/trpc/lib/types/reward.ts b/packages/trpc/lib/types/reward.ts index 208c00d49..cd35ca4c8 100644 --- a/packages/trpc/lib/types/reward.ts +++ b/packages/trpc/lib/types/reward.ts @@ -6,7 +6,6 @@ import type { CouponReward, REDEEM_LOCATIONS, REWARD_TYPES, - rewardRefsSchema, validateCmsRewardsSchema, } from "../routers/contentstack/reward/output" @@ -17,7 +16,6 @@ export type { CMSRewardsResponse, Coupon, CouponReward, - GetRewardRefsSchema, RedeemableCoupon, RedeemLocation, RewardType, @@ -27,8 +25,6 @@ export type { type CMSRewardsResponse = z.input type CMSReward = z.output[number] -type GetRewardRefsSchema = z.input - type RedeemLocation = (typeof REDEEM_LOCATIONS)[number] type RewardType = (typeof REWARD_TYPES)[keyof typeof REWARD_TYPES] diff --git a/packages/trpc/lib/types/siteConfig.ts b/packages/trpc/lib/types/siteConfig.ts index 49e5838ec..acc843166 100644 --- a/packages/trpc/lib/types/siteConfig.ts +++ b/packages/trpc/lib/types/siteConfig.ts @@ -2,14 +2,10 @@ import type { z } from "zod" import type { alertSchema, - siteConfigRefSchema, siteConfigSchema, - sitewideCampaignBannerRefSchema, sitewideCampaignBannerSchema, } from "../routers/contentstack/base/output" -export type GetSiteConfigRefData = z.infer - export type GetSiteConfigData = z.input export type SiteConfig = z.output @@ -26,9 +22,6 @@ export type Alert = Omit & { phoneContact: AlertPhoneContact | null } -export type GetSitewideCampaignBannerRefData = z.infer< - typeof sitewideCampaignBannerRefSchema -> export type GetSitewideCampaignBannerData = z.output< typeof sitewideCampaignBannerSchema > diff --git a/packages/trpc/lib/utils/generateTag.ts b/packages/trpc/lib/utils/generateTag.ts index fcdd9791b..f7f6af6c9 100644 --- a/packages/trpc/lib/utils/generateTag.ts +++ b/packages/trpc/lib/utils/generateTag.ts @@ -4,45 +4,6 @@ import type { AssetSystem, System, } from "../routers/contentstack/schemas/system" -import type { Edges } from "../types/edges" -import type { NodeRefs } from "../types/refs" - -/** - * Function to generate tag for initial refs request - * - * @param lang Lang - * @param identifier Should be uid for all pages and content_type_uid for - * everything else - * @param affix possible extra value to add to string, e.g lang:identifier:breadcrumbs:refs - * as it is the same entity as the actual page tag otherwise - * @returns string - */ -export function generateRefsResponseTag( - lang: Lang, - identifier: string, - affix?: string -) { - if (affix) { - return `${lang}:${identifier}:${affix}:refs` - } - return `${lang}:${identifier}:refs` -} - -/** - * Function to generate all tags to references on entity - * - * @param lang Lang - * @param contentTypeUid content_type_uid of reference - * @param uid system.uid of reference - * @returns string - */ -export function generateRefTag( - lang: Lang, - contentTypeUid: string, - uid: string -) { - return `${lang}:ref:${contentTypeUid}:${uid}` -} /** * Function to generate tag for entity being requested @@ -61,20 +22,6 @@ export function generateTag(lang: Lang, uid: string, affix?: string | null) { return `${lang}:${uid}` } -export function generateTags(lang: Lang, connections: Edges[]) { - return connections - .map((connection) => { - return connection.edges.map(({ node }) => { - return generateRefTag( - lang, - node.system.content_type_uid, - node.system.uid - ) - }) - }) - .flat() -} - export function generateTagsFromSystem( lang: Lang, connections: System["system"][]