@superfeedback/widget 0.0.24 → 0.0.25
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/dist/index.iife.js +5 -5
- package/dist/index.js +7 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -70,7 +70,7 @@ var VISITOR_ID_KEY = "sf_visitor_id", SessionTracker = class {
|
|
|
70
70
|
this.#f();
|
|
71
71
|
}
|
|
72
72
|
}, __widgetBaseUrl = null;
|
|
73
|
-
typeof document < "u" && document.currentScript && (__widgetBaseUrl = document.currentScript.src);
|
|
73
|
+
typeof document < "u" && document.currentScript && (__widgetBaseUrl = document.currentScript.src), console.log(__widgetBaseUrl);
|
|
74
74
|
function loadScript(e) {
|
|
75
75
|
return new Promise((r, i) => {
|
|
76
76
|
let a = document.createElement("script");
|
|
@@ -80,7 +80,7 @@ function loadScript(e) {
|
|
|
80
80
|
var iifeLoader = async () => {
|
|
81
81
|
if (window.__superfeedback_widget) return window.__superfeedback_widget;
|
|
82
82
|
if (!__widgetBaseUrl) throw Error("Cannot determine widget chunk URL");
|
|
83
|
-
await loadScript(`${__widgetBaseUrl}/dist/widget.iife.js`);
|
|
83
|
+
console.log("load widget from base_url:", __widgetBaseUrl), await loadScript(`${__widgetBaseUrl}/dist/widget.iife.js`);
|
|
84
84
|
let e = window.__superfeedback_widget;
|
|
85
85
|
if (!e) throw Error("Widget chunk failed to register");
|
|
86
86
|
return e;
|
|
@@ -134,9 +134,11 @@ var iifeLoader = async () => {
|
|
|
134
134
|
this.#n = l, l.mount(this.#r), this.#a = !1;
|
|
135
135
|
}
|
|
136
136
|
async #s(e) {
|
|
137
|
-
let r =
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
let r = "https://app.superfeedback.ai";
|
|
138
|
+
console.log("resolve project_id with url:", r);
|
|
139
|
+
let i = await fetch(`${r}/api/external/v1/apps/${e}/config`);
|
|
140
|
+
if (!i.ok) throw Error(`Failed to resolve appId: ${i.statusText}`);
|
|
141
|
+
return (await i.json()).projectId;
|
|
140
142
|
}
|
|
141
143
|
static init(e) {
|
|
142
144
|
return r.#e ||= new r(e), r.#e;
|