@emit-vision/sdk-js 0.4.0 → 0.4.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.
- package/dist/index.d.ts +11 -1
- package/dist/index.js +12 -0
- package/package.json +3 -4
package/dist/index.d.ts
CHANGED
|
@@ -97,6 +97,11 @@ declare class EmitVisionClient {
|
|
|
97
97
|
getFlag<T extends string | number | boolean | null>(flagKey: string, fallback: T, opts: FlagEvaluationOptions): Promise<T>;
|
|
98
98
|
refreshFlags(opts: FlagEvaluationOptions): Promise<FeatureFlagsContext>;
|
|
99
99
|
capturePageView(path?: string): void;
|
|
100
|
+
captureFeedback(feedback: {
|
|
101
|
+
message: string;
|
|
102
|
+
rating?: number;
|
|
103
|
+
url?: string;
|
|
104
|
+
}, options?: CaptureOptions): void;
|
|
100
105
|
captureExposure(flagKey: string, variantKey: string, variantValue?: string | number | boolean | null, reason?: string, environment?: string): void;
|
|
101
106
|
setTags(tags: Record<string, string>): void;
|
|
102
107
|
flush(): Promise<void>;
|
|
@@ -108,6 +113,11 @@ declare function init(options: EmitVisionOptions): EmitVisionClient;
|
|
|
108
113
|
declare function captureEvent(name: string, properties?: Record<string, unknown>, options?: CaptureOptions): void;
|
|
109
114
|
declare function captureError(error: unknown, options?: CaptureOptions): void;
|
|
110
115
|
declare function capturePageView(path?: string): void;
|
|
116
|
+
declare function captureFeedback(feedback: {
|
|
117
|
+
message: string;
|
|
118
|
+
rating?: number;
|
|
119
|
+
url?: string;
|
|
120
|
+
}, options?: CaptureOptions): void;
|
|
111
121
|
declare function identify(user: EmitVisionUser): void;
|
|
112
122
|
declare function identify(userId: string, traits?: EmitVisionTraits): void;
|
|
113
123
|
declare function setContext(context: Record<string, unknown>): void;
|
|
@@ -120,4 +130,4 @@ declare function getFlag<T extends string | number | boolean | null>(flagKey: st
|
|
|
120
130
|
declare function refreshFlags(options: FlagEvaluationOptions): Promise<FeatureFlagsContext>;
|
|
121
131
|
declare function captureExposure(flagKey: string, variantKey: string, variantValue?: string | number | boolean | null, reason?: string, environment?: string): void;
|
|
122
132
|
|
|
123
|
-
export { type AutoCaptureOptions, type CaptureOptions, type DeploymentContext, type EmitVisionOptions, type EmitVisionTraits, type EmitVisionUser, type FeatureFlagsContext, type FlagEvaluationOptions, captureError, captureEvent, captureExposure, capturePageView, evaluateFlags, flush, getFlag, identify, init, refreshFlags, setContext, setDeploymentContext, setFeatureFlags, setTags };
|
|
133
|
+
export { type AutoCaptureOptions, type CaptureOptions, type DeploymentContext, type EmitVisionOptions, type EmitVisionTraits, type EmitVisionUser, type FeatureFlagsContext, type FlagEvaluationOptions, captureError, captureEvent, captureExposure, captureFeedback, capturePageView, evaluateFlags, flush, getFlag, identify, init, refreshFlags, setContext, setDeploymentContext, setFeatureFlags, setTags };
|
package/dist/index.js
CHANGED
|
@@ -712,6 +712,14 @@ var EmitVisionClient = class {
|
|
|
712
712
|
if (!page) return;
|
|
713
713
|
this.captureEvent("$page_view", { page });
|
|
714
714
|
}
|
|
715
|
+
captureFeedback(feedback, options = {}) {
|
|
716
|
+
const url = feedback.url ?? (typeof window !== "undefined" ? window.location.href : void 0);
|
|
717
|
+
this.captureEvent(
|
|
718
|
+
"$feedback",
|
|
719
|
+
{ message: feedback.message, ...feedback.rating !== void 0 ? { rating: feedback.rating } : {}, ...url ? { url } : {} },
|
|
720
|
+
options
|
|
721
|
+
);
|
|
722
|
+
}
|
|
715
723
|
captureExposure(flagKey, variantKey, variantValue, reason, environment) {
|
|
716
724
|
this.captureEvent("$flag_exposure", {
|
|
717
725
|
flagKey,
|
|
@@ -780,6 +788,9 @@ function captureError(error, options) {
|
|
|
780
788
|
function capturePageView(path) {
|
|
781
789
|
requireClient().capturePageView(path);
|
|
782
790
|
}
|
|
791
|
+
function captureFeedback(feedback, options) {
|
|
792
|
+
requireClient().captureFeedback(feedback, options);
|
|
793
|
+
}
|
|
783
794
|
function identify(userIdOrUser, traits) {
|
|
784
795
|
requireClient().identify(userIdOrUser, traits);
|
|
785
796
|
}
|
|
@@ -826,6 +837,7 @@ export {
|
|
|
826
837
|
captureError,
|
|
827
838
|
captureEvent,
|
|
828
839
|
captureExposure,
|
|
840
|
+
captureFeedback,
|
|
829
841
|
capturePageView,
|
|
830
842
|
evaluateFlags,
|
|
831
843
|
flush,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emit-vision/sdk-js",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Browser SDK for self-hosted emit-vision analytics and error tracking.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
|
-
"build": "tsup --config tsup.config.ts"
|
|
38
|
-
"prepack": "pnpm run build"
|
|
37
|
+
"build": "tsup --config tsup.config.ts"
|
|
39
38
|
}
|
|
40
|
-
}
|
|
39
|
+
}
|