crisp-api 9.13.0 → 10.0.2
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 +8 -0
- package/README.md +2 -2
- package/dist/crisp.d.ts +167 -0
- package/dist/crisp.js +764 -0
- package/dist/resources/BaseResource.d.ts +15 -0
- package/dist/resources/BaseResource.js +20 -0
- package/dist/resources/BucketURL.d.ts +28 -0
- package/dist/resources/BucketURL.js +29 -0
- package/dist/resources/MediaAnimation.d.ts +14 -0
- package/dist/resources/MediaAnimation.js +32 -0
- package/dist/resources/PluginConnect.d.ts +50 -0
- package/dist/resources/PluginConnect.js +73 -0
- package/dist/resources/PluginSubscription.d.ts +103 -0
- package/dist/resources/PluginSubscription.js +122 -0
- package/dist/resources/WebsiteAnalytics.d.ts +14 -0
- package/dist/resources/WebsiteAnalytics.js +29 -0
- package/dist/resources/WebsiteAvailability.d.ts +31 -0
- package/dist/resources/WebsiteAvailability.js +36 -0
- package/dist/resources/WebsiteBase.d.ts +60 -0
- package/dist/resources/WebsiteBase.js +71 -0
- package/dist/resources/WebsiteBatch.d.ts +52 -0
- package/dist/resources/WebsiteBatch.js +70 -0
- package/dist/resources/WebsiteCampaign.d.ts +199 -0
- package/dist/resources/WebsiteCampaign.js +194 -0
- package/dist/resources/WebsiteConversation.d.ts +701 -0
- package/dist/resources/WebsiteConversation.js +595 -0
- package/dist/resources/WebsiteHelpdesk.d.ts +347 -0
- package/dist/resources/WebsiteHelpdesk.js +587 -0
- package/dist/resources/WebsiteOperator.d.ts +79 -0
- package/dist/resources/WebsiteOperator.js +93 -0
- package/dist/resources/WebsitePeople.d.ts +248 -0
- package/dist/resources/WebsitePeople.js +276 -0
- package/dist/resources/WebsiteSettings.d.ts +159 -0
- package/dist/resources/WebsiteSettings.js +36 -0
- package/dist/resources/WebsiteVerify.d.ts +38 -0
- package/dist/resources/WebsiteVerify.js +50 -0
- package/dist/resources/WebsiteVisitors.d.ts +113 -0
- package/dist/resources/WebsiteVisitors.js +88 -0
- package/dist/resources/index.d.ts +17 -0
- package/dist/resources/index.js +40 -0
- package/dist/services/bucket.d.ts +13 -0
- package/dist/services/bucket.js +28 -0
- package/dist/services/media.d.ts +13 -0
- package/dist/services/media.js +28 -0
- package/dist/services/plugin.d.ts +14 -0
- package/dist/services/plugin.js +30 -0
- package/dist/services/website.d.ts +24 -0
- package/dist/services/website.js +50 -0
- package/eslint.config.mjs +208 -0
- package/lib/crisp.ts +957 -0
- package/lib/resources/BaseResource.ts +29 -0
- package/lib/resources/BucketURL.ts +49 -0
- package/lib/resources/MediaAnimation.ts +34 -0
- package/lib/resources/PluginConnect.ts +128 -0
- package/lib/resources/PluginSubscription.ts +208 -0
- package/lib/resources/WebsiteAnalytics.ts +31 -0
- package/lib/resources/WebsiteAvailability.ts +54 -0
- package/lib/resources/WebsiteBase.ts +108 -0
- package/lib/resources/WebsiteBatch.ts +96 -0
- package/lib/resources/WebsiteCampaign.ts +399 -0
- package/lib/resources/WebsiteConversation.ts +1416 -0
- package/lib/resources/WebsiteHelpdesk.ts +982 -0
- package/lib/resources/WebsiteOperator.ts +161 -0
- package/lib/resources/WebsitePeople.ts +527 -0
- package/lib/resources/WebsiteSettings.ts +192 -0
- package/lib/resources/WebsiteVerify.ts +76 -0
- package/lib/resources/WebsiteVisitors.ts +196 -0
- package/lib/resources/index.ts +25 -0
- package/lib/services/bucket.ts +28 -0
- package/lib/services/media.ts +28 -0
- package/lib/services/plugin.ts +32 -0
- package/lib/services/website.ts +62 -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,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* node-crisp-api
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2022, Crisp IM SAS
|
|
6
|
+
* Author: Baptiste Jamin <baptiste@crisp.chat>
|
|
7
|
+
*/
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
/**************************************************************************
|
|
13
|
+
* IMPORTS
|
|
14
|
+
***************************************************************************/
|
|
15
|
+
// PROJECT: RESOURCES
|
|
16
|
+
const BaseResource_1 = __importDefault(require("./BaseResource"));
|
|
17
|
+
/**
|
|
18
|
+
* Crisp WebsiteOperator Resource
|
|
19
|
+
*/
|
|
20
|
+
class WebsiteOperatorService extends BaseResource_1.default {
|
|
21
|
+
/**
|
|
22
|
+
* List Website Operators
|
|
23
|
+
*/
|
|
24
|
+
listWebsiteOperators(websiteID) {
|
|
25
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
26
|
+
"website", websiteID, "operators", "list"
|
|
27
|
+
]));
|
|
28
|
+
}
|
|
29
|
+
;
|
|
30
|
+
/**
|
|
31
|
+
* List Last Active Website Operators
|
|
32
|
+
*/
|
|
33
|
+
listLastActiveWebsiteOperators(websiteID) {
|
|
34
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
35
|
+
"website", websiteID, "operators", "active"
|
|
36
|
+
]));
|
|
37
|
+
}
|
|
38
|
+
;
|
|
39
|
+
/**
|
|
40
|
+
* Flush Last Active Website Operators
|
|
41
|
+
*/
|
|
42
|
+
flushLastActiveWebsiteOperators(websiteID) {
|
|
43
|
+
return this.crisp.delete(this.crisp.prepareRestUrl([
|
|
44
|
+
"website", websiteID, "operators", "active"
|
|
45
|
+
]));
|
|
46
|
+
}
|
|
47
|
+
;
|
|
48
|
+
/**
|
|
49
|
+
* Send Email To Website Operators
|
|
50
|
+
*/
|
|
51
|
+
sendEmailToWebsiteOperators(websiteID, emailData) {
|
|
52
|
+
return this.crisp.post(this.crisp.prepareRestUrl(["website", websiteID, "operators", "email"]), null, emailData);
|
|
53
|
+
}
|
|
54
|
+
;
|
|
55
|
+
/**
|
|
56
|
+
* Get A Website Operator
|
|
57
|
+
*/
|
|
58
|
+
getWebsiteOperator(websiteID, userID) {
|
|
59
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
60
|
+
"website", websiteID, "operator", userID
|
|
61
|
+
]));
|
|
62
|
+
}
|
|
63
|
+
;
|
|
64
|
+
/**
|
|
65
|
+
* Invite A Website Operator
|
|
66
|
+
*/
|
|
67
|
+
inviteWebsiteOperator(websiteID, email, role, verify) {
|
|
68
|
+
return this.crisp.post(this.crisp.prepareRestUrl(["website", websiteID, "operator"]), null, {
|
|
69
|
+
email: email,
|
|
70
|
+
role: role,
|
|
71
|
+
verify: verify
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
;
|
|
75
|
+
/**
|
|
76
|
+
* Change Operator Membership
|
|
77
|
+
*/
|
|
78
|
+
changeOperatorMembership(websiteID, userID, role, title) {
|
|
79
|
+
return this.crisp.patch(this.crisp.prepareRestUrl(["website", websiteID, "operator", userID]), null, {
|
|
80
|
+
role: role,
|
|
81
|
+
title: title
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
;
|
|
85
|
+
/**
|
|
86
|
+
* Unlink Operator From Website
|
|
87
|
+
*/
|
|
88
|
+
unlinkOperatorFromWebsite(websiteID, userID) {
|
|
89
|
+
return this.crisp.delete(this.crisp.prepareRestUrl(["website", websiteID, "operator", userID]));
|
|
90
|
+
}
|
|
91
|
+
;
|
|
92
|
+
}
|
|
93
|
+
exports.default = WebsiteOperatorService;
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/**************************************************************************
|
|
2
|
+
* IMPORTS
|
|
3
|
+
***************************************************************************/
|
|
4
|
+
import BaseResource from "./BaseResource";
|
|
5
|
+
export interface PeopleStatistics {
|
|
6
|
+
total?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface PeopleSuggestedSegment {
|
|
9
|
+
segment?: string;
|
|
10
|
+
count?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface PeopleSuggestedDataKey {
|
|
13
|
+
key?: string;
|
|
14
|
+
count?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface PeopleSuggestedEvent {
|
|
17
|
+
text?: string;
|
|
18
|
+
count?: number;
|
|
19
|
+
}
|
|
20
|
+
export interface PeopleProfile extends PeopleProfileCard {
|
|
21
|
+
people_id?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface PeopleProfileNew {
|
|
24
|
+
people_id?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface PeopleProfileCard {
|
|
27
|
+
email?: string;
|
|
28
|
+
person?: PeopleProfileCardPerson;
|
|
29
|
+
company?: PeopleProfileCardCompany;
|
|
30
|
+
segments?: string[];
|
|
31
|
+
notepad?: string;
|
|
32
|
+
active?: PeopleProfileCardActive;
|
|
33
|
+
score?: number;
|
|
34
|
+
created_at?: number;
|
|
35
|
+
updated_at?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface PeopleProfileUpdateCard {
|
|
38
|
+
email?: string;
|
|
39
|
+
person?: PeopleProfileCardPerson;
|
|
40
|
+
company?: PeopleProfileCardCompany;
|
|
41
|
+
segments?: string[];
|
|
42
|
+
notepad?: string;
|
|
43
|
+
active?: number;
|
|
44
|
+
}
|
|
45
|
+
export interface PeopleProfileCardPerson {
|
|
46
|
+
nickname?: string;
|
|
47
|
+
avatar?: string;
|
|
48
|
+
gender?: string;
|
|
49
|
+
phone?: string;
|
|
50
|
+
address?: string;
|
|
51
|
+
description?: string;
|
|
52
|
+
website?: string;
|
|
53
|
+
timezone?: number;
|
|
54
|
+
profiles?: PeopleProfileCardPersonProfile[];
|
|
55
|
+
employment?: PeopleProfileCardPersonEmployment;
|
|
56
|
+
geolocation?: PeopleProfileCardGeolocation;
|
|
57
|
+
locales?: string[];
|
|
58
|
+
}
|
|
59
|
+
export interface PeopleProfileCardPersonProfile {
|
|
60
|
+
type?: string;
|
|
61
|
+
handle?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface PeopleProfileCardPersonEmployment {
|
|
64
|
+
name?: string;
|
|
65
|
+
domain?: string;
|
|
66
|
+
title?: string;
|
|
67
|
+
role?: string;
|
|
68
|
+
seniority?: string;
|
|
69
|
+
}
|
|
70
|
+
export interface PeopleProfileCardCompany {
|
|
71
|
+
name?: string;
|
|
72
|
+
legal_name?: string;
|
|
73
|
+
domain?: string;
|
|
74
|
+
url?: string;
|
|
75
|
+
description?: string;
|
|
76
|
+
timezone?: number;
|
|
77
|
+
phones?: string[];
|
|
78
|
+
emails?: string[];
|
|
79
|
+
geolocation?: PeopleProfileCardGeolocation;
|
|
80
|
+
metrics?: PeopleProfileCardCompanyMetrics;
|
|
81
|
+
tags?: string[];
|
|
82
|
+
}
|
|
83
|
+
export interface PeopleProfileCardCompanyMetrics {
|
|
84
|
+
employees?: number;
|
|
85
|
+
market_cap?: number;
|
|
86
|
+
raised?: number;
|
|
87
|
+
arr?: number;
|
|
88
|
+
}
|
|
89
|
+
export interface PeopleProfileCardGeolocation {
|
|
90
|
+
country?: string;
|
|
91
|
+
region?: string;
|
|
92
|
+
city?: string;
|
|
93
|
+
coordinates?: PeopleProfileCardGeolocationCoordinates;
|
|
94
|
+
}
|
|
95
|
+
export interface PeopleProfileCardGeolocationCoordinates {
|
|
96
|
+
latitude?: number;
|
|
97
|
+
longitude?: number;
|
|
98
|
+
}
|
|
99
|
+
export interface PeopleProfileCardActive {
|
|
100
|
+
now?: boolean;
|
|
101
|
+
last?: number;
|
|
102
|
+
}
|
|
103
|
+
export interface PeopleCampaign {
|
|
104
|
+
campaign_id?: string;
|
|
105
|
+
type?: string;
|
|
106
|
+
name?: string;
|
|
107
|
+
created_at?: number;
|
|
108
|
+
updated_at?: number;
|
|
109
|
+
dispatched_at?: number;
|
|
110
|
+
occurred_at?: number;
|
|
111
|
+
statistics?: string[];
|
|
112
|
+
}
|
|
113
|
+
export interface PeopleEvent {
|
|
114
|
+
text?: string;
|
|
115
|
+
data?: object;
|
|
116
|
+
color?: string;
|
|
117
|
+
timestamp?: number;
|
|
118
|
+
}
|
|
119
|
+
export interface PeopleData {
|
|
120
|
+
data?: Record<string, boolean | string | number>;
|
|
121
|
+
}
|
|
122
|
+
export interface PeopleSubscription {
|
|
123
|
+
email?: boolean;
|
|
124
|
+
}
|
|
125
|
+
export interface PeopleSubscriptionUpdate {
|
|
126
|
+
email?: boolean;
|
|
127
|
+
}
|
|
128
|
+
export interface PeopleProfileImportSetup {
|
|
129
|
+
url?: string;
|
|
130
|
+
mapping?: PeopleProfileImportSetupMapping[];
|
|
131
|
+
options?: PeopleProfileImportSetupOptions;
|
|
132
|
+
}
|
|
133
|
+
export interface PeopleProfileImportSetupMapping {
|
|
134
|
+
column?: number;
|
|
135
|
+
field?: string;
|
|
136
|
+
}
|
|
137
|
+
export interface PeopleProfileImportSetupOptions {
|
|
138
|
+
column_separator?: string;
|
|
139
|
+
skip_header?: boolean;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Crisp WebsitePeople Resource
|
|
143
|
+
* @class
|
|
144
|
+
* @classdesc This is the Crisp Website People Resource
|
|
145
|
+
*/
|
|
146
|
+
declare class WebsitePeople extends BaseResource {
|
|
147
|
+
/**
|
|
148
|
+
* Get People Statistics
|
|
149
|
+
*/
|
|
150
|
+
getPeopleStatistics(websiteID: string): Promise<PeopleStatistics>;
|
|
151
|
+
/**
|
|
152
|
+
* List Suggested People Segments
|
|
153
|
+
*/
|
|
154
|
+
listSuggestedPeopleSegments(websiteID: string, pageNumber?: number): Promise<PeopleSuggestedSegment[]>;
|
|
155
|
+
/**
|
|
156
|
+
* Delete Suggested People Segment
|
|
157
|
+
*/
|
|
158
|
+
deleteSuggestedPeopleSegment(websiteID: string, segment: string): Promise<any>;
|
|
159
|
+
/**
|
|
160
|
+
* List Suggested People Data Keys
|
|
161
|
+
*/
|
|
162
|
+
listSuggestedPeopleDataKeys(websiteID: string, pageNumber?: number): Promise<PeopleSuggestedDataKey[]>;
|
|
163
|
+
/**
|
|
164
|
+
* Delete Suggested People Data Key
|
|
165
|
+
*/
|
|
166
|
+
deleteSuggestedPeopleDataKey(websiteID: string, key: string): Promise<any>;
|
|
167
|
+
/**
|
|
168
|
+
* List Suggested People Events
|
|
169
|
+
*/
|
|
170
|
+
listSuggestedPeopleEvents(websiteID: string, pageNumber?: number): Promise<PeopleSuggestedEvent[]>;
|
|
171
|
+
/**
|
|
172
|
+
* Delete Suggested People Event
|
|
173
|
+
*/
|
|
174
|
+
deleteSuggestedPeopleEvent(websiteID: string, text: string): Promise<any>;
|
|
175
|
+
/**
|
|
176
|
+
* List People Profiles
|
|
177
|
+
*/
|
|
178
|
+
listPeopleProfiles(websiteID: string, pageNumber?: number, searchField?: string, searchOrder?: string, searchOperator?: string, searchFilter?: string, searchText?: string): Promise<PeopleProfile[]>;
|
|
179
|
+
/**
|
|
180
|
+
* Add New People Profile
|
|
181
|
+
*/
|
|
182
|
+
addNewPeopleProfile(websiteID: string, profile: PeopleProfileUpdateCard): Promise<any>;
|
|
183
|
+
/**
|
|
184
|
+
* Check If People Profile Exists
|
|
185
|
+
*/
|
|
186
|
+
checkPeopleProfileExists(websiteID: string, peopleID: string): Promise<any>;
|
|
187
|
+
/**
|
|
188
|
+
* Save People Profile
|
|
189
|
+
*/
|
|
190
|
+
getPeopleProfile(websiteID: string, peopleID: string): Promise<any>;
|
|
191
|
+
/**
|
|
192
|
+
* Get People Profile
|
|
193
|
+
*/
|
|
194
|
+
savePeopleProfile(websiteID: string, peopleID: string, profile: PeopleProfileUpdateCard): Promise<any>;
|
|
195
|
+
/**
|
|
196
|
+
* Update People Profile
|
|
197
|
+
*/
|
|
198
|
+
updatePeopleProfile(websiteID: string, peopleID: string, profile: PeopleProfileUpdateCard): Promise<any>;
|
|
199
|
+
/**
|
|
200
|
+
* Remove People Profile
|
|
201
|
+
*/
|
|
202
|
+
removePeopleProfile(websiteID: string, peopleID: string): Promise<any>;
|
|
203
|
+
/**
|
|
204
|
+
* List People Conversations
|
|
205
|
+
*/
|
|
206
|
+
listPeopleConversations(websiteID: string, peopleID: string, pageNumber?: number): Promise<string[]>;
|
|
207
|
+
/**
|
|
208
|
+
* List People Campaigns
|
|
209
|
+
*/
|
|
210
|
+
listPeopleCampaigns(websiteID: string, peopleID: string, pageNumber?: number): Promise<PeopleCampaign[]>;
|
|
211
|
+
/**
|
|
212
|
+
* Add A People Event
|
|
213
|
+
*/
|
|
214
|
+
addPeopleEvent(websiteID: string, peopleID: string, peopleEvent: PeopleEvent): Promise<any>;
|
|
215
|
+
/**
|
|
216
|
+
* List People Events
|
|
217
|
+
*/
|
|
218
|
+
listPeopleEvents(websiteID: string, peopleID: string, pageNumber?: number): Promise<PeopleEvent[]>;
|
|
219
|
+
/**
|
|
220
|
+
* Get People Data
|
|
221
|
+
*/
|
|
222
|
+
getPeopleData(websiteID: string, peopleID: string): Promise<PeopleData>;
|
|
223
|
+
/**
|
|
224
|
+
* Save People Data
|
|
225
|
+
*/
|
|
226
|
+
savePeopleData(websiteID: string, peopleID: string, peopleData: Record<string, boolean | string | number>): Promise<any>;
|
|
227
|
+
/**
|
|
228
|
+
* Update People Data
|
|
229
|
+
*/
|
|
230
|
+
updatePeopleData(websiteID: string, peopleID: string, peopleData: Record<string, boolean | string | number>): Promise<any>;
|
|
231
|
+
/**
|
|
232
|
+
* Get People Subscription Status
|
|
233
|
+
*/
|
|
234
|
+
getPeopleSubscriptionStatus(websiteID: string, peopleID: string): Promise<PeopleSubscription>;
|
|
235
|
+
/**
|
|
236
|
+
* Update People Subscription Status
|
|
237
|
+
*/
|
|
238
|
+
updatePeopleSubscriptionStatus(websiteID: string, peopleID: string, peopleSubscription: PeopleSubscriptionUpdate): Promise<any>;
|
|
239
|
+
/**
|
|
240
|
+
* Export People Profiles
|
|
241
|
+
*/
|
|
242
|
+
exportPeopleProfiles(websiteID: string): Promise<any>;
|
|
243
|
+
/**
|
|
244
|
+
* Import People Profiles
|
|
245
|
+
*/
|
|
246
|
+
importPeopleProfiles(websiteID: string, importSetup: PeopleProfileImportSetup): Promise<any>;
|
|
247
|
+
}
|
|
248
|
+
export default WebsitePeople;
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* node-crisp-api
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2022, Crisp IM SAS
|
|
6
|
+
* Author: Baptiste Jamin <baptiste@crisp.chat>
|
|
7
|
+
*/
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
/**************************************************************************
|
|
13
|
+
* IMPORTS
|
|
14
|
+
***************************************************************************/
|
|
15
|
+
// PROJECT: RESOURCES
|
|
16
|
+
const BaseResource_1 = __importDefault(require("./BaseResource"));
|
|
17
|
+
/**
|
|
18
|
+
* Crisp WebsitePeople Resource
|
|
19
|
+
* @class
|
|
20
|
+
* @classdesc This is the Crisp Website People Resource
|
|
21
|
+
*/
|
|
22
|
+
class WebsitePeople extends BaseResource_1.default {
|
|
23
|
+
/**
|
|
24
|
+
* Get People Statistics
|
|
25
|
+
*/
|
|
26
|
+
getPeopleStatistics(websiteID) {
|
|
27
|
+
return this.crisp.get(this.crisp.prepareRestUrl(["website", websiteID, "people", "stats"]));
|
|
28
|
+
}
|
|
29
|
+
;
|
|
30
|
+
/**
|
|
31
|
+
* List Suggested People Segments
|
|
32
|
+
*/
|
|
33
|
+
listSuggestedPeopleSegments(websiteID, pageNumber = 1) {
|
|
34
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
35
|
+
"website", websiteID, "people", "suggest", "segments", String(pageNumber)
|
|
36
|
+
]));
|
|
37
|
+
}
|
|
38
|
+
;
|
|
39
|
+
/**
|
|
40
|
+
* Delete Suggested People Segment
|
|
41
|
+
*/
|
|
42
|
+
deleteSuggestedPeopleSegment(websiteID, segment) {
|
|
43
|
+
return this.crisp.delete(this.crisp.prepareRestUrl([
|
|
44
|
+
"website", websiteID, "people", "suggest", "segment"
|
|
45
|
+
]), null, {
|
|
46
|
+
segment: segment
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
;
|
|
50
|
+
/**
|
|
51
|
+
* List Suggested People Data Keys
|
|
52
|
+
*/
|
|
53
|
+
listSuggestedPeopleDataKeys(websiteID, pageNumber = 1) {
|
|
54
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
55
|
+
"website", websiteID, "people", "suggest", "data", String(pageNumber)
|
|
56
|
+
]));
|
|
57
|
+
}
|
|
58
|
+
;
|
|
59
|
+
/**
|
|
60
|
+
* Delete Suggested People Data Key
|
|
61
|
+
*/
|
|
62
|
+
deleteSuggestedPeopleDataKey(websiteID, key) {
|
|
63
|
+
return this.crisp.delete(this.crisp.prepareRestUrl([
|
|
64
|
+
"website", websiteID, "people", "suggest", "data"
|
|
65
|
+
]), null, {
|
|
66
|
+
key: key
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
;
|
|
70
|
+
/**
|
|
71
|
+
* List Suggested People Events
|
|
72
|
+
*/
|
|
73
|
+
listSuggestedPeopleEvents(websiteID, pageNumber = 1) {
|
|
74
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
75
|
+
"website", websiteID, "people", "suggest", "events", String(pageNumber)
|
|
76
|
+
]));
|
|
77
|
+
}
|
|
78
|
+
;
|
|
79
|
+
/**
|
|
80
|
+
* Delete Suggested People Event
|
|
81
|
+
*/
|
|
82
|
+
deleteSuggestedPeopleEvent(websiteID, text) {
|
|
83
|
+
return this.crisp.delete(this.crisp.prepareRestUrl([
|
|
84
|
+
"website", websiteID, "people", "suggest", "event"
|
|
85
|
+
]), null, {
|
|
86
|
+
text: text
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
;
|
|
90
|
+
/**
|
|
91
|
+
* List People Profiles
|
|
92
|
+
*/
|
|
93
|
+
listPeopleProfiles(websiteID, pageNumber = 1, searchField, searchOrder, searchOperator, searchFilter, searchText) {
|
|
94
|
+
// Generate query
|
|
95
|
+
let query = {};
|
|
96
|
+
if (searchField) {
|
|
97
|
+
// @ts-ignore
|
|
98
|
+
query.sort_field = searchField;
|
|
99
|
+
}
|
|
100
|
+
if (searchOrder) {
|
|
101
|
+
// @ts-ignore
|
|
102
|
+
query.sort_order = searchOrder;
|
|
103
|
+
}
|
|
104
|
+
if (searchOperator) {
|
|
105
|
+
// @ts-ignore
|
|
106
|
+
query.search_operator = searchOperator;
|
|
107
|
+
}
|
|
108
|
+
if (searchFilter) {
|
|
109
|
+
// @ts-ignore
|
|
110
|
+
query.search_filter = searchFilter;
|
|
111
|
+
}
|
|
112
|
+
if (searchText) {
|
|
113
|
+
// @ts-ignore
|
|
114
|
+
query.search_text = searchText;
|
|
115
|
+
}
|
|
116
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
117
|
+
"website", websiteID, "people", "profiles", String(pageNumber)
|
|
118
|
+
]), query);
|
|
119
|
+
}
|
|
120
|
+
;
|
|
121
|
+
/**
|
|
122
|
+
* Add New People Profile
|
|
123
|
+
*/
|
|
124
|
+
addNewPeopleProfile(websiteID, profile) {
|
|
125
|
+
return this.crisp.post(this.crisp.prepareRestUrl(["website", websiteID, "people", "profile"]), null, profile);
|
|
126
|
+
}
|
|
127
|
+
;
|
|
128
|
+
/**
|
|
129
|
+
* Check If People Profile Exists
|
|
130
|
+
*/
|
|
131
|
+
checkPeopleProfileExists(websiteID, peopleID) {
|
|
132
|
+
return this.crisp.head(this.crisp.prepareRestUrl([
|
|
133
|
+
"website", websiteID, "people", "profile", peopleID
|
|
134
|
+
]));
|
|
135
|
+
}
|
|
136
|
+
;
|
|
137
|
+
/**
|
|
138
|
+
* Save People Profile
|
|
139
|
+
*/
|
|
140
|
+
getPeopleProfile(websiteID, peopleID) {
|
|
141
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
142
|
+
"website", websiteID, "people", "profile", peopleID
|
|
143
|
+
]));
|
|
144
|
+
}
|
|
145
|
+
;
|
|
146
|
+
/**
|
|
147
|
+
* Get People Profile
|
|
148
|
+
*/
|
|
149
|
+
savePeopleProfile(websiteID, peopleID, profile) {
|
|
150
|
+
return this.crisp.put(this.crisp.prepareRestUrl([
|
|
151
|
+
"website", websiteID, "people", "profile", peopleID
|
|
152
|
+
]), null, profile);
|
|
153
|
+
}
|
|
154
|
+
;
|
|
155
|
+
/**
|
|
156
|
+
* Update People Profile
|
|
157
|
+
*/
|
|
158
|
+
updatePeopleProfile(websiteID, peopleID, profile) {
|
|
159
|
+
return this.crisp.patch(this.crisp.prepareRestUrl([
|
|
160
|
+
"website", websiteID, "people", "profile", peopleID
|
|
161
|
+
]), null, profile);
|
|
162
|
+
}
|
|
163
|
+
;
|
|
164
|
+
/**
|
|
165
|
+
* Remove People Profile
|
|
166
|
+
*/
|
|
167
|
+
removePeopleProfile(websiteID, peopleID) {
|
|
168
|
+
return this.crisp.delete(this.crisp.prepareRestUrl([
|
|
169
|
+
"website", websiteID, "people", "profile", peopleID
|
|
170
|
+
]));
|
|
171
|
+
}
|
|
172
|
+
;
|
|
173
|
+
/**
|
|
174
|
+
* List People Conversations
|
|
175
|
+
*/
|
|
176
|
+
listPeopleConversations(websiteID, peopleID, pageNumber = 1) {
|
|
177
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
178
|
+
"website", websiteID, "people", "conversations", peopleID, "list",
|
|
179
|
+
String(pageNumber)
|
|
180
|
+
]));
|
|
181
|
+
}
|
|
182
|
+
;
|
|
183
|
+
/**
|
|
184
|
+
* List People Campaigns
|
|
185
|
+
*/
|
|
186
|
+
listPeopleCampaigns(websiteID, peopleID, pageNumber = 1) {
|
|
187
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
188
|
+
"website", websiteID, "people", "campaigns", peopleID, "list",
|
|
189
|
+
String(pageNumber)
|
|
190
|
+
]));
|
|
191
|
+
}
|
|
192
|
+
;
|
|
193
|
+
/**
|
|
194
|
+
* Add A People Event
|
|
195
|
+
*/
|
|
196
|
+
addPeopleEvent(websiteID, peopleID, peopleEvent) {
|
|
197
|
+
return this.crisp.post(this.crisp.prepareRestUrl([
|
|
198
|
+
"website", websiteID, "people", "events", peopleID
|
|
199
|
+
]), null, peopleEvent);
|
|
200
|
+
}
|
|
201
|
+
;
|
|
202
|
+
/**
|
|
203
|
+
* List People Events
|
|
204
|
+
*/
|
|
205
|
+
listPeopleEvents(websiteID, peopleID, pageNumber = 1) {
|
|
206
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
207
|
+
"website", websiteID, "people", "events", peopleID, "list",
|
|
208
|
+
String(pageNumber)
|
|
209
|
+
]));
|
|
210
|
+
}
|
|
211
|
+
;
|
|
212
|
+
/**
|
|
213
|
+
* Get People Data
|
|
214
|
+
*/
|
|
215
|
+
getPeopleData(websiteID, peopleID) {
|
|
216
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
217
|
+
"website", websiteID, "people", "data", peopleID
|
|
218
|
+
]));
|
|
219
|
+
}
|
|
220
|
+
;
|
|
221
|
+
/**
|
|
222
|
+
* Save People Data
|
|
223
|
+
*/
|
|
224
|
+
savePeopleData(websiteID, peopleID, peopleData) {
|
|
225
|
+
return this.crisp.put(this.crisp.prepareRestUrl([
|
|
226
|
+
"website", websiteID, "people", "data", peopleID
|
|
227
|
+
]), null, peopleData);
|
|
228
|
+
}
|
|
229
|
+
;
|
|
230
|
+
/**
|
|
231
|
+
* Update People Data
|
|
232
|
+
*/
|
|
233
|
+
updatePeopleData(websiteID, peopleID, peopleData) {
|
|
234
|
+
return this.crisp.patch(this.crisp.prepareRestUrl([
|
|
235
|
+
"website", websiteID, "people", "data", peopleID
|
|
236
|
+
]), null, peopleData);
|
|
237
|
+
}
|
|
238
|
+
;
|
|
239
|
+
/**
|
|
240
|
+
* Get People Subscription Status
|
|
241
|
+
*/
|
|
242
|
+
getPeopleSubscriptionStatus(websiteID, peopleID) {
|
|
243
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
244
|
+
"website", websiteID, "people", "subscription", peopleID
|
|
245
|
+
]));
|
|
246
|
+
}
|
|
247
|
+
;
|
|
248
|
+
/**
|
|
249
|
+
* Update People Subscription Status
|
|
250
|
+
*/
|
|
251
|
+
updatePeopleSubscriptionStatus(websiteID, peopleID, peopleSubscription) {
|
|
252
|
+
return this.crisp.patch(this.crisp.prepareRestUrl([
|
|
253
|
+
"website", websiteID, "people", "subscription", peopleID
|
|
254
|
+
]), null, peopleSubscription);
|
|
255
|
+
}
|
|
256
|
+
;
|
|
257
|
+
/**
|
|
258
|
+
* Export People Profiles
|
|
259
|
+
*/
|
|
260
|
+
exportPeopleProfiles(websiteID) {
|
|
261
|
+
return this.crisp.post(this.crisp.prepareRestUrl([
|
|
262
|
+
"website", websiteID, "people", "export", "profiles"
|
|
263
|
+
]), null, null);
|
|
264
|
+
}
|
|
265
|
+
;
|
|
266
|
+
/**
|
|
267
|
+
* Import People Profiles
|
|
268
|
+
*/
|
|
269
|
+
importPeopleProfiles(websiteID, importSetup) {
|
|
270
|
+
return this.crisp.post(this.crisp.prepareRestUrl([
|
|
271
|
+
"website", websiteID, "people", "import", "profiles"
|
|
272
|
+
]), null, importSetup);
|
|
273
|
+
}
|
|
274
|
+
;
|
|
275
|
+
}
|
|
276
|
+
exports.default = WebsitePeople;
|