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,183 @@
|
|
|
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 WebsiteOperatorListOne {
|
|
20
|
+
type?: string;
|
|
21
|
+
details?: WebsiteOperator;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface WebsiteOperatorData {
|
|
25
|
+
data?: WebsiteOperator;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface WebsiteOperator {
|
|
29
|
+
userID?: string;
|
|
30
|
+
email?: string;
|
|
31
|
+
avatar?: string;
|
|
32
|
+
firstName?: string;
|
|
33
|
+
lastName?: string;
|
|
34
|
+
role?: string;
|
|
35
|
+
title?: string;
|
|
36
|
+
availability?: string;
|
|
37
|
+
hasToken?: boolean;
|
|
38
|
+
identifier?: string;
|
|
39
|
+
key?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface WebsiteOperatorsLastActiveListOne {
|
|
43
|
+
userID?: string;
|
|
44
|
+
avatar?: string;
|
|
45
|
+
nickname?: string;
|
|
46
|
+
timestamp?: number;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface WebsiteOperatorEmail {
|
|
50
|
+
recipient?: string;
|
|
51
|
+
userID?: string;
|
|
52
|
+
subject?: string;
|
|
53
|
+
message?: string;
|
|
54
|
+
target?: WebsiteOperatorEmailTarget;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface WebsiteOperatorEmailTarget {
|
|
58
|
+
label?: string;
|
|
59
|
+
url?: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**************************************************************************
|
|
63
|
+
* CLASSES
|
|
64
|
+
***************************************************************************/
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Crisp WebsiteOperator Resource
|
|
68
|
+
*/
|
|
69
|
+
class WebsiteOperatorService extends BaseResource {
|
|
70
|
+
/**
|
|
71
|
+
* List Website Operators
|
|
72
|
+
*/
|
|
73
|
+
listWebsiteOperators(websiteID: string): Promise<WebsiteOperatorListOne[]> {
|
|
74
|
+
return this.crisp.get(
|
|
75
|
+
this.crisp.prepareRestUrl([
|
|
76
|
+
"website", websiteID, "operators", "list"
|
|
77
|
+
])
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* List Last Active Website Operators
|
|
83
|
+
*/
|
|
84
|
+
listLastActiveWebsiteOperators(
|
|
85
|
+
websiteID: string
|
|
86
|
+
): Promise<WebsiteOperatorsLastActiveListOne[]> {
|
|
87
|
+
return this.crisp.get(
|
|
88
|
+
this.crisp.prepareRestUrl([
|
|
89
|
+
"website", websiteID, "operators", "active"
|
|
90
|
+
])
|
|
91
|
+
);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Flush Last Active Website Operators
|
|
96
|
+
*/
|
|
97
|
+
flushLastActiveWebsiteOperators(websiteID: string) {
|
|
98
|
+
return this.crisp.delete(
|
|
99
|
+
this.crisp.prepareRestUrl([
|
|
100
|
+
"website", websiteID, "operators", "active"
|
|
101
|
+
])
|
|
102
|
+
);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Send Email To Website Operators
|
|
107
|
+
*/
|
|
108
|
+
sendEmailToWebsiteOperators(
|
|
109
|
+
websiteID: string, emailData: WebsiteOperatorEmail
|
|
110
|
+
) {
|
|
111
|
+
return this.crisp.post(
|
|
112
|
+
this.crisp.prepareRestUrl(["website", websiteID, "operators", "email"]),
|
|
113
|
+
|
|
114
|
+
null, emailData
|
|
115
|
+
);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Get A Website Operator
|
|
120
|
+
*/
|
|
121
|
+
getWebsiteOperator(
|
|
122
|
+
websiteID: string, userID: string
|
|
123
|
+
): Promise<WebsiteOperator> {
|
|
124
|
+
return this.crisp.get(
|
|
125
|
+
this.crisp.prepareRestUrl([
|
|
126
|
+
"website", websiteID, "operator", userID
|
|
127
|
+
])
|
|
128
|
+
);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Invite A Website Operator
|
|
133
|
+
*/
|
|
134
|
+
inviteWebsiteOperator(
|
|
135
|
+
websiteID: string, email: string, role: string, verify: boolean
|
|
136
|
+
) {
|
|
137
|
+
return this.crisp.post(
|
|
138
|
+
this.crisp.prepareRestUrl(["website", websiteID, "operator"]),
|
|
139
|
+
|
|
140
|
+
null,
|
|
141
|
+
|
|
142
|
+
{
|
|
143
|
+
email: email,
|
|
144
|
+
role: role,
|
|
145
|
+
verify: verify
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Change Operator Membership
|
|
152
|
+
*/
|
|
153
|
+
changeOperatorMembership(
|
|
154
|
+
websiteID: string, userID: string, role: string, title: string
|
|
155
|
+
) {
|
|
156
|
+
return this.crisp.patch(
|
|
157
|
+
this.crisp.prepareRestUrl(["website", websiteID, "operator", userID]),
|
|
158
|
+
|
|
159
|
+
null,
|
|
160
|
+
|
|
161
|
+
{
|
|
162
|
+
role: role,
|
|
163
|
+
title: title
|
|
164
|
+
}
|
|
165
|
+
);
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Unlink Operator From Website
|
|
170
|
+
*/
|
|
171
|
+
unlinkOperatorFromWebsite(websiteID: string, userID: string) {
|
|
172
|
+
return this.crisp.delete(
|
|
173
|
+
this.crisp.prepareRestUrl(["website", websiteID, "operator", userID])
|
|
174
|
+
);
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**************************************************************************
|
|
179
|
+
* EXPORTS
|
|
180
|
+
***************************************************************************/
|
|
181
|
+
|
|
182
|
+
export default WebsiteOperatorService;
|
|
183
|
+
|