@wireai/activation 0.13.2 → 0.13.3
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 +4 -3
- package/CHANGELOG.md +228 -4
- package/README.md +16 -2
- package/dist/analytics/index.d.mts +4 -4
- package/dist/analytics/index.d.ts +4 -4
- package/dist/analytics/index.js +104 -470
- package/dist/analytics/index.js.map +1 -1
- package/dist/analytics/index.mjs +102 -468
- package/dist/analytics/index.mjs.map +1 -1
- package/dist/coachmarks/index.d.mts +14 -1
- package/dist/coachmarks/index.d.ts +14 -1
- 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-BoWtr3Jp.d.mts} +2 -2
- package/dist/{currentSession-DOVZEWJl.d.ts → currentSession-CCOMlaQ2.d.ts} +2 -2
- package/dist/{decision-Bl_M2y3r.d.mts → decision-Cjw0jbEj.d.mts} +1 -1
- package/dist/{decision-Cau5KmP6.d.ts → decision-GfpXAsk_.d.ts} +1 -1
- package/dist/index.d.mts +25 -2
- package/dist/index.d.ts +25 -2
- package/dist/index.js +220 -573
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +217 -570
- package/dist/index.mjs.map +1 -1
- package/dist/questionnaire/index.d.mts +42 -10
- package/dist/questionnaire/index.d.ts +42 -10
- 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 +4 -4
- package/dist/reviews/index.d.ts +4 -4
- package/dist/reviews/index.js +27 -7
- package/dist/reviews/index.js.map +1 -1
- package/dist/reviews/index.mjs +27 -7
- package/dist/reviews/index.mjs.map +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-DsRe4epC.d.ts → transport-CefdERPs.d.mts} +44 -5
- package/dist/{transport-CF_eHwzC.d.mts → transport-DFuPyCoJ.d.ts} +44 -5
- package/dist/{types-Buj9Lw9t.d.ts → types-UVYt9BJe.d.ts} +41 -1
- package/dist/{types-CNUqMK0D.d.mts → types-l2tfg23P.d.mts} +41 -1
- package/package.json +4 -1
- package/src/OnboardingFlow.tsx +44 -15
- package/src/WireOnboarding.tsx +7 -6
- package/src/activation/wireActivation.ts +3 -3
- package/src/analytics/analyticsFacade.ts +2 -2
- package/src/analytics/eventQueue.ts +83 -20
- 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 +62 -2
- package/src/coachmarks/useCoachmarkTour.ts +62 -14
- package/src/context/deviceId.ts +4 -4
- package/src/features/WireFeaturesProvider.tsx +4 -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/transport.ts +58 -12
- package/src/session-analytics/useLifecycleEvents.ts +1 -1
- package/src/theme/ThemeContext.tsx +42 -1
- package/src/types.ts +1 -1
- package/src/utils/submitResult.ts +39 -0
package/dist/reviews/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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-l2tfg23P.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-l2tfg23P.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-Cjw0jbEj.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-CefdERPs.mjs';
|
|
8
8
|
import '../types-BcmagF6K.mjs';
|
|
9
9
|
import '../types-CKFhyrMu.mjs';
|
|
10
10
|
|
package/dist/reviews/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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-UVYt9BJe.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-UVYt9BJe.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-GfpXAsk_.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-DFuPyCoJ.js';
|
|
8
8
|
import '../types-BcmagF6K.js';
|
|
9
9
|
import '../types-CKFhyrMu.js';
|
|
10
10
|
|
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();
|
|
@@ -792,19 +797,21 @@ var ensureCurrentSessionId = () => {
|
|
|
792
797
|
};
|
|
793
798
|
|
|
794
799
|
// src/reviews/transport.ts
|
|
795
|
-
var submitReview = (target, review) => {
|
|
796
|
-
if (!(target == null ? void 0 : target.serverUrl)) return;
|
|
800
|
+
var submitReview = async (target, review) => {
|
|
801
|
+
if (!(target == null ? void 0 : target.serverUrl)) return "unsent";
|
|
797
802
|
try {
|
|
798
803
|
const url = `${target.serverUrl.replace(/\/$/, "")}/v1/reviews`;
|
|
799
804
|
const headers = { "Content-Type": "application/json" };
|
|
800
805
|
if (target.apiKey) headers.Authorization = `Bearer ${target.apiKey}`;
|
|
801
|
-
|
|
806
|
+
const res = await fetch(url, {
|
|
802
807
|
method: "POST",
|
|
803
808
|
headers,
|
|
804
809
|
body: JSON.stringify(review)
|
|
805
|
-
}).catch(() => {
|
|
806
810
|
});
|
|
811
|
+
if (!res) return "unsent";
|
|
812
|
+
return res.ok ? "accepted" : "rejected";
|
|
807
813
|
} catch {
|
|
814
|
+
return "unsent";
|
|
808
815
|
}
|
|
809
816
|
};
|
|
810
817
|
var fetchReviewDecision = async (target, options = {}) => {
|
|
@@ -893,17 +900,30 @@ var _ReviewGate = ({
|
|
|
893
900
|
onResolved == null ? void 0 : onResolved();
|
|
894
901
|
}, [onResolved]);
|
|
895
902
|
const postedRef = React7__default.default.useRef(false);
|
|
903
|
+
const unackedRef = React7__default.default.useRef(null);
|
|
896
904
|
const postOnce = React7.useCallback(
|
|
897
905
|
(body) => {
|
|
898
906
|
if (postedRef.current) return;
|
|
899
907
|
postedRef.current = true;
|
|
900
|
-
|
|
908
|
+
unackedRef.current = body;
|
|
909
|
+
void submitReview(target, body).then((result) => {
|
|
910
|
+
if (result === "unsent") {
|
|
911
|
+
postedRef.current = false;
|
|
912
|
+
return;
|
|
913
|
+
}
|
|
914
|
+
unackedRef.current = null;
|
|
915
|
+
});
|
|
901
916
|
},
|
|
902
917
|
[target]
|
|
903
918
|
);
|
|
904
919
|
const abandonRef = React7__default.default.useRef(() => {
|
|
905
920
|
});
|
|
906
921
|
abandonRef.current = () => {
|
|
922
|
+
const undelivered = unackedRef.current;
|
|
923
|
+
if (undelivered && !postedRef.current) {
|
|
924
|
+
postOnce(undelivered);
|
|
925
|
+
return;
|
|
926
|
+
}
|
|
907
927
|
if (postedRef.current || stars < 1) return;
|
|
908
928
|
postOnce(
|
|
909
929
|
buildReviewSubmission({
|
|
@@ -1271,7 +1291,7 @@ var useWireFeatures = (config) => {
|
|
|
1271
1291
|
return flags;
|
|
1272
1292
|
};
|
|
1273
1293
|
var CONTEXT_SYMBOL = /* @__PURE__ */ Symbol.for("wireai.features.context");
|
|
1274
|
-
var globalObj =
|
|
1294
|
+
var globalObj = globalThis;
|
|
1275
1295
|
if (!globalObj[CONTEXT_SYMBOL]) {
|
|
1276
1296
|
globalObj[CONTEXT_SYMBOL] = React7.createContext(null);
|
|
1277
1297
|
}
|