capacitor-gleap-plugin 15.3.4 → 15.4.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/README.md +57 -9
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/gleapplugins/capacitor/GleapPlugin.java +41 -71
- package/dist/docs.json +72 -7
- package/dist/esm/definitions.d.ts +29 -19
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +8 -1
- package/dist/esm/index.js +52 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +9 -17
- package/dist/esm/web.js +27 -3
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +79 -3
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +79 -3
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/GleapPlugin.m +2 -1
- package/ios/Plugin/GleapPlugin.swift +35 -55
- package/package.json +2 -2
package/ios/Plugin/GleapPlugin.m
CHANGED
|
@@ -17,7 +17,8 @@ CAP_PLUGIN(GleapPlugin, "Gleap",
|
|
|
17
17
|
CAP_PLUGIN_METHOD(setTicketAttribute, CAPPluginReturnPromise);
|
|
18
18
|
CAP_PLUGIN_METHOD(unsetTicketAttribute, CAPPluginReturnPromise);
|
|
19
19
|
CAP_PLUGIN_METHOD(clearTicketAttributes, CAPPluginReturnPromise);
|
|
20
|
-
CAP_PLUGIN_METHOD(
|
|
20
|
+
CAP_PLUGIN_METHOD(registerAgentTool, CAPPluginReturnPromise);
|
|
21
|
+
CAP_PLUGIN_METHOD(sendAgentToolResult, CAPPluginReturnPromise);
|
|
21
22
|
CAP_PLUGIN_METHOD(trackEvent, CAPPluginReturnPromise);
|
|
22
23
|
CAP_PLUGIN_METHOD(trackPage, CAPPluginReturnPromise);
|
|
23
24
|
CAP_PLUGIN_METHOD(sendSilentCrashReport, CAPPluginReturnPromise);
|
|
@@ -13,6 +13,7 @@ public class GleapPlugin: CAPPlugin, GleapDelegate {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
private var callQueue: [String: CallType] = [:]
|
|
16
|
+
private var pendingAgentToolExecutions: [String: GleapAgentToolCompletion] = [:]
|
|
16
17
|
|
|
17
18
|
@objc func initialize(_ call: CAPPluginCall) {
|
|
18
19
|
// Check if key is present
|
|
@@ -266,65 +267,44 @@ public class GleapPlugin: CAPPlugin, GleapDelegate {
|
|
|
266
267
|
])
|
|
267
268
|
}
|
|
268
269
|
|
|
269
|
-
@objc func
|
|
270
|
-
guard let
|
|
271
|
-
call.reject("Must provide a
|
|
270
|
+
@objc func registerAgentTool(_ call: CAPPluginCall) {
|
|
271
|
+
guard let name = call.options["name"] as? String else {
|
|
272
|
+
call.reject("Must provide a name")
|
|
272
273
|
return
|
|
273
274
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
required: required,
|
|
304
|
-
enums: enums
|
|
305
|
-
)
|
|
306
|
-
|
|
307
|
-
parameters.append(parameter)
|
|
275
|
+
|
|
276
|
+
DispatchQueue.main.async {
|
|
277
|
+
// Executions round-trip to JS via the agentToolExecution event and sendAgentToolResult.
|
|
278
|
+
Gleap.registerAgentTool(name, handler: { (params, completion) in
|
|
279
|
+
let executionId = UUID().uuidString
|
|
280
|
+
self.pendingAgentToolExecutions[executionId] = completion
|
|
281
|
+
|
|
282
|
+
self.notifyListeners("agentToolExecution", data: [
|
|
283
|
+
"executionId": executionId,
|
|
284
|
+
"name": name,
|
|
285
|
+
"params": params
|
|
286
|
+
])
|
|
287
|
+
})
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
call.resolve()
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
@objc func sendAgentToolResult(_ call: CAPPluginCall) {
|
|
294
|
+
guard let executionId = call.options["executionId"] as? String else {
|
|
295
|
+
call.reject("Must provide an executionId")
|
|
296
|
+
return
|
|
297
|
+
}
|
|
298
|
+
let result = call.options["result"] as? String ?? ""
|
|
299
|
+
|
|
300
|
+
DispatchQueue.main.async {
|
|
301
|
+
if let completion = self.pendingAgentToolExecutions[executionId] {
|
|
302
|
+
self.pendingAgentToolExecutions.removeValue(forKey: executionId)
|
|
303
|
+
completion(result)
|
|
308
304
|
}
|
|
309
|
-
|
|
310
|
-
let aiTool = GleapAiTool(
|
|
311
|
-
name: name,
|
|
312
|
-
toolDescription: toolDescription,
|
|
313
|
-
response: response,
|
|
314
|
-
executionType: executionType,
|
|
315
|
-
parameters: parameters
|
|
316
|
-
)
|
|
317
|
-
|
|
318
|
-
aiTools.append(aiTool)
|
|
319
305
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
Gleap.setAiTools(aiTools)
|
|
323
|
-
|
|
324
|
-
// Provide feedback that the AI tools have been successfully set
|
|
325
|
-
call.resolve([
|
|
326
|
-
"aiToolsSet": true
|
|
327
|
-
])
|
|
306
|
+
|
|
307
|
+
call.resolve()
|
|
328
308
|
}
|
|
329
309
|
|
|
330
310
|
@objc func setTicketAttribute(_ call: CAPPluginCall) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "capacitor-gleap-plugin",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.4.0",
|
|
4
4
|
"description": "Gleap SDK for Capacitor is the easiest way to integrate Gleap into your Ionic apps! Achieve better app quality with comprehensive in-app bug reporting & customer feedback for your web-apps and websites. Many thanks to Stephan Nagel (congrapp) for his work on the Gleap capacitor plugin.",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -76,6 +76,6 @@
|
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"gleap": "16.
|
|
79
|
+
"gleap": "16.2.4"
|
|
80
80
|
}
|
|
81
81
|
}
|