@ecodrix/erix-api 1.0.5 → 1.0.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecodrix/erix-api",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "author": "ECODrIx Team <contact@ecodrix.com>",
5
5
  "license": "MIT",
6
6
  "description": "Official Isomorphic SDK for the ECODrIx platform. Native support for WhatsApp, CRM, Storage, and Meetings across TS, JS, Python, and Java.",
package/src/core.ts CHANGED
@@ -236,6 +236,20 @@ export class Ecodrix {
236
236
  this.socket.disconnect();
237
237
  }
238
238
 
239
+ /**
240
+ * Remove a previously registered event listener.
241
+ * Always call this in cleanup (e.g. React `useEffect` return) to prevent
242
+ * memory leaks and duplicate handlers after reconnections.
243
+ *
244
+ * @param event - The event name to unsubscribe from.
245
+ * @param callback - The exact handler reference passed to `.on()`.
246
+ * @returns `this` for method chaining.
247
+ */
248
+ public off(event: string, callback: (...args: any[]) => void): this {
249
+ this.socket.off(event, callback);
250
+ return this;
251
+ }
252
+
239
253
  /**
240
254
  * Raw Execution Escape-Hatch.
241
255
  * Send an authenticated HTTP request directly to the ECODrIx backend from ANY external project.
@@ -122,32 +122,37 @@ export class Notifications extends APIResource {
122
122
  }
123
123
 
124
124
  // --- CRM Notifications (Alerts) ---
125
+ // Backend routes mounted at /api/crm — see crm.router.ts + notification.routes.ts
125
126
 
126
127
  /**
127
- * List active CRM notifications/alerts for the current agent.
128
+ * List unread CRM notifications/alerts for the current tenant.
129
+ * Maps to: GET /api/crm/notifications
128
130
  */
129
131
  async listAlerts<T = any>(params?: { limit?: number; unreadOnly?: boolean }) {
130
- return this.get<T>("/api/saas/crm/notifications", { params } as any);
132
+ return this.get<T>("/api/crm/notifications", { params } as any);
131
133
  }
132
134
 
133
135
  /**
134
136
  * Dismiss a specific notification alert.
137
+ * Maps to: PATCH /api/crm/notifications/:id/dismiss
135
138
  */
136
139
  async dismissAlert<T = any>(notificationId: string) {
137
- return this.patch<T>(`/api/saas/crm/notifications/${notificationId}/dismiss`);
140
+ return this.patch<T>(`/api/crm/notifications/${notificationId}/dismiss`);
138
141
  }
139
142
 
140
143
  /**
141
- * Clear (dismiss) all notifications for the current agent.
144
+ * Clear (dismiss) all notifications for the current tenant.
145
+ * Maps to: DELETE /api/crm/notifications/clear-all
142
146
  */
143
147
  async clearAllAlerts<T = any>() {
144
- return this.deleteRequest<T>("/api/saas/crm/notifications/clear-all");
148
+ return this.deleteRequest<T>("/api/crm/notifications/clear-all");
145
149
  }
146
150
 
147
151
  /**
148
- * Retry an action from a notification (e.g. failed send).
152
+ * Retry an action from a notification (e.g. failed automation send).
153
+ * Maps to: POST /api/crm/notifications/:id/retry
149
154
  */
150
155
  async retryAction<T = any>(notificationId: string) {
151
- return this.post<T>(`/api/saas/crm/notifications/${notificationId}/retry`, {});
156
+ return this.post<T>(`/api/crm/notifications/${notificationId}/retry`, {});
152
157
  }
153
158
  }