Merged in chore/cleanup-unused (pull request #3461)

chore: Cleanup unused vars, exports, types

* Cleanup some unused exports

* Remove more

* Readd CampaignPageIncludedHotelsRef

* Add alias comment to procedure exports

* Remove unused exports


Approved-by: Linus Flood
This commit is contained in:
Anton Gunnarsson
2026-01-22 12:34:07 +00:00
parent 4de24e9f2a
commit f79ff9b570
56 changed files with 84 additions and 411 deletions

View File

@@ -1,6 +1,4 @@
import type { Lang } from "@scandic-hotels/common/constants/language"
import type { EmbedTypesEnum, RTEItemType, RTEItemTypeEnum } from "./enums"
import type { RTEItemType } from "./enums"
export interface Attributes {
[key: string]: unknown
@@ -9,47 +7,7 @@ export interface Attributes {
style?: { [key: string]: unknown } | undefined
}
export interface RTEAssetAttrs extends Attributes {
alt: string
"asset-alt": string
"asset-link": string
"asset-name": string
"asset-type": "image/png" | "image/jpg" | "image/jpeg"
"asset-uid": string
"display-type": EmbedTypesEnum.display
"content-type-uid": "sys_assets"
inline: false
type: RTEItemTypeEnum.asset
}
export interface RTEAnchorAttrs extends Attributes {
target: string
url: string
}
export interface RTELinkAttrs extends Attributes {
"display-type": EmbedTypesEnum.link
"class-name": string
"content-type-uid": string
"entry-uid": string
locale: Lang
href: string
target: HTMLAnchorElement["target"]
type: RTEItemTypeEnum.entry
}
export interface RTEImageVaultAttrs extends Attributes {
height: string
// style: string[]
width: string
id: number
title: string
url: string
dimensions: {
width: number
height: number
aspectRatio: number
}
meta: { alt: string | undefined | null; caption: string | undefined | null }
focalPoint: { x: number; y: number }
}

View File

@@ -1,13 +1,3 @@
export enum EmbedTypesEnum {
block = "block",
display = "display",
download = "download",
inline = "inline",
link = "link",
}
export type EmbedTypes = keyof typeof EmbedTypesEnum
/** Copied from https://github.com/contentstack/contentstack-utils-javascript/blob/master/src/nodes/node-type.ts */
export enum RTETypeEnum {
a = "a",
@@ -45,8 +35,6 @@ export enum RTETypeEnum {
fragment = "fragment",
}
export type RTEType = keyof typeof RTETypeEnum
export enum RTEItemTypeEnum {
asset = "asset",
entry = "entry",

View File

@@ -5,12 +5,7 @@ import {
ImageVaultAssetResponse,
} from "@scandic-hotels/common/utils/imageVault"
import type { EmbedByUid } from "../../JsonToHtml"
import type {
Attributes,
RTEAnchorAttrs,
RTEAssetAttrs,
RTELinkAttrs,
} from "./attrs"
import type { Attributes, RTEAnchorAttrs } from "./attrs"
import type { RTETypeEnum } from "./enums"
import type { RenderOptions } from "./option"
@@ -21,26 +16,11 @@ export interface RTEDefaultNode {
uid: string
}
export interface RTELinkNode {
attrs: Attributes
children: RTENode[]
type: RTETypeEnum
uid: string
}
export interface RTEReferenceAssetNode extends RTEDefaultNode {
attrs: RTEAssetAttrs
}
export interface RTEAnchorNode extends RTEDefaultNode {
interface RTEAnchorNode extends RTEDefaultNode {
attrs: RTEAnchorAttrs
type: RTETypeEnum.a
}
export interface RTEReferenceLinkNode extends RTEDefaultNode {
attrs: RTELinkAttrs
}
export interface RTEImageVaultNode extends RTEDefaultNode {
attrs: Attributes &
(DeprecatedImageVaultAssetResponse | ImageVaultAssetResponse)
@@ -73,7 +53,7 @@ export type RTERegularNode = RTEDefaultNode | RTEAnchorNode | RTEImageVaultNode
export type RTEImageNode = RTEDefaultNode | RTEImageVaultNode
export type RTEReferenceNode = RTEAnchorNode
type RTEReferenceNode = RTEAnchorNode
export type RTENode = RTERegularNode | RTEReferenceNode | RTETextNode
@@ -83,11 +63,6 @@ export type RTERenderMark = (
id?: string
) => JSX.Element
export interface RTEDocument extends RTEDefaultNode {
type: RTETypeEnum.doc
_version: number
}
export type RTERenderOptionComponent = (
node: RTERegularNode,
embeds: EmbedByUid,

View File

@@ -18,7 +18,7 @@ import {
} from "./types/rte/node"
import type { RenderOptions } from "./types/rte/option"
export function groupEmbedsByUid(embedsArray: Node<Embeds>[]) {
function groupEmbedsByUid(embedsArray: Node<Embeds>[]) {
const embedsByUid = embedsArray.reduce<EmbedByUid>((acc, embed) => {
if ("system" in embed.node && embed.node.system?.uid) {
acc[embed.node.system.uid] = embed
@@ -29,7 +29,7 @@ export function groupEmbedsByUid(embedsArray: Node<Embeds>[]) {
return embedsByUid
}
export function nodeChildrenToHtml(
function nodeChildrenToHtml(
nodes: RTENode[],
embeds: EmbedByUid,
fullRenderOptions: RenderOptions
@@ -51,10 +51,7 @@ export function nodeChildrenToHtml(
.filter(Boolean)
}
export function textNodeToHtml(
node: RTETextNode,
fullRenderOptions: RenderOptions
) {
function textNodeToHtml(node: RTETextNode, fullRenderOptions: RenderOptions) {
let text = <>{node.text}</>
if (node.classname || node.id) {
@@ -116,7 +113,7 @@ export function extractAvailableListClassNames(className?: string) {
.map((item) => styles[item] || item)
}
export function nodeToHtml(
function nodeToHtml(
node: RTENode,
embeds: EmbedByUid,
fullRenderOptions: RenderOptions