@hyve-sdk/js 2.4.2 → 2.4.3

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.mts CHANGED
@@ -33,8 +33,8 @@ interface TelemetryEvent {
33
33
  event_action: string;
34
34
  /** Sub-action for detailed tracking (optional) */
35
35
  event_sub_action?: string | null;
36
- /** Event details as object (optional) */
37
- event_details?: Record<string, unknown> | null;
36
+ /** Event details as JSON string or object (optional) */
37
+ event_details?: Record<string, any> | string | null;
38
38
  /** Mapping details as JSON string or object (optional) */
39
39
  mapping_details?: Record<string, any> | string | null;
40
40
  }
@@ -42,7 +42,7 @@ interface TelemetryEvent {
42
42
  * Additional telemetry data that can be passed with events
43
43
  */
44
44
  interface TelemetryAdditionalData {
45
- /** Optional additional data object passed as event_details */
45
+ /** Optional additional data object (will be JSON stringified and put in event_details) */
46
46
  [key: string]: any;
47
47
  }
48
48
  /**
@@ -506,7 +506,7 @@ declare class HyveClient {
506
506
  * @param platformId Optional platform identifier
507
507
  * @returns Promise resolving to boolean indicating success
508
508
  */
509
- sendTelemetry(eventLocation: string, eventCategory: string, eventAction: string, eventSubCategory?: string | null, eventSubAction?: string | null, eventDetails?: Record<string, unknown> | null, platformId?: string | null): Promise<boolean>;
509
+ sendTelemetry(eventLocation: string, eventCategory: string, eventAction: string, eventSubCategory?: string | null, eventSubAction?: string | null, eventDetails?: Record<string, any> | string | null, platformId?: string | null): Promise<boolean>;
510
510
  /**
511
511
  * Makes an authenticated API call using the JWT token
512
512
  * @param endpoint API endpoint path (will be appended to base URL)
package/dist/index.d.ts CHANGED
@@ -33,8 +33,8 @@ interface TelemetryEvent {
33
33
  event_action: string;
34
34
  /** Sub-action for detailed tracking (optional) */
35
35
  event_sub_action?: string | null;
36
- /** Event details as object (optional) */
37
- event_details?: Record<string, unknown> | null;
36
+ /** Event details as JSON string or object (optional) */
37
+ event_details?: Record<string, any> | string | null;
38
38
  /** Mapping details as JSON string or object (optional) */
39
39
  mapping_details?: Record<string, any> | string | null;
40
40
  }
@@ -42,7 +42,7 @@ interface TelemetryEvent {
42
42
  * Additional telemetry data that can be passed with events
43
43
  */
44
44
  interface TelemetryAdditionalData {
45
- /** Optional additional data object passed as event_details */
45
+ /** Optional additional data object (will be JSON stringified and put in event_details) */
46
46
  [key: string]: any;
47
47
  }
48
48
  /**
@@ -506,7 +506,7 @@ declare class HyveClient {
506
506
  * @param platformId Optional platform identifier
507
507
  * @returns Promise resolving to boolean indicating success
508
508
  */
509
- sendTelemetry(eventLocation: string, eventCategory: string, eventAction: string, eventSubCategory?: string | null, eventSubAction?: string | null, eventDetails?: Record<string, unknown> | null, platformId?: string | null): Promise<boolean>;
509
+ sendTelemetry(eventLocation: string, eventCategory: string, eventAction: string, eventSubCategory?: string | null, eventSubAction?: string | null, eventDetails?: Record<string, any> | string | null, platformId?: string | null): Promise<boolean>;
510
510
  /**
511
511
  * Makes an authenticated API call using the JWT token
512
512
  * @param endpoint API endpoint path (will be appended to base URL)
package/dist/index.js CHANGED
@@ -1740,6 +1740,23 @@ var HyveClient = class {
1740
1740
  return false;
1741
1741
  }
1742
1742
  try {
1743
+ if (eventDetails) {
1744
+ try {
1745
+ if (typeof eventDetails === "string") {
1746
+ JSON.parse(eventDetails);
1747
+ } else if (typeof eventDetails === "object") {
1748
+ JSON.stringify(eventDetails);
1749
+ }
1750
+ } catch (validationError) {
1751
+ logger.error("Invalid JSON in eventDetails:", validationError);
1752
+ logger.error("eventDetails value:", eventDetails);
1753
+ return false;
1754
+ }
1755
+ }
1756
+ const toJsonString = (data) => {
1757
+ if (!data) return null;
1758
+ return typeof data === "string" ? data : JSON.stringify(data);
1759
+ };
1743
1760
  const telemetryEvent = {
1744
1761
  game_id: this.gameId,
1745
1762
  session_id: this.sessionId,
@@ -1749,7 +1766,7 @@ var HyveClient = class {
1749
1766
  event_action: eventAction,
1750
1767
  event_sub_category: eventSubCategory || null,
1751
1768
  event_sub_action: eventSubAction || null,
1752
- event_details: eventDetails || null
1769
+ event_details: toJsonString(eventDetails)
1753
1770
  };
1754
1771
  logger.debug("Sending telemetry event:", telemetryEvent);
1755
1772
  const telemetryUrl = `${this.apiBaseUrl}/api/v1/analytics/send`;
package/dist/index.mjs CHANGED
@@ -1700,6 +1700,23 @@ var HyveClient = class {
1700
1700
  return false;
1701
1701
  }
1702
1702
  try {
1703
+ if (eventDetails) {
1704
+ try {
1705
+ if (typeof eventDetails === "string") {
1706
+ JSON.parse(eventDetails);
1707
+ } else if (typeof eventDetails === "object") {
1708
+ JSON.stringify(eventDetails);
1709
+ }
1710
+ } catch (validationError) {
1711
+ logger.error("Invalid JSON in eventDetails:", validationError);
1712
+ logger.error("eventDetails value:", eventDetails);
1713
+ return false;
1714
+ }
1715
+ }
1716
+ const toJsonString = (data) => {
1717
+ if (!data) return null;
1718
+ return typeof data === "string" ? data : JSON.stringify(data);
1719
+ };
1703
1720
  const telemetryEvent = {
1704
1721
  game_id: this.gameId,
1705
1722
  session_id: this.sessionId,
@@ -1709,7 +1726,7 @@ var HyveClient = class {
1709
1726
  event_action: eventAction,
1710
1727
  event_sub_category: eventSubCategory || null,
1711
1728
  event_sub_action: eventSubAction || null,
1712
- event_details: eventDetails || null
1729
+ event_details: toJsonString(eventDetails)
1713
1730
  };
1714
1731
  logger.debug("Sending telemetry event:", telemetryEvent);
1715
1732
  const telemetryUrl = `${this.apiBaseUrl}/api/v1/analytics/send`;
package/dist/react.d.mts CHANGED
@@ -281,7 +281,7 @@ declare class HyveClient {
281
281
  * @param platformId Optional platform identifier
282
282
  * @returns Promise resolving to boolean indicating success
283
283
  */
284
- sendTelemetry(eventLocation: string, eventCategory: string, eventAction: string, eventSubCategory?: string | null, eventSubAction?: string | null, eventDetails?: Record<string, unknown> | null, platformId?: string | null): Promise<boolean>;
284
+ sendTelemetry(eventLocation: string, eventCategory: string, eventAction: string, eventSubCategory?: string | null, eventSubAction?: string | null, eventDetails?: Record<string, any> | string | null, platformId?: string | null): Promise<boolean>;
285
285
  /**
286
286
  * Makes an authenticated API call using the JWT token
287
287
  * @param endpoint API endpoint path (will be appended to base URL)
package/dist/react.d.ts CHANGED
@@ -281,7 +281,7 @@ declare class HyveClient {
281
281
  * @param platformId Optional platform identifier
282
282
  * @returns Promise resolving to boolean indicating success
283
283
  */
284
- sendTelemetry(eventLocation: string, eventCategory: string, eventAction: string, eventSubCategory?: string | null, eventSubAction?: string | null, eventDetails?: Record<string, unknown> | null, platformId?: string | null): Promise<boolean>;
284
+ sendTelemetry(eventLocation: string, eventCategory: string, eventAction: string, eventSubCategory?: string | null, eventSubAction?: string | null, eventDetails?: Record<string, any> | string | null, platformId?: string | null): Promise<boolean>;
285
285
  /**
286
286
  * Makes an authenticated API call using the JWT token
287
287
  * @param endpoint API endpoint path (will be appended to base URL)
package/dist/react.js CHANGED
@@ -1691,6 +1691,23 @@ var HyveClient = class {
1691
1691
  return false;
1692
1692
  }
1693
1693
  try {
1694
+ if (eventDetails) {
1695
+ try {
1696
+ if (typeof eventDetails === "string") {
1697
+ JSON.parse(eventDetails);
1698
+ } else if (typeof eventDetails === "object") {
1699
+ JSON.stringify(eventDetails);
1700
+ }
1701
+ } catch (validationError) {
1702
+ logger.error("Invalid JSON in eventDetails:", validationError);
1703
+ logger.error("eventDetails value:", eventDetails);
1704
+ return false;
1705
+ }
1706
+ }
1707
+ const toJsonString = (data) => {
1708
+ if (!data) return null;
1709
+ return typeof data === "string" ? data : JSON.stringify(data);
1710
+ };
1694
1711
  const telemetryEvent = {
1695
1712
  game_id: this.gameId,
1696
1713
  session_id: this.sessionId,
@@ -1700,7 +1717,7 @@ var HyveClient = class {
1700
1717
  event_action: eventAction,
1701
1718
  event_sub_category: eventSubCategory || null,
1702
1719
  event_sub_action: eventSubAction || null,
1703
- event_details: eventDetails || null
1720
+ event_details: toJsonString(eventDetails)
1704
1721
  };
1705
1722
  logger.debug("Sending telemetry event:", telemetryEvent);
1706
1723
  const telemetryUrl = `${this.apiBaseUrl}/api/v1/analytics/send`;
package/dist/react.mjs CHANGED
@@ -1670,6 +1670,23 @@ var HyveClient = class {
1670
1670
  return false;
1671
1671
  }
1672
1672
  try {
1673
+ if (eventDetails) {
1674
+ try {
1675
+ if (typeof eventDetails === "string") {
1676
+ JSON.parse(eventDetails);
1677
+ } else if (typeof eventDetails === "object") {
1678
+ JSON.stringify(eventDetails);
1679
+ }
1680
+ } catch (validationError) {
1681
+ logger.error("Invalid JSON in eventDetails:", validationError);
1682
+ logger.error("eventDetails value:", eventDetails);
1683
+ return false;
1684
+ }
1685
+ }
1686
+ const toJsonString = (data) => {
1687
+ if (!data) return null;
1688
+ return typeof data === "string" ? data : JSON.stringify(data);
1689
+ };
1673
1690
  const telemetryEvent = {
1674
1691
  game_id: this.gameId,
1675
1692
  session_id: this.sessionId,
@@ -1679,7 +1696,7 @@ var HyveClient = class {
1679
1696
  event_action: eventAction,
1680
1697
  event_sub_category: eventSubCategory || null,
1681
1698
  event_sub_action: eventSubAction || null,
1682
- event_details: eventDetails || null
1699
+ event_details: toJsonString(eventDetails)
1683
1700
  };
1684
1701
  logger.debug("Sending telemetry event:", telemetryEvent);
1685
1702
  const telemetryUrl = `${this.apiBaseUrl}/api/v1/analytics/send`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyve-sdk/js",
3
- "version": "2.4.2",
3
+ "version": "2.4.3",
4
4
  "description": "Hyve SDK - TypeScript wrapper for Hyve game server integration",
5
5
  "private": false,
6
6
  "publishConfig": {