@srsergio/taptapp-ar 1.0.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/README.md +62 -0
- package/dist/compiler/aframe.d.ts +1 -0
- package/dist/compiler/aframe.js +275 -0
- package/dist/compiler/compiler-base.d.ts +12 -0
- package/dist/compiler/compiler-base.js +165 -0
- package/dist/compiler/compiler.d.ts +9 -0
- package/dist/compiler/compiler.js +24 -0
- package/dist/compiler/compiler.worker.d.ts +1 -0
- package/dist/compiler/compiler.worker.js +28 -0
- package/dist/compiler/controller.d.ts +101 -0
- package/dist/compiler/controller.js +400 -0
- package/dist/compiler/controller.worker.d.ts +1 -0
- package/dist/compiler/controller.worker.js +61 -0
- package/dist/compiler/detector/crop-detector.d.ts +65 -0
- package/dist/compiler/detector/crop-detector.js +59 -0
- package/dist/compiler/detector/detector.d.ts +98 -0
- package/dist/compiler/detector/detector.js +1049 -0
- package/dist/compiler/detector/freak.d.ts +1 -0
- package/dist/compiler/detector/freak.js +89 -0
- package/dist/compiler/detector/kernels/cpu/binomialFilter.d.ts +6 -0
- package/dist/compiler/detector/kernels/cpu/binomialFilter.js +51 -0
- package/dist/compiler/detector/kernels/cpu/buildExtremas.d.ts +6 -0
- package/dist/compiler/detector/kernels/cpu/buildExtremas.js +89 -0
- package/dist/compiler/detector/kernels/cpu/computeExtremaAngles.d.ts +7 -0
- package/dist/compiler/detector/kernels/cpu/computeExtremaAngles.js +79 -0
- package/dist/compiler/detector/kernels/cpu/computeExtremaFreak.d.ts +6 -0
- package/dist/compiler/detector/kernels/cpu/computeExtremaFreak.js +68 -0
- package/dist/compiler/detector/kernels/cpu/computeFreakDescriptors.d.ts +6 -0
- package/dist/compiler/detector/kernels/cpu/computeFreakDescriptors.js +57 -0
- package/dist/compiler/detector/kernels/cpu/computeLocalization.d.ts +6 -0
- package/dist/compiler/detector/kernels/cpu/computeLocalization.js +54 -0
- package/dist/compiler/detector/kernels/cpu/computeOrientationHistograms.d.ts +6 -0
- package/dist/compiler/detector/kernels/cpu/computeOrientationHistograms.js +118 -0
- package/dist/compiler/detector/kernels/cpu/downsampleBilinear.d.ts +6 -0
- package/dist/compiler/detector/kernels/cpu/downsampleBilinear.js +29 -0
- package/dist/compiler/detector/kernels/cpu/extremaReduction.d.ts +6 -0
- package/dist/compiler/detector/kernels/cpu/extremaReduction.js +50 -0
- package/dist/compiler/detector/kernels/cpu/fakeShader.d.ts +20 -0
- package/dist/compiler/detector/kernels/cpu/fakeShader.js +80 -0
- package/dist/compiler/detector/kernels/cpu/index.d.ts +1 -0
- package/dist/compiler/detector/kernels/cpu/index.js +25 -0
- package/dist/compiler/detector/kernels/cpu/prune.d.ts +1 -0
- package/dist/compiler/detector/kernels/cpu/prune.js +103 -0
- package/dist/compiler/detector/kernels/cpu/smoothHistograms.d.ts +6 -0
- package/dist/compiler/detector/kernels/cpu/smoothHistograms.js +47 -0
- package/dist/compiler/detector/kernels/cpu/upsampleBilinear.d.ts +6 -0
- package/dist/compiler/detector/kernels/cpu/upsampleBilinear.js +43 -0
- package/dist/compiler/detector/kernels/index.d.ts +1 -0
- package/dist/compiler/detector/kernels/index.js +2 -0
- package/dist/compiler/detector/kernels/webgl/binomialFilter.d.ts +6 -0
- package/dist/compiler/detector/kernels/webgl/binomialFilter.js +67 -0
- package/dist/compiler/detector/kernels/webgl/buildExtremas.d.ts +6 -0
- package/dist/compiler/detector/kernels/webgl/buildExtremas.js +101 -0
- package/dist/compiler/detector/kernels/webgl/computeExtremaAngles.d.ts +6 -0
- package/dist/compiler/detector/kernels/webgl/computeExtremaAngles.js +78 -0
- package/dist/compiler/detector/kernels/webgl/computeExtremaFreak.d.ts +6 -0
- package/dist/compiler/detector/kernels/webgl/computeExtremaFreak.js +86 -0
- package/dist/compiler/detector/kernels/webgl/computeFreakDescriptors.d.ts +6 -0
- package/dist/compiler/detector/kernels/webgl/computeFreakDescriptors.js +52 -0
- package/dist/compiler/detector/kernels/webgl/computeLocalization.d.ts +6 -0
- package/dist/compiler/detector/kernels/webgl/computeLocalization.js +58 -0
- package/dist/compiler/detector/kernels/webgl/computeOrientationHistograms.d.ts +6 -0
- package/dist/compiler/detector/kernels/webgl/computeOrientationHistograms.js +116 -0
- package/dist/compiler/detector/kernels/webgl/downsampleBilinear.d.ts +6 -0
- package/dist/compiler/detector/kernels/webgl/downsampleBilinear.js +46 -0
- package/dist/compiler/detector/kernels/webgl/extremaReduction.d.ts +6 -0
- package/dist/compiler/detector/kernels/webgl/extremaReduction.js +48 -0
- package/dist/compiler/detector/kernels/webgl/index.d.ts +1 -0
- package/dist/compiler/detector/kernels/webgl/index.js +25 -0
- package/dist/compiler/detector/kernels/webgl/smoothHistograms.d.ts +6 -0
- package/dist/compiler/detector/kernels/webgl/smoothHistograms.js +49 -0
- package/dist/compiler/detector/kernels/webgl/upsampleBilinear.d.ts +6 -0
- package/dist/compiler/detector/kernels/webgl/upsampleBilinear.js +56 -0
- package/dist/compiler/estimation/esimate-experiment.d.ts +5 -0
- package/dist/compiler/estimation/esimate-experiment.js +267 -0
- package/dist/compiler/estimation/estimate.d.ts +5 -0
- package/dist/compiler/estimation/estimate.js +51 -0
- package/dist/compiler/estimation/estimator.d.ts +13 -0
- package/dist/compiler/estimation/estimator.js +30 -0
- package/dist/compiler/estimation/refine-estimate-experiment.d.ts +6 -0
- package/dist/compiler/estimation/refine-estimate-experiment.js +429 -0
- package/dist/compiler/estimation/refine-estimate.d.ts +6 -0
- package/dist/compiler/estimation/refine-estimate.js +299 -0
- package/dist/compiler/estimation/utils.d.ts +10 -0
- package/dist/compiler/estimation/utils.js +80 -0
- package/dist/compiler/image-list.d.ts +13 -0
- package/dist/compiler/image-list.js +52 -0
- package/dist/compiler/index.d.ts +3 -0
- package/dist/compiler/index.js +10 -0
- package/dist/compiler/input-loader.d.ts +23 -0
- package/dist/compiler/input-loader.js +88 -0
- package/dist/compiler/matching/hamming-distance.d.ts +1 -0
- package/dist/compiler/matching/hamming-distance.js +20 -0
- package/dist/compiler/matching/hierarchical-clustering.d.ts +7 -0
- package/dist/compiler/matching/hierarchical-clustering.js +109 -0
- package/dist/compiler/matching/hough.d.ts +1 -0
- package/dist/compiler/matching/hough.js +169 -0
- package/dist/compiler/matching/matcher.d.ts +28 -0
- package/dist/compiler/matching/matcher.js +48 -0
- package/dist/compiler/matching/matching.d.ts +41 -0
- package/dist/compiler/matching/matching.js +197 -0
- package/dist/compiler/matching/ransacHomography.d.ts +1 -0
- package/dist/compiler/matching/ransacHomography.js +136 -0
- package/dist/compiler/offline-compiler.d.ts +10 -0
- package/dist/compiler/offline-compiler.js +450 -0
- package/dist/compiler/tensorflow-setup.d.ts +7 -0
- package/dist/compiler/tensorflow-setup.js +73 -0
- package/dist/compiler/three.d.ts +66 -0
- package/dist/compiler/three.js +310 -0
- package/dist/compiler/tracker/extract-utils.d.ts +1 -0
- package/dist/compiler/tracker/extract-utils.js +29 -0
- package/dist/compiler/tracker/extract.d.ts +4 -0
- package/dist/compiler/tracker/extract.js +349 -0
- package/dist/compiler/tracker/tracker.d.ts +38 -0
- package/dist/compiler/tracker/tracker.js +327 -0
- package/dist/compiler/utils/cumsum.d.ts +5 -0
- package/dist/compiler/utils/cumsum.js +39 -0
- package/dist/compiler/utils/geometry.d.ts +8 -0
- package/dist/compiler/utils/geometry.js +101 -0
- package/dist/compiler/utils/homography.d.ts +1 -0
- package/dist/compiler/utils/homography.js +138 -0
- package/dist/compiler/utils/images.d.ts +24 -0
- package/dist/compiler/utils/images.js +99 -0
- package/dist/compiler/utils/randomizer.d.ts +5 -0
- package/dist/compiler/utils/randomizer.js +25 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +7 -0
- package/dist/react/AREditor.d.ts +5 -0
- package/dist/react/AREditor.js +159 -0
- package/dist/react/ProgressDialog.d.ts +13 -0
- package/dist/react/ProgressDialog.js +57 -0
- package/dist/react/types.d.ts +22 -0
- package/dist/react/types.js +14 -0
- package/package.json +53 -0
- package/src/astro/ARScene.astro +59 -0
- package/src/astro/ARVideoTrigger.astro +73 -0
- package/src/astro/overlays/ErrorOverlay.astro +40 -0
- package/src/astro/overlays/LoadingOverlay.astro +28 -0
- package/src/astro/overlays/ScanningOverlay.astro +119 -0
- package/src/astro/scripts/ARScripts.astro +118 -0
- package/src/astro/styles/ARStyles.astro +147 -0
- package/src/compiler/aframe.js +343 -0
- package/src/compiler/compiler-base.js +195 -0
- package/src/compiler/compiler.js +25 -0
- package/src/compiler/compiler.worker.js +30 -0
- package/src/compiler/controller.js +473 -0
- package/src/compiler/controller.worker.js +77 -0
- package/src/compiler/detector/crop-detector.js +68 -0
- package/src/compiler/detector/detector.js +1130 -0
- package/src/compiler/detector/freak.js +91 -0
- package/src/compiler/detector/kernels/cpu/binomialFilter.js +59 -0
- package/src/compiler/detector/kernels/cpu/buildExtremas.js +108 -0
- package/src/compiler/detector/kernels/cpu/computeExtremaAngles.js +91 -0
- package/src/compiler/detector/kernels/cpu/computeExtremaFreak.js +92 -0
- package/src/compiler/detector/kernels/cpu/computeFreakDescriptors.js +68 -0
- package/src/compiler/detector/kernels/cpu/computeLocalization.js +71 -0
- package/src/compiler/detector/kernels/cpu/computeOrientationHistograms.js +141 -0
- package/src/compiler/detector/kernels/cpu/downsampleBilinear.js +33 -0
- package/src/compiler/detector/kernels/cpu/extremaReduction.js +53 -0
- package/src/compiler/detector/kernels/cpu/fakeShader.js +88 -0
- package/src/compiler/detector/kernels/cpu/index.js +26 -0
- package/src/compiler/detector/kernels/cpu/prune.js +114 -0
- package/src/compiler/detector/kernels/cpu/smoothHistograms.js +57 -0
- package/src/compiler/detector/kernels/cpu/upsampleBilinear.js +51 -0
- package/src/compiler/detector/kernels/index.js +2 -0
- package/src/compiler/detector/kernels/webgl/binomialFilter.js +72 -0
- package/src/compiler/detector/kernels/webgl/buildExtremas.js +109 -0
- package/src/compiler/detector/kernels/webgl/computeExtremaAngles.js +82 -0
- package/src/compiler/detector/kernels/webgl/computeExtremaFreak.js +105 -0
- package/src/compiler/detector/kernels/webgl/computeFreakDescriptors.js +56 -0
- package/src/compiler/detector/kernels/webgl/computeLocalization.js +70 -0
- package/src/compiler/detector/kernels/webgl/computeOrientationHistograms.js +129 -0
- package/src/compiler/detector/kernels/webgl/downsampleBilinear.js +50 -0
- package/src/compiler/detector/kernels/webgl/extremaReduction.js +50 -0
- package/src/compiler/detector/kernels/webgl/index.js +26 -0
- package/src/compiler/detector/kernels/webgl/smoothHistograms.js +53 -0
- package/src/compiler/detector/kernels/webgl/upsampleBilinear.js +62 -0
- package/src/compiler/estimation/esimate-experiment.js +316 -0
- package/src/compiler/estimation/estimate.js +67 -0
- package/src/compiler/estimation/estimator.js +34 -0
- package/src/compiler/estimation/refine-estimate-experiment.js +512 -0
- package/src/compiler/estimation/refine-estimate.js +365 -0
- package/src/compiler/estimation/utils.js +97 -0
- package/src/compiler/image-list.js +62 -0
- package/src/compiler/index.js +13 -0
- package/src/compiler/input-loader.js +107 -0
- package/src/compiler/matching/hamming-distance.js +23 -0
- package/src/compiler/matching/hierarchical-clustering.js +131 -0
- package/src/compiler/matching/hough.js +206 -0
- package/src/compiler/matching/matcher.js +59 -0
- package/src/compiler/matching/matching.js +237 -0
- package/src/compiler/matching/ransacHomography.js +192 -0
- package/src/compiler/offline-compiler.js +553 -0
- package/src/compiler/tensorflow-setup.js +88 -0
- package/src/compiler/three.js +368 -0
- package/src/compiler/tracker/extract-utils.js +34 -0
- package/src/compiler/tracker/extract.js +419 -0
- package/src/compiler/tracker/tracker.js +397 -0
- package/src/compiler/utils/cumsum.js +40 -0
- package/src/compiler/utils/geometry.js +114 -0
- package/src/compiler/utils/homography.js +150 -0
- package/src/compiler/utils/images.js +111 -0
- package/src/compiler/utils/randomizer.js +29 -0
- package/src/index.ts +8 -0
- package/src/react/AREditor.tsx +394 -0
- package/src/react/ProgressDialog.tsx +185 -0
- package/src/react/types.ts +35 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import {
|
|
3
|
+
CheckCircle2,
|
|
4
|
+
Loader2,
|
|
5
|
+
Upload,
|
|
6
|
+
Image as ImageIcon,
|
|
7
|
+
Video as VideoIcon,
|
|
8
|
+
} from "lucide-react";
|
|
9
|
+
|
|
10
|
+
interface ProgressStage {
|
|
11
|
+
label: string;
|
|
12
|
+
status: "pending" | "processing" | "completed" | "error";
|
|
13
|
+
progress?: number;
|
|
14
|
+
icon: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface ProgressDialogProps {
|
|
18
|
+
open: boolean;
|
|
19
|
+
imageStatus: "pending" | "processing" | "completed" | "error";
|
|
20
|
+
videoStatus: "pending" | "processing" | "completed" | "error";
|
|
21
|
+
arProcessingStatus: "pending" | "processing" | "completed" | "error";
|
|
22
|
+
arUploadStatus: "pending" | "processing" | "completed" | "error";
|
|
23
|
+
imageProgress?: number;
|
|
24
|
+
videoProgress?: number;
|
|
25
|
+
arProcessingProgress?: number;
|
|
26
|
+
arUploadProgress?: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function ProgressDialog({
|
|
30
|
+
open,
|
|
31
|
+
imageStatus,
|
|
32
|
+
videoStatus,
|
|
33
|
+
arProcessingStatus,
|
|
34
|
+
arUploadStatus,
|
|
35
|
+
imageProgress = 0,
|
|
36
|
+
videoProgress = 0,
|
|
37
|
+
arProcessingProgress = 0,
|
|
38
|
+
arUploadProgress = 0,
|
|
39
|
+
}: ProgressDialogProps) {
|
|
40
|
+
// Configurar las etapas del progreso
|
|
41
|
+
const stages: ProgressStage[] = [
|
|
42
|
+
{
|
|
43
|
+
label: "Subiendo imagen",
|
|
44
|
+
status: imageStatus,
|
|
45
|
+
progress: imageProgress,
|
|
46
|
+
icon: <ImageIcon className="h-5 w-5" />,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
label: "Subiendo video",
|
|
50
|
+
status: videoStatus,
|
|
51
|
+
progress: videoProgress,
|
|
52
|
+
icon: <VideoIcon className="h-5 w-5" />,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
label: "Procesando imagen para AR",
|
|
56
|
+
status: arProcessingStatus,
|
|
57
|
+
progress: arProcessingProgress,
|
|
58
|
+
icon: <Loader2 className="h-5 w-5" />,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
label: "Subiendo experiencia AR",
|
|
62
|
+
status: arUploadStatus,
|
|
63
|
+
progress: arUploadProgress,
|
|
64
|
+
icon: <Upload className="h-5 w-5" />,
|
|
65
|
+
},
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
// Calcular el progreso total (promedio de todos los procesos)
|
|
69
|
+
const completedSteps = stages.filter((stage) => stage.status === "completed").length;
|
|
70
|
+
const totalProgress =
|
|
71
|
+
(imageProgress + videoProgress + arProcessingProgress + arUploadProgress) / 4;
|
|
72
|
+
const overallProgress = Math.min(Math.max(totalProgress, completedSteps * 25), 100);
|
|
73
|
+
|
|
74
|
+
// Bloquear el scroll cuando el modal está abierto
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
if (open) {
|
|
77
|
+
document.body.style.overflow = "hidden";
|
|
78
|
+
} else {
|
|
79
|
+
document.body.style.overflow = "auto";
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return () => {
|
|
83
|
+
document.body.style.overflow = "auto";
|
|
84
|
+
};
|
|
85
|
+
}, [open]);
|
|
86
|
+
|
|
87
|
+
if (!open) return null;
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<div className="fixed inset-0 z-50 flex items-center justify-center overflow-y-auto bg-black bg-opacity-50 p-4">
|
|
91
|
+
<div className="relative max-h-full w-full max-w-md overflow-hidden rounded-lg bg-white p-6 shadow-xl">
|
|
92
|
+
{/* Encabezado */}
|
|
93
|
+
<div className="mb-4 flex items-center justify-between">
|
|
94
|
+
<h2 className="text-center font-semibold text-xl">Guardando experiencia AR</h2>
|
|
95
|
+
</div>
|
|
96
|
+
|
|
97
|
+
{/* Barra de progreso general */}
|
|
98
|
+
<div className="mt-2">
|
|
99
|
+
<div className="relative pt-1">
|
|
100
|
+
<div className="mb-6">
|
|
101
|
+
<div className="h-2 w-full rounded-full bg-gray-200">
|
|
102
|
+
<div
|
|
103
|
+
className="h-2 rounded-full bg-blue-600 transition-all duration-500"
|
|
104
|
+
style={{ width: `${overallProgress}%` }}
|
|
105
|
+
></div>
|
|
106
|
+
</div>
|
|
107
|
+
<div className="mt-2 text-center text-gray-600 text-sm">
|
|
108
|
+
Progreso total: {Math.round(overallProgress)}%
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
{/* Etapas individuales */}
|
|
115
|
+
<div className="mt-2 space-y-5">
|
|
116
|
+
{stages.map((stage, index) => (
|
|
117
|
+
<div key={index} className="relative">
|
|
118
|
+
<div className="flex items-center">
|
|
119
|
+
<div
|
|
120
|
+
className={`mr-3 flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full ${stage.status === "completed"
|
|
121
|
+
? "bg-green-100"
|
|
122
|
+
: stage.status === "processing"
|
|
123
|
+
? "bg-blue-100"
|
|
124
|
+
: stage.status === "error"
|
|
125
|
+
? "bg-red-100"
|
|
126
|
+
: "bg-gray-100"
|
|
127
|
+
}`}
|
|
128
|
+
>
|
|
129
|
+
{stage.status === "completed" ? (
|
|
130
|
+
<CheckCircle2 className="h-6 w-6 text-green-600" />
|
|
131
|
+
) : stage.status === "processing" ? (
|
|
132
|
+
<div className="text-blue-600">{stage.icon}</div>
|
|
133
|
+
) : stage.status === "error" ? (
|
|
134
|
+
<div className="text-red-600">{stage.icon}</div>
|
|
135
|
+
) : (
|
|
136
|
+
<div className="text-gray-400">{stage.icon}</div>
|
|
137
|
+
)}
|
|
138
|
+
</div>
|
|
139
|
+
|
|
140
|
+
<div className="min-w-0 flex-1">
|
|
141
|
+
<div className="font-medium text-sm">{stage.label}</div>
|
|
142
|
+
|
|
143
|
+
{stage.status === "processing" && (
|
|
144
|
+
<div className="mt-1">
|
|
145
|
+
<div className="h-1.5 w-full rounded-full bg-gray-200">
|
|
146
|
+
<div
|
|
147
|
+
className="h-1.5 rounded-full bg-blue-600 transition-all duration-300"
|
|
148
|
+
style={{ width: `${stage.progress || 0}%` }}
|
|
149
|
+
></div>
|
|
150
|
+
</div>
|
|
151
|
+
<div className="mt-1 text-gray-500 text-xs">
|
|
152
|
+
{Math.round(stage.progress || 0)}%
|
|
153
|
+
</div>
|
|
154
|
+
</div>
|
|
155
|
+
)}
|
|
156
|
+
|
|
157
|
+
{stage.status === "completed" && (
|
|
158
|
+
<div className="mt-1 text-green-600 text-xs">Completado</div>
|
|
159
|
+
)}
|
|
160
|
+
|
|
161
|
+
{stage.status === "error" && (
|
|
162
|
+
<div className="mt-1 text-red-600 text-xs">Error</div>
|
|
163
|
+
)}
|
|
164
|
+
|
|
165
|
+
{stage.status === "pending" && (
|
|
166
|
+
<div className="mt-1 text-gray-500 text-xs">Pendiente</div>
|
|
167
|
+
)}
|
|
168
|
+
</div>
|
|
169
|
+
</div>
|
|
170
|
+
</div>
|
|
171
|
+
))}
|
|
172
|
+
</div>
|
|
173
|
+
|
|
174
|
+
{/* Mensaje de finalización */}
|
|
175
|
+
{completedSteps === stages.length && (
|
|
176
|
+
<div className="mt-4 rounded-lg bg-green-50 p-4 text-center">
|
|
177
|
+
<CheckCircle2 className="mx-auto mb-2 h-8 w-8 text-green-500" />
|
|
178
|
+
<p className="font-medium text-green-800">¡Experiencia AR guardada con éxito!</p>
|
|
179
|
+
<p className="text-green-700 text-sm">Tu contenido está listo para ser visualizado.</p>
|
|
180
|
+
</div>
|
|
181
|
+
)}
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
184
|
+
);
|
|
185
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface PropsConfig {
|
|
2
|
+
cardId: string;
|
|
3
|
+
targetImageSrc: string;
|
|
4
|
+
targetMindSrc: string;
|
|
5
|
+
videoSrc: string;
|
|
6
|
+
videoWidth: number;
|
|
7
|
+
videoHeight: number;
|
|
8
|
+
scale: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface DataItem {
|
|
12
|
+
id: string;
|
|
13
|
+
type: "photos" | "videoNative" | "ar";
|
|
14
|
+
images?: { image: string; fileId: string }[];
|
|
15
|
+
url?: string;
|
|
16
|
+
scale?: number;
|
|
17
|
+
width?: number;
|
|
18
|
+
height?: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function mapDataToPropsConfig(data: any[]): PropsConfig {
|
|
22
|
+
const photos = data.find((item) => item.type === "photos");
|
|
23
|
+
const video = data.find((item) => item.type === "videoNative");
|
|
24
|
+
const ar = data.find((item) => item.type === "ar");
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
cardId: photos?.id || "",
|
|
28
|
+
targetImageSrc: photos?.images?.[0]?.image || "",
|
|
29
|
+
targetMindSrc: ar?.url || "",
|
|
30
|
+
videoSrc: video?.url || "",
|
|
31
|
+
videoWidth: video?.width || 0,
|
|
32
|
+
videoHeight: video?.height || 0,
|
|
33
|
+
scale: video?.scale || 1,
|
|
34
|
+
};
|
|
35
|
+
}
|