autotel-subscribers 16.0.0 → 17.0.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.
package/dist/posthog.js CHANGED
@@ -41,11 +41,11 @@ function normalizeWindowsPath(path) {
41
41
  return path.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
42
42
  }
43
43
  var init_module_node = __esm({
44
- "../../node_modules/.pnpm/posthog-node@5.19.0/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs"() {
44
+ "../../node_modules/.pnpm/posthog-node@5.24.1/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs"() {
45
45
  }
46
46
  });
47
47
 
48
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/featureFlagUtils.mjs
48
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/featureFlagUtils.mjs
49
49
  function getFlagDetailFromFlagAndPayload(key, value, payload) {
50
50
  return {
51
51
  key,
@@ -62,7 +62,7 @@ function getFlagDetailFromFlagAndPayload(key, value, payload) {
62
62
  }
63
63
  var normalizeFlagsResponse, getFlagValuesFromFlags, getPayloadsFromFlags, getFeatureFlagValue, parsePayload;
64
64
  var init_featureFlagUtils = __esm({
65
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/featureFlagUtils.mjs"() {
65
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/featureFlagUtils.mjs"() {
66
66
  normalizeFlagsResponse = (flagsResponse) => {
67
67
  if ("flags" in flagsResponse) {
68
68
  const featureFlags = getFlagValuesFromFlags(flagsResponse.flags);
@@ -120,10 +120,10 @@ var init_featureFlagUtils = __esm({
120
120
  }
121
121
  });
122
122
 
123
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/vendor/uuidv7.mjs
123
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/vendor/uuidv7.mjs
124
124
  var DIGITS, UUID, V7Generator, getDefaultRandom, defaultGenerator, uuidv7, uuidv7obj;
125
125
  var init_uuidv7 = __esm({
126
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/vendor/uuidv7.mjs"() {
126
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/vendor/uuidv7.mjs"() {
127
127
  DIGITS = "0123456789abcdef";
128
128
  UUID = class _UUID {
129
129
  constructor(bytes) {
@@ -284,10 +284,10 @@ var init_uuidv7 = __esm({
284
284
  }
285
285
  });
286
286
 
287
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/bot-detection.mjs
287
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/utils/bot-detection.mjs
288
288
  var DEFAULT_BLOCKED_UA_STRS, isBlockedUA;
289
289
  var init_bot_detection = __esm({
290
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/bot-detection.mjs"() {
290
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/utils/bot-detection.mjs"() {
291
291
  DEFAULT_BLOCKED_UA_STRS = [
292
292
  "amazonbot",
293
293
  "amazonproductbot",
@@ -378,10 +378,10 @@ var init_bot_detection = __esm({
378
378
  }
379
379
  });
380
380
 
381
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/types.mjs
382
- var types_PostHogPersistedProperty;
381
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/types.mjs
382
+ var types_PostHogPersistedProperty, FeatureFlagError;
383
383
  var init_types = __esm({
384
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/types.mjs"() {
384
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/types.mjs"() {
385
385
  types_PostHogPersistedProperty = /* @__PURE__ */ (function(PostHogPersistedProperty) {
386
386
  PostHogPersistedProperty["AnonymousId"] = "anonymous_id";
387
387
  PostHogPersistedProperty["DistinctId"] = "distinct_id";
@@ -410,23 +410,25 @@ var init_types = __esm({
410
410
  PostHogPersistedProperty["FlagsEndpointWasHit"] = "flags_endpoint_was_hit";
411
411
  return PostHogPersistedProperty;
412
412
  })({});
413
+ FeatureFlagError = {
414
+ ERRORS_WHILE_COMPUTING: "errors_while_computing_flags",
415
+ FLAG_MISSING: "flag_missing",
416
+ QUOTA_LIMITED: "quota_limited",
417
+ TIMEOUT: "timeout",
418
+ CONNECTION_ERROR: "connection_error",
419
+ UNKNOWN_ERROR: "unknown_error",
420
+ apiError: (status) => `api_error_${status}`
421
+ };
413
422
  }
414
423
  });
415
424
 
416
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/string-utils.mjs
425
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/utils/string-utils.mjs
417
426
  var init_string_utils = __esm({
418
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/string-utils.mjs"() {
427
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/utils/string-utils.mjs"() {
419
428
  }
420
429
  });
421
430
 
422
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/type-utils.mjs
423
- function isInstanceOf(candidate, base) {
424
- try {
425
- return candidate instanceof base;
426
- } catch {
427
- return false;
428
- }
429
- }
431
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/utils/type-utils.mjs
430
432
  function isPrimitive(value) {
431
433
  return null === value || "object" != typeof value;
432
434
  }
@@ -442,9 +444,16 @@ function isEvent(candidate) {
442
444
  function isPlainObject(candidate) {
443
445
  return isBuiltin(candidate, "Object");
444
446
  }
445
- var nativeIsArray, ObjProto, type_utils_toString, isArray, isUndefined, isString, isEmptyString, isNumber, isPlainError;
447
+ function isInstanceOf(candidate, base) {
448
+ try {
449
+ return candidate instanceof base;
450
+ } catch {
451
+ return false;
452
+ }
453
+ }
454
+ var nativeIsArray, ObjProto, type_utils_toString, isArray, isObject, isUndefined, isString, isEmptyString, isNumber, isPlainError;
446
455
  var init_type_utils = __esm({
447
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/type-utils.mjs"() {
456
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/utils/type-utils.mjs"() {
448
457
  init_types();
449
458
  init_string_utils();
450
459
  nativeIsArray = Array.isArray;
@@ -454,15 +463,16 @@ var init_type_utils = __esm({
454
463
  isArray = nativeIsArray || function(obj) {
455
464
  return "[object Array]" === type_utils_toString.call(obj);
456
465
  };
466
+ isObject = (x) => x === Object(x) && !isArray(x);
457
467
  isUndefined = (x) => void 0 === x;
458
468
  isString = (x) => "[object String]" == type_utils_toString.call(x);
459
469
  isEmptyString = (x) => isString(x) && 0 === x.trim().length;
460
- isNumber = (x) => "[object Number]" == type_utils_toString.call(x);
470
+ isNumber = (x) => "[object Number]" == type_utils_toString.call(x) && x === x;
461
471
  isPlainError = (x) => x instanceof Error;
462
472
  }
463
473
  });
464
474
 
465
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/number-utils.mjs
475
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/utils/number-utils.mjs
466
476
  function clampToRange(value, min, max, logger, fallbackValue) {
467
477
  if (min > max) {
468
478
  logger.warn("min cannot be greater than max.");
@@ -480,15 +490,15 @@ function clampToRange(value, min, max, logger, fallbackValue) {
480
490
  return clampToRange(max, min, max, logger);
481
491
  }
482
492
  var init_number_utils = __esm({
483
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/number-utils.mjs"() {
493
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/utils/number-utils.mjs"() {
484
494
  init_type_utils();
485
495
  }
486
496
  });
487
497
 
488
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/bucketed-rate-limiter.mjs
498
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/utils/bucketed-rate-limiter.mjs
489
499
  var ONE_DAY_IN_MS, BucketedRateLimiter;
490
500
  var init_bucketed_rate_limiter = __esm({
491
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/bucketed-rate-limiter.mjs"() {
501
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/utils/bucketed-rate-limiter.mjs"() {
492
502
  init_number_utils();
493
503
  ONE_DAY_IN_MS = 864e5;
494
504
  BucketedRateLimiter = class {
@@ -532,10 +542,10 @@ var init_bucketed_rate_limiter = __esm({
532
542
  }
533
543
  });
534
544
 
535
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/promise-queue.mjs
545
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/utils/promise-queue.mjs
536
546
  var PromiseQueue;
537
547
  var init_promise_queue = __esm({
538
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/promise-queue.mjs"() {
548
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/utils/promise-queue.mjs"() {
539
549
  init_uuidv7();
540
550
  PromiseQueue = class {
541
551
  add(promise) {
@@ -566,7 +576,7 @@ var init_promise_queue = __esm({
566
576
  }
567
577
  });
568
578
 
569
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/logger.mjs
579
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/utils/logger.mjs
570
580
  function createConsole(consoleLike = console) {
571
581
  const lockedMethods = {
572
582
  log: consoleLike.log.bind(consoleLike),
@@ -581,7 +591,7 @@ function createLogger(prefix, maybeCall = passThrough) {
581
591
  }
582
592
  var _createLogger, passThrough;
583
593
  var init_logger = __esm({
584
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/logger.mjs"() {
594
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/utils/logger.mjs"() {
585
595
  _createLogger = (prefix, maybeCall, consoleLike) => {
586
596
  function _log(level, ...args) {
587
597
  maybeCall(() => {
@@ -610,10 +620,10 @@ var init_logger = __esm({
610
620
  }
611
621
  });
612
622
 
613
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/user-agent-utils.mjs
623
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/utils/user-agent-utils.mjs
614
624
  var MOBILE, TABLET, GENERIC;
615
625
  var init_user_agent_utils = __esm({
616
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/user-agent-utils.mjs"() {
626
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/utils/user-agent-utils.mjs"() {
617
627
  init_string_utils();
618
628
  init_type_utils();
619
629
  MOBILE = "Mobile";
@@ -624,7 +634,7 @@ var init_user_agent_utils = __esm({
624
634
  }
625
635
  });
626
636
 
627
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/index.mjs
637
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/utils/index.mjs
628
638
  function assert(truthyValue, message) {
629
639
  if (!truthyValue || "string" != typeof truthyValue || isEmpty(truthyValue)) throw new Error(message);
630
640
  }
@@ -668,7 +678,7 @@ function allSettled(promises) {
668
678
  }
669
679
  var STRING_FORMAT, isError;
670
680
  var init_utils = __esm({
671
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/utils/index.mjs"() {
681
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/utils/index.mjs"() {
672
682
  init_bot_detection();
673
683
  init_bucketed_rate_limiter();
674
684
  init_number_utils();
@@ -682,10 +692,10 @@ var init_utils = __esm({
682
692
  }
683
693
  });
684
694
 
685
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/eventemitter.mjs
695
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/eventemitter.mjs
686
696
  var SimpleEventEmitter;
687
697
  var init_eventemitter = __esm({
688
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/eventemitter.mjs"() {
698
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/eventemitter.mjs"() {
689
699
  SimpleEventEmitter = class {
690
700
  constructor() {
691
701
  this.events = {};
@@ -706,7 +716,7 @@ var init_eventemitter = __esm({
706
716
  }
707
717
  });
708
718
 
709
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/gzip.mjs
719
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/gzip.mjs
710
720
  function isGzipSupported() {
711
721
  return "CompressionStream" in globalThis;
712
722
  }
@@ -725,11 +735,11 @@ async function gzipCompress(input, isDebug = true) {
725
735
  }
726
736
  }
727
737
  var init_gzip = __esm({
728
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/gzip.mjs"() {
738
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/gzip.mjs"() {
729
739
  }
730
740
  });
731
741
 
732
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/posthog-core-stateless.mjs
742
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/posthog-core-stateless.mjs
733
743
  async function logFlushError(err) {
734
744
  if (err instanceof PostHogFetchHttpError) {
735
745
  let text = "";
@@ -749,7 +759,7 @@ function isPostHogFetchContentTooLargeError(err) {
749
759
  }
750
760
  var PostHogFetchHttpError, PostHogFetchNetworkError, PostHogCoreStateless;
751
761
  var init_posthog_core_stateless = __esm({
752
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/posthog-core-stateless.mjs"() {
762
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/posthog-core-stateless.mjs"() {
753
763
  init_eventemitter();
754
764
  init_featureFlagUtils();
755
765
  init_gzip();
@@ -805,10 +815,11 @@ var init_posthog_core_stateless = __esm({
805
815
  this.disableGeoip = options.disableGeoip ?? true;
806
816
  this.disabled = options.disabled ?? false;
807
817
  this.historicalMigration = options?.historicalMigration ?? false;
808
- this.evaluationEnvironments = options?.evaluationEnvironments;
809
818
  this._initPromise = Promise.resolve();
810
819
  this._isInitialized = true;
811
820
  this._logger = createLogger("[PostHog]", this.logMsgIfDebug.bind(this));
821
+ this.evaluationContexts = options?.evaluationContexts ?? options?.evaluationEnvironments;
822
+ if (options?.evaluationEnvironments && !options?.evaluationContexts) this._logger.warn("evaluationEnvironments is deprecated. Use evaluationContexts instead. This property will be removed in a future version.");
812
823
  this.disableCompression = !isGzipSupported() || (options?.disableCompression ?? false);
813
824
  }
814
825
  logMsgIfDebug(fn) {
@@ -983,7 +994,7 @@ var init_posthog_core_stateless = __esm({
983
994
  group_properties: groupProperties,
984
995
  ...extraPayload
985
996
  };
986
- if (this.evaluationEnvironments && this.evaluationEnvironments.length > 0) requestData.evaluation_environments = this.evaluationEnvironments;
997
+ if (this.evaluationContexts && this.evaluationContexts.length > 0) requestData.evaluation_contexts = this.evaluationContexts;
987
998
  const fetchOptions = {
988
999
  method: "POST",
989
1000
  headers: {
@@ -995,10 +1006,35 @@ var init_posthog_core_stateless = __esm({
995
1006
  this._logger.info("Flags URL", url);
996
1007
  return this.fetchWithRetry(url, fetchOptions, {
997
1008
  retryCount: 0
998
- }, this.featureFlagsRequestTimeoutMs).then((response) => response.json()).then((response) => normalizeFlagsResponse(response)).catch((error) => {
1009
+ }, this.featureFlagsRequestTimeoutMs).then((response) => response.json()).then((response) => ({
1010
+ success: true,
1011
+ response: normalizeFlagsResponse(response)
1012
+ })).catch((error) => {
999
1013
  this._events.emit("error", error);
1014
+ return {
1015
+ success: false,
1016
+ error: this.categorizeRequestError(error)
1017
+ };
1000
1018
  });
1001
1019
  }
1020
+ categorizeRequestError(error) {
1021
+ if (error instanceof PostHogFetchHttpError) return {
1022
+ type: "api_error",
1023
+ statusCode: error.status
1024
+ };
1025
+ if (error instanceof PostHogFetchNetworkError) {
1026
+ const cause = error.error;
1027
+ if (cause instanceof Error && ("AbortError" === cause.name || "TimeoutError" === cause.name)) return {
1028
+ type: "timeout"
1029
+ };
1030
+ return {
1031
+ type: "connection_error"
1032
+ };
1033
+ }
1034
+ return {
1035
+ type: "unknown_error"
1036
+ };
1037
+ }
1002
1038
  async getFeatureFlagStateless(key, distinctId, groups = {}, personProperties = {}, groupProperties = {}, disableGeoip) {
1003
1039
  await this._initPromise;
1004
1040
  const flagDetailResponse = await this.getFeatureFlagDetailStateless(key, distinctId, groups, personProperties, groupProperties, disableGeoip);
@@ -1065,8 +1101,9 @@ var init_posthog_core_stateless = __esm({
1065
1101
  const extraPayload = {};
1066
1102
  if (disableGeoip ?? this.disableGeoip) extraPayload["geoip_disable"] = true;
1067
1103
  if (flagKeysToEvaluate) extraPayload["flag_keys_to_evaluate"] = flagKeysToEvaluate;
1068
- const flagsResponse = await this.getFlags(distinctId, groups, personProperties, groupProperties, extraPayload);
1069
- if (void 0 === flagsResponse) return;
1104
+ const result = await this.getFlags(distinctId, groups, personProperties, groupProperties, extraPayload);
1105
+ if (!result.success) return;
1106
+ const flagsResponse = result.response;
1070
1107
  if (flagsResponse.errorsWhileComputingFlags) console.error("[FEATURE FLAGS] Error while computing feature flags, some flags may be missing or incorrect. Learn more at https://posthog.com/docs/feature-flags/best-practices");
1071
1108
  if (flagsResponse.quotaLimited?.includes("feature_flags")) {
1072
1109
  console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - feature flags unavailable. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts");
@@ -1133,10 +1170,15 @@ var init_posthog_core_stateless = __esm({
1133
1170
  this.setPersistedProperty(types_PostHogPersistedProperty.Props, this.props);
1134
1171
  });
1135
1172
  }
1173
+ processBeforeEnqueue(message) {
1174
+ return message;
1175
+ }
1136
1176
  enqueue(type, _message, options) {
1137
1177
  this.wrap(() => {
1138
1178
  if (this.optedOut) return void this._events.emit(type, "Library is disabled. Not sending event. To re-enable, call posthog.optIn()");
1139
- const message = this.prepareMessage(type, _message, options);
1179
+ let message = this.prepareMessage(type, _message, options);
1180
+ message = this.processBeforeEnqueue(message);
1181
+ if (null === message) return;
1140
1182
  const queue = this.getPersistedProperty(types_PostHogPersistedProperty.Queue) || [];
1141
1183
  if (queue.length >= this.maxQueueSize) {
1142
1184
  queue.shift();
@@ -1155,10 +1197,13 @@ var init_posthog_core_stateless = __esm({
1155
1197
  if (this.disabled) return void this._logger.warn("The client is disabled");
1156
1198
  if (!this._isInitialized) await this._initPromise;
1157
1199
  if (this.optedOut) return void this._events.emit(type, "Library is disabled. Not sending event. To re-enable, call posthog.optIn()");
1200
+ let message = this.prepareMessage(type, _message, options);
1201
+ message = this.processBeforeEnqueue(message);
1202
+ if (null === message) return;
1158
1203
  const data = {
1159
1204
  api_key: this.apiKey,
1160
1205
  batch: [
1161
- this.prepareMessage(type, _message, options)
1206
+ message
1162
1207
  ],
1163
1208
  sent_at: currentISOTime()
1164
1209
  };
@@ -1367,9 +1412,9 @@ var init_posthog_core_stateless = __esm({
1367
1412
  }
1368
1413
  });
1369
1414
 
1370
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/posthog-core.mjs
1415
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/posthog-core.mjs
1371
1416
  var init_posthog_core = __esm({
1372
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/posthog-core.mjs"() {
1417
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/posthog-core.mjs"() {
1373
1418
  init_featureFlagUtils();
1374
1419
  init_types();
1375
1420
  init_posthog_core_stateless();
@@ -1378,7 +1423,7 @@ var init_posthog_core = __esm({
1378
1423
  }
1379
1424
  });
1380
1425
 
1381
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/chunk-ids.mjs
1426
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/chunk-ids.mjs
1382
1427
  function getFilenameToChunkIdMap(stackParser) {
1383
1428
  const chunkIdMap = globalThis._posthogChunkIds;
1384
1429
  if (!chunkIdMap) return;
@@ -1411,14 +1456,14 @@ function getFilenameToChunkIdMap(stackParser) {
1411
1456
  }
1412
1457
  var parsedStackResults, lastKeysCount, cachedFilenameChunkIds;
1413
1458
  var init_chunk_ids = __esm({
1414
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/chunk-ids.mjs"() {
1459
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/chunk-ids.mjs"() {
1415
1460
  }
1416
1461
  });
1417
1462
 
1418
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/error-properties-builder.mjs
1463
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/error-properties-builder.mjs
1419
1464
  var MAX_CAUSE_RECURSION, ErrorPropertiesBuilder;
1420
1465
  var init_error_properties_builder = __esm({
1421
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/error-properties-builder.mjs"() {
1466
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/error-properties-builder.mjs"() {
1422
1467
  init_utils();
1423
1468
  init_chunk_ids();
1424
1469
  MAX_CAUSE_RECURSION = 4;
@@ -1532,7 +1577,7 @@ var init_error_properties_builder = __esm({
1532
1577
  }
1533
1578
  });
1534
1579
 
1535
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/base.mjs
1580
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/parsers/base.mjs
1536
1581
  function createFrame(platform, filename, func, lineno, colno) {
1537
1582
  const frame = {
1538
1583
  platform,
@@ -1546,16 +1591,16 @@ function createFrame(platform, filename, func, lineno, colno) {
1546
1591
  }
1547
1592
  var UNKNOWN_FUNCTION;
1548
1593
  var init_base = __esm({
1549
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/base.mjs"() {
1594
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/parsers/base.mjs"() {
1550
1595
  init_utils();
1551
1596
  UNKNOWN_FUNCTION = "?";
1552
1597
  }
1553
1598
  });
1554
1599
 
1555
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/safari.mjs
1600
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/parsers/safari.mjs
1556
1601
  var extractSafariExtensionDetails;
1557
1602
  var init_safari = __esm({
1558
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/safari.mjs"() {
1603
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/parsers/safari.mjs"() {
1559
1604
  init_base();
1560
1605
  extractSafariExtensionDetails = (func, filename) => {
1561
1606
  const isSafariExtension = -1 !== func.indexOf("safari-extension");
@@ -1571,10 +1616,10 @@ var init_safari = __esm({
1571
1616
  }
1572
1617
  });
1573
1618
 
1574
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/chrome.mjs
1619
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/parsers/chrome.mjs
1575
1620
  var chromeRegexNoFnName, chromeRegex, chromeEvalRegex, chromeStackLineParser;
1576
1621
  var init_chrome = __esm({
1577
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/chrome.mjs"() {
1622
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/parsers/chrome.mjs"() {
1578
1623
  init_base();
1579
1624
  init_safari();
1580
1625
  chromeRegexNoFnName = /^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i;
@@ -1604,23 +1649,10 @@ var init_chrome = __esm({
1604
1649
  }
1605
1650
  });
1606
1651
 
1607
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/winjs.mjs
1608
- var winjsRegex, winjsStackLineParser;
1609
- var init_winjs = __esm({
1610
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/winjs.mjs"() {
1611
- init_base();
1612
- winjsRegex = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i;
1613
- winjsStackLineParser = (line, platform) => {
1614
- const parts = winjsRegex.exec(line);
1615
- return parts ? createFrame(platform, parts[2], parts[1] || UNKNOWN_FUNCTION, +parts[3], parts[4] ? +parts[4] : void 0) : void 0;
1616
- };
1617
- }
1618
- });
1619
-
1620
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/gecko.mjs
1652
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/parsers/gecko.mjs
1621
1653
  var geckoREgex, geckoEvalRegex, geckoStackLineParser;
1622
1654
  var init_gecko = __esm({
1623
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/gecko.mjs"() {
1655
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/parsers/gecko.mjs"() {
1624
1656
  init_base();
1625
1657
  init_safari();
1626
1658
  geckoREgex = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i;
@@ -1647,10 +1679,23 @@ var init_gecko = __esm({
1647
1679
  }
1648
1680
  });
1649
1681
 
1650
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/opera.mjs
1682
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/parsers/winjs.mjs
1683
+ var winjsRegex, winjsStackLineParser;
1684
+ var init_winjs = __esm({
1685
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/parsers/winjs.mjs"() {
1686
+ init_base();
1687
+ winjsRegex = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i;
1688
+ winjsStackLineParser = (line, platform) => {
1689
+ const parts = winjsRegex.exec(line);
1690
+ return parts ? createFrame(platform, parts[2], parts[1] || UNKNOWN_FUNCTION, +parts[3], parts[4] ? +parts[4] : void 0) : void 0;
1691
+ };
1692
+ }
1693
+ });
1694
+
1695
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/parsers/opera.mjs
1651
1696
  var opera10Regex, opera10StackLineParser, opera11Regex, opera11StackLineParser;
1652
1697
  var init_opera = __esm({
1653
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/opera.mjs"() {
1698
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/parsers/opera.mjs"() {
1654
1699
  init_base();
1655
1700
  opera10Regex = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i;
1656
1701
  opera10StackLineParser = (line, platform) => {
@@ -1665,7 +1710,7 @@ var init_opera = __esm({
1665
1710
  }
1666
1711
  });
1667
1712
 
1668
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/node.mjs
1713
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/parsers/node.mjs
1669
1714
  function filenameIsInApp(filename, isNative = false) {
1670
1715
  const isInternal = isNative || filename && !filename.startsWith("/") && !filename.match(/^[A-Z]:/) && !filename.startsWith(".") && !filename.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//);
1671
1716
  return !isInternal && void 0 !== filename && !filename.includes("node_modules/");
@@ -1675,7 +1720,7 @@ function _parseIntOrUndefined(input) {
1675
1720
  }
1676
1721
  var FILENAME_MATCH, FULL_MATCH, nodeStackLineParser;
1677
1722
  var init_node = __esm({
1678
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/node.mjs"() {
1723
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/parsers/node.mjs"() {
1679
1724
  init_base();
1680
1725
  FILENAME_MATCH = /^\s*[-]{4,}$/;
1681
1726
  FULL_MATCH = /at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;
@@ -1736,7 +1781,7 @@ var init_node = __esm({
1736
1781
  }
1737
1782
  });
1738
1783
 
1739
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/index.mjs
1784
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/parsers/index.mjs
1740
1785
  function reverseAndStripFrames(stack) {
1741
1786
  if (!stack.length) return [];
1742
1787
  const localStack = Array.from(stack);
@@ -1750,6 +1795,9 @@ function reverseAndStripFrames(stack) {
1750
1795
  function getLastStackFrame(arr) {
1751
1796
  return arr[arr.length - 1] || {};
1752
1797
  }
1798
+ function createDefaultStackParser() {
1799
+ return createStackParser("web:javascript", chromeStackLineParser, geckoStackLineParser);
1800
+ }
1753
1801
  function createStackParser(platform, ...parsers) {
1754
1802
  return (stack, skipFirstLines = 0) => {
1755
1803
  const frames = [];
@@ -1774,11 +1822,11 @@ function createStackParser(platform, ...parsers) {
1774
1822
  }
1775
1823
  var WEBPACK_ERROR_REGEXP, STACKTRACE_FRAME_LIMIT;
1776
1824
  var init_parsers = __esm({
1777
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/parsers/index.mjs"() {
1825
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/parsers/index.mjs"() {
1778
1826
  init_base();
1779
1827
  init_chrome();
1780
- init_winjs();
1781
1828
  init_gecko();
1829
+ init_winjs();
1782
1830
  init_opera();
1783
1831
  init_node();
1784
1832
  WEBPACK_ERROR_REGEXP = /\(error: (.*)\)/;
@@ -1786,10 +1834,10 @@ var init_parsers = __esm({
1786
1834
  }
1787
1835
  });
1788
1836
 
1789
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/dom-exception-coercer.mjs
1837
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/coercers/dom-exception-coercer.mjs
1790
1838
  var DOMExceptionCoercer;
1791
1839
  var init_dom_exception_coercer = __esm({
1792
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/dom-exception-coercer.mjs"() {
1840
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/coercers/dom-exception-coercer.mjs"() {
1793
1841
  init_utils();
1794
1842
  DOMExceptionCoercer = class {
1795
1843
  match(err) {
@@ -1823,10 +1871,10 @@ var init_dom_exception_coercer = __esm({
1823
1871
  }
1824
1872
  });
1825
1873
 
1826
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/error-coercer.mjs
1874
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/coercers/error-coercer.mjs
1827
1875
  var ErrorCoercer;
1828
1876
  var init_error_coercer = __esm({
1829
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/error-coercer.mjs"() {
1877
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/coercers/error-coercer.mjs"() {
1830
1878
  init_utils();
1831
1879
  ErrorCoercer = class {
1832
1880
  match(err) {
@@ -1856,10 +1904,10 @@ var init_error_coercer = __esm({
1856
1904
  }
1857
1905
  });
1858
1906
 
1859
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/error-event-coercer.mjs
1907
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/coercers/error-event-coercer.mjs
1860
1908
  var ErrorEventCoercer;
1861
1909
  var init_error_event_coercer = __esm({
1862
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/error-event-coercer.mjs"() {
1910
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/coercers/error-event-coercer.mjs"() {
1863
1911
  init_utils();
1864
1912
  ErrorEventCoercer = class {
1865
1913
  constructor() {
@@ -1881,10 +1929,10 @@ var init_error_event_coercer = __esm({
1881
1929
  }
1882
1930
  });
1883
1931
 
1884
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/string-coercer.mjs
1932
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/coercers/string-coercer.mjs
1885
1933
  var ERROR_TYPES_PATTERN, StringCoercer;
1886
1934
  var init_string_coercer = __esm({
1887
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/string-coercer.mjs"() {
1935
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/coercers/string-coercer.mjs"() {
1888
1936
  ERROR_TYPES_PATTERN = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;
1889
1937
  StringCoercer = class {
1890
1938
  match(input) {
@@ -1916,10 +1964,10 @@ var init_string_coercer = __esm({
1916
1964
  }
1917
1965
  });
1918
1966
 
1919
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/types.mjs
1967
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/types.mjs
1920
1968
  var severityLevels;
1921
1969
  var init_types2 = __esm({
1922
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/types.mjs"() {
1970
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/types.mjs"() {
1923
1971
  severityLevels = [
1924
1972
  "fatal",
1925
1973
  "error",
@@ -1931,7 +1979,7 @@ var init_types2 = __esm({
1931
1979
  }
1932
1980
  });
1933
1981
 
1934
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/utils.mjs
1982
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/coercers/utils.mjs
1935
1983
  function extractExceptionKeysForMessage(err, maxLength = 40) {
1936
1984
  const keys = Object.keys(err);
1937
1985
  keys.sort();
@@ -1946,14 +1994,14 @@ function extractExceptionKeysForMessage(err, maxLength = 40) {
1946
1994
  return "";
1947
1995
  }
1948
1996
  var init_utils2 = __esm({
1949
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/utils.mjs"() {
1997
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/coercers/utils.mjs"() {
1950
1998
  }
1951
1999
  });
1952
2000
 
1953
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/object-coercer.mjs
2001
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/coercers/object-coercer.mjs
1954
2002
  var ObjectCoercer;
1955
2003
  var init_object_coercer = __esm({
1956
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/object-coercer.mjs"() {
2004
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/coercers/object-coercer.mjs"() {
1957
2005
  init_utils();
1958
2006
  init_types2();
1959
2007
  init_utils2();
@@ -2007,10 +2055,10 @@ var init_object_coercer = __esm({
2007
2055
  }
2008
2056
  });
2009
2057
 
2010
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/event-coercer.mjs
2058
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/coercers/event-coercer.mjs
2011
2059
  var EventCoercer;
2012
2060
  var init_event_coercer = __esm({
2013
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/event-coercer.mjs"() {
2061
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/coercers/event-coercer.mjs"() {
2014
2062
  init_utils();
2015
2063
  init_utils2();
2016
2064
  EventCoercer = class {
@@ -2030,10 +2078,10 @@ var init_event_coercer = __esm({
2030
2078
  }
2031
2079
  });
2032
2080
 
2033
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/primitive-coercer.mjs
2081
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/coercers/primitive-coercer.mjs
2034
2082
  var PrimitiveCoercer;
2035
2083
  var init_primitive_coercer = __esm({
2036
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/primitive-coercer.mjs"() {
2084
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/coercers/primitive-coercer.mjs"() {
2037
2085
  init_utils();
2038
2086
  PrimitiveCoercer = class {
2039
2087
  match(candidate) {
@@ -2051,10 +2099,10 @@ var init_primitive_coercer = __esm({
2051
2099
  }
2052
2100
  });
2053
2101
 
2054
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/promise-rejection-event.mjs
2102
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/coercers/promise-rejection-event.mjs
2055
2103
  var PromiseRejectionEventCoercer;
2056
2104
  var init_promise_rejection_event = __esm({
2057
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/promise-rejection-event.mjs"() {
2105
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/coercers/promise-rejection-event.mjs"() {
2058
2106
  init_utils();
2059
2107
  PromiseRejectionEventCoercer = class {
2060
2108
  match(err) {
@@ -2083,9 +2131,9 @@ var init_promise_rejection_event = __esm({
2083
2131
  }
2084
2132
  });
2085
2133
 
2086
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/index.mjs
2134
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/coercers/index.mjs
2087
2135
  var init_coercers = __esm({
2088
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/coercers/index.mjs"() {
2136
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/coercers/index.mjs"() {
2089
2137
  init_dom_exception_coercer();
2090
2138
  init_error_coercer();
2091
2139
  init_error_event_coercer();
@@ -2097,10 +2145,10 @@ var init_coercers = __esm({
2097
2145
  }
2098
2146
  });
2099
2147
 
2100
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/utils.mjs
2148
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/utils.mjs
2101
2149
  var ReduceableCache;
2102
2150
  var init_utils3 = __esm({
2103
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/utils.mjs"() {
2151
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/utils.mjs"() {
2104
2152
  ReduceableCache = class {
2105
2153
  constructor(_maxSize) {
2106
2154
  this._maxSize = _maxSize;
@@ -2126,7 +2174,7 @@ var init_utils3 = __esm({
2126
2174
  }
2127
2175
  });
2128
2176
 
2129
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/index.mjs
2177
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/index.mjs
2130
2178
  var error_tracking_exports = {};
2131
2179
  __export(error_tracking_exports, {
2132
2180
  DOMExceptionCoercer: () => DOMExceptionCoercer,
@@ -2140,6 +2188,7 @@ __export(error_tracking_exports, {
2140
2188
  ReduceableCache: () => ReduceableCache,
2141
2189
  StringCoercer: () => StringCoercer,
2142
2190
  chromeStackLineParser: () => chromeStackLineParser,
2191
+ createDefaultStackParser: () => createDefaultStackParser,
2143
2192
  createStackParser: () => createStackParser,
2144
2193
  geckoStackLineParser: () => geckoStackLineParser,
2145
2194
  nodeStackLineParser: () => nodeStackLineParser,
@@ -2149,7 +2198,7 @@ __export(error_tracking_exports, {
2149
2198
  winjsStackLineParser: () => winjsStackLineParser
2150
2199
  });
2151
2200
  var init_error_tracking = __esm({
2152
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/error-tracking/index.mjs"() {
2201
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/error-tracking/index.mjs"() {
2153
2202
  init_error_properties_builder();
2154
2203
  init_parsers();
2155
2204
  init_coercers();
@@ -2157,9 +2206,9 @@ var init_error_tracking = __esm({
2157
2206
  }
2158
2207
  });
2159
2208
 
2160
- // ../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/index.mjs
2209
+ // ../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/index.mjs
2161
2210
  var init_dist = __esm({
2162
- "../../node_modules/.pnpm/@posthog+core@1.9.0/node_modules/@posthog/core/dist/index.mjs"() {
2211
+ "../../node_modules/.pnpm/@posthog+core@1.13.0/node_modules/@posthog/core/dist/index.mjs"() {
2163
2212
  init_featureFlagUtils();
2164
2213
  init_uuidv7();
2165
2214
  init_utils();
@@ -2350,7 +2399,7 @@ function snipLine(line, colno) {
2350
2399
  }
2351
2400
  var LRU_FILE_CONTENTS_CACHE, LRU_FILE_CONTENTS_FS_READ_FAILED, DEFAULT_LINES_OF_CONTEXT, MAX_CONTEXTLINES_COLNO, MAX_CONTEXTLINES_LINENO;
2352
2401
  var init_context_lines_node = __esm({
2353
- "../../node_modules/.pnpm/posthog-node@5.19.0/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/context-lines.node.mjs"() {
2402
+ "../../node_modules/.pnpm/posthog-node@5.24.1/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/context-lines.node.mjs"() {
2354
2403
  init_dist();
2355
2404
  LRU_FILE_CONTENTS_CACHE = new error_tracking_exports.ReduceableCache(25);
2356
2405
  LRU_FILE_CONTENTS_FS_READ_FAILED = new error_tracking_exports.ReduceableCache(20);
@@ -2360,7 +2409,7 @@ var init_context_lines_node = __esm({
2360
2409
  }
2361
2410
  });
2362
2411
 
2363
- // ../../node_modules/.pnpm/posthog-node@5.19.0/node_modules/posthog-node/dist/extensions/error-tracking/autocapture.mjs
2412
+ // ../../node_modules/.pnpm/posthog-node@5.24.1/node_modules/posthog-node/dist/extensions/error-tracking/autocapture.mjs
2364
2413
  function makeUncaughtExceptionHandler(captureFn, onFatalFn) {
2365
2414
  let calledFatalError = false;
2366
2415
  return Object.assign((error) => {
@@ -2392,14 +2441,14 @@ function addUnhandledRejectionListener(captureFn) {
2392
2441
  }));
2393
2442
  }
2394
2443
  var init_autocapture = __esm({
2395
- "../../node_modules/.pnpm/posthog-node@5.19.0/node_modules/posthog-node/dist/extensions/error-tracking/autocapture.mjs"() {
2444
+ "../../node_modules/.pnpm/posthog-node@5.24.1/node_modules/posthog-node/dist/extensions/error-tracking/autocapture.mjs"() {
2396
2445
  }
2397
2446
  });
2398
2447
 
2399
- // ../../node_modules/.pnpm/posthog-node@5.19.0/node_modules/posthog-node/dist/extensions/error-tracking/index.mjs
2448
+ // ../../node_modules/.pnpm/posthog-node@5.24.1/node_modules/posthog-node/dist/extensions/error-tracking/index.mjs
2400
2449
  var SHUTDOWN_TIMEOUT, ErrorTracking;
2401
2450
  var init_error_tracking2 = __esm({
2402
- "../../node_modules/.pnpm/posthog-node@5.19.0/node_modules/posthog-node/dist/extensions/error-tracking/index.mjs"() {
2451
+ "../../node_modules/.pnpm/posthog-node@5.24.1/node_modules/posthog-node/dist/extensions/error-tracking/index.mjs"() {
2403
2452
  init_autocapture();
2404
2453
  init_dist();
2405
2454
  SHUTDOWN_TIMEOUT = 2e3;
@@ -2416,6 +2465,9 @@ var init_error_tracking2 = __esm({
2416
2465
  });
2417
2466
  this.startAutocaptureIfEnabled();
2418
2467
  }
2468
+ static isPreviouslyCapturedError(x) {
2469
+ return isObject(x) && "__posthog_previously_captured_error" in x && true === x.__posthog_previously_captured_error;
2470
+ }
2419
2471
  static async buildEventMessage(error, hint, distinctId, additionalProperties) {
2420
2472
  const properties = {
2421
2473
  ...additionalProperties
@@ -2440,14 +2492,16 @@ var init_error_tracking2 = __esm({
2440
2492
  }
2441
2493
  onException(exception, hint) {
2442
2494
  this.client.addPendingPromise((async () => {
2443
- const eventMessage = await _ErrorTracking.buildEventMessage(exception, hint);
2444
- const exceptionProperties = eventMessage.properties;
2445
- const exceptionType = exceptionProperties?.$exception_list[0]?.type ?? "Exception";
2446
- const isRateLimited = this._rateLimiter.consumeRateLimit(exceptionType);
2447
- if (isRateLimited) return void this._logger.info("Skipping exception capture because of client rate limiting.", {
2448
- exception: exceptionType
2449
- });
2450
- return this.client.capture(eventMessage);
2495
+ if (!_ErrorTracking.isPreviouslyCapturedError(exception)) {
2496
+ const eventMessage = await _ErrorTracking.buildEventMessage(exception, hint);
2497
+ const exceptionProperties = eventMessage.properties;
2498
+ const exceptionType = exceptionProperties?.$exception_list[0]?.type ?? "Exception";
2499
+ const isRateLimited = this._rateLimiter.consumeRateLimit(exceptionType);
2500
+ if (isRateLimited) return void this._logger.info("Skipping exception capture because of client rate limiting.", {
2501
+ exception: exceptionType
2502
+ });
2503
+ return this.client.capture(eventMessage);
2504
+ }
2451
2505
  })());
2452
2506
  }
2453
2507
  async onFatalError(exception) {
@@ -2465,19 +2519,19 @@ var init_error_tracking2 = __esm({
2465
2519
  }
2466
2520
  });
2467
2521
 
2468
- // ../../node_modules/.pnpm/posthog-node@5.19.0/node_modules/posthog-node/dist/version.mjs
2522
+ // ../../node_modules/.pnpm/posthog-node@5.24.1/node_modules/posthog-node/dist/version.mjs
2469
2523
  var version;
2470
2524
  var init_version = __esm({
2471
- "../../node_modules/.pnpm/posthog-node@5.19.0/node_modules/posthog-node/dist/version.mjs"() {
2472
- version = "5.19.0";
2525
+ "../../node_modules/.pnpm/posthog-node@5.24.1/node_modules/posthog-node/dist/version.mjs"() {
2526
+ version = "5.24.1";
2473
2527
  }
2474
2528
  });
2475
2529
 
2476
- // ../../node_modules/.pnpm/posthog-node@5.19.0/node_modules/posthog-node/dist/types.mjs
2477
- var FeatureFlagError;
2530
+ // ../../node_modules/.pnpm/posthog-node@5.24.1/node_modules/posthog-node/dist/types.mjs
2531
+ var FeatureFlagError2;
2478
2532
  var init_types3 = __esm({
2479
- "../../node_modules/.pnpm/posthog-node@5.19.0/node_modules/posthog-node/dist/types.mjs"() {
2480
- FeatureFlagError = {
2533
+ "../../node_modules/.pnpm/posthog-node@5.24.1/node_modules/posthog-node/dist/types.mjs"() {
2534
+ FeatureFlagError2 = {
2481
2535
  ERRORS_WHILE_COMPUTING: "errors_while_computing_flags",
2482
2536
  FLAG_MISSING: "flag_missing",
2483
2537
  QUOTA_LIMITED: "quota_limited",
@@ -2486,7 +2540,7 @@ var init_types3 = __esm({
2486
2540
  }
2487
2541
  });
2488
2542
 
2489
- // ../../node_modules/.pnpm/posthog-node@5.19.0/node_modules/posthog-node/dist/extensions/feature-flags/crypto.mjs
2543
+ // ../../node_modules/.pnpm/posthog-node@5.24.1/node_modules/posthog-node/dist/extensions/feature-flags/crypto.mjs
2490
2544
  async function hashSHA1(text) {
2491
2545
  const subtle = globalThis.crypto?.subtle;
2492
2546
  if (!subtle) throw new Error("SubtleCrypto API not available");
@@ -2495,11 +2549,11 @@ async function hashSHA1(text) {
2495
2549
  return hashArray.map((byte) => byte.toString(16).padStart(2, "0")).join("");
2496
2550
  }
2497
2551
  var init_crypto = __esm({
2498
- "../../node_modules/.pnpm/posthog-node@5.19.0/node_modules/posthog-node/dist/extensions/feature-flags/crypto.mjs"() {
2552
+ "../../node_modules/.pnpm/posthog-node@5.24.1/node_modules/posthog-node/dist/extensions/feature-flags/crypto.mjs"() {
2499
2553
  }
2500
2554
  });
2501
2555
 
2502
- // ../../node_modules/.pnpm/posthog-node@5.19.0/node_modules/posthog-node/dist/extensions/feature-flags/feature-flags.mjs
2556
+ // ../../node_modules/.pnpm/posthog-node@5.24.1/node_modules/posthog-node/dist/extensions/feature-flags/feature-flags.mjs
2503
2557
  async function _hash(key, distinctId, salt = "") {
2504
2558
  const hashString = await hashSHA1(`${key}.${distinctId}${salt}`);
2505
2559
  return parseInt(hashString.slice(0, 15), 16) / LONG_SCALE;
@@ -2667,7 +2721,7 @@ function relativeDateParseForFeatureFlagMatching(value) {
2667
2721
  }
2668
2722
  var SIXTY_SECONDS, LONG_SCALE, NULL_VALUES_ALLOWED_OPERATORS, ClientError, InconclusiveMatchError, RequiresServerEvaluation, FeatureFlagsPoller;
2669
2723
  var init_feature_flags = __esm({
2670
- "../../node_modules/.pnpm/posthog-node@5.19.0/node_modules/posthog-node/dist/extensions/feature-flags/feature-flags.mjs"() {
2724
+ "../../node_modules/.pnpm/posthog-node@5.24.1/node_modules/posthog-node/dist/extensions/feature-flags/feature-flags.mjs"() {
2671
2725
  init_dist();
2672
2726
  init_crypto();
2673
2727
  SIXTY_SECONDS = 6e4;
@@ -2721,6 +2775,7 @@ var init_feature_flags = __esm({
2721
2775
  this.customHeaders = customHeaders;
2722
2776
  this.onLoad = options.onLoad;
2723
2777
  this.cacheProvider = options.cacheProvider;
2778
+ this.strictLocalEvaluation = options.strictLocalEvaluation ?? false;
2724
2779
  this.loadFeatureFlags();
2725
2780
  }
2726
2781
  debug(enabled = true) {
@@ -2916,6 +2971,11 @@ var init_feature_flags = __esm({
2916
2971
  this.cohorts = flagData.cohorts;
2917
2972
  this.loadedSuccessfullyOnce = true;
2918
2973
  }
2974
+ warnAboutExperienceContinuityFlags(flags) {
2975
+ if (this.strictLocalEvaluation) return;
2976
+ const experienceContinuityFlags = flags.filter((f) => f.ensure_experience_continuity);
2977
+ if (experienceContinuityFlags.length > 0) console.warn(`[PostHog] You are using local evaluation but ${experienceContinuityFlags.length} flag(s) have experience continuity enabled: ${experienceContinuityFlags.map((f) => f.key).join(", ")}. Experience continuity is incompatible with local evaluation and will cause a server request on every flag evaluation, negating local evaluation cost savings. To avoid server requests and unexpected costs, either disable experience continuity on these flags in PostHog, use strictLocalEvaluation: true in client init, or pass onlyEvaluateLocally: true per flag call (flags that cannot be evaluated locally will return undefined).`);
2978
+ }
2919
2979
  async loadFromCache(debugMessage) {
2920
2980
  if (!this.cacheProvider) return false;
2921
2981
  try {
@@ -2924,6 +2984,7 @@ var init_feature_flags = __esm({
2924
2984
  this.updateFlagState(cached);
2925
2985
  this.logMsgIfDebug(() => console.debug(`[FEATURE FLAGS] ${debugMessage} (${cached.flags.length} flags)`));
2926
2986
  this.onLoad?.(this.featureFlags.length);
2987
+ this.warnAboutExperienceContinuityFlags(cached.flags);
2927
2988
  return true;
2928
2989
  }
2929
2990
  return false;
@@ -3017,6 +3078,7 @@ var init_feature_flags = __esm({
3017
3078
  this.onError?.(new Error(`Failed to store in cache: ${err}`));
3018
3079
  }
3019
3080
  this.onLoad?.(this.featureFlags.length);
3081
+ this.warnAboutExperienceContinuityFlags(flagData.flags);
3020
3082
  break;
3021
3083
  }
3022
3084
  default:
@@ -3072,10 +3134,10 @@ var init_feature_flags = __esm({
3072
3134
  }
3073
3135
  });
3074
3136
 
3075
- // ../../node_modules/.pnpm/posthog-node@5.19.0/node_modules/posthog-node/dist/storage-memory.mjs
3137
+ // ../../node_modules/.pnpm/posthog-node@5.24.1/node_modules/posthog-node/dist/storage-memory.mjs
3076
3138
  var PostHogMemoryStorage;
3077
3139
  var init_storage_memory = __esm({
3078
- "../../node_modules/.pnpm/posthog-node@5.19.0/node_modules/posthog-node/dist/storage-memory.mjs"() {
3140
+ "../../node_modules/.pnpm/posthog-node@5.24.1/node_modules/posthog-node/dist/storage-memory.mjs"() {
3079
3141
  PostHogMemoryStorage = class {
3080
3142
  getProperty(key) {
3081
3143
  return this._memoryStorage[key];
@@ -3090,10 +3152,10 @@ var init_storage_memory = __esm({
3090
3152
  }
3091
3153
  });
3092
3154
 
3093
- // ../../node_modules/.pnpm/posthog-node@5.19.0/node_modules/posthog-node/dist/client.mjs
3155
+ // ../../node_modules/.pnpm/posthog-node@5.24.1/node_modules/posthog-node/dist/client.mjs
3094
3156
  var MINIMUM_POLLING_INTERVAL, THIRTY_SECONDS, MAX_CACHE_SIZE, PostHogBackendClient;
3095
3157
  var init_client = __esm({
3096
- "../../node_modules/.pnpm/posthog-node@5.19.0/node_modules/posthog-node/dist/client.mjs"() {
3158
+ "../../node_modules/.pnpm/posthog-node@5.24.1/node_modules/posthog-node/dist/client.mjs"() {
3097
3159
  init_version();
3098
3160
  init_dist();
3099
3161
  init_types3();
@@ -3126,7 +3188,8 @@ var init_client = __esm({
3126
3188
  this._events.emit("localEvaluationFlagsLoaded", count);
3127
3189
  },
3128
3190
  customHeaders: this.getCustomHeaders(),
3129
- cacheProvider: options.flagDefinitionCacheProvider
3191
+ cacheProvider: options.flagDefinitionCacheProvider,
3192
+ strictLocalEvaluation: options.strictLocalEvaluation
3130
3193
  });
3131
3194
  }
3132
3195
  this.errorTracking = new ErrorTracking(this, options, this._logger);
@@ -3232,94 +3295,148 @@ var init_client = __esm({
3232
3295
  });
3233
3296
  });
3234
3297
  }
3235
- async getFeatureFlag(key, distinctId, options) {
3236
- if (void 0 !== this._flagOverrides && key in this._flagOverrides) return this._flagOverrides[key];
3237
- const { groups, disableGeoip } = options || {};
3238
- let { onlyEvaluateLocally, sendFeatureFlagEvents, personProperties, groupProperties } = options || {};
3298
+ async _getFeatureFlagResult(key, distinctId, options = {}, matchValue) {
3299
+ const sendFeatureFlagEvents = options.sendFeatureFlagEvents ?? true;
3300
+ if (void 0 !== this._flagOverrides && key in this._flagOverrides) {
3301
+ const overrideValue = this._flagOverrides[key];
3302
+ if (void 0 === overrideValue) return;
3303
+ const overridePayload = this._payloadOverrides?.[key];
3304
+ return {
3305
+ key,
3306
+ enabled: false !== overrideValue,
3307
+ variant: "string" == typeof overrideValue ? overrideValue : void 0,
3308
+ payload: overridePayload
3309
+ };
3310
+ }
3311
+ const { groups, disableGeoip } = options;
3312
+ let { onlyEvaluateLocally, personProperties, groupProperties } = options;
3239
3313
  const adjustedProperties = this.addLocalPersonAndGroupProperties(distinctId, groups, personProperties, groupProperties);
3240
3314
  personProperties = adjustedProperties.allPersonProperties;
3241
3315
  groupProperties = adjustedProperties.allGroupProperties;
3242
- if (void 0 == onlyEvaluateLocally) onlyEvaluateLocally = false;
3243
- if (void 0 == sendFeatureFlagEvents) sendFeatureFlagEvents = this.options.sendFeatureFlagEvent ?? true;
3244
- let response = await this.featureFlagsPoller?.getFeatureFlag(key, distinctId, groups, personProperties, groupProperties);
3245
- const flagWasLocallyEvaluated = void 0 !== response;
3316
+ if (void 0 == onlyEvaluateLocally) onlyEvaluateLocally = this.options.strictLocalEvaluation ?? false;
3317
+ let result;
3318
+ let flagWasLocallyEvaluated = false;
3246
3319
  let requestId;
3247
3320
  let evaluatedAt;
3248
- let flagDetail;
3249
3321
  let featureFlagError;
3322
+ let flagId;
3323
+ let flagVersion;
3324
+ let flagReason;
3325
+ const localEvaluationEnabled = void 0 !== this.featureFlagsPoller;
3326
+ if (localEvaluationEnabled) {
3327
+ await this.featureFlagsPoller?.loadFeatureFlags();
3328
+ const flag = this.featureFlagsPoller?.featureFlagsByKey[key];
3329
+ if (flag) try {
3330
+ const localResult = await this.featureFlagsPoller?.computeFlagAndPayloadLocally(flag, distinctId, groups, personProperties, groupProperties, matchValue);
3331
+ if (localResult) {
3332
+ flagWasLocallyEvaluated = true;
3333
+ const value = localResult.value;
3334
+ flagId = flag.id;
3335
+ flagReason = "Evaluated locally";
3336
+ result = {
3337
+ key,
3338
+ enabled: false !== value,
3339
+ variant: "string" == typeof value ? value : void 0,
3340
+ payload: localResult.payload ?? void 0
3341
+ };
3342
+ }
3343
+ } catch (e) {
3344
+ if (e instanceof RequiresServerEvaluation || e instanceof InconclusiveMatchError) this._logger?.info(`${e.name} when computing flag locally: ${key}: ${e.message}`);
3345
+ else throw e;
3346
+ }
3347
+ }
3250
3348
  if (!flagWasLocallyEvaluated && !onlyEvaluateLocally) {
3251
3349
  const flagsResponse = await super.getFeatureFlagDetailsStateless(distinctId, groups, personProperties, groupProperties, disableGeoip, [
3252
3350
  key
3253
3351
  ]);
3254
- if (void 0 === flagsResponse) featureFlagError = FeatureFlagError.UNKNOWN_ERROR;
3352
+ if (void 0 === flagsResponse) featureFlagError = FeatureFlagError2.UNKNOWN_ERROR;
3255
3353
  else {
3256
3354
  requestId = flagsResponse.requestId;
3257
3355
  evaluatedAt = flagsResponse.evaluatedAt;
3258
3356
  const errors = [];
3259
- if (flagsResponse.errorsWhileComputingFlags) errors.push(FeatureFlagError.ERRORS_WHILE_COMPUTING);
3260
- if (flagsResponse.quotaLimited?.includes("feature_flags")) errors.push(FeatureFlagError.QUOTA_LIMITED);
3261
- flagDetail = flagsResponse.flags[key];
3262
- if (void 0 === flagDetail) errors.push(FeatureFlagError.FLAG_MISSING);
3357
+ if (flagsResponse.errorsWhileComputingFlags) errors.push(FeatureFlagError2.ERRORS_WHILE_COMPUTING);
3358
+ if (flagsResponse.quotaLimited?.includes("feature_flags")) errors.push(FeatureFlagError2.QUOTA_LIMITED);
3359
+ const flagDetail = flagsResponse.flags[key];
3360
+ if (void 0 === flagDetail) errors.push(FeatureFlagError2.FLAG_MISSING);
3361
+ else {
3362
+ flagId = flagDetail.metadata?.id;
3363
+ flagVersion = flagDetail.metadata?.version;
3364
+ flagReason = flagDetail.reason?.description ?? flagDetail.reason?.code;
3365
+ let parsedPayload;
3366
+ if (flagDetail.metadata?.payload !== void 0) try {
3367
+ parsedPayload = JSON.parse(flagDetail.metadata.payload);
3368
+ } catch {
3369
+ parsedPayload = flagDetail.metadata.payload;
3370
+ }
3371
+ result = {
3372
+ key,
3373
+ enabled: flagDetail.enabled,
3374
+ variant: flagDetail.variant,
3375
+ payload: parsedPayload
3376
+ };
3377
+ }
3263
3378
  if (errors.length > 0) featureFlagError = errors.join(",");
3264
- response = getFeatureFlagValue(flagDetail);
3265
3379
  }
3266
3380
  }
3267
- const featureFlagReportedKey = `${key}_${response}`;
3268
- if (sendFeatureFlagEvents && (!(distinctId in this.distinctIdHasSentFlagCalls) || !this.distinctIdHasSentFlagCalls[distinctId].includes(featureFlagReportedKey))) {
3269
- if (Object.keys(this.distinctIdHasSentFlagCalls).length >= this.maxCacheSize) this.distinctIdHasSentFlagCalls = {};
3270
- if (Array.isArray(this.distinctIdHasSentFlagCalls[distinctId])) this.distinctIdHasSentFlagCalls[distinctId].push(featureFlagReportedKey);
3271
- else this.distinctIdHasSentFlagCalls[distinctId] = [
3272
- featureFlagReportedKey
3273
- ];
3274
- const properties = {
3275
- $feature_flag: key,
3276
- $feature_flag_response: response,
3277
- $feature_flag_id: flagDetail?.metadata?.id,
3278
- $feature_flag_version: flagDetail?.metadata?.version,
3279
- $feature_flag_reason: flagDetail?.reason?.description ?? flagDetail?.reason?.code,
3280
- locally_evaluated: flagWasLocallyEvaluated,
3281
- [`$feature/${key}`]: response,
3282
- $feature_flag_request_id: requestId,
3283
- $feature_flag_evaluated_at: evaluatedAt
3284
- };
3285
- if (featureFlagError) properties.$feature_flag_error = featureFlagError;
3286
- this.capture({
3287
- distinctId,
3288
- event: "$feature_flag_called",
3289
- properties,
3290
- groups,
3291
- disableGeoip
3292
- });
3381
+ if (sendFeatureFlagEvents) {
3382
+ const response = void 0 === result ? void 0 : false === result.enabled ? false : result.variant ?? true;
3383
+ const featureFlagReportedKey = `${key}_${response}`;
3384
+ if (!(distinctId in this.distinctIdHasSentFlagCalls) || !this.distinctIdHasSentFlagCalls[distinctId].includes(featureFlagReportedKey)) {
3385
+ if (Object.keys(this.distinctIdHasSentFlagCalls).length >= this.maxCacheSize) this.distinctIdHasSentFlagCalls = {};
3386
+ if (Array.isArray(this.distinctIdHasSentFlagCalls[distinctId])) this.distinctIdHasSentFlagCalls[distinctId].push(featureFlagReportedKey);
3387
+ else this.distinctIdHasSentFlagCalls[distinctId] = [
3388
+ featureFlagReportedKey
3389
+ ];
3390
+ const properties = {
3391
+ $feature_flag: key,
3392
+ $feature_flag_response: response,
3393
+ $feature_flag_id: flagId,
3394
+ $feature_flag_version: flagVersion,
3395
+ $feature_flag_reason: flagReason,
3396
+ locally_evaluated: flagWasLocallyEvaluated,
3397
+ [`$feature/${key}`]: response,
3398
+ $feature_flag_request_id: requestId,
3399
+ $feature_flag_evaluated_at: evaluatedAt
3400
+ };
3401
+ if (featureFlagError) properties.$feature_flag_error = featureFlagError;
3402
+ this.capture({
3403
+ distinctId,
3404
+ event: "$feature_flag_called",
3405
+ properties,
3406
+ groups,
3407
+ disableGeoip
3408
+ });
3409
+ }
3293
3410
  }
3294
- return response;
3411
+ if (void 0 !== result && void 0 !== this._payloadOverrides && key in this._payloadOverrides) result = {
3412
+ ...result,
3413
+ payload: this._payloadOverrides[key]
3414
+ };
3415
+ return result;
3416
+ }
3417
+ async getFeatureFlag(key, distinctId, options) {
3418
+ const result = await this._getFeatureFlagResult(key, distinctId, {
3419
+ ...options,
3420
+ sendFeatureFlagEvents: options?.sendFeatureFlagEvents ?? this.options.sendFeatureFlagEvent ?? true
3421
+ });
3422
+ if (void 0 === result) return;
3423
+ if (false === result.enabled) return false;
3424
+ return result.variant ?? true;
3295
3425
  }
3296
3426
  async getFeatureFlagPayload(key, distinctId, matchValue, options) {
3297
3427
  if (void 0 !== this._payloadOverrides && key in this._payloadOverrides) return this._payloadOverrides[key];
3298
- const { groups, disableGeoip } = options || {};
3299
- let { onlyEvaluateLocally, personProperties, groupProperties } = options || {};
3300
- const adjustedProperties = this.addLocalPersonAndGroupProperties(distinctId, groups, personProperties, groupProperties);
3301
- personProperties = adjustedProperties.allPersonProperties;
3302
- groupProperties = adjustedProperties.allGroupProperties;
3303
- let response;
3304
- const localEvaluationEnabled = void 0 !== this.featureFlagsPoller;
3305
- if (localEvaluationEnabled) {
3306
- await this.featureFlagsPoller?.loadFeatureFlags();
3307
- const flag = this.featureFlagsPoller?.featureFlagsByKey[key];
3308
- if (flag) try {
3309
- const result = await this.featureFlagsPoller?.computeFlagAndPayloadLocally(flag, distinctId, groups, personProperties, groupProperties, matchValue);
3310
- if (result) {
3311
- matchValue = result.value;
3312
- response = result.payload;
3313
- }
3314
- } catch (e) {
3315
- if (e instanceof RequiresServerEvaluation || e instanceof InconclusiveMatchError) this._logger?.info(`${e.name} when computing flag locally: ${flag.key}: ${e.message}`);
3316
- else throw e;
3317
- }
3318
- }
3319
- if (void 0 == onlyEvaluateLocally) onlyEvaluateLocally = false;
3320
- const payloadWasLocallyEvaluated = void 0 !== response;
3321
- if (!payloadWasLocallyEvaluated && !onlyEvaluateLocally) response = await super.getFeatureFlagPayloadStateless(key, distinctId, groups, personProperties, groupProperties, disableGeoip);
3322
- return response;
3428
+ const result = await this._getFeatureFlagResult(key, distinctId, {
3429
+ ...options,
3430
+ sendFeatureFlagEvents: false
3431
+ }, matchValue);
3432
+ if (void 0 === result) return;
3433
+ return result.payload ?? null;
3434
+ }
3435
+ async getFeatureFlagResult(key, distinctId, options) {
3436
+ return this._getFeatureFlagResult(key, distinctId, {
3437
+ ...options,
3438
+ sendFeatureFlagEvents: options?.sendFeatureFlagEvents ?? this.options.sendFeatureFlagEvent ?? true
3439
+ });
3323
3440
  }
3324
3441
  async getRemoteConfigPayload(flagKey) {
3325
3442
  if (!this.options.personalApiKey) throw new Error("Personal API key is required for remote config payload decryption");
@@ -3347,7 +3464,7 @@ var init_client = __esm({
3347
3464
  const adjustedProperties = this.addLocalPersonAndGroupProperties(distinctId, groups, personProperties, groupProperties);
3348
3465
  personProperties = adjustedProperties.allPersonProperties;
3349
3466
  groupProperties = adjustedProperties.allGroupProperties;
3350
- if (void 0 == onlyEvaluateLocally) onlyEvaluateLocally = false;
3467
+ if (void 0 == onlyEvaluateLocally) onlyEvaluateLocally = this.options.strictLocalEvaluation ?? false;
3351
3468
  const localEvaluationResult = await this.featureFlagsPoller?.getAllFlagsAndPayloads(distinctId, groups, personProperties, groupProperties, flagKeys);
3352
3469
  let featureFlags = {};
3353
3470
  let featureFlagPayloads = {};
@@ -3497,7 +3614,7 @@ var init_client = __esm({
3497
3614
  const finalPersonProperties = sendFeatureFlagsOptions?.personProperties || {};
3498
3615
  const finalGroupProperties = sendFeatureFlagsOptions?.groupProperties || {};
3499
3616
  const flagKeys = sendFeatureFlagsOptions?.flagKeys;
3500
- const onlyEvaluateLocally = sendFeatureFlagsOptions?.onlyEvaluateLocally ?? false;
3617
+ const onlyEvaluateLocally = sendFeatureFlagsOptions?.onlyEvaluateLocally ?? this.options.strictLocalEvaluation ?? false;
3501
3618
  if (onlyEvaluateLocally) if (!((this.featureFlagsPoller?.featureFlags?.length || 0) > 0)) return {};
3502
3619
  else {
3503
3620
  const groupsWithStringValues = {};
@@ -3540,17 +3657,24 @@ var init_client = __esm({
3540
3657
  allGroupProperties
3541
3658
  };
3542
3659
  }
3543
- captureException(error, distinctId, additionalProperties) {
3544
- const syntheticException = new Error("PostHog syntheticException");
3545
- this.addPendingPromise(ErrorTracking.buildEventMessage(error, {
3546
- syntheticException
3547
- }, distinctId, additionalProperties).then((msg) => this.capture(msg)));
3660
+ captureException(error, distinctId, additionalProperties, uuid) {
3661
+ if (!ErrorTracking.isPreviouslyCapturedError(error)) {
3662
+ const syntheticException = new Error("PostHog syntheticException");
3663
+ this.addPendingPromise(ErrorTracking.buildEventMessage(error, {
3664
+ syntheticException
3665
+ }, distinctId, additionalProperties).then((msg) => this.capture({
3666
+ ...msg,
3667
+ uuid
3668
+ })));
3669
+ }
3548
3670
  }
3549
3671
  async captureExceptionImmediate(error, distinctId, additionalProperties) {
3550
- const syntheticException = new Error("PostHog syntheticException");
3551
- this.addPendingPromise(ErrorTracking.buildEventMessage(error, {
3552
- syntheticException
3553
- }, distinctId, additionalProperties).then((msg) => this.captureImmediate(msg)));
3672
+ if (!ErrorTracking.isPreviouslyCapturedError(error)) {
3673
+ const syntheticException = new Error("PostHog syntheticException");
3674
+ this.addPendingPromise(ErrorTracking.buildEventMessage(error, {
3675
+ syntheticException
3676
+ }, distinctId, additionalProperties).then((msg) => this.captureImmediate(msg)));
3677
+ }
3554
3678
  }
3555
3679
  async prepareEventMessage(props) {
3556
3680
  const { distinctId, event, properties, groups, sendFeatureFlags, timestamp, disableGeoip, uuid } = props;
@@ -3639,7 +3763,7 @@ var init_client = __esm({
3639
3763
  });
3640
3764
  var PostHogContext;
3641
3765
  var init_context = __esm({
3642
- "../../node_modules/.pnpm/posthog-node@5.19.0/node_modules/posthog-node/dist/extensions/context/context.mjs"() {
3766
+ "../../node_modules/.pnpm/posthog-node@5.24.1/node_modules/posthog-node/dist/extensions/context/context.mjs"() {
3643
3767
  PostHogContext = class {
3644
3768
  constructor() {
3645
3769
  this.storage = new AsyncLocalStorage();
@@ -3667,7 +3791,7 @@ var init_context = __esm({
3667
3791
  }
3668
3792
  });
3669
3793
 
3670
- // ../../node_modules/.pnpm/posthog-node@5.19.0/node_modules/posthog-node/dist/extensions/sentry-integration.mjs
3794
+ // ../../node_modules/.pnpm/posthog-node@5.24.1/node_modules/posthog-node/dist/extensions/sentry-integration.mjs
3671
3795
  function createEventProcessor(_posthog, { organization, projectId, prefix, severityAllowList = [
3672
3796
  "error"
3673
3797
  ], sendExceptionsToPostHog = true } = {}) {
@@ -3723,7 +3847,7 @@ function sentryIntegration(_posthog, options) {
3723
3847
  }
3724
3848
  var NAME, PostHogSentryIntegration;
3725
3849
  var init_sentry_integration = __esm({
3726
- "../../node_modules/.pnpm/posthog-node@5.19.0/node_modules/posthog-node/dist/extensions/sentry-integration.mjs"() {
3850
+ "../../node_modules/.pnpm/posthog-node@5.24.1/node_modules/posthog-node/dist/extensions/sentry-integration.mjs"() {
3727
3851
  NAME = "posthog-node";
3728
3852
  PostHogSentryIntegration = class {
3729
3853
  static #_ = this.POSTHOG_ID_TAG = "posthog_distinct_id";
@@ -3745,12 +3869,13 @@ var init_sentry_integration = __esm({
3745
3869
  }
3746
3870
  });
3747
3871
 
3748
- // ../../node_modules/.pnpm/posthog-node@5.19.0/node_modules/posthog-node/dist/extensions/express.mjs
3872
+ // ../../node_modules/.pnpm/posthog-node@5.24.1/node_modules/posthog-node/dist/extensions/express.mjs
3749
3873
  function setupExpressErrorHandler(_posthog, app) {
3750
3874
  app.use(posthogErrorHandler(_posthog));
3751
3875
  }
3752
3876
  function posthogErrorHandler(posthog) {
3753
3877
  return (error, req, res, next) => {
3878
+ if (ErrorTracking.isPreviouslyCapturedError(error)) return void next(error);
3754
3879
  const sessionId = req.headers["x-posthog-session-id"];
3755
3880
  const distinctId = req.headers["x-posthog-distinct-id"];
3756
3881
  const syntheticException = new Error("Synthetic exception");
@@ -3776,21 +3901,22 @@ function posthogErrorHandler(posthog) {
3776
3901
  };
3777
3902
  }
3778
3903
  var init_express = __esm({
3779
- "../../node_modules/.pnpm/posthog-node@5.19.0/node_modules/posthog-node/dist/extensions/express.mjs"() {
3904
+ "../../node_modules/.pnpm/posthog-node@5.24.1/node_modules/posthog-node/dist/extensions/express.mjs"() {
3780
3905
  init_error_tracking2();
3781
3906
  }
3782
3907
  });
3783
3908
 
3784
- // ../../node_modules/.pnpm/posthog-node@5.19.0/node_modules/posthog-node/dist/exports.mjs
3909
+ // ../../node_modules/.pnpm/posthog-node@5.24.1/node_modules/posthog-node/dist/exports.mjs
3785
3910
  var init_exports = __esm({
3786
- "../../node_modules/.pnpm/posthog-node@5.19.0/node_modules/posthog-node/dist/exports.mjs"() {
3911
+ "../../node_modules/.pnpm/posthog-node@5.24.1/node_modules/posthog-node/dist/exports.mjs"() {
3912
+ init_dist();
3787
3913
  init_sentry_integration();
3788
3914
  init_express();
3789
3915
  init_types3();
3790
3916
  }
3791
3917
  });
3792
3918
 
3793
- // ../../node_modules/.pnpm/posthog-node@5.19.0/node_modules/posthog-node/dist/entrypoints/index.node.mjs
3919
+ // ../../node_modules/.pnpm/posthog-node@5.24.1/node_modules/posthog-node/dist/entrypoints/index.node.mjs
3794
3920
  var index_node_exports = {};
3795
3921
  __export(index_node_exports, {
3796
3922
  FeatureFlagError: () => FeatureFlagError,
@@ -3802,7 +3928,7 @@ __export(index_node_exports, {
3802
3928
  });
3803
3929
  var PostHog;
3804
3930
  var init_index_node = __esm({
3805
- "../../node_modules/.pnpm/posthog-node@5.19.0/node_modules/posthog-node/dist/entrypoints/index.node.mjs"() {
3931
+ "../../node_modules/.pnpm/posthog-node@5.24.1/node_modules/posthog-node/dist/entrypoints/index.node.mjs"() {
3806
3932
  init_module_node();
3807
3933
  init_context_lines_node();
3808
3934
  init_error_tracking2();