@contentful/live-preview
Advanced tools
Comparing version 2.11.8 to 2.11.9
@@ -10,2 +10,1 @@ export declare const DATA_CURR_FIELD_ID: string; | ||
export declare const LIVE_PREVIEW_SDK_SOURCE: "live-preview-sdk"; | ||
export declare const CONTENTFUL_ORIGINS: string[]; |
@@ -11,4 +11,4 @@ import { SysProps, Entity, UpdateEntryProps } from '../types'; | ||
*/ | ||
export declare function updateEntry({ contentType, dataFromPreviewApp, updateFromEntryEditor, locale, entityReferenceMap, gqlParams, }: UpdateEntryProps): Promise<Entity & { | ||
export declare function updateEntry({ contentType, dataFromPreviewApp, updateFromEntryEditor, locale, entityReferenceMap, gqlParams, sendMessage, }: UpdateEntryProps): Promise<Entity & { | ||
sys: SysProps; | ||
}>; |
@@ -0,3 +1,5 @@ | ||
import { PostMessageMethods, RequestEntitiesMessage } from '@contentful/visual-sdk'; | ||
import type { Asset, Entry } from 'contentful'; | ||
import { EntityReferenceMap } from '../types'; | ||
export type SendMessage = (method: PostMessageMethods, params: RequestEntitiesMessage) => void; | ||
export declare function resolveReference(info: { | ||
@@ -7,2 +9,3 @@ entityReferenceMap: EntityReferenceMap; | ||
locale: string; | ||
sendMessage: SendMessage; | ||
}): Promise<{ | ||
@@ -17,2 +20,3 @@ reference: Entry; | ||
locale: string; | ||
sendMessage: SendMessage; | ||
}): Promise<{ | ||
@@ -19,0 +23,0 @@ reference: Asset; |
@@ -7,3 +7,3 @@ import { PostMessageMethods } from '../messages'; | ||
*/ | ||
export declare function sendMessageToEditor(method: PostMessageMethods, data: EditorMessage): void; | ||
export declare function sendMessageToEditor(method: PostMessageMethods, data: EditorMessage, targetOrigin: string[]): void; | ||
type Callback = (...args: any[]) => void; | ||
@@ -10,0 +10,0 @@ type DebouncedFunction<T extends Callback> = (...args: Parameters<T>) => void; |
import { type DocumentNode } from 'graphql'; | ||
import { InspectorMode } from './inspectorMode'; | ||
import { LiveUpdates } from './liveUpdates'; | ||
import { EditorMessage, PostMessageMethods } from './messages'; | ||
import { SaveEvent } from './saveEvent'; | ||
@@ -12,2 +13,7 @@ import { Argument, InspectorModeTags, LivePreviewProps, SubscribeCallback } from './types'; | ||
enableLiveUpdates?: boolean; | ||
/** | ||
* Contentful host in which the website should be shown | ||
* Can be `https://app.contentful.com` or `https://app.eu.contentful.com` | ||
*/ | ||
targetOrigin?: string | string[]; | ||
} | ||
@@ -28,2 +34,4 @@ export interface ContentfulSubscribeConfig { | ||
static locale: string; | ||
static sendMessage: (method: PostMessageMethods, data: EditorMessage) => void; | ||
static targetOrigin: string[]; | ||
static init(config: ContentfulLivePreviewInitConfig): Promise<InspectorMode | null> | undefined; | ||
@@ -30,0 +38,0 @@ static subscribe(config: ContentfulSubscribeConfig): VoidFunction; |
@@ -1,2 +0,2 @@ | ||
import { C as t, L as E, a as o, b as a, P as i, V as r, o as I } from "./index-5b1a08c7.js"; | ||
import { C as t, L as E, a as o, b as a, P as i, V as r, o as I } from "./index-8ecd860d.js"; | ||
export { | ||
@@ -3,0 +3,0 @@ t as ContentfulLivePreview, |
@@ -6,4 +6,6 @@ import { MessageFromEditor } from './messages'; | ||
private defaultLocale; | ||
constructor({ locale }: { | ||
private targetOrigin; | ||
constructor({ locale, targetOrigin }: { | ||
locale: string; | ||
targetOrigin: string[]; | ||
}); | ||
@@ -10,0 +12,0 @@ receiveMessage(data: MessageFromEditor): void; |
@@ -10,4 +10,6 @@ import type { ContentfulSubscribeConfig, MessageFromEditor } from '.'; | ||
private defaultLocale; | ||
constructor({ locale }: { | ||
private sendMessage; | ||
constructor({ locale, targetOrigin }: { | ||
locale: string; | ||
targetOrigin: string[]; | ||
}); | ||
@@ -29,2 +31,3 @@ private mergeEntity; | ||
private clearStorage; | ||
private sendErrorMessage; | ||
/** | ||
@@ -31,0 +34,0 @@ * Subscribe to data changes from the Editor, returns a function to unsubscribe |
@@ -125,2 +125,2 @@ import type { RequestEntitiesMessage, RequestedEntitiesMessage } from '@contentful/visual-sdk'; | ||
}; | ||
export declare function openEntryInEditorUtility(fieldId: string, entryId: string, locale: string): void; | ||
export declare function openEntryInEditorUtility(fieldId: string, entryId: string, locale: string, targetOrigin: string[]): void; |
@@ -15,3 +15,3 @@ import { useEffect, type PropsWithChildren, type ReactElement } from 'react'; | ||
*/ | ||
export declare function ContentfulLivePreviewProvider({ children, locale, debugMode, enableInspectorMode, enableLiveUpdates, }: PropsWithChildren<ContentfulLivePreviewInitConfig>): ReactElement; | ||
export declare function ContentfulLivePreviewProvider({ children, locale, debugMode, enableInspectorMode, enableLiveUpdates, targetOrigin, }: PropsWithChildren<ContentfulLivePreviewInitConfig>): ReactElement; | ||
interface Options { | ||
@@ -18,0 +18,0 @@ locale?: string; |
import Zr, { createContext as At, useRef as mr, useMemo as $r, useEffect as jt, useState as Dt, useContext as Qr, useCallback as It } from "react"; | ||
import { c as Er, g as Ft, C as Ur, d as Lt } from "./index-5b1a08c7.js"; | ||
import { c as Er, g as Ft, C as Ur, d as Lt } from "./index-8ecd860d.js"; | ||
var Mr = { exports: {} }, Me = {}; | ||
@@ -18,14 +18,14 @@ /** | ||
Jr = 1; | ||
var d = Zr, v = Symbol.for("react.element"), P = Symbol.for("react.fragment"), x = Object.prototype.hasOwnProperty, A = d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, $ = { key: !0, ref: !0, __self: !0, __source: !0 }; | ||
function q(j, _, W) { | ||
var w, I = {}, H = null, ie = null; | ||
W !== void 0 && (H = "" + W), _.key !== void 0 && (H = "" + _.key), _.ref !== void 0 && (ie = _.ref); | ||
var d = Zr, v = Symbol.for("react.element"), P = Symbol.for("react.fragment"), x = Object.prototype.hasOwnProperty, A = d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, I = { key: !0, ref: !0, __self: !0, __source: !0 }; | ||
function U(j, _, Y) { | ||
var w, F = {}, H = null, ie = null; | ||
Y !== void 0 && (H = "" + Y), _.key !== void 0 && (H = "" + _.key), _.ref !== void 0 && (ie = _.ref); | ||
for (w in _) | ||
x.call(_, w) && !$.hasOwnProperty(w) && (I[w] = _[w]); | ||
x.call(_, w) && !I.hasOwnProperty(w) && (F[w] = _[w]); | ||
if (j && j.defaultProps) | ||
for (w in _ = j.defaultProps, _) | ||
I[w] === void 0 && (I[w] = _[w]); | ||
return { $$typeof: v, type: j, key: H, ref: ie, props: I, _owner: A.current }; | ||
F[w] === void 0 && (F[w] = _[w]); | ||
return { $$typeof: v, type: j, key: H, ref: ie, props: F, _owner: A.current }; | ||
} | ||
return Me.Fragment = P, Me.jsx = q, Me.jsxs = q, Me; | ||
return Me.Fragment = P, Me.jsx = U, Me.jsxs = U, Me; | ||
} | ||
@@ -45,3 +45,3 @@ var $e = {}; | ||
return Xr || (Xr = 1, process.env.NODE_ENV !== "production" && function() { | ||
var d = Zr, v = Symbol.for("react.element"), P = Symbol.for("react.portal"), x = Symbol.for("react.fragment"), A = Symbol.for("react.strict_mode"), $ = Symbol.for("react.profiler"), q = Symbol.for("react.provider"), j = Symbol.for("react.context"), _ = Symbol.for("react.forward_ref"), W = Symbol.for("react.suspense"), w = Symbol.for("react.suspense_list"), I = Symbol.for("react.memo"), H = Symbol.for("react.lazy"), ie = Symbol.for("react.offscreen"), Ue = Symbol.iterator, de = "@@iterator"; | ||
var d = Zr, v = Symbol.for("react.element"), P = Symbol.for("react.portal"), x = Symbol.for("react.fragment"), A = Symbol.for("react.strict_mode"), I = Symbol.for("react.profiler"), U = Symbol.for("react.provider"), j = Symbol.for("react.context"), _ = Symbol.for("react.forward_ref"), Y = Symbol.for("react.suspense"), w = Symbol.for("react.suspense_list"), F = Symbol.for("react.memo"), H = Symbol.for("react.lazy"), ie = Symbol.for("react.offscreen"), Ue = Symbol.iterator, de = "@@iterator"; | ||
function Ne(r) { | ||
@@ -74,3 +74,3 @@ if (r === null || typeof r != "object") | ||
function we(r) { | ||
return !!(typeof r == "string" || typeof r == "function" || r === x || r === $ || wr || r === A || r === W || r === w || ze || r === ie || Rr || Ye || pe || typeof r == "object" && r !== null && (r.$$typeof === H || r.$$typeof === I || r.$$typeof === q || r.$$typeof === j || r.$$typeof === _ || // This needs to include all possible module reference object | ||
return !!(typeof r == "string" || typeof r == "function" || r === x || r === I || wr || r === A || r === Y || r === w || ze || r === ie || Rr || Ye || pe || typeof r == "object" && r !== null && (r.$$typeof === H || r.$$typeof === F || r.$$typeof === U || r.$$typeof === j || r.$$typeof === _ || // This needs to include all possible module reference object | ||
// types supported by any Flight configuration anywhere since | ||
@@ -91,3 +91,3 @@ // we don't know which Flight build this will end up being used | ||
} | ||
function Y(r) { | ||
function z(r) { | ||
if (r == null) | ||
@@ -104,7 +104,7 @@ return null; | ||
return "Portal"; | ||
case $: | ||
case I: | ||
return "Profiler"; | ||
case A: | ||
return "StrictMode"; | ||
case W: | ||
case Y: | ||
return "Suspense"; | ||
@@ -119,3 +119,3 @@ case w: | ||
return oe(a) + ".Consumer"; | ||
case q: | ||
case U: | ||
var i = r; | ||
@@ -125,9 +125,9 @@ return oe(i._context) + ".Provider"; | ||
return Ge(r, r.render, "ForwardRef"); | ||
case I: | ||
case F: | ||
var s = r.displayName || null; | ||
return s !== null ? s : Y(r.type) || "Memo"; | ||
return s !== null ? s : z(r.type) || "Memo"; | ||
case H: { | ||
var p = r, l = p._payload, c = p._init; | ||
try { | ||
return Y(c(l)); | ||
return z(c(l)); | ||
} catch { | ||
@@ -203,3 +203,3 @@ return null; | ||
var ve = X.ReactCurrentDispatcher, Ce; | ||
function F(r, a, i) { | ||
function L(r, a, i) { | ||
{ | ||
@@ -248,4 +248,4 @@ if (Ce === void 0) | ||
Reflect.construct(c, []); | ||
} catch (B) { | ||
s = B; | ||
} catch (G) { | ||
s = G; | ||
} | ||
@@ -256,4 +256,4 @@ Reflect.construct(r, [], c); | ||
c.call(); | ||
} catch (B) { | ||
s = B; | ||
} catch (G) { | ||
s = G; | ||
} | ||
@@ -265,10 +265,10 @@ r.call(c.prototype); | ||
throw Error(); | ||
} catch (B) { | ||
s = B; | ||
} catch (G) { | ||
s = G; | ||
} | ||
r(); | ||
} | ||
} catch (B) { | ||
if (B && s && typeof B.stack == "string") { | ||
for (var f = B.stack.split(` | ||
} catch (G) { | ||
if (G && s && typeof G.stack == "string") { | ||
for (var f = G.stack.split(` | ||
`), S = s.stack.split(` | ||
@@ -293,3 +293,3 @@ `), y = f.length - 1, m = S.length - 1; y >= 1 && m >= 0 && f[y] !== S[m]; ) | ||
} | ||
var re = r ? r.displayName || r.name : "", pr = re ? F(re) : ""; | ||
var re = r ? r.displayName || r.name : "", pr = re ? L(re) : ""; | ||
return typeof r == "function" && ue.set(r, pr), pr; | ||
@@ -310,8 +310,8 @@ } | ||
if (typeof r == "string") | ||
return F(r); | ||
return L(r); | ||
switch (r) { | ||
case W: | ||
return F("Suspense"); | ||
case Y: | ||
return L("Suspense"); | ||
case w: | ||
return F("SuspenseList"); | ||
return L("SuspenseList"); | ||
} | ||
@@ -322,3 +322,3 @@ if (typeof r == "object") | ||
return er(r.render); | ||
case I: | ||
case F: | ||
return he(r.type, a, i); | ||
@@ -391,3 +391,3 @@ case H: { | ||
__source: !0 | ||
}, Pe, L, Ee; | ||
}, Pe, M, Ee; | ||
Ee = {}; | ||
@@ -412,4 +412,4 @@ function or(r) { | ||
if (typeof r.ref == "string" && K.current && a && K.current.stateNode !== a) { | ||
var i = Y(K.current.type); | ||
Ee[i] || (E('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', Y(K.current.type), r.ref), Ee[i] = !0); | ||
var i = z(K.current.type); | ||
Ee[i] || (E('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', z(K.current.type), r.ref), Ee[i] = !0); | ||
} | ||
@@ -431,3 +431,3 @@ } | ||
var i = function() { | ||
L || (L = !0, E("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", a)); | ||
M || (M = !0, E("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", a)); | ||
}; | ||
@@ -487,3 +487,3 @@ i.isReactWarning = !0, Object.defineProperty(r, "ref", { | ||
} | ||
var z = X.ReactCurrentOwner, xe = X.ReactDebugCurrentFrame; | ||
var B = X.ReactCurrentOwner, xe = X.ReactDebugCurrentFrame; | ||
function Z(r) { | ||
@@ -503,4 +503,4 @@ if (r) { | ||
{ | ||
if (z.current) { | ||
var r = Y(z.current.type); | ||
if (B.current) { | ||
var r = z(B.current.type); | ||
if (r) | ||
@@ -548,3 +548,3 @@ return ` | ||
var s = ""; | ||
r && r._owner && r._owner !== z.current && (s = " It was passed a child from " + Y(r._owner.type) + "."), Z(r), E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', i, s), Z(null); | ||
r && r._owner && r._owner !== B.current && (s = " It was passed a child from " + z(r._owner.type) + "."), Z(r), E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', i, s), Z(null); | ||
} | ||
@@ -581,3 +581,3 @@ } | ||
// Inner props are checked in the reconciler. | ||
a.$$typeof === I)) | ||
a.$$typeof === F)) | ||
i = a.propTypes; | ||
@@ -587,7 +587,7 @@ else | ||
if (i) { | ||
var s = Y(a); | ||
var s = z(a); | ||
Sr(i, r.props, "prop", s, r); | ||
} else if (a.PropTypes !== void 0 && !Ae) { | ||
Ae = !0; | ||
var p = Y(a); | ||
var p = z(a); | ||
E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", p || "Unknown"); | ||
@@ -619,3 +619,3 @@ } | ||
var y; | ||
r === null ? y = "null" : Se(r) ? y = "array" : r !== void 0 && r.$$typeof === v ? (y = "<" + (Y(r.type) || "Unknown") + " />", f = " Did you accidentally export a JSX literal instead of a component?") : y = typeof r, E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", y, f); | ||
r === null ? y = "null" : Se(r) ? y = "array" : r !== void 0 && r.$$typeof === v ? (y = "<" + (z(r.type) || "Unknown") + " />", f = " Did you accidentally export a JSX literal instead of a component?") : y = typeof r, E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", y, f); | ||
} | ||
@@ -655,5 +655,5 @@ var m = jr(r, a, i, p, l); | ||
(function(d, v) { | ||
var P = 200, x = "__lodash_hash_undefined__", A = 1, $ = 2, q = 9007199254740991, j = "[object Arguments]", _ = "[object Array]", W = "[object AsyncFunction]", w = "[object Boolean]", I = "[object Date]", H = "[object Error]", ie = "[object Function]", Ue = "[object GeneratorFunction]", de = "[object Map]", Ne = "[object Number]", X = "[object Null]", E = "[object Object]", We = "[object Promise]", Rr = "[object Proxy]", Ye = "[object RegExp]", pe = "[object Set]", ze = "[object String]", wr = "[object Symbol]", Be = "[object Undefined]", we = "[object WeakMap]", Ge = "[object ArrayBuffer]", oe = "[object DataView]", Y = "[object Float32Array]", k = "[object Float64Array]", se = "[object Int8Array]", qe = "[object Int16Array]", He = "[object Int32Array]", Ke = "[object Uint8Array]", ke = "[object Uint8ClampedArray]", Ve = "[object Uint16Array]", Je = "[object Uint32Array]", Xe = /[\\^$.*+?()[\]{}|]/g, Ze = /^\[object .+?Constructor\]$/, Cr = /^(?:0|[1-9]\d*)$/, g = {}; | ||
g[Y] = g[k] = g[se] = g[qe] = g[He] = g[Ke] = g[ke] = g[Ve] = g[Je] = !0, g[j] = g[_] = g[Ge] = g[w] = g[oe] = g[I] = g[H] = g[ie] = g[de] = g[Ne] = g[E] = g[Ye] = g[pe] = g[ze] = g[we] = !1; | ||
var ve = typeof Er == "object" && Er && Er.Object === Object && Er, Ce = typeof self == "object" && self && self.Object === Object && self, F = ve || Ce || Function("return this")(), ge = v && !v.nodeType && v, ue = ge && !0 && d && !d.nodeType && d, Qe = ue && ue.exports === ge, _e = Qe && ve.process, er = function() { | ||
var P = 200, x = "__lodash_hash_undefined__", A = 1, I = 2, U = 9007199254740991, j = "[object Arguments]", _ = "[object Array]", Y = "[object AsyncFunction]", w = "[object Boolean]", F = "[object Date]", H = "[object Error]", ie = "[object Function]", Ue = "[object GeneratorFunction]", de = "[object Map]", Ne = "[object Number]", X = "[object Null]", E = "[object Object]", We = "[object Promise]", Rr = "[object Proxy]", Ye = "[object RegExp]", pe = "[object Set]", ze = "[object String]", wr = "[object Symbol]", Be = "[object Undefined]", we = "[object WeakMap]", Ge = "[object ArrayBuffer]", oe = "[object DataView]", z = "[object Float32Array]", k = "[object Float64Array]", se = "[object Int8Array]", qe = "[object Int16Array]", He = "[object Int32Array]", Ke = "[object Uint8Array]", ke = "[object Uint8ClampedArray]", Ve = "[object Uint16Array]", Je = "[object Uint32Array]", Xe = /[\\^$.*+?()[\]{}|]/g, Ze = /^\[object .+?Constructor\]$/, Cr = /^(?:0|[1-9]\d*)$/, g = {}; | ||
g[z] = g[k] = g[se] = g[qe] = g[He] = g[Ke] = g[ke] = g[Ve] = g[Je] = !0, g[j] = g[_] = g[Ge] = g[w] = g[oe] = g[F] = g[H] = g[ie] = g[de] = g[Ne] = g[E] = g[Ye] = g[pe] = g[ze] = g[we] = !1; | ||
var ve = typeof Er == "object" && Er && Er.Object === Object && Er, Ce = typeof self == "object" && self && self.Object === Object && self, L = ve || Ce || Function("return this")(), ge = v && !v.nodeType && v, ue = ge && !0 && d && !d.nodeType && d, Qe = ue && ue.exports === ge, _e = Qe && ve.process, er = function() { | ||
try { | ||
@@ -715,8 +715,8 @@ return _e && _e.binding && _e.binding("util"); | ||
} | ||
var ar = Array.prototype, ir = Function.prototype, K = Object.prototype, Oe = F["__core-js_shared__"], Pe = ir.toString, L = K.hasOwnProperty, Ee = function() { | ||
var ar = Array.prototype, ir = Function.prototype, K = Object.prototype, Oe = L["__core-js_shared__"], Pe = ir.toString, M = K.hasOwnProperty, Ee = function() { | ||
var e = /[^.]+$/.exec(Oe && Oe.keys && Oe.keys.IE_PROTO || ""); | ||
return e ? "Symbol(src)_1." + e : ""; | ||
}(), or = K.toString, Ar = RegExp( | ||
"^" + Pe.call(L).replace(Xe, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" | ||
), sr = Qe ? F.Buffer : void 0, me = F.Symbol, ur = F.Uint8Array, fr = K.propertyIsEnumerable, jr = ar.splice, z = me ? me.toStringTag : void 0, xe = Object.getOwnPropertySymbols, Z = sr ? sr.isBuffer : void 0, Ae = Pr(Object.keys, Object), fe = Re(F, "DataView"), Q = Re(F, "Map"), je = Re(F, "Promise"), Te = Re(F, "Set"), De = Re(F, "WeakMap"), ee = Re(Object, "create"), lr = le(fe), Dr = le(Q), Ir = le(je), cr = le(Te), Fr = le(De), dr = me ? me.prototype : void 0, Ie = dr ? dr.valueOf : void 0; | ||
"^" + Pe.call(M).replace(Xe, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" | ||
), sr = Qe ? L.Buffer : void 0, me = L.Symbol, ur = L.Uint8Array, fr = K.propertyIsEnumerable, jr = ar.splice, B = me ? me.toStringTag : void 0, xe = Object.getOwnPropertySymbols, Z = sr ? sr.isBuffer : void 0, Ae = Pr(Object.keys, Object), fe = Re(L, "DataView"), Q = Re(L, "Map"), je = Re(L, "Promise"), Te = Re(L, "Set"), De = Re(L, "WeakMap"), ee = Re(Object, "create"), lr = le(fe), Dr = le(Q), Ir = le(je), cr = le(Te), Fr = le(De), dr = me ? me.prototype : void 0, Ie = dr ? dr.valueOf : void 0; | ||
function V(e) { | ||
@@ -742,7 +742,7 @@ var t = -1, n = e == null ? 0 : e.length; | ||
} | ||
return L.call(t, e) ? t[e] : void 0; | ||
return M.call(t, e) ? t[e] : void 0; | ||
} | ||
function s(e) { | ||
var t = this.__data__; | ||
return ee ? t[e] !== void 0 : L.call(t, e); | ||
return ee ? t[e] !== void 0 : M.call(t, e); | ||
} | ||
@@ -801,3 +801,3 @@ function p(e, t) { | ||
} | ||
function B(e) { | ||
function G(e) { | ||
return _r(this, e).get(e); | ||
@@ -812,3 +812,3 @@ } | ||
} | ||
R.prototype.clear = re, R.prototype.delete = pr, R.prototype.get = B, R.prototype.has = et, R.prototype.set = rt; | ||
R.prototype.clear = re, R.prototype.delete = pr, R.prototype.get = G, R.prototype.has = et, R.prototype.set = rt; | ||
function vr(e) { | ||
@@ -857,3 +857,3 @@ var t = -1, n = e == null ? 0 : e.length; | ||
for (var b in e) | ||
(t || L.call(e, b)) && !(T && // Safari 9 has enumerable `arguments.length` in strict mode. | ||
(t || M.call(e, b)) && !(T && // Safari 9 has enumerable `arguments.length` in strict mode. | ||
(b == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. | ||
@@ -876,3 +876,3 @@ h && (b == "offset" || b == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. | ||
function Fe(e) { | ||
return e == null ? e === void 0 ? Be : X : z && z in Object(e) ? ht(e) : Rt(e); | ||
return e == null ? e === void 0 ? Be : X : B && B in Object(e) ? ht(e) : Rt(e); | ||
} | ||
@@ -888,14 +888,14 @@ function Wr(e) { | ||
O = O == j ? E : O, b = b == j ? E : b; | ||
var M = O == E, G = b == E, D = O == b; | ||
var $ = O == E, q = b == E, D = O == b; | ||
if (D && Lr(e)) { | ||
if (!Lr(t)) | ||
return !1; | ||
T = !0, M = !1; | ||
T = !0, $ = !1; | ||
} | ||
if (D && !M) | ||
if (D && !$) | ||
return u || (u = new te()), T || kr(e) ? zr(e, t, n, o, h, u) : gt(e, t, O, n, o, h, u); | ||
if (!(n & A)) { | ||
var U = M && L.call(e, "__wrapped__"), N = G && L.call(t, "__wrapped__"); | ||
if (U || N) { | ||
var ae = U ? e.value() : e, J = N ? t.value() : t; | ||
var N = $ && M.call(e, "__wrapped__"), W = q && M.call(t, "__wrapped__"); | ||
if (N || W) { | ||
var ae = N ? e.value() : e, J = W ? t.value() : t; | ||
return u || (u = new te()), h(ae, J, n, o, u); | ||
@@ -920,3 +920,3 @@ } | ||
for (var n in Object(e)) | ||
L.call(e, n) && n != "constructor" && t.push(n); | ||
M.call(e, n) && n != "constructor" && t.push(n); | ||
return t; | ||
@@ -931,11 +931,11 @@ } | ||
return b == t; | ||
var M = -1, G = !0, D = n & $ ? new vr() : void 0; | ||
for (u.set(e, t), u.set(t, e); ++M < C; ) { | ||
var U = e[M], N = t[M]; | ||
var $ = -1, q = !0, D = n & I ? new vr() : void 0; | ||
for (u.set(e, t), u.set(t, e); ++$ < C; ) { | ||
var N = e[$], W = t[$]; | ||
if (o) | ||
var ae = T ? o(N, U, M, t, e, u) : o(U, N, M, e, t, u); | ||
var ae = T ? o(W, N, $, t, e, u) : o(N, W, $, e, t, u); | ||
if (ae !== void 0) { | ||
if (ae) | ||
continue; | ||
G = !1; | ||
q = !1; | ||
break; | ||
@@ -945,14 +945,14 @@ } | ||
if (!tr(t, function(J, ce) { | ||
if (!Sr(D, ce) && (U === J || h(U, J, n, o, u))) | ||
if (!Sr(D, ce) && (N === J || h(N, J, n, o, u))) | ||
return D.push(ce); | ||
})) { | ||
G = !1; | ||
q = !1; | ||
break; | ||
} | ||
} else if (!(U === N || h(U, N, n, o, u))) { | ||
G = !1; | ||
} else if (!(N === W || h(N, W, n, o, u))) { | ||
q = !1; | ||
break; | ||
} | ||
} | ||
return u.delete(e), u.delete(t), G; | ||
return u.delete(e), u.delete(t), q; | ||
} | ||
@@ -968,3 +968,3 @@ function gt(e, t, n, o, h, u, T) { | ||
case w: | ||
case I: | ||
case F: | ||
case Ne: | ||
@@ -986,5 +986,5 @@ return Gr(+e, +t); | ||
return b == t; | ||
o |= $, T.set(e, t); | ||
var M = zr(C(e), C(t), o, h, u, T); | ||
return T.delete(e), M; | ||
o |= I, T.set(e, t); | ||
var $ = zr(C(e), C(t), o, h, u, T); | ||
return T.delete(e), $; | ||
case wr: | ||
@@ -997,17 +997,17 @@ if (Ie) | ||
function _t(e, t, n, o, h, u) { | ||
var T = n & A, C = Br(e), O = C.length, b = Br(t), M = b.length; | ||
if (O != M && !T) | ||
var T = n & A, C = Br(e), O = C.length, b = Br(t), $ = b.length; | ||
if (O != $ && !T) | ||
return !1; | ||
for (var G = O; G--; ) { | ||
var D = C[G]; | ||
if (!(T ? D in t : L.call(t, D))) | ||
for (var q = O; q--; ) { | ||
var D = C[q]; | ||
if (!(T ? D in t : M.call(t, D))) | ||
return !1; | ||
} | ||
var U = u.get(e); | ||
if (U && u.get(t)) | ||
return U == t; | ||
var N = !0; | ||
var N = u.get(e); | ||
if (N && u.get(t)) | ||
return N == t; | ||
var W = !0; | ||
u.set(e, t), u.set(t, e); | ||
for (var ae = T; ++G < O; ) { | ||
D = C[G]; | ||
for (var ae = T; ++q < O; ) { | ||
D = C[q]; | ||
var J = e[D], ce = t[D]; | ||
@@ -1017,3 +1017,3 @@ if (o) | ||
if (!(Vr === void 0 ? J === ce || h(J, ce, n, o, u) : Vr)) { | ||
N = !1; | ||
W = !1; | ||
break; | ||
@@ -1023,7 +1023,7 @@ } | ||
} | ||
if (N && !ae) { | ||
if (W && !ae) { | ||
var yr = e.constructor, br = t.constructor; | ||
yr != br && "constructor" in e && "constructor" in t && !(typeof yr == "function" && yr instanceof yr && typeof br == "function" && br instanceof br) && (N = !1); | ||
yr != br && "constructor" in e && "constructor" in t && !(typeof yr == "function" && yr instanceof yr && typeof br == "function" && br instanceof br) && (W = !1); | ||
} | ||
return u.delete(e), u.delete(t), N; | ||
return u.delete(e), u.delete(t), W; | ||
} | ||
@@ -1042,5 +1042,5 @@ function Br(e) { | ||
function ht(e) { | ||
var t = L.call(e, z), n = e[z]; | ||
var t = M.call(e, B), n = e[B]; | ||
try { | ||
e[z] = void 0; | ||
e[B] = void 0; | ||
var o = !0; | ||
@@ -1050,3 +1050,3 @@ } catch { | ||
var h = or.call(e); | ||
return o && (t ? e[z] = n : delete e[z]), h; | ||
return o && (t ? e[B] = n : delete e[B]), h; | ||
} | ||
@@ -1076,3 +1076,3 @@ var yt = xe ? function(e) { | ||
function bt(e, t) { | ||
return t = t ?? q, !!t && (typeof e == "number" || Cr.test(e)) && e > -1 && e % 1 == 0 && e < t; | ||
return t = t ?? U, !!t && (typeof e == "number" || Cr.test(e)) && e > -1 && e % 1 == 0 && e < t; | ||
} | ||
@@ -1112,3 +1112,3 @@ function Et(e) { | ||
}()) ? Wr : function(e) { | ||
return Le(e) && L.call(e, "callee") && !fr.call(e, "callee"); | ||
return Le(e) && M.call(e, "callee") && !fr.call(e, "callee"); | ||
}, hr = Array.isArray; | ||
@@ -1126,6 +1126,6 @@ function Ct(e) { | ||
var t = Fe(e); | ||
return t == ie || t == Ue || t == W || t == Rr; | ||
return t == ie || t == Ue || t == Y || t == Rr; | ||
} | ||
function Hr(e) { | ||
return typeof e == "number" && e > -1 && e % 1 == 0 && e <= q; | ||
return typeof e == "number" && e > -1 && e % 1 == 0 && e <= U; | ||
} | ||
@@ -1166,3 +1166,4 @@ function Kr(e) { | ||
enableInspectorMode: x = !0, | ||
enableLiveUpdates: A = !0 | ||
enableLiveUpdates: A = !0, | ||
targetOrigin: I | ||
}) { | ||
@@ -1173,14 +1174,20 @@ if (!v) | ||
); | ||
Ur.init({ locale: v, debugMode: P, enableInspectorMode: x, enableLiveUpdates: A }); | ||
const $ = $r( | ||
() => ({ locale: v, debugMode: P, enableInspectorMode: x, enableLiveUpdates: A }), | ||
[v, P, x, A] | ||
Ur.init({ | ||
locale: v, | ||
debugMode: P, | ||
enableInspectorMode: x, | ||
enableLiveUpdates: A, | ||
targetOrigin: I | ||
}); | ||
const U = $r( | ||
() => ({ locale: v, debugMode: P, enableInspectorMode: x, enableLiveUpdates: A, targetOrigin: I }), | ||
[v, P, x, A, I] | ||
); | ||
return /* @__PURE__ */ Ut.jsx(Nr.Provider, { value: $, children: d }); | ||
return /* @__PURE__ */ Ut.jsx(Nr.Provider, { value: U, children: d }); | ||
} | ||
function Ht(d, v, P = !1) { | ||
const [x, A] = Dt({ data: d, version: 1 }), $ = mr(d), q = mr(Lt(A)), j = Qr(Nr), _ = typeof v == "object" ? v : { locale: v, skip: P }, W = $r(() => j && !j.enableLiveUpdates || _.skip ? !1 : !!(Array.isArray(d) && d.length || d && typeof d == "object" && Object.keys(d).length), [j, _.skip, d]); | ||
const [x, A] = Dt({ data: d, version: 1 }), I = mr(d), U = mr(Lt(A)), j = Qr(Nr), _ = typeof v == "object" ? v : { locale: v, skip: P }, Y = $r(() => j && !j.enableLiveUpdates || _.skip ? !1 : !!(Array.isArray(d) && d.length || d && typeof d == "object" && Object.keys(d).length), [j, _.skip, d]); | ||
return zt(() => { | ||
if ($.current !== d && (A({ data: d, version: 1 }), $.current = d), !!W) | ||
return Ur.subscribe({ | ||
if (I.current !== d && (A({ data: d, version: 1 }), I.current = d), !!Y) | ||
return Ur.subscribe("edit", { | ||
data: d, | ||
@@ -1190,6 +1197,6 @@ locale: _.locale, | ||
callback: (w) => { | ||
q.current((I) => ({ data: w, version: I.version + 1 })); | ||
U.current((F) => ({ data: w, version: F.version + 1 })); | ||
} | ||
}); | ||
}, [d, W, _.locale, _.query]), x.data; | ||
}, [d, Y, _.locale, _.query]), x.data; | ||
} | ||
@@ -1196,0 +1203,0 @@ function Kt(d) { |
import { Asset, Entry } from 'contentful'; | ||
import type { WithResourceName } from 'contentful-management'; | ||
import { SendMessage } from '../helpers'; | ||
import { ContentType, EntityReferenceMap } from '../types'; | ||
@@ -14,2 +15,2 @@ export type Reference = Asset | Entry | WithResourceName<Entry>; | ||
*/ | ||
export declare function updateEntity(contentType: ContentType, dataFromPreviewApp: Entry, updateFromEntryEditor: Entry | Asset, locale: string, entityReferenceMap: EntityReferenceMap, depth: number, visitedReferenceMap: Map<string, Reference>): Promise<Entry>; | ||
export declare function updateEntity(contentType: ContentType, dataFromPreviewApp: Entry, updateFromEntryEditor: Entry | Asset, locale: string, entityReferenceMap: EntityReferenceMap, depth: number, visitedReferenceMap: Map<string, Reference>, sendMessage: SendMessage): Promise<Entry>; |
import type { Asset, Entry } from 'contentful'; | ||
import type { ContentTypeProps } from 'contentful-management'; | ||
import { SendMessage } from './helpers'; | ||
export type ContentType = ContentTypeProps; | ||
@@ -47,2 +48,3 @@ export declare const ASSET_TYPENAME = "Asset"; | ||
gqlParams?: GraphQLParams; | ||
sendMessage: SendMessage; | ||
}; | ||
@@ -56,2 +58,3 @@ export type UpdateFieldProps = { | ||
gqlParams?: GraphQLParams; | ||
sendMessage: SendMessage; | ||
}; | ||
@@ -68,2 +71,3 @@ export type UpdateReferenceFieldProps = { | ||
gqlParams?: GraphQLParams; | ||
sendMessage: SendMessage; | ||
}; | ||
@@ -70,0 +74,0 @@ /** |
{ | ||
"name": "@contentful/live-preview", | ||
"version": "2.11.8", | ||
"version": "2.11.9", | ||
"author": "Contentful GmbH", | ||
@@ -80,3 +80,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "5fc158bb4ab0deb7593477e312999658683256d1" | ||
"gitHead": "3d01930f314888d008566fd7203ed95b6d8245c8" | ||
} |
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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
743272
3596
3