capacitor-gleap-plugin 18.0.0 → 19.0.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 +7 -2
- package/Package.swift +31 -0
- package/README.md +307 -761
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/gleapplugins/capacitor/GleapPlugin.java +228 -37
- package/dist/docs.json +323 -3907
- package/dist/esm/definitions.d.ts +168 -3
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.js +9 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/logs/body.d.ts +58 -0
- package/dist/esm/logs/body.js +303 -0
- package/dist/esm/logs/body.js.map +1 -0
- package/dist/esm/logs/consoleCapture.d.ts +29 -0
- package/dist/esm/logs/consoleCapture.js +189 -0
- package/dist/esm/logs/consoleCapture.js.map +1 -0
- package/dist/esm/logs/format.d.ts +16 -0
- package/dist/esm/logs/format.js +394 -0
- package/dist/esm/logs/format.js.map +1 -0
- package/dist/esm/logs/networkCapture.d.ts +65 -0
- package/dist/esm/logs/networkCapture.js +654 -0
- package/dist/esm/logs/networkCapture.js.map +1 -0
- package/dist/esm/logs/redaction.d.ts +54 -0
- package/dist/esm/logs/redaction.js +388 -0
- package/dist/esm/logs/redaction.js.map +1 -0
- package/dist/esm/logs/webViewLogs.d.ts +70 -0
- package/dist/esm/logs/webViewLogs.js +297 -0
- package/dist/esm/logs/webViewLogs.js.map +1 -0
- package/dist/esm/logs/zone.d.ts +5 -0
- package/dist/esm/logs/zone.js +15 -0
- package/dist/esm/logs/zone.js.map +1 -0
- package/dist/esm/web.d.ts +47 -2
- package/dist/esm/web.js +43 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +2263 -1
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +2263 -1
- package/dist/plugin.js.map +1 -1
- package/ios/{Plugin → Sources/GleapPlugin}/GleapPlugin.swift +222 -12
- package/package.json +27 -6
- package/ios/Plugin/GleapPlugin.h +0 -10
- package/ios/Plugin/GleapPlugin.m +0 -66
- package/ios/Plugin/Info.plist +0 -24
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: '
|
|
58
|
+
implementation group: 'io.gleap', name: 'gleap-android-sdk', version: '19.0.0'
|
|
59
59
|
}
|
|
@@ -58,10 +58,49 @@ public class GleapPlugin extends Plugin {
|
|
|
58
58
|
|
|
59
59
|
private Gleap implementation;
|
|
60
60
|
private final Map<String, GleapAgentToolResultCallback> pendingAgentToolExecutions = new ConcurrentHashMap<>();
|
|
61
|
+
// Network log settings from the last loaded config, for the WebView log capture.
|
|
62
|
+
private volatile JSObject lastLogConfig;
|
|
63
|
+
// Set by disableConsoleLogOverwrite: WebView console logs are no longer attached.
|
|
64
|
+
private volatile boolean webViewConsoleLogsDisabled = false;
|
|
61
65
|
|
|
62
66
|
@Override
|
|
63
67
|
public void load() {
|
|
64
68
|
implementation = Gleap.getInstance();
|
|
69
|
+
// The loaded config only feeds the WebView log capture; like on iOS, setEventCallback gets no event for it.
|
|
70
|
+
implementation.setConfigLoadedCallback(
|
|
71
|
+
new ConfigLoadedCallback() {
|
|
72
|
+
@Override
|
|
73
|
+
public void configLoaded(JSONObject jsonObject) {
|
|
74
|
+
notifyLogConfig(jsonObject);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Sends the network log settings of the loaded config to the WebView log capture.
|
|
82
|
+
*/
|
|
83
|
+
private void notifyLogConfig(JSONObject config) {
|
|
84
|
+
JSObject logConfig = new JSObject();
|
|
85
|
+
logConfig.put("enableNetworkLogs", config != null && config.optBoolean("enableNetworkLogs", false));
|
|
86
|
+
logConfig.put("networkLogPropsToIgnore", stringArray(config, "networkLogPropsToIgnore"));
|
|
87
|
+
logConfig.put("networkLogBlacklist", stringArray(config, "networkLogBlacklist"));
|
|
88
|
+
lastLogConfig = logConfig;
|
|
89
|
+
notifyListeners("logConfigLoaded", logConfig, true);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
private static JSONArray stringArray(JSONObject config, String key) {
|
|
93
|
+
JSONArray result = new JSONArray();
|
|
94
|
+
JSONArray values = config != null ? config.optJSONArray(key) : null;
|
|
95
|
+
if (values != null) {
|
|
96
|
+
for (int i = 0; i < values.length(); i++) {
|
|
97
|
+
Object value = values.opt(i);
|
|
98
|
+
if (value instanceof String) {
|
|
99
|
+
result.put(value);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return result;
|
|
65
104
|
}
|
|
66
105
|
|
|
67
106
|
@PluginMethod
|
|
@@ -80,6 +119,12 @@ public class GleapPlugin extends Plugin {
|
|
|
80
119
|
// Set the application type
|
|
81
120
|
Gleap.getInstance().setApplicationType(APPLICATIONTYPE.CAPACITOR);
|
|
82
121
|
|
|
122
|
+
// A reloaded WebView calls initialize again: hand it the config that was already loaded.
|
|
123
|
+
JSObject logConfig = lastLogConfig;
|
|
124
|
+
if (logConfig != null) {
|
|
125
|
+
notifyListeners("logConfigLoaded", logConfig, true);
|
|
126
|
+
}
|
|
127
|
+
|
|
83
128
|
// Build Json object and resolve success
|
|
84
129
|
JSObject ret = new JSObject();
|
|
85
130
|
ret.put("initialized", true);
|
|
@@ -251,6 +296,48 @@ public class GleapPlugin extends Plugin {
|
|
|
251
296
|
call.resolve(ret);
|
|
252
297
|
}
|
|
253
298
|
|
|
299
|
+
@PluginMethod
|
|
300
|
+
public void updateContact(PluginCall call) {
|
|
301
|
+
GleapSessionProperties sessionProperties = new GleapSessionProperties();
|
|
302
|
+
if (call.getData().has("email")) {
|
|
303
|
+
sessionProperties.setEmail(call.getString("email"));
|
|
304
|
+
}
|
|
305
|
+
if (call.getData().has("name")) {
|
|
306
|
+
sessionProperties.setName(call.getString("name"));
|
|
307
|
+
}
|
|
308
|
+
if (call.getData().has("phone")) {
|
|
309
|
+
sessionProperties.setPhone(call.getString("phone"));
|
|
310
|
+
}
|
|
311
|
+
if (call.getData().has("plan")) {
|
|
312
|
+
sessionProperties.setPlan(call.getString("plan"));
|
|
313
|
+
}
|
|
314
|
+
if (call.getData().has("companyName")) {
|
|
315
|
+
sessionProperties.setCompanyName(call.getString("companyName"));
|
|
316
|
+
}
|
|
317
|
+
if (call.getData().has("avatar")) {
|
|
318
|
+
sessionProperties.setAvatar(call.getString("avatar"));
|
|
319
|
+
}
|
|
320
|
+
if (call.getData().has("sla")) {
|
|
321
|
+
sessionProperties.setSla(call.getDouble("sla"));
|
|
322
|
+
}
|
|
323
|
+
if (call.getData().has("companyId")) {
|
|
324
|
+
sessionProperties.setCompanyId(call.getString("companyId"));
|
|
325
|
+
}
|
|
326
|
+
if (call.getData().has("value")) {
|
|
327
|
+
sessionProperties.setValue(call.getDouble("value"));
|
|
328
|
+
}
|
|
329
|
+
if (call.getData().has("customData")) {
|
|
330
|
+
sessionProperties.setCustomData(call.getObject("customData"));
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
implementation.updateContact(sessionProperties);
|
|
334
|
+
|
|
335
|
+
// Build Json object and resolve success
|
|
336
|
+
JSObject ret = new JSObject();
|
|
337
|
+
ret.put("identify", true);
|
|
338
|
+
call.resolve(ret);
|
|
339
|
+
}
|
|
340
|
+
|
|
254
341
|
@PluginMethod
|
|
255
342
|
public void clearIdentity(PluginCall call) {
|
|
256
343
|
// Clear User Identity in Gleap
|
|
@@ -513,6 +600,38 @@ public class GleapPlugin extends Plugin {
|
|
|
513
600
|
call.resolve(ret);
|
|
514
601
|
}
|
|
515
602
|
|
|
603
|
+
/**
|
|
604
|
+
* Sets env data properties to be removed before a ticket is sent.
|
|
605
|
+
*
|
|
606
|
+
* @since 18.1.0
|
|
607
|
+
*/
|
|
608
|
+
@PluginMethod
|
|
609
|
+
public void setEnvDataPropsToIgnore(PluginCall call) {
|
|
610
|
+
// Check if 'propsToIgnore' key is provided, return error if not
|
|
611
|
+
if (!call.getData().has("propsToIgnore")) {
|
|
612
|
+
call.reject("Must provide a propsToIgnore array");
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
try {
|
|
617
|
+
// Retrieve and set the env data properties to be ignored
|
|
618
|
+
JSArray jsonPropsToIgnore = call.getArray("propsToIgnore");
|
|
619
|
+
String[] propsToIgnore = new String[jsonPropsToIgnore.length()];
|
|
620
|
+
for (int i = 0; i < jsonPropsToIgnore.length(); i++) {
|
|
621
|
+
propsToIgnore[i] = jsonPropsToIgnore.getString(i);
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
implementation.setEnvDataPropsToIgnore(propsToIgnore);
|
|
625
|
+
} catch (Exception ex) {
|
|
626
|
+
// Handle exceptions if necessary
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
// Confirm successful setting of env data properties to ignore
|
|
630
|
+
JSObject ret = new JSObject();
|
|
631
|
+
ret.put("envDataPropsToIgnoreSet", true);
|
|
632
|
+
call.resolve(ret);
|
|
633
|
+
}
|
|
634
|
+
|
|
516
635
|
@PluginMethod
|
|
517
636
|
public void attachCustomData(PluginCall call) {
|
|
518
637
|
// If key is empty, then pass back error
|
|
@@ -584,9 +703,9 @@ public class GleapPlugin extends Plugin {
|
|
|
584
703
|
String message = call.getString("message");
|
|
585
704
|
String logLevel = call.getString("logLevel", "INFO");
|
|
586
705
|
GleapLogLevel logLevelObj = GleapLogLevel.INFO;
|
|
587
|
-
if (
|
|
706
|
+
if ("ERROR".equals(logLevel)) {
|
|
588
707
|
logLevelObj = GleapLogLevel.ERROR;
|
|
589
|
-
} else if (
|
|
708
|
+
} else if ("WARNING".equals(logLevel)) {
|
|
590
709
|
logLevelObj = GleapLogLevel.WARNING;
|
|
591
710
|
}
|
|
592
711
|
|
|
@@ -642,7 +761,7 @@ public class GleapPlugin extends Plugin {
|
|
|
642
761
|
|
|
643
762
|
// Build Json object and resolve success
|
|
644
763
|
JSObject ret = new JSObject();
|
|
645
|
-
ret.put("
|
|
764
|
+
ret.put("loggedEvent", true);
|
|
646
765
|
call.resolve(ret);
|
|
647
766
|
}
|
|
648
767
|
|
|
@@ -742,7 +861,7 @@ public class GleapPlugin extends Plugin {
|
|
|
742
861
|
|
|
743
862
|
@PluginMethod
|
|
744
863
|
public void setDisableInAppNotifications(PluginCall call) {
|
|
745
|
-
boolean disableInAppNotifications = call.getBoolean("disableInAppNotifications");
|
|
864
|
+
boolean disableInAppNotifications = call.getBoolean("disableInAppNotifications", false);
|
|
746
865
|
|
|
747
866
|
implementation.setDisableInAppNotifications(disableInAppNotifications);
|
|
748
867
|
|
|
@@ -752,9 +871,44 @@ public class GleapPlugin extends Plugin {
|
|
|
752
871
|
call.resolve(ret);
|
|
753
872
|
}
|
|
754
873
|
|
|
874
|
+
@PluginMethod
|
|
875
|
+
public void setDisableEnvData(PluginCall call) {
|
|
876
|
+
boolean disableEnvData = call.getBoolean("disableEnvData", false);
|
|
877
|
+
|
|
878
|
+
implementation.setDisableEnvData(disableEnvData);
|
|
879
|
+
|
|
880
|
+
// Build Json object and resolve success
|
|
881
|
+
JSObject ret = new JSObject();
|
|
882
|
+
ret.put("envDataDisabled", true);
|
|
883
|
+
call.resolve(ret);
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
/**
|
|
887
|
+
* Sets the color scheme of the widget ("auto", "light" or "dark").
|
|
888
|
+
*
|
|
889
|
+
* @since 19.0.0
|
|
890
|
+
*/
|
|
891
|
+
@PluginMethod
|
|
892
|
+
public void setColorScheme(PluginCall call) {
|
|
893
|
+
if (!call.getData().has("colorScheme")) {
|
|
894
|
+
call.reject("No colorScheme provided");
|
|
895
|
+
return;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
String colorScheme = call.getString("colorScheme");
|
|
899
|
+
|
|
900
|
+
// Missing colors fall back to the dashboard setting / the SDK defaults
|
|
901
|
+
implementation.setColorScheme(colorScheme, call.getString("lightBackgroundColor"), call.getString("darkBackgroundColor"));
|
|
902
|
+
|
|
903
|
+
// Build Json object and resolve success
|
|
904
|
+
JSObject ret = new JSObject();
|
|
905
|
+
ret.put("colorScheme", colorScheme);
|
|
906
|
+
call.resolve(ret);
|
|
907
|
+
}
|
|
908
|
+
|
|
755
909
|
@PluginMethod
|
|
756
910
|
public void showFeedbackButton(PluginCall call) {
|
|
757
|
-
boolean show = call.getBoolean("show");
|
|
911
|
+
boolean show = call.getBoolean("show", false);
|
|
758
912
|
|
|
759
913
|
implementation.showFeedbackButton(show);
|
|
760
914
|
|
|
@@ -776,12 +930,54 @@ public class GleapPlugin extends Plugin {
|
|
|
776
930
|
|
|
777
931
|
@PluginMethod
|
|
778
932
|
public void disableConsoleLogOverwrite(PluginCall call) {
|
|
933
|
+
// The plugin's JavaScript restores the WebView console; drop what it attached so far.
|
|
934
|
+
webViewConsoleLogsDisabled = true;
|
|
935
|
+
implementation.attachConsoleLogs(new JSONArray());
|
|
936
|
+
|
|
779
937
|
// Build Json object and resolve success
|
|
780
938
|
JSObject ret = new JSObject();
|
|
781
939
|
ret.put("consoleLogDisabled", true);
|
|
782
940
|
call.resolve(ret);
|
|
783
941
|
}
|
|
784
942
|
|
|
943
|
+
/**
|
|
944
|
+
* Network requests made inside the WebView (fetch / XMLHttpRequest), recorded by the plugin's
|
|
945
|
+
* JavaScript. Each call replaces the previous list; the SDK merges and sanitizes them.
|
|
946
|
+
*
|
|
947
|
+
* @since 19.0.0
|
|
948
|
+
*/
|
|
949
|
+
@PluginMethod
|
|
950
|
+
public void attachNetworkLogs(PluginCall call) {
|
|
951
|
+
JSONArray logs = call.getArray("logs", new JSArray());
|
|
952
|
+
implementation.attachNetworkLogs(logs);
|
|
953
|
+
|
|
954
|
+
JSObject ret = new JSObject();
|
|
955
|
+
ret.put("networkLogsAttached", true);
|
|
956
|
+
call.resolve(ret);
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
/**
|
|
960
|
+
* Console output of the WebView, recorded by the plugin's JavaScript. Each call replaces the
|
|
961
|
+
* previous list.
|
|
962
|
+
*
|
|
963
|
+
* @since 19.0.0
|
|
964
|
+
*/
|
|
965
|
+
@PluginMethod
|
|
966
|
+
public void attachConsoleLogs(PluginCall call) {
|
|
967
|
+
JSObject ret = new JSObject();
|
|
968
|
+
if (webViewConsoleLogsDisabled) {
|
|
969
|
+
ret.put("consoleLogsAttached", false);
|
|
970
|
+
call.resolve(ret);
|
|
971
|
+
return;
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
JSONArray logs = call.getArray("logs", new JSArray());
|
|
975
|
+
implementation.attachConsoleLogs(logs);
|
|
976
|
+
|
|
977
|
+
ret.put("consoleLogsAttached", true);
|
|
978
|
+
call.resolve(ret);
|
|
979
|
+
}
|
|
980
|
+
|
|
785
981
|
@PluginMethod
|
|
786
982
|
public void enableDebugConsoleLog(PluginCall call) {
|
|
787
983
|
// Build Json object and resolve success
|
|
@@ -801,9 +997,9 @@ public class GleapPlugin extends Plugin {
|
|
|
801
997
|
String severity = call.getString("severity");
|
|
802
998
|
|
|
803
999
|
Gleap.SEVERITY severityObj = Gleap.SEVERITY.HIGH;
|
|
804
|
-
if (
|
|
1000
|
+
if ("HIGH".equalsIgnoreCase(severity)) {
|
|
805
1001
|
severityObj = Gleap.SEVERITY.HIGH;
|
|
806
|
-
} else if (
|
|
1002
|
+
} else if ("MEDIUM".equalsIgnoreCase(severity)) {
|
|
807
1003
|
severityObj = Gleap.SEVERITY.MEDIUM;
|
|
808
1004
|
} else {
|
|
809
1005
|
severityObj = Gleap.SEVERITY.LOW;
|
|
@@ -843,7 +1039,7 @@ public class GleapPlugin extends Plugin {
|
|
|
843
1039
|
|
|
844
1040
|
@PluginMethod
|
|
845
1041
|
public void openChecklists(PluginCall call) throws GleapNotInitialisedException {
|
|
846
|
-
boolean showBackButton = call.getBoolean("showBackButton");
|
|
1042
|
+
boolean showBackButton = call.getBoolean("showBackButton", true);
|
|
847
1043
|
|
|
848
1044
|
implementation.openChecklists(showBackButton);
|
|
849
1045
|
|
|
@@ -856,7 +1052,7 @@ public class GleapPlugin extends Plugin {
|
|
|
856
1052
|
@PluginMethod
|
|
857
1053
|
public void openChecklist(PluginCall call) throws GleapNotInitialisedException {
|
|
858
1054
|
String checklistId = call.getString("checklistId");
|
|
859
|
-
boolean showBackButton = call.getBoolean("showBackButton");
|
|
1055
|
+
boolean showBackButton = call.getBoolean("showBackButton", true);
|
|
860
1056
|
|
|
861
1057
|
implementation.openChecklist(checklistId, showBackButton);
|
|
862
1058
|
|
|
@@ -869,9 +1065,9 @@ public class GleapPlugin extends Plugin {
|
|
|
869
1065
|
@PluginMethod
|
|
870
1066
|
public void startChecklist(PluginCall call) throws GleapNotInitialisedException {
|
|
871
1067
|
String outboundId = call.getString("outboundId");
|
|
872
|
-
boolean showBackButton = call.getBoolean("showBackButton");
|
|
1068
|
+
boolean showBackButton = call.getBoolean("showBackButton", true);
|
|
873
1069
|
|
|
874
|
-
implementation.
|
|
1070
|
+
implementation.startChecklist(outboundId, showBackButton);
|
|
875
1071
|
|
|
876
1072
|
// Build Json object and resolve success
|
|
877
1073
|
JSObject ret = new JSObject();
|
|
@@ -881,20 +1077,20 @@ public class GleapPlugin extends Plugin {
|
|
|
881
1077
|
|
|
882
1078
|
@PluginMethod
|
|
883
1079
|
public void openNews(PluginCall call) throws GleapNotInitialisedException {
|
|
884
|
-
boolean showBackButton = call.getBoolean("showBackButton");
|
|
1080
|
+
boolean showBackButton = call.getBoolean("showBackButton", true);
|
|
885
1081
|
|
|
886
1082
|
implementation.openNews(showBackButton);
|
|
887
1083
|
|
|
888
1084
|
// Build Json object and resolve success
|
|
889
1085
|
JSObject ret = new JSObject();
|
|
890
|
-
ret.put("
|
|
1086
|
+
ret.put("openedNews", true);
|
|
891
1087
|
call.resolve(ret);
|
|
892
1088
|
}
|
|
893
1089
|
|
|
894
1090
|
@PluginMethod
|
|
895
1091
|
public void openNewsArticle(PluginCall call) throws GleapNotInitialisedException {
|
|
896
1092
|
String articleId = call.getString("articleId");
|
|
897
|
-
boolean showBackButton = call.getBoolean("showBackButton");
|
|
1093
|
+
boolean showBackButton = call.getBoolean("showBackButton", true);
|
|
898
1094
|
|
|
899
1095
|
implementation.openNewsArticle(articleId, showBackButton);
|
|
900
1096
|
|
|
@@ -906,7 +1102,7 @@ public class GleapPlugin extends Plugin {
|
|
|
906
1102
|
|
|
907
1103
|
@PluginMethod
|
|
908
1104
|
public void openHelpCenter(PluginCall call) throws GleapNotInitialisedException {
|
|
909
|
-
boolean showBackButton = call.getBoolean("showBackButton");
|
|
1105
|
+
boolean showBackButton = call.getBoolean("showBackButton", true);
|
|
910
1106
|
|
|
911
1107
|
implementation.openHelpCenter(showBackButton);
|
|
912
1108
|
|
|
@@ -920,7 +1116,7 @@ public class GleapPlugin extends Plugin {
|
|
|
920
1116
|
public void askAI(PluginCall call) throws GleapNotInitialisedException {
|
|
921
1117
|
// Open news
|
|
922
1118
|
String question = call.getString("question");
|
|
923
|
-
boolean showBackButton = call.getBoolean("showBackButton");
|
|
1119
|
+
boolean showBackButton = call.getBoolean("showBackButton", true);
|
|
924
1120
|
|
|
925
1121
|
implementation.askAI(question, showBackButton);
|
|
926
1122
|
|
|
@@ -934,7 +1130,7 @@ public class GleapPlugin extends Plugin {
|
|
|
934
1130
|
public void openHelpCenterArticle(PluginCall call) throws GleapNotInitialisedException {
|
|
935
1131
|
// Open news
|
|
936
1132
|
String articleId = call.getString("articleId");
|
|
937
|
-
boolean showBackButton = call.getBoolean("showBackButton");
|
|
1133
|
+
boolean showBackButton = call.getBoolean("showBackButton", true);
|
|
938
1134
|
|
|
939
1135
|
implementation.openHelpCenterArticle(articleId, showBackButton);
|
|
940
1136
|
|
|
@@ -948,7 +1144,7 @@ public class GleapPlugin extends Plugin {
|
|
|
948
1144
|
public void openHelpCenterCollection(PluginCall call) throws GleapNotInitialisedException {
|
|
949
1145
|
// Open news
|
|
950
1146
|
String collectionId = call.getString("collectionId");
|
|
951
|
-
boolean showBackButton = call.getBoolean("showBackButton");
|
|
1147
|
+
boolean showBackButton = call.getBoolean("showBackButton", true);
|
|
952
1148
|
|
|
953
1149
|
implementation.openHelpCenterCollection(collectionId, showBackButton);
|
|
954
1150
|
|
|
@@ -962,7 +1158,7 @@ public class GleapPlugin extends Plugin {
|
|
|
962
1158
|
public void searchHelpCenter(PluginCall call) throws GleapNotInitialisedException {
|
|
963
1159
|
// Open news
|
|
964
1160
|
String term = call.getString("term");
|
|
965
|
-
boolean showBackButton = call.getBoolean("showBackButton");
|
|
1161
|
+
boolean showBackButton = call.getBoolean("showBackButton", true);
|
|
966
1162
|
|
|
967
1163
|
implementation.searchHelpCenter(term, showBackButton);
|
|
968
1164
|
|
|
@@ -974,7 +1170,7 @@ public class GleapPlugin extends Plugin {
|
|
|
974
1170
|
|
|
975
1171
|
@PluginMethod
|
|
976
1172
|
public void openFeatureRequests(PluginCall call) throws GleapNotInitialisedException {
|
|
977
|
-
boolean showBackButton = call.getBoolean("showBackButton");
|
|
1173
|
+
boolean showBackButton = call.getBoolean("showBackButton", true);
|
|
978
1174
|
|
|
979
1175
|
// Open feature requests
|
|
980
1176
|
implementation.openFeatureRequests(showBackButton);
|
|
@@ -1005,7 +1201,7 @@ public class GleapPlugin extends Plugin {
|
|
|
1005
1201
|
|
|
1006
1202
|
// Start bot
|
|
1007
1203
|
String botId = call.getString("botId");
|
|
1008
|
-
boolean showBackButton = call.getBoolean("showBackButton");
|
|
1204
|
+
boolean showBackButton = call.getBoolean("showBackButton", true);
|
|
1009
1205
|
implementation.startBot(botId, showBackButton);
|
|
1010
1206
|
|
|
1011
1207
|
// Build Json object and resolve success
|
|
@@ -1023,7 +1219,8 @@ public class GleapPlugin extends Plugin {
|
|
|
1023
1219
|
|
|
1024
1220
|
// Start feedback flow
|
|
1025
1221
|
String feedbackFlow = call.getString("feedbackFlow");
|
|
1026
|
-
|
|
1222
|
+
boolean showBackButton = call.getBoolean("showBackButton", true);
|
|
1223
|
+
implementation.startFeedbackFlow(feedbackFlow, showBackButton);
|
|
1027
1224
|
|
|
1028
1225
|
// Build Json object and resolve success
|
|
1029
1226
|
JSObject ret = new JSObject();
|
|
@@ -1033,7 +1230,7 @@ public class GleapPlugin extends Plugin {
|
|
|
1033
1230
|
|
|
1034
1231
|
@PluginMethod
|
|
1035
1232
|
public void startConversation(PluginCall call) throws GleapNotInitialisedException {
|
|
1036
|
-
boolean showBackButton = call.getBoolean("showBackButton");
|
|
1233
|
+
boolean showBackButton = call.getBoolean("showBackButton", true);
|
|
1037
1234
|
|
|
1038
1235
|
// Start conversation
|
|
1039
1236
|
implementation.startConversation(showBackButton);
|
|
@@ -1046,7 +1243,7 @@ public class GleapPlugin extends Plugin {
|
|
|
1046
1243
|
|
|
1047
1244
|
@PluginMethod
|
|
1048
1245
|
public void openConversations(PluginCall call) throws GleapNotInitialisedException {
|
|
1049
|
-
boolean showBackButton = call.getBoolean("showBackButton");
|
|
1246
|
+
boolean showBackButton = call.getBoolean("showBackButton", true);
|
|
1050
1247
|
|
|
1051
1248
|
// Start conversation
|
|
1052
1249
|
implementation.openConversations(showBackButton);
|
|
@@ -1057,6 +1254,12 @@ public class GleapPlugin extends Plugin {
|
|
|
1057
1254
|
call.resolve(ret);
|
|
1058
1255
|
}
|
|
1059
1256
|
|
|
1257
|
+
// The name the plugin's TypeScript API uses for opening the conversations tab.
|
|
1258
|
+
@PluginMethod
|
|
1259
|
+
public void openConversation(PluginCall call) throws GleapNotInitialisedException {
|
|
1260
|
+
openConversations(call);
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1060
1263
|
@PluginMethod
|
|
1061
1264
|
public void startClassicForm(PluginCall call) throws GleapNotInitialisedException {
|
|
1062
1265
|
if (!call.getData().has("formId")) {
|
|
@@ -1065,7 +1268,7 @@ public class GleapPlugin extends Plugin {
|
|
|
1065
1268
|
}
|
|
1066
1269
|
|
|
1067
1270
|
// Start feedback flow
|
|
1068
|
-
boolean showBackButton = call.getBoolean("showBackButton");
|
|
1271
|
+
boolean showBackButton = call.getBoolean("showBackButton", true);
|
|
1069
1272
|
String formId = call.getString("formId");
|
|
1070
1273
|
implementation.startClassicForm(formId, showBackButton);
|
|
1071
1274
|
|
|
@@ -1142,18 +1345,6 @@ public class GleapPlugin extends Plugin {
|
|
|
1142
1345
|
}
|
|
1143
1346
|
);
|
|
1144
1347
|
|
|
1145
|
-
implementation.setConfigLoadedCallback(
|
|
1146
|
-
new ConfigLoadedCallback() {
|
|
1147
|
-
@Override
|
|
1148
|
-
public void configLoaded(JSONObject jsonObject) {
|
|
1149
|
-
JSObject data = new JSObject();
|
|
1150
|
-
data.put("name", "widget-opened");
|
|
1151
|
-
data.put("data", jsonObject);
|
|
1152
|
-
call.resolve(data);
|
|
1153
|
-
}
|
|
1154
|
-
}
|
|
1155
|
-
);
|
|
1156
|
-
|
|
1157
1348
|
implementation.setFeedbackSentCallback(
|
|
1158
1349
|
new FeedbackSentCallback() {
|
|
1159
1350
|
@Override
|