@meiroio/web-sdk 0.1.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.
@@ -0,0 +1,74 @@
1
+ export type MptConsent = 'denied' | 'granted';
2
+
3
+ export type MptConsentOptions = {
4
+ storagePersistence?: MptConsent;
5
+ userId?: MptConsent;
6
+ sessionId?: MptConsent;
7
+ };
8
+
9
+ export type MptLinkTrackingOptions = {
10
+ enabled: boolean;
11
+ domainsBlacklist?: string[];
12
+ };
13
+
14
+ export type MptIdSyncOptions = {
15
+ googleAnalytics?: boolean;
16
+ meta?: boolean;
17
+ };
18
+
19
+ export type MptTradeDeskOptions = {
20
+ pid: string;
21
+ gdpr?: 0 | 1;
22
+ gdprConsent?: string;
23
+ };
24
+
25
+ export type MptGooglePixelOptions = {
26
+ googleNid: string;
27
+ };
28
+
29
+ export type MptTrackingRulesStorageAllowlist = {
30
+ cookies?: string[];
31
+ localStorage?: string[];
32
+ sessionStorage?: string[];
33
+ };
34
+
35
+ export type MptTrackingRulesOptions = {
36
+ enabled: boolean;
37
+ debug?: boolean;
38
+ storageAllowlist?: MptTrackingRulesStorageAllowlist;
39
+ };
40
+
41
+ export type MptWebBannersOptions = {
42
+ enabled?: boolean;
43
+ };
44
+
45
+ export type MptConfig = {
46
+ collectionEndpoint: string;
47
+ crossDomainWhitelist?: string[];
48
+ linkTracking?: MptLinkTrackingOptions;
49
+ idSync?: MptIdSyncOptions;
50
+ theTradeDesk?: MptTradeDeskOptions;
51
+ googlePixel?: MptGooglePixelOptions;
52
+ trackingRules?: MptTrackingRulesOptions;
53
+ webBanners?: MptWebBannersOptions;
54
+ };
55
+
56
+ export type MptConfigUpdate = Partial<MptConfig>;
57
+
58
+ export type MptOptions = MptConfig & {
59
+ consent?: MptConsentOptions;
60
+ };
61
+
62
+ export type MptEventPayload = Record<string, unknown>;
63
+
64
+ export type MptSharedPayload = Record<string, unknown>;
65
+
66
+ export type MptFieldName = 'userId' | 'sessionId';
67
+
68
+ export interface MptClient {
69
+ config(config: MptConfigUpdate): void;
70
+ consent(consent: MptConsentOptions): void;
71
+ event(eventName: string, payload?: MptEventPayload): Promise<void>;
72
+ set(payload: MptSharedPayload): void;
73
+ get(fieldName: MptFieldName): string;
74
+ }
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@meiroio/web-sdk",
3
+ "version": "0.1.0",
4
+ "description": "Browser SDK for collecting website events with Meiro Pipes.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "default": "./dist/index.js"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "README.md"
19
+ ],
20
+ "sideEffects": false,
21
+ "scripts": {
22
+ "build": "bun run ../scripts/build-web-sdk-package.ts",
23
+ "typecheck": "tsc -p tsconfig.json --noEmit",
24
+ "test": "bun test ../src/server/sdk/npm.test.ts ../src/server/sdk/npm-client.test.ts ../src/server/sdk/npm-config.test.ts",
25
+ "prepack": "bun run build",
26
+ "prepublishOnly": "bun run typecheck && bun run test"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/meiroio/pipes.git",
34
+ "directory": "web-sdk"
35
+ },
36
+ "homepage": "https://github.com/meiroio/pipes#readme",
37
+ "bugs": {
38
+ "url": "https://github.com/meiroio/pipes/issues"
39
+ },
40
+ "keywords": [
41
+ "analytics",
42
+ "cdp",
43
+ "customer-data",
44
+ "meiro",
45
+ "tracking",
46
+ "web-sdk"
47
+ ],
48
+ "license": "UNLICENSED"
49
+ }