flowboard-react 0.6.7 → 0.6.10
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/LICENSE +2 -3
- package/README.md +16 -0
- package/lib/module/components/FlowboardFlow.js +24 -57
- package/lib/module/components/FlowboardFlow.js.map +1 -1
- package/lib/module/components/FlowboardRenderer.js +590 -196
- package/lib/module/components/FlowboardRenderer.js.map +1 -1
- package/lib/module/components/layout/stackOverlayModel.js +156 -0
- package/lib/module/components/layout/stackOverlayModel.js.map +1 -0
- package/lib/module/fonts/fontLoader.js +285 -0
- package/lib/module/fonts/fontLoader.js.map +1 -0
- package/lib/module/fonts/fontResolver.js +38 -0
- package/lib/module/fonts/fontResolver.js.map +1 -0
- package/lib/module/fonts/google-fonts-meta.json +1 -0
- package/lib/module/fonts/googleFontCatalog.js +56 -0
- package/lib/module/fonts/googleFontCatalog.js.map +1 -0
- package/lib/module/fonts/googleFontLoader.js +101 -0
- package/lib/module/fonts/googleFontLoader.js.map +1 -0
- package/lib/module/fonts/googleFontsLoader.js +68 -0
- package/lib/module/fonts/googleFontsLoader.js.map +1 -0
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/components/FlowboardFlow.d.ts.map +1 -1
- package/lib/typescript/src/components/FlowboardRenderer.d.ts +11 -4
- package/lib/typescript/src/components/FlowboardRenderer.d.ts.map +1 -1
- package/lib/typescript/src/components/layout/stackOverlayModel.d.ts +13 -0
- package/lib/typescript/src/components/layout/stackOverlayModel.d.ts.map +1 -0
- package/lib/typescript/src/fonts/fontLoader.d.ts +17 -0
- package/lib/typescript/src/fonts/fontLoader.d.ts.map +1 -0
- package/lib/typescript/src/fonts/fontResolver.d.ts +11 -0
- package/lib/typescript/src/fonts/fontResolver.d.ts.map +1 -0
- package/lib/typescript/src/fonts/googleFontCatalog.d.ts +4 -0
- package/lib/typescript/src/fonts/googleFontCatalog.d.ts.map +1 -0
- package/lib/typescript/src/fonts/googleFontLoader.d.ts +7 -0
- package/lib/typescript/src/fonts/googleFontLoader.d.ts.map +1 -0
- package/lib/typescript/src/fonts/googleFontsLoader.d.ts +18 -0
- package/lib/typescript/src/fonts/googleFontsLoader.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +14 -2
- package/src/components/FlowboardFlow.tsx +33 -67
- package/src/components/FlowboardRenderer.tsx +852 -210
- package/src/components/layout/stackOverlayModel.ts +185 -0
- package/src/fonts/fontLoader.ts +426 -0
- package/src/fonts/fontResolver.ts +69 -0
- package/src/fonts/google-fonts-meta.json +1 -0
- package/src/fonts/googleFontCatalog.ts +77 -0
- package/src/fonts/googleFontLoader.ts +136 -0
- package/src/fonts/googleFontsLoader.ts +124 -0
- package/src/index.tsx +13 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type GoogleFontLoadRequest = {
|
|
2
|
+
family: string;
|
|
3
|
+
weight: number;
|
|
4
|
+
nativeFontName: string;
|
|
5
|
+
cacheKey: string;
|
|
6
|
+
};
|
|
7
|
+
export type GoogleFontProvider = {
|
|
8
|
+
loadFont: (request: GoogleFontLoadRequest) => Promise<boolean | string | void> | boolean | string | void;
|
|
9
|
+
};
|
|
10
|
+
export declare function resolveGoogleFontWeight(family: string, weight?: number | string): number;
|
|
11
|
+
export declare function resolveGoogleFontNativeName(family: string, weight?: number | string): string;
|
|
12
|
+
export declare function ensureGoogleFontLoaded(family: string, weight?: number | string): Promise<void>;
|
|
13
|
+
export declare function isGoogleFontLoaded(family: string, weight?: number | string): boolean;
|
|
14
|
+
export declare function getLoadedGoogleFontNativeName(family: string, weight?: number | string): string | undefined;
|
|
15
|
+
export declare function registerGoogleFontProvider(provider: GoogleFontProvider | null): void;
|
|
16
|
+
export declare function subscribeGoogleFontLoad(listener: () => void): () => void;
|
|
17
|
+
export declare function __resetGoogleFontsLoaderForTests(): void;
|
|
18
|
+
//# sourceMappingURL=googleFontsLoader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D"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { Flowboard } from './Flowboard';
|
|
2
2
|
export { default as FlowboardProvider } from './FlowboardProvider';
|
|
3
3
|
export { default as FlowboardFlow } from './components/FlowboardFlow';
|
|
4
|
+
export { ensureGoogleFontLoaded, registerFontResolver, resolveFontFamily, } from './fonts/googleFontLoader';
|
|
5
|
+
export { ensureGoogleFontLoaded as ensureGoogleNativeFontLoaded, getLoadedGoogleFontNativeName, isGoogleFontLoaded as isGoogleNativeFontLoaded, registerGoogleFontProvider, resolveGoogleFontNativeName, resolveGoogleFontWeight, } from './fonts/googleFontsLoader';
|
|
4
6
|
export type { FlowboardContext, CustomScreenBuilder, CustomActionBuilder, OnboardingEndCallback, OnStepChangeCallback, FlowboardLaunchOptions, FlowboardLaunchByIdOptions, FlowboardFlowVersion, FlowboardData, } from './types/flowboard';
|
|
5
7
|
export type { FlowboardFlowProps } from './components/FlowboardFlow';
|
|
6
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtE,YAAY,EACV,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,EAC1B,oBAAoB,EACpB,aAAa,GACd,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,sBAAsB,IAAI,4BAA4B,EACtD,6BAA6B,EAC7B,kBAAkB,IAAI,wBAAwB,EAC9C,0BAA0B,EAC1B,2BAA2B,EAC3B,uBAAuB,GACxB,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACV,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,EAC1B,oBAAoB,EACpB,aAAa,GACd,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flowboard-react",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.10",
|
|
4
4
|
"description": "Onboard your users with one click",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -101,19 +101,31 @@
|
|
|
101
101
|
"peerDependencies": {
|
|
102
102
|
"@react-native-async-storage/async-storage": ">= 1.24.0",
|
|
103
103
|
"@react-native-masked-view/masked-view": ">= 0.3.2",
|
|
104
|
+
"expo-font": ">= 12.0.0",
|
|
104
105
|
"lottie-react-native": ">= 7.1.0",
|
|
105
106
|
"react": ">= 18.2.0",
|
|
106
107
|
"react-native": ">= 0.71.0",
|
|
107
108
|
"react-native-device-info": ">= 13.2.0",
|
|
109
|
+
"react-native-dynamic-fonts": ">= 1.0.0",
|
|
110
|
+
"react-native-gesture-handler": ">= 2.30.0",
|
|
108
111
|
"react-native-get-random-values": ">= 1.11.0",
|
|
109
112
|
"react-native-in-app-review": ">= 4.3.0",
|
|
110
113
|
"react-native-linear-gradient": ">= 2.8.3",
|
|
111
|
-
"react-native-
|
|
114
|
+
"react-native-mask-input": ">= 1.2.3",
|
|
115
|
+
"react-native-pager-view": ">= 6.2.4",
|
|
112
116
|
"react-native-permissions": ">= 4.1.5",
|
|
113
117
|
"react-native-safe-area-context": ">= 5.0.0",
|
|
114
118
|
"react-native-svg": ">= 15.10.1",
|
|
115
119
|
"react-native-vector-icons": ">= 10.2.0"
|
|
116
120
|
},
|
|
121
|
+
"peerDependenciesMeta": {
|
|
122
|
+
"expo-font": {
|
|
123
|
+
"optional": true
|
|
124
|
+
},
|
|
125
|
+
"react-native-dynamic-fonts": {
|
|
126
|
+
"optional": true
|
|
127
|
+
}
|
|
128
|
+
},
|
|
117
129
|
"workspaces": [
|
|
118
130
|
"example"
|
|
119
131
|
],
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
requestInAppReview,
|
|
16
16
|
isInAppReviewAvailable,
|
|
17
17
|
} from '../native/inAppReview';
|
|
18
|
-
import PagerView, { type PagerViewHandle } from '../native/pagerView';
|
|
19
18
|
import { SafeAreaProvider } from '../native/safeAreaContext';
|
|
20
19
|
import FlowboardRenderer from './FlowboardRenderer';
|
|
21
20
|
import {
|
|
@@ -65,20 +64,15 @@ export default function FlowboardFlow(props: FlowboardFlowProps) {
|
|
|
65
64
|
const repository = useMemo(() => new OnboardingRepository(), []);
|
|
66
65
|
const assetPreloader = useMemo(() => new AssetPreloader(), []);
|
|
67
66
|
const sliderRegistry = useMemo(() => new SliderRegistry(), []);
|
|
68
|
-
const pagerRef = useRef<PagerViewHandle | null>(null);
|
|
69
67
|
const [currentIndex, setCurrentIndex] = useState(() =>
|
|
70
68
|
resolveInitialPage(initialStep, screens.length)
|
|
71
69
|
);
|
|
72
|
-
const [activePages, setActivePages] = useState<Record<number, true>>(() => ({
|
|
73
|
-
[resolveInitialPage(initialStep, screens.length)]: true,
|
|
74
|
-
}));
|
|
75
70
|
const [formData, setFormData] = useState<Record<string, any>>({
|
|
76
71
|
...initialFormData,
|
|
77
72
|
});
|
|
78
73
|
const formDataRef = useRef<Record<string, any>>({
|
|
79
74
|
...initialFormData,
|
|
80
75
|
});
|
|
81
|
-
const didSyncPagerRef = useRef(false);
|
|
82
76
|
const completedRef = useRef(false);
|
|
83
77
|
const flowStartTimeRef = useRef(Date.now());
|
|
84
78
|
const currentScreenData =
|
|
@@ -103,17 +97,6 @@ export default function FlowboardFlow(props: FlowboardFlowProps) {
|
|
|
103
97
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
104
98
|
}, []);
|
|
105
99
|
|
|
106
|
-
useEffect(() => {
|
|
107
|
-
if (pagerRef.current) {
|
|
108
|
-
if (!didSyncPagerRef.current) {
|
|
109
|
-
pagerRef.current.setPageWithoutAnimation(currentIndex);
|
|
110
|
-
didSyncPagerRef.current = true;
|
|
111
|
-
} else {
|
|
112
|
-
pagerRef.current.setPage(currentIndex);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}, [currentIndex]);
|
|
116
|
-
|
|
117
100
|
const notifyStepChange = (index: number, preloadNext = true) => {
|
|
118
101
|
if (index < 0 || index >= screens.length) return;
|
|
119
102
|
const screenData = screens[index] as Record<string, any>;
|
|
@@ -135,16 +118,8 @@ export default function FlowboardFlow(props: FlowboardFlowProps) {
|
|
|
135
118
|
}
|
|
136
119
|
};
|
|
137
120
|
|
|
138
|
-
const markPageAsActive = (index: number) => {
|
|
139
|
-
setActivePages((prev) => {
|
|
140
|
-
if (prev[index]) return prev;
|
|
141
|
-
return { ...prev, [index]: true };
|
|
142
|
-
});
|
|
143
|
-
};
|
|
144
|
-
|
|
145
121
|
const moveToIndex = (nextIndex: number) => {
|
|
146
122
|
if (nextIndex < 0 || nextIndex >= screens.length) return;
|
|
147
|
-
markPageAsActive(nextIndex);
|
|
148
123
|
setCurrentIndex(nextIndex);
|
|
149
124
|
notifyStepChange(nextIndex);
|
|
150
125
|
};
|
|
@@ -411,6 +386,36 @@ export default function FlowboardFlow(props: FlowboardFlowProps) {
|
|
|
411
386
|
persistProgress(index, next);
|
|
412
387
|
};
|
|
413
388
|
|
|
389
|
+
const renderCurrentScreen = () => {
|
|
390
|
+
const screen = screens[currentIndex];
|
|
391
|
+
if (!screen || typeof screen !== 'object') return null;
|
|
392
|
+
|
|
393
|
+
const screenData = screen as Record<string, any>;
|
|
394
|
+
const screenType = screenData.type;
|
|
395
|
+
|
|
396
|
+
if (screenType === 'custom' && customScreenBuilder) {
|
|
397
|
+
const ctx = createContext(currentIndex);
|
|
398
|
+
return customScreenBuilder(ctx);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
return (
|
|
402
|
+
<SliderRegistryProvider registry={sliderRegistry}>
|
|
403
|
+
<FlowboardRenderer
|
|
404
|
+
screenData={screenData}
|
|
405
|
+
formData={formData}
|
|
406
|
+
onInputChange={(id, value) =>
|
|
407
|
+
handleInputChange(id, value, currentIndex)
|
|
408
|
+
}
|
|
409
|
+
onAction={(action, payload) =>
|
|
410
|
+
handleAction(action, currentIndex, screens.length, payload)
|
|
411
|
+
}
|
|
412
|
+
currentIndex={currentIndex}
|
|
413
|
+
totalScreens={screens.length}
|
|
414
|
+
/>
|
|
415
|
+
</SliderRegistryProvider>
|
|
416
|
+
);
|
|
417
|
+
};
|
|
418
|
+
|
|
414
419
|
return (
|
|
415
420
|
<SafeAreaProvider>
|
|
416
421
|
<View
|
|
@@ -421,48 +426,9 @@ export default function FlowboardFlow(props: FlowboardFlowProps) {
|
|
|
421
426
|
: undefined,
|
|
422
427
|
]}
|
|
423
428
|
>
|
|
424
|
-
<
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
scrollEnabled={false}
|
|
428
|
-
initialPage={currentIndex}
|
|
429
|
-
>
|
|
430
|
-
{screens.map((screen, index) => {
|
|
431
|
-
const screenData = screen as Record<string, any>;
|
|
432
|
-
const screenType = screenData.type;
|
|
433
|
-
const isActivePage = activePages[index] === true;
|
|
434
|
-
|
|
435
|
-
if (screenType === 'custom' && customScreenBuilder) {
|
|
436
|
-
const ctx = createContext(index);
|
|
437
|
-
return (
|
|
438
|
-
<View key={`screen-${index}`} style={styles.fullFlex}>
|
|
439
|
-
{isActivePage ? customScreenBuilder(ctx) : null}
|
|
440
|
-
</View>
|
|
441
|
-
);
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
return (
|
|
445
|
-
<View key={`screen-${index}`} style={styles.fullFlex}>
|
|
446
|
-
{isActivePage ? (
|
|
447
|
-
<SliderRegistryProvider registry={sliderRegistry}>
|
|
448
|
-
<FlowboardRenderer
|
|
449
|
-
screenData={screenData}
|
|
450
|
-
formData={formData}
|
|
451
|
-
onInputChange={(id, value) =>
|
|
452
|
-
handleInputChange(id, value, index)
|
|
453
|
-
}
|
|
454
|
-
onAction={(action, payload) =>
|
|
455
|
-
handleAction(action, index, screens.length, payload)
|
|
456
|
-
}
|
|
457
|
-
currentIndex={currentIndex}
|
|
458
|
-
totalScreens={screens.length}
|
|
459
|
-
/>
|
|
460
|
-
</SliderRegistryProvider>
|
|
461
|
-
) : null}
|
|
462
|
-
</View>
|
|
463
|
-
);
|
|
464
|
-
})}
|
|
465
|
-
</PagerView>
|
|
429
|
+
<View key={`screen-${currentIndex}`} style={styles.fullFlex}>
|
|
430
|
+
{renderCurrentScreen()}
|
|
431
|
+
</View>
|
|
466
432
|
</View>
|
|
467
433
|
</SafeAreaProvider>
|
|
468
434
|
);
|