@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.
- package/dist/analytics/index.d.mts +69 -2
- package/dist/analytics/index.d.ts +69 -2
- package/dist/analytics/index.js +123 -2
- package/dist/analytics/index.js.map +1 -1
- package/dist/analytics/index.mjs +122 -3
- package/dist/analytics/index.mjs.map +1 -1
- package/dist/coachmarks/index.js +6 -1
- package/dist/coachmarks/index.js.map +1 -1
- package/dist/coachmarks/index.mjs +6 -1
- package/dist/coachmarks/index.mjs.map +1 -1
- package/dist/{eventQueue-CxKi7Qd5.d.mts → eventQueue-CA1d8Fmn.d.mts} +7 -3
- package/dist/{eventQueue-rV1dtJJR.d.ts → eventQueue-CrNB9gzH.d.ts} +7 -3
- package/dist/index.d.mts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +220 -151
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +221 -152
- package/dist/index.mjs.map +1 -1
- package/dist/questionnaire/index.d.mts +1 -1
- package/dist/questionnaire/index.d.ts +1 -1
- package/dist/questionnaire/index.js +29 -5
- package/dist/questionnaire/index.js.map +1 -1
- package/dist/questionnaire/index.mjs +30 -6
- package/dist/questionnaire/index.mjs.map +1 -1
- package/dist/reviews/index.d.mts +1 -1
- package/dist/reviews/index.d.ts +1 -1
- package/dist/reviews/index.js +40 -9
- package/dist/reviews/index.js.map +1 -1
- package/dist/reviews/index.mjs +42 -11
- package/dist/reviews/index.mjs.map +1 -1
- package/dist/showcase/index.d.mts +1 -14
- package/dist/showcase/index.d.ts +1 -14
- package/dist/showcase/index.js +8 -2
- package/dist/showcase/index.js.map +1 -1
- package/dist/showcase/index.mjs +8 -2
- package/dist/showcase/index.mjs.map +1 -1
- package/package.json +3 -2
- package/src/OnboardingFlow.tsx +8 -4
- package/src/WireOnboarding.tsx +8 -3
- package/src/analytics/analyticsFacade.ts +184 -0
- package/src/analytics/eventQueue.ts +5 -0
- package/src/analytics/index.ts +12 -0
- package/src/analytics/reportClientEvent.ts +11 -2
- package/src/analytics/useAnalytics.ts +42 -0
- package/src/analytics/useScreenTracking.ts +23 -1
- package/src/cards/InterstitialCard.tsx +1 -1
- package/src/cards/NumberStepperCard.tsx +12 -7
- package/src/cards/StatusCard.tsx +13 -8
- package/src/cards/TextInputCard.tsx +10 -5
- package/src/components/AnimatedSparkle.tsx +20 -3
- package/src/components/Button.tsx +10 -1
- package/src/components/CardHandoff.tsx +2 -6
- package/src/components/CardLayout.tsx +16 -10
- package/src/components/Illustration.tsx +9 -5
- package/src/components/LoadingBlock.tsx +44 -29
- package/src/components/LoadingScreen.tsx +3 -2
- package/src/components/OnboardingScaffold.tsx +21 -23
- package/src/features/WireFeaturesProvider.tsx +7 -2
- package/src/questionnaire/QuestionnaireGate.tsx +15 -3
- package/src/reviews/ReviewGate.tsx +27 -7
- package/src/reviews/ReviewModal.tsx +4 -0
- package/src/showcase/FeatureShowcase.tsx +2 -1
- package/src/components/loaderChrome.ts +0 -28
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React4, { createContext, forwardRef, useRef, useState, useEffect, useCallback, useImperativeHandle,
|
|
1
|
+
import React4, { createContext, forwardRef, useRef, useState, useEffect, useCallback, useImperativeHandle, useMemo, useContext } from 'react';
|
|
2
2
|
import { StyleSheet, Animated, Easing, BackHandler, Modal, Pressable, Text, AccessibilityInfo, TextInput } from 'react-native';
|
|
3
3
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
@@ -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 :
|
|
169
|
+
onPress: disabled ? void 0 : handlePress,
|
|
162
170
|
onPressIn: disabled ? void 0 : handlePressIn,
|
|
163
171
|
onPressOut: disabled ? void 0 : handlePressOut,
|
|
164
172
|
disabled,
|
|
@@ -440,7 +448,7 @@ var mergeThemeOver = (base, override) => {
|
|
|
440
448
|
button: { ...base.button, ...override.button }
|
|
441
449
|
};
|
|
442
450
|
};
|
|
443
|
-
var
|
|
451
|
+
var _QuestionnaireGate = ({
|
|
444
452
|
questionnaire,
|
|
445
453
|
target,
|
|
446
454
|
sessionId,
|
|
@@ -472,6 +480,12 @@ var QuestionnaireGate = ({
|
|
|
472
480
|
(_a2 = onShownRef.current) == null ? void 0 : _a2.call(onShownRef);
|
|
473
481
|
(_b2 = onEventRef.current) == null ? void 0 : _b2.call(onEventRef, { name: "questionnaire_prompt_shown", id });
|
|
474
482
|
}, []);
|
|
483
|
+
const resolveTimer = React4.useRef(null);
|
|
484
|
+
React4.useEffect(() => {
|
|
485
|
+
return () => {
|
|
486
|
+
if (resolveTimer.current) clearTimeout(resolveTimer.current);
|
|
487
|
+
};
|
|
488
|
+
}, []);
|
|
475
489
|
const resolve = useCallback(() => {
|
|
476
490
|
onResolved == null ? void 0 : onResolved();
|
|
477
491
|
}, [onResolved]);
|
|
@@ -486,8 +500,12 @@ var QuestionnaireGate = ({
|
|
|
486
500
|
submitQuestionnaireResponse(target, id, submission);
|
|
487
501
|
onEvent == null ? void 0 : onEvent({ name: "questionnaire_submitted", id });
|
|
488
502
|
setPhase("thanks");
|
|
489
|
-
|
|
490
|
-
|
|
503
|
+
if (resolveTimer.current) clearTimeout(resolveTimer.current);
|
|
504
|
+
resolveTimer.current = setTimeout(() => {
|
|
505
|
+
var _a2;
|
|
506
|
+
(_a2 = modalRef.current) == null ? void 0 : _a2.close();
|
|
507
|
+
}, 1500);
|
|
508
|
+
}, [canSend, opinion, improve, suggestions, sessionId, meta, target, id, onEvent]);
|
|
491
509
|
const handleDismissTap = useCallback(() => {
|
|
492
510
|
var _a2;
|
|
493
511
|
onEvent == null ? void 0 : onEvent({ name: "questionnaire_dismissed", id });
|
|
@@ -580,6 +598,7 @@ var QuestionnaireGate = ({
|
|
|
580
598
|
] });
|
|
581
599
|
return /* @__PURE__ */ jsx(CenteredModal, { ref: modalRef, theme: t, dismissible, onDismiss: resolve, children: content });
|
|
582
600
|
};
|
|
601
|
+
var QuestionnaireGate = React4.memo(_QuestionnaireGate);
|
|
583
602
|
QuestionnaireGate.displayName = "QuestionnaireGate";
|
|
584
603
|
var styles3 = StyleSheet.create({
|
|
585
604
|
input: { borderWidth: 1 },
|
|
@@ -750,7 +769,12 @@ var useWireFeatures = (config) => {
|
|
|
750
769
|
}, [canFetch, stableConfig]);
|
|
751
770
|
return flags;
|
|
752
771
|
};
|
|
753
|
-
var
|
|
772
|
+
var CONTEXT_SYMBOL = /* @__PURE__ */ Symbol.for("wireai.features.context");
|
|
773
|
+
var globalObj = global;
|
|
774
|
+
if (!globalObj[CONTEXT_SYMBOL]) {
|
|
775
|
+
globalObj[CONTEXT_SYMBOL] = createContext(null);
|
|
776
|
+
}
|
|
777
|
+
var WireFeaturesContext = globalObj[CONTEXT_SYMBOL];
|
|
754
778
|
var useWireFeaturesContext = () => useContext(WireFeaturesContext);
|
|
755
779
|
var useResolvedFeatures = (options) => {
|
|
756
780
|
var _a, _b, _c;
|