diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 701922a..cb8c8e4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,3 +23,4 @@ jobs: cache: "npm" - run: npm ci - run: npm run build --if-present + - run: npm run build:HarmonyExport diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index f4bf49f..ebd5dae 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -29,6 +29,7 @@ jobs: - run: npm install - run: npm ci - run: npm run build --if-present + - run: npm run build:HarmonyExport # - run: npm test - name: Deploy uses: s0/git-publish-subdir-action@develop diff --git a/package-lock.json b/package-lock.json index 41be40a..e48d666 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7233,9 +7233,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001566", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001566.tgz", - "integrity": "sha512-ggIhCsTxmITBAMmK8yZjEhCO5/47jKXPu6Dha/wuCS4JePVL+3uiDEBuhu2aIoT+bqTOR8L76Ip1ARL9xYsEJA==", + "version": "1.0.30001636", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001636.tgz", + "integrity": "sha512-bMg2vmr8XBsbL6Lr0UHXy/21m84FTxDLWn2FSqMd5PrlbMxwJlQnC2YWYxVgp66PZE+BBNF2jYQUBKCo1FDeZg==", "funding": [ { "type": "opencollective", diff --git a/src/components/HarmonyExport.js b/src/components/HarmonyExport.js index 64d8fd1..6480869 100644 --- a/src/components/HarmonyExport.js +++ b/src/components/HarmonyExport.js @@ -6,10 +6,10 @@ import { Base64 } from "js-base64"; ? define(factory) : ((global = typeof globalThis !== "undefined" ? globalThis : global || self), - (global.MyDataSharingLib = factory())); + (global.HarmonyExport = factory())); })(this, function () { "use strict"; - const harmonyURL = "https://harmony-staging.netlify.app/#/"; + const harmonyURL = "https://harmonydata.ac.uk/app/#/"; const createHarmonyUrl = ({ questions, instrument_name }) => { // @@ -18,10 +18,11 @@ import { Base64 } from "js-base64"; questions.length && questions.every( (q) => - (typeof q === "string" || q instanceof String) && - q.question_text && - (typeof q.question_text === "string" || - q.question_text instanceof String) + typeof q === "string" || + q instanceof String || + (q.question_text && + (typeof q.question_text === "string" || + q.question_text instanceof String)) ) ) { const qArray = questions.map((q, i) => { @@ -41,10 +42,13 @@ import { Base64 } from "js-base64"; } }; - class HarmonySharingComponent extends HTMLElement { + class HarmonyExportComponent extends HTMLElement { constructor() { super(); - this.attachShadow({ mode: "open" }); // Create a shadow DOM + this._questions = []; + this._instrument_name = "Imported Instrument"; + this._size = "26px"; + this.attachShadow({ mode: "open" }); this.shadowRoot.innerHTML = `