crisp-api 9.13.0 → 10.0.3
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 +12 -0
- package/README.md +2 -2
- package/dist/crisp.d.ts +179 -0
- package/dist/crisp.js +773 -0
- package/dist/resources/BaseResource.d.ts +21 -0
- package/dist/resources/BaseResource.js +26 -0
- package/dist/resources/BucketURL.d.ts +37 -0
- package/dist/resources/BucketURL.js +35 -0
- package/dist/resources/MediaAnimation.d.ts +20 -0
- package/dist/resources/MediaAnimation.js +40 -0
- package/dist/resources/PluginConnect.d.ts +59 -0
- package/dist/resources/PluginConnect.js +79 -0
- package/dist/resources/PluginSubscription.d.ts +112 -0
- package/dist/resources/PluginSubscription.js +130 -0
- package/dist/resources/WebsiteAnalytics.d.ts +20 -0
- package/dist/resources/WebsiteAnalytics.js +37 -0
- package/dist/resources/WebsiteAvailability.d.ts +40 -0
- package/dist/resources/WebsiteAvailability.js +46 -0
- package/dist/resources/WebsiteBase.d.ts +69 -0
- package/dist/resources/WebsiteBase.js +77 -0
- package/dist/resources/WebsiteBatch.d.ts +61 -0
- package/dist/resources/WebsiteBatch.js +76 -0
- package/dist/resources/WebsiteCampaign.d.ts +208 -0
- package/dist/resources/WebsiteCampaign.js +201 -0
- package/dist/resources/WebsiteConversation.d.ts +710 -0
- package/dist/resources/WebsiteConversation.js +607 -0
- package/dist/resources/WebsiteHelpdesk.d.ts +356 -0
- package/dist/resources/WebsiteHelpdesk.js +593 -0
- package/dist/resources/WebsiteOperator.d.ts +88 -0
- package/dist/resources/WebsiteOperator.js +99 -0
- package/dist/resources/WebsitePeople.d.ts +257 -0
- package/dist/resources/WebsitePeople.js +282 -0
- package/dist/resources/WebsiteSettings.d.ts +168 -0
- package/dist/resources/WebsiteSettings.js +42 -0
- package/dist/resources/WebsiteVerify.d.ts +47 -0
- package/dist/resources/WebsiteVerify.js +56 -0
- package/dist/resources/WebsiteVisitors.d.ts +122 -0
- package/dist/resources/WebsiteVisitors.js +98 -0
- package/dist/resources/index.d.ts +20 -0
- package/dist/resources/index.js +42 -0
- package/dist/services/bucket.d.ts +19 -0
- package/dist/services/bucket.js +31 -0
- package/dist/services/media.d.ts +19 -0
- package/dist/services/media.js +31 -0
- package/dist/services/plugin.d.ts +20 -0
- package/dist/services/plugin.js +33 -0
- package/dist/services/website.d.ts +30 -0
- package/dist/services/website.js +53 -0
- package/eslint.config.mjs +208 -0
- package/lib/crisp.ts +1006 -0
- package/lib/resources/BaseResource.ts +37 -0
- package/lib/resources/BucketURL.ts +58 -0
- package/lib/resources/MediaAnimation.ts +44 -0
- package/lib/resources/PluginConnect.ts +135 -0
- package/lib/resources/PluginSubscription.ts +236 -0
- package/lib/resources/WebsiteAnalytics.ts +41 -0
- package/lib/resources/WebsiteAvailability.ts +74 -0
- package/lib/resources/WebsiteBase.ts +119 -0
- package/lib/resources/WebsiteBatch.ts +116 -0
- package/lib/resources/WebsiteCampaign.ts +432 -0
- package/lib/resources/WebsiteConversation.ts +1507 -0
- package/lib/resources/WebsiteHelpdesk.ts +1024 -0
- package/lib/resources/WebsiteOperator.ts +183 -0
- package/lib/resources/WebsitePeople.ts +568 -0
- package/lib/resources/WebsiteSettings.ts +207 -0
- package/lib/resources/WebsiteVerify.ts +90 -0
- package/lib/resources/WebsiteVisitors.ts +219 -0
- package/lib/resources/index.ts +28 -0
- package/lib/services/bucket.ts +36 -0
- package/lib/services/media.ts +36 -0
- package/lib/services/plugin.ts +40 -0
- package/lib/services/website.ts +70 -0
- package/package.json +16 -11
- package/tsconfig.json +12 -5
- package/lib/crisp.js +0 -1171
- package/lib/resources/BucketURL.js +0 -34
- package/lib/resources/MediaAnimation.js +0 -41
- package/lib/resources/PluginConnect.js +0 -119
- package/lib/resources/PluginSubscription.js +0 -234
- package/lib/resources/WebsiteAnalytics.js +0 -37
- package/lib/resources/WebsiteAvailability.js +0 -48
- package/lib/resources/WebsiteBase.js +0 -100
- package/lib/resources/WebsiteBatch.js +0 -92
- package/lib/resources/WebsiteCampaign.js +0 -396
- package/lib/resources/WebsiteConversation.js +0 -1261
- package/lib/resources/WebsiteHelpdesk.js +0 -1198
- package/lib/resources/WebsiteOperator.js +0 -167
- package/lib/resources/WebsitePeople.js +0 -516
- package/lib/resources/WebsiteSettings.js +0 -50
- package/lib/resources/WebsiteVerify.js +0 -79
- package/lib/resources/WebsiteVisitors.js +0 -148
- package/lib/services/Bucket.js +0 -28
- package/lib/services/Media.js +0 -28
- package/lib/services/Plugin.js +0 -29
- package/lib/services/Website.js +0 -39
- package/types/crisp.d.ts +0 -151
- package/types/resources/BucketURL.d.ts +0 -15
- package/types/resources/MediaAnimation.d.ts +0 -15
- package/types/resources/PluginConnect.d.ts +0 -15
- package/types/resources/PluginSubscription.d.ts +0 -15
- package/types/resources/WebsiteAnalytics.d.ts +0 -15
- package/types/resources/WebsiteAvailability.d.ts +0 -15
- package/types/resources/WebsiteBase.d.ts +0 -15
- package/types/resources/WebsiteBatch.d.ts +0 -15
- package/types/resources/WebsiteCampaign.d.ts +0 -15
- package/types/resources/WebsiteConversation.d.ts +0 -15
- package/types/resources/WebsiteHelpdesk.d.ts +0 -15
- package/types/resources/WebsiteOperator.d.ts +0 -15
- package/types/resources/WebsitePeople.d.ts +0 -15
- package/types/resources/WebsiteSettings.d.ts +0 -15
- package/types/resources/WebsiteVerify.d.ts +0 -15
- package/types/resources/WebsiteVisitors.d.ts +0 -15
- package/types/services/Bucket.d.ts +0 -14
- package/types/services/Media.d.ts +0 -14
- package/types/services/Plugin.d.ts +0 -14
- package/types/services/Website.d.ts +0 -14
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* node-crisp-api
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2022, Crisp IM SAS
|
|
5
|
+
* Author: Baptiste Jamin <baptiste@crisp.chat>
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**************************************************************************
|
|
9
|
+
* IMPORTS
|
|
10
|
+
***************************************************************************/
|
|
11
|
+
|
|
12
|
+
// PROJECT: RESOURCES
|
|
13
|
+
import BaseResource from "./BaseResource";
|
|
14
|
+
|
|
15
|
+
/**************************************************************************
|
|
16
|
+
* INTERFACES
|
|
17
|
+
***************************************************************************/
|
|
18
|
+
|
|
19
|
+
export interface WebsiteSettings {
|
|
20
|
+
websiteID?: string;
|
|
21
|
+
name?: string;
|
|
22
|
+
domain?: string;
|
|
23
|
+
logo?: string;
|
|
24
|
+
audit?: WebsiteSettingsAudit;
|
|
25
|
+
contact?: WebsiteSettingsContact;
|
|
26
|
+
inbox?: WebsiteSettingsInbox;
|
|
27
|
+
emails?: WebsiteSettingsEmails;
|
|
28
|
+
chatbox?: WebsiteSettingsChatbox;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface WebsiteSettingsAudit {
|
|
32
|
+
log?: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface WebsiteSettingsContact {
|
|
36
|
+
email?: string;
|
|
37
|
+
phone?: string;
|
|
38
|
+
messenger?: string;
|
|
39
|
+
telegram?: string;
|
|
40
|
+
twitter?: string;
|
|
41
|
+
whatsapp?: string;
|
|
42
|
+
instagram?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface WebsiteSettingsInbox {
|
|
46
|
+
lock_removal?: boolean;
|
|
47
|
+
force_operator_token?: boolean;
|
|
48
|
+
locale?: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface WebsiteSettingsEmails {
|
|
52
|
+
rating?: boolean;
|
|
53
|
+
transcript?: boolean;
|
|
54
|
+
enrich?: boolean;
|
|
55
|
+
junk_filter?: boolean;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface WebsiteSettingsChatbox {
|
|
59
|
+
tile?: string;
|
|
60
|
+
wait_game?: boolean;
|
|
61
|
+
website_logo?: boolean;
|
|
62
|
+
last_operator_face?: boolean;
|
|
63
|
+
ongoing_operator_face?: boolean;
|
|
64
|
+
activity_metrics?: boolean;
|
|
65
|
+
operator_privacy?: boolean;
|
|
66
|
+
visitor_privacy?: boolean;
|
|
67
|
+
availability_tooltip?: boolean;
|
|
68
|
+
hide_vacation?: boolean;
|
|
69
|
+
hide_on_away?: boolean;
|
|
70
|
+
hide_on_mobile?: boolean;
|
|
71
|
+
position_reverse?: boolean;
|
|
72
|
+
email_visitors?: boolean;
|
|
73
|
+
phone_visitors?: boolean;
|
|
74
|
+
force_identify?: boolean;
|
|
75
|
+
ignore_privacy?: boolean;
|
|
76
|
+
visitor_compose?: boolean;
|
|
77
|
+
file_transfer?: boolean;
|
|
78
|
+
audio_record?: boolean;
|
|
79
|
+
overlay_search?: boolean;
|
|
80
|
+
overlay_mode?: boolean;
|
|
81
|
+
helpdesk_link?: boolean;
|
|
82
|
+
helpdesk_only?: boolean;
|
|
83
|
+
status_health_dead?: boolean;
|
|
84
|
+
check_domain?: boolean;
|
|
85
|
+
color_theme?: string;
|
|
86
|
+
text_theme?: string;
|
|
87
|
+
welcome_message?: string;
|
|
88
|
+
locale?: string;
|
|
89
|
+
allowed_pages?: string[];
|
|
90
|
+
blocked_pages?: string[];
|
|
91
|
+
blocked_countries?: string[];
|
|
92
|
+
blocked_locales?: string[];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface WebsiteSettingsUpdate {
|
|
96
|
+
websiteID?: string;
|
|
97
|
+
name?: string;
|
|
98
|
+
domain?: string;
|
|
99
|
+
logo?: string;
|
|
100
|
+
audit?: WebsiteSettingsUpdateAudit;
|
|
101
|
+
contact?: WebsiteSettingsUpdateContact;
|
|
102
|
+
inbox?: WebsiteSettingsUpdateInbox;
|
|
103
|
+
emails?: WebsiteSettingsUpdateEmails;
|
|
104
|
+
chatbox?: WebsiteSettingsUpdateChatbox;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface WebsiteSettingsUpdateAudit {
|
|
108
|
+
log?: boolean;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface WebsiteSettingsUpdateContact {
|
|
112
|
+
email?: string;
|
|
113
|
+
phone?: string;
|
|
114
|
+
messenger?: string;
|
|
115
|
+
telegram?: string;
|
|
116
|
+
twitter?: string;
|
|
117
|
+
whatsapp?: string;
|
|
118
|
+
instagram?: string;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface WebsiteSettingsUpdateInbox {
|
|
122
|
+
lock_removal?: boolean;
|
|
123
|
+
force_operator_token?: boolean;
|
|
124
|
+
locale?: string;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface WebsiteSettingsUpdateEmails {
|
|
128
|
+
rating?: boolean;
|
|
129
|
+
transcript?: boolean;
|
|
130
|
+
enrich?: boolean;
|
|
131
|
+
junk_filter?: boolean;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface WebsiteSettingsUpdateChatbox {
|
|
135
|
+
tile?: string;
|
|
136
|
+
wait_game?: boolean;
|
|
137
|
+
website_logo?: boolean;
|
|
138
|
+
last_operator_face?: boolean;
|
|
139
|
+
ongoing_operator_face?: boolean;
|
|
140
|
+
activity_metrics?: boolean;
|
|
141
|
+
operator_privacy?: boolean;
|
|
142
|
+
visitor_privacy?: boolean;
|
|
143
|
+
availability_tooltip?: boolean;
|
|
144
|
+
hide_vacation?: boolean;
|
|
145
|
+
hide_on_away?: boolean;
|
|
146
|
+
hide_on_mobile?: boolean;
|
|
147
|
+
position_reverse?: boolean;
|
|
148
|
+
email_visitors?: boolean;
|
|
149
|
+
phone_visitors?: boolean;
|
|
150
|
+
force_identify?: boolean;
|
|
151
|
+
ignore_privacy?: boolean;
|
|
152
|
+
visitor_compose?: boolean;
|
|
153
|
+
file_transfer?: boolean;
|
|
154
|
+
audio_record?: boolean;
|
|
155
|
+
overlay_search?: boolean;
|
|
156
|
+
overlay_mode?: boolean;
|
|
157
|
+
helpdesk_link?: boolean;
|
|
158
|
+
helpdesk_only?: boolean;
|
|
159
|
+
status_health_dead?: boolean;
|
|
160
|
+
check_domain?: boolean;
|
|
161
|
+
color_theme?: string;
|
|
162
|
+
text_theme?: string;
|
|
163
|
+
welcome_message?: string;
|
|
164
|
+
locale?: string;
|
|
165
|
+
allowed_pages?: string[];
|
|
166
|
+
blocked_pages?: string[];
|
|
167
|
+
blocked_countries?: string[];
|
|
168
|
+
blocked_locales?: string[];
|
|
169
|
+
blocked_ips?: string[];
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**************************************************************************
|
|
173
|
+
* CLASSES
|
|
174
|
+
***************************************************************************/
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Crisp WebsiteSettings Resource
|
|
178
|
+
*/
|
|
179
|
+
class WebsiteSettingsService extends BaseResource {
|
|
180
|
+
/**
|
|
181
|
+
* Get Website Settings
|
|
182
|
+
*/
|
|
183
|
+
getWebsiteSettings(websiteID: string): Promise<WebsiteSettings> {
|
|
184
|
+
return this.crisp.get(
|
|
185
|
+
this.crisp.prepareRestUrl(["website", websiteID, "settings"])
|
|
186
|
+
);
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Update Website Settings
|
|
191
|
+
*/
|
|
192
|
+
updateWebsiteSettings(websiteID: string, settings: WebsiteSettingsUpdate) {
|
|
193
|
+
return this.crisp.patch(
|
|
194
|
+
this.crisp.prepareRestUrl(["website", websiteID, "settings"]),
|
|
195
|
+
|
|
196
|
+
null,
|
|
197
|
+
settings
|
|
198
|
+
);
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**************************************************************************
|
|
203
|
+
* EXPORTS
|
|
204
|
+
***************************************************************************/
|
|
205
|
+
|
|
206
|
+
export default WebsiteSettingsService;
|
|
207
|
+
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* node-crisp-api
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2022, Crisp IM SAS
|
|
5
|
+
* Author: Valerian Saliou <valerian@valeriansaliou.name>
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**************************************************************************
|
|
9
|
+
* IMPORTS
|
|
10
|
+
***************************************************************************/
|
|
11
|
+
|
|
12
|
+
// PROJECT: RESOURCES
|
|
13
|
+
import BaseResource from "./BaseResource";
|
|
14
|
+
|
|
15
|
+
/**************************************************************************
|
|
16
|
+
* INTERFACES
|
|
17
|
+
***************************************************************************/
|
|
18
|
+
|
|
19
|
+
export interface WebsiteVerifyKeyData {
|
|
20
|
+
data?: WebsiteVerifyKey;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface WebsiteVerifySettings {
|
|
24
|
+
enabled?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface WebsiteVerifyKey {
|
|
28
|
+
secret?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface WebsiteVerifySettingsUpdate {
|
|
32
|
+
enabled?: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**************************************************************************
|
|
36
|
+
* CLASSES
|
|
37
|
+
***************************************************************************/
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Crisp WebsiteVerify Resource
|
|
41
|
+
*/
|
|
42
|
+
class WebsiteVerify extends BaseResource {
|
|
43
|
+
/**
|
|
44
|
+
* Get Verify Settings
|
|
45
|
+
*/
|
|
46
|
+
getVerifySettings(websiteID: string): Promise<WebsiteVerifySettings> {
|
|
47
|
+
return this.crisp.get(
|
|
48
|
+
this.crisp.prepareRestUrl(["website", websiteID, "verify", "settings"])
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Update Verify Settings
|
|
54
|
+
*/
|
|
55
|
+
updateVerifySettings(
|
|
56
|
+
websiteID: string, settings: WebsiteVerifySettingsUpdate
|
|
57
|
+
) {
|
|
58
|
+
return this.crisp.patch(
|
|
59
|
+
this.crisp.prepareRestUrl(["website", websiteID, "verify", "settings"]),
|
|
60
|
+
|
|
61
|
+
null, settings
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Get Verify Key
|
|
67
|
+
*/
|
|
68
|
+
getVerifyKey(websiteID: string): Promise<WebsiteVerifyKey> {
|
|
69
|
+
return this.crisp.get(
|
|
70
|
+
this.crisp.prepareRestUrl(["website", websiteID, "verify", "key"])
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Roll Verify Key
|
|
76
|
+
*/
|
|
77
|
+
rollVerifyKey(websiteID: string) {
|
|
78
|
+
return this.crisp.post(
|
|
79
|
+
this.crisp.prepareRestUrl(["website", websiteID, "verify", "key"]),
|
|
80
|
+
|
|
81
|
+
null, null
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**************************************************************************
|
|
87
|
+
* EXPORTS
|
|
88
|
+
***************************************************************************/
|
|
89
|
+
|
|
90
|
+
export default WebsiteVerify;
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* node-crisp-api
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2022, Crisp IM SAS
|
|
5
|
+
* Author: Valerian Saliou <valerian@valeriansaliou.name>
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**************************************************************************
|
|
9
|
+
* IMPORTS
|
|
10
|
+
***************************************************************************/
|
|
11
|
+
|
|
12
|
+
// PROJECT: RESOURCES
|
|
13
|
+
import BaseResource from "./BaseResource";
|
|
14
|
+
|
|
15
|
+
/**************************************************************************
|
|
16
|
+
* INTERFACES
|
|
17
|
+
***************************************************************************/
|
|
18
|
+
|
|
19
|
+
export interface WebsiteVisitorCount {
|
|
20
|
+
count?: number;
|
|
21
|
+
active?: number;
|
|
22
|
+
limited?: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface WebsiteVisitor {
|
|
26
|
+
session_id?: string;
|
|
27
|
+
inbox_id?: string;
|
|
28
|
+
nickname?: string;
|
|
29
|
+
email?: string;
|
|
30
|
+
avatar?: string;
|
|
31
|
+
useragent?: string;
|
|
32
|
+
initiated?: boolean;
|
|
33
|
+
active?: boolean;
|
|
34
|
+
last_page?: WebsiteVisitorLastPage;
|
|
35
|
+
geolocation?: WebsiteVisitorGeolocation;
|
|
36
|
+
timezone?: number;
|
|
37
|
+
capabilities?: string[];
|
|
38
|
+
locales?: string[];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface WebsiteVisitorLastPage {
|
|
42
|
+
page_title?: string;
|
|
43
|
+
page_url?: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface WebsiteVisitorGeolocation {
|
|
47
|
+
coordinates?: WebsiteVisitorGeolocationCoordinates;
|
|
48
|
+
city?: string;
|
|
49
|
+
region?: string;
|
|
50
|
+
country?: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface WebsiteVisitorGeolocationCoordinates {
|
|
54
|
+
latitude?: number;
|
|
55
|
+
longitude?: number;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface WebsiteVisitorsMapPointsData {
|
|
59
|
+
data?: WebsiteVisitorsMapPoint[];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface WebsiteVisitorsMapPoint {
|
|
63
|
+
visitors?: WebsiteVisitorsMapPointVisitors;
|
|
64
|
+
geolocation?: WebsiteVisitorsMapPointGeolocation;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface WebsiteVisitorsMapPointGeolocation {
|
|
68
|
+
coordinates?: WebsiteVisitorsMapPointGeolocationCoordinates;
|
|
69
|
+
city?: string;
|
|
70
|
+
region?: string;
|
|
71
|
+
country?: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface WebsiteVisitorsMapPointGeolocationCoordinates {
|
|
75
|
+
latitude?: number;
|
|
76
|
+
longitude?: number;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface WebsiteVisitorsMapPointVisitors {
|
|
80
|
+
count?: number;
|
|
81
|
+
threshold?: number;
|
|
82
|
+
sessions?: WebsiteVisitorsMapPointVisitorsSession[];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface WebsiteVisitorsMapPointVisitorsSession {
|
|
86
|
+
session_id?: string;
|
|
87
|
+
nickname?: string;
|
|
88
|
+
email?: string;
|
|
89
|
+
avatar?: string;
|
|
90
|
+
initiated?: boolean;
|
|
91
|
+
active?: boolean;
|
|
92
|
+
last_page?: WebsiteVisitorLastPage;
|
|
93
|
+
timezone?: number;
|
|
94
|
+
capabilities?: string[];
|
|
95
|
+
locales?: string[];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface WebsiteVisitorsToken {
|
|
99
|
+
session_id?: string;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface WebsiteVisitorsBlocked {
|
|
103
|
+
rule?: string[];
|
|
104
|
+
blocked?: number;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**************************************************************************
|
|
108
|
+
* CLASSES
|
|
109
|
+
***************************************************************************/
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Crisp WebsiteVisitors Resource
|
|
113
|
+
*/
|
|
114
|
+
class WebsiteVisitors extends BaseResource {
|
|
115
|
+
/**
|
|
116
|
+
* Count Visitors
|
|
117
|
+
*/
|
|
118
|
+
countVisitors(websiteID: string): Promise<WebsiteVisitorCount> {
|
|
119
|
+
return this.crisp.get(
|
|
120
|
+
this.crisp.prepareRestUrl(["website", websiteID, "visitors", "count"])
|
|
121
|
+
);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* List Visitors
|
|
126
|
+
*/
|
|
127
|
+
listVisitors(
|
|
128
|
+
websiteID: string, pageNumber: number = 1
|
|
129
|
+
): Promise<WebsiteVisitor[]> {
|
|
130
|
+
return this.crisp.get(
|
|
131
|
+
this.crisp.prepareRestUrl([
|
|
132
|
+
"website", websiteID, "visitors", "list", String(pageNumber)
|
|
133
|
+
])
|
|
134
|
+
);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Pinpoint Visitors On A Map
|
|
139
|
+
*/
|
|
140
|
+
pinpointVisitorsOnMap(
|
|
141
|
+
websiteID: string, centerLongitude: number, centerLatitude: number,
|
|
142
|
+
centerRadius: number
|
|
143
|
+
): Promise<WebsiteVisitorsMapPoint[]> {
|
|
144
|
+
// Generate query
|
|
145
|
+
const query: Record<string, string> = {};
|
|
146
|
+
|
|
147
|
+
if (typeof centerLongitude === "number") {
|
|
148
|
+
query.center_longitude = String(centerLongitude);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (typeof centerLatitude === "number") {
|
|
152
|
+
query.center_latitude = String(centerLatitude);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (typeof centerRadius === "number") {
|
|
156
|
+
query.center_radius = String(centerRadius);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return this.crisp.get(
|
|
160
|
+
this.crisp.prepareRestUrl([
|
|
161
|
+
"website", websiteID, "visitors", "map"
|
|
162
|
+
]),
|
|
163
|
+
|
|
164
|
+
query
|
|
165
|
+
);
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Get Session Identifier From Token
|
|
170
|
+
*/
|
|
171
|
+
getSessionIdentifierFromToken(
|
|
172
|
+
websiteID: string, tokenID: string
|
|
173
|
+
): Promise<WebsiteVisitorsToken> {
|
|
174
|
+
return this.crisp.get(
|
|
175
|
+
this.crisp.prepareRestUrl([
|
|
176
|
+
"website", websiteID, "visitors", "token", tokenID
|
|
177
|
+
])
|
|
178
|
+
);
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Count Blocked Visitors
|
|
183
|
+
*/
|
|
184
|
+
countBlockedVisitors(websiteID: string): Promise<WebsiteVisitorsBlocked> {
|
|
185
|
+
return this.crisp.get(
|
|
186
|
+
this.crisp.prepareRestUrl(["website", websiteID, "visitors", "blocked"])
|
|
187
|
+
);
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Count Blocked Visitors In Rule
|
|
192
|
+
*/
|
|
193
|
+
countBlockedVisitorsInRule(
|
|
194
|
+
websiteID: string, rule: string
|
|
195
|
+
): Promise<number> {
|
|
196
|
+
return this.crisp.get(
|
|
197
|
+
this.crisp.prepareRestUrl([
|
|
198
|
+
"website", websiteID, "visitors", "blocked", rule
|
|
199
|
+
])
|
|
200
|
+
);
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Clear Blocked Visitors In Rule
|
|
205
|
+
*/
|
|
206
|
+
clearBlockedVisitorsInRule(websiteID: string, rule: string) {
|
|
207
|
+
return this.crisp.delete(
|
|
208
|
+
this.crisp.prepareRestUrl([
|
|
209
|
+
"website", websiteID, "visitors", "blocked", rule
|
|
210
|
+
])
|
|
211
|
+
);
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**************************************************************************
|
|
216
|
+
* EXPORTS
|
|
217
|
+
***************************************************************************/
|
|
218
|
+
|
|
219
|
+
export default WebsiteVisitors;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* node-crisp-api
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2022, Crisp IM SAS
|
|
5
|
+
* Author: Baptiste Jamin <baptiste@crisp.chat>
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**************************************************************************
|
|
9
|
+
* EXPORTS
|
|
10
|
+
***************************************************************************/
|
|
11
|
+
|
|
12
|
+
export * from "./BaseResource";
|
|
13
|
+
export * from "./BucketURL";
|
|
14
|
+
export * from "./MediaAnimation";
|
|
15
|
+
export * from "./PluginConnect";
|
|
16
|
+
export * from "./PluginSubscription";
|
|
17
|
+
export * from "./WebsiteAnalytics";
|
|
18
|
+
export * from "./WebsiteAvailability";
|
|
19
|
+
export * from "./WebsiteBase";
|
|
20
|
+
export * from "./WebsiteBatch";
|
|
21
|
+
export * from "./WebsiteCampaign";
|
|
22
|
+
export * from "./WebsiteConversation";
|
|
23
|
+
export * from "./WebsiteHelpdesk";
|
|
24
|
+
export * from "./WebsiteOperator";
|
|
25
|
+
export * from "./WebsitePeople";
|
|
26
|
+
export * from "./WebsiteSettings";
|
|
27
|
+
export * from "./WebsiteVerify";
|
|
28
|
+
export * from "./WebsiteVisitors";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* node-crisp-api
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2022, Crisp IM SAS
|
|
5
|
+
* Author: Baptiste Jamin <baptiste@crisp.chat>
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**************************************************************************
|
|
9
|
+
* IMPORTS
|
|
10
|
+
***************************************************************************/
|
|
11
|
+
|
|
12
|
+
// PROJECT: RESOURCES
|
|
13
|
+
import BucketURL from "@/resources/BucketURL";
|
|
14
|
+
|
|
15
|
+
/**************************************************************************
|
|
16
|
+
* CLASSES
|
|
17
|
+
***************************************************************************/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Bucket Service
|
|
21
|
+
*/
|
|
22
|
+
class BucketService {
|
|
23
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
24
|
+
public __resources: any[] = [
|
|
25
|
+
BucketURL
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**************************************************************************
|
|
30
|
+
* EXPORTS
|
|
31
|
+
***************************************************************************/
|
|
32
|
+
|
|
33
|
+
export interface BucketServiceInterface extends
|
|
34
|
+
BucketURL {}
|
|
35
|
+
|
|
36
|
+
export default BucketService;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* node-crisp-api
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2022, Crisp IM SAS
|
|
5
|
+
* Author: Baptiste Jamin <baptiste@crisp.chat>
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**************************************************************************
|
|
9
|
+
* IMPORTS
|
|
10
|
+
***************************************************************************/
|
|
11
|
+
|
|
12
|
+
// PROJECT: RESOURCES
|
|
13
|
+
import MediaAnimation from "@/resources/MediaAnimation";
|
|
14
|
+
|
|
15
|
+
/**************************************************************************
|
|
16
|
+
* CLASSES
|
|
17
|
+
***************************************************************************/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Crisp Media Service
|
|
21
|
+
*/
|
|
22
|
+
class MediaService {
|
|
23
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
24
|
+
public __resources: any[] = [
|
|
25
|
+
MediaAnimation
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**************************************************************************
|
|
30
|
+
* EXPORTS
|
|
31
|
+
***************************************************************************/
|
|
32
|
+
|
|
33
|
+
export interface MediaServiceInterface extends
|
|
34
|
+
MediaAnimation {}
|
|
35
|
+
|
|
36
|
+
export default MediaService;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* node-crisp-api
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2022, Crisp IM SAS
|
|
5
|
+
* Author: Baptiste Jamin <baptiste@crisp.chat>
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**************************************************************************
|
|
9
|
+
* IMPORTS
|
|
10
|
+
***************************************************************************/
|
|
11
|
+
|
|
12
|
+
// PROJECT: RESOURCES
|
|
13
|
+
import PluginConnect from "@/resources/PluginConnect";
|
|
14
|
+
import PluginSubscription from "@/resources/PluginSubscription";
|
|
15
|
+
|
|
16
|
+
/**************************************************************************
|
|
17
|
+
* CLASSES
|
|
18
|
+
***************************************************************************/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Crisp Plugin Service
|
|
22
|
+
*/
|
|
23
|
+
class PluginService {
|
|
24
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
25
|
+
public __resources: any[] = [
|
|
26
|
+
PluginConnect,
|
|
27
|
+
PluginSubscription
|
|
28
|
+
];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**************************************************************************
|
|
32
|
+
* EXPORTS
|
|
33
|
+
***************************************************************************/
|
|
34
|
+
|
|
35
|
+
export interface PluginServiceInterface extends
|
|
36
|
+
PluginConnect,
|
|
37
|
+
PluginSubscription {
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default PluginService;
|