@raydiant/playlist-window-manager 0.14.20 → 0.14.21

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/README.md CHANGED
@@ -1,4 +1,10 @@
1
- Usage:
1
+ ## Deployment
2
+
3
+ ```
4
+ yarn deploy
5
+ ```
6
+
7
+ ## Usage
2
8
 
3
9
  ```js
4
10
 
@@ -21,9 +21,8 @@ function createEmbeddedApp(presentation, embeddedUrlFormat) {
21
21
  if (!isNaN(Number(variableName)))
22
22
  return;
23
23
  var value = presentation.applicationVariables[m[2]];
24
- if (value === undefined)
25
- value = '';
26
- url = url.replace(variable, value);
24
+ var encodedValue = value === undefined ? '' : encodeURIComponent(value);
25
+ url = url.replace(variable, encodedValue);
27
26
  });
28
27
  return url;
29
28
  }
@@ -37,3 +37,8 @@ test('Replaces variable with underscore', function () {
37
37
  test('Does not replace variable that is a number', function () {
38
38
  expect(embeddedApps_1.default(createPresentation({ applicationVariables: { foo: 'bar' } }), 'http://localhost:8080?foo=:foo')).toBe('http://localhost:8080?foo=bar');
39
39
  });
40
+ test('Encodes a variables containing special characters', function () {
41
+ var fooValue = 'Lorem Ipsum. !@#$%^&*()-. More Text';
42
+ var fooValueEncoded = 'Lorem%20Ipsum.%20!%40%23%24%25%5E%26*()-.%20More%20Text';
43
+ expect(embeddedApps_1.default(createPresentation({ applicationVariables: { foo: fooValue } }), "http://localhost:8080?foo=:foo")).toBe("http://localhost:8080?foo=" + fooValueEncoded);
44
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raydiant/playlist-window-manager",
3
- "version": "0.14.20",
3
+ "version": "0.14.21",
4
4
  "description": "Window manager for playlist playback.",
5
5
  "main": "build/index.js",
6
6
  "scripts": {
@@ -64,3 +64,16 @@ test('Does not replace variable that is a number', () => {
64
64
  )
65
65
  ).toBe('http://localhost:8080?foo=bar');
66
66
  });
67
+
68
+ test('Encodes a variables containing special characters', () => {
69
+ const fooValue = 'Lorem Ipsum. !@#$%^&*()-. More Text';
70
+ const fooValueEncoded =
71
+ 'Lorem%20Ipsum.%20!%40%23%24%25%5E%26*()-.%20More%20Text';
72
+
73
+ expect(
74
+ createEmbeddedApp(
75
+ createPresentation({ applicationVariables: { foo: fooValue } }),
76
+ `http://localhost:8080?foo=:foo`
77
+ )
78
+ ).toBe(`http://localhost:8080?foo=${fooValueEncoded}`);
79
+ });
@@ -25,9 +25,9 @@ export default function createEmbeddedApp(
25
25
  // port numbers in the embedded app url.
26
26
  if (!isNaN(Number(variableName))) return;
27
27
 
28
- let value = presentation.applicationVariables[m[2]];
29
- if (value === undefined) value = '';
30
- url = url.replace(variable, value);
28
+ const value = presentation.applicationVariables[m[2]];
29
+ const encodedValue = value === undefined ? '' : encodeURIComponent(value);
30
+ url = url.replace(variable, encodedValue);
31
31
  });
32
32
 
33
33
  return url;