{"version":3,"file":"Case_Study_Flow_Overrides.AoltmB1a.mjs","names":[],"sources":["https:/framerusercontent.com/modules/lGWjWJfEGf7iEbAePgqu/liVoOZgcHw2SSJ2UmVI5/Case_Study_Flow_Overrides.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef}from\"react\";// User request: Create two canvas-native code overrides:\n// 1) withCaseStudyFlowTracking to detect case-study link clicks from /fintech/home and /guidehouse/home and store \"fintech\" or \"data\" in sessionStorage.\n// 2) withDynamicCaseStudyNext to drive next-button navigation using the saved flow sequence while preserving original behavior for unsupported cases.\nconst FLOW_STORAGE_KEY=\"caseStudyFlow\";const flowSequences={fintech:[\"/cs26/comgmsys\",\"/cs26/comgmdes\",\"/cs26/etaxpl\",\"/cs26/itpmmvp\",\"/cs26/efinds\"],data:[\"/cs26/etaxpl\",\"/cs26/itpmmvp\",\"/cs26/utintoan\",\"/cs26/tcowo\"]};const unifiedGuidehouseSequence=[\"/cs26/etaxpl\",\"/cs26/utintoan\",\"/cs26/comgmsys\",\"/cs26/comgmdes\",\"/cs26/tcowo\"];function isModifiedClick(event){return event.button!==0||event.metaKey||event.ctrlKey||event.shiftKey||event.altKey;}function readPathname(){if(typeof window!==\"undefined\")return window.location.pathname;return\"\";}function resolveCurrentFlow(pathname){if(pathname.startsWith(\"/fintech/home\"))return\"fintech\";if(pathname.startsWith(\"/guidehouse/home\"))return\"data\";return null;}function resolveHomePath(flow){if(flow===\"fintech\")return\"/fintech/home\";return\"/guidehouse/home\";}function isCaseStudyHref(href){return/^\\/cs26\\//.test(href);}function toPathname(urlOrPath){if(typeof window===\"undefined\")return urlOrPath;try{return new URL(urlOrPath,window.location.origin).pathname;}catch(error){return urlOrPath;}}function readSavedFlow(){if(typeof window===\"undefined\")return null;try{const value=window.sessionStorage.getItem(FLOW_STORAGE_KEY);return value===\"fintech\"||value===\"data\"?value:null;}catch(error){return null;}}function writeSavedFlow(flow){if(typeof window!==\"undefined\"){try{window.sessionStorage.setItem(FLOW_STORAGE_KEY,flow);}catch(error){// ignore storage access errors\n}}}export function withCaseStudyFlowTracking(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const handleClickCapture=event=>{props.onClickCapture?.(event);if(event.defaultPrevented||isModifiedClick(event))return;const pathname=readPathname();const flow=resolveCurrentFlow(pathname);if(!flow)return;const target=event.target;const anchor=target?.closest?.(\"a[href]\");if(!anchor)return;const destinationPath=toPathname(anchor.getAttribute(\"href\")||\"\");if(!isCaseStudyHref(destinationPath))return;writeSavedFlow(flow);};return /*#__PURE__*/_jsx(Component,{ref:ref,...props,onClickCapture:handleClickCapture});});}export function withDynamicCaseStudyNext(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const handleClick=event=>{if(isModifiedClick(event)){props.onClick?.(event);return;}const savedFlow=readSavedFlow();if(!savedFlow){props.onClick?.(event);return;}const sequence=unifiedGuidehouseSequence;const currentPath=readPathname();const currentIndex=sequence.indexOf(currentPath);if(currentIndex===-1||currentIndex>=sequence.length-1){props.onClick?.(event);return;}const nextPath=sequence[currentIndex+1];if(typeof window!==\"undefined\"){event.preventDefault();window.location.assign(nextPath);return;}props.onClick?.(event);};return /*#__PURE__*/_jsx(Component,{ref:ref,...props,onClick:handleClick});});}export function withSectionHomeLink(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const handleClick=event=>{if(isModifiedClick(event)){props.onClick?.(event);return;}if(typeof window===\"undefined\"){props.onClick?.(event);return;}const firstSegment=window.location.pathname.split(\"/\").filter(Boolean)[0];if(!firstSegment){props.onClick?.(event);return;}let targetFlow=null;if(firstSegment===\"fintech\"||firstSegment===\"data\"){targetFlow=firstSegment;}else if(firstSegment===\"cs26\"){targetFlow=readSavedFlow();}if(!targetFlow){props.onClick?.(event);return;}event.preventDefault();window.location.assign(`${window.location.origin}${resolveHomePath(targetFlow)}`);};return /*#__PURE__*/_jsx(Component,{ref:ref,...props,onClick:handleClick});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withDynamicCaseStudyNext\":{\"type\":\"reactHoc\",\"name\":\"withDynamicCaseStudyNext\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCaseStudyFlowTracking\":{\"type\":\"reactHoc\",\"name\":\"withCaseStudyFlowTracking\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSectionHomeLink\":{\"type\":\"reactHoc\",\"name\":\"withSectionHomeLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Case_Study_Flow_Overrides.map"],"mappings":"2HAG8U,SAAS,EAAgB,EAAM,CAAC,OAAO,EAAM,SAAS,GAAG,EAAM,SAAS,EAAM,SAAS,EAAM,UAAU,EAAM,MAAO,CAAC,SAAS,GAAc,CAAgE,OAArD,IAAS,OAAkD,GAA/B,EAAO,SAAS,QAAkB,CAAC,SAAS,EAAmB,EAAS,CAAiH,OAA7G,EAAS,WAAW,eAAe,EAAQ,UAAa,EAAS,WAAW,kBAAkB,EAAQ,OAAc,IAAK,CAAC,SAAS,EAAgB,EAAK,CAA2C,OAAvC,IAAO,UAAgB,gBAAsB,kBAAmB,CAAC,SAAS,EAAgB,EAAK,CAAC,MAAM,YAAY,KAAK,CAAI,CAAE,CAAC,SAAS,EAAW,EAAU,CAAC,GAAU,IAAS,OAAY,OAAO,EAAU,GAAG,CAAC,OAAO,IAAI,IAAI,EAAU,EAAO,SAAS,MAAM,CAAC,CAAC,QAAS,MAAa,CAAC,OAAO,CAAU,CAAC,CAAC,SAAS,GAAe,CAAC,GAAU,IAAS,OAAY,OAAO,KAAK,GAAG,CAAC,IAAM,EAAM,EAAO,eAAe,QAAQ,CAAgB,EAAE,OAAO,IAAQ,WAAW,IAAQ,OAAO,EAAM,IAAK,MAAa,CAAC,OAAO,IAAK,CAAC,CAAC,SAAS,EAAe,EAAK,CAAC,GAAU,IAAS,OAAa,GAAG,CAAC,EAAO,eAAe,QAAQ,EAAiB,CAAI,CAAE,MAAa,CAC72C,CAAE,CAAC,SAAgB,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