@hook-sdk/template 0.28.0 → 0.28.1
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/index.cjs +8 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +13 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -175,7 +175,7 @@ interface SkipDefaults {
|
|
|
175
175
|
declare function skipOnboarding(hook: HookContextValue, defaults: SkipDefaults, appSlug: string): Promise<void>;
|
|
176
176
|
declare function DevSkipOnboardingFab({ defaults }: {
|
|
177
177
|
defaults: SkipDefaults;
|
|
178
|
-
}): react_jsx_runtime.JSX.Element;
|
|
178
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
179
179
|
|
|
180
180
|
declare function PaymentReturnHandler({ children }: {
|
|
181
181
|
children: ReactNode;
|
package/dist/index.d.ts
CHANGED
|
@@ -175,7 +175,7 @@ interface SkipDefaults {
|
|
|
175
175
|
declare function skipOnboarding(hook: HookContextValue, defaults: SkipDefaults, appSlug: string): Promise<void>;
|
|
176
176
|
declare function DevSkipOnboardingFab({ defaults }: {
|
|
177
177
|
defaults: SkipDefaults;
|
|
178
|
-
}): react_jsx_runtime.JSX.Element;
|
|
178
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
179
179
|
|
|
180
180
|
declare function PaymentReturnHandler({ children }: {
|
|
181
181
|
children: ReactNode;
|
package/dist/index.js
CHANGED
|
@@ -2108,7 +2108,7 @@ function isDevToolsEnabled() {
|
|
|
2108
2108
|
|
|
2109
2109
|
// src/dev/DevSkipOnboardingFab.tsx
|
|
2110
2110
|
import { useCallback as useCallback3, useRef as useRef4, useState as useState5 } from "react";
|
|
2111
|
-
import { useHook as useHook5 } from "@hook-sdk/sdk";
|
|
2111
|
+
import { useHook as useHook5, usePersistedState as usePersistedState2 } from "@hook-sdk/sdk";
|
|
2112
2112
|
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
2113
2113
|
var STORAGE_KEY = "hook_dev_skip_email";
|
|
2114
2114
|
var TEST_EMAIL_DOMAIN = "@hook.test";
|
|
@@ -2181,6 +2181,13 @@ function DevSkipOnboardingFab({ defaults }) {
|
|
|
2181
2181
|
const [state, setState] = useState5("idle");
|
|
2182
2182
|
const [errorMsg, setErrorMsg] = useState5(null);
|
|
2183
2183
|
const timerRef = useRef4(null);
|
|
2184
|
+
const isAuthed = hook.authStatus === "authenticated";
|
|
2185
|
+
const [onboarding] = usePersistedState2(
|
|
2186
|
+
"onboarding_data",
|
|
2187
|
+
null,
|
|
2188
|
+
{ enabled: isAuthed }
|
|
2189
|
+
);
|
|
2190
|
+
const onboardingCompleted = isAuthed && onboarding?.onboarding_completed === true;
|
|
2184
2191
|
const clearTimer = useCallback3(() => {
|
|
2185
2192
|
if (timerRef.current) {
|
|
2186
2193
|
clearTimeout(timerRef.current);
|
|
@@ -2211,6 +2218,7 @@ function DevSkipOnboardingFab({ defaults }) {
|
|
|
2211
2218
|
if (state === "error") return `failed \u2014 tap to retry`;
|
|
2212
2219
|
return hook.authStatus === "authenticated" ? "\u26A1 skip onboarding" : "\u26A1 skip + signup";
|
|
2213
2220
|
})();
|
|
2221
|
+
if (onboardingCompleted) return null;
|
|
2214
2222
|
const style = {
|
|
2215
2223
|
...STYLES.base,
|
|
2216
2224
|
...state === "confirm" || state === "error" ? STYLES.confirm : {},
|
|
@@ -2684,12 +2692,12 @@ function PushPrompt2({ texts, onSubscribed, onDeclined, onInstallRequested, clas
|
|
|
2684
2692
|
}
|
|
2685
2693
|
|
|
2686
2694
|
// src/components/LanguageSwitcher.tsx
|
|
2687
|
-
import { usePersistedState as
|
|
2695
|
+
import { usePersistedState as usePersistedState3 } from "@hook-sdk/sdk";
|
|
2688
2696
|
import { jsx as jsx24, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2689
2697
|
function LanguageSwitcher({ id, className, label = "Language" }) {
|
|
2690
2698
|
const config = useAppConfig();
|
|
2691
2699
|
const i18nConfig = config.i18n;
|
|
2692
|
-
const [userLocale, setUserLocale] =
|
|
2700
|
+
const [userLocale, setUserLocale] = usePersistedState3(
|
|
2693
2701
|
"user-locale",
|
|
2694
2702
|
i18nConfig?.defaultLocale ?? "en-US"
|
|
2695
2703
|
);
|
|
@@ -3963,7 +3971,7 @@ function PreAuthShell({
|
|
|
3963
3971
|
|
|
3964
3972
|
// src/OnboardingFlow.tsx
|
|
3965
3973
|
import { useCallback as useCallback13, useEffect as useEffect16, useMemo as useMemo11, useRef as useRef7 } from "react";
|
|
3966
|
-
import { usePersistedState as
|
|
3974
|
+
import { usePersistedState as usePersistedState4, useHook as useHook20 } from "@hook-sdk/sdk";
|
|
3967
3975
|
|
|
3968
3976
|
// src/hooks/useOnboardingStep.ts
|
|
3969
3977
|
import { createContext as createContext3, useContext as useContext4 } from "react";
|
|
@@ -3992,7 +4000,7 @@ function OnboardingFlow({
|
|
|
3992
4000
|
onComplete,
|
|
3993
4001
|
persistKey
|
|
3994
4002
|
}) {
|
|
3995
|
-
const [draft, setDraft, status] =
|
|
4003
|
+
const [draft, setDraft, status] = usePersistedState4(persistKey, {});
|
|
3996
4004
|
const draftRef = useRef7(draft);
|
|
3997
4005
|
draftRef.current = draft;
|
|
3998
4006
|
const idx = readPersistedStepIdx(draft);
|