{"version":3,"file":"utils_Experiments.BTdkkCM8.mjs","names":[],"sources":["https:/framerusercontent.com/modules/B2QJpnsZccOglpTE2COX/IbUCMTxnVOvifaLiJY4S/utils_Experiments.js"],"sourcesContent":["const SD_EXPERIMENT_COOKIE_NAME=\"tns_experiment_sd\";const SD_DISABLE_EXPERIMENT=true;const FLOW_EXPERIMENT_COOKIE_NAME=\"tns_experiment_flow\";const FLOW_DISABLE_EXPERIMENT_UNLESS_FORCED=true;// Utility: Get cookie value by name\nconst getCookie=name=>{const match=document.cookie.match(new RegExp(\"(^| )\"+name+\"=([^;]+)\"));const result=match?decodeURIComponent(match[2]):null;return result;};// Utility: Set cookie with optional expiry (in days)\nconst setCookie=(name,value,daysToExpire)=>{let expires=\"\";if(daysToExpire!==undefined){const date=new Date;date.setTime(date.getTime()+daysToExpire*24*60*60*1e3);expires=\"; expires=\"+date.toUTCString();}// Add SameSite=Lax for better cross-site compatibility and session persistence\n// Add Secure flag if on HTTPS (will be ignored on HTTP)\nconst isSecure=window.location.protocol===\"https:\";const secureFlag=isSecure?\"; Secure\":\"\";document.cookie=`${name}=${encodeURIComponent(value)}${expires}; path=/; SameSite=Lax${secureFlag}`;};// Get the entire experiment map from cookie\nconst getExperimentPropsCookieValue=cookieName=>{try{const cookieValue=getCookie(cookieName);if(cookieValue){return JSON.parse(cookieValue);}}catch(error){console.error(\"Error parsing experiment cookie\",error);}return{};};// Save the full experiment map to cookie (defaults to 7 days)\nconst setExperimentPropsCookie=(cookieName,experiments,daysToExpire=7)=>{try{setCookie(cookieName,JSON.stringify(experiments),daysToExpire);}catch(error){console.error(`Error saving experiment cookie ${cookieName}`,error);}};// Main function: get or initialize experiment value\nconst getOrInitExperimentVersion=(cookieName,key,experimentValues,daysToExpire=7)=>{if(experimentValues.length<=0)return\"\";let experimentsObj=getExperimentPropsCookieValue(cookieName);if(key in experimentsObj&&experimentValues.includes(experimentsObj[key])){const foundValue=experimentsObj[key];return foundValue;}// Assign a new experiment value\nconst assignedExperiment=experimentValues[Math.floor(Math.random()*experimentValues.length)];experimentsObj[key]=assignedExperiment;setExperimentPropsCookie(cookieName,experimentsObj,daysToExpire);return assignedExperiment;};export const getOrInitSavedDesignExperiment=()=>{try{if(SD_DISABLE_EXPERIMENT){return\"\";}return getOrInitExperimentVersion(SD_EXPERIMENT_COOKIE_NAME,\"SavedDesign\",[\"251111_SD_Original\",\"251111_SD_Variant\"]);}catch(error){console.error(error);}return\"(Not Set)\";};export const getOrInitFlowExperiment=()=>{try{if(FLOW_DISABLE_EXPERIMENT_UNLESS_FORCED){return\"\";}return getOrInitExperimentVersion(FLOW_EXPERIMENT_COOKIE_NAME,\"CreateFlowVersion\",[\"20251205_CreateFlow_Original\",\"20251205_CreateFlow_Updated\"]);}catch(error){console.error(error);}return\"\";};const getFlowExperimentParam=()=>{try{const qs=(window?.location?.search||\"\").toLowerCase();if(qs.includes(\"flow=updated\")){return true;}else if(qs.includes(\"flow=original\")){return false;}}catch(error){console.error(`Error`,error);}return null;};export const initFlowExperimentForceVersion=forceVariant=>{try{// First check if cookie already exists - preserve it unless URL param forces a change\nconst existingExperiments=getExperimentPropsCookieValue(FLOW_EXPERIMENT_COOKIE_NAME);const existingValue=existingExperiments[\"CreateFlow\"];// Check URL params for forced variant\nconst urlParam=getFlowExperimentParam();let assignedExperiment=\"\";if(urlParam===true){// URL param forces updated version\nassignedExperiment=\"20251205_CreateFlow_Updated\";}else if(urlParam===false){// URL param forces original version\nassignedExperiment=\"20251205_CreateFlow_Original\";}else if(existingValue){// No URL param, but cookie exists - preserve existing value\nassignedExperiment=existingValue;return assignedExperiment;}else if(!FLOW_DISABLE_EXPERIMENT_UNLESS_FORCED){// No URL param and no existing cookie - initialize new experiment\nassignedExperiment=getOrInitFlowExperiment();return assignedExperiment;}// Only update cookie if URL param forced a change\nif(assignedExperiment&&urlParam!==null){let experimentsObj={...existingExperiments};experimentsObj[\"CreateFlow\"]=assignedExperiment;setExperimentPropsCookie(FLOW_EXPERIMENT_COOKIE_NAME,experimentsObj,7);}return assignedExperiment;}catch(error){console.error(error);}return\"\";};export const getFlowVersionIsUpdated=()=>{try{// Check if URL param forces a change (this will update cookie if needed)\nconst urlParam=getFlowExperimentParam();// If no URL param, check existing cookie first to avoid unnecessary initialization\nif(urlParam===null){const existingExperiments=getExperimentPropsCookieValue(FLOW_EXPERIMENT_COOKIE_NAME);const existingValue=existingExperiments[\"CreateFlow\"];if(existingValue){if(existingValue.toLowerCase().includes(\"updated\")){return true;}else if(existingValue.toLowerCase().includes(\"original\")){return false;}return null;}}// Initialize or get experiment (will handle URL params and new assignments)\nconst assignedExperiment=initFlowExperimentForceVersion();if(assignedExperiment&&assignedExperiment.toLowerCase().includes(\"updated\")){return true;}else if(assignedExperiment&&assignedExperiment.toLowerCase().includes(\"original\")){return false;}return null;}catch(error){console.error(\"Error in getFlowVersionIsUpdated:\",error);return null;}};\nexport const __FramerMetadata__ = {\"exports\":{\"getFlowVersionIsUpdated\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getOrInitSavedDesignExperiment\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getOrInitFlowExperiment\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"initFlowExperimentForceVersion\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./utils_Experiments.map"],"mappings":"wIAA2F,EAA4B,sBACjH,EAAU,GAAM,CAAC,IAAM,EAAM,SAAS,OAAO,MAAU,OAAO,QAAQ,EAAK,WAAW,CAAC,CAAsD,OAAxC,EAAM,mBAAmB,EAAM,GAAG,CAAC,MACxI,GAAW,EAAK,EAAM,IAAe,CAAC,IAAI,EAAQ,GAAG,GAAG,IAAe,IAAA,GAAU,CAAC,IAAM,EAAK,IAAI,KAAK,EAAK,QAAQ,EAAK,SAAS,CAAC,EAAa,GAAG,GAAG,GAAG,IAAI,CAA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