@upscopeio/sdk 2026.1.12 → 2026.6.15

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.d.ts CHANGED
@@ -4,6 +4,7 @@ type CobrowsingSdkConfiguration = {
4
4
  callName?: string;
5
5
  jsConfiguration?: boolean;
6
6
  secretKey?: string;
7
+ sharingRoot: Window;
7
8
 
8
9
  // User provided nulls clear, undefined maintain existing info
9
10
  identities?: null | string | string[];
@@ -13,15 +14,15 @@ type CobrowsingSdkConfiguration = {
13
14
  uniqueId?: null | string;
14
15
 
15
16
  // Automatic
16
- agentRequestAcceptedText: string;
17
+ agentRequestAcceptedText: LocalizedMessage;
17
18
  agentRequestButtonPages: string[];
18
- agentRequestButtonRequestingSubtitle: string;
19
- agentRequestButtonRequestingTitle: string;
19
+ agentRequestButtonRequestingSubtitle: LocalizedMessage;
20
+ agentRequestButtonRequestingTitle: LocalizedMessage;
20
21
  agentRequestButtonStyle: string;
21
- agentRequestButtonSubtitle: string;
22
- agentRequestButtonTitle: string;
23
- agentRequestNotAvailableText: string;
24
- agentRequestResultTitle: string;
22
+ agentRequestButtonSubtitle: LocalizedMessage;
23
+ agentRequestButtonTitle: LocalizedMessage;
24
+ agentRequestNotAvailableText: LocalizedMessage;
25
+ agentRequestResultTitle: LocalizedMessage;
25
26
  allowAgentRedirect: boolean;
26
27
  allowFullScreen: boolean;
27
28
  allowRemoteClick: boolean;
@@ -31,28 +32,33 @@ type CobrowsingSdkConfiguration = {
31
32
  allowRemoteType: boolean;
32
33
  allowRequestFullTab: boolean;
33
34
  apiKey: string;
34
- authorizationPromptMessage: string;
35
- authorizationPromptTitle: string;
35
+ authorizationPromptMessage: LocalizedMessage;
36
+ authorizationPromptTitle: LocalizedMessage;
36
37
  autoconnect: boolean;
37
38
  automaticallyRequestFullTab: boolean;
38
39
  beta: boolean;
39
- callAudioAuthorizationFailedMessage: string;
40
- callAudioAuthorizationFailedTitle: string;
41
- callPopupFailedMessage: string;
42
- callPopupFailedTitle: string;
43
- callPopupNoInputMessage: string;
44
- callPopupNoInputTitle: string;
45
- callPopupNoOutputMessage: string;
46
- callPopupNoOutputTitle: string;
47
- callPromptText: string;
40
+ callAudioAuthorizationFailedMessage: LocalizedMessage;
41
+ callAudioAuthorizationFailedTitle: LocalizedMessage;
42
+ callPopupFailedMessage: LocalizedMessage;
43
+ callPopupFailedTitle: LocalizedMessage;
44
+ callPopupNoInputMessage: LocalizedMessage;
45
+ callPopupNoInputTitle: LocalizedMessage;
46
+ callPopupNoOutputMessage: LocalizedMessage;
47
+ callPopupNoOutputTitle: LocalizedMessage;
48
+ callPopupNoVideoInputMessage: LocalizedMessage;
49
+ callPopupNoVideoInputTitle: LocalizedMessage;
50
+ callPromptText: LocalizedMessage;
48
51
  callRingtone: string;
49
- callWaitMessage: string;
52
+ callVideoAuthorizationFailedMessage: LocalizedMessage;
53
+ callVideoAuthorizationFailedTitle: LocalizedMessage;
54
+ callVideoRequestButton: LocalizedMessage;
55
+ callWaitMessage: LocalizedMessage;
50
56
  collectHistory: boolean;
51
57
  compressImages: boolean;
52
58
  computedStyleSelectors: "angular" | "react" | string[];
53
59
  consoleAllowed: boolean;
54
- controlRequestMessage: string;
55
- controlRequestTitle: string;
60
+ controlRequestMessage: LocalizedMessage;
61
+ controlRequestTitle: LocalizedMessage;
56
62
  cssFile: string;
57
63
  cursorColor: string;
58
64
  customCallController: ((callback: (accepted: boolean) => void) => (() => void) | void) | null;
@@ -66,11 +72,10 @@ type CobrowsingSdkConfiguration = {
66
72
  enableCanvases: boolean;
67
73
  enableLookupCodeOnKey: boolean;
68
74
  enableSessionRating: boolean;
69
- enableSessionRating: boolean;
70
75
  endOfScreenshareMessage: null | string;
71
76
  enlargeCursor: boolean;
72
- fullScreenRequestMessage: string;
73
- fullScreenRequestTitle: string;
77
+ fullScreenRequestMessage: LocalizedMessage;
78
+ fullScreenRequestTitle: LocalizedMessage;
74
79
  grabIdentityFromLivechat: boolean;
75
80
  ignoreBrowserSupport: boolean;
76
81
  injectLookupCodeButton: boolean;
@@ -81,9 +86,9 @@ type CobrowsingSdkConfiguration = {
81
86
  lookupCodeButtonStyle: string;
82
87
  lookupCodeElement: HTMLElement | null | string;
83
88
  lookupCodeKey: number;
84
- lookupCodeKeyMessage: string;
89
+ lookupCodeKeyMessage: LocalizedMessage;
85
90
  lookupCodeKeyRepetitions: number;
86
- lookupCodeKeyTitle: string;
91
+ lookupCodeKeyTitle: LocalizedMessage;
87
92
  maskedElements: string[];
88
93
  maskElementMiddleware: (element: HTMLElement) => boolean;
89
94
  noRemoteElements: string[];
@@ -95,7 +100,10 @@ type CobrowsingSdkConfiguration = {
95
100
  onWaitingForCall: () => void;
96
101
  pageviewsEndpoint: string;
97
102
  phoneEndpoint: string;
103
+ videoCallPromptText: LocalizedMessage;
98
104
  // Automatic
105
+ cobrowsingVideoAudioRelationship: "automatic" | "independent" | "video_requires_audio";
106
+ cobrowsingVideoEnabled: "disabled" | "two_way" | "viewer_to_visitor" | "visitor_to_viewer";
99
107
  product: "cobrowsingapi" | "helloscreen" | "userview";
100
108
  proxyAssets: string[];
101
109
  publicLinkOrigin: null | string;
@@ -105,12 +113,12 @@ type CobrowsingSdkConfiguration = {
105
113
  requireControlRequest: boolean;
106
114
  rewriteExternalLinks: boolean;
107
115
  screenWakeLock: boolean;
108
- sessionRatingAgentLabel: string;
109
- sessionRatingFeedbackLabel: string;
110
- sessionRatingModalMessage: string;
111
- sessionRatingModalTitle: string;
112
- sessionRatingSessionLabel: string;
113
- sessionRatingSubmitLabel: string;
116
+ sessionRatingAgentLabel: LocalizedMessage;
117
+ sessionRatingFeedbackLabel: LocalizedMessage;
118
+ sessionRatingModalMessage: LocalizedMessage;
119
+ sessionRatingModalTitle: LocalizedMessage;
120
+ sessionRatingSessionLabel: LocalizedMessage;
121
+ sessionRatingSubmitLabel: LocalizedMessage;
114
122
  sfdcFieldId: string;
115
123
  sfdcFieldLabel: string;
116
124
  shouldComputeStyleMiddleware: (element: HTMLElement) => boolean;
@@ -121,10 +129,10 @@ type CobrowsingSdkConfiguration = {
121
129
  storageKey: null | string;
122
130
  styleSheetContentFromRules: (stylesheet: HTMLLinkElement | HTMLStyleElement) => boolean;
123
131
  trackConsole: boolean;
124
- translationsNo: string;
125
- translationsOk: string;
126
- translationsStopSession: string;
127
- translationsYes: string;
132
+ translationsNo: LocalizedMessage;
133
+ translationsOk: LocalizedMessage;
134
+ translationsStopSession: LocalizedMessage;
135
+ translationsYes: LocalizedMessage;
128
136
  unavailableAgentRequestRedirectImmediately: boolean;
129
137
  unavailableAgentRequestRedirectTo: null | string;
130
138
  useFingerprinting: boolean;
@@ -133,10 +141,15 @@ type CobrowsingSdkConfiguration = {
133
141
  };
134
142
 
135
143
  type Instruction =
144
+ | ["beginViewerVideoCall"]
145
+ | ["beginVisitorVideoCall"]
136
146
  | ["cancelRequestAgent"]
137
147
  | ["connect"]
138
148
  | ["customMessage", Record<string, unknown>]
139
149
  | ["dataBounce", (ms: number) => void]
150
+ | ["endAudio"]
151
+ | ["endViewerVideoCall"]
152
+ | ["endVisitorVideoCall"]
140
153
  | ["expectDisconnect", Partial<{ message: null | string; returnTimeSeconds: null | number; title: null | string }>]
141
154
  | ["fullTabEnd"]
142
155
  | ["fullTabStart"]
@@ -151,9 +164,20 @@ type Instruction =
151
164
  | ["on", ...(keyof SDKEvents)[], (event: any) => void] // eslint-disable-line @typescript-eslint/no-explicit-any
152
165
  | ["prefetchAssets"]
153
166
  | ["requestAgent"]
167
+ | [
168
+ "requestMode",
169
+ (
170
+ | "visitor_app"
171
+ | "visitor_browser"
172
+ | `viewer_screen:${"*" | `cobrowsing_viewer_connection_${string}`}`
173
+ | `visitor_screen:${"*" | `cobrowsing_visitor_connection_${string}`}`
174
+ ),
175
+ ]
154
176
  | ["reset", boolean]
155
177
  | ["reset"]
156
178
  | ["saveHistory"]
179
+ | ["shutdown"]
180
+ | ["startAudio"]
157
181
  | ["stopSession"]
158
182
  | [
159
183
  "submitRating",
@@ -163,32 +187,28 @@ type Instruction =
163
187
  userSessionRating?: number;
164
188
  },
165
189
  ]
190
+ | ["triggerConfetti", null | string]
166
191
  | ["updateConnection", Partial<CobrowsingSdkConfiguration>];
167
192
 
168
- type Observer = {
169
- hasFocus: boolean;
170
- id: string;
171
- name: null | string;
172
- screenHeight: number;
173
- screenWidth: number;
174
- windowHeight: number;
175
- windowWidth: number;
176
- };
193
+ type LocalizedMessage = Record<string, string> | string;
177
194
 
178
195
  type SDKEvents = {
179
196
  agentRequestUpdate: ["accepted" | "canceled" | "pending" | "unavailable"];
180
197
  agentsAvailable: undefined;
181
- callAccepted: undefined;
182
- callEnd: undefined;
183
- callStart: undefined;
198
+ audioCallAccepted: undefined;
199
+ audioCallEnd: undefined;
200
+ audioCallStart: undefined;
184
201
  connection: undefined;
185
202
  connectionReset: undefined;
186
- customMessage: [{ observer: string } | { visitor: string }, Record<string, unknown>];
187
- newObserver: [string, Observer];
188
- observerContentVisible: [string];
189
- observerGone: [string];
203
+ customMessage: [
204
+ { observer: `cobrowsing_viewer_connection_${string}` } | { visitor: `cobrowsing_visitor_connection_${string}` },
205
+ Record<string, unknown>,
206
+ ];
207
+ newObserver: [`cobrowsing_viewer_connection_${string}`, Viewer];
208
+ observerContentVisible: [`cobrowsing_viewer_connection_${string}`];
209
+ observerGone: [`cobrowsing_viewer_connection_${string}`];
190
210
  observersCount: [number];
191
- observerUpdate: [string, Partial<Observer>];
211
+ observerUpdate: [`cobrowsing_viewer_connection_${string}`, Partial<Viewer>];
192
212
  sessionContinue: undefined;
193
213
  sessionEnd: undefined;
194
214
  sessionRequest: undefined;
@@ -212,4 +232,19 @@ type UpscopeStorageImplementation = {
212
232
  setItem: (key: string, value: string) => Promise<void> | void;
213
233
  };
214
234
 
235
+ type Viewer = {
236
+ audioStatus: "accepted" | "active" | "authorizing" | "off" | "ringing";
237
+ audioSupported: boolean;
238
+ connectionId: `cobrowsing_viewer_connection_${string}`;
239
+ externalId: "__UNKNOWN_ONPREM_EXTERNAL_VIEWER_ID__" | "__UNTRACKED__" | `ea_${string}` | `u_${string}`;
240
+ hasFocus: boolean;
241
+ keepsSessionAlive: boolean;
242
+ name: null | string;
243
+ screenHeight: number;
244
+ screenScale: number;
245
+ screenWidth: number;
246
+ windowHeight: number;
247
+ windowWidth: number;
248
+ };
249
+
215
250
  export default function Upscope(...instruction: Instruction): void;
package/index.js CHANGED
@@ -23,14 +23,10 @@ function _unsupportedIterableToArray(o, minLen) {
23
23
  if (n === "Map" || n === "Set") return Array.from(n);
24
24
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
25
25
  }
26
- var loadedWindows = new WeakSet();
27
26
  var pendingInstructionsMap = new WeakMap();
28
27
  var environment = window.__upscope__sdk__load__environment;
29
28
  function loadSDK(w, apiKey) {
30
- if (typeof w.Upscope !== "undefined") {
31
- loadedWindows.add(w);
32
- return;
33
- }
29
+ if (typeof w.Upscope !== "undefined") return;
34
30
  var i = function i1() {
35
31
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
36
32
  args[_key] = arguments[_key];
@@ -50,14 +46,15 @@ function loadSDK(w, apiKey) {
50
46
  staging: "https://code.upscope.xyz/".concat(apiKey, ".js")
51
47
  })[environment !== null && environment !== void 0 ? environment : "production"]) !== null && _ !== void 0 ? _ : "https://code.upscope.io/".concat(apiKey, ".js");
52
48
  w.document.head.appendChild(s);
53
- loadedWindows.add(w);
54
49
  }
50
+ // "Loaded" is keyed off window.Upscope existing. Upscope("shutdown") deletes it,
51
+ // so the next "init" reloads the account script for whatever apiKey is passed.
55
52
  var ScopedUpscope = function ScopedUpscope(w) {
56
53
  for(var _len = arguments.length, instruction = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
57
54
  instruction[_key - 1] = arguments[_key];
58
55
  }
59
56
  var _w;
60
- if (!loadedWindows.has(w)) {
57
+ if (typeof w.Upscope === "undefined") {
61
58
  if (instruction[0] === "init") {
62
59
  var config = instruction[1];
63
60
  if (!(config === null || config === void 0 ? void 0 : config.apiKey)) throw new Error("API key not specified");
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,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,EAAE,QAAQ,CAAC,aAAa,CAAC;IACnC,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,EAAE,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC;IAC5B,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;QAuB5C;IAtBA,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;YACxB,IAAM,sBAAsB,uBAAuB,GAAG,CAAC;YACvD,IAAI,qBAAqB;gBACrB,uBAAuB,MAAM,CAAC;gBAC9B,oBAAoB,OAAO,CAAC,SAAC,aAAgB;wBACzC;oBAAA,CAAA,KAAA,GAAE,OAAO,CAAT,MAAA,IAAU,mBAAG;gBACjB;YACJ,CAAC;QACL,OACK,IAAI,WAAW,CAAC,EAAE,KAAK,MAAM;gBACK;YAAnC,uBAAuB,GAAG,CAAC,GAAG,AAAC,mBAAI,CAAA,8BAAA,uBAAuB,GAAG,CAAC,gBAA3B,yCAAA,8BAAiC,EAAE,SAAxC;gBAA2C;aAAY;YACrF;QACJ,OACK;YACD,MAAM,IAAI,MAAM,wEAAwE;QAC5F,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 pendingInstructionsMap = 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"]}
1
+ {"version":3,"sources":["index.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAM,yBAAyB,IAAI;AACnC,IAAM,cAAc,OAAO,iCAAiC;AAC5D,SAAS,QAAQ,CAAC,EAAE,MAAM,EAAE;IACxB,IAAI,OAAO,EAAE,OAAO,KAAK,aACrB;IACJ,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,EAAE,QAAQ,CAAC,aAAa,CAAC;IACnC,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,EAAE,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC;AAChC;AACA,iFAAiF;AACjF,+EAA+E;AAC/E,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;QAuB5C;IAtBA,IAAI,OAAO,EAAE,OAAO,KAAK,aAAa;QAClC,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;YACxB,IAAM,sBAAsB,uBAAuB,GAAG,CAAC;YACvD,IAAI,qBAAqB;gBACrB,uBAAuB,MAAM,CAAC;gBAC9B,oBAAoB,OAAO,CAAC,SAAC,aAAgB;wBACzC;oBAAA,CAAA,KAAA,GAAE,OAAO,CAAT,MAAA,IAAU,mBAAG;gBACjB;YACJ,CAAC;QACL,OACK,IAAI,WAAW,CAAC,EAAE,KAAK,MAAM;gBACK;YAAnC,uBAAuB,GAAG,CAAC,GAAG,AAAC,mBAAI,CAAA,8BAAA,uBAAuB,GAAG,CAAC,gBAA3B,yCAAA,8BAAiC,EAAE,SAAxC;gBAA2C;aAAY;YACrF;QACJ,OACK;YACD,MAAM,IAAI,MAAM,wEAAwE;QAC5F,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 pendingInstructionsMap = new WeakMap();\nconst environment = window.__upscope__sdk__load__environment;\nfunction loadSDK(w, apiKey) {\n if (typeof w.Upscope !== \"undefined\")\n return;\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}\n// \"Loaded\" is keyed off window.Upscope existing. Upscope(\"shutdown\") deletes it,\n// so the next \"init\" reloads the account script for whatever apiKey is passed.\nconst ScopedUpscope = function (w, ...instruction) {\n if (typeof w.Upscope === \"undefined\") {\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
@@ -2,6 +2,10 @@
2
2
  "name": "@upscopeio/sdk",
3
3
  "main": "index.js",
4
4
  "type": "module",
5
+ "publishConfig": {
6
+ "registry": "https://registry.npmjs.org",
7
+ "access": "public"
8
+ },
5
9
  "dependencies": {},
6
- "version": "2026.1.12"
7
- }
10
+ "version": "2026.6.15"
11
+ }