crisp-api 10.2.0 → 10.4.0
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/EXAMPLES.md +64 -2
- package/README.md +106 -6
- package/dist/crisp.d.ts +2 -0
- package/dist/crisp.js +4 -1
- package/dist/resources/PlanSubscription.d.ts +87 -0
- package/dist/resources/PlanSubscription.js +87 -0
- package/dist/resources/PluginConnect.d.ts +2 -2
- package/dist/resources/PluginConnect.js +6 -4
- package/dist/resources/WebsiteSettings.d.ts +4 -0
- package/dist/resources/index.d.ts +1 -0
- package/dist/resources/index.js +1 -0
- package/dist/services/plan.d.ts +19 -0
- package/dist/services/plan.js +31 -0
- package/lib/crisp.ts +6 -0
- package/lib/resources/PlanSubscription.ts +171 -0
- package/lib/resources/PluginConnect.ts +10 -2
- package/lib/resources/PluginSubscription.ts +34 -34
- package/lib/resources/WebsiteAvailability.ts +6 -6
- package/lib/resources/WebsiteBase.ts +12 -12
- package/lib/resources/WebsiteBatch.ts +4 -4
- package/lib/resources/WebsiteCampaign.ts +67 -67
- package/lib/resources/WebsiteConversation.ts +8 -8
- package/lib/resources/WebsiteSettings.ts +4 -0
- package/lib/resources/index.ts +1 -0
- package/lib/services/plan.ts +36 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
Changelog
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
|
+
## v10.4.0
|
|
5
|
+
|
|
6
|
+
### New Features
|
|
7
|
+
|
|
8
|
+
* Added now-public `subscription` REST API routes for `CrispClient.plan` prefix.
|
|
9
|
+
|
|
10
|
+
## v10.3.0
|
|
11
|
+
|
|
12
|
+
### New Features
|
|
13
|
+
|
|
14
|
+
* Added a new `includePlan` parameter to `CrispClient.plugin.listAllConnectWebsites` and `CrispClient.plugin.listConnectWebsitesSince` methods.
|
|
15
|
+
|
|
4
16
|
## v10.2.0
|
|
5
17
|
|
|
6
18
|
### New Features
|
package/EXAMPLES.md
CHANGED
|
@@ -1711,9 +1711,11 @@ var settings = {
|
|
|
1711
1711
|
"overlay_mode": false,
|
|
1712
1712
|
"helpdesk_link": true,
|
|
1713
1713
|
"helpdesk_only": false,
|
|
1714
|
+
"helpdesk_navigate": "deep",
|
|
1714
1715
|
"status_health_dead": true,
|
|
1715
1716
|
"check_domain": false,
|
|
1716
1717
|
"color_theme": "blue",
|
|
1718
|
+
"color_mode": "auto",
|
|
1717
1719
|
"layout_theme": "default",
|
|
1718
1720
|
"text_theme": "default",
|
|
1719
1721
|
"welcome_message": "default",
|
|
@@ -2258,7 +2260,7 @@ https://docs.crisp.chat/references/rest-api/v1/#list-all-connect-websites
|
|
|
2258
2260
|
|
|
2259
2261
|
var pageNumber = 1;
|
|
2260
2262
|
|
|
2261
|
-
CrispClient.plugin.listAllConnectWebsites(pageNumber, filterConfigured);
|
|
2263
|
+
CrispClient.plugin.listAllConnectWebsites(pageNumber, filterConfigured, includePlan);
|
|
2262
2264
|
|
|
2263
2265
|
=========================
|
|
2264
2266
|
|
|
@@ -2266,7 +2268,7 @@ https://docs.crisp.chat/references/rest-api/v1/#list-connect-websites-since
|
|
|
2266
2268
|
|
|
2267
2269
|
var dateSince = "2023-08-16T09:00:00Z";
|
|
2268
2270
|
|
|
2269
|
-
CrispClient.plugin.listConnectWebsitesSince(dateSince, filterConfigured);
|
|
2271
|
+
CrispClient.plugin.listConnectWebsitesSince(dateSince, filterConfigured, includePlan);
|
|
2270
2272
|
|
|
2271
2273
|
=========================
|
|
2272
2274
|
|
|
@@ -2424,6 +2426,66 @@ CrispClient.plugin.dispatchPluginEvent(websiteID, pluginID, payload);
|
|
|
2424
2426
|
|
|
2425
2427
|
=========================
|
|
2426
2428
|
|
|
2429
|
+
https://docs.crisp.chat/references/rest-api/v1/#list-all-active-plan-subscriptions
|
|
2430
|
+
|
|
2431
|
+
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
|
|
2432
|
+
|
|
2433
|
+
CrispClient.plan.listAllActiveSubscriptions();
|
|
2434
|
+
|
|
2435
|
+
=========================
|
|
2436
|
+
|
|
2437
|
+
https://docs.crisp.chat/references/rest-api/v1/#get-plan-subscription-for-a-website
|
|
2438
|
+
|
|
2439
|
+
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
|
|
2440
|
+
|
|
2441
|
+
CrispClient.plan.getPlanSubscriptionForWebsite(websiteID);
|
|
2442
|
+
|
|
2443
|
+
=========================
|
|
2444
|
+
|
|
2445
|
+
https://docs.crisp.chat/references/rest-api/v1/#subscribe-website-to-plan
|
|
2446
|
+
|
|
2447
|
+
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
|
|
2448
|
+
var planID = "d678dbc1-e49d-47d3-92f2-c436f5b0e4a5";
|
|
2449
|
+
|
|
2450
|
+
CrispClient.plan.subscribeWebsiteToPlan(websiteID, planID);
|
|
2451
|
+
|
|
2452
|
+
=========================
|
|
2453
|
+
|
|
2454
|
+
https://docs.crisp.chat/references/rest-api/v1/#unsubscribe-plan-from-website
|
|
2455
|
+
|
|
2456
|
+
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
|
|
2457
|
+
|
|
2458
|
+
CrispClient.plan.unsubscribePlanFromWebsite(websiteID);
|
|
2459
|
+
|
|
2460
|
+
=========================
|
|
2461
|
+
|
|
2462
|
+
https://docs.crisp.chat/references/rest-api/v1/#change-bill-period-for-website-plan-subscription
|
|
2463
|
+
|
|
2464
|
+
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
|
|
2465
|
+
var period = "yearly";
|
|
2466
|
+
|
|
2467
|
+
CrispClient.plan.changeBillPeriodForWebsitePlanSubscription(websiteID, period);
|
|
2468
|
+
|
|
2469
|
+
=========================
|
|
2470
|
+
|
|
2471
|
+
https://docs.crisp.chat/references/rest-api/v1/#check-coupon-availability-for-website-plan-subscription
|
|
2472
|
+
|
|
2473
|
+
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
|
|
2474
|
+
var code = "CRISP+AWESOME";
|
|
2475
|
+
|
|
2476
|
+
CrispClient.plan.checkCouponAvailabilityForWebsitePlanSubscription(websiteID, code);
|
|
2477
|
+
|
|
2478
|
+
=========================
|
|
2479
|
+
|
|
2480
|
+
https://docs.crisp.chat/references/rest-api/v1/#redeem-coupon-for-website-plan-subscription
|
|
2481
|
+
|
|
2482
|
+
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
|
|
2483
|
+
var code = "CRISP+AWESOME";
|
|
2484
|
+
|
|
2485
|
+
CrispClient.plan.redeemCouponForWebsitePlanSubscription(websiteID, code);
|
|
2486
|
+
|
|
2487
|
+
=========================
|
|
2488
|
+
|
|
2427
2489
|
https://docs.crisp.chat/references/rest-api/v1/#list-animation-medias
|
|
2428
2490
|
|
|
2429
2491
|
var listID = "f7fb43da-1cd8-49c1-ade0-9f5b71d034e3";
|
package/README.md
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
The Crisp API Node wrapper. Authenticate, send messages, fetch conversations, access your agent accounts from your JavaScript code.
|
|
6
6
|
|
|
7
|
-
Copyright
|
|
7
|
+
Copyright 2026 Crisp IM SAS. See LICENSE for copying information.
|
|
8
8
|
|
|
9
|
-
* **📝 Implements**: [REST API Reference (V1)](https://docs.crisp.chat/references/rest-api/v1/) at revision:
|
|
9
|
+
* **📝 Implements**: [REST API Reference (V1)](https://docs.crisp.chat/references/rest-api/v1/) at revision: 06/01/2026
|
|
10
10
|
* **😘 Maintainers**: [@baptistejamin](https://github.com/baptistejamin), [@eliottvincent](https://github.com/eliottvincent), [@valeriansaliou](https://github.com/valeriansaliou)
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
@@ -125,6 +125,14 @@ All methods that you will most likely need when building a Crisp integration are
|
|
|
125
125
|
<li><a href="#plugin-subscription">Plugin Subscription</a></li>
|
|
126
126
|
</ul>
|
|
127
127
|
</details>
|
|
128
|
+
<details>
|
|
129
|
+
<summary>
|
|
130
|
+
<a href="#plan">Plan</a>
|
|
131
|
+
</summary>
|
|
132
|
+
<ul>
|
|
133
|
+
<li><a href="#plan-subscription">Plan Subscription</a></li>
|
|
134
|
+
</ul>
|
|
135
|
+
</details>
|
|
128
136
|
<details>
|
|
129
137
|
<summary>
|
|
130
138
|
<a href="#media">Media</a>
|
|
@@ -2473,9 +2481,11 @@ _👉 Notice: The `peopleID` argument can be an email or the `peopleID`._
|
|
|
2473
2481
|
"overlay_mode": false,
|
|
2474
2482
|
"helpdesk_link": true,
|
|
2475
2483
|
"helpdesk_only": false,
|
|
2484
|
+
"helpdesk_navigate": "deep",
|
|
2476
2485
|
"status_health_dead": true,
|
|
2477
2486
|
"check_domain": false,
|
|
2478
2487
|
"color_theme": "blue",
|
|
2488
|
+
"color_mode": "auto",
|
|
2479
2489
|
"layout_theme": "default",
|
|
2480
2490
|
"text_theme": "default",
|
|
2481
2491
|
"welcome_message": "default",
|
|
@@ -3223,26 +3233,26 @@ _👉 Notice: The `peopleID` argument can be an email or the `peopleID`._
|
|
|
3223
3233
|
</details>
|
|
3224
3234
|
|
|
3225
3235
|
* **⭐ List All Connect Websites** [`plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#list-all-connect-websites)
|
|
3226
|
-
* `CrispClient.plugin.listAllConnectWebsites(pageNumber, filterConfigured)`
|
|
3236
|
+
* `CrispClient.plugin.listAllConnectWebsites(pageNumber, filterConfigured, includePlan)`
|
|
3227
3237
|
* <details>
|
|
3228
3238
|
<summary>See Example</summary>
|
|
3229
3239
|
|
|
3230
3240
|
```javascript
|
|
3231
3241
|
var pageNumber = 1;
|
|
3232
3242
|
|
|
3233
|
-
CrispClient.plugin.listAllConnectWebsites(pageNumber, filterConfigured);
|
|
3243
|
+
CrispClient.plugin.listAllConnectWebsites(pageNumber, filterConfigured, includePlan);
|
|
3234
3244
|
```
|
|
3235
3245
|
</details>
|
|
3236
3246
|
|
|
3237
3247
|
* **⭐ List Connect Websites Since** [`plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#list-connect-websites-since)
|
|
3238
|
-
* `CrispClient.plugin.listConnectWebsitesSince(dateSince, filterConfigured)`
|
|
3248
|
+
* `CrispClient.plugin.listConnectWebsitesSince(dateSince, filterConfigured, includePlan)`
|
|
3239
3249
|
* <details>
|
|
3240
3250
|
<summary>See Example</summary>
|
|
3241
3251
|
|
|
3242
3252
|
```javascript
|
|
3243
3253
|
var dateSince = "2023-08-16T09:00:00Z";
|
|
3244
3254
|
|
|
3245
|
-
CrispClient.plugin.listConnectWebsitesSince(dateSince, filterConfigured);
|
|
3255
|
+
CrispClient.plugin.listConnectWebsitesSince(dateSince, filterConfigured, includePlan);
|
|
3246
3256
|
```
|
|
3247
3257
|
</details>
|
|
3248
3258
|
|
|
@@ -3459,6 +3469,96 @@ _👉 Notice: The `peopleID` argument can be an email or the `peopleID`._
|
|
|
3459
3469
|
</details>
|
|
3460
3470
|
|
|
3461
3471
|
|
|
3472
|
+
### Plan
|
|
3473
|
+
|
|
3474
|
+
* #### **Plan Subscription**
|
|
3475
|
+
* **List All Active Plan Subscriptions** [`user`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#list-all-active-plan-subscriptions)
|
|
3476
|
+
* `CrispClient.plan.listAllActiveSubscriptions()`
|
|
3477
|
+
* <details>
|
|
3478
|
+
<summary>See Example</summary>
|
|
3479
|
+
|
|
3480
|
+
```javascript
|
|
3481
|
+
CrispClient.plan.listAllActiveSubscriptions();
|
|
3482
|
+
```
|
|
3483
|
+
</details>
|
|
3484
|
+
|
|
3485
|
+
* **Get Plan Subscription For A Website** [`user`, `plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#get-plan-subscription-for-a-website)
|
|
3486
|
+
* `CrispClient.plan.getPlanSubscriptionForWebsite(websiteID)`
|
|
3487
|
+
* <details>
|
|
3488
|
+
<summary>See Example</summary>
|
|
3489
|
+
|
|
3490
|
+
```javascript
|
|
3491
|
+
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
|
|
3492
|
+
|
|
3493
|
+
CrispClient.plan.getPlanSubscriptionForWebsite(websiteID);
|
|
3494
|
+
```
|
|
3495
|
+
</details>
|
|
3496
|
+
|
|
3497
|
+
* **Subscribe Website To Plan** [`user`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#subscribe-website-to-plan)
|
|
3498
|
+
* `CrispClient.plan.subscribeWebsiteToPlan(websiteID, planID)`
|
|
3499
|
+
* <details>
|
|
3500
|
+
<summary>See Example</summary>
|
|
3501
|
+
|
|
3502
|
+
```javascript
|
|
3503
|
+
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
|
|
3504
|
+
var planID = "d678dbc1-e49d-47d3-92f2-c436f5b0e4a5";
|
|
3505
|
+
|
|
3506
|
+
CrispClient.plan.subscribeWebsiteToPlan(websiteID, planID);
|
|
3507
|
+
```
|
|
3508
|
+
</details>
|
|
3509
|
+
|
|
3510
|
+
* **Unsubscribe Plan From Website** [`user`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#unsubscribe-plan-from-website)
|
|
3511
|
+
* `CrispClient.plan.unsubscribePlanFromWebsite(websiteID)`
|
|
3512
|
+
* <details>
|
|
3513
|
+
<summary>See Example</summary>
|
|
3514
|
+
|
|
3515
|
+
```javascript
|
|
3516
|
+
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
|
|
3517
|
+
|
|
3518
|
+
CrispClient.plan.unsubscribePlanFromWebsite(websiteID);
|
|
3519
|
+
```
|
|
3520
|
+
</details>
|
|
3521
|
+
|
|
3522
|
+
* **Change Bill Period For Website Plan Subscription** [`user`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#change-bill-period-for-website-plan-subscription)
|
|
3523
|
+
* `CrispClient.plan.changeBillPeriodForWebsitePlanSubscription(websiteID, period)`
|
|
3524
|
+
* <details>
|
|
3525
|
+
<summary>See Example</summary>
|
|
3526
|
+
|
|
3527
|
+
```javascript
|
|
3528
|
+
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
|
|
3529
|
+
var period = "yearly";
|
|
3530
|
+
|
|
3531
|
+
CrispClient.plan.changeBillPeriodForWebsitePlanSubscription(websiteID, period);
|
|
3532
|
+
```
|
|
3533
|
+
</details>
|
|
3534
|
+
|
|
3535
|
+
* **Check Coupon Availability For Website Plan Subscription** [`user`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#check-coupon-availability-for-website-plan-subscription)
|
|
3536
|
+
* `CrispClient.plan.checkCouponAvailabilityForWebsitePlanSubscription(websiteID, code)`
|
|
3537
|
+
* <details>
|
|
3538
|
+
<summary>See Example</summary>
|
|
3539
|
+
|
|
3540
|
+
```javascript
|
|
3541
|
+
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
|
|
3542
|
+
var code = "CRISP+AWESOME";
|
|
3543
|
+
|
|
3544
|
+
CrispClient.plan.checkCouponAvailabilityForWebsitePlanSubscription(websiteID, code);
|
|
3545
|
+
```
|
|
3546
|
+
</details>
|
|
3547
|
+
|
|
3548
|
+
* **Redeem Coupon For Website Plan Subscription** [`user`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#redeem-coupon-for-website-plan-subscription)
|
|
3549
|
+
* `CrispClient.plan.redeemCouponForWebsitePlanSubscription(websiteID, code)`
|
|
3550
|
+
* <details>
|
|
3551
|
+
<summary>See Example</summary>
|
|
3552
|
+
|
|
3553
|
+
```javascript
|
|
3554
|
+
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
|
|
3555
|
+
var code = "CRISP+AWESOME";
|
|
3556
|
+
|
|
3557
|
+
CrispClient.plan.redeemCouponForWebsitePlanSubscription(websiteID, code);
|
|
3558
|
+
```
|
|
3559
|
+
</details>
|
|
3560
|
+
|
|
3561
|
+
|
|
3462
3562
|
### Media
|
|
3463
3563
|
|
|
3464
3564
|
* #### **Media Animation**
|
package/dist/crisp.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Emitter } from "mitt";
|
|
|
3
3
|
import { BucketServiceInterface } from "./services/bucket";
|
|
4
4
|
import { MediaServiceInterface } from "./services/media";
|
|
5
5
|
import { PluginServiceInterface } from "./services/plugin";
|
|
6
|
+
import { PlanServiceInterface } from "./services/plan";
|
|
6
7
|
import { WebsiteServiceInterface } from "./services/website";
|
|
7
8
|
/**************************************************************************
|
|
8
9
|
* TYPES
|
|
@@ -28,6 +29,7 @@ declare class Crisp {
|
|
|
28
29
|
bucket: BucketServiceInterface;
|
|
29
30
|
media: MediaServiceInterface;
|
|
30
31
|
plugin: PluginServiceInterface;
|
|
32
|
+
plan: PlanServiceInterface;
|
|
31
33
|
website: WebsiteServiceInterface;
|
|
32
34
|
/**
|
|
33
35
|
* @deprecated Use import { RTM_MODES } instead
|
package/dist/crisp.js
CHANGED
|
@@ -37,6 +37,7 @@ const mitt_1 = __importDefault(require("mitt"));
|
|
|
37
37
|
const bucket_1 = __importDefault(require("./services/bucket"));
|
|
38
38
|
const media_1 = __importDefault(require("./services/media"));
|
|
39
39
|
const plugin_1 = __importDefault(require("./services/plugin"));
|
|
40
|
+
const plan_1 = __importDefault(require("./services/plan"));
|
|
40
41
|
const website_1 = __importDefault(require("./services/website"));
|
|
41
42
|
/**************************************************************************
|
|
42
43
|
* CONSTANTS
|
|
@@ -45,7 +46,7 @@ const AVAILABLE_RTM_MODES = [
|
|
|
45
46
|
"websockets",
|
|
46
47
|
"webhooks"
|
|
47
48
|
];
|
|
48
|
-
const VERSION = "10.
|
|
49
|
+
const VERSION = "10.4.0";
|
|
49
50
|
// Base configuration
|
|
50
51
|
const DEFAULT_REQUEST_TIMEOUT = 10000;
|
|
51
52
|
const DEFAULT_SOCKET_TIMEOUT = 10000;
|
|
@@ -161,6 +162,7 @@ const services = {
|
|
|
161
162
|
Bucket: bucket_1.default,
|
|
162
163
|
Media: media_1.default,
|
|
163
164
|
Plugin: plugin_1.default,
|
|
165
|
+
Plan: plan_1.default,
|
|
164
166
|
Website: website_1.default
|
|
165
167
|
};
|
|
166
168
|
/**************************************************************************
|
|
@@ -177,6 +179,7 @@ class Crisp {
|
|
|
177
179
|
this.bucket = new bucket_1.default();
|
|
178
180
|
this.media = new media_1.default();
|
|
179
181
|
this.plugin = new plugin_1.default();
|
|
182
|
+
this.plan = new plan_1.default();
|
|
180
183
|
this.website = new website_1.default();
|
|
181
184
|
this.auth = {
|
|
182
185
|
tier: "user",
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**************************************************************************
|
|
2
|
+
* IMPORTS
|
|
3
|
+
***************************************************************************/
|
|
4
|
+
import BaseResource from "./BaseResource";
|
|
5
|
+
/**************************************************************************
|
|
6
|
+
* TYPES
|
|
7
|
+
***************************************************************************/
|
|
8
|
+
export type PlanSubscription = {
|
|
9
|
+
id?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
price?: number;
|
|
12
|
+
since?: string;
|
|
13
|
+
trialing?: boolean;
|
|
14
|
+
trial_end?: string;
|
|
15
|
+
trial_end_date?: string;
|
|
16
|
+
bill_period?: PlanSubscriptionBillPeriod;
|
|
17
|
+
bill_valid_until?: string;
|
|
18
|
+
active?: boolean;
|
|
19
|
+
sandbox?: boolean;
|
|
20
|
+
website?: PlanSubscriptionWebsite;
|
|
21
|
+
coupon_redeemed?: boolean;
|
|
22
|
+
card_id?: string;
|
|
23
|
+
owner?: PlanSubscriptionOwner;
|
|
24
|
+
};
|
|
25
|
+
export type PlanSubscriptionBillPeriod = "monthly" | "yearly";
|
|
26
|
+
export type PlanSubscriptionWebsite = {
|
|
27
|
+
id?: string;
|
|
28
|
+
name?: string;
|
|
29
|
+
domain?: string;
|
|
30
|
+
logo?: string;
|
|
31
|
+
};
|
|
32
|
+
export type PlanSubscriptionOwner = {
|
|
33
|
+
user_id?: string;
|
|
34
|
+
email?: string;
|
|
35
|
+
first_name?: string;
|
|
36
|
+
last_name?: string;
|
|
37
|
+
};
|
|
38
|
+
export type PlanSubscriptionCoupon = {
|
|
39
|
+
code?: string;
|
|
40
|
+
policy?: PlanSubscriptionCouponPolicy;
|
|
41
|
+
redeem_limit?: number;
|
|
42
|
+
expire_at?: string;
|
|
43
|
+
};
|
|
44
|
+
export type PlanSubscriptionCouponPolicy = {
|
|
45
|
+
rebate_percent?: number;
|
|
46
|
+
trial_days?: number;
|
|
47
|
+
};
|
|
48
|
+
/**************************************************************************
|
|
49
|
+
* CLASSES
|
|
50
|
+
***************************************************************************/
|
|
51
|
+
/**
|
|
52
|
+
* Crisp PlanSubscription Resource
|
|
53
|
+
*/
|
|
54
|
+
declare class PlanSubscriptionService extends BaseResource {
|
|
55
|
+
/**
|
|
56
|
+
* List All Active Plan Subscriptions
|
|
57
|
+
*/
|
|
58
|
+
listAllActiveSubscriptions(): Promise<PlanSubscription[]>;
|
|
59
|
+
/**
|
|
60
|
+
* Get Plan Subscription For A Website
|
|
61
|
+
*/
|
|
62
|
+
getPlanSubscriptionForWebsite(websiteID: string): Promise<PlanSubscription>;
|
|
63
|
+
/**
|
|
64
|
+
* Subscribe Website To Plan
|
|
65
|
+
*/
|
|
66
|
+
subscribeWebsiteToPlan(websiteID: string, planID: string): Promise<any>;
|
|
67
|
+
/**
|
|
68
|
+
* Unsubscribe Plan From Website
|
|
69
|
+
*/
|
|
70
|
+
unsubscribePlanFromWebsite(websiteID: string): Promise<any>;
|
|
71
|
+
/**
|
|
72
|
+
* Change Bill Period For Website Plan Subscription
|
|
73
|
+
*/
|
|
74
|
+
changeBillPeriodForWebsitePlanSubscription(websiteID: string, period: PlanSubscriptionBillPeriod): Promise<any>;
|
|
75
|
+
/**
|
|
76
|
+
* Check Coupon Availability For Website Plan Subscription
|
|
77
|
+
*/
|
|
78
|
+
checkCouponAvailabilityForWebsitePlanSubscription(websiteID: string, code: string): Promise<PlanSubscriptionCoupon>;
|
|
79
|
+
/**
|
|
80
|
+
* Redeem Coupon For Website Plan Subscription
|
|
81
|
+
*/
|
|
82
|
+
redeemCouponForWebsitePlanSubscription(websiteID: string, code: string): Promise<any>;
|
|
83
|
+
}
|
|
84
|
+
/**************************************************************************
|
|
85
|
+
* EXPORTS
|
|
86
|
+
***************************************************************************/
|
|
87
|
+
export default PlanSubscriptionService;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This file is part of node-crisp-api
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2026 Crisp IM SAS
|
|
6
|
+
* All rights belong to Crisp IM SAS
|
|
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
|
+
* CLASSES
|
|
19
|
+
***************************************************************************/
|
|
20
|
+
/**
|
|
21
|
+
* Crisp PlanSubscription Resource
|
|
22
|
+
*/
|
|
23
|
+
class PlanSubscriptionService extends BaseResource_1.default {
|
|
24
|
+
/**
|
|
25
|
+
* List All Active Plan Subscriptions
|
|
26
|
+
*/
|
|
27
|
+
listAllActiveSubscriptions() {
|
|
28
|
+
return this.crisp.get(this.crisp.prepareRestUrl(["plans", "subscription"]));
|
|
29
|
+
}
|
|
30
|
+
;
|
|
31
|
+
/**
|
|
32
|
+
* Get Plan Subscription For A Website
|
|
33
|
+
*/
|
|
34
|
+
getPlanSubscriptionForWebsite(websiteID) {
|
|
35
|
+
return this.crisp.get(this.crisp.prepareRestUrl(["plans", "subscription", websiteID]));
|
|
36
|
+
}
|
|
37
|
+
;
|
|
38
|
+
/**
|
|
39
|
+
* Subscribe Website To Plan
|
|
40
|
+
*/
|
|
41
|
+
subscribeWebsiteToPlan(websiteID, planID) {
|
|
42
|
+
return this.crisp.post(this.crisp.prepareRestUrl(["plans", "subscription", websiteID]), null, {
|
|
43
|
+
plan_id: planID
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
;
|
|
47
|
+
/**
|
|
48
|
+
* Unsubscribe Plan From Website
|
|
49
|
+
*/
|
|
50
|
+
unsubscribePlanFromWebsite(websiteID) {
|
|
51
|
+
return this.crisp.delete(this.crisp.prepareRestUrl(["plans", "subscription", websiteID]));
|
|
52
|
+
}
|
|
53
|
+
;
|
|
54
|
+
/**
|
|
55
|
+
* Change Bill Period For Website Plan Subscription
|
|
56
|
+
*/
|
|
57
|
+
changeBillPeriodForWebsitePlanSubscription(websiteID, period) {
|
|
58
|
+
return this.crisp.patch(this.crisp.prepareRestUrl([
|
|
59
|
+
"plans", "subscription", websiteID, "bill", "period"
|
|
60
|
+
]), null, {
|
|
61
|
+
period
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
;
|
|
65
|
+
/**
|
|
66
|
+
* Check Coupon Availability For Website Plan Subscription
|
|
67
|
+
*/
|
|
68
|
+
checkCouponAvailabilityForWebsitePlanSubscription(websiteID, code) {
|
|
69
|
+
return this.crisp.get(this.crisp.prepareRestUrl(["plans", "subscription", websiteID, "coupon"]), {
|
|
70
|
+
code
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
;
|
|
74
|
+
/**
|
|
75
|
+
* Redeem Coupon For Website Plan Subscription
|
|
76
|
+
*/
|
|
77
|
+
redeemCouponForWebsitePlanSubscription(websiteID, code) {
|
|
78
|
+
return this.crisp.patch(this.crisp.prepareRestUrl(["plans", "subscription", websiteID, "coupon"]), null, {
|
|
79
|
+
code
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
;
|
|
83
|
+
}
|
|
84
|
+
/**************************************************************************
|
|
85
|
+
* EXPORTS
|
|
86
|
+
***************************************************************************/
|
|
87
|
+
exports.default = PlanSubscriptionService;
|
|
@@ -47,11 +47,11 @@ declare class PluginConnect extends BaseResource {
|
|
|
47
47
|
/**
|
|
48
48
|
* List All Connect Websites
|
|
49
49
|
*/
|
|
50
|
-
listAllConnectWebsites(pageNumber: number, filterConfigured: boolean): Promise<PluginConnectAllWebsite[]>;
|
|
50
|
+
listAllConnectWebsites(pageNumber: number, filterConfigured: boolean, includePlan: boolean): Promise<PluginConnectAllWebsite[]>;
|
|
51
51
|
/**
|
|
52
52
|
* List Connect Websites Since
|
|
53
53
|
*/
|
|
54
|
-
listConnectWebsitesSince(dateSince: string, filterConfigured: boolean): Promise<PluginConnectWebsitesSince[]>;
|
|
54
|
+
listConnectWebsitesSince(dateSince: string, filterConfigured: boolean, includePlan: boolean): Promise<PluginConnectWebsitesSince[]>;
|
|
55
55
|
/**
|
|
56
56
|
* Get Connect Endpoints
|
|
57
57
|
*/
|
|
@@ -38,10 +38,11 @@ class PluginConnect extends BaseResource_1.default {
|
|
|
38
38
|
/**
|
|
39
39
|
* List All Connect Websites
|
|
40
40
|
*/
|
|
41
|
-
listAllConnectWebsites(pageNumber, filterConfigured) {
|
|
41
|
+
listAllConnectWebsites(pageNumber, filterConfigured, includePlan) {
|
|
42
42
|
// Generate query
|
|
43
43
|
let query = {
|
|
44
|
-
filter_configured: ((filterConfigured === true) ? "1" : "0")
|
|
44
|
+
filter_configured: ((filterConfigured === true) ? "1" : "0"),
|
|
45
|
+
include_plan: ((includePlan === true) ? "1" : "0")
|
|
45
46
|
};
|
|
46
47
|
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
47
48
|
"plugin", "connect", "websites", "all", String(pageNumber)
|
|
@@ -51,10 +52,11 @@ class PluginConnect extends BaseResource_1.default {
|
|
|
51
52
|
/**
|
|
52
53
|
* List Connect Websites Since
|
|
53
54
|
*/
|
|
54
|
-
listConnectWebsitesSince(dateSince, filterConfigured) {
|
|
55
|
+
listConnectWebsitesSince(dateSince, filterConfigured, includePlan) {
|
|
55
56
|
// Generate query
|
|
56
57
|
let query = {
|
|
57
|
-
filter_configured: ((filterConfigured === true) ? "1" : "0")
|
|
58
|
+
filter_configured: ((filterConfigured === true) ? "1" : "0"),
|
|
59
|
+
include_plan: ((includePlan === true) ? "1" : "0")
|
|
58
60
|
};
|
|
59
61
|
if (dateSince) {
|
|
60
62
|
// @ts-ignore
|
|
@@ -64,9 +64,11 @@ export interface WebsiteSettingsChatbox {
|
|
|
64
64
|
overlay_mode?: boolean;
|
|
65
65
|
helpdesk_link?: boolean;
|
|
66
66
|
helpdesk_only?: boolean;
|
|
67
|
+
helpdesk_navigate?: string;
|
|
67
68
|
status_health_dead?: boolean;
|
|
68
69
|
check_domain?: boolean;
|
|
69
70
|
color_theme?: string;
|
|
71
|
+
color_mode?: string;
|
|
70
72
|
layout_theme?: string;
|
|
71
73
|
text_theme?: string;
|
|
72
74
|
welcome_message?: string;
|
|
@@ -135,9 +137,11 @@ export interface WebsiteSettingsUpdateChatbox {
|
|
|
135
137
|
overlay_mode?: boolean;
|
|
136
138
|
helpdesk_link?: boolean;
|
|
137
139
|
helpdesk_only?: boolean;
|
|
140
|
+
helpdesk_navigate?: string;
|
|
138
141
|
status_health_dead?: boolean;
|
|
139
142
|
check_domain?: boolean;
|
|
140
143
|
color_theme?: string;
|
|
144
|
+
color_mode?: string;
|
|
141
145
|
layout_theme?: string;
|
|
142
146
|
text_theme?: string;
|
|
143
147
|
welcome_message?: string;
|
|
@@ -6,6 +6,7 @@ export * from "./BucketURL";
|
|
|
6
6
|
export * from "./MediaAnimation";
|
|
7
7
|
export * from "./PluginConnect";
|
|
8
8
|
export * from "./PluginSubscription";
|
|
9
|
+
export * from "./PlanSubscription";
|
|
9
10
|
export * from "./WebsiteAnalytics";
|
|
10
11
|
export * from "./WebsiteAvailability";
|
|
11
12
|
export * from "./WebsiteBase";
|
package/dist/resources/index.js
CHANGED
|
@@ -28,6 +28,7 @@ __exportStar(require("./BucketURL"), exports);
|
|
|
28
28
|
__exportStar(require("./MediaAnimation"), exports);
|
|
29
29
|
__exportStar(require("./PluginConnect"), exports);
|
|
30
30
|
__exportStar(require("./PluginSubscription"), exports);
|
|
31
|
+
__exportStar(require("./PlanSubscription"), exports);
|
|
31
32
|
__exportStar(require("./WebsiteAnalytics"), exports);
|
|
32
33
|
__exportStar(require("./WebsiteAvailability"), exports);
|
|
33
34
|
__exportStar(require("./WebsiteBase"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**************************************************************************
|
|
2
|
+
* IMPORTS
|
|
3
|
+
***************************************************************************/
|
|
4
|
+
import PlanSubscription from "../resources/PlanSubscription";
|
|
5
|
+
/**************************************************************************
|
|
6
|
+
* CLASSES
|
|
7
|
+
***************************************************************************/
|
|
8
|
+
/**
|
|
9
|
+
* Crisp Plan Service
|
|
10
|
+
*/
|
|
11
|
+
declare class PlanService {
|
|
12
|
+
__resources: any[];
|
|
13
|
+
}
|
|
14
|
+
/**************************************************************************
|
|
15
|
+
* EXPORTS
|
|
16
|
+
***************************************************************************/
|
|
17
|
+
export interface PlanServiceInterface extends PlanSubscription {
|
|
18
|
+
}
|
|
19
|
+
export default PlanService;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This file is part of node-crisp-api
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2026 Crisp IM SAS
|
|
6
|
+
* All rights belong to Crisp IM SAS
|
|
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 PlanSubscription_1 = __importDefault(require("../resources/PlanSubscription"));
|
|
17
|
+
/**************************************************************************
|
|
18
|
+
* CLASSES
|
|
19
|
+
***************************************************************************/
|
|
20
|
+
/**
|
|
21
|
+
* Crisp Plan Service
|
|
22
|
+
*/
|
|
23
|
+
class PlanService {
|
|
24
|
+
constructor() {
|
|
25
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
26
|
+
this.__resources = [
|
|
27
|
+
PlanSubscription_1.default
|
|
28
|
+
];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.default = PlanService;
|
package/lib/crisp.ts
CHANGED
|
@@ -22,6 +22,7 @@ import mitt, { Emitter } from "mitt";
|
|
|
22
22
|
import Bucket, { BucketServiceInterface } from "@/services/bucket";
|
|
23
23
|
import Media, { MediaServiceInterface } from "@/services/media";
|
|
24
24
|
import Plugin, { PluginServiceInterface } from "@/services/plugin";
|
|
25
|
+
import Plan, { PlanServiceInterface } from "@/services/plan";
|
|
25
26
|
import Website, { WebsiteServiceInterface } from "@/services/website";
|
|
26
27
|
|
|
27
28
|
/**************************************************************************
|
|
@@ -175,6 +176,7 @@ const services = {
|
|
|
175
176
|
Bucket: Bucket,
|
|
176
177
|
Media: Media,
|
|
177
178
|
Plugin: Plugin,
|
|
179
|
+
Plan: Plan,
|
|
178
180
|
Website: Website
|
|
179
181
|
};
|
|
180
182
|
|
|
@@ -209,6 +211,10 @@ class Crisp {
|
|
|
209
211
|
new Plugin() as unknown as PluginServiceInterface
|
|
210
212
|
);
|
|
211
213
|
|
|
214
|
+
public plan: PlanServiceInterface = (
|
|
215
|
+
new Plan() as unknown as PlanServiceInterface
|
|
216
|
+
);
|
|
217
|
+
|
|
212
218
|
public website: WebsiteServiceInterface = (
|
|
213
219
|
new Website() as unknown as WebsiteServiceInterface
|
|
214
220
|
);
|