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