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.
Files changed (116) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +2 -2
  3. package/dist/crisp.d.ts +179 -0
  4. package/dist/crisp.js +773 -0
  5. package/dist/resources/BaseResource.d.ts +21 -0
  6. package/dist/resources/BaseResource.js +26 -0
  7. package/dist/resources/BucketURL.d.ts +37 -0
  8. package/dist/resources/BucketURL.js +35 -0
  9. package/dist/resources/MediaAnimation.d.ts +20 -0
  10. package/dist/resources/MediaAnimation.js +40 -0
  11. package/dist/resources/PluginConnect.d.ts +59 -0
  12. package/dist/resources/PluginConnect.js +79 -0
  13. package/dist/resources/PluginSubscription.d.ts +112 -0
  14. package/dist/resources/PluginSubscription.js +130 -0
  15. package/dist/resources/WebsiteAnalytics.d.ts +20 -0
  16. package/dist/resources/WebsiteAnalytics.js +37 -0
  17. package/dist/resources/WebsiteAvailability.d.ts +40 -0
  18. package/dist/resources/WebsiteAvailability.js +46 -0
  19. package/dist/resources/WebsiteBase.d.ts +69 -0
  20. package/dist/resources/WebsiteBase.js +77 -0
  21. package/dist/resources/WebsiteBatch.d.ts +61 -0
  22. package/dist/resources/WebsiteBatch.js +76 -0
  23. package/dist/resources/WebsiteCampaign.d.ts +208 -0
  24. package/dist/resources/WebsiteCampaign.js +201 -0
  25. package/dist/resources/WebsiteConversation.d.ts +710 -0
  26. package/dist/resources/WebsiteConversation.js +607 -0
  27. package/dist/resources/WebsiteHelpdesk.d.ts +356 -0
  28. package/dist/resources/WebsiteHelpdesk.js +593 -0
  29. package/dist/resources/WebsiteOperator.d.ts +88 -0
  30. package/dist/resources/WebsiteOperator.js +99 -0
  31. package/dist/resources/WebsitePeople.d.ts +257 -0
  32. package/dist/resources/WebsitePeople.js +282 -0
  33. package/dist/resources/WebsiteSettings.d.ts +168 -0
  34. package/dist/resources/WebsiteSettings.js +42 -0
  35. package/dist/resources/WebsiteVerify.d.ts +47 -0
  36. package/dist/resources/WebsiteVerify.js +56 -0
  37. package/dist/resources/WebsiteVisitors.d.ts +122 -0
  38. package/dist/resources/WebsiteVisitors.js +98 -0
  39. package/dist/resources/index.d.ts +20 -0
  40. package/dist/resources/index.js +42 -0
  41. package/dist/services/bucket.d.ts +19 -0
  42. package/dist/services/bucket.js +31 -0
  43. package/dist/services/media.d.ts +19 -0
  44. package/dist/services/media.js +31 -0
  45. package/dist/services/plugin.d.ts +20 -0
  46. package/dist/services/plugin.js +33 -0
  47. package/dist/services/website.d.ts +30 -0
  48. package/dist/services/website.js +53 -0
  49. package/eslint.config.mjs +208 -0
  50. package/lib/crisp.ts +1006 -0
  51. package/lib/resources/BaseResource.ts +37 -0
  52. package/lib/resources/BucketURL.ts +58 -0
  53. package/lib/resources/MediaAnimation.ts +44 -0
  54. package/lib/resources/PluginConnect.ts +135 -0
  55. package/lib/resources/PluginSubscription.ts +236 -0
  56. package/lib/resources/WebsiteAnalytics.ts +41 -0
  57. package/lib/resources/WebsiteAvailability.ts +74 -0
  58. package/lib/resources/WebsiteBase.ts +119 -0
  59. package/lib/resources/WebsiteBatch.ts +116 -0
  60. package/lib/resources/WebsiteCampaign.ts +432 -0
  61. package/lib/resources/WebsiteConversation.ts +1507 -0
  62. package/lib/resources/WebsiteHelpdesk.ts +1024 -0
  63. package/lib/resources/WebsiteOperator.ts +183 -0
  64. package/lib/resources/WebsitePeople.ts +568 -0
  65. package/lib/resources/WebsiteSettings.ts +207 -0
  66. package/lib/resources/WebsiteVerify.ts +90 -0
  67. package/lib/resources/WebsiteVisitors.ts +219 -0
  68. package/lib/resources/index.ts +28 -0
  69. package/lib/services/bucket.ts +36 -0
  70. package/lib/services/media.ts +36 -0
  71. package/lib/services/plugin.ts +40 -0
  72. package/lib/services/website.ts +70 -0
  73. package/package.json +16 -11
  74. package/tsconfig.json +12 -5
  75. package/lib/crisp.js +0 -1171
  76. package/lib/resources/BucketURL.js +0 -34
  77. package/lib/resources/MediaAnimation.js +0 -41
  78. package/lib/resources/PluginConnect.js +0 -119
  79. package/lib/resources/PluginSubscription.js +0 -234
  80. package/lib/resources/WebsiteAnalytics.js +0 -37
  81. package/lib/resources/WebsiteAvailability.js +0 -48
  82. package/lib/resources/WebsiteBase.js +0 -100
  83. package/lib/resources/WebsiteBatch.js +0 -92
  84. package/lib/resources/WebsiteCampaign.js +0 -396
  85. package/lib/resources/WebsiteConversation.js +0 -1261
  86. package/lib/resources/WebsiteHelpdesk.js +0 -1198
  87. package/lib/resources/WebsiteOperator.js +0 -167
  88. package/lib/resources/WebsitePeople.js +0 -516
  89. package/lib/resources/WebsiteSettings.js +0 -50
  90. package/lib/resources/WebsiteVerify.js +0 -79
  91. package/lib/resources/WebsiteVisitors.js +0 -148
  92. package/lib/services/Bucket.js +0 -28
  93. package/lib/services/Media.js +0 -28
  94. package/lib/services/Plugin.js +0 -29
  95. package/lib/services/Website.js +0 -39
  96. package/types/crisp.d.ts +0 -151
  97. package/types/resources/BucketURL.d.ts +0 -15
  98. package/types/resources/MediaAnimation.d.ts +0 -15
  99. package/types/resources/PluginConnect.d.ts +0 -15
  100. package/types/resources/PluginSubscription.d.ts +0 -15
  101. package/types/resources/WebsiteAnalytics.d.ts +0 -15
  102. package/types/resources/WebsiteAvailability.d.ts +0 -15
  103. package/types/resources/WebsiteBase.d.ts +0 -15
  104. package/types/resources/WebsiteBatch.d.ts +0 -15
  105. package/types/resources/WebsiteCampaign.d.ts +0 -15
  106. package/types/resources/WebsiteConversation.d.ts +0 -15
  107. package/types/resources/WebsiteHelpdesk.d.ts +0 -15
  108. package/types/resources/WebsiteOperator.d.ts +0 -15
  109. package/types/resources/WebsitePeople.d.ts +0 -15
  110. package/types/resources/WebsiteSettings.d.ts +0 -15
  111. package/types/resources/WebsiteVerify.d.ts +0 -15
  112. package/types/resources/WebsiteVisitors.d.ts +0 -15
  113. package/types/services/Bucket.d.ts +0 -14
  114. package/types/services/Media.d.ts +0 -14
  115. package/types/services/Plugin.d.ts +0 -14
  116. 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
+