{"version":3,"file":"RevukitWidget.4-RUdPDt.mjs","names":["useRef","useState","useMemo"],"sources":["https:/framerusercontent.com/modules/mZvVgoJcfjK4z15DiMSc/2gI3b5PiBM6svgrmz7BV/RevukitWidget.js"],"sourcesContent":["/**\n * RevuKit Widget (Unified) - Framer Code Component\n *\n * Single component with a widget selector.\n * placeId/businessId are intentionally hidden from controls and should be\n * set by the plugin when inserting the component.\n */import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useMemo,useRef,useState}from\"react\";const WIDGET_OPTIONS=[{title:\"Counter\",value:\"number-counter\"},{title:\"Classic\",value:\"google-badge\"},{title:\"Corner\",value:\"google-stars-top\"},{title:\"Spotlight\",value:\"google-rating-top\"},{title:\"Essential\",value:\"custom-badge\"},{title:\"Tower\",value:\"vertical-stack\"},{title:\"Capsule\",value:\"pill-divider\"},{title:\"Natural\",value:\"integrated-text\"},{title:\"App Icon\",value:\"icon-badge\"},{title:\"Statement\",value:\"rating-card\"},{title:\"Transformer\",value:\"animated-rating-grid\"},{title:\"Archive\",value:\"detailed-reviews\"},{title:\"Living Wall\",value:\"dynamic-review-wall\"},{title:\"Gallery\",value:\"testimonial-mosaic-wall\"},{title:\"Masonry\",value:\"testimonial-masonry-grid\"},{title:\"Foundation\",value:\"testimonial-grid\"},{title:\"Showcase\",value:\"testimonial-grid-double-row\"},{title:\"Anthology\",value:\"featured-reviews-list\"},{title:\"Insight AI\",value:\"ai-summary-carousel\"}];const FREE_WIDGETS=[\"google-badge\",\"google-stars-top\",\"google-rating-top\",\"number-counter\"];const PREMIUM_SUFFIX=\"\";const WIDGET_OPTION_TITLES=WIDGET_OPTIONS.map(widget=>FREE_WIDGETS.includes(widget.value)?widget.title:`${widget.title}${PREMIUM_SUFFIX}`);const BORDER_RADIUS_OPTIONS=[{title:\"None\",value:\"0px\"},{title:\"Small\",value:\"4px\"},{title:\"Medium\",value:\"8px\"},{title:\"Large\",value:\"12px\"},{title:\"Full\",value:\"9999px\"}];const SHADOW_OPTIONS=[{title:\"Default\",value:\"0 1px 3px rgba(0,0,0,0.1)\"},{title:\"None\",value:\"none\"},{title:\"Small\",value:\"0 1px 2px 0 rgb(0 0 0 / 0.05)\"},{title:\"Medium\",value:\"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)\"},{title:\"Large\",value:\"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)\"},{title:\"Extra Large\",value:\"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)\"}];const WIDGET_MAX_WIDTHS={\"number-counter\":159,\"google-badge\":277,\"google-stars-top\":112,\"google-rating-top\":282,\"custom-badge\":201,\"vertical-stack\":238,\"pill-divider\":274,\"integrated-text\":181,\"icon-badge\":80,\"rating-card\":158,\"animated-rating-grid\":638,\"detailed-reviews\":768,\"dynamic-review-wall\":768,\"ai-summary-carousel\":768,\"testimonial-grid\":1019,\"testimonial-grid-double-row\":1019,\"testimonial-mosaic-wall\":1080,\"testimonial-masonry-grid\":1280,\"featured-reviews-list\":1280};// Removed global Window augmentation to avoid duplicate property declaration conflicts.\n// Use a local cast when accessing window.RevuKit below.\nconst toRenderMethod=widgetType=>`render${widgetType.split(\"-\").map(part=>part.charAt(0).toUpperCase()+part.slice(1)).join(\"\")}`;/**\n * @framerDisableUnlink\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function RevuKitWidget(props){const{widgetType,placeId,businessId,isPremium,primaryColor,secondaryColor,tertiaryColor,borderRadius,shadow,centerInline}=props;const containerRef=useRef(null);const[scriptLoaded,setScriptLoaded]=useState(false);const[loadedWidgetType,setLoadedWidgetType]=useState(null);const isFreeWidgetSelected=FREE_WIDGETS.includes(widgetType);const canRenderWidget=isFreeWidgetSelected||isPremium;const widgetUmdUrl=useMemo(()=>`https://cdn.revukit.com/widgets/${widgetType}.umd.js`,[widgetType]);useEffect(()=>{if(!canRenderWidget)return;setScriptLoaded(false);setLoadedWidgetType(null);const script=document.createElement(\"script\");script.src=widgetUmdUrl;script.async=true;script.onload=()=>{setLoadedWidgetType(widgetType);setScriptLoaded(true);};script.onerror=()=>setScriptLoaded(false);document.body.appendChild(script);return()=>{if(script.parentNode)script.parentNode.removeChild(script);};},[widgetUmdUrl,canRenderWidget]);const lastRenderKeyRef=useRef(null);useEffect(()=>{if(!canRenderWidget)return;if(!scriptLoaded)return;if(loadedWidgetType!==widgetType)return;if(!containerRef.current)return;if(!placeId?.trim()||!businessId?.trim())return;const renderKey=`${widgetType}::${placeId}::${businessId}`;if(lastRenderKeyRef.current===renderKey)return;const methodName=toRenderMethod(widgetType);const api=window.RevuKit;const renderFn=api&&api[methodName];if(typeof renderFn!==\"function\")return;lastRenderKeyRef.current=renderKey;renderFn({container:containerRef.current,placeId,businessId,useShadow:true,enableContainerQueries:true,colors:{primary:primaryColor,secondary:secondaryColor,tertiary:tertiaryColor},style:{borderRadius,shadow}});},[canRenderWidget,scriptLoaded,loadedWidgetType,widgetType,placeId,businessId,primaryColor,secondaryColor,tertiaryColor,borderRadius,shadow,centerInline]);const showMissingIds=!placeId?.trim()||!businessId?.trim();const showUpgradeRequired=!isPremium&&!isFreeWidgetSelected;const widgetMaxWidth=WIDGET_MAX_WIDTHS[widgetType];const centeredMaxWidth=widgetMaxWidth?`min(100%, ${widgetMaxWidth}px)`:\"fit-content\";return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,className:\"rk-framer\",style:{width:\"100%\",maxWidth:centerInline?centeredMaxWidth:\"100%\",marginLeft:centerInline?\"auto\":0,marginRight:centerInline?\"auto\":0,display:\"block\",boxSizing:\"border-box\"},children:[showMissingIds&&/*#__PURE__*/_jsx(\"div\",{style:{padding:8,color:\"#64748b\",fontSize:12},children:\"Connect your business in the RevuKit plugin to load this widget.\"}),showUpgradeRequired&&/*#__PURE__*/_jsxs(\"div\",{style:{position:\"fixed\",inset:0,zIndex:9999,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",padding:\"32px 24px\",background:\"#ffffff\",overflow:\"hidden\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",inset:0,zIndex:0,pointerEvents:\"none\",opacity:.7,background:\"radial-gradient(closest-side at 50% 100%, rgba(119,117,214,0.35), rgba(233,53,193,0.25), rgba(255,255,255,0))\"}}),/*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",zIndex:1,maxWidth:520,width:\"100%\",padding:\"18px 20px\",color:\"#0f172a\",fontSize:14,lineHeight:1.55,background:\"rgba(255,255,255,0.95)\",border:\"1px solid rgba(148,163,184,0.35)\",borderRadius:14,boxShadow:\"0 20px 50px -30px rgba(15,23,42,0.45)\"},children:[/*#__PURE__*/_jsx(\"strong\",{style:{color:\"#0f172a\",fontWeight:600,letterSpacing:\"-0.01em\"},children:\"Upgrade required\"}),/*#__PURE__*/_jsxs(\"span\",{style:{color:\"#334155\"},children:[\" \",\"to use this widget. Open the RevuKit plugin to upgrade, or\",\" \"]}),/*#__PURE__*/_jsx(\"a\",{href:\"https://www.revukit.com/framer-pricing\",target:\"_blank\",rel:\"noopener noreferrer\",style:{color:\"#2563eb\",textDecoration:\"underline\",fontWeight:600},children:\"click here\"}),\".\"]})]})]});}addPropertyControls(RevuKitWidget,{widgetType:{title:\"Widget\",type:ControlType.Enum,options:WIDGET_OPTIONS.map(w=>w.value),optionTitles:WIDGET_OPTION_TITLES,defaultValue:\"number-counter\"},placeId:{title:\"Place ID\",type:ControlType.String,defaultValue:\"\",hidden:()=>true},businessId:{title:\"Business ID\",type:ControlType.String,defaultValue:\"\",hidden:()=>true},isPremium:{title:\"Premium Access\",type:ControlType.Boolean,defaultValue:false,hidden:()=>true},primaryColor:{title:\"Primary\",type:ControlType.Color,defaultValue:\"#FBBC04\"},secondaryColor:{title:\"Secondary\",type:ControlType.Color,defaultValue:\"#1f2937\"},tertiaryColor:{title:\"Tertiary\",type:ControlType.Color,defaultValue:\"#6b7280\"},borderRadius:{title:\"Radius\",type:ControlType.Enum,options:BORDER_RADIUS_OPTIONS.map(o=>o.value),optionTitles:BORDER_RADIUS_OPTIONS.map(o=>o.title),defaultValue:\"8px\"},shadow:{title:\"Shadow\",type:ControlType.Enum,options:SHADOW_OPTIONS.map(o=>o.value),optionTitles:SHADOW_OPTIONS.map(o=>o.title),defaultValue:\"0 1px 3px rgba(0,0,0,0.1)\"},centerInline:{title:\"Inline Center\",type:ControlType.Boolean,defaultValue:false}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RevuKitWidget\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"* @framerSupportedLayoutWidth any\",\"framerSupportedLayoutHeight\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./RevukitWidget.map"],"mappings":"+MAYG,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,aAAW,UAAQ,aAAW,YAAU,eAAa,iBAAe,gBAAc,eAAa,SAAO,gBAAc,EAAY,EAAaA,EAAO,KAAK,CAAM,CAAC,EAAa,GAAiBC,EAAS,GAAM,CAAM,CAAC,EAAiB,GAAqBA,EAAS,KAAK,CAAO,EAAqB,EAAa,SAAS,EAAW,CAAO,EAAgB,GAAsB,EAAgB,EAAaC,MAAY,mCAAmC,EAAW,SAAS,CAAC,EAAW,CAAC,CAAC,MAAc,CAAC,GAAG,CAAC,EAAgB,OAAO,EAAgB,GAAM,CAAC,EAAoB,KAAK,CAAC,IAAM,EAAO,SAAS,cAAc,SAAS,CAAkM,MAAjM,GAAO,IAAI,EAAa,EAAO,MAAM,GAAK,EAAO,WAAW,CAAC,EAAoB,EAAW,CAAC,EAAgB,GAAK,EAAG,EAAO,YAAY,EAAgB,GAAM,CAAC,SAAS,KAAK,YAAY,EAAO,KAAW,CAAI,EAAO,YAAW,EAAO,WAAW,YAAY,EAAO,GAAK,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