@preprio/toolkit 0.5.0-rc.1 → 0.5.0-rc.2
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/README.md +8 -8
- package/dist/astro/index.cjs +1 -1
- package/dist/astro/index.js +1 -1
- package/dist/{chunk-4JNKYIEV.js → chunk-FLPNN3CV.js} +9 -3
- package/dist/index.cjs +9 -3
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +1 -1
- package/dist/nextjs/components.cjs +9 -3
- package/dist/nextjs/components.d.cts +1 -1
- package/dist/nextjs/components.d.ts +1 -1
- package/dist/nextjs/components.js +1 -1
- package/dist/nextjs/index.cjs +1 -1
- package/dist/nextjs/index.d.cts +8 -2
- package/dist/nextjs/index.d.ts +8 -2
- package/dist/nextjs/index.js +1 -1
- package/dist/nuxt/index.cjs +1 -1
- package/dist/nuxt/index.js +1 -1
- package/dist/{pixel-e1fUWl2Y.d.cts → pixel-B3oQNbZ3.d.cts} +8 -2
- package/dist/{pixel-e1fUWl2Y.d.ts → pixel-B3oQNbZ3.d.ts} +8 -2
- package/dist/react/components.cjs +9 -3
- package/dist/react/components.d.cts +8 -2
- package/dist/react/components.d.ts +8 -2
- package/dist/react/components.js +9 -3
- package/dist/sveltekit/index.cjs +1 -1
- package/dist/sveltekit/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -694,14 +694,14 @@ createPreprMiddleware(request, response, { preview });
|
|
|
694
694
|
createPreprPreview({ props, options: { debug: true, locale: 'nl' } });
|
|
695
695
|
```
|
|
696
696
|
|
|
697
|
-
| Option | Type | Default | Description
|
|
698
|
-
| ---------------------- | --------------- | ------------- |
|
|
699
|
-
| `debug` | `boolean` | `false` | Enable debug logging.
|
|
700
|
-
| `locale` | `'en' \| 'nl'` | auto-detected | UI language. Falls back to the first supported browser language, then `en`.
|
|
701
|
-
| `features` | `PreprFeatures` | all enabled | Which features run. See [Feature flags](#feature-flags).
|
|
702
|
-
| `ui` | `boolean` | `true` | Mount the visible toolbar. See [Headless preview](#headless-preview-no-toolbar-ui).
|
|
703
|
-
| `allowedEditorOrigins` | `string[]` | `*.prepr.io` | Exact editor origins allowed to drive this preview, for self-hosted editors. Replaces the wildcard.
|
|
704
|
-
| `autoClean` | `boolean` | `true` | Strip the invisible stega characters from visible text. See [Stega auto-cleaning](#stega-auto-cleaning).
|
|
697
|
+
| Option | Type | Default | Description |
|
|
698
|
+
| ---------------------- | --------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
699
|
+
| `debug` | `boolean` | `false` | Enable debug logging. |
|
|
700
|
+
| `locale` | `'en' \| 'nl'` | auto-detected | UI language. Falls back to the first supported browser language, then `en`. |
|
|
701
|
+
| `features` | `PreprFeatures` | all enabled | Which features run. See [Feature flags](#feature-flags). |
|
|
702
|
+
| `ui` | `boolean` | `true` | Mount the visible toolbar. See [Headless preview](#headless-preview-no-toolbar-ui). |
|
|
703
|
+
| `allowedEditorOrigins` | `string[]` | `*.prepr.io` | Exact editor origins allowed to drive this preview, for self-hosted or local editors. Replaces the wildcard. `['*']` accepts any origin — development only. |
|
|
704
|
+
| `autoClean` | `boolean` | `true` | Strip the invisible stega characters from visible text. See [Stega auto-cleaning](#stega-auto-cleaning). |
|
|
705
705
|
|
|
706
706
|
`features` and `ui` are independent: `features` decides _what runs_, `ui` decides _whether the toolbar is visible_.
|
|
707
707
|
|
package/dist/astro/index.cjs
CHANGED
package/dist/astro/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/version.ts
|
|
2
|
-
var VERSION = "0.5.0-rc.
|
|
2
|
+
var VERSION = "0.5.0-rc.2";
|
|
3
3
|
|
|
4
4
|
// src/core/features.ts
|
|
5
5
|
function isEnabled(config) {
|
|
@@ -2007,7 +2007,10 @@ function t2(key, locale, vars) {
|
|
|
2007
2007
|
var debug8 = createScopedLogger("iframe-bridge");
|
|
2008
2008
|
var EDITOR_BASE_DOMAIN = "prepr.io";
|
|
2009
2009
|
function isAllowedEditorOrigin(origin, allowed) {
|
|
2010
|
-
if (allowed)
|
|
2010
|
+
if (allowed) {
|
|
2011
|
+
if (allowed.includes("*")) return origin !== "null";
|
|
2012
|
+
return allowed.includes(origin);
|
|
2013
|
+
}
|
|
2011
2014
|
let url;
|
|
2012
2015
|
try {
|
|
2013
2016
|
url = new URL(origin);
|
|
@@ -2032,7 +2035,10 @@ function createIframeBridge(store, options = {}) {
|
|
|
2032
2035
|
const onMessage = (evt) => {
|
|
2033
2036
|
const data = evt?.data;
|
|
2034
2037
|
if (data?.event === "prepr:initVE" && !parentOrigin) {
|
|
2035
|
-
if (!isAllowedEditorOrigin(evt.origin, allowedOrigins))
|
|
2038
|
+
if (!isAllowedEditorOrigin(evt.origin, allowedOrigins)) {
|
|
2039
|
+
debug8.warn("ignored editor handshake from origin", evt.origin);
|
|
2040
|
+
return;
|
|
2041
|
+
}
|
|
2036
2042
|
parentOrigin = evt.origin;
|
|
2037
2043
|
setTrustedParentOrigin(parentOrigin);
|
|
2038
2044
|
if (data.scrollPosition != null) {
|
package/dist/index.cjs
CHANGED
|
@@ -44,7 +44,7 @@ __export(src_exports, {
|
|
|
44
44
|
module.exports = __toCommonJS(src_exports);
|
|
45
45
|
|
|
46
46
|
// src/version.ts
|
|
47
|
-
var VERSION = "0.5.0-rc.
|
|
47
|
+
var VERSION = "0.5.0-rc.2";
|
|
48
48
|
|
|
49
49
|
// src/core/features.ts
|
|
50
50
|
function isEnabled(config) {
|
|
@@ -315,7 +315,10 @@ function createElementCache(query, ttl = 1e3) {
|
|
|
315
315
|
var debug = createScopedLogger("iframe-bridge");
|
|
316
316
|
var EDITOR_BASE_DOMAIN = "prepr.io";
|
|
317
317
|
function isAllowedEditorOrigin(origin, allowed) {
|
|
318
|
-
if (allowed)
|
|
318
|
+
if (allowed) {
|
|
319
|
+
if (allowed.includes("*")) return origin !== "null";
|
|
320
|
+
return allowed.includes(origin);
|
|
321
|
+
}
|
|
319
322
|
let url;
|
|
320
323
|
try {
|
|
321
324
|
url = new URL(origin);
|
|
@@ -340,7 +343,10 @@ function createIframeBridge(store, options = {}) {
|
|
|
340
343
|
const onMessage = (evt) => {
|
|
341
344
|
const data = evt?.data;
|
|
342
345
|
if (data?.event === "prepr:initVE" && !parentOrigin) {
|
|
343
|
-
if (!isAllowedEditorOrigin(evt.origin, allowedOrigins))
|
|
346
|
+
if (!isAllowedEditorOrigin(evt.origin, allowedOrigins)) {
|
|
347
|
+
debug.warn("ignored editor handshake from origin", evt.origin);
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
344
350
|
parentOrigin = evt.origin;
|
|
345
351
|
setTrustedParentOrigin(parentOrigin);
|
|
346
352
|
if (data.scrollPosition != null) {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { P as PreprFeatures, R as ResolvedPreprFeatures, L as Locale, a as PreprSegment, b as PreprVariant, c as PreprToolbarProps, d as PreprPreviewOptions, e as PreprErrorCode, f as PreprHeaders } from './pixel-
|
|
2
|
-
export { g as PreprEnvironment, h as PreprEventType, i as PreprFeatureConfig, j as PreprHeaderName, k as PreprPixelConfig, l as PreprToolbarComponentProps, m as PreprToolbarOptions, n as loadTrackingPixel, s as setTrackingParam, t as trackEvent } from './pixel-
|
|
1
|
+
import { P as PreprFeatures, R as ResolvedPreprFeatures, L as Locale, a as PreprSegment, b as PreprVariant, c as PreprToolbarProps, d as PreprPreviewOptions, e as PreprErrorCode, f as PreprHeaders } from './pixel-B3oQNbZ3.cjs';
|
|
2
|
+
export { g as PreprEnvironment, h as PreprEventType, i as PreprFeatureConfig, j as PreprHeaderName, k as PreprPixelConfig, l as PreprToolbarComponentProps, m as PreprToolbarOptions, n as loadTrackingPixel, s as setTrackingParam, t as trackEvent } from './pixel-B3oQNbZ3.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Package version; must match package.json. Lives in its own leaf module so
|
|
6
6
|
* core can import it without cycling through the barrel.
|
|
7
7
|
*/
|
|
8
|
-
declare const VERSION = "0.5.0-rc.
|
|
8
|
+
declare const VERSION = "0.5.0-rc.2";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Resolve a `PreprFeatures` bag to plain booleans, defaulting every omitted key
|
|
@@ -145,7 +145,8 @@ interface ScrollToFieldMessage {
|
|
|
145
145
|
interface IframeBridgeOptions {
|
|
146
146
|
/**
|
|
147
147
|
* Replace the `*.prepr.io` wildcard with an exact origin list. Intended for
|
|
148
|
-
* self-hosted editors; when set, the wildcard no longer applies.
|
|
148
|
+
* self-hosted editors; when set, the wildcard no longer applies. `['*']`
|
|
149
|
+
* accepts any editor origin — see `PreprPreviewOptions.allowedEditorOrigins`.
|
|
149
150
|
*/
|
|
150
151
|
allowedEditorOrigins?: string[];
|
|
151
152
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { P as PreprFeatures, R as ResolvedPreprFeatures, L as Locale, a as PreprSegment, b as PreprVariant, c as PreprToolbarProps, d as PreprPreviewOptions, e as PreprErrorCode, f as PreprHeaders } from './pixel-
|
|
2
|
-
export { g as PreprEnvironment, h as PreprEventType, i as PreprFeatureConfig, j as PreprHeaderName, k as PreprPixelConfig, l as PreprToolbarComponentProps, m as PreprToolbarOptions, n as loadTrackingPixel, s as setTrackingParam, t as trackEvent } from './pixel-
|
|
1
|
+
import { P as PreprFeatures, R as ResolvedPreprFeatures, L as Locale, a as PreprSegment, b as PreprVariant, c as PreprToolbarProps, d as PreprPreviewOptions, e as PreprErrorCode, f as PreprHeaders } from './pixel-B3oQNbZ3.js';
|
|
2
|
+
export { g as PreprEnvironment, h as PreprEventType, i as PreprFeatureConfig, j as PreprHeaderName, k as PreprPixelConfig, l as PreprToolbarComponentProps, m as PreprToolbarOptions, n as loadTrackingPixel, s as setTrackingParam, t as trackEvent } from './pixel-B3oQNbZ3.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Package version; must match package.json. Lives in its own leaf module so
|
|
6
6
|
* core can import it without cycling through the barrel.
|
|
7
7
|
*/
|
|
8
|
-
declare const VERSION = "0.5.0-rc.
|
|
8
|
+
declare const VERSION = "0.5.0-rc.2";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Resolve a `PreprFeatures` bag to plain booleans, defaulting every omitted key
|
|
@@ -145,7 +145,8 @@ interface ScrollToFieldMessage {
|
|
|
145
145
|
interface IframeBridgeOptions {
|
|
146
146
|
/**
|
|
147
147
|
* Replace the `*.prepr.io` wildcard with an exact origin list. Intended for
|
|
148
|
-
* self-hosted editors; when set, the wildcard no longer applies.
|
|
148
|
+
* self-hosted editors; when set, the wildcard no longer applies. `['*']`
|
|
149
|
+
* accepts any editor origin — see `PreprPreviewOptions.allowedEditorOrigins`.
|
|
149
150
|
*/
|
|
150
151
|
allowedEditorOrigins?: string[];
|
|
151
152
|
/**
|
package/dist/index.js
CHANGED
|
@@ -295,7 +295,10 @@ function createElementCache(query, ttl = 1e3) {
|
|
|
295
295
|
var debug = createScopedLogger("iframe-bridge");
|
|
296
296
|
var EDITOR_BASE_DOMAIN = "prepr.io";
|
|
297
297
|
function isAllowedEditorOrigin(origin, allowed) {
|
|
298
|
-
if (allowed)
|
|
298
|
+
if (allowed) {
|
|
299
|
+
if (allowed.includes("*")) return origin !== "null";
|
|
300
|
+
return allowed.includes(origin);
|
|
301
|
+
}
|
|
299
302
|
let url;
|
|
300
303
|
try {
|
|
301
304
|
url = new URL(origin);
|
|
@@ -320,7 +323,10 @@ function createIframeBridge(store, options = {}) {
|
|
|
320
323
|
const onMessage = (evt) => {
|
|
321
324
|
const data = evt?.data;
|
|
322
325
|
if (data?.event === "prepr:initVE" && !parentOrigin) {
|
|
323
|
-
if (!isAllowedEditorOrigin(evt.origin, allowedOrigins))
|
|
326
|
+
if (!isAllowedEditorOrigin(evt.origin, allowedOrigins)) {
|
|
327
|
+
debug.warn("ignored editor handshake from origin", evt.origin);
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
324
330
|
parentOrigin = evt.origin;
|
|
325
331
|
setTrustedParentOrigin(parentOrigin);
|
|
326
332
|
if (data.scrollPosition != null) {
|
|
@@ -2348,7 +2354,7 @@ function createPreprPreview(opts = {}) {
|
|
|
2348
2354
|
var import_react = require("react");
|
|
2349
2355
|
|
|
2350
2356
|
// src/version.ts
|
|
2351
|
-
var VERSION = "0.5.0-rc.
|
|
2357
|
+
var VERSION = "0.5.0-rc.2";
|
|
2352
2358
|
|
|
2353
2359
|
// src/core/pixel.ts
|
|
2354
2360
|
var PIXEL_SCRIPT_URL = "https://cdn.tracking.prepr.io/js/prepr.min.js";
|
package/dist/nextjs/index.cjs
CHANGED
|
@@ -38,7 +38,7 @@ module.exports = __toCommonJS(nextjs_exports);
|
|
|
38
38
|
var import_server = require("next/server");
|
|
39
39
|
|
|
40
40
|
// src/version.ts
|
|
41
|
-
var VERSION = "0.5.0-rc.
|
|
41
|
+
var VERSION = "0.5.0-rc.2";
|
|
42
42
|
|
|
43
43
|
// src/core/constants.ts
|
|
44
44
|
var COOKIE_PREVIEW_MODE = "Prepr-Preview-Mode";
|
package/dist/nextjs/index.d.cts
CHANGED
|
@@ -60,8 +60,14 @@ interface PreprPreviewOptions extends PreprToolbarOptions {
|
|
|
60
60
|
*/
|
|
61
61
|
ui?: boolean;
|
|
62
62
|
/**
|
|
63
|
-
* Replace the `*.prepr.io` editor-origin wildcard with an exact list.
|
|
64
|
-
* Intended for self-hosted
|
|
63
|
+
* Replace the `*.prepr.io` editor-origin wildcard with an exact list, e.g.
|
|
64
|
+
* `['http://acme.localhost:8000']`. Intended for self-hosted or locally run
|
|
65
|
+
* editors; when set, the wildcard no longer applies. Entries are compared to
|
|
66
|
+
* the editor's origin exactly: scheme, host and port.
|
|
67
|
+
*
|
|
68
|
+
* `['*']` accepts any editor origin. Use it for development only: any page
|
|
69
|
+
* that frames the preview can then switch on preview and edit mode and
|
|
70
|
+
* receives the field-edit events, which carry content item ids.
|
|
65
71
|
*/
|
|
66
72
|
allowedEditorOrigins?: string[];
|
|
67
73
|
/**
|
package/dist/nextjs/index.d.ts
CHANGED
|
@@ -60,8 +60,14 @@ interface PreprPreviewOptions extends PreprToolbarOptions {
|
|
|
60
60
|
*/
|
|
61
61
|
ui?: boolean;
|
|
62
62
|
/**
|
|
63
|
-
* Replace the `*.prepr.io` editor-origin wildcard with an exact list.
|
|
64
|
-
* Intended for self-hosted
|
|
63
|
+
* Replace the `*.prepr.io` editor-origin wildcard with an exact list, e.g.
|
|
64
|
+
* `['http://acme.localhost:8000']`. Intended for self-hosted or locally run
|
|
65
|
+
* editors; when set, the wildcard no longer applies. Entries are compared to
|
|
66
|
+
* the editor's origin exactly: scheme, host and port.
|
|
67
|
+
*
|
|
68
|
+
* `['*']` accepts any editor origin. Use it for development only: any page
|
|
69
|
+
* that frames the preview can then switch on preview and edit mode and
|
|
70
|
+
* receives the field-edit events, which carry content item ids.
|
|
65
71
|
*/
|
|
66
72
|
allowedEditorOrigins?: string[];
|
|
67
73
|
/**
|
package/dist/nextjs/index.js
CHANGED
package/dist/nuxt/index.cjs
CHANGED
package/dist/nuxt/index.js
CHANGED
|
@@ -64,8 +64,14 @@ interface PreprPreviewOptions extends PreprToolbarOptions {
|
|
|
64
64
|
*/
|
|
65
65
|
ui?: boolean;
|
|
66
66
|
/**
|
|
67
|
-
* Replace the `*.prepr.io` editor-origin wildcard with an exact list.
|
|
68
|
-
* Intended for self-hosted
|
|
67
|
+
* Replace the `*.prepr.io` editor-origin wildcard with an exact list, e.g.
|
|
68
|
+
* `['http://acme.localhost:8000']`. Intended for self-hosted or locally run
|
|
69
|
+
* editors; when set, the wildcard no longer applies. Entries are compared to
|
|
70
|
+
* the editor's origin exactly: scheme, host and port.
|
|
71
|
+
*
|
|
72
|
+
* `['*']` accepts any editor origin. Use it for development only: any page
|
|
73
|
+
* that frames the preview can then switch on preview and edit mode and
|
|
74
|
+
* receives the field-edit events, which carry content item ids.
|
|
69
75
|
*/
|
|
70
76
|
allowedEditorOrigins?: string[];
|
|
71
77
|
/**
|
|
@@ -64,8 +64,14 @@ interface PreprPreviewOptions extends PreprToolbarOptions {
|
|
|
64
64
|
*/
|
|
65
65
|
ui?: boolean;
|
|
66
66
|
/**
|
|
67
|
-
* Replace the `*.prepr.io` editor-origin wildcard with an exact list.
|
|
68
|
-
* Intended for self-hosted
|
|
67
|
+
* Replace the `*.prepr.io` editor-origin wildcard with an exact list, e.g.
|
|
68
|
+
* `['http://acme.localhost:8000']`. Intended for self-hosted or locally run
|
|
69
|
+
* editors; when set, the wildcard no longer applies. Entries are compared to
|
|
70
|
+
* the editor's origin exactly: scheme, host and port.
|
|
71
|
+
*
|
|
72
|
+
* `['*']` accepts any editor origin. Use it for development only: any page
|
|
73
|
+
* that frames the preview can then switch on preview and edit mode and
|
|
74
|
+
* receives the field-edit events, which carry content item ids.
|
|
69
75
|
*/
|
|
70
76
|
allowedEditorOrigins?: string[];
|
|
71
77
|
/**
|
|
@@ -294,7 +294,10 @@ function createElementCache(query, ttl = 1e3) {
|
|
|
294
294
|
var debug = createScopedLogger("iframe-bridge");
|
|
295
295
|
var EDITOR_BASE_DOMAIN = "prepr.io";
|
|
296
296
|
function isAllowedEditorOrigin(origin, allowed) {
|
|
297
|
-
if (allowed)
|
|
297
|
+
if (allowed) {
|
|
298
|
+
if (allowed.includes("*")) return origin !== "null";
|
|
299
|
+
return allowed.includes(origin);
|
|
300
|
+
}
|
|
298
301
|
let url;
|
|
299
302
|
try {
|
|
300
303
|
url = new URL(origin);
|
|
@@ -319,7 +322,10 @@ function createIframeBridge(store, options = {}) {
|
|
|
319
322
|
const onMessage = (evt) => {
|
|
320
323
|
const data = evt?.data;
|
|
321
324
|
if (data?.event === "prepr:initVE" && !parentOrigin) {
|
|
322
|
-
if (!isAllowedEditorOrigin(evt.origin, allowedOrigins))
|
|
325
|
+
if (!isAllowedEditorOrigin(evt.origin, allowedOrigins)) {
|
|
326
|
+
debug.warn("ignored editor handshake from origin", evt.origin);
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
323
329
|
parentOrigin = evt.origin;
|
|
324
330
|
setTrustedParentOrigin(parentOrigin);
|
|
325
331
|
if (data.scrollPosition != null) {
|
|
@@ -2344,7 +2350,7 @@ function createPreprPreview(opts = {}) {
|
|
|
2344
2350
|
}
|
|
2345
2351
|
|
|
2346
2352
|
// src/version.ts
|
|
2347
|
-
var VERSION = "0.5.0-rc.
|
|
2353
|
+
var VERSION = "0.5.0-rc.2";
|
|
2348
2354
|
|
|
2349
2355
|
// src/core/pixel.ts
|
|
2350
2356
|
var PIXEL_SCRIPT_URL = "https://cdn.tracking.prepr.io/js/prepr.min.js";
|
|
@@ -58,8 +58,14 @@ interface PreprPreviewOptions extends PreprToolbarOptions {
|
|
|
58
58
|
*/
|
|
59
59
|
ui?: boolean;
|
|
60
60
|
/**
|
|
61
|
-
* Replace the `*.prepr.io` editor-origin wildcard with an exact list.
|
|
62
|
-
* Intended for self-hosted
|
|
61
|
+
* Replace the `*.prepr.io` editor-origin wildcard with an exact list, e.g.
|
|
62
|
+
* `['http://acme.localhost:8000']`. Intended for self-hosted or locally run
|
|
63
|
+
* editors; when set, the wildcard no longer applies. Entries are compared to
|
|
64
|
+
* the editor's origin exactly: scheme, host and port.
|
|
65
|
+
*
|
|
66
|
+
* `['*']` accepts any editor origin. Use it for development only: any page
|
|
67
|
+
* that frames the preview can then switch on preview and edit mode and
|
|
68
|
+
* receives the field-edit events, which carry content item ids.
|
|
63
69
|
*/
|
|
64
70
|
allowedEditorOrigins?: string[];
|
|
65
71
|
/**
|
|
@@ -58,8 +58,14 @@ interface PreprPreviewOptions extends PreprToolbarOptions {
|
|
|
58
58
|
*/
|
|
59
59
|
ui?: boolean;
|
|
60
60
|
/**
|
|
61
|
-
* Replace the `*.prepr.io` editor-origin wildcard with an exact list.
|
|
62
|
-
* Intended for self-hosted
|
|
61
|
+
* Replace the `*.prepr.io` editor-origin wildcard with an exact list, e.g.
|
|
62
|
+
* `['http://acme.localhost:8000']`. Intended for self-hosted or locally run
|
|
63
|
+
* editors; when set, the wildcard no longer applies. Entries are compared to
|
|
64
|
+
* the editor's origin exactly: scheme, host and port.
|
|
65
|
+
*
|
|
66
|
+
* `['*']` accepts any editor origin. Use it for development only: any page
|
|
67
|
+
* that frames the preview can then switch on preview and edit mode and
|
|
68
|
+
* receives the field-edit events, which carry content item ids.
|
|
63
69
|
*/
|
|
64
70
|
allowedEditorOrigins?: string[];
|
|
65
71
|
/**
|
package/dist/react/components.js
CHANGED
|
@@ -270,7 +270,10 @@ function createElementCache(query, ttl = 1e3) {
|
|
|
270
270
|
var debug = createScopedLogger("iframe-bridge");
|
|
271
271
|
var EDITOR_BASE_DOMAIN = "prepr.io";
|
|
272
272
|
function isAllowedEditorOrigin(origin, allowed) {
|
|
273
|
-
if (allowed)
|
|
273
|
+
if (allowed) {
|
|
274
|
+
if (allowed.includes("*")) return origin !== "null";
|
|
275
|
+
return allowed.includes(origin);
|
|
276
|
+
}
|
|
274
277
|
let url;
|
|
275
278
|
try {
|
|
276
279
|
url = new URL(origin);
|
|
@@ -295,7 +298,10 @@ function createIframeBridge(store, options = {}) {
|
|
|
295
298
|
const onMessage = (evt) => {
|
|
296
299
|
const data = evt?.data;
|
|
297
300
|
if (data?.event === "prepr:initVE" && !parentOrigin) {
|
|
298
|
-
if (!isAllowedEditorOrigin(evt.origin, allowedOrigins))
|
|
301
|
+
if (!isAllowedEditorOrigin(evt.origin, allowedOrigins)) {
|
|
302
|
+
debug.warn("ignored editor handshake from origin", evt.origin);
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
299
305
|
parentOrigin = evt.origin;
|
|
300
306
|
setTrustedParentOrigin(parentOrigin);
|
|
301
307
|
if (data.scrollPosition != null) {
|
|
@@ -2320,7 +2326,7 @@ function createPreprPreview(opts = {}) {
|
|
|
2320
2326
|
}
|
|
2321
2327
|
|
|
2322
2328
|
// src/version.ts
|
|
2323
|
-
var VERSION = "0.5.0-rc.
|
|
2329
|
+
var VERSION = "0.5.0-rc.2";
|
|
2324
2330
|
|
|
2325
2331
|
// src/core/pixel.ts
|
|
2326
2332
|
var PIXEL_SCRIPT_URL = "https://cdn.tracking.prepr.io/js/prepr.min.js";
|
package/dist/sveltekit/index.cjs
CHANGED
package/dist/sveltekit/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@preprio/toolkit",
|
|
3
|
-
"version": "0.5.0-rc.
|
|
3
|
+
"version": "0.5.0-rc.2",
|
|
4
4
|
"description": "Prepr personalization, A/B testing and preview toolkit for React, Next.js, Nuxt, Astro, SvelteKit and Express",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Prepr B.V. (https://prepr.io)",
|