@wireai/activation 0.3.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 (57) hide show
  1. package/dist/analytics/index.js +46 -4
  2. package/dist/analytics/index.js.map +1 -1
  3. package/dist/analytics/index.mjs +46 -4
  4. package/dist/analytics/index.mjs.map +1 -1
  5. package/dist/coachmarks/index.js +6 -1
  6. package/dist/coachmarks/index.js.map +1 -1
  7. package/dist/coachmarks/index.mjs +6 -1
  8. package/dist/coachmarks/index.mjs.map +1 -1
  9. package/dist/index.d.mts +3 -2
  10. package/dist/index.d.ts +3 -2
  11. package/dist/index.js +220 -151
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.mjs +221 -152
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/questionnaire/index.d.mts +1 -1
  16. package/dist/questionnaire/index.d.ts +1 -1
  17. package/dist/questionnaire/index.js +29 -5
  18. package/dist/questionnaire/index.js.map +1 -1
  19. package/dist/questionnaire/index.mjs +30 -6
  20. package/dist/questionnaire/index.mjs.map +1 -1
  21. package/dist/reviews/index.d.mts +1 -1
  22. package/dist/reviews/index.d.ts +1 -1
  23. package/dist/reviews/index.js +40 -9
  24. package/dist/reviews/index.js.map +1 -1
  25. package/dist/reviews/index.mjs +42 -11
  26. package/dist/reviews/index.mjs.map +1 -1
  27. package/dist/showcase/index.d.mts +1 -14
  28. package/dist/showcase/index.d.ts +1 -14
  29. package/dist/showcase/index.js +8 -2
  30. package/dist/showcase/index.js.map +1 -1
  31. package/dist/showcase/index.mjs +8 -2
  32. package/dist/showcase/index.mjs.map +1 -1
  33. package/package.json +3 -2
  34. package/src/OnboardingFlow.tsx +8 -4
  35. package/src/WireOnboarding.tsx +8 -3
  36. package/src/analytics/analyticsFacade.ts +14 -1
  37. package/src/analytics/eventQueue.ts +5 -0
  38. package/src/analytics/useAnalytics.ts +7 -1
  39. package/src/analytics/useScreenTracking.ts +23 -1
  40. package/src/cards/InterstitialCard.tsx +1 -1
  41. package/src/cards/NumberStepperCard.tsx +12 -7
  42. package/src/cards/StatusCard.tsx +13 -8
  43. package/src/cards/TextInputCard.tsx +10 -5
  44. package/src/components/AnimatedSparkle.tsx +20 -3
  45. package/src/components/Button.tsx +10 -1
  46. package/src/components/CardHandoff.tsx +2 -6
  47. package/src/components/CardLayout.tsx +16 -10
  48. package/src/components/Illustration.tsx +9 -5
  49. package/src/components/LoadingBlock.tsx +44 -29
  50. package/src/components/LoadingScreen.tsx +3 -2
  51. package/src/components/OnboardingScaffold.tsx +21 -23
  52. package/src/features/WireFeaturesProvider.tsx +7 -2
  53. package/src/questionnaire/QuestionnaireGate.tsx +15 -3
  54. package/src/reviews/ReviewGate.tsx +27 -7
  55. package/src/reviews/ReviewModal.tsx +4 -0
  56. package/src/showcase/FeatureShowcase.tsx +2 -1
  57. package/src/components/loaderChrome.ts +0 -28
@@ -177,7 +177,7 @@ interface QuestionnaireGateController {
177
177
  * OnboardingTheme; analytics are callback-based (no PII - answers go ONLY in the POST body).
178
178
  */
179
179
 
180
- declare const QuestionnaireGate: React__default.FC<QuestionnaireGateProps>;
180
+ declare const QuestionnaireGate: React__default.NamedExoticComponent<QuestionnaireGateProps>;
181
181
 
182
182
  declare const useQuestionnaireGate: ({ config: configProp, decision: decisionProp, events, storage, isTesting, features, featuresConfig, }: UseQuestionnaireGateOptions) => QuestionnaireGateController;
183
183
 
@@ -177,7 +177,7 @@ interface QuestionnaireGateController {
177
177
  * OnboardingTheme; analytics are callback-based (no PII - answers go ONLY in the POST body).
178
178
  */
179
179
 
180
- declare const QuestionnaireGate: React__default.FC<QuestionnaireGateProps>;
180
+ declare const QuestionnaireGate: React__default.NamedExoticComponent<QuestionnaireGateProps>;
181
181
 
182
182
  declare const useQuestionnaireGate: ({ config: configProp, decision: decisionProp, events, storage, isTesting, features, featuresConfig, }: UseQuestionnaireGateOptions) => QuestionnaireGateController;
183
183
 
@@ -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,
@@ -446,7 +454,7 @@ var mergeThemeOver = (base, override) => {
446
454
  button: { ...base.button, ...override.button }
447
455
  };
448
456
  };
449
- var QuestionnaireGate = ({
457
+ var _QuestionnaireGate = ({
450
458
  questionnaire,
451
459
  target,
452
460
  sessionId,
@@ -478,6 +486,12 @@ var QuestionnaireGate = ({
478
486
  (_a2 = onShownRef.current) == null ? void 0 : _a2.call(onShownRef);
479
487
  (_b2 = onEventRef.current) == null ? void 0 : _b2.call(onEventRef, { name: "questionnaire_prompt_shown", id });
480
488
  }, []);
489
+ const resolveTimer = React4__default.default.useRef(null);
490
+ React4__default.default.useEffect(() => {
491
+ return () => {
492
+ if (resolveTimer.current) clearTimeout(resolveTimer.current);
493
+ };
494
+ }, []);
481
495
  const resolve = React4.useCallback(() => {
482
496
  onResolved == null ? void 0 : onResolved();
483
497
  }, [onResolved]);
@@ -492,8 +506,12 @@ var QuestionnaireGate = ({
492
506
  submitQuestionnaireResponse(target, id, submission);
493
507
  onEvent == null ? void 0 : onEvent({ name: "questionnaire_submitted", id });
494
508
  setPhase("thanks");
495
- resolve();
496
- }, [canSend, opinion, improve, suggestions, sessionId, meta, target, id, onEvent, resolve]);
509
+ if (resolveTimer.current) clearTimeout(resolveTimer.current);
510
+ resolveTimer.current = setTimeout(() => {
511
+ var _a2;
512
+ (_a2 = modalRef.current) == null ? void 0 : _a2.close();
513
+ }, 1500);
514
+ }, [canSend, opinion, improve, suggestions, sessionId, meta, target, id, onEvent]);
497
515
  const handleDismissTap = React4.useCallback(() => {
498
516
  var _a2;
499
517
  onEvent == null ? void 0 : onEvent({ name: "questionnaire_dismissed", id });
@@ -586,6 +604,7 @@ var QuestionnaireGate = ({
586
604
  ] });
587
605
  return /* @__PURE__ */ jsxRuntime.jsx(CenteredModal, { ref: modalRef, theme: t, dismissible, onDismiss: resolve, children: content });
588
606
  };
607
+ var QuestionnaireGate = React4__default.default.memo(_QuestionnaireGate);
589
608
  QuestionnaireGate.displayName = "QuestionnaireGate";
590
609
  var styles3 = reactNative.StyleSheet.create({
591
610
  input: { borderWidth: 1 },
@@ -756,7 +775,12 @@ var useWireFeatures = (config) => {
756
775
  }, [canFetch, stableConfig]);
757
776
  return flags;
758
777
  };
759
- var WireFeaturesContext = React4.createContext(null);
778
+ var CONTEXT_SYMBOL = /* @__PURE__ */ Symbol.for("wireai.features.context");
779
+ var globalObj = global;
780
+ if (!globalObj[CONTEXT_SYMBOL]) {
781
+ globalObj[CONTEXT_SYMBOL] = React4.createContext(null);
782
+ }
783
+ var WireFeaturesContext = globalObj[CONTEXT_SYMBOL];
760
784
  var useWireFeaturesContext = () => React4.useContext(WireFeaturesContext);
761
785
  var useResolvedFeatures = (options) => {
762
786
  var _a, _b, _c;