crisp-api 10.10.3 → 10.10.5

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,8 @@
1
+ "use strict";
2
+ /*
3
+ * This file is part of node-crisp-api
4
+ *
5
+ * Copyright (c) 2025 Crisp IM SAS
6
+ * All rights belong to Crisp IM SAS
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -507,7 +507,7 @@ declare class WebsiteConversation extends BaseResource {
507
507
  /**
508
508
  * Get Messages In Conversation
509
509
  */
510
- getMessagesInConversation(websiteID: string, sessionID: string, timestampBefore?: string | number): Promise<ConversationMessage[]>;
510
+ getMessagesInConversation(websiteID: string, sessionID: string, timestampBefore?: string | number, timestampAfter?: string | number, timestampAround?: string | number): Promise<ConversationMessage[]>;
511
511
  /**
512
512
  * Send A Message In Conversation
513
513
  */
@@ -146,13 +146,21 @@ class WebsiteConversation extends BaseResource_1.default {
146
146
  /**
147
147
  * Get Messages In Conversation
148
148
  */
149
- getMessagesInConversation(websiteID, sessionID, timestampBefore) {
149
+ getMessagesInConversation(websiteID, sessionID, timestampBefore, timestampAfter, timestampAround) {
150
150
  // Generate query
151
151
  let query = {};
152
152
  if (timestampBefore) {
153
153
  // @ts-ignore
154
154
  query.timestamp_before = String(timestampBefore);
155
155
  }
156
+ if (timestampAfter) {
157
+ // @ts-ignore
158
+ query.timestamp_after = String(timestampAfter);
159
+ }
160
+ if (timestampAround) {
161
+ // @ts-ignore
162
+ query.timestamp_around = String(timestampAround);
163
+ }
156
164
  return this.crisp.get(this.crisp.prepareRestUrl([
157
165
  "website", websiteID, "conversation", sessionID, "messages"
158
166
  ]), query);
package/lib/crisp.ts CHANGED
@@ -25,6 +25,9 @@ import Plugin, { PluginServiceInterface } from "@/services/plugin";
25
25
  import Plan, { PlanServiceInterface } from "@/services/plan";
26
26
  import Website, { WebsiteServiceInterface } from "@/services/website";
27
27
 
28
+ // PROJECT: EVENTS
29
+ import { EventsMap, EventName } from "@/events/Events";
30
+
28
31
  /**************************************************************************
29
32
  * TYPES
30
33
  ***************************************************************************/
@@ -424,6 +427,22 @@ class Crisp {
424
427
 
425
428
  /* eslint-enable @typescript-eslint/no-explicit-any */
426
429
 
430
+ /**
431
+ * Binds RTM event (typed variant)
432
+ */
433
+ on<Name extends EventName>(
434
+ // eslint-disable-next-line no-unused-vars
435
+ event: Name, callback: (data: EventsMap[Name]) => unknown
436
+ ): Promise<unknown>;
437
+
438
+ /**
439
+ * Binds RTM event (loose variant)
440
+ */
441
+ on(
442
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, no-unused-vars
443
+ event: string, callback: (data: any) => unknown
444
+ ): Promise<unknown>;
445
+
427
446
  /**
428
447
  * Binds RTM event
429
448
  */
@@ -1046,5 +1065,6 @@ class Crisp {
1046
1065
  ***************************************************************************/
1047
1066
 
1048
1067
  export * from "@/resources";
1068
+ export * from "@/events/Events";
1049
1069
  export { Crisp };
1050
1070
  export default Crisp;