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