@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
@@ -1,5 +1,5 @@
1
- import React4, { createContext, forwardRef, useRef, useState, useEffect, useCallback, useImperativeHandle, useContext, useMemo } from 'react';
2
- import { StyleSheet, Animated, Easing, BackHandler, Modal, Pressable, Text, AccessibilityInfo, Platform, Linking, View, TextInput } from 'react-native';
1
+ import React4, { createContext, forwardRef, useRef, useState, useEffect, useCallback, useImperativeHandle, useMemo, useContext } from 'react';
2
+ import { StyleSheet, Animated, Easing, BackHandler, Modal, Pressable, Text, AccessibilityInfo, View, TextInput, Linking, Platform } from 'react-native';
3
3
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
4
4
  import { SafeAreaView } from 'react-native-safe-area-context';
5
5
 
@@ -145,6 +145,14 @@ var _Button = ({
145
145
  },
146
146
  [pressT, reduced]
147
147
  );
148
+ const lastPress = useRef(0);
149
+ const handlePress = useCallback(() => {
150
+ if (!onPress) return;
151
+ const now = Date.now();
152
+ if (now - lastPress.current < 500) return;
153
+ lastPress.current = now;
154
+ onPress();
155
+ }, [onPress]);
148
156
  const handlePressIn = useCallback(() => pressTo(1), [pressTo]);
149
157
  const handlePressOut = useCallback(() => pressTo(0), [pressTo]);
150
158
  const scale = pressT.interpolate({
@@ -158,7 +166,7 @@ var _Button = ({
158
166
  return /* @__PURE__ */ jsx(
159
167
  Pressable,
160
168
  {
161
- onPress: disabled ? void 0 : onPress,
169
+ onPress: disabled ? void 0 : handlePress,
162
170
  onPressIn: disabled ? void 0 : handlePressIn,
163
171
  onPressOut: disabled ? void 0 : handlePressOut,
164
172
  disabled,
@@ -483,7 +491,7 @@ var mergeThemeOver = (base, override) => {
483
491
  button: { ...base.button, ...override.button }
484
492
  };
485
493
  };
486
- var ReviewGate = ({
494
+ var _ReviewGate = ({
487
495
  appName,
488
496
  store,
489
497
  target,
@@ -518,9 +526,26 @@ var ReviewGate = ({
518
526
  (_a = onShownRef.current) == null ? void 0 : _a.call(onShownRef);
519
527
  (_b = onEventRef.current) == null ? void 0 : _b.call(onEventRef, { name: "review_prompt_shown", id });
520
528
  }, []);
529
+ const resolveTimer = React4.useRef(null);
530
+ React4.useEffect(() => {
531
+ return () => {
532
+ if (resolveTimer.current) clearTimeout(resolveTimer.current);
533
+ };
534
+ }, []);
521
535
  const resolve = useCallback(() => {
522
536
  onResolved == null ? void 0 : onResolved();
523
537
  }, [onResolved]);
538
+ const resolveWithDelay = useCallback(() => {
539
+ if (resolveTimer.current) clearTimeout(resolveTimer.current);
540
+ resolveTimer.current = setTimeout(() => {
541
+ var _a;
542
+ if (mode === "modal") {
543
+ (_a = modalRef.current) == null ? void 0 : _a.close();
544
+ } else {
545
+ onResolved == null ? void 0 : onResolved();
546
+ }
547
+ }, 1500);
548
+ }, [mode, onResolved]);
524
549
  const pickRating = useCallback(
525
550
  async (value) => {
526
551
  setStars(value);
@@ -529,12 +554,12 @@ var ReviewGate = ({
529
554
  onEvent == null ? void 0 : onEvent({ name: "store_review_requested", id, stars: value });
530
555
  await requestStoreReview(store);
531
556
  setPhase("thanks");
532
- resolve();
557
+ resolveWithDelay();
533
558
  } else {
534
559
  setPhase("feedback");
535
560
  }
536
561
  },
537
- [onEvent, id, store, resolve]
562
+ [onEvent, id, store, resolveWithDelay]
538
563
  );
539
564
  const sendFeedback = useCallback(() => {
540
565
  const body = buildReviewSubmission({
@@ -547,12 +572,12 @@ var ReviewGate = ({
547
572
  submitReview(target, body);
548
573
  onEvent == null ? void 0 : onEvent({ name: "review_feedback_submitted", id, stars });
549
574
  setPhase("thanks");
550
- resolve();
551
- }, [stars, feedback, suggestion, sessionId, meta, target, onEvent, id, resolve]);
575
+ resolveWithDelay();
576
+ }, [stars, feedback, suggestion, sessionId, meta, target, onEvent, id, resolveWithDelay]);
552
577
  const dismiss = useCallback(() => {
553
578
  setPhase("thanks");
554
- resolve();
555
- }, [resolve]);
579
+ resolveWithDelay();
580
+ }, [resolveWithDelay]);
556
581
  const handleDismissTap = useCallback(() => {
557
582
  var _a;
558
583
  if (mode === "modal") (_a = modalRef.current) == null ? void 0 : _a.close();
@@ -665,6 +690,7 @@ var ReviewGate = ({
665
690
  }
666
691
  return /* @__PURE__ */ jsx(View, { style: [styles3.card, surface], children: content });
667
692
  };
693
+ var ReviewGate = React4.memo(_ReviewGate);
668
694
  ReviewGate.displayName = "ReviewGate";
669
695
  var styles3 = StyleSheet.create({
670
696
  card: { width: "100%" },
@@ -838,7 +864,12 @@ var useWireFeatures = (config) => {
838
864
  }, [canFetch, stableConfig]);
839
865
  return flags;
840
866
  };
841
- var WireFeaturesContext = createContext(null);
867
+ var CONTEXT_SYMBOL = /* @__PURE__ */ Symbol.for("wireai.features.context");
868
+ var globalObj = global;
869
+ if (!globalObj[CONTEXT_SYMBOL]) {
870
+ globalObj[CONTEXT_SYMBOL] = createContext(null);
871
+ }
872
+ var WireFeaturesContext = globalObj[CONTEXT_SYMBOL];
842
873
  var useWireFeaturesContext = () => useContext(WireFeaturesContext);
843
874
  var useResolvedFeatures = (options) => {
844
875
  var _a, _b, _c;