@beinformed/react 1.0.0-beta.0 → 1.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/{beforeRenderHooks-Gb0tcmCY.d.ts → beforeRenderHooks-B0CWdI7P.d.ts} +1 -1
- package/dist/{beforeRenderHooks-CNvsMmi8.d.cts → beforeRenderHooks-CKR6eECI.d.cts} +1 -1
- package/dist/chunk-4IDEBSD5.js +2 -0
- package/dist/chunk-4IDEBSD5.js.map +1 -0
- package/dist/chunk-6AKWSGWH.js +2 -0
- package/dist/chunk-6AKWSGWH.js.map +1 -0
- package/dist/chunk-6EK3TAMN.js +2 -0
- package/dist/chunk-6EK3TAMN.js.map +1 -0
- package/dist/{chunk-YJNJVQFW.js → chunk-7JMMW2FM.js} +2 -2
- package/dist/{chunk-YJNJVQFW.js.map → chunk-7JMMW2FM.js.map} +1 -1
- package/dist/{chunk-X2C7CKOK.js → chunk-A3D5R7MI.js} +2 -2
- package/dist/{chunk-X2C7CKOK.js.map → chunk-A3D5R7MI.js.map} +1 -1
- package/dist/{chunk-HDOILTJ2.js → chunk-BV77KA4Y.js} +2 -2
- package/dist/chunk-BV77KA4Y.js.map +1 -0
- package/dist/{chunk-K3DTH6XN.js → chunk-FBCZEJSD.js} +2 -2
- package/dist/chunk-FBCZEJSD.js.map +1 -0
- package/dist/{chunk-DI7VM62A.js → chunk-GD4NSZBN.js} +2 -2
- package/dist/chunk-GD4NSZBN.js.map +1 -0
- package/dist/chunk-HTR32BUX.js +2 -0
- package/dist/{chunk-6KRECIRI.js.map → chunk-HTR32BUX.js.map} +1 -1
- package/dist/chunk-ITSZQHGD.js +2 -0
- package/dist/chunk-ITSZQHGD.js.map +1 -0
- package/dist/chunk-JWOBKHOJ.js +2 -0
- package/dist/chunk-JWOBKHOJ.js.map +1 -0
- package/dist/chunk-KZB56W7Q.js +2 -0
- package/dist/chunk-KZB56W7Q.js.map +1 -0
- package/dist/chunk-KZLW2NHD.js +2 -0
- package/dist/chunk-KZLW2NHD.js.map +1 -0
- package/dist/{chunk-WBPDMDW4.js → chunk-L7DO7AZT.js} +2 -2
- package/dist/{chunk-WBPDMDW4.js.map → chunk-L7DO7AZT.js.map} +1 -1
- package/dist/{chunk-VG3QU524.js → chunk-OQK6SSUD.js} +3 -3
- package/dist/chunk-OQK6SSUD.js.map +1 -0
- package/dist/chunk-SPV6MD7J.js +2 -0
- package/dist/chunk-SPV6MD7J.js.map +1 -0
- package/dist/{chunk-Z2Y3OPVI.js → chunk-TAWZ2VIM.js} +2 -2
- package/dist/chunk-TAWZ2VIM.js.map +1 -0
- package/dist/{chunk-A4USB53Q.js → chunk-TDYPCNQI.js} +2 -2
- package/dist/{chunk-A4USB53Q.js.map → chunk-TDYPCNQI.js.map} +1 -1
- package/dist/chunk-VXOYOMNN.js +2 -0
- package/dist/chunk-VXOYOMNN.js.map +1 -0
- package/dist/chunk-WEJGEXAP.js +2 -0
- package/dist/chunk-WEJGEXAP.js.map +1 -0
- package/dist/client/index.cjs +5 -5
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +3 -3
- package/dist/client/index.d.ts +3 -3
- package/dist/client/index.js +1 -1
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.cts +193 -69
- package/dist/hooks/index.d.ts +193 -69
- package/dist/hooks/index.js +1 -1
- package/dist/i18n/index.cjs +1 -1
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.d.cts +22 -4
- package/dist/i18n/index.d.ts +22 -4
- package/dist/i18n/index.js +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -8
- package/dist/index.d.ts +9 -8
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/redux/index.cjs +1 -1
- package/dist/redux/index.cjs.map +1 -1
- package/dist/redux/index.d.cts +215 -28
- package/dist/redux/index.d.ts +215 -28
- package/dist/redux/index.js +1 -1
- package/dist/server/index.cjs +2 -2
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +3 -3
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +1 -1
- package/dist/{styled-components.d-CrkOxzv5.d.cts → styled-components.d-C19eFejP.d.cts} +7 -13
- package/dist/{styled-components.d-CrkOxzv5.d.ts → styled-components.d-C19eFejP.d.ts} +7 -13
- package/dist/theme/index.cjs +1 -1
- package/dist/theme/index.cjs.map +1 -1
- package/dist/theme/index.d.cts +1 -1
- package/dist/theme/index.d.ts +1 -1
- package/dist/theme/index.js +1 -1
- package/dist/{useForm-DW-a5mcV.d.ts → useForm-BWwXFuv5.d.cts} +3 -3
- package/dist/{useForm-CG_DMYfZ.d.cts → useForm-DqaU9T78.d.ts} +3 -3
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +6 -1
- package/dist/utils/index.d.ts +6 -1
- package/dist/utils/index.js +1 -1
- package/package.json +16 -16
- package/dist/chunk-3OP2KQ56.js +0 -2
- package/dist/chunk-3OP2KQ56.js.map +0 -1
- package/dist/chunk-4AC7YQ5Q.js +0 -2
- package/dist/chunk-4AC7YQ5Q.js.map +0 -1
- package/dist/chunk-6KRECIRI.js +0 -2
- package/dist/chunk-AMFWIR2R.js +0 -2
- package/dist/chunk-AMFWIR2R.js.map +0 -1
- package/dist/chunk-B7PQLTVC.js +0 -2
- package/dist/chunk-B7PQLTVC.js.map +0 -1
- package/dist/chunk-DI7VM62A.js.map +0 -1
- package/dist/chunk-HDOILTJ2.js.map +0 -1
- package/dist/chunk-JYAETKRB.js +0 -2
- package/dist/chunk-JYAETKRB.js.map +0 -1
- package/dist/chunk-K3DTH6XN.js.map +0 -1
- package/dist/chunk-RKGGCIUD.js +0 -2
- package/dist/chunk-RKGGCIUD.js.map +0 -1
- package/dist/chunk-UZIZDEU6.js +0 -2
- package/dist/chunk-UZIZDEU6.js.map +0 -1
- package/dist/chunk-VFLYA5WJ.js +0 -2
- package/dist/chunk-VFLYA5WJ.js.map +0 -1
- package/dist/chunk-VG3QU524.js.map +0 -1
- package/dist/chunk-X3N2NQVZ.js +0 -2
- package/dist/chunk-X3N2NQVZ.js.map +0 -1
- package/dist/chunk-Y7ESITVO.js +0 -2
- package/dist/chunk-Y7ESITVO.js.map +0 -1
- package/dist/chunk-YG7XDCNV.js +0 -2
- package/dist/chunk-YG7XDCNV.js.map +0 -1
- package/dist/chunk-Z2Y3OPVI.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_defineProperty.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseAssignValue.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_assignValue.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseSet.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_basePickBy.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseHasIn.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/hasIn.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_basePick.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/flatten.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_apply.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_overRest.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/constant.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/identity.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseSetToString.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_shortOut.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_setToString.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_flatRest.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/pick.js","../src/hooks/useAllFormsOnModel.ts","../src/hooks/useModularUIRequest.ts","../src/hooks/useAuthentication.ts","../src/hooks/useContent.ts","../src/hooks/useProgressIndicator.ts","../src/hooks/useDeepCompareEffect.ts","../src/hooks/useForm.ts","../src/hooks/useModularUI.ts","../src/hooks/useModal.ts","../src/hooks/useModelCatalog.ts","../src/hooks/useModularUIBasic.ts","../src/hooks/useRouter.ts","../src/hooks/useModels.ts","../src/hooks/useModularUIModel.ts","../src/hooks/useNotification.ts","../src/hooks/usePreference.ts"],"sourcesContent":["var getNative = require('./_getNative');\n\nvar defineProperty = (function() {\n try {\n var func = getNative(Object, 'defineProperty');\n func({}, '', {});\n return func;\n } catch (e) {}\n}());\n\nmodule.exports = defineProperty;\n","var defineProperty = require('./_defineProperty');\n\n/**\n * The base implementation of `assignValue` and `assignMergeValue` without\n * value checks.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction baseAssignValue(object, key, value) {\n if (key == '__proto__' && defineProperty) {\n defineProperty(object, key, {\n 'configurable': true,\n 'enumerable': true,\n 'value': value,\n 'writable': true\n });\n } else {\n object[key] = value;\n }\n}\n\nmodule.exports = baseAssignValue;\n","var baseAssignValue = require('./_baseAssignValue'),\n eq = require('./eq');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\nmodule.exports = assignValue;\n","var assignValue = require('./_assignValue'),\n castPath = require('./_castPath'),\n isIndex = require('./_isIndex'),\n isObject = require('./isObject'),\n toKey = require('./_toKey');\n\n/**\n * The base implementation of `_.set`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @param {Function} [customizer] The function to customize path creation.\n * @returns {Object} Returns `object`.\n */\nfunction baseSet(object, path, value, customizer) {\n if (!isObject(object)) {\n return object;\n }\n path = castPath(path, object);\n\n var index = -1,\n length = path.length,\n lastIndex = length - 1,\n nested = object;\n\n while (nested != null && ++index < length) {\n var key = toKey(path[index]),\n newValue = value;\n\n if (key === '__proto__' || key === 'constructor' || key === 'prototype') {\n return object;\n }\n\n if (index != lastIndex) {\n var objValue = nested[key];\n newValue = customizer ? customizer(objValue, key, nested) : undefined;\n if (newValue === undefined) {\n newValue = isObject(objValue)\n ? objValue\n : (isIndex(path[index + 1]) ? [] : {});\n }\n }\n assignValue(nested, key, newValue);\n nested = nested[key];\n }\n return object;\n}\n\nmodule.exports = baseSet;\n","var baseGet = require('./_baseGet'),\n baseSet = require('./_baseSet'),\n castPath = require('./_castPath');\n\n/**\n * The base implementation of `_.pickBy` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} paths The property paths to pick.\n * @param {Function} predicate The function invoked per property.\n * @returns {Object} Returns the new object.\n */\nfunction basePickBy(object, paths, predicate) {\n var index = -1,\n length = paths.length,\n result = {};\n\n while (++index < length) {\n var path = paths[index],\n value = baseGet(object, path);\n\n if (predicate(value, path)) {\n baseSet(result, castPath(path, object), value);\n }\n }\n return result;\n}\n\nmodule.exports = basePickBy;\n","/**\n * The base implementation of `_.hasIn` without support for deep paths.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\nfunction baseHasIn(object, key) {\n return object != null && key in Object(object);\n}\n\nmodule.exports = baseHasIn;\n","var baseHasIn = require('./_baseHasIn'),\n hasPath = require('./_hasPath');\n\n/**\n * Checks if `path` is a direct or inherited property of `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n * @example\n *\n * var object = _.create({ 'a': _.create({ 'b': 2 }) });\n *\n * _.hasIn(object, 'a');\n * // => true\n *\n * _.hasIn(object, 'a.b');\n * // => true\n *\n * _.hasIn(object, ['a', 'b']);\n * // => true\n *\n * _.hasIn(object, 'b');\n * // => false\n */\nfunction hasIn(object, path) {\n return object != null && hasPath(object, path, baseHasIn);\n}\n\nmodule.exports = hasIn;\n","var basePickBy = require('./_basePickBy'),\n hasIn = require('./hasIn');\n\n/**\n * The base implementation of `_.pick` without support for individual\n * property identifiers.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} paths The property paths to pick.\n * @returns {Object} Returns the new object.\n */\nfunction basePick(object, paths) {\n return basePickBy(object, paths, function(value, path) {\n return hasIn(object, path);\n });\n}\n\nmodule.exports = basePick;\n","var baseFlatten = require('./_baseFlatten');\n\n/**\n * Flattens `array` a single level deep.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Array\n * @param {Array} array The array to flatten.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * _.flatten([1, [2, [3, [4]], 5]]);\n * // => [1, 2, [3, [4]], 5]\n */\nfunction flatten(array) {\n var length = array == null ? 0 : array.length;\n return length ? baseFlatten(array, 1) : [];\n}\n\nmodule.exports = flatten;\n","/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\nmodule.exports = apply;\n","var apply = require('./_apply');\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * A specialized version of `baseRest` which transforms the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @param {Function} transform The rest array transform.\n * @returns {Function} Returns the new function.\n */\nfunction overRest(func, start, transform) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = transform(array);\n return apply(func, this, otherArgs);\n };\n}\n\nmodule.exports = overRest;\n","/**\n * Creates a function that returns `value`.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {*} value The value to return from the new function.\n * @returns {Function} Returns the new constant function.\n * @example\n *\n * var objects = _.times(2, _.constant({ 'a': 1 }));\n *\n * console.log(objects);\n * // => [{ 'a': 1 }, { 'a': 1 }]\n *\n * console.log(objects[0] === objects[1]);\n * // => true\n */\nfunction constant(value) {\n return function() {\n return value;\n };\n}\n\nmodule.exports = constant;\n","/**\n * This method returns the first argument it receives.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'a': 1 };\n *\n * console.log(_.identity(object) === object);\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\nmodule.exports = identity;\n","var constant = require('./constant'),\n defineProperty = require('./_defineProperty'),\n identity = require('./identity');\n\n/**\n * The base implementation of `setToString` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar baseSetToString = !defineProperty ? identity : function(func, string) {\n return defineProperty(func, 'toString', {\n 'configurable': true,\n 'enumerable': false,\n 'value': constant(string),\n 'writable': true\n });\n};\n\nmodule.exports = baseSetToString;\n","/** Used to detect hot functions by number of calls within a span of milliseconds. */\nvar HOT_COUNT = 800,\n HOT_SPAN = 16;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeNow = Date.now;\n\n/**\n * Creates a function that'll short out and invoke `identity` instead\n * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`\n * milliseconds.\n *\n * @private\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new shortable function.\n */\nfunction shortOut(func) {\n var count = 0,\n lastCalled = 0;\n\n return function() {\n var stamp = nativeNow(),\n remaining = HOT_SPAN - (stamp - lastCalled);\n\n lastCalled = stamp;\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return arguments[0];\n }\n } else {\n count = 0;\n }\n return func.apply(undefined, arguments);\n };\n}\n\nmodule.exports = shortOut;\n","var baseSetToString = require('./_baseSetToString'),\n shortOut = require('./_shortOut');\n\n/**\n * Sets the `toString` method of `func` to return `string`.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar setToString = shortOut(baseSetToString);\n\nmodule.exports = setToString;\n","var flatten = require('./flatten'),\n overRest = require('./_overRest'),\n setToString = require('./_setToString');\n\n/**\n * A specialized version of `baseRest` which flattens the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @returns {Function} Returns the new function.\n */\nfunction flatRest(func) {\n return setToString(overRest(func, undefined, flatten), func + '');\n}\n\nmodule.exports = flatRest;\n","var basePick = require('./_basePick'),\n flatRest = require('./_flatRest');\n\n/**\n * Creates an object composed of the picked `object` properties.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The source object.\n * @param {...(string|string[])} [paths] The property paths to pick.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.pick(object, ['a', 'c']);\n * // => { 'a': 1, 'c': 3 }\n */\nvar pick = flatRest(function(object, paths) {\n return object == null ? {} : basePick(object, paths);\n});\n\nmodule.exports = pick;\n","import { useEffect, useState } from \"react\";\n\nimport { HTTP_METHODS } from \"@beinformed/ui/constants\";\nimport { FormModel, ListModel } from \"@beinformed/ui/models\";\n\nimport { useModularUIRequest } from \"./useModularUIRequest\";\n\nimport type { ActionModel, DetailModel, TabModel } from \"@beinformed/ui/models\";\n\nexport const useRetrieveFormsOnModel = (\n model: ListModel | DetailModel | TabModel,\n) => {\n const modularui = useModularUIRequest();\n\n const [forms, setForms] = useState(null);\n const [requestCount, setRequestCount] = useState(0);\n const [responseCount, setResponseCount] = useState(0);\n\n useEffect(() => {\n const requests = getActions(model).map((action) => {\n const href = action.selfhref.addParameter(\"commit\", \"false\");\n\n return modularui(href, { method: HTTP_METHODS.POST })\n .fetch()\n .then((form) => {\n if (form instanceof FormModel) {\n form.tokens = [];\n }\n return { [action.name]: form };\n });\n });\n\n setRequestCount(requests.length);\n\n Promise.all(requests).then((responses) => {\n // put response array in object\n const actionForms = Object.assign({}, ...responses);\n setForms(actionForms);\n setResponseCount(responses.length);\n });\n }, [model, modularui]);\n\n if (responseCount === requestCount) {\n return forms;\n }\n\n return null;\n};\n\nconst getActions = (model: ListModel | DetailModel | TabModel) => {\n if (!model.actionCollection) {\n return [];\n }\n\n const createActions = model.actionCollection\n .getActionsByType(\"create\")\n .filter((action) => !action.isDisabled);\n\n const allActions = [...createActions];\n\n if (model instanceof ListModel) {\n model.listItemCollection.forEach((listItem) => {\n const updateActions = listItem.actionCollection\n .getActionsByType(\"update\")\n .filter((action) => !action.isDisabled);\n\n allActions.push(...updateActions);\n });\n }\n\n const actions: ActionModel[] = [];\n const unique: string[] = [];\n allActions.forEach((action) => {\n if (!unique.includes(action.name)) {\n unique.push(action.name);\n actions.push(action);\n }\n });\n\n return actions;\n};\n","import { ModularUIRequest } from \"@beinformed/ui/modularui\";\nimport { createSelector } from \"reselect\";\n\nimport { useBEISelector } from \"../redux/hooks\";\nimport { getLocale } from \"../redux/i18n/i18nSelectors\";\n\nimport type { Href } from \"@beinformed/ui/models\";\nimport type { ModularUIRequestOptions } from \"@beinformed/ui/utils\";\n\nconst getModularUIRequest = createSelector([getLocale], (localeCode) => {\n return (href: Href, options?: ModularUIRequestOptions) => {\n const request = new ModularUIRequest(href, options);\n request.locale = localeCode;\n return request;\n };\n});\n\n/**\n * Creates a ModularUIRequest with the locale as available in the redux store\n */\nexport const useModularUIRequest = (): ((\n href: Href,\n options?: ModularUIRequestOptions,\n) => ModularUIRequest) => useBEISelector(getModularUIRequest);\n","import { DEFAULT_AUTHENTICATION_TYPE } from \"@beinformed/ui/constants\";\nimport { IllegalStateException } from \"@beinformed/ui/exceptions\";\nimport { getContextPathServer, logoutPath } from \"@beinformed/ui/settings\";\nimport { Cache } from \"@beinformed/ui/utils\";\n\nimport { getApplication } from \"../redux/application/applicationSelectors\";\nimport { resetAuthErrors } from \"../redux/auth/authReducer\";\nimport { login } from \"../redux/auth/signinActions\";\nimport { logout } from \"../redux/auth/signoutActions\";\nimport { useBEIDispatch, useBEISelector } from \"../redux/hooks\";\n\nimport type { AuthenticationType } from \"@beinformed/ui/modularui\";\nimport type { RootState } from \"../redux/store\";\n\n/**\n * Provides access to authentication state and actions.\n * Includes functionality for standard username/password login and redirect-based login.\n * @returns An object containing authentication status, available authentication types, error messages, and login/logout functions.\n */\nexport const useLogin = () => {\n Cache.setItem(\"isRedirectLogin\", false);\n\n const dispatch = useBEIDispatch();\n\n const application = useBEISelector(getApplication);\n const auth = useBEISelector((state: RootState) => state.auth);\n\n const isAuthenticated = application?.isLoggedIn ?? false;\n\n return {\n /**\n * Indicates whether the user is currently authenticated.\n */\n isAuthenticated,\n\n /**\n * An array of available authentication types supported by the application.\n * Defaults to an array containing the `DEFAULT_AUTHENTICATION_TYPE` if no types are available in the application state.\n */\n authenticationTypes: application?.authenticationTypes ?? [\n DEFAULT_AUTHENTICATION_TYPE,\n ],\n\n /**\n * The current authentication error message, if any.\n */\n errorMessage: auth.error,\n\n /**\n * Resets the authentication error message in the Redux store.\n */\n resetErrors: () => dispatch(resetAuthErrors()),\n\n /**\n * Attempts to log in the user with the provided username and password.\n * Dispatches the `login` action to the Redux store.\n * @param username The username for authentication.\n * @param password The password for authentication.\n */\n login: (username: string, password: string) =>\n dispatch(login({ username, password })),\n\n /**\n * Initiates a redirect-based login flow for a specific authentication type.\n * If a redirect login is already in progress, it throws an `IllegalStateException` to prevent infinite loops.\n * If the user is not currently authenticated, it sets a flag in the cache and redirects the browser to the authentication provider's redirect URI.\n * @param authenticationType The authentication type to initiate the redirect for.\n * @throws {IllegalStateException} If a redirect login is already in progress for a different authentication type.\n */\n redirectLogin: (authenticationType: AuthenticationType) => {\n if (Cache.getItem(\"isRedirectLogin\")) {\n // prevent endless loop in redirects when authentication type can't be redirected\n throw new IllegalStateException(\n `Could not redirect to '${\n authenticationType.authentication\n }' using url: '${authenticationType.redirectUri ?? \"\"}'`,\n );\n }\n\n if (!isAuthenticated) {\n Cache.setItem(\"isRedirectLogin\", true);\n window.location.assign(\n `${getContextPathServer()}${authenticationType.redirectUri ?? \"\"}`,\n );\n }\n },\n };\n};\n\n/**\n * Provides access to logout functionality.\n * Handles both standard logout and redirect-based logout scenarios.\n * @returns An object containing the authentication status, available authentication types, and the logout function.\n */\nexport const useLogout = () => {\n const dispatch = useBEIDispatch();\n const application = useBEISelector(getApplication);\n\n const LOGOUT_PATH = logoutPath();\n const BASE_PATH = getContextPathServer();\n\n const isAuthenticated = application?.isLoggedIn ?? false;\n return {\n /**\n * Indicates whether the user is currently authenticated.\n */\n isAuthenticated,\n\n /**\n * An array of available authentication types supported by the application.\n * Defaults to an array containing the `DEFAULT_AUTHENTICATION_TYPE` if no types are available in the application state.\n */\n authenticationTypes: application?.authenticationTypes ?? [\n DEFAULT_AUTHENTICATION_TYPE,\n ],\n\n /**\n * Initiates the logout process.\n * If a redirect login was in progress, it redirects the user to the server's logout endpoint with a return URL to the current origin.\n * Otherwise, it dispatches the `logout` action to the Redux store.\n */\n logout: () => {\n if (Cache.getItem(\"isRedirectLogin\")) {\n const origin = window.location.origin;\n const url = `${origin}${BASE_PATH}/logout?url=${origin}${BASE_PATH}${LOGOUT_PATH}`;\n Cache.setItem(\"isRedirectLogin\", false);\n window.location.assign(url);\n } else {\n return dispatch(logout());\n }\n },\n };\n};\n","import { useEffect, useState } from \"react\";\n\nimport { ModularUIRequest } from \"@beinformed/ui/modularui\";\n\nimport { useLocale } from \"../hooks/useI18n\";\nimport { useProgressIndicator } from \"../hooks/useProgressIndicator\";\n\nimport type {\n ContentModel,\n Href,\n SourceReferenceCollection,\n} from \"@beinformed/ui/models\";\n\n/**\n * Hook to retrieve multiple source references at once\n */\nexport const useContentFromSourceReferences = (\n sourceReferences: SourceReferenceCollection,\n renderChildSections: boolean,\n): ContentModel[] => {\n const [content, setContent] = useState<ContentModel[]>([]);\n const localeCode = useLocale();\n\n const { start, finish } = useProgressIndicator();\n\n const hrefs = sourceReferences\n .map((sourceReference) => sourceReference.link?.selfhref.href)\n .filter((href, index, self) => self.indexOf(href) === index)\n .map((href) => href?.toString());\n\n const allHrefs = JSON.stringify(hrefs);\n useEffect(() => {\n const requests = JSON.parse(allHrefs).map((href: Href) => {\n const modularuiRequest = new ModularUIRequest(href);\n modularuiRequest.locale = localeCode;\n return modularuiRequest.fetchContent(renderChildSections);\n });\n\n start();\n Promise.all(requests).then((responseContent) => {\n setContent(responseContent);\n finish();\n });\n\n // start and finish don't change\n }, [allHrefs, localeCode, renderChildSections]);\n\n return content;\n};\n","import { useBEIDispatch, useBEISelector } from \"../redux/hooks\";\nimport {\n finishProgress,\n resetProgress,\n startProgress,\n updateProgress,\n} from \"../redux/progressindicator/progressIndicatorActions\";\n\nimport type { RootState } from \"../redux/store\";\n\nexport const useProgressIndicator = () => {\n const dispatch = useBEIDispatch();\n const progress = useBEISelector(\n (state: RootState) => state.progressindicator,\n );\n\n return {\n ...progress,\n start: () => dispatch(startProgress()),\n finish: () => dispatch(finishProgress()),\n reset: () => dispatch(resetProgress()),\n update: (percentComplete: number) =>\n dispatch(updateProgress(percentComplete)),\n };\n};\n","import { useEffect, useRef } from \"react\";\n\nimport { dequal as deepEqual } from \"dequal/lite\";\n\ntype Callback = () => void | (() => void);\ntype DependencyList = unknown[];\n\n/**\n * As copied from https://github.com/kentcdodds/use-deep-compare-effect/\n * Need to copy this, because the dependency on dequal breaks in ie11\n */\nconst useDeepCompareMemoize = (value: DependencyList) => {\n const ref = useRef<DependencyList | null>(null);\n const signalRef = useRef<number>(0);\n\n if (!deepEqual(value, ref.current)) {\n ref.current = value;\n signalRef.current += 1;\n }\n\n return [signalRef.current];\n};\n\nexport function useDeepCompareEffect(\n callback: Callback,\n dependencies: DependencyList,\n): void {\n return useEffect(callback, useDeepCompareMemoize(dependencies));\n}\n","import { HTTP_METHODS } from \"@beinformed/ui/constants\";\nimport { FormModel, Href } from \"@beinformed/ui/models\";\nimport { getSetting } from \"@beinformed/ui/settings\";\nimport { produce } from \"immer\";\n\nimport { updateFormAttribute } from \"../redux/form/attributeActions\";\nimport { cancelForm, previousObject } from \"../redux/form/formActions\";\nimport {\n addRepeatableAttributeSet,\n cancelRepeatableAttributeSet,\n removeRepeatableAttributeSet,\n} from \"../redux/form/formAttributesetRepeatable\";\nimport { useBEIDispatch } from \"../redux/hooks\";\nimport { fetchModel } from \"../redux/modularui/fetchModel\";\nimport { removeModelByKey } from \"../redux/modularui/modelActions\";\nimport { showFormNotification } from \"../redux/notifications/notificationActions\";\nimport { useModularUI } from \"./useModularUI\";\n\nimport type {\n AttributeModel,\n FormObjectModel,\n ModularUIModel,\n} from \"@beinformed/ui/models\";\n\nexport interface UpdateFormOptions {\n autosubmit: boolean;\n autosave: boolean;\n autoupdate: boolean;\n forceUpdate?: boolean;\n /** Default true: Activate/deactivate the form object validate by an update */\n validate?: boolean;\n}\n\n/**\n * Load a form by href\n */\nexport const useForm = (\n href: string | Href,\n data?: Record<string, unknown>,\n) => {\n const formHref = new Href(href);\n\n if (!getSetting(\"ALWAYS_COMMIT_FORM\")) {\n formHref.addParameter(\"commit\", \"false\");\n }\n\n const form = useModularUI(\"form\", formHref, {\n method: HTTP_METHODS.POST,\n targetModel: FormModel,\n removeOnUnmount: true,\n data: data ? JSON.stringify(data) : undefined,\n origin: formHref.origin,\n contextPath: formHref.contextPath,\n });\n\n if (form?.model) {\n return form.model;\n }\n\n return;\n};\n\n/**\n * Form navigation methods\n */\nexport const useFormNavigation = () => {\n const dispatch = useBEIDispatch();\n\n const previous = (form: FormModel) => dispatch(previousObject(form));\n\n const cancel = (form: FormModel) => dispatch(cancelForm(form));\n\n const submit = (form: FormModel) =>\n dispatch(\n fetchModel({\n key: form.connectKey || form.key,\n href: form.selfhref,\n options: {\n method: HTTP_METHODS.POST,\n data: form.formdata,\n updateHandler: (newModel: ModularUIModel): ModularUIModel => {\n if (newModel instanceof FormModel) {\n return produce(newModel, (draft) => {\n draft.update(newModel);\n });\n }\n return newModel;\n },\n targetModel: FormModel,\n },\n }),\n );\n\n const remove = (form: FormModel) =>\n dispatch(removeModelByKey(form.connectKey || \"\"));\n\n const showFormNotificationAction = (form: FormModel) =>\n dispatch(showFormNotification(form));\n\n return {\n previous,\n cancel,\n submit,\n remove,\n showFormNotification: showFormNotificationAction,\n };\n};\n\n/**\n * Hook that returns a function to update attributes of a form object.\n * <br >\n * The returned function accepts the following options:\n *\n * - autosubmit: Automatically submit the form after a change\n * - autosav: Automatically save the form (in the background) after a change\n * - autoupdate: Automatically update the current form object after a change\n * - forceUpdate: Force the update even if conditions are not met.\n * - validate: Activate/deactivate the form object validation by an update.\n */\nexport const useAttributeUpdate = (\n form: FormModel,\n formObject: FormObjectModel,\n) => {\n const dispatch = useBEIDispatch();\n\n return (\n attribute: AttributeModel,\n inputvalue: string,\n options?: UpdateFormOptions,\n ) =>\n dispatch(\n updateFormAttribute({ form, formObject, attribute, inputvalue, options }),\n );\n};\n\n/**\n * Repeatable attributeset actions\n */\nexport const useRepeatableAttributeSet = (form: FormModel) => {\n const dispatch = useBEIDispatch();\n\n return {\n save: () => dispatch(addRepeatableAttributeSet(form)),\n cancel: (object: FormObjectModel) =>\n dispatch(cancelRepeatableAttributeSet(form, object)),\n remove: (object: FormObjectModel) =>\n dispatch(removeRepeatableAttributeSet(form, object)),\n };\n};\n","import { useEffect, useMemo, useRef } from \"react\";\n\nimport { HTTP_METHODS } from \"@beinformed/ui/constants\";\nimport { Href } from \"@beinformed/ui/models\";\nimport { useLocation } from \"react-router\";\n\nimport { useBEIDispatch, useBEISelector } from \"../redux/hooks\";\nimport { fetchModel } from \"../redux/modularui/fetchModel\";\nimport { removeModelByKey } from \"../redux/modularui/modelActions\";\nimport { useDeepCompareEffect } from \"./useDeepCompareEffect\";\nimport { useLocale } from \"./useI18n\";\n\nimport type { ModularUIRequestOptions } from \"@beinformed/ui/utils\";\nimport type { RootState } from \"../redux/store\";\n\nconst useKeyForHook = (modelKey: string, url: string) => {\n const locale = useLocale();\n return useMemo(\n () => `${modelKey}(${url.split(\"?\")[0]})(${locale})`,\n [modelKey, url, locale],\n );\n};\n\n/**\n * Use redux action and selector to retrieve the correct modular ui service model\n */\nexport const useModularUI = (\n modelKey: string,\n url: string | Href,\n options: ModularUIRequestOptions = {\n method: HTTP_METHODS.GET,\n removeOnUnmount: false,\n },\n) => {\n const dispatch = useBEIDispatch();\n const href = useMemo(() => url?.toString() || \"\", [url]);\n const key = useKeyForHook(modelKey, href);\n\n const modelSelector = useMemo(\n () => (state: RootState) => state.modularui[key],\n [key],\n );\n const model = useBEISelector(modelSelector);\n\n if (url instanceof Href) {\n options.origin = options.origin ?? url.origin;\n options.contextPath = options.contextPath ?? url.contextPath;\n }\n\n const location = useLocation();\n const redirectLocation =\n location !== null &&\n typeof location === \"object\" &&\n location.state !== null &&\n typeof location.state === \"object\" &&\n \"redirectLocation\" in location.state\n ? location.state.redirectLocation\n : undefined;\n const forceLoad =\n model == null ||\n (redirectLocation instanceof Href ? redirectLocation?.equals(href) : false);\n\n const prevOptions = useRef(options);\n const prevHref = useRef(href);\n const prevForceLoad = useRef(forceLoad);\n\n useDeepCompareEffect(() => {\n // prevent reloads when previous option had the isReload, but the new options not\n const isOldReload =\n prevHref.current === href &&\n prevOptions.current.isReload &&\n !options.isReload;\n\n const doForceLoad = forceLoad && !prevForceLoad.current;\n\n if (href !== \"\" && (doForceLoad || !isOldReload)) {\n dispatch(fetchModel({ key, href, options }));\n }\n\n prevOptions.current = options;\n prevHref.current = href;\n prevForceLoad.current = forceLoad;\n }, [key, href, options, forceLoad]);\n\n useEffect(() => {\n if (options.removeOnUnmount) {\n return () => {\n dispatch(removeModelByKey(key));\n };\n }\n return;\n }, [dispatch, key, options.removeOnUnmount]);\n\n return model;\n};\n","import { useCallback } from \"react\";\n\nimport { IllegalArgumentException } from \"@beinformed/ui/exceptions\";\n\nimport { useBEIDispatch, useBEISelector } from \"../redux/hooks\";\nimport { closeModal, showModal } from \"../redux/modals/modalsReducer\";\n\nimport type { RootState } from \"../redux/store\";\n\ntype ModalHook = (modalId: string) => {\n key: string | null;\n size?: string | null;\n visible: boolean;\n show: () => void;\n close: () => void;\n};\n\n/**\n * Manage modals\n */\nexport const useModal: ModalHook = (modalId: string) => {\n if (!modalId) {\n throw new IllegalArgumentException(\n \"Missing modalId argument for useModal hook\",\n );\n }\n\n const dispatch = useBEIDispatch();\n const modal = useBEISelector((state: RootState) =>\n state.modals.modals.find((m) => m.key === modalId),\n );\n\n const show = useCallback(() => {\n dispatch(showModal(modalId));\n }, [dispatch, modalId]);\n\n const close = useCallback(() => {\n dispatch(closeModal(modalId));\n }, [dispatch, modalId]);\n\n return {\n key: modal ? modal.key : null,\n size: modal ? modal.size : null,\n visible: modal ? modal.visible : false,\n show,\n close,\n };\n};\n","import {\n ConceptIndexModel,\n ContentIndexModel,\n ContentTOCModel,\n ContentTypeModel,\n Href,\n ModelCatalogModel,\n} from \"@beinformed/ui/models\";\nimport { createHref, filterParameters } from \"@beinformed/ui/utils\";\n\nimport { useBEIDispatch, useBEISelector } from \"../redux/hooks\";\nimport { updateEntryDate } from \"../redux/modelcatalog/modelCatalogReducer\";\nimport { getEntryDate } from \"../redux/modelcatalog/modelCatalogSelectors\";\nimport { useModularUIBasic } from \"./useModularUIBasic\";\nimport { useLocation } from \"./useRouter\";\n\nimport type { ConceptDetailModel, ContentModel } from \"@beinformed/ui/models\";\nimport type { ISO_DATE } from \"@beinformed/ui/types\";\nimport type { UseModularUIBasicOptions } from \"./useModularUIBasic\";\n\nexport interface SearchFilter {\n index?: string;\n label?: string;\n type?: string | string[];\n modelCategory?: string | string[];\n entryDate?: string;\n}\n\nexport const useModelCatalog = (\n options?: UseModularUIBasicOptions<ModelCatalogModel>,\n) =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n ...options,\n });\n\nexport const useConceptIndex = (\n href: string | Href,\n key = \"conceptindex\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n) => {\n const { entryDate } = useEntryDate();\n const url = filterParameters(href, [\n \"index\",\n \"label\",\n \"modelcategory\",\n \"type\",\n ]);\n url.setParameter(\"entryDate\", entryDate);\n\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n ...options,\n });\n};\n\nexport const useConceptDetail = (\n concept: string | Href,\n key = \"conceptdetail\",\n options?: UseModularUIBasicOptions<ConceptDetailModel>,\n) => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"concepts\", concept, entryDate, location, []);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n ...options,\n });\n};\n\nexport const useContentIndex = (\n href: string | Href,\n key = \"contentindex\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n) => {\n const url = filterParameters(href, [\"index\", \"label\", \"type\"]);\n return useModularUIBasic(key, url, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n ...options,\n });\n};\n\nexport const useContentTOC = (\n content: string | Href,\n key = \"contenttoc\",\n options?: UseModularUIBasicOptions<ContentTOCModel>,\n) => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"content\", content, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n ...options,\n });\n};\n\nexport const useContent = (\n content: string | Href,\n key = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n) => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"content\", content, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\", \"ContentTOC\"],\n ...options,\n });\n};\n\nexport const useCompleteSource = (\n content: string | Href,\n key = \"content\",\n options?: UseModularUIBasicOptions<ContentModel | ContentTOCModel>,\n) => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const contentHref = new Href(content);\n contentHref.removeParameter(\"complete\");\n contentHref.addParameter(\"complete\", \"true\");\n\n const href = createHref(\"content\", contentHref, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\", \"ContentTOC\"],\n ...options,\n });\n};\n\nexport const useContentType = (\n contentType: string | Href,\n key = \"contenttypes\",\n options?: UseModularUIBasicOptions<ContentTypeModel>,\n) => {\n const href = createHref(\n \"contenttypes\",\n contentType,\n undefined,\n undefined,\n [],\n );\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n ...options,\n });\n};\n\nexport const useRelatedConcepts = (\n href: string | Href,\n key = \"relatedconcepts\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n) => {\n const { entryDate } = useEntryDate();\n const url = filterParameters(href, [\"modelcategory\"]);\n url.setParameter(\"entryDate\", entryDate);\n\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n ...options,\n });\n};\n\nconst getSearchHref = (uri: string, filters: SearchFilter) => {\n const filterString = [];\n\n for (const key of Object.keys(filters)) {\n const filterValue = filters[key as keyof SearchFilter];\n if (filterValue) {\n let value: string = Array.isArray(filterValue)\n ? filterValue.join(\",\")\n : filterValue;\n if (key === \"type\") {\n value = value.replace(\"#\", \"%23\"); // handles un-encoded #\n }\n filterString.push(`${key}=${value}`);\n }\n }\n\n return filterString.length ? `${uri}?${filterString.join(\"&\")}` : uri;\n};\n\nexport const useConceptSearch = (\n filters: SearchFilter,\n key: string | \"conceptSearch\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n) => {\n const href = getSearchHref(\"/concepts\", filters);\n return useConceptIndex(href, key, options);\n};\n\nexport const useContentSearch = (\n filters: SearchFilter,\n key: string | \"contentSearch\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n) => {\n const href = getSearchHref(\"/content\", filters);\n return useContentIndex(href, key, options);\n};\n\n/**\n * Retrieve and update the entrydate for the modelcatalog\n */\nexport const useEntryDate = () => {\n const dispatch = useBEIDispatch();\n const entryDate = useBEISelector(getEntryDate);\n\n return {\n entryDate,\n setEntryDate: (entryDate: ISO_DATE) => dispatch(updateEntryDate(entryDate)),\n };\n};\n","import { useMemo } from \"react\";\n\nimport { useModularUI } from \"./useModularUI\";\nimport { useLocation } from \"./useRouter\";\n\nimport type { Href } from \"@beinformed/ui/models\";\nimport type { ModularUIResponse } from \"@beinformed/ui/modularui\";\n\nexport interface UseModularUIBasicOptions<T> {\n expectedModels?: string[];\n targetModel?: new (modularuiResponse: ModularUIResponse) => T;\n forceTargetModel?: boolean;\n origin?: string;\n contextPath?: string;\n cache?: boolean;\n}\n\n// Helper to create useModularUI options\nconst createUseModularUIOptions = <T>(\n options: UseModularUIBasicOptions<T>,\n href: string,\n location: unknown,\n): Record<string, unknown> => {\n const baseOptions: Record<string, unknown> = {\n targetModel: undefined,\n forceTargetModel: undefined,\n isReload: false,\n origin: undefined,\n contextPath: undefined,\n cache: false,\n };\n\n // Handle targetModel and forceTargetModel\n\n if (options.targetModel) {\n baseOptions.targetModel = options.targetModel;\n baseOptions.forceTargetModel = options.forceTargetModel;\n }\n\n // Handle cache option\n if (options.cache) {\n baseOptions.cache = options.cache;\n }\n\n // Check for reload if location matches href\n if (\n location !== null &&\n typeof location === \"object\" &&\n \"state\" in location &&\n location.state !== null &&\n typeof location.state === \"object\" &&\n \"reload\" in location.state &&\n \"pathname\" in location &&\n typeof location.pathname === \"string\" &&\n location.pathname.startsWith(href)\n ) {\n baseOptions.isReload = true;\n }\n\n // Handle origin and contextPath options\n baseOptions.origin = options.origin ?? baseOptions.origin;\n baseOptions.contextPath = options.contextPath ?? baseOptions.contextPath;\n\n return baseOptions;\n};\n\n// Helper to validate the model against expectedModels\nconst validateModel = (model: unknown, expectedModels: string[]) => {\n if (expectedModels.length > 0) {\n const isCorrectModel = expectedModels.some((expectedModel) => {\n if (model !== null && typeof model === \"object\" && \"type\" in model) {\n return model.type === expectedModel;\n }\n return;\n });\n if (!isCorrectModel) {\n console.warn(model, \"is not of instance\", expectedModels);\n }\n }\n};\n\n/**\n * useModularUIBasic Hook\n */\nexport const useModularUIBasic = <T>(\n key: string,\n href: string | Href,\n options: UseModularUIBasicOptions<T> = {\n expectedModels: [],\n targetModel: undefined,\n forceTargetModel: false,\n origin: undefined,\n contextPath: undefined,\n },\n): T | undefined => {\n const location = useLocation();\n const memoizedHref = useMemo(() => href.toString(), [href]);\n const useModularUIOptions = useMemo(\n () => createUseModularUIOptions(options, memoizedHref, location),\n [options, memoizedHref, location],\n );\n\n const modularUI = useModularUI(key, href, useModularUIOptions);\n const expectedModels = useMemo(\n () => options.expectedModels ?? [],\n [options.expectedModels],\n );\n\n return useMemo((): T | undefined => {\n if (modularUI?.model) {\n validateModel(modularUI.model, expectedModels);\n return modularUI.model as T;\n }\n return undefined;\n }, [expectedModels, modularUI]);\n};\n","import { useBEIDispatch, useBEISelector } from \"../redux/hooks\";\nimport {\n go,\n goBack,\n goForward,\n push,\n replace,\n} from \"../redux/router/routerActions\";\n\nimport type { RouterLocation } from \"../redux/router/routerReducer\";\nimport type { RootState } from \"../redux/store\";\n\nexport const useLocation = () =>\n useBEISelector((state: RootState) => state.router.location);\n\nexport const useLocationKey = () => useLocation()?.key ?? \"\";\n\nexport const useQuerystring = () => useLocation()?.search;\n\nexport const usePathname = () => useLocation()?.pathname;\n\nexport const useNavigation = () => {\n const dispatch = useBEIDispatch();\n\n return {\n push: (location: RouterLocation | string, state?: RootState) =>\n dispatch(push(location, state)),\n replace: (location: RouterLocation | string, state?: RootState) =>\n dispatch(replace(location, state)),\n go: (delta: number) => dispatch(go(delta)),\n goBack: () => dispatch(goBack()),\n goForward: () => dispatch(goForward()),\n };\n};\n","import { createSelector } from \"reselect\";\n\nimport { useBEIDispatch, useBEISelector } from \"../redux/hooks\";\nimport { MODULARUI_STATUS } from \"../redux/modularui/constants\";\nimport { reloadModel } from \"../redux/modularui/reloadModel\";\n\nimport type { ModularUIModel } from \"@beinformed/ui/models\";\nimport type { ModularUIRequestOptions } from \"@beinformed/ui/utils\";\nimport type { RootState } from \"../redux/store\";\n\ntype ReloadCallback = (model: ModularUIModel | undefined) => boolean;\n\ntype UseModels = () => {\n reload: (model: ModularUIModel, options?: Record<string, unknown>) => void;\n reloadWithFilter: (\n callbackFn: ReloadCallback,\n options?: Record<string, unknown>,\n ) => void;\n};\n\n/**\n * Hook that contains the reload property that can be used to reload a model\n */\nexport const useModels: UseModels = () => {\n const dispatch = useBEIDispatch();\n\n const selectModularUI = (state: RootState) => state.modularui;\n const selector = createSelector([selectModularUI], (modularui) => {\n const models = [];\n const keys = Object.keys(modularui);\n for (const key of keys) {\n const model = modularui[key];\n if (model?.status === MODULARUI_STATUS.FINISHED) {\n models.push(model.model);\n }\n }\n return models;\n });\n\n const modularuiModels = useBEISelector(selector);\n\n return {\n reload: (model: ModularUIModel, options?: ModularUIRequestOptions) => {\n dispatch(reloadModel(model, options));\n },\n reloadWithFilter: (\n callbackFn: ReloadCallback,\n options?: Record<string, unknown>,\n ) => {\n const modelsToReload = modularuiModels.filter(callbackFn);\n for (const modelToReload of modelsToReload) {\n if (modelToReload) {\n dispatch(reloadModel(modelToReload, options));\n }\n }\n },\n };\n};\n","import {\n ApplicationModel,\n CaseSearchModel,\n CaseViewModel,\n DetailModel,\n GroupingPanelModel,\n ListDetailModel,\n ListModel,\n TabModel,\n UserProfileModel,\n} from \"@beinformed/ui/models\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\n\nimport type { Href } from \"@beinformed/ui/models\";\n\ninterface HookOptions {\n origin?: string;\n contextPath?: string;\n}\n\n/**\n * Load application\n */\nexport const useApplication = (options?: HookOptions) =>\n useModularUIBasic(\"application\", \"/\", {\n expectedModels: [\"Application\"],\n targetModel: ApplicationModel,\n ...options,\n });\n\n/**\n * Load a tab by href\n */\nexport const useTab = (href: string | Href, options?: HookOptions) =>\n useModularUIBasic(\"tab\", href, {\n expectedModels: [\"Tab\"],\n targetModel: TabModel,\n ...options,\n });\n\n/**\n * Load caseview by href\n */\nexport const useCaseView = (href: string | Href, options?: HookOptions) =>\n useModularUIBasic(\"caseview\", href, {\n expectedModels: [\"CaseView\"],\n targetModel: CaseViewModel,\n ...options,\n });\n\nexport const usePanel = (href: string | Href, options?: HookOptions) =>\n useModularUIBasic<ListModel | GroupingPanelModel | DetailModel>(\n \"panel\",\n href,\n {\n expectedModels: [\"List\", \"GroupingPanel\", \"Detail\"],\n ...options,\n },\n );\n\nexport const useList = (href: string | Href, options?: HookOptions) =>\n useModularUIBasic(\"list\", href, {\n expectedModels: [\"List\"],\n targetModel: ListModel,\n ...options,\n });\n\nexport const useListOrDetail = (href: string | Href, options?: HookOptions) =>\n useModularUIBasic<ListModel | DetailModel>(\"list\", href, {\n expectedModels: [\"List\", \"Detail\"],\n // @ts-expect-error Need to improve typing for array\n targetModel: [ListModel, DetailModel],\n ...options,\n });\n\nexport const useListDetail = (href: string | Href, options?: HookOptions) =>\n useModularUIBasic(\"listdetail\", href, {\n expectedModels: [\"ListDetail\"],\n targetModel: ListDetailModel,\n forceTargetModel: true,\n ...options,\n });\n\nexport const useGroupingPanel = (href: string | Href, options?: HookOptions) =>\n useModularUIBasic(\"groupingpanel\", href, {\n expectedModels: [\"GroupingPanel\"],\n targetModel: GroupingPanelModel,\n ...options,\n });\n\nexport const useDetailPanel = (href: string | Href, options?: HookOptions) =>\n useModularUIBasic(\"detailpanel\", href, {\n expectedModels: [\"Detail\"],\n targetModel: DetailModel,\n ...options,\n });\n\nexport const useQuicksearch = (href: string | Href, options?: HookOptions) =>\n useModularUIBasic(\"quicksearch\", href, {\n expectedModels: [\"CaseSearch\"],\n targetModel: CaseSearchModel,\n ...options,\n });\n\nexport const useSearch = (href: string | Href, options?: HookOptions) =>\n useModularUIBasic(\"search\", href, {\n expectedModels: [\"CaseSearch\"],\n targetModel: CaseSearchModel,\n ...options,\n });\n\nexport const useUserProfile = (href: string | Href, options?: HookOptions) =>\n useModularUIBasic(\"userprofile\", href, {\n expectedModels: [\"UserProfile\"],\n targetModel: UserProfileModel,\n ...options,\n });\n","import { useBEIDispatch, useBEISelector } from \"../redux/hooks\";\nimport {\n dismissNotification,\n NOTIFICATION_TYPES,\n showNotification,\n} from \"../redux/notifications/notificationReducer\";\n\nimport type { ErrorResponse } from \"@beinformed/ui/models\";\nimport type { MessageObject } from \"../i18n/types\";\nimport type { RootState } from \"../redux/store\";\n\nexport const useNotification = () => {\n const dispatch = useBEIDispatch();\n const { render, messageType, message, error } = useBEISelector(\n (state: RootState) => state.notification,\n );\n\n return {\n render,\n messageType,\n message,\n error,\n dismiss: () => dispatch(dismissNotification()),\n };\n};\n\nexport const useErrorNotification = () => {\n const dispatch = useBEIDispatch();\n return (message: MessageObject, error?: ErrorResponse) => {\n return dispatch(\n showNotification({ type: NOTIFICATION_TYPES.ERROR, message, error }),\n );\n };\n};\n","import { useMemo } from \"react\";\n\nimport pick from \"lodash/pick\";\nimport { createSelector } from \"reselect\";\n\nimport { useBEISelector } from \"../redux/hooks\";\n\nimport type { RootState } from \"../redux/store\";\n\nconst getPreferences = (state: RootState) => state.preferences;\n\nconst makeSelectPreference = (preferenceNames: string | string[]) => {\n const names = Array.isArray(preferenceNames)\n ? preferenceNames\n : [preferenceNames];\n\n return createSelector([getPreferences], (preferences) =>\n pick(preferences, names),\n );\n};\n\nexport const usePreference = (preferenceNames: string | string[]) => {\n const selectPreference = useMemo(\n () => makeSelectPreference(preferenceNames),\n [\n Array.isArray(preferenceNames)\n ? preferenceNames.join(\",\")\n : preferenceNames,\n ],\n );\n\n return useBEISelector(selectPreference);\n};\n"],"mappings":"+mBAAA,IAAAA,EAAAC,EAAA,CAAAC,GAAAC,KAAA,kBAAIC,GAAY,KAEZC,GAAkB,UAAW,CAC/B,GAAI,CACF,IAAIC,EAAOF,GAAU,OAAQ,gBAAgB,EAC7C,OAAAE,EAAK,CAAC,EAAG,GAAI,CAAC,CAAC,EACRA,CACT,MAAY,CAAC,CACf,EAAE,EAEFH,GAAO,QAAUE,KCVjB,IAAAE,GAAAC,EAAA,CAAAC,GAAAC,KAAA,kBAAIC,GAAiB,IAWrB,SAASC,GAAgBC,EAAQC,EAAKC,EAAO,CACvCD,GAAO,aAAeH,GACxBA,GAAeE,EAAQC,EAAK,CAC1B,aAAgB,GAChB,WAAc,GACd,MAASC,EACT,SAAY,EACd,CAAC,EAEDF,EAAOC,CAAG,EAAIC,CAElB,CAEAL,GAAO,QAAUE,KCxBjB,IAAAI,GAAAC,EAAA,CAAAC,GAAAC,KAAA,kBAAIC,GAAkB,KAClBC,GAAK,KAGLC,GAAc,OAAO,UAGrBC,GAAiBD,GAAY,eAYjC,SAASE,GAAYC,EAAQC,EAAKC,EAAO,CAC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Ae,EACvCA,EACA,CAACA,CAAe,EAEpB,OAAOE,GAAe,CAACL,EAAc,EAAIM,MACvC,GAAAC,SAAKD,EAAaF,CAAK,CACzB,CACF,EAEaI,GAAiBL,GAAuC,CACnE,IAAMM,EAAmBC,GACvB,IAAMR,GAAqBC,CAAe,EAC1C,CACE,MAAM,QAAQA,CAAe,EACzBA,EAAgB,KAAK,GAAG,EACxBA,CACN,CACF,EAEA,OAAOQ,EAAeF,CAAgB,CACxC","names":["require_defineProperty","__commonJSMin","exports","module","getNative","defineProperty","func","require_baseAssignValue","__commonJSMin","exports","module","defineProperty","baseAssignValue","object","key","value","require_assignValue","__commonJSMin","exports","module","baseAssignValue","eq","objectProto","hasOwnProperty","assignValue","object","key","value","objValue","require_baseSet","__commonJSMin","exports","module","assignValue","castPath","isIndex","isObject","toKey","baseSet","object","path","value","customizer","index","length","lastIndex","nested","key","newValue","objValue","require_basePickBy","__commonJSMin","exports","module","baseGet","baseSet","castPath","basePickBy","object","paths","predicate","index","length","result","path","value","require_baseHasIn","__commonJSMin","exports","module","baseHasIn","object","key","require_hasIn","__commonJSMin","exports","module","baseHasIn","hasPath","hasIn","object","path","require_basePick","__commonJSMin","exports","module","basePickBy","hasIn","basePick","object","paths","value","path","require_flatten","__commonJSMin","exports","module","baseFlatten","flatten","array","length","require_apply","__commonJSMin","exports","module","apply","func","thisArg","args","require_overRest","__commonJSMin","exports","module","apply","nativeMax","overRest","func","start","transform","args","index","length","array","otherArgs","require_constant","__commonJSMin","exports","module","constant","value","require_identity","__commonJSMin","exports","module","identity","value","require_baseSetToString","__commonJSMin","exports","module","constant","defineProperty","identity","baseSetToString","func","string","require_shortOut","__commonJSMin","exports","module","HOT_COUNT","HOT_SPAN","nativeNow","shortOut","func","count","lastCalled","stamp","remaining","require_setToString","__commonJSMin","exports","module","baseSetToString","shortOut","setToString","require_flatRest","__commonJSMin","exports","module","flatten","overRest","setToString","flatRest","func","require_pick","__commonJSMin","exports","module","basePick","flatRest","pick","object","paths","useEffect","useState","HTTP_METHODS","FormModel","ListModel","ModularUIRequest","createSelector","getModularUIRequest","createSelector","getLocale","localeCode","href","options","request","ModularUIRequest","useModularUIRequest","useBEISelector","useRetrieveFormsOnModel","model","modularui","useModularUIRequest","forms","setForms","useState","requestCount","setRequestCount","responseCount","setResponseCount","useEffect","requests","getActions","action","href","HTTP_METHODS","form","FormModel","responses","actionForms","allActions","ListModel","listItem","updateActions","actions","unique","DEFAULT_AUTHENTICATION_TYPE","IllegalStateException","getContextPathServer","logoutPath","Cache","useLogin","Cache","dispatch","useBEIDispatch","application","useBEISelector","getApplication","auth","state","isAuthenticated","DEFAULT_AUTHENTICATION_TYPE","resetAuthErrors","username","password","login","authenticationType","IllegalStateException","getContextPathServer","useLogout","LOGOUT_PATH","logoutPath","BASE_PATH","origin","url","logout","useEffect","useState","ModularUIRequest","useProgressIndicator","dispatch","useBEIDispatch","useBEISelector","state","startProgress","finishProgress","resetProgress","percentComplete","updateProgress","useContentFromSourceReferences","sourceReferences","renderChildSections","content","setContent","useState","localeCode","useLocale","start","finish","useProgressIndicator","hrefs","sourceReference","href","index","self","allHrefs","useEffect","requests","modularuiRequest","ModularUIRequest","responseContent","useEffect","useRef","deepEqual","useDeepCompareMemoize","value","ref","signalRef","useDeepCompareEffect","callback","dependencies","HTTP_METHODS","FormModel","Href","getSetting","produce","useEffect","useMemo","useRef","HTTP_METHODS","Href","useLocation","useKeyForHook","modelKey","url","locale","useLocale","useMemo","useModularUI","options","HTTP_METHODS","dispatch","useBEIDispatch","href","key","modelSelector","state","model","useBEISelector","Href","location","useLocation","redirectLocation","forceLoad","prevOptions","useRef","prevHref","prevForceLoad","useDeepCompareEffect","isOldReload","doForceLoad","fetchModel","useEffect","removeModelByKey","useForm","href","data","formHref","Href","getSetting","form","useModularUI","HTTP_METHODS","FormModel","useFormNavigation","dispatch","useBEIDispatch","previousObject","cancelForm","fetchModel","newModel","produce","draft","removeModelByKey","showFormNotification","useAttributeUpdate","formObject","attribute","inputvalue","options","updateFormAttribute","useRepeatableAttributeSet","addRepeatableAttributeSet","object","cancelRepeatableAttributeSet","removeRepeatableAttributeSet","useCallback","IllegalArgumentException","useModal","modalId","IllegalArgumentException","dispatch","useBEIDispatch","modal","useBEISelector","state","m","show","useCallback","showModal","close","closeModal","ConceptIndexModel","ContentIndexModel","ContentTOCModel","ContentTypeModel","Href","ModelCatalogModel","createHref","filterParameters","useMemo","useLocation","useBEISelector","state","useLocationKey","useQuerystring","usePathname","useNavigation","dispatch","useBEIDispatch","location","push","replace","delta","go","goBack","goForward","createUseModularUIOptions","options","href","location","baseOptions","validateModel","model","expectedModels","expectedModel","useModularUIBasic","key","useLocation","memoizedHref","useMemo","useModularUIOptions","modularUI","useModularUI","useModelCatalog","options","useModularUIBasic","ModelCatalogModel","useConceptIndex","href","key","entryDate","useEntryDate","url","filterParameters","ConceptIndexModel","useConceptDetail","concept","location","useLocation","createHref","useContentIndex","ContentIndexModel","useContentTOC","content","ContentTOCModel","useContent","useCompleteSource","contentHref","Href","useContentType","contentType","ContentTypeModel","useRelatedConcepts","getSearchHref","uri","filters","filterString","filterValue","value","useConceptSearch","useContentSearch","dispatch","useBEIDispatch","useBEISelector","getEntryDate","updateEntryDate","createSelector","useModels","dispatch","useBEIDispatch","selector","createSelector","state","modularui","models","keys","key","model","modularuiModels","useBEISelector","options","reloadModel","callbackFn","modelsToReload","modelToReload","ApplicationModel","CaseSearchModel","CaseViewModel","DetailModel","GroupingPanelModel","ListDetailModel","ListModel","TabModel","UserProfileModel","useApplication","options","useModularUIBasic","ApplicationModel","useTab","href","TabModel","useCaseView","CaseViewModel","usePanel","useList","ListModel","useListOrDetail","DetailModel","useListDetail","ListDetailModel","useGroupingPanel","GroupingPanelModel","useDetailPanel","useQuicksearch","CaseSearchModel","useSearch","useUserProfile","UserProfileModel","useNotification","dispatch","useBEIDispatch","render","messageType","message","error","useBEISelector","state","dismissNotification","useErrorNotification","showNotification","import_pick","useMemo","createSelector","getPreferences","state","makeSelectPreference","preferenceNames","names","createSelector","preferences","pick","usePreference","selectPreference","useMemo","useBEISelector"]}
|
package/dist/chunk-VFLYA5WJ.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{b as p}from"./chunk-3OP2KQ56.js";import{e as s}from"./chunk-YG7XDCNV.js";import{b as a}from"./chunk-FW4363Y4.js";var e=a(p(),1);import{resolveModel as f}from"@beinformed/ui/models";import{ModularUIResponse as h}from"@beinformed/ui/modularui";var l=r=>{let o=h.rehydrate(r),n=f(o);if(n){let t=new n(o);if(r.childModels){let d=r.childModels.map(c=>l(c)).filter(c=>c!=null);t.addChildModels(d)}return t}},m=r=>r!=null&&typeof r=="object"&&(0,e.default)(r,"data")&&(0,e.default)(r,"contributions")&&(0,e.default)(r,"key")&&typeof r.key=="string"&&(0,e.default)(r,"locale")&&typeof r.locale=="string",u=(r,o)=>Array.isArray(o)?o.map(t=>i(t)):m(o)?l(o):r==="i18n"&&(0,e.default)(o,"locales")&&(0,e.default)(o,"locale")?{locales:s.rehydrate(o.locales),locale:o?.locale}:["preferences","router","progressindicator","modelcatalog"].includes(r)?o:o!==null&&typeof o=="object"?i(o):o,i=r=>{let o={};return Object.keys(r).forEach(n=>{let t=r[n];o[n]=u(n,t)}),o};import{JsonParseException as y}from"@beinformed/ui/exceptions";var b=()=>{let r=document.querySelector('script[type="application/json"][data-app-state="app-json"]');if(r){if(r?.textContent?.trim()==="")return{}}else throw new Error("Error loading state, json not found");let o=r.textContent||"";try{let n=JSON.parse(o);return i(n)}catch{throw new y(`Error parsing content ${o}`)}};export{i as a,b};
|
|
2
|
-
//# sourceMappingURL=chunk-VFLYA5WJ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client/rehydrate.ts","../src/redux/dataFromServer.ts"],"sourcesContent":["import { resolveModel } from \"@beinformed/ui/models\";\nimport { ModularUIResponse } from \"@beinformed/ui/modularui\";\nimport has from \"lodash/has\";\n\nimport { Locales } from \"../i18n/Locales\";\n\nimport type { Contributions, Data } from \"@beinformed/ui/types\";\n\ninterface RehydrateData {\n key: string;\n locale: string;\n data: Data;\n contributions: Contributions;\n origin?: string;\n contextPath?: string;\n childModels?: RehydrateData[];\n}\n\n/**\n * Recreate a model from dehydrated data obtained after a server render.\n */\nconst recreateModel = (data: RehydrateData) => {\n const modelData = ModularUIResponse.rehydrate(data);\n\n const Model = resolveModel(modelData);\n\n if (Model) {\n const model = new Model(modelData);\n\n //Todo\n // model.rehydrate(data);\n\n if (data.childModels) {\n const childModels = data.childModels\n .map((childModel: RehydrateData) => recreateModel(childModel))\n .filter((d) => d != null);\n\n model.addChildModels(childModels);\n }\n\n return model;\n }\n\n return undefined;\n};\n\nconst isModularUIModelData = (data: unknown) =>\n data != null &&\n typeof data === \"object\" &&\n has(data, \"data\") &&\n has(data, \"contributions\") &&\n has(data, \"key\") &&\n typeof data.key === \"string\" &&\n has(data, \"locale\") &&\n typeof data.locale === \"string\";\n\nconst rehydratedValue = (stateKey: string, stateValue: unknown) => {\n if (Array.isArray(stateValue)) {\n return stateValue.map((stateItem) => rehydrate(stateItem));\n }\n\n if (isModularUIModelData(stateValue)) {\n return recreateModel(stateValue as RehydrateData);\n }\n\n if (\n stateKey === \"i18n\" &&\n has(stateValue, \"locales\") &&\n has(stateValue, \"locale\")\n ) {\n return {\n locales: Locales.rehydrate(stateValue.locales),\n locale: stateValue?.locale,\n };\n }\n\n const noFurtherRehydration = [\n \"preferences\",\n \"router\",\n \"progressindicator\",\n \"modelcatalog\",\n ];\n if (noFurtherRehydration.includes(stateKey)) {\n return stateValue;\n }\n\n if (stateValue !== null && typeof stateValue === \"object\") {\n return rehydrate(stateValue as Record<string, unknown>);\n }\n\n return stateValue;\n};\n\n/**\n * Maps dehydrated state to models that can be used to rehydrated the application.\n */\nexport const rehydrate = (state: Record<string, unknown>) => {\n const mappedState: Record<string, unknown> = {};\n\n Object.keys(state).forEach((stateKey) => {\n const stateValue = state[stateKey];\n mappedState[stateKey] = rehydratedValue(stateKey, stateValue);\n });\n\n return mappedState;\n};\n","import { JsonParseException } from \"@beinformed/ui/exceptions\";\n\nimport { rehydrate } from \"../client/rehydrate\";\n\nexport const getDataFromServer = () => {\n const dataElement = document.querySelector(\n 'script[type=\"application/json\"][data-app-state=\"app-json\"]',\n );\n\n if (!dataElement) {\n throw new Error(\"Error loading state, json not found\");\n } else if (dataElement?.textContent?.trim() === \"\") {\n return {};\n }\n\n const data = dataElement.textContent || \"\";\n try {\n const json = JSON.parse(data);\n return rehydrate(json);\n } catch (_error) {\n throw new JsonParseException(`Error parsing content ${data}`);\n }\n};\n"],"mappings":"wHAEA,IAAAA,EAAgB,SAFhB,OAAS,gBAAAC,MAAoB,wBAC7B,OAAS,qBAAAC,MAAyB,2BAoBlC,IAAMC,EAAiBC,GAAwB,CAC7C,IAAMC,EAAYC,EAAkB,UAAUF,CAAI,EAE5CG,EAAQC,EAAaH,CAAS,EAEpC,GAAIE,EAAO,CACT,IAAME,EAAQ,IAAIF,EAAMF,CAAS,EAKjC,GAAID,EAAK,YAAa,CACpB,IAAMM,EAAcN,EAAK,YACtB,IAAKO,GAA8BR,EAAcQ,CAAU,CAAC,EAC5D,OAAQC,GAAMA,GAAK,IAAI,EAE1BH,EAAM,eAAeC,CAAW,CAClC,CAEA,OAAOD,CACT,CAGF,EAEMI,EAAwBT,GAC5BA,GAAQ,MACR,OAAOA,GAAS,aAChB,EAAAU,SAAIV,EAAM,MAAM,MAChB,EAAAU,SAAIV,EAAM,eAAe,MACzB,EAAAU,SAAIV,EAAM,KAAK,GACf,OAAOA,EAAK,KAAQ,aACpB,EAAAU,SAAIV,EAAM,QAAQ,GAClB,OAAOA,EAAK,QAAW,SAEnBW,EAAkB,CAACC,EAAkBC,IACrC,MAAM,QAAQA,CAAU,EACnBA,EAAW,IAAKC,GAAcC,EAAUD,CAAS,CAAC,EAGvDL,EAAqBI,CAAU,EAC1Bd,EAAcc,CAA2B,EAIhDD,IAAa,WACb,EAAAF,SAAIG,EAAY,SAAS,MACzB,EAAAH,SAAIG,EAAY,QAAQ,EAEjB,CACL,QAASG,EAAQ,UAAUH,EAAW,OAAO,EAC7C,OAAQA,GAAY,MACtB,EAG2B,CAC3B,cACA,SACA,oBACA,cACF,EACyB,SAASD,CAAQ,EACjCC,EAGLA,IAAe,MAAQ,OAAOA,GAAe,SACxCE,EAAUF,CAAqC,EAGjDA,EAMIE,EAAaE,GAAmC,CAC3D,IAAMC,EAAuC,CAAC,EAE9C,cAAO,KAAKD,CAAK,EAAE,QAASL,GAAa,CACvC,IAAMC,EAAaI,EAAML,CAAQ,EACjCM,EAAYN,CAAQ,EAAID,EAAgBC,EAAUC,CAAU,CAC9D,CAAC,EAEMK,CACT,ECzGA,OAAS,sBAAAC,MAA0B,4BAI5B,IAAMC,EAAoB,IAAM,CACrC,IAAMC,EAAc,SAAS,cAC3B,4DACF,EAEA,GAAKA,GAEE,GAAIA,GAAa,aAAa,KAAK,IAAM,GAC9C,MAAO,CAAC,MAFR,OAAM,IAAI,MAAM,qCAAqC,EAKvD,IAAMC,EAAOD,EAAY,aAAe,GACxC,GAAI,CACF,IAAME,EAAO,KAAK,MAAMD,CAAI,EAC5B,OAAOE,EAAUD,CAAI,CACvB,MAAiB,CACf,MAAM,IAAIE,EAAmB,yBAAyBH,CAAI,EAAE,CAC9D,CACF","names":["import_has","resolveModel","ModularUIResponse","recreateModel","data","modelData","ModularUIResponse","Model","resolveModel","model","childModels","childModel","d","isModularUIModelData","has","rehydratedValue","stateKey","stateValue","stateItem","rehydrate","Locales","state","mappedState","JsonParseException","getDataFromServer","dataElement","data","json","rehydrate","JsonParseException"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/server/application.ts","../src/server/contextPath.ts","../src/server/htmlpage.ts","../src/server/renderSSRMinimal.tsx","../src/server/serverState.ts","../src/server/serverNoSSR.ts","../src/server/serverPreferences.ts"],"sourcesContent":["import { ModularUIRequest } from \"@beinformed/ui/modularui\";\n\nimport { getLocale } from \"../redux/i18n/i18nSelectors\";\nimport { initModels } from \"../redux/modularui/modelActions\";\n\nimport type { BEIStore } from \"../redux/store\";\n\nexport const setApplication = (store: BEIStore) => {\n try {\n const locale = getLocale(store.getState());\n const application = new ModularUIRequest(\"/\", {\n locale: locale,\n }).fetchSync();\n\n application.connectKey = `application(/)(${locale})`;\n\n store.dispatch(\n initModels([\n {\n key: `application(/)(${locale})`,\n model: application,\n },\n ]),\n );\n } catch (_e) {\n // swallow error, in this case we just don't pre-cache the webapplication,\n // which has not much difference for the end user\n }\n};\n","import { getContextPath } from \"@beinformed/ui/settings\";\n\ndeclare let __webpack_public_path__: string;\n\n(function x() {\n if (typeof __webpack_public_path__ !== \"undefined\") {\n __webpack_public_path__ = `${getContextPath()}/`; // NOSONAR\n }\n})();\n\nexport {};\n","export interface TemplateProps {\n contextPath: string;\n html: string;\n head: Record<string, unknown>;\n state: string;\n UUID: string;\n}\n\nexport const htmlpage = (props?: Partial<TemplateProps>): string => {\n if (props?.contextPath === undefined) {\n throw new Error(\"Missing contextPath argument\");\n }\n if (props.html === undefined) {\n throw new Error(\"Missing html for server\");\n }\n\n const { head = {} } = props;\n\n const template = `\n <!doctype html>\n <html ${head.htmlAttributes ? head.htmlAttributes.toString() : \"\"}>\n <head>\n <meta charset=\"utf-8\" />\n ${Object.keys(head)\n .filter((key) => key !== \"htmlAttributes\")\n .map((key) => String(head[key]))\n .join(\"\")}\n {CSSASSETS:<link rel=\"stylesheet\" type=\"text/css\" href=\"{CONTEXT_PATH}/{FILE}\" />:CSSASSETS}\n </head>\n <body class=\"nojs\">\n <div id=\"application\">${props.html}</div>\n <div id=\"portal\"></div>\n <script\n type=\"application/json\"\n data-app-state=\"app-json\"\n data-app-contextpath=\"{CONTEXT_PATH}\"\n data-app-filepath=\"{FILEPATH}\"\n data-app-nonce=\"${props.UUID ?? \"\"}\">${props.state ?? \"\"}</script>\n {JSASSETS:<script src=\"{CONTEXT_PATH}/{FILE}\"></script>:JSASSETS}\n </body>\n </html>\n`;\n\n // It is important to replace the context afterwards,\n // the JSASSESTS and CSSASSETS parts act as a small template for all generated javascript and css files\n // these templates must be pure strings to make it possible to add the context path in all situations\n return template.replace(/{CONTEXT_PATH}/g, props.contextPath).trim();\n};\n","import React from \"react\";\n\nimport { getContextPathServer } from \"@beinformed/ui/settings\";\nimport { renderToString } from \"react-dom/server\";\nimport { Provider } from \"react-redux\";\nimport { ServerStyleSheet, StyleSheetManager } from \"styled-components\";\n\nimport { ThemeProvider } from \"../theme/ThemeProvider\";\nimport { htmlpage } from \"./htmlpage\";\nimport { dehydrate } from \"./serverState\";\n\nimport type { BEIStore } from \"../redux/store\";\nimport type { Theme } from \"../theme/types\";\nimport type { TemplateProps } from \"./htmlpage\";\n\ninterface Props {\n store: BEIStore;\n theme?: Theme | Theme[];\n UUID: string;\n render: () => React.ReactNode;\n template?: (arg0: TemplateProps) => string;\n}\n\nexport const renderSSRMinimal = ({\n store,\n theme,\n UUID = \"\",\n render,\n template = htmlpage,\n}: Props): string => {\n const sheet = new ServerStyleSheet();\n\n const appHTML = renderToString(\n <Provider store={store}>\n <StyleSheetManager sheet={sheet.instance}>\n <ThemeProvider theme={theme}>{render()}</ThemeProvider>\n </StyleSheetManager>\n </Provider>,\n );\n\n const head = createHead(sheet);\n return template({\n contextPath: getContextPathServer(),\n html: appHTML,\n head,\n state: dehydrate(store),\n UUID,\n });\n};\n\nexport const createHead = (\n sheet: ServerStyleSheet,\n helmetContext?: Record<string, unknown>,\n): Record<string, unknown> => {\n const style = sheet.getStyleTags();\n const helmet = helmetContext?.helmet as {\n meta: Record<string, unknown>[];\n };\n const meta = helmetContext ? [...helmet.meta] : [];\n\n if (helmetContext) {\n return {\n ...helmet,\n style,\n meta,\n };\n }\n\n return {\n style,\n meta,\n };\n};\n","import type { ModularUIModel } from \"@beinformed/ui/models\";\nimport type { BEIStore } from \"../redux/store\";\n\nexport const dehydrate = (store: BEIStore): string => {\n const state = store.getState();\n\n const modularui: Record<\n string,\n {\n status: string;\n lastModification: number;\n model: ModularUIModel | undefined;\n }\n > = {};\n\n for (const key in state.modularui) {\n const modelEntry = state.modularui[key];\n if (modelEntry) {\n const { status, model, lastModification } = modelEntry;\n\n if (model) {\n modularui[key] = {\n status,\n lastModification,\n model,\n };\n } else {\n modularui[key] = {\n status,\n lastModification,\n model: undefined,\n };\n }\n }\n }\n\n const filteredState = {\n ...state,\n modularui,\n };\n\n return JSON.stringify(filteredState).replace(/</g, \"\\\\u003c\");\n};\n","import \"./contextPath\";\n\nimport { createUUID } from \"@beinformed/ui/utils\";\nimport has from \"lodash/has\";\n\nimport { setI18n } from \"../i18n/serverI18n\";\nimport { handleBeforeRenderHooks } from \"../redux/beforeRenderHooks\";\nimport { setupStore } from \"../redux/store\";\nimport { createTheme } from \"../theme/createTheme\";\nimport { setConfigurationTheme } from \"../theme/serverTheme\";\nimport { setApplication } from \"./application\";\nimport { renderSSRMinimal } from \"./renderSSRMinimal\";\nimport { getFullRequestLocation } from \"./requestInformation\";\nimport { setServerPreferences } from \"./serverPreferences\";\n\nimport type { Reducer } from \"@reduxjs/toolkit\";\nimport type React from \"react\";\nimport type { LocaleConfiguration } from \"../i18n/types\";\nimport type { BeforeRenderHook } from \"../redux/beforeRenderHooks\";\nimport type { BEIStore } from \"../redux/store\";\nimport type { Theme } from \"../theme/types\";\nimport type { TemplateProps } from \"./htmlpage\";\nimport type { ServerPreferenceValue } from \"./serverPreferences\";\nimport type { HttpServletRequestJava } from \"./types\";\n\ndeclare let __webpack_nonce__: string;\n\ninterface serverProps {\n request: HttpServletRequestJava;\n locales?: LocaleConfiguration[];\n customReducers?: Record<string, Reducer>;\n theme?: Theme | Theme[];\n serverPreferences?: (string | ServerPreferenceValue)[];\n render: () => React.ReactNode;\n template?: (arg0: TemplateProps) => string;\n beforeRenderHooks?: BeforeRenderHook[];\n preloadApplication?: boolean;\n}\n\nconst handleErrors = (s: BEIStore) => {\n const state = s.getState();\n\n if (\n state.error &&\n (state.error.shouldThrowOnServer ||\n !has(state.error, \"shouldThrowOnServer\"))\n ) {\n throw state.error;\n }\n};\n\nexport const serverNoSSR = ({\n request,\n locales,\n customReducers,\n serverPreferences = [],\n theme,\n render,\n template,\n beforeRenderHooks,\n preloadApplication = true,\n}: serverProps): string => {\n const isPreviewCheck = request.getHeader(\"X-BI-Preview-Available\");\n if (isPreviewCheck) {\n return \"<h1>Preview Available</h1>\";\n }\n\n const UUID = createUUID();\n __webpack_nonce__ = UUID; // NOSONAR\n\n const location = getFullRequestLocation(request);\n const reduxStore = setupStore(\n { router: { location, action: undefined } },\n customReducers,\n );\n\n setServerPreferences(reduxStore, serverPreferences);\n setConfigurationTheme(reduxStore);\n\n if (theme) {\n const storedTheme = reduxStore.getState()?.preferences\n ?.theme as unknown as Theme;\n createTheme(storedTheme, theme);\n }\n\n setI18n(reduxStore, locales, request);\n\n if (preloadApplication) {\n setApplication(reduxStore);\n }\n\n handleErrors(reduxStore);\n\n handleBeforeRenderHooks(beforeRenderHooks, { store: reduxStore, request });\n\n return renderSSRMinimal({ store: reduxStore, theme, UUID, render, template });\n};\n","import {\n setAllContentInDataSetting,\n setDateTimeSettings,\n setLoginPreferences,\n setServerPreference,\n} from \"../redux/preferences/preferencesActions\";\nimport { setPreference } from \"../redux/preferences/preferencesReducer\";\n\nimport type { BEIStore } from \"../redux/store\";\n\nexport interface ServerPreferenceValue {\n name: string;\n defaultValue?: string | null;\n type?: string;\n}\n\nexport const setServerPreferencesFromArray = (\n store: BEIStore,\n serverPreferences: (string | ServerPreferenceValue)[],\n) => {\n serverPreferences.forEach((serverPreference) => {\n if (typeof serverPreference === \"object\") {\n const { name, defaultValue, type } = serverPreference;\n if (defaultValue) {\n store.dispatch(setServerPreference(name, defaultValue, type));\n }\n } else {\n store.dispatch(setServerPreference(serverPreference, null));\n }\n });\n};\n\n/**\n * Server preferences can be suplied by an array of preference names,\n * or an array of objects which has the name, an optional default value and an optional type.<br>\n * When the type is set to string, a comma separated value is not converted to an array:\n *\n * @example\n * // value becomes an array [default1, default2]\n * { name: \"prefName\", defaultValue: \"default1, default2\" }\n * // value remains a string \"default1, default2\"\n * { name: \"prefName\", defaultValue: \"default1, default2\", type: \"string\" }\n *\n * @param store\n * @param serverPreferences\n */\nexport const setServerPreferences = (\n store: BEIStore,\n serverPreferences: (string | ServerPreferenceValue)[],\n) => {\n if (Array.isArray(serverPreferences)) {\n setServerPreferencesFromArray(store, serverPreferences);\n }\n\n store.dispatch(setAllContentInDataSetting());\n store.dispatch(setLoginPreferences());\n store.dispatch(setDateTimeSettings());\n\n if (\n preferencesProvider &&\n preferencesProvider.isStudioContext &&\n preferencesProvider.isStudioContext()\n ) {\n store.dispatch(setPreference(\"isStudioContext\", true));\n }\n};\n"],"mappings":"wXAAA,OAAS,oBAAAA,MAAwB,2BAO1B,IAAMC,EAAkBC,GAAoB,CACjD,GAAI,CACF,IAAMC,EAASC,EAAUF,EAAM,SAAS,CAAC,EACnCG,EAAc,IAAIC,EAAiB,IAAK,CAC5C,OAAQH,CACV,CAAC,EAAE,UAAU,EAEbE,EAAY,WAAa,kBAAkBF,CAAM,IAEjDD,EAAM,SACJK,EAAW,CACT,CACE,IAAK,kBAAkBJ,CAAM,IAC7B,MAAOE,CACT,CACF,CAAC,CACH,CACF,MAAa,CAGb,CACF,EC5BA,OAAS,kBAAAG,MAAsB,2BAI9B,UAAa,CACR,OAAO,wBAA4B,MACrC,wBAA0B,GAAGA,EAAe,CAAC,IAEjD,GAAG,ECAI,IAAMC,EAAYC,GAA2C,CAClE,GAAIA,GAAO,cAAgB,OACzB,MAAM,IAAI,MAAM,8BAA8B,EAEhD,GAAIA,EAAM,OAAS,OACjB,MAAM,IAAI,MAAM,yBAAyB,EAG3C,GAAM,CAAE,KAAAC,EAAO,CAAC,CAAE,EAAID,EA8BtB,MA5BiB;AAAA;AAAA,UAETC,EAAK,eAAiBA,EAAK,eAAe,SAAS,EAAI,EAAE;AAAA;AAAA;AAAA,QAG3D,OAAO,KAAKA,CAAI,EACf,OAAQC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,MAAO,qBAAqB,GAEzC,MAAMA,EAAM,KAEhB,EAEaE,GAAc,CAAC,CAC1B,QAAAC,EACA,QAAAC,EACA,eAAAC,EACA,kBAAAC,EAAoB,CAAC,EACrB,MAAAC,EACA,OAAAC,EACA,SAAAC,EACA,kBAAAC,EACA,mBAAAC,EAAqB,EACvB,IAA2B,CAEzB,GADuBR,EAAQ,UAAU,wBAAwB,EAE/D,MAAO,6BAGT,IAAMS,EAAOC,EAAW,EACxB,kBAAoBD,EAEpB,IAAME,EAAWC,EAAuBZ,CAAO,EACzCa,EAAaC,EACjB,CAAE,OAAQ,CAAE,SAAAH,EAAU,OAAQ,MAAU,CAAE,EAC1CT,CACF,EAKA,GAHAa,EAAqBF,EAAYV,CAAiB,EAClDa,EAAsBH,CAAU,EAE5BT,EAAO,CACT,IAAMa,EAAcJ,EAAW,SAAS,GAAG,aACvC,MACJK,EAAYD,EAAab,CAAK,CAChC,CAEA,OAAAe,EAAQN,EAAYZ,EAASD,CAAO,EAEhCQ,GACFY,EAAeP,CAAU,EAG3BlB,EAAakB,CAAU,EAEvBQ,EAAwBd,EAAmB,CAAE,MAAOM,EAAY,QAAAb,CAAQ,CAAC,EAElEsB,EAAiB,CAAE,MAAOT,EAAY,MAAAT,EAAO,KAAAK,EAAM,OAAAJ,EAAQ,SAAAC,CAAS,CAAC,CAC9E","names":["ModularUIRequest","setApplication","store","locale","getLocale","application","ModularUIRequest","initModels","getContextPath","htmlpage","props","head","key","getContextPathServer","renderToString","Provider","ServerStyleSheet","StyleSheetManager","dehydrate","store","state","modularui","key","modelEntry","status","model","lastModification","filteredState","jsx","renderSSRMinimal","store","theme","UUID","render","template","htmlpage","sheet","ServerStyleSheet","appHTML","renderToString","Provider","StyleSheetManager","ThemeProvider","head","createHead","getContextPathServer","dehydrate","helmetContext","style","helmet","meta","import_has","createUUID","setServerPreferencesFromArray","store","serverPreferences","serverPreference","name","defaultValue","type","setServerPreference","setServerPreferences","setAllContentInDataSetting","setLoginPreferences","setDateTimeSettings","setPreference","handleErrors","s","state","has","serverNoSSR","request","locales","customReducers","serverPreferences","theme","render","template","beforeRenderHooks","preloadApplication","UUID","createUUID","location","getFullRequestLocation","reduxStore","setupStore","setServerPreferences","setConfigurationTheme","storedTheme","createTheme","setI18n","setApplication","handleBeforeRenderHooks","renderSSRMinimal"]}
|
package/dist/chunk-X3N2NQVZ.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a}from"./chunk-RKGGCIUD.js";import{hideVisually as i}from"polished";import{jsx as s}from"react/jsx-runtime";var d=({className:e,id:t,defaultMessage:o,children:n,data:p,screenreaderOnly:l=!1,allowHTML:f=!1})=>{let r=a(t,o||n,p);if(l){let m={...i()};return s("span",{className:e,style:m,children:r})}return f?s("span",{className:e,dangerouslySetInnerHTML:{__html:r}}):s("span",{className:e,children:r})};d.displayName="BI.Message";
|
|
2
|
-
//# sourceMappingURL=chunk-X3N2NQVZ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/i18n/react/Message.tsx"],"sourcesContent":["import { hideVisually } from \"polished\";\n\nimport { useMessage } from \"../../hooks/useI18n\";\n\nimport type { MessageParameters } from \"@beinformed/ui/types\";\n\ninterface Props {\n className?: string;\n id: string;\n defaultMessage?: string | null;\n children?: string;\n data?: MessageParameters | undefined;\n screenreaderOnly?: boolean;\n allowHTML?: boolean;\n}\n\n/**\n * Message React component\n */\nconst Message = ({\n className,\n id,\n defaultMessage,\n children,\n data,\n screenreaderOnly = false,\n allowHTML = false,\n}: Props) => {\n const translatedMessage = useMessage(id, defaultMessage || children, data);\n\n if (screenreaderOnly) {\n const styles = {\n ...hideVisually(),\n };\n\n return (\n <span className={className} style={styles}>\n {translatedMessage}\n </span>\n );\n }\n\n if (allowHTML) {\n return (\n <span\n className={className}\n dangerouslySetInnerHTML={{\n __html: translatedMessage,\n }}\n />\n );\n }\n\n return <span className={className}>{translatedMessage}</span>;\n};\n\nMessage.displayName = \"BI.Message\";\n\nexport default Message;\n"],"mappings":"mCAAA,OAAS,gBAAAA,MAAoB,WAoCvB,cAAAC,MAAA,oBAjBN,IAAMC,EAAU,CAAC,CACf,UAAAC,EACA,GAAAC,EACA,eAAAC,EACA,SAAAC,EACA,KAAAC,EACA,iBAAAC,EAAmB,GACnB,UAAAC,EAAY,EACd,IAAa,CACX,IAAMC,EAAoBC,EAAWP,EAAIC,GAAkBC,EAAUC,CAAI,EAEzE,GAAIC,EAAkB,CACpB,IAAMI,EAAS,CACb,GAAGC,EAAa,CAClB,EAEA,OACEZ,EAAC,QAAK,UAAWE,EAAW,MAAOS,EAChC,SAAAF,EACH,CAEJ,CAEA,OAAID,EAEAR,EAAC,QACC,UAAWE,EACX,wBAAyB,CACvB,OAAQO,CACV,EACF,EAIGT,EAAC,QAAK,UAAWE,EAAY,SAAAO,EAAkB,CACxD,EAEAR,EAAQ,YAAc","names":["hideVisually","jsx","Message","className","id","defaultMessage","children","data","screenreaderOnly","allowHTML","translatedMessage","useMessage","styles","hideVisually"]}
|
package/dist/chunk-Y7ESITVO.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as x}from"./chunk-JYAETKRB.js";import{a as J,d as Q,e as ee,f as oe}from"./chunk-WBPDMDW4.js";import{a as E}from"./chunk-FW4363Y4.js";var $=E((Dt,X)=>{"use strict";var Be=9007199254740991,Ge=/^(?:0|[1-9]\d*)$/;function Ke(e,o){var t=typeof e;return o=o??Be,!!o&&(t=="number"||t!="symbol"&&Ge.test(e))&&e>-1&&e%1==0&&e<o}X.exports=Ke});var Y=E((wt,j)=>{"use strict";var qe=9007199254740991;function We(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=qe}j.exports=We});var Je=E((Ut,Z)=>{"use strict";var ze=Q(),Ve=ee(),Xe=J(),$e=$(),je=Y(),Ye=oe();function Ze(e,o,t){o=ze(o,e);for(var n=-1,r=o.length,a=!1;++n<r;){var s=Ye(o[n]);if(!(a=e!=null&&t(e,s)))break;e=e[s]}return a||++n!=r?a:(r=e==null?0:e.length,!!r&&je(r)&&$e(s,r)&&(Xe(e)||Ve(e)))}Z.exports=Ze});import{createAction as u,createReducer as te}from"@reduxjs/toolkit";var re={authenticated:!1,mustChangePassword:!1,error:null},ne=u("AUTHENTICATION_SUCCESS"),g=u("AUTHENTICATION_LOGOUT"),y=u("AUTHENTICATION_ERROR",e=>({payload:e})),ae=u("AUTHENTICATION_RESET_ERRORS"),h=u("CHANGE_PASSWORD"),eo=te(re,e=>{e.addCase(ne,o=>{o.authenticated=!0,o.error=null,o.mustChangePassword=!1}).addCase(y,(o,t)=>{o.authenticated=!1,o.error=t.payload,o.mustChangePassword=!1}).addCase(ae,o=>{o.error=null}).addCase(g,o=>{o.authenticated=!1,o.error=null,o.mustChangePassword=!1}).addCase(h,o=>{o.authenticated=!0,o.error=null,o.mustChangePassword=!0})});import{Cache as se}from"@beinformed/ui/utils";import{createAction as ie,createReducer as de}from"@reduxjs/toolkit";var le=ie("UPDATE_ENTRYDATE",e=>({payload:e})),ce={entryDate:new Date().toISOString().split("T")[0]},no=de(ce,e=>{e.addCase(le,(o,t)=>{se.addItem("ModelCatalogEntryDate",t.payload),o.entryDate=t.payload})});import{createAction as M,createAsyncThunk as ue,createReducer as me}from"@reduxjs/toolkit";var O=(r=>(r.SUCCESS="SUCCESS",r.INFO="INFO",r.WARNING="WARNING",r.ERROR="ERROR",r))(O||{}),T=M("SHOW_NOTIFICATION",(e,o,t)=>({payload:{type:e,message:o,error:t}})),S=ue("notifications/show",({type:e,message:o,error:t,timeout:n},{dispatch:r})=>{n&&setTimeout(()=>{r(p())},n),r(T(e,o,t))}),p=M("DISMISS_NOTIFICATION"),pe={render:!1,messageType:void 0,message:void 0,error:void 0},io=me(pe,e=>{e.addCase(T,(o,t)=>({...o,render:!0,messageType:t.payload.type,message:t.payload.message,error:t.payload.error})).addCase(p,o=>({...o,render:!1,messageType:void 0,message:void 0,error:void 0}))});import{getNumberSetting as fe}from"@beinformed/ui/settings";import{createAsyncThunk as Re}from"@reduxjs/toolkit";import{createAction as f}from"@reduxjs/toolkit";var N=f("START_PROGRESS"),C=f("FINISH_PROGRESS"),uo=f("RESET_PROGRESS"),mo=f("UPDATE_PROGRESS",e=>({payload:{percentComplete:e}}));var Ee=e=>e.actiontype==="create"?"Notification.Msg.Create":e.actiontype==="update"?"Notification.Msg.Update":e.actiontype==="delete"?"Notification.Msg.Delete":"Notification.Msg.Generic",yo=Re("notification/show_form",async(e,{dispatch:o})=>(o(N()),o(S({type:"SUCCESS",message:{id:Ee(e)}})),setTimeout(()=>{o(p())},fe("HIDE_NOTIFICATION_TIMEOUT")),o(C()))),P=e=>S({type:"ERROR",message:{id:e.id,defaultMessage:e.message,parameters:e.properties},error:e});import{createAction as m}from"@reduxjs/toolkit";var D=m("ROUTER/PUSH",(e,o)=>({payload:{location:e,state:o}})),w=m("ROUTER/REPLACE",(e,o)=>({payload:{location:e,state:o}})),Ao=m("ROUTER/GO",e=>({payload:{delta:e}})),Io=m("ROUTER/GOBACK"),xo=m("ROUTER/GOFORWARD");import{createAction as ge,createReducer as ye}from"@reduxjs/toolkit";var A=ge("SAVE_ERROR",e=>({payload:e})),he=null,To=ye(he,e=>{e.addCase(A,(o,t)=>t.payload)});import{createAction as U,createReducer as Se}from"@reduxjs/toolkit";var Ae=U("SHOW_MODAL",e=>({payload:e})),Ie=U("CLOSE_MODAL",e=>({payload:e})),xe={modals:[]},Po=Se(xe,e=>{e.addCase(Ae,(o,t)=>{let n=t.payload;o.modals.forEach(a=>{a.visible=!1});let r=o.modals.find(a=>a.key===n);r?r.visible=!0:o.modals.push({key:n,visible:!0})}).addCase(Ie,(o,t)=>{let n=t.payload;o.modals=o.modals.filter(a=>a.key!==n);let r=o.modals[o.modals.length-1];r&&(r.visible=!0)})});var H=(r=>(r.IDLE="IDLE",r.LOADING="LOADING",r.FINISHED="FINISHED",r.ERROR="ERROR",r))(H||{});import{createAction as d}from"@reduxjs/toolkit";var _=d("MODULARUI/ERROR_STATUS",(e,o)=>({payload:{key:e,error:o}})),Ho=d("MODULARUI/SET",(e,o)=>(o.connectKey=e,{payload:{key:e,model:o}})),_o=d("MODULARUI/INIT",e=>({payload:e})),vo=d("MODULARUI/UPDATE",e=>({payload:e})),Fo=d("MODULARUI/UPDATE_FORM",e=>({payload:e})),l=d("MODULARUI/REMOVE_KEY",e=>({payload:e})),Lo=d("MODULARUI/RESET");import{Href as v}from"@beinformed/ui/models";var Bo=(e,o)=>{let t=e.i18n.locale||"en",n=e.modularui;if(n){let r=Object.keys(n).find(a=>{let s=n[a];return s?.model?s.model instanceof o&&s.model.locale===t:!1});if(r){let a=n[r];if(a?.model instanceof o)return a.model}}},F=(e,o)=>{if(e&&e.modularui){let t=o instanceof v?o:new v(o);return Object.keys(e.modularui).filter(n=>{let r=e.modularui[n];if(r)return r.model?.selfhref?.equals(t)})}return[]};import{ApplicationModel as Me}from"@beinformed/ui/models";var R=e=>{let o=e.i18n.locale||"en",t=e.modularui;if(t){let n=Object.keys(t).find(r=>{let a=t[r];return a?.model?a.model instanceof Me&&a.model.locale===o:!1});if(n)return t[n]}};import{ApplicationModel as Le,Href as be}from"@beinformed/ui/models";import{createAsyncThunk as ke}from"@reduxjs/toolkit";import{HTTP_METHODS as Ue}from"@beinformed/ui/constants";import{ErrorResponse as He,Href as z}from"@beinformed/ui/models";import{ModularUIRequest as _e}from"@beinformed/ui/modularui";import{createAsyncThunk as ve}from"@reduxjs/toolkit";import{IS_SERVER as Pe}from"@beinformed/ui/constants";import{ErrorResponse as G}from"@beinformed/ui/models";import{logoutPath as De}from"@beinformed/ui/settings";import{getBooleanSetting as Oe,getStringSetting as Te}from"@beinformed/ui/settings";import{Cache as L}from"@beinformed/ui/utils";import{createAsyncThunk as Ne}from"@reduxjs/toolkit";var k=Ne("auth/unauthorized",(e,{dispatch:o,getState:t})=>{if(e.connectKey&&o(l(e.connectKey)),Oe("PAGE_RELOAD_ON_UNAUTHORIZED_ERROR",!1)&&e.response){window.location.reload();return}let n=R(t());(L.getItem("auth")||n?.isLoggedIn)&&o(b()),o(g()),L.removeItem("auth"),e.isInvalidUsername&&o(y(e.message||""));let r=t().router.location,a=Te("LOGIN_PATH","/signin");if(r?.pathname!==a){let s=r?.state?.from;o(w(a,{from:s||t().router.location,modal:!1}))}});import{createAction as Ce}from"@reduxjs/toolkit";var B=Ce("NO_ACTION");var we=e=>o=>{if(e.isResourceNotFoundAfterReload||e.isRemoteServiceException)return o(B());if(e.isUnauthorized)return o(k(e));if(e.isBlocked||e.isConcurrentUser||e.isInvalidUsername){o(D(De()));return}return e.isChangePassword?o(h()):Pe?o(A(e)):(setTimeout(()=>{throw e.error||e}),o(P(e)))},K=(e,o)=>t=>t(o(e)),ct=e=>{K=e},q=e=>{let o=e instanceof G?e:new G(e);return K(o,we)};var W=(e,o)=>e||typeof navigator<"u"&&navigator?.language&&navigator.language.split("-")[0]||o;var Fe=async({key:e,href:o,options:t},{dispatch:n,getState:r,rejectWithValue:a})=>{try{let s=W(t?.locale,r().i18n.locale),i=o instanceof z?o:new z(o,"",{origin:t?.origin,contextPath:t?.contextPath}),c=await new _e(i,{method:t?.method||Ue.GET,params:t?.params||"",data:t?.data||null,locale:s,childmodels:t?.childmodels??!0,isReload:t?.isReload,cache:t?.cache,headers:t?.headers,events:t?.events,onProgress:t?.onProgress,origin:t?.origin,contextPath:t?.contextPath,targetModel:t?.targetModel,forceTargetModel:t?.forceTargetModel??!1,timeout:t?.timeout}).fetch();return c&&(c.connectKey=e),{key:e,model:c,updateHandler:t?.updateHandler}}catch(s){let i=new He(s,e,{origin:t?.origin,contextPath:t?.contextPath});throw i.isChangePassword||i.isResourceNotFoundAfterReload?n(l(e)):n(_(e,i)),n(q(s)),a(i)}},V=ve("modularui/fetchModel",Fe,{condition:({key:e},{getState:o})=>{if(o().modularui[e]?.status==="LOADING")return!1}});var b=ke("application/reload",async(e,{dispatch:o,getState:t})=>{let n=t(),r=new be("/","Application"),a=R(n);a&&(a.contextPath&&(r.contextPath=a.contextPath),a.origin&&(r.origin=a.origin));let s=F(n,r);for(let c of s)o(l(c));let I=`application(/)(${x(n)}`;await o(V({key:I,href:r,options:{targetModel:Le}}))});export{ne as a,g as b,y as c,ae as d,h as e,eo as f,$ as g,Je as h,le as i,no as j,N as k,C as l,uo as m,mo as n,O as o,S as p,p as q,io as r,yo as s,P as t,D as u,w as v,Ao as w,Io as x,xo as y,A as z,To as A,Ae as B,Ie as C,Po as D,H as E,_ as F,Ho as G,_o as H,vo as I,Fo as J,l as K,Lo as L,Bo as M,F as N,R as O,b as P,k as Q,B as R,ct as S,q as T,W as U,V};
|
|
2
|
-
//# sourceMappingURL=chunk-Y7ESITVO.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isIndex.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isLength.js","../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hasPath.js","../src/redux/auth/authReducer.ts","../src/redux/modelcatalog/modelCatalogReducer.ts","../src/redux/notifications/notificationReducer.ts","../src/redux/notifications/notificationActions.ts","../src/redux/progressindicator/progressIndicatorActions.ts","../src/redux/router/routerActions.ts","../src/redux/error/errorReducer.ts","../src/redux/modals/modalsReducer.ts","../src/redux/modularui/constants.ts","../src/redux/modularui/modelActions.ts","../src/redux/shared/selectors.ts","../src/redux/application/applicationSelectors.ts","../src/redux/application/applicationActions.ts","../src/redux/modularui/fetchModel.ts","../src/redux/error/errorActions.ts","../src/redux/auth/unauthorizedActions.ts","../src/redux/shared/actions.ts","../src/redux/modularui/utils.ts"],"sourcesContent":["/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\nmodule.exports = isIndex;\n","/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nmodule.exports = isLength;\n","var castPath = require('./_castPath'),\n isArguments = require('./isArguments'),\n isArray = require('./isArray'),\n isIndex = require('./_isIndex'),\n isLength = require('./isLength'),\n toKey = require('./_toKey');\n\n/**\n * Checks if `path` exists on `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @param {Function} hasFunc The function to check properties.\n * @returns {boolean} Returns `true` if `path` exists, else `false`.\n */\nfunction hasPath(object, path, hasFunc) {\n path = castPath(path, object);\n\n var index = -1,\n length = path.length,\n result = false;\n\n while (++index < length) {\n var key = toKey(path[index]);\n if (!(result = object != null && hasFunc(object, key))) {\n break;\n }\n object = object[key];\n }\n if (result || ++index != length) {\n return result;\n }\n length = object == null ? 0 : object.length;\n return !!length && isLength(length) && isIndex(key, length) &&\n (isArray(object) || isArguments(object));\n}\n\nmodule.exports = hasPath;\n","import { createAction, createReducer } from \"@reduxjs/toolkit\";\n\nexport interface AuthState {\n authenticated: boolean;\n mustChangePassword: boolean;\n error: string | null;\n}\n\nconst initalState: AuthState = {\n authenticated: false,\n mustChangePassword: false,\n error: null,\n};\n\nexport const loginSuccess = createAction(\"AUTHENTICATION_SUCCESS\");\n\nexport const logoutSuccess = createAction(\"AUTHENTICATION_LOGOUT\");\n\nexport const sendAuthenticationError = createAction(\n \"AUTHENTICATION_ERROR\",\n (errorMessage: string) => {\n return {\n payload: errorMessage,\n };\n },\n);\n\nexport const resetAuthErrors = createAction(\"AUTHENTICATION_RESET_ERRORS\");\n\nexport const saveChangePassword = createAction(\"CHANGE_PASSWORD\");\n\nexport const authReducer = createReducer(initalState, (builder) => {\n builder\n .addCase(loginSuccess, (state) => {\n state.authenticated = true;\n state.error = null;\n state.mustChangePassword = false;\n })\n .addCase(sendAuthenticationError, (state, action) => {\n state.authenticated = false;\n state.error = action.payload;\n state.mustChangePassword = false;\n })\n .addCase(resetAuthErrors, (state) => {\n state.error = null;\n })\n .addCase(logoutSuccess, (state) => {\n state.authenticated = false;\n state.error = null;\n state.mustChangePassword = false;\n })\n .addCase(saveChangePassword, (state) => {\n state.authenticated = true;\n state.error = null;\n state.mustChangePassword = true;\n });\n});\n","import { Cache } from \"@beinformed/ui/utils\";\nimport { createAction, createReducer } from \"@reduxjs/toolkit\";\n\nexport interface ModelCatalogState {\n entryDate: string | undefined;\n}\n\nexport const updateEntryDate = createAction(\n \"UPDATE_ENTRYDATE\",\n (entryDate: string) => {\n return {\n payload: entryDate,\n };\n },\n);\n\nconst initialState: ModelCatalogState = {\n entryDate: new Date().toISOString().split(\"T\")[0],\n};\n\n/**\n * Keep track of the entry date for the modelcatalog\n */\nexport const modelCatalogReducer = createReducer<ModelCatalogState>(\n initialState,\n (builder) => {\n builder.addCase(updateEntryDate, (state, action) => {\n Cache.addItem(\"ModelCatalogEntryDate\", action.payload);\n\n state.entryDate = action.payload;\n });\n },\n);\n","import {\n createAction,\n createAsyncThunk,\n createReducer,\n} from \"@reduxjs/toolkit\";\n\nimport type { ErrorResponse } from \"@beinformed/ui/models\";\nimport type { MessageObject } from \"../../i18n/types\";\n\nexport interface NotificationState {\n render: boolean;\n messageType: string | undefined;\n message: MessageObject | undefined;\n error: ErrorResponse | undefined;\n}\n\nexport interface ShowNotificationArguments {\n type: NOTIFICATION_TYPES | undefined;\n message: MessageObject | undefined;\n error?: ErrorResponse | undefined;\n timeout?: number;\n}\n\nexport enum NOTIFICATION_TYPES {\n SUCCESS = \"SUCCESS\",\n INFO = \"INFO\",\n WARNING = \"WARNING\",\n ERROR = \"ERROR\",\n}\n\nconst saveNotification = createAction(\n \"SHOW_NOTIFICATION\",\n (\n type: NOTIFICATION_TYPES | undefined,\n message: MessageObject | undefined,\n error?: ErrorResponse | undefined,\n ) => {\n return {\n payload: {\n type,\n message,\n error,\n },\n };\n },\n);\n\nexport const showNotification = createAsyncThunk(\n \"notifications/show\",\n (\n { type, message, error, timeout }: ShowNotificationArguments,\n { dispatch },\n ) => {\n if (timeout) {\n setTimeout(() => {\n dispatch(dismissNotification());\n }, timeout);\n }\n\n dispatch(saveNotification(type, message, error));\n },\n);\n\nexport const dismissNotification = createAction(\"DISMISS_NOTIFICATION\");\n\nconst initialState: NotificationState = {\n render: false,\n messageType: undefined,\n message: undefined,\n error: undefined,\n};\n\nexport const notificationReducer = createReducer<NotificationState>(\n initialState,\n (builder) => {\n builder\n .addCase(saveNotification, (state, action) => {\n return {\n ...state,\n render: true,\n messageType: action.payload.type,\n message: action.payload.message,\n error: action.payload.error,\n };\n })\n .addCase(dismissNotification, (state) => {\n return {\n ...state,\n render: false,\n messageType: undefined,\n message: undefined,\n error: undefined,\n };\n });\n },\n);\n","import { getNumberSetting } from \"@beinformed/ui/settings\";\nimport { createAsyncThunk } from \"@reduxjs/toolkit\";\n\nimport {\n finishProgress,\n startProgress,\n} from \"../progressindicator/progressIndicatorActions\";\nimport {\n dismissNotification,\n NOTIFICATION_TYPES,\n showNotification,\n} from \"./notificationReducer\";\n\nimport type { ErrorResponse, FormModel } from \"@beinformed/ui/models\";\n\nconst getNotificationMessageId = (form: FormModel) => {\n if (form.actiontype === \"create\") {\n return \"Notification.Msg.Create\";\n }\n\n if (form.actiontype === \"update\") {\n return \"Notification.Msg.Update\";\n }\n\n if (form.actiontype === \"delete\") {\n return \"Notification.Msg.Delete\";\n }\n\n return \"Notification.Msg.Generic\";\n};\n\n/**\n * Show form notification\n */\nexport const showFormNotification = createAsyncThunk(\n \"notification/show_form\",\n async (form: FormModel, { dispatch }) => {\n dispatch(startProgress());\n\n dispatch(\n showNotification({\n type: NOTIFICATION_TYPES.SUCCESS,\n message: {\n id: getNotificationMessageId(form),\n },\n }),\n );\n\n setTimeout(() => {\n dispatch(dismissNotification());\n }, getNumberSetting(\"HIDE_NOTIFICATION_TIMEOUT\"));\n\n return dispatch(finishProgress());\n },\n);\n\n/**\n * Show error notification\n */\nexport const showXHRErrorNotification = (error: ErrorResponse) => {\n return showNotification({\n type: NOTIFICATION_TYPES.ERROR,\n message: {\n id: error.id,\n defaultMessage: error.message,\n parameters: error.properties,\n },\n error,\n });\n};\n","import { createAction } from \"@reduxjs/toolkit\";\n\nexport const startProgress = createAction(\"START_PROGRESS\");\nexport const finishProgress = createAction(\"FINISH_PROGRESS\");\nexport const resetProgress = createAction(\"RESET_PROGRESS\");\nexport const updateProgress = createAction(\n \"UPDATE_PROGRESS\",\n (percentComplete: number) => ({\n payload: {\n percentComplete,\n },\n }),\n);\n","import { createAction } from \"@reduxjs/toolkit\";\n\nimport type { LocationState } from \"history\";\nimport type { RouterLocation } from \"./routerReducer\";\n\nexport const push = createAction(\n \"ROUTER/PUSH\",\n (location: RouterLocation | string, state?: LocationState) => {\n return {\n payload: { location, state },\n };\n },\n);\n\nexport const replace = createAction(\n \"ROUTER/REPLACE\",\n (location: RouterLocation | string, state?: LocationState) => {\n return {\n payload: { location, state },\n };\n },\n);\n\nexport const go = createAction(\"ROUTER/GO\", (delta: number) => {\n return {\n payload: { delta },\n };\n});\n\nexport const goBack = createAction(\"ROUTER/GOBACK\");\n\nexport const goForward = createAction(\"ROUTER/GOFORWARD\");\n","import { createAction, createReducer } from \"@reduxjs/toolkit\";\n\nimport type { ErrorResponse } from \"@beinformed/ui/models\";\n\nexport type ErrorState = null | ErrorResponse;\n\nexport const saveError = createAction(\"SAVE_ERROR\", (error: ErrorResponse) => {\n return {\n payload: error,\n };\n});\n\nconst initialState = null;\n\nexport const errorReducer = createReducer<ErrorState>(\n initialState,\n (builder) => {\n builder.addCase(saveError, (_state, action) => {\n return action.payload;\n });\n },\n);\n","import { createAction, createReducer } from \"@reduxjs/toolkit\";\n\nexport interface ModalState {\n key: string;\n visible: boolean;\n size?: string;\n}\n\nexport interface ModalsState {\n modals: ModalState[];\n}\n\nexport const showModal = createAction(\"SHOW_MODAL\", (key: string) => {\n return {\n payload: key,\n };\n});\n\nexport const closeModal = createAction(\"CLOSE_MODAL\", (key: string) => {\n return {\n payload: key,\n };\n});\n\nconst initialState: ModalsState = {\n modals: [],\n};\n\nexport const modalsReducer = createReducer(initialState, (builder) => {\n builder\n .addCase(showModal, (state, action) => {\n const key = action.payload;\n\n // Hide all modals\n state.modals.forEach((modal) => {\n modal.visible = false;\n });\n\n // Find existing modal\n const existing = state.modals.find((modal) => modal.key === key);\n\n if (existing) {\n existing.visible = true;\n } else {\n state.modals.push({ key, visible: true });\n }\n })\n .addCase(closeModal, (state, action) => {\n const key = action.payload;\n\n // Remove the modal\n state.modals = state.modals.filter((modal) => modal.key !== key);\n\n // Show the last modal (if any)\n const last = state.modals[state.modals.length - 1];\n if (last) {\n last.visible = true;\n }\n });\n});\n","export enum MODULARUI_STATUS {\n IDLE = \"IDLE\",\n LOADING = \"LOADING\",\n FINISHED = \"FINISHED\",\n ERROR = \"ERROR\",\n}\n","import { createAction } from \"@reduxjs/toolkit\";\n\nimport type { ErrorResponse, ModularUIModel } from \"@beinformed/ui/models\";\n\nexport const updateErrorStatus = createAction(\n \"MODULARUI/ERROR_STATUS\",\n (key: string, error: ErrorResponse) => {\n return {\n payload: {\n key,\n error,\n },\n };\n },\n);\n\nexport const setModel = createAction(\n \"MODULARUI/SET\",\n (key: string, model: ModularUIModel) => {\n model.connectKey = key;\n return {\n payload: {\n key,\n model,\n },\n };\n },\n);\n\nexport const initModels = createAction(\n \"MODULARUI/INIT\",\n (models: { key: string; model: ModularUIModel }[]) => {\n return {\n payload: models,\n };\n },\n);\n\nexport const updateModel = createAction(\n \"MODULARUI/UPDATE\",\n (model: ModularUIModel) => {\n return {\n payload: model,\n };\n },\n);\n\nexport const updateForm = createAction(\n \"MODULARUI/UPDATE_FORM\",\n (model: ModularUIModel) => {\n return {\n payload: model,\n };\n },\n);\n\nexport const removeModelByKey = createAction(\n \"MODULARUI/REMOVE_KEY\",\n (key: string) => {\n return {\n payload: key,\n };\n },\n);\n\n/**\n * Removes all models except the application model from the modular ui reducer\n */\nexport const resetModularUI = createAction(\"MODULARUI/RESET\");\n","import { Href } from \"@beinformed/ui/models\";\n\nimport type { RootState } from \"../store\";\n\nexport const getFirstModelByInstance = <\n T extends new (...args: unknown[]) => unknown,\n>(\n state: RootState,\n instance: T,\n): InstanceType<T> | undefined => {\n const locale = state.i18n.locale || \"en\";\n const modularui = state.modularui;\n\n if (modularui) {\n const key = Object.keys(modularui).find((key) => {\n const modelEntry = modularui[key];\n if (!modelEntry?.model) {\n return false;\n }\n return (\n modelEntry.model instanceof instance &&\n modelEntry.model.locale === locale\n );\n });\n\n if (key) {\n const modelEntry = modularui[key];\n if (modelEntry?.model instanceof instance) {\n return modelEntry.model as InstanceType<T>;\n }\n }\n }\n\n return undefined;\n};\n\n/**\n * Returns all model keys found in the store, restrict on href\n */\nexport const allKeysByHref = (state: RootState, href: Href | string) => {\n if (state && state.modularui) {\n const findHref = href instanceof Href ? href : new Href(href);\n\n return Object.keys(state.modularui).filter((key) => {\n const modelEntry = state.modularui[key];\n if (modelEntry) {\n return modelEntry.model?.selfhref?.equals(findHref);\n }\n });\n }\n\n return [];\n};\n","import { ApplicationModel } from \"@beinformed/ui/models\";\n\nimport type { RootState } from \"../store\";\n\n/**\n * Get the application model, which is the model with selfhref '/'\n */\nexport const getApplication = (state: RootState) => {\n const locale = state.i18n.locale || \"en\";\n const modularui = state.modularui;\n\n if (modularui) {\n const key = Object.keys(modularui).find((key) => {\n const modelEntry = modularui[key];\n if (!modelEntry?.model) {\n return false;\n }\n return (\n modelEntry.model instanceof ApplicationModel &&\n modelEntry.model.locale === locale\n );\n });\n\n if (key) {\n return modularui[key] as unknown as ApplicationModel;\n }\n }\n\n return undefined;\n};\n","import { ApplicationModel, Href } from \"@beinformed/ui/models\";\nimport { createAsyncThunk } from \"@reduxjs/toolkit\";\n\nimport { getLocale } from \"../i18n/i18nSelectors\";\nimport { fetchModel } from \"../modularui/fetchModel\";\nimport { removeModelByKey } from \"../modularui/modelActions\";\nimport { allKeysByHref } from \"../shared/selectors\";\nimport { getApplication } from \"./applicationSelectors\";\n\nimport type { BEIDispatch, RootState } from \"../store\";\n\nexport const reloadApplication = createAsyncThunk<\n void,\n void,\n { dispatch: BEIDispatch; state: RootState; extra: unknown }\n>(\"application/reload\", async (_, { dispatch, getState }) => {\n const state = getState();\n\n const applicationHref = new Href(\"/\", \"Application\");\n\n const application = getApplication(state);\n if (application) {\n if (application.contextPath) {\n applicationHref.contextPath = application.contextPath;\n }\n if (application.origin) {\n applicationHref.origin = application.origin;\n }\n }\n\n const allKeys = allKeysByHref(state, applicationHref);\n for (const key of allKeys) {\n dispatch(removeModelByKey(key));\n }\n\n const locale = getLocale(state);\n const modelKey = `application(/)(${locale}`;\n\n await dispatch(\n fetchModel({\n key: modelKey,\n href: applicationHref,\n options: {\n targetModel: ApplicationModel,\n },\n }),\n );\n});\n","import { HTTP_METHODS } from \"@beinformed/ui/constants\";\nimport { ErrorResponse, Href } from \"@beinformed/ui/models\";\nimport { ModularUIRequest } from \"@beinformed/ui/modularui\";\nimport { createAsyncThunk } from \"@reduxjs/toolkit\";\n\nimport { handleError } from \"../error/errorActions\";\nimport { MODULARUI_STATUS } from \"./constants\";\nimport { removeModelByKey, updateErrorStatus } from \"./modelActions\";\nimport { getRequestLocale } from \"./utils\";\n\nimport type { BEIDispatch, RootState } from \"../store\";\nimport type { FetchModelPayload, FetchModelResult } from \"./types\";\n\nconst executeRequest = async (\n { key, href, options }: FetchModelPayload,\n {\n dispatch,\n getState,\n rejectWithValue,\n }: {\n dispatch: BEIDispatch;\n getState: () => RootState;\n rejectWithValue: (value: ErrorResponse) => unknown;\n },\n): Promise<FetchModelResult> => {\n try {\n const locale = getRequestLocale(options?.locale, getState().i18n.locale);\n\n const requestHref =\n href instanceof Href\n ? href\n : new Href(href, \"\", {\n origin: options?.origin,\n contextPath: options?.contextPath,\n });\n\n const modularuiRequest = new ModularUIRequest(requestHref, {\n method: options?.method || HTTP_METHODS.GET,\n params: options?.params || \"\",\n data: options?.data || null,\n locale: locale,\n childmodels: options?.childmodels ?? true,\n isReload: options?.isReload,\n cache: options?.cache,\n headers: options?.headers,\n events: options?.events,\n onProgress: options?.onProgress,\n origin: options?.origin,\n contextPath: options?.contextPath,\n targetModel: options?.targetModel,\n forceTargetModel: options?.forceTargetModel ?? false,\n timeout: options?.timeout,\n });\n\n const model = await modularuiRequest.fetch();\n\n if (model) {\n model.connectKey = key;\n }\n\n // Return data for the fulfilled action\n return {\n key,\n model,\n updateHandler: options?.updateHandler,\n };\n } catch (error: unknown) {\n const errorResponse = new ErrorResponse(error as Error, key, {\n origin: options?.origin,\n contextPath: options?.contextPath,\n });\n\n // Specific error handling for removing model on certain errors\n if (\n errorResponse.isChangePassword ||\n errorResponse.isResourceNotFoundAfterReload\n ) {\n dispatch(removeModelByKey(key));\n } else {\n dispatch(updateErrorStatus(key, errorResponse));\n }\n\n // Dispatch the global error handler\n dispatch(handleError(error));\n\n throw rejectWithValue(errorResponse);\n }\n};\n\nexport const fetchModel = createAsyncThunk<\n FetchModelResult, // Return type of the fulfilled action payload\n FetchModelPayload, // First argument to the thunk\n {\n dispatch: BEIDispatch;\n state: RootState;\n rejectValue: ErrorResponse; // Type of the error payload in case of rejection\n }\n>(\"modularui/fetchModel\", executeRequest, {\n condition: ({ key }, { getState }) => {\n if (getState().modularui[key]?.status === MODULARUI_STATUS.LOADING) {\n return false;\n }\n },\n});\n","import { IS_SERVER } from \"@beinformed/ui/constants\";\nimport { ErrorResponse } from \"@beinformed/ui/models\";\nimport { logoutPath } from \"@beinformed/ui/settings\";\n\nimport { saveChangePassword } from \"../auth/authReducer\";\nimport { handleUnauthorized } from \"../auth/unauthorizedActions\";\nimport { showXHRErrorNotification } from \"../notifications/notificationActions\";\nimport { push } from \"../router/routerActions\";\nimport { noAction } from \"../shared/actions\";\nimport { saveError } from \"./errorReducer\";\n\nimport type { BEIDispatch } from \"../store\";\n\ntype DefaultHandler = typeof defaultErrorResponseHandler;\n\n// Default handler\nconst defaultErrorResponseHandler =\n (error: ErrorResponse) => (dispatch: BEIDispatch) => {\n if (error.isResourceNotFoundAfterReload || error.isRemoteServiceException) {\n return dispatch(noAction());\n }\n\n if (error.isUnauthorized) {\n return dispatch(handleUnauthorized(error));\n }\n\n if (error.isBlocked || error.isConcurrentUser || error.isInvalidUsername) {\n dispatch(push(logoutPath()));\n return;\n }\n\n if (error.isChangePassword) {\n return dispatch(saveChangePassword());\n }\n\n if (IS_SERVER) {\n return dispatch(saveError(error));\n }\n\n // This setTimeout might hide errors from Sentry/monitoring tools\n setTimeout(() => {\n throw error.error || error;\n });\n\n return dispatch(showXHRErrorNotification(error));\n };\n\ntype CustomErrorResponseHandler = (\n error: ErrorResponse,\n defaultHandler: DefaultHandler,\n) => (dispatch: BEIDispatch) => void;\n\nlet customErrorResponseHandler: CustomErrorResponseHandler =\n (error, defaultHandler) => (dispatch) =>\n dispatch(defaultHandler(error));\n\nexport const setCustomErrorResponseHandler = (\n handler: CustomErrorResponseHandler,\n) => {\n customErrorResponseHandler = handler;\n};\n\nexport const handleError = (error: unknown) => {\n // Ensure the error is an ErrorResponse if possible, otherwise create one.\n const errorResponse =\n error instanceof ErrorResponse ? error : new ErrorResponse(error as Error);\n\n // Dispatch the default handler or custom handler\n return customErrorResponseHandler(errorResponse, defaultErrorResponseHandler);\n};\n","import { getBooleanSetting, getStringSetting } from \"@beinformed/ui/settings\";\nimport { Cache } from \"@beinformed/ui/utils\";\nimport { createAsyncThunk } from \"@reduxjs/toolkit\";\n\nimport { reloadApplication } from \"../application/applicationActions\";\nimport { getApplication } from \"../application/applicationSelectors\";\nimport { removeModelByKey } from \"../modularui/modelActions\";\nimport { replace } from \"../router/routerActions\";\nimport { logoutSuccess, sendAuthenticationError } from \"./authReducer\";\n\nimport type { ErrorResponse } from \"@beinformed/ui/models\";\nimport type { BEIDispatch, RootState } from \"../store\";\n\nexport const handleUnauthorized = createAsyncThunk<\n void,\n ErrorResponse,\n { state: RootState; dispatch: BEIDispatch }\n>(\"auth/unauthorized\", (errorResponse, { dispatch, getState }) => {\n if (errorResponse.connectKey) {\n dispatch(removeModelByKey(errorResponse.connectKey));\n }\n\n if (\n getBooleanSetting(\"PAGE_RELOAD_ON_UNAUTHORIZED_ERROR\", false) &&\n errorResponse.response\n ) {\n window.location.reload();\n return;\n }\n\n // reload application when flag auth is set or isLogged\n const application = getApplication(getState());\n if (Cache.getItem(\"auth\") || application?.isLoggedIn) {\n dispatch(reloadApplication());\n }\n\n // set logged out\n dispatch(logoutSuccess());\n\n Cache.removeItem(\"auth\");\n\n if (errorResponse.isInvalidUsername) {\n dispatch(sendAuthenticationError(errorResponse.message || \"\"));\n }\n\n // add current location as from location before redirect\n const location = getState().router.location;\n const LOGIN_PATH = getStringSetting(\"LOGIN_PATH\", \"/signin\");\n if (location?.pathname !== LOGIN_PATH) {\n const locationFrom = location?.state?.from;\n dispatch(\n replace(LOGIN_PATH, {\n from: locationFrom ? locationFrom : getState().router.location,\n // cannot open login in a modal, because of previous locations that might be secure\n modal: false,\n }),\n );\n }\n});\n","import { createAction } from \"@reduxjs/toolkit\";\n\nexport const noAction = createAction(\"NO_ACTION\");\n","/**\n * Retrieve the preferred language for this request, falls back to the browser language or english\n */\nexport const getRequestLocale = (\n optionLocale: string | undefined,\n currentStateLocale: string,\n) => {\n if (optionLocale) {\n return optionLocale;\n }\n\n if (typeof navigator !== \"undefined\" && navigator?.language) {\n return navigator.language.split(\"-\")[0] || currentStateLocale;\n }\n\n return currentStateLocale;\n};\n"],"mappings":"+IAAA,IAAAA,EAAAC,EAAA,CAAAC,GAAAC,IAAA,cACA,IAAIC,GAAmB,iBAGnBC,GAAW,mBAUf,SAASC,GAAQC,EAAOC,EAAQ,CAC9B,IAAIC,EAAO,OAAOF,EAClB,OAAAC,EAASA,GAAiBJ,GAEnB,CAAC,CAACI,IACNC,GAAQ,UACNA,GAAQ,UAAYJ,GAAS,KAAKE,CAAK,IACrCA,EAAQ,IAAMA,EAAQ,GAAK,GAAKA,EAAQC,CACjD,CAEAL,EAAO,QAAUG,KCxBjB,IAAAI,EAAAC,EAAA,CAAAC,GAAAC,IAAA,cACA,IAAIC,GAAmB,iBA4BvB,SAASC,GAASC,EAAO,CACvB,OAAO,OAAOA,GAAS,UACrBA,EAAQ,IAAMA,EAAQ,GAAK,GAAKA,GAASF,EAC7C,CAEAD,EAAO,QAAUE,KClCjB,IAAAE,GAAAC,EAAA,CAAAC,GAAAC,IAAA,kBAAIC,GAAW,IACXC,GAAc,KACdC,GAAU,IACVC,GAAU,IACVC,GAAW,IACXC,GAAQ,KAWZ,SAASC,GAAQC,EAAQC,EAAMC,EAAS,CACtCD,EAAOR,GAASQ,EAAMD,CAAM,EAM5B,QAJIG,EAAQ,GACRC,EAASH,EAAK,OACdI,EAAS,GAEN,EAAEF,EAAQC,GAAQ,CACvB,IAAIE,EAAMR,GAAMG,EAAKE,CAAK,CAAC,EAC3B,GAAI,EAAEE,EAASL,GAAU,MAAQE,EAAQF,EAAQM,CAAG,GAClD,MAEFN,EAASA,EAAOM,CAAG,CACrB,CACA,OAAID,GAAU,EAAEF,GAASC,EAChBC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AAOF,EAChBP,EAASU,EAAiBD,CAAG,CAAC,EAIhC,IAAME,EAAW,kBADFC,EAAUV,CAAK,CACW,GAEzC,MAAMF,EACJa,EAAW,CACT,IAAKF,EACL,KAAMR,EACN,QAAS,CACP,YAAaW,EACf,CACF,CAAC,CACH,CACF,CAAC","names":["require_isIndex","__commonJSMin","exports","module","MAX_SAFE_INTEGER","reIsUint","isIndex","value","length","type","require_isLength","__commonJSMin","exports","module","MAX_SAFE_INTEGER","isLength","value","require_hasPath","__commonJSMin","exports","module","castPath","isArguments","isArray","isIndex","isLength","toKey","hasPath","object","path","hasFunc","index","length","result","key","createAction","createReducer","initalState","loginSuccess","logoutSuccess","sendAuthenticationError","errorMessage","resetAuthErrors","saveChangePassword","authReducer","builder","state","action","Cache","createAction","createReducer","updateEntryDate","entryDate","initialState","modelCatalogReducer","builder","state","action","createAction","createAsyncThunk","createReducer","NOTIFICATION_TYPES","saveNotification","type","message","error","showNotification","timeout","dispatch","dismissNotification","initialState","notificationReducer","builder","state","action","getNumberSetting","createAsyncThunk","createAction","startProgress","finishProgress","resetProgress","updateProgress","percentComplete","getNotificationMessageId","form","showFormNotification","createAsyncThunk","dispatch","startProgress","showNotification","dismissNotification","getNumberSetting","finishProgress","showXHRErrorNotification","error","createAction","push","location","state","replace","go","delta","goBack","goForward","createAction","createReducer","saveError","error","initialState","errorReducer","builder","_state","action","createAction","createReducer","showModal","key","closeModal","initialState","modalsReducer","builder","state","action","modal","existing","last","MODULARUI_STATUS","createAction","updateErrorStatus","key","error","setModel","model","initModels","models","updateModel","updateForm","removeModelByKey","resetModularUI","Href","getFirstModelByInstance","state","instance","locale","modularui","key","modelEntry","allKeysByHref","href","findHref","ApplicationModel","getApplication","state","locale","modularui","key","modelEntry","ApplicationModel","Href","createAsyncThunk","HTTP_METHODS","ErrorResponse","Href","ModularUIRequest","createAsyncThunk","IS_SERVER","ErrorResponse","logoutPath","getBooleanSetting","getStringSetting","Cache","createAsyncThunk","handleUnauthorized","createAsyncThunk","errorResponse","dispatch","getState","removeModelByKey","getBooleanSetting","application","getApplication","Cache","reloadApplication","logoutSuccess","sendAuthenticationError","location","LOGIN_PATH","getStringSetting","locationFrom","replace","createAction","noAction","defaultErrorResponseHandler","error","dispatch","noAction","handleUnauthorized","push","logoutPath","saveChangePassword","IS_SERVER","saveError","showXHRErrorNotification","customErrorResponseHandler","defaultHandler","setCustomErrorResponseHandler","handler","handleError","errorResponse","ErrorResponse","getRequestLocale","optionLocale","currentStateLocale","executeRequest","key","href","options","dispatch","getState","rejectWithValue","locale","getRequestLocale","requestHref","Href","model","ModularUIRequest","HTTP_METHODS","error","errorResponse","ErrorResponse","removeModelByKey","updateErrorStatus","handleError","fetchModel","createAsyncThunk","reloadApplication","createAsyncThunk","_","dispatch","getState","state","applicationHref","Href","application","getApplication","allKeys","allKeysByHref","key","removeModelByKey","modelKey","getLocale","fetchModel","ApplicationModel"]}
|
package/dist/chunk-YG7XDCNV.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var d={attribute:{name:0,nativeName:1},rtl:{ar:1,dv:1,fa:1,ha:1,he:1,ks:1,ku:1,ps:1,ur:1,yi:1},lang:{aa:["Afar","Afar"],ab:["Abkhazian","\u0410\u04A7\u0441\u0443\u0430"],af:["Afrikaans","Afrikaans"],ak:["Akan","Akana"],am:["Amharic","\u12A0\u121B\u122D\u129B"],an:["Aragonese","Aragon\xE9s"],ar:["Arabic","\u0627\u0644\u0639\u0631\u0628\u064A\u0629"],as:["Assamese","\u0985\u09B8\u09AE\u09C0\u09AF\u09BC\u09BE"],av:["Avar","\u0410\u0432\u0430\u0440"],ay:["Aymara","Aymar"],az:["Azerbaijani","Az\u0259rbaycanca / \u0622\u0630\u0631\u0628\u0627\u064A\u062C\u0627\u0646"],ba:["Bashkir","\u0411\u0430\u0448\u04A1\u043E\u0440\u0442"],be:["Belarusian","\u0411\u0435\u043B\u0430\u0440\u0443\u0441\u043A\u0430\u044F"],bg:["Bulgarian","\u0411\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438"],bh:["Bihari","\u092D\u094B\u091C\u092A\u0941\u0930\u0940"],bi:["Bislama","Bislama"],bm:["Bambara","Bamanankan"],bn:["Bengali","\u09AC\u09BE\u0982\u09B2\u09BE"],bo:["Tibetan","\u0F56\u0F7C\u0F51\u0F0B\u0F61\u0F72\u0F42 / Bod skad"],br:["Breton","Brezhoneg"],bs:["Bosnian","Bosanski"],ca:["Catalan","Catal\xE0"],ce:["Chechen","\u041D\u043E\u0445\u0447\u0438\u0439\u043D"],ch:["Chamorro","Chamoru"],co:["Corsican","Corsu"],cr:["Cree","Nehiyaw"],cs:["Czech","\u010Cesky"],cu:["Old Church Slavonic / Old Bulgarian","\u0441\u043B\u043E\u0432\u0463\u043D\u044C\u0441\u043A\u044A / slov\u011Bn\u012Dsk\u016D"],cv:["Chuvash","\u0427\u0103\u0432\u0430\u0448"],cy:["Welsh","Cymraeg"],da:["Danish","Dansk"],de:["German","Deutsch"],dv:["Divehi","\u078B\u07A8\u0788\u07AC\u0780\u07A8\u0784\u07A6\u0790\u07B0"],dz:["Dzongkha","\u0F47\u0F7C\u0F44\u0F0B\u0F41"],ee:["Ewe","\u0190\u028B\u025B"],el:["Greek","\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC"],en:["English","English"],eo:["Esperanto","Esperanto"],es:["Spanish","Espa\xF1ol"],et:["Estonian","Eesti"],eu:["Basque","Euskara"],fa:["Persian","\u0641\u0627\u0631\u0633\u06CC"],ff:["Peul","Fulfulde"],fi:["Finnish","Suomi"],fj:["Fijian","Na Vosa Vakaviti"],fo:["Faroese","F\xF8royskt"],fr:["French","Fran\xE7ais"],fy:["West Frisian","Frysk"],ga:["Irish","Gaeilge"],gd:["Scottish Gaelic","G\xE0idhlig"],gl:["Galician","Galego"],gn:["Guarani","Ava\xF1e'\u1EBD"],gu:["Gujarati","\u0A97\u0AC1\u0A9C\u0AB0\u0ABE\u0AA4\u0AC0"],gv:["Manx","Gaelg"],ha:["Hausa","\u0647\u064E\u0648\u064F\u0633\u064E"],he:["Hebrew","\u05E2\u05D1\u05E8\u05D9\u05EA"],hi:["Hindi","\u0939\u093F\u0928\u094D\u0926\u0940"],ho:["Hiri Motu","Hiri Motu"],hr:["Croatian","Hrvatski"],ht:["Haitian","Kr\xE8yol ayisyen"],hu:["Hungarian","Magyar"],hy:["Armenian","\u0540\u0561\u0575\u0565\u0580\u0565\u0576"],hz:["Herero","Otsiherero"],ia:["Interlingua","Interlingua"],id:["Indonesian","Bahasa Indonesia"],ie:["Interlingue","Interlingue"],ig:["Igbo","Igbo"],ii:["Sichuan Yi","\uA187\uA259 / \u56DB\u5DDD\u5F5D\u8BED"],ik:["Inupiak","I\xF1upiak"],io:["Ido","Ido"],is:["Icelandic","\xCDslenska"],it:["Italian","Italiano"],iu:["Inuktitut","\u1403\u14C4\u1483\u144E\u1450\u1466"],ja:["Japanese","\u65E5\u672C\u8A9E"],jv:["Javanese","Basa Jawa"],ka:["Georgian","\u10E5\u10D0\u10E0\u10D7\u10E3\u10DA\u10D8"],kg:["Kongo","KiKongo"],ki:["Kikuyu","G\u0129k\u0169y\u0169"],kj:["Kuanyama","Kuanyama"],kk:["Kazakh","\u049A\u0430\u0437\u0430\u049B\u0448\u0430"],kl:["Greenlandic","Kalaallisut"],km:["Cambodian","\u1797\u17B6\u179F\u17B6\u1781\u17D2\u1798\u17C2\u179A"],kn:["Kannada","\u0C95\u0CA8\u0CCD\u0CA8\u0CA1"],ko:["Korean","\uD55C\uAD6D\uC5B4"],kr:["Kanuri","Kanuri"],ks:["Kashmiri","\u0915\u0936\u094D\u092E\u0940\u0930\u0940 / \u0643\u0634\u0645\u064A\u0631\u064A"],ku:["Kurdish","Kurd\xEE / \u0643\u0648\u0631\u062F\u06CC"],kv:["Komi","\u041A\u043E\u043C\u0438"],kw:["Cornish","Kernewek"],ky:["Kirghiz","K\u0131rg\u0131zca / \u041A\u044B\u0440\u0433\u044B\u0437\u0447\u0430"],la:["Latin","Latina"],lb:["Luxembourgish","L\xEBtzebuergesch"],lg:["Ganda","Luganda"],li:["Limburgian","Limburgs"],ln:["Lingala","Ling\xE1la"],lo:["Laotian","\u0EA5\u0EB2\u0EA7 / Pha xa lao"],lt:["Lithuanian","Lietuvi\u0173"],lv:["Latvian","Latvie\u0161u"],mg:["Malagasy","Malagasy"],mh:["Marshallese","Kajin Majel / Ebon"],mi:["Maori","M\u0101ori"],mk:["Macedonian","\u041C\u0430\u043A\u0435\u0434\u043E\u043D\u0441\u043A\u0438"],ml:["Malayalam","\u0D2E\u0D32\u0D2F\u0D3E\u0D33\u0D02"],mn:["Mongolian","\u041C\u043E\u043D\u0433\u043E\u043B"],mo:["Moldovan","Moldoveneasc\u0103"],mr:["Marathi","\u092E\u0930\u093E\u0920\u0940"],ms:["Malay","Bahasa Melayu"],mt:["Maltese","bil-Malti"],my:["Burmese","Myanmasa"],na:["Nauruan","Dorerin Naoero"],nd:["North Ndebele","Sindebele"],ne:["Nepali","\u0928\u0947\u092A\u093E\u0932\u0940"],ng:["Ndonga","Oshiwambo"],nl:["Dutch","Nederlands"],nn:["Norwegian Nynorsk","Norsk (nynorsk)"],no:["Norwegian","Norsk (bokm\xE5l / riksm\xE5l)"],nr:["South Ndebele","isiNdebele"],nv:["Navajo","Din\xE9 bizaad"],ny:["Chichewa","Chi-Chewa"],oc:["Occitan","Occitan"],oj:["Ojibwa","\u140A\u14C2\u1511\u14C8\u142F\u14A7\u140E\u14D0 / Anishinaabemowin"],om:["Oromo","Oromoo"],or:["Oriya","\u0B13\u0B21\u0B3C\u0B3F\u0B06"],os:["Ossetian / Ossetic","\u0418\u0440\u043E\u043D\u0430\u0443"],pa:["Panjabi / Punjabi","\u0A2A\u0A70\u0A1C\u0A3E\u0A2C\u0A40 / \u092A\u0902\u091C\u093E\u092C\u0940 / \u067E\u0646\u062C\u0627\u0628\u064A"],pi:["Pali","P\u0101li / \u092A\u093E\u0934\u093F"],pl:["Polish","Polski"],ps:["Pashto","\u067E\u069A\u062A\u0648"],pt:["Portuguese","Portugu\xEAs"],qu:["Quechua","Runa Simi"],rm:["Raeto Romance","Rumantsch"],rn:["Kirundi","Kirundi"],ro:["Romanian","Rom\xE2n\u0103"],ru:["Russian","\u0420\u0443\u0441\u0441\u043A\u0438\u0439"],rw:["Rwandi","Kinyarwandi"],sa:["Sanskrit","\u0938\u0902\u0938\u094D\u0915\u0943\u0924\u092E\u094D"],sc:["Sardinian","Sardu"],sd:["Sindhi","\u0938\u093F\u0928\u0927\u093F"],se:["Northern Sami","S\xE1megiella"],sg:["Sango","S\xE4ng\xF6"],sh:["Serbo-Croatian","Srpskohrvatski / \u0421\u0440\u043F\u0441\u043A\u043E\u0445\u0440\u0432\u0430\u0442\u0441\u043A\u0438"],si:["Sinhalese","\u0DC3\u0DD2\u0D82\u0DC4\u0DBD"],sk:["Slovak","Sloven\u010Dina"],sl:["Slovenian","Sloven\u0161\u010Dina"],sm:["Samoan","Gagana Samoa"],sn:["Shona","chiShona"],so:["Somalia","Soomaaliga"],sq:["Albanian","Shqip"],sr:["Serbian","\u0421\u0440\u043F\u0441\u043A\u0438"],ss:["Swati","SiSwati"],st:["Southern Sotho","Sesotho"],su:["Sundanese","Basa Sunda"],sv:["Swedish","Svenska"],sw:["Swahili","Kiswahili"],ta:["Tamil","\u0BA4\u0BAE\u0BBF\u0BB4\u0BCD"],te:["Telugu","\u0C24\u0C46\u0C32\u0C41\u0C17\u0C41"],tg:["Tajik","\u0422\u043E\u04B7\u0438\u043A\u04E3"],th:["Thai","\u0E44\u0E17\u0E22 / Phasa Thai"],ti:["Tigrinya","\u1275\u130D\u122D\u129B"],tk:["Turkmen","\u0422\u0443\u0440\u043A\u043C\u0435\u043D / \u062A\u0631\u0643\u0645\u0646"],tl:["Tagalog / Filipino","Tagalog"],tn:["Tswana","Setswana"],to:["Tonga","Lea Faka-Tonga"],tr:["Turkish","T\xFCrk\xE7e"],ts:["Tsonga","Xitsonga"],tt:["Tatar","Tatar\xE7a"],tw:["Twi","Twi"],ty:["Tahitian","Reo M\u0101`ohi"],ug:["Uyghur","Uy\u01A3urq\u0259 / \u0626\u06C7\u064A\u063A\u06C7\u0631\u0686\u06D5"],uk:["Ukrainian","\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430"],ur:["Urdu","\u0627\u0631\u062F\u0648"],uz:["Uzbek","\u040E\u0437\u0431\u0435\u043A"],ve:["Venda","Tshiven\u1E13a"],vi:["Vietnamese","Ti\u1EBFng Vi\u1EC7t"],vo:["Volap\xFCk","Volap\xFCk"],wa:["Walloon","Walon"],wo:["Wolof","Wollof"],xh:["Xhosa","isiXhosa"],yi:["Yiddish","\u05D9\u05D9\u05B4\u05D3\u05D9\u05E9"],yo:["Yoruba","Yor\xF9b\xE1"],za:["Zhuang","Cuengh / T\xF4\xF4 / \u58EE\u8BED"],zh:["Chinese","\u4E2D\u6587"],zu:["Zulu","isiZulu"],pap:["Papiamento","Papiamento"]}};import{IllegalStateException as v}from"@beinformed/ui/exceptions";import{getBooleanSetting as C}from"@beinformed/ui/settings";import l from"format-message";import{immerable as f}from"immer";var i=class{[f]=!0;#n;#e;#a;#t;constructor(e){this.#n=e.code,this.#e=this.fixPlaceHoldersInObject(e.messages),this.#a=this.fixPlaceHoldersInObject(e.errors),this.#t=e.nativeName,l.setup({missingTranslation:"ignore"})}get code(){return this.#n}get nativeName(){if(this.#t)return this.#t;let e=this.code.split("-");if(e.length>0){let a=e[0];if(a){let t=d.lang[a];if(t)return t[1]+(e[1]?` (${e[1].toUpperCase()})`:"")}}throw new v(`Can not find language name based on locale: ${this.code}`)}fixPlaceHolders(e){return typeof e=="string"?e.replace(/'\$\{(?<key>.*?)}'/g,"''{$<key>}''").replace(/\$\{(?<key>.*?)}/g,"{$<key>}"):null}fixPlaceHoldersInObject(e={}){return JSON.parse(JSON.stringify(e).replace(/'\$\{(?<key>.*?)}'/g,"''{$<key>}''").replace(/\$\{(?<key>.*?)}/g,"{$<key>}"))}getBaseMessage(e,a){if(!e&&!a)return"[message: id or defaultMessage missing]";let t=this.#e[e]||this.#a[e];return(typeof process>"u"||process.env.NODE_ENV!=="production")&&!t&&e&&C("DEBUG_I18N_MESSAGE_NOT_FOUND")&&console.debug(`Message with id ${e} not found for locale ${this.code} in layout translations`),t||this.fixPlaceHolders(a)||e}formatMessage(e,a){return a?l(e,a):e}getMessage(e,a,t){let r=this.getBaseMessage(e,a);return this.formatMessage(r,t)}update(e={},a={}){this.#e={...this.#e,...this.fixPlaceHoldersInObject(e)},this.#a={...this.#a,...this.fixPlaceHoldersInObject(a)}}};import{IllegalArgumentException as k}from"@beinformed/ui/exceptions";import{BaseCollection as y}from"@beinformed/ui/models";var m={"Constraint.Attribute.IncorrectValue":"Incorrect value","Constraint.Boolean.InvalidValue":"Invalid boolean value, only values 'true' or 'false' are valid","Constraint.BSN.InvalidFormat":"Must be a valid BSN","Constraint.Captcha.InvalidToken":"The captcha is invalid","Constraint.Choice.ConflictingAnswer":"Cannot select '${answer-option-key}' because this is not a relevant option, given the other answers","Constraint.Choice.ConflictingOptions":"Cannot select '${answer-option-key1}' and '${answer-option-key2}' at the same time","Constraint.Choice.InvalidOption":"Allowed options are: ${options}","Constraint.Choice.InvalidOption.General":"Value '${value}' is not allowed","Constraint.Choice.MultipleNotAllowed":"Selecting multiple options is not allowed","Constraint.ConfirmCurrentPassword.Invalid":"Must match the current password","Constraint.Date.AboveMaximum":"Must be on or before ${max-date}","Constraint.Date.BelowMinimum":"Must be on or after ${min-date}","Constraint.Date.InvalidFormat":"Must be entered in the format ${format}","Constraint.Date.NotOnDate":"Must be on ${date}","Constraint.Date.OutOfRange":"Must be between ${min-date} and ${max-date}","Constraint.DateRange.InvalidRange":"Start date must be before end date","Constraint.DateRange.Mandatory":"Field is mandatory: must contain at least a start or end date","Constraint.DateTime.AboveMaximum":"Must be before ${max-date-time}","Constraint.DateTime.BelowMinimum":"Must be at ${min-date-time} or after","Constraint.DateTime.InvalidFormat":"Must be entered in the format ${format}","Constraint.DateTime.OutOfRange":"Must be between ${min-date-time} and ${max-date-time}","Constraint.DateTimeRange.InvalidRange":"Start date-time must be before end date-time","Constraint.DateTimeRange.Mandatory":"Field is mandatory: must contain at least a start or end date-time","Constraint.Document.MimeTypeNotAllowed":"The document mime type is not valid for the selected document type","Constraint.Email.InvalidFormat":"Must be a valid e-mail address","Constraint.File.DataEmpty":"File does not exist or has no content","Constraint.File.InvalidExtension":"Allowed extensions are: ${extensions}","Constraint.File.InvalidFormat":"Must meet the requirements of the file name","Constraint.File.InvalidMimeType":"Allowed mime types are: ${mime-types}","Constraint.File.MaxFileSizeExceeded":"Maximum file upload size is ${max-filesize}","Constraint.File.OnlyAllowsOneFile":"Only one file is allowed","Constraint.IBAN.InvalidFormat":"Must be a valid IBAN number","Constraint.InvalidLengthBetween":"Length must be between ${min-length} and ${max-length} characters","Constraint.InvalidLengthExact":"Length must be precisely ${length} characters","Constraint.InvalidLengthTooLong":"Length must not be larger than ${max-length} characters","Constraint.InvalidLengthTooShort":"Length must be at least ${min-length} characters","Constraint.InvalidRegularExpression":"The value is not according the given regular expression ${regexp}","Constraint.Mandatory":"Field is mandatory","Constraint.Missing":"Field is mandatory","Constraint.Number.AboveMaximum":"Must be at most ${max-number}","Constraint.Number.BelowMinimum":"Must be at least ${min-number}","Constraint.Number.InvalidDecimal":"Must be a number with up to ${max-digits} decimal places","Constraint.Number.InvalidInteger":"Must be a whole number","Constraint.Number.InvalidLong":"Must be a whole number","Constraint.Number.OutOfRange":"Must be between ${min-number} and ${max-number}","Constraint.NumberRange.BothFieldsMandatory":"Must contain start and end value","Constraint.NumberRange.InvalidRange":"Start value must be less than the end value","Constraint.NumberRange.Mandatory":"Field is mandatory: must contain at least a start or end value","Constraint.Password.AlreadyUsed":"Must not have been used before","Constraint.Password.LowerAndUpperCaseMandatory":"Must contain both upper and lowercase characters","Constraint.Password.MinNumericCharactersMandatory":"Must contain ${min-numeric} or more numerical characters","Constraint.Password.MinSpecialCharactersMandatory":"Must contain ${min-special} or more special characters","Constraint.Password.ThreeConsecutiveCharactersNotAllowed":"Must not contain any character more than twice consecutively","Constraint.Password.Unchanged":"Must not be the same as the old password","Constraint.Password.UserNameSubstringNotAllowed":"Must not have 5 consecutive characters from username","Constraint.SortParameter.InvalidValue":"Invalid sort parameter. Allowed values: field+[asc|desc]","Constraint.Time.InvalidFormat":"Must be entered in the format ${format}","Constraint.TimeRange.InvalidRange":"Start time must be before end time","Constraint.TimeRange.Mandatory":"Field is mandatory: must contain at least a start or end time","Constraint.TimeStamp.AboveMaximum":"Must be on or before ${max-date}","Constraint.TimeStamp.BelowMinimum":"Must be on or after ${min-date}","Constraint.Timestamp.InvalidFormat":"Must be entered in the format ${format}","Constraint.TimeStampRange.InvalidRange":"Start value must be before end value","Constraint.TimeStampRange.Mandatory":"Field is mandatory: must contain at least a start or end value","Constraint.XML.InvalidFormat":"Must be well-formed XML","Constraint.ZipCode.InvalidFormat":"Must be a valid Dutch ZIP code, e.g. 1234AB","Error.AcceptHeaderRequired":"The 'Accept' request-header field must be provided","Error.Authentication.BlockedUser":"You have been logged out, because your account has been blocked","Error.Authentication.ConcurrentUser":"You have been logged out, since your username has been used at a different location.","Error.Authentication.InvalidCredentials":"Authentication failed","Error.Authentication.InvalidUsername":"You have been logged out, because your username is not valid anymore","Error.Authentication.Required":"Authentication is required","Error.Case.ConcurrentModification":"Another user has updated a case used in this task. As a result, this task can not be completed.","Error.ChangePasswordRequired":"User password is initial or expired, and must be changed ","Error.CodemapLookup.InvalidToken":"Token for codemap lookup is not valid","Error.DataStore.ConcurrentModification":"Another user has updated a record used in this task","Error.DataStore.RecordAlreadyExists":"","Error.DataStore.RowCannotBeLocked":"Another user has already locked a record used in this task","Error.Form.DataNotAvailableForId":"Service can not be completed, data not available for mandatory element ${elementid}","Error.Form.ObjectNotAllowed":"Object '${objectid}' is not allowed","Error.Form.ReadOnlyElementId":"Element '${elementid}' is read only","Error.Form.TooManyObjects":"Too many objects '${objectid}' provided","Error.Form.UndefinedElementId":"Undefined element '${elementid}'","Error.Form.UndefinedObject":"Undefined object(s) '${objectid}'","Error.GeneralError":"An unexpected error occurred","Error.MethodNotAllowed":"The given HTTP method is not allowed for this resource","Error.Parameter.InvalidValue":"The parameter contains characters that are not allowed","Error.Parameter.Mandatory":"Parameter ${parameter} is mandatory","Error.Parameter.NotAllowed":"Parameter '${parameter}' is not allowed","Error.ResourceNotFound":"The requested resource cannot be found","Validation.StandardCreateAndUpdateUserTask.PasswordsDoNotMatch":"Password and password confirmation do not match.","Validation.StandardCreateAndUpdateUserTask.UserEmailAlreadyExists":"A user with email address '${Email}' already exists","Validation.StandardCreateAndUpdateUserTask.UserNameAlreadyExists":"A user with username '${Username}' already exists","Validation.StandardCreateOrganizationTask.OrganizationAlreadyExists":"An organization with id '${ID}' already exists"};var g={"Constraint.Attribute.IncorrectValue":"Ongeldige waarde","Constraint.Boolean.InvalidValue":"Waarde voldoet niet aan het boolean formaat, alleen waarden 'true' en 'false' zijn toegestaan","Constraint.BSN.InvalidFormat":"Moet een geldig BSN zijn","Constraint.Captcha.InvalidToken":"Captcha is niet correct","Constraint.Choice.ConflictingAnswer":"'${answer-option-key}' kan niet worden gekozen omdat dit geen relevante optie is, gegeven de andere antwoorden","Constraint.Choice.ConflictingOptions":"'${answer-option-key1}' and '${answer-option-key2}' kunnen niet tegelijkertijd worden gekozen","Constraint.Choice.InvalidOption":"Toegestane waarden zijn: ${options}","Constraint.Choice.InvalidOption.General":"Waarde '${value}' is niet toegestaan","Constraint.Choice.MultipleNotAllowed":"Meerdere opties selecteren is niet toegestaan","Constraint.ConfirmCurrentPassword.Invalid":"Moet overeenkomen met het huidige wachtwoord","Constraint.Date.AboveMaximum":"Moet op of voor ${max-date} liggen","Constraint.Date.BelowMinimum":"Moet op of na ${min-date} liggen","Constraint.Date.InvalidFormat":"Moet worden opgegeven in het formaat ${format}","Constraint.Date.NotOnDate":"Moet op ${date} liggen","Constraint.Date.OutOfRange":"Moet tussen ${min-date} en ${max-date} liggen","Constraint.DateRange.InvalidRange":"De begindatum dient voor de einddatum te liggen","Constraint.DateRange.Mandatory":"Veld is verplicht: moet tenminste begin- of einddatum bevatten","Constraint.DateTime.AboveMaximum":"Moet voor ${max-date-time} liggen","Constraint.DateTime.BelowMinimum":"Moet op ${min-date-time} of later liggen","Constraint.DateTime.InvalidFormat":"Moet worden opgegeven in het formaat ${format}","Constraint.DateTime.OutOfRange":"Moet tussen ${min-date-time} en ${max-date-time} liggen","Constraint.DateTimeRange.InvalidRange":"De begindatumtijd dient voor de einddatumtijd te liggen","Constraint.DateTimeRange.Mandatory":"Veld is verplicht: moet tenminste begin- of einddatumtijd bevatten","Constraint.Document.MimeTypeNotAllowed":"Het document mime type voldoet niet aan het document type","Constraint.Email.InvalidFormat":"Moet een geldig emailadres zijn","Constraint.File.DataEmpty":"Bestand bestaat niet of heeft geen inhoud","Constraint.File.InvalidExtension":"Toegestane extensies zijn: ${extensions}","Constraint.File.InvalidFormat":"Voldoet niet aan de voorwaarden van een bestandsnaam","Constraint.File.InvalidMimeType":"Toegestane mime-types zijn: ${mime-types}","Constraint.File.MaxFileSizeExceeded":"De maximum file grootte voor upload is ${max-filesize}","Constraint.File.OnlyAllowsOneFile":"Er is slechts \xE9\xE9n bestand toegestaan","Constraint.IBAN.InvalidFormat":"Moet een geldig IBAN nummer zijn","Constraint.InvalidLengthBetween":"Lengte moet tussen ${min-length} en ${max-length} karakters liggen","Constraint.InvalidLengthExact":"Lengte moet precies ${length} karakters zijn","Constraint.InvalidLengthTooLong":"Lengte mag niet langer dan ${max-length} karakters zijn","Constraint.InvalidLengthTooShort":"Lengte moet tenminste ${min-length} karakters zijn","Constraint.InvalidRegularExpression":"De waarde voldoet niet aan de reguliere expressie ${regexp}","Constraint.Mandatory":"Veld is verplicht","Constraint.Missing":"Veld is verplicht","Constraint.Number.AboveMaximum":"Mag niet groter dan ${max-number} zijn","Constraint.Number.BelowMinimum":"Moet minstens ${min-number} zijn","Constraint.Number.InvalidDecimal":"Moet een getal zijn met maximaal ${max-digits} decimalen","Constraint.Number.InvalidInteger":"Moet een geheel getal zijn","Constraint.Number.InvalidLong":"Moet een geheel getal zijn","Constraint.Number.OutOfRange":"Moet tussen ${min-number} en ${max-number} liggen","Constraint.NumberRange.BothFieldsMandatory":"Moet zowel een begin- als een eindwaarde bevatten","Constraint.NumberRange.InvalidRange":"De beginwaarde dient kleiner te zijn dan de eindwaarde","Constraint.NumberRange.Mandatory":"Veld is verplicht: moet tenminste begin- of eindwaarde bevatten","Constraint.Password.AlreadyUsed":"Mag niet eerder zijn gebruikt","Constraint.Password.LowerAndUpperCaseMandatory":"Moet zowel hoofdletters als kleine letters bevatten","Constraint.Password.MinNumericCharactersMandatory":"Moet ${min-numeric} of meer numerieke karakters bevatten","Constraint.Password.MinSpecialCharactersMandatory":"Moet ${min-special} of meer speciale karakters bevatten","Constraint.Password.ThreeConsecutiveCharactersNotAllowed":"Mag niet meer dan twee dezelfde karakters achter elkaar bevatten","Constraint.Password.Unchanged":"Mag niet hetzelfde zijn als het oude wachtwoord","Constraint.Password.UserNameSubstringNotAllowed":"Mag niet vijf opeenvolgende karakters van de gebruikersnaam bevatten","Constraint.SortParameter.InvalidValue":"Ongeldige sorteerparameter. Toegestane waardes: veld+[asc|desc]","Constraint.Time.InvalidFormat":"Moet worden opgegeven in het formaat ${format}","Constraint.TimeRange.InvalidRange":"De begintijd dient voor de eindtijd te liggen","Constraint.TimeRange.Mandatory":"Veld is verplicht: moet tenminste begin- of eindtijd bevatten","Constraint.TimeStamp.AboveMaximum":"Moet op of voor ${max-date} liggen","Constraint.TimeStamp.BelowMinimum":"Moet op of na ${min-date} liggen","Constraint.Timestamp.InvalidFormat":"Moet worden opgegeven in het formaat ${format}","Constraint.TimeStampRange.InvalidRange":"De beginwaarde dient voor de eindwaarde te liggen","Constraint.TimeStampRange.Mandatory":"Veld is verplicht: moet tenminste begin- of eindwaarde bevatten","Constraint.XML.InvalidFormat":"Moet geldige XML zijn","Constraint.ZipCode.InvalidFormat":"Moet een geldige postcode zijn, bijvoorbeeld 1234AB","Error.AcceptHeaderRequired":"De 'Accept' request-header moet worden meegegeven","Error.Authentication.BlockedUser":"U bent uitgelogd omdat uw account geblokkeerd is","Error.Authentication.ConcurrentUser":"U bent uitgelogd omdat uw gebruikersnaam op een andere locatie is gebruikt om in te loggen.","Error.Authentication.InvalidCredentials":"Inloggen is mislukt","Error.Authentication.InvalidUsername":"U bent uitgelogd omdat uw gebruikersnaam niet meer geldig is","Error.Authentication.Required":"Autorisatie is vereist","Error.Case.ConcurrentModification":"Een andere gebruiker heeft het dossier aangepast waardoor deze taak nu niet meer is toegestaan","Error.ChangePasswordRequired":"Gebruikerswachtwoord is initieel of verlopen, en moet worden aangepast","Error.CodemapLookup.InvalidToken":"Token voor keuzelijst lookup is niet valide","Error.DataStore.ConcurrentModification":"Een andere gebruiker heeft de rij in de datastore reeds aangepast","Error.DataStore.RecordAlreadyExists":"","Error.DataStore.RowCannotBeLocked":"Een andere gebruiker heeft de rij in bewerking en daarom kan deze taak niet worden volbracht.","Error.Form.DataNotAvailableForId":"Service kan niet worden afgrond, data voor verplicht element ${elementid} is niet beschikbaar","Error.Form.ObjectNotAllowed":"Object '${objectid}' is niet toegestaan","Error.Form.ReadOnlyElementId":"Element '${elementid}' is alleen lezen","Error.Form.TooManyObjects":"Te veel objecten '${objectid}' aangeleverd","Error.Form.UndefinedElementId":"Element '${elementid}' is ongedefinieerd","Error.Form.UndefinedObject":"Object(en) '${objectid}' ongedefinieerd","Error.GeneralError":"Er is een onverwachte fout opgetreden","Error.MethodNotAllowed":"De opgegeven HTTP methode is niet toegestaan op deze resource","Error.Parameter.InvalidValue":"De parameter bevat karakters die niet zijn toegestaan","Error.Parameter.Mandatory":"De parameter ${parameter} is verplicht","Error.Parameter.NotAllowed":"Parameter '${parameter}' is niet toegestaan","Error.ResourceNotFound":"De opgevraagde resource kan niet worden gevonden","Validation.StandardCreateAndUpdateUserTask.PasswordsDoNotMatch":"Het wachtwoord en de wachtwoordbevestiging komen niet overeen","Validation.StandardCreateAndUpdateUserTask.UserEmailAlreadyExists":"Een gebruiker met e-mailadres '${Email}' bestaat al","Validation.StandardCreateAndUpdateUserTask.UserNameAlreadyExists":"Een gebruiker met gebruikersnaam '${Username}' bestaat al","Validation.StandardCreateOrganizationTask.OrganizationAlreadyExists":"Een organisatie met id '${ID}' bestaat al"};var u=[{code:"en",messages:{},errors:m},{code:"nl",messages:{},errors:g}],K=n=>u.map(e=>n[e.code]?{...e,errors:{...e.errors,...n[e.code]}}:e),o=class n extends y{constructor(e=u){super(e.map(a=>new i(a)))}static rehydrate(e){return e&&e.collection?new n(e.collection.map(a=>({code:a.code,messages:a.messages,errors:a.errors}))):new n([])}hasLocale(e){return this.some(a=>e.startsWith(a.code))}getLocale(e){if(this.hasLocale(e)){let a=this.find(t=>e.startsWith(t.code));if(a)return a}throw new k(`Locale configuration for locale ${e} not found`)}get availableLocaleCodes(){return this.map(e=>e.code)}getPreferredLocale(e){if(e!=null){let t=(e.match(/[-A-Za-z]{2,10}/gu)||[]).filter(r=>this.availableLocaleCodes.some(s=>r.startsWith(s))).map(r=>this.availableLocaleCodes.find(s=>r.startsWith(s)));if(t.length>0)return t[0]}return this.availableLocaleCodes[0]}update(e,a={},t={}){this.hasLocale(e)?this.getLocale(e).update(a,t):this.add(new i({code:e,messages:a,errors:t}))}};import{Cache as I,clearCookie as c,setCookie as h}from"@beinformed/ui/utils";import{createAction as b,createReducer as E}from"@reduxjs/toolkit";var X=n=>p(n),p=b("UPDATE_LOCALE",n=>({payload:n})),A=b("SET_LOCALES",(n,e)=>({payload:{locales:n,locale:e}})),$=()=>typeof navigator<"u"&&navigator?.language&&navigator?.language.split("-")[0]||"en",T={locales:new o,locale:$()},Y=E(T,n=>{n.addCase(p,(e,a)=>{e.locales?.length>1?h("locale",a.payload):c("locale"),I.clear(),e.locale=a.payload}).addCase(A,(e,a)=>{let{locale:t,locales:r}=a.payload;e.locales.length>1?h("locale",t):c("locale"),e.locales=r,t&&(e.locale=t)})});export{d as a,i as b,u as c,K as d,o as e,X as f,p as g,A as h,Y as i};
|
|
2
|
-
//# sourceMappingURL=chunk-YG7XDCNV.js.map
|