@fire-spark/analytics-masivo 0.0.0-stage → 0.1.1

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.
@@ -0,0 +1,10 @@
1
+ import { AnalyticsAdapter } from "@fire-spark/analytics";
2
+ //#region src/index.d.ts
3
+ type MasivoTrack = (name: string, params?: Record<string, unknown>) => Promise<void> | void;
4
+ type MasivoOptions = {
5
+ publishableKey: string;
6
+ track?: MasivoTrack;
7
+ };
8
+ declare const masivo: (options: MasivoOptions) => AnalyticsAdapter;
9
+ //#endregion
10
+ export { MasivoOptions, MasivoTrack, masivo };
package/dist/index.js ADDED
@@ -0,0 +1,25 @@
1
+ //#region src/index.ts
2
+ const existingSdk = () => {
3
+ const root = globalThis;
4
+ if (root.masivo) return root.masivo;
5
+ return globalThis.window?.masivo;
6
+ };
7
+ const masivo = (options) => {
8
+ const key = options.publishableKey?.trim() ?? "";
9
+ if (!key) throw new Error("Masivo publishableKey is required");
10
+ return {
11
+ provider: "masivo",
12
+ send: async (event) => {
13
+ if (options.track) {
14
+ await options.track(event.name, event.params);
15
+ return;
16
+ }
17
+ const sdk = existingSdk();
18
+ sdk?.init?.(key);
19
+ if (!sdk?.track) return;
20
+ await sdk.track(event.name, event.params);
21
+ }
22
+ };
23
+ };
24
+ //#endregion
25
+ export { masivo };
package/package.json CHANGED
@@ -1,6 +1,58 @@
1
1
  {
2
2
  "name": "@fire-spark/analytics-masivo",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.1",
4
+ "description": "Fire Spark Masivo analytics adapter (public-key SDK)",
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "main": "./dist/index.js",
11
+ "types": "./dist/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.js",
16
+ "default": "./dist/index.js"
17
+ }
18
+ },
19
+ "peerDependencies": {
20
+ "@fire-spark/analytics": "^0.1.1"
21
+ },
22
+ "devDependencies": {
23
+ "tsdown": "^0.22.14",
24
+ "typescript": "^7.0.2",
25
+ "vitest": "^2.1.8",
26
+ "@fire-spark/analytics": "0.1.1"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "tsdown": {
32
+ "entry": [
33
+ "src/index.ts"
34
+ ],
35
+ "format": [
36
+ "esm"
37
+ ],
38
+ "platform": "neutral",
39
+ "dts": {
40
+ "tsconfig": "tsconfig.build.json"
41
+ },
42
+ "clean": true,
43
+ "deps": {
44
+ "neverBundle": [
45
+ "@fire-spark/analytics"
46
+ ]
47
+ }
48
+ },
49
+ "scripts": {
50
+ "build": "tsdown",
51
+ "dev": "tsdown --watch",
52
+ "check-types": "tsc --noEmit",
53
+ "test:utils": "vitest run",
54
+ "lint": "oxlint ./src --max-warnings=0",
55
+ "format": "oxfmt ./src",
56
+ "check-format": "oxfmt --check ./src"
57
+ }
6
58
  }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.