Skip to content

Commit

Permalink
Video consent trial (#52)
Browse files Browse the repository at this point in the history
* Remove unnecessary json file
* Don't commit DS_Store files
* Move data package to peer dependencies.
* Update TS config for record package
* Initial features for consent video trial.
* Move/New templates
* Rename error file to "errors"
* Rename survey consent file
* Add style changes
* Expose consent video plugin
* Update recorder start
* Change exposed survey trial names
* Remove record as a dependency
* Update to recorder class
* Add error classes
* Move scss to record package
* Play is active after playback.
* Remove unused template
* Update border for play icon
* Update package lock
* Change to Rollup processing images
* Update tests
* changeset
* Rename consent video plugin to VideoConsentPlugin
* Fix odd double import
* Update docs after renaming exposed classes
* Uncomment wrongly commented tests.
  • Loading branch information
okaycj authored Sep 25, 2024
1 parent 4c436ee commit b729922
Show file tree
Hide file tree
Showing 38 changed files with 1,302 additions and 610 deletions.
8 changes: 8 additions & 0 deletions .changeset/large-deers-deny.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@lookit/surveys": patch
"@lookit/record": patch
"@lookit/style": patch
"@lookit/data": patch
---

Add consent video trial
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ dist
coverage
Procfile
.env
site
site
.DS_Store
1 change: 1 addition & 0 deletions jest.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports.makePackageConfig = () => {
transform: {
...config.transform,
"^.+\\.mustache$": "<rootDir>/../../jest.text.loader.js",
"^.+\\.svg$": "<rootDir>/../../jest.text.loader.js",
},
moduleNameMapper: { "@lookit/data": "<rootDir>/../../packages/data/src" },
coverageThreshold: {
Expand Down
36 changes: 35 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions packages/data/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,11 @@ export class AWSConfigError extends Error {
this.name = "AWSConfigError";
}
}
/** Error for when URL from Django API is not formatted as expected. */
export class URLWrongError extends Error {
/** Throw error when URL is not formatted correctly. */
public constructor() {
super("URL is different than expected.");
this.name = "URLWrongError";
}
}
3 changes: 2 additions & 1 deletion packages/data/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { URLWrongError } from "./errors";
import { ApiResponse } from "./types";

const CONFIG = <const>{ url_base: "/api/v2/" };
Expand Down Expand Up @@ -75,6 +76,6 @@ export const getUuids = () => {
if (locationHref.includes("studies/j/") && uuids && uuids.length === 2) {
return { study: uuids[0], child: uuids[1] };
} else {
throw new Error("URL is different than expected.");
throw new URLWrongError();
}
};
12 changes: 12 additions & 0 deletions packages/record/img/play-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions packages/record/img/record-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion packages/record/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,20 @@
"test": "jest --coverage"
},
"dependencies": {
"@lookit/data": "^0.0.1",
"auto-bind": "^5.0.1",
"mustache": "^4.2.0"
},
"devDependencies": {
"@jspsych/config": "^2.0.0",
"@rollup/plugin-image": "^3.0.3",
"@types/audioworklet": "^0.0.60",
"@types/mustache": "^4.2.5",
"rollup-plugin-dotenv": "^0.5.1",
"rollup-plugin-string-import": "^1.2.4",
"typescript": "^5.6.2"
},
"peerDependencies": {
"@lookit/data": "^0.0.1",
"jspsych": "^8.0.2"
}
}
3 changes: 3 additions & 0 deletions packages/record/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import image from "@rollup/plugin-image";
import dotenv from "rollup-plugin-dotenv";
import { importAsString } from "rollup-plugin-string-import";
import { makeRollupConfig } from "../../rollup.mjs";
Expand All @@ -13,6 +14,8 @@ export default makeRollupConfig("chsRecord").map((config) => {
importAsString({
include: ["**/*.mustache"],
}),

image(),
],
};
});
12 changes: 12 additions & 0 deletions packages/record/scss/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
img#record-icon,
img#play-icon {
top: 7px;
left: 7px;
height: 25px;
position: absolute;
}

div#lookit-jspsych-video-container {
position: relative;
width: min-content;
}
Loading

0 comments on commit b729922

Please sign in to comment.