@soleil-se/app-util 2.1.0 → 2.1.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 CHANGED
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [2.1.2] - 2020-02-21
8
+ ### Fixed
9
+ - Wrapped `renderApp` script in svDocReady in edit mode to be sure it executes when other bundles are loaded.
10
+
11
+ ## [2.1.1] - 2020-02-14
12
+ ### Changed
13
+ - Updated readme, heading levels and examples.
14
+
7
15
  ## [2.1.0] - 2020-02-14
8
16
  ### Added
9
17
  - App data import in client, `@soleil-api/webapp-util/app-data`.
package/README.md CHANGED
@@ -17,7 +17,7 @@ See [example](#example).
17
17
 
18
18
  ## Usage
19
19
  ```javascript
20
- import { renderApp, getRouteUri, getResourceUri, renderTemplate, isOffline } from '@soleil-se/webapp-util';
20
+ import { renderApp, getRouteUri, getViewUri, getResourceUri, renderTemplate, isOffline, isOnline } from '@soleil-se/webapp-util';
21
21
  ```
22
22
  ### `renderApp([config], [settings])` ⇒ `String`
23
23
  Get HTML string for rendering an application.
@@ -78,7 +78,7 @@ const searchThings = async (query) => {
78
78
  export default searchThings;
79
79
  ```
80
80
 
81
- ## `getRouteUri(route)` ⇒ `String`
81
+ ### `getRouteUri(route)` ⇒ `String`
82
82
  Get URI for a route, same as `getStandaloneUrl` in SiteVision template.
83
83
  https://developer.sitevision.se/docs/webapps/template#h-Methods
84
84
 
@@ -93,7 +93,7 @@ https://developer.sitevision.se/docs/webapps/template#h-Methods
93
93
  ```javascript
94
94
  const routeUri = getRouteUri('/my-route');
95
95
  ```
96
- ## `getViewUri(route)` ⇒ `String`
96
+ ### `getViewUri(route)` ⇒ `String`
97
97
  Get URI for a view, same as `getUrl` in SiteVision template.
98
98
  https://developer.sitevision.se/docs/webapps/template#h-Methods
99
99
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soleil-se/app-util",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "Utility functions for Webapps.",
5
5
  "main": "./src/index.js",
6
6
  "author": "Soleil AB",
package/src/index.js CHANGED
@@ -64,14 +64,14 @@ export function renderApp(data, {
64
64
  return `
65
65
  <div data-portlet-id="${portletId}">${noScript}</div>
66
66
  <script>
67
- (function(){
67
+ window.svDocReady(function() {
68
68
  var targetElement = document.querySelector('[data-portlet-id="${portletId}"]');
69
69
  var script = document.createElement('script');
70
70
  script.src = '${getResourceUri('client/index.js')}?${portletId.replace('_', '')}';
71
71
  script.setAttribute('data-app', '${encodeURIComponent(JSON.stringify({ ...data, isOffline }))}');
72
72
  script.setAttribute('data-selector', '${encodeURIComponent(selector)}');
73
73
  targetElement.parentNode.insertBefore(script, targetElement.nextSibling);
74
- })();
74
+ });
75
75
  </script>`;
76
76
  }
77
77
  return `