@raydiant/playlist-window-manager 0.21.2 → 0.21.3
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/package.json +1 -1
- package/src/PresentationWindow.ts +1 -1
- package/build/BrowserViewRenderer.d.ts +0 -19
- package/build/BrowserViewRenderer.js +0 -212
- package/build/BrowserWindowRenderer.d.ts +0 -47
- package/build/BrowserWindowRenderer.js +0 -521
- package/build/IFrameRenderer.d.ts +0 -20
- package/build/IFrameRenderer.js +0 -226
- package/build/PlaylistWindowManager.d.ts +0 -106
- package/build/PlaylistWindowManager.js +0 -1017
- package/build/PlaylistWindowManagerState.d.ts +0 -28
- package/build/PlaylistWindowManagerState.js +0 -60
- package/build/PresentationWindow.d.ts +0 -142
- package/build/PresentationWindow.js +0 -1138
- package/build/PresentationWindow.test.d.ts +0 -1
- package/build/PresentationWindow.test.js +0 -241
- package/build/WindowLoadError.d.ts +0 -3
- package/build/WindowLoadError.js +0 -29
- package/build/WindowTimeoutError.d.ts +0 -3
- package/build/WindowTimeoutError.js +0 -29
- package/build/WindowUnresponsiveError.d.ts +0 -3
- package/build/WindowUnresponsiveError.js +0 -29
- package/build/embeddedApps.d.ts +0 -2
- package/build/embeddedApps.js +0 -59
- package/build/embeddedApps.test.d.ts +0 -1
- package/build/embeddedApps.test.js +0 -123
- package/build/index.d.ts +0 -10
- package/build/index.js +0 -30
- package/build/preload.d.ts +0 -1
- package/build/preload.js +0 -20
- package/build/testUtils.d.ts +0 -43
- package/build/testUtils.js +0 -208
- package/build/types.d.ts +0 -142
- package/build/types.js +0 -2
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
var testUtils_1 = require("./testUtils");
|
|
40
|
-
var delay = function (ms) { return new Promise(function (resolve) { return setTimeout(resolve, ms); }); };
|
|
41
|
-
describe('embedded apps', function () {
|
|
42
|
-
test('loads embedded url format', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
43
|
-
var testRenderer, window;
|
|
44
|
-
return __generator(this, function (_a) {
|
|
45
|
-
switch (_a.label) {
|
|
46
|
-
case 0:
|
|
47
|
-
testRenderer = (0, testUtils_1.createRenderer)();
|
|
48
|
-
window = (0, testUtils_1.createPresentationWindow)({
|
|
49
|
-
windowId: 'test-embedded-url-format',
|
|
50
|
-
presentation: (0, testUtils_1.createPresentation)({
|
|
51
|
-
applicationVariables: { input: 'test' },
|
|
52
|
-
}),
|
|
53
|
-
applicationVersion: (0, testUtils_1.createApplicationVersion)({
|
|
54
|
-
embeddedUrlFormat: 'http://test.local/:input',
|
|
55
|
-
presentationProperties: [{ name: 'input', type: 'string' }],
|
|
56
|
-
}),
|
|
57
|
-
renderer: testRenderer,
|
|
58
|
-
});
|
|
59
|
-
return [4 /*yield*/, window.load()];
|
|
60
|
-
case 1:
|
|
61
|
-
_a.sent();
|
|
62
|
-
expect(testRenderer.createWindow).toHaveBeenCalledWith({
|
|
63
|
-
windowId: 'test-embedded-url-format',
|
|
64
|
-
backgroundColor: '#ffffff',
|
|
65
|
-
bounds: undefined,
|
|
66
|
-
parentWindowId: undefined,
|
|
67
|
-
errorCallback: expect.any(Function),
|
|
68
|
-
receiveMessageCallback: expect.any(Function),
|
|
69
|
-
});
|
|
70
|
-
expect(testRenderer.loadWindow).toHaveBeenCalledWith('test-embedded-url-format', 'http://test.local/test#__raydiantWindowId=test-embedded-url-format');
|
|
71
|
-
return [2 /*return*/];
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
}); });
|
|
75
|
-
test('reloads by rendering embedded url format', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
76
|
-
var testRenderer, window;
|
|
77
|
-
return __generator(this, function (_a) {
|
|
78
|
-
switch (_a.label) {
|
|
79
|
-
case 0:
|
|
80
|
-
testRenderer = (0, testUtils_1.createRenderer)();
|
|
81
|
-
window = (0, testUtils_1.createPresentationWindow)({
|
|
82
|
-
windowId: 'test-reload-url',
|
|
83
|
-
presentation: (0, testUtils_1.createPresentation)({
|
|
84
|
-
applicationVariables: { input: 'test' },
|
|
85
|
-
}),
|
|
86
|
-
applicationVersion: (0, testUtils_1.createApplicationVersion)({
|
|
87
|
-
embeddedUrlFormat: 'http://test.local/:input',
|
|
88
|
-
presentationProperties: [{ name: 'input', type: 'string' }],
|
|
89
|
-
}),
|
|
90
|
-
renderer: testRenderer,
|
|
91
|
-
});
|
|
92
|
-
return [4 /*yield*/, window.load()];
|
|
93
|
-
case 1:
|
|
94
|
-
_a.sent();
|
|
95
|
-
window.setPresentation((0, testUtils_1.createPresentation)({ applicationVariables: { input: 'updated' } }), (0, testUtils_1.createPlaylistWindowManagerState)(), (0, testUtils_1.createRuleEngineState)());
|
|
96
|
-
return [4 /*yield*/, window.reload()];
|
|
97
|
-
case 2:
|
|
98
|
-
_a.sent();
|
|
99
|
-
expect(testRenderer.loadWindow).toHaveBeenCalledTimes(2);
|
|
100
|
-
expect(testRenderer.loadWindow).toHaveBeenCalledWith('test-reload-url', 'http://test.local/updated#__raydiantWindowId=test-reload-url');
|
|
101
|
-
return [2 /*return*/];
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}); });
|
|
105
|
-
test('reloads by sending message if has preview subscription', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
106
|
-
var testRenderer, window;
|
|
107
|
-
return __generator(this, function (_a) {
|
|
108
|
-
switch (_a.label) {
|
|
109
|
-
case 0:
|
|
110
|
-
testRenderer = (0, testUtils_1.createRenderer)();
|
|
111
|
-
window = (0, testUtils_1.createPresentationWindow)({
|
|
112
|
-
windowId: 'test-reload-message',
|
|
113
|
-
presentation: (0, testUtils_1.createPresentation)({
|
|
114
|
-
applicationVariables: { input: 'test' },
|
|
115
|
-
}),
|
|
116
|
-
applicationVersion: (0, testUtils_1.createApplicationVersion)({
|
|
117
|
-
embeddedUrlFormat: 'http://test.local/:input',
|
|
118
|
-
presentationProperties: [{ name: 'input', type: 'string' }],
|
|
119
|
-
}),
|
|
120
|
-
renderer: testRenderer,
|
|
121
|
-
});
|
|
122
|
-
return [4 /*yield*/, window.load()];
|
|
123
|
-
case 1:
|
|
124
|
-
_a.sent();
|
|
125
|
-
// Subscribe to receive input updates via message.
|
|
126
|
-
testRenderer.runReceiveMessageCallback('preview-subscribe', 'inputs');
|
|
127
|
-
window.setPresentation((0, testUtils_1.createPresentation)({ applicationVariables: { input: 'updated' } }), (0, testUtils_1.createPlaylistWindowManagerState)(), (0, testUtils_1.createRuleEngineState)());
|
|
128
|
-
return [4 /*yield*/, window.reload()];
|
|
129
|
-
case 2:
|
|
130
|
-
_a.sent();
|
|
131
|
-
// loadWindow should only be called once for the initial load.
|
|
132
|
-
expect(testRenderer.loadWindow).toHaveBeenCalledTimes(1);
|
|
133
|
-
expect(testRenderer.sendMessageObject).toHaveBeenCalledWith('test-reload-message', 'preview-inputs', { input: 'updated' });
|
|
134
|
-
// sendMessageObject should not be called again for the same inputs.
|
|
135
|
-
return [4 /*yield*/, window.reload()];
|
|
136
|
-
case 3:
|
|
137
|
-
// sendMessageObject should not be called again for the same inputs.
|
|
138
|
-
_a.sent();
|
|
139
|
-
expect(testRenderer.sendMessageObject).toHaveBeenCalledTimes(1);
|
|
140
|
-
// Unsubscribe to receive input updates via message.
|
|
141
|
-
testRenderer.runReceiveMessageCallback('preview-unsubscribe', 'inputs');
|
|
142
|
-
return [4 /*yield*/, window.reload()];
|
|
143
|
-
case 4:
|
|
144
|
-
_a.sent();
|
|
145
|
-
// loadWindow should be called again since the preview subscription was removed.
|
|
146
|
-
expect(testRenderer.loadWindow).toHaveBeenCalledTimes(2);
|
|
147
|
-
return [2 /*return*/];
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
}); });
|
|
151
|
-
test('preview subscription strips internal file properties from inputs', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
152
|
-
var testRenderer, window;
|
|
153
|
-
return __generator(this, function (_a) {
|
|
154
|
-
switch (_a.label) {
|
|
155
|
-
case 0:
|
|
156
|
-
testRenderer = (0, testUtils_1.createRenderer)();
|
|
157
|
-
window = (0, testUtils_1.createPresentationWindow)({
|
|
158
|
-
windowId: 'test-reload-message',
|
|
159
|
-
presentation: (0, testUtils_1.createPresentation)({
|
|
160
|
-
applicationVariables: {
|
|
161
|
-
input: {
|
|
162
|
-
url: 'http://test.local/image.png',
|
|
163
|
-
'content-length': 123,
|
|
164
|
-
'content-type': 'image/png',
|
|
165
|
-
file_upload_id: 'test',
|
|
166
|
-
filename: 'image.png',
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
}),
|
|
170
|
-
applicationVersion: (0, testUtils_1.createApplicationVersion)({
|
|
171
|
-
embeddedUrlFormat: 'http://test.local/:input',
|
|
172
|
-
presentationProperties: [{ name: 'input', type: 'file' }],
|
|
173
|
-
}),
|
|
174
|
-
renderer: testRenderer,
|
|
175
|
-
});
|
|
176
|
-
return [4 /*yield*/, window.load()];
|
|
177
|
-
case 1:
|
|
178
|
-
_a.sent();
|
|
179
|
-
// Subscribe to receive input updates via message.
|
|
180
|
-
testRenderer.runReceiveMessageCallback('preview-subscribe', 'inputs');
|
|
181
|
-
return [4 /*yield*/, window.reload()];
|
|
182
|
-
case 2:
|
|
183
|
-
_a.sent();
|
|
184
|
-
expect(testRenderer.sendMessageObject).toHaveBeenCalledWith('test-reload-message', 'preview-inputs', { input: { url: 'http://test.local/image.png' } });
|
|
185
|
-
// Updating internal file input values should not cause a reload.
|
|
186
|
-
window.setPresentation((0, testUtils_1.createPresentation)({
|
|
187
|
-
applicationVariables: {
|
|
188
|
-
input: {
|
|
189
|
-
url: 'http://test.local/image.png',
|
|
190
|
-
file_upload_id: 'test2',
|
|
191
|
-
},
|
|
192
|
-
},
|
|
193
|
-
}), (0, testUtils_1.createPlaylistWindowManagerState)(), (0, testUtils_1.createRuleEngineState)());
|
|
194
|
-
return [4 /*yield*/, window.reload()];
|
|
195
|
-
case 3:
|
|
196
|
-
_a.sent();
|
|
197
|
-
// sendMessageObject should not be called again for the same inputs.
|
|
198
|
-
expect(testRenderer.sendMessageObject).toHaveBeenCalledTimes(1);
|
|
199
|
-
return [2 /*return*/];
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
}); });
|
|
203
|
-
test('sends create object url message', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
204
|
-
var testRenderer, window, createObjectUrlPromise, requestId, result;
|
|
205
|
-
return __generator(this, function (_a) {
|
|
206
|
-
switch (_a.label) {
|
|
207
|
-
case 0:
|
|
208
|
-
testRenderer = (0, testUtils_1.createRenderer)();
|
|
209
|
-
window = (0, testUtils_1.createPresentationWindow)({
|
|
210
|
-
windowId: 'test-object-url',
|
|
211
|
-
presentation: (0, testUtils_1.createPresentation)(),
|
|
212
|
-
applicationVersion: (0, testUtils_1.createApplicationVersion)({
|
|
213
|
-
embeddedUrlFormat: 'http://test.local/:input',
|
|
214
|
-
}),
|
|
215
|
-
renderer: testRenderer,
|
|
216
|
-
});
|
|
217
|
-
return [4 /*yield*/, window.load()];
|
|
218
|
-
case 1:
|
|
219
|
-
_a.sent();
|
|
220
|
-
createObjectUrlPromise = window.createObjectURL(new Blob(['test']));
|
|
221
|
-
// Wait for the createObjectURL call to be sent to the renderer.
|
|
222
|
-
return [4 /*yield*/, delay(100)];
|
|
223
|
-
case 2:
|
|
224
|
-
// Wait for the createObjectURL call to be sent to the renderer.
|
|
225
|
-
_a.sent();
|
|
226
|
-
expect(testRenderer.sendMessageObject).toHaveBeenCalledWith('test-object-url', 'create-object-url', { requestId: expect.any(String), buffer: expect.any(ArrayBuffer) });
|
|
227
|
-
requestId = testRenderer.sendMessageObject.mock.calls[0][2].requestId;
|
|
228
|
-
testRenderer.runReceiveMessageCallback('create-object-url-result', {
|
|
229
|
-
requestId: requestId,
|
|
230
|
-
url: 'http://test.local/blob',
|
|
231
|
-
});
|
|
232
|
-
return [4 /*yield*/, createObjectUrlPromise];
|
|
233
|
-
case 3:
|
|
234
|
-
result = _a.sent();
|
|
235
|
-
expect(result).toBe('http://test.local/blob');
|
|
236
|
-
return [2 /*return*/];
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
}); });
|
|
240
|
-
});
|
|
241
|
-
// TODO: Backfill tests for all legacy and embedded apps.
|
package/build/WindowLoadError.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
var WindowLoadError = /** @class */ (function (_super) {
|
|
19
|
-
__extends(WindowLoadError, _super);
|
|
20
|
-
function WindowLoadError(message) {
|
|
21
|
-
var _this = _super.call(this, message) || this;
|
|
22
|
-
_this.name = 'WindowLoadError';
|
|
23
|
-
// Set prototype for instanceof WindowLoadError checks.
|
|
24
|
-
Object.setPrototypeOf(_this, WindowLoadError.prototype);
|
|
25
|
-
return _this;
|
|
26
|
-
}
|
|
27
|
-
return WindowLoadError;
|
|
28
|
-
}(Error));
|
|
29
|
-
exports.default = WindowLoadError;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
var WindowTimeoutError = /** @class */ (function (_super) {
|
|
19
|
-
__extends(WindowTimeoutError, _super);
|
|
20
|
-
function WindowTimeoutError(message) {
|
|
21
|
-
var _this = _super.call(this, message) || this;
|
|
22
|
-
_this.name = 'WindowTimeoutError';
|
|
23
|
-
// Set prototype for instanceof WindowTimeoutError checks.
|
|
24
|
-
Object.setPrototypeOf(_this, WindowTimeoutError.prototype);
|
|
25
|
-
return _this;
|
|
26
|
-
}
|
|
27
|
-
return WindowTimeoutError;
|
|
28
|
-
}(Error));
|
|
29
|
-
exports.default = WindowTimeoutError;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
var WindowUnresponsiveError = /** @class */ (function (_super) {
|
|
19
|
-
__extends(WindowUnresponsiveError, _super);
|
|
20
|
-
function WindowUnresponsiveError(message) {
|
|
21
|
-
var _this = _super.call(this, message) || this;
|
|
22
|
-
_this.name = 'WindowUnresponsiveError';
|
|
23
|
-
// Set prototype for instanceof WindowUnresponsiveError checks.
|
|
24
|
-
Object.setPrototypeOf(_this, WindowUnresponsiveError.prototype);
|
|
25
|
-
return _this;
|
|
26
|
-
}
|
|
27
|
-
return WindowUnresponsiveError;
|
|
28
|
-
}(Error));
|
|
29
|
-
exports.default = WindowUnresponsiveError;
|
package/build/embeddedApps.d.ts
DELETED
package/build/embeddedApps.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function createEmbeddedApp(presentation, applicationVersion, metadata) {
|
|
4
|
-
// build matches
|
|
5
|
-
var parameterRegex = /(:([\w-\$]+))(.?$|[^\w-\$])/gm;
|
|
6
|
-
var matches = [];
|
|
7
|
-
var match = null;
|
|
8
|
-
do {
|
|
9
|
-
match = parameterRegex.exec(applicationVersion.embeddedUrlFormat || '');
|
|
10
|
-
if (match) {
|
|
11
|
-
matches.push(match);
|
|
12
|
-
}
|
|
13
|
-
} while (match !== null);
|
|
14
|
-
// replace
|
|
15
|
-
var url = applicationVersion.embeddedUrlFormat || '';
|
|
16
|
-
matches.forEach(function (m) {
|
|
17
|
-
var queryParamVariableName = m[1]; // Where the value of your input will be injected. E.g. ":location"
|
|
18
|
-
var queryParamName = m[2]; // The query param name. E.g. "location"
|
|
19
|
-
var _a = queryParamVariableName.split(':'), variableName = _a[1];
|
|
20
|
-
var shouldEncodeValue = true;
|
|
21
|
-
var value = '';
|
|
22
|
-
if (variableName.charAt(0) === '$') {
|
|
23
|
-
var metadataKey = variableName.slice(1);
|
|
24
|
-
if (metadataKey === 'renderMode') {
|
|
25
|
-
value = metadata.renderMode;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
// Don't replace variables that are numbers to allow setting
|
|
30
|
-
// port numbers in the embedded app url.
|
|
31
|
-
if (!isNaN(Number(variableName)))
|
|
32
|
-
return;
|
|
33
|
-
var presentationProperty = applicationVersion.presentationProperties.find(function (p) { return p.name === variableName; });
|
|
34
|
-
// If the presentation property is not found (this shouldn't happen), default to encoding the value.
|
|
35
|
-
// Otherwise, only skip encoding if the presentation property's encode property is false.
|
|
36
|
-
shouldEncodeValue =
|
|
37
|
-
!presentationProperty || presentationProperty.encode !== false;
|
|
38
|
-
value = presentation.applicationVariables[queryParamName];
|
|
39
|
-
if (value === undefined)
|
|
40
|
-
value = '';
|
|
41
|
-
if (Array.isArray(value)) {
|
|
42
|
-
value = JSON.stringify(value);
|
|
43
|
-
}
|
|
44
|
-
// Presentation property specific handling.
|
|
45
|
-
if (presentationProperty) {
|
|
46
|
-
// If the presentation property is a file, use the url property as the value.
|
|
47
|
-
if (presentationProperty.type === 'file' && value && value.url) {
|
|
48
|
-
value = value.url;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
if (shouldEncodeValue) {
|
|
53
|
-
value = encodeURIComponent(value);
|
|
54
|
-
}
|
|
55
|
-
url = url.replace(queryParamVariableName, value);
|
|
56
|
-
});
|
|
57
|
-
return url;
|
|
58
|
-
}
|
|
59
|
-
exports.default = createEmbeddedApp;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
var embeddedApps_1 = __importDefault(require("./embeddedApps"));
|
|
18
|
-
var createPresentation = function (overrides) {
|
|
19
|
-
if (overrides === void 0) { overrides = {}; }
|
|
20
|
-
return (__assign({ id: 'id', name: 'name', applicationDeploymentId: 'applicationDeploymentId', themeId: null, applicationVariables: {}, duration: 0, r: {
|
|
21
|
-
resource: {
|
|
22
|
-
updatedAt: '',
|
|
23
|
-
createdAt: '',
|
|
24
|
-
},
|
|
25
|
-
presentationsPlaylists: [],
|
|
26
|
-
} }, overrides));
|
|
27
|
-
};
|
|
28
|
-
var createApplicationVersion = function (overrides) {
|
|
29
|
-
if (overrides === void 0) { overrides = {}; }
|
|
30
|
-
return (__assign({ id: 'id', name: 'name', applicationId: 'applicationId', embeddedUrlFormat: null, configurableDuration: false, sourceUrl: null, presentationProperties: [] }, overrides));
|
|
31
|
-
};
|
|
32
|
-
var createMetadata = function (overrides) {
|
|
33
|
-
if (overrides === void 0) { overrides = {}; }
|
|
34
|
-
return (__assign({ renderMode: 'live' }, overrides));
|
|
35
|
-
};
|
|
36
|
-
test('Replaces variable in query parameteers', function () {
|
|
37
|
-
expect((0, embeddedApps_1.default)(createPresentation({ applicationVariables: { foo: 'bar' } }), createApplicationVersion({
|
|
38
|
-
embeddedUrlFormat: 'https://example.com?foo=:foo',
|
|
39
|
-
}), createMetadata())).toBe('https://example.com?foo=bar');
|
|
40
|
-
});
|
|
41
|
-
test('Replaces variable in path', function () {
|
|
42
|
-
expect((0, embeddedApps_1.default)(createPresentation({ applicationVariables: { foo: 'bar' } }), createApplicationVersion({
|
|
43
|
-
embeddedUrlFormat: 'https://example.com/:foo',
|
|
44
|
-
}), createMetadata())).toBe('https://example.com/bar');
|
|
45
|
-
});
|
|
46
|
-
test('Replaces undefined variable with empty string', function () {
|
|
47
|
-
expect((0, embeddedApps_1.default)(createPresentation({ applicationVariables: {} }), createApplicationVersion({
|
|
48
|
-
embeddedUrlFormat: 'https://example.com/:foo',
|
|
49
|
-
}), createMetadata())).toBe('https://example.com/');
|
|
50
|
-
});
|
|
51
|
-
test('Replaces variable with underscore', function () {
|
|
52
|
-
expect((0, embeddedApps_1.default)(createPresentation({ applicationVariables: { foo_1: 'bar' } }), createApplicationVersion({
|
|
53
|
-
embeddedUrlFormat: 'https://example.com/:foo_1',
|
|
54
|
-
}), createMetadata())).toBe('https://example.com/bar');
|
|
55
|
-
});
|
|
56
|
-
test('Replaces variable with hyphen', function () {
|
|
57
|
-
expect((0, embeddedApps_1.default)(createPresentation({ applicationVariables: { 'foo-1': 'bar' } }), createApplicationVersion({
|
|
58
|
-
embeddedUrlFormat: 'https://example.com/:foo-1',
|
|
59
|
-
}), createMetadata())).toBe('https://example.com/bar');
|
|
60
|
-
});
|
|
61
|
-
test('Does not replace variable that is a number', function () {
|
|
62
|
-
expect((0, embeddedApps_1.default)(createPresentation({ applicationVariables: { foo: 'bar' } }), createApplicationVersion({
|
|
63
|
-
embeddedUrlFormat: 'http://localhost:8080?foo=:foo',
|
|
64
|
-
}), createMetadata())).toBe('http://localhost:8080?foo=bar');
|
|
65
|
-
});
|
|
66
|
-
test('Encodes a variables containing special characters', function () {
|
|
67
|
-
var fooValue = 'Lorem Ipsum. !@#$%^&*()-. More Text';
|
|
68
|
-
var fooValueEncoded = 'Lorem%20Ipsum.%20!%40%23%24%25%5E%26*()-.%20More%20Text';
|
|
69
|
-
expect((0, embeddedApps_1.default)(createPresentation({ applicationVariables: { foo: fooValue } }), createApplicationVersion({
|
|
70
|
-
embeddedUrlFormat: "http://localhost:8080?foo=:foo",
|
|
71
|
-
}), createMetadata())).toBe("http://localhost:8080?foo=".concat(fooValueEncoded));
|
|
72
|
-
});
|
|
73
|
-
test('Does not encode value if presentation property disables encoding', function () {
|
|
74
|
-
expect((0, embeddedApps_1.default)(createPresentation({
|
|
75
|
-
applicationVariables: { url: 'https://raydiant.com' },
|
|
76
|
-
}), createApplicationVersion({
|
|
77
|
-
embeddedUrlFormat: ":url",
|
|
78
|
-
presentationProperties: [
|
|
79
|
-
{ type: 'string', name: 'url', encode: false },
|
|
80
|
-
],
|
|
81
|
-
}), createMetadata())).toBe("https://raydiant.com");
|
|
82
|
-
});
|
|
83
|
-
test('Encodes a variables containing an array', function () {
|
|
84
|
-
var fooValue = ['option-a', 'option-b', 'option-c'];
|
|
85
|
-
var fooValueEncoded = '%5B%22option-a%22%2C%22option-b%22%2C%22option-c%22%5D';
|
|
86
|
-
expect((0, embeddedApps_1.default)(createPresentation({ applicationVariables: { foo: fooValue } }), createApplicationVersion({
|
|
87
|
-
embeddedUrlFormat: "http://localhost:8080?foo=:foo",
|
|
88
|
-
}), createMetadata())).toBe("http://localhost:8080?foo=".concat(fooValueEncoded));
|
|
89
|
-
});
|
|
90
|
-
test('Replaces $renderMode with metadata', function () {
|
|
91
|
-
var presentation = createPresentation();
|
|
92
|
-
var applicationVersion = createApplicationVersion({
|
|
93
|
-
embeddedUrlFormat: 'https://example.com?renderMode=:$renderMode',
|
|
94
|
-
});
|
|
95
|
-
expect((0, embeddedApps_1.default)(presentation, applicationVersion, createMetadata({ renderMode: 'preview' }))).toBe('https://example.com?renderMode=preview');
|
|
96
|
-
expect((0, embeddedApps_1.default)(presentation, applicationVersion, createMetadata({ renderMode: 'live' }))).toBe('https://example.com?renderMode=live');
|
|
97
|
-
});
|
|
98
|
-
test('Replaces undefined metadata with empty string', function () {
|
|
99
|
-
var presentation = createPresentation();
|
|
100
|
-
var applicationVersion = createApplicationVersion({
|
|
101
|
-
embeddedUrlFormat: 'https://example.com?invalid=:$invalid',
|
|
102
|
-
});
|
|
103
|
-
expect((0, embeddedApps_1.default)(presentation, applicationVersion, createMetadata())).toBe('https://example.com?invalid=');
|
|
104
|
-
});
|
|
105
|
-
test('Replace protocol, ip and port', function () {
|
|
106
|
-
expect((0, embeddedApps_1.default)(createPresentation({
|
|
107
|
-
applicationVariables: {
|
|
108
|
-
protocol: 'http',
|
|
109
|
-
ip: '192.168.1.0',
|
|
110
|
-
port: 3000,
|
|
111
|
-
},
|
|
112
|
-
}), createApplicationVersion({
|
|
113
|
-
embeddedUrlFormat: ":protocol://:ip::port",
|
|
114
|
-
}), createMetadata())).toBe("http://192.168.1.0:3000");
|
|
115
|
-
});
|
|
116
|
-
test('File input uses url as value', function () {
|
|
117
|
-
expect((0, embeddedApps_1.default)(createPresentation({
|
|
118
|
-
applicationVariables: { file: { url: 'https://image.png' } },
|
|
119
|
-
}), createApplicationVersion({
|
|
120
|
-
embeddedUrlFormat: "https://example.come?image=:file",
|
|
121
|
-
presentationProperties: [{ type: 'file', name: 'file' }],
|
|
122
|
-
}), createMetadata())).toBe("https://example.come?image=".concat(encodeURIComponent('https://image.png')));
|
|
123
|
-
});
|
package/build/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import PlaylistWindowManager from './PlaylistWindowManager';
|
|
2
|
-
export * from './PlaylistWindowManager';
|
|
3
|
-
export { PlaylistWindowManager };
|
|
4
|
-
import PlaylistWindowManagerState from './PlaylistWindowManagerState';
|
|
5
|
-
export * from './PlaylistWindowManagerState';
|
|
6
|
-
export { PlaylistWindowManagerState };
|
|
7
|
-
import PresentationWindow from './PresentationWindow';
|
|
8
|
-
export * from './PresentationWindow';
|
|
9
|
-
export { PresentationWindow };
|
|
10
|
-
export * from './types';
|
package/build/index.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.PresentationWindow = exports.PlaylistWindowManagerState = exports.PlaylistWindowManager = void 0;
|
|
21
|
-
var PlaylistWindowManager_1 = __importDefault(require("./PlaylistWindowManager"));
|
|
22
|
-
exports.PlaylistWindowManager = PlaylistWindowManager_1.default;
|
|
23
|
-
__exportStar(require("./PlaylistWindowManager"), exports);
|
|
24
|
-
var PlaylistWindowManagerState_1 = __importDefault(require("./PlaylistWindowManagerState"));
|
|
25
|
-
exports.PlaylistWindowManagerState = PlaylistWindowManagerState_1.default;
|
|
26
|
-
__exportStar(require("./PlaylistWindowManagerState"), exports);
|
|
27
|
-
var PresentationWindow_1 = __importDefault(require("./PresentationWindow"));
|
|
28
|
-
exports.PresentationWindow = PresentationWindow_1.default;
|
|
29
|
-
__exportStar(require("./PresentationWindow"), exports);
|
|
30
|
-
__exportStar(require("./types"), exports);
|
package/build/preload.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/build/preload.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var electron_1 = require("electron");
|
|
4
|
-
var internals = {
|
|
5
|
-
sendMessage: function (windowId, type, payload) {
|
|
6
|
-
electron_1.ipcRenderer.send(windowId, type, payload);
|
|
7
|
-
}
|
|
8
|
-
};
|
|
9
|
-
// Set __RAYDIANT_INTERNALS on window so it is accessible in to the running application.
|
|
10
|
-
window.__RAYDIANT_INTERNALS = internals;
|
|
11
|
-
// Forward messages from the main process to the app (render process) via receiveMessage.
|
|
12
|
-
// __RAYDIANT_INTERNALS.receiveMessage is required to be set by the app with the Raydiant SDK.
|
|
13
|
-
electron_1.ipcRenderer.on('electron-main', function (_, message) {
|
|
14
|
-
if (typeof internals.receiveMessage === 'function') {
|
|
15
|
-
internals.receiveMessage(message);
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
console.error('Failed to handle message from main process, receiveMessage is not defined');
|
|
19
|
-
}
|
|
20
|
-
});
|
package/build/testUtils.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/// <reference types="jest" />
|
|
2
|
-
import * as re from '@raydiant/playlist-rule-engine';
|
|
3
|
-
import PresentationWindow, { PresentationWindowOptions } from './PresentationWindow';
|
|
4
|
-
import PlaylistWindowManagerState, { PlaylistWindowManagerStateOptions } from './PlaylistWindowManagerState';
|
|
5
|
-
import { Presentation, ApplicationVersion, Logger, CreateWindowOptions } from './types';
|
|
6
|
-
export declare function createPresentationWindow(overrides?: Partial<PresentationWindowOptions>): PresentationWindow;
|
|
7
|
-
export declare function createPresentation(overrides?: Partial<Presentation>): Presentation;
|
|
8
|
-
export declare function createPresentationRelationships(overrides?: Partial<Presentation['r']>): Presentation['r'];
|
|
9
|
-
export declare function createApplicationVersion(overrides?: Partial<ApplicationVersion>): ApplicationVersion;
|
|
10
|
-
export declare function createPlaylistWindowManagerState(overrides?: Partial<PlaylistWindowManagerStateOptions>): PlaylistWindowManagerState;
|
|
11
|
-
export declare function createRuleEngineState(playlists?: {
|
|
12
|
-
[index: string]: re.Playlist;
|
|
13
|
-
}, presentations?: {
|
|
14
|
-
[index: string]: re.Presentation;
|
|
15
|
-
}, rulesDataStore?: re.RulesDataStore, isMultitimezoneEnabled?: boolean): re.State;
|
|
16
|
-
export declare function createLogger(overrides?: Partial<Logger>): {
|
|
17
|
-
debug: (message: any, context?: {
|
|
18
|
-
[key: string]: any;
|
|
19
|
-
} | undefined) => void;
|
|
20
|
-
info: (message: any, context?: {
|
|
21
|
-
[key: string]: any;
|
|
22
|
-
} | undefined) => void;
|
|
23
|
-
warn: (message: any, context?: {
|
|
24
|
-
[key: string]: any;
|
|
25
|
-
} | undefined) => void;
|
|
26
|
-
error: (message: any, context?: {
|
|
27
|
-
[key: string]: any;
|
|
28
|
-
} | undefined) => void;
|
|
29
|
-
};
|
|
30
|
-
export declare function createRenderer(): {
|
|
31
|
-
createWindow: jest.Mock<void, [opts: CreateWindowOptions]>;
|
|
32
|
-
loadWindow: jest.Mock<any, any>;
|
|
33
|
-
updateWindowBounds: jest.Mock<any, any>;
|
|
34
|
-
showWindow: jest.Mock<any, any>;
|
|
35
|
-
hideWindow: jest.Mock<any, any>;
|
|
36
|
-
removeWindow: jest.Mock<any, any>;
|
|
37
|
-
sendMessageString: jest.Mock<any, any>;
|
|
38
|
-
sendMessageObject: jest.Mock<any, any>;
|
|
39
|
-
muteWindow: jest.Mock<any, any>;
|
|
40
|
-
unMuteWindow: jest.Mock<any, any>;
|
|
41
|
-
runReceiveMessageCallback(type: string, payload: any): void;
|
|
42
|
-
runErrorCallback(error: Error): void;
|
|
43
|
-
};
|