add op.js to public site

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-02-05 22:39:22 +01:00
parent 2c20c1e3df
commit a92ce66048
10 changed files with 28 additions and 5 deletions

View File

@@ -81,6 +81,8 @@ export class MixanWeb extends Mixan<MixanWebOptions> {
} else {
window.addEventListener('locationchange', () => this.screenView());
}
this.screenView();
}
public screenView(properties?: Record<string, unknown>): void {

View File

@@ -4,6 +4,7 @@
"module": "index.ts",
"scripts": {
"build": "rm -rf dist && tsup",
"build-for-openpanel": "pnpm build && cp dist/cdn.global.js ../../apps/public/public/op.js",
"lint": "eslint .",
"format": "prettier --check \"**/*.{mjs,ts,md,json}\"",
"typecheck": "tsc --noEmit"

View File

@@ -41,11 +41,11 @@ function createApi(_url: string, clientId: string, clientSecret?: string) {
...(options ?? {}),
})
.then(async (res) => {
if (res.status !== 200) {
if (res.status !== 200 && res.status !== 202) {
return retry(attempt, resolve);
}
const response = await res.json();
const response = await res.text();
if (!response) {
return resolve(null);