@umituz/react-native-ai-generation-content 1.72.29 → 1.72.30

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-ai-generation-content",
3
- "version": "1.72.29",
3
+ "version": "1.72.30",
4
4
  "description": "Provider-agnostic AI generation orchestration for React Native with result preview components",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -61,10 +61,6 @@ export function createGenerationStrategy(
61
61
  return result.data;
62
62
  },
63
63
 
64
- getCreditCost: () => {
65
- return featureConfig.creditCost;
66
- },
67
-
68
64
  save: async (result: unknown, uid: string) => {
69
65
  if (!repository) {
70
66
  if (typeof __DEV__ !== "undefined" && __DEV__) {
@@ -53,6 +53,7 @@ export interface SelectionStepConfig extends BaseStepConfig {
53
53
  readonly value: unknown;
54
54
  }[];
55
55
  readonly multiSelect?: boolean;
56
+ readonly layout?: "grid" | "list";
56
57
  readonly defaultValue?: string | string[];
57
58
  }
58
59
 
@@ -101,7 +101,5 @@ export function createImageStrategy(options: CreateImageStrategyOptions): Wizard
101
101
 
102
102
  return { imageUrl: result.imageUrl };
103
103
  },
104
-
105
- getCreditCost: () => creditCost,
106
104
  };
107
105
  }
@@ -103,7 +103,5 @@ export function createVideoStrategy(options: CreateVideoStrategyOptions): Wizard
103
103
  error: result.error,
104
104
  };
105
105
  },
106
-
107
- getCreditCost: () => creditCost,
108
106
  };
109
107
  }
@@ -15,6 +15,4 @@ export interface WizardStrategy {
15
15
  execute: (input: unknown) => Promise<{ imageUrl?: string; videoUrl?: string }>;
16
16
  /** Submit to queue for background processing - returns immediately with requestId */
17
17
  submitToQueue?: (input: unknown) => Promise<QueueSubmissionResult>;
18
- /** Get credit cost for this generation */
19
- getCreditCost: () => number;
20
18
  }
@@ -73,6 +73,7 @@ export function renderSelectionStep({
73
73
  config={{
74
74
  multiSelect: selectionConfig?.multiSelect ?? false,
75
75
  required: isRequired,
76
+ layout: selectionConfig?.layout,
76
77
  }}
77
78
  initialValue={initialValue}
78
79
  onBack={onBack}
@@ -19,6 +19,7 @@ export interface SelectionScreenTranslations {
19
19
  export interface SelectionScreenConfig {
20
20
  readonly multiSelect?: boolean;
21
21
  readonly required?: boolean;
22
+ readonly layout?: "grid" | "list";
22
23
  }
23
24
 
24
25
  export interface SelectionScreenProps {
@@ -66,7 +66,6 @@ export const createImageToVideoStrategy = (
66
66
  thumbnailUrl: result.thumbnailUrl,
67
67
  };
68
68
  },
69
- getCreditCost: () => config.creditCost ?? 0,
70
69
  save: async (result) => {
71
70
  if (result.success && result.videoUrl && creationIdRef.current) {
72
71
  await callbacks?.onCreationSave?.({
@@ -65,7 +65,6 @@ export function useGeneration(options: UseGenerationOptions): UseGenerationRetur
65
65
  }
66
66
  return result.imageUrls;
67
67
  },
68
- getCreditCost: () => totalCost,
69
68
  }),
70
69
  [callbacks, totalCost],
71
70
  );
@@ -74,7 +73,6 @@ export function useGeneration(options: UseGenerationOptions): UseGenerationRetur
74
73
  const { generate, isGenerating, error } = useGenerationOrchestrator(strategy, {
75
74
  userId: userId ?? undefined,
76
75
  alertMessages: DEFAULT_ALERT_MESSAGES,
77
- onCreditsExhausted: () => callbacks.onCreditsRequired?.(totalCost),
78
76
  onSuccess: (result) => {
79
77
  const imageUrls = result as string[];
80
78
  if (typeof __DEV__ !== "undefined" && __DEV__) {
@@ -65,7 +65,6 @@ export const createTextToVideoStrategy = (
65
65
  thumbnailUrl: result.thumbnailUrl,
66
66
  };
67
67
  },
68
- getCreditCost: () => config.creditCost,
69
68
  save: async (result) => {
70
69
  if (result.success && result.videoUrl && creationIdRef.current) {
71
70
  await callbacks.onCreationSave?.({
@@ -14,7 +14,6 @@ export interface UseExecutionCallbackParams<TRequest, TResult> {
14
14
  imageUrl?: string;
15
15
  imageUrls?: string[];
16
16
  }>;
17
- deductCredits?: (amount: number) => Promise<void>;
18
17
  creditCostPerUnit: number;
19
18
  onSuccess?: (result: TResult) => void;
20
19
  onError?: (error: string) => void;
@@ -30,17 +29,13 @@ export interface ExecutionCallbacks<TRequest> {
30
29
  export function useExecutionCallback<TRequest = unknown, TResult = unknown>(
31
30
  params: UseExecutionCallbackParams<TRequest, TResult>,
32
31
  ): ExecutionCallbacks<TRequest> {
33
- const { executor, deductCredits, creditCostPerUnit, onSuccess, onError } = params;
32
+ const { executor, creditCostPerUnit, onSuccess, onError } = params;
34
33
 
35
34
  const executeGeneration = useCallback(
36
35
  async (request: TRequest): Promise<AIFeatureGenerationResult> => {
37
36
  try {
38
37
  const result = await executor(request);
39
38
 
40
- if (result.success && deductCredits) {
41
- await deductCredits(creditCostPerUnit);
42
- }
43
-
44
39
  if (result.success && result.data) {
45
40
  onSuccess?.(result.data);
46
41
  } else if (!result.success && result.error) {
@@ -57,7 +52,7 @@ export function useExecutionCallback<TRequest = unknown, TResult = unknown>(
57
52
  return { success: false, error: message };
58
53
  }
59
54
  },
60
- [executor, deductCredits, creditCostPerUnit, onSuccess, onError],
55
+ [executor, creditCostPerUnit, onSuccess, onError],
61
56
  );
62
57
 
63
58
  return {
@@ -28,7 +28,6 @@ export interface AIFeatureCallbacksConfig<TRequest = unknown, TResult = unknown>
28
28
  // Actions from app - showAuthModal accepts callback for post-auth resume
29
29
  showAuthModal: (callback?: () => void) => void;
30
30
  openPaywall: () => void;
31
- deductCredits?: (amount: number) => Promise<void>;
32
31
 
33
32
  // Optional callbacks
34
33
  onSuccess?: (result: TResult) => void;
@@ -64,7 +64,6 @@ export const useDualImageGeneration = (
64
64
 
65
65
  return result.imageUrl;
66
66
  },
67
- getCreditCost: () => creditCost,
68
67
  }),
69
68
  [model, getPrompt, creditCost],
70
69
  );
@@ -73,7 +72,6 @@ export const useDualImageGeneration = (
73
72
  const orchestrator = useGenerationOrchestrator(strategy, {
74
73
  userId,
75
74
  alertMessages,
76
- onCreditsExhausted,
77
75
  onSuccess: (result) => onSuccess?.(result as string),
78
76
  onError: (error) => onError?.(error.message),
79
77
  });
@@ -72,7 +72,6 @@ export const useImageGeneration = <TInput extends ImageGenerationInput, TResult>
72
72
 
73
73
  return processResult(result.imageUrl, input);
74
74
  },
75
- getCreditCost: () => creditCost,
76
75
  save: buildCreation
77
76
  ? async (result, uid) => {
78
77
  const creation = buildCreation(result, lastInputRef.current ?? ({} as TInput));
@@ -90,7 +89,6 @@ export const useImageGeneration = <TInput extends ImageGenerationInput, TResult>
90
89
  return useGenerationOrchestrator(strategy, {
91
90
  userId,
92
91
  alertMessages,
93
- onCreditsExhausted,
94
92
  onSuccess: onSuccess as (result: unknown) => void,
95
93
  onError: handleError,
96
94
  });
@@ -82,7 +82,6 @@ export const useVideoGeneration = <TResult>(
82
82
 
83
83
  return processResult(result.videoUrl, input);
84
84
  },
85
- getCreditCost: () => creditCost,
86
85
  save: buildCreation
87
86
  ? async (result, uid) => {
88
87
  const creation = buildCreation(result, lastInputRef.current ?? {} as DualImageVideoInput);
@@ -105,7 +104,6 @@ export const useVideoGeneration = <TResult>(
105
104
  return useGenerationOrchestrator(strategy, {
106
105
  userId,
107
106
  alertMessages,
108
- onCreditsExhausted,
109
107
  onSuccess: onSuccess as (result: unknown) => void,
110
108
  onError: handleError,
111
109
  });
@@ -42,7 +42,6 @@ export function useAIFeatureCallbacks<TRequest = unknown, TResult = unknown>(
42
42
  executor,
43
43
  showAuthModal,
44
44
  openPaywall,
45
- deductCredits,
46
45
  onSuccess,
47
46
  onError,
48
47
  } = config;
@@ -64,7 +63,6 @@ export function useAIFeatureCallbacks<TRequest = unknown, TResult = unknown>(
64
63
  // Execution callback
65
64
  const executionCallbacks = useExecutionCallback({
66
65
  executor,
67
- deductCredits,
68
66
  creditCostPerUnit,
69
67
  onSuccess,
70
68
  onError,