{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/nROLN2ppOfdXfpzkYLGX/tIQgOZ1pJFvNeNQPiSGe/withRealPrice.js"],
  "sourcesContent": ["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";import{useAnimate}from\"framer-motion\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";const useStore=createStore({});var ProductTypes;(function(ProductTypes){ProductTypes[ProductTypes[\"mediation\"]=50]=\"mediation\";ProductTypes[ProductTypes[\"diyPaperwork\"]=63]=\"diyPaperwork\";ProductTypes[ProductTypes[\"weFileForYou\"]=67]=\"weFileForYou\";ProductTypes[ProductTypes[\"assistedDivorce\"]=92]=\"assistedDivorce\";ProductTypes[ProductTypes[\"fullyGuidedDivorce\"]=93]=\"fullyGuidedDivorce\";})(ProductTypes||(ProductTypes={}));const fetchStatuses={};const fetchPriceFromAPI=async params=>{const fetchKey=JSON.stringify(params);if(fetchStatuses[fetchKey]){return null;}fetchStatuses[fetchKey]=true;const baseUrl=window.location.hostname.includes(\"divorce.com\")?\"https://divorce.com\":\"https://staging.completecase.com:8190\";const url=new URL(\"/api/v2/product-prices/\",baseUrl);url.search=new URLSearchParams(params).toString();const response=await fetch(url.toString());const data=await response.json();fetchStatuses[fetchKey]=false;return data;};const getPriceString=(price,affirm)=>affirm?`4 payments of $${Number(price/4).toLocaleString(\"en-US\")}/mo`:`$${Number(price).toLocaleString(\"en-US\")}`;const withRealPriceFactory=(Component,productType,affirm)=>props=>{const[store,setStore]=useStore();const[scope,animate]=useAnimate();const price=store[productType]||0;useEffect(()=>{const getAndSetPrice=async()=>{const params={product_types:productType};const data=await fetchPriceFromAPI(params);data&&setStore({...store,[productType]:data[productType]});};!price&&getAndSetPrice();},[]);useEffect(()=>{price&&animate(scope.current,{opacity:1},{duration:.1});},[price]);const newPrors=price?{...props,text:getPriceString(price,affirm)}:{...props,initial:{opacity:0}};return /*#__PURE__*/_jsx(Component,{...newPrors,ref:scope});};export function withMediationRealPrice(Component){return withRealPriceFactory(Component,50,false);}export function withDiyPaperworkRealPrice(Component){return withRealPriceFactory(Component,63,false);}export function withWeFileForYouRealPrice(Component){return withRealPriceFactory(Component,67,false);}export function withAssistedDivorceRealPrice(Component){return withRealPriceFactory(Component,92,false);}export function withFullyGuidedDivorceRealPrice(Component){return withRealPriceFactory(Component,93,false);}export function withDiyPaperworkAffirmRealPrice(Component){return withRealPriceFactory(Component,63,true);}export function withWeFileForYouAffirmRealPrice(Component){return withRealPriceFactory(Component,67,true);}export function withAssistedDivorceAffirmRealPrice(Component){return withRealPriceFactory(Component,92,true);}export function withFullyGuidedDivorceAffirmRealPrice(Component){return withRealPriceFactory(Component,93,true);}\nexport const __FramerMetadata__ = {\"exports\":{\"withFullyGuidedDivorceAffirmRealPrice\":{\"type\":\"reactHoc\",\"name\":\"withFullyGuidedDivorceAffirmRealPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withWeFileForYouRealPrice\":{\"type\":\"reactHoc\",\"name\":\"withWeFileForYouRealPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withDiyPaperworkRealPrice\":{\"type\":\"reactHoc\",\"name\":\"withDiyPaperworkRealPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withWeFileForYouAffirmRealPrice\":{\"type\":\"reactHoc\",\"name\":\"withWeFileForYouAffirmRealPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withFullyGuidedDivorceRealPrice\":{\"type\":\"reactHoc\",\"name\":\"withFullyGuidedDivorceRealPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withAssistedDivorceAffirmRealPrice\":{\"type\":\"reactHoc\",\"name\":\"withAssistedDivorceAffirmRealPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withMediationRealPrice\":{\"type\":\"reactHoc\",\"name\":\"withMediationRealPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withDiyPaperworkAffirmRealPrice\":{\"type\":\"reactHoc\",\"name\":\"withDiyPaperworkAffirmRealPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withAssistedDivorceRealPrice\":{\"type\":\"reactHoc\",\"name\":\"withAssistedDivorceRealPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./withRealPrice.map"],
  "mappings": "uLAAAA,IAAmL,IAAMC,EAASC,EAAY,CAAC,CAAC,EAAMC,GAAc,SAASA,EAAa,CAACA,EAAaA,EAAa,UAAa,EAAE,EAAE,YAAYA,EAAaA,EAAa,aAAgB,EAAE,EAAE,eAAeA,EAAaA,EAAa,aAAgB,EAAE,EAAE,eAAeA,EAAaA,EAAa,gBAAmB,EAAE,EAAE,kBAAkBA,EAAaA,EAAa,mBAAsB,EAAE,EAAE,oBAAqB,GAAGA,IAAeA,EAAa,CAAC,EAAE,EAAE,IAAMC,EAAc,CAAC,EAAQC,EAAkB,MAAMC,GAAQ,CAAC,IAAMC,EAAS,KAAK,UAAUD,CAAM,EAAE,GAAGF,EAAcG,CAAQ,EAAG,OAAO,KAAMH,EAAcG,CAAQ,EAAE,GAAK,IAAMC,EAAQ,OAAO,SAAS,SAAS,SAAS,aAAa,EAAE,sBAAsB,wCAA8CC,EAAI,IAAI,IAAI,0BAA0BD,CAAO,EAAEC,EAAI,OAAO,IAAI,gBAAgBH,CAAM,EAAE,SAAS,EAA6C,IAAMI,EAAK,MAAvC,MAAM,MAAMD,EAAI,SAAS,CAAC,GAA4B,KAAK,EAAE,OAAAL,EAAcG,CAAQ,EAAE,GAAaG,CAAK,EAAQC,EAAe,CAACC,EAAMC,IAASA,EAAO,kBAAkB,OAAOD,EAAM,CAAC,EAAE,eAAe,OAAO,CAAC,MAAM,IAAI,OAAOA,CAAK,EAAE,eAAe,OAAO,CAAC,GAASE,EAAqB,CAACC,EAAUC,EAAYH,IAASI,GAAO,CAAC,GAAK,CAACC,EAAMC,CAAQ,EAAElB,EAAS,EAAO,CAACmB,EAAMC,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,EAAsCnB,EAAU,CAAC,OAAOD,EAAqBC,EAAU,GAAG,EAAI,CAAE",
  "names": ["init_ssg_sandbox_shims", "useStore", "createStore", "ProductTypes", "fetchStatuses", "fetchPriceFromAPI", "params", "fetchKey", "baseUrl", "url", "data", "getPriceString", "price", "affirm", "withRealPriceFactory", "Component", "productType", "props", "store", "setStore", "scope", "animate", "useAnimate", "ue", "newPrors", "p", "withMediationRealPrice", "withDiyPaperworkRealPrice", "withWeFileForYouRealPrice", "withAssistedDivorceRealPrice", "withFullyGuidedDivorceRealPrice", "withDiyPaperworkAffirmRealPrice", "withWeFileForYouAffirmRealPrice", "withAssistedDivorceAffirmRealPrice", "withFullyGuidedDivorceAffirmRealPrice"]
}
