@wireai/activation 0.10.0 → 0.11.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/CHANGELOG.md +55 -0
- package/README.md +33 -4
- package/dist/analytics/index.d.mts +21 -3
- package/dist/analytics/index.d.ts +21 -3
- package/dist/analytics/index.js +94 -61
- package/dist/analytics/index.js.map +1 -1
- package/dist/analytics/index.mjs +91 -62
- package/dist/analytics/index.mjs.map +1 -1
- package/dist/{currentSession-DdDkprpM.d.mts → currentSession-C0_odnIW.d.mts} +101 -1
- package/dist/{currentSession-D0Vq7_VE.d.ts → currentSession-DdnUq2HQ.d.ts} +101 -1
- package/dist/index.d.mts +3 -49
- package/dist/index.d.ts +3 -49
- package/dist/index.js +50 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +47 -42
- package/dist/index.mjs.map +1 -1
- package/dist/questionnaire/index.js +10 -2
- package/dist/questionnaire/index.js.map +1 -1
- package/dist/questionnaire/index.mjs +10 -2
- package/dist/questionnaire/index.mjs.map +1 -1
- package/dist/reviews/index.d.mts +1 -1
- package/dist/reviews/index.d.ts +1 -1
- package/dist/reviews/index.js +24 -9
- package/dist/reviews/index.js.map +1 -1
- package/dist/reviews/index.mjs +24 -9
- package/dist/reviews/index.mjs.map +1 -1
- package/dist/{transport-Bzb-bcB2.d.mts → transport-BGW9uXZJ.d.mts} +0 -15
- package/dist/{transport-B31G0Cib.d.ts → transport-jUJd5kxu.d.ts} +0 -15
- package/llms.txt +8 -0
- package/package.json +1 -1
- package/src/analytics/analyticsFacade.ts +72 -9
- package/src/analytics/eventQueue.ts +12 -11
- package/src/analytics/index.ts +9 -0
- package/src/analytics/reportClientEvent.ts +12 -2
- package/src/context/userContext.ts +55 -0
- package/src/identity/userIdentity.ts +10 -0
- package/src/index.ts +5 -1
- package/src/questionnaire/transport.ts +5 -1
- package/src/reviews/decision.ts +8 -1
- package/src/reviews/transport.ts +6 -8
- package/src/session-analytics/lifecycle.ts +6 -11
- package/src/session-analytics/useLifecycleEvents.ts +41 -27
package/dist/reviews/index.d.mts
CHANGED
|
@@ -4,7 +4,7 @@ export { e as RatingRoute, f as ReviewConfig, g as ReviewDecisionResponse, h as
|
|
|
4
4
|
export { C as ReviewModal, a as ReviewModalHandle, b as ReviewModalProps } from '../CenteredModal-C3qQBHsA.mjs';
|
|
5
5
|
export { G as GateRules, a as GateSignals, b as buildReviewSubmission, d as decideReview, e as evaluateGate, r as resolveRules, c as routeRating } from '../decision-Bl_M2y3r.mjs';
|
|
6
6
|
import { c as OnboardingFonts } from '../types-BKfpdZzX.mjs';
|
|
7
|
-
export { F as FetchReviewDecisionOptions, R as ReportAppEventOptions, f as fetchReviewDecision, r as reportAppEvent, s as submitReview } from '../transport-
|
|
7
|
+
export { F as FetchReviewDecisionOptions, R as ReportAppEventOptions, f as fetchReviewDecision, r as reportAppEvent, s as submitReview } from '../transport-BGW9uXZJ.mjs';
|
|
8
8
|
import '../types-BcmagF6K.mjs';
|
|
9
9
|
import '../types-CKFhyrMu.mjs';
|
|
10
10
|
|
package/dist/reviews/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { e as RatingRoute, f as ReviewConfig, g as ReviewDecisionResponse, h as
|
|
|
4
4
|
export { C as ReviewModal, a as ReviewModalHandle, b as ReviewModalProps } from '../CenteredModal-Cdgns6--.js';
|
|
5
5
|
export { G as GateRules, a as GateSignals, b as buildReviewSubmission, d as decideReview, e as evaluateGate, r as resolveRules, c as routeRating } from '../decision-Cau5KmP6.js';
|
|
6
6
|
import { c as OnboardingFonts } from '../types-BKfpdZzX.js';
|
|
7
|
-
export { F as FetchReviewDecisionOptions, R as ReportAppEventOptions, f as fetchReviewDecision, r as reportAppEvent, s as submitReview } from '../transport-
|
|
7
|
+
export { F as FetchReviewDecisionOptions, R as ReportAppEventOptions, f as fetchReviewDecision, r as reportAppEvent, s as submitReview } from '../transport-jUJd5kxu.js';
|
|
8
8
|
import '../types-BcmagF6K.js';
|
|
9
9
|
import '../types-CKFhyrMu.js';
|
|
10
10
|
|
package/dist/reviews/index.js
CHANGED
|
@@ -504,7 +504,14 @@ var resolveRules = (config) => {
|
|
|
504
504
|
var _a, _b, _c, _d, _e;
|
|
505
505
|
return {
|
|
506
506
|
enabled: (_a = config.enabled) != null ? _a : true,
|
|
507
|
-
|
|
507
|
+
// FAIL-CLOSED on the first session (behavior change, 0.11.0). An unconfigured host with no
|
|
508
|
+
// server decision must NOT prompt on the very first mount: `minSessions` defaults to 2 so the
|
|
509
|
+
// gate needs at least a second session before the LOCAL rules can fire. This is the client-side
|
|
510
|
+
// floor only — a server `decision` (from `fetchReviewDecision`) still OVERRIDES everything, and a
|
|
511
|
+
// host that genuinely wants first-session prompting can set `minSessions: 1` (or `0`) explicitly.
|
|
512
|
+
// Mirrors the 2026-07-16 incident: a first-session user, no server decision, got the prompt and
|
|
513
|
+
// left 1 star. See `evaluateGate` (`min_sessions` reason) and the CHANGELOG.
|
|
514
|
+
minSessions: (_b = config.minSessions) != null ? _b : 2,
|
|
508
515
|
minEvents: (_c = config.minEvents) != null ? _c : 0,
|
|
509
516
|
cooldownDays: (_d = config.cooldownDays) != null ? _d : 0,
|
|
510
517
|
oncePerVersion: (_e = config.oncePerVersion) != null ? _e : true
|
|
@@ -728,6 +735,19 @@ var requestStoreReview = async (store) => {
|
|
|
728
735
|
return opened ? "store_url" : "none";
|
|
729
736
|
};
|
|
730
737
|
|
|
738
|
+
// src/analytics/reportClientEvent.ts
|
|
739
|
+
var buildEventsRequest = (target, events) => {
|
|
740
|
+
if (!(target == null ? void 0 : target.serverUrl) || events.length === 0) return null;
|
|
741
|
+
try {
|
|
742
|
+
const url = `${target.serverUrl.replace(/\/$/, "")}/v1/events`;
|
|
743
|
+
const headers = { "Content-Type": "application/json" };
|
|
744
|
+
if (target.apiKey) headers.Authorization = `Bearer ${target.apiKey}`;
|
|
745
|
+
return { url, init: { method: "POST", headers, body: JSON.stringify({ events }) } };
|
|
746
|
+
} catch {
|
|
747
|
+
return null;
|
|
748
|
+
}
|
|
749
|
+
};
|
|
750
|
+
|
|
731
751
|
// src/reviews/transport.ts
|
|
732
752
|
var submitReview = (target, review) => {
|
|
733
753
|
if (!(target == null ? void 0 : target.serverUrl)) return;
|
|
@@ -767,9 +787,6 @@ var fetchReviewDecision = async (target, options = {}) => {
|
|
|
767
787
|
var reportAppEvent = (target, name, options = {}) => {
|
|
768
788
|
if (!(target == null ? void 0 : target.serverUrl) || !name) return;
|
|
769
789
|
try {
|
|
770
|
-
const url = `${target.serverUrl.replace(/\/$/, "")}/v1/events`;
|
|
771
|
-
const headers = { "Content-Type": "application/json" };
|
|
772
|
-
if (target.apiKey) headers.Authorization = `Bearer ${target.apiKey}`;
|
|
773
790
|
const event = {
|
|
774
791
|
event_type: "app_event",
|
|
775
792
|
question_key: name
|
|
@@ -779,11 +796,9 @@ var reportAppEvent = (target, name, options = {}) => {
|
|
|
779
796
|
if (options.meta && Object.keys(options.meta).length > 0) {
|
|
780
797
|
event.meta = JSON.stringify(options.meta);
|
|
781
798
|
}
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
body: JSON.stringify({ events: [event] })
|
|
786
|
-
}).catch(() => {
|
|
799
|
+
const req = buildEventsRequest(target, [event]);
|
|
800
|
+
if (!req) return;
|
|
801
|
+
void fetch(req.url, req.init).catch(() => {
|
|
787
802
|
});
|
|
788
803
|
} catch {
|
|
789
804
|
}
|