crisp-api 10.0.2 → 10.0.4
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/CHANGELOG.md +6 -2
- package/dist/crisp.d.ts +41 -29
- package/dist/crisp.js +43 -34
- package/dist/resources/BaseResource.d.ts +6 -0
- package/dist/resources/BaseResource.js +6 -0
- package/dist/resources/BucketURL.d.ts +9 -0
- package/dist/resources/BucketURL.js +6 -0
- package/dist/resources/MediaAnimation.d.ts +6 -0
- package/dist/resources/MediaAnimation.js +9 -1
- package/dist/resources/PluginConnect.d.ts +9 -0
- package/dist/resources/PluginConnect.js +6 -0
- package/dist/resources/PluginSubscription.d.ts +9 -0
- package/dist/resources/PluginSubscription.js +9 -1
- package/dist/resources/WebsiteAnalytics.d.ts +6 -0
- package/dist/resources/WebsiteAnalytics.js +9 -1
- package/dist/resources/WebsiteAvailability.d.ts +9 -0
- package/dist/resources/WebsiteAvailability.js +12 -2
- package/dist/resources/WebsiteBase.d.ts +9 -0
- package/dist/resources/WebsiteBase.js +6 -0
- package/dist/resources/WebsiteBatch.d.ts +9 -0
- package/dist/resources/WebsiteBatch.js +6 -0
- package/dist/resources/WebsiteCampaign.d.ts +9 -0
- package/dist/resources/WebsiteCampaign.js +8 -1
- package/dist/resources/WebsiteConversation.d.ts +9 -0
- package/dist/resources/WebsiteConversation.js +15 -3
- package/dist/resources/WebsiteHelpdesk.d.ts +15 -2
- package/dist/resources/WebsiteHelpdesk.js +6 -0
- package/dist/resources/WebsiteOperator.d.ts +9 -0
- package/dist/resources/WebsiteOperator.js +6 -0
- package/dist/resources/WebsitePeople.d.ts +9 -0
- package/dist/resources/WebsitePeople.js +6 -0
- package/dist/resources/WebsiteSettings.d.ts +9 -0
- package/dist/resources/WebsiteSettings.js +6 -0
- package/dist/resources/WebsiteVerify.d.ts +9 -0
- package/dist/resources/WebsiteVerify.js +6 -0
- package/dist/resources/WebsiteVisitors.d.ts +9 -0
- package/dist/resources/WebsiteVisitors.js +12 -2
- package/dist/resources/index.d.ts +3 -0
- package/dist/resources/index.js +3 -1
- package/dist/services/bucket.d.ts +6 -0
- package/dist/services/bucket.js +3 -0
- package/dist/services/media.d.ts +6 -0
- package/dist/services/media.js +3 -0
- package/dist/services/plugin.d.ts +6 -0
- package/dist/services/plugin.js +3 -0
- package/dist/services/website.d.ts +6 -0
- package/dist/services/website.js +3 -0
- package/lib/crisp.ts +123 -74
- package/lib/resources/BaseResource.ts +8 -0
- package/lib/resources/BucketURL.ts +12 -3
- package/lib/resources/MediaAnimation.ts +11 -1
- package/lib/resources/PluginConnect.ts +12 -5
- package/lib/resources/PluginSubscription.ts +36 -8
- package/lib/resources/WebsiteAnalytics.ts +11 -1
- package/lib/resources/WebsiteAvailability.ts +24 -4
- package/lib/resources/WebsiteBase.ts +14 -3
- package/lib/resources/WebsiteBatch.ts +24 -4
- package/lib/resources/WebsiteCampaign.ts +49 -16
- package/lib/resources/WebsiteConversation.ts +136 -45
- package/lib/resources/WebsiteHelpdesk.ts +81 -34
- package/lib/resources/WebsiteOperator.ts +28 -6
- package/lib/resources/WebsitePeople.ts +60 -19
- package/lib/resources/WebsiteSettings.ts +17 -2
- package/lib/resources/WebsiteVerify.ts +17 -3
- package/lib/resources/WebsiteVisitors.ts +32 -9
- package/lib/resources/index.ts +4 -1
- package/lib/services/bucket.ts +8 -0
- package/lib/services/media.ts +8 -0
- package/lib/services/plugin.ts +8 -0
- package/lib/services/website.ts +8 -0
- package/package.json +1 -1
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
// PROJECT: RESOURCES
|
|
13
13
|
import BaseResource from "./BaseResource";
|
|
14
14
|
|
|
15
|
+
/**************************************************************************
|
|
16
|
+
* INTERFACES
|
|
17
|
+
***************************************************************************/
|
|
18
|
+
|
|
15
19
|
export interface WebsiteSettings {
|
|
16
20
|
websiteID?: string;
|
|
17
21
|
name?: string;
|
|
@@ -165,6 +169,10 @@ export interface WebsiteSettingsUpdateChatbox {
|
|
|
165
169
|
blocked_ips?: string[];
|
|
166
170
|
}
|
|
167
171
|
|
|
172
|
+
/**************************************************************************
|
|
173
|
+
* CLASSES
|
|
174
|
+
***************************************************************************/
|
|
175
|
+
|
|
168
176
|
/**
|
|
169
177
|
* Crisp WebsiteSettings Resource
|
|
170
178
|
*/
|
|
@@ -172,7 +180,7 @@ class WebsiteSettingsService extends BaseResource {
|
|
|
172
180
|
/**
|
|
173
181
|
* Get Website Settings
|
|
174
182
|
*/
|
|
175
|
-
getWebsiteSettings(websiteID: string)
|
|
183
|
+
getWebsiteSettings(websiteID: string): Promise<WebsiteSettings> {
|
|
176
184
|
return this.crisp.get(
|
|
177
185
|
this.crisp.prepareRestUrl(["website", websiteID, "settings"])
|
|
178
186
|
);
|
|
@@ -183,10 +191,17 @@ class WebsiteSettingsService extends BaseResource {
|
|
|
183
191
|
*/
|
|
184
192
|
updateWebsiteSettings(websiteID: string, settings: WebsiteSettingsUpdate) {
|
|
185
193
|
return this.crisp.patch(
|
|
186
|
-
this.crisp.prepareRestUrl(["website", websiteID, "settings"]),
|
|
194
|
+
this.crisp.prepareRestUrl(["website", websiteID, "settings"]),
|
|
195
|
+
|
|
196
|
+
null,
|
|
197
|
+
settings
|
|
187
198
|
);
|
|
188
199
|
};
|
|
189
200
|
}
|
|
190
201
|
|
|
202
|
+
/**************************************************************************
|
|
203
|
+
* EXPORTS
|
|
204
|
+
***************************************************************************/
|
|
205
|
+
|
|
191
206
|
export default WebsiteSettingsService;
|
|
192
207
|
|
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
// PROJECT: RESOURCES
|
|
13
13
|
import BaseResource from "./BaseResource";
|
|
14
14
|
|
|
15
|
+
/**************************************************************************
|
|
16
|
+
* INTERFACES
|
|
17
|
+
***************************************************************************/
|
|
18
|
+
|
|
15
19
|
export interface WebsiteVerifyKeyData {
|
|
16
20
|
data?: WebsiteVerifyKey;
|
|
17
21
|
}
|
|
@@ -28,6 +32,10 @@ export interface WebsiteVerifySettingsUpdate {
|
|
|
28
32
|
enabled?: boolean;
|
|
29
33
|
}
|
|
30
34
|
|
|
35
|
+
/**************************************************************************
|
|
36
|
+
* CLASSES
|
|
37
|
+
***************************************************************************/
|
|
38
|
+
|
|
31
39
|
/**
|
|
32
40
|
* Crisp WebsiteVerify Resource
|
|
33
41
|
*/
|
|
@@ -35,7 +43,7 @@ class WebsiteVerify extends BaseResource {
|
|
|
35
43
|
/**
|
|
36
44
|
* Get Verify Settings
|
|
37
45
|
*/
|
|
38
|
-
getVerifySettings(websiteID: string)
|
|
46
|
+
getVerifySettings(websiteID: string): Promise<WebsiteVerifySettings> {
|
|
39
47
|
return this.crisp.get(
|
|
40
48
|
this.crisp.prepareRestUrl(["website", websiteID, "verify", "settings"])
|
|
41
49
|
);
|
|
@@ -44,7 +52,9 @@ class WebsiteVerify extends BaseResource {
|
|
|
44
52
|
/**
|
|
45
53
|
* Update Verify Settings
|
|
46
54
|
*/
|
|
47
|
-
updateVerifySettings(
|
|
55
|
+
updateVerifySettings(
|
|
56
|
+
websiteID: string, settings: WebsiteVerifySettingsUpdate
|
|
57
|
+
) {
|
|
48
58
|
return this.crisp.patch(
|
|
49
59
|
this.crisp.prepareRestUrl(["website", websiteID, "verify", "settings"]),
|
|
50
60
|
|
|
@@ -55,7 +65,7 @@ class WebsiteVerify extends BaseResource {
|
|
|
55
65
|
/**
|
|
56
66
|
* Get Verify Key
|
|
57
67
|
*/
|
|
58
|
-
getVerifyKey(websiteID: string)
|
|
68
|
+
getVerifyKey(websiteID: string): Promise<WebsiteVerifyKey> {
|
|
59
69
|
return this.crisp.get(
|
|
60
70
|
this.crisp.prepareRestUrl(["website", websiteID, "verify", "key"])
|
|
61
71
|
);
|
|
@@ -73,4 +83,8 @@ class WebsiteVerify extends BaseResource {
|
|
|
73
83
|
};
|
|
74
84
|
}
|
|
75
85
|
|
|
86
|
+
/**************************************************************************
|
|
87
|
+
* EXPORTS
|
|
88
|
+
***************************************************************************/
|
|
89
|
+
|
|
76
90
|
export default WebsiteVerify;
|
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
// PROJECT: RESOURCES
|
|
13
13
|
import BaseResource from "./BaseResource";
|
|
14
14
|
|
|
15
|
+
/**************************************************************************
|
|
16
|
+
* INTERFACES
|
|
17
|
+
***************************************************************************/
|
|
18
|
+
|
|
15
19
|
export interface WebsiteVisitorCount {
|
|
16
20
|
count?: number;
|
|
17
21
|
active?: number;
|
|
@@ -100,6 +104,10 @@ export interface WebsiteVisitorsBlocked {
|
|
|
100
104
|
blocked?: number;
|
|
101
105
|
}
|
|
102
106
|
|
|
107
|
+
/**************************************************************************
|
|
108
|
+
* CLASSES
|
|
109
|
+
***************************************************************************/
|
|
110
|
+
|
|
103
111
|
/**
|
|
104
112
|
* Crisp WebsiteVisitors Resource
|
|
105
113
|
*/
|
|
@@ -107,7 +115,7 @@ class WebsiteVisitors extends BaseResource {
|
|
|
107
115
|
/**
|
|
108
116
|
* Count Visitors
|
|
109
117
|
*/
|
|
110
|
-
countVisitors(websiteID: string)
|
|
118
|
+
countVisitors(websiteID: string): Promise<WebsiteVisitorCount> {
|
|
111
119
|
return this.crisp.get(
|
|
112
120
|
this.crisp.prepareRestUrl(["website", websiteID, "visitors", "count"])
|
|
113
121
|
);
|
|
@@ -116,7 +124,9 @@ class WebsiteVisitors extends BaseResource {
|
|
|
116
124
|
/**
|
|
117
125
|
* List Visitors
|
|
118
126
|
*/
|
|
119
|
-
listVisitors(
|
|
127
|
+
listVisitors(
|
|
128
|
+
websiteID: string, pageNumber: number = 1
|
|
129
|
+
): Promise<WebsiteVisitor[]> {
|
|
120
130
|
return this.crisp.get(
|
|
121
131
|
this.crisp.prepareRestUrl([
|
|
122
132
|
"website", websiteID, "visitors", "list", String(pageNumber)
|
|
@@ -128,8 +138,9 @@ class WebsiteVisitors extends BaseResource {
|
|
|
128
138
|
* Pinpoint Visitors On A Map
|
|
129
139
|
*/
|
|
130
140
|
pinpointVisitorsOnMap(
|
|
131
|
-
websiteID: string, centerLongitude: number, centerLatitude: number,
|
|
132
|
-
|
|
141
|
+
websiteID: string, centerLongitude: number, centerLatitude: number,
|
|
142
|
+
centerRadius: number
|
|
143
|
+
): Promise<WebsiteVisitorsMapPoint[]> {
|
|
133
144
|
// Generate query
|
|
134
145
|
const query: Record<string, string> = {};
|
|
135
146
|
|
|
@@ -157,7 +168,9 @@ class WebsiteVisitors extends BaseResource {
|
|
|
157
168
|
/**
|
|
158
169
|
* Get Session Identifier From Token
|
|
159
170
|
*/
|
|
160
|
-
getSessionIdentifierFromToken(
|
|
171
|
+
getSessionIdentifierFromToken(
|
|
172
|
+
websiteID: string, tokenID: string
|
|
173
|
+
): Promise<WebsiteVisitorsToken> {
|
|
161
174
|
return this.crisp.get(
|
|
162
175
|
this.crisp.prepareRestUrl([
|
|
163
176
|
"website", websiteID, "visitors", "token", tokenID
|
|
@@ -168,7 +181,7 @@ class WebsiteVisitors extends BaseResource {
|
|
|
168
181
|
/**
|
|
169
182
|
* Count Blocked Visitors
|
|
170
183
|
*/
|
|
171
|
-
countBlockedVisitors(websiteID: string)
|
|
184
|
+
countBlockedVisitors(websiteID: string): Promise<WebsiteVisitorsBlocked> {
|
|
172
185
|
return this.crisp.get(
|
|
173
186
|
this.crisp.prepareRestUrl(["website", websiteID, "visitors", "blocked"])
|
|
174
187
|
);
|
|
@@ -177,9 +190,13 @@ class WebsiteVisitors extends BaseResource {
|
|
|
177
190
|
/**
|
|
178
191
|
* Count Blocked Visitors In Rule
|
|
179
192
|
*/
|
|
180
|
-
countBlockedVisitorsInRule(
|
|
193
|
+
countBlockedVisitorsInRule(
|
|
194
|
+
websiteID: string, rule: string
|
|
195
|
+
): Promise<number> {
|
|
181
196
|
return this.crisp.get(
|
|
182
|
-
this.crisp.prepareRestUrl([
|
|
197
|
+
this.crisp.prepareRestUrl([
|
|
198
|
+
"website", websiteID, "visitors", "blocked", rule
|
|
199
|
+
])
|
|
183
200
|
);
|
|
184
201
|
};
|
|
185
202
|
|
|
@@ -188,9 +205,15 @@ class WebsiteVisitors extends BaseResource {
|
|
|
188
205
|
*/
|
|
189
206
|
clearBlockedVisitorsInRule(websiteID: string, rule: string) {
|
|
190
207
|
return this.crisp.delete(
|
|
191
|
-
this.crisp.prepareRestUrl([
|
|
208
|
+
this.crisp.prepareRestUrl([
|
|
209
|
+
"website", websiteID, "visitors", "blocked", rule
|
|
210
|
+
])
|
|
192
211
|
);
|
|
193
212
|
};
|
|
194
213
|
}
|
|
195
214
|
|
|
215
|
+
/**************************************************************************
|
|
216
|
+
* EXPORTS
|
|
217
|
+
***************************************************************************/
|
|
218
|
+
|
|
196
219
|
export default WebsiteVisitors;
|
package/lib/resources/index.ts
CHANGED
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
* Author: Baptiste Jamin <baptiste@crisp.chat>
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
/**************************************************************************
|
|
9
|
+
* EXPORTS
|
|
10
|
+
***************************************************************************/
|
|
11
|
+
|
|
9
12
|
export * from "./BaseResource";
|
|
10
13
|
export * from "./BucketURL";
|
|
11
14
|
export * from "./MediaAnimation";
|
package/lib/services/bucket.ts
CHANGED
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
// PROJECT: RESOURCES
|
|
13
13
|
import BucketURL from "@/resources/BucketURL";
|
|
14
14
|
|
|
15
|
+
/**************************************************************************
|
|
16
|
+
* CLASSES
|
|
17
|
+
***************************************************************************/
|
|
18
|
+
|
|
15
19
|
/**
|
|
16
20
|
* Bucket Service
|
|
17
21
|
*/
|
|
@@ -22,6 +26,10 @@ class BucketService {
|
|
|
22
26
|
];
|
|
23
27
|
}
|
|
24
28
|
|
|
29
|
+
/**************************************************************************
|
|
30
|
+
* EXPORTS
|
|
31
|
+
***************************************************************************/
|
|
32
|
+
|
|
25
33
|
export interface BucketServiceInterface extends
|
|
26
34
|
BucketURL {}
|
|
27
35
|
|
package/lib/services/media.ts
CHANGED
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
// PROJECT: RESOURCES
|
|
13
13
|
import MediaAnimation from "@/resources/MediaAnimation";
|
|
14
14
|
|
|
15
|
+
/**************************************************************************
|
|
16
|
+
* CLASSES
|
|
17
|
+
***************************************************************************/
|
|
18
|
+
|
|
15
19
|
/**
|
|
16
20
|
* Crisp Media Service
|
|
17
21
|
*/
|
|
@@ -22,6 +26,10 @@ class MediaService {
|
|
|
22
26
|
];
|
|
23
27
|
}
|
|
24
28
|
|
|
29
|
+
/**************************************************************************
|
|
30
|
+
* EXPORTS
|
|
31
|
+
***************************************************************************/
|
|
32
|
+
|
|
25
33
|
export interface MediaServiceInterface extends
|
|
26
34
|
MediaAnimation {}
|
|
27
35
|
|
package/lib/services/plugin.ts
CHANGED
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
import PluginConnect from "@/resources/PluginConnect";
|
|
14
14
|
import PluginSubscription from "@/resources/PluginSubscription";
|
|
15
15
|
|
|
16
|
+
/**************************************************************************
|
|
17
|
+
* CLASSES
|
|
18
|
+
***************************************************************************/
|
|
19
|
+
|
|
16
20
|
/**
|
|
17
21
|
* Crisp Plugin Service
|
|
18
22
|
*/
|
|
@@ -24,6 +28,10 @@ class PluginService {
|
|
|
24
28
|
];
|
|
25
29
|
}
|
|
26
30
|
|
|
31
|
+
/**************************************************************************
|
|
32
|
+
* EXPORTS
|
|
33
|
+
***************************************************************************/
|
|
34
|
+
|
|
27
35
|
export interface PluginServiceInterface extends
|
|
28
36
|
PluginConnect,
|
|
29
37
|
PluginSubscription {
|
package/lib/services/website.ts
CHANGED
|
@@ -23,6 +23,10 @@ import WebsiteSettings from "@/resources/WebsiteSettings";
|
|
|
23
23
|
import WebsiteVerify from "@/resources/WebsiteVerify";
|
|
24
24
|
import WebsiteVisitors from "@/resources/WebsiteVisitors";
|
|
25
25
|
|
|
26
|
+
/**************************************************************************
|
|
27
|
+
* CLASSES
|
|
28
|
+
***************************************************************************/
|
|
29
|
+
|
|
26
30
|
/**
|
|
27
31
|
* Website Service
|
|
28
32
|
*/
|
|
@@ -44,6 +48,10 @@ class WebsiteService {
|
|
|
44
48
|
];
|
|
45
49
|
}
|
|
46
50
|
|
|
51
|
+
/**************************************************************************
|
|
52
|
+
* EXPORTS
|
|
53
|
+
***************************************************************************/
|
|
54
|
+
|
|
47
55
|
export interface WebsiteServiceInterface extends
|
|
48
56
|
WebsiteBase,
|
|
49
57
|
WebsiteAnalytics,
|
package/package.json
CHANGED