capacitor-gleap-plugin 17.0.0 → 18.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.
@@ -11,8 +11,8 @@ Pod::Spec.new do |s|
11
11
  s.author = package['author']
12
12
  s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13
13
  s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
14
- s.ios.deployment_target = '14.0'
14
+ s.ios.deployment_target = '15.0'
15
15
  s.dependency 'Capacitor'
16
- s.dependency 'Gleap', '17.0.0'
16
+ s.dependency 'Gleap', '18.0.0'
17
17
  s.swift_version = '5.1'
18
18
  end
package/README.md CHANGED
@@ -23,11 +23,33 @@ Please install the plugin version from our capacitor-v5 brunch with `npm install
23
23
 
24
24
  Please install the plugin version from our capacitor-v4 brunch with `npm install GleapSDK/Capacitor-SDK#capacitor-v4 --save` if you are using capacitor 4 or earlier.
25
25
 
26
+ ## Data regions
27
+
28
+ Gleap projects live in a data region. The SDK talks to the EU region by default. If your project is hosted in the US region, set the region **before** calling `initialize`:
29
+
30
+ ```typescript
31
+ import { Gleap } from "capacitor-gleap-plugin";
32
+
33
+ await Gleap.setRegion({ region: "us" });
34
+ await Gleap.initialize({ API_KEY: "YOUR_API_KEY" });
35
+ ```
36
+
37
+ `setRegion` sets the API, websocket and realtime hosts at once (supported regions: `"eu"` and `"us"`). The static widget hosts (frame, banner, modal) are global and are not changed by the region.
38
+
39
+ For self-hosted or custom setups you can override single hosts with `setApiUrl({ url })`, `setWSApiUrl({ url })`, `setRealtimeHost({ host })`, `setFrameUrl({ url })`, `setBannerUrl({ url })` and `setModalUrl({ url })`. All of them must be called before `initialize`; a manual setter called after `setRegion` overrides that single host.
40
+
26
41
  ## API
27
42
 
28
43
  <docgen-index>
29
44
 
30
45
  * [`initialize(...)`](#initialize)
46
+ * [`setRegion(...)`](#setregion)
47
+ * [`setApiUrl(...)`](#setapiurl)
48
+ * [`setWSApiUrl(...)`](#setwsapiurl)
49
+ * [`setRealtimeHost(...)`](#setrealtimehost)
50
+ * [`setFrameUrl(...)`](#setframeurl)
51
+ * [`setBannerUrl(...)`](#setbannerurl)
52
+ * [`setModalUrl(...)`](#setmodalurl)
31
53
  * [`identify(...)`](#identify)
32
54
  * [`updateContact(...)`](#updatecontact)
33
55
  * [`clearIdentity()`](#clearidentity)
@@ -104,6 +126,141 @@ Initialize Gleap with an API key
104
126
  --------------------
105
127
 
106
128
 
129
+ ### setRegion(...)
130
+
131
+ ```typescript
132
+ setRegion(options: { region: 'eu' | 'us'; }) => Promise<{ region: string; }>
133
+ ```
134
+
135
+ Set the data region of your Gleap project ("eu" is the default).
136
+ Sets the API, websocket and realtime hosts at once. Must be called before initialize.
137
+ A manual setter (setApiUrl, setWSApiUrl, setRealtimeHost) called afterwards overrides that single host.
138
+
139
+ | Param | Type |
140
+ | ------------- | -------------------------------------- |
141
+ | **`options`** | <code>{ region: 'eu' \| 'us'; }</code> |
142
+
143
+ **Returns:** <code>Promise&lt;{ region: string; }&gt;</code>
144
+
145
+ **Since:** 18.0.0
146
+
147
+ --------------------
148
+
149
+
150
+ ### setApiUrl(...)
151
+
152
+ ```typescript
153
+ setApiUrl(options: { url: string; }) => Promise<{ url: string; }>
154
+ ```
155
+
156
+ Set a custom API url. Must be called before initialize.
157
+
158
+ | Param | Type |
159
+ | ------------- | ----------------------------- |
160
+ | **`options`** | <code>{ url: string; }</code> |
161
+
162
+ **Returns:** <code>Promise&lt;{ url: string; }&gt;</code>
163
+
164
+ **Since:** 18.0.0
165
+
166
+ --------------------
167
+
168
+
169
+ ### setWSApiUrl(...)
170
+
171
+ ```typescript
172
+ setWSApiUrl(options: { url: string; }) => Promise<{ url: string; }>
173
+ ```
174
+
175
+ Set a custom websocket API url. Must be called before initialize.
176
+
177
+ | Param | Type |
178
+ | ------------- | ----------------------------- |
179
+ | **`options`** | <code>{ url: string; }</code> |
180
+
181
+ **Returns:** <code>Promise&lt;{ url: string; }&gt;</code>
182
+
183
+ **Since:** 18.0.0
184
+
185
+ --------------------
186
+
187
+
188
+ ### setRealtimeHost(...)
189
+
190
+ ```typescript
191
+ setRealtimeHost(options: { host: string; }) => Promise<{ host: string; }>
192
+ ```
193
+
194
+ Set a custom realtime host (hostname only, without protocol or path). Must be called before initialize.
195
+
196
+ | Param | Type |
197
+ | ------------- | ------------------------------ |
198
+ | **`options`** | <code>{ host: string; }</code> |
199
+
200
+ **Returns:** <code>Promise&lt;{ host: string; }&gt;</code>
201
+
202
+ **Since:** 18.0.0
203
+
204
+ --------------------
205
+
206
+
207
+ ### setFrameUrl(...)
208
+
209
+ ```typescript
210
+ setFrameUrl(options: { url: string; }) => Promise<{ url: string; }>
211
+ ```
212
+
213
+ Set a custom widget frame url. Must be called before initialize.
214
+
215
+ | Param | Type |
216
+ | ------------- | ----------------------------- |
217
+ | **`options`** | <code>{ url: string; }</code> |
218
+
219
+ **Returns:** <code>Promise&lt;{ url: string; }&gt;</code>
220
+
221
+ **Since:** 18.0.0
222
+
223
+ --------------------
224
+
225
+
226
+ ### setBannerUrl(...)
227
+
228
+ ```typescript
229
+ setBannerUrl(options: { url: string; }) => Promise<{ url: string; }>
230
+ ```
231
+
232
+ Set a custom banner url. Must be called before initialize.
233
+
234
+ | Param | Type |
235
+ | ------------- | ----------------------------- |
236
+ | **`options`** | <code>{ url: string; }</code> |
237
+
238
+ **Returns:** <code>Promise&lt;{ url: string; }&gt;</code>
239
+
240
+ **Since:** 18.0.0
241
+
242
+ --------------------
243
+
244
+
245
+ ### setModalUrl(...)
246
+
247
+ ```typescript
248
+ setModalUrl(options: { url: string; }) => Promise<{ url: string; }>
249
+ ```
250
+
251
+ Set a custom modal url. Must be called before initialize.
252
+
253
+ | Param | Type |
254
+ | ------------- | ----------------------------- |
255
+ | **`options`** | <code>{ url: string; }</code> |
256
+
257
+ **Returns:** <code>Promise&lt;{ url: string; }&gt;</code>
258
+
259
+ **Since:** 18.0.0
260
+
261
+ --------------------
262
+
263
+
107
264
  ### identify(...)
108
265
 
109
266
  ```typescript
@@ -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: '17.0.0'
58
+ implementation group: 'io.gleap', name: 'gleap-android-sdk', version: '18.0.0'
59
59
  }
@@ -86,6 +86,119 @@ public class GleapPlugin extends Plugin {
86
86
  call.resolve(ret);
87
87
  }
88
88
 
89
+ // Data region & host overrides. All of them must be called before initialize.
90
+ @PluginMethod
91
+ public void setRegion(PluginCall call) {
92
+ if (!call.getData().has("region")) {
93
+ call.reject("No region provided");
94
+ return;
95
+ }
96
+
97
+ String region = call.getString("region");
98
+ implementation.setRegion(region);
99
+
100
+ // Build Json object and resolve success
101
+ JSObject ret = new JSObject();
102
+ ret.put("region", region);
103
+ call.resolve(ret);
104
+ }
105
+
106
+ @PluginMethod
107
+ public void setApiUrl(PluginCall call) {
108
+ if (!call.getData().has("url")) {
109
+ call.reject("No url provided");
110
+ return;
111
+ }
112
+
113
+ String url = call.getString("url");
114
+ implementation.setApiUrl(url);
115
+
116
+ // Build Json object and resolve success
117
+ JSObject ret = new JSObject();
118
+ ret.put("url", url);
119
+ call.resolve(ret);
120
+ }
121
+
122
+ @PluginMethod
123
+ public void setWSApiUrl(PluginCall call) {
124
+ if (!call.getData().has("url")) {
125
+ call.reject("No url provided");
126
+ return;
127
+ }
128
+
129
+ String url = call.getString("url");
130
+ implementation.setWSApiUrl(url);
131
+
132
+ // Build Json object and resolve success
133
+ JSObject ret = new JSObject();
134
+ ret.put("url", url);
135
+ call.resolve(ret);
136
+ }
137
+
138
+ @PluginMethod
139
+ public void setRealtimeHost(PluginCall call) {
140
+ if (!call.getData().has("host")) {
141
+ call.reject("No host provided");
142
+ return;
143
+ }
144
+
145
+ String host = call.getString("host");
146
+ implementation.setRealtimeHost(host);
147
+
148
+ // Build Json object and resolve success
149
+ JSObject ret = new JSObject();
150
+ ret.put("host", host);
151
+ call.resolve(ret);
152
+ }
153
+
154
+ @PluginMethod
155
+ public void setFrameUrl(PluginCall call) {
156
+ if (!call.getData().has("url")) {
157
+ call.reject("No url provided");
158
+ return;
159
+ }
160
+
161
+ String url = call.getString("url");
162
+ implementation.setFrameUrl(url);
163
+
164
+ // Build Json object and resolve success
165
+ JSObject ret = new JSObject();
166
+ ret.put("url", url);
167
+ call.resolve(ret);
168
+ }
169
+
170
+ @PluginMethod
171
+ public void setBannerUrl(PluginCall call) {
172
+ if (!call.getData().has("url")) {
173
+ call.reject("No url provided");
174
+ return;
175
+ }
176
+
177
+ String url = call.getString("url");
178
+ implementation.setBannerUrl(url);
179
+
180
+ // Build Json object and resolve success
181
+ JSObject ret = new JSObject();
182
+ ret.put("url", url);
183
+ call.resolve(ret);
184
+ }
185
+
186
+ @PluginMethod
187
+ public void setModalUrl(PluginCall call) {
188
+ if (!call.getData().has("url")) {
189
+ call.reject("No url provided");
190
+ return;
191
+ }
192
+
193
+ String url = call.getString("url");
194
+ implementation.setModalUrl(url);
195
+
196
+ // Build Json object and resolve success
197
+ JSObject ret = new JSObject();
198
+ ret.put("url", url);
199
+ call.resolve(ret);
200
+ }
201
+
89
202
  @PluginMethod
90
203
  public void identify(PluginCall call) {
91
204
  // If userId is empty, then pass back error
package/dist/docs.json CHANGED
@@ -26,6 +26,153 @@
26
26
  "complexTypes": [],
27
27
  "slug": "initialize"
28
28
  },
29
+ {
30
+ "name": "setRegion",
31
+ "signature": "(options: { region: 'eu' | 'us'; }) => Promise<{ region: string; }>",
32
+ "parameters": [
33
+ {
34
+ "name": "options",
35
+ "docs": "",
36
+ "type": "{ region: 'eu' | 'us'; }"
37
+ }
38
+ ],
39
+ "returns": "Promise<{ region: string; }>",
40
+ "tags": [
41
+ {
42
+ "name": "since",
43
+ "text": "18.0.0"
44
+ }
45
+ ],
46
+ "docs": "Set the data region of your Gleap project (\"eu\" is the default).\nSets the API, websocket and realtime hosts at once. Must be called before initialize.\nA manual setter (setApiUrl, setWSApiUrl, setRealtimeHost) called afterwards overrides that single host.",
47
+ "complexTypes": [],
48
+ "slug": "setregion"
49
+ },
50
+ {
51
+ "name": "setApiUrl",
52
+ "signature": "(options: { url: string; }) => Promise<{ url: string; }>",
53
+ "parameters": [
54
+ {
55
+ "name": "options",
56
+ "docs": "",
57
+ "type": "{ url: string; }"
58
+ }
59
+ ],
60
+ "returns": "Promise<{ url: string; }>",
61
+ "tags": [
62
+ {
63
+ "name": "since",
64
+ "text": "18.0.0"
65
+ }
66
+ ],
67
+ "docs": "Set a custom API url. Must be called before initialize.",
68
+ "complexTypes": [],
69
+ "slug": "setapiurl"
70
+ },
71
+ {
72
+ "name": "setWSApiUrl",
73
+ "signature": "(options: { url: string; }) => Promise<{ url: string; }>",
74
+ "parameters": [
75
+ {
76
+ "name": "options",
77
+ "docs": "",
78
+ "type": "{ url: string; }"
79
+ }
80
+ ],
81
+ "returns": "Promise<{ url: string; }>",
82
+ "tags": [
83
+ {
84
+ "name": "since",
85
+ "text": "18.0.0"
86
+ }
87
+ ],
88
+ "docs": "Set a custom websocket API url. Must be called before initialize.",
89
+ "complexTypes": [],
90
+ "slug": "setwsapiurl"
91
+ },
92
+ {
93
+ "name": "setRealtimeHost",
94
+ "signature": "(options: { host: string; }) => Promise<{ host: string; }>",
95
+ "parameters": [
96
+ {
97
+ "name": "options",
98
+ "docs": "",
99
+ "type": "{ host: string; }"
100
+ }
101
+ ],
102
+ "returns": "Promise<{ host: string; }>",
103
+ "tags": [
104
+ {
105
+ "name": "since",
106
+ "text": "18.0.0"
107
+ }
108
+ ],
109
+ "docs": "Set a custom realtime host (hostname only, without protocol or path). Must be called before initialize.",
110
+ "complexTypes": [],
111
+ "slug": "setrealtimehost"
112
+ },
113
+ {
114
+ "name": "setFrameUrl",
115
+ "signature": "(options: { url: string; }) => Promise<{ url: string; }>",
116
+ "parameters": [
117
+ {
118
+ "name": "options",
119
+ "docs": "",
120
+ "type": "{ url: string; }"
121
+ }
122
+ ],
123
+ "returns": "Promise<{ url: string; }>",
124
+ "tags": [
125
+ {
126
+ "name": "since",
127
+ "text": "18.0.0"
128
+ }
129
+ ],
130
+ "docs": "Set a custom widget frame url. Must be called before initialize.",
131
+ "complexTypes": [],
132
+ "slug": "setframeurl"
133
+ },
134
+ {
135
+ "name": "setBannerUrl",
136
+ "signature": "(options: { url: string; }) => Promise<{ url: string; }>",
137
+ "parameters": [
138
+ {
139
+ "name": "options",
140
+ "docs": "",
141
+ "type": "{ url: string; }"
142
+ }
143
+ ],
144
+ "returns": "Promise<{ url: string; }>",
145
+ "tags": [
146
+ {
147
+ "name": "since",
148
+ "text": "18.0.0"
149
+ }
150
+ ],
151
+ "docs": "Set a custom banner url. Must be called before initialize.",
152
+ "complexTypes": [],
153
+ "slug": "setbannerurl"
154
+ },
155
+ {
156
+ "name": "setModalUrl",
157
+ "signature": "(options: { url: string; }) => Promise<{ url: string; }>",
158
+ "parameters": [
159
+ {
160
+ "name": "options",
161
+ "docs": "",
162
+ "type": "{ url: string; }"
163
+ }
164
+ ],
165
+ "returns": "Promise<{ url: string; }>",
166
+ "tags": [
167
+ {
168
+ "name": "since",
169
+ "text": "18.0.0"
170
+ }
171
+ ],
172
+ "docs": "Set a custom modal url. Must be called before initialize.",
173
+ "complexTypes": [],
174
+ "slug": "setmodalurl"
175
+ },
29
176
  {
30
177
  "name": "identify",
31
178
  "signature": "(options: { userId: string; userHash?: string; name?: string; email?: string; phone?: string; companyId?: string; companyName?: string; avatar?: string; sla?: number; plan?: string; value?: number; customData?: Object; }) => Promise<{ identify: boolean; }>",
@@ -17,6 +17,78 @@ export interface GleapPlugin {
17
17
  initialized: boolean;
18
18
  }>;
19
19
  /**
20
+ * Set the data region of your Gleap project ("eu" is the default).
21
+ * Sets the API, websocket and realtime hosts at once. Must be called before initialize.
22
+ * A manual setter (setApiUrl, setWSApiUrl, setRealtimeHost) called afterwards overrides that single host.
23
+ *
24
+ * @since 18.0.0
25
+ */
26
+ setRegion(options: {
27
+ region: 'eu' | 'us';
28
+ }): Promise<{
29
+ region: string;
30
+ }>;
31
+ /**
32
+ * Set a custom API url. Must be called before initialize.
33
+ *
34
+ * @since 18.0.0
35
+ */
36
+ setApiUrl(options: {
37
+ url: string;
38
+ }): Promise<{
39
+ url: string;
40
+ }>;
41
+ /**
42
+ * Set a custom websocket API url. Must be called before initialize.
43
+ *
44
+ * @since 18.0.0
45
+ */
46
+ setWSApiUrl(options: {
47
+ url: string;
48
+ }): Promise<{
49
+ url: string;
50
+ }>;
51
+ /**
52
+ * Set a custom realtime host (hostname only, without protocol or path). Must be called before initialize.
53
+ *
54
+ * @since 18.0.0
55
+ */
56
+ setRealtimeHost(options: {
57
+ host: string;
58
+ }): Promise<{
59
+ host: string;
60
+ }>;
61
+ /**
62
+ * Set a custom widget frame url. Must be called before initialize.
63
+ *
64
+ * @since 18.0.0
65
+ */
66
+ setFrameUrl(options: {
67
+ url: string;
68
+ }): Promise<{
69
+ url: string;
70
+ }>;
71
+ /**
72
+ * Set a custom banner url. Must be called before initialize.
73
+ *
74
+ * @since 18.0.0
75
+ */
76
+ setBannerUrl(options: {
77
+ url: string;
78
+ }): Promise<{
79
+ url: string;
80
+ }>;
81
+ /**
82
+ * Set a custom modal url. Must be called before initialize.
83
+ *
84
+ * @since 18.0.0
85
+ */
86
+ setModalUrl(options: {
87
+ url: string;
88
+ }): Promise<{
89
+ url: string;
90
+ }>;
91
+ /**
20
92
  * Set user identity
21
93
  *
22
94
  * @since 7.0.0
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nexport type CallbackID = string;\n\nexport interface GleapEventMessage {\n name: string,\n data?: any,\n}\n\nexport type GleapEventCallback = (message: GleapEventMessage | null, err?: any) => void;\n\nexport interface GleapPlugin {\n /**\n * Initialize Gleap with an API key\n *\n * @since 7.0.0\n */\n initialize(options: {\n API_KEY: string;\n }): Promise<{\n initialized: boolean;\n }>;\n\n /**\n * Set user identity\n *\n * @since 7.0.0\n */\n identify(options: {\n userId: string;\n userHash?: string;\n name?: string;\n email?: string;\n phone?: string;\n companyId?: string;\n companyName?: string;\n avatar?: string;\n sla?: number;\n plan?: string;\n value?: number;\n customData?: Object;\n }): Promise<{\n identify: boolean;\n }>;\n\n /**\n * Update user properties\n *\n * @since 13.2.1\n */\n updateContact(options: {\n name?: string;\n email?: string;\n phone?: string;\n companyId?: string;\n companyName?: string;\n avatar?: string;\n sla?: number;\n plan?: string;\n value?: number;\n customData?: Object;\n }): Promise<{\n identify: boolean;\n }>;\n\n /**\n * Clear user identity\n *\n * @since 7.0.0\n */\n clearIdentity(): Promise<{\n clearIdentity: boolean;\n }>;\n\n /**\n * Get the current user identity\n *\n * @since 8.1.0\n */\n getIdentity(): Promise<{\n identity: {\n userId: string;\n name?: string;\n email?: string;\n phone?: string;\n value?: number;\n };\n }>;\n\n /**\n * User identified status.\n *\n * @since 8.1.0\n */\n isUserIdentified(): Promise<{\n isUserIdentified: boolean;\n }>;\n\n /**\n * Submit a custom log message with the given level\n *\n * @since 7.0.0\n */\n log(options: {\n message: string;\n logLevel?: \"ERROR\" | \"WARNING\" | \"INFO\";\n }): Promise<{\n logged: boolean;\n }>;\n\n /**\n * Manually show a survey.\n *\n * @since 8.5.1\n */\n showSurvey(options: {\n surveyId: string;\n format?: \"survey\" | \"survey_full\";\n }): Promise<{\n opened: boolean;\n }>;\n\n /**\n * Add custom data\n *\n * @since 7.0.0\n */\n attachCustomData(options: {\n data: any;\n }): Promise<{\n attachedCustomData: boolean;\n }>;\n\n /**\n * Set tags\n *\n * @since 8.6.0\n */\n setTags(options: {\n tags: string[];\n }): Promise<{\n tagsSet: boolean;\n }>;\n\n /**\n * Set network logs blacklist\n *\n * @since 13.2.1\n */\n setNetworkLogsBlacklist(options: {\n blacklist: string[];\n }): Promise<{\n blacklistSet: boolean;\n }>;\n\n /**\n * Set network logs props to ignore\n *\n * @since 13.2.1\n */\n setNetworkLogPropsToIgnore(options: {\n propsToIgnore: string[];\n }): Promise<{\n propsToIgnoreSet: boolean;\n }>;\n\n /**\n * Registers a Frontend tool defined on your AI agent in the Gleap dashboard.\n * Prefer the `registerAgentTool(name, handler)` helper exported by this\n * package — it wires the agentToolExecution event and result round-trip for\n * you.\n *\n * @since 15.0.0\n */\n registerAgentTool(options: {\n name: string;\n }): Promise<void>;\n\n /**\n * Resolves a pending agent tool execution with the handler's result.\n * Used by the `registerAgentTool(name, handler)` helper.\n *\n * @since 15.0.0\n */\n sendAgentToolResult(options: {\n executionId: string;\n result: string;\n }): Promise<void>;\n\n /**\n * Called when a registered agent tool should execute.\n *\n * @since 15.0.0\n */\n addListener(\n eventName: 'agentToolExecution',\n listenerFunc: (data: {\n executionId: string;\n name: string;\n params: any;\n }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Sets the value of a ticket attribute\n *\n * @since 13.5.0\n */\n setTicketAttribute(options: {\n key: string;\n value: string;\n }): Promise<{\n setTicketAttribute: boolean;\n }>;\n\n /**\n * Unset a ticket attribute\n *\n * @since 14.1.0\n */\n unsetTicketAttribute(options: {\n key: string;\n }): Promise<{\n unsetTicketAttribute: boolean;\n }>;\n\n /**\n * Clear all ticket attributes\n *\n * @since 14.1.0\n */\n clearTicketAttributes(): Promise<{\n clearTicketAttributes: boolean;\n }>;\n\n /**\n * Set custom data\n *\n * @since 7.0.0\n */\n setCustomData(options: {\n key: string;\n value: string;\n }): Promise<{\n setCustomData: boolean;\n }>;\n\n /**\n * Remove custom data by key\n *\n * @since 7.0.0\n */\n removeCustomData(options: {\n key: string;\n }): Promise<{\n removedCustomData: boolean;\n }>;\n\n /**\n * Clear custom data\n *\n * @since 7.0.0\n */\n clearCustomData(): Promise<{\n clearedCustomData: boolean;\n }>;\n\n /**\n * Log event to Gleap\n *\n * @since 8.0.0\n */\n trackEvent(options: {\n name: string;\n data?: any;\n }): Promise<{\n loggedEvent: boolean;\n }>;\n\n /**\n * Track a page view\n *\n * @since 8.4.1\n */\n trackPage(options: {\n pageName: string;\n }): Promise<{\n trackedPage: boolean;\n }>;\n\n /**\n * \n *\n * @since 7.0.0\n */\n setEventCallback(\n callback: GleapEventCallback,\n ): Promise<CallbackID>;\n\n /**\n * Log event to Gleap\n *\n * @since 7.0.0\n */\n sendSilentCrashReport(options: {\n description: string,\n severity?: \"LOW\" | \"MEDIUM\" | \"HIGH\";\n dataExclusion?: {\n customData: Boolean;\n metaData: Boolean;\n attachments: Boolean;\n consoleLog: Boolean;\n networkLogs: Boolean;\n customEventLog: Boolean;\n screenshot: Boolean;\n replays: Boolean;\n };\n }): Promise<{\n sentSilentBugReport: boolean;\n }>;\n\n /**\n * Prefills the widget's form data\n *\n * @since 7.0.0\n */\n preFillForm(options: {\n data: any;\n }): Promise<{\n preFilledForm: boolean;\n }>;\n\n /**\n * Add attachment as bas64 string\n *\n * @since 7.0.0\n */\n addAttachment(options: {\n base64data: string;\n name: string;\n }): Promise<{\n attachmentAdded: boolean;\n }>;\n\n /**\n * All attachments removed\n *\n * @since 7.0.0\n */\n removeAllAttachments(): Promise<{\n allAttachmentsRemoved: boolean;\n }>;\n\n /**\n * Open widget\n *\n * @since 7.0.0\n */\n open(): Promise<{\n openedWidget: boolean;\n }>;\n\n /**\n * Open news\n *\n * @since 8.4.0\n */\n openNews(options: {\n showBackButton?: boolean;\n }): Promise<{\n openedNews: boolean;\n }>;\n\n /**\n * Open news article\n *\n * @since 8.4.0\n */\n openNewsArticle(options: {\n articleId: string;\n showBackButton?: boolean;\n }): Promise<{\n opened: boolean;\n }>;\n\n /**\n * Open help center\n *\n * @since 8.4.0\n */\n openHelpCenter(options: {\n showBackButton?: boolean;\n }): Promise<{\n opened: boolean;\n }>;\n\n /**\n * Open help center article\n *\n * @since 8.4.0\n */\n openHelpCenterArticle(options: {\n articleId: string;\n showBackButton?: boolean;\n }): Promise<{\n opened: boolean;\n }>;\n\n /**\n * Ask the AI a question\n *\n * @since 15.0.0\n */\n askAI(options: {\n question: string;\n showBackButton?: boolean;\n }): Promise<{\n opened: boolean;\n }>;\n\n /**\n * Open help center collection\n *\n * @since 8.4.0\n */\n openHelpCenterCollection(options: {\n collectionId: string;\n showBackButton?: boolean;\n }): Promise<{\n opened: boolean;\n }>;\n\n /**\n * Search help center\n *\n * @since 8.4.0\n */\n searchHelpCenter(options: {\n term: string;\n showBackButton?: boolean;\n }): Promise<{\n opened: boolean;\n }>;\n\n /**\n * Open feature requests\n *\n * @since 8.4.0\n */\n openFeatureRequests(options: {\n showBackButton?: boolean;\n }): Promise<{\n openedFeatureRequests: boolean;\n }>;\n\n /**\n * Close widget\n *\n * @since 7.0.0\n */\n close(): Promise<{\n closedWidget: boolean;\n }>;\n\n /**\n * Check widget status code\n *\n * @since 7.0.0\n */\n isOpened(): Promise<{\n isOpened: boolean;\n }>;\n\n /**\n * Start feedback flow\n *\n * @since 7.0.0\n */\n startFeedbackFlow(options: {\n feedbackFlow?: string;\n showBackButton?: boolean;\n }): Promise<{\n startedFeedbackFlow: boolean;\n }>;\n\n /**\n * Start a classic form\n *\n * @since 13.1.0\n */\n startClassicForm(options: {\n formId?: string;\n showBackButton?: boolean;\n }): Promise<{\n classicFormStarted: boolean;\n }>;\n\n /**\n * Start a new conversation\n *\n * @since 13.1.0\n */\n startConversation(options: {\n showBackButton?: boolean;\n }): Promise<{\n conversationStarted: boolean;\n }>;\n\n /**\n * Opens the conversations tab.\n *\n * @since 13.9.0\n */\n openConversation(options: {\n showBackButton?: boolean;\n }): Promise<{\n conversationsOpened: boolean;\n }>;\n\n /**\n * Start bot\n *\n * @since 10.0.3\n */\n startBot(options: {\n botId?: string;\n showBackButton?: boolean;\n }): Promise<{\n startedBot: boolean;\n }>;\n\n /**\n * Show or hide the feedback button.\n *\n * @since 8.0.0\n */\n showFeedbackButton(options: {\n show?: boolean;\n }): Promise<{\n feedbackButtonShown: boolean;\n }>;\n\n /**\n* Disable in app notifications.\n*\n* @since 8.6.1\n*/\n setDisableInAppNotifications(options: {\n disableInAppNotifications?: boolean;\n }): Promise<{\n inAppNotificationsDisabled: boolean;\n }>;\n\n /**\n * Set Language\n *\n * @since 7.0.0\n */\n setLanguage(options: {\n languageCode: string;\n }): Promise<{\n setLanguage: string;\n }>;\n\n /**\n * Disable console log overwrite\n *\n * @since 7.0.0\n */\n disableConsoleLogOverwrite(): Promise<{\n consoleLogDisabled: boolean;\n }>;\n\n /**\n * Enable debug console log\n *\n * @since 7.0.0\n */\n enableDebugConsoleLog(): Promise<{\n debugConsoleLogEnabled: boolean;\n }>;\n\n /**\n * Set the notification container offset\n *\n * @since 15.2.0\n */\n setNotificationContainerOffset(options: {\n x: number;\n y: number;\n }): Promise<{\n notificationContainerOffsetSet: boolean;\n }>;\n\n}"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nexport type CallbackID = string;\n\nexport interface GleapEventMessage {\n name: string,\n data?: any,\n}\n\nexport type GleapEventCallback = (message: GleapEventMessage | null, err?: any) => void;\n\nexport interface GleapPlugin {\n /**\n * Initialize Gleap with an API key\n *\n * @since 7.0.0\n */\n initialize(options: {\n API_KEY: string;\n }): Promise<{\n initialized: boolean;\n }>;\n\n /**\n * Set the data region of your Gleap project (\"eu\" is the default).\n * Sets the API, websocket and realtime hosts at once. Must be called before initialize.\n * A manual setter (setApiUrl, setWSApiUrl, setRealtimeHost) called afterwards overrides that single host.\n *\n * @since 18.0.0\n */\n setRegion(options: {\n region: 'eu' | 'us';\n }): Promise<{\n region: string;\n }>;\n\n /**\n * Set a custom API url. Must be called before initialize.\n *\n * @since 18.0.0\n */\n setApiUrl(options: {\n url: string;\n }): Promise<{\n url: string;\n }>;\n\n /**\n * Set a custom websocket API url. Must be called before initialize.\n *\n * @since 18.0.0\n */\n setWSApiUrl(options: {\n url: string;\n }): Promise<{\n url: string;\n }>;\n\n /**\n * Set a custom realtime host (hostname only, without protocol or path). Must be called before initialize.\n *\n * @since 18.0.0\n */\n setRealtimeHost(options: {\n host: string;\n }): Promise<{\n host: string;\n }>;\n\n /**\n * Set a custom widget frame url. Must be called before initialize.\n *\n * @since 18.0.0\n */\n setFrameUrl(options: {\n url: string;\n }): Promise<{\n url: string;\n }>;\n\n /**\n * Set a custom banner url. Must be called before initialize.\n *\n * @since 18.0.0\n */\n setBannerUrl(options: {\n url: string;\n }): Promise<{\n url: string;\n }>;\n\n /**\n * Set a custom modal url. Must be called before initialize.\n *\n * @since 18.0.0\n */\n setModalUrl(options: {\n url: string;\n }): Promise<{\n url: string;\n }>;\n\n /**\n * Set user identity\n *\n * @since 7.0.0\n */\n identify(options: {\n userId: string;\n userHash?: string;\n name?: string;\n email?: string;\n phone?: string;\n companyId?: string;\n companyName?: string;\n avatar?: string;\n sla?: number;\n plan?: string;\n value?: number;\n customData?: Object;\n }): Promise<{\n identify: boolean;\n }>;\n\n /**\n * Update user properties\n *\n * @since 13.2.1\n */\n updateContact(options: {\n name?: string;\n email?: string;\n phone?: string;\n companyId?: string;\n companyName?: string;\n avatar?: string;\n sla?: number;\n plan?: string;\n value?: number;\n customData?: Object;\n }): Promise<{\n identify: boolean;\n }>;\n\n /**\n * Clear user identity\n *\n * @since 7.0.0\n */\n clearIdentity(): Promise<{\n clearIdentity: boolean;\n }>;\n\n /**\n * Get the current user identity\n *\n * @since 8.1.0\n */\n getIdentity(): Promise<{\n identity: {\n userId: string;\n name?: string;\n email?: string;\n phone?: string;\n value?: number;\n };\n }>;\n\n /**\n * User identified status.\n *\n * @since 8.1.0\n */\n isUserIdentified(): Promise<{\n isUserIdentified: boolean;\n }>;\n\n /**\n * Submit a custom log message with the given level\n *\n * @since 7.0.0\n */\n log(options: {\n message: string;\n logLevel?: \"ERROR\" | \"WARNING\" | \"INFO\";\n }): Promise<{\n logged: boolean;\n }>;\n\n /**\n * Manually show a survey.\n *\n * @since 8.5.1\n */\n showSurvey(options: {\n surveyId: string;\n format?: \"survey\" | \"survey_full\";\n }): Promise<{\n opened: boolean;\n }>;\n\n /**\n * Add custom data\n *\n * @since 7.0.0\n */\n attachCustomData(options: {\n data: any;\n }): Promise<{\n attachedCustomData: boolean;\n }>;\n\n /**\n * Set tags\n *\n * @since 8.6.0\n */\n setTags(options: {\n tags: string[];\n }): Promise<{\n tagsSet: boolean;\n }>;\n\n /**\n * Set network logs blacklist\n *\n * @since 13.2.1\n */\n setNetworkLogsBlacklist(options: {\n blacklist: string[];\n }): Promise<{\n blacklistSet: boolean;\n }>;\n\n /**\n * Set network logs props to ignore\n *\n * @since 13.2.1\n */\n setNetworkLogPropsToIgnore(options: {\n propsToIgnore: string[];\n }): Promise<{\n propsToIgnoreSet: boolean;\n }>;\n\n /**\n * Registers a Frontend tool defined on your AI agent in the Gleap dashboard.\n * Prefer the `registerAgentTool(name, handler)` helper exported by this\n * package — it wires the agentToolExecution event and result round-trip for\n * you.\n *\n * @since 15.0.0\n */\n registerAgentTool(options: {\n name: string;\n }): Promise<void>;\n\n /**\n * Resolves a pending agent tool execution with the handler's result.\n * Used by the `registerAgentTool(name, handler)` helper.\n *\n * @since 15.0.0\n */\n sendAgentToolResult(options: {\n executionId: string;\n result: string;\n }): Promise<void>;\n\n /**\n * Called when a registered agent tool should execute.\n *\n * @since 15.0.0\n */\n addListener(\n eventName: 'agentToolExecution',\n listenerFunc: (data: {\n executionId: string;\n name: string;\n params: any;\n }) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Sets the value of a ticket attribute\n *\n * @since 13.5.0\n */\n setTicketAttribute(options: {\n key: string;\n value: string;\n }): Promise<{\n setTicketAttribute: boolean;\n }>;\n\n /**\n * Unset a ticket attribute\n *\n * @since 14.1.0\n */\n unsetTicketAttribute(options: {\n key: string;\n }): Promise<{\n unsetTicketAttribute: boolean;\n }>;\n\n /**\n * Clear all ticket attributes\n *\n * @since 14.1.0\n */\n clearTicketAttributes(): Promise<{\n clearTicketAttributes: boolean;\n }>;\n\n /**\n * Set custom data\n *\n * @since 7.0.0\n */\n setCustomData(options: {\n key: string;\n value: string;\n }): Promise<{\n setCustomData: boolean;\n }>;\n\n /**\n * Remove custom data by key\n *\n * @since 7.0.0\n */\n removeCustomData(options: {\n key: string;\n }): Promise<{\n removedCustomData: boolean;\n }>;\n\n /**\n * Clear custom data\n *\n * @since 7.0.0\n */\n clearCustomData(): Promise<{\n clearedCustomData: boolean;\n }>;\n\n /**\n * Log event to Gleap\n *\n * @since 8.0.0\n */\n trackEvent(options: {\n name: string;\n data?: any;\n }): Promise<{\n loggedEvent: boolean;\n }>;\n\n /**\n * Track a page view\n *\n * @since 8.4.1\n */\n trackPage(options: {\n pageName: string;\n }): Promise<{\n trackedPage: boolean;\n }>;\n\n /**\n * \n *\n * @since 7.0.0\n */\n setEventCallback(\n callback: GleapEventCallback,\n ): Promise<CallbackID>;\n\n /**\n * Log event to Gleap\n *\n * @since 7.0.0\n */\n sendSilentCrashReport(options: {\n description: string,\n severity?: \"LOW\" | \"MEDIUM\" | \"HIGH\";\n dataExclusion?: {\n customData: Boolean;\n metaData: Boolean;\n attachments: Boolean;\n consoleLog: Boolean;\n networkLogs: Boolean;\n customEventLog: Boolean;\n screenshot: Boolean;\n replays: Boolean;\n };\n }): Promise<{\n sentSilentBugReport: boolean;\n }>;\n\n /**\n * Prefills the widget's form data\n *\n * @since 7.0.0\n */\n preFillForm(options: {\n data: any;\n }): Promise<{\n preFilledForm: boolean;\n }>;\n\n /**\n * Add attachment as bas64 string\n *\n * @since 7.0.0\n */\n addAttachment(options: {\n base64data: string;\n name: string;\n }): Promise<{\n attachmentAdded: boolean;\n }>;\n\n /**\n * All attachments removed\n *\n * @since 7.0.0\n */\n removeAllAttachments(): Promise<{\n allAttachmentsRemoved: boolean;\n }>;\n\n /**\n * Open widget\n *\n * @since 7.0.0\n */\n open(): Promise<{\n openedWidget: boolean;\n }>;\n\n /**\n * Open news\n *\n * @since 8.4.0\n */\n openNews(options: {\n showBackButton?: boolean;\n }): Promise<{\n openedNews: boolean;\n }>;\n\n /**\n * Open news article\n *\n * @since 8.4.0\n */\n openNewsArticle(options: {\n articleId: string;\n showBackButton?: boolean;\n }): Promise<{\n opened: boolean;\n }>;\n\n /**\n * Open help center\n *\n * @since 8.4.0\n */\n openHelpCenter(options: {\n showBackButton?: boolean;\n }): Promise<{\n opened: boolean;\n }>;\n\n /**\n * Open help center article\n *\n * @since 8.4.0\n */\n openHelpCenterArticle(options: {\n articleId: string;\n showBackButton?: boolean;\n }): Promise<{\n opened: boolean;\n }>;\n\n /**\n * Ask the AI a question\n *\n * @since 15.0.0\n */\n askAI(options: {\n question: string;\n showBackButton?: boolean;\n }): Promise<{\n opened: boolean;\n }>;\n\n /**\n * Open help center collection\n *\n * @since 8.4.0\n */\n openHelpCenterCollection(options: {\n collectionId: string;\n showBackButton?: boolean;\n }): Promise<{\n opened: boolean;\n }>;\n\n /**\n * Search help center\n *\n * @since 8.4.0\n */\n searchHelpCenter(options: {\n term: string;\n showBackButton?: boolean;\n }): Promise<{\n opened: boolean;\n }>;\n\n /**\n * Open feature requests\n *\n * @since 8.4.0\n */\n openFeatureRequests(options: {\n showBackButton?: boolean;\n }): Promise<{\n openedFeatureRequests: boolean;\n }>;\n\n /**\n * Close widget\n *\n * @since 7.0.0\n */\n close(): Promise<{\n closedWidget: boolean;\n }>;\n\n /**\n * Check widget status code\n *\n * @since 7.0.0\n */\n isOpened(): Promise<{\n isOpened: boolean;\n }>;\n\n /**\n * Start feedback flow\n *\n * @since 7.0.0\n */\n startFeedbackFlow(options: {\n feedbackFlow?: string;\n showBackButton?: boolean;\n }): Promise<{\n startedFeedbackFlow: boolean;\n }>;\n\n /**\n * Start a classic form\n *\n * @since 13.1.0\n */\n startClassicForm(options: {\n formId?: string;\n showBackButton?: boolean;\n }): Promise<{\n classicFormStarted: boolean;\n }>;\n\n /**\n * Start a new conversation\n *\n * @since 13.1.0\n */\n startConversation(options: {\n showBackButton?: boolean;\n }): Promise<{\n conversationStarted: boolean;\n }>;\n\n /**\n * Opens the conversations tab.\n *\n * @since 13.9.0\n */\n openConversation(options: {\n showBackButton?: boolean;\n }): Promise<{\n conversationsOpened: boolean;\n }>;\n\n /**\n * Start bot\n *\n * @since 10.0.3\n */\n startBot(options: {\n botId?: string;\n showBackButton?: boolean;\n }): Promise<{\n startedBot: boolean;\n }>;\n\n /**\n * Show or hide the feedback button.\n *\n * @since 8.0.0\n */\n showFeedbackButton(options: {\n show?: boolean;\n }): Promise<{\n feedbackButtonShown: boolean;\n }>;\n\n /**\n* Disable in app notifications.\n*\n* @since 8.6.1\n*/\n setDisableInAppNotifications(options: {\n disableInAppNotifications?: boolean;\n }): Promise<{\n inAppNotificationsDisabled: boolean;\n }>;\n\n /**\n * Set Language\n *\n * @since 7.0.0\n */\n setLanguage(options: {\n languageCode: string;\n }): Promise<{\n setLanguage: string;\n }>;\n\n /**\n * Disable console log overwrite\n *\n * @since 7.0.0\n */\n disableConsoleLogOverwrite(): Promise<{\n consoleLogDisabled: boolean;\n }>;\n\n /**\n * Enable debug console log\n *\n * @since 7.0.0\n */\n enableDebugConsoleLog(): Promise<{\n debugConsoleLogEnabled: boolean;\n }>;\n\n /**\n * Set the notification container offset\n *\n * @since 15.2.0\n */\n setNotificationContainerOffset(options: {\n x: number;\n y: number;\n }): Promise<{\n notificationContainerOffsetSet: boolean;\n }>;\n\n}"]}
package/dist/esm/web.d.ts CHANGED
@@ -12,6 +12,41 @@ export declare class GleapWeb extends WebPlugin implements GleapPlugin {
12
12
  }): Promise<{
13
13
  initialized: boolean;
14
14
  }>;
15
+ setRegion(options: {
16
+ region: 'eu' | 'us';
17
+ }): Promise<{
18
+ region: string;
19
+ }>;
20
+ setApiUrl(options: {
21
+ url: string;
22
+ }): Promise<{
23
+ url: string;
24
+ }>;
25
+ setWSApiUrl(options: {
26
+ url: string;
27
+ }): Promise<{
28
+ url: string;
29
+ }>;
30
+ setRealtimeHost(options: {
31
+ host: string;
32
+ }): Promise<{
33
+ host: string;
34
+ }>;
35
+ setFrameUrl(options: {
36
+ url: string;
37
+ }): Promise<{
38
+ url: string;
39
+ }>;
40
+ setBannerUrl(options: {
41
+ url: string;
42
+ }): Promise<{
43
+ url: string;
44
+ }>;
45
+ setModalUrl(options: {
46
+ url: string;
47
+ }): Promise<{
48
+ url: string;
49
+ }>;
15
50
  registerCallbackListeners(): void;
16
51
  registerAgentTool(options: {
17
52
  name: string;