@upscopeio/sdk 2025.12.5 → 2025.12.6

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 CHANGED
@@ -24,6 +24,7 @@ function _unsupportedIterableToArray(o, minLen) {
24
24
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
25
25
  }
26
26
  var loadedWindows = new WeakSet();
27
+ var environment = window.__upscope__sdk__load__environment;
27
28
  function loadSDK(w, apiKey) {
28
29
  if (typeof w.Upscope !== "undefined") {
29
30
  loadedWindows.add(w);
@@ -41,7 +42,12 @@ function loadSDK(w, apiKey) {
41
42
  var s = document.createElement("script");
42
43
  s.type = "text/javascript";
43
44
  s.async = true;
44
- s.src = "https://code.upscope.io/".concat(apiKey, ".js");
45
+ var _;
46
+ s.src = (_ = ({
47
+ development: "http://code.upscope.local/".concat(apiKey, ".js"),
48
+ production: "https://code.upscope.io/".concat(apiKey, ".js"),
49
+ staging: "https://code.upscope.xyz/".concat(apiKey, ".js")
50
+ })[environment !== null && environment !== void 0 ? environment : "production"]) !== null && _ !== void 0 ? _ : "https://code.upscope.io/".concat(apiKey, ".js");
45
51
  document.head.appendChild(s);
46
52
  loadedWindows.add(w);
47
53
  }
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["index.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAM,gBAAgB,IAAI;AAC1B,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,OAAA;YAAG,KAAH,QAAA,SAAA,CAAA,KAAO;QAAD;QACtB,EAAE,CAAC,CAAC,IAAI,CAAC;IACb;IACA,EAAE,CAAC,GAAG,EAAE;IACR,kDAAkD;IAClD,EAAE,OAAO,GAAG;IACZ,IAAM,IAAI,SAAS,aAAa,CAAC;IACjC,EAAE,IAAI,GAAG;IACT,EAAE,KAAK,GAAG,IAAI;IACd,EAAE,GAAG,GAAG,AAAC,2BAAiC,OAAP,QAAO;IAC1C,SAAS,IAAI,CAAC,WAAW,CAAC;IAC1B,cAAc,GAAG,CAAC;AACtB;AACA,IAAM,gBAAgB,SAAhB,cAA0B,CAAC,EAAkB;IAAhB,IAAA,IAAA,OAAA,UAAA,QAAA,AAAG,cAAH,UAAA,OAAA,IAAA,OAAA,KAAc,GAAd,OAAA,GAAA,OAAA,MAAA,OAAA;QAAG,YAAH,OAAA,KAAA,SAAA,CAAA,KAAc;IAAD;QAY5C;IAXA,IAAI,CAAC,cAAc,GAAG,CAAC,IAAI;QACvB,IAAI,WAAW,CAAC,EAAE,KAAK,QAAQ;YAC3B,IAAM,SAAS,WAAW,CAAC,EAAE;YAC7B,IAAI,CAAC,CAAA,mBAAA,oBAAA,KAAA,IAAA,OAAQ,MAAK,AAAC,GACf,MAAM,IAAI,MAAM,yBAAyB;YAC7C,QAAQ,GAAG,OAAO,MAAM;QAC5B,OACK;YACD,MAAM,IAAI,MAAM,yBAAyB;QAC7C,CAAC;IACL,CAAC;IACD,CAAA,KAAA,GAAE,OAAO,CAAT,MAAA,IAAU,mBAAG;AACjB;AACA,OAAO,IAAM,aAAa,SAAb,WAAuB,CAAC,EAAE;IACnC,OAAO,WAAoB;yCAAhB;YAAA;;QACP,cAAA,MAAA,KAAA,GAAA;YAAc;SAAkB,CAAhC,OAAiB,mBAAG;IACxB;AACJ,EAAE;AACF,IAAM,WAAW,WAAW;AAC5B,eAAe,SAAS","file":"index.js","sourcesContent":["const loadedWindows = new WeakSet();\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 = document.createElement(\"script\");\n s.type = \"text/javascript\";\n s.async = true;\n s.src = `https://code.upscope.io/${apiKey}.js`;\n 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 }\n else {\n throw new Error(\"Upscope is not loaded\");\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"]}
1
+ {"version":3,"sources":["index.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAM,gBAAgB,IAAI;AAC1B,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,OAAA;YAAG,KAAH,QAAA,SAAA,CAAA,KAAO;QAAD;QACtB,EAAE,CAAC,CAAC,IAAI,CAAC;IACb;IACA,EAAE,CAAC,GAAG,EAAE;IACR,kDAAkD;IAClD,EAAE,OAAO,GAAG;IACZ,IAAM,IAAI,SAAS,aAAa,CAAC;IACjC,EAAE,IAAI,GAAG;IACT,EAAE,KAAK,GAAG,IAAI;QAEV;IADJ,EAAE,GAAG,GACD,CAAA,IAAA,CAAA;QACI,aAAa,AAAC,6BAAmC,OAAP,QAAO;QACjD,YAAY,AAAC,2BAAiC,OAAP,QAAO;QAC9C,SAAS,AAAC,4BAAkC,OAAP,QAAO;IAChD,CAAA,CAAC,CAAC,wBAAA,yBAAA,cAAe,YAAY,CAAC,cAJ9B,eAAA,IAIkC,AAAC,2BAAiC,OAAP,QAAO,MAAI;IAC5E,SAAS,IAAI,CAAC,WAAW,CAAC;IAC1B,cAAc,GAAG,CAAC;AACtB;AACA,IAAM,gBAAgB,SAAhB,cAA0B,CAAC,EAAkB;IAAhB,IAAA,IAAA,OAAA,UAAA,QAAA,AAAG,cAAH,UAAA,OAAA,IAAA,OAAA,KAAc,GAAd,OAAA,GAAA,OAAA,MAAA,OAAA;QAAG,YAAH,OAAA,KAAA,SAAA,CAAA,KAAc;IAAD;QAY5C;IAXA,IAAI,CAAC,cAAc,GAAG,CAAC,IAAI;QACvB,IAAI,WAAW,CAAC,EAAE,KAAK,QAAQ;YAC3B,IAAM,SAAS,WAAW,CAAC,EAAE;YAC7B,IAAI,CAAC,CAAA,mBAAA,oBAAA,KAAA,IAAA,OAAQ,MAAK,AAAC,GACf,MAAM,IAAI,MAAM,yBAAyB;YAC7C,QAAQ,GAAG,OAAO,MAAM;QAC5B,OACK;YACD,MAAM,IAAI,MAAM,yBAAyB;QAC7C,CAAC;IACL,CAAC;IACD,CAAA,KAAA,GAAE,OAAO,CAAT,MAAA,IAAU,mBAAG;AACjB;AACA,OAAO,IAAM,aAAa,SAAb,WAAuB,CAAC,EAAE;IACnC,OAAO,WAAoB;yCAAhB;YAAA;;QACP,cAAA,MAAA,KAAA,GAAA;YAAc;SAAkB,CAAhC,OAAiB,mBAAG;IACxB;AACJ,EAAE;AACF,IAAM,WAAW,WAAW;AAC5B,eAAe,SAAS","file":"index.js","sourcesContent":["const loadedWindows = new WeakSet();\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 = 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 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 }\n else {\n throw new Error(\"Upscope is not loaded\");\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
@@ -3,5 +3,5 @@
3
3
  "main": "index.js",
4
4
  "type": "module",
5
5
  "dependencies": {},
6
- "version": "2025.12.5"
6
+ "version": "2025.12.6"
7
7
  }