@upscopeio/sdk 2025.1.5 → 2025.1.13

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,14 @@ type SubmitRating = {
4
4
  userAgentFeedback?: string;
5
5
  };
6
6
 
7
+ type UpscopeStorageImplementation = {
8
+ clear(): void | Promise<void>;
9
+ getItem(key: string): string | null | Promise<string | null>;
10
+ key(index: number): string | null | Promise<string | null>;
11
+ removeItem(key: string): void | Promise<void>;
12
+ setItem(key: string, value: string): void | Promise<void>;
13
+ };
14
+
7
15
  type CobrowsingSdkConfiguration = {
8
16
  jsConfiguration?: boolean;
9
17
  uniqueId?: null | string;
@@ -12,6 +20,7 @@ type CobrowsingSdkConfiguration = {
12
20
  integrationIds?: null | string | string[];
13
21
  agentPrompt?: string;
14
22
  callName?: string;
23
+ secretKey?: string;
15
24
 
16
25
  // Automatic
17
26
  version: string;
@@ -23,7 +32,8 @@ type CobrowsingSdkConfiguration = {
23
32
  pageviewsEndpoint: string;
24
33
  phoneEndpoint: string;
25
34
  javascriptEndpoint: string;
26
- storageImplementation: null | Storage;
35
+ storageImplementation: null | UpscopeStorageImplementation;
36
+ storageKey: string | null;
27
37
  requireAuthorizationForSession: boolean;
28
38
  integrateWithLivechat: boolean;
29
39
  liveChatRewrite: boolean;
@@ -111,6 +121,7 @@ type CobrowsingSdkConfiguration = {
111
121
  noRemoteElements: string[];
112
122
  allowRemoteMiddleware: (element: HTMLElement) => boolean;
113
123
  styleSheetContentFromRules: (stylesheet: HTMLLinkElement | HTMLStyleElement) => boolean;
124
+ publicLinkOrigin: string | null;
114
125
  };
115
126
 
116
127
  type SDKEvents = {
@@ -166,6 +177,7 @@ type Instruction =
166
177
  userAgentFeedback?: string;
167
178
  },
168
179
  ]
180
+ | ["getPublicLink", { agentId: string; agentName: string }, (publicLink: string) => void]
169
181
  | ["updateConnection", Partial<CobrowsingSdkConfiguration>];
170
182
 
171
183
  type Upscope = (...instruction: Instruction) => void;
package/index.js CHANGED
@@ -53,9 +53,7 @@ var _Upscope = function _Upscope() {
53
53
  if (!loaded) {
54
54
  if (instruction[0] === "init") {
55
55
  var config = instruction[1];
56
- if (!(config === null || config === void 0 ? void 0 : config.apiKey)) {
57
- throw new Error("API key not specified");
58
- }
56
+ if (!(config === null || config === void 0 ? void 0 : config.apiKey)) throw new Error("API key not specified");
59
57
  loadSDK(config.apiKey);
60
58
  } else {
61
59
  throw new Error("Upscope is not loaded");
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["index.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAI,SAAS,KAAK;AAClB,SAAS,QAAQ,MAAM,EAAE;IACrB,IAAI,OAAO,OAAO,OAAO,KAAK,aAAa;QACvC,SAAS,IAAI;QACb;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,OAAO,OAAO,GAAG;IACjB,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,SAAS,IAAI;AACjB;AACA,IAAM,WAAW,SAAX,WAAqC;IAAhB,IAAA,IAAA,OAAA,UAAA,QAAA,AAAG,cAAH,UAAA,OAAA,OAAA,GAAA,OAAA,MAAA,OAAA;QAAG,YAAH,QAAA,SAAA,CAAA,KAAc;IAAD;QAa7B;IAZP,IAAI,CAAC,QAAQ;QACT,IAAI,WAAW,CAAC,EAAE,KAAK,QAAQ;YAC3B,IAAM,SAAS,WAAW,CAAC,EAAE;YAC7B,IAAI,CAAC,CAAA,mBAAA,oBAAA,KAAA,IAAA,OAAQ,MAAK,AAAC,GAAE;gBACjB,MAAM,IAAI,MAAM,yBAAyB;YAC7C,CAAC;YACD,QAAQ,OAAO,MAAM;QACzB,OACK;YACD,MAAM,IAAI,MAAM,yBAAyB;QAC7C,CAAC;IACL,CAAC;IACD,OAAO,CAAA,UAAA,QAAO,OAAO,CAAd,MAAA,SAAe,mBAAG;AAC7B;AACA,eAAe,SAAS","file":"index.js","sourcesContent":["let loaded = false;\nfunction loadSDK(apiKey) {\n if (typeof window.Upscope !== \"undefined\") {\n loaded = true;\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 window.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 loaded = true;\n}\nconst _Upscope = function (...instruction) {\n if (!loaded) {\n if (instruction[0] === \"init\") {\n const config = instruction[1];\n if (!config?.apiKey) {\n throw new Error(\"API key not specified\");\n }\n loadSDK(config.apiKey);\n }\n else {\n throw new Error(\"Upscope is not loaded\");\n }\n }\n return window.Upscope(...instruction);\n};\nexport default _Upscope;\n"]}
1
+ {"version":3,"sources":["index.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAI,SAAS,KAAK;AAClB,SAAS,QAAQ,MAAM,EAAE;IACrB,IAAI,OAAO,OAAO,OAAO,KAAK,aAAa;QACvC,SAAS,IAAI;QACb;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,OAAO,OAAO,GAAG;IACjB,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,SAAS,IAAI;AACjB;AACA,IAAM,WAAW,SAAX,WAAqC;IAAhB,IAAA,IAAA,OAAA,UAAA,QAAA,AAAG,cAAH,UAAA,OAAA,OAAA,GAAA,OAAA,MAAA,OAAA;QAAG,YAAH,QAAA,SAAA,CAAA,KAAc;IAAD;QAY7B;IAXP,IAAI,CAAC,QAAQ;QACT,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,OAAO,MAAM;QACzB,OACK;YACD,MAAM,IAAI,MAAM,yBAAyB;QAC7C,CAAC;IACL,CAAC;IACD,OAAO,CAAA,UAAA,QAAO,OAAO,CAAd,MAAA,SAAe,mBAAG;AAC7B;AACA,eAAe,SAAS","file":"index.js","sourcesContent":["let loaded = false;\nfunction loadSDK(apiKey) {\n if (typeof window.Upscope !== \"undefined\") {\n loaded = true;\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 window.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 loaded = true;\n}\nconst _Upscope = function (...instruction) {\n if (!loaded) {\n if (instruction[0] === \"init\") {\n const config = instruction[1];\n if (!config?.apiKey)\n throw new Error(\"API key not specified\");\n loadSDK(config.apiKey);\n }\n else {\n throw new Error(\"Upscope is not loaded\");\n }\n }\n return window.Upscope(...instruction);\n};\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.1.5"
6
+ "version": "2025.1.13"
7
7
  }