{"version":3,"file":"ThentyLockVideo.Cpcge4sV.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/nOpmkx9xQRkZB8c846Nb/YLva80SmEl2Bg9QeGZCS/ThentyLockVideo.js"],"sourcesContent":["// Get Started: https://www.framer.com/developers\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget,useNavigation}from\"framer\";import{fetchUserData,hasProduct}from\"https://framer.com/m/ThentyHelpers-I0Oh.js\";import{useEffect,useState}from\"react\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight auto\n */export default function TestThentySDK(props){const navigate=useNavigation();const{productVideoMap,tint,redirectUrl,radius}=props;// --- HELPER DATA ---\nconst data=typeof fetchUserData===\"function\"?fetchUserData():{};const{userData={},loggedIn=false}=data||{};const[shouldRedirect,setShouldRedirect]=useState(false);let embedUrlToDisplay=null;let productCodeFound=null;// 1. Buscar video\nif(productVideoMap&&Array.isArray(productVideoMap)){for(const map of productVideoMap){const productCode=map.productCode;const rawEmbedUrl=map.embedUrl;if(productCode&&rawEmbedUrl&&typeof hasProduct===\"function\"&&hasProduct([productCode])){embedUrlToDisplay=rawEmbedUrl;productCodeFound=productCode;break;}}}// --- CHECK REDIRECT ---\nuseEffect(()=>{if(RenderTarget.current()===RenderTarget.canvas)return;if(productCodeFound){const storageKey=`hasSeenVideo`;const hasSeen=localStorage.getItem(storageKey);console.log({hasSeen});if(hasSeen&&redirectUrl){const urlConCacheBuster=redirectUrl.includes(\"?\")?`${redirectUrl}&reload=${Date.now()}`:`${redirectUrl}?reload=${Date.now()}`;window.location.href=urlConCacheBuster;const timer=setTimeout(()=>{window.location.href=urlConCacheBuster;console.log(\"heyyy\");},100);}else if(hasSeen){console.log(\"redirigiendoooo\");navigate.push(\"/dashboard-cursos?reload=true\");}else{localStorage.setItem(storageKey,\"true\");}}},[productCodeFound,redirectUrl]);// --- ESTILOS ---\n// Este contenedor fuerza la proporción de video (16:9)\n// para que siempre ocupe el mismo espacio, haya video o no.\nconst wrapperStyle={width:\"100%\",position:\"relative\",aspectRatio:\"16 / 9\",backgroundColor:\"#000\",borderRadius:radius,overflow:\"hidden\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"};const contentContainerStyle={width:\"100%\",height:\"100%\",display:\"flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"center\",padding:\"20px\",textAlign:\"center\",boxSizing:\"border-box\"};// 2. Renderizado\n// A) SI HAY VIDEO (Permitido)\nif(embedUrlToDisplay){return /*#__PURE__*/_jsxs(\"div\",{style:wrapperStyle,children:[/*#__PURE__*/_jsx(\"iframe\",{src:embedUrlToDisplay,width:\"100%\",height:\"100%\",frameBorder:\"0\",allow:\"autoplay; fullscreen; picture-in-picture\",allowFullScreen:true,style:{position:\"absolute\",top:0,left:0,width:\"100%\",height:\"100%\"}}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",bottom:10,right:10,padding:\"4px 8px\",background:\"rgba(0,0,0,0.7)\",color:\"rgba(255,255,255,0.6)\",fontSize:\"9px\",borderRadius:\"4px\",pointerEvents:\"none\"},children:\"Desbloqueado\"})]});}// B) NO LOGUEADO (Estilo mejorado)\nif(!loggedIn){return /*#__PURE__*/_jsx(\"div\",{style:wrapperStyle,children:/*#__PURE__*/_jsxs(\"div\",{style:{...contentContainerStyle,background:\"linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%)\",color:\"#fff\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{background:\"rgba(255,255,255,0.1)\",padding:\"16px\",borderRadius:\"50%\",marginBottom:\"16px\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:/*#__PURE__*/_jsxs(\"svg\",{xmlns:\"http://www.w3.org/2000/svg\",width:\"24\",height:\"24\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:\"currentColor\",strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",children:[/*#__PURE__*/_jsx(\"rect\",{x:\"3\",y:\"11\",width:\"18\",height:\"11\",rx:\"2\",ry:\"2\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M7 11V7a5 5 0 0 1 10 0v4\"})]})}),/*#__PURE__*/_jsx(\"h3\",{style:{margin:\"0 0 8px 0\",fontSize:\"18px\",fontWeight:600},children:\"Contenido Exclusivo\"}),/*#__PURE__*/_jsx(\"p\",{style:{margin:0,fontSize:\"14px\",opacity:.7,maxWidth:\"300px\",lineHeight:\"1.5\"},children:\"Inicia sesi\\xf3n para acceder a este video de mentor\\xeda.\"})]})});}// C) LOGUEADO PERO SIN PERMISO (Estilo mejorado)\nreturn /*#__PURE__*/_jsx(\"div\",{style:wrapperStyle,children:/*#__PURE__*/_jsxs(\"div\",{style:{...contentContainerStyle,background:\"linear-gradient(135deg, #2a0a0a 0%, #3d1010 100%)\",color:\"#ffcccc\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{background:\"rgba(255, 0, 0, 0.1)\",padding:\"16px\",borderRadius:\"50%\",marginBottom:\"16px\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:/*#__PURE__*/_jsxs(\"svg\",{xmlns:\"http://www.w3.org/2000/svg\",width:\"24\",height:\"24\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:\"currentColor\",strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",children:[/*#__PURE__*/_jsx(\"circle\",{cx:\"12\",cy:\"12\",r:\"10\"}),/*#__PURE__*/_jsx(\"line\",{x1:\"15\",y1:\"9\",x2:\"9\",y2:\"15\"}),/*#__PURE__*/_jsx(\"line\",{x1:\"9\",y1:\"9\",x2:\"15\",y2:\"15\"})]})}),/*#__PURE__*/_jsx(\"h3\",{style:{margin:\"0 0 8px 0\",fontSize:\"18px\",fontWeight:600,color:\"#fff\"},children:\"Video No Disponible\"}),/*#__PURE__*/_jsx(\"p\",{style:{margin:0,fontSize:\"14px\",opacity:.8,maxWidth:\"300px\",lineHeight:\"1.5\"},children:\"No tienes el producto necesario asignado para ver este contenido.\"})]})});}addPropertyControls(TestThentySDK,{productVideoMap:{title:\"Videos\",type:ControlType.Array,control:{type:ControlType.Object,controls:{productCode:{title:\"UUID\",type:ControlType.String,defaultValue:\"\"},embedUrl:{title:\"URL Video\",type:ControlType.String,defaultValue:\"\"}}},defaultValue:[]},redirectUrl:{title:\"Redirigir a\",type:ControlType.String,placeholder:\"https://...\"},radius:{title:\"Radio Borde\",type:ControlType.Number,min:0,max:50,defaultValue:12,displayStepper:true},tint:{title:\"Color Placeholder\",type:ControlType.Color,defaultValue:\"#0099FF\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TestThentySDK\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ThentyLockVideo.map"],"mappings":"yRAIG,SAAwB,EAAc,EAAM,CAAC,IAAM,EAAS,GAAe,CAAM,CAAC,kBAAgB,OAAK,cAAY,UAAQ,EACzD,CAAC,WAAS,EAAE,CAAC,WAAS,KAAhF,OAAO,GAAgB,WAAW,GAAe,CAAC,EAAE,GAAyC,EAAE,CAAM,CAAC,EAAe,GAAmBA,EAAS,GAAM,CAAK,EAAkB,KAAS,EAAiB,KACnN,GAAG,GAAiB,MAAM,QAAQ,EAAgB,CAAE,IAAI,IAAM,KAAO,EAAgB,CAAC,IAAM,EAAY,EAAI,YAAkB,EAAY,EAAI,SAAS,GAAG,GAAa,GAAa,OAAO,GAAa,YAAY,EAAW,CAAC,EAAY,CAAC,CAAC,CAAC,EAAkB,EAAY,EAAiB,EAAY,OAC1S,MAAc,CAAI,KAAa,SAAS,GAAG,EAAa,QAAiB,EAAiB,CAAC,IAAM,EAAW,eAAqB,EAAQ,aAAa,QAAQ,EAAW,CAAwB,GAAvB,QAAQ,IAAI,CAAC,UAAQ,CAAC,CAAI,GA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