{"version":3,"file":"SmartOSDownloadButton.C_c1jVP0.mjs","names":["useState","useMemo","useCallback","startTransition"],"sources":["https:/framerusercontent.com/modules/YgNDrXTA4EihlV9ccmFH/0IFyoGegXqEbH7Kg8CPY/SmartOSDownloadButton.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect,useMemo,useCallback,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight fixed\n */export default function SmartDownloadButton(props){const{iosLink,androidLink,webLink=\"https://callbridge.sg\",buttonText=\"Download app\",iosText=\"Download for iPhone\",androidText=\"Download for Android\",webText=\"Open CallBridge\",backgroundColor=\"#6443F7\",textColor=\"#ffffff\",hoverColor=\"#5236d6\",borderRadius=32,padding=16,textFont={fontSize:16,variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1em\",textAlign:\"center\"}}=props;const[hover,setHover]=useState(false);const[platform,setPlatform]=useState(\"desktop\");useEffect(()=>{if(typeof window!==\"undefined\"&&typeof navigator!==\"undefined\"){const ua=navigator.userAgent.toLowerCase();const touchPoints=navigator.maxTouchPoints||0;const isAndroid=/android/i.test(ua);const isIOSDevice=/iphone|ipad|ipod/i.test(ua);const isTouchCapableMac=/macintosh|mac os x/i.test(ua)&&touchPoints>1;if(isAndroid){startTransition(()=>setPlatform(\"android\"));}else if(isIOSDevice||isTouchCapableMac){startTransition(()=>setPlatform(\"ios\"));}else{startTransition(()=>setPlatform(\"desktop\"));}}else{startTransition(()=>setPlatform(\"desktop\"));}},[]);const targetLink=useMemo(()=>{if(platform===\"ios\")return iosLink||webLink;if(platform===\"android\")return androidLink||webLink;return webLink;},[platform,iosLink,androidLink,webLink]);const resolvedButtonText=useMemo(()=>{if(buttonText?.trim())return buttonText;if(platform===\"ios\")return iosText;if(platform===\"android\")return androidText;return webText;},[buttonText,platform,iosText,androidText,webText]);const handleClick=useCallback(()=>{if(typeof window!==\"undefined\"){window.open(targetLink,\"_blank\",\"noopener,noreferrer\");}},[targetLink]);const textStyle=useMemo(()=>({fontSize:textFont?.fontSize,lineHeight:textFont?.lineHeight,letterSpacing:textFont?.letterSpacing,fontFamily:textFont?.fontFamily,fontWeight:textFont?.fontWeight,fontStyle:textFont?.fontStyle,textAlign:textFont?.textAlign}),[textFont]);return /*#__PURE__*/_jsx(\"button\",{onClick:handleClick,onMouseEnter:()=>startTransition(()=>setHover(true)),onMouseLeave:()=>startTransition(()=>setHover(false)),\"aria-label\":resolvedButtonText,style:{...props.style,position:\"relative\",background:hover?hoverColor:backgroundColor,color:textColor,border:\"none\",borderRadius,padding:`${padding}px ${padding*1.5}px`,cursor:\"pointer\",transition:\"0.2s ease\",...textStyle},children:resolvedButtonText});}addPropertyControls(SmartDownloadButton,{iosLink:{type:ControlType.String,title:\"App Store URL\",defaultValue:\"\",placeholder:\"https://apps.apple.com/...\"},androidLink:{type:ControlType.String,title:\"Play Store URL\",defaultValue:\"\",placeholder:\"https://play.google.com/store/apps/...\"},webLink:{type:ControlType.String,title:\"Fallback URL\",defaultValue:\"https://callbridge.sg\",placeholder:\"https://...\"},buttonText:{type:ControlType.String,title:\"Label\",defaultValue:\"Download app\"},iosText:{type:ControlType.String,title:\"iOS Label\",defaultValue:\"Download for iPhone\"},androidText:{type:ControlType.String,title:\"Android Label\",defaultValue:\"Download for Android\"},webText:{type:ControlType.String,title:\"Fallback Label\",defaultValue:\"Open CallBridge\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#6443F7\"},textColor:{type:ControlType.Color,title:\"Text\",defaultValue:\"#ffffff\"},hoverColor:{type:ControlType.Color,title:\"Hover\",defaultValue:\"#5236d6\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:32,min:0,max:999,step:1},padding:{type:ControlType.Number,title:\"Padding\",defaultValue:16,min:0,max:80,step:1},textFont:{type:ControlType.Font,title:\"Text Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"16px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1em\",textAlign:\"center\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SmartDownloadButton\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SmartOSDownloadButton.map"],"mappings":"sNAGG,SAAwB,EAAoB,EAAM,CAAC,GAAK,CAAC,UAAQ,cAAY,UAAQ,wBAAwB,aAAW,eAAe,UAAQ,sBAAsB,cAAY,uBAAuB,UAAQ,kBAAkB,kBAAgB,UAAU,YAAU,UAAU,aAAW,UAAU,eAAa,GAAG,UAAQ,GAAG,WAAS,CAAC,SAAS,GAAG,QAAQ,SAAS,cAAc,UAAU,WAAW,MAAM,UAAU,SAAS,EAAE,EAAW,CAAC,EAAM,GAAUA,EAAS,GAAM,CAAM,CAAC,EAAS,GAAaA,EAAS,UAAU,CAAC,MAAc,CAAC,GAAU,IAAS,QAAoB,IAAY,OAAY,CAAC,IAAM,EAAG,EAAU,UAAU,aAAa,CAAO,EAAY,EAAU,gBAAgB,EAAQ,EAAU,WAAW,KAAK,EAAG,CAAO,EAAY,oBAAoB,KAAK,EAAG,CAAO,EAAkB,sBAAsB,KAAK,EAAG,EAAE,EAAY,EAAgB,EAAX,MAA+B,EAAY,UAAU,CAAW,GAAa,MAAuC,EAAY,MAAM,KAA4B,EAAY,UAAU,CAAC,MAAQ,MAAoB,EAAY,UAAU,CAAC,EAAI,EAAE,CAAC,CAAC,IAAM,EAAWC,MAAgB,IAAW,MAAa,GAAS,EAAW,IAAW,WAAiB,GAA4B,EAAU,CAAC,EAAS,EAAQ,EAAY,EAAQ,CAAC,CAAO,EAAmBA,MAAgB,GAAY,MAAM,CAAQ,EAAc,IAAW,MAAa,EAAW,IAAW,UAA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