capacitor-gleap-plugin 19.0.0 → 19.1.0
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/CapacitorGleapPlugin.podspec +1 -1
- package/Package.swift +1 -1
- package/README.md +144 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/gleapplugins/capacitor/GleapPlugin.java +143 -0
- package/dist/docs.json +112 -0
- package/dist/esm/definitions.d.ts +66 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/logs/webViewLogs.d.ts +18 -2
- package/dist/esm/logs/webViewLogs.js +45 -7
- package/dist/esm/logs/webViewLogs.js.map +1 -1
- package/dist/esm/web.d.ts +16 -0
- package/dist/esm/web.js +29 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +74 -7
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +74 -7
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/GleapPlugin/GleapPlugin.swift +92 -0
- package/package.json +2 -2
package/Package.swift
CHANGED
|
@@ -16,7 +16,7 @@ let package = Package(
|
|
|
16
16
|
// Capacitor rewrites this to the app's Capacitor major version during `npx cap sync`.
|
|
17
17
|
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0"),
|
|
18
18
|
// Native Gleap iOS SDK, released together with this plugin (same version).
|
|
19
|
-
.package(url: "https://github.com/GleapSDK/Gleap-iOS-SDK.git", from: "19.
|
|
19
|
+
.package(url: "https://github.com/GleapSDK/Gleap-iOS-SDK.git", from: "19.1.0")
|
|
20
20
|
],
|
|
21
21
|
targets: [
|
|
22
22
|
.target(
|
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ The plugin needs Capacitor 7 or later and an iOS deployment target of **15.0** o
|
|
|
27
27
|
target 'App' do
|
|
28
28
|
capacitor_pods
|
|
29
29
|
# Add your Pods here
|
|
30
|
-
pod 'Gleap', :git => 'https://github.com/GleapSDK/Gleap-iOS-SDK.git', :tag => '19.
|
|
30
|
+
pod 'Gleap', :git => 'https://github.com/GleapSDK/Gleap-iOS-SDK.git', :tag => '19.1.0'
|
|
31
31
|
end
|
|
32
32
|
```
|
|
33
33
|
|
|
@@ -82,6 +82,30 @@ await Gleap.setColorScheme({ colorScheme: isDarkTheme ? "dark" : "light", darkBa
|
|
|
82
82
|
|
|
83
83
|
`setColorScheme` only takes effect when "Adapt to dark / light mode" is enabled in the Gleap dashboard; it then overrides the dashboard's color scheme. Before the first call the dashboard setting applies. In dark mode the widget uses the dark mode colors, logo, header image and composer glow set in the Gleap dashboard; without dark colors it keeps its normal colors. `lightBackgroundColor` / `darkBackgroundColor` override the background in light / dark mode. Can be called before or after `initialize`.
|
|
84
84
|
|
|
85
|
+
## Protected conversation files
|
|
86
|
+
|
|
87
|
+
With "Require authenticated file access" (Project settings → User identity), conversation files can only be opened by agents and by the verified customer the conversation belongs to. Identify the customer with a user hash (created on your server with the project's identity verification secret) on every app start:
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
await Gleap.identify({ userId: "user-1", userHash: userHash, email: "jane@example.com" });
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Email replies link attachments to your customer application URL with a `gleapFile` query parameter. If that URL opens your app (universal link / App Link), pass it to Gleap; the conversation opens once the customer is identified with a user hash:
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
import { App } from "@capacitor/app";
|
|
97
|
+
|
|
98
|
+
const launch = await App.getLaunchUrl();
|
|
99
|
+
if (launch?.url) {
|
|
100
|
+
await Gleap.openProtectedFileFromUrl({ url: launch.url });
|
|
101
|
+
}
|
|
102
|
+
App.addListener("appUrlOpen", ({ url }) => {
|
|
103
|
+
Gleap.openProtectedFileFromUrl({ url });
|
|
104
|
+
});
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
`openProtectedFileFromUrl` resolves `{ opened: false }` when the URL has no valid `gleapFile` parameter. On web the JavaScript SDK opens `?gleapFile=` links on page load by itself.
|
|
108
|
+
|
|
85
109
|
## API
|
|
86
110
|
|
|
87
111
|
<docgen-index>
|
|
@@ -107,11 +131,13 @@ await Gleap.setColorScheme({ colorScheme: isDarkTheme ? "dark" : "light", darkBa
|
|
|
107
131
|
* [`setNetworkLogPropsToIgnore(...)`](#setnetworklogpropstoignore)
|
|
108
132
|
* [`attachNetworkLogs(...)`](#attachnetworklogs)
|
|
109
133
|
* [`attachConsoleLogs(...)`](#attachconsolelogs)
|
|
134
|
+
* [`logsFlushed(...)`](#logsflushed)
|
|
110
135
|
* [`setEnvDataPropsToIgnore(...)`](#setenvdatapropstoignore)
|
|
111
136
|
* [`registerAgentTool(...)`](#registeragenttool)
|
|
112
137
|
* [`sendAgentToolResult(...)`](#sendagenttoolresult)
|
|
113
138
|
* [`addListener('agentToolExecution', ...)`](#addlisteneragenttoolexecution-)
|
|
114
139
|
* [`addListener('logConfigLoaded', ...)`](#addlistenerlogconfigloaded-)
|
|
140
|
+
* [`addListener('flushLogs', ...)`](#addlistenerflushlogs-)
|
|
115
141
|
* [`setTicketAttribute(...)`](#setticketattribute)
|
|
116
142
|
* [`unsetTicketAttribute(...)`](#unsetticketattribute)
|
|
117
143
|
* [`clearTicketAttributes()`](#clearticketattributes)
|
|
@@ -144,11 +170,14 @@ await Gleap.setColorScheme({ colorScheme: isDarkTheme ? "dark" : "light", darkBa
|
|
|
144
170
|
* [`startConversation(...)`](#startconversation)
|
|
145
171
|
* [`openConversation(...)`](#openconversation)
|
|
146
172
|
* [`openConversations(...)`](#openconversations)
|
|
173
|
+
* [`openProtectedFileFromUrl(...)`](#openprotectedfilefromurl)
|
|
147
174
|
* [`startBot(...)`](#startbot)
|
|
148
175
|
* [`showFeedbackButton(...)`](#showfeedbackbutton)
|
|
149
176
|
* [`setDisableInAppNotifications(...)`](#setdisableinappnotifications)
|
|
150
177
|
* [`setDisableEnvData(...)`](#setdisableenvdata)
|
|
151
178
|
* [`setColorScheme(...)`](#setcolorscheme)
|
|
179
|
+
* [`setCaptureEnabled(...)`](#setcaptureenabled)
|
|
180
|
+
* [`setRemoteLogCollectionEnabled(...)`](#setremotelogcollectionenabled)
|
|
152
181
|
* [`setLanguage(...)`](#setlanguage)
|
|
153
182
|
* [`disableConsoleLogOverwrite()`](#disableconsolelogoverwrite)
|
|
154
183
|
* [`enableDebugConsoleLog()`](#enabledebugconsolelog)
|
|
@@ -555,6 +584,25 @@ No-op on web, where the JavaScript SDK records the console itself.
|
|
|
555
584
|
--------------------
|
|
556
585
|
|
|
557
586
|
|
|
587
|
+
### logsFlushed(...)
|
|
588
|
+
|
|
589
|
+
```typescript
|
|
590
|
+
logsFlushed(options: { flushId: string; }) => Promise<void>
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
Answers a `flushLogs` event once the WebView console and network logs the plugin buffers were handed to the native
|
|
594
|
+
SDK, so it collects the logs for a capture request with them. The plugin calls this for you on iOS and Android.
|
|
595
|
+
No-op on web.
|
|
596
|
+
|
|
597
|
+
| Param | Type |
|
|
598
|
+
| ------------- | --------------------------------- |
|
|
599
|
+
| **`options`** | <code>{ flushId: string; }</code> |
|
|
600
|
+
|
|
601
|
+
**Since:** 19.1.0
|
|
602
|
+
|
|
603
|
+
--------------------
|
|
604
|
+
|
|
605
|
+
|
|
558
606
|
### setEnvDataPropsToIgnore(...)
|
|
559
607
|
|
|
560
608
|
```typescript
|
|
@@ -655,6 +703,28 @@ WebView log capture needs (network logs are only recorded when they are enabled
|
|
|
655
703
|
--------------------
|
|
656
704
|
|
|
657
705
|
|
|
706
|
+
### addListener('flushLogs', ...)
|
|
707
|
+
|
|
708
|
+
```typescript
|
|
709
|
+
addListener(eventName: 'flushLogs', listenerFunc: (data: { flushId: string; }) => void) => Promise<PluginListenerHandle>
|
|
710
|
+
```
|
|
711
|
+
|
|
712
|
+
Called on iOS and Android right before the native SDK collects the logs for a capture request: the plugin's
|
|
713
|
+
WebView log capture hands over what it buffers (it pushes at most every 500 ms otherwise) and answers with
|
|
714
|
+
`logsFlushed`. The native SDK waits at most 500 ms for the answer. The plugin listens for you.
|
|
715
|
+
|
|
716
|
+
| Param | Type |
|
|
717
|
+
| ------------------ | ---------------------------------------------------- |
|
|
718
|
+
| **`eventName`** | <code>'flushLogs'</code> |
|
|
719
|
+
| **`listenerFunc`** | <code>(data: { flushId: string; }) => void</code> |
|
|
720
|
+
|
|
721
|
+
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
722
|
+
|
|
723
|
+
**Since:** 19.1.0
|
|
724
|
+
|
|
725
|
+
--------------------
|
|
726
|
+
|
|
727
|
+
|
|
658
728
|
### setTicketAttribute(...)
|
|
659
729
|
|
|
660
730
|
```typescript
|
|
@@ -1237,6 +1307,32 @@ Opens the conversations tab (same as openConversation).
|
|
|
1237
1307
|
--------------------
|
|
1238
1308
|
|
|
1239
1309
|
|
|
1310
|
+
### openProtectedFileFromUrl(...)
|
|
1311
|
+
|
|
1312
|
+
```typescript
|
|
1313
|
+
openProtectedFileFromUrl(options: { url: string; }) => Promise<{ opened: boolean; }>
|
|
1314
|
+
```
|
|
1315
|
+
|
|
1316
|
+
Open the conversation of a protected file from an emailed link.
|
|
1317
|
+
With "Require authenticated file access" enabled, email replies link attachments to your customer
|
|
1318
|
+
application URL with a `gleapFile` query parameter. If that URL opens your app (for example as a
|
|
1319
|
+
universal link / App Link), pass it here, e.g. from `App.addListener('appUrlOpen')` or
|
|
1320
|
+
`App.getLaunchUrl()` of `@capacitor/app`. `opened` is true when the URL carries a Gleap file reference.
|
|
1321
|
+
The conversation opens once the customer is identified with a user hash (`identify` with `userHash`);
|
|
1322
|
+
the link alone grants nothing. On web the JavaScript SDK handles `?gleapFile=` automatically on page load,
|
|
1323
|
+
so this resolves `{ opened: false }` there.
|
|
1324
|
+
|
|
1325
|
+
| Param | Type |
|
|
1326
|
+
| ------------- | ----------------------------- |
|
|
1327
|
+
| **`options`** | <code>{ url: string; }</code> |
|
|
1328
|
+
|
|
1329
|
+
**Returns:** <code>Promise<{ opened: boolean; }></code>
|
|
1330
|
+
|
|
1331
|
+
**Since:** 19.0.1
|
|
1332
|
+
|
|
1333
|
+
--------------------
|
|
1334
|
+
|
|
1335
|
+
|
|
1240
1336
|
### startBot(...)
|
|
1241
1337
|
|
|
1242
1338
|
```typescript
|
|
@@ -1341,6 +1437,53 @@ Can be called before or after initialize and applies live.
|
|
|
1341
1437
|
--------------------
|
|
1342
1438
|
|
|
1343
1439
|
|
|
1440
|
+
### setCaptureEnabled(...)
|
|
1441
|
+
|
|
1442
|
+
```typescript
|
|
1443
|
+
setCaptureEnabled(options: { enabled: boolean; }) => Promise<{ captureEnabled: boolean; }>
|
|
1444
|
+
```
|
|
1445
|
+
|
|
1446
|
+
Enable or disable screenshots and screen recordings for capture requests: when a workflow, an AI agent or a
|
|
1447
|
+
teammate asks the user in the widget to show the issue, the widget steps aside, a small bar lets the user go to
|
|
1448
|
+
the right screen, and the SDK captures the app once they tap Capture (or records it between Start and Stop).
|
|
1449
|
+
Nothing is captured without that tap. While disabled, the widget only offers to upload a file.
|
|
1450
|
+
Enabled by default. Works on iOS, Android and web and can be called before or after initialize.
|
|
1451
|
+
|
|
1452
|
+
| Param | Type |
|
|
1453
|
+
| ------------- | ---------------------------------- |
|
|
1454
|
+
| **`options`** | <code>{ enabled: boolean; }</code> |
|
|
1455
|
+
|
|
1456
|
+
**Returns:** <code>Promise<{ captureEnabled: boolean; }></code>
|
|
1457
|
+
|
|
1458
|
+
**Since:** 19.1.0
|
|
1459
|
+
|
|
1460
|
+
--------------------
|
|
1461
|
+
|
|
1462
|
+
|
|
1463
|
+
### setRemoteLogCollectionEnabled(...)
|
|
1464
|
+
|
|
1465
|
+
```typescript
|
|
1466
|
+
setRemoteLogCollectionEnabled(options: { enabled: boolean; }) => Promise<{ remoteLogCollectionEnabled: boolean; }>
|
|
1467
|
+
```
|
|
1468
|
+
|
|
1469
|
+
Enable or disable sending the app's logs for capture requests: a workflow or an AI agent can ask for the logs
|
|
1470
|
+
while the app runs (no user action), and screenshots and recordings can bring the logs around them. The logs are
|
|
1471
|
+
what a bug report carries (console and network logs, custom data, env data, custom events; the replay only when
|
|
1472
|
+
it is asked for and enabled in the dashboard), and the existing settings still apply (e.g. setDisableEnvData).
|
|
1473
|
+
While disabled, log requests are answered as not supported and captures are sent without logs.
|
|
1474
|
+
Enabled by default. Works on iOS, Android and web and can be called before or after initialize.
|
|
1475
|
+
|
|
1476
|
+
| Param | Type |
|
|
1477
|
+
| ------------- | ---------------------------------- |
|
|
1478
|
+
| **`options`** | <code>{ enabled: boolean; }</code> |
|
|
1479
|
+
|
|
1480
|
+
**Returns:** <code>Promise<{ remoteLogCollectionEnabled: boolean; }></code>
|
|
1481
|
+
|
|
1482
|
+
**Since:** 19.1.0
|
|
1483
|
+
|
|
1484
|
+
--------------------
|
|
1485
|
+
|
|
1486
|
+
|
|
1344
1487
|
### setLanguage(...)
|
|
1345
1488
|
|
|
1346
1489
|
```typescript
|
package/android/build.gradle
CHANGED
|
@@ -55,5 +55,5 @@ dependencies {
|
|
|
55
55
|
testImplementation "junit:junit:$junitVersion"
|
|
56
56
|
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
57
57
|
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
58
|
-
implementation group: 'io.gleap', name: 'gleap-android-sdk', version: '19.
|
|
58
|
+
implementation group: 'io.gleap', name: 'gleap-android-sdk', version: '19.1.0'
|
|
59
59
|
}
|
|
@@ -2,6 +2,8 @@ package io.gleapplugins.capacitor;
|
|
|
2
2
|
|
|
3
3
|
import android.Manifest;
|
|
4
4
|
import android.os.Build;
|
|
5
|
+
import android.os.Handler;
|
|
6
|
+
import android.os.Looper;
|
|
5
7
|
|
|
6
8
|
import com.getcapacitor.JSArray;
|
|
7
9
|
import com.getcapacitor.JSObject;
|
|
@@ -12,6 +14,7 @@ import com.getcapacitor.annotation.CapacitorPlugin;
|
|
|
12
14
|
import com.getcapacitor.annotation.Permission;
|
|
13
15
|
import io.gleap.APPLICATIONTYPE;
|
|
14
16
|
import io.gleap.Gleap;
|
|
17
|
+
import io.gleap.GleapLogFlushHandler;
|
|
15
18
|
import io.gleap.GleapLogLevel;
|
|
16
19
|
import io.gleap.GleapNotInitialisedException;
|
|
17
20
|
import io.gleap.GleapSessionProperties;
|
|
@@ -62,6 +65,12 @@ public class GleapPlugin extends Plugin {
|
|
|
62
65
|
private volatile JSObject lastLogConfig;
|
|
63
66
|
// Set by disableConsoleLogOverwrite: WebView console logs are no longer attached.
|
|
64
67
|
private volatile boolean webViewConsoleLogsDisabled = false;
|
|
68
|
+
// Capture requests: log flushes the native SDK waits for (at most 500 ms) until the WebView log capture handed
|
|
69
|
+
// over what it buffers, by flush id.
|
|
70
|
+
private final Map<String, Runnable> pendingLogFlushes = new ConcurrentHashMap<>();
|
|
71
|
+
private final Handler mainHandler = new Handler(Looper.getMainLooper());
|
|
72
|
+
// An unanswered flush (e.g. the page reloaded) is forgotten after this; the SDK stopped waiting long before.
|
|
73
|
+
private static final long LOG_FLUSH_FORGET_MS = 1000;
|
|
65
74
|
|
|
66
75
|
@Override
|
|
67
76
|
public void load() {
|
|
@@ -119,6 +128,8 @@ public class GleapPlugin extends Plugin {
|
|
|
119
128
|
// Set the application type
|
|
120
129
|
Gleap.getInstance().setApplicationType(APPLICATIONTYPE.CAPACITOR);
|
|
121
130
|
|
|
131
|
+
registerLogFlushHandler();
|
|
132
|
+
|
|
122
133
|
// A reloaded WebView calls initialize again: hand it the config that was already loaded.
|
|
123
134
|
JSObject logConfig = lastLogConfig;
|
|
124
135
|
if (logConfig != null) {
|
|
@@ -131,6 +142,76 @@ public class GleapPlugin extends Plugin {
|
|
|
131
142
|
call.resolve(ret);
|
|
132
143
|
}
|
|
133
144
|
|
|
145
|
+
/**
|
|
146
|
+
* Capture requests: before the native SDK collects the logs for a request, the WebView log capture hands over
|
|
147
|
+
* what it buffers (pushed at most every 500 ms otherwise). The SDK calls this on the main thread and waits at
|
|
148
|
+
* most 500 ms for done; without a flushLogs listener it does not wait.
|
|
149
|
+
*/
|
|
150
|
+
private void registerLogFlushHandler() {
|
|
151
|
+
try {
|
|
152
|
+
implementation.setLogFlushHandler(
|
|
153
|
+
new GleapLogFlushHandler() {
|
|
154
|
+
@Override
|
|
155
|
+
public void onFlushRequested(Runnable done) {
|
|
156
|
+
requestLogFlush(done);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
} catch (Exception | LinkageError ex) {
|
|
161
|
+
System.out.println(ex);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
private void requestLogFlush(Runnable done) {
|
|
166
|
+
if (done == null) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
if (!hasListeners("flushLogs")) {
|
|
170
|
+
done.run();
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
final String flushId = UUID.randomUUID().toString();
|
|
174
|
+
pendingLogFlushes.put(flushId, done);
|
|
175
|
+
try {
|
|
176
|
+
JSObject data = new JSObject();
|
|
177
|
+
data.put("flushId", flushId);
|
|
178
|
+
notifyListeners("flushLogs", data);
|
|
179
|
+
} catch (Exception ex) {
|
|
180
|
+
finishLogFlush(flushId);
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
mainHandler.postDelayed(
|
|
184
|
+
new Runnable() {
|
|
185
|
+
@Override
|
|
186
|
+
public void run() {
|
|
187
|
+
pendingLogFlushes.remove(flushId);
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
LOG_FLUSH_FORGET_MS
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
private void finishLogFlush(String flushId) {
|
|
195
|
+
if (flushId == null) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
Runnable done = pendingLogFlushes.remove(flushId);
|
|
199
|
+
if (done != null) {
|
|
200
|
+
try {
|
|
201
|
+
done.run();
|
|
202
|
+
} catch (Exception ignore) {}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* The WebView log capture handed over what it buffered for the flush with this id.
|
|
208
|
+
*/
|
|
209
|
+
@PluginMethod
|
|
210
|
+
public void logsFlushed(PluginCall call) {
|
|
211
|
+
finishLogFlush(call.getString("flushId"));
|
|
212
|
+
call.resolve();
|
|
213
|
+
}
|
|
214
|
+
|
|
134
215
|
// Data region & host overrides. All of them must be called before initialize.
|
|
135
216
|
@PluginMethod
|
|
136
217
|
public void setRegion(PluginCall call) {
|
|
@@ -906,6 +987,50 @@ public class GleapPlugin extends Plugin {
|
|
|
906
987
|
call.resolve(ret);
|
|
907
988
|
}
|
|
908
989
|
|
|
990
|
+
/**
|
|
991
|
+
* Enables or disables screenshots and screen recordings for capture requests.
|
|
992
|
+
*/
|
|
993
|
+
@PluginMethod
|
|
994
|
+
public void setCaptureEnabled(PluginCall call) {
|
|
995
|
+
Boolean enabled = call.getBoolean("enabled");
|
|
996
|
+
if (enabled == null) {
|
|
997
|
+
call.reject("No enabled value provided");
|
|
998
|
+
return;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
try {
|
|
1002
|
+
implementation.setCaptureEnabled(enabled);
|
|
1003
|
+
} catch (Exception | LinkageError ex) {
|
|
1004
|
+
System.out.println(ex);
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
JSObject ret = new JSObject();
|
|
1008
|
+
ret.put("captureEnabled", enabled);
|
|
1009
|
+
call.resolve(ret);
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
/**
|
|
1013
|
+
* Enables or disables sending the app's logs for capture requests.
|
|
1014
|
+
*/
|
|
1015
|
+
@PluginMethod
|
|
1016
|
+
public void setRemoteLogCollectionEnabled(PluginCall call) {
|
|
1017
|
+
Boolean enabled = call.getBoolean("enabled");
|
|
1018
|
+
if (enabled == null) {
|
|
1019
|
+
call.reject("No enabled value provided");
|
|
1020
|
+
return;
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
try {
|
|
1024
|
+
implementation.setRemoteLogCollectionEnabled(enabled);
|
|
1025
|
+
} catch (Exception | LinkageError ex) {
|
|
1026
|
+
System.out.println(ex);
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
JSObject ret = new JSObject();
|
|
1030
|
+
ret.put("remoteLogCollectionEnabled", enabled);
|
|
1031
|
+
call.resolve(ret);
|
|
1032
|
+
}
|
|
1033
|
+
|
|
909
1034
|
@PluginMethod
|
|
910
1035
|
public void showFeedbackButton(PluginCall call) {
|
|
911
1036
|
boolean show = call.getBoolean("show", false);
|
|
@@ -1260,6 +1385,24 @@ public class GleapPlugin extends Plugin {
|
|
|
1260
1385
|
openConversations(call);
|
|
1261
1386
|
}
|
|
1262
1387
|
|
|
1388
|
+
// Emailed protected file link (gleapFile query parameter). The SDK opens the conversation
|
|
1389
|
+
// once a verified identify (user hash) gave the session file access.
|
|
1390
|
+
@PluginMethod
|
|
1391
|
+
public void openProtectedFileFromUrl(PluginCall call) {
|
|
1392
|
+
String url = call.getString("url");
|
|
1393
|
+
if (url == null) {
|
|
1394
|
+
call.reject("No url provided");
|
|
1395
|
+
return;
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
boolean opened = implementation.openProtectedFileFromUrl(url);
|
|
1399
|
+
|
|
1400
|
+
// Build Json object and resolve success
|
|
1401
|
+
JSObject ret = new JSObject();
|
|
1402
|
+
ret.put("opened", opened);
|
|
1403
|
+
call.resolve(ret);
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1263
1406
|
@PluginMethod
|
|
1264
1407
|
public void startClassicForm(PluginCall call) throws GleapNotInitialisedException {
|
|
1265
1408
|
if (!call.getData().has("formId")) {
|
package/dist/docs.json
CHANGED
|
@@ -436,6 +436,27 @@
|
|
|
436
436
|
],
|
|
437
437
|
"slug": "attachconsolelogs"
|
|
438
438
|
},
|
|
439
|
+
{
|
|
440
|
+
"name": "logsFlushed",
|
|
441
|
+
"signature": "(options: { flushId: string; }) => Promise<void>",
|
|
442
|
+
"parameters": [
|
|
443
|
+
{
|
|
444
|
+
"name": "options",
|
|
445
|
+
"docs": "",
|
|
446
|
+
"type": "{ flushId: string; }"
|
|
447
|
+
}
|
|
448
|
+
],
|
|
449
|
+
"returns": "Promise<void>",
|
|
450
|
+
"tags": [
|
|
451
|
+
{
|
|
452
|
+
"name": "since",
|
|
453
|
+
"text": "19.1.0"
|
|
454
|
+
}
|
|
455
|
+
],
|
|
456
|
+
"docs": "Answers a `flushLogs` event once the WebView console and network logs the plugin buffers were handed to the native\nSDK, so it collects the logs for a capture request with them. The plugin calls this for you on iOS and Android.\nNo-op on web.",
|
|
457
|
+
"complexTypes": [],
|
|
458
|
+
"slug": "logsflushed"
|
|
459
|
+
},
|
|
439
460
|
{
|
|
440
461
|
"name": "setEnvDataPropsToIgnore",
|
|
441
462
|
"signature": "(options: { propsToIgnore: string[]; }) => Promise<{ envDataPropsToIgnoreSet: boolean; }>",
|
|
@@ -556,6 +577,34 @@
|
|
|
556
577
|
],
|
|
557
578
|
"slug": "addlistenerlogconfigloaded-"
|
|
558
579
|
},
|
|
580
|
+
{
|
|
581
|
+
"name": "addListener",
|
|
582
|
+
"signature": "(eventName: 'flushLogs', listenerFunc: (data: { flushId: string; }) => void) => Promise<PluginListenerHandle>",
|
|
583
|
+
"parameters": [
|
|
584
|
+
{
|
|
585
|
+
"name": "eventName",
|
|
586
|
+
"docs": "",
|
|
587
|
+
"type": "'flushLogs'"
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
"name": "listenerFunc",
|
|
591
|
+
"docs": "",
|
|
592
|
+
"type": "(data: { flushId: string; }) => void"
|
|
593
|
+
}
|
|
594
|
+
],
|
|
595
|
+
"returns": "Promise<PluginListenerHandle>",
|
|
596
|
+
"tags": [
|
|
597
|
+
{
|
|
598
|
+
"name": "since",
|
|
599
|
+
"text": "19.1.0"
|
|
600
|
+
}
|
|
601
|
+
],
|
|
602
|
+
"docs": "Called on iOS and Android right before the native SDK collects the logs for a capture request: the plugin's\nWebView log capture hands over what it buffers (it pushes at most every 500 ms otherwise) and answers with\n`logsFlushed`. The native SDK waits at most 500 ms for the answer. The plugin listens for you.",
|
|
603
|
+
"complexTypes": [
|
|
604
|
+
"PluginListenerHandle"
|
|
605
|
+
],
|
|
606
|
+
"slug": "addlistenerflushlogs-"
|
|
607
|
+
},
|
|
559
608
|
{
|
|
560
609
|
"name": "setTicketAttribute",
|
|
561
610
|
"signature": "(options: { key: string; value: string; }) => Promise<{ setTicketAttribute: boolean; }>",
|
|
@@ -1197,6 +1246,27 @@
|
|
|
1197
1246
|
"complexTypes": [],
|
|
1198
1247
|
"slug": "openconversations"
|
|
1199
1248
|
},
|
|
1249
|
+
{
|
|
1250
|
+
"name": "openProtectedFileFromUrl",
|
|
1251
|
+
"signature": "(options: { url: string; }) => Promise<{ opened: boolean; }>",
|
|
1252
|
+
"parameters": [
|
|
1253
|
+
{
|
|
1254
|
+
"name": "options",
|
|
1255
|
+
"docs": "",
|
|
1256
|
+
"type": "{ url: string; }"
|
|
1257
|
+
}
|
|
1258
|
+
],
|
|
1259
|
+
"returns": "Promise<{ opened: boolean; }>",
|
|
1260
|
+
"tags": [
|
|
1261
|
+
{
|
|
1262
|
+
"name": "since",
|
|
1263
|
+
"text": "19.0.1"
|
|
1264
|
+
}
|
|
1265
|
+
],
|
|
1266
|
+
"docs": "Open the conversation of a protected file from an emailed link.\nWith \"Require authenticated file access\" enabled, email replies link attachments to your customer\napplication URL with a `gleapFile` query parameter. If that URL opens your app (for example as a\nuniversal link / App Link), pass it here, e.g. from `App.addListener('appUrlOpen')` or\n`App.getLaunchUrl()` of `@capacitor/app`. `opened` is true when the URL carries a Gleap file reference.\nThe conversation opens once the customer is identified with a user hash (`identify` with `userHash`);\nthe link alone grants nothing. On web the JavaScript SDK handles `?gleapFile=` automatically on page load,\nso this resolves `{ opened: false }` there.",
|
|
1267
|
+
"complexTypes": [],
|
|
1268
|
+
"slug": "openprotectedfilefromurl"
|
|
1269
|
+
},
|
|
1200
1270
|
{
|
|
1201
1271
|
"name": "startBot",
|
|
1202
1272
|
"signature": "(options: { botId?: string; showBackButton?: boolean; }) => Promise<{ startedBot: boolean; }>",
|
|
@@ -1302,6 +1372,48 @@
|
|
|
1302
1372
|
"complexTypes": [],
|
|
1303
1373
|
"slug": "setcolorscheme"
|
|
1304
1374
|
},
|
|
1375
|
+
{
|
|
1376
|
+
"name": "setCaptureEnabled",
|
|
1377
|
+
"signature": "(options: { enabled: boolean; }) => Promise<{ captureEnabled: boolean; }>",
|
|
1378
|
+
"parameters": [
|
|
1379
|
+
{
|
|
1380
|
+
"name": "options",
|
|
1381
|
+
"docs": "",
|
|
1382
|
+
"type": "{ enabled: boolean; }"
|
|
1383
|
+
}
|
|
1384
|
+
],
|
|
1385
|
+
"returns": "Promise<{ captureEnabled: boolean; }>",
|
|
1386
|
+
"tags": [
|
|
1387
|
+
{
|
|
1388
|
+
"name": "since",
|
|
1389
|
+
"text": "19.1.0"
|
|
1390
|
+
}
|
|
1391
|
+
],
|
|
1392
|
+
"docs": "Enable or disable screenshots and screen recordings for capture requests: when a workflow, an AI agent or a\nteammate asks the user in the widget to show the issue, the widget steps aside, a small bar lets the user go to\nthe right screen, and the SDK captures the app once they tap Capture (or records it between Start and Stop).\nNothing is captured without that tap. While disabled, the widget only offers to upload a file.\nEnabled by default. Works on iOS, Android and web and can be called before or after initialize.",
|
|
1393
|
+
"complexTypes": [],
|
|
1394
|
+
"slug": "setcaptureenabled"
|
|
1395
|
+
},
|
|
1396
|
+
{
|
|
1397
|
+
"name": "setRemoteLogCollectionEnabled",
|
|
1398
|
+
"signature": "(options: { enabled: boolean; }) => Promise<{ remoteLogCollectionEnabled: boolean; }>",
|
|
1399
|
+
"parameters": [
|
|
1400
|
+
{
|
|
1401
|
+
"name": "options",
|
|
1402
|
+
"docs": "",
|
|
1403
|
+
"type": "{ enabled: boolean; }"
|
|
1404
|
+
}
|
|
1405
|
+
],
|
|
1406
|
+
"returns": "Promise<{ remoteLogCollectionEnabled: boolean; }>",
|
|
1407
|
+
"tags": [
|
|
1408
|
+
{
|
|
1409
|
+
"name": "since",
|
|
1410
|
+
"text": "19.1.0"
|
|
1411
|
+
}
|
|
1412
|
+
],
|
|
1413
|
+
"docs": "Enable or disable sending the app's logs for capture requests: a workflow or an AI agent can ask for the logs\nwhile the app runs (no user action), and screenshots and recordings can bring the logs around them. The logs are\nwhat a bug report carries (console and network logs, custom data, env data, custom events; the replay only when\nit is asked for and enabled in the dashboard), and the existing settings still apply (e.g. setDisableEnvData).\nWhile disabled, log requests are answered as not supported and captures are sent without logs.\nEnabled by default. Works on iOS, Android and web and can be called before or after initialize.",
|
|
1414
|
+
"complexTypes": [],
|
|
1415
|
+
"slug": "setremotelogcollectionenabled"
|
|
1416
|
+
},
|
|
1305
1417
|
{
|
|
1306
1418
|
"name": "setLanguage",
|
|
1307
1419
|
"signature": "(options: { languageCode: string; }) => Promise<{ setLanguage: string; }>",
|
|
@@ -293,6 +293,16 @@ export interface GleapPlugin {
|
|
|
293
293
|
consoleLogsAttached: boolean;
|
|
294
294
|
}>;
|
|
295
295
|
/**
|
|
296
|
+
* Answers a `flushLogs` event once the WebView console and network logs the plugin buffers were handed to the native
|
|
297
|
+
* SDK, so it collects the logs for a capture request with them. The plugin calls this for you on iOS and Android.
|
|
298
|
+
* No-op on web.
|
|
299
|
+
*
|
|
300
|
+
* @since 19.1.0
|
|
301
|
+
*/
|
|
302
|
+
logsFlushed(options: {
|
|
303
|
+
flushId: string;
|
|
304
|
+
}): Promise<void>;
|
|
305
|
+
/**
|
|
296
306
|
* Set env data props to ignore. The given env data keys (exact and case-sensitive, e.g. "deviceName" or "currentUrl")
|
|
297
307
|
* are removed before a ticket or conversation is sent. Each call replaces the previous list, an empty list resets it.
|
|
298
308
|
* Can be called before or after initialize.
|
|
@@ -343,6 +353,16 @@ export interface GleapPlugin {
|
|
|
343
353
|
*/
|
|
344
354
|
addListener(eventName: 'logConfigLoaded', listenerFunc: (config: GleapLogConfig) => void): Promise<PluginListenerHandle>;
|
|
345
355
|
/**
|
|
356
|
+
* Called on iOS and Android right before the native SDK collects the logs for a capture request: the plugin's
|
|
357
|
+
* WebView log capture hands over what it buffers (it pushes at most every 500 ms otherwise) and answers with
|
|
358
|
+
* `logsFlushed`. The native SDK waits at most 500 ms for the answer. The plugin listens for you.
|
|
359
|
+
*
|
|
360
|
+
* @since 19.1.0
|
|
361
|
+
*/
|
|
362
|
+
addListener(eventName: 'flushLogs', listenerFunc: (data: {
|
|
363
|
+
flushId: string;
|
|
364
|
+
}) => void): Promise<PluginListenerHandle>;
|
|
365
|
+
/**
|
|
346
366
|
* Sets the value of a ticket attribute
|
|
347
367
|
*
|
|
348
368
|
* @since 13.5.0
|
|
@@ -671,6 +691,23 @@ export interface GleapPlugin {
|
|
|
671
691
|
conversationsOpened: boolean;
|
|
672
692
|
}>;
|
|
673
693
|
/**
|
|
694
|
+
* Open the conversation of a protected file from an emailed link.
|
|
695
|
+
* With "Require authenticated file access" enabled, email replies link attachments to your customer
|
|
696
|
+
* application URL with a `gleapFile` query parameter. If that URL opens your app (for example as a
|
|
697
|
+
* universal link / App Link), pass it here, e.g. from `App.addListener('appUrlOpen')` or
|
|
698
|
+
* `App.getLaunchUrl()` of `@capacitor/app`. `opened` is true when the URL carries a Gleap file reference.
|
|
699
|
+
* The conversation opens once the customer is identified with a user hash (`identify` with `userHash`);
|
|
700
|
+
* the link alone grants nothing. On web the JavaScript SDK handles `?gleapFile=` automatically on page load,
|
|
701
|
+
* so this resolves `{ opened: false }` there.
|
|
702
|
+
*
|
|
703
|
+
* @since 19.0.1
|
|
704
|
+
*/
|
|
705
|
+
openProtectedFileFromUrl(options: {
|
|
706
|
+
url: string;
|
|
707
|
+
}): Promise<{
|
|
708
|
+
opened: boolean;
|
|
709
|
+
}>;
|
|
710
|
+
/**
|
|
674
711
|
* Start bot
|
|
675
712
|
*
|
|
676
713
|
* @since 10.0.3
|
|
@@ -733,6 +770,35 @@ export interface GleapPlugin {
|
|
|
733
770
|
colorScheme: string;
|
|
734
771
|
}>;
|
|
735
772
|
/**
|
|
773
|
+
* Enable or disable screenshots and screen recordings for capture requests: when a workflow, an AI agent or a
|
|
774
|
+
* teammate asks the user in the widget to show the issue, the widget steps aside, a small bar lets the user go to
|
|
775
|
+
* the right screen, and the SDK captures the app once they tap Capture (or records it between Start and Stop).
|
|
776
|
+
* Nothing is captured without that tap. While disabled, the widget only offers to upload a file.
|
|
777
|
+
* Enabled by default. Works on iOS, Android and web and can be called before or after initialize.
|
|
778
|
+
*
|
|
779
|
+
* @since 19.1.0
|
|
780
|
+
*/
|
|
781
|
+
setCaptureEnabled(options: {
|
|
782
|
+
enabled: boolean;
|
|
783
|
+
}): Promise<{
|
|
784
|
+
captureEnabled: boolean;
|
|
785
|
+
}>;
|
|
786
|
+
/**
|
|
787
|
+
* Enable or disable sending the app's logs for capture requests: a workflow or an AI agent can ask for the logs
|
|
788
|
+
* while the app runs (no user action), and screenshots and recordings can bring the logs around them. The logs are
|
|
789
|
+
* what a bug report carries (console and network logs, custom data, env data, custom events; the replay only when
|
|
790
|
+
* it is asked for and enabled in the dashboard), and the existing settings still apply (e.g. setDisableEnvData).
|
|
791
|
+
* While disabled, log requests are answered as not supported and captures are sent without logs.
|
|
792
|
+
* Enabled by default. Works on iOS, Android and web and can be called before or after initialize.
|
|
793
|
+
*
|
|
794
|
+
* @since 19.1.0
|
|
795
|
+
*/
|
|
796
|
+
setRemoteLogCollectionEnabled(options: {
|
|
797
|
+
enabled: boolean;
|
|
798
|
+
}): Promise<{
|
|
799
|
+
remoteLogCollectionEnabled: boolean;
|
|
800
|
+
}>;
|
|
801
|
+
/**
|
|
736
802
|
* Set Language
|
|
737
803
|
*
|
|
738
804
|
* @since 7.0.0
|