@solomei-ai/intent 1.9.3 → 1.11.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.
@@ -6,13 +6,66 @@ type InitOptions = {
6
6
  geo?: boolean;
7
7
  sidMaxAgeSeconds?: number;
8
8
  debug?: boolean;
9
+ /**
10
+ * @internal - For development/debugging only. Only available in debug builds.
11
+ * Use `@solomei-ai/intent/debug` or `intent.debug.umd.min.js` to access this feature.
12
+ */
13
+ debugPanel?: boolean;
9
14
  };
10
- declare function setFlag(name: string, yes: boolean | undefined | string): void;
15
+ /**
16
+ * Valid flag names for the Intent SDK
17
+ */
18
+ type FlagName = 'intent:consent' | 'intent:geo' | 'intent:debug';
19
+ /**
20
+ * Generic flag setter - prefer using specific functions like setConsent(), setGeo(), setDebug()
21
+ * @param name - The flag name to set
22
+ * @param yes - Boolean value to enable (true) or disable (false). Undefined will skip setting.
23
+ * @deprecated This entire function will be removed in v2.0.0 (February 2026 - 2 months).
24
+ * Migrate to type-safe functions: setConsent(), setGeo(), or setDebug().
25
+ * See migration guide in README for details.
26
+ */
27
+ declare function setFlag(name: FlagName | string, yes: boolean | undefined | string): void;
28
+ /**
29
+ * Set consent flag - controls whether the SDK tracks user activity
30
+ * @param granted - true to grant consent, false to revoke consent
31
+ */
32
+ declare function setConsent(granted: boolean): void;
33
+ /**
34
+ * Set geolocation flag - controls whether the SDK captures device location
35
+ * @param enabled - true to enable geolocation, false to disable
36
+ */
37
+ declare function setGeo(enabled: boolean): void;
38
+ /**
39
+ * Set debug flag - controls whether the SDK outputs debug logs
40
+ * @param enabled - true to enable debug logging, false to disable
41
+ */
42
+ declare function setDebug(enabled: boolean): void;
43
+ /**
44
+ * Toggle debug panel - controls whether the debug panel UI is shown
45
+ *
46
+ * **⚠️ WARNING: Only available in debug builds**
47
+ *
48
+ * This function is only available when using debug build variants:
49
+ * - ESM: `@solomei-ai/intent/debug` → `dist/esm/index.debug.js`
50
+ * - UMD: `intent.debug.umd.min.js`
51
+ *
52
+ * The debug panel exposes internal SDK behavior including:
53
+ * - Screenshots of user interactions
54
+ * - Event payloads and metadata
55
+ * - HTML content and element information
56
+ *
57
+ * **Production builds do not include this functionality.**
58
+ * Attempting to use this in production builds will result in a warning and no-op.
59
+ *
60
+ * @internal
61
+ * @param enabled - true to show debug panel, false to hide
62
+ */
63
+ declare function setDebugPanel(enabled: boolean): void;
11
64
  declare function initIntent(opts?: InitOptions): void;
12
65
  declare function getIntentSessionId(): string | undefined;
13
66
  declare function ensureIntentSessionId(): void;
14
67
  declare function clearIntentSessionId(): void;
15
68
  declare function setIntentSessionMaxAge(seconds: number): void;
16
69
 
17
- export { clearIntentSessionId, ensureIntentSessionId, getIntentSessionId, initIntent, setFlag, setIntentSessionMaxAge };
18
- export type { InitOptions };
70
+ export { clearIntentSessionId, ensureIntentSessionId, getIntentSessionId, initIntent, setConsent, setDebug, setDebugPanel, setFlag, setGeo, setIntentSessionMaxAge };
71
+ export type { FlagName, InitOptions };
package/package.json CHANGED
@@ -1,51 +1,67 @@
1
1
  {
2
2
  "name": "@solomei-ai/intent",
3
- "version": "1.9.3",
3
+ "version": "1.11.0",
4
4
  "description": "Lightweight browser SDK for intent events (client-only).",
5
5
  "type": "module",
6
6
  "module": "dist/esm/index.js",
7
+ "browser": "dist/intent.umd.min.js",
7
8
  "types": "dist/types/index.d.ts",
8
9
  "exports": {
9
10
  ".": {
10
11
  "types": "./dist/types/index.d.ts",
11
12
  "import": "./dist/esm/index.js",
12
13
  "default": "./dist/esm/index.js"
14
+ },
15
+ "./debug": {
16
+ "types": "./dist/types/index.d.ts",
17
+ "import": "./dist/esm/index.debug.js",
18
+ "default": "./dist/esm/index.debug.js"
13
19
  }
14
20
  },
15
21
  "unpkg": "dist/intent.umd.min.js",
16
22
  "jsdelivr": "dist/intent.umd.min.js",
17
23
  "files": [
18
- "dist"
24
+ "dist",
25
+ "README.md",
26
+ "LICENSE"
19
27
  ],
20
28
  "sideEffects": false,
29
+ "engines": {
30
+ "node": ">=24.0.0 <25.0.0"
31
+ },
21
32
  "scripts": {
22
33
  "build": "rollup -c",
34
+ "build:debug": "rollup -c rollup.config.debug.js",
23
35
  "build:dev": "rollup -c rollup.config.dev.js",
36
+ "build:all": "npm run build && npm run build:debug",
24
37
  "dev": "rollup -c -w",
25
38
  "clean": "rm -rf dist",
26
39
  "test": "vitest run",
27
- "test:watch": "vitest"
40
+ "test:watch": "vitest",
41
+ "test:browser": "vitest run --config vitest.browser.config.ts"
28
42
  },
29
43
  "dependencies": {
30
- "html2canvas-pro": "^1.5.13",
44
+ "html2canvas-pro": "^1.6.3",
31
45
  "js-cookie": "3.0.5"
32
46
  },
33
47
  "devDependencies": {
34
48
  "@babel/preset-env": "^7.28.5",
35
49
  "@rollup/plugin-babel": "^6.1.0",
36
- "@rollup/plugin-commonjs": "^29.0.0",
37
50
  "@rollup/plugin-node-resolve": "^16.0.3",
51
+ "@rollup/plugin-replace": "^6.0.3",
38
52
  "@rollup/plugin-terser": "^0.4.4",
39
53
  "@rollup/plugin-typescript": "^12.3.0",
40
54
  "@tsconfig/recommended": "^1.0.13",
41
55
  "@types/js-cookie": "^3.0.6",
42
- "@vitest/ui": "^4.0.15",
56
+ "@vitest/browser-playwright": "^4.0.16",
57
+ "@vitest/coverage-v8": "^4.0.16",
58
+ "@vitest/ui": "^4.0.16",
43
59
  "eslint-config-xo-typescript": "^9.0.0",
44
60
  "happy-dom": "^20.0.11",
45
- "rollup": "^4.53.3",
61
+ "rollup": "^4.54.0",
46
62
  "rollup-plugin-dts": "^6.3.0",
47
63
  "rollup-plugin-obfuscator": "^1.1.0",
48
64
  "typescript": "^5.9.3",
49
- "vitest": "^4.0.15"
65
+ "vitest": "^4.0.16"
50
66
  }
51
67
  }