@roottale/cms-renderer-next 0.61.1 → 0.62.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/CHANGELOG.md +12 -0
- package/dist/chunk-L3I4W5NP.js +16 -0
- package/dist/chunk-L3I4W5NP.js.map +1 -0
- package/dist/chunk-SEPUIKVM.js +922 -0
- package/dist/chunk-SEPUIKVM.js.map +1 -0
- package/dist/chunk-UIBT23RJ.js +3 -0
- package/dist/chunk-UIBT23RJ.js.map +1 -0
- package/dist/cms-public.css +111 -13
- package/dist/exposure-client.d.ts +4 -9
- package/dist/exposure-client.js +5 -3
- package/dist/exposures.d.ts +51 -0
- package/dist/exposures.js +17 -0
- package/dist/exposures.js.map +1 -0
- package/dist/routes.d.ts +20 -1
- package/dist/routes.js +41 -2
- package/dist/routes.js.map +1 -1
- package/dist/server.js +6 -4
- package/dist/server.js.map +1 -1
- package/package.json +11 -4
- package/dist/chunk-GVKENK6H.js +0 -75
- package/dist/chunk-GVKENK6H.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roottale/cms-renderer-next",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.62.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "RootTale CMS public-render React/Next.js Server Components. SSR-only RSC components (RootTaleBlogList / RootTaleBlogPost / RootTaleLeadForm) for external customer sites.",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,6 +24,11 @@
|
|
|
24
24
|
"import": "./dist/routes.js",
|
|
25
25
|
"default": "./dist/routes.js"
|
|
26
26
|
},
|
|
27
|
+
"./exposures": {
|
|
28
|
+
"types": "./dist/exposures.d.ts",
|
|
29
|
+
"import": "./dist/exposures.js",
|
|
30
|
+
"default": "./dist/exposures.js"
|
|
31
|
+
},
|
|
27
32
|
"./mui": {
|
|
28
33
|
"types": "./dist/mui.d.ts",
|
|
29
34
|
"import": "./dist/mui.js",
|
|
@@ -48,17 +53,19 @@
|
|
|
48
53
|
"CHANGELOG.md"
|
|
49
54
|
],
|
|
50
55
|
"dependencies": {
|
|
51
|
-
"@roottale/cms-client": "^0.
|
|
52
|
-
"@roottale/cms-core": "^0.
|
|
56
|
+
"@roottale/cms-client": "^0.62.0",
|
|
57
|
+
"@roottale/cms-core": "^0.62.0"
|
|
53
58
|
},
|
|
54
59
|
"peerDependencies": {
|
|
55
|
-
"react": "^19.0.0"
|
|
60
|
+
"react": "^19.0.0",
|
|
61
|
+
"react-dom": "^19.0.0"
|
|
56
62
|
},
|
|
57
63
|
"devDependencies": {
|
|
58
64
|
"@types/node": "^22.0.0",
|
|
59
65
|
"@types/react": "^19.0.0",
|
|
60
66
|
"@types/react-dom": "^19.0.0",
|
|
61
67
|
"esbuild-plugin-preserve-directives": "^0.0.11",
|
|
68
|
+
"jsdom": "^29.1.1",
|
|
62
69
|
"react": "^19.0.0",
|
|
63
70
|
"react-dom": "^19.0.0",
|
|
64
71
|
"typescript": "^5.7.0",
|
package/dist/chunk-GVKENK6H.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/exposure-client.tsx
|
|
4
|
-
import { useEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
function storageKey(campaign) {
|
|
7
|
-
return `rt-exposure-dismissed:${campaign.id}`;
|
|
8
|
-
}
|
|
9
|
-
function wasDismissed(campaign) {
|
|
10
|
-
if (campaign.repeat === "always") return false;
|
|
11
|
-
try {
|
|
12
|
-
const storage = campaign.repeat === "session" ? sessionStorage : localStorage;
|
|
13
|
-
const value = storage.getItem(storageKey(campaign));
|
|
14
|
-
if (!value) return false;
|
|
15
|
-
if (campaign.repeat === "day") return Date.now() - Number(value) < 864e5;
|
|
16
|
-
return true;
|
|
17
|
-
} catch {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function rememberDismissal(campaign) {
|
|
22
|
-
if (campaign.repeat === "always") return;
|
|
23
|
-
try {
|
|
24
|
-
const storage = campaign.repeat === "session" ? sessionStorage : localStorage;
|
|
25
|
-
storage.setItem(storageKey(campaign), String(Date.now()));
|
|
26
|
-
} catch {
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
function RootTaleExposure({
|
|
30
|
-
campaign,
|
|
31
|
-
allowedVariants
|
|
32
|
-
}) {
|
|
33
|
-
const [dismissed, setDismissed] = useState(false);
|
|
34
|
-
const closeRef = useRef(null);
|
|
35
|
-
const knownVariant = allowedVariants.includes(campaign.content.variant);
|
|
36
|
-
const eligible = useSyncExternalStore(
|
|
37
|
-
() => () => void 0,
|
|
38
|
-
() => !wasDismissed(campaign),
|
|
39
|
-
() => false
|
|
40
|
-
);
|
|
41
|
-
const visible = knownVariant && eligible && !dismissed;
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
if (!visible || campaign.kind !== "popup") return;
|
|
44
|
-
closeRef.current?.focus();
|
|
45
|
-
const onKeyDown = (event) => {
|
|
46
|
-
if (event.key === "Escape") dismiss();
|
|
47
|
-
};
|
|
48
|
-
window.addEventListener("keydown", onKeyDown);
|
|
49
|
-
return () => window.removeEventListener("keydown", onKeyDown);
|
|
50
|
-
});
|
|
51
|
-
function dismiss() {
|
|
52
|
-
rememberDismissal(campaign);
|
|
53
|
-
setDismissed(true);
|
|
54
|
-
}
|
|
55
|
-
if (!knownVariant || !visible) return null;
|
|
56
|
-
const body = /* @__PURE__ */ jsxs("div", { className: "rt-exposure__body", children: [
|
|
57
|
-
campaign.content.assetUrl ? /* @__PURE__ */ jsx("img", { className: "rt-exposure__asset", src: campaign.content.assetUrl, alt: campaign.content.assetAlt ?? "" }) : null,
|
|
58
|
-
/* @__PURE__ */ jsxs("div", { className: "rt-exposure__copy", children: [
|
|
59
|
-
campaign.content.eyebrow ? /* @__PURE__ */ jsx("p", { className: "rt-exposure__eyebrow", children: campaign.content.eyebrow }) : null,
|
|
60
|
-
/* @__PURE__ */ jsx("h2", { className: "rt-exposure__title", children: campaign.content.title }),
|
|
61
|
-
campaign.content.description ? /* @__PURE__ */ jsx("p", { className: "rt-exposure__description", children: campaign.content.description }) : null,
|
|
62
|
-
campaign.content.linkUrl && campaign.content.linkLabel ? /* @__PURE__ */ jsx("a", { className: "rt-exposure__link", href: campaign.content.linkUrl, children: campaign.content.linkLabel }) : null
|
|
63
|
-
] }),
|
|
64
|
-
/* @__PURE__ */ jsx("button", { ref: closeRef, type: "button", className: "rt-exposure__close", "aria-label": "\uB2EB\uAE30", onClick: dismiss, children: "\xD7" })
|
|
65
|
-
] });
|
|
66
|
-
if (campaign.kind === "banner") {
|
|
67
|
-
return /* @__PURE__ */ jsx("aside", { className: `rt-exposure rt-exposure--banner rt-exposure--${campaign.content.variant}`, "aria-label": "\uC548\uB0B4", children: body });
|
|
68
|
-
}
|
|
69
|
-
return /* @__PURE__ */ jsx("div", { className: "rt-exposure-backdrop", role: "presentation", children: /* @__PURE__ */ jsx("section", { className: `rt-exposure rt-exposure--popup rt-exposure--${campaign.content.variant}`, role: "dialog", "aria-modal": "true", "aria-label": campaign.content.title, children: body }) });
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export {
|
|
73
|
-
RootTaleExposure
|
|
74
|
-
};
|
|
75
|
-
//# sourceMappingURL=chunk-GVKENK6H.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/exposure-client.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState, useSyncExternalStore } from \"react\";\n\nimport type { CmsExposureCampaign } from \"@roottale/cms-client/server\";\n\nfunction storageKey(campaign: CmsExposureCampaign): string {\n return `rt-exposure-dismissed:${campaign.id}`;\n}\n\nfunction wasDismissed(campaign: CmsExposureCampaign): boolean {\n if (campaign.repeat === \"always\") return false;\n try {\n const storage = campaign.repeat === \"session\" ? sessionStorage : localStorage;\n const value = storage.getItem(storageKey(campaign));\n if (!value) return false;\n if (campaign.repeat === \"day\") return Date.now() - Number(value) < 86_400_000;\n return true;\n } catch {\n return false;\n }\n}\n\nfunction rememberDismissal(campaign: CmsExposureCampaign): void {\n if (campaign.repeat === \"always\") return;\n try {\n const storage = campaign.repeat === \"session\" ? sessionStorage : localStorage;\n storage.setItem(storageKey(campaign), String(Date.now()));\n } catch {\n // 저장소 차단 환경에서는 현재 화면에서만 닫는다.\n }\n}\n\nexport function RootTaleExposure({\n campaign,\n allowedVariants,\n}: {\n readonly campaign: CmsExposureCampaign;\n readonly allowedVariants: readonly string[];\n}) {\n const [dismissed, setDismissed] = useState(false);\n const closeRef = useRef<HTMLButtonElement>(null);\n const knownVariant = allowedVariants.includes(campaign.content.variant);\n const eligible = useSyncExternalStore(\n () => () => undefined,\n () => !wasDismissed(campaign),\n () => false,\n );\n const visible = knownVariant && eligible && !dismissed;\n\n useEffect(() => {\n if (!visible || campaign.kind !== \"popup\") return;\n closeRef.current?.focus();\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") dismiss();\n };\n window.addEventListener(\"keydown\", onKeyDown);\n return () => window.removeEventListener(\"keydown\", onKeyDown);\n });\n\n function dismiss() {\n rememberDismissal(campaign);\n setDismissed(true);\n }\n\n if (!knownVariant || !visible) return null;\n const body = <div className=\"rt-exposure__body\">\n {campaign.content.assetUrl ? <img className=\"rt-exposure__asset\" src={campaign.content.assetUrl} alt={campaign.content.assetAlt ?? \"\"} /> : null}\n <div className=\"rt-exposure__copy\">\n {campaign.content.eyebrow ? <p className=\"rt-exposure__eyebrow\">{campaign.content.eyebrow}</p> : null}\n <h2 className=\"rt-exposure__title\">{campaign.content.title}</h2>\n {campaign.content.description ? <p className=\"rt-exposure__description\">{campaign.content.description}</p> : null}\n {campaign.content.linkUrl && campaign.content.linkLabel ? <a className=\"rt-exposure__link\" href={campaign.content.linkUrl}>{campaign.content.linkLabel}</a> : null}\n </div>\n <button ref={closeRef} type=\"button\" className=\"rt-exposure__close\" aria-label=\"닫기\" onClick={dismiss}>×</button>\n </div>;\n\n if (campaign.kind === \"banner\") {\n return <aside className={`rt-exposure rt-exposure--banner rt-exposure--${campaign.content.variant}`} aria-label=\"안내\">{body}</aside>;\n }\n return <div className=\"rt-exposure-backdrop\" role=\"presentation\">\n <section className={`rt-exposure rt-exposure--popup rt-exposure--${campaign.content.variant}`} role=\"dialog\" aria-modal=\"true\" aria-label={campaign.content.title}>\n {body}\n </section>\n </div>;\n}\n"],"mappings":";AAEA,SAAS,WAAW,QAAQ,UAAU,4BAA4B;AAiEjC,cAC7B,YAD6B;AA7DjC,SAAS,WAAW,UAAuC;AACzD,SAAO,yBAAyB,SAAS,EAAE;AAC7C;AAEA,SAAS,aAAa,UAAwC;AAC5D,MAAI,SAAS,WAAW,SAAU,QAAO;AACzC,MAAI;AACF,UAAM,UAAU,SAAS,WAAW,YAAY,iBAAiB;AACjE,UAAM,QAAQ,QAAQ,QAAQ,WAAW,QAAQ,CAAC;AAClD,QAAI,CAAC,MAAO,QAAO;AACnB,QAAI,SAAS,WAAW,MAAO,QAAO,KAAK,IAAI,IAAI,OAAO,KAAK,IAAI;AACnE,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,SAAS,kBAAkB,UAAqC;AAC9D,MAAI,SAAS,WAAW,SAAU;AAClC,MAAI;AACF,UAAM,UAAU,SAAS,WAAW,YAAY,iBAAiB;AACjE,YAAQ,QAAQ,WAAW,QAAQ,GAAG,OAAO,KAAK,IAAI,CAAC,CAAC;AAAA,EAC1D,QAAQ;AAAA,EAER;AACF;AAEO,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA;AACF,GAGG;AACD,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAChD,QAAM,WAAW,OAA0B,IAAI;AAC/C,QAAM,eAAe,gBAAgB,SAAS,SAAS,QAAQ,OAAO;AACtE,QAAM,WAAW;AAAA,IACf,MAAM,MAAM;AAA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