@entrolytics/api-client 2.1.0 → 2.2.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/dist/index.d.cts CHANGED
@@ -123,6 +123,14 @@ interface WebsiteStats {
123
123
  change: number;
124
124
  };
125
125
  }
126
+ /**
127
+ * Link statistics - alias to WebsiteStats as they share the same structure
128
+ */
129
+ type LinkStats = WebsiteStats;
130
+ /**
131
+ * @deprecated Use WebsiteStats or LinkStats instead
132
+ */
133
+ type Stats = WebsiteStats;
126
134
  interface PageviewData {
127
135
  x: string;
128
136
  y: number;
@@ -898,15 +906,16 @@ declare function createEventsEndpoints(client: ApiClient): {
898
906
  propertyName: string;
899
907
  total: number;
900
908
  }[]>>;
901
- /**
902
- * Get session data values for a property.
903
- */
904
909
  getSessionDataValues(websiteId: string, params: DateRangeParams & {
905
910
  propertyName: string;
906
911
  }): Promise<ApiResponse<{
907
912
  propertyValue: string;
908
913
  total: number;
909
914
  }[]>>;
915
+ /**
916
+ * Send a test event to verify setup.
917
+ */
918
+ sendTestEvent(websiteId: string): Promise<ApiResponse<void>>;
910
919
  };
911
920
 
912
921
  interface IntegrationWordPressParams {
@@ -944,6 +953,10 @@ declare function createLinksEndpoints(client: ApiClient): {
944
953
  * Delete a link.
945
954
  */
946
955
  deleteLink(linkId: string): Promise<ApiResponse<void>>;
956
+ /**
957
+ * Get link statistics.
958
+ */
959
+ getLinkStats(linkId: string): Promise<ApiResponse<Stats>>;
947
960
  };
948
961
 
949
962
  declare function createMeEndpoints(client: ApiClient): {
@@ -1848,6 +1861,7 @@ interface EntrolyticsClient {
1848
1861
  getEventData: ReturnType<typeof createEventsEndpoints>['getEventData'];
1849
1862
  getSessionDataProperties: ReturnType<typeof createEventsEndpoints>['getSessionDataProperties'];
1850
1863
  getSessionDataValues: ReturnType<typeof createEventsEndpoints>['getSessionDataValues'];
1864
+ sendTestEvent: ReturnType<typeof createEventsEndpoints>['sendTestEvent'];
1851
1865
  getReports: ReturnType<typeof createReportsEndpoints>['getReports'];
1852
1866
  createReport: ReturnType<typeof createReportsEndpoints>['createReport'];
1853
1867
  getReport: ReturnType<typeof createReportsEndpoints>['getReport'];
@@ -1872,6 +1886,7 @@ interface EntrolyticsClient {
1872
1886
  getLink: ReturnType<typeof createLinksEndpoints>['getLink'];
1873
1887
  updateLink: ReturnType<typeof createLinksEndpoints>['updateLink'];
1874
1888
  deleteLink: ReturnType<typeof createLinksEndpoints>['deleteLink'];
1889
+ getLinkStats: ReturnType<typeof createLinksEndpoints>['getLinkStats'];
1875
1890
  getPixels: ReturnType<typeof createPixelsEndpoints>['getPixels'];
1876
1891
  getOrgPixels: ReturnType<typeof createPixelsEndpoints>['getOrgPixels'];
1877
1892
  createPixel: ReturnType<typeof createPixelsEndpoints>['createPixel'];
@@ -1914,4 +1929,4 @@ interface EntrolyticsClient {
1914
1929
  */
1915
1930
  declare function getClient(config?: ClientConfig): EntrolyticsClient;
1916
1931
 
1917
- export { type AccountEntitlements, type AccountUsage, type ActiveVisitor, ApiClient, type ApiResponse, type Board, type BoardWidget, type CheckoutOptions, type CheckoutResponse, type ClientConfig, type CreateBoardData, type CreateBoardWidgetData, type CreateLinkData, type CreateOrgData, type CreatePixelData, type CreateReportData, type CreateSegmentData, type CreateUserData, type CreateWebsiteData, type DateRangeParams, type Deployment, type DeploymentComparison, type DeploymentParams, type EdgeFetchOptions, type EntrolyticsClient, type EventData, type EventDataField, type EventStats, type FormAnalyticsParams, type FormEvent, type FormEventType, type FormFieldStats, type FormStats, type IngestMode, type JoinOrgData, type Link, type MetricData, type MetricType, type NavigationType, type OrgUser, type Organization, type OrganizationRole, type PageviewData, type PaginationParams, type Pixel, type PlanId, type PlatformRole, type PortalResponse, type RealtimeData, type RegionInfo, type Report, type RoutingHealth, type RoutingStats, type Runtime, type Segment, type Session, type SessionActivity, type SessionStats, type SetDeploymentData, type Subscription, type TrackFormEventData, type TrackVitalData, type UpdateBoardData, type UpdateBoardWidgetData, type UpdateLinkData, type UpdateOrgData, type UpdatePixelData, type UpdateReportData, type UpdateSegmentData, type UpdateUserData, type UpdateWebsiteData, type User, type VitalMetric, type VitalRating, type WebVital, type WebVitalsParams, type WebVitalsStats, type Website, type WebsiteEvent, type WebsiteMetricsParams, type WebsiteModeConfig, type WebsitePageviews, type WebsiteStats, assertRuntime, createAdminEndpoints, createAuthEndpoints, createBillingEndpoints, createBoardsEndpoints, createConfigEndpoints, createEdgeFetch, createEventsEndpoints, createIntegrationsEndpoints, createLinksEndpoints, createMeEndpoints, createOrgsEndpoints, createPixelsEndpoints, createReportsEndpoints, createSegmentsEndpoints, createSessionsEndpoints, createUsersEndpoints, createWebhooksEndpoints, createWebsitesEndpoints, getClient as default, detectRuntime, getClient, getClientIp, getEdgeEnv, getGeoFromRequest, getRegionInfo, getRuntimeCapabilities, isEdgeRuntime, isNodeRuntime, requireEdgeEnv };
1932
+ export { type AccountEntitlements, type AccountUsage, type ActiveVisitor, ApiClient, type ApiResponse, type Board, type BoardWidget, type CheckoutOptions, type CheckoutResponse, type ClientConfig, type CreateBoardData, type CreateBoardWidgetData, type CreateLinkData, type CreateOrgData, type CreatePixelData, type CreateReportData, type CreateSegmentData, type CreateUserData, type CreateWebsiteData, type DateRangeParams, type Deployment, type DeploymentComparison, type DeploymentParams, type EdgeFetchOptions, type EntrolyticsClient, type EventData, type EventDataField, type EventStats, type FormAnalyticsParams, type FormEvent, type FormEventType, type FormFieldStats, type FormStats, type IngestMode, type JoinOrgData, type Link, type LinkStats, type MetricData, type MetricType, type NavigationType, type OrgUser, type Organization, type OrganizationRole, type PageviewData, type PaginationParams, type Pixel, type PlanId, type PlatformRole, type PortalResponse, type RealtimeData, type RegionInfo, type Report, type RoutingHealth, type RoutingStats, type Runtime, type Segment, type Session, type SessionActivity, type SessionStats, type SetDeploymentData, type Stats, type Subscription, type TrackFormEventData, type TrackVitalData, type UpdateBoardData, type UpdateBoardWidgetData, type UpdateLinkData, type UpdateOrgData, type UpdatePixelData, type UpdateReportData, type UpdateSegmentData, type UpdateUserData, type UpdateWebsiteData, type User, type VitalMetric, type VitalRating, type WebVital, type WebVitalsParams, type WebVitalsStats, type Website, type WebsiteEvent, type WebsiteMetricsParams, type WebsiteModeConfig, type WebsitePageviews, type WebsiteStats, assertRuntime, createAdminEndpoints, createAuthEndpoints, createBillingEndpoints, createBoardsEndpoints, createConfigEndpoints, createEdgeFetch, createEventsEndpoints, createIntegrationsEndpoints, createLinksEndpoints, createMeEndpoints, createOrgsEndpoints, createPixelsEndpoints, createReportsEndpoints, createSegmentsEndpoints, createSessionsEndpoints, createUsersEndpoints, createWebhooksEndpoints, createWebsitesEndpoints, getClient as default, detectRuntime, getClient, getClientIp, getEdgeEnv, getGeoFromRequest, getRegionInfo, getRuntimeCapabilities, isEdgeRuntime, isNodeRuntime, requireEdgeEnv };
package/dist/index.d.ts CHANGED
@@ -123,6 +123,14 @@ interface WebsiteStats {
123
123
  change: number;
124
124
  };
125
125
  }
126
+ /**
127
+ * Link statistics - alias to WebsiteStats as they share the same structure
128
+ */
129
+ type LinkStats = WebsiteStats;
130
+ /**
131
+ * @deprecated Use WebsiteStats or LinkStats instead
132
+ */
133
+ type Stats = WebsiteStats;
126
134
  interface PageviewData {
127
135
  x: string;
128
136
  y: number;
@@ -898,15 +906,16 @@ declare function createEventsEndpoints(client: ApiClient): {
898
906
  propertyName: string;
899
907
  total: number;
900
908
  }[]>>;
901
- /**
902
- * Get session data values for a property.
903
- */
904
909
  getSessionDataValues(websiteId: string, params: DateRangeParams & {
905
910
  propertyName: string;
906
911
  }): Promise<ApiResponse<{
907
912
  propertyValue: string;
908
913
  total: number;
909
914
  }[]>>;
915
+ /**
916
+ * Send a test event to verify setup.
917
+ */
918
+ sendTestEvent(websiteId: string): Promise<ApiResponse<void>>;
910
919
  };
911
920
 
912
921
  interface IntegrationWordPressParams {
@@ -944,6 +953,10 @@ declare function createLinksEndpoints(client: ApiClient): {
944
953
  * Delete a link.
945
954
  */
946
955
  deleteLink(linkId: string): Promise<ApiResponse<void>>;
956
+ /**
957
+ * Get link statistics.
958
+ */
959
+ getLinkStats(linkId: string): Promise<ApiResponse<Stats>>;
947
960
  };
948
961
 
949
962
  declare function createMeEndpoints(client: ApiClient): {
@@ -1848,6 +1861,7 @@ interface EntrolyticsClient {
1848
1861
  getEventData: ReturnType<typeof createEventsEndpoints>['getEventData'];
1849
1862
  getSessionDataProperties: ReturnType<typeof createEventsEndpoints>['getSessionDataProperties'];
1850
1863
  getSessionDataValues: ReturnType<typeof createEventsEndpoints>['getSessionDataValues'];
1864
+ sendTestEvent: ReturnType<typeof createEventsEndpoints>['sendTestEvent'];
1851
1865
  getReports: ReturnType<typeof createReportsEndpoints>['getReports'];
1852
1866
  createReport: ReturnType<typeof createReportsEndpoints>['createReport'];
1853
1867
  getReport: ReturnType<typeof createReportsEndpoints>['getReport'];
@@ -1872,6 +1886,7 @@ interface EntrolyticsClient {
1872
1886
  getLink: ReturnType<typeof createLinksEndpoints>['getLink'];
1873
1887
  updateLink: ReturnType<typeof createLinksEndpoints>['updateLink'];
1874
1888
  deleteLink: ReturnType<typeof createLinksEndpoints>['deleteLink'];
1889
+ getLinkStats: ReturnType<typeof createLinksEndpoints>['getLinkStats'];
1875
1890
  getPixels: ReturnType<typeof createPixelsEndpoints>['getPixels'];
1876
1891
  getOrgPixels: ReturnType<typeof createPixelsEndpoints>['getOrgPixels'];
1877
1892
  createPixel: ReturnType<typeof createPixelsEndpoints>['createPixel'];
@@ -1914,4 +1929,4 @@ interface EntrolyticsClient {
1914
1929
  */
1915
1930
  declare function getClient(config?: ClientConfig): EntrolyticsClient;
1916
1931
 
1917
- export { type AccountEntitlements, type AccountUsage, type ActiveVisitor, ApiClient, type ApiResponse, type Board, type BoardWidget, type CheckoutOptions, type CheckoutResponse, type ClientConfig, type CreateBoardData, type CreateBoardWidgetData, type CreateLinkData, type CreateOrgData, type CreatePixelData, type CreateReportData, type CreateSegmentData, type CreateUserData, type CreateWebsiteData, type DateRangeParams, type Deployment, type DeploymentComparison, type DeploymentParams, type EdgeFetchOptions, type EntrolyticsClient, type EventData, type EventDataField, type EventStats, type FormAnalyticsParams, type FormEvent, type FormEventType, type FormFieldStats, type FormStats, type IngestMode, type JoinOrgData, type Link, type MetricData, type MetricType, type NavigationType, type OrgUser, type Organization, type OrganizationRole, type PageviewData, type PaginationParams, type Pixel, type PlanId, type PlatformRole, type PortalResponse, type RealtimeData, type RegionInfo, type Report, type RoutingHealth, type RoutingStats, type Runtime, type Segment, type Session, type SessionActivity, type SessionStats, type SetDeploymentData, type Subscription, type TrackFormEventData, type TrackVitalData, type UpdateBoardData, type UpdateBoardWidgetData, type UpdateLinkData, type UpdateOrgData, type UpdatePixelData, type UpdateReportData, type UpdateSegmentData, type UpdateUserData, type UpdateWebsiteData, type User, type VitalMetric, type VitalRating, type WebVital, type WebVitalsParams, type WebVitalsStats, type Website, type WebsiteEvent, type WebsiteMetricsParams, type WebsiteModeConfig, type WebsitePageviews, type WebsiteStats, assertRuntime, createAdminEndpoints, createAuthEndpoints, createBillingEndpoints, createBoardsEndpoints, createConfigEndpoints, createEdgeFetch, createEventsEndpoints, createIntegrationsEndpoints, createLinksEndpoints, createMeEndpoints, createOrgsEndpoints, createPixelsEndpoints, createReportsEndpoints, createSegmentsEndpoints, createSessionsEndpoints, createUsersEndpoints, createWebhooksEndpoints, createWebsitesEndpoints, getClient as default, detectRuntime, getClient, getClientIp, getEdgeEnv, getGeoFromRequest, getRegionInfo, getRuntimeCapabilities, isEdgeRuntime, isNodeRuntime, requireEdgeEnv };
1932
+ export { type AccountEntitlements, type AccountUsage, type ActiveVisitor, ApiClient, type ApiResponse, type Board, type BoardWidget, type CheckoutOptions, type CheckoutResponse, type ClientConfig, type CreateBoardData, type CreateBoardWidgetData, type CreateLinkData, type CreateOrgData, type CreatePixelData, type CreateReportData, type CreateSegmentData, type CreateUserData, type CreateWebsiteData, type DateRangeParams, type Deployment, type DeploymentComparison, type DeploymentParams, type EdgeFetchOptions, type EntrolyticsClient, type EventData, type EventDataField, type EventStats, type FormAnalyticsParams, type FormEvent, type FormEventType, type FormFieldStats, type FormStats, type IngestMode, type JoinOrgData, type Link, type LinkStats, type MetricData, type MetricType, type NavigationType, type OrgUser, type Organization, type OrganizationRole, type PageviewData, type PaginationParams, type Pixel, type PlanId, type PlatformRole, type PortalResponse, type RealtimeData, type RegionInfo, type Report, type RoutingHealth, type RoutingStats, type Runtime, type Segment, type Session, type SessionActivity, type SessionStats, type SetDeploymentData, type Stats, type Subscription, type TrackFormEventData, type TrackVitalData, type UpdateBoardData, type UpdateBoardWidgetData, type UpdateLinkData, type UpdateOrgData, type UpdatePixelData, type UpdateReportData, type UpdateSegmentData, type UpdateUserData, type UpdateWebsiteData, type User, type VitalMetric, type VitalRating, type WebVital, type WebVitalsParams, type WebVitalsStats, type Website, type WebsiteEvent, type WebsiteMetricsParams, type WebsiteModeConfig, type WebsitePageviews, type WebsiteStats, assertRuntime, createAdminEndpoints, createAuthEndpoints, createBillingEndpoints, createBoardsEndpoints, createConfigEndpoints, createEdgeFetch, createEventsEndpoints, createIntegrationsEndpoints, createLinksEndpoints, createMeEndpoints, createOrgsEndpoints, createPixelsEndpoints, createReportsEndpoints, createSegmentsEndpoints, createSessionsEndpoints, createUsersEndpoints, createWebhooksEndpoints, createWebsitesEndpoints, getClient as default, detectRuntime, getClient, getClientIp, getEdgeEnv, getGeoFromRequest, getRegionInfo, getRuntimeCapabilities, isEdgeRuntime, isNodeRuntime, requireEdgeEnv };
package/dist/index.js CHANGED
@@ -408,11 +408,21 @@ function createEventsEndpoints(client) {
408
408
  getSessionDataProperties(websiteId, params) {
409
409
  return client.get(`/websites/${websiteId}/session-data/properties`, params);
410
410
  },
411
- /**
412
- * Get session data values for a property.
413
- */
414
411
  getSessionDataValues(websiteId, params) {
415
412
  return client.get(`/websites/${websiteId}/session-data/values`, params);
413
+ },
414
+ /**
415
+ * Send a test event to verify setup.
416
+ */
417
+ sendTestEvent(websiteId) {
418
+ return client.post("/send", {
419
+ type: "event",
420
+ payload: {
421
+ website: websiteId,
422
+ name: "cli_test_event",
423
+ data: { source: "entro-cli", timestamp: Date.now() }
424
+ }
425
+ });
416
426
  }
417
427
  };
418
428
  }
@@ -465,6 +475,12 @@ function createLinksEndpoints(client) {
465
475
  */
466
476
  deleteLink(linkId) {
467
477
  return client.delete(`/links/${linkId}`);
478
+ },
479
+ /**
480
+ * Get link statistics.
481
+ */
482
+ getLinkStats(linkId) {
483
+ return client.get(`/links/${linkId}/stats`);
468
484
  }
469
485
  };
470
486
  }
@@ -934,19 +950,37 @@ function createWebsitesEndpoints(client) {
934
950
  * Get all websites.
935
951
  */
936
952
  getWebsites() {
937
- return client.get("/websites");
953
+ return client.get("/websites").then((response) => {
954
+ if (response.data) {
955
+ response.data = response.data.map((site) => ({
956
+ ...site,
957
+ id: site.id || site.websiteId
958
+ }));
959
+ }
960
+ return response;
961
+ });
938
962
  },
939
963
  /**
940
964
  * Create a new website.
941
965
  */
942
966
  createWebsite(data) {
943
- return client.post("/websites", data);
967
+ return client.post("/websites", data).then((response) => {
968
+ if (response.data) {
969
+ response.data.id = response.data.id || response.data.websiteId;
970
+ }
971
+ return response;
972
+ });
944
973
  },
945
974
  /**
946
975
  * Get a website by ID.
947
976
  */
948
977
  getWebsite(websiteId) {
949
- return client.get(`/websites/${websiteId}`);
978
+ return client.get(`/websites/${websiteId}`).then((response) => {
979
+ if (response.data) {
980
+ response.data.id = response.data.id || response.data.websiteId;
981
+ }
982
+ return response;
983
+ });
950
984
  },
951
985
  /**
952
986
  * Update a website.