@wireai/activation 0.13.2 → 0.13.5
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/AGENTS.md +6 -3
- package/CHANGELOG.md +291 -4
- package/INTEGRATION_PROMPT.md +7 -1
- package/README.md +68 -2
- package/dist/analytics/index.d.mts +86 -6
- package/dist/analytics/index.d.ts +86 -6
- package/dist/analytics/index.js +271 -472
- package/dist/analytics/index.js.map +1 -1
- package/dist/analytics/index.mjs +269 -471
- package/dist/analytics/index.mjs.map +1 -1
- package/dist/coachmarks/index.d.mts +15 -2
- package/dist/coachmarks/index.d.ts +15 -2
- package/dist/coachmarks/index.js +58 -14
- package/dist/coachmarks/index.js.map +1 -1
- package/dist/coachmarks/index.mjs +58 -14
- package/dist/coachmarks/index.mjs.map +1 -1
- package/dist/{currentSession-ClkLjcJ0.d.mts → currentSession-DgJf0fRz.d.mts} +4 -4
- package/dist/{currentSession-DOVZEWJl.d.ts → currentSession-EOHU64QD.d.ts} +4 -4
- package/dist/{decision-Bl_M2y3r.d.mts → decision-Bgo17oH7.d.mts} +1 -1
- package/dist/{decision-Cau5KmP6.d.ts → decision-Bkh_LigV.d.ts} +1 -1
- package/dist/index.d.mts +27 -4
- package/dist/index.d.ts +27 -4
- package/dist/index.js +224 -575
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +221 -572
- package/dist/index.mjs.map +1 -1
- package/dist/questionnaire/index.d.mts +43 -11
- package/dist/questionnaire/index.d.ts +43 -11
- package/dist/questionnaire/index.js +45 -13
- package/dist/questionnaire/index.js.map +1 -1
- package/dist/questionnaire/index.mjs +45 -13
- package/dist/questionnaire/index.mjs.map +1 -1
- package/dist/reviews/index.d.mts +5 -5
- package/dist/reviews/index.d.ts +5 -5
- package/dist/reviews/index.js +31 -9
- package/dist/reviews/index.js.map +1 -1
- package/dist/reviews/index.mjs +31 -9
- package/dist/reviews/index.mjs.map +1 -1
- package/dist/showcase/index.d.mts +1 -1
- package/dist/showcase/index.d.ts +1 -1
- package/dist/showcase/index.js +7 -2
- package/dist/showcase/index.js.map +1 -1
- package/dist/showcase/index.mjs +7 -2
- package/dist/showcase/index.mjs.map +1 -1
- package/dist/{transport-CF_eHwzC.d.mts → transport-B_0SgCBe.d.ts} +44 -5
- package/dist/{transport-DsRe4epC.d.ts → transport-j5gFfJhK.d.mts} +44 -5
- package/dist/{types-CKFhyrMu.d.mts → types-BpwiRpA8.d.mts} +1 -1
- package/dist/{types-CKFhyrMu.d.ts → types-BpwiRpA8.d.ts} +1 -1
- package/dist/{types-CNUqMK0D.d.mts → types-Cju-1_jT.d.mts} +42 -2
- package/dist/{types-Buj9Lw9t.d.ts → types-h2BZvl1t.d.ts} +42 -2
- package/llms.txt +1 -1
- package/package.json +6 -1
- package/src/OnboardingFlow.tsx +44 -15
- package/src/WireOnboarding.tsx +7 -6
- package/src/activation/revalidation.ts +9 -1
- package/src/activation/wireActivation.ts +3 -3
- package/src/analytics/analyticsFacade.ts +2 -2
- package/src/analytics/currentSession.ts +10 -0
- package/src/analytics/eventQueue.ts +88 -20
- package/src/analytics/index.ts +6 -0
- package/src/analytics/reportClientEvent.ts +29 -7
- package/src/analytics/wireDoctor.ts +330 -0
- package/src/cards/CardGridSelectCard.tsx +1 -1
- package/src/cards/ChipSelectCard.tsx +2 -2
- package/src/cards/SelectionCard.tsx +1 -1
- package/src/coachmarks/runtime.ts +72 -3
- package/src/coachmarks/useCoachmarkTour.ts +62 -14
- package/src/context/deviceId.ts +14 -5
- package/src/features/WireFeaturesProvider.tsx +12 -1
- package/src/identity/identityRecord.ts +9 -1
- package/src/identity/userIdentity.ts +1 -1
- package/src/questionnaire/QuestionnaireGate.tsx +90 -10
- package/src/questionnaire/index.ts +9 -1
- package/src/questionnaire/transport.ts +46 -11
- package/src/reviews/ReviewGate.tsx +61 -6
- package/src/reviews/index.ts +10 -1
- package/src/reviews/runtime.ts +11 -1
- package/src/reviews/transport.ts +58 -12
- package/src/session-analytics/useLifecycleEvents.ts +1 -1
- package/src/theme/ThemeContext.tsx +49 -1
- package/src/types.ts +1 -1
- package/src/utils/submitResult.ts +39 -0
package/dist/reviews/index.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
|
-
import { R as ReviewGateProps, a as ReviewPresentation, U as UseReviewGateOptions, b as ReviewGateController, c as ReviewDecision, d as ReviewStoreConfig } from '../types-
|
|
3
|
-
export { e as RatingRoute, f as ReviewConfig, g as ReviewDecisionResponse, h as ReviewGateEvent, i as ReviewGateEventName, j as ReviewSubmission, k as ReviewTarget } from '../types-
|
|
2
|
+
import { R as ReviewGateProps, a as ReviewPresentation, U as UseReviewGateOptions, b as ReviewGateController, c as ReviewDecision, d as ReviewStoreConfig } from '../types-Cju-1_jT.mjs';
|
|
3
|
+
export { e as RatingRoute, f as ReviewConfig, g as ReviewDecisionResponse, h as ReviewGateEvent, i as ReviewGateEventName, j as ReviewSubmission, k as ReviewTarget, S as SubmitResult } from '../types-Cju-1_jT.mjs';
|
|
4
4
|
export { C as ReviewModal, a as ReviewModalHandle, b as ReviewModalProps } from '../CenteredModal-C3qQBHsA.mjs';
|
|
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-
|
|
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-Bgo17oH7.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, a as ReviewSubmitResult, f as fetchReviewDecision, r as reportAppEvent, s as submitReview } from '../transport-j5gFfJhK.mjs';
|
|
8
8
|
import '../types-BcmagF6K.mjs';
|
|
9
|
-
import '../types-
|
|
9
|
+
import '../types-BpwiRpA8.mjs';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Runtime helpers for the review gate: the `wire_review_*` gate keys and small
|
package/dist/reviews/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
|
-
import { R as ReviewGateProps, a as ReviewPresentation, U as UseReviewGateOptions, b as ReviewGateController, c as ReviewDecision, d as ReviewStoreConfig } from '../types-
|
|
3
|
-
export { e as RatingRoute, f as ReviewConfig, g as ReviewDecisionResponse, h as ReviewGateEvent, i as ReviewGateEventName, j as ReviewSubmission, k as ReviewTarget } from '../types-
|
|
2
|
+
import { R as ReviewGateProps, a as ReviewPresentation, U as UseReviewGateOptions, b as ReviewGateController, c as ReviewDecision, d as ReviewStoreConfig } from '../types-h2BZvl1t.js';
|
|
3
|
+
export { e as RatingRoute, f as ReviewConfig, g as ReviewDecisionResponse, h as ReviewGateEvent, i as ReviewGateEventName, j as ReviewSubmission, k as ReviewTarget, S as SubmitResult } from '../types-h2BZvl1t.js';
|
|
4
4
|
export { C as ReviewModal, a as ReviewModalHandle, b as ReviewModalProps } from '../CenteredModal-Cdgns6--.js';
|
|
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-
|
|
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-Bkh_LigV.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, a as ReviewSubmitResult, f as fetchReviewDecision, r as reportAppEvent, s as submitReview } from '../transport-B_0SgCBe.js';
|
|
8
8
|
import '../types-BcmagF6K.js';
|
|
9
|
-
import '../types-
|
|
9
|
+
import '../types-BpwiRpA8.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Runtime helpers for the review gate: the `wire_review_*` gate keys and small
|
package/dist/reviews/index.js
CHANGED
|
@@ -60,7 +60,12 @@ var defaultOnboardingTheme = {
|
|
|
60
60
|
var mergeTheme = (override) => {
|
|
61
61
|
return defaultOnboardingTheme;
|
|
62
62
|
};
|
|
63
|
-
var
|
|
63
|
+
var THEME_CONTEXT_SLOT = /* @__PURE__ */ Symbol.for("@wireai/activation:themeContext");
|
|
64
|
+
var themeGlobal = globalThis;
|
|
65
|
+
if (!themeGlobal[THEME_CONTEXT_SLOT]) {
|
|
66
|
+
themeGlobal[THEME_CONTEXT_SLOT] = React7.createContext(null);
|
|
67
|
+
}
|
|
68
|
+
var OnboardingThemeContext = themeGlobal[THEME_CONTEXT_SLOT];
|
|
64
69
|
var useOnboardingTheme = () => {
|
|
65
70
|
const ctx = React7.useContext(OnboardingThemeContext);
|
|
66
71
|
return ctx != null ? ctx : mergeTheme();
|
|
@@ -747,13 +752,15 @@ var toWireEvents = (events) => events.map((event) => {
|
|
|
747
752
|
return rest;
|
|
748
753
|
}
|
|
749
754
|
});
|
|
750
|
-
var buildEventsRequest = (target, events) => {
|
|
755
|
+
var buildEventsRequest = (target, events, options) => {
|
|
751
756
|
if (!(target == null ? void 0 : target.serverUrl) || events.length === 0) return null;
|
|
752
757
|
try {
|
|
753
758
|
const url = `${target.serverUrl.replace(/\/$/, "")}/v1/events`;
|
|
754
759
|
const headers = { "Content-Type": "application/json" };
|
|
755
760
|
if (target.apiKey) headers.Authorization = `Bearer ${target.apiKey}`;
|
|
756
|
-
const
|
|
761
|
+
const envelope = { events: toWireEvents(events) };
|
|
762
|
+
if ((options == null ? void 0 : options.dryRun) === true) ;
|
|
763
|
+
const body = JSON.stringify(envelope);
|
|
757
764
|
return { url, init: { method: "POST", headers, body } };
|
|
758
765
|
} catch {
|
|
759
766
|
return null;
|
|
@@ -792,19 +799,21 @@ var ensureCurrentSessionId = () => {
|
|
|
792
799
|
};
|
|
793
800
|
|
|
794
801
|
// src/reviews/transport.ts
|
|
795
|
-
var submitReview = (target, review) => {
|
|
796
|
-
if (!(target == null ? void 0 : target.serverUrl)) return;
|
|
802
|
+
var submitReview = async (target, review) => {
|
|
803
|
+
if (!(target == null ? void 0 : target.serverUrl)) return "unsent";
|
|
797
804
|
try {
|
|
798
805
|
const url = `${target.serverUrl.replace(/\/$/, "")}/v1/reviews`;
|
|
799
806
|
const headers = { "Content-Type": "application/json" };
|
|
800
807
|
if (target.apiKey) headers.Authorization = `Bearer ${target.apiKey}`;
|
|
801
|
-
|
|
808
|
+
const res = await fetch(url, {
|
|
802
809
|
method: "POST",
|
|
803
810
|
headers,
|
|
804
811
|
body: JSON.stringify(review)
|
|
805
|
-
}).catch(() => {
|
|
806
812
|
});
|
|
813
|
+
if (!res) return "unsent";
|
|
814
|
+
return res.ok ? "accepted" : "rejected";
|
|
807
815
|
} catch {
|
|
816
|
+
return "unsent";
|
|
808
817
|
}
|
|
809
818
|
};
|
|
810
819
|
var fetchReviewDecision = async (target, options = {}) => {
|
|
@@ -893,17 +902,30 @@ var _ReviewGate = ({
|
|
|
893
902
|
onResolved == null ? void 0 : onResolved();
|
|
894
903
|
}, [onResolved]);
|
|
895
904
|
const postedRef = React7__default.default.useRef(false);
|
|
905
|
+
const unackedRef = React7__default.default.useRef(null);
|
|
896
906
|
const postOnce = React7.useCallback(
|
|
897
907
|
(body) => {
|
|
898
908
|
if (postedRef.current) return;
|
|
899
909
|
postedRef.current = true;
|
|
900
|
-
|
|
910
|
+
unackedRef.current = body;
|
|
911
|
+
void submitReview(target, body).then((result) => {
|
|
912
|
+
if (result === "unsent") {
|
|
913
|
+
postedRef.current = false;
|
|
914
|
+
return;
|
|
915
|
+
}
|
|
916
|
+
unackedRef.current = null;
|
|
917
|
+
});
|
|
901
918
|
},
|
|
902
919
|
[target]
|
|
903
920
|
);
|
|
904
921
|
const abandonRef = React7__default.default.useRef(() => {
|
|
905
922
|
});
|
|
906
923
|
abandonRef.current = () => {
|
|
924
|
+
const undelivered = unackedRef.current;
|
|
925
|
+
if (undelivered && !postedRef.current) {
|
|
926
|
+
postOnce(undelivered);
|
|
927
|
+
return;
|
|
928
|
+
}
|
|
907
929
|
if (postedRef.current || stars < 1) return;
|
|
908
930
|
postOnce(
|
|
909
931
|
buildReviewSubmission({
|
|
@@ -1271,7 +1293,7 @@ var useWireFeatures = (config) => {
|
|
|
1271
1293
|
return flags;
|
|
1272
1294
|
};
|
|
1273
1295
|
var CONTEXT_SYMBOL = /* @__PURE__ */ Symbol.for("wireai.features.context");
|
|
1274
|
-
var globalObj =
|
|
1296
|
+
var globalObj = globalThis;
|
|
1275
1297
|
if (!globalObj[CONTEXT_SYMBOL]) {
|
|
1276
1298
|
globalObj[CONTEXT_SYMBOL] = React7.createContext(null);
|
|
1277
1299
|
}
|