imposium-js-sdk 2.4.0 → 3.0.0

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/.eslintrc.js ADDED
@@ -0,0 +1,168 @@
1
+ /*
2
+ 👋 Hi! This file was autogenerated by tslint-to-eslint-config.
3
+ https://github.com/typescript-eslint/tslint-to-eslint-config
4
+
5
+ It represents the closest reasonable ESLint configuration to this
6
+ project's original TSLint configuration.
7
+
8
+ We recommend eventually switching this configuration to extend from
9
+ the recommended rulesets in typescript-eslint.
10
+ https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md
11
+
12
+ Happy linting! 💖
13
+ */
14
+ module.exports = {
15
+ "env": {
16
+ "browser": true,
17
+ "node": true
18
+ },
19
+ "extends": [
20
+ "plugin:@typescript-eslint/recommended",
21
+ "plugin:@typescript-eslint/recommended-requiring-type-checking"
22
+ ],
23
+ "parser": "@typescript-eslint/parser",
24
+ "parserOptions": {
25
+ "project": "tsconfig.json",
26
+ "sourceType": "module"
27
+ },
28
+ "plugins": [
29
+ "eslint-plugin-import",
30
+ "eslint-plugin-jsdoc",
31
+ "eslint-plugin-prefer-arrow",
32
+ "@typescript-eslint"
33
+ ],
34
+ "rules": {
35
+ "@typescript-eslint/adjacent-overload-signatures": "error",
36
+ "@typescript-eslint/array-type": [
37
+ "error",
38
+ {
39
+ "default": "array"
40
+ }
41
+ ],
42
+ "@typescript-eslint/ban-types": [
43
+ "error",
44
+ {
45
+ "types": {
46
+ "Object": {
47
+ "message": "Avoid using the `Object` type. Did you mean `object`?"
48
+ },
49
+ "Function": {
50
+ "message": "Avoid using the `Function` type. Prefer a specific function type, like `() => void`."
51
+ },
52
+ "Boolean": {
53
+ "message": "Avoid using the `Boolean` type. Did you mean `boolean`?"
54
+ },
55
+ "Number": {
56
+ "message": "Avoid using the `Number` type. Did you mean `number`?"
57
+ },
58
+ "String": {
59
+ "message": "Avoid using the `String` type. Did you mean `string`?"
60
+ },
61
+ "Symbol": {
62
+ "message": "Avoid using the `Symbol` type. Did you mean `symbol`?"
63
+ }
64
+ }
65
+ }
66
+ ],
67
+ "@typescript-eslint/consistent-type-assertions": "error",
68
+ "@typescript-eslint/dot-notation": "off",
69
+ "@typescript-eslint/no-unsafe-argument": "off",
70
+ "@typescript-eslint/no-unsafe-call": "off",
71
+ "@typescript-eslint/no-unsafe-assignment": "off",
72
+ "@typescript-eslint/no-empty-function": "error",
73
+ "@typescript-eslint/no-inferrable-types":"off",
74
+ "@typescript-eslint/restrict-template-expressions":"off",
75
+ "@typescript-eslint/no-unsafe-member-access":"off",
76
+ "@typescript-eslint/no-unsafe-return":"off",
77
+ "@typescript-eslint/no-empty-interface": "error",
78
+ "@typescript-eslint/no-explicit-any": "off",
79
+ "@typescript-eslint/no-misused-new": "error",
80
+ "@typescript-eslint/no-namespace": "error",
81
+ "@typescript-eslint/no-parameter-properties": "off",
82
+ "@typescript-eslint/no-shadow": [
83
+ "error",
84
+ {
85
+ "hoist": "all"
86
+ }
87
+ ],
88
+ "@typescript-eslint/no-unused-expressions": "error",
89
+ "@typescript-eslint/no-use-before-define": "off",
90
+ "@typescript-eslint/no-var-requires": "off",
91
+ "@typescript-eslint/prefer-for-of": "error",
92
+ "@typescript-eslint/prefer-function-type": "error",
93
+ "@typescript-eslint/prefer-namespace-keyword": "error",
94
+ "@typescript-eslint/quotes": [
95
+ "error",
96
+ "single",
97
+ {
98
+ "allowTemplateLiterals": true
99
+ }
100
+ ],
101
+ "@typescript-eslint/triple-slash-reference": [
102
+ "error",
103
+ {
104
+ "path": "always",
105
+ "types": "prefer-import",
106
+ "lib": "always"
107
+ }
108
+ ],
109
+ "@typescript-eslint/unified-signatures": "error",
110
+ "comma-dangle": "off",
111
+ "complexity": "off",
112
+ "constructor-super": "error",
113
+ "dot-notation": "off",
114
+ "eqeqeq": [
115
+ "error",
116
+ "smart"
117
+ ],
118
+ "guard-for-in": "error",
119
+ "id-denylist": "error",
120
+ "id-match": "error",
121
+ "import/order": "off",
122
+ "jsdoc/check-alignment": "error",
123
+ "jsdoc/check-indentation": "error",
124
+ "jsdoc/newline-after-description": "error",
125
+ "max-classes-per-file": "off",
126
+ "new-parens": "error",
127
+ "no-bitwise": "off",
128
+ "no-caller": "error",
129
+ "no-cond-assign": "error",
130
+ "no-console": "off",
131
+ "no-debugger": "error",
132
+ "no-empty": "error",
133
+ "no-empty-function": "error",
134
+ "no-eval": "error",
135
+ "no-fallthrough": "off",
136
+ "no-invalid-this": "off",
137
+ "no-new-wrappers": "error",
138
+ "no-shadow": "error",
139
+ "no-throw-literal": "error",
140
+ "no-trailing-spaces": "error",
141
+ "no-undef-init": "error",
142
+ "no-underscore-dangle": "error",
143
+ "no-unsafe-finally": "error",
144
+ "no-unused-expressions": "error",
145
+ "no-unused-labels": "error",
146
+ "no-use-before-define": "off",
147
+ "no-var": "error",
148
+ "object-shorthand": "error",
149
+ "one-var": [
150
+ "error",
151
+ "never"
152
+ ],
153
+ "prefer-arrow/prefer-arrow-functions": "error",
154
+ "prefer-const": "error",
155
+ "radix": "error",
156
+ "spaced-comment": [
157
+ "error",
158
+ "always",
159
+ {
160
+ "markers": [
161
+ "/"
162
+ ]
163
+ }
164
+ ],
165
+ "use-isnan": "error",
166
+ "valid-typeof": "off"
167
+ }
168
+ };
@@ -52,7 +52,8 @@
52
52
  //Create an instance of the Client and Player
53
53
  var client = new Imposium.Client({
54
54
  accessToken:'zooch5ja8fiejoojoo6AeQuahmex1wes',
55
- storyId:'295a80d0-871c-4def-a579-8a375d6942fc'
55
+ storyId:'75e3ed80-7008-480e-ca39-6a3dab807fe9',
56
+ compositionId:'473df1b4-d9f5-4648-b08b-e0af03abb86e'
56
57
  });
57
58
  var player = new Imposium.Player(videoNode, client);
58
59
 
@@ -64,7 +65,7 @@
64
65
  e.preventDefault();
65
66
 
66
67
  //Create the Imposium Experience
67
- client.createExperience({
68
+ client.renderExperience({
68
69
  text:captionInput.value,
69
70
  });
70
71
  }
@@ -50,7 +50,6 @@
50
50
  </div>
51
51
 
52
52
  <section id="player-wrapper">
53
- <p id = "status"></p>
54
53
  <video id="dynamic-video" />
55
54
  </section>
56
55
 
@@ -61,22 +60,19 @@
61
60
  var btnSubmit = document.getElementById('btn-submit'),
62
61
  videoNode = document.getElementById('dynamic-video'),
63
62
  captionInput = document.getElementById('caption'),
64
- statusField = document.getElementById('status'),
65
63
  imageInput = document.getElementById('image');
66
64
 
67
65
  //Create an instance of the Client and Player
68
66
  var client = new Imposium.Client({
69
- accessToken:'zooch5ja8fiejoojoo6AeQuahmex1wes',
70
- storyId:'295a80d0-871c-4def-a579-8a375d6942fc'
71
- });
67
+ accessToken:'zooch5ja8fiejoojoo6AeQuahmex1wes',
68
+ storyId:'75e3ed80-7008-480e-ca39-6a3dab807fe9',
69
+ compositionId:'473df1b4-d9f5-4648-b08b-e0af03abb86e'
70
+ });
72
71
 
73
72
  var player = new Imposium.Player(videoNode, client);
74
73
 
75
- //Listen to the client STATUS_UPDATE event to populate the status field
76
- client.on(Imposium.Events.STATUS_UPDATE, setStatus);
77
-
78
74
  //Listen for the EXPERIENCE_CREATED event to pull the experience ID and write it to the URL
79
- client.on(Imposium.Events.EXPERIENCE_CREATED, gotExperience);
75
+ client.on(Imposium.Events.EXPERIENCE_CREATED, expCreated);
80
76
 
81
77
  //Listen for input event to trigger input validation
82
78
  captionInput.addEventListener('change', validateForm);
@@ -103,13 +99,9 @@
103
99
  }
104
100
 
105
101
  //Writes the experience ID to the URL
106
- function gotExperience(e){
102
+ function expCreated(e){
107
103
  window.location.hash = '#' + e.id;
108
- }
109
-
110
- //Set the content of the status update field
111
- function setStatus(e){
112
- statusField.innerHTML = e.status;
104
+ client.getExperience(e.id);
113
105
  }
114
106
 
115
107
  //Validate the two inputs in the inputs field, enable the submit button if they are filled out
@@ -50,7 +50,6 @@
50
50
  </div>
51
51
 
52
52
  <section id="player-wrapper">
53
- <p id = "status"></p>
54
53
  <video id="dynamic-video" />
55
54
  </section>
56
55
 
@@ -61,19 +60,16 @@
61
60
  var btnSubmit = document.getElementById('btn-submit'),
62
61
  videoNode = document.getElementById('dynamic-video'),
63
62
  captionInput = document.getElementById('caption'),
64
- statusField = document.getElementById('status'),
65
63
  imageInput = document.getElementById('image');
66
64
 
67
65
  //Create an instance of the Client and Player
68
66
  var client = new Imposium.Client({
69
67
  accessToken:'zooch5ja8fiejoojoo6AeQuahmex1wes',
70
- storyId:'295a80d0-871c-4def-a579-8a375d6942fc'
68
+ storyId:'75e3ed80-7008-480e-ca39-6a3dab807fe9',
69
+ compositionId:'473df1b4-d9f5-4648-b08b-e0af03abb86e'
71
70
  });
72
71
  var player = new Imposium.Player(videoNode, client);
73
72
 
74
- //Listen to the client STATUS_UPDATE event to populate the status field
75
- client.on(Imposium.Events.STATUS_UPDATE, setStatus);
76
-
77
73
  //Listen for input event to trigger input validation
78
74
  captionInput.addEventListener('change', validateForm);
79
75
  imageInput.addEventListener('change', validateForm);
@@ -90,13 +86,7 @@
90
86
  }
91
87
 
92
88
  //Create the Imposium Experience
93
- client.createExperience(inventory);
94
- }
95
-
96
- //Set the content of the status update field
97
- function setStatus(e){
98
-
99
- statusField.innerHTML = e.status;
89
+ client.renderExperience(inventory);
100
90
  }
101
91
 
102
92
  //Validate the two inputs in the inputs field, enable the submit button if they are filled out
@@ -51,7 +51,6 @@
51
51
  </div>
52
52
 
53
53
  <section id="player-wrapper">
54
- <p id = "status"></p>
55
54
  <video id="dynamic-video" />
56
55
  </section>
57
56
 
@@ -62,21 +61,18 @@
62
61
  var btnSubmit = document.getElementById('btn-submit'),
63
62
  videoNode = document.getElementById('dynamic-video'),
64
63
  captionInput = document.getElementById('caption'),
65
- statusField = document.getElementById('status'),
66
64
  imageInput = document.getElementById('image');
67
65
 
68
66
  //Create an instance of the Client
69
67
  var client = new Imposium.Client({
70
68
  accessToken:'zooch5ja8fiejoojoo6AeQuahmex1wes',
71
- storyId:'295a80d0-871c-4def-a579-8a375d6942fc'
69
+ storyId:'75e3ed80-7008-480e-ca39-6a3dab807fe9',
70
+ compositionId:'473df1b4-d9f5-4648-b08b-e0af03abb86e'
72
71
  });
73
72
 
74
73
  //Enables imposium to capture playback metrics without our default video player
75
74
  client.captureAnalytics(videoNode);
76
75
 
77
- //Listen to the client STATUS_UPDATE event to populate the status field
78
- client.on(Imposium.Events.STATUS_UPDATE, setStatus);
79
-
80
76
  //Listen to the client GOT_EXPERIENE event to get the video URLs
81
77
  client.on(Imposium.Events.GOT_EXPERIENCE, gotExperience);
82
78
 
@@ -96,18 +92,13 @@
96
92
  }
97
93
 
98
94
  // Create the Imposium Experience
99
- client.createExperience(inventory);
95
+ client.renderExperience(inventory);
100
96
  }
101
97
 
102
98
  function gotExperience(data) {
103
99
  videoNode.src = data.output.videos['mp4_720'].url;
104
100
  }
105
101
 
106
- //Set the content of the status update field
107
- function setStatus(e){
108
- statusField.innerHTML = e.status;
109
- }
110
-
111
102
  //Validate the two inputs in the inputs field, enable the submit button if they are filled out
112
103
  function validateForm(){
113
104
 
@@ -17,7 +17,6 @@
17
17
  </header>
18
18
 
19
19
  <section id="player-wrapper">
20
- <p id = "status"></p>
21
20
  <video id="dynamic-video" />
22
21
  </section>
23
22
 
@@ -33,7 +32,8 @@
33
32
  //Create an instance of the Client and Player
34
33
  var client = new Imposium.Client({
35
34
  accessToken:'zooch5ja8fiejoojoo6AeQuahmex1wes',
36
- storyId:'295a80d0-871c-4def-a579-8a375d6942fc'
35
+ storyId:'75e3ed80-7008-480e-ca39-6a3dab807fe9',
36
+ compositionId:'473df1b4-d9f5-4648-b08b-e0af03abb86e'
37
37
  });
38
38
  var player = new Imposium.Player(videoNode, client);
39
39
 
@@ -18,7 +18,6 @@
18
18
  </header>
19
19
 
20
20
  <section id="player-wrapper">
21
- <p id = "status"></p>
22
21
  <video id="dynamic-video" />
23
22
  </section>
24
23
 
@@ -65,7 +64,8 @@
65
64
  //Create an instance of the Client
66
65
  var client = new Imposium.Client({
67
66
  accessToken:'zooch5ja8fiejoojoo6AeQuahmex1wes',
68
- storyId:'295a80d0-871c-4def-a579-8a375d6942fc'
67
+ storyId:'75e3ed80-7008-480e-ca39-6a3dab807fe9',
68
+ compositionId:'473df1b4-d9f5-4648-b08b-e0af03abb86e'
69
69
  });
70
70
 
71
71
  //Turns off default media controls
@@ -50,7 +50,6 @@
50
50
  </div>
51
51
 
52
52
  <section id="player-wrapper">
53
- <p id = "status"></p>
54
53
  <video id="dynamic-video" />
55
54
  </section>
56
55
 
@@ -61,19 +60,16 @@
61
60
  var btnSubmit = document.getElementById('btn-submit'),
62
61
  videoNode = document.getElementById('dynamic-video'),
63
62
  captionInput = document.getElementById('caption'),
64
- statusField = document.getElementById('status'),
65
63
  imageInput = document.getElementById('image');
66
64
 
67
65
  //Create an instance of the Client and Player
68
66
  var client = new Imposium.Client({
69
67
  accessToken:'zooch5ja8fiejoojoo6AeQuahmex1wes',
70
- storyId:'295a80d0-871c-4def-a579-8a375d6942fc'
68
+ storyId:'75e3ed80-7008-480e-ca39-6a3dab807fe9',
69
+ compositionId:'473df1b4-d9f5-4648-b08b-e0af03abb86e'
71
70
  });
72
71
  var player = new Imposium.Player(videoNode, client);
73
72
 
74
- //Listen to the client STATUS_UPDATE event to populate the status field
75
- client.on(Imposium.Events.STATUS_UPDATE, setStatus);
76
-
77
73
  //Listen to the client EXPERIENCE_CREATED event to get the experience ID
78
74
  client.on(Imposium.Events.EXPERIENCE_CREATED, experienceCreated);
79
75
 
@@ -102,7 +98,7 @@
102
98
  }
103
99
 
104
100
  //Create the Imposium Experience. The false parameter will prevent the video render from beginning
105
- client.createExperience(inventory, false);
101
+ client.createExperience(inventory);
106
102
  }
107
103
 
108
104
  function experienceCreated(e){
@@ -111,12 +107,6 @@
111
107
  client.getExperience(e.id);
112
108
  }
113
109
 
114
- //Set the content of the status update field
115
- function setStatus(e){
116
-
117
- statusField.innerHTML = e.status;
118
- }
119
-
120
110
  //Validate the two inputs in the inputs field, enable the submit button if they are filled out
121
111
  function validateForm(){
122
112
 
@@ -63,7 +63,6 @@
63
63
  </button>
64
64
 
65
65
  <section id="player-wrapper">
66
- <p id = "status"></p>
67
66
  <video id="dynamic-video" />
68
67
  </section>
69
68
 
@@ -74,7 +73,6 @@
74
73
  var btnSubmit = document.getElementById('btn-submit'),
75
74
  videoNode = document.getElementById('dynamic-video'),
76
75
  captionInput = document.getElementById('caption'),
77
- statusField = document.getElementById('status'),
78
76
  imageInput = document.getElementById('image'),
79
77
  imgCanvas = document.getElementById('img-canvas'),
80
78
  ctx = imgCanvas.getContext('2d'),
@@ -88,7 +86,8 @@
88
86
  //Create an instance of the Client and Player
89
87
  var client = new Imposium.Client({
90
88
  accessToken:'zooch5ja8fiejoojoo6AeQuahmex1wes',
91
- storyId:'295a80d0-871c-4def-a579-8a375d6942fc'
89
+ storyId:'75e3ed80-7008-480e-ca39-6a3dab807fe9',
90
+ compositionId:'473df1b4-d9f5-4648-b08b-e0af03abb86e'
92
91
  });
93
92
  var player = new Imposium.Player(videoNode, client);
94
93
 
@@ -103,9 +102,6 @@
103
102
  offset = 10,
104
103
  imgScale = 1;
105
104
 
106
- //Listen to the client STATUS_UPDATE event to populate the status field
107
- client.on(Imposium.Events.STATUS_UPDATE, setStatus);
108
-
109
105
  //Listen for input event to trigger input validation
110
106
  captionInput.addEventListener('change', validateForm);
111
107
  imageInput.addEventListener('change', imageUploaded);
@@ -134,7 +130,7 @@
134
130
  }
135
131
 
136
132
  //Create the Imposium Experience
137
- client.createExperience(inventory);
133
+ client.renderExperience(inventory);
138
134
  });
139
135
  }
140
136
 
@@ -229,12 +225,6 @@
229
225
  }
230
226
  }
231
227
 
232
- //Set the content of the status update field
233
- function setStatus(e){
234
-
235
- statusField.innerHTML = e.status;
236
- }
237
-
238
228
  //Validate the two inputs in the inputs field, enable the submit button if they are filled out
239
229
  function validateForm(){
240
230
 
@@ -54,7 +54,6 @@
54
54
  </button>
55
55
 
56
56
  <section id="player-wrapper">
57
- <p id = "status"></p>
58
57
  <video id="dynamic-video" />
59
58
  </section>
60
59
 
@@ -66,14 +65,14 @@
66
65
  btnCapture = document.getElementById('btn-capture'),
67
66
  videoNode = document.getElementById('dynamic-video'),
68
67
  captionInput = document.getElementById('caption'),
69
- statusField = document.getElementById('status'),
70
68
  captureNode = document.getElementById('capture-video'),
71
69
  captureCanvas = document.getElementById('capture-canvas');
72
70
 
73
71
  //Create an instance of the Client and Player
74
72
  var client = new Imposium.Client({
75
73
  accessToken:'zooch5ja8fiejoojoo6AeQuahmex1wes',
76
- storyId:'295a80d0-871c-4def-a579-8a375d6942fc'
74
+ storyId:'75e3ed80-7008-480e-ca39-6a3dab807fe9',
75
+ compositionId:'473df1b4-d9f5-4648-b08b-e0af03abb86e'
77
76
  });
78
77
  var player = new Imposium.Player(videoNode, client);
79
78
 
@@ -90,9 +89,6 @@
90
89
  }
91
90
  };
92
91
 
93
- //Listen to the client STATUS_UPDATE event to populate the status field
94
- client.on(Imposium.Events.STATUS_UPDATE, setStatus);
95
-
96
92
  //Listen for input event to trigger input validation
97
93
  captionInput.addEventListener('input', validateForm);
98
94
  btnSubmit.addEventListener('click', submit);
@@ -115,7 +111,7 @@
115
111
  }
116
112
 
117
113
  //Create the Imposium Experience
118
- client.createExperience(inventory);
114
+ client.renderExperience(inventory);
119
115
  });
120
116
  }
121
117
 
@@ -130,12 +126,6 @@
130
126
  validateForm();
131
127
  }
132
128
 
133
- //Set the content of the status update field
134
- function setStatus(e){
135
-
136
- statusField.innerHTML = e.status;
137
- }
138
-
139
129
  //Validate the two inputs in the inputs field, enable the submit button if they are filled out.
140
130
  function validateForm(){
141
131