Skip to content

Chrome Core 🍎

The chrome core is used for exposing additional functionality to the Kiosk web application.

Serial resolution will not work when running the application on any device that is not a chrome box, irrespective of whether or not you are accessing the site via the chrome extension.

Installing

  • Navigate to chrome://extensions

  • Select Load Unpacked

  • IMPORTANT Find the uploaded apps ID and add it to your UI's env file as the POI_APP_CHROME_EXTENSION_ID

Chrome App Id Location

This will launch the chrome app and load the current DEFAULT_URL in the .env.development

If you need to mimic serial resolution in an environment that is not a chrome box append ?serialKey=SERIAL_KEY to the DEFAULT_URL where SERIAL_KEY is a valid serial.

How to manually build

If for whatever reason you need to manually build and deploy, here's how

  • Update the manifest file to include the target name and version (must be higher than previous release)

  • Copy manifest.json, index.html, index.js, schema.json and dist/ into a seperate folder

  • Zip this folder

  • Find target app at the chrome web store (use team-supersonic credentials on 1password)

  • Upload zip folder to target app

  • Wait for review

This process usually takes 20-30 mins for already released apps (1 hour - 1 day for new apps)

Structure

index.js
Creates the chrome app window and loads the index.html

index.html
Contains webview for loading with PWA, loads dist/app.js

src/index.js
Contains on load event for once the chrome app / PWA are loaded
Note: Gets compiled into dist/app.js

Supplementary

Messaging:

Chrome exposes a somewhat archaic messaging API as a result we decided it was best to provide an adaption layer over this. Primary motivators for this were that if we ever needed to migrate away from Chrome or support multiple platforms this would make this easier. For a more in depth overview of this please refer to this RFC.

Runtime:

Chrome applications (not extensions) have a very particular ruleset when it comes to code execution. As a result any code that is considered an eval is prohibited. This issue is relatively nuanced, if you are interested in a more in depth explanation please review this thread.

Logging:

Currently all packages in this monorepo implement the @fingermarkglobal/logger package, including those used in the chrome-core. Unfortunately these libraries uses pimterry/loglevel package internally which takes advantage of a particular Javascript hack to evaluate the runtime global. As a result we have to shim this package out of any package used by the chrome-core. We do this via a custome rollup config, please refer to the section below for more infor on this.

Rollup:

The chrome core is the only application that uses vanilla Rollup over tsdx. This was because we needed more fine grained control over the build process.