@contentful/live-preview
Advanced tools
Comparing version 2.1.0 to 2.1.1
import { Entity } from '../types'; | ||
export declare function logUnrecognizedFields(contentTypeFields: string[], data: Entity): void; | ||
export declare function buildCollectionName(name: string): string; |
@@ -12,3 +12,3 @@ import { InspectorMode } from './inspectorMode'; | ||
data: Argument; | ||
locale: string; | ||
locale?: string; | ||
callback: SubscribeCallback; | ||
@@ -23,3 +23,3 @@ } | ||
static locale: string; | ||
static init({ locale, debugMode, enableInspectorMode, enableLiveUpdates, }: ContentfulLivePreviewInitConfig): Promise<InspectorMode | null> | undefined; | ||
static init(config: ContentfulLivePreviewInitConfig): Promise<InspectorMode | null> | undefined; | ||
static subscribe(config: Subscription): VoidFunction; | ||
@@ -26,0 +26,0 @@ static getProps({ fieldId, entryId, locale }: LivePreviewProps): InspectorModeTags; |
@@ -1,2 +0,2 @@ | ||
import { C as r } from "./index-524cd730.js"; | ||
import { C as r } from "./index-14f5bbee.js"; | ||
export { | ||
@@ -3,0 +3,0 @@ r as ContentfulLivePreview |
export declare class InspectorMode { | ||
private tooltip; | ||
private currentElementBesideTooltip; | ||
constructor(); | ||
private defaultLocale; | ||
constructor({ locale }: { | ||
locale: string; | ||
}); | ||
receiveMessage(data: Record<string, unknown>): void; | ||
@@ -6,0 +9,0 @@ private updateTooltipPosition; |
@@ -9,3 +9,6 @@ import { ContentfulSubscribeConfig } from '.'; | ||
private storage; | ||
constructor(); | ||
private defaultLocale; | ||
constructor({ locale }: { | ||
locale: string; | ||
}); | ||
private mergeEntity; | ||
@@ -12,0 +15,0 @@ /** |
@@ -17,5 +17,5 @@ import { type PropsWithChildren, type ReactElement } from 'react'; | ||
type GetInspectorModeProps<T> = (props: { | ||
[K in Exclude<keyof Pick<LivePreviewProps, 'entryId' | 'fieldId'>, keyof T>]: LivePreviewProps[K]; | ||
[K in Exclude<keyof LivePreviewProps, keyof T | 'locale'>]: LivePreviewProps[K]; | ||
} & { | ||
locale?: string; | ||
locale?: LivePreviewProps['locale']; | ||
}) => InspectorModeTags; | ||
@@ -22,0 +22,0 @@ /** |
@@ -1,4 +0,4 @@ | ||
import * as U from "react"; | ||
import ke, { createContext as gr, useMemo as De, useState as hr, useRef as Oe, useContext as Ae, useCallback as yr } from "react"; | ||
import { C as Q, d as mr } from "./index-524cd730.js"; | ||
import * as V from "react"; | ||
import ke, { createContext as hr, useMemo as De, useState as gr, useRef as Pe, useContext as Ae, useCallback as yr } from "react"; | ||
import { C as Q, d as mr } from "./index-14f5bbee.js"; | ||
var Z = { exports: {} }, F = {}; | ||
@@ -14,19 +14,19 @@ /** | ||
*/ | ||
var Pe; | ||
var Oe; | ||
function Er() { | ||
if (Pe) | ||
if (Oe) | ||
return F; | ||
Pe = 1; | ||
var n = ke, a = Symbol.for("react.element"), s = Symbol.for("react.fragment"), u = Object.prototype.hasOwnProperty, v = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, _ = { key: !0, ref: !0, __self: !0, __source: !0 }; | ||
function O(R, g, w) { | ||
var h, b = {}, P = null, W = null; | ||
w !== void 0 && (P = "" + w), g.key !== void 0 && (P = "" + g.key), g.ref !== void 0 && (W = g.ref); | ||
for (h in g) | ||
u.call(g, h) && !_.hasOwnProperty(h) && (b[h] = g[h]); | ||
Oe = 1; | ||
var n = ke, a = Symbol.for("react.element"), s = Symbol.for("react.fragment"), o = Object.prototype.hasOwnProperty, v = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, _ = { key: !0, ref: !0, __self: !0, __source: !0 }; | ||
function P(R, h, T) { | ||
var g, b = {}, O = null, W = null; | ||
T !== void 0 && (O = "" + T), h.key !== void 0 && (O = "" + h.key), h.ref !== void 0 && (W = h.ref); | ||
for (g in h) | ||
o.call(h, g) && !_.hasOwnProperty(g) && (b[g] = h[g]); | ||
if (R && R.defaultProps) | ||
for (h in g = R.defaultProps, g) | ||
b[h] === void 0 && (b[h] = g[h]); | ||
return { $$typeof: a, type: R, key: P, ref: W, props: b, _owner: v.current }; | ||
for (g in h = R.defaultProps, h) | ||
b[g] === void 0 && (b[g] = h[g]); | ||
return { $$typeof: a, type: R, key: O, ref: W, props: b, _owner: v.current }; | ||
} | ||
return F.Fragment = s, F.jsx = O, F.jsxs = O, F; | ||
return F.Fragment = s, F.jsx = P, F.jsxs = P, F; | ||
} | ||
@@ -46,3 +46,3 @@ var I = {}; | ||
return Se || (Se = 1, process.env.NODE_ENV !== "production" && function() { | ||
var n = ke, a = Symbol.for("react.element"), s = Symbol.for("react.portal"), u = Symbol.for("react.fragment"), v = Symbol.for("react.strict_mode"), _ = Symbol.for("react.profiler"), O = Symbol.for("react.provider"), R = Symbol.for("react.context"), g = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), h = Symbol.for("react.suspense_list"), b = Symbol.for("react.memo"), P = Symbol.for("react.lazy"), W = Symbol.for("react.offscreen"), re = Symbol.iterator, Fe = "@@iterator"; | ||
var n = ke, a = Symbol.for("react.element"), s = Symbol.for("react.portal"), o = Symbol.for("react.fragment"), v = Symbol.for("react.strict_mode"), _ = Symbol.for("react.profiler"), P = Symbol.for("react.provider"), R = Symbol.for("react.context"), h = Symbol.for("react.forward_ref"), T = Symbol.for("react.suspense"), g = Symbol.for("react.suspense_list"), b = Symbol.for("react.memo"), O = Symbol.for("react.lazy"), W = Symbol.for("react.offscreen"), re = Symbol.iterator, Fe = "@@iterator"; | ||
function Ie(e) { | ||
@@ -74,4 +74,4 @@ if (e === null || typeof e != "object") | ||
te = Symbol.for("react.module.reference"); | ||
function Ve(e) { | ||
return !!(typeof e == "string" || typeof e == "function" || e === u || e === _ || Ne || e === v || e === w || e === h || Me || e === W || We || Ye || $e || typeof e == "object" && e !== null && (e.$$typeof === P || e.$$typeof === b || e.$$typeof === O || e.$$typeof === R || e.$$typeof === g || // This needs to include all possible module reference object | ||
function Ue(e) { | ||
return !!(typeof e == "string" || typeof e == "function" || e === o || e === _ || Ne || e === v || e === T || e === g || Me || e === W || We || Ye || $e || typeof e == "object" && e !== null && (e.$$typeof === O || e.$$typeof === b || e.$$typeof === P || e.$$typeof === R || e.$$typeof === h || // This needs to include all possible module reference object | ||
// types supported by any Flight configuration anywhere since | ||
@@ -82,3 +82,3 @@ // we don't know which Flight build this will end up being used | ||
} | ||
function Ue(e, r, t) { | ||
function Ve(e, r, t) { | ||
var i = e.displayName; | ||
@@ -101,3 +101,3 @@ if (i) | ||
switch (e) { | ||
case u: | ||
case o: | ||
return "Fragment"; | ||
@@ -110,5 +110,5 @@ case s: | ||
return "StrictMode"; | ||
case w: | ||
case T: | ||
return "Suspense"; | ||
case h: | ||
case g: | ||
return "SuspenseList"; | ||
@@ -121,11 +121,11 @@ } | ||
return ne(r) + ".Consumer"; | ||
case O: | ||
case P: | ||
var t = e; | ||
return ne(t._context) + ".Provider"; | ||
case g: | ||
return Ue(e, e.render, "ForwardRef"); | ||
case h: | ||
return Ve(e, e.render, "ForwardRef"); | ||
case b: | ||
var i = e.displayName || null; | ||
return i !== null ? i : C(e.type) || "Memo"; | ||
case P: { | ||
case O: { | ||
var l = e, c = l._payload, f = l._init; | ||
@@ -141,3 +141,3 @@ try { | ||
} | ||
var S = Object.assign, D = 0, ae, ie, ue, oe, se, fe, le; | ||
var S = Object.assign, D = 0, ae, ie, oe, ue, se, fe, le; | ||
function ce() { | ||
@@ -149,3 +149,3 @@ } | ||
if (D === 0) { | ||
ae = console.log, ie = console.info, ue = console.warn, oe = console.error, se = console.group, fe = console.groupCollapsed, le = console.groupEnd; | ||
ae = console.log, ie = console.info, oe = console.warn, ue = console.error, se = console.group, fe = console.groupCollapsed, le = console.groupEnd; | ||
var e = { | ||
@@ -186,6 +186,6 @@ configurable: !0, | ||
warn: S({}, e, { | ||
value: ue | ||
value: oe | ||
}), | ||
error: S({}, e, { | ||
value: oe | ||
value: ue | ||
}), | ||
@@ -251,4 +251,4 @@ group: S({}, e, { | ||
Reflect.construct(f, []); | ||
} catch (T) { | ||
i = T; | ||
} catch (w) { | ||
i = w; | ||
} | ||
@@ -259,4 +259,4 @@ Reflect.construct(e, [], f); | ||
f.call(); | ||
} catch (T) { | ||
i = T; | ||
} catch (w) { | ||
i = w; | ||
} | ||
@@ -268,20 +268,20 @@ e.call(f.prototype); | ||
throw Error(); | ||
} catch (T) { | ||
i = T; | ||
} catch (w) { | ||
i = w; | ||
} | ||
e(); | ||
} | ||
} catch (T) { | ||
if (T && i && typeof T.stack == "string") { | ||
for (var o = T.stack.split(` | ||
} catch (w) { | ||
if (w && i && typeof w.stack == "string") { | ||
for (var u = w.stack.split(` | ||
`), m = i.stack.split(` | ||
`), d = o.length - 1, p = m.length - 1; d >= 1 && p >= 0 && o[d] !== m[p]; ) | ||
`), d = u.length - 1, p = m.length - 1; d >= 1 && p >= 0 && u[d] !== m[p]; ) | ||
p--; | ||
for (; d >= 1 && p >= 0; d--, p--) | ||
if (o[d] !== m[p]) { | ||
if (u[d] !== m[p]) { | ||
if (d !== 1 || p !== 1) | ||
do | ||
if (d--, p--, p < 0 || o[d] !== m[p]) { | ||
if (d--, p--, p < 0 || u[d] !== m[p]) { | ||
var E = ` | ||
` + o[d].replace(" at new ", " at "); | ||
` + u[d].replace(" at new ", " at "); | ||
return e.displayName && E.includes("<anonymous>") && (E = E.replace("<anonymous>", e.displayName)), typeof e == "function" && $.set(e, E), E; | ||
@@ -296,4 +296,4 @@ } | ||
} | ||
var k = e ? e.displayName || e.name : "", we = k ? Y(k) : ""; | ||
return typeof e == "function" && $.set(e, we), we; | ||
var k = e ? e.displayName || e.name : "", Te = k ? Y(k) : ""; | ||
return typeof e == "function" && $.set(e, Te), Te; | ||
} | ||
@@ -315,5 +315,5 @@ function Je(e, r, t) { | ||
switch (e) { | ||
case w: | ||
case T: | ||
return Y("Suspense"); | ||
case h: | ||
case g: | ||
return Y("SuspenseList"); | ||
@@ -323,7 +323,7 @@ } | ||
switch (e.$$typeof) { | ||
case g: | ||
case h: | ||
return Je(e.render); | ||
case b: | ||
return M(e.type, r, t); | ||
case P: { | ||
case O: { | ||
var i = e, l = i._payload, c = i._init; | ||
@@ -339,3 +339,3 @@ try { | ||
var N = Object.prototype.hasOwnProperty, de = {}, pe = j.ReactDebugCurrentFrame; | ||
function V(e) { | ||
function U(e) { | ||
if (e) { | ||
@@ -352,3 +352,3 @@ var r = e._owner, t = M(e.type, e._source, r ? r.type : null); | ||
if (c(e, f)) { | ||
var o = void 0; | ||
var u = void 0; | ||
try { | ||
@@ -359,7 +359,7 @@ if (typeof e[f] != "function") { | ||
} | ||
o = e[f](r, f, i, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); | ||
u = e[f](r, f, i, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); | ||
} catch (d) { | ||
o = d; | ||
u = d; | ||
} | ||
o && !(o instanceof Error) && (V(l), y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", i || "React class", t, f, typeof o), V(null)), o instanceof Error && !(o.message in de) && (de[o.message] = !0, V(l), y("Failed %s type: %s", t, o.message), V(null)); | ||
u && !(u instanceof Error) && (U(l), y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", i || "React class", t, f, typeof u), U(null)), u instanceof Error && !(u.message in de) && (de[u.message] = !0, U(l), y("Failed %s type: %s", t, u.message), U(null)); | ||
} | ||
@@ -380,3 +380,3 @@ } | ||
try { | ||
return ge(e), !1; | ||
return he(e), !1; | ||
} catch { | ||
@@ -386,8 +386,8 @@ return !0; | ||
} | ||
function ge(e) { | ||
function he(e) { | ||
return "" + e; | ||
} | ||
function he(e) { | ||
function ge(e) { | ||
if (Ze(e)) | ||
return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Xe(e)), ge(e); | ||
return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Xe(e)), he(e); | ||
} | ||
@@ -446,3 +446,3 @@ var A = j.ReactCurrentOwner, Qe = { | ||
var ir = function(e, r, t, i, l, c, f) { | ||
var o = { | ||
var u = { | ||
// This tag allows us to uniquely identify this as a React Element | ||
@@ -458,3 +458,3 @@ $$typeof: a, | ||
}; | ||
return o._store = {}, Object.defineProperty(o._store, "validated", { | ||
return u._store = {}, Object.defineProperty(u._store, "validated", { | ||
configurable: !1, | ||
@@ -464,3 +464,3 @@ enumerable: !1, | ||
value: !1 | ||
}), Object.defineProperty(o, "_self", { | ||
}), Object.defineProperty(u, "_self", { | ||
configurable: !1, | ||
@@ -470,3 +470,3 @@ enumerable: !1, | ||
value: i | ||
}), Object.defineProperty(o, "_source", { | ||
}), Object.defineProperty(u, "_source", { | ||
configurable: !1, | ||
@@ -476,8 +476,8 @@ enumerable: !1, | ||
value: l | ||
}), Object.freeze && (Object.freeze(o.props), Object.freeze(o)), o; | ||
}), Object.freeze && (Object.freeze(u.props), Object.freeze(u)), u; | ||
}; | ||
function ur(e, r, t, i, l) { | ||
function or(e, r, t, i, l) { | ||
{ | ||
var c, f = {}, o = null, m = null; | ||
t !== void 0 && (he(t), o = "" + t), rr(r) && (he(r.key), o = "" + r.key), er(r) && (m = r.ref, tr(r, l)); | ||
var c, f = {}, u = null, m = null; | ||
t !== void 0 && (ge(t), u = "" + t), rr(r) && (ge(r.key), u = "" + r.key), er(r) && (m = r.ref, tr(r, l)); | ||
for (c in r) | ||
@@ -490,7 +490,7 @@ N.call(r, c) && !Qe.hasOwnProperty(c) && (f[c] = r[c]); | ||
} | ||
if (o || m) { | ||
if (u || m) { | ||
var p = typeof e == "function" ? e.displayName || e.name || "Unknown" : e; | ||
o && nr(f, p), m && ar(f, p); | ||
u && nr(f, p), m && ar(f, p); | ||
} | ||
return ir(e, o, m, l, i, A.current, f); | ||
return ir(e, u, m, l, i, A.current, f); | ||
} | ||
@@ -523,3 +523,3 @@ } | ||
} | ||
function or(e) { | ||
function ur(e) { | ||
{ | ||
@@ -588,3 +588,3 @@ if (e !== void 0) { | ||
t = r.propTypes; | ||
else if (typeof r == "object" && (r.$$typeof === g || // Note: Memo only checks outer props here. | ||
else if (typeof r == "object" && (r.$$typeof === h || // Note: Memo only checks outer props here. | ||
// Inner props are checked in the reconciler. | ||
@@ -618,14 +618,14 @@ r.$$typeof === b)) | ||
} | ||
function Te(e, r, t, i, l, c) { | ||
function we(e, r, t, i, l, c) { | ||
{ | ||
var f = Ve(e); | ||
var f = Ue(e); | ||
if (!f) { | ||
var o = ""; | ||
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (o += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."); | ||
var m = or(l); | ||
m ? o += m : o += Re(); | ||
var u = ""; | ||
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (u += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."); | ||
var m = ur(l); | ||
m ? u += m : u += Re(); | ||
var d; | ||
e === null ? d = "null" : J(e) ? d = "array" : e !== void 0 && e.$$typeof === a ? (d = "<" + (C(e.type) || "Unknown") + " />", o = " Did you accidentally export a JSX literal instead of a component?") : d = typeof e, y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", d, o); | ||
e === null ? d = "null" : J(e) ? d = "array" : e !== void 0 && e.$$typeof === a ? (d = "<" + (C(e.type) || "Unknown") + " />", u = " Did you accidentally export a JSX literal instead of a component?") : d = typeof e, y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", d, u); | ||
} | ||
var p = ur(e, r, t, l, c); | ||
var p = or(e, r, t, l, c); | ||
if (p == null) | ||
@@ -646,13 +646,13 @@ return p; | ||
} | ||
return e === u ? lr(p) : fr(p), p; | ||
return e === o ? lr(p) : fr(p), p; | ||
} | ||
} | ||
function cr(e, r, t) { | ||
return Te(e, r, t, !0); | ||
return we(e, r, t, !0); | ||
} | ||
function vr(e, r, t) { | ||
return Te(e, r, t, !1); | ||
return we(e, r, t, !1); | ||
} | ||
var dr = vr, pr = cr; | ||
I.Fragment = u, I.jsx = dr, I.jsxs = pr; | ||
I.Fragment = o, I.jsx = dr, I.jsxs = pr; | ||
}()), I; | ||
@@ -668,3 +668,3 @@ } | ||
function L(n, a) { | ||
var s, u, v; | ||
var s, o, v; | ||
if (n === a) | ||
@@ -678,6 +678,6 @@ return !0; | ||
if (s === Array) { | ||
if ((u = n.length) === a.length) | ||
for (; u-- && L(n[u], a[u]); ) | ||
if ((o = n.length) === a.length) | ||
for (; o-- && L(n[o], a[o]); ) | ||
; | ||
return u === -1; | ||
return o === -1; | ||
} | ||
@@ -687,4 +687,4 @@ if (s === Set) { | ||
return !1; | ||
for (u of n) | ||
if (v = u, v && typeof v == "object" && (v = xe(a, v), !v) || !a.has(v)) | ||
for (o of n) | ||
if (v = o, v && typeof v == "object" && (v = xe(a, v), !v) || !a.has(v)) | ||
return !1; | ||
@@ -696,4 +696,4 @@ return !0; | ||
return !1; | ||
for (u of n) | ||
if (v = u[0], v && typeof v == "object" && (v = xe(a, v), !v) || !L(u[1], a.get(v))) | ||
for (o of n) | ||
if (v = o[0], v && typeof v == "object" && (v = xe(a, v), !v) || !L(o[1], a.get(v))) | ||
return !1; | ||
@@ -705,19 +705,19 @@ return !0; | ||
else if (s === DataView) { | ||
if ((u = n.byteLength) === a.byteLength) | ||
for (; u-- && n.getInt8(u) === a.getInt8(u); ) | ||
if ((o = n.byteLength) === a.byteLength) | ||
for (; o-- && n.getInt8(o) === a.getInt8(o); ) | ||
; | ||
return u === -1; | ||
return o === -1; | ||
} | ||
if (ArrayBuffer.isView(n)) { | ||
if ((u = n.byteLength) === a.byteLength) | ||
for (; u-- && n[u] === a[u]; ) | ||
if ((o = n.byteLength) === a.byteLength) | ||
for (; o-- && n[o] === a[o]; ) | ||
; | ||
return u === -1; | ||
return o === -1; | ||
} | ||
if (!s || typeof n == "object") { | ||
u = 0; | ||
o = 0; | ||
for (s in n) | ||
if (je.call(n, s) && ++u && !je.call(a, s) || !(s in a) || !L(n[s], a[s])) | ||
if (je.call(n, s) && ++o && !je.call(a, s) || !(s in a) || !L(n[s], a[s])) | ||
return !1; | ||
return Object.keys(a).length === u; | ||
return Object.keys(a).length === o; | ||
} | ||
@@ -728,4 +728,4 @@ } | ||
function br(n) { | ||
var a = U.useRef(n), s = U.useRef(0); | ||
return L(n, a.current) || (a.current = n, s.current += 1), U.useMemo(function() { | ||
var a = V.useRef(n), s = V.useRef(0); | ||
return L(n, a.current) || (a.current = n, s.current += 1), V.useMemo(function() { | ||
return a.current; | ||
@@ -735,31 +735,35 @@ }, [s.current]); | ||
function Cr(n, a) { | ||
return U.useEffect(n, br(a)); | ||
return V.useEffect(n, br(a)); | ||
} | ||
const ee = gr(null); | ||
function Or({ | ||
const ee = hr(null); | ||
function Pr({ | ||
children: n, | ||
locale: a, | ||
debugMode: s = !1, | ||
enableInspectorMode: u = !0, | ||
enableInspectorMode: o = !0, | ||
enableLiveUpdates: v = !0 | ||
}) { | ||
Q.init({ locale: a, debugMode: s, enableInspectorMode: u, enableLiveUpdates: v }); | ||
if (!a) | ||
throw new Error( | ||
'ContentfulLivePreviewProvider have to be called with a locale property (for example: `<ContentfulLivePreviewProvider locale="en-US">{children}</ContentfulLivePreviewProvider>`' | ||
); | ||
Q.init({ locale: a, debugMode: s, enableInspectorMode: o, enableLiveUpdates: v }); | ||
const _ = De( | ||
() => ({ locale: a, debugMode: s, enableInspectorMode: u, enableLiveUpdates: v }), | ||
[a, s, u, v] | ||
() => ({ locale: a, debugMode: s, enableInspectorMode: o, enableLiveUpdates: v }), | ||
[a, s, o, v] | ||
); | ||
return /* @__PURE__ */ _r.jsx(ee.Provider, { value: _, children: n }); | ||
} | ||
function Pr(n, a, s = !1) { | ||
const [u, v] = hr({ data: n, version: 1 }), _ = Oe(n), O = Oe(mr(v)), R = Ae(ee), g = De(() => R && !R.enableLiveUpdates || s ? !1 : !!(Array.isArray(n) && n.length || n && typeof n == "object" && Object.keys(n).length), [R, s, n]); | ||
function Or(n, a, s = !1) { | ||
const [o, v] = gr({ data: n, version: 1 }), _ = Pe(n), P = Pe(mr(v)), R = Ae(ee), h = De(() => R && !R.enableLiveUpdates || s ? !1 : !!(Array.isArray(n) && n.length || n && typeof n == "object" && Object.keys(n).length), [R, s, n]); | ||
return Cr(() => { | ||
if (_.current !== n && (v({ data: n, version: 1 }), _.current = n), !!g) | ||
if (_.current !== n && (v({ data: n, version: 1 }), _.current = n), !!h) | ||
return Q.subscribe({ | ||
data: n, | ||
locale: a, | ||
callback: (w) => { | ||
O.current((h) => ({ data: w, version: h.version++ })); | ||
callback: (T) => { | ||
P.current((g) => ({ data: T, version: g.version + 1 })); | ||
} | ||
}); | ||
}, [n, g]), u.data; | ||
}, [n, h]), o.data; | ||
} | ||
@@ -774,6 +778,6 @@ function Sr(n) { | ||
export { | ||
Or as ContentfulLivePreviewProvider, | ||
Pr as ContentfulLivePreviewProvider, | ||
Sr as useContentfulInspectorMode, | ||
Pr as useContentfulLiveUpdates | ||
Or as useContentfulLiveUpdates | ||
}; | ||
//# sourceMappingURL=react.js.map |
@@ -14,3 +14,7 @@ import type { AssetProps, EntryProps, ContentTypeProps } from 'contentful-management'; | ||
} | ||
export type InspectorModeTags = Record<TagAttributes, string> | null; | ||
export type InspectorModeTags = { | ||
[TagAttributes.ENTRY_ID]: string; | ||
[TagAttributes.FIELD_ID]: string; | ||
[TagAttributes.LOCALE]?: string; | ||
} | null; | ||
export interface SysProps { | ||
@@ -77,2 +81,3 @@ id: string; | ||
entityReferenceMap?: EntityReferenceMap; | ||
depth?: number; | ||
}; | ||
@@ -83,13 +88,12 @@ export type UpdateReferenceFieldProps = { | ||
}) | null | undefined; | ||
updatedReference: EntryProps & { | ||
__typename?: string; | ||
}; | ||
updatedReference: Entity & CollectionItem; | ||
entityReferenceMap: EntityReferenceMap; | ||
locale: string; | ||
depth?: number; | ||
}; | ||
export interface Subscription { | ||
data: Argument; | ||
locale: string; | ||
locale?: string; | ||
callback: SubscribeCallback; | ||
} | ||
export {}; |
{ | ||
"name": "@contentful/live-preview", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"author": "Contentful GmbH", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
390915
1930
2