@umituz/react-native-ai-fal-provider 2.1.10 → 2.2.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/package.json
CHANGED
|
@@ -6,33 +6,13 @@ import type { FalModelConfig } from "../default-models.constants";
|
|
|
6
6
|
|
|
7
7
|
export const DEFAULT_TEXT_TO_IMAGE_MODELS: FalModelConfig[] = [
|
|
8
8
|
{
|
|
9
|
-
id: "
|
|
10
|
-
name: "
|
|
9
|
+
id: "xai/grok-imagine-image",
|
|
10
|
+
name: "Grok Imagine",
|
|
11
11
|
type: "text-to-image",
|
|
12
12
|
isDefault: true,
|
|
13
13
|
isActive: true,
|
|
14
|
-
pricing: { freeUserCost:
|
|
15
|
-
description: "
|
|
14
|
+
pricing: { freeUserCost: 0.5, premiumUserCost: 0.25 },
|
|
15
|
+
description: "X.AI's cost-effective text-to-image generation ($0.02/image)",
|
|
16
16
|
order: 1,
|
|
17
17
|
},
|
|
18
|
-
{
|
|
19
|
-
id: "fal-ai/flux/dev",
|
|
20
|
-
name: "Flux Dev",
|
|
21
|
-
type: "text-to-image",
|
|
22
|
-
isDefault: false,
|
|
23
|
-
isActive: true,
|
|
24
|
-
pricing: { freeUserCost: 2, premiumUserCost: 1 },
|
|
25
|
-
description: "High-quality text-to-image generation",
|
|
26
|
-
order: 2,
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
id: "fal-ai/flux-pro",
|
|
30
|
-
name: "Flux Pro",
|
|
31
|
-
type: "text-to-image",
|
|
32
|
-
isDefault: false,
|
|
33
|
-
isActive: true,
|
|
34
|
-
pricing: { freeUserCost: 3, premiumUserCost: 1.5 },
|
|
35
|
-
description: "Professional-grade text-to-image generation",
|
|
36
|
-
order: 3,
|
|
37
|
-
},
|
|
38
18
|
];
|
package/src/index.ts
CHANGED
|
@@ -33,6 +33,20 @@ export interface AiProviderInitModuleConfig {
|
|
|
33
33
|
* @default ["firebase"]
|
|
34
34
|
*/
|
|
35
35
|
dependsOn?: string[];
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Optional callback called after provider is initialized
|
|
39
|
+
* Use this to register the provider with wizard flow:
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* onInitialized: () => {
|
|
43
|
+
* const { providerRegistry } = require('@umituz/react-native-ai-generation-content');
|
|
44
|
+
* const { registerWithWizard } = require('@umituz/react-native-ai-fal-provider');
|
|
45
|
+
* registerWithWizard(providerRegistry);
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
onInitialized?: () => void;
|
|
36
50
|
}
|
|
37
51
|
|
|
38
52
|
/**
|
|
@@ -61,6 +75,7 @@ export function createAiProviderInitModule(
|
|
|
61
75
|
getApiKey,
|
|
62
76
|
critical = false,
|
|
63
77
|
dependsOn = ['firebase'],
|
|
78
|
+
onInitialized,
|
|
64
79
|
} = config;
|
|
65
80
|
|
|
66
81
|
return {
|
|
@@ -75,10 +90,16 @@ export function createAiProviderInitModule(
|
|
|
75
90
|
return Promise.resolve(false);
|
|
76
91
|
}
|
|
77
92
|
|
|
93
|
+
// Initialize FAL provider
|
|
78
94
|
falProvider.initialize({
|
|
79
95
|
apiKey,
|
|
80
96
|
});
|
|
81
97
|
|
|
98
|
+
// Call optional callback after initialization
|
|
99
|
+
if (onInitialized) {
|
|
100
|
+
onInitialized();
|
|
101
|
+
}
|
|
102
|
+
|
|
82
103
|
return Promise.resolve(true);
|
|
83
104
|
} catch (error) {
|
|
84
105
|
return Promise.resolve(false);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wizard Flow Registration Helper
|
|
3
|
+
* Use this when your app uses GenericWizardFlow from @umituz/react-native-ai-generation-content
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { falProvider } from '../infrastructure/services';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Register FAL provider with the wizard flow provider registry
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { providerRegistry } from '@umituz/react-native-ai-generation-content';
|
|
14
|
+
* import { registerWithWizard } from '@umituz/react-native-ai-fal-provider';
|
|
15
|
+
*
|
|
16
|
+
* // After FAL provider is initialized, register it for wizard flow
|
|
17
|
+
* registerWithWizard(providerRegistry);
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export function registerWithWizard(registry: {
|
|
21
|
+
register: (provider: any) => void;
|
|
22
|
+
setActiveProvider: (id: string) => void;
|
|
23
|
+
}): void {
|
|
24
|
+
registry.register(falProvider);
|
|
25
|
+
registry.setActiveProvider('fal');
|
|
26
|
+
|
|
27
|
+
if (typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
28
|
+
console.log('[FAL Provider] Registered with wizard flow');
|
|
29
|
+
}
|
|
30
|
+
}
|