@solomei-ai/intent 1.9.2 → 1.10.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.
@@ -7,12 +7,39 @@ type InitOptions = {
7
7
  sidMaxAgeSeconds?: number;
8
8
  debug?: boolean;
9
9
  };
10
- declare function setFlag(name: string, yes: boolean | undefined | string): void;
10
+ /**
11
+ * Valid flag names for the Intent SDK
12
+ */
13
+ type FlagName = 'intent:consent' | 'intent:geo' | 'intent:debug';
14
+ /**
15
+ * Generic flag setter - prefer using specific functions like setConsent(), setGeo(), setDebug()
16
+ * @param name - The flag name to set
17
+ * @param yes - Boolean value to enable (true) or disable (false). Undefined will skip setting.
18
+ * @deprecated This entire function will be removed in v2.0.0 (February 2026 - 2 months).
19
+ * Migrate to type-safe functions: setConsent(), setGeo(), or setDebug().
20
+ * See migration guide in README for details.
21
+ */
22
+ declare function setFlag(name: FlagName | string, yes: boolean | undefined | string): void;
23
+ /**
24
+ * Set consent flag - controls whether the SDK tracks user activity
25
+ * @param granted - true to grant consent, false to revoke consent
26
+ */
27
+ declare function setConsent(granted: boolean): void;
28
+ /**
29
+ * Set geolocation flag - controls whether the SDK captures device location
30
+ * @param enabled - true to enable geolocation, false to disable
31
+ */
32
+ declare function setGeo(enabled: boolean): void;
33
+ /**
34
+ * Set debug flag - controls whether the SDK outputs debug logs
35
+ * @param enabled - true to enable debug logging, false to disable
36
+ */
37
+ declare function setDebug(enabled: boolean): void;
11
38
  declare function initIntent(opts?: InitOptions): void;
12
39
  declare function getIntentSessionId(): string | undefined;
13
40
  declare function ensureIntentSessionId(): void;
14
41
  declare function clearIntentSessionId(): void;
15
42
  declare function setIntentSessionMaxAge(seconds: number): void;
16
43
 
17
- export { clearIntentSessionId, ensureIntentSessionId, getIntentSessionId, initIntent, setFlag, setIntentSessionMaxAge };
18
- export type { InitOptions };
44
+ export { clearIntentSessionId, ensureIntentSessionId, getIntentSessionId, initIntent, setConsent, setDebug, setFlag, setGeo, setIntentSessionMaxAge };
45
+ export type { FlagName, InitOptions };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solomei-ai/intent",
3
- "version": "1.9.2",
3
+ "version": "1.10.0",
4
4
  "description": "Lightweight browser SDK for intent events (client-only).",
5
5
  "type": "module",
6
6
  "module": "dist/esm/index.js",