posthog-js 1.310.2 → 1.311.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.
@@ -4059,6 +4059,45 @@ declare class PostHog {
4059
4059
  * @public
4060
4060
  */
4061
4061
  reloadFeatureFlags(): void;
4062
+ /**
4063
+ * Manually update feature flag values without making a network request.
4064
+ *
4065
+ * This is useful when you have feature flag values from an external source
4066
+ * (e.g., server-side evaluation, edge middleware) and want to inject them
4067
+ * into the client SDK.
4068
+ *
4069
+ * {@label Feature flags}
4070
+ *
4071
+ * @example
4072
+ * ```js
4073
+ * // Replace all flags with server-evaluated values
4074
+ * posthog.updateFlags({
4075
+ * 'my-flag': true,
4076
+ * 'my-experiment': 'variant-a'
4077
+ * })
4078
+ *
4079
+ * // Merge with existing flags (update only specified flags)
4080
+ * posthog.updateFlags(
4081
+ * { 'my-flag': true },
4082
+ * undefined,
4083
+ * { merge: true }
4084
+ * )
4085
+ *
4086
+ * // With payloads
4087
+ * posthog.updateFlags(
4088
+ * { 'my-flag': true },
4089
+ * { 'my-flag': { some: 'data' } }
4090
+ * )
4091
+ * ```
4092
+ *
4093
+ * @param flags - An object mapping flag keys to their values (boolean or string variant)
4094
+ * @param payloads - Optional object mapping flag keys to their JSON payloads
4095
+ * @param options - Optional settings. Use `{ merge: true }` to merge with existing flags instead of replacing.
4096
+ * @public
4097
+ */
4098
+ updateFlags(flags: Record<string, boolean | string>, payloads?: Record<string, JsonType>, options?: {
4099
+ merge?: boolean;
4100
+ }): void;
4062
4101
  /**
4063
4102
  * Opt the user in or out of an early access feature. [Learn more in the docs](/docs/feature-flags/early-access-feature-management#option-2-custom-implementation)
4064
4103
  *