@contentful/field-editor-shared 0.24.0 → 1.0.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.
@@ -1 +1 @@
1
- {"version":3,"file":"field-editor-shared.cjs.production.min.js","sources":["../../../node_modules/regenerator-runtime/runtime.js","../src/FieldConnector.ts","../src/CharCounter.tsx","../src/ModalDialogLauncher.tsx","../src/utils/entityHelpers.ts","../src/utils/constraints.ts","../src/CharValidation.tsx","../src/PredefinedValuesError.tsx","../src/utils/isValidImage.ts","../src/utils/shortenStorageUnit.ts"],"sourcesContent":["/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n IteratorPrototype[iteratorSymbol] = function () {\n return this;\n };\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;\n GeneratorFunctionPrototype.constructor = GeneratorFunction;\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n AsyncIterator.prototype[asyncIteratorSymbol] = function () {\n return this;\n };\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n Gp[iteratorSymbol] = function() {\n return this;\n };\n\n Gp.toString = function() {\n return \"[object Generator]\";\n };\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n}\n","import React from 'react';\nimport isEqual from 'lodash/isEqual';\nimport throttle from 'lodash/throttle';\nimport { FieldAPI } from '@contentful/app-sdk';\n\ntype Nullable = null | undefined;\n\nexport interface FieldConnectorChildProps<ValueType> {\n isLocalValueChange: boolean;\n externalReset: number;\n lastRemoteValue: ValueType | Nullable;\n value: ValueType | Nullable;\n disabled: boolean;\n errors: Error[];\n setValue: (value: ValueType | Nullable) => Promise<unknown>;\n}\n\ninterface FieldConnectorState<ValueType> {\n isLocalValueChange: boolean;\n externalReset: number;\n lastRemoteValue: ValueType | Nullable;\n value: ValueType | Nullable;\n disabled: boolean;\n errors: Error[];\n}\n\ninterface FieldConnectorProps<ValueType> {\n field: FieldAPI;\n isInitiallyDisabled: boolean;\n children: (state: FieldConnectorChildProps<ValueType>) => React.ReactNode;\n isEmptyValue: (value: ValueType | null) => boolean;\n isEqualValues: (value1: ValueType | Nullable, value2: ValueType | Nullable) => boolean;\n throttle: number;\n}\n\nexport class FieldConnector<ValueType> extends React.Component<\n FieldConnectorProps<ValueType>,\n FieldConnectorState<ValueType>\n> {\n static defaultProps = {\n children: () => {\n return null;\n },\n // eslint-disable-next-line\n isEmptyValue: (value: any | Nullable) => {\n return value === null || value === '';\n },\n // eslint-disable-next-line\n isEqualValues: (value1: any | Nullable, value2: any | Nullable) => {\n return isEqual(value1, value2);\n },\n throttle: 300,\n };\n\n constructor(props: FieldConnectorProps<ValueType>) {\n super(props);\n const initialValue = props.field.getValue();\n this.state = {\n isLocalValueChange: false,\n externalReset: 0,\n value: initialValue,\n lastRemoteValue: initialValue,\n disabled: props.isInitiallyDisabled,\n errors: [],\n };\n }\n\n unsubscribeErrors: Function | null = null;\n unsubscribeDisabled: Function | null = null;\n unsubscribeValue: Function | null = null;\n\n setValue = async (value: ValueType | Nullable) => {\n if (this.props.isEmptyValue(value ?? null)) {\n this.setState({ value: undefined });\n } else {\n this.setState({ value });\n }\n\n await this.triggerSetValueCallbacks(value);\n };\n\n triggerSetValueCallbacks = throttle(\n (value: ValueType | Nullable) => {\n return new Promise((resolve, reject) => {\n if (this.props.isEmptyValue(value ?? null)) {\n this.props.field.removeValue().then(resolve).catch(reject);\n } else {\n this.props.field.setValue(value).then(resolve).catch(reject);\n }\n });\n },\n this.props.throttle,\n {\n leading: this.props.throttle === 0,\n }\n );\n\n componentDidMount() {\n const { field } = this.props;\n this.unsubscribeErrors = field.onSchemaErrorsChanged((errors: Error[]) => {\n this.setState({\n errors: errors || [],\n });\n });\n this.unsubscribeDisabled = field.onIsDisabledChanged((disabled: boolean) => {\n this.setState({\n disabled,\n });\n });\n this.unsubscribeValue = field.onValueChanged((value: ValueType | Nullable) => {\n this.setState((currentState) => {\n const isLocalValueChange = this.props.isEqualValues(value, currentState.value);\n const lastRemoteValue = isLocalValueChange ? currentState.lastRemoteValue : value;\n const externalReset = currentState.externalReset + (isLocalValueChange ? 0 : 1);\n return {\n value,\n lastRemoteValue,\n isLocalValueChange,\n externalReset,\n };\n });\n });\n }\n\n componentWillUnmount() {\n if (typeof this.unsubscribeErrors === 'function') {\n this.unsubscribeErrors();\n }\n if (typeof this.unsubscribeDisabled === 'function') {\n this.unsubscribeDisabled();\n }\n if (typeof this.unsubscribeValue === 'function') {\n this.unsubscribeValue();\n }\n }\n\n render() {\n return this.props.children({\n ...this.state,\n setValue: this.setValue,\n });\n }\n}\n","import React from 'react';\nimport tokens from '@contentful/forma-36-tokens';\nimport { css, cx } from 'emotion';\n\ninterface CharCounterProps {\n value?: string;\n checkConstraint: (n: number) => boolean;\n}\n\nconst styles = {\n invalid: css({\n color: tokens.red600,\n }),\n};\n\nexport function CharCounter(props: CharCounterProps) {\n let count = 0;\n if (props.value) {\n count = props.value.length;\n }\n const valid = count === 0 || props.checkConstraint(count);\n return (\n <span\n data-status-code={valid ? null : 'invalid-size'}\n className={cx({\n [styles.invalid]: !valid,\n })}>\n {count} characters\n </span>\n );\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-use-before-define */\n\nimport React from 'react';\nimport isNumber from 'lodash/isNumber';\nimport ReactDOM from 'react-dom';\nimport { Modal } from '@contentful/forma-36-react-components';\nimport { OpenCustomWidgetOptions } from '@contentful/app-sdk';\n\nexport function open(componentRenderer: (params: { onClose: Function; isShown: boolean }) => any) {\n let rootDom: any = null;\n\n const getRoot = () => {\n if (rootDom === null) {\n rootDom = document.createElement('div');\n rootDom.setAttribute('id', 'field-editor-modal-root');\n document.body.appendChild(rootDom);\n }\n return rootDom;\n };\n\n return new Promise((resolve) => {\n let currentConfig = { onClose, isShown: true };\n\n function render({ onClose, isShown }: { onClose: Function; isShown: boolean }) {\n ReactDOM.render(componentRenderer({ onClose, isShown }), getRoot());\n }\n\n function onClose(...args: any[]) {\n currentConfig = {\n ...currentConfig,\n isShown: false,\n };\n render(currentConfig);\n resolve(...args);\n getRoot().remove();\n }\n\n render(currentConfig);\n });\n}\n\nexport function openDialog<T>(\n options: OpenCustomWidgetOptions,\n Component: React.SFC<{ onClose: (result: T) => void }>\n) {\n const key = Date.now();\n const size = isNumber(options.width) ? `${options.width}px` : options.width;\n return open(({ isShown, onClose }) => {\n const onCloseHandler = () => onClose();\n return (\n <Modal\n key={key}\n shouldCloseOnOverlayClick={options.shouldCloseOnOverlayClick || false}\n shouldCloseOnEscapePress={options.shouldCloseOnEscapePress || false}\n allowHeightOverflow={options.allowHeightOverflow || false}\n position={options.position || 'center'}\n isShown={isShown}\n onClose={onCloseHandler}\n size={size || '700px'}>\n {() => (\n <>\n {options.title && (\n <Modal.Header testId=\"dialog-title\" title={options.title} onClose={onCloseHandler} />\n )}\n <div style={{ minHeight: options.minHeight || 'auto' }}>\n <Component onClose={onClose as any} />\n </div>\n </>\n )}\n </Modal>\n );\n });\n}\n\nexport default {\n openDialog,\n};\n","import get from 'lodash/get';\nimport isObject from 'lodash/isObject';\nimport isString from 'lodash/isString';\nimport { File, ContentType, Entry, ContentTypeField, EntrySys } from '../typesEntity';\n\nfunction titleOrDefault(title: string | undefined, defaultTitle: string): string {\n if (!isString(title)) {\n return defaultTitle;\n }\n if (title) {\n const trimmedTitle = title.trim();\n if (trimmedTitle.length === 0) {\n return defaultTitle;\n }\n return trimmedTitle;\n }\n return defaultTitle;\n}\n\nexport function getFieldValue({\n /**\n * Expects an entity fetched with a flag Skip-Transformation: true\n */\n entity,\n fieldId,\n localeCode,\n defaultLocaleCode\n}: {\n entity: {\n fields: { [key: string]: { [valueKey: string]: string | undefined } };\n };\n fieldId: string;\n localeCode: string;\n defaultLocaleCode: string;\n}): string | undefined {\n const values = get(entity, ['fields', fieldId]);\n if (!isObject(values)) {\n return;\n }\n\n const firstLocaleCode = Object.keys(values)[0];\n\n return values[localeCode] || values[defaultLocaleCode] || values[firstLocaleCode];\n}\n\nexport function getAssetTitle({\n asset,\n localeCode,\n defaultLocaleCode,\n defaultTitle\n}: {\n asset: Entry;\n localeCode: string;\n defaultLocaleCode: string;\n defaultTitle: string;\n}) {\n const title = getFieldValue({\n entity: asset,\n fieldId: 'title',\n localeCode,\n defaultLocaleCode\n });\n return titleOrDefault(title, defaultTitle);\n}\n\nexport function getEntityDescription({\n entity,\n contentType,\n localeCode,\n defaultLocaleCode\n}: {\n entity: Entry;\n contentType?: ContentType;\n localeCode: string;\n defaultLocaleCode: string;\n}): string {\n if (!contentType) {\n return '';\n }\n\n const isTextField = (field: ContentTypeField) => ['Symbol', 'Text'].includes(field.type);\n const isDisplayField = (field: ContentTypeField) => field.id === contentType.displayField;\n const isMaybeSlugField = (field: ContentTypeField) => /\\bslug\\b/.test(field.name);\n const isDescriptionField = (field: ContentTypeField) =>\n isTextField(field) && !isDisplayField(field) && !isMaybeSlugField(field);\n\n const descriptionField = contentType.fields.find(isDescriptionField);\n\n if (!descriptionField) {\n return '';\n }\n\n return (\n getFieldValue({ entity, fieldId: descriptionField.id, localeCode, defaultLocaleCode }) || ''\n );\n}\n\nexport function getEntryTitle({\n entry,\n contentType,\n localeCode,\n defaultLocaleCode,\n defaultTitle\n}: {\n entry: Entry;\n contentType?: ContentType;\n localeCode: string;\n defaultLocaleCode: string;\n defaultTitle: string;\n}) {\n let title;\n\n if (!contentType) {\n return defaultTitle;\n }\n\n const displayField = contentType.displayField;\n if (!displayField) {\n return defaultTitle;\n }\n\n const displayFieldInfo = contentType.fields.find(field => field.id === displayField);\n\n if (!displayFieldInfo) {\n return defaultTitle;\n }\n\n // when localization for a field is \"turned off\",\n // we don't clean up the \"old\" localized data, so it is still in the response.\n // Therefore, we're checking if displayField is localizable.\n if (displayFieldInfo.localized) {\n title = getFieldValue({\n entity: entry,\n fieldId: displayField,\n localeCode,\n defaultLocaleCode\n });\n if (!title) {\n // Older content types may return id/apiName, but some entry lookup paths do not fetch raw data\n // In order to still return a title in this case, look for displayField as apiName in content type,\n // ...but still look for displayField as a field in the entry\n title = getFieldValue({\n entity: entry,\n fieldId: displayFieldInfo.id,\n localeCode,\n defaultLocaleCode\n });\n }\n } else {\n title = getFieldValue({\n entity: entry,\n fieldId: displayField,\n defaultLocaleCode,\n localeCode: ''\n });\n if (!title) {\n title = getFieldValue({\n entity: entry,\n fieldId: displayFieldInfo.id,\n defaultLocaleCode,\n localeCode: ''\n });\n }\n }\n\n return titleOrDefault(title, defaultTitle);\n}\n\nexport function getEntryStatus(sys: EntrySys) {\n if (!sys || (sys.type !== 'Entry' && sys.type !== 'Asset')) {\n throw new TypeError('Invalid entity metadata object');\n }\n if (sys.deletedVersion) {\n return 'deleted';\n } else if (sys.archivedVersion) {\n return 'archived';\n } else if (sys.publishedVersion) {\n if (sys.version > sys.publishedVersion + 1) {\n return 'changed';\n } else {\n return 'published';\n }\n } else {\n return 'draft';\n }\n}\n\n/**\n * Gets a promise resolving with a localized asset image field representing a\n * given entities file. The promise may resolve with null.\n */\nexport const getEntryImage = async (\n {\n entry,\n contentType,\n localeCode\n }: {\n entry: Entry;\n contentType?: ContentType;\n localeCode: string;\n defaultLocaleCode: string;\n },\n getAsset: (assetId: string) => Promise<unknown>\n): Promise<null | File> => {\n if (!contentType) {\n return null;\n }\n\n const assetLink = contentType.fields.find(\n field => field.type === 'Link' && field.linkType === 'Asset'\n );\n\n if (!assetLink) {\n return null;\n }\n\n const assetId = get(entry.fields, [assetLink.id, localeCode, 'sys', 'id']);\n\n if (!assetId) {\n return null;\n }\n\n try {\n const asset = await getAsset(assetId);\n const file = get(asset, ['fields', 'file', localeCode]);\n const isImage = Boolean(get(file, ['details', 'image'], false));\n return isImage ? file : null;\n } catch (e) {\n return null;\n }\n};\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * This module parses field validations as a constraint and checks\n * values against that constraint.\n */\n\nimport isNumber from 'lodash/isNumber';\nimport { ValidationType } from '../types';\n\nexport function fromFieldValidations(\n validations: Record<string, any>[] = [],\n fieldType: 'Symbol' | 'Text'\n): ValidationType {\n const sizeValidation = validations.find(v => 'size' in v);\n const size = (sizeValidation && sizeValidation.size) || {};\n const min = size.min;\n const max = size.max;\n\n if (isNumber(min) && isNumber(max)) {\n return {\n type: 'min-max',\n min,\n max\n };\n } else if (isNumber(min)) {\n return {\n type: 'min',\n min\n };\n } else if (isNumber(max)) {\n return {\n type: 'max',\n max\n };\n } else {\n return {\n type: 'max',\n max: fieldType === 'Symbol' ? 256 : 50000\n };\n }\n}\n\nexport function makeChecker(constraint: ValidationType) {\n return function checkConstraint(length: number) {\n if (constraint.type === 'max') {\n return length <= constraint.max;\n } else if (constraint.type === 'min') {\n return length >= constraint.min;\n } else {\n return length >= constraint.min && length <= constraint.max;\n }\n };\n}\n","import React from 'react';\nimport { ValidationType } from './types';\n\ninterface CharValidationProps {\n constraints: ValidationType;\n}\n\nexport function CharValidation(props: CharValidationProps) {\n const { constraints } = props;\n\n if (constraints.type === 'max') {\n return <span>Maximum {constraints.max} characters</span>;\n } else if (constraints.type === 'min') {\n return <span>Requires at least {constraints.min} characters</span>;\n } else {\n return (\n <span>\n Requires between {constraints.min} and {constraints.max} characters\n </span>\n );\n }\n}\n","import React from 'react';\nimport { Note } from '@contentful/forma-36-react-components';\n\nexport function PredefinedValuesError() {\n return (\n <Note noteType=\"warning\" testId=\"predefined-values-warning\">\n The widget failed to initialize. You can fix the problem by providing predefined values under\n the validations tab in the field settings.\n </Note>\n );\n}\n","import { File } from '../typesEntity';\n\n/**\n * Checks whether the passed content type matches one of our valid MIME types\n */\nexport function isValidImage(file: File) {\n const validMimeTypes = [\n 'image/bmp',\n 'image/x-windows-bmp',\n 'image/gif',\n 'image/webp',\n // This is not a valid MIME type but we supported it in the past.\n 'image/jpg',\n 'image/jpeg',\n 'image/pjpeg',\n 'image/x-jps',\n 'image/png',\n 'image/svg+xml',\n ];\n\n return validMimeTypes.includes(file.contentType);\n}\n","/**\n * Transforms a number into a localized string (en-US)\n * toLocaleString(1000); // \"1,000\"\n * @param {Number} number\n */\nexport function toLocaleString(number: number) {\n return number.toLocaleString('en-US');\n}\n\nfunction formatFloat(value: number, localize: boolean) {\n return localize\n ? toLocaleString(value)\n : value\n .toFixed(2)\n // remove floating point if not necessary\n .replace(/\\.(0)*$|0*$/, '');\n}\n\ntype UnitOfMeasure = 'PB' | 'TB' | 'GB' | 'MB' | 'KB' | 'B';\n\n/**\n * Make a storage unit number more readable by making them smaller\n * shortenStorageUnit(1000, 'GB'); // \"1 TB\"\n * shortenStorageUnit(0.001, 'TB'); // \"1 GB\"\n * @param value\n * @param uom Unit of measure\n * @returns\n */\nexport function shortenStorageUnit(value: number, uom: UnitOfMeasure) {\n if (value <= 0) {\n return '0 B';\n }\n\n const units: UnitOfMeasure[] = ['PB', 'TB', 'GB', 'MB', 'KB', 'B'];\n\n const getBigger = (unit: UnitOfMeasure): UnitOfMeasure => units[units.indexOf(unit) - 1];\n const getSmaller = (unit: UnitOfMeasure) => units[units.indexOf(unit) + 1];\n const isBiggestUnit = (unit: UnitOfMeasure) => units.indexOf(unit) === 0;\n const isSmallestUnit = (unit: UnitOfMeasure) => units.indexOf(unit) === units.length - 1;\n\n const reduce = (number: number, unit: UnitOfMeasure): { number: number; unit: UnitOfMeasure } => {\n if (number < 0.99 && !isSmallestUnit(unit)) {\n return reduce(number * 1000, getSmaller(unit));\n } else if (number >= 1000 && !isBiggestUnit(unit)) {\n return reduce(number / 1000, getBigger(unit));\n } else {\n return { number, unit };\n }\n };\n\n const { number, unit } = reduce(value, uom);\n\n return `${formatFloat(number, false)} ${unit}`;\n}\n"],"names":["runtime","exports","Op","Object","prototype","hasOwn","hasOwnProperty","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","define","obj","key","value","defineProperty","enumerable","configurable","writable","err","wrap","innerFn","outerFn","self","tryLocsList","generator","create","Generator","context","Context","_invoke","state","method","arg","Error","undefined","done","delegate","delegateResult","maybeInvokeDelegate","ContinueSentinel","sent","_sent","dispatchException","abrupt","record","tryCatch","type","makeInvokeMethod","fn","call","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","this","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","AsyncIterator","PromiseImpl","previousPromise","callInvokeWithMethodAndArg","resolve","reject","invoke","result","__await","then","unwrapped","error","TypeError","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","length","i","doneResult","constructor","displayName","isGeneratorFunction","genFun","ctor","name","mark","setPrototypeOf","__proto__","awrap","async","Promise","iter","toString","keys","object","reverse","pop","skipTempReset","prev","charAt","slice","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","thrown","delegateYield","module","regeneratorRuntime","accidentalStrictMode","Function","FieldConnector","props","_this","isEmptyValue","setState","triggerSetValueCallbacks","throttle","field","removeValue","setValue","leading","initialValue","getValue","isLocalValueChange","externalReset","lastRemoteValue","disabled","isInitiallyDisabled","errors","componentDidMount","unsubscribeErrors","onSchemaErrorsChanged","_this2","unsubscribeDisabled","onIsDisabledChanged","unsubscribeValue","onValueChanged","currentState","isEqualValues","componentWillUnmount","render","children","React","Component","value1","value2","isEqual","styles","css","color","tokens","red600","open","componentRenderer","rootDom","getRoot","document","createElement","setAttribute","body","appendChild","currentConfig","onClose","isShown","remove","ReactDOM","openDialog","options","Date","now","size","isNumber","width","onCloseHandler","Modal","shouldCloseOnOverlayClick","shouldCloseOnEscapePress","allowHeightOverflow","position","title","Header","testId","style","minHeight","titleOrDefault","defaultTitle","isString","trimmedTitle","trim","getFieldValue","localeCode","defaultLocaleCode","get","entity","fieldId","isObject","firstLocaleCode","asset","contentType","descriptionField","fields","find","includes","isTextField","id","displayField","isDisplayField","test","isMaybeSlugField","displayFieldInfo","localized","sys","deletedVersion","archivedVersion","publishedVersion","version","getAsset","assetLink","linkType","assetId","file","isImage","Boolean","validations","fieldType","sizeValidation","v","min","max","constraint","count","valid","checkConstraint","className","cx","constraints","Note","noteType","uom","units","reduce","number","unit","indexOf","isSmallestUnit","getSmaller","isBiggestUnit","getBigger","localize","toFixed","replace","formatFloat","toLocaleString"],"mappings":"yqCAOIA,EAAW,SAAUC,OAGnBC,EAAKC,OAAOC,UACZC,EAASH,EAAGI,eAEZC,EAA4B,mBAAXC,OAAwBA,OAAS,GAClDC,EAAiBF,EAAQG,UAAY,aACrCC,EAAsBJ,EAAQK,eAAiB,kBAC/CC,EAAoBN,EAAQO,aAAe,yBAEtCC,EAAOC,EAAKC,EAAKC,UACxBf,OAAOgB,eAAeH,EAAKC,EAAK,CAC9BC,MAAOA,EACPE,YAAY,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CrF,gDACoB6F,EAAYR,YAAUQ,EAAYP,sJCZxDtF,gBAAC8F,QAAKC,SAAS,UAAUxD,OAAO,gOCAPuC,SACJ,CACrB,YACA,sBACA,YACA,yBAGA,aACA,cACA,cACA,YACA,iBAGoBlB,SAASkB,EAAKtB,kDCQHnN,EAAe2P,MAC5C3P,GAAS,QACJ,UAGH4P,EAAyB,CAAC,KAAM,KAAM,KAAM,KAAM,KAAM,OAO/C,SAATC,EAAUC,EAAgBC,UAC1BD,EAAS,MAHQ,SAACC,UAAwBH,EAAMI,QAAQD,KAAUH,EAAM5K,OAAS,EAG/DiL,CAAeF,GAC5BF,EAAgB,IAATC,EANC,SAACC,UAAwBH,EAAMA,EAAMI,QAAQD,GAAQ,GAMvCG,CAAWH,IAC/BD,GAAU,MAND,SAACC,UAAgD,IAAxBH,EAAMI,QAAQD,GAM7BI,CAAcJ,GACnCF,EAAOC,EAAS,IATT,SAACC,UAAuCH,EAAMA,EAAMI,QAAQD,GAAQ,GASrDK,CAAUL,IAEhC,CAAED,OAAAA,EAAQC,KAAAA,GAIIF,CAAO7P,EAAO2P,GAAvBI,IAAAA,YAzClB,SAAqB/P,EAAeqQ,UAG9BrQ,EACGsQ,QAAQ,GAERC,QAAQ,cAAe,IAqCpBC,GAFFV,YAEgCC,mCA/CXD,UACtBA,EAAOW,eAAe"}
1
+ {"version":3,"file":"field-editor-shared.cjs.production.min.js","sources":["../../../node_modules/regenerator-runtime/runtime.js","../src/FieldConnector.ts","../src/CharCounter.tsx","../src/ModalDialogLauncher.tsx","../src/utils/entityHelpers.ts","../src/utils/constraints.ts","../src/CharValidation.tsx","../src/PredefinedValuesError.tsx","../src/utils/isValidImage.ts","../src/utils/shortenStorageUnit.ts"],"sourcesContent":["/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n IteratorPrototype[iteratorSymbol] = function () {\n return this;\n };\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;\n GeneratorFunctionPrototype.constructor = GeneratorFunction;\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n AsyncIterator.prototype[asyncIteratorSymbol] = function () {\n return this;\n };\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n Gp[iteratorSymbol] = function() {\n return this;\n };\n\n Gp.toString = function() {\n return \"[object Generator]\";\n };\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n}\n","import React from 'react';\nimport isEqual from 'lodash/isEqual';\nimport throttle from 'lodash/throttle';\nimport { FieldAPI, ValidationError } from '@contentful/app-sdk';\n\ntype Nullable = null | undefined;\n\nexport interface FieldConnectorChildProps<ValueType> {\n isLocalValueChange: boolean;\n externalReset: number;\n lastRemoteValue: ValueType | Nullable;\n value: ValueType | Nullable;\n disabled: boolean;\n errors: ValidationError[];\n setValue: (value: ValueType | Nullable) => Promise<unknown>;\n}\n\ninterface FieldConnectorState<ValueType> {\n isLocalValueChange: boolean;\n externalReset: number;\n lastRemoteValue: ValueType | Nullable;\n value: ValueType | Nullable;\n disabled: boolean;\n errors: ValidationError[];\n}\n\ninterface FieldConnectorProps<ValueType> {\n field: FieldAPI;\n isInitiallyDisabled: boolean;\n children: (state: FieldConnectorChildProps<ValueType>) => React.ReactNode;\n isEmptyValue: (value: ValueType | null) => boolean;\n isEqualValues: (value1: ValueType | Nullable, value2: ValueType | Nullable) => boolean;\n throttle: number;\n}\n\nexport class FieldConnector<ValueType> extends React.Component<\n FieldConnectorProps<ValueType>,\n FieldConnectorState<ValueType>\n> {\n static defaultProps = {\n children: () => {\n return null;\n },\n // eslint-disable-next-line\n isEmptyValue: (value: any | Nullable) => {\n return value === null || value === '';\n },\n // eslint-disable-next-line\n isEqualValues: (value1: any | Nullable, value2: any | Nullable) => {\n return isEqual(value1, value2);\n },\n throttle: 300,\n };\n\n constructor(props: FieldConnectorProps<ValueType>) {\n super(props);\n const initialValue = props.field.getValue();\n this.state = {\n isLocalValueChange: false,\n externalReset: 0,\n value: initialValue,\n lastRemoteValue: initialValue,\n disabled: props.isInitiallyDisabled,\n errors: [],\n };\n }\n\n unsubscribeErrors: Function | null = null;\n unsubscribeDisabled: Function | null = null;\n unsubscribeValue: Function | null = null;\n\n setValue = async (value: ValueType | Nullable) => {\n if (this.props.isEmptyValue(value ?? null)) {\n this.setState({ value: undefined });\n } else {\n this.setState({ value });\n }\n\n await this.triggerSetValueCallbacks(value);\n };\n\n triggerSetValueCallbacks = throttle(\n (value: ValueType | Nullable) => {\n return new Promise((resolve, reject) => {\n if (this.props.isEmptyValue(value ?? null)) {\n this.props.field.removeValue().then(resolve).catch(reject);\n } else {\n this.props.field.setValue(value).then(resolve).catch(reject);\n }\n });\n },\n this.props.throttle,\n {\n leading: this.props.throttle === 0,\n }\n );\n\n componentDidMount() {\n const { field } = this.props;\n this.unsubscribeErrors = field.onSchemaErrorsChanged((errors: ValidationError[]) => {\n this.setState({\n errors: errors || [],\n });\n });\n this.unsubscribeDisabled = field.onIsDisabledChanged((disabled: boolean) => {\n this.setState({\n disabled,\n });\n });\n this.unsubscribeValue = field.onValueChanged((value: ValueType | Nullable) => {\n this.setState((currentState) => {\n const isLocalValueChange = this.props.isEqualValues(value, currentState.value);\n const lastRemoteValue = isLocalValueChange ? currentState.lastRemoteValue : value;\n const externalReset = currentState.externalReset + (isLocalValueChange ? 0 : 1);\n return {\n value,\n lastRemoteValue,\n isLocalValueChange,\n externalReset,\n };\n });\n });\n }\n\n componentWillUnmount() {\n if (typeof this.unsubscribeErrors === 'function') {\n this.unsubscribeErrors();\n }\n if (typeof this.unsubscribeDisabled === 'function') {\n this.unsubscribeDisabled();\n }\n if (typeof this.unsubscribeValue === 'function') {\n this.unsubscribeValue();\n }\n }\n\n render() {\n return this.props.children({\n ...this.state,\n setValue: this.setValue,\n });\n }\n}\n","import React from 'react';\nimport tokens from '@contentful/f36-tokens';\nimport { css, cx } from 'emotion';\n\ninterface CharCounterProps {\n value?: string;\n checkConstraint: (n: number) => boolean;\n}\n\nconst styles = {\n invalid: css({\n color: tokens.red600,\n }),\n};\n\nexport function CharCounter(props: CharCounterProps) {\n let count = 0;\n if (props.value) {\n count = props.value.length;\n }\n const valid = count === 0 || props.checkConstraint(count);\n return (\n <span\n data-status-code={valid ? null : 'invalid-size'}\n className={cx({\n [styles.invalid]: !valid,\n })}>\n {count} characters\n </span>\n );\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-use-before-define */\n\nimport React from 'react';\nimport isNumber from 'lodash/isNumber';\nimport ReactDOM from 'react-dom';\nimport { Modal, ModalHeader } from '@contentful/f36-components';\nimport { OpenCustomWidgetOptions } from '@contentful/app-sdk';\n\nexport function open(componentRenderer: (params: { onClose: Function; isShown: boolean }) => any) {\n let rootDom: any = null;\n\n const getRoot = () => {\n if (rootDom === null) {\n rootDom = document.createElement('div');\n rootDom.setAttribute('id', 'field-editor-modal-root');\n document.body.appendChild(rootDom);\n }\n return rootDom;\n };\n\n return new Promise((resolve) => {\n let currentConfig = { onClose, isShown: true };\n\n function render({ onClose, isShown }: { onClose: Function; isShown: boolean }) {\n ReactDOM.render(componentRenderer({ onClose, isShown }), getRoot());\n }\n\n function onClose(...args: any[]) {\n currentConfig = {\n ...currentConfig,\n isShown: false,\n };\n render(currentConfig);\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n resolve(...args);\n getRoot().remove();\n }\n\n render(currentConfig);\n });\n}\n\nexport function openDialog<T>(\n options: OpenCustomWidgetOptions,\n Component: React.SFC<{ onClose: (result: T) => void }>\n) {\n const key = Date.now();\n const size = isNumber(options.width) ? `${options.width}px` : options.width;\n return open(({ isShown, onClose }) => {\n const onCloseHandler = () => onClose();\n return (\n <Modal\n key={key}\n shouldCloseOnOverlayClick={options.shouldCloseOnOverlayClick || false}\n shouldCloseOnEscapePress={options.shouldCloseOnEscapePress || false}\n allowHeightOverflow={options.allowHeightOverflow || false}\n position={options.position || 'center'}\n isShown={isShown}\n onClose={onCloseHandler}\n size={size || '700px'}>\n {() => (\n <>\n {options.title && (\n <ModalHeader testId=\"dialog-title\" title={options.title} onClose={onCloseHandler} />\n )}\n <div style={{ minHeight: options.minHeight || 'auto' }}>\n <Component onClose={onClose as any} />\n </div>\n </>\n )}\n </Modal>\n );\n });\n}\n\nexport default {\n openDialog,\n};\n","import get from 'lodash/get';\nimport isObject from 'lodash/isObject';\nimport isString from 'lodash/isString';\nimport { File, ContentType, Entry, ContentTypeField } from '../typesEntity';\n\nfunction titleOrDefault(title: string | undefined, defaultTitle: string): string {\n if (!isString(title)) {\n return defaultTitle;\n }\n if (title) {\n const trimmedTitle = title.trim();\n if (trimmedTitle.length === 0) {\n return defaultTitle;\n }\n return trimmedTitle;\n }\n return defaultTitle;\n}\n\nexport function getFieldValue({\n /**\n * Expects an entity fetched with a flag Skip-Transformation: true\n */\n entity,\n fieldId,\n localeCode,\n defaultLocaleCode,\n}: {\n entity: {\n fields: { [key: string]: { [valueKey: string]: string | undefined } };\n };\n fieldId: string;\n localeCode: string;\n defaultLocaleCode: string;\n}): string | undefined {\n const values = get(entity, ['fields', fieldId]);\n if (!isObject(values)) {\n return;\n }\n\n const firstLocaleCode = Object.keys(values)[0];\n\n return values[localeCode] || values[defaultLocaleCode] || values[firstLocaleCode];\n}\n\nexport function getAssetTitle({\n asset,\n localeCode,\n defaultLocaleCode,\n defaultTitle,\n}: {\n asset: Entry;\n localeCode: string;\n defaultLocaleCode: string;\n defaultTitle: string;\n}) {\n const title = getFieldValue({\n entity: asset,\n fieldId: 'title',\n localeCode,\n defaultLocaleCode,\n });\n return titleOrDefault(title, defaultTitle);\n}\n\n/**\n * Returns true if field is an Asset\n *\n * @param field\n * @returns {boolean}\n */\nexport const isAssetField = (field: ContentTypeField): boolean =>\n field.type === 'Link' && field.linkType === 'Asset';\n/**\n * Returns true if field is a Title\n */\nexport function isDisplayField({\n field,\n contentType,\n}: {\n field: ContentTypeField;\n contentType: ContentType;\n}): boolean {\n return field.id === contentType.displayField;\n}\n\n/**\n * Returns true if field is a short Description\n */\nexport function isDescriptionField({\n field,\n contentType,\n}: {\n field: ContentTypeField;\n contentType: ContentType;\n}) {\n const isTextField = (field: ContentTypeField) => ['Symbol', 'Text'].includes(field.type);\n const isMaybeSlugField = (field: ContentTypeField) => /\\bslug\\b/.test(field.name);\n return isTextField(field) && !isDisplayField({ field, contentType }) && !isMaybeSlugField(field);\n}\n\nexport function getEntityDescription({\n entity,\n contentType,\n localeCode,\n defaultLocaleCode,\n}: {\n entity: Entry;\n contentType?: ContentType;\n localeCode: string;\n defaultLocaleCode: string;\n}): string {\n if (!contentType) {\n return '';\n }\n\n const descriptionField = contentType.fields.find((field) =>\n isDescriptionField({ field, contentType })\n );\n\n if (!descriptionField) {\n return '';\n }\n\n return (\n getFieldValue({ entity, fieldId: descriptionField.id, localeCode, defaultLocaleCode }) || ''\n );\n}\n\nexport function getEntryTitle({\n entry,\n contentType,\n localeCode,\n defaultLocaleCode,\n defaultTitle,\n}: {\n entry: Entry;\n contentType?: ContentType;\n localeCode: string;\n defaultLocaleCode: string;\n defaultTitle: string;\n}) {\n let title;\n\n if (!contentType) {\n return defaultTitle;\n }\n\n const displayField = contentType.displayField;\n if (!displayField) {\n return defaultTitle;\n }\n\n const displayFieldInfo = contentType.fields.find((field) => field.id === displayField);\n\n if (!displayFieldInfo) {\n return defaultTitle;\n }\n\n // when localization for a field is \"turned off\",\n // we don't clean up the \"old\" localized data, so it is still in the response.\n // Therefore, we're checking if displayField is localizable.\n if (displayFieldInfo.localized) {\n title = getFieldValue({\n entity: entry,\n fieldId: displayField,\n localeCode,\n defaultLocaleCode,\n });\n if (!title) {\n // Older content types may return id/apiName, but some entry lookup paths do not fetch raw data\n // In order to still return a title in this case, look for displayField as apiName in content type,\n // ...but still look for displayField as a field in the entry\n title = getFieldValue({\n entity: entry,\n fieldId: displayFieldInfo.id,\n localeCode,\n defaultLocaleCode,\n });\n }\n } else {\n title = getFieldValue({\n entity: entry,\n fieldId: displayField,\n defaultLocaleCode,\n localeCode: '',\n });\n if (!title) {\n title = getFieldValue({\n entity: entry,\n fieldId: displayFieldInfo.id,\n defaultLocaleCode,\n localeCode: '',\n });\n }\n }\n\n return titleOrDefault(title, defaultTitle);\n}\n\nexport function getEntryStatus(sys: Entry['sys']) {\n if (!sys || (sys.type !== 'Entry' && sys.type !== 'Asset')) {\n throw new TypeError('Invalid entity metadata object');\n }\n if (sys.deletedVersion) {\n return 'deleted';\n } else if (sys.archivedVersion) {\n return 'archived';\n } else if (sys.publishedVersion) {\n if (sys.version > sys.publishedVersion + 1) {\n return 'changed';\n } else {\n return 'published';\n }\n } else {\n return 'draft';\n }\n}\n\n/**\n * Gets a promise resolving with a localized asset image field representing a\n * given entities file. The promise may resolve with null.\n */\nexport const getEntryImage = async (\n {\n entry,\n contentType,\n localeCode,\n }: {\n entry: Entry;\n contentType?: ContentType;\n localeCode: string;\n defaultLocaleCode: string;\n },\n getAsset: (assetId: string) => Promise<unknown>\n): Promise<null | File> => {\n if (!contentType) {\n return null;\n }\n\n const assetLink = contentType.fields.find(isAssetField);\n\n if (!assetLink) {\n return null;\n }\n\n const assetId = get(entry.fields, [assetLink.id, localeCode, 'sys', 'id']);\n\n if (!assetId) {\n return null;\n }\n\n try {\n const asset = await getAsset(assetId);\n const file = get(asset, ['fields', 'file', localeCode]);\n const isImage = Boolean(get(file, ['details', 'image'], false));\n return isImage ? file : null;\n } catch (e) {\n return null;\n }\n};\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * This module parses field validations as a constraint and checks\n * values against that constraint.\n */\n\nimport isNumber from 'lodash/isNumber';\nimport { ValidationType } from '../types';\n\nexport function fromFieldValidations(\n validations: Record<string, any>[] = [],\n fieldType: 'Symbol' | 'Text'\n): ValidationType {\n const sizeValidation = validations.find((v) => 'size' in v);\n const size = (sizeValidation && sizeValidation.size) || {};\n const min = size.min;\n const max = size.max;\n\n if (isNumber(min) && isNumber(max)) {\n return {\n type: 'min-max',\n min,\n max,\n };\n } else if (isNumber(min)) {\n return {\n type: 'min',\n min,\n };\n } else if (isNumber(max)) {\n return {\n type: 'max',\n max,\n };\n } else {\n return {\n type: 'max',\n max: fieldType === 'Symbol' ? 256 : 50000,\n };\n }\n}\n\nexport function makeChecker(constraint: ValidationType) {\n return function checkConstraint(length: number) {\n if (constraint.type === 'max') {\n return length <= constraint.max;\n } else if (constraint.type === 'min') {\n return length >= constraint.min;\n } else {\n return length >= constraint.min && length <= constraint.max;\n }\n };\n}\n","import React from 'react';\nimport { ValidationType } from './types';\n\ninterface CharValidationProps {\n constraints: ValidationType;\n}\n\nexport function CharValidation(props: CharValidationProps) {\n const { constraints } = props;\n\n if (constraints.type === 'max') {\n return <span>Maximum {constraints.max} characters</span>;\n } else if (constraints.type === 'min') {\n return <span>Requires at least {constraints.min} characters</span>;\n } else {\n return (\n <span>\n Requires between {constraints.min} and {constraints.max} characters\n </span>\n );\n }\n}\n","import React from 'react';\nimport { Note } from '@contentful/f36-note';\n\nexport function PredefinedValuesError() {\n return (\n <Note variant=\"warning\" testId=\"predefined-values-warning\">\n The widget failed to initialize. You can fix the problem by providing predefined values under\n the validations tab in the field settings.\n </Note>\n );\n}\n","import { File } from '../typesEntity';\n\n/**\n * Checks whether the passed content type matches one of our valid MIME types\n */\nexport function isValidImage(file: File) {\n const validMimeTypes = [\n 'image/bmp',\n 'image/x-windows-bmp',\n 'image/gif',\n 'image/webp',\n // This is not a valid MIME type but we supported it in the past.\n 'image/jpg',\n 'image/jpeg',\n 'image/pjpeg',\n 'image/x-jps',\n 'image/png',\n 'image/svg+xml',\n ];\n\n return validMimeTypes.includes(file.contentType);\n}\n","/**\n * Transforms a number into a localized string (en-US)\n * toLocaleString(1000); // \"1,000\"\n * @param {Number} number\n */\nexport function toLocaleString(number: number) {\n return number.toLocaleString('en-US');\n}\n\nfunction formatFloat(value: number, localize: boolean) {\n return localize\n ? toLocaleString(value)\n : value\n .toFixed(2)\n // remove floating point if not necessary\n .replace(/\\.(0)*$|0*$/, '');\n}\n\ntype UnitOfMeasure = 'PB' | 'TB' | 'GB' | 'MB' | 'KB' | 'B';\n\n/**\n * Make a storage unit number more readable by making them smaller\n * shortenStorageUnit(1000, 'GB'); // \"1 TB\"\n * shortenStorageUnit(0.001, 'TB'); // \"1 GB\"\n * @param value\n * @param uom Unit of measure\n * @returns\n */\nexport function shortenStorageUnit(value: number, uom: UnitOfMeasure) {\n if (value <= 0) {\n return '0 B';\n }\n\n const units: UnitOfMeasure[] = ['PB', 'TB', 'GB', 'MB', 'KB', 'B'];\n\n const getBigger = (unit: UnitOfMeasure): UnitOfMeasure => units[units.indexOf(unit) - 1];\n const getSmaller = (unit: UnitOfMeasure) => units[units.indexOf(unit) + 1];\n const isBiggestUnit = (unit: UnitOfMeasure) => units.indexOf(unit) === 0;\n const isSmallestUnit = (unit: UnitOfMeasure) => units.indexOf(unit) === units.length - 1;\n\n const reduce = (number: number, unit: UnitOfMeasure): { number: number; unit: UnitOfMeasure } => {\n if (number < 0.99 && !isSmallestUnit(unit)) {\n return reduce(number * 1000, getSmaller(unit));\n } else if (number >= 1000 && !isBiggestUnit(unit)) {\n return reduce(number / 1000, getBigger(unit));\n } else {\n return { number, unit };\n }\n };\n\n const { number, unit } = reduce(value, uom);\n\n return `${formatFloat(number, false)} ${unit}`;\n}\n"],"names":["runtime","exports","Op","Object","prototype","hasOwn","hasOwnProperty","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","define","obj","key","value","defineProperty","enumerable","configurable","writable","err","wrap","innerFn","outerFn","self","tryLocsList","generator","create","Generator","context","Context","_invoke","state","method","arg","Error","undefined","done","delegate","delegateResult","maybeInvokeDelegate","ContinueSentinel","sent","_sent","dispatchException","abrupt","record","tryCatch","type","makeInvokeMethod","fn","call","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","this","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","AsyncIterator","PromiseImpl","previousPromise","callInvokeWithMethodAndArg","resolve","reject","invoke","result","__await","then","unwrapped","error","TypeError","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","length","i","doneResult","constructor","displayName","isGeneratorFunction","genFun","ctor","name","mark","setPrototypeOf","__proto__","awrap","async","Promise","iter","toString","keys","object","reverse","pop","skipTempReset","prev","charAt","slice","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","thrown","delegateYield","module","regeneratorRuntime","accidentalStrictMode","Function","FieldConnector","props","_this","isEmptyValue","setState","triggerSetValueCallbacks","throttle","field","removeValue","setValue","leading","initialValue","getValue","isLocalValueChange","externalReset","lastRemoteValue","disabled","isInitiallyDisabled","errors","componentDidMount","unsubscribeErrors","onSchemaErrorsChanged","_this2","unsubscribeDisabled","onIsDisabledChanged","unsubscribeValue","onValueChanged","currentState","isEqualValues","componentWillUnmount","render","children","React","Component","value1","value2","isEqual","styles","css","color","tokens","red600","open","componentRenderer","rootDom","getRoot","document","createElement","setAttribute","body","appendChild","currentConfig","onClose","isShown","remove","ReactDOM","openDialog","options","Date","now","size","isNumber","width","onCloseHandler","Modal","shouldCloseOnOverlayClick","shouldCloseOnEscapePress","allowHeightOverflow","position","title","ModalHeader","testId","style","minHeight","titleOrDefault","defaultTitle","isString","trimmedTitle","trim","getFieldValue","localeCode","defaultLocaleCode","get","entity","fieldId","isObject","firstLocaleCode","isAssetField","linkType","isDisplayField","id","contentType","displayField","isDescriptionField","includes","isTextField","test","isMaybeSlugField","asset","descriptionField","fields","find","displayFieldInfo","localized","sys","deletedVersion","archivedVersion","publishedVersion","version","getAsset","assetLink","assetId","file","isImage","Boolean","validations","fieldType","sizeValidation","v","min","max","constraint","count","valid","checkConstraint","className","cx","constraints","Note","variant","uom","units","reduce","number","unit","indexOf","isSmallestUnit","getSmaller","isBiggestUnit","getBigger","localize","toFixed","replace","formatFloat","toLocaleString"],"mappings":"2rCAOIA,EAAW,SAAUC,OAGnBC,EAAKC,OAAOC,UACZC,EAASH,EAAGI,eAEZC,EAA4B,mBAAXC,OAAwBA,OAAS,GAClDC,EAAiBF,EAAQG,UAAY,aACrCC,EAAsBJ,EAAQK,eAAiB,kBAC/CC,EAAoBN,EAAQO,aAAe,yBAEtCC,EAAOC,EAAKC,EAAKC,UACxBf,OAAOgB,eAAeH,EAAKC,EAAK,CAC9BC,MAAOA,EACPE,YAAY,EACZC,cAAc,EACdC,UAAU,IAELN,EAAIC,OAIXF,EAAO,GAAI,IACX,MAAOQ,GACPR,EAAS,SAASC,EAAKC,EAAKC,UACnBF,EAAIC,GAAOC,YAIbM,EAAKC,EAASC,EAASC,EAAMC,OAGhCC,EAAY1B,OAAO2B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,EAAYP,sJCZxDxF,gBAACgG,QAAKC,QAAQ,UAAU1D,OAAO,gOCANyC,SACJ,CACrB,YACA,sBACA,YACA,yBAGA,aACA,cACA,cACA,YACA,iBAGoBlB,SAASkB,EAAKrB,kDCQHtN,EAAe6P,MAC5C7P,GAAS,QACJ,UAGH8P,EAAyB,CAAC,KAAM,KAAM,KAAM,KAAM,KAAM,OAO/C,SAATC,EAAUC,EAAgBC,UAC1BD,EAAS,MAHQ,SAACC,UAAwBH,EAAMI,QAAQD,KAAUH,EAAM9K,OAAS,EAG/DmL,CAAeF,GAC5BF,EAAgB,IAATC,EANC,SAACC,UAAwBH,EAAMA,EAAMI,QAAQD,GAAQ,GAMvCG,CAAWH,IAC/BD,GAAU,MAND,SAACC,UAAgD,IAAxBH,EAAMI,QAAQD,GAM7BI,CAAcJ,GACnCF,EAAOC,EAAS,IATT,SAACC,UAAuCH,EAAMA,EAAMI,QAAQD,GAAQ,GASrDK,CAAUL,IAEhC,CAAED,OAAAA,EAAQC,KAAAA,GAIIF,CAAO/P,EAAO6P,GAAvBI,IAAAA,YAzClB,SAAqBjQ,EAAeuQ,UAG9BvQ,EACGwQ,QAAQ,GAERC,QAAQ,cAAe,IAqCpBC,GAFFV,YAEgCC,mCA/CXD,UACtBA,EAAOW,eAAe"}
@@ -1,11 +1,12 @@
1
1
  import React from 'react';
2
2
  import isEqual from 'lodash-es/isEqual';
3
3
  import throttle from 'lodash-es/throttle';
4
- import { Note, Modal } from '@contentful/forma-36-react-components';
5
- import tokens from '@contentful/forma-36-tokens';
4
+ import { Note } from '@contentful/f36-note';
5
+ import tokens from '@contentful/f36-tokens';
6
6
  import { cx, css } from 'emotion';
7
7
  import isNumber from 'lodash-es/isNumber';
8
8
  import ReactDOM from 'react-dom';
9
+ import { Modal, ModalHeader } from '@contentful/f36-components';
9
10
  import get from 'lodash-es/get';
10
11
  import isObject from 'lodash-es/isObject';
11
12
  import isString from 'lodash-es/isString';
@@ -945,7 +946,7 @@ FieldConnector.defaultProps = {
945
946
 
946
947
  function PredefinedValuesError() {
947
948
  return React.createElement(Note, {
948
- noteType: "warning",
949
+ variant: "warning",
949
950
  testId: "predefined-values-warning"
950
951
  }, "The widget failed to initialize. You can fix the problem by providing predefined values under the validations tab in the field settings.");
951
952
  }
@@ -1015,7 +1016,9 @@ function open(componentRenderer) {
1015
1016
  currentConfig = _extends({}, currentConfig, {
1016
1017
  isShown: false
1017
1018
  });
1018
- render(currentConfig);
1019
+ render(currentConfig); // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1020
+ // @ts-ignore
1021
+
1019
1022
  resolve.apply(void 0, arguments);
1020
1023
  getRoot().remove();
1021
1024
  }
@@ -1044,7 +1047,7 @@ function openDialog(options, Component) {
1044
1047
  onClose: onCloseHandler,
1045
1048
  size: size || '700px'
1046
1049
  }, function () {
1047
- return React.createElement(React.Fragment, null, options.title && React.createElement(Modal.Header, {
1050
+ return React.createElement(React.Fragment, null, options.title && React.createElement(ModalHeader, {
1048
1051
  testId: "dialog-title",
1049
1052
  title: options.title,
1050
1053
  onClose: onCloseHandler
@@ -1114,33 +1117,62 @@ function getAssetTitle(_ref2) {
1114
1117
  });
1115
1118
  return titleOrDefault(title, defaultTitle);
1116
1119
  }
1117
- function getEntityDescription(_ref3) {
1118
- var entity = _ref3.entity,
1119
- contentType = _ref3.contentType,
1120
- localeCode = _ref3.localeCode,
1121
- defaultLocaleCode = _ref3.defaultLocaleCode;
1120
+ /**
1121
+ * Returns true if field is an Asset
1122
+ *
1123
+ * @param field
1124
+ * @returns {boolean}
1125
+ */
1122
1126
 
1123
- if (!contentType) {
1124
- return '';
1125
- }
1127
+ var isAssetField = function isAssetField(field) {
1128
+ return field.type === 'Link' && field.linkType === 'Asset';
1129
+ };
1130
+ /**
1131
+ * Returns true if field is a Title
1132
+ */
1133
+
1134
+ function isDisplayField(_ref3) {
1135
+ var field = _ref3.field,
1136
+ contentType = _ref3.contentType;
1137
+ return field.id === contentType.displayField;
1138
+ }
1139
+ /**
1140
+ * Returns true if field is a short Description
1141
+ */
1142
+
1143
+ function isDescriptionField(_ref4) {
1144
+ var field = _ref4.field,
1145
+ contentType = _ref4.contentType;
1126
1146
 
1127
1147
  var isTextField = function isTextField(field) {
1128
1148
  return ['Symbol', 'Text'].includes(field.type);
1129
1149
  };
1130
1150
 
1131
- var isDisplayField = function isDisplayField(field) {
1132
- return field.id === contentType.displayField;
1133
- };
1134
-
1135
1151
  var isMaybeSlugField = function isMaybeSlugField(field) {
1136
1152
  return /\bslug\b/.test(field.name);
1137
1153
  };
1138
1154
 
1139
- var isDescriptionField = function isDescriptionField(field) {
1140
- return isTextField(field) && !isDisplayField(field) && !isMaybeSlugField(field);
1141
- };
1155
+ return isTextField(field) && !isDisplayField({
1156
+ field: field,
1157
+ contentType: contentType
1158
+ }) && !isMaybeSlugField(field);
1159
+ }
1160
+ function getEntityDescription(_ref5) {
1161
+ var entity = _ref5.entity,
1162
+ contentType = _ref5.contentType,
1163
+ localeCode = _ref5.localeCode,
1164
+ defaultLocaleCode = _ref5.defaultLocaleCode;
1165
+
1166
+ if (!contentType) {
1167
+ return '';
1168
+ }
1142
1169
 
1143
- var descriptionField = contentType.fields.find(isDescriptionField);
1170
+ var descriptionField = contentType.fields.find(function (field) {
1171
+ return isDescriptionField({
1172
+ field: field,
1173
+ contentType: contentType
1174
+ });
1175
+ });
1144
1176
 
1145
1177
  if (!descriptionField) {
1146
1178
  return '';
@@ -1153,12 +1185,12 @@ function getEntityDescription(_ref3) {
1153
1185
  defaultLocaleCode: defaultLocaleCode
1154
1186
  }) || '';
1155
1187
  }
1156
- function getEntryTitle(_ref4) {
1157
- var entry = _ref4.entry,
1158
- contentType = _ref4.contentType,
1159
- localeCode = _ref4.localeCode,
1160
- defaultLocaleCode = _ref4.defaultLocaleCode,
1161
- defaultTitle = _ref4.defaultTitle;
1188
+ function getEntryTitle(_ref6) {
1189
+ var entry = _ref6.entry,
1190
+ contentType = _ref6.contentType,
1191
+ localeCode = _ref6.localeCode,
1192
+ defaultLocaleCode = _ref6.defaultLocaleCode,
1193
+ defaultTitle = _ref6.defaultTitle;
1162
1194
  var title;
1163
1195
 
1164
1196
  if (!contentType) {
@@ -1246,13 +1278,13 @@ function getEntryStatus(sys) {
1246
1278
  */
1247
1279
 
1248
1280
  var getEntryImage = /*#__PURE__*/function () {
1249
- var _ref6 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(_ref5, getAsset) {
1281
+ var _ref8 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(_ref7, getAsset) {
1250
1282
  var entry, contentType, localeCode, assetLink, assetId, asset, file, isImage;
1251
1283
  return runtime_1.wrap(function _callee$(_context) {
1252
1284
  while (1) {
1253
1285
  switch (_context.prev = _context.next) {
1254
1286
  case 0:
1255
- entry = _ref5.entry, contentType = _ref5.contentType, localeCode = _ref5.localeCode;
1287
+ entry = _ref7.entry, contentType = _ref7.contentType, localeCode = _ref7.localeCode;
1256
1288
 
1257
1289
  if (contentType) {
1258
1290
  _context.next = 3;
@@ -1262,9 +1294,7 @@ var getEntryImage = /*#__PURE__*/function () {
1262
1294
  return _context.abrupt("return", null);
1263
1295
 
1264
1296
  case 3:
1265
- assetLink = contentType.fields.find(function (field) {
1266
- return field.type === 'Link' && field.linkType === 'Asset';
1267
- });
1297
+ assetLink = contentType.fields.find(isAssetField);
1268
1298
 
1269
1299
  if (assetLink) {
1270
1300
  _context.next = 6;
@@ -1308,7 +1338,7 @@ var getEntryImage = /*#__PURE__*/function () {
1308
1338
  }));
1309
1339
 
1310
1340
  return function getEntryImage(_x, _x2) {
1311
- return _ref6.apply(this, arguments);
1341
+ return _ref8.apply(this, arguments);
1312
1342
  };
1313
1343
  }();
1314
1344
 
@@ -1316,6 +1346,9 @@ var entityHelpers = {
1316
1346
  __proto__: null,
1317
1347
  getFieldValue: getFieldValue,
1318
1348
  getAssetTitle: getAssetTitle,
1349
+ isAssetField: isAssetField,
1350
+ isDisplayField: isDisplayField,
1351
+ isDescriptionField: isDescriptionField,
1319
1352
  getEntityDescription: getEntityDescription,
1320
1353
  getEntryTitle: getEntryTitle,
1321
1354
  getEntryStatus: getEntryStatus,