@scalemule/nextjs 0.0.26 → 0.0.28

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/client.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { j as StorageAdapter } from './index-CYS_FzSf.mjs';
1
+ import { j as StorageAdapter } from './index-DewTyMF2.mjs';
2
2
 
3
3
  /**
4
4
  * ScaleMule API Client
package/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { j as StorageAdapter } from './index-CYS_FzSf.js';
1
+ import { j as StorageAdapter } from './index-DewTyMF2.js';
2
2
 
3
3
  /**
4
4
  * ScaleMule API Client
@@ -533,12 +533,36 @@ interface UTMParams {
533
533
  utm_source?: string;
534
534
  /** Marketing medium (e.g., 'cpc', 'email', 'social') */
535
535
  utm_medium?: string;
536
- /** Campaign name */
536
+ /** Campaign name or ID */
537
537
  utm_campaign?: string;
538
538
  /** Search term for paid search */
539
539
  utm_term?: string;
540
540
  /** Content identifier for A/B testing */
541
541
  utm_content?: string;
542
+ /** Ad group name or ID */
543
+ utm_adgroup?: string;
544
+ /** Google Ads click ID (auto-appended by Google) */
545
+ gclid?: string;
546
+ /** Google Ads click ID for iOS (app attribution) */
547
+ gbraid?: string;
548
+ /** Google Ads click ID for web (cross-domain) */
549
+ wbraid?: string;
550
+ /** Facebook/Meta click ID (auto-appended by Meta) */
551
+ fbclid?: string;
552
+ /** Google Ads campaign ID (via ValueTrack {campaignid}) */
553
+ gad_campaignid?: string;
554
+ /** Google Ads ad group ID (via ValueTrack {adgroupid}) */
555
+ gad_adgroupid?: string;
556
+ /** Google Ads network: g=search, d=display, y=youtube */
557
+ gad_network?: string;
558
+ /** Google Ads match type: b=broad, p=phrase, e=exact */
559
+ gad_matchtype?: string;
560
+ /** Google Ads device: m=mobile, c=desktop, t=tablet */
561
+ gad_device?: string;
562
+ /** Google Ads placement (display/youtube site) */
563
+ gad_placement?: string;
564
+ /** Google Ads source identifier */
565
+ gad_source?: string;
542
566
  }
543
567
  /**
544
568
  * Device information for analytics
@@ -533,12 +533,36 @@ interface UTMParams {
533
533
  utm_source?: string;
534
534
  /** Marketing medium (e.g., 'cpc', 'email', 'social') */
535
535
  utm_medium?: string;
536
- /** Campaign name */
536
+ /** Campaign name or ID */
537
537
  utm_campaign?: string;
538
538
  /** Search term for paid search */
539
539
  utm_term?: string;
540
540
  /** Content identifier for A/B testing */
541
541
  utm_content?: string;
542
+ /** Ad group name or ID */
543
+ utm_adgroup?: string;
544
+ /** Google Ads click ID (auto-appended by Google) */
545
+ gclid?: string;
546
+ /** Google Ads click ID for iOS (app attribution) */
547
+ gbraid?: string;
548
+ /** Google Ads click ID for web (cross-domain) */
549
+ wbraid?: string;
550
+ /** Facebook/Meta click ID (auto-appended by Meta) */
551
+ fbclid?: string;
552
+ /** Google Ads campaign ID (via ValueTrack {campaignid}) */
553
+ gad_campaignid?: string;
554
+ /** Google Ads ad group ID (via ValueTrack {adgroupid}) */
555
+ gad_adgroupid?: string;
556
+ /** Google Ads network: g=search, d=display, y=youtube */
557
+ gad_network?: string;
558
+ /** Google Ads match type: b=broad, p=phrase, e=exact */
559
+ gad_matchtype?: string;
560
+ /** Google Ads device: m=mobile, c=desktop, t=tablet */
561
+ gad_device?: string;
562
+ /** Google Ads placement (display/youtube site) */
563
+ gad_placement?: string;
564
+ /** Google Ads source identifier */
565
+ gad_source?: string;
542
566
  }
543
567
  /**
544
568
  * Device information for analytics
package/dist/index.d.mts CHANGED
@@ -2,8 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
3
  import { ScaleMuleClient } from './client.mjs';
4
4
  export { ClientConfig, RequestOptions, createClient } from './client.mjs';
5
- import { S as ScaleMuleConfig, U as User, L as LoginResponse, A as ApiError, a as UseAuthReturn, b as UseBillingReturn, c as ListFilesParams, d as UseContentReturn, e as UseUserReturn, f as UseAnalyticsOptions, g as UseAnalyticsReturn } from './index-CYS_FzSf.mjs';
6
- export { a2 as AccountBalance, a9 as AnalyticsEvent, k as ApiResponse, af as BatchTrackRequest, a3 as BillingPayment, a5 as BillingPayout, a4 as BillingRefund, a7 as BillingTransaction, r as ChangeEmailRequest, C as ChangePasswordRequest, $ as ClientContext, a1 as ConnectedAccount, D as DeviceFingerprint, ac as DeviceInfo, ad as EnhancedAnalyticsEvent, F as ForgotPasswordRequest, x as LinkedAccount, T as ListFilesResponse, n as LoginDeviceInfo, l as LoginRequest, m as LoginResponseWithMFA, o as LoginRiskInfo, G as MFAChallengeResponse, M as MFAMethod, B as MFASMSSetupResponse, y as MFASetupRequest, H as MFAStatus, z as MFATOTPSetupResponse, E as MFAVerifyRequest, v as OAuthCallbackRequest, w as OAuthCallbackResponse, t as OAuthConfig, O as OAuthProvider, u as OAuthStartResponse, aa as PageViewData, a6 as PayoutSchedule, K as PhoneLoginRequest, I as PhoneSendCodeRequest, J as PhoneVerifyRequest, P as Profile, p as RefreshResponse, R as RegisterRequest, q as ResetPasswordRequest, h as ScaleMuleApiError, i as ScaleMuleEnvironment, s as Session, _ as SignedUploadCompleteRequest, Y as SignedUploadRequest, Z as SignedUploadResponse, X as SignedUploadUrl, j as StorageAdapter, N as StorageFile, ae as TrackEventResponse, a8 as TransactionSummary, ab as UTMParams, a0 as UpdateProfileRequest, Q as UploadOptions, W as UploadResponse, V as VerifyEmailRequest } from './index-CYS_FzSf.mjs';
5
+ import { S as ScaleMuleConfig, U as User, L as LoginResponse, A as ApiError, a as UseAuthReturn, b as UseBillingReturn, c as ListFilesParams, d as UseContentReturn, e as UseUserReturn, f as UseAnalyticsOptions, g as UseAnalyticsReturn } from './index-DewTyMF2.mjs';
6
+ export { a2 as AccountBalance, a9 as AnalyticsEvent, k as ApiResponse, af as BatchTrackRequest, a3 as BillingPayment, a5 as BillingPayout, a4 as BillingRefund, a7 as BillingTransaction, r as ChangeEmailRequest, C as ChangePasswordRequest, $ as ClientContext, a1 as ConnectedAccount, D as DeviceFingerprint, ac as DeviceInfo, ad as EnhancedAnalyticsEvent, F as ForgotPasswordRequest, x as LinkedAccount, T as ListFilesResponse, n as LoginDeviceInfo, l as LoginRequest, m as LoginResponseWithMFA, o as LoginRiskInfo, G as MFAChallengeResponse, M as MFAMethod, B as MFASMSSetupResponse, y as MFASetupRequest, H as MFAStatus, z as MFATOTPSetupResponse, E as MFAVerifyRequest, v as OAuthCallbackRequest, w as OAuthCallbackResponse, t as OAuthConfig, O as OAuthProvider, u as OAuthStartResponse, aa as PageViewData, a6 as PayoutSchedule, K as PhoneLoginRequest, I as PhoneSendCodeRequest, J as PhoneVerifyRequest, P as Profile, p as RefreshResponse, R as RegisterRequest, q as ResetPasswordRequest, h as ScaleMuleApiError, i as ScaleMuleEnvironment, s as Session, _ as SignedUploadCompleteRequest, Y as SignedUploadRequest, Z as SignedUploadResponse, X as SignedUploadUrl, j as StorageAdapter, N as StorageFile, ae as TrackEventResponse, a8 as TransactionSummary, ab as UTMParams, a0 as UpdateProfileRequest, Q as UploadOptions, W as UploadResponse, V as VerifyEmailRequest } from './index-DewTyMF2.mjs';
7
7
 
8
8
  interface ScaleMuleContextValue {
9
9
  /** The API client instance */
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
3
  import { ScaleMuleClient } from './client.js';
4
4
  export { ClientConfig, RequestOptions, createClient } from './client.js';
5
- import { S as ScaleMuleConfig, U as User, L as LoginResponse, A as ApiError, a as UseAuthReturn, b as UseBillingReturn, c as ListFilesParams, d as UseContentReturn, e as UseUserReturn, f as UseAnalyticsOptions, g as UseAnalyticsReturn } from './index-CYS_FzSf.js';
6
- export { a2 as AccountBalance, a9 as AnalyticsEvent, k as ApiResponse, af as BatchTrackRequest, a3 as BillingPayment, a5 as BillingPayout, a4 as BillingRefund, a7 as BillingTransaction, r as ChangeEmailRequest, C as ChangePasswordRequest, $ as ClientContext, a1 as ConnectedAccount, D as DeviceFingerprint, ac as DeviceInfo, ad as EnhancedAnalyticsEvent, F as ForgotPasswordRequest, x as LinkedAccount, T as ListFilesResponse, n as LoginDeviceInfo, l as LoginRequest, m as LoginResponseWithMFA, o as LoginRiskInfo, G as MFAChallengeResponse, M as MFAMethod, B as MFASMSSetupResponse, y as MFASetupRequest, H as MFAStatus, z as MFATOTPSetupResponse, E as MFAVerifyRequest, v as OAuthCallbackRequest, w as OAuthCallbackResponse, t as OAuthConfig, O as OAuthProvider, u as OAuthStartResponse, aa as PageViewData, a6 as PayoutSchedule, K as PhoneLoginRequest, I as PhoneSendCodeRequest, J as PhoneVerifyRequest, P as Profile, p as RefreshResponse, R as RegisterRequest, q as ResetPasswordRequest, h as ScaleMuleApiError, i as ScaleMuleEnvironment, s as Session, _ as SignedUploadCompleteRequest, Y as SignedUploadRequest, Z as SignedUploadResponse, X as SignedUploadUrl, j as StorageAdapter, N as StorageFile, ae as TrackEventResponse, a8 as TransactionSummary, ab as UTMParams, a0 as UpdateProfileRequest, Q as UploadOptions, W as UploadResponse, V as VerifyEmailRequest } from './index-CYS_FzSf.js';
5
+ import { S as ScaleMuleConfig, U as User, L as LoginResponse, A as ApiError, a as UseAuthReturn, b as UseBillingReturn, c as ListFilesParams, d as UseContentReturn, e as UseUserReturn, f as UseAnalyticsOptions, g as UseAnalyticsReturn } from './index-DewTyMF2.js';
6
+ export { a2 as AccountBalance, a9 as AnalyticsEvent, k as ApiResponse, af as BatchTrackRequest, a3 as BillingPayment, a5 as BillingPayout, a4 as BillingRefund, a7 as BillingTransaction, r as ChangeEmailRequest, C as ChangePasswordRequest, $ as ClientContext, a1 as ConnectedAccount, D as DeviceFingerprint, ac as DeviceInfo, ad as EnhancedAnalyticsEvent, F as ForgotPasswordRequest, x as LinkedAccount, T as ListFilesResponse, n as LoginDeviceInfo, l as LoginRequest, m as LoginResponseWithMFA, o as LoginRiskInfo, G as MFAChallengeResponse, M as MFAMethod, B as MFASMSSetupResponse, y as MFASetupRequest, H as MFAStatus, z as MFATOTPSetupResponse, E as MFAVerifyRequest, v as OAuthCallbackRequest, w as OAuthCallbackResponse, t as OAuthConfig, O as OAuthProvider, u as OAuthStartResponse, aa as PageViewData, a6 as PayoutSchedule, K as PhoneLoginRequest, I as PhoneSendCodeRequest, J as PhoneVerifyRequest, P as Profile, p as RefreshResponse, R as RegisterRequest, q as ResetPasswordRequest, h as ScaleMuleApiError, i as ScaleMuleEnvironment, s as Session, _ as SignedUploadCompleteRequest, Y as SignedUploadRequest, Z as SignedUploadResponse, X as SignedUploadUrl, j as StorageAdapter, N as StorageFile, ae as TrackEventResponse, a8 as TransactionSummary, ab as UTMParams, a0 as UpdateProfileRequest, Q as UploadOptions, W as UploadResponse, V as VerifyEmailRequest } from './index-DewTyMF2.js';
7
7
 
8
8
  interface ScaleMuleContextValue {
9
9
  /** The API client instance */
package/dist/index.js CHANGED
@@ -2511,20 +2511,34 @@ function parseUtmParams() {
2511
2511
  const campaign = params.get("utm_campaign");
2512
2512
  const term = params.get("utm_term");
2513
2513
  const content = params.get("utm_content");
2514
+ const adgroup = params.get("utm_adgroup");
2514
2515
  if (source) utm.utm_source = source;
2515
2516
  if (medium) utm.utm_medium = medium;
2516
2517
  if (campaign) utm.utm_campaign = campaign;
2517
2518
  if (term) utm.utm_term = term;
2518
2519
  if (content) utm.utm_content = content;
2519
- if (!utm.utm_source && (params.get("gclid") || params.get("gad_source") || params.get("wbraid") || params.get("gbraid"))) {
2520
+ if (adgroup) utm.utm_adgroup = adgroup;
2521
+ const gclid = params.get("gclid");
2522
+ const gbraid = params.get("gbraid");
2523
+ const wbraid = params.get("wbraid");
2524
+ const fbclid = params.get("fbclid");
2525
+ if (gclid) utm.gclid = gclid;
2526
+ if (gbraid) utm.gbraid = gbraid;
2527
+ if (wbraid) utm.wbraid = wbraid;
2528
+ if (fbclid) utm.fbclid = fbclid;
2529
+ const gadFields = ["gad_source", "gad_campaignid", "gad_adgroupid", "gad_network", "gad_matchtype", "gad_device", "gad_placement"];
2530
+ for (const field of gadFields) {
2531
+ const val = params.get(field);
2532
+ if (val) utm[field] = val;
2533
+ }
2534
+ if (!utm.utm_source && (gclid || utm.gad_source || wbraid || gbraid)) {
2520
2535
  utm.utm_source = "google";
2521
2536
  utm.utm_medium = utm.utm_medium || "cpc";
2522
- const gadCampaign = params.get("gad_campaignid");
2523
- if (gadCampaign && !utm.utm_campaign) {
2524
- utm.utm_campaign = gadCampaign;
2537
+ if (utm.gad_campaignid && !utm.utm_campaign) {
2538
+ utm.utm_campaign = utm.gad_campaignid;
2525
2539
  }
2526
2540
  }
2527
- if (!utm.utm_source && params.get("fbclid")) {
2541
+ if (!utm.utm_source && fbclid) {
2528
2542
  utm.utm_source = "facebook";
2529
2543
  utm.utm_medium = utm.utm_medium || "cpc";
2530
2544
  }
@@ -2712,14 +2726,22 @@ function useAnalytics(options = {}) {
2712
2726
  const sendEvent = react.useCallback(
2713
2727
  async (event) => {
2714
2728
  const fullEvent = buildFullEvent(event);
2729
+ const payload = JSON.stringify(fullEvent);
2715
2730
  if (analyticsProxyUrl) {
2716
- fetch(analyticsProxyUrl, {
2717
- method: "POST",
2718
- headers: { "Content-Type": "application/json" },
2719
- body: JSON.stringify(fullEvent)
2720
- }).catch((err) => {
2721
- console.debug("[ScaleMule Analytics] Proxy tracking failed:", err);
2722
- });
2731
+ const sent = typeof navigator !== "undefined" && typeof navigator.sendBeacon === "function" && navigator.sendBeacon(
2732
+ analyticsProxyUrl,
2733
+ new Blob([payload], { type: "application/json" })
2734
+ );
2735
+ if (!sent) {
2736
+ fetch(analyticsProxyUrl, {
2737
+ method: "POST",
2738
+ headers: { "Content-Type": "application/json" },
2739
+ body: payload,
2740
+ keepalive: true
2741
+ }).catch((err) => {
2742
+ console.debug("[ScaleMule Analytics] Proxy tracking failed:", err);
2743
+ });
2744
+ }
2723
2745
  return { tracked: 1, session_id: sessionIdRef.current || void 0 };
2724
2746
  }
2725
2747
  if (publishableKey && gatewayUrl) {
@@ -2730,7 +2752,8 @@ function useAnalytics(options = {}) {
2730
2752
  "Content-Type": "application/json",
2731
2753
  "x-api-key": publishableKey
2732
2754
  },
2733
- body: JSON.stringify(fullEvent)
2755
+ body: payload,
2756
+ keepalive: true
2734
2757
  }).catch((err) => {
2735
2758
  console.debug("[ScaleMule Analytics] Direct tracking failed:", err);
2736
2759
  });
@@ -2793,13 +2816,21 @@ function useAnalytics(options = {}) {
2793
2816
  const fullEvents = events.map((event) => buildFullEvent(event));
2794
2817
  if (analyticsProxyUrl) {
2795
2818
  for (const event of fullEvents) {
2796
- fetch(analyticsProxyUrl, {
2797
- method: "POST",
2798
- headers: { "Content-Type": "application/json" },
2799
- body: JSON.stringify(event)
2800
- }).catch((err) => {
2801
- console.debug("[ScaleMule Analytics] Proxy batch tracking failed:", err);
2802
- });
2819
+ const payload = JSON.stringify(event);
2820
+ const sent = typeof navigator !== "undefined" && typeof navigator.sendBeacon === "function" && navigator.sendBeacon(
2821
+ analyticsProxyUrl,
2822
+ new Blob([payload], { type: "application/json" })
2823
+ );
2824
+ if (!sent) {
2825
+ fetch(analyticsProxyUrl, {
2826
+ method: "POST",
2827
+ headers: { "Content-Type": "application/json" },
2828
+ body: payload,
2829
+ keepalive: true
2830
+ }).catch((err) => {
2831
+ console.debug("[ScaleMule Analytics] Proxy batch tracking failed:", err);
2832
+ });
2833
+ }
2803
2834
  }
2804
2835
  setLoading(false);
2805
2836
  return { tracked: events.length, session_id: sessionIdRef.current || void 0 };
@@ -2812,7 +2843,8 @@ function useAnalytics(options = {}) {
2812
2843
  "Content-Type": "application/json",
2813
2844
  "x-api-key": publishableKey
2814
2845
  },
2815
- body: JSON.stringify({ events: fullEvents })
2846
+ body: JSON.stringify({ events: fullEvents }),
2847
+ keepalive: true
2816
2848
  }).catch((err) => {
2817
2849
  console.debug("[ScaleMule Analytics] Direct batch tracking failed:", err);
2818
2850
  });
package/dist/index.mjs CHANGED
@@ -2509,20 +2509,34 @@ function parseUtmParams() {
2509
2509
  const campaign = params.get("utm_campaign");
2510
2510
  const term = params.get("utm_term");
2511
2511
  const content = params.get("utm_content");
2512
+ const adgroup = params.get("utm_adgroup");
2512
2513
  if (source) utm.utm_source = source;
2513
2514
  if (medium) utm.utm_medium = medium;
2514
2515
  if (campaign) utm.utm_campaign = campaign;
2515
2516
  if (term) utm.utm_term = term;
2516
2517
  if (content) utm.utm_content = content;
2517
- if (!utm.utm_source && (params.get("gclid") || params.get("gad_source") || params.get("wbraid") || params.get("gbraid"))) {
2518
+ if (adgroup) utm.utm_adgroup = adgroup;
2519
+ const gclid = params.get("gclid");
2520
+ const gbraid = params.get("gbraid");
2521
+ const wbraid = params.get("wbraid");
2522
+ const fbclid = params.get("fbclid");
2523
+ if (gclid) utm.gclid = gclid;
2524
+ if (gbraid) utm.gbraid = gbraid;
2525
+ if (wbraid) utm.wbraid = wbraid;
2526
+ if (fbclid) utm.fbclid = fbclid;
2527
+ const gadFields = ["gad_source", "gad_campaignid", "gad_adgroupid", "gad_network", "gad_matchtype", "gad_device", "gad_placement"];
2528
+ for (const field of gadFields) {
2529
+ const val = params.get(field);
2530
+ if (val) utm[field] = val;
2531
+ }
2532
+ if (!utm.utm_source && (gclid || utm.gad_source || wbraid || gbraid)) {
2518
2533
  utm.utm_source = "google";
2519
2534
  utm.utm_medium = utm.utm_medium || "cpc";
2520
- const gadCampaign = params.get("gad_campaignid");
2521
- if (gadCampaign && !utm.utm_campaign) {
2522
- utm.utm_campaign = gadCampaign;
2535
+ if (utm.gad_campaignid && !utm.utm_campaign) {
2536
+ utm.utm_campaign = utm.gad_campaignid;
2523
2537
  }
2524
2538
  }
2525
- if (!utm.utm_source && params.get("fbclid")) {
2539
+ if (!utm.utm_source && fbclid) {
2526
2540
  utm.utm_source = "facebook";
2527
2541
  utm.utm_medium = utm.utm_medium || "cpc";
2528
2542
  }
@@ -2710,14 +2724,22 @@ function useAnalytics(options = {}) {
2710
2724
  const sendEvent = useCallback(
2711
2725
  async (event) => {
2712
2726
  const fullEvent = buildFullEvent(event);
2727
+ const payload = JSON.stringify(fullEvent);
2713
2728
  if (analyticsProxyUrl) {
2714
- fetch(analyticsProxyUrl, {
2715
- method: "POST",
2716
- headers: { "Content-Type": "application/json" },
2717
- body: JSON.stringify(fullEvent)
2718
- }).catch((err) => {
2719
- console.debug("[ScaleMule Analytics] Proxy tracking failed:", err);
2720
- });
2729
+ const sent = typeof navigator !== "undefined" && typeof navigator.sendBeacon === "function" && navigator.sendBeacon(
2730
+ analyticsProxyUrl,
2731
+ new Blob([payload], { type: "application/json" })
2732
+ );
2733
+ if (!sent) {
2734
+ fetch(analyticsProxyUrl, {
2735
+ method: "POST",
2736
+ headers: { "Content-Type": "application/json" },
2737
+ body: payload,
2738
+ keepalive: true
2739
+ }).catch((err) => {
2740
+ console.debug("[ScaleMule Analytics] Proxy tracking failed:", err);
2741
+ });
2742
+ }
2721
2743
  return { tracked: 1, session_id: sessionIdRef.current || void 0 };
2722
2744
  }
2723
2745
  if (publishableKey && gatewayUrl) {
@@ -2728,7 +2750,8 @@ function useAnalytics(options = {}) {
2728
2750
  "Content-Type": "application/json",
2729
2751
  "x-api-key": publishableKey
2730
2752
  },
2731
- body: JSON.stringify(fullEvent)
2753
+ body: payload,
2754
+ keepalive: true
2732
2755
  }).catch((err) => {
2733
2756
  console.debug("[ScaleMule Analytics] Direct tracking failed:", err);
2734
2757
  });
@@ -2791,13 +2814,21 @@ function useAnalytics(options = {}) {
2791
2814
  const fullEvents = events.map((event) => buildFullEvent(event));
2792
2815
  if (analyticsProxyUrl) {
2793
2816
  for (const event of fullEvents) {
2794
- fetch(analyticsProxyUrl, {
2795
- method: "POST",
2796
- headers: { "Content-Type": "application/json" },
2797
- body: JSON.stringify(event)
2798
- }).catch((err) => {
2799
- console.debug("[ScaleMule Analytics] Proxy batch tracking failed:", err);
2800
- });
2817
+ const payload = JSON.stringify(event);
2818
+ const sent = typeof navigator !== "undefined" && typeof navigator.sendBeacon === "function" && navigator.sendBeacon(
2819
+ analyticsProxyUrl,
2820
+ new Blob([payload], { type: "application/json" })
2821
+ );
2822
+ if (!sent) {
2823
+ fetch(analyticsProxyUrl, {
2824
+ method: "POST",
2825
+ headers: { "Content-Type": "application/json" },
2826
+ body: payload,
2827
+ keepalive: true
2828
+ }).catch((err) => {
2829
+ console.debug("[ScaleMule Analytics] Proxy batch tracking failed:", err);
2830
+ });
2831
+ }
2801
2832
  }
2802
2833
  setLoading(false);
2803
2834
  return { tracked: events.length, session_id: sessionIdRef.current || void 0 };
@@ -2810,7 +2841,8 @@ function useAnalytics(options = {}) {
2810
2841
  "Content-Type": "application/json",
2811
2842
  "x-api-key": publishableKey
2812
2843
  },
2813
- body: JSON.stringify({ events: fullEvents })
2844
+ body: JSON.stringify({ events: fullEvents }),
2845
+ keepalive: true
2814
2846
  }).catch((err) => {
2815
2847
  console.debug("[ScaleMule Analytics] Direct batch tracking failed:", err);
2816
2848
  });
@@ -1,6 +1,6 @@
1
- import { S as ServerConfig } from '../webhook-handler-BlklRG--.mjs';
2
- export { a as ScaleMuleServer, e as VideoFailedEvent, V as VideoReadyEvent, g as VideoTranscodedEvent, f as VideoUploadedEvent, W as WebhookEvent, h as WebhookRoutesConfig, c as createServerClient, i as createWebhookHandler, d as createWebhookRoutes, p as parseWebhookEvent, b as registerVideoWebhook, r as resolveGatewayUrl, v as verifyWebhookSignature } from '../webhook-handler-BlklRG--.mjs';
3
- import { $ as ClientContext, A as ApiError } from '../index-CYS_FzSf.mjs';
1
+ import { S as ServerConfig } from '../webhook-handler-DS0r_w4M.mjs';
2
+ export { a as ScaleMuleServer, e as VideoFailedEvent, V as VideoReadyEvent, g as VideoTranscodedEvent, f as VideoUploadedEvent, W as WebhookEvent, h as WebhookRoutesConfig, c as createServerClient, i as createWebhookHandler, d as createWebhookRoutes, p as parseWebhookEvent, b as registerVideoWebhook, r as resolveGatewayUrl, v as verifyWebhookSignature } from '../webhook-handler-DS0r_w4M.mjs';
3
+ import { $ as ClientContext, A as ApiError } from '../index-DewTyMF2.mjs';
4
4
  import { NextRequest, NextResponse } from 'next/server';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { S as ServerConfig } from '../webhook-handler-DHCE2Utl.js';
2
- export { a as ScaleMuleServer, e as VideoFailedEvent, V as VideoReadyEvent, g as VideoTranscodedEvent, f as VideoUploadedEvent, W as WebhookEvent, h as WebhookRoutesConfig, c as createServerClient, i as createWebhookHandler, d as createWebhookRoutes, p as parseWebhookEvent, b as registerVideoWebhook, r as resolveGatewayUrl, v as verifyWebhookSignature } from '../webhook-handler-DHCE2Utl.js';
3
- import { $ as ClientContext, A as ApiError } from '../index-CYS_FzSf.js';
1
+ import { S as ServerConfig } from '../webhook-handler-CQ2lZgy0.js';
2
+ export { a as ScaleMuleServer, e as VideoFailedEvent, V as VideoReadyEvent, g as VideoTranscodedEvent, f as VideoUploadedEvent, W as WebhookEvent, h as WebhookRoutesConfig, c as createServerClient, i as createWebhookHandler, d as createWebhookRoutes, p as parseWebhookEvent, b as registerVideoWebhook, r as resolveGatewayUrl, v as verifyWebhookSignature } from '../webhook-handler-CQ2lZgy0.js';
3
+ import { $ as ClientContext, A as ApiError } from '../index-DewTyMF2.js';
4
4
  import { NextRequest, NextResponse } from 'next/server';
5
5
 
6
6
  /**
@@ -1,2 +1,2 @@
1
- export { i as createWebhookHandler } from '../webhook-handler-BlklRG--.mjs';
2
- import '../index-CYS_FzSf.mjs';
1
+ export { i as createWebhookHandler } from '../webhook-handler-DS0r_w4M.mjs';
2
+ import '../index-DewTyMF2.mjs';
@@ -1,2 +1,2 @@
1
- export { i as createWebhookHandler } from '../webhook-handler-DHCE2Utl.js';
2
- import '../index-CYS_FzSf.js';
1
+ export { i as createWebhookHandler } from '../webhook-handler-CQ2lZgy0.js';
2
+ import '../index-DewTyMF2.js';
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { U as User, N as StorageFile, A as ApiError } from './index-CYS_FzSf.mjs';
3
+ import { U as User, N as StorageFile, A as ApiError } from './index-DewTyMF2.mjs';
4
4
 
5
5
  interface MockUserOptions {
6
6
  id?: string;
package/dist/testing.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { U as User, N as StorageFile, A as ApiError } from './index-CYS_FzSf.js';
3
+ import { U as User, N as StorageFile, A as ApiError } from './index-DewTyMF2.js';
4
4
 
5
5
  interface MockUserOptions {
6
6
  id?: string;
@@ -1,4 +1,4 @@
1
- import { R as RegisterRequest, $ as ClientContext, U as User, l as LoginRequest, L as LoginResponse, c as ListFilesParams, T as ListFilesResponse, N as StorageFile, W as UploadResponse } from './index-CYS_FzSf.js';
1
+ import { R as RegisterRequest, $ as ClientContext, U as User, l as LoginRequest, L as LoginResponse, c as ListFilesParams, T as ListFilesResponse, N as StorageFile, W as UploadResponse } from './index-DewTyMF2.js';
2
2
 
3
3
  /**
4
4
  * Server-Side ScaleMule Client
@@ -1,4 +1,4 @@
1
- import { R as RegisterRequest, $ as ClientContext, U as User, l as LoginRequest, L as LoginResponse, c as ListFilesParams, T as ListFilesResponse, N as StorageFile, W as UploadResponse } from './index-CYS_FzSf.mjs';
1
+ import { R as RegisterRequest, $ as ClientContext, U as User, l as LoginRequest, L as LoginResponse, c as ListFilesParams, T as ListFilesResponse, N as StorageFile, W as UploadResponse } from './index-DewTyMF2.mjs';
2
2
 
3
3
  /**
4
4
  * Server-Side ScaleMule Client
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalemule/nextjs",
3
- "version": "0.0.26",
3
+ "version": "0.0.28",
4
4
  "description": "ScaleMule SDK for Next.js applications - authentication, storage, and user management",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",