@raydiant/playlist-window-manager 0.0.0-electron-upgrade-1

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.
Files changed (55) hide show
  1. package/.eslintrc +6 -0
  2. package/README.md +16 -0
  3. package/babel.config.js +13 -0
  4. package/build/BrowserViewRenderer.d.ts +19 -0
  5. package/build/BrowserViewRenderer.js +213 -0
  6. package/build/BrowserWindowRenderer.d.ts +47 -0
  7. package/build/BrowserWindowRenderer.js +524 -0
  8. package/build/IFrameRenderer.d.ts +20 -0
  9. package/build/IFrameRenderer.js +226 -0
  10. package/build/PlaylistWindowManager.d.ts +111 -0
  11. package/build/PlaylistWindowManager.js +1056 -0
  12. package/build/PlaylistWindowManagerState.d.ts +28 -0
  13. package/build/PlaylistWindowManagerState.js +60 -0
  14. package/build/PresentationWindow.d.ts +149 -0
  15. package/build/PresentationWindow.js +1235 -0
  16. package/build/PresentationWindow.test.d.ts +1 -0
  17. package/build/PresentationWindow.test.js +340 -0
  18. package/build/WindowLoadError.d.ts +3 -0
  19. package/build/WindowLoadError.js +29 -0
  20. package/build/WindowTimeoutError.d.ts +3 -0
  21. package/build/WindowTimeoutError.js +29 -0
  22. package/build/WindowUnresponsiveError.d.ts +3 -0
  23. package/build/WindowUnresponsiveError.js +29 -0
  24. package/build/embeddedApps.d.ts +2 -0
  25. package/build/embeddedApps.js +59 -0
  26. package/build/embeddedApps.test.d.ts +1 -0
  27. package/build/embeddedApps.test.js +123 -0
  28. package/build/index.d.ts +10 -0
  29. package/build/index.js +30 -0
  30. package/build/preload.d.ts +1 -0
  31. package/build/preload.js +20 -0
  32. package/build/testUtils.d.ts +43 -0
  33. package/build/testUtils.js +209 -0
  34. package/build/types.d.ts +162 -0
  35. package/build/types.js +2 -0
  36. package/jest.config.js +6 -0
  37. package/package.json +30 -0
  38. package/src/BrowserViewRenderer.ts +180 -0
  39. package/src/BrowserWindowRenderer.ts +595 -0
  40. package/src/IFrameRenderer.ts +251 -0
  41. package/src/PlaylistWindowManager.ts +1094 -0
  42. package/src/PlaylistWindowManagerState.ts +70 -0
  43. package/src/PresentationWindow.test.ts +333 -0
  44. package/src/PresentationWindow.ts +1434 -0
  45. package/src/WindowLoadError.ts +8 -0
  46. package/src/WindowTimeoutError.ts +8 -0
  47. package/src/WindowUnresponsiveError.ts +8 -0
  48. package/src/embeddedApps.test.ts +231 -0
  49. package/src/embeddedApps.ts +74 -0
  50. package/src/index.ts +13 -0
  51. package/src/preload.ts +27 -0
  52. package/src/testUtils.ts +160 -0
  53. package/src/types.ts +199 -0
  54. package/tasks/npm-publish.sh +13 -0
  55. package/tsconfig.json +7 -0
package/src/types.ts ADDED
@@ -0,0 +1,199 @@
1
+ export interface Playlist {
2
+ id: string;
3
+ }
4
+
5
+ export interface Presentation {
6
+ id: string;
7
+ name: string;
8
+ applicationDeploymentId: string;
9
+ themeId: string | null;
10
+ applicationVariables: { [key: string]: any };
11
+ duration: number;
12
+ r: {
13
+ resource: {
14
+ updatedAt: string;
15
+ createdAt: string;
16
+ };
17
+ presentationsPlaylists: Array<{ playlistId: string }>;
18
+ };
19
+ }
20
+
21
+ export interface ApplicationVersion {
22
+ id: string;
23
+ name: string;
24
+ applicationId: string;
25
+ embeddedUrlFormat: string | null;
26
+ configurableDuration: boolean;
27
+ sourceUrl: string | null;
28
+ presentationProperties: Array<{
29
+ name: string;
30
+ type: string;
31
+ encode?: boolean;
32
+ }>;
33
+ }
34
+
35
+ export interface Font {
36
+ id: string;
37
+ name: string;
38
+ weight: string;
39
+ fileUpload: {
40
+ url: string;
41
+ };
42
+ }
43
+ export interface Theme {
44
+ id: string;
45
+ name: string;
46
+ backgroundColor: string;
47
+ backgroundImage: string;
48
+ backgroundImagePortrait: string;
49
+ headingTextColor: string;
50
+ headingFont: string;
51
+ heading2TextColor: string;
52
+ heading2Font: string;
53
+ bodyTextColor: string;
54
+ bodyFont: string;
55
+ borderColor: string;
56
+ headingFontNew: Font | null;
57
+ heading2FontNew: Font | null;
58
+ bodyFontNew: Font | null;
59
+ backgroundImageFileUpload: {
60
+ url: string;
61
+ } | null;
62
+ backgroundScale: 'fit' | 'fill' | null;
63
+ }
64
+
65
+ export interface Device {
66
+ id: string;
67
+ name: string | null;
68
+ }
69
+
70
+ export interface WindowBounds {
71
+ x: number;
72
+ y: number;
73
+ width: number;
74
+ height: number;
75
+ }
76
+
77
+ export interface WorkerState {
78
+ [key: string]: any;
79
+ }
80
+
81
+ export interface PreviewState {
82
+ inputs: Record<string, any>;
83
+ }
84
+
85
+ export interface CreateWindowOptions {
86
+ windowId: string;
87
+ parentWindowId?: string;
88
+ bounds?: WindowBounds;
89
+ backgroundColor?: string;
90
+
91
+ // Called when attaching a message listener to the inner window.
92
+ // The callback function will receive the message type (ie. presentation_ready)
93
+ // and a message payload if provided.
94
+ receiveMessageCallback?: (type: string, payload?: any) => void;
95
+
96
+ // Called when a window is unresponsive or crashed to move on to the next presentation.
97
+ errorCallback: (err: any) => void;
98
+ }
99
+
100
+ export interface Logger {
101
+ debug(message: any, context?: { [key: string]: any }): void;
102
+ info(message: any, context?: { [key: string]: any }): void;
103
+ warn(message: any, context?: { [key: string]: any }): void;
104
+ error(message: any, context?: { [key: string]: any }): void;
105
+ }
106
+
107
+ export interface PresentationWindowRenderer {
108
+ // Called when a new window needs to be created. It will be called once
109
+ // for the current window and again for the next window. A created window
110
+ // is hidden until the manager says it's active.
111
+ createWindow(options: CreateWindowOptions): void;
112
+
113
+ // Called when a window should be loaded with a URL, returns a promise that
114
+ // resolves when the window has finished loading.
115
+ loadWindow(windowId: string, url: string): Promise<void>;
116
+
117
+ // Called when a window's bounds beed to be updated.
118
+ updateWindowBounds(windowId: string, bounds: WindowBounds): void;
119
+
120
+ // Called when a window should be shown.
121
+ showWindow(windowId: string, isFocused: boolean): void;
122
+
123
+ // Called when a window should be hidden.
124
+ hideWindow(windowId: string): void;
125
+
126
+ // Called when a window should be destoyed, returns a promise that resolves
127
+ // when the window is finished unloading.
128
+ removeWindow(windowId: string): Promise<void>;
129
+
130
+ // Called when sending a message string to the inner window.
131
+ sendMessageString(windowId: string, message: string): void;
132
+
133
+ // Called when sending a message object to the inner window.
134
+ sendMessageObject(windowId: string, type: string, payload?: any): void;
135
+
136
+ // Called when muting a window.
137
+ muteWindow(windowId: string): void;
138
+
139
+ // Called when unmuting a window.
140
+ unMuteWindow(windowId: string): void;
141
+ }
142
+
143
+ export interface OpenChildWindowOptions {
144
+ windowId: string;
145
+ playlistId: string;
146
+ x: number;
147
+ y: number;
148
+ width: number;
149
+ height: number;
150
+ isFocused: boolean;
151
+ isMuted: boolean;
152
+ theme?: Theme;
153
+ }
154
+
155
+ export type Path = Array<string | number>;
156
+
157
+ export interface BuilderState {
158
+ inputs: InputState[];
159
+ profileId?: string;
160
+ }
161
+
162
+ export interface InputState {
163
+ path: Path;
164
+ state: any;
165
+ }
166
+
167
+ export interface EmbeddedAppMetadata {
168
+ renderMode: 'preview' | 'live';
169
+ }
170
+
171
+ export interface AnalyticsEvent {
172
+ type: string;
173
+ source: string;
174
+ productCategory?: string | null;
175
+ }
176
+
177
+ export interface ChargeRequest {
178
+ requestId: string;
179
+ amount: number;
180
+ tags?: Record<string, undefined | null | boolean | number | string>;
181
+ idempotencyId?: string;
182
+ }
183
+
184
+ export interface Charge {
185
+ id: string;
186
+ status: string;
187
+ }
188
+
189
+ export interface ChargeResponse {
190
+ requestId: string;
191
+ charge?: Charge;
192
+ error?: {
193
+ message: string;
194
+ };
195
+ }
196
+
197
+ export interface Terminal {
198
+ status: string;
199
+ }
@@ -0,0 +1,13 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ # Clean build
5
+ rm -rf build
6
+ mkdir build
7
+
8
+
9
+ # Build project
10
+ yarn build
11
+
12
+ # Publish
13
+ yarn publish --access public
package/tsconfig.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./build"
5
+ },
6
+ "exclude": ["./build"]
7
+ }