maquinaweb-ui 2.65.0 → 2.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/container-animation/container-animation.d.ts +2 -2
- package/dist/date-field/DateField.d.ts +2 -2
- package/dist/date-field/DateField.d.ts.map +1 -1
- package/dist/date-hour-field/DateHourField.d.ts +2 -2
- package/dist/date-hour-field/DateHourField.d.ts.map +1 -1
- package/dist/input-suggest/input-suggest.d.ts +2 -2
- package/dist/landing-content.d.ts +3 -2
- package/dist/landing-content.js +2 -2
- package/dist/landing-text/client-landing-text.js +12 -6
- package/dist/landing-text/client-landing-text.js.map +1 -1
- package/dist/landing-text/landing-content.d.ts +2 -37
- package/dist/landing-text/landing-content.d.ts.map +1 -1
- package/dist/landing-text/landing-content.js +34 -37
- package/dist/landing-text/landing-content.js.map +1 -1
- package/dist/landing-text/landing-text.d.ts +4 -22
- package/dist/landing-text/landing-text.d.ts.map +1 -1
- package/dist/landing-text/landing-text.js.map +1 -1
- package/dist/landing-text/server-landing-text.d.ts +4 -14
- package/dist/landing-text/server-landing-text.d.ts.map +1 -1
- package/dist/landing-text/server-landing-text.js.map +1 -1
- package/dist/landing-text/types.d.ts +68 -0
- package/dist/landing-text/types.d.ts.map +1 -0
- package/dist/landing-text.d.ts +3 -2
- package/dist/page-header/page-header.d.ts +2 -2
- package/dist/remote-selector/remote-selector.d.ts +3 -3
- package/dist/text-field/TextField.d.ts +5 -5
- package/dist/toggle-field/ToggleGroup.d.ts +2 -2
- package/package.json +1 -1
- package/dist/_virtual/rolldown_runtime.js +0 -30
- package/dist/node_modules/cookie/dist/index.js +0 -300
- package/dist/node_modules/cookie/dist/index.js.map +0 -1
- package/dist/node_modules/cookies-next/lib/client/context.js +0 -111
- package/dist/node_modules/cookies-next/lib/client/context.js.map +0 -1
- package/dist/node_modules/cookies-next/lib/client/cookie-functions.js +0 -85
- package/dist/node_modules/cookies-next/lib/client/cookie-functions.js.map +0 -1
- package/dist/node_modules/cookies-next/lib/client/hooks.js +0 -129
- package/dist/node_modules/cookies-next/lib/client/hooks.js.map +0 -1
- package/dist/node_modules/cookies-next/lib/client/index.js +0 -44
- package/dist/node_modules/cookies-next/lib/client/index.js.map +0 -1
- package/dist/node_modules/cookies-next/lib/common/types.js +0 -12
- package/dist/node_modules/cookies-next/lib/common/types.js.map +0 -1
- package/dist/node_modules/cookies-next/lib/common/utils.js +0 -35
- package/dist/node_modules/cookies-next/lib/common/utils.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentProps, ElementType } from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime1 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/container-animation/container-animation.d.ts
|
|
5
5
|
type ContainerAnimationProps<T extends ElementType = 'div'> = ComponentProps<'div'> & ComponentProps<T> & {
|
|
@@ -23,7 +23,7 @@ declare const ContainerAnimation: <T extends ElementType = "div">({
|
|
|
23
23
|
distance,
|
|
24
24
|
hideNotInView,
|
|
25
25
|
...props
|
|
26
|
-
}: ContainerAnimationProps<T>) =>
|
|
26
|
+
}: ContainerAnimationProps<T>) => react_jsx_runtime1.JSX.Element;
|
|
27
27
|
//#endregion
|
|
28
28
|
export { ContainerAnimation, ContainerAnimationProps };
|
|
29
29
|
//# sourceMappingURL=container-animation.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FieldPath, FieldValues, UseControllerProps } from "react-hook-form";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime11 from "react/jsx-runtime";
|
|
3
3
|
import { Matcher } from "react-day-picker";
|
|
4
4
|
|
|
5
5
|
//#region src/components/date-field/DateField.d.ts
|
|
@@ -29,7 +29,7 @@ declare function DateField<TFieldValues extends FieldValues = FieldValues, TFiel
|
|
|
29
29
|
required,
|
|
30
30
|
help,
|
|
31
31
|
dateOnly
|
|
32
|
-
}: DateFieldProps<TFieldValues, TFieldName>):
|
|
32
|
+
}: DateFieldProps<TFieldValues, TFieldName>): react_jsx_runtime11.JSX.Element;
|
|
33
33
|
//#endregion
|
|
34
34
|
export { DateField, DateFieldProps };
|
|
35
35
|
//# sourceMappingURL=DateField.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateField.d.ts","names":[],"sources":["../../src/components/date-field/DateField.tsx"],"sourcesContent":[],"mappings":";;;;;UA4BiB,oCACM,cAAc,gCAChB,UAAU,gBAAgB,UAAU,uBAC/C,KAAK,mBAAmB,cAAc;;;EAH/B,WAAA,CAAA,EAAA,MAAc;EACR,SAAA,CAAA,EAAA,MAAA;EAAc,QAAA,CAAA,EAOxB,OAPwB,GAOd,OAPc,EAAA,GAAA,SAAA;EACN,aAAA,CAAA,EAAA,OAAA;EAAV,YAAA,CAAA,EAQJ,IARI;EAAoC,QAAA,CAAA,EAS5C,IAT4C;EAAV,QAAA,CAAA,EAAA,OAAA;EACb,IAAA,CAAA,EAAA,MAAA;EAAc;EAAjC,QAAA,CAAA,EAAA,OAAA;;iBAeN,SAVc,CAAA,qBAWA,WAXA,GAWc,WAXd,EAAA,mBAYF,SAZE,CAYQ,YAZR,CAAA,GAYwB,SAZxB,CAYkC,YAZlC,CAAA,CAAA,CAAA;EAAA,IAAA;EAAA,KAAA;EAAA,WAAA;EAAA,aAAA;EAAA,QAAA;EAAA,SAAA;EAAA,QAAA;EAAA,YAAA;EAAA,QAAA;EAAA,IAAA;EAAA;AAAA,CAAA,EAyBpB,cAzBoB,CAyBL,YAzBK,EAyBS,UAzBT,CAAA,CAAA,EAyBoB,
|
|
1
|
+
{"version":3,"file":"DateField.d.ts","names":[],"sources":["../../src/components/date-field/DateField.tsx"],"sourcesContent":[],"mappings":";;;;;UA4BiB,oCACM,cAAc,gCAChB,UAAU,gBAAgB,UAAU,uBAC/C,KAAK,mBAAmB,cAAc;;;EAH/B,WAAA,CAAA,EAAA,MAAc;EACR,SAAA,CAAA,EAAA,MAAA;EAAc,QAAA,CAAA,EAOxB,OAPwB,GAOd,OAPc,EAAA,GAAA,SAAA;EACN,aAAA,CAAA,EAAA,OAAA;EAAV,YAAA,CAAA,EAQJ,IARI;EAAoC,QAAA,CAAA,EAS5C,IAT4C;EAAV,QAAA,CAAA,EAAA,OAAA;EACb,IAAA,CAAA,EAAA,MAAA;EAAc;EAAjC,QAAA,CAAA,EAAA,OAAA;;iBAeN,SAVc,CAAA,qBAWA,WAXA,GAWc,WAXd,EAAA,mBAYF,SAZE,CAYQ,YAZR,CAAA,GAYwB,SAZxB,CAYkC,YAZlC,CAAA,CAAA,CAAA;EAAA,IAAA;EAAA,KAAA;EAAA,WAAA;EAAA,aAAA;EAAA,QAAA;EAAA,SAAA;EAAA,QAAA;EAAA,YAAA;EAAA,QAAA;EAAA,IAAA;EAAA;AAAA,CAAA,EAyBpB,cAzBoB,CAyBL,YAzBK,EAyBS,UAzBT,CAAA,CAAA,EAyBoB,mBAAA,CAAA,GAAA,CAAA,OAzBpB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FieldPath, FieldValues, UseControllerProps } from "react-hook-form";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime2 from "react/jsx-runtime";
|
|
3
3
|
import { Matcher } from "react-day-picker";
|
|
4
4
|
|
|
5
5
|
//#region src/components/date-hour-field/DateHourField.d.ts
|
|
@@ -29,7 +29,7 @@ declare function DateHourField<TFieldValues extends FieldValues = FieldValues, T
|
|
|
29
29
|
help,
|
|
30
30
|
hourPlaceholder,
|
|
31
31
|
valueType
|
|
32
|
-
}: DateHourFieldProps<TFieldValues, TFieldName>):
|
|
32
|
+
}: DateHourFieldProps<TFieldValues, TFieldName>): react_jsx_runtime2.JSX.Element;
|
|
33
33
|
//#endregion
|
|
34
34
|
export { DateHourField, DateHourFieldProps };
|
|
35
35
|
//# sourceMappingURL=DateHourField.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateHourField.d.ts","names":[],"sources":["../../src/components/date-hour-field/DateHourField.tsx"],"sourcesContent":[],"mappings":";;;;;UA4CiB,wCACM,cAAc,gCAChB,UAAU,gBAAgB,UAAU,uBAC/C,KAAK,mBAAmB,cAAc;;;EAH/B,SAAA,CAAA,EAAA,MAAA;EACM,QAAA,CAAA,EAMV,OANU,GAMA,OANA,EAAA,GAAA,SAAA;EAAc,aAAA,CAAA,EAAA,OAAA;EACN,YAAA,CAAA,EAOd,IAPc;EAAV,QAAA,CAAA,EAQR,IARQ;EAAoC,QAAA,CAAA,EAAA,OAAA;EAAV,IAAA,CAAA,EAAA,MAAA;EACb,eAAA,CAAA,EAAA,MAAA;EAAc,SAAA,CAAA,EAAA,MAAA,GAAA,cAAA;;iBAcvC,aAVI,CAAA,qBAWU,WAXV,GAWwB,WAXxB,EAAA,mBAYQ,SAZR,CAYkB,YAZlB,CAAA,GAYkC,SAZlC,CAY4C,YAZ5C,CAAA,CAAA,CAAA;EAAA,IAAA;EAAA,KAAA;EAAA,WAAA;EAAA,aAAA;EAAA,QAAA;EAAA,SAAA;EAAA,QAAA;EAAA,YAAA;EAAA,QAAA;EAAA,IAAA;EAAA,eAAA;EAAA;AAAA,CAAA,EA0BV,kBA1BU,CA0BS,YA1BT,EA0BuB,UA1BvB,CAAA,CAAA,EA0BkC,
|
|
1
|
+
{"version":3,"file":"DateHourField.d.ts","names":[],"sources":["../../src/components/date-hour-field/DateHourField.tsx"],"sourcesContent":[],"mappings":";;;;;UA4CiB,wCACM,cAAc,gCAChB,UAAU,gBAAgB,UAAU,uBAC/C,KAAK,mBAAmB,cAAc;;;EAH/B,SAAA,CAAA,EAAA,MAAA;EACM,QAAA,CAAA,EAMV,OANU,GAMA,OANA,EAAA,GAAA,SAAA;EAAc,aAAA,CAAA,EAAA,OAAA;EACN,YAAA,CAAA,EAOd,IAPc;EAAV,QAAA,CAAA,EAQR,IARQ;EAAoC,QAAA,CAAA,EAAA,OAAA;EAAV,IAAA,CAAA,EAAA,MAAA;EACb,eAAA,CAAA,EAAA,MAAA;EAAc,SAAA,CAAA,EAAA,MAAA,GAAA,cAAA;;iBAcvC,aAVI,CAAA,qBAWU,WAXV,GAWwB,WAXxB,EAAA,mBAYQ,SAZR,CAYkB,YAZlB,CAAA,GAYkC,SAZlC,CAY4C,YAZ5C,CAAA,CAAA,CAAA;EAAA,IAAA;EAAA,KAAA;EAAA,WAAA;EAAA,aAAA;EAAA,QAAA;EAAA,SAAA;EAAA,QAAA;EAAA,YAAA;EAAA,QAAA;EAAA,IAAA;EAAA,eAAA;EAAA;AAAA,CAAA,EA0BV,kBA1BU,CA0BS,YA1BT,EA0BuB,UA1BvB,CAAA,CAAA,EA0BkC,kBAAA,CAAA,GAAA,CAAA,OA1BlC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Mask, Options } from "../src/hooks/with-mask.js";
|
|
2
2
|
import { FieldPath, FieldValues, UseControllerProps } from "react-hook-form";
|
|
3
3
|
import { Dispatch, SetStateAction } from "react";
|
|
4
|
-
import * as
|
|
4
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
5
|
import { PopoverProps } from "@radix-ui/react-popover";
|
|
6
6
|
|
|
7
7
|
//#region src/components/input-suggest/input-suggest.d.ts
|
|
@@ -71,7 +71,7 @@ declare function InputSuggest<TFieldValues extends FieldValues = FieldValues, TF
|
|
|
71
71
|
debounceTime,
|
|
72
72
|
maxWait,
|
|
73
73
|
...props
|
|
74
|
-
}: InputSuggestProps<TFieldValues, TFieldName> & PopoverProps):
|
|
74
|
+
}: InputSuggestProps<TFieldValues, TFieldName> & PopoverProps): react_jsx_runtime0.JSX.Element;
|
|
75
75
|
//#endregion
|
|
76
76
|
export { InputSuggest, InputSuggestProps };
|
|
77
77
|
//# sourceMappingURL=input-suggest.d.ts.map
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { LandingContentDefinitionItem, LandingContentDefinitionSection, LandingContentName, LandingPageContentApiItem, LandingPageContentDefinition, LandingPageKey, ResolvedLandingContentItem, ResolvedLandingPageContent
|
|
2
|
-
|
|
1
|
+
import { LandingContentDefinitionItem, LandingContentDefinitionSection, LandingContentName, LandingPageContentApiItem, LandingPageContentDefinition, LandingPageKey, ResolvedLandingContentItem, ResolvedLandingPageContent } from "./landing-text/types.js";
|
|
2
|
+
import { buildContentId, getLandingContentByName, getLandingContentItem, getLandingPageContent, parseLandingContentName, setLandingPageDefaults } from "./landing-text/landing-content.js";
|
|
3
|
+
export { type LandingContentDefinitionItem, type LandingContentDefinitionSection, type LandingContentName, type LandingPageContentApiItem, type LandingPageContentDefinition, type LandingPageKey, type ResolvedLandingContentItem, type ResolvedLandingPageContent, buildContentId, getLandingContentByName, getLandingContentItem, getLandingPageContent, parseLandingContentName, setLandingPageDefaults };
|
package/dist/landing-content.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { buildContentId, getLandingContentByName, getLandingContentItem, getLandingPageContent,
|
|
1
|
+
import { buildContentId, getLandingContentByName, getLandingContentItem, getLandingPageContent, parseLandingContentName, setLandingPageDefaults } from "./landing-text/landing-content.js";
|
|
2
2
|
|
|
3
|
-
export { buildContentId, getLandingContentByName, getLandingContentItem, getLandingPageContent,
|
|
3
|
+
export { buildContentId, getLandingContentByName, getLandingContentItem, getLandingPageContent, parseLandingContentName, setLandingPageDefaults };
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
import { __toESM } from "../_virtual/rolldown_runtime.js";
|
|
5
4
|
import { cn } from "../src/lib/utils.js";
|
|
6
5
|
import { Button } from "../ui/button.js";
|
|
7
|
-
import { require_client } from "../node_modules/cookies-next/lib/client/index.js";
|
|
8
6
|
import { useRef, useState } from "react";
|
|
9
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
8
|
import { Check, X } from "lucide-react";
|
|
11
9
|
import { Slot } from "@radix-ui/react-slot";
|
|
12
10
|
|
|
13
11
|
//#region src/components/landing-text/client-landing-text.tsx
|
|
14
|
-
var import_client = /* @__PURE__ */ __toESM(require_client());
|
|
15
12
|
function labelFromKey(value) {
|
|
16
13
|
if (!value) return "";
|
|
17
14
|
return value.split(/[-_\.]/g).filter(Boolean).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
@@ -19,11 +16,20 @@ function labelFromKey(value) {
|
|
|
19
16
|
function normalizeBaseUrl(baseUrl) {
|
|
20
17
|
return baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl;
|
|
21
18
|
}
|
|
19
|
+
function getCookieValue(name) {
|
|
20
|
+
if (typeof document === "undefined") return;
|
|
21
|
+
const key = `${encodeURIComponent(name)}=`;
|
|
22
|
+
const cookies = document.cookie ? document.cookie.split("; ") : [];
|
|
23
|
+
for (const cookie of cookies) {
|
|
24
|
+
if (!cookie.startsWith(key)) continue;
|
|
25
|
+
return decodeURIComponent(cookie.slice(key.length));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
22
28
|
async function persistLandingContent(item, value) {
|
|
23
29
|
const baseUrl = String(process.env.NEXT_PUBLIC_BASE_URL || "");
|
|
24
30
|
const organization = process.env.NEXT_PUBLIC_ORGANIZATION_ID || "";
|
|
25
31
|
if (!baseUrl) return;
|
|
26
|
-
const token = (
|
|
32
|
+
const token = getCookieValue("token");
|
|
27
33
|
if (!token || !organization) throw new Error("Credenciais de edição indisponíveis para salvar conteúdo.");
|
|
28
34
|
if (!(await fetch(`${normalizeBaseUrl(baseUrl)}/landing-page-contents/upsert/`, {
|
|
29
35
|
method: "POST",
|
|
@@ -87,7 +93,7 @@ function ClientLandingText({ item, editable, children }) {
|
|
|
87
93
|
children: [editable && isEditing && /* @__PURE__ */ jsxs("div", {
|
|
88
94
|
className: "absolute right-0 z-10 h-fit -top-7 flex",
|
|
89
95
|
children: [/* @__PURE__ */ jsx(Button, {
|
|
90
|
-
className: "
|
|
96
|
+
className: "size-6 rounded-none p-0",
|
|
91
97
|
disabled: isSaving,
|
|
92
98
|
onClick: handleCancel,
|
|
93
99
|
size: "icon",
|
|
@@ -95,7 +101,7 @@ function ClientLandingText({ item, editable, children }) {
|
|
|
95
101
|
variant: "outline",
|
|
96
102
|
children: /* @__PURE__ */ jsx(X, {})
|
|
97
103
|
}), /* @__PURE__ */ jsx(Button, {
|
|
98
|
-
className: "
|
|
104
|
+
className: "size-6 rounded-none p-0",
|
|
99
105
|
disabled: isSaving,
|
|
100
106
|
onClick: handleSave,
|
|
101
107
|
size: "icon",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-landing-text.js","names":[],"sources":["../../src/components/landing-text/client-landing-text.tsx"],"sourcesContent":["'use client';\n\nimport { useRef, useState } from 'react';\n\nimport { Slot } from '@radix-ui/react-slot';\nimport { Button } from '../ui/button';\n\nimport { Check, X } from 'lucide-react';\n\nimport { cn } from '@/lib/utils';\nimport
|
|
1
|
+
{"version":3,"file":"client-landing-text.js","names":[],"sources":["../../src/components/landing-text/client-landing-text.tsx"],"sourcesContent":["'use client';\n\nimport { useRef, useState } from 'react';\n\nimport { Slot } from '@radix-ui/react-slot';\nimport { Button } from '../ui/button';\n\nimport { Check, X } from 'lucide-react';\n\nimport { cn } from '@/lib/utils';\nimport type { LandingTextItem } from './types';\n\ninterface ClientLandingTextProps {\n item: LandingTextItem;\n editable: boolean;\n children: React.ReactNode;\n}\n\nfunction labelFromKey(value: string) {\n if (!value) {\n return '';\n }\n\n return value\n .split(/[-_\\.]/g)\n .filter(Boolean)\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n}\n\nfunction normalizeBaseUrl(baseUrl: string): string {\n return baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl;\n}\n\nfunction getCookieValue(name: string): string | undefined {\n if (typeof document === 'undefined') {\n return undefined;\n }\n\n const key = `${encodeURIComponent(name)}=`;\n const cookies = document.cookie ? document.cookie.split('; ') : [];\n\n for (const cookie of cookies) {\n if (!cookie.startsWith(key)) {\n continue;\n }\n\n return decodeURIComponent(cookie.slice(key.length));\n }\n\n return undefined;\n}\n\nasync function persistLandingContent(item: LandingTextItem, value: string) {\n const baseUrl = String(process.env.NEXT_PUBLIC_BASE_URL || '');\n const organization = process.env.NEXT_PUBLIC_ORGANIZATION_ID || '';\n\n if (!baseUrl) {\n return;\n }\n\n const token = getCookieValue('token');\n\n if (!token || !organization) {\n throw new Error(\n 'Credenciais de edição indisponíveis para salvar conteúdo.'\n );\n }\n\n const endpoint = '/landing-page-contents/upsert/';\n const response = await fetch(`${normalizeBaseUrl(baseUrl)}${endpoint}`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Token ${token}`,\n 'X-Organization': organization,\n },\n body: JSON.stringify({\n page_key: item.pageKey,\n page_title: labelFromKey(item.pageKey),\n section_key: item.sectionKey,\n section_title: labelFromKey(item.sectionKey),\n content_key: item.contentKey,\n content_title: labelFromKey(item.contentKey),\n value,\n default_value: item.defaultValue,\n metadata: item.metadata,\n }),\n credentials: 'include',\n });\n\n if (!response.ok) {\n throw new Error('Nao foi possivel salvar o conteudo.');\n }\n}\n\nfunction ClientLandingText({\n item,\n editable,\n children,\n}: ClientLandingTextProps) {\n const [isEditing, setIsEditing] = useState(false);\n const [isSaving, setIsSaving] = useState(false);\n const [currentValue, setCurrentValue] = useState(item.value);\n const [draftValue, setDraftValue] = useState(item.value);\n const ref = useRef<HTMLElement | null>(null);\n\n const handleEdit = (event: React.MouseEvent<HTMLElement>) => {\n if (!editable || isSaving) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n\n const nextDraft = ref.current?.innerText ?? currentValue;\n setDraftValue(nextDraft);\n setIsEditing(true);\n\n requestAnimationFrame(() => {\n ref.current?.focus();\n });\n };\n\n const handleCancel = () => {\n if (ref.current) {\n ref.current.innerText = currentValue;\n }\n setDraftValue(currentValue);\n setIsEditing(false);\n };\n\n const handleSave = async () => {\n try {\n setIsSaving(true);\n await persistLandingContent(item, draftValue);\n setCurrentValue(draftValue);\n if (ref.current) {\n ref.current.innerText = draftValue;\n }\n setIsEditing(false);\n } finally {\n setIsSaving(false);\n }\n };\n\n const handleInput = (event: React.FormEvent<HTMLElement>) => {\n if (!isEditing) {\n return;\n }\n setDraftValue(event.currentTarget.innerText);\n };\n\n return (\n <div className=\"relative\">\n {editable && isEditing && (\n <div className=\"absolute right-0 z-10 h-fit -top-7 flex\">\n <Button\n className=\"size-6 rounded-none p-0\"\n disabled={isSaving}\n onClick={handleCancel}\n size=\"icon\"\n type=\"button\"\n variant=\"outline\"\n >\n <X />\n </Button>\n <Button\n className=\"size-6 rounded-none p-0\"\n disabled={isSaving}\n onClick={handleSave}\n size=\"icon\"\n type=\"button\"\n >\n <Check />\n </Button>\n </div>\n )}\n\n <Slot\n className={cn(\n 'relative',\n 'after:z-10 after:w-full after:h-full after:absolute after:left-1/2 after:-translate-x-1/2 after:top-1/2 after:-translate-y-1/2 after:box-content after:p-1',\n editable && 'hover:after:border hover:after:border-input',\n isEditing && 'after:border after:border-input',\n isEditing && 'outline-none cursor-text before:bg-red-500',\n !editable && 'after:hidden'\n )}\n contentEditable={editable && isEditing}\n onClick={handleEdit}\n onInput={handleInput}\n ref={ref}\n suppressContentEditableWarning\n >\n {children}\n </Slot>\n </div>\n );\n}\n\nexport { ClientLandingText };\n"],"mappings":"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"}
|
|
@@ -1,45 +1,10 @@
|
|
|
1
|
+
import { LandingContentName, LandingPageContentDefinition, LandingPageKey, ResolvedLandingContentItem, ResolvedLandingPageContent } from "./types.js";
|
|
1
2
|
import "server-only";
|
|
2
3
|
|
|
3
4
|
//#region src/components/landing-text/landing-content.d.ts
|
|
4
|
-
type LandingPageKey = string;
|
|
5
|
-
type LandingContentName = `${string}.${string}.${string}`;
|
|
6
|
-
interface LandingContentDefinitionItem {
|
|
7
|
-
contentKey: string;
|
|
8
|
-
value: string;
|
|
9
|
-
metadata?: Record<string, unknown>;
|
|
10
|
-
}
|
|
11
|
-
interface LandingContentDefinitionSection {
|
|
12
|
-
sectionKey: string;
|
|
13
|
-
contents: LandingContentDefinitionItem[];
|
|
14
|
-
}
|
|
15
|
-
interface LandingPageContentDefinition {
|
|
16
|
-
pageKey: string;
|
|
17
|
-
sections: LandingContentDefinitionSection[];
|
|
18
|
-
}
|
|
19
|
-
interface LandingPageContentApiItem {
|
|
20
|
-
page_key: string;
|
|
21
|
-
section_key: string;
|
|
22
|
-
content_key: string;
|
|
23
|
-
value: string;
|
|
24
|
-
metadata?: Record<string, unknown>;
|
|
25
|
-
}
|
|
26
|
-
interface ResolvedLandingContentItem {
|
|
27
|
-
pageKey: string;
|
|
28
|
-
sectionKey: string;
|
|
29
|
-
contentKey: string;
|
|
30
|
-
value: string;
|
|
31
|
-
defaultValue: string;
|
|
32
|
-
metadata: Record<string, unknown>;
|
|
33
|
-
}
|
|
34
|
-
interface ResolvedLandingPageContent {
|
|
35
|
-
pageKey: string;
|
|
36
|
-
editable: boolean;
|
|
37
|
-
contents: Record<string, ResolvedLandingContentItem>;
|
|
38
|
-
}
|
|
39
5
|
declare function setLandingPageDefaults(defaults: Record<LandingPageKey, LandingPageContentDefinition>): void;
|
|
40
6
|
declare function buildContentId(sectionKey: string, contentKey: string): string;
|
|
41
7
|
declare function getLandingPageContent(pageKey: LandingPageKey): Promise<ResolvedLandingPageContent>;
|
|
42
|
-
declare const getLandingPageContentCached: (pageKey: LandingPageKey) => Promise<ResolvedLandingPageContent>;
|
|
43
8
|
declare function parseLandingContentName(name: string): {
|
|
44
9
|
pageKey: string;
|
|
45
10
|
sectionKey: string;
|
|
@@ -51,5 +16,5 @@ declare function getLandingContentByName(name: LandingContentName): Promise<{
|
|
|
51
16
|
item: ResolvedLandingContentItem;
|
|
52
17
|
}>;
|
|
53
18
|
//#endregion
|
|
54
|
-
export {
|
|
19
|
+
export { buildContentId, getLandingContentByName, getLandingContentItem, getLandingPageContent, parseLandingContentName, setLandingPageDefaults };
|
|
55
20
|
//# sourceMappingURL=landing-content.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"landing-content.d.ts","names":[],"sources":["../../src/components/landing-text/landing-content.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"landing-content.d.ts","names":[],"sources":["../../src/components/landing-text/landing-content.ts"],"sourcesContent":[],"mappings":";;;;iBAsBgB,sBAAA,WACJ,OAAO,gBAAgB;iBAQnB,cAAA;AATA,iBA4DM,qBAAA,CA5DgB,OAAA,EA6D3B,cA7D2B,CAAA,EA8DnC,OA9DmC,CA8D3B,0BA9D2B,CAAA;AACnB,iBA6GH,uBAAA,CA7GG,IAAA,EAAA,MAAA,CAAA,EAAA;EAAgB,OAAA,EAAA,MAAA;EAAvB,UAAA,EAAA,MAAA;EAAM,UAAA,EAAA,MAAA;AAQlB,CAAA,GAAgB,IAAA;AAmDM,iBAsEN,qBAAA,CAtE2B,OAAA,EAuEhC,0BAvEgC,EAAA,UAAA,EAAA,MAAA,EAAA,UAAA,EAAA,MAAA,CAAA,EAyEvB,0BAzEuB;AAChC,iBAsFW,uBAAA,CAtFX,IAAA,EAsFyC,kBAtFzC,CAAA,EAsF2D,OAtF3D,CAAA;EACA,QAAA,EAAA,OAAA;EAAR,IAAA,EAkGQ,0BAlGR;CAAO,CAAA"}
|
|
@@ -13,61 +13,61 @@ function setLandingPageDefaults(defaults) {
|
|
|
13
13
|
function buildContentId(sectionKey, contentKey) {
|
|
14
14
|
return `${sectionKey}.${contentKey}`;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
16
|
+
function toApiUrl(path) {
|
|
17
|
+
const baseUrl = String(process.env.NEXT_PUBLIC_BASE_URL || "").replace(/\/$/, "");
|
|
18
|
+
return baseUrl ? `${baseUrl}${path}` : "";
|
|
18
19
|
}
|
|
19
|
-
async function
|
|
20
|
-
const defaults = pageDefaults[pageKey] || {
|
|
21
|
-
pageKey,
|
|
22
|
-
sections: []
|
|
23
|
-
};
|
|
24
|
-
const organizationId = process.env.NEXT_PUBLIC_ORGANIZATION_ID;
|
|
25
|
-
const baseUrl = normalizeBaseUrl(String(process.env.NEXT_PUBLIC_BASE_URL || ""));
|
|
20
|
+
async function getEditableState() {
|
|
26
21
|
const cookieStore = await cookies();
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
return Boolean(cookieStore.get("token")?.value && cookieStore.get("organization")?.value);
|
|
23
|
+
}
|
|
24
|
+
async function getLandingOverrides(pageKey) {
|
|
25
|
+
const organizationId = process.env.NEXT_PUBLIC_ORGANIZATION_ID;
|
|
26
|
+
const url = toApiUrl(`/public/landing-page-contents/?page_key=${encodeURIComponent(pageKey)}`);
|
|
27
|
+
if (!organizationId || !url) return [];
|
|
28
|
+
try {
|
|
29
|
+
const response = await fetch(url, {
|
|
33
30
|
headers: { "X-Organization": organizationId },
|
|
34
31
|
next: { tags: ["landing-page-content", `landing-page-content-${pageKey}`] }
|
|
35
32
|
});
|
|
36
|
-
if (response.ok)
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
if (!response.ok) return [];
|
|
34
|
+
return response.json();
|
|
35
|
+
} catch {
|
|
36
|
+
return [];
|
|
39
37
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
38
|
+
}
|
|
39
|
+
async function getLandingPageContent(pageKey) {
|
|
40
|
+
const defaults = pageDefaults[pageKey] ?? {
|
|
41
|
+
pageKey,
|
|
42
|
+
sections: []
|
|
43
|
+
};
|
|
44
|
+
const [editable, overrides] = await Promise.all([getEditableState(), getLandingOverrides(pageKey)]);
|
|
45
|
+
const byId = new Map(overrides.map((item) => [buildContentId(item.section_key, item.content_key), item]));
|
|
46
|
+
const contents = Object.fromEntries(defaults.sections.flatMap((section) => section.contents.map((item) => {
|
|
44
47
|
const id = buildContentId(section.sectionKey, item.contentKey);
|
|
45
48
|
const override = byId.get(id);
|
|
46
|
-
|
|
49
|
+
return [id, {
|
|
47
50
|
pageKey: defaults.pageKey,
|
|
48
51
|
sectionKey: section.sectionKey,
|
|
49
52
|
contentKey: item.contentKey,
|
|
50
|
-
value: override
|
|
53
|
+
value: override?.value ?? item.value,
|
|
51
54
|
defaultValue: item.value,
|
|
52
|
-
metadata: override?.metadata
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
+
metadata: override?.metadata ?? item.metadata ?? {}
|
|
56
|
+
}];
|
|
57
|
+
})));
|
|
55
58
|
return {
|
|
56
59
|
pageKey: defaults.pageKey,
|
|
57
60
|
editable,
|
|
58
61
|
contents
|
|
59
62
|
};
|
|
60
63
|
}
|
|
61
|
-
const getLandingPageContentCached = cache(
|
|
62
|
-
function isLandingPageKey(value) {
|
|
63
|
-
return value in pageDefaults;
|
|
64
|
-
}
|
|
64
|
+
const getLandingPageContentCached = cache(getLandingPageContent);
|
|
65
65
|
function parseLandingContentName(name) {
|
|
66
66
|
const [rawPageKey, rawSectionKey, ...contentParts] = name.split(".").map((part) => part.trim());
|
|
67
67
|
const pageKey = rawPageKey || "";
|
|
68
68
|
const sectionKey = rawSectionKey || "";
|
|
69
69
|
const contentKey = contentParts.join(".").trim();
|
|
70
|
-
if (!
|
|
70
|
+
if (!pageDefaults[pageKey] || !sectionKey || !contentKey) return null;
|
|
71
71
|
return {
|
|
72
72
|
pageKey,
|
|
73
73
|
sectionKey,
|
|
@@ -75,10 +75,7 @@ function parseLandingContentName(name) {
|
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
77
|
function getLandingContentItem(content, sectionKey, contentKey) {
|
|
78
|
-
|
|
79
|
-
const existing = content.contents[id];
|
|
80
|
-
if (existing) return existing;
|
|
81
|
-
return {
|
|
78
|
+
return content.contents[buildContentId(sectionKey, contentKey)] ?? {
|
|
82
79
|
pageKey: content.pageKey,
|
|
83
80
|
sectionKey,
|
|
84
81
|
contentKey,
|
|
@@ -108,5 +105,5 @@ async function getLandingContentByName(name) {
|
|
|
108
105
|
}
|
|
109
106
|
|
|
110
107
|
//#endregion
|
|
111
|
-
export { buildContentId, getLandingContentByName, getLandingContentItem, getLandingPageContent,
|
|
108
|
+
export { buildContentId, getLandingContentByName, getLandingContentItem, getLandingPageContent, parseLandingContentName, setLandingPageDefaults };
|
|
112
109
|
//# sourceMappingURL=landing-content.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"landing-content.js","names":["pageDefaults: Record<LandingPageKey, LandingPageContentDefinition>"
|
|
1
|
+
{"version":3,"file":"landing-content.js","names":["pageDefaults: Record<LandingPageKey, LandingPageContentDefinition>"],"sources":["../../src/components/landing-text/landing-content.ts"],"sourcesContent":["import 'server-only';\n\nimport { cache } from 'react';\nimport { cookies } from 'next/headers';\n\nimport type {\n LandingContentName,\n LandingPageContentApiItem,\n LandingPageContentDefinition,\n LandingPageKey,\n ResolvedLandingContentItem,\n ResolvedLandingPageContent,\n} from './types';\n\ntype NextFetchInit = RequestInit & {\n next?: {\n tags?: string[];\n };\n};\n\nlet pageDefaults: Record<LandingPageKey, LandingPageContentDefinition> = {};\n\nexport function setLandingPageDefaults(\n defaults: Record<LandingPageKey, LandingPageContentDefinition>\n) {\n pageDefaults = {\n ...pageDefaults,\n ...defaults,\n };\n}\n\nexport function buildContentId(sectionKey: string, contentKey: string) {\n return `${sectionKey}.${contentKey}`;\n}\n\nfunction toApiUrl(path: string) {\n const baseUrl = String(process.env.NEXT_PUBLIC_BASE_URL || '').replace(\n /\\/$/,\n ''\n );\n return baseUrl ? `${baseUrl}${path}` : '';\n}\n\nasync function getEditableState() {\n const cookieStore = await cookies();\n return Boolean(\n cookieStore.get('token')?.value && cookieStore.get('organization')?.value\n );\n}\n\nasync function getLandingOverrides(\n pageKey: LandingPageKey\n): Promise<LandingPageContentApiItem[]> {\n const organizationId = process.env.NEXT_PUBLIC_ORGANIZATION_ID;\n const url = toApiUrl(\n `/public/landing-page-contents/?page_key=${encodeURIComponent(pageKey)}`\n );\n\n if (!organizationId || !url) {\n return [];\n }\n\n try {\n const response = await fetch(url, {\n headers: {\n 'X-Organization': organizationId,\n },\n next: {\n tags: ['landing-page-content', `landing-page-content-${pageKey}`],\n },\n } satisfies NextFetchInit);\n\n if (!response.ok) {\n return [];\n }\n\n return response.json();\n } catch {\n return [];\n }\n}\n\nexport async function getLandingPageContent(\n pageKey: LandingPageKey\n): Promise<ResolvedLandingPageContent> {\n const defaults = pageDefaults[pageKey] ?? {\n pageKey,\n sections: [],\n };\n\n const [editable, overrides] = await Promise.all([\n getEditableState(),\n getLandingOverrides(pageKey),\n ]);\n\n const byId = new Map<string, LandingPageContentApiItem>(\n overrides.map((item) => [\n buildContentId(item.section_key, item.content_key),\n item,\n ])\n );\n\n const contents = Object.fromEntries(\n defaults.sections.flatMap((section) =>\n section.contents.map((item) => {\n const id = buildContentId(section.sectionKey, item.contentKey);\n const override = byId.get(id);\n\n return [\n id,\n {\n pageKey: defaults.pageKey,\n sectionKey: section.sectionKey,\n contentKey: item.contentKey,\n value: override?.value ?? item.value,\n defaultValue: item.value,\n metadata: override?.metadata ?? item.metadata ?? {},\n },\n ] as const;\n })\n )\n );\n\n return {\n pageKey: defaults.pageKey,\n editable,\n contents,\n };\n}\n\nconst getLandingPageContentCached = cache(getLandingPageContent);\n\nexport function parseLandingContentName(name: string) {\n const [rawPageKey, rawSectionKey, ...contentParts] = name\n .split('.')\n .map((part) => part.trim());\n\n const pageKey = rawPageKey || '';\n const sectionKey = rawSectionKey || '';\n const contentKey = contentParts.join('.').trim();\n\n if (!pageDefaults[pageKey] || !sectionKey || !contentKey) {\n return null;\n }\n\n return {\n pageKey,\n sectionKey,\n contentKey,\n };\n}\n\nexport function getLandingContentItem(\n content: ResolvedLandingPageContent,\n sectionKey: string,\n contentKey: string\n) {\n return (\n content.contents[buildContentId(sectionKey, contentKey)] ?? {\n pageKey: content.pageKey,\n sectionKey,\n contentKey,\n value: '',\n defaultValue: '',\n metadata: {},\n }\n );\n}\n\nexport async function getLandingContentByName(name: LandingContentName) {\n const parsed = parseLandingContentName(name);\n\n if (!parsed) {\n return {\n editable: false,\n item: {\n pageKey: 'unknown',\n sectionKey: 'invalid',\n contentKey: name,\n value: '',\n defaultValue: '',\n metadata: {},\n } as ResolvedLandingContentItem,\n };\n }\n\n const content = await getLandingPageContentCached(parsed.pageKey);\n\n return {\n editable: content.editable,\n item: getLandingContentItem(content, parsed.sectionKey, parsed.contentKey),\n };\n}\n"],"mappings":"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"}
|
|
@@ -1,26 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
1
|
+
import { LandingTextProps } from "./types.js";
|
|
2
|
+
import * as react_jsx_runtime10 from "react/jsx-runtime";
|
|
4
3
|
|
|
5
4
|
//#region src/components/landing-text/landing-text.d.ts
|
|
6
|
-
|
|
7
|
-
value: string;
|
|
8
|
-
defaultValue: string;
|
|
9
|
-
metadata: Record<string, unknown>;
|
|
10
|
-
}
|
|
11
|
-
interface LandingTextBaseProps {
|
|
12
|
-
className?: string;
|
|
13
|
-
as?: 'p' | 'span' | 'h1' | 'h2' | 'h3' | 'div';
|
|
14
|
-
}
|
|
15
|
-
interface LandingTextWithItemProps extends LandingTextBaseProps {
|
|
16
|
-
item: LandingTextItem;
|
|
17
|
-
editable: boolean;
|
|
18
|
-
}
|
|
19
|
-
interface LandingTextWithNameProps extends LandingTextBaseProps {
|
|
20
|
-
name: LandingContentName;
|
|
21
|
-
}
|
|
22
|
-
type LandingTextProps = LandingTextWithItemProps | LandingTextWithNameProps;
|
|
23
|
-
declare function LandingText(props: LandingTextProps): Promise<react_jsx_runtime3.JSX.Element>;
|
|
5
|
+
declare function LandingText(props: LandingTextProps): Promise<react_jsx_runtime10.JSX.Element>;
|
|
24
6
|
//#endregion
|
|
25
|
-
export { LandingText
|
|
7
|
+
export { LandingText };
|
|
26
8
|
//# sourceMappingURL=landing-text.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"landing-text.d.ts","names":[],"sources":["../../src/components/landing-text/landing-text.tsx"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"landing-text.d.ts","names":[],"sources":["../../src/components/landing-text/landing-text.tsx"],"sourcesContent":[],"mappings":";;;;iBAWe,WAAA,QAAmB,mBAAgB,QAAA,mBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"landing-text.js","names":[],"sources":["../../src/components/landing-text/landing-text.tsx"],"sourcesContent":["import { ClientLandingText } from './client-landing-text';\nimport {
|
|
1
|
+
{"version":3,"file":"landing-text.js","names":[],"sources":["../../src/components/landing-text/landing-text.tsx"],"sourcesContent":["import { ClientLandingText } from './client-landing-text';\nimport { getLandingContentByName } from './landing-content';\nimport { ServerLandingText } from './server-landing-text';\nimport type { LandingTextProps, LandingTextWithNameProps } from './types';\n\nfunction isLandingTextWithName(\n props: LandingTextProps\n): props is LandingTextWithNameProps {\n return 'name' in props;\n}\n\nasync function LandingText(props: LandingTextProps) {\n const { className, as } = props;\n\n const { item, editable } = isLandingTextWithName(props)\n ? await getLandingContentByName(props.name)\n : {\n item: props.item,\n editable: props.editable,\n };\n\n return (\n <ClientLandingText editable={editable} item={item}>\n <ServerLandingText\n as={as}\n className={className}\n registration={{\n pageKey: item.pageKey,\n sectionKey: item.sectionKey,\n contentKey: item.contentKey,\n }}\n value={item.value}\n />\n </ClientLandingText>\n );\n}\n\nexport { LandingText };\n"],"mappings":";;;;;;AAKA,SAAS,sBACP,OACmC;AACnC,QAAO,UAAU;;AAGnB,eAAe,YAAY,OAAyB;CAClD,MAAM,EAAE,WAAW,OAAO;CAE1B,MAAM,EAAE,MAAM,aAAa,sBAAsB,MAAM,GACnD,MAAM,wBAAwB,MAAM,KAAK,GACzC;EACE,MAAM,MAAM;EACZ,UAAU,MAAM;EACjB;AAEL,QACE,oBAAC;EAA4B;EAAgB;YAC3C,oBAAC;GACK;GACO;GACX,cAAc;IACZ,SAAS,KAAK;IACd,YAAY,KAAK;IACjB,YAAY,KAAK;IAClB;GACD,OAAO,KAAK;IACZ;GACgB"}
|
|
@@ -1,24 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as
|
|
1
|
+
import { ServerLandingTextProps } from "./types.js";
|
|
2
|
+
import * as react_jsx_runtime5 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/landing-text/server-landing-text.d.ts
|
|
5
|
-
interface LandingTextRegistration {
|
|
6
|
-
pageKey: string;
|
|
7
|
-
sectionKey: string;
|
|
8
|
-
contentKey: string;
|
|
9
|
-
}
|
|
10
|
-
interface ServerLandingTextProps extends HTMLAttributes<HTMLElement> {
|
|
11
|
-
as?: ElementType;
|
|
12
|
-
value: string;
|
|
13
|
-
registration?: LandingTextRegistration;
|
|
14
|
-
}
|
|
15
5
|
declare function ServerLandingText({
|
|
16
6
|
as: As,
|
|
17
7
|
value,
|
|
18
8
|
className,
|
|
19
9
|
registration,
|
|
20
10
|
...props
|
|
21
|
-
}: ServerLandingTextProps):
|
|
11
|
+
}: ServerLandingTextProps): react_jsx_runtime5.JSX.Element;
|
|
22
12
|
//#endregion
|
|
23
|
-
export {
|
|
13
|
+
export { ServerLandingText };
|
|
24
14
|
//# sourceMappingURL=server-landing-text.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-landing-text.d.ts","names":[],"sources":["../../src/components/landing-text/server-landing-text.tsx"],"sourcesContent":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"server-landing-text.d.ts","names":[],"sources":["../../src/components/landing-text/server-landing-text.tsx"],"sourcesContent":[],"mappings":";;;;iBAGS,iBAAA;MACH;;;;;GAKH,yBAAsB,kBAAA,CAAA,GAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-landing-text.js","names":[],"sources":["../../src/components/landing-text/server-landing-text.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"server-landing-text.js","names":[],"sources":["../../src/components/landing-text/server-landing-text.tsx"],"sourcesContent":["import { cn } from '@/lib/utils';\nimport type { ServerLandingTextProps } from './types';\n\nfunction ServerLandingText({\n as: As = 'span',\n value,\n className,\n registration,\n ...props\n}: ServerLandingTextProps) {\n return (\n <As\n className={cn(className)}\n data-content-key={registration?.contentKey}\n data-page-key={registration?.pageKey}\n data-section-key={registration?.sectionKey}\n {...props}\n >\n {value}\n </As>\n );\n}\n\nexport { ServerLandingText };\n"],"mappings":";;;;AAGA,SAAS,kBAAkB,EACzB,IAAI,KAAK,QACT,OACA,WACA,aACA,GAAG,SACsB;AACzB,QACE,oBAAC;EACC,WAAW,GAAG,UAAU;EACxB,oBAAkB,cAAc;EAChC,iBAAe,cAAc;EAC7B,oBAAkB,cAAc;EAChC,GAAI;YAEH;GACE"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ElementType, HTMLAttributes } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/landing-text/types.d.ts
|
|
4
|
+
type LandingPageKey = string;
|
|
5
|
+
type LandingContentName = `${string}.${string}.${string}`;
|
|
6
|
+
interface LandingContentDefinitionItem {
|
|
7
|
+
contentKey: string;
|
|
8
|
+
value: string;
|
|
9
|
+
metadata?: Record<string, unknown>;
|
|
10
|
+
}
|
|
11
|
+
interface LandingContentDefinitionSection {
|
|
12
|
+
sectionKey: string;
|
|
13
|
+
contents: LandingContentDefinitionItem[];
|
|
14
|
+
}
|
|
15
|
+
interface LandingPageContentDefinition {
|
|
16
|
+
pageKey: string;
|
|
17
|
+
sections: LandingContentDefinitionSection[];
|
|
18
|
+
}
|
|
19
|
+
interface LandingPageContentApiItem {
|
|
20
|
+
page_key: string;
|
|
21
|
+
section_key: string;
|
|
22
|
+
content_key: string;
|
|
23
|
+
value: string;
|
|
24
|
+
metadata?: Record<string, unknown>;
|
|
25
|
+
}
|
|
26
|
+
interface ResolvedLandingContentItem {
|
|
27
|
+
pageKey: string;
|
|
28
|
+
sectionKey: string;
|
|
29
|
+
contentKey: string;
|
|
30
|
+
value: string;
|
|
31
|
+
defaultValue: string;
|
|
32
|
+
metadata: Record<string, unknown>;
|
|
33
|
+
}
|
|
34
|
+
interface ResolvedLandingPageContent {
|
|
35
|
+
pageKey: string;
|
|
36
|
+
editable: boolean;
|
|
37
|
+
contents: Record<string, ResolvedLandingContentItem>;
|
|
38
|
+
}
|
|
39
|
+
interface LandingTextRegistration {
|
|
40
|
+
pageKey: string;
|
|
41
|
+
sectionKey: string;
|
|
42
|
+
contentKey: string;
|
|
43
|
+
}
|
|
44
|
+
interface LandingTextItem extends LandingTextRegistration {
|
|
45
|
+
value: string;
|
|
46
|
+
defaultValue: string;
|
|
47
|
+
metadata: Record<string, unknown>;
|
|
48
|
+
}
|
|
49
|
+
interface LandingTextBaseProps {
|
|
50
|
+
className?: string;
|
|
51
|
+
as?: 'p' | 'span' | 'h1' | 'h2' | 'h3' | 'div';
|
|
52
|
+
}
|
|
53
|
+
interface LandingTextWithItemProps extends LandingTextBaseProps {
|
|
54
|
+
item: LandingTextItem;
|
|
55
|
+
editable: boolean;
|
|
56
|
+
}
|
|
57
|
+
interface LandingTextWithNameProps extends LandingTextBaseProps {
|
|
58
|
+
name: LandingContentName;
|
|
59
|
+
}
|
|
60
|
+
type LandingTextProps = LandingTextWithItemProps | LandingTextWithNameProps;
|
|
61
|
+
interface ServerLandingTextProps extends HTMLAttributes<HTMLElement> {
|
|
62
|
+
as?: ElementType;
|
|
63
|
+
value: string;
|
|
64
|
+
registration?: LandingTextRegistration;
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { LandingContentDefinitionItem, LandingContentDefinitionSection, LandingContentName, LandingPageContentApiItem, LandingPageContentDefinition, LandingPageKey, LandingTextItem, LandingTextProps, LandingTextRegistration, ResolvedLandingContentItem, ResolvedLandingPageContent, ServerLandingTextProps };
|
|
68
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/components/landing-text/types.ts"],"sourcesContent":[],"mappings":";;;KAEY,cAAA;KACA,kBAAA;AADA,UAGK,4BAAA,CAHS;EACd,UAAA,EAAA,MAAA;EAEK,KAAA,EAAA,MAAA;EAMA,QAAA,CAAA,EAHJ,MAGI,CAAA,MAAA,EAAA,OAAA,CAA+B;AAKhD;AAKiB,UAVA,+BAAA,CAeJ;EAGI,UAAA,EAAA,MAAA;EASA,QAAA,EAzBL,4BAyB+B,EAAA;AAM3C;AAMiB,UAlCA,4BAAA,CAkCwB;EAMxB,OAAA,EAAA,MAAA;EAKA,QAAA,EA3CL,+BA4CJ,EAAA;AAIR;AAIY,UAjDK,yBAAA,CAkDb;EAGa,QAAA,EAAA,MAAA;EAA8C,WAAA,EAAA,MAAA;EACxD,WAAA,EAAA,MAAA;EAEU,KAAA,EAAA,MAAA;EAH+B,QAAA,CAAA,EAhDnC,MAgDmC,CAAA,MAAA,EAAA,OAAA,CAAA;;UA7C/B,0BAAA;;;;;;YAML;;UAGK,0BAAA;;;YAGL,eAAe;;UAGV,uBAAA;;;;;UAMA,eAAA,SAAwB;;;YAG7B;;UAGK,oBAAA;;;;UAKA,wBAAA,SAAiC;QAC1C;;;UAIS,wBAAA,SAAiC;QAC1C;;KAGI,gBAAA,GACR,2BACA;UAEa,sBAAA,SAA+B,eAAe;OACxD;;iBAEU"}
|
package/dist/landing-text.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { LandingText
|
|
1
|
+
import { LandingTextItem, LandingTextProps, LandingTextRegistration, ServerLandingTextProps } from "./landing-text/types.js";
|
|
2
|
+
import { LandingText } from "./landing-text/landing-text.js";
|
|
3
|
+
import { ServerLandingText } from "./landing-text/server-landing-text.js";
|
|
3
4
|
export { LandingText, type LandingTextItem, type LandingTextProps, type LandingTextRegistration, ServerLandingText, type ServerLandingTextProps };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/components/page-header/page-header.d.ts
|
|
4
4
|
interface PageHeaderProps {
|
|
@@ -10,7 +10,7 @@ declare function PageHeader({
|
|
|
10
10
|
title,
|
|
11
11
|
help,
|
|
12
12
|
description
|
|
13
|
-
}: PageHeaderProps):
|
|
13
|
+
}: PageHeaderProps): react_jsx_runtime0.JSX.Element;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { PageHeader, PageHeaderProps };
|
|
16
16
|
//# sourceMappingURL=page-header.d.ts.map
|