@wireai/activation 0.9.1 → 0.9.2

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.
@@ -1,6 +1,6 @@
1
1
  export { R as ReportAppEventOptions, r as reportAppEvent } from '../transport-Bzb-bcB2.mjs';
2
- import { W as WireUserContext, E as EventQueueOptions } from '../currentSession-Bs2JfTJ8.mjs';
3
- export { A as AnalyticsEvent, C as ClientEvent, a as ClientEventTarget, b as ClientEventType, c as ContextEnvelope, d as ContextEnvelopeInput, e as EnvelopeSource, f as EventQueue, g as WIRE_ONBOARDING_EVENTS, h as WireOnboardingEventName, i as buildContextEnvelope, j as createEventQueue, k as getCurrentSessionId, m as makeSessionId, r as reportClientEvent, l as reportClientEvents, n as resetCurrentSessionId, s as setCurrentSessionId, t as toAnalyticsEvent } from '../currentSession-Bs2JfTJ8.mjs';
2
+ import { W as WireUserContext, E as EventQueueOptions } from '../currentSession-CRRQLbAq.mjs';
3
+ export { A as AnalyticsEvent, C as ClientEvent, a as ClientEventTarget, b as ClientEventType, c as ContextEnvelope, d as ContextEnvelopeInput, e as EnvelopeSource, f as EventQueue, g as WIRE_ONBOARDING_EVENTS, h as WireOnboardingEventName, i as buildContextEnvelope, j as createEventQueue, k as getCurrentSessionId, m as makeSessionId, r as reportClientEvent, l as reportClientEvents, n as resetCurrentSessionId, s as setCurrentSessionId, t as toAnalyticsEvent } from '../currentSession-CRRQLbAq.mjs';
4
4
  import '../types-CNUqMK0D.mjs';
5
5
  import '../types-BKfpdZzX.mjs';
6
6
  import '../types-BcmagF6K.mjs';
@@ -1,6 +1,6 @@
1
1
  export { R as ReportAppEventOptions, r as reportAppEvent } from '../transport-B31G0Cib.js';
2
- import { W as WireUserContext, E as EventQueueOptions } from '../currentSession-61dcm3V-.js';
3
- export { A as AnalyticsEvent, C as ClientEvent, a as ClientEventTarget, b as ClientEventType, c as ContextEnvelope, d as ContextEnvelopeInput, e as EnvelopeSource, f as EventQueue, g as WIRE_ONBOARDING_EVENTS, h as WireOnboardingEventName, i as buildContextEnvelope, j as createEventQueue, k as getCurrentSessionId, m as makeSessionId, r as reportClientEvent, l as reportClientEvents, n as resetCurrentSessionId, s as setCurrentSessionId, t as toAnalyticsEvent } from '../currentSession-61dcm3V-.js';
2
+ import { W as WireUserContext, E as EventQueueOptions } from '../currentSession-Dj0cN3Rg.js';
3
+ export { A as AnalyticsEvent, C as ClientEvent, a as ClientEventTarget, b as ClientEventType, c as ContextEnvelope, d as ContextEnvelopeInput, e as EnvelopeSource, f as EventQueue, g as WIRE_ONBOARDING_EVENTS, h as WireOnboardingEventName, i as buildContextEnvelope, j as createEventQueue, k as getCurrentSessionId, m as makeSessionId, r as reportClientEvent, l as reportClientEvents, n as resetCurrentSessionId, s as setCurrentSessionId, t as toAnalyticsEvent } from '../currentSession-Dj0cN3Rg.js';
4
4
  import '../types-Buj9Lw9t.js';
5
5
  import '../types-BKfpdZzX.js';
6
6
  import '../types-BcmagF6K.js';
@@ -860,8 +860,9 @@ var createEventQueue = (options) => {
860
860
  } catch {
861
861
  }
862
862
  })();
863
+ const DROP_STATUSES = /* @__PURE__ */ new Set([400, 404, 413, 422]);
863
864
  const postBatch = async (events) => {
864
- if (!(target == null ? void 0 : target.serverUrl) || events.length === 0) return false;
865
+ if (!(target == null ? void 0 : target.serverUrl) || events.length === 0) return "retry";
865
866
  const controller = typeof AbortController !== "undefined" ? new AbortController() : void 0;
866
867
  const timer = setTimeout(() => controller == null ? void 0 : controller.abort(), 15e3);
867
868
  try {
@@ -874,9 +875,12 @@ var createEventQueue = (options) => {
874
875
  body: JSON.stringify({ events }),
875
876
  signal: controller == null ? void 0 : controller.signal
876
877
  });
877
- return !!(res && res.ok);
878
+ if (res && res.ok) return "ok";
879
+ const status = res == null ? void 0 : res.status;
880
+ if (typeof status === "number" && DROP_STATUSES.has(status)) return "drop";
881
+ return "retry";
878
882
  } catch {
879
- return false;
883
+ return "retry";
880
884
  } finally {
881
885
  clearTimeout(timer);
882
886
  }
@@ -908,8 +912,8 @@ var createEventQueue = (options) => {
908
912
  try {
909
913
  while (pending.length > 0) {
910
914
  const batch = pending.slice(0, batchSize);
911
- const ok = await postBatch(batch.map((item) => item.event));
912
- if (!ok) {
915
+ const result = await postBatch(batch.map((item) => item.event));
916
+ if (result === "retry") {
913
917
  scheduleRetry();
914
918
  return;
915
919
  }