@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
package/dist/reviews/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React4, { createContext, forwardRef, useRef, useState, useEffect, useCallback, useImperativeHandle,
|
|
2
|
-
import { StyleSheet, Animated, Easing, BackHandler, Modal, Pressable, Text, AccessibilityInfo,
|
|
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 :
|
|
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
|
|
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
|
-
|
|
557
|
+
resolveWithDelay();
|
|
533
558
|
} else {
|
|
534
559
|
setPhase("feedback");
|
|
535
560
|
}
|
|
536
561
|
},
|
|
537
|
-
[onEvent, id, store,
|
|
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
|
-
|
|
551
|
-
}, [stars, feedback, suggestion, sessionId, meta, target, onEvent, id,
|
|
575
|
+
resolveWithDelay();
|
|
576
|
+
}, [stars, feedback, suggestion, sessionId, meta, target, onEvent, id, resolveWithDelay]);
|
|
552
577
|
const dismiss = useCallback(() => {
|
|
553
578
|
setPhase("thanks");
|
|
554
|
-
|
|
555
|
-
}, [
|
|
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
|
|
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;
|