@bygghammar/cms-platform 0.90.0-m7.2 → 0.90.0-m7.3
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/package.json +3 -3
- package/src/popups/host.ts +9 -0
- package/src/popups/runtime.tsx +25 -8
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,18 @@ matches `package.json` exactly. See
|
|
|
8
8
|
Versions 0.1.0 through 0.78.0 predate this repository and were reconstructed
|
|
9
9
|
from the published npm tarballs.
|
|
10
10
|
|
|
11
|
+
## 0.90.0-m7.3
|
|
12
|
+
|
|
13
|
+
- Popup exclusions are derived from the configured `backofficePath`, so a site
|
|
14
|
+
that mounts its office at `/admin` or `/cms/backoffice` is covered without
|
|
15
|
+
naming it twice. Both the tree and its landing page are excluded: `/admin/**`
|
|
16
|
+
does not match `/admin`.
|
|
17
|
+
- `registerPopupPublicHost` accepts `excludedPaths` for a site's own private
|
|
18
|
+
routes — a checkout, a members' area. The CMS adds to that list and never
|
|
19
|
+
replaces it, and drops duplicates rather than repeating a path.
|
|
20
|
+
- Requires `@bygghammar/lightweight-popup@>=0.2.0-m7.3`, whose defaults no
|
|
21
|
+
longer name anyone's backoffice.
|
|
22
|
+
|
|
11
23
|
## 0.90.0-m7.2
|
|
12
24
|
|
|
13
25
|
- `backofficePaths` gains `popups` and `popupDestinations`, and both popup
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bygghammar/cms-platform",
|
|
3
|
-
"version": "0.90.0-m7.
|
|
3
|
+
"version": "0.90.0-m7.3",
|
|
4
4
|
"description": "Shared CMS platform: blocks, block types, i18n core, UI primitives and design-token contract used by every Bygghammar/Voyara site.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -263,7 +263,7 @@
|
|
|
263
263
|
"@dnd-kit/sortable": ">=3",
|
|
264
264
|
"@dnd-kit/utilities": ">=3",
|
|
265
265
|
"zod": ">=3",
|
|
266
|
-
"@bygghammar/lightweight-popup": ">=0.2.0-m7.
|
|
266
|
+
"@bygghammar/lightweight-popup": ">=0.2.0-m7.3"
|
|
267
267
|
},
|
|
268
268
|
"peerDependenciesMeta": {
|
|
269
269
|
"@supabase/supabase-js": {
|
|
@@ -328,7 +328,7 @@
|
|
|
328
328
|
"check": "bun run typecheck && bun run test && bun run verify:pack"
|
|
329
329
|
},
|
|
330
330
|
"devDependencies": {
|
|
331
|
-
"@bygghammar/lightweight-popup": "file:./vendor/bygghammar-lightweight-popup-0.2.0-m7.
|
|
331
|
+
"@bygghammar/lightweight-popup": "file:./vendor/bygghammar-lightweight-popup-0.2.0-m7.3.tgz",
|
|
332
332
|
"@dnd-kit/core": "^6.3.1",
|
|
333
333
|
"@dnd-kit/sortable": "^10.0.0",
|
|
334
334
|
"@dnd-kit/utilities": "^3.2.2",
|
package/src/popups/host.ts
CHANGED
|
@@ -19,6 +19,15 @@ import type {
|
|
|
19
19
|
export type PopupPublicHost = {
|
|
20
20
|
readonly configs: PopupConfigRepository;
|
|
21
21
|
readonly analytics: AnalyticsEventRepository;
|
|
22
|
+
/**
|
|
23
|
+
* Paths of the site's own that no popup may appear on.
|
|
24
|
+
*
|
|
25
|
+
* The backoffice is added for every site already, from the configured
|
|
26
|
+
* `backofficePath` — this is for the rest: a checkout, a members' area, a
|
|
27
|
+
* page a site simply wants left alone. Patterns are the popup package's:
|
|
28
|
+
* `/checkout` for one page, `/checkout/**` for everything beneath it.
|
|
29
|
+
*/
|
|
30
|
+
readonly excludedPaths?: readonly string[];
|
|
22
31
|
};
|
|
23
32
|
|
|
24
33
|
/**
|
package/src/popups/runtime.tsx
CHANGED
|
@@ -13,12 +13,16 @@
|
|
|
13
13
|
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
14
14
|
import type { ReactNode } from "react";
|
|
15
15
|
import { useRouterState } from "@tanstack/react-router";
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
PopupRuntime,
|
|
18
|
+
withExcludedBase,
|
|
19
|
+
} from "@bygghammar/lightweight-popup/runtime";
|
|
17
20
|
import type { RuntimeAdapters } from "@bygghammar/lightweight-popup/adapters";
|
|
18
21
|
|
|
19
22
|
import { ManagedForm } from "../forms/FormRenderer";
|
|
20
23
|
import { onFormSubmissionSuccess } from "../forms/success-listeners";
|
|
21
24
|
import { siteConfig } from "../config/site-config";
|
|
25
|
+
import type { PopupPublicHost } from "./host";
|
|
22
26
|
import { popupPublicHost } from "./host";
|
|
23
27
|
|
|
24
28
|
/**
|
|
@@ -52,13 +56,26 @@ function PopupForm({
|
|
|
52
56
|
/**
|
|
53
57
|
* Paths the runtime never displays on.
|
|
54
58
|
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* live preview
|
|
59
|
+
* Three sources, in one list. The site's own exclusions come first and are
|
|
60
|
+
* kept whole — this only ever adds to them. `/preview/**` is the platform's:
|
|
61
|
+
* a popup over the editor's live preview ends up in screenshots. The
|
|
62
|
+
* backoffice comes from the site's configured `backofficePath`, the same
|
|
63
|
+
* value `backofficePaths()` builds every backoffice address from, so a site
|
|
64
|
+
* that mounts its office at `/admin` or `/cms/backoffice` is covered without
|
|
65
|
+
* telling anyone twice.
|
|
66
|
+
*
|
|
67
|
+
* The popup package deliberately excludes nothing by itself. It cannot know
|
|
68
|
+
* which of a site's paths are private, and when it used to guess, every site
|
|
69
|
+
* whose office was named differently got popups over its own admin screens.
|
|
58
70
|
*/
|
|
59
|
-
function
|
|
60
|
-
|
|
61
|
-
|
|
71
|
+
export function popupExcludedPaths(
|
|
72
|
+
host: Pick<PopupPublicHost, "excludedPaths">,
|
|
73
|
+
backofficePath: string,
|
|
74
|
+
): readonly string[] {
|
|
75
|
+
return withExcludedBase(
|
|
76
|
+
[...(host.excludedPaths ?? []), "/preview/**"],
|
|
77
|
+
backofficePath,
|
|
78
|
+
);
|
|
62
79
|
}
|
|
63
80
|
|
|
64
81
|
export function PopupModuleRuntime(): ReactNode {
|
|
@@ -85,7 +102,7 @@ export function PopupModuleRuntime(): ReactNode {
|
|
|
85
102
|
<PopupRuntime
|
|
86
103
|
path={path}
|
|
87
104
|
adapters={adapters}
|
|
88
|
-
excludedPaths={
|
|
105
|
+
excludedPaths={popupExcludedPaths(host, siteConfig().backofficePath)}
|
|
89
106
|
/>
|
|
90
107
|
);
|
|
91
108
|
}
|