{"version":3,"file":"NewDemoController.BMOhUBTL.mjs","names":["useState","useCallback","__legacyOverrideHOC_DataObserverContext","_jsx"],"sources":["https:/framerusercontent.com/modules/GyLS0LzD3V4t56NH8RRL/6j8UCO5OYvOGpFAMImy8/NewDemoController.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useCallback,useEffect,useState}from\"react\";const DEFAULT_IMAGE=\"https://cdn.goentri.com//uploads/7c83772d-40c2-45b7-b55e-97478dbd6b31.svg\";async function openEntriDemo(product,registrar=\"ionos\",sellVersion=\"v3\",autoOpen=false){const url=new URL(window.location.href);const appId=url.searchParams.get(\"appId\")||\"exampleapp\";const config=url.searchParams.get(\"config\");const partnerLogo=url.searchParams.get(\"partnerLogo\");const _preferred_registrar=autoOpen?url.searchParams.get(\"preferred_registrar\")||registrar:registrar;const finalRegistrar=[\"ionos\",\"squarespace\",\"godaddy\"].includes(_preferred_registrar.toLowerCase())?_preferred_registrar.toLowerCase():registrar;// Check auto-open\nconst defaultOpen=url.hash===\"#open\"||url.searchParams.get(\"open\")===\"true\";if(autoOpen&&!defaultOpen){return;}try{const logo=\"https://entri.s3.us-east-2.amazonaws.com/uploads/50eb2693-f95d-4f28-b731-768b78e5d752.svg\";switch(product){case\"sell\":const sellConfig=config?{...JSON.parse(config),applicationId:appId,preferred_registrar:finalRegistrar}:{applicationId:appId,sellVersion,preferred_registrar:finalRegistrar,token:\"JWT_TOKEN\",prefilledDomain:\"\",dnsRecords:[{type:\"TXT\",host:\"entri\",value:\"entri-sample-txt-record\",ttl:300}],whiteLabel:{sell:{partnerLogo:partnerLogo||logo}}};// @ts-ignore\nentri.purchaseDomain({...sellConfig,testPurchase:true});break;case\"connect\":default:// @ts-ignore\nentri.showEntri({applicationId:appId,token:\"JWT_TOKEN\",prefilledDomain:\"\",dnsRecords:[{type:\"TXT\",host:\"entri\",value:\"entri-sample-txt-record\",ttl:300}],...JSON.parse(config||\"{}\")});break;}}catch(error){console.error(\"Error opening demo:\",error);}}export function SellDemoActionOverride(){return DemoActionOverride(\"sell\");}export function SellIONOSDemoActionOverride(){return{onClick:()=>openEntriDemo(\"sell\",\"ionos\",\"v3\")};//return DemoActionOverride(\"sell\", \"v3\", \"ionos\")\n}export function SellSQSPDemoActionOverride(){return{onClick:()=>openEntriDemo(\"sell\",\"squarespace\",\"\")};// return DemoActionOverride(\"sell\", \"\", \"squarespace\")\n}export function ConnectDemoActionOverride(){return{onClick:()=>openEntriDemo(\"connect\")};// return DemoActionOverride(\"connect\")\n}export function OpenDemoActionOverride(){return DemoActionOverride(\"connect\",\"v3\",\"ionos\",true);}function DemoActionOverride(demoProduct,sellVersion=\"v3\",preferred_registrar=\"ionos\",checkOpen=false){const[appSetting,setAppSettings]=useState(null);const[isLoading,setIsLoading]=useState(false);const fetchSettings=useCallback(()=>{return new Promise((resolve,reject)=>{setIsLoading(true);const path=window.location.href;const url=new URL(path);const appId=url.searchParams.get(\"appId\")||\"exampleapp\";const _product=url.searchParams.get(\"product\")||null;const config=url.searchParams.get(\"config\");const partnerLogo=url.searchParams.get(\"partnerLogo\");// const product = demoProduct\n//     ? demoProduct\n//     : [\"sell\", \"connect\"].includes(_product.toLowerCase())\n//       ? _product.toLowerCase()\n//       : \"connect\"\nconst product=_product&&[\"sell\",\"connect\"].includes(_product.toLowerCase())?_product.toLowerCase():demoProduct??\"connect\";const _preferred_registrar=url.searchParams.get(\"preferred_registrar\")||preferred_registrar;const registrar=[\"ionos\",\"squarespace\"].includes(_preferred_registrar.toLowerCase())?_preferred_registrar.toLowerCase():preferred_registrar;// const defaultOpen = path.includes(\"open\")\nconst defaultOpen=url.hash===\"#open\"||url.searchParams.get(\"open\")===\"true\";const demoConfig={logo:\"https://entri.s3.us-east-2.amazonaws.com/uploads/50eb2693-f95d-4f28-b731-768b78e5d752.svg\",appId,product:product,partnerLogo,sellVersion,config,registrar};setAppSettings(demoConfig);setIsLoading(false);if(checkOpen&&defaultOpen){handleDemo(demoConfig);}resolve(demoConfig);// fetch(\"https://api.goentri.com/application/exampleapp/image\")\n//     .then((response) => response.json())\n//     .then((data) => {\n//         const demoConfig = {\n//             logo: data?.logo || DEFAULT_IMAGE,\n//             appId,\n//             product: product as EntriProducts,\n//             partnerLogo,\n//             sellVersion,\n//             config,\n//             registrar,\n//         }\n//         setAppSettings(demoConfig)\n//         setIsLoading(false)\n//         if (checkOpen && defaultOpen) {\n//             handleDemo(demoConfig)\n//         }\n//         resolve(demoConfig)\n//     })\n//     .catch((error) => {\n//         console.error(\"Error fetching data:\", error)\n//         setIsLoading(false)\n//         reject(error)\n//     })\n});},[demoProduct]);useEffect(()=>{fetchSettings();},[fetchSettings]);async function handleDemo(config){try{let appSettings;if(config){appSettings=config;}else if(appSetting){appSettings=appSetting;}else{console.info(\"App settings not loaded yet, fetching settings first...\");appSettings=await fetchSettings();}const{appId,logo,product,config:configStr,partnerLogo,registrar}=appSettings;switch(product){case\"sell\":const sellConfig=configStr?{...JSON.parse(configStr),applicationId:appId}:{applicationId:appId,sellVersion:config?.sellVersion||\"v3\",preferred_registrar:registrar,token:\"JWT_TOKEN\",prefilledDomain:\"\",dnsRecords:[{type:\"TXT\",host:\"entri\",value:\"entri-sample-txt-record\",ttl:300}],whiteLabel:{sell:{partnerLogo:partnerLogo||logo}}};// @ts-ignore\nentri.purchaseDomain(sellConfig);break;case\"connect\":default:// @ts-ignore\nentri.showEntri({applicationId:appId,token:\"JWT_TOKEN\",prefilledDomain:\"\",dnsRecords:[{type:\"TXT\",host:\"entri\",value:\"entri-sample-txt-record\",ttl:300}],...JSON.parse(configStr||\"{}\")});break;}}catch(error){console.error(\"Error in handleDemo:\",error);}}return{onClick:async event=>{await handleDemo(appSetting);}};}import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withSellDemoActionOverride(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...SellDemoActionOverride(props)});};}withSellDemoActionOverride.displayName=\"SellDemoActionOverride\";export function withSellIONOSDemoActionOverride(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...SellIONOSDemoActionOverride(props)});};}withSellIONOSDemoActionOverride.displayName=\"SellIONOSDemoActionOverride\";export function withSellSQSPDemoActionOverride(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...SellSQSPDemoActionOverride(props)});};}withSellSQSPDemoActionOverride.displayName=\"SellSQSPDemoActionOverride\";export function withConnectDemoActionOverride(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...ConnectDemoActionOverride(props)});};}withConnectDemoActionOverride.displayName=\"ConnectDemoActionOverride\";export function withOpenDemoActionOverride(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...OpenDemoActionOverride(props)});};}withOpenDemoActionOverride.displayName=\"OpenDemoActionOverride\";export function withDemoActionOverride(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...DemoActionOverride(props)});};}withDemoActionOverride.displayName=\"DemoActionOverride\";\nexport const __FramerMetadata__ = {\"exports\":{\"withSellIONOSDemoActionOverride\":{\"type\":\"reactHoc\",\"name\":\"withSellIONOSDemoActionOverride\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ConnectDemoActionOverride\":{\"type\":\"override\",\"name\":\"ConnectDemoActionOverride\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withOpenDemoActionOverride\":{\"type\":\"reactHoc\",\"name\":\"withOpenDemoActionOverride\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withConnectDemoActionOverride\":{\"type\":\"reactHoc\",\"name\":\"withConnectDemoActionOverride\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"OpenDemoActionOverride\":{\"type\":\"override\",\"name\":\"OpenDemoActionOverride\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSellSQSPDemoActionOverride\":{\"type\":\"reactHoc\",\"name\":\"withSellSQSPDemoActionOverride\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"SellIONOSDemoActionOverride\":{\"type\":\"override\",\"name\":\"SellIONOSDemoActionOverride\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"SellSQSPDemoActionOverride\":{\"type\":\"override\",\"name\":\"SellSQSPDemoActionOverride\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"SellDemoActionOverride\":{\"type\":\"override\",\"name\":\"SellDemoActionOverride\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withDemoActionOverride\":{\"type\":\"reactHoc\",\"name\":\"withDemoActionOverride\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSellDemoActionOverride\":{\"type\":\"reactHoc\",\"name\":\"withSellDemoActionOverride\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./NewDemoController.map"],"mappings":"uMAA6L,eAAe,EAAc,EAAQ,EAAU,QAAQ,EAAY,KAAK,EAAS,GAAM,CAAC,IAAM,EAAI,IAAI,IAAI,EAAO,SAAS,KAAK,CAAO,EAAM,EAAI,aAAa,IAAI,QAAQ,EAAE,aAAmB,EAAO,EAAI,aAAa,IAAI,SAAS,CAAO,EAAY,EAAI,aAAa,IAAI,cAAc,CAAO,EAAqB,GAAS,EAAI,aAAa,IAAI,sBAAsB,EAAY,EAAgB,EAAe,CAAC,QAAQ,cAAc,UAAU,CAAC,SAAS,EAAqB,aAAa,CAAC,CAAC,EAAqB,aAAa,CAAC,EAC7rB,EAAY,EAAI,OAAO,SAAS,EAAI,aAAa,IAAI,OAAO,GAAG,OAAU,QAAU,CAAC,GAAqB,GAAG,CAAwG,OAAO,EAAP,CAAgB,IAAI,OAAO,IAAM,EAAW,EAAO,CAAC,GAAG,KAAK,MAAM,EAAO,CAAC,cAAc,EAAM,oBAAoB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