@wireai/activation 0.2.0 → 0.4.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.
Files changed (63) hide show
  1. package/dist/analytics/index.d.mts +69 -2
  2. package/dist/analytics/index.d.ts +69 -2
  3. package/dist/analytics/index.js +123 -2
  4. package/dist/analytics/index.js.map +1 -1
  5. package/dist/analytics/index.mjs +122 -3
  6. package/dist/analytics/index.mjs.map +1 -1
  7. package/dist/coachmarks/index.js +6 -1
  8. package/dist/coachmarks/index.js.map +1 -1
  9. package/dist/coachmarks/index.mjs +6 -1
  10. package/dist/coachmarks/index.mjs.map +1 -1
  11. package/dist/{eventQueue-CxKi7Qd5.d.mts → eventQueue-CA1d8Fmn.d.mts} +7 -3
  12. package/dist/{eventQueue-rV1dtJJR.d.ts → eventQueue-CrNB9gzH.d.ts} +7 -3
  13. package/dist/index.d.mts +5 -4
  14. package/dist/index.d.ts +5 -4
  15. package/dist/index.js +220 -151
  16. package/dist/index.js.map +1 -1
  17. package/dist/index.mjs +221 -152
  18. package/dist/index.mjs.map +1 -1
  19. package/dist/questionnaire/index.d.mts +1 -1
  20. package/dist/questionnaire/index.d.ts +1 -1
  21. package/dist/questionnaire/index.js +29 -5
  22. package/dist/questionnaire/index.js.map +1 -1
  23. package/dist/questionnaire/index.mjs +30 -6
  24. package/dist/questionnaire/index.mjs.map +1 -1
  25. package/dist/reviews/index.d.mts +1 -1
  26. package/dist/reviews/index.d.ts +1 -1
  27. package/dist/reviews/index.js +40 -9
  28. package/dist/reviews/index.js.map +1 -1
  29. package/dist/reviews/index.mjs +42 -11
  30. package/dist/reviews/index.mjs.map +1 -1
  31. package/dist/showcase/index.d.mts +1 -14
  32. package/dist/showcase/index.d.ts +1 -14
  33. package/dist/showcase/index.js +8 -2
  34. package/dist/showcase/index.js.map +1 -1
  35. package/dist/showcase/index.mjs +8 -2
  36. package/dist/showcase/index.mjs.map +1 -1
  37. package/package.json +3 -2
  38. package/src/OnboardingFlow.tsx +8 -4
  39. package/src/WireOnboarding.tsx +8 -3
  40. package/src/analytics/analyticsFacade.ts +184 -0
  41. package/src/analytics/eventQueue.ts +5 -0
  42. package/src/analytics/index.ts +12 -0
  43. package/src/analytics/reportClientEvent.ts +11 -2
  44. package/src/analytics/useAnalytics.ts +42 -0
  45. package/src/analytics/useScreenTracking.ts +23 -1
  46. package/src/cards/InterstitialCard.tsx +1 -1
  47. package/src/cards/NumberStepperCard.tsx +12 -7
  48. package/src/cards/StatusCard.tsx +13 -8
  49. package/src/cards/TextInputCard.tsx +10 -5
  50. package/src/components/AnimatedSparkle.tsx +20 -3
  51. package/src/components/Button.tsx +10 -1
  52. package/src/components/CardHandoff.tsx +2 -6
  53. package/src/components/CardLayout.tsx +16 -10
  54. package/src/components/Illustration.tsx +9 -5
  55. package/src/components/LoadingBlock.tsx +44 -29
  56. package/src/components/LoadingScreen.tsx +3 -2
  57. package/src/components/OnboardingScaffold.tsx +21 -23
  58. package/src/features/WireFeaturesProvider.tsx +7 -2
  59. package/src/questionnaire/QuestionnaireGate.tsx +15 -3
  60. package/src/reviews/ReviewGate.tsx +27 -7
  61. package/src/reviews/ReviewModal.tsx +4 -0
  62. package/src/showcase/FeatureShowcase.tsx +2 -1
  63. package/src/components/loaderChrome.ts +0 -28
@@ -46,7 +46,7 @@ declare const reviewSessionsKey: (id: string) => string;
46
46
  * on the 5-star path, never from a "rate us 5 stars" button. See the README notes.
47
47
  */
48
48
 
49
- declare const ReviewGate: React__default.FC<ReviewGateProps>;
49
+ declare const ReviewGate: React__default.NamedExoticComponent<ReviewGateProps>;
50
50
 
51
51
  /**
52
52
  * centeredModalMotion - the pure entrance spec for the content-agnostic CenteredModal shell.
@@ -151,6 +151,14 @@ var _Button = ({
151
151
  },
152
152
  [pressT, reduced]
153
153
  );
154
+ const lastPress = React4.useRef(0);
155
+ const handlePress = React4.useCallback(() => {
156
+ if (!onPress) return;
157
+ const now = Date.now();
158
+ if (now - lastPress.current < 500) return;
159
+ lastPress.current = now;
160
+ onPress();
161
+ }, [onPress]);
154
162
  const handlePressIn = React4.useCallback(() => pressTo(1), [pressTo]);
155
163
  const handlePressOut = React4.useCallback(() => pressTo(0), [pressTo]);
156
164
  const scale = pressT.interpolate({
@@ -164,7 +172,7 @@ var _Button = ({
164
172
  return /* @__PURE__ */ jsxRuntime.jsx(
165
173
  reactNative.Pressable,
166
174
  {
167
- onPress: disabled ? void 0 : onPress,
175
+ onPress: disabled ? void 0 : handlePress,
168
176
  onPressIn: disabled ? void 0 : handlePressIn,
169
177
  onPressOut: disabled ? void 0 : handlePressOut,
170
178
  disabled,
@@ -489,7 +497,7 @@ var mergeThemeOver = (base, override) => {
489
497
  button: { ...base.button, ...override.button }
490
498
  };
491
499
  };
492
- var ReviewGate = ({
500
+ var _ReviewGate = ({
493
501
  appName,
494
502
  store,
495
503
  target,
@@ -524,9 +532,26 @@ var ReviewGate = ({
524
532
  (_a = onShownRef.current) == null ? void 0 : _a.call(onShownRef);
525
533
  (_b = onEventRef.current) == null ? void 0 : _b.call(onEventRef, { name: "review_prompt_shown", id });
526
534
  }, []);
535
+ const resolveTimer = React4__default.default.useRef(null);
536
+ React4__default.default.useEffect(() => {
537
+ return () => {
538
+ if (resolveTimer.current) clearTimeout(resolveTimer.current);
539
+ };
540
+ }, []);
527
541
  const resolve = React4.useCallback(() => {
528
542
  onResolved == null ? void 0 : onResolved();
529
543
  }, [onResolved]);
544
+ const resolveWithDelay = React4.useCallback(() => {
545
+ if (resolveTimer.current) clearTimeout(resolveTimer.current);
546
+ resolveTimer.current = setTimeout(() => {
547
+ var _a;
548
+ if (mode === "modal") {
549
+ (_a = modalRef.current) == null ? void 0 : _a.close();
550
+ } else {
551
+ onResolved == null ? void 0 : onResolved();
552
+ }
553
+ }, 1500);
554
+ }, [mode, onResolved]);
530
555
  const pickRating = React4.useCallback(
531
556
  async (value) => {
532
557
  setStars(value);
@@ -535,12 +560,12 @@ var ReviewGate = ({
535
560
  onEvent == null ? void 0 : onEvent({ name: "store_review_requested", id, stars: value });
536
561
  await requestStoreReview(store);
537
562
  setPhase("thanks");
538
- resolve();
563
+ resolveWithDelay();
539
564
  } else {
540
565
  setPhase("feedback");
541
566
  }
542
567
  },
543
- [onEvent, id, store, resolve]
568
+ [onEvent, id, store, resolveWithDelay]
544
569
  );
545
570
  const sendFeedback = React4.useCallback(() => {
546
571
  const body = buildReviewSubmission({
@@ -553,12 +578,12 @@ var ReviewGate = ({
553
578
  submitReview(target, body);
554
579
  onEvent == null ? void 0 : onEvent({ name: "review_feedback_submitted", id, stars });
555
580
  setPhase("thanks");
556
- resolve();
557
- }, [stars, feedback, suggestion, sessionId, meta, target, onEvent, id, resolve]);
581
+ resolveWithDelay();
582
+ }, [stars, feedback, suggestion, sessionId, meta, target, onEvent, id, resolveWithDelay]);
558
583
  const dismiss = React4.useCallback(() => {
559
584
  setPhase("thanks");
560
- resolve();
561
- }, [resolve]);
585
+ resolveWithDelay();
586
+ }, [resolveWithDelay]);
562
587
  const handleDismissTap = React4.useCallback(() => {
563
588
  var _a;
564
589
  if (mode === "modal") (_a = modalRef.current) == null ? void 0 : _a.close();
@@ -671,6 +696,7 @@ var ReviewGate = ({
671
696
  }
672
697
  return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles3.card, surface], children: content });
673
698
  };
699
+ var ReviewGate = React4__default.default.memo(_ReviewGate);
674
700
  ReviewGate.displayName = "ReviewGate";
675
701
  var styles3 = reactNative.StyleSheet.create({
676
702
  card: { width: "100%" },
@@ -844,7 +870,12 @@ var useWireFeatures = (config) => {
844
870
  }, [canFetch, stableConfig]);
845
871
  return flags;
846
872
  };
847
- var WireFeaturesContext = React4.createContext(null);
873
+ var CONTEXT_SYMBOL = /* @__PURE__ */ Symbol.for("wireai.features.context");
874
+ var globalObj = global;
875
+ if (!globalObj[CONTEXT_SYMBOL]) {
876
+ globalObj[CONTEXT_SYMBOL] = React4.createContext(null);
877
+ }
878
+ var WireFeaturesContext = globalObj[CONTEXT_SYMBOL];
848
879
  var useWireFeaturesContext = () => React4.useContext(WireFeaturesContext);
849
880
  var useResolvedFeatures = (options) => {
850
881
  var _a, _b, _c;