@upscopeio/sdk 2025.12.8 → 2025.12.9
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/index.js +2 -2
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -40,7 +40,7 @@ function loadSDK(w, apiKey) {
|
|
|
40
40
|
i.q = [];
|
|
41
41
|
// The real Upscope implementation is loaded below
|
|
42
42
|
w.Upscope = i;
|
|
43
|
-
var s = document.createElement("script");
|
|
43
|
+
var s = w.document.createElement("script");
|
|
44
44
|
s.type = "text/javascript";
|
|
45
45
|
s.async = true;
|
|
46
46
|
var _;
|
|
@@ -49,7 +49,7 @@ function loadSDK(w, apiKey) {
|
|
|
49
49
|
production: "https://code.upscope.io/".concat(apiKey, ".js"),
|
|
50
50
|
staging: "https://code.upscope.xyz/".concat(apiKey, ".js")
|
|
51
51
|
})[environment !== null && environment !== void 0 ? environment : "production"]) !== null && _ !== void 0 ? _ : "https://code.upscope.io/".concat(apiKey, ".js");
|
|
52
|
-
document.head.appendChild(s);
|
|
52
|
+
w.document.head.appendChild(s);
|
|
53
53
|
loadedWindows.add(w);
|
|
54
54
|
}
|
|
55
55
|
var ScopedUpscope = function ScopedUpscope(w) {
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAM,gBAAgB,IAAI;AAC1B,IAAM,yBAAyB,IAAI;AACnC,IAAM,cAAc,OAAO,iCAAiC;AAC5D,SAAS,QAAQ,CAAC,EAAE,MAAM,EAAE;IACxB,IAAI,OAAO,EAAE,OAAO,KAAK,aAAa;QAClC,cAAc,GAAG,CAAC;QAClB;IACJ,CAAC;IACD,IAAM,IAAI,SAAJ,KAAuB;QAAT,IAAA,IAAA,OAAA,UAAA,QAAA,AAAG,OAAH,UAAA,OAAA,OAAA,GAAA,OAAA,MAAA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Map = new WeakMap();\nconst environment = window.__upscope__sdk__load__environment;\nfunction loadSDK(w, apiKey) {\n if (typeof w.Upscope !== \"undefined\") {\n loadedWindows.add(w);\n return;\n }\n const i = function (...args) {\n i.q.push(args);\n };\n i.q = [];\n // The real Upscope implementation is loaded below\n w.Upscope = i;\n const s = w.document.createElement(\"script\");\n s.type = \"text/javascript\";\n s.async = true;\n s.src =\n {\n development: `http://code.upscope.local/${apiKey}.js`,\n production: `https://code.upscope.io/${apiKey}.js`,\n staging: `https://code.upscope.xyz/${apiKey}.js`,\n }[environment ?? \"production\"] ?? `https://code.upscope.io/${apiKey}.js`;\n w.document.head.appendChild(s);\n loadedWindows.add(w);\n}\nconst ScopedUpscope = function (w, ...instruction) {\n if (!loadedWindows.has(w)) {\n if (instruction[0] === \"init\") {\n const config = instruction[1];\n if (!config?.apiKey)\n throw new Error(\"API key not specified\");\n loadSDK(w, config.apiKey);\n const pendingInstructions = pendingInstructionsMap.get(w);\n if (pendingInstructions) {\n pendingInstructionsMap.delete(w);\n pendingInstructions.forEach((instruction) => {\n w.Upscope(...instruction);\n });\n }\n }\n else if (instruction[0] === \"on\") {\n pendingInstructionsMap.set(w, [...(pendingInstructionsMap.get(w) ?? []), instruction]);\n return;\n }\n else {\n throw new Error('Upscope is not loaded yet. Please call \"init\" as your first command.');\n }\n }\n w.Upscope(...instruction);\n};\nexport const upscopeFor = function (w) {\n return (...instruction) => {\n ScopedUpscope(w, ...instruction);\n };\n};\nconst _Upscope = upscopeFor(window);\nexport default _Upscope;\n"]}
|
package/package.json
CHANGED