@hyve-sdk/js 2.4.2 → 2.4.4

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
@@ -560,6 +560,11 @@ var AdsService = class {
560
560
  if (type === "rewarded") {
561
561
  adBreakConfig.beforeReward = (showAdFn) => showAdFn();
562
562
  adBreakConfig.adViewed = () => this.config.onRewardEarned();
563
+ adBreakConfig.adDismissed = () => {
564
+ if (this.config.debug) {
565
+ logger.debug("[AdsService] Rewarded ad dismissed");
566
+ }
567
+ };
563
568
  }
564
569
  window.adBreak(adBreakConfig);
565
570
  });
@@ -1740,6 +1745,23 @@ var HyveClient = class {
1740
1745
  return false;
1741
1746
  }
1742
1747
  try {
1748
+ if (eventDetails) {
1749
+ try {
1750
+ if (typeof eventDetails === "string") {
1751
+ JSON.parse(eventDetails);
1752
+ } else if (typeof eventDetails === "object") {
1753
+ JSON.stringify(eventDetails);
1754
+ }
1755
+ } catch (validationError) {
1756
+ logger.error("Invalid JSON in eventDetails:", validationError);
1757
+ logger.error("eventDetails value:", eventDetails);
1758
+ return false;
1759
+ }
1760
+ }
1761
+ const toJsonString = (data) => {
1762
+ if (!data) return null;
1763
+ return typeof data === "string" ? data : JSON.stringify(data);
1764
+ };
1743
1765
  const telemetryEvent = {
1744
1766
  game_id: this.gameId,
1745
1767
  session_id: this.sessionId,
@@ -1749,7 +1771,7 @@ var HyveClient = class {
1749
1771
  event_action: eventAction,
1750
1772
  event_sub_category: eventSubCategory || null,
1751
1773
  event_sub_action: eventSubAction || null,
1752
- event_details: eventDetails || null
1774
+ event_details: toJsonString(eventDetails)
1753
1775
  };
1754
1776
  logger.debug("Sending telemetry event:", telemetryEvent);
1755
1777
  const telemetryUrl = `${this.apiBaseUrl}/api/v1/analytics/send`;
package/dist/index.mjs CHANGED
@@ -520,6 +520,11 @@ var AdsService = class {
520
520
  if (type === "rewarded") {
521
521
  adBreakConfig.beforeReward = (showAdFn) => showAdFn();
522
522
  adBreakConfig.adViewed = () => this.config.onRewardEarned();
523
+ adBreakConfig.adDismissed = () => {
524
+ if (this.config.debug) {
525
+ logger.debug("[AdsService] Rewarded ad dismissed");
526
+ }
527
+ };
523
528
  }
524
529
  window.adBreak(adBreakConfig);
525
530
  });
@@ -1700,6 +1705,23 @@ var HyveClient = class {
1700
1705
  return false;
1701
1706
  }
1702
1707
  try {
1708
+ if (eventDetails) {
1709
+ try {
1710
+ if (typeof eventDetails === "string") {
1711
+ JSON.parse(eventDetails);
1712
+ } else if (typeof eventDetails === "object") {
1713
+ JSON.stringify(eventDetails);
1714
+ }
1715
+ } catch (validationError) {
1716
+ logger.error("Invalid JSON in eventDetails:", validationError);
1717
+ logger.error("eventDetails value:", eventDetails);
1718
+ return false;
1719
+ }
1720
+ }
1721
+ const toJsonString = (data) => {
1722
+ if (!data) return null;
1723
+ return typeof data === "string" ? data : JSON.stringify(data);
1724
+ };
1703
1725
  const telemetryEvent = {
1704
1726
  game_id: this.gameId,
1705
1727
  session_id: this.sessionId,
@@ -1709,7 +1731,7 @@ var HyveClient = class {
1709
1731
  event_action: eventAction,
1710
1732
  event_sub_category: eventSubCategory || null,
1711
1733
  event_sub_action: eventSubAction || null,
1712
- event_details: eventDetails || null
1734
+ event_details: toJsonString(eventDetails)
1713
1735
  };
1714
1736
  logger.debug("Sending telemetry event:", telemetryEvent);
1715
1737
  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
@@ -517,6 +517,11 @@ var AdsService = class {
517
517
  if (type === "rewarded") {
518
518
  adBreakConfig.beforeReward = (showAdFn) => showAdFn();
519
519
  adBreakConfig.adViewed = () => this.config.onRewardEarned();
520
+ adBreakConfig.adDismissed = () => {
521
+ if (this.config.debug) {
522
+ logger.debug("[AdsService] Rewarded ad dismissed");
523
+ }
524
+ };
520
525
  }
521
526
  window.adBreak(adBreakConfig);
522
527
  });
@@ -1691,6 +1696,23 @@ var HyveClient = class {
1691
1696
  return false;
1692
1697
  }
1693
1698
  try {
1699
+ if (eventDetails) {
1700
+ try {
1701
+ if (typeof eventDetails === "string") {
1702
+ JSON.parse(eventDetails);
1703
+ } else if (typeof eventDetails === "object") {
1704
+ JSON.stringify(eventDetails);
1705
+ }
1706
+ } catch (validationError) {
1707
+ logger.error("Invalid JSON in eventDetails:", validationError);
1708
+ logger.error("eventDetails value:", eventDetails);
1709
+ return false;
1710
+ }
1711
+ }
1712
+ const toJsonString = (data) => {
1713
+ if (!data) return null;
1714
+ return typeof data === "string" ? data : JSON.stringify(data);
1715
+ };
1694
1716
  const telemetryEvent = {
1695
1717
  game_id: this.gameId,
1696
1718
  session_id: this.sessionId,
@@ -1700,7 +1722,7 @@ var HyveClient = class {
1700
1722
  event_action: eventAction,
1701
1723
  event_sub_category: eventSubCategory || null,
1702
1724
  event_sub_action: eventSubAction || null,
1703
- event_details: eventDetails || null
1725
+ event_details: toJsonString(eventDetails)
1704
1726
  };
1705
1727
  logger.debug("Sending telemetry event:", telemetryEvent);
1706
1728
  const telemetryUrl = `${this.apiBaseUrl}/api/v1/analytics/send`;
package/dist/react.mjs CHANGED
@@ -496,6 +496,11 @@ var AdsService = class {
496
496
  if (type === "rewarded") {
497
497
  adBreakConfig.beforeReward = (showAdFn) => showAdFn();
498
498
  adBreakConfig.adViewed = () => this.config.onRewardEarned();
499
+ adBreakConfig.adDismissed = () => {
500
+ if (this.config.debug) {
501
+ logger.debug("[AdsService] Rewarded ad dismissed");
502
+ }
503
+ };
499
504
  }
500
505
  window.adBreak(adBreakConfig);
501
506
  });
@@ -1670,6 +1675,23 @@ var HyveClient = class {
1670
1675
  return false;
1671
1676
  }
1672
1677
  try {
1678
+ if (eventDetails) {
1679
+ try {
1680
+ if (typeof eventDetails === "string") {
1681
+ JSON.parse(eventDetails);
1682
+ } else if (typeof eventDetails === "object") {
1683
+ JSON.stringify(eventDetails);
1684
+ }
1685
+ } catch (validationError) {
1686
+ logger.error("Invalid JSON in eventDetails:", validationError);
1687
+ logger.error("eventDetails value:", eventDetails);
1688
+ return false;
1689
+ }
1690
+ }
1691
+ const toJsonString = (data) => {
1692
+ if (!data) return null;
1693
+ return typeof data === "string" ? data : JSON.stringify(data);
1694
+ };
1673
1695
  const telemetryEvent = {
1674
1696
  game_id: this.gameId,
1675
1697
  session_id: this.sessionId,
@@ -1679,7 +1701,7 @@ var HyveClient = class {
1679
1701
  event_action: eventAction,
1680
1702
  event_sub_category: eventSubCategory || null,
1681
1703
  event_sub_action: eventSubAction || null,
1682
- event_details: eventDetails || null
1704
+ event_details: toJsonString(eventDetails)
1683
1705
  };
1684
1706
  logger.debug("Sending telemetry event:", telemetryEvent);
1685
1707
  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.4",
4
4
  "description": "Hyve SDK - TypeScript wrapper for Hyve game server integration",
5
5
  "private": false,
6
6
  "publishConfig": {