@scalemule/nextjs 0.0.9 → 0.0.10

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
@@ -257,6 +257,32 @@ declare function useRealtime(options?: UseRealtimeOptions): UseRealtimeReturn;
257
257
  */
258
258
  declare function useAnalytics(options?: UseAnalyticsOptions): UseAnalyticsReturn;
259
259
 
260
+ interface FeatureFlagEvaluation<T = unknown> {
261
+ flag_id: string;
262
+ flag_key: string;
263
+ environment: string;
264
+ value: T;
265
+ reason: string;
266
+ matched_rule_id?: string | null;
267
+ variant_key?: string | null;
268
+ bucket?: number | null;
269
+ }
270
+ interface UseFeatureFlagsOptions {
271
+ environment?: string;
272
+ context?: Record<string, unknown>;
273
+ keys?: string[];
274
+ enabled?: boolean;
275
+ }
276
+ interface UseFeatureFlagsReturn {
277
+ flags: Record<string, FeatureFlagEvaluation>;
278
+ loading: boolean;
279
+ error: ApiError | null;
280
+ refresh: () => Promise<void>;
281
+ isEnabled: (flagKey: string, fallback?: boolean) => boolean;
282
+ getFlag: <T = unknown>(flagKey: string, fallback?: T) => T;
283
+ }
284
+ declare function useFeatureFlags(options?: UseFeatureFlagsOptions): UseFeatureFlagsReturn;
285
+
260
286
  /**
261
287
  * Client-side validation helpers
262
288
  *
@@ -415,4 +441,4 @@ declare function createSafeLogger(prefix: string): {
415
441
  error: (message: string, data?: unknown) => void;
416
442
  };
417
443
 
418
- export { ApiError, ListFilesParams, LoginResponse, type PasswordValidationResult, type PhoneCountry, type PhoneValidationResult, type RealtimeEvent, type RealtimeMessage, type RealtimeStatus, ScaleMuleClient, ScaleMuleConfig, ScaleMuleProvider, type ScaleMuleProviderProps, UseAnalyticsOptions, UseAnalyticsReturn, UseAuthReturn, UseBillingReturn, UseContentReturn, type UseRealtimeOptions, type UseRealtimeReturn, UseUserReturn, User, type UsernameValidationResult, composePhone, createSafeLogger, normalizePhone, phoneCountries, sanitizeForLog, useAnalytics, useAuth, useBilling, useContent, useRealtime, useScaleMule, useScaleMuleClient, useUser, validateForm, validators };
444
+ export { ApiError, type FeatureFlagEvaluation, type FeatureFlagEvaluation as FeatureFlagResult, ListFilesParams, LoginResponse, type PasswordValidationResult, type PhoneCountry, type PhoneValidationResult, type RealtimeEvent, type RealtimeMessage, type RealtimeStatus, ScaleMuleClient, ScaleMuleConfig, ScaleMuleProvider, type ScaleMuleProviderProps, UseAnalyticsOptions, UseAnalyticsReturn, UseAuthReturn, UseBillingReturn, UseContentReturn, type UseFeatureFlagsOptions, type UseFeatureFlagsReturn, type UseFeatureFlagsOptions as UseFlagsOptions, type UseFeatureFlagsReturn as UseFlagsReturn, type UseRealtimeOptions, type UseRealtimeReturn, UseUserReturn, User, type UsernameValidationResult, composePhone, createSafeLogger, normalizePhone, phoneCountries, sanitizeForLog, useAnalytics, useAuth, useBilling, useContent, useFeatureFlags, useRealtime, useScaleMule, useScaleMuleClient, useUser, validateForm, validators };
package/dist/index.d.ts CHANGED
@@ -257,6 +257,32 @@ declare function useRealtime(options?: UseRealtimeOptions): UseRealtimeReturn;
257
257
  */
258
258
  declare function useAnalytics(options?: UseAnalyticsOptions): UseAnalyticsReturn;
259
259
 
260
+ interface FeatureFlagEvaluation<T = unknown> {
261
+ flag_id: string;
262
+ flag_key: string;
263
+ environment: string;
264
+ value: T;
265
+ reason: string;
266
+ matched_rule_id?: string | null;
267
+ variant_key?: string | null;
268
+ bucket?: number | null;
269
+ }
270
+ interface UseFeatureFlagsOptions {
271
+ environment?: string;
272
+ context?: Record<string, unknown>;
273
+ keys?: string[];
274
+ enabled?: boolean;
275
+ }
276
+ interface UseFeatureFlagsReturn {
277
+ flags: Record<string, FeatureFlagEvaluation>;
278
+ loading: boolean;
279
+ error: ApiError | null;
280
+ refresh: () => Promise<void>;
281
+ isEnabled: (flagKey: string, fallback?: boolean) => boolean;
282
+ getFlag: <T = unknown>(flagKey: string, fallback?: T) => T;
283
+ }
284
+ declare function useFeatureFlags(options?: UseFeatureFlagsOptions): UseFeatureFlagsReturn;
285
+
260
286
  /**
261
287
  * Client-side validation helpers
262
288
  *
@@ -415,4 +441,4 @@ declare function createSafeLogger(prefix: string): {
415
441
  error: (message: string, data?: unknown) => void;
416
442
  };
417
443
 
418
- export { ApiError, ListFilesParams, LoginResponse, type PasswordValidationResult, type PhoneCountry, type PhoneValidationResult, type RealtimeEvent, type RealtimeMessage, type RealtimeStatus, ScaleMuleClient, ScaleMuleConfig, ScaleMuleProvider, type ScaleMuleProviderProps, UseAnalyticsOptions, UseAnalyticsReturn, UseAuthReturn, UseBillingReturn, UseContentReturn, type UseRealtimeOptions, type UseRealtimeReturn, UseUserReturn, User, type UsernameValidationResult, composePhone, createSafeLogger, normalizePhone, phoneCountries, sanitizeForLog, useAnalytics, useAuth, useBilling, useContent, useRealtime, useScaleMule, useScaleMuleClient, useUser, validateForm, validators };
444
+ export { ApiError, type FeatureFlagEvaluation, type FeatureFlagEvaluation as FeatureFlagResult, ListFilesParams, LoginResponse, type PasswordValidationResult, type PhoneCountry, type PhoneValidationResult, type RealtimeEvent, type RealtimeMessage, type RealtimeStatus, ScaleMuleClient, ScaleMuleConfig, ScaleMuleProvider, type ScaleMuleProviderProps, UseAnalyticsOptions, UseAnalyticsReturn, UseAuthReturn, UseBillingReturn, UseContentReturn, type UseFeatureFlagsOptions, type UseFeatureFlagsReturn, type UseFeatureFlagsOptions as UseFlagsOptions, type UseFeatureFlagsReturn as UseFlagsReturn, type UseRealtimeOptions, type UseRealtimeReturn, UseUserReturn, User, type UsernameValidationResult, composePhone, createSafeLogger, normalizePhone, phoneCountries, sanitizeForLog, useAnalytics, useAuth, useBilling, useContent, useFeatureFlags, useRealtime, useScaleMule, useScaleMuleClient, useUser, validateForm, validators };
package/dist/index.js CHANGED
@@ -2831,6 +2831,80 @@ function useAnalytics(options = {}) {
2831
2831
  ]
2832
2832
  );
2833
2833
  }
2834
+ function toApiError(error) {
2835
+ if (error instanceof ScaleMuleApiError) {
2836
+ return {
2837
+ code: error.code,
2838
+ message: error.message,
2839
+ field: error.field
2840
+ };
2841
+ }
2842
+ return {
2843
+ code: "UNKNOWN",
2844
+ message: error instanceof Error ? error.message : "Failed to load feature flags"
2845
+ };
2846
+ }
2847
+ function useFeatureFlags(options = {}) {
2848
+ const {
2849
+ environment = "prod",
2850
+ context = {},
2851
+ keys,
2852
+ enabled = true
2853
+ } = options;
2854
+ const { client } = useScaleMule();
2855
+ const [flags, setFlags] = react.useState({});
2856
+ const [loading, setLoading] = react.useState(enabled);
2857
+ const [error, setError] = react.useState(null);
2858
+ const contextRef = react.useRef(context);
2859
+ const keysKey = react.useMemo(() => keys && keys.length > 0 ? [...keys].sort().join("|") : "", [keys]);
2860
+ react.useEffect(() => {
2861
+ contextRef.current = context;
2862
+ }, [context]);
2863
+ const refresh = react.useCallback(async () => {
2864
+ if (!enabled) {
2865
+ setLoading(false);
2866
+ return;
2867
+ }
2868
+ setLoading(true);
2869
+ try {
2870
+ const payload = keys && keys.length > 0 ? { flag_keys: keys, environment, context: contextRef.current } : { environment, context: contextRef.current };
2871
+ const result = keys && keys.length > 0 ? await client.post("/v1/flags/evaluate/batch", payload) : await client.post("/v1/flags/evaluate/all", payload);
2872
+ setFlags(result || {});
2873
+ setError(null);
2874
+ } catch (err) {
2875
+ setError(toApiError(err));
2876
+ } finally {
2877
+ setLoading(false);
2878
+ }
2879
+ }, [client, enabled, environment, keys, keysKey]);
2880
+ react.useEffect(() => {
2881
+ void refresh();
2882
+ }, [refresh]);
2883
+ const isEnabled = react.useCallback(
2884
+ (flagKey, fallback = false) => {
2885
+ const evaluation = flags[flagKey];
2886
+ if (!evaluation) return fallback;
2887
+ return typeof evaluation.value === "boolean" ? evaluation.value : fallback;
2888
+ },
2889
+ [flags]
2890
+ );
2891
+ const getFlag = react.useCallback(
2892
+ (flagKey, fallback) => {
2893
+ const evaluation = flags[flagKey];
2894
+ if (!evaluation) return fallback;
2895
+ return evaluation.value ?? fallback;
2896
+ },
2897
+ [flags]
2898
+ );
2899
+ return {
2900
+ flags,
2901
+ loading,
2902
+ error,
2903
+ refresh,
2904
+ isEnabled,
2905
+ getFlag
2906
+ };
2907
+ }
2834
2908
 
2835
2909
  // src/validation.ts
2836
2910
  var phoneCountries = [
@@ -3136,6 +3210,7 @@ exports.useAnalytics = useAnalytics;
3136
3210
  exports.useAuth = useAuth;
3137
3211
  exports.useBilling = useBilling;
3138
3212
  exports.useContent = useContent;
3213
+ exports.useFeatureFlags = useFeatureFlags;
3139
3214
  exports.useRealtime = useRealtime;
3140
3215
  exports.useScaleMule = useScaleMule;
3141
3216
  exports.useScaleMuleClient = useScaleMuleClient;
package/dist/index.mjs CHANGED
@@ -2829,6 +2829,80 @@ function useAnalytics(options = {}) {
2829
2829
  ]
2830
2830
  );
2831
2831
  }
2832
+ function toApiError(error) {
2833
+ if (error instanceof ScaleMuleApiError) {
2834
+ return {
2835
+ code: error.code,
2836
+ message: error.message,
2837
+ field: error.field
2838
+ };
2839
+ }
2840
+ return {
2841
+ code: "UNKNOWN",
2842
+ message: error instanceof Error ? error.message : "Failed to load feature flags"
2843
+ };
2844
+ }
2845
+ function useFeatureFlags(options = {}) {
2846
+ const {
2847
+ environment = "prod",
2848
+ context = {},
2849
+ keys,
2850
+ enabled = true
2851
+ } = options;
2852
+ const { client } = useScaleMule();
2853
+ const [flags, setFlags] = useState({});
2854
+ const [loading, setLoading] = useState(enabled);
2855
+ const [error, setError] = useState(null);
2856
+ const contextRef = useRef(context);
2857
+ const keysKey = useMemo(() => keys && keys.length > 0 ? [...keys].sort().join("|") : "", [keys]);
2858
+ useEffect(() => {
2859
+ contextRef.current = context;
2860
+ }, [context]);
2861
+ const refresh = useCallback(async () => {
2862
+ if (!enabled) {
2863
+ setLoading(false);
2864
+ return;
2865
+ }
2866
+ setLoading(true);
2867
+ try {
2868
+ const payload = keys && keys.length > 0 ? { flag_keys: keys, environment, context: contextRef.current } : { environment, context: contextRef.current };
2869
+ const result = keys && keys.length > 0 ? await client.post("/v1/flags/evaluate/batch", payload) : await client.post("/v1/flags/evaluate/all", payload);
2870
+ setFlags(result || {});
2871
+ setError(null);
2872
+ } catch (err) {
2873
+ setError(toApiError(err));
2874
+ } finally {
2875
+ setLoading(false);
2876
+ }
2877
+ }, [client, enabled, environment, keys, keysKey]);
2878
+ useEffect(() => {
2879
+ void refresh();
2880
+ }, [refresh]);
2881
+ const isEnabled = useCallback(
2882
+ (flagKey, fallback = false) => {
2883
+ const evaluation = flags[flagKey];
2884
+ if (!evaluation) return fallback;
2885
+ return typeof evaluation.value === "boolean" ? evaluation.value : fallback;
2886
+ },
2887
+ [flags]
2888
+ );
2889
+ const getFlag = useCallback(
2890
+ (flagKey, fallback) => {
2891
+ const evaluation = flags[flagKey];
2892
+ if (!evaluation) return fallback;
2893
+ return evaluation.value ?? fallback;
2894
+ },
2895
+ [flags]
2896
+ );
2897
+ return {
2898
+ flags,
2899
+ loading,
2900
+ error,
2901
+ refresh,
2902
+ isEnabled,
2903
+ getFlag
2904
+ };
2905
+ }
2832
2906
 
2833
2907
  // src/validation.ts
2834
2908
  var phoneCountries = [
@@ -3121,4 +3195,4 @@ function createSafeLogger(prefix) {
3121
3195
  };
3122
3196
  }
3123
3197
 
3124
- export { ScaleMuleApiError, ScaleMuleClient, ScaleMuleProvider, composePhone, createClient, createSafeLogger, normalizePhone, phoneCountries, sanitizeForLog, useAnalytics, useAuth, useBilling, useContent, useRealtime, useScaleMule, useScaleMuleClient, useUser, validateForm, validators };
3198
+ export { ScaleMuleApiError, ScaleMuleClient, ScaleMuleProvider, composePhone, createClient, createSafeLogger, normalizePhone, phoneCountries, sanitizeForLog, useAnalytics, useAuth, useBilling, useContent, useFeatureFlags, useRealtime, useScaleMule, useScaleMuleClient, useUser, validateForm, validators };
@@ -655,6 +655,37 @@ var ScaleMuleServer = class {
655
655
  });
656
656
  }
657
657
  };
658
+ this.flags = {
659
+ evaluate: async (flagKey, context = {}, environment = "prod", options) => {
660
+ return this.request("POST", "/v1/flags/evaluate", {
661
+ body: {
662
+ flag_key: flagKey,
663
+ environment,
664
+ context
665
+ },
666
+ clientContext: options?.clientContext
667
+ });
668
+ },
669
+ evaluateBatch: async (flagKeys, context = {}, environment = "prod", options) => {
670
+ return this.request("POST", "/v1/flags/evaluate/batch", {
671
+ body: {
672
+ flag_keys: flagKeys,
673
+ environment,
674
+ context
675
+ },
676
+ clientContext: options?.clientContext
677
+ });
678
+ },
679
+ evaluateAll: async (context = {}, environment = "prod", options) => {
680
+ return this.request("POST", "/v1/flags/evaluate/all", {
681
+ body: {
682
+ environment,
683
+ context
684
+ },
685
+ clientContext: options?.clientContext
686
+ });
687
+ }
688
+ };
658
689
  this.apiKey = config.apiKey;
659
690
  this.gatewayUrl = resolveGatewayUrl(config);
660
691
  this.debug = config.debug || false;
@@ -653,6 +653,37 @@ var ScaleMuleServer = class {
653
653
  });
654
654
  }
655
655
  };
656
+ this.flags = {
657
+ evaluate: async (flagKey, context = {}, environment = "prod", options) => {
658
+ return this.request("POST", "/v1/flags/evaluate", {
659
+ body: {
660
+ flag_key: flagKey,
661
+ environment,
662
+ context
663
+ },
664
+ clientContext: options?.clientContext
665
+ });
666
+ },
667
+ evaluateBatch: async (flagKeys, context = {}, environment = "prod", options) => {
668
+ return this.request("POST", "/v1/flags/evaluate/batch", {
669
+ body: {
670
+ flag_keys: flagKeys,
671
+ environment,
672
+ context
673
+ },
674
+ clientContext: options?.clientContext
675
+ });
676
+ },
677
+ evaluateAll: async (context = {}, environment = "prod", options) => {
678
+ return this.request("POST", "/v1/flags/evaluate/all", {
679
+ body: {
680
+ environment,
681
+ context
682
+ },
683
+ clientContext: options?.clientContext
684
+ });
685
+ }
686
+ };
656
687
  this.apiKey = config.apiKey;
657
688
  this.gatewayUrl = resolveGatewayUrl(config);
658
689
  this.debug = config.debug || false;
@@ -1,5 +1,5 @@
1
- import { S as ServerConfig } from '../webhook-handler-BzBvYbZU.mjs';
2
- export { a as ScaleMuleServer, d as VideoFailedEvent, V as VideoReadyEvent, f as VideoTranscodedEvent, e as VideoUploadedEvent, W as WebhookEvent, g as WebhookRoutesConfig, c as createServerClient, h as createWebhookHandler, b as createWebhookRoutes, p as parseWebhookEvent, r as registerVideoWebhook, v as verifyWebhookSignature } from '../webhook-handler-BzBvYbZU.mjs';
1
+ import { S as ServerConfig } from '../webhook-handler-CweF_nT3.mjs';
2
+ export { a as ScaleMuleServer, d as VideoFailedEvent, V as VideoReadyEvent, f as VideoTranscodedEvent, e as VideoUploadedEvent, W as WebhookEvent, g as WebhookRoutesConfig, c as createServerClient, h as createWebhookHandler, b as createWebhookRoutes, p as parseWebhookEvent, r as registerVideoWebhook, v as verifyWebhookSignature } from '../webhook-handler-CweF_nT3.mjs';
3
3
  import { $ as ClientContext, L as LoginResponse, A as ApiError } from '../index-jomBa89d.mjs';
4
4
  import { NextRequest, NextResponse } from 'next/server';
5
5
 
@@ -1,5 +1,5 @@
1
- import { S as ServerConfig } from '../webhook-handler-tcJtRpkE.js';
2
- export { a as ScaleMuleServer, d as VideoFailedEvent, V as VideoReadyEvent, f as VideoTranscodedEvent, e as VideoUploadedEvent, W as WebhookEvent, g as WebhookRoutesConfig, c as createServerClient, h as createWebhookHandler, b as createWebhookRoutes, p as parseWebhookEvent, r as registerVideoWebhook, v as verifyWebhookSignature } from '../webhook-handler-tcJtRpkE.js';
1
+ import { S as ServerConfig } from '../webhook-handler-Bi3bMNty.js';
2
+ export { a as ScaleMuleServer, d as VideoFailedEvent, V as VideoReadyEvent, f as VideoTranscodedEvent, e as VideoUploadedEvent, W as WebhookEvent, g as WebhookRoutesConfig, c as createServerClient, h as createWebhookHandler, b as createWebhookRoutes, p as parseWebhookEvent, r as registerVideoWebhook, v as verifyWebhookSignature } from '../webhook-handler-Bi3bMNty.js';
3
3
  import { $ as ClientContext, L as LoginResponse, A as ApiError } from '../index-jomBa89d.js';
4
4
  import { NextRequest, NextResponse } from 'next/server';
5
5
 
@@ -715,6 +715,37 @@ var ScaleMuleServer = class {
715
715
  });
716
716
  }
717
717
  };
718
+ this.flags = {
719
+ evaluate: async (flagKey, context = {}, environment = "prod", options) => {
720
+ return this.request("POST", "/v1/flags/evaluate", {
721
+ body: {
722
+ flag_key: flagKey,
723
+ environment,
724
+ context
725
+ },
726
+ clientContext: options?.clientContext
727
+ });
728
+ },
729
+ evaluateBatch: async (flagKeys, context = {}, environment = "prod", options) => {
730
+ return this.request("POST", "/v1/flags/evaluate/batch", {
731
+ body: {
732
+ flag_keys: flagKeys,
733
+ environment,
734
+ context
735
+ },
736
+ clientContext: options?.clientContext
737
+ });
738
+ },
739
+ evaluateAll: async (context = {}, environment = "prod", options) => {
740
+ return this.request("POST", "/v1/flags/evaluate/all", {
741
+ body: {
742
+ environment,
743
+ context
744
+ },
745
+ clientContext: options?.clientContext
746
+ });
747
+ }
748
+ };
718
749
  this.apiKey = config.apiKey;
719
750
  this.gatewayUrl = resolveGatewayUrl(config);
720
751
  this.debug = config.debug || false;
@@ -713,6 +713,37 @@ var ScaleMuleServer = class {
713
713
  });
714
714
  }
715
715
  };
716
+ this.flags = {
717
+ evaluate: async (flagKey, context = {}, environment = "prod", options) => {
718
+ return this.request("POST", "/v1/flags/evaluate", {
719
+ body: {
720
+ flag_key: flagKey,
721
+ environment,
722
+ context
723
+ },
724
+ clientContext: options?.clientContext
725
+ });
726
+ },
727
+ evaluateBatch: async (flagKeys, context = {}, environment = "prod", options) => {
728
+ return this.request("POST", "/v1/flags/evaluate/batch", {
729
+ body: {
730
+ flag_keys: flagKeys,
731
+ environment,
732
+ context
733
+ },
734
+ clientContext: options?.clientContext
735
+ });
736
+ },
737
+ evaluateAll: async (context = {}, environment = "prod", options) => {
738
+ return this.request("POST", "/v1/flags/evaluate/all", {
739
+ body: {
740
+ environment,
741
+ context
742
+ },
743
+ clientContext: options?.clientContext
744
+ });
745
+ }
746
+ };
716
747
  this.apiKey = config.apiKey;
717
748
  this.gatewayUrl = resolveGatewayUrl(config);
718
749
  this.debug = config.debug || false;
@@ -1,2 +1,2 @@
1
- export { h as createWebhookHandler } from '../webhook-handler-BzBvYbZU.mjs';
1
+ export { h as createWebhookHandler } from '../webhook-handler-CweF_nT3.mjs';
2
2
  import '../index-jomBa89d.mjs';
@@ -1,2 +1,2 @@
1
- export { h as createWebhookHandler } from '../webhook-handler-tcJtRpkE.js';
1
+ export { h as createWebhookHandler } from '../webhook-handler-Bi3bMNty.js';
2
2
  import '../index-jomBa89d.js';
@@ -523,6 +523,44 @@ declare class ScaleMuleServer {
523
523
  tracked: number;
524
524
  }>;
525
525
  };
526
+ flags: {
527
+ evaluate: <T = unknown>(flagKey: string, context?: Record<string, unknown>, environment?: string, options?: {
528
+ clientContext?: ClientContext;
529
+ }) => Promise<{
530
+ flag_id: string;
531
+ flag_key: string;
532
+ environment: string;
533
+ value: T;
534
+ reason: string;
535
+ matched_rule_id?: string | null;
536
+ variant_key?: string | null;
537
+ bucket?: number | null;
538
+ }>;
539
+ evaluateBatch: (flagKeys: string[], context?: Record<string, unknown>, environment?: string, options?: {
540
+ clientContext?: ClientContext;
541
+ }) => Promise<Record<string, {
542
+ flag_id: string;
543
+ flag_key: string;
544
+ environment: string;
545
+ value: unknown;
546
+ reason: string;
547
+ matched_rule_id?: string | null;
548
+ variant_key?: string | null;
549
+ bucket?: number | null;
550
+ }>>;
551
+ evaluateAll: (context?: Record<string, unknown>, environment?: string, options?: {
552
+ clientContext?: ClientContext;
553
+ }) => Promise<Record<string, {
554
+ flag_id: string;
555
+ flag_key: string;
556
+ environment: string;
557
+ value: unknown;
558
+ reason: string;
559
+ matched_rule_id?: string | null;
560
+ variant_key?: string | null;
561
+ bucket?: number | null;
562
+ }>>;
563
+ };
526
564
  }
527
565
  /**
528
566
  * Create a server client with environment-based defaults
@@ -523,6 +523,44 @@ declare class ScaleMuleServer {
523
523
  tracked: number;
524
524
  }>;
525
525
  };
526
+ flags: {
527
+ evaluate: <T = unknown>(flagKey: string, context?: Record<string, unknown>, environment?: string, options?: {
528
+ clientContext?: ClientContext;
529
+ }) => Promise<{
530
+ flag_id: string;
531
+ flag_key: string;
532
+ environment: string;
533
+ value: T;
534
+ reason: string;
535
+ matched_rule_id?: string | null;
536
+ variant_key?: string | null;
537
+ bucket?: number | null;
538
+ }>;
539
+ evaluateBatch: (flagKeys: string[], context?: Record<string, unknown>, environment?: string, options?: {
540
+ clientContext?: ClientContext;
541
+ }) => Promise<Record<string, {
542
+ flag_id: string;
543
+ flag_key: string;
544
+ environment: string;
545
+ value: unknown;
546
+ reason: string;
547
+ matched_rule_id?: string | null;
548
+ variant_key?: string | null;
549
+ bucket?: number | null;
550
+ }>>;
551
+ evaluateAll: (context?: Record<string, unknown>, environment?: string, options?: {
552
+ clientContext?: ClientContext;
553
+ }) => Promise<Record<string, {
554
+ flag_id: string;
555
+ flag_key: string;
556
+ environment: string;
557
+ value: unknown;
558
+ reason: string;
559
+ matched_rule_id?: string | null;
560
+ variant_key?: string | null;
561
+ bucket?: number | null;
562
+ }>>;
563
+ };
526
564
  }
527
565
  /**
528
566
  * Create a server client with environment-based defaults
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalemule/nextjs",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
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",