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.
@@ -0,0 +1,171 @@
1
+ /*
2
+ * This file is part of node-crisp-api
3
+ *
4
+ * Copyright (c) 2026 Crisp IM SAS
5
+ * All rights belong to Crisp IM SAS
6
+ */
7
+
8
+ /**************************************************************************
9
+ * IMPORTS
10
+ ***************************************************************************/
11
+
12
+ // PROJECT: RESOURCES
13
+ import BaseResource from "./BaseResource";
14
+
15
+ /**************************************************************************
16
+ * TYPES
17
+ ***************************************************************************/
18
+
19
+ export type PlanSubscription = {
20
+ id?: string;
21
+ name?: string;
22
+ price?: number;
23
+ since?: string;
24
+ trialing?: boolean;
25
+ trial_end?: string;
26
+ trial_end_date?: string;
27
+ bill_period?: PlanSubscriptionBillPeriod;
28
+ bill_valid_until?: string;
29
+ active?: boolean;
30
+ sandbox?: boolean;
31
+ website?: PlanSubscriptionWebsite;
32
+ coupon_redeemed?: boolean;
33
+ card_id?: string;
34
+ owner?: PlanSubscriptionOwner;
35
+ }
36
+
37
+ export type PlanSubscriptionBillPeriod = "monthly" | "yearly";
38
+
39
+ export type PlanSubscriptionWebsite = {
40
+ id?: string;
41
+ name?: string;
42
+ domain?: string;
43
+ logo?: string;
44
+ }
45
+
46
+ export type PlanSubscriptionOwner = {
47
+ user_id?: string;
48
+ email?: string;
49
+ first_name?: string;
50
+ last_name?: string;
51
+ }
52
+
53
+ export type PlanSubscriptionCoupon = {
54
+ code?: string;
55
+ policy?: PlanSubscriptionCouponPolicy;
56
+ redeem_limit?: number;
57
+ expire_at?: string;
58
+ }
59
+
60
+ export type PlanSubscriptionCouponPolicy = {
61
+ rebate_percent?: number;
62
+ trial_days?: number;
63
+ }
64
+
65
+ /**************************************************************************
66
+ * CLASSES
67
+ ***************************************************************************/
68
+
69
+ /**
70
+ * Crisp PlanSubscription Resource
71
+ */
72
+ class PlanSubscriptionService extends BaseResource {
73
+ /**
74
+ * List All Active Plan Subscriptions
75
+ */
76
+ listAllActiveSubscriptions(): Promise<PlanSubscription[]> {
77
+ return this.crisp.get(
78
+ this.crisp.prepareRestUrl(["plans", "subscription"])
79
+ );
80
+ };
81
+
82
+ /**
83
+ * Get Plan Subscription For A Website
84
+ */
85
+ getPlanSubscriptionForWebsite(websiteID: string): Promise<PlanSubscription> {
86
+ return this.crisp.get(
87
+ this.crisp.prepareRestUrl(["plans", "subscription", websiteID])
88
+ );
89
+ };
90
+
91
+ /**
92
+ * Subscribe Website To Plan
93
+ */
94
+ subscribeWebsiteToPlan(websiteID: string, planID: string) {
95
+ return this.crisp.post(
96
+ this.crisp.prepareRestUrl(["plans", "subscription", websiteID]),
97
+
98
+ null,
99
+
100
+ {
101
+ plan_id: planID
102
+ }
103
+ );
104
+ };
105
+
106
+ /**
107
+ * Unsubscribe Plan From Website
108
+ */
109
+ unsubscribePlanFromWebsite(websiteID: string) {
110
+ return this.crisp.delete(
111
+ this.crisp.prepareRestUrl(["plans", "subscription", websiteID])
112
+ );
113
+ };
114
+
115
+ /**
116
+ * Change Bill Period For Website Plan Subscription
117
+ */
118
+ changeBillPeriodForWebsitePlanSubscription(
119
+ websiteID: string,
120
+ period: PlanSubscriptionBillPeriod
121
+ ) {
122
+ return this.crisp.patch(
123
+ this.crisp.prepareRestUrl([
124
+ "plans", "subscription", websiteID, "bill", "period"
125
+ ]),
126
+
127
+ null,
128
+
129
+ {
130
+ period
131
+ }
132
+ );
133
+ };
134
+
135
+ /**
136
+ * Check Coupon Availability For Website Plan Subscription
137
+ */
138
+ checkCouponAvailabilityForWebsitePlanSubscription(
139
+ websiteID: string,
140
+ code: string
141
+ ): Promise<PlanSubscriptionCoupon> {
142
+ return this.crisp.get(
143
+ this.crisp.prepareRestUrl(["plans", "subscription", websiteID, "coupon"]),
144
+
145
+ {
146
+ code
147
+ }
148
+ );
149
+ };
150
+
151
+ /**
152
+ * Redeem Coupon For Website Plan Subscription
153
+ */
154
+ redeemCouponForWebsitePlanSubscription(websiteID: string, code: string) {
155
+ return this.crisp.patch(
156
+ this.crisp.prepareRestUrl(["plans", "subscription", websiteID, "coupon"]),
157
+
158
+ null,
159
+
160
+ {
161
+ code
162
+ }
163
+ );
164
+ };
165
+ }
166
+
167
+ /**************************************************************************
168
+ * EXPORTS
169
+ ***************************************************************************/
170
+
171
+ export default PlanSubscriptionService;
@@ -78,12 +78,16 @@ class PluginConnect extends BaseResource {
78
78
  * List All Connect Websites
79
79
  */
80
80
  listAllConnectWebsites(
81
- pageNumber: number, filterConfigured: boolean
81
+ pageNumber: number, filterConfigured: boolean, includePlan: boolean
82
82
  ): Promise<PluginConnectAllWebsite[]> {
83
83
  // Generate query
84
84
  let query = {
85
85
  filter_configured: (
86
86
  (filterConfigured === true) ? "1" : "0"
87
+ ),
88
+
89
+ include_plan: (
90
+ (includePlan === true) ? "1" : "0"
87
91
  )
88
92
  };
89
93
 
@@ -100,12 +104,16 @@ class PluginConnect extends BaseResource {
100
104
  * List Connect Websites Since
101
105
  */
102
106
  listConnectWebsitesSince(
103
- dateSince: string, filterConfigured: boolean
107
+ dateSince: string, filterConfigured: boolean, includePlan: boolean
104
108
  ): Promise<PluginConnectWebsitesSince[]> {
105
109
  // Generate query
106
110
  let query = {
107
111
  filter_configured: (
108
112
  (filterConfigured === true) ? "1" : "0"
113
+ ),
114
+
115
+ include_plan: (
116
+ (includePlan === true) ? "1" : "0"
109
117
  )
110
118
  };
111
119
 
@@ -17,53 +17,53 @@ import BaseResource from "./BaseResource";
17
17
  ***************************************************************************/
18
18
 
19
19
  export type PluginSubscription = {
20
- id?: string;
21
- urn?: string;
22
- type?: string;
23
- category?: string;
24
- name?: string;
25
- summary?: string;
26
- price?: number;
27
- plans?: PluginSubscriptionPlan[];
28
- icon?: string;
29
- website_url?: string;
30
- contact_url?: string;
31
- terms_url?: string;
32
- privacy_url?: string;
33
- help_url?: string;
34
- video_url?: string;
35
- configurable?: boolean;
36
- since?: string;
37
- active?: boolean;
38
- website_id?: string;
39
- card_id?: string;
20
+ id?: string;
21
+ urn?: string;
22
+ type?: string;
23
+ category?: string;
24
+ name?: string;
25
+ summary?: string;
26
+ price?: number;
27
+ plans?: PluginSubscriptionPlan[];
28
+ icon?: string;
29
+ website_url?: string;
30
+ contact_url?: string;
31
+ terms_url?: string;
32
+ privacy_url?: string;
33
+ help_url?: string;
34
+ video_url?: string;
35
+ configurable?: boolean;
36
+ since?: string;
37
+ active?: boolean;
38
+ website_id?: string;
39
+ card_id?: string;
40
40
  }
41
41
 
42
42
  export type PluginSubscriptionPlan = {
43
- id?: string;
44
- name?: string;
45
- price?: number;
43
+ id?: string;
44
+ name?: string;
45
+ price?: number;
46
46
  }
47
47
 
48
48
  export type PluginSubscriptionSettings = {
49
- plugin_id?: string;
50
- website_id?: string;
51
- token?: string;
52
- schema?: object;
53
- settings?: object;
49
+ plugin_id?: string;
50
+ website_id?: string;
51
+ token?: string;
52
+ schema?: object;
53
+ settings?: object;
54
54
  settings_form_url?: string;
55
- callback_url?: string;
55
+ callback_url?: string;
56
56
  }
57
57
 
58
58
  export type PluginSubscriptionChannelForward = {
59
- namespace?: string;
60
- identifier?: string;
61
- payload?: object;
59
+ namespace?: string;
60
+ identifier?: string;
61
+ payload?: object;
62
62
  }
63
63
 
64
64
  export type PluginSubscriptionEventDispatch = {
65
- name?: string;
66
- data?: object;
65
+ name?: string;
66
+ data?: object;
67
67
  }
68
68
 
69
69
  /**************************************************************************
@@ -17,18 +17,18 @@ import BaseResource from "./BaseResource";
17
17
  ***************************************************************************/
18
18
 
19
19
  export type WebsiteAvailabilityStatus = {
20
- status?: string;
21
- since?: number;
20
+ status?: string;
21
+ since?: number;
22
22
  }
23
23
 
24
24
  export type WebsiteAvailabilityOperator = {
25
- user_id?: string;
26
- type?: string;
27
- time?: WebsiteAvailabilityOperatorTime;
25
+ user_id?: string;
26
+ type?: string;
27
+ time?: WebsiteAvailabilityOperatorTime;
28
28
  }
29
29
 
30
30
  export type WebsiteAvailabilityOperatorTime = {
31
- for?: number;
31
+ for?: number;
32
32
  since?: number;
33
33
  }
34
34
 
@@ -17,27 +17,27 @@ import BaseResource from "./BaseResource";
17
17
  ***************************************************************************/
18
18
 
19
19
  export type Website = {
20
- website_id?: string;
21
- name?: string;
22
- domain?: string;
23
- logo?: string;
20
+ website_id?: string;
21
+ name?: string;
22
+ domain?: string;
23
+ logo?: string;
24
24
  }
25
25
 
26
26
  export type WebsiteCreate = {
27
- name?: string;
28
- domain?: string;
27
+ name?: string;
28
+ domain?: string;
29
29
  }
30
30
 
31
31
  export type WebsiteRemoveVerify = {
32
- method?: string;
33
- secret?: string;
32
+ method?: string;
33
+ secret?: string;
34
34
  }
35
35
 
36
36
  export type WebsiteFilter = {
37
- model?: string;
38
- criterion?: string;
39
- operator?: string;
40
- query?: Record<string, unknown>;
37
+ model?: string;
38
+ criterion?: string;
39
+ operator?: string;
40
+ query?: Record<string, unknown>;
41
41
  }
42
42
 
43
43
  /**************************************************************************
@@ -17,13 +17,13 @@ import BaseResource from "./BaseResource";
17
17
  ***************************************************************************/
18
18
 
19
19
  export type WebsiteBatchConversationsOperation = {
20
- inbox_id?: string;
21
- sessions?: string[];
20
+ inbox_id?: string;
21
+ sessions?: string[];
22
22
  }
23
23
 
24
24
  export type WebsiteBatchPeopleOperationInner = {
25
- profiles?: string[];
26
- search?: string;
25
+ profiles?: string[];
26
+ search?: string;
27
27
  }
28
28
 
29
29
  /**************************************************************************
@@ -18,122 +18,122 @@ import { WebsiteFilter } from "./WebsiteBase";
18
18
  ***************************************************************************/
19
19
 
20
20
  export type WebsiteCampaignExcerpt = {
21
- campaign_id?: string;
22
- type?: string;
23
- format?: string;
24
- name?: string;
25
- subject?: string;
26
- tag?: string;
27
- ready?: boolean;
28
- dispatched?: boolean;
29
- running?: boolean;
30
- progress?: number;
31
- targets?: number;
32
- reached?: number;
33
- created_at: number;
34
- updated_at: number;
21
+ campaign_id?: string;
22
+ type?: string;
23
+ format?: string;
24
+ name?: string;
25
+ subject?: string;
26
+ tag?: string;
27
+ ready?: boolean;
28
+ dispatched?: boolean;
29
+ running?: boolean;
30
+ progress?: number;
31
+ targets?: number;
32
+ reached?: number;
33
+ created_at: number;
34
+ updated_at: number;
35
35
  dispatched_at?: number;
36
36
  }
37
37
 
38
38
  export type WebsiteCampaignTemplateExcerpt = {
39
- template_id?: string;
40
- type?: string;
41
- name?: string;
42
- format?: string;
43
- created_at?: number;
44
- updated_at?: number;
39
+ template_id?: string;
40
+ type?: string;
41
+ name?: string;
42
+ format?: string;
43
+ created_at?: number;
44
+ updated_at?: number;
45
45
  }
46
46
 
47
47
  export type WebsiteCampaignTemplateNew = {
48
- template_id?: string;
48
+ template_id?: string;
49
49
  }
50
50
 
51
51
  export interface WebsiteCampaignTemplateItem extends WebsiteCampaignTemplateExcerpt {
52
- content?: string;
52
+ content?: string;
53
53
  }
54
54
 
55
55
  export interface WebsiteCampaignItem extends WebsiteCampaignExcerpt {
56
- sender?: WebsiteCampaignItemSender;
57
- recipients?: WebsiteCampaignItemRecipients;
58
- flow?: WebsiteCampaignItemFlow;
59
- message?: string;
60
- options?: WebsiteCampaignItemOptions;
61
- statistics?: WebsiteCampaignItemStatistics;
56
+ sender?: WebsiteCampaignItemSender;
57
+ recipients?: WebsiteCampaignItemRecipients;
58
+ flow?: WebsiteCampaignItemFlow;
59
+ message?: string;
60
+ options?: WebsiteCampaignItemOptions;
61
+ statistics?: WebsiteCampaignItemStatistics;
62
62
  }
63
63
 
64
64
  export type WebsiteCampaignItemSender = {
65
- user_id?: string;
65
+ user_id?: string;
66
66
  }
67
67
 
68
68
  export type WebsiteCampaignItemRecipients = {
69
- type?: string;
70
- segments?: string[];
71
- people?: string[];
72
- filter?: WebsiteFilter[];
69
+ type?: string;
70
+ segments?: string[];
71
+ people?: string[];
72
+ filter?: WebsiteFilter[];
73
73
  }
74
74
 
75
75
  export type WebsiteCampaignItemFlow = {
76
- launch_event?: string;
77
- assert_filter?: WebsiteFilter[];
78
- assert_delay?: number;
79
- deliver_once?: boolean;
80
- deliver_delay?: number;
76
+ launch_event?: string;
77
+ assert_filter?: WebsiteFilter[];
78
+ assert_delay?: number;
79
+ deliver_once?: boolean;
80
+ deliver_delay?: number;
81
81
  }
82
82
 
83
83
  export type WebsiteCampaignItemOptions = {
84
- deliver_to_chatbox?: boolean;
85
- deliver_to_email?: boolean;
86
- sender_name_website?: boolean;
87
- sender_email_reply?: boolean;
88
- tracking?: boolean;
84
+ deliver_to_chatbox?: boolean;
85
+ deliver_to_email?: boolean;
86
+ sender_name_website?: boolean;
87
+ sender_email_reply?: boolean;
88
+ tracking?: boolean;
89
89
  }
90
90
 
91
91
  export type WebsiteCampaignItemStatistics = {
92
- opened?: number;
93
- clicked?: number;
94
- unsubscribed?: number;
92
+ opened?: number;
93
+ clicked?: number;
94
+ unsubscribed?: number;
95
95
  }
96
96
 
97
97
  export type WebsiteCampaignRecipient = {
98
- people_id?: string;
99
- email?: string;
100
- person?: WebsiteCampaignRecipientPerson;
101
- subscribed?: boolean;
98
+ people_id?: string;
99
+ email?: string;
100
+ person?: WebsiteCampaignRecipientPerson;
101
+ subscribed?: boolean;
102
102
  }
103
103
 
104
104
  export type WebsiteCampaignRecipientPerson = {
105
- nickname?: string;
106
- avatar?: string;
105
+ nickname?: string;
106
+ avatar?: string;
107
107
  }
108
108
 
109
109
  export type WebsiteCampaignStatistic = {
110
- profile?: WebsiteCampaignStatisticProfile;
111
- data?: Record<string, unknown>;
112
- created_at?: number;
113
- updated_at?: number;
110
+ profile?: WebsiteCampaignStatisticProfile;
111
+ data?: Record<string, unknown>;
112
+ created_at?: number;
113
+ updated_at?: number;
114
114
  }
115
115
 
116
116
  export type WebsiteCampaignStatisticProfile = {
117
- people_id?: string;
118
- email?: string;
119
- person?: WebsiteCampaignStatisticProfilePerson;
117
+ people_id?: string;
118
+ email?: string;
119
+ person?: WebsiteCampaignStatisticProfilePerson;
120
120
  }
121
121
 
122
122
  export type WebsiteCampaignStatisticProfilePerson = {
123
- nickname?: string;
124
- avatar?: string;
125
- geolocation?: WebsiteCampaignStatisticProfilePersonGeolocation;
123
+ nickname?: string;
124
+ avatar?: string;
125
+ geolocation?: WebsiteCampaignStatisticProfilePersonGeolocation;
126
126
  }
127
127
 
128
128
  export type WebsiteCampaignStatisticProfilePersonGeolocation = {
129
- country?: string;
130
- region?: string;
131
- city?: string;
132
- coordinates?: WebsiteCampaignStatisticProfilePersonGeolocationCoordinates;
129
+ country?: string;
130
+ region?: string;
131
+ city?: string;
132
+ coordinates?: WebsiteCampaignStatisticProfilePersonGeolocationCoordinates;
133
133
  }
134
134
 
135
135
  export type WebsiteCampaignStatisticProfilePersonGeolocationCoordinates = {
136
- latitude?: number;
136
+ latitude?: number;
137
137
  longitude?: number;
138
138
  }
139
139
 
@@ -398,21 +398,21 @@ export interface ConversationComposeMessageNew {
398
398
  }
399
399
 
400
400
  export interface ConversationSuggestedSegment {
401
- segment?: string;
402
- count?: number;
401
+ segment?: string;
402
+ count?: number;
403
403
  }
404
404
 
405
405
  export interface ConversationSuggestedData {
406
- key?: string;
406
+ key?: string;
407
407
  count?: number;
408
408
  }
409
409
 
410
410
  export interface ConversationSpam {
411
- spam_id?: string;
412
- type?: string;
413
- reason?: string;
414
- metadata?: Record<string, unknown>;
415
- headers?: Record<string, unknown>;
411
+ spam_id?: string;
412
+ type?: string;
413
+ reason?: string;
414
+ metadata?: Record<string, unknown>;
415
+ headers?: Record<string, unknown>;
416
416
  timestamp?: number;
417
417
  }
418
418
 
@@ -80,9 +80,11 @@ export interface WebsiteSettingsChatbox {
80
80
  overlay_mode?: boolean;
81
81
  helpdesk_link?: boolean;
82
82
  helpdesk_only?: boolean;
83
+ helpdesk_navigate?: string;
83
84
  status_health_dead?: boolean;
84
85
  check_domain?: boolean;
85
86
  color_theme?: string;
87
+ color_mode?: string;
86
88
  layout_theme?: string;
87
89
  text_theme?: string;
88
90
  welcome_message?: string;
@@ -157,9 +159,11 @@ export interface WebsiteSettingsUpdateChatbox {
157
159
  overlay_mode?: boolean;
158
160
  helpdesk_link?: boolean;
159
161
  helpdesk_only?: boolean;
162
+ helpdesk_navigate?: string;
160
163
  status_health_dead?: boolean;
161
164
  check_domain?: boolean;
162
165
  color_theme?: string;
166
+ color_mode?: string;
163
167
  layout_theme?: string;
164
168
  text_theme?: string;
165
169
  welcome_message?: string;
@@ -14,6 +14,7 @@ export * from "./BucketURL";
14
14
  export * from "./MediaAnimation";
15
15
  export * from "./PluginConnect";
16
16
  export * from "./PluginSubscription";
17
+ export * from "./PlanSubscription";
17
18
  export * from "./WebsiteAnalytics";
18
19
  export * from "./WebsiteAvailability";
19
20
  export * from "./WebsiteBase";
@@ -0,0 +1,36 @@
1
+ /*
2
+ * This file is part of node-crisp-api
3
+ *
4
+ * Copyright (c) 2026 Crisp IM SAS
5
+ * All rights belong to Crisp IM SAS
6
+ */
7
+
8
+ /**************************************************************************
9
+ * IMPORTS
10
+ ***************************************************************************/
11
+
12
+ // PROJECT: RESOURCES
13
+ import PlanSubscription from "@/resources/PlanSubscription";
14
+
15
+ /**************************************************************************
16
+ * CLASSES
17
+ ***************************************************************************/
18
+
19
+ /**
20
+ * Crisp Plan Service
21
+ */
22
+ class PlanService {
23
+ /* eslint-disable @typescript-eslint/no-explicit-any */
24
+ public __resources: any[] = [
25
+ PlanSubscription
26
+ ];
27
+ }
28
+
29
+ /**************************************************************************
30
+ * EXPORTS
31
+ ***************************************************************************/
32
+
33
+ export interface PlanServiceInterface extends PlanSubscription {
34
+ }
35
+
36
+ export default PlanService;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "crisp-api",
3
3
  "description": "Crisp API wrapper for Node - official, maintained by Crisp",
4
- "version": "10.2.0",
4
+ "version": "10.4.0",
5
5
  "homepage": "https://github.com/crisp-im/node-crisp-api",
6
6
  "license": "MIT",
7
7
  "author": {