@metamask-previews/analytics-controller 0.0.0-preview-565dfca2 → 0.0.0-preview-c208c1a
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.
- package/README.md +30 -174
- package/dist/AnalyticsController-method-action-types.cjs.map +1 -1
- package/dist/AnalyticsController-method-action-types.d.cts +8 -24
- package/dist/AnalyticsController-method-action-types.d.cts.map +1 -1
- package/dist/AnalyticsController-method-action-types.d.mts +8 -24
- package/dist/AnalyticsController-method-action-types.d.mts.map +1 -1
- package/dist/AnalyticsController-method-action-types.mjs.map +1 -1
- package/dist/AnalyticsController.cjs +102 -78
- package/dist/AnalyticsController.cjs.map +1 -1
- package/dist/AnalyticsController.d.cts +48 -34
- package/dist/AnalyticsController.d.cts.map +1 -1
- package/dist/AnalyticsController.d.mts +48 -34
- package/dist/AnalyticsController.d.mts.map +1 -1
- package/dist/AnalyticsController.mjs +103 -79
- package/dist/AnalyticsController.mjs.map +1 -1
- package/dist/AnalyticsPlatformAdapter.types.cjs.map +1 -1
- package/dist/AnalyticsPlatformAdapter.types.d.cts +63 -15
- package/dist/AnalyticsPlatformAdapter.types.d.cts.map +1 -1
- package/dist/AnalyticsPlatformAdapter.types.d.mts +63 -15
- package/dist/AnalyticsPlatformAdapter.types.d.mts.map +1 -1
- package/dist/AnalyticsPlatformAdapter.types.mjs.map +1 -1
- package/dist/AnalyticsPlatformAdapterSetupError.cjs +17 -0
- package/dist/AnalyticsPlatformAdapterSetupError.cjs.map +1 -0
- package/dist/AnalyticsPlatformAdapterSetupError.d.cts +8 -0
- package/dist/AnalyticsPlatformAdapterSetupError.d.cts.map +1 -0
- package/dist/AnalyticsPlatformAdapterSetupError.d.mts +8 -0
- package/dist/AnalyticsPlatformAdapterSetupError.d.mts.map +1 -0
- package/dist/AnalyticsPlatformAdapterSetupError.mjs +13 -0
- package/dist/AnalyticsPlatformAdapterSetupError.mjs.map +1 -0
- package/dist/analyticsControllerStateValidator.cjs +34 -0
- package/dist/analyticsControllerStateValidator.cjs.map +1 -0
- package/dist/analyticsControllerStateValidator.d.cts +16 -0
- package/dist/analyticsControllerStateValidator.d.cts.map +1 -0
- package/dist/analyticsControllerStateValidator.d.mts +16 -0
- package/dist/analyticsControllerStateValidator.d.mts.map +1 -0
- package/dist/analyticsControllerStateValidator.mjs +29 -0
- package/dist/analyticsControllerStateValidator.mjs.map +1 -0
- package/dist/index.cjs +9 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -5
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +6 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +6 -3
- package/dist/index.mjs.map +1 -1
- package/dist/selectors.cjs +36 -0
- package/dist/selectors.cjs.map +1 -0
- package/dist/selectors.d.cts +11 -0
- package/dist/selectors.d.cts.map +1 -0
- package/dist/selectors.d.mts +11 -0
- package/dist/selectors.d.mts.map +1 -0
- package/dist/selectors.mjs +33 -0
- package/dist/selectors.mjs.map +1 -0
- package/package.json +2 -3
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error thrown when platform adapter setup fails during the onSetupCompleted lifecycle hook.
|
|
3
|
+
*/
|
|
4
|
+
export declare class AnalyticsPlatformAdapterSetupError extends Error {
|
|
5
|
+
cause?: Error;
|
|
6
|
+
constructor(message: string, cause?: Error);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=AnalyticsPlatformAdapterSetupError.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnalyticsPlatformAdapterSetupError.d.mts","sourceRoot":"","sources":["../src/AnalyticsPlatformAdapterSetupError.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,kCAAmC,SAAQ,KAAK;IAC3D,KAAK,CAAC,EAAE,KAAK,CAAC;gBAEF,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;CAO3C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error thrown when platform adapter setup fails during the onSetupCompleted lifecycle hook.
|
|
3
|
+
*/
|
|
4
|
+
export class AnalyticsPlatformAdapterSetupError extends Error {
|
|
5
|
+
constructor(message, cause) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = this.constructor.name;
|
|
8
|
+
if (cause) {
|
|
9
|
+
this.cause = cause;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=AnalyticsPlatformAdapterSetupError.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnalyticsPlatformAdapterSetupError.mjs","sourceRoot":"","sources":["../src/AnalyticsPlatformAdapterSetupError.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,kCAAmC,SAAQ,KAAK;IAG3D,YAAY,OAAe,EAAE,KAAa;QACxC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACrB,CAAC;IACH,CAAC;CACF","sourcesContent":["/**\n * Error thrown when platform adapter setup fails during the onSetupCompleted lifecycle hook.\n */\nexport class AnalyticsPlatformAdapterSetupError extends Error {\n cause?: Error;\n\n constructor(message: string, cause?: Error) {\n super(message);\n this.name = this.constructor.name;\n if (cause) {\n this.cause = cause;\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateAnalyticsControllerState = exports.isValidUUIDv4 = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* UUIDv4 format regex pattern.
|
|
6
|
+
* Format: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
|
|
7
|
+
* - x is any hexadecimal digit [0-9a-f]
|
|
8
|
+
* - 4 indicates UUID version 4
|
|
9
|
+
* - y is the variant indicator [89ab]
|
|
10
|
+
*/
|
|
11
|
+
const UUID_V4_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu;
|
|
12
|
+
/**
|
|
13
|
+
* Validates that a string is a valid UUIDv4 format.
|
|
14
|
+
*
|
|
15
|
+
* @param value - The string to validate
|
|
16
|
+
* @returns True if the string matches UUIDv4 format
|
|
17
|
+
*/
|
|
18
|
+
function isValidUUIDv4(value) {
|
|
19
|
+
return typeof value === 'string' && UUID_V4_REGEX.test(value);
|
|
20
|
+
}
|
|
21
|
+
exports.isValidUUIDv4 = isValidUUIDv4;
|
|
22
|
+
/**
|
|
23
|
+
* Validates that the analytics state has a valid UUIDv4 analyticsId.
|
|
24
|
+
*
|
|
25
|
+
* @param state - The analytics controller state to validate
|
|
26
|
+
* @throws Error if analyticsId is missing or not a valid UUIDv4
|
|
27
|
+
*/
|
|
28
|
+
function validateAnalyticsControllerState(state) {
|
|
29
|
+
if (!state.analyticsId || !isValidUUIDv4(state.analyticsId)) {
|
|
30
|
+
throw new Error('Invalid analyticsId');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.validateAnalyticsControllerState = validateAnalyticsControllerState;
|
|
34
|
+
//# sourceMappingURL=analyticsControllerStateValidator.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyticsControllerStateValidator.cjs","sourceRoot":"","sources":["../src/analyticsControllerStateValidator.ts"],"names":[],"mappings":";;;AAEA;;;;;;GAMG;AACH,MAAM,aAAa,GACjB,yEAAyE,CAAC;AAE5E;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,KAAa;IACzC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC;AAFD,sCAEC;AAED;;;;;GAKG;AACH,SAAgB,gCAAgC,CAC9C,KAA+B;IAE/B,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC;QAC5D,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;AACH,CAAC;AAND,4EAMC","sourcesContent":["import type { AnalyticsControllerState } from './AnalyticsController';\n\n/**\n * UUIDv4 format regex pattern.\n * Format: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\n * - x is any hexadecimal digit [0-9a-f]\n * - 4 indicates UUID version 4\n * - y is the variant indicator [89ab]\n */\nconst UUID_V4_REGEX =\n /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu;\n\n/**\n * Validates that a string is a valid UUIDv4 format.\n *\n * @param value - The string to validate\n * @returns True if the string matches UUIDv4 format\n */\nexport function isValidUUIDv4(value: string): boolean {\n return typeof value === 'string' && UUID_V4_REGEX.test(value);\n}\n\n/**\n * Validates that the analytics state has a valid UUIDv4 analyticsId.\n *\n * @param state - The analytics controller state to validate\n * @throws Error if analyticsId is missing or not a valid UUIDv4\n */\nexport function validateAnalyticsControllerState(\n state: AnalyticsControllerState,\n): void {\n if (!state.analyticsId || !isValidUUIDv4(state.analyticsId)) {\n throw new Error('Invalid analyticsId');\n }\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AnalyticsControllerState } from "./AnalyticsController.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* Validates that a string is a valid UUIDv4 format.
|
|
4
|
+
*
|
|
5
|
+
* @param value - The string to validate
|
|
6
|
+
* @returns True if the string matches UUIDv4 format
|
|
7
|
+
*/
|
|
8
|
+
export declare function isValidUUIDv4(value: string): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Validates that the analytics state has a valid UUIDv4 analyticsId.
|
|
11
|
+
*
|
|
12
|
+
* @param state - The analytics controller state to validate
|
|
13
|
+
* @throws Error if analyticsId is missing or not a valid UUIDv4
|
|
14
|
+
*/
|
|
15
|
+
export declare function validateAnalyticsControllerState(state: AnalyticsControllerState): void;
|
|
16
|
+
//# sourceMappingURL=analyticsControllerStateValidator.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyticsControllerStateValidator.d.cts","sourceRoot":"","sources":["../src/analyticsControllerStateValidator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,kCAA8B;AAYtE;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,wBAAwB,GAC9B,IAAI,CAIN"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AnalyticsControllerState } from "./AnalyticsController.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Validates that a string is a valid UUIDv4 format.
|
|
4
|
+
*
|
|
5
|
+
* @param value - The string to validate
|
|
6
|
+
* @returns True if the string matches UUIDv4 format
|
|
7
|
+
*/
|
|
8
|
+
export declare function isValidUUIDv4(value: string): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Validates that the analytics state has a valid UUIDv4 analyticsId.
|
|
11
|
+
*
|
|
12
|
+
* @param state - The analytics controller state to validate
|
|
13
|
+
* @throws Error if analyticsId is missing or not a valid UUIDv4
|
|
14
|
+
*/
|
|
15
|
+
export declare function validateAnalyticsControllerState(state: AnalyticsControllerState): void;
|
|
16
|
+
//# sourceMappingURL=analyticsControllerStateValidator.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyticsControllerStateValidator.d.mts","sourceRoot":"","sources":["../src/analyticsControllerStateValidator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,kCAA8B;AAYtE;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,wBAAwB,GAC9B,IAAI,CAIN"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UUIDv4 format regex pattern.
|
|
3
|
+
* Format: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
|
|
4
|
+
* - x is any hexadecimal digit [0-9a-f]
|
|
5
|
+
* - 4 indicates UUID version 4
|
|
6
|
+
* - y is the variant indicator [89ab]
|
|
7
|
+
*/
|
|
8
|
+
const UUID_V4_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu;
|
|
9
|
+
/**
|
|
10
|
+
* Validates that a string is a valid UUIDv4 format.
|
|
11
|
+
*
|
|
12
|
+
* @param value - The string to validate
|
|
13
|
+
* @returns True if the string matches UUIDv4 format
|
|
14
|
+
*/
|
|
15
|
+
export function isValidUUIDv4(value) {
|
|
16
|
+
return typeof value === 'string' && UUID_V4_REGEX.test(value);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Validates that the analytics state has a valid UUIDv4 analyticsId.
|
|
20
|
+
*
|
|
21
|
+
* @param state - The analytics controller state to validate
|
|
22
|
+
* @throws Error if analyticsId is missing or not a valid UUIDv4
|
|
23
|
+
*/
|
|
24
|
+
export function validateAnalyticsControllerState(state) {
|
|
25
|
+
if (!state.analyticsId || !isValidUUIDv4(state.analyticsId)) {
|
|
26
|
+
throw new Error('Invalid analyticsId');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=analyticsControllerStateValidator.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyticsControllerStateValidator.mjs","sourceRoot":"","sources":["../src/analyticsControllerStateValidator.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,aAAa,GACjB,yEAAyE,CAAC;AAE5E;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gCAAgC,CAC9C,KAA+B;IAE/B,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC;QAC5D,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;AACH,CAAC","sourcesContent":["import type { AnalyticsControllerState } from './AnalyticsController';\n\n/**\n * UUIDv4 format regex pattern.\n * Format: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\n * - x is any hexadecimal digit [0-9a-f]\n * - 4 indicates UUID version 4\n * - y is the variant indicator [89ab]\n */\nconst UUID_V4_REGEX =\n /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu;\n\n/**\n * Validates that a string is a valid UUIDv4 format.\n *\n * @param value - The string to validate\n * @returns True if the string matches UUIDv4 format\n */\nexport function isValidUUIDv4(value: string): boolean {\n return typeof value === 'string' && UUID_V4_REGEX.test(value);\n}\n\n/**\n * Validates that the analytics state has a valid UUIDv4 analyticsId.\n *\n * @param state - The analytics controller state to validate\n * @throws Error if analyticsId is missing or not a valid UUIDv4\n */\nexport function validateAnalyticsControllerState(\n state: AnalyticsControllerState,\n): void {\n if (!state.analyticsId || !isValidUUIDv4(state.analyticsId)) {\n throw new Error('Invalid analyticsId');\n }\n}\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDefaultAnalyticsControllerState = exports.AnalyticsController = void 0;
|
|
4
|
-
// Export controller class
|
|
3
|
+
exports.analyticsControllerSelectors = exports.AnalyticsPlatformAdapterSetupError = exports.getDefaultAnalyticsControllerState = exports.AnalyticsController = void 0;
|
|
4
|
+
// Export controller class and state utilities
|
|
5
5
|
var AnalyticsController_1 = require("./AnalyticsController.cjs");
|
|
6
6
|
Object.defineProperty(exports, "AnalyticsController", { enumerable: true, get: function () { return AnalyticsController_1.AnalyticsController; } });
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
Object.defineProperty(exports, "getDefaultAnalyticsControllerState", { enumerable: true, get: function () { return AnalyticsController_1.getDefaultAnalyticsControllerState; } });
|
|
8
|
+
// Export errors
|
|
9
|
+
var AnalyticsPlatformAdapterSetupError_1 = require("./AnalyticsPlatformAdapterSetupError.cjs");
|
|
10
|
+
Object.defineProperty(exports, "AnalyticsPlatformAdapterSetupError", { enumerable: true, get: function () { return AnalyticsPlatformAdapterSetupError_1.AnalyticsPlatformAdapterSetupError; } });
|
|
11
|
+
// Export selectors
|
|
12
|
+
var selectors_1 = require("./selectors.cjs");
|
|
13
|
+
Object.defineProperty(exports, "analyticsControllerSelectors", { enumerable: true, get: function () { return selectors_1.analyticsControllerSelectors; } });
|
|
9
14
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,8CAA8C;AAC9C,iEAG+B;AAF7B,0HAAA,mBAAmB,OAAA;AACnB,yIAAA,kCAAkC,OAAA;AAIpC,gBAAgB;AAChB,+FAA0F;AAAjF,wJAAA,kCAAkC,OAAA;AAa3C,mBAAmB;AACnB,6CAA2D;AAAlD,yHAAA,4BAA4B,OAAA","sourcesContent":["// Export controller class and state utilities\nexport {\n AnalyticsController,\n getDefaultAnalyticsControllerState,\n} from './AnalyticsController';\nexport type { AnalyticsControllerOptions } from './AnalyticsController';\n\n// Export errors\nexport { AnalyticsPlatformAdapterSetupError } from './AnalyticsPlatformAdapterSetupError';\n\n// Export types\nexport type {\n AnalyticsEventProperties,\n AnalyticsUserTraits,\n AnalyticsPlatformAdapter,\n AnalyticsTrackingEvent,\n} from './AnalyticsPlatformAdapter.types';\n\n// Export state types\nexport type { AnalyticsControllerState } from './AnalyticsController';\n\n// Export selectors\nexport { analyticsControllerSelectors } from './selectors';\n\n// Export messenger types\nexport type { AnalyticsControllerMessenger } from './AnalyticsController';\n\n// Export action and event types\nexport type {\n AnalyticsControllerActions,\n AnalyticsControllerEvents,\n AnalyticsControllerGetStateAction,\n AnalyticsControllerStateChangeEvent,\n} from './AnalyticsController';\nexport type {\n AnalyticsControllerTrackEventAction,\n AnalyticsControllerIdentifyAction,\n AnalyticsControllerTrackViewAction,\n AnalyticsControllerOptInAction,\n AnalyticsControllerOptOutAction,\n AnalyticsControllerMethodActions,\n} from './AnalyticsController-method-action-types';\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export { AnalyticsController } from "./AnalyticsController.cjs";
|
|
1
|
+
export { AnalyticsController, getDefaultAnalyticsControllerState, } from "./AnalyticsController.cjs";
|
|
2
2
|
export type { AnalyticsControllerOptions } from "./AnalyticsController.cjs";
|
|
3
|
-
export
|
|
3
|
+
export { AnalyticsPlatformAdapterSetupError } from "./AnalyticsPlatformAdapterSetupError.cjs";
|
|
4
|
+
export type { AnalyticsEventProperties, AnalyticsUserTraits, AnalyticsPlatformAdapter, AnalyticsTrackingEvent, } from "./AnalyticsPlatformAdapter.types.cjs";
|
|
4
5
|
export type { AnalyticsControllerState } from "./AnalyticsController.cjs";
|
|
5
|
-
export {
|
|
6
|
+
export { analyticsControllerSelectors } from "./selectors.cjs";
|
|
6
7
|
export type { AnalyticsControllerMessenger } from "./AnalyticsController.cjs";
|
|
7
|
-
export type { AnalyticsControllerActions, AnalyticsControllerEvents, AnalyticsControllerGetStateAction, AnalyticsControllerStateChangeEvent,
|
|
8
|
-
export type { AnalyticsControllerTrackEventAction, AnalyticsControllerIdentifyAction,
|
|
8
|
+
export type { AnalyticsControllerActions, AnalyticsControllerEvents, AnalyticsControllerGetStateAction, AnalyticsControllerStateChangeEvent, } from "./AnalyticsController.cjs";
|
|
9
|
+
export type { AnalyticsControllerTrackEventAction, AnalyticsControllerIdentifyAction, AnalyticsControllerTrackViewAction, AnalyticsControllerOptInAction, AnalyticsControllerOptOutAction, AnalyticsControllerMethodActions, } from "./AnalyticsController-method-action-types.cjs";
|
|
9
10
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,kCAAkC,GACnC,kCAA8B;AAC/B,YAAY,EAAE,0BAA0B,EAAE,kCAA8B;AAGxE,OAAO,EAAE,kCAAkC,EAAE,iDAA6C;AAG1F,YAAY,EACV,wBAAwB,EACxB,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,GACvB,6CAAyC;AAG1C,YAAY,EAAE,wBAAwB,EAAE,kCAA8B;AAGtE,OAAO,EAAE,4BAA4B,EAAE,wBAAoB;AAG3D,YAAY,EAAE,4BAA4B,EAAE,kCAA8B;AAG1E,YAAY,EACV,0BAA0B,EAC1B,yBAAyB,EACzB,iCAAiC,EACjC,mCAAmC,GACpC,kCAA8B;AAC/B,YAAY,EACV,mCAAmC,EACnC,iCAAiC,EACjC,kCAAkC,EAClC,8BAA8B,EAC9B,+BAA+B,EAC/B,gCAAgC,GACjC,sDAAkD"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export { AnalyticsController } from "./AnalyticsController.mjs";
|
|
1
|
+
export { AnalyticsController, getDefaultAnalyticsControllerState, } from "./AnalyticsController.mjs";
|
|
2
2
|
export type { AnalyticsControllerOptions } from "./AnalyticsController.mjs";
|
|
3
|
-
export
|
|
3
|
+
export { AnalyticsPlatformAdapterSetupError } from "./AnalyticsPlatformAdapterSetupError.mjs";
|
|
4
|
+
export type { AnalyticsEventProperties, AnalyticsUserTraits, AnalyticsPlatformAdapter, AnalyticsTrackingEvent, } from "./AnalyticsPlatformAdapter.types.mjs";
|
|
4
5
|
export type { AnalyticsControllerState } from "./AnalyticsController.mjs";
|
|
5
|
-
export {
|
|
6
|
+
export { analyticsControllerSelectors } from "./selectors.mjs";
|
|
6
7
|
export type { AnalyticsControllerMessenger } from "./AnalyticsController.mjs";
|
|
7
|
-
export type { AnalyticsControllerActions, AnalyticsControllerEvents, AnalyticsControllerGetStateAction, AnalyticsControllerStateChangeEvent,
|
|
8
|
-
export type { AnalyticsControllerTrackEventAction, AnalyticsControllerIdentifyAction,
|
|
8
|
+
export type { AnalyticsControllerActions, AnalyticsControllerEvents, AnalyticsControllerGetStateAction, AnalyticsControllerStateChangeEvent, } from "./AnalyticsController.mjs";
|
|
9
|
+
export type { AnalyticsControllerTrackEventAction, AnalyticsControllerIdentifyAction, AnalyticsControllerTrackViewAction, AnalyticsControllerOptInAction, AnalyticsControllerOptOutAction, AnalyticsControllerMethodActions, } from "./AnalyticsController-method-action-types.mjs";
|
|
9
10
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,kCAAkC,GACnC,kCAA8B;AAC/B,YAAY,EAAE,0BAA0B,EAAE,kCAA8B;AAGxE,OAAO,EAAE,kCAAkC,EAAE,iDAA6C;AAG1F,YAAY,EACV,wBAAwB,EACxB,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,GACvB,6CAAyC;AAG1C,YAAY,EAAE,wBAAwB,EAAE,kCAA8B;AAGtE,OAAO,EAAE,4BAA4B,EAAE,wBAAoB;AAG3D,YAAY,EAAE,4BAA4B,EAAE,kCAA8B;AAG1E,YAAY,EACV,0BAA0B,EAC1B,yBAAyB,EACzB,iCAAiC,EACjC,mCAAmC,GACpC,kCAA8B;AAC/B,YAAY,EACV,mCAAmC,EACnC,iCAAiC,EACjC,kCAAkC,EAClC,8BAA8B,EAC9B,+BAA+B,EAC/B,gCAAgC,GACjC,sDAAkD"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
// Export controller class
|
|
2
|
-
export { AnalyticsController } from "./AnalyticsController.mjs";
|
|
3
|
-
|
|
1
|
+
// Export controller class and state utilities
|
|
2
|
+
export { AnalyticsController, getDefaultAnalyticsControllerState } from "./AnalyticsController.mjs";
|
|
3
|
+
// Export errors
|
|
4
|
+
export { AnalyticsPlatformAdapterSetupError } from "./AnalyticsPlatformAdapterSetupError.mjs";
|
|
5
|
+
// Export selectors
|
|
6
|
+
export { analyticsControllerSelectors } from "./selectors.mjs";
|
|
4
7
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,OAAO,EACL,mBAAmB,EACnB,kCAAkC,EACnC,kCAA8B;AAG/B,gBAAgB;AAChB,OAAO,EAAE,kCAAkC,EAAE,iDAA6C;AAa1F,mBAAmB;AACnB,OAAO,EAAE,4BAA4B,EAAE,wBAAoB","sourcesContent":["// Export controller class and state utilities\nexport {\n AnalyticsController,\n getDefaultAnalyticsControllerState,\n} from './AnalyticsController';\nexport type { AnalyticsControllerOptions } from './AnalyticsController';\n\n// Export errors\nexport { AnalyticsPlatformAdapterSetupError } from './AnalyticsPlatformAdapterSetupError';\n\n// Export types\nexport type {\n AnalyticsEventProperties,\n AnalyticsUserTraits,\n AnalyticsPlatformAdapter,\n AnalyticsTrackingEvent,\n} from './AnalyticsPlatformAdapter.types';\n\n// Export state types\nexport type { AnalyticsControllerState } from './AnalyticsController';\n\n// Export selectors\nexport { analyticsControllerSelectors } from './selectors';\n\n// Export messenger types\nexport type { AnalyticsControllerMessenger } from './AnalyticsController';\n\n// Export action and event types\nexport type {\n AnalyticsControllerActions,\n AnalyticsControllerEvents,\n AnalyticsControllerGetStateAction,\n AnalyticsControllerStateChangeEvent,\n} from './AnalyticsController';\nexport type {\n AnalyticsControllerTrackEventAction,\n AnalyticsControllerIdentifyAction,\n AnalyticsControllerTrackViewAction,\n AnalyticsControllerOptInAction,\n AnalyticsControllerOptOutAction,\n AnalyticsControllerMethodActions,\n} from './AnalyticsController-method-action-types';\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.analyticsControllerSelectors = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Selects the analytics ID from the controller state.
|
|
6
|
+
*
|
|
7
|
+
* @param state - The controller state
|
|
8
|
+
* @returns The analytics ID
|
|
9
|
+
*/
|
|
10
|
+
const selectAnalyticsId = (state) => state.analyticsId;
|
|
11
|
+
/**
|
|
12
|
+
* Selects the opted-in user status from the controller state.
|
|
13
|
+
* Use this selector to read the user's opt-in preference (e.g., for UI display).
|
|
14
|
+
*
|
|
15
|
+
* @param state - The controller state
|
|
16
|
+
* @returns Whether the user has opted in to analytics
|
|
17
|
+
*/
|
|
18
|
+
const selectOptedIn = (state) => state.optedIn;
|
|
19
|
+
/**
|
|
20
|
+
* Selects whether analytics tracking is enabled.
|
|
21
|
+
* Use this selector to determine if tracking should occur (e.g., in controller methods).
|
|
22
|
+
*
|
|
23
|
+
* @param state - The controller state
|
|
24
|
+
* @returns Whether analytics tracking is enabled
|
|
25
|
+
*/
|
|
26
|
+
const selectEnabled = (state) => state.optedIn;
|
|
27
|
+
/**
|
|
28
|
+
* Selectors for the AnalyticsController state.
|
|
29
|
+
* These can be used with Redux or directly with controller state.
|
|
30
|
+
*/
|
|
31
|
+
exports.analyticsControllerSelectors = {
|
|
32
|
+
selectAnalyticsId,
|
|
33
|
+
selectOptedIn,
|
|
34
|
+
selectEnabled,
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=selectors.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.cjs","sourceRoot":"","sources":["../src/selectors.ts"],"names":[],"mappings":";;;AAEA;;;;;GAKG;AACH,MAAM,iBAAiB,GAAG,CAAC,KAA+B,EAAU,EAAE,CACpE,KAAK,CAAC,WAAW,CAAC;AAEpB;;;;;;GAMG;AACH,MAAM,aAAa,GAAG,CAAC,KAA+B,EAAW,EAAE,CACjE,KAAK,CAAC,OAAO,CAAC;AAEhB;;;;;;GAMG;AACH,MAAM,aAAa,GAAG,CAAC,KAA+B,EAAW,EAAE,CACjE,KAAK,CAAC,OAAO,CAAC;AAEhB;;;GAGG;AACU,QAAA,4BAA4B,GAAG;IAC1C,iBAAiB;IACjB,aAAa;IACb,aAAa;CACd,CAAC","sourcesContent":["import type { AnalyticsControllerState } from './AnalyticsController';\n\n/**\n * Selects the analytics ID from the controller state.\n *\n * @param state - The controller state\n * @returns The analytics ID\n */\nconst selectAnalyticsId = (state: AnalyticsControllerState): string =>\n state.analyticsId;\n\n/**\n * Selects the opted-in user status from the controller state.\n * Use this selector to read the user's opt-in preference (e.g., for UI display).\n *\n * @param state - The controller state\n * @returns Whether the user has opted in to analytics\n */\nconst selectOptedIn = (state: AnalyticsControllerState): boolean =>\n state.optedIn;\n\n/**\n * Selects whether analytics tracking is enabled.\n * Use this selector to determine if tracking should occur (e.g., in controller methods).\n *\n * @param state - The controller state\n * @returns Whether analytics tracking is enabled\n */\nconst selectEnabled = (state: AnalyticsControllerState): boolean =>\n state.optedIn;\n\n/**\n * Selectors for the AnalyticsController state.\n * These can be used with Redux or directly with controller state.\n */\nexport const analyticsControllerSelectors = {\n selectAnalyticsId,\n selectOptedIn,\n selectEnabled,\n};\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AnalyticsControllerState } from "./AnalyticsController.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* Selectors for the AnalyticsController state.
|
|
4
|
+
* These can be used with Redux or directly with controller state.
|
|
5
|
+
*/
|
|
6
|
+
export declare const analyticsControllerSelectors: {
|
|
7
|
+
selectAnalyticsId: (state: AnalyticsControllerState) => string;
|
|
8
|
+
selectOptedIn: (state: AnalyticsControllerState) => boolean;
|
|
9
|
+
selectEnabled: (state: AnalyticsControllerState) => boolean;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=selectors.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.d.cts","sourceRoot":"","sources":["../src/selectors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,kCAA8B;AA+BtE;;;GAGG;AACH,eAAO,MAAM,4BAA4B;+BA3BP,wBAAwB,KAAG,MAAM;2BAUrC,wBAAwB,KAAG,OAAO;2BAUlC,wBAAwB,KAAG,OAAO;CAW/D,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AnalyticsControllerState } from "./AnalyticsController.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Selectors for the AnalyticsController state.
|
|
4
|
+
* These can be used with Redux or directly with controller state.
|
|
5
|
+
*/
|
|
6
|
+
export declare const analyticsControllerSelectors: {
|
|
7
|
+
selectAnalyticsId: (state: AnalyticsControllerState) => string;
|
|
8
|
+
selectOptedIn: (state: AnalyticsControllerState) => boolean;
|
|
9
|
+
selectEnabled: (state: AnalyticsControllerState) => boolean;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=selectors.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.d.mts","sourceRoot":"","sources":["../src/selectors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,kCAA8B;AA+BtE;;;GAGG;AACH,eAAO,MAAM,4BAA4B;+BA3BP,wBAAwB,KAAG,MAAM;2BAUrC,wBAAwB,KAAG,OAAO;2BAUlC,wBAAwB,KAAG,OAAO;CAW/D,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Selects the analytics ID from the controller state.
|
|
3
|
+
*
|
|
4
|
+
* @param state - The controller state
|
|
5
|
+
* @returns The analytics ID
|
|
6
|
+
*/
|
|
7
|
+
const selectAnalyticsId = (state) => state.analyticsId;
|
|
8
|
+
/**
|
|
9
|
+
* Selects the opted-in user status from the controller state.
|
|
10
|
+
* Use this selector to read the user's opt-in preference (e.g., for UI display).
|
|
11
|
+
*
|
|
12
|
+
* @param state - The controller state
|
|
13
|
+
* @returns Whether the user has opted in to analytics
|
|
14
|
+
*/
|
|
15
|
+
const selectOptedIn = (state) => state.optedIn;
|
|
16
|
+
/**
|
|
17
|
+
* Selects whether analytics tracking is enabled.
|
|
18
|
+
* Use this selector to determine if tracking should occur (e.g., in controller methods).
|
|
19
|
+
*
|
|
20
|
+
* @param state - The controller state
|
|
21
|
+
* @returns Whether analytics tracking is enabled
|
|
22
|
+
*/
|
|
23
|
+
const selectEnabled = (state) => state.optedIn;
|
|
24
|
+
/**
|
|
25
|
+
* Selectors for the AnalyticsController state.
|
|
26
|
+
* These can be used with Redux or directly with controller state.
|
|
27
|
+
*/
|
|
28
|
+
export const analyticsControllerSelectors = {
|
|
29
|
+
selectAnalyticsId,
|
|
30
|
+
selectOptedIn,
|
|
31
|
+
selectEnabled,
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=selectors.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.mjs","sourceRoot":"","sources":["../src/selectors.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,iBAAiB,GAAG,CAAC,KAA+B,EAAU,EAAE,CACpE,KAAK,CAAC,WAAW,CAAC;AAEpB;;;;;;GAMG;AACH,MAAM,aAAa,GAAG,CAAC,KAA+B,EAAW,EAAE,CACjE,KAAK,CAAC,OAAO,CAAC;AAEhB;;;;;;GAMG;AACH,MAAM,aAAa,GAAG,CAAC,KAA+B,EAAW,EAAE,CACjE,KAAK,CAAC,OAAO,CAAC;AAEhB;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,iBAAiB;IACjB,aAAa;IACb,aAAa;CACd,CAAC","sourcesContent":["import type { AnalyticsControllerState } from './AnalyticsController';\n\n/**\n * Selects the analytics ID from the controller state.\n *\n * @param state - The controller state\n * @returns The analytics ID\n */\nconst selectAnalyticsId = (state: AnalyticsControllerState): string =>\n state.analyticsId;\n\n/**\n * Selects the opted-in user status from the controller state.\n * Use this selector to read the user's opt-in preference (e.g., for UI display).\n *\n * @param state - The controller state\n * @returns Whether the user has opted in to analytics\n */\nconst selectOptedIn = (state: AnalyticsControllerState): boolean =>\n state.optedIn;\n\n/**\n * Selects whether analytics tracking is enabled.\n * Use this selector to determine if tracking should occur (e.g., in controller methods).\n *\n * @param state - The controller state\n * @returns Whether analytics tracking is enabled\n */\nconst selectEnabled = (state: AnalyticsControllerState): boolean =>\n state.optedIn;\n\n/**\n * Selectors for the AnalyticsController state.\n * These can be used with Redux or directly with controller state.\n */\nexport const analyticsControllerSelectors = {\n selectAnalyticsId,\n selectOptedIn,\n selectEnabled,\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask-previews/analytics-controller",
|
|
3
|
-
"version": "0.0.0-preview-
|
|
3
|
+
"version": "0.0.0-preview-c208c1a",
|
|
4
4
|
"description": "Common Analytics controller for event tracking",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MetaMask",
|
|
@@ -50,8 +50,7 @@
|
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@metamask/base-controller": "^9.0.0",
|
|
52
52
|
"@metamask/messenger": "^0.3.0",
|
|
53
|
-
"@metamask/utils": "^11.8.1"
|
|
54
|
-
"uuid": "^8.3.2"
|
|
53
|
+
"@metamask/utils": "^11.8.1"
|
|
55
54
|
},
|
|
56
55
|
"devDependencies": {
|
|
57
56
|
"@metamask/auto-changelog": "^3.4.4",
|