@posthog/browser-common 0.10.5 → 0.10.7
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/autocapture.js +1 -1
- package/dist/autocapture.mjs +1 -1
- package/dist/client.d.ts +8 -2
- package/dist/config.js +1 -1
- package/dist/config.mjs +1 -1
- package/dist/feature-flags.d.ts +4 -0
- package/dist/feature-flags.js +54 -12
- package/dist/feature-flags.mjs +54 -12
- package/dist/utils/autocapture-utils.js +8 -8
- package/dist/utils/autocapture-utils.mjs +8 -8
- package/dist/utils/event-utils.js +10 -10
- package/dist/utils/event-utils.mjs +10 -10
- package/dist/utils/logger.js +2 -2
- package/dist/utils/logger.mjs +2 -2
- package/dist/utils/survey-utils.js +1 -1
- package/dist/utils/survey-utils.mjs +1 -1
- package/package.json +3 -3
package/dist/autocapture.js
CHANGED
|
@@ -90,7 +90,7 @@ function isInputValueEligible(target, config) {
|
|
|
90
90
|
}
|
|
91
91
|
return true;
|
|
92
92
|
}
|
|
93
|
-
const logger = (0, logger_js_namespaceObject.createLogger)('[AutoCapture]');
|
|
93
|
+
const logger = /* @__PURE__ */ (0, logger_js_namespaceObject.createLogger)('[AutoCapture]');
|
|
94
94
|
function limitText(length, text) {
|
|
95
95
|
if (text.length > length) return text.slice(0, length) + '...';
|
|
96
96
|
return text;
|
package/dist/autocapture.mjs
CHANGED
|
@@ -42,7 +42,7 @@ function isInputValueEligible(target, config) {
|
|
|
42
42
|
}
|
|
43
43
|
return true;
|
|
44
44
|
}
|
|
45
|
-
const logger = createLogger('[AutoCapture]');
|
|
45
|
+
const logger = /* @__PURE__ */ createLogger('[AutoCapture]');
|
|
46
46
|
function limitText(length, text) {
|
|
47
47
|
if (text.length > length) return text.slice(0, length) + '...';
|
|
48
48
|
return text;
|
package/dist/client.d.ts
CHANGED
|
@@ -108,8 +108,14 @@ export interface Client {
|
|
|
108
108
|
readonly isOptedOut: boolean;
|
|
109
109
|
/** Whether the host currently permits data capture. */
|
|
110
110
|
readonly canCapture: boolean;
|
|
111
|
-
/**
|
|
112
|
-
|
|
111
|
+
/** Whether the client rate limit drops an event captured now. Reading it must not use a token. */
|
|
112
|
+
readonly isRateLimited?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Synchronously admits an analytics event to the client's normal pipeline.
|
|
115
|
+
* Returns `false` when the client rate limit dropped the event, so the caller can send it again later.
|
|
116
|
+
* An event that is dropped for another reason, for example by `before_send`, returns `true`.
|
|
117
|
+
*/
|
|
118
|
+
capture(event: string, properties?: Properties | null, options?: CaptureOptions): boolean;
|
|
113
119
|
/** Registers a synchronous producer of properties merged into every captured event. */
|
|
114
120
|
registerDynamicEventProperties(producer: () => Record<string, unknown>): Disposable;
|
|
115
121
|
/** Returns the extension registered under a typed stable name, or `undefined` when it is not installed. */
|
package/dist/config.js
CHANGED
package/dist/config.mjs
CHANGED
package/dist/feature-flags.d.ts
CHANGED
|
@@ -228,7 +228,11 @@ export declare class PostHogFeatureFlags implements Extension {
|
|
|
228
228
|
* @returns {FeatureFlagResult | undefined} The feature flag result including key, enabled, variant, and payload.
|
|
229
229
|
*/
|
|
230
230
|
getFeatureFlagResult(key: string, options?: FeatureFlagOptions): FeatureFlagResult | undefined;
|
|
231
|
+
/** Returns `false` when the client rate limit dropped the event. */
|
|
231
232
|
private _captureFeatureFlagCalled;
|
|
233
|
+
private _holdFlagCall;
|
|
234
|
+
private _flagCallContext;
|
|
235
|
+
private _unmarkFlagCallReported;
|
|
232
236
|
getRemoteConfigPayload(key: string, callback: RemoteConfigFeatureFlagCallback): void;
|
|
233
237
|
private _getRemoteConfigPayload;
|
|
234
238
|
/**
|
package/dist/feature-flags.js
CHANGED
|
@@ -41,8 +41,8 @@ const logger_js_namespaceObject = require("./utils/logger.js");
|
|
|
41
41
|
const timezone_js_namespaceObject = require("./utils/timezone.js");
|
|
42
42
|
const promise_utils_js_namespaceObject = require("./utils/promise-utils.js");
|
|
43
43
|
const request_reachability_js_namespaceObject = require("./utils/request-reachability.js");
|
|
44
|
-
const logger = (0, logger_js_namespaceObject.createLogger)('[FeatureFlags]');
|
|
45
|
-
const forceDebugLogger = (0, logger_js_namespaceObject.createLogger)('[FeatureFlags]', {
|
|
44
|
+
const logger = /* @__PURE__ */ (0, logger_js_namespaceObject.createLogger)('[FeatureFlags]');
|
|
45
|
+
const forceDebugLogger = /* @__PURE__ */ (0, logger_js_namespaceObject.createLogger)('[FeatureFlags]', {
|
|
46
46
|
debugEnabled: true
|
|
47
47
|
});
|
|
48
48
|
const FLAG_TIMEOUT_MSG = '" failed. Feature flags didn\'t load in time.';
|
|
@@ -190,6 +190,11 @@ const QuotaLimitedResource = {
|
|
|
190
190
|
FeatureFlags: 'feature_flags',
|
|
191
191
|
Recordings: 'recordings'
|
|
192
192
|
};
|
|
193
|
+
const haveSameGroups = (a, b)=>{
|
|
194
|
+
const keys = Object.keys(a);
|
|
195
|
+
return keys.length === Object.keys(b).length && keys.every((key)=>a[key] === b[key]);
|
|
196
|
+
};
|
|
197
|
+
const isSameFlagCallContext = (a, b)=>a.distinctId === b.distinctId && a.sessionId === b.sessionId && haveSameGroups(a.groups, b.groups);
|
|
193
198
|
class PostHogFeatureFlags {
|
|
194
199
|
constructor(configSource){
|
|
195
200
|
this.name = 'featureFlags';
|
|
@@ -655,13 +660,21 @@ class PostHogFeatureFlags {
|
|
|
655
660
|
this._flagCallsPendingCapture = new Map();
|
|
656
661
|
}
|
|
657
662
|
sendFlagCallsPendingCapture() {
|
|
658
|
-
if (0 === this._flagCallsPendingCapture.size || this._sendingFlagCallsPendingCapture || !this._client?.canCapture) return;
|
|
663
|
+
if (0 === this._flagCallsPendingCapture.size || this._sendingFlagCallsPendingCapture || !this._client?.canCapture || this._client.isRateLimited) return;
|
|
659
664
|
this._sendingFlagCallsPendingCapture = true;
|
|
660
665
|
try {
|
|
661
|
-
this.
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
666
|
+
const flagVariants = this.getFlagVariants();
|
|
667
|
+
for (const key of Array.from(this._flagCallsPendingCapture.keys())){
|
|
668
|
+
const pending = this._flagCallsPendingCapture.get(key);
|
|
669
|
+
if (pending) {
|
|
670
|
+
if (pending.value !== String(flagVariants[key]) || !isSameFlagCallContext(pending.context, this._flagCallContext())) {
|
|
671
|
+
this._flagCallsPendingCapture.delete(key);
|
|
672
|
+
continue;
|
|
673
|
+
}
|
|
674
|
+
this.getFeatureFlagResult(key);
|
|
675
|
+
if (this._flagCallsPendingCapture.has(key)) break;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
665
678
|
} finally{
|
|
666
679
|
this._sendingFlagCallsPendingCapture = false;
|
|
667
680
|
}
|
|
@@ -827,16 +840,17 @@ class PostHogFeatureFlags {
|
|
|
827
840
|
[external_constants_js_namespaceObject.FLAG_CALL_REPORTED_SESSION_ID]: sessionIdToPersist
|
|
828
841
|
});
|
|
829
842
|
} else {
|
|
830
|
-
const
|
|
843
|
+
const captureOff = !this._client?.canCapture;
|
|
844
|
+
const canCapture = !captureOff && !this._client?.isRateLimited;
|
|
831
845
|
if (canCapture) this._flagCallsPendingCapture.delete(key);
|
|
832
846
|
else {
|
|
833
|
-
if (Object.keys(flagCallReported).length > 0) {
|
|
847
|
+
if (captureOff && Object.keys(flagCallReported).length > 0) {
|
|
834
848
|
flagCallReported = {};
|
|
835
849
|
this._set({
|
|
836
850
|
[external_constants_js_namespaceObject.FLAG_CALL_REPORTED]: flagCallReported
|
|
837
851
|
});
|
|
838
852
|
}
|
|
839
|
-
this.
|
|
853
|
+
if (!flagCallReported[key]?.includes(flagReportValue)) this._holdFlagCall(key, flagReportValue);
|
|
840
854
|
}
|
|
841
855
|
if (canCapture && !flagCallReported[key]?.includes(flagReportValue)) {
|
|
842
856
|
if ((0, core_namespaceObject.isArray)(flagCallReported[key])) flagCallReported[key].push(flagReportValue);
|
|
@@ -872,7 +886,10 @@ class PostHogFeatureFlags {
|
|
|
872
886
|
if (!(0, core_namespaceObject.isUndefined)(flagDetails?.original_variant) || !(0, core_namespaceObject.isUndefined)(flagDetails?.original_enabled)) properties.$feature_flag_original_response = (0, core_namespaceObject.isUndefined)(flagDetails.original_variant) ? flagDetails.original_enabled : flagDetails.original_variant;
|
|
873
887
|
if (flagDetails?.metadata?.original_payload) properties.$feature_flag_original_payload = flagDetails?.metadata?.original_payload;
|
|
874
888
|
if (errors.length) properties.$feature_flag_error = errors.join(',');
|
|
875
|
-
this._captureFeatureFlagCalled(properties)
|
|
889
|
+
if (!this._captureFeatureFlagCalled(properties)) {
|
|
890
|
+
this._unmarkFlagCallReported(key, flagReportValue);
|
|
891
|
+
this._holdFlagCall(key, flagReportValue);
|
|
892
|
+
}
|
|
876
893
|
} else if (sessionIdToPersist) this._set({
|
|
877
894
|
[external_constants_js_namespaceObject.FLAG_CALL_REPORTED]: flagCallReported,
|
|
878
895
|
[external_constants_js_namespaceObject.FLAG_CALL_REPORTED_SESSION_ID]: sessionIdToPersist
|
|
@@ -888,11 +905,36 @@ class PostHogFeatureFlags {
|
|
|
888
905
|
}
|
|
889
906
|
_captureFeatureFlagCalled(properties) {
|
|
890
907
|
try {
|
|
891
|
-
this._client?.capture('$feature_flag_called', properties);
|
|
908
|
+
return this._client?.capture('$feature_flag_called', properties) !== false;
|
|
892
909
|
} catch (error) {
|
|
893
910
|
this._logger.error('Failed to capture feature flag call', error);
|
|
911
|
+
return true;
|
|
894
912
|
}
|
|
895
913
|
}
|
|
914
|
+
_holdFlagCall(key, value) {
|
|
915
|
+
this._flagCallsPendingCapture.set(key, {
|
|
916
|
+
value,
|
|
917
|
+
context: this._flagCallContext()
|
|
918
|
+
});
|
|
919
|
+
}
|
|
920
|
+
_flagCallContext() {
|
|
921
|
+
return {
|
|
922
|
+
distinctId: this._client?.distinctId,
|
|
923
|
+
groups: {
|
|
924
|
+
...this._client?.groups
|
|
925
|
+
},
|
|
926
|
+
sessionId: this._config.deduplicateCallsPerSession ? this._client?.session?.sessionId : void 0
|
|
927
|
+
};
|
|
928
|
+
}
|
|
929
|
+
_unmarkFlagCallReported(key, flagReportValue) {
|
|
930
|
+
const flagCallReported = this._prop(external_constants_js_namespaceObject.FLAG_CALL_REPORTED) || {};
|
|
931
|
+
const reportedValues = flagCallReported[key];
|
|
932
|
+
if (!(0, core_namespaceObject.isArray)(reportedValues) || !reportedValues.includes(flagReportValue)) return;
|
|
933
|
+
flagCallReported[key] = reportedValues.filter((value)=>value !== flagReportValue);
|
|
934
|
+
this._set({
|
|
935
|
+
[external_constants_js_namespaceObject.FLAG_CALL_REPORTED]: flagCallReported
|
|
936
|
+
});
|
|
937
|
+
}
|
|
896
938
|
getRemoteConfigPayload(key, callback) {
|
|
897
939
|
this._getRemoteConfigPayload(key, callback);
|
|
898
940
|
}
|
package/dist/feature-flags.mjs
CHANGED
|
@@ -5,8 +5,8 @@ import { createLogger } from "./utils/logger.mjs";
|
|
|
5
5
|
import { getTimezone } from "./utils/timezone.mjs";
|
|
6
6
|
import { continueWith } from "./utils/promise-utils.mjs";
|
|
7
7
|
import { isStatusZeroFailureCircuitBreakerTripped, updateStatusZeroFailureCount } from "./utils/request-reachability.mjs";
|
|
8
|
-
const logger = createLogger('[FeatureFlags]');
|
|
9
|
-
const forceDebugLogger = createLogger('[FeatureFlags]', {
|
|
8
|
+
const logger = /* @__PURE__ */ createLogger('[FeatureFlags]');
|
|
9
|
+
const forceDebugLogger = /* @__PURE__ */ createLogger('[FeatureFlags]', {
|
|
10
10
|
debugEnabled: true
|
|
11
11
|
});
|
|
12
12
|
const FLAG_TIMEOUT_MSG = '" failed. Feature flags didn\'t load in time.';
|
|
@@ -154,6 +154,11 @@ const QuotaLimitedResource = {
|
|
|
154
154
|
FeatureFlags: 'feature_flags',
|
|
155
155
|
Recordings: 'recordings'
|
|
156
156
|
};
|
|
157
|
+
const haveSameGroups = (a, b)=>{
|
|
158
|
+
const keys = Object.keys(a);
|
|
159
|
+
return keys.length === Object.keys(b).length && keys.every((key)=>a[key] === b[key]);
|
|
160
|
+
};
|
|
161
|
+
const isSameFlagCallContext = (a, b)=>a.distinctId === b.distinctId && a.sessionId === b.sessionId && haveSameGroups(a.groups, b.groups);
|
|
157
162
|
class PostHogFeatureFlags {
|
|
158
163
|
constructor(configSource){
|
|
159
164
|
this.name = 'featureFlags';
|
|
@@ -619,13 +624,21 @@ class PostHogFeatureFlags {
|
|
|
619
624
|
this._flagCallsPendingCapture = new Map();
|
|
620
625
|
}
|
|
621
626
|
sendFlagCallsPendingCapture() {
|
|
622
|
-
if (0 === this._flagCallsPendingCapture.size || this._sendingFlagCallsPendingCapture || !this._client?.canCapture) return;
|
|
627
|
+
if (0 === this._flagCallsPendingCapture.size || this._sendingFlagCallsPendingCapture || !this._client?.canCapture || this._client.isRateLimited) return;
|
|
623
628
|
this._sendingFlagCallsPendingCapture = true;
|
|
624
629
|
try {
|
|
625
|
-
this.
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
630
|
+
const flagVariants = this.getFlagVariants();
|
|
631
|
+
for (const key of Array.from(this._flagCallsPendingCapture.keys())){
|
|
632
|
+
const pending = this._flagCallsPendingCapture.get(key);
|
|
633
|
+
if (pending) {
|
|
634
|
+
if (pending.value !== String(flagVariants[key]) || !isSameFlagCallContext(pending.context, this._flagCallContext())) {
|
|
635
|
+
this._flagCallsPendingCapture.delete(key);
|
|
636
|
+
continue;
|
|
637
|
+
}
|
|
638
|
+
this.getFeatureFlagResult(key);
|
|
639
|
+
if (this._flagCallsPendingCapture.has(key)) break;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
629
642
|
} finally{
|
|
630
643
|
this._sendingFlagCallsPendingCapture = false;
|
|
631
644
|
}
|
|
@@ -791,16 +804,17 @@ class PostHogFeatureFlags {
|
|
|
791
804
|
[FLAG_CALL_REPORTED_SESSION_ID]: sessionIdToPersist
|
|
792
805
|
});
|
|
793
806
|
} else {
|
|
794
|
-
const
|
|
807
|
+
const captureOff = !this._client?.canCapture;
|
|
808
|
+
const canCapture = !captureOff && !this._client?.isRateLimited;
|
|
795
809
|
if (canCapture) this._flagCallsPendingCapture.delete(key);
|
|
796
810
|
else {
|
|
797
|
-
if (Object.keys(flagCallReported).length > 0) {
|
|
811
|
+
if (captureOff && Object.keys(flagCallReported).length > 0) {
|
|
798
812
|
flagCallReported = {};
|
|
799
813
|
this._set({
|
|
800
814
|
[FLAG_CALL_REPORTED]: flagCallReported
|
|
801
815
|
});
|
|
802
816
|
}
|
|
803
|
-
this.
|
|
817
|
+
if (!flagCallReported[key]?.includes(flagReportValue)) this._holdFlagCall(key, flagReportValue);
|
|
804
818
|
}
|
|
805
819
|
if (canCapture && !flagCallReported[key]?.includes(flagReportValue)) {
|
|
806
820
|
if (isArray(flagCallReported[key])) flagCallReported[key].push(flagReportValue);
|
|
@@ -836,7 +850,10 @@ class PostHogFeatureFlags {
|
|
|
836
850
|
if (!isUndefined(flagDetails?.original_variant) || !isUndefined(flagDetails?.original_enabled)) properties.$feature_flag_original_response = isUndefined(flagDetails.original_variant) ? flagDetails.original_enabled : flagDetails.original_variant;
|
|
837
851
|
if (flagDetails?.metadata?.original_payload) properties.$feature_flag_original_payload = flagDetails?.metadata?.original_payload;
|
|
838
852
|
if (errors.length) properties.$feature_flag_error = errors.join(',');
|
|
839
|
-
this._captureFeatureFlagCalled(properties)
|
|
853
|
+
if (!this._captureFeatureFlagCalled(properties)) {
|
|
854
|
+
this._unmarkFlagCallReported(key, flagReportValue);
|
|
855
|
+
this._holdFlagCall(key, flagReportValue);
|
|
856
|
+
}
|
|
840
857
|
} else if (sessionIdToPersist) this._set({
|
|
841
858
|
[FLAG_CALL_REPORTED]: flagCallReported,
|
|
842
859
|
[FLAG_CALL_REPORTED_SESSION_ID]: sessionIdToPersist
|
|
@@ -852,11 +869,36 @@ class PostHogFeatureFlags {
|
|
|
852
869
|
}
|
|
853
870
|
_captureFeatureFlagCalled(properties) {
|
|
854
871
|
try {
|
|
855
|
-
this._client?.capture('$feature_flag_called', properties);
|
|
872
|
+
return this._client?.capture('$feature_flag_called', properties) !== false;
|
|
856
873
|
} catch (error) {
|
|
857
874
|
this._logger.error('Failed to capture feature flag call', error);
|
|
875
|
+
return true;
|
|
858
876
|
}
|
|
859
877
|
}
|
|
878
|
+
_holdFlagCall(key, value) {
|
|
879
|
+
this._flagCallsPendingCapture.set(key, {
|
|
880
|
+
value,
|
|
881
|
+
context: this._flagCallContext()
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
_flagCallContext() {
|
|
885
|
+
return {
|
|
886
|
+
distinctId: this._client?.distinctId,
|
|
887
|
+
groups: {
|
|
888
|
+
...this._client?.groups
|
|
889
|
+
},
|
|
890
|
+
sessionId: this._config.deduplicateCallsPerSession ? this._client?.session?.sessionId : void 0
|
|
891
|
+
};
|
|
892
|
+
}
|
|
893
|
+
_unmarkFlagCallReported(key, flagReportValue) {
|
|
894
|
+
const flagCallReported = this._prop(FLAG_CALL_REPORTED) || {};
|
|
895
|
+
const reportedValues = flagCallReported[key];
|
|
896
|
+
if (!isArray(reportedValues) || !reportedValues.includes(flagReportValue)) return;
|
|
897
|
+
flagCallReported[key] = reportedValues.filter((value)=>value !== flagReportValue);
|
|
898
|
+
this._set({
|
|
899
|
+
[FLAG_CALL_REPORTED]: flagCallReported
|
|
900
|
+
});
|
|
901
|
+
}
|
|
860
902
|
getRemoteConfigPayload(key, callback) {
|
|
861
903
|
this._getRemoteConfigPayload(key, callback);
|
|
862
904
|
}
|
|
@@ -149,14 +149,14 @@ const DEFAULT_CONTENT_IGNORELIST = [
|
|
|
149
149
|
'❯',
|
|
150
150
|
'❮'
|
|
151
151
|
];
|
|
152
|
-
const DEFAULT_CONTENT_IGNORELIST_WITH_STEPPERS = [
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
];
|
|
159
|
-
const MAX_CONTENT_IGNORELIST_ENTRIES = DEFAULT_CONTENT_IGNORELIST_WITH_STEPPERS.length + 10;
|
|
152
|
+
const DEFAULT_CONTENT_IGNORELIST_WITH_STEPPERS = /* @__PURE__ */ (()=>[
|
|
153
|
+
...DEFAULT_CONTENT_IGNORELIST,
|
|
154
|
+
'+',
|
|
155
|
+
'-',
|
|
156
|
+
'−',
|
|
157
|
+
'–'
|
|
158
|
+
])();
|
|
159
|
+
const MAX_CONTENT_IGNORELIST_ENTRIES = /* @__PURE__ */ (()=>DEFAULT_CONTENT_IGNORELIST_WITH_STEPPERS.length + 10)();
|
|
160
160
|
const INTERACTIVE_TAGS = [
|
|
161
161
|
'button',
|
|
162
162
|
'a',
|
|
@@ -95,14 +95,14 @@ const DEFAULT_CONTENT_IGNORELIST = [
|
|
|
95
95
|
'❯',
|
|
96
96
|
'❮'
|
|
97
97
|
];
|
|
98
|
-
const DEFAULT_CONTENT_IGNORELIST_WITH_STEPPERS = [
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
];
|
|
105
|
-
const MAX_CONTENT_IGNORELIST_ENTRIES = DEFAULT_CONTENT_IGNORELIST_WITH_STEPPERS.length + 10;
|
|
98
|
+
const DEFAULT_CONTENT_IGNORELIST_WITH_STEPPERS = /* @__PURE__ */ (()=>[
|
|
99
|
+
...DEFAULT_CONTENT_IGNORELIST,
|
|
100
|
+
'+',
|
|
101
|
+
'-',
|
|
102
|
+
'−',
|
|
103
|
+
'–'
|
|
104
|
+
])();
|
|
105
|
+
const MAX_CONTENT_IGNORELIST_ENTRIES = /* @__PURE__ */ (()=>DEFAULT_CONTENT_IGNORELIST_WITH_STEPPERS.length + 10)();
|
|
106
106
|
const INTERACTIVE_TAGS = [
|
|
107
107
|
'button',
|
|
108
108
|
'a',
|
|
@@ -88,16 +88,16 @@ const PERSONAL_DATA_CAMPAIGN_PARAMS = [
|
|
|
88
88
|
'irclid',
|
|
89
89
|
'_kx'
|
|
90
90
|
];
|
|
91
|
-
const CAMPAIGN_PARAMS = [
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
];
|
|
91
|
+
const CAMPAIGN_PARAMS = /* @__PURE__ */ (()=>[
|
|
92
|
+
'utm_source',
|
|
93
|
+
'utm_medium',
|
|
94
|
+
'utm_campaign',
|
|
95
|
+
'utm_content',
|
|
96
|
+
'utm_term',
|
|
97
|
+
'gad_source',
|
|
98
|
+
'mc_cid',
|
|
99
|
+
...PERSONAL_DATA_CAMPAIGN_PARAMS
|
|
100
|
+
])();
|
|
101
101
|
const EVENT_TO_PERSON_PROPERTIES = [
|
|
102
102
|
'$app_build',
|
|
103
103
|
'$app_name',
|
|
@@ -28,16 +28,16 @@ const PERSONAL_DATA_CAMPAIGN_PARAMS = [
|
|
|
28
28
|
'irclid',
|
|
29
29
|
'_kx'
|
|
30
30
|
];
|
|
31
|
-
const CAMPAIGN_PARAMS = [
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
];
|
|
31
|
+
const CAMPAIGN_PARAMS = /* @__PURE__ */ (()=>[
|
|
32
|
+
'utm_source',
|
|
33
|
+
'utm_medium',
|
|
34
|
+
'utm_campaign',
|
|
35
|
+
'utm_content',
|
|
36
|
+
'utm_term',
|
|
37
|
+
'gad_source',
|
|
38
|
+
'mc_cid',
|
|
39
|
+
...PERSONAL_DATA_CAMPAIGN_PARAMS
|
|
40
|
+
])();
|
|
41
41
|
const EVENT_TO_PERSON_PROPERTIES = [
|
|
42
42
|
'$app_build',
|
|
43
43
|
'$app_name',
|
package/dist/utils/logger.js
CHANGED
|
@@ -79,8 +79,8 @@ const _createLogger = (prefix, { debugEnabled } = {})=>{
|
|
|
79
79
|
};
|
|
80
80
|
return logger;
|
|
81
81
|
};
|
|
82
|
-
const logger_logger = _createLogger('[PostHog.js]');
|
|
83
|
-
const createLogger = logger_logger.createLogger;
|
|
82
|
+
const logger_logger = /* @__PURE__ */ _createLogger('[PostHog.js]');
|
|
83
|
+
const createLogger = (prefix, options)=>logger_logger.createLogger(prefix, options);
|
|
84
84
|
exports.createLogger = __webpack_exports__.createLogger;
|
|
85
85
|
exports.logger = __webpack_exports__.logger;
|
|
86
86
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
package/dist/utils/logger.mjs
CHANGED
|
@@ -36,6 +36,6 @@ const _createLogger = (prefix, { debugEnabled } = {})=>{
|
|
|
36
36
|
};
|
|
37
37
|
return logger;
|
|
38
38
|
};
|
|
39
|
-
const logger_logger = _createLogger('[PostHog.js]');
|
|
40
|
-
const createLogger = logger_logger.createLogger;
|
|
39
|
+
const logger_logger = /* @__PURE__ */ _createLogger('[PostHog.js]');
|
|
40
|
+
const createLogger = (prefix, options)=>logger_logger.createLogger(prefix, options);
|
|
41
41
|
export { createLogger, logger_logger as logger };
|
|
@@ -48,7 +48,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
48
48
|
const surveys_namespaceObject = require("@posthog/core/surveys");
|
|
49
49
|
const external_survey_constants_js_namespaceObject = require("../survey-constants.js");
|
|
50
50
|
const external_logger_js_namespaceObject = require("./logger.js");
|
|
51
|
-
const SURVEY_LOGGER = (0, external_logger_js_namespaceObject.createLogger)('[Surveys]');
|
|
51
|
+
const SURVEY_LOGGER = /* @__PURE__ */ (0, external_logger_js_namespaceObject.createLogger)('[Surveys]');
|
|
52
52
|
const SURVEY_CAPTURING_DISABLED = 'PostHog is not capturing, so a survey response cannot be recorded';
|
|
53
53
|
function isSurveyRunning(survey) {
|
|
54
54
|
return !!(survey.start_date && !survey.end_date);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { doesSurveyActivateByEvent, getSurveyInteractionProperty, getSurveyIterationKey, isSurveyIterationBased } from "@posthog/core/surveys";
|
|
2
2
|
import { DisplaySurveyType, SurveyType } from "../survey-constants.mjs";
|
|
3
3
|
import { createLogger } from "./logger.mjs";
|
|
4
|
-
const SURVEY_LOGGER = createLogger('[Surveys]');
|
|
4
|
+
const SURVEY_LOGGER = /* @__PURE__ */ createLogger('[Surveys]');
|
|
5
5
|
const SURVEY_CAPTURING_DISABLED = 'PostHog is not capturing, so a survey response cannot be recorded';
|
|
6
6
|
function isSurveyRunning(survey) {
|
|
7
7
|
return !!(survey.start_date && !survey.end_date);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@posthog/browser-common",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.7",
|
|
4
4
|
"description": "Internal shared browser utilities and extension primitives for PostHog Browser SDKs",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -241,8 +241,8 @@
|
|
|
241
241
|
"dependencies": {
|
|
242
242
|
"dompurify": "^3.4.13",
|
|
243
243
|
"preact": "^10.29.3",
|
|
244
|
-
"@posthog/core": "^1.63.
|
|
245
|
-
"@posthog/types": "^1.
|
|
244
|
+
"@posthog/core": "^1.63.2",
|
|
245
|
+
"@posthog/types": "^1.420.0"
|
|
246
246
|
},
|
|
247
247
|
"devDependencies": {
|
|
248
248
|
"@rsbuild/plugin-react": "^2.1.0",
|