@upscopeio/react 2025.10.9 → 2025.11.10

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/sdk.d.ts +161 -152
package/package.json CHANGED
@@ -9,5 +9,5 @@
9
9
  "react": ">=16.2.0",
10
10
  "react-dom": ">=16.2.0"
11
11
  },
12
- "version": "2025.10.9"
12
+ "version": "2025.11.10"
13
13
  }
package/sdk.d.ts CHANGED
@@ -1,201 +1,210 @@
1
- type SubmitRating = {
2
- userSessionRating?: number;
3
- userAgentRating?: number;
4
- userAgentFeedback?: string;
5
- };
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
-
15
1
  type CobrowsingSdkConfiguration = {
2
+ // User provided
3
+ agentPrompt?: string;
4
+ callName?: string;
16
5
  jsConfiguration?: boolean;
17
- uniqueId?: null | string;
6
+ secretKey?: string;
7
+
8
+ // User provided nulls clear, undefined maintain existing info
18
9
  identities?: null | string | string[];
19
- tags?: null | string | string[];
20
10
  integrationIds?: null | string | string[];
21
11
  metadata?: null | Record<string, string>;
22
- agentPrompt?: string;
23
- callName?: string;
24
- secretKey?: string;
12
+ tags?: null | string | string[];
13
+ uniqueId?: null | string;
25
14
 
26
15
  // Automatic
27
- product: "helloscreen" | "userview" | "cobrowsingapi";
28
- version: string;
29
- apiKey: string;
30
- beta: boolean;
31
- region: string | null;
32
- readonly regionWhitelist: string[] | null;
33
- dataEndpoint: string;
34
- pageviewsEndpoint: string;
35
- phoneEndpoint: string;
36
- javascriptEndpoint: string;
37
- storageImplementation: null | UpscopeStorageImplementation;
38
- storageKey: string | null;
39
- requireAuthorizationForSession: boolean;
40
- integrateWithLivechat: boolean;
41
- liveChatRewrite: boolean;
42
- grabIdentityFromLivechat: boolean;
43
- showUpscopeLink: boolean;
44
- cursorColor: string;
45
- enlargeCursor: boolean;
46
- showTerminateButton: boolean;
47
- screenWakeLock: boolean;
48
- useFingerprinting: boolean;
49
- autoconnect: boolean;
50
- trackConsole: boolean;
51
- allowRemoteConsole: boolean;
16
+ agentRequestAcceptedText: string;
17
+ agentRequestButtonPages: string[];
18
+ agentRequestButtonRequestingSubtitle: string;
19
+ agentRequestButtonRequestingTitle: string;
20
+ agentRequestButtonStyle: string;
21
+ agentRequestButtonSubtitle: string;
22
+ agentRequestButtonTitle: string;
23
+ agentRequestNotAvailableText: string;
24
+ agentRequestResultTitle: string;
25
+ allowAgentRedirect: boolean;
26
+ allowFullScreen: boolean;
52
27
  allowRemoteClick: boolean;
28
+ allowRemoteConsole: boolean;
29
+ allowRemoteMiddleware: (element: HTMLElement) => boolean;
53
30
  allowRemoteScroll: boolean;
54
31
  allowRemoteType: boolean;
55
- allowAgentRedirect: boolean;
56
- allowFullScreen: boolean;
57
- enableSessionRating: boolean;
58
- requireControlRequest: boolean;
59
- rewriteExternalLinks: boolean;
32
+ allowRequestFullTab: boolean;
33
+ apiKey: string;
34
+ authorizationPromptMessage: string;
35
+ authorizationPromptTitle: string;
36
+ autoconnect: boolean;
37
+ automaticallyRequestFullTab: boolean;
38
+ 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;
48
+ callRingtone: string;
49
+ callWaitMessage: string;
60
50
  collectHistory: boolean;
51
+ computedStyleSelectors: "angular" | "react" | string[];
61
52
  consoleAllowed: boolean;
53
+ controlRequestMessage: string;
54
+ controlRequestTitle: string;
55
+ cssFile: string;
56
+ cursorColor: string;
57
+ customCallController: ((callback: (accepted: boolean) => void) => (() => void) | void) | null;
58
+ customControlRequestController: ((callback: (accepted: boolean) => void) => (() => void) | void) | null;
59
+ customFullScreenRequestController: ((callback: (accepted: boolean) => void) => (() => void) | void) | null;
60
+ dataEndpoint: string;
61
+ disableFullScreenWhenMasked: boolean;
62
+ disconnectAfterSeconds: number;
63
+ domChangesDelay: number;
62
64
  drawingsTtlMs: number;
65
+ enableCanvases: boolean;
63
66
  enableLookupCodeOnKey: boolean;
64
- lookupCodeKey: number;
65
- lookupCodeKeyRepetitions: number;
66
- lookupCodeKeyTitle: string;
67
- lookupCodeKeyMessage: string;
68
- lookupCodeElement: null | HTMLElement | string;
67
+ enableSessionRating: boolean;
68
+ enableSessionRating: boolean;
69
+ endOfScreenshareMessage: null | string;
70
+ enlargeCursor: boolean;
71
+ fullScreenRequestMessage: string;
72
+ fullScreenRequestTitle: string;
73
+ grabIdentityFromLivechat: boolean;
74
+ ignoreBrowserSupport: boolean;
69
75
  injectLookupCodeButton: boolean;
76
+ integrateWithLivechat: boolean;
77
+ javascriptEndpoint: string;
78
+ liveChatRewrite: boolean;
70
79
  lookupCodeButtonPages: string[];
71
80
  lookupCodeButtonStyle: string;
72
- disconnectAfterSeconds: number;
73
- proxyAssets: string[];
81
+ lookupCodeElement: HTMLElement | null | string;
82
+ lookupCodeKey: number;
83
+ lookupCodeKeyMessage: string;
84
+ lookupCodeKeyRepetitions: number;
85
+ lookupCodeKeyTitle: string;
74
86
  maskedElements: string[];
75
- domChangesDelay: number;
76
- ignoreBrowserSupport: boolean;
77
- enableCanvases: boolean;
78
- customCallController: null | ((callback: (accepted: boolean) => void) => void | (() => void));
79
- customControlRequestController: null | ((callback: (accepted: boolean) => void) => void | (() => void));
80
- customFullScreenRequestController: null | ((callback: (accepted: boolean) => void) => void | (() => void));
81
- controlRequestTitle: string;
82
- controlRequestMessage: string;
83
- enableSessionRating: boolean;
84
- sessionRatingModalTitle: string;
85
- sessionRatingModalMessage: string;
86
- sessionRatingSessionLabel: string;
87
+ maskElementMiddleware: (element: HTMLElement) => boolean;
88
+ noRemoteElements: string[];
89
+ onConnection: (() => void) | null;
90
+ onSessionContinue: () => void;
91
+ onSessionEnd: () => void;
92
+ onSessionRequest: (cb: (accepted: boolean) => void, requestingAgent: null | string) => (() => void) | void;
93
+ onSessionStart: () => void;
94
+ onWaitingForCall: () => void;
95
+ pageviewsEndpoint: string;
96
+ phoneEndpoint: string;
97
+ // Automatic
98
+ product: "cobrowsingapi" | "helloscreen" | "userview";
99
+ proxyAssets: string[];
100
+ publicLinkOrigin: null | string;
101
+ region: null | string;
102
+ readonly regionWhitelist: null | string[];
103
+ requireAuthorizationForSession: boolean;
104
+ requireControlRequest: boolean;
105
+ rewriteExternalLinks: boolean;
106
+ screenWakeLock: boolean;
87
107
  sessionRatingAgentLabel: string;
88
108
  sessionRatingFeedbackLabel: string;
109
+ sessionRatingModalMessage: string;
110
+ sessionRatingModalTitle: string;
111
+ sessionRatingSessionLabel: string;
89
112
  sessionRatingSubmitLabel: string;
90
- fullScreenRequestTitle: string;
91
- fullScreenRequestMessage: string;
92
- callPromptText: string;
93
- callRingtone: string;
94
- cssFile: string;
95
- useInlineCss: boolean;
96
- authorizationPromptTitle: string;
97
- authorizationPromptMessage: string;
98
- endOfScreenshareMessage: null | string;
99
- callWaitMessage: string;
100
- translationsYes: string;
113
+ sfdcFieldId: string;
114
+ sfdcFieldLabel: string;
115
+ shouldComputeStyleMiddleware: (element: HTMLElement) => boolean;
116
+ showAgentRequestButton: "always" | "never" | "when_available"; // One of: always / when_available / never
117
+ showTerminateButton: boolean;
118
+ showUpscopeLink: boolean;
119
+ storageImplementation: null | UpscopeStorageImplementation;
120
+ storageKey: null | string;
121
+ styleSheetContentFromRules: (stylesheet: HTMLLinkElement | HTMLStyleElement) => boolean;
122
+ trackConsole: boolean;
101
123
  translationsNo: string;
102
124
  translationsOk: string;
103
125
  translationsStopSession: string;
104
- agentRequestButtonStyle: string;
105
- agentRequestButtonTitle: string;
106
- agentRequestButtonSubtitle: string;
107
- agentRequestButtonRequestingTitle: string;
108
- agentRequestButtonRequestingSubtitle: string;
109
- agentRequestResultTitle: string;
110
- agentRequestNotAvailableText: string;
111
- agentRequestAcceptedText: string;
112
- showAgentRequestButton: "always" | "when_available" | "never"; // One of: always / when_available / never
113
- agentRequestButtonPages: string[];
114
- callPopupFailedTitle: string;
115
- callPopupFailedMessage: string;
116
- callPopupNoInputTitle: string;
117
- callPopupNoInputMessage: string;
118
- callPopupNoOutputTitle: string;
119
- callPopupNoOutputMessage: string;
120
- callAudioAuthorizationFailedTitle: string;
121
- callAudioAuthorizationFailedMessage: string;
126
+ translationsYes: string;
122
127
  unavailableAgentRequestRedirectImmediately: boolean;
123
128
  unavailableAgentRequestRedirectTo: null | string;
124
- sfdcFieldLabel: string;
125
- sfdcFieldId: string;
126
- onSessionRequest: (cb: (accepted: boolean) => void, requestingAgent: string | null) => void | (() => void);
127
- onSessionStart: () => void;
128
- onSessionEnd: () => void;
129
- onWaitingForCall: () => void;
130
- onSessionContinue: () => void;
131
- onConnection: null | (() => void);
132
- maskElementMiddleware: (element: HTMLElement) => boolean;
133
- noRemoteElements: string[];
134
- allowRemoteMiddleware: (element: HTMLElement) => boolean;
135
- computedStyleSelectors: string[] | "react" | "angular";
136
- shouldComputeStyleMiddleware: (element: HTMLElement) => boolean;
137
- styleSheetContentFromRules: (stylesheet: HTMLLinkElement | HTMLStyleElement) => boolean;
138
- publicLinkOrigin: string | null;
139
- };
140
-
141
- type SDKEvents = {
142
- connection: undefined;
143
- waitingForCall: undefined;
144
- sessionStart: undefined;
145
- callStart: undefined;
146
- callAccepted: undefined;
147
- agentRequestUpdate: ["pending" | "unavailable" | "canceled" | "accepted"];
148
- newObserver: [string, Observer];
149
- observerUpdate: [string, Partial<Observer>];
150
- observerGone: [string];
151
- observerContentVisible: [string];
152
- observersCount: [number];
153
- agentsAvailable: undefined;
154
- sessionContinue: undefined;
155
- sessionEnd: undefined;
156
- callEnd: undefined;
157
- connectionReset: undefined;
158
- sessionRequest: undefined;
159
- customMessage: [{ observer: string } | { visitor: string }, Record<string, any>];
160
- };
161
-
162
- type Observer = {
163
- name: string | null;
164
- id: string;
165
- screenWidth: number;
166
- screenHeight: number;
129
+ useFingerprinting: boolean;
130
+ useInlineCss: boolean;
131
+ version: string;
167
132
  };
168
133
 
169
134
  type Instruction =
170
- | ["init", Partial<Omit<CobrowsingSdkConfiguration, "apiKey">> & { apiKey: string }]
171
- | ["reset"]
172
- | ["connect"]
173
135
  | ["cancelRequestAgent"]
136
+ | ["connect"]
137
+ | ["customMessage", Record<string, unknown>]
138
+ | ["expectDisconnect", Partial<{ message: null | string; returnTimeSeconds: null | number; title: null | string }>]
139
+ | ["fullTabEnd"]
140
+ | ["fullTabStart"]
141
+ | ["getLookupCode", (code: string) => void]
142
+ | ["getPublicLink", { agentId: string; agentName: string }, (publicLink: string) => void]
174
143
  | ["getShortId", (shortId: string) => void]
175
144
  | ["getUserId", (shortId: string) => void] // Legacy version of getShortId
176
- | ["getLookupCode", (code: string) => void]
177
145
  | ["getWatchLink", (link: string) => void]
178
- | ["logEvent", "success" | "error" | "info" | "warn" | "contact", string]
146
+ | ["init", Partial<Omit<CobrowsingSdkConfiguration, "apiKey">> & { apiKey: string }]
147
+ | ["logEvent", "contact" | "error" | "info" | "success" | "warn", string]
179
148
  | ["newPageview"]
180
- | ["on", ...(keyof SDKEvents)[], (event: any) => void]
149
+ | ["on", ...(keyof SDKEvents)[], (event: any) => void] // eslint-disable-line @typescript-eslint/no-explicit-any
150
+ | ["prefetchAssets"]
181
151
  | ["requestAgent"]
182
152
  | ["reset", boolean]
153
+ | ["reset"]
183
154
  | ["saveHistory"]
184
155
  | ["stopSession"]
185
- | ["prefetchAssets"]
186
- | ["customMessage", Record<string, any>]
187
156
  | [
188
157
  "submitRating",
189
158
  {
190
- userSessionRating?: number;
191
- userAgentRating?: number;
192
159
  userAgentFeedback?: string;
160
+ userAgentRating?: number;
161
+ userSessionRating?: number;
193
162
  },
194
163
  ]
195
- | ["expectDisconnect", Partial<SessionClientMessage["expectDisconnect"]>]
196
- | ["getPublicLink", { agentId: string; agentName: string }, (publicLink: string) => void]
197
164
  | ["updateConnection", Partial<CobrowsingSdkConfiguration>];
198
165
 
166
+ type Observer = {
167
+ id: string;
168
+ name: null | string;
169
+ screenHeight: number;
170
+ screenWidth: number;
171
+ };
172
+
173
+ type SDKEvents = {
174
+ agentRequestUpdate: ["accepted" | "canceled" | "pending" | "unavailable"];
175
+ agentsAvailable: undefined;
176
+ callAccepted: undefined;
177
+ callEnd: undefined;
178
+ callStart: undefined;
179
+ connection: undefined;
180
+ connectionReset: undefined;
181
+ customMessage: [{ observer: string } | { visitor: string }, Record<string, unknown>];
182
+ newObserver: [string, Observer];
183
+ observerContentVisible: [string];
184
+ observerGone: [string];
185
+ observersCount: [number];
186
+ observerUpdate: [string, Partial<Observer>];
187
+ sessionContinue: undefined;
188
+ sessionEnd: undefined;
189
+ sessionRequest: undefined;
190
+ sessionStart: undefined;
191
+ waitingForCall: undefined;
192
+ };
193
+
194
+ type SubmitRating = {
195
+ userAgentFeedback?: string;
196
+ userAgentRating?: number;
197
+ userSessionRating?: number;
198
+ };
199
+
199
200
  type Upscope = (...instruction: Instruction) => void;
200
201
 
202
+ type UpscopeStorageImplementation = {
203
+ clear: () => Promise<void> | void;
204
+ getItem: (key: string) => null | Promise<null | string> | string;
205
+ key: (index: number) => null | Promise<null | string> | string;
206
+ removeItem: (key: string) => Promise<void> | void;
207
+ setItem: (key: string, value: string) => Promise<void> | void;
208
+ };
209
+
201
210
  export default function Upscope(...instruction: Instruction): void;