# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## \[5.15.3] - 2026-08-25

* Add exports for base svelte in client and server for backwards compatibility with existing imports.

## \[5.15.2] - 2026-08-18

* Sort numerical characters before alphabetic characters in `localizedCompare`.

## \[5.15.1] - 2026-06-12

* Handle undefined array values in `stringifyParams`.

## \[5.15.0] - 2026-06-09

* New wrapper API for privileged actions, `privilegedAction`, that checks for required permissions and configuration before executing the callback. It also provides better error messages when the privileged user is missing required permissions.

## \[5.14.3] - 2026-05-19

* Set correct direct export for `localized-compare` in package.json.

## \[5.14.2] - 2026-05-19

* Add direct export for `localized-compare` in package.json.

## \[5.14.1] - 2026-05-15

* Add exports to package.json for better support in ESM environments.

## \[5.14.0] - 2026-04-24

* `localizedCompareBy` now accepts objects with a `key` and optional `order` (`'asc'` | `'desc'`, defaults to `'asc'`) in addition to plain strings, enabling per-property sort direction. Existing string-based usage is unchanged.

## \[5.13.0] - 2026-01-16

* Add comparator functions [localizedCompare](/packages/app-util/common/#localizedcomparea-b--number) and [localizedCompareBy](/packages/app-util/common/#localizedcomparebyprop--props--function) to sort strings and objects by a specific property using localized string comparison since String.localeCompare does not work properly with nordic characters in Rhino.

## \[5.12.3] - 2025-12-03

* Even better type definitions for Svelte render functions.

## \[5.12.2] - 2025-12-03

* Better type definitions for Svelte render functions.

## \[5.12.1] - 2025-10-15

* Return identifier for Node instances in `toString` function in `app-data` and `global-app-data`.

## \[5.12.0] - 2025-10-09

* Add `iteratorToArray`, `nodeIteratorToArray`, `listToArray` and `setToArray` utility functions to convert these data structures into arrays.

## \[5.11.0] - 2025-09-04

* Add type-safe wrapper for `@sitevision/api/server/appData` and `@sitevision/api/server/globalAppData`.
* Adjust types for `fetchJson` and `urlParams` to work better with TypeScript.

## \[5.10.1] - 2025-06-26

* Adjust types for rendering functions.

## \[5.10.0] - 2025-05-30

* Add new utility function `preventDefault` to prevent default behavior of events in a more readable way.

## \[5.9.1] - 2025-03-27

* Update type definitions.

## \[5.9.0] - 2025-03-17

* Add `idPrefix` when rendering Svelte on the server to avoid conflicts with other apps.
* Add type definitions.

## \[5.8.3] - 2025-02-14

* Update license.

## \[5.8.2] - 2025-02-14

* Update README and tagging in `package.json`.

## \[5.8.1] - 2024-10-28

* Pass props properly to Svelte 5 server render function.
* Update JSDoc to correct new paths for deprecated functions.

## \[5.8.0] - 2024-10-21

* Restructure rendering function for different Svelte versions.
* Add rendering function for Svelte 5.
* Deprecate old Svelte rendering functions.

## \[5.7.2] - 2024-08-21

* Add `?version=0` properly to `getRouteUri` when called in offline mode.

## \[5.7.1] - 2024-08-07

* Change widget detection to use `window.sv.PageContext.dashboardId`.
* Options in `fetchJson` is now optional.

## \[5.7.0] - 2024-05-23

* Add widget support for `fetchJson`.

## \[5.6.5] - 2024-01-25

* Fix asynchronous handling of error in `fetchJson`.

## \[5.6.4] - 2024-01-18

* Cast `Packages.java.util.UUID.randomUUID()` to `string`.

## \[5.6.3] - 2024-01-15

* Only remove values in `stringifyParams` if they are `undefined`, `null` or an empty string.

## \[5.6.2] - 2023-12-14

* Update to correct homepage in `package.json`.

## \[5.6.1] - 2023-12-14

* Hydrate when children other than HTML Elements exist in target.
* New argument for client side Svelte rendering for `hydrate`.

## \[5.6.0] - 2023-11-23

* New constants: `isServer` and `isBrowser`.
* New function: `generateId`.
* Throw more clear error when JSON response can’t be parsed in `fetchJson`.
* Webpack support for usage with `@sitevision/sitevision-scripts`.

## \[5.5.2] - 2023-08-28

* Respect hash when updating URL parameters with `updateUrlParams` and `setUrlParams`.

## \[5.5.1] - 2023-08-25

* Don’t remove `?` from `location.search` when parsing parameters in `getUrlParams` and `updateUrlParams`.

## \[5.5.0] - 2023-08-25

* Remove abort controllers in `fetchJson` since it’s better to handle this seperatly case by case.

## \[5.4.1] - 2023-08-22

* Add `/edit-app-config` to ignored URIin `fetchJson`.

## \[5.4.0] - 2023-08-09

* Add `fetchJson` function to make requests to app routes or other resources.

## \[5.3.0] - 2023-07-06

* Added helper functions for managing parameters in the URL-field.

## \[5.2.2] - 2023-01-31

* Fix `parseParams` export.

## \[5.2.1] - 2023-01-31

* Fix homepage url.
* More lenient with peerDependency `@sitevision/api`.

## \[5.2.0] - 2023-01-31

* New function `parseParams` to parse query parameters from an URL, URI or query string.

## \[5.1.0] - 2022-05-27

* New function `stringifyParams` to stringify query parameters to a Sitevision compatible format.
* Possible to pass a parameters object to `getRouteUri`.
* All common constants and functions are now usable in hooks.
* Deprecate `getViewUri` since it’s not used in WebApps 2.

## \[5.0.0] - 2022-02-08

* Using WebApps 2 for rendering apps.
* Removed `getAppData`, use `getAppProps` instead.
* Removed `server/render`, use `res.agnosticRender` for framework agnostic rendering.
* Removed `server/renderTemplate`, used for rendering underscore templates.

## \[4.2.1] - 2021-09-06

* Underscore is misspelled in `renderTemplate`.

## \[4.2.0] - 2021-08-20

* Added `getAppProps` for getting props passed to the app when rendering.
* `getAppData` deprecated due to confusion, use `getAppProps` instead.

## \[4.1.4] - 2021-05-25

* Return empty object instead of undefined when app data isn’t set.
* Remove `vue` as optional dependency.

## \[4.1.3] - 2021-03-31

* Consistent rendering when using `serverServer` and `render` for Svelte.
* Docs for Svelte `renderServer` function.

## \[4.1.2] - 2021-02-24

* Escape tags when parsing data to prevent closure of script tags.

## \[4.1.1] - 2021-02-17

* Validation error for `id` on script tags, even though it’s allowed.

## \[4.1.0] - 2021-02-17

* Put app data and metadata in script elements instead of data attributes.

## \[4.0.1] - 2021-01-28

* Crashes when no data is passed to app and then trying to call `getAppData`.

## \[4.0.0] - 2021-01-27

A much needed major overhaul of the package. See [MIGRATION](/packages/app-util/migration/).

* Major refactoring of package.
* Exports for render functions are moved.
* All documented constants and functions from base import (`@soleil-se/app-util`) now works both in a server and client context.
* Settings for selector is moved from server to client rendering functions.
* Removed `noScript` option in `render` (formerly `renderApp`) has been removed. If a no script message is needed use the `html` option wrapped in `<noscript>`.
* Removed `@soleil-se/app-util/app-data` has been removed, use getAppData from `@soleil-se/app-util`.

## \[3.0.3] - 2020-11-03

* Nothing, Lerna wanted to publish…

## \[3.0.2] - 2020-10-19

* Nothing, Lerna wanted to publish…

## \[3.0.1] - 2020-09-28

* Homepage link

## \[3.0.0] - 2020-09-28

* Svelte support.
* New exports:
  * `uniqueId` - A unique id for the app instance.

## \[2.4.1] - 2020-09-01

* App data with single quotes crashes app in edit mode, use double quotes instead.

## \[2.4.0] - 2020-05-26

* `getViewUri` returns correct URI when in offline mode and in the Addons view.

## \[2.3.0] - 2020-05-22

* `renderApp` now accepts `req` as a setting to opimize script loading when multiple instances of the app exists. If `req` is present the script will only be loaded once in all browsers except IE11 that needs a unique script src for the currentScript polyfill to work.
* `noScript` in `renderApp` was not wrapped in a `<noscript>` tag.

## \[2.2.0] - 2020-05-20

* `renderTemplate` function is now available inside templates rendered by the function.

## \[2.1.4] - 2020-04-07

* `getViewUri` had incorrect portlet ID.

## \[2.1.3] - 2020-02-25

* Add timestamp to script url in edit mode as well.

## \[2.1.2] - 2020-02-21

* Wrapped `renderApp` script in svDocReady in edit mode to be sure it executes when other bundles are loaded.

## \[2.1.1] - 2020-02-14

* Updated readme, heading levels and examples.

## \[2.1.0] - 2020-02-14

* App data import in client, `@soleil-se/app-util/app-data`.
* `getViewUri` to get the URI that also renders the page.
* `isOnline` to see if the app is online.
* `vue` is now an optional depedency.

## \[2.0.0] - 2020-02-12

* Now using `currentScript` to reference the script element the app is running in to pass data when using `renderApp`.
* `renderApp` is no longer using appName.
* `render` is now called directly in `./app_src/client/index.js`.
* `render` and `App` no longer needs to be exported from `./app_src/client/index.js`.