{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/3WzpOjkWQD1zQ5VgFiI9/c7ss9MJwkYZ9RAiOcRVh/formatPrice.js", "ssg:https://framerusercontent.com/modules/jnnCLGtZYuPkmvLMBNFM/4xYRdkkneHn6UrY2ueuQ/siteAPI.js", "ssg:https://framerusercontent.com/modules/avVU2TMYNmGrmUI4jLF1/Wyga4RgrLGAJFUKvaAT9/Pricing.js"],
  "sourcesContent": ["export function formatPrice(amount, currency, round = true) {\n  const priceFormatter = new Intl.NumberFormat(\"en-US\", {\n    style: \"currency\",\n    currency,\n    minimumFractionDigits: round ? 0 : 2,\n    maximumFractionDigits: round ? 0 : 2\n  });\n  return priceFormatter.format(amount);\n}\nexport const __FramerMetadata__ = {\n  \"exports\": {\n    \"formatPrice\": {\n      \"type\": \"function\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"__FramerMetadata__\": {\n      \"type\": \"variable\"\n    }\n  }\n};\n//# sourceMappingURL=./formatPrice.map", "const api = \"https://api.framer.com/site\";\nexport async function getLocalPrices() {\n  const res = await fetch(`${api}/prices`);\n  const data = await res.json();\n  return data;\n}\nexport const __FramerMetadata__ = {\n  \"exports\": {\n    \"PlanSiteTier\": {\n      \"type\": \"tsType\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"PlanTeamTier\": {\n      \"type\": \"tsType\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"PlanName\": {\n      \"type\": \"tsType\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"getLocalPrices\": {\n      \"type\": \"function\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"PlanPeriod\": {\n      \"type\": \"tsType\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"Plans\": {\n      \"type\": \"tsType\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"TeamOrSitePlanName\": {\n      \"type\": \"tsType\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"Plan\": {\n      \"type\": \"tsType\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"__FramerMetadata__\": {\n      \"type\": \"variable\"\n    }\n  }\n};\n//# sourceMappingURL=./siteAPI.map", "import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useEffect } from \"react\";\nimport { createStore } from \"https://framer.com/m/framer/store.js@^1.0.0\";\nimport { formatPrice } from \"https://framerusercontent.com/modules/3WzpOjkWQD1zQ5VgFiI9/c7ss9MJwkYZ9RAiOcRVh/formatPrice.js\";\nimport { getLocalPrices } from \"https://framerusercontent.com/modules/jnnCLGtZYuPkmvLMBNFM/4xYRdkkneHn6UrY2ueuQ/siteAPI.js\";\nconst fallbackPrices = {\n  mini_site_yearly: {\n    price: 60,\n    currency: \"USD\"\n  },\n  mini_site_monthly: {\n    price: 10,\n    currency: \"USD\"\n  },\n  basic_site_yearly: {\n    price: 180,\n    currency: \"USD\"\n  },\n  basic_site_monthly: {\n    price: 20,\n    currency: \"USD\"\n  },\n  pro_site_yearly: {\n    price: 300,\n    currency: \"USD\"\n  },\n  pro_site_monthly: {\n    price: 30,\n    currency: \"USD\"\n  },\n  basic_team_yearly: {\n    price: 240,\n    currency: \"USD\"\n  },\n  basic_team_monthly: {\n    price: 25,\n    currency: \"USD\"\n  },\n  pro_team_yearly: {\n    price: 445,\n    currency: \"USD\"\n  },\n  pro_team_monthly: {\n    price: 45,\n    currency: \"USD\"\n  }\n};\nconst useStore = createStore({\n  period: \"yearly\",\n  hasLocalPrices: false,\n  prices: fallbackPrices\n}); // ======\n// PERIOD\n// ======\nexport function withPeriodToggle(Component) {\n  return props => {\n    const [store, setStore] = useStore();\n    function handleToggle() {\n      if (store.period === \"yearly\") {\n        setStore({\n          period: \"monthly\"\n        });\n      }\n      if (store.period === \"monthly\") {\n        setStore({\n          period: \"yearly\"\n        });\n      }\n    }\n    return /*#__PURE__*/_jsx(Component, {\n      ...props,\n      variant: store.period === \"yearly\" ? \"On\" : \"Off\",\n      onToggle: handleToggle\n    });\n  };\n} // ======\n// PRICES\n// ======\nconst toMonthlyNotation = plan => `${formatPrice(plan.price, plan.currency)}/mo`;\nexport const useLocalPrice = (plan, monthly = true) => {\n  const [{\n    prices,\n    hasLocalPrices,\n    period\n  }, setStore] = useStore();\n  const {\n    price,\n    currency\n  } = prices[`${plan}_${period}`];\n  const priceForPeriod = period === \"yearly\" ? price / 12 : price;\n  const formattedPrice = formatPrice(priceForPeriod, currency);\n  return {\n    price: priceForPeriod,\n    currency,\n    formatted: monthly ? `${formattedPrice}/mo` : formattedPrice,\n    show: hasLocalPrices\n  };\n};\nexport function withLocalPricesFetcher(Component) {\n  return props => {\n    const [_, setStore] = useStore();\n    const fetchLocalPrices = async () => {\n      try {\n        const localPrices = await getLocalPrices();\n        setStore({\n          prices: localPrices,\n          hasLocalPrices: true\n        });\n      } catch (error) {\n        setStore({\n          hasLocalPrices: true\n        });\n      }\n    };\n    useEffect(() => {\n      fetchLocalPrices();\n    }, []);\n    return /*#__PURE__*/_jsx(Component, {\n      ...props\n    });\n  };\n}\nfunction createPriceComponent(plan, Component) {\n  return props => {\n    const isFree = plan === \"free\";\n    const {\n      formatted,\n      currency,\n      show\n    } = useLocalPrice(isFree ? \"basic_site\" : plan, false);\n    const text = isFree ? formatPrice(0, currency) : formatted;\n    return /*#__PURE__*/_jsx(Component, {\n      ...props,\n      text: text,\n      initial: {\n        opacity: 0\n      },\n      animate: {\n        opacity: show ? 1 : 0\n      },\n      transition: {\n        duration: .2\n      }\n    });\n  };\n}\nexport function withPriceFree(Component) {\n  return createPriceComponent(\"free\", Component);\n}\nexport function withPriceMini(Component) {\n  return createPriceComponent(\"mini_site\", Component);\n}\nexport function withPriceBasic(Component) {\n  return createPriceComponent(\"basic_site\", Component);\n}\nexport function withPricePro(Component) {\n  return createPriceComponent(\"pro_site\", Component);\n}\nexport function withPriceTeamBasic(Component) {\n  return createPriceComponent(\"basic_team\", Component);\n}\nexport function withPriceTeamPro(Component) {\n  return createPriceComponent(\"pro_team\", Component);\n} // ==========\n// CALCULATOR\n// ==========\nconst useCalculator = createStore({\n  mini_site: 0,\n  basic_site: 1,\n  pro_site: 0,\n  basic_team: 1\n});\nconst usePlanCalculator = (plan, min = 0, max = 10) => {\n  const [calculator, setCalculator] = useCalculator();\n  const {\n    price,\n    currency,\n    show\n  } = useLocalPrice(plan);\n  const amount = calculator[plan];\n  let total = amount * price;\n  function handlePlus() {\n    if (amount < max) {\n      setCalculator({\n        [plan]: amount + 1\n      });\n    }\n  }\n  function handleMinus() {\n    if (amount > min) {\n      setCalculator({\n        [plan]: amount - 1\n      });\n    }\n  } // First editor is free\n  if (plan === \"basic_team\" && amount < 2) {\n    total = 0;\n  }\n  return {\n    handleMinus,\n    handlePlus,\n    amount,\n    total,\n    formatted: toMonthlyNotation({\n      price: total,\n      currency\n    }),\n    price,\n    currency,\n    show\n  };\n};\nexport function withCalculatorSumTotal(Component) {\n  return props => {\n    const mini = usePlanCalculator(\"mini_site\");\n    const basic = usePlanCalculator(\"basic_site\");\n    const pro = usePlanCalculator(\"pro_site\");\n    const team = usePlanCalculator(\"basic_team\", 1);\n    const total = mini.total + basic.total + pro.total + team.total;\n    const getBusinessPlan = team.amount === 10;\n    const [{\n      hasLocalPrices\n    }] = useStore();\n    return /*#__PURE__*/_jsx(Component, {\n      ...props,\n      text: formatPrice(total, basic.currency),\n      initial: {\n        opacity: 0\n      },\n      animate: {\n        opacity: hasLocalPrices ? 1 : 0\n      },\n      transition: {\n        duration: .2\n      }\n    });\n  };\n}\nfunction createCalculatorTotalComponent(plan, Component) {\n  return props => {\n    const {\n      formatted,\n      show\n    } = usePlanCalculator(plan);\n    return /*#__PURE__*/_jsx(Component, {\n      ...props,\n      text: formatted,\n      initial: {\n        opacity: 0\n      },\n      animate: {\n        opacity: show ? 1 : 0\n      },\n      transition: {\n        duration: .2\n      }\n    });\n  };\n}\nexport function withCalculatorMiniTotal(Component) {\n  return createCalculatorTotalComponent(\"mini_site\", Component);\n}\nexport function withCalculatorBasicTotal(Component) {\n  return createCalculatorTotalComponent(\"basic_site\", Component);\n}\nexport function withCalculatorProTotal(Component) {\n  return createCalculatorTotalComponent(\"pro_site\", Component);\n}\nexport function withCalculatorTeamBasicTotal(Component) {\n  return createCalculatorTotalComponent(\"basic_team\", Component);\n}\nfunction createCalculatorAmountComponent(plan, Component) {\n  return props => {\n    const {\n      handleMinus,\n      handlePlus,\n      amount\n    } = usePlanCalculator(plan, plan === \"basic_team\" ? 1 : 0);\n    return /*#__PURE__*/_jsx(Component, {\n      ...props,\n      amount: `${amount}`,\n      plus: handlePlus,\n      minus: handleMinus\n    });\n  };\n}\nexport function withAmountMini(Component) {\n  return createCalculatorAmountComponent(\"mini_site\", Component);\n}\nexport function withAmountBasic(Component) {\n  return createCalculatorAmountComponent(\"basic_site\", Component);\n}\nexport function withAmountPro(Component) {\n  return createCalculatorAmountComponent(\"pro_site\", Component);\n}\nexport function withAmountTeamBasic(Component) {\n  return createCalculatorAmountComponent(\"basic_team\", Component);\n}\nfunction createMonthlyPrice(plan, Component) {\n  return props => {\n    const isFree = plan === \"free\";\n    const {\n      formatted,\n      currency,\n      show\n    } = useLocalPrice(isFree ? \"basic_site\" : plan, false);\n    const text = isFree ? formatPrice(0, currency) : formatted;\n    return /*#__PURE__*/_jsx(Component, {\n      ...props,\n      text: `${text}/mo`\n    });\n  };\n}\nexport function withMonthlyPriceFree(Component) {\n  return createMonthlyPrice(\"free\", Component);\n}\nexport function withMonthlyPriceMini(Component) {\n  return createMonthlyPrice(\"mini_site\", Component);\n}\nexport function withMonthlyPriceBasic(Component) {\n  return createMonthlyPrice(\"basic_site\", Component);\n}\nexport function withMonthlyPricePro(Component) {\n  return createMonthlyPrice(\"pro_site\", Component);\n}\nexport const __FramerMetadata__ = {\n  \"exports\": {\n    \"withAmountPro\": {\n      \"type\": \"reactHoc\",\n      \"name\": \"withAmountPro\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"withAmountMini\": {\n      \"type\": \"reactHoc\",\n      \"name\": \"withAmountMini\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"withMonthlyPriceBasic\": {\n      \"type\": \"reactHoc\",\n      \"name\": \"withMonthlyPriceBasic\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"withCalculatorBasicTotal\": {\n      \"type\": \"reactHoc\",\n      \"name\": \"withCalculatorBasicTotal\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"withPriceTeamPro\": {\n      \"type\": \"reactHoc\",\n      \"name\": \"withPriceTeamPro\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"withAmountBasic\": {\n      \"type\": \"reactHoc\",\n      \"name\": \"withAmountBasic\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"withCalculatorMiniTotal\": {\n      \"type\": \"reactHoc\",\n      \"name\": \"withCalculatorMiniTotal\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"withPeriodToggle\": {\n      \"type\": \"reactHoc\",\n      \"name\": \"withPeriodToggle\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"withCalculatorSumTotal\": {\n      \"type\": \"reactHoc\",\n      \"name\": \"withCalculatorSumTotal\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"withMonthlyPriceFree\": {\n      \"type\": \"reactHoc\",\n      \"name\": \"withMonthlyPriceFree\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"withCalculatorProTotal\": {\n      \"type\": \"reactHoc\",\n      \"name\": \"withCalculatorProTotal\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"withPriceFree\": {\n      \"type\": \"reactHoc\",\n      \"name\": \"withPriceFree\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"withCalculatorTeamBasicTotal\": {\n      \"type\": \"reactHoc\",\n      \"name\": \"withCalculatorTeamBasicTotal\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"withPriceBasic\": {\n      \"type\": \"reactHoc\",\n      \"name\": \"withPriceBasic\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"withPriceTeamBasic\": {\n      \"type\": \"reactHoc\",\n      \"name\": \"withPriceTeamBasic\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"withAmountTeamBasic\": {\n      \"type\": \"reactHoc\",\n      \"name\": \"withAmountTeamBasic\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"withPriceMini\": {\n      \"type\": \"reactHoc\",\n      \"name\": \"withPriceMini\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"withMonthlyPricePro\": {\n      \"type\": \"reactHoc\",\n      \"name\": \"withMonthlyPricePro\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"withPricePro\": {\n      \"type\": \"reactHoc\",\n      \"name\": \"withPricePro\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"useLocalPrice\": {\n      \"type\": \"variable\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"withMonthlyPriceMini\": {\n      \"type\": \"reactHoc\",\n      \"name\": \"withMonthlyPriceMini\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"withLocalPricesFetcher\": {\n      \"type\": \"reactHoc\",\n      \"name\": \"withLocalPricesFetcher\",\n      \"annotations\": {\n        \"framerContractVersion\": \"1\"\n      }\n    },\n    \"__FramerMetadata__\": {\n      \"type\": \"variable\"\n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R,CAAS,CACpD,CACO,SAASe,EAAef,EAAW,CACxC,OAAOQ,EAAqB,aAAcR,CAAS,CACrD,CACO,SAASgB,EAAahB,EAAW,CACtC,OAAOQ,EAAqB,WAAYR,CAAS,CACnD,CACO,SAASiB,EAAmBjB,EAAW,CAC5C,OAAOQ,EAAqB,aAAcR,CAAS,CACrD,CACO,SAASkB,EAAiBlB,EAAW,CAC1C,OAAOQ,EAAqB,WAAYR,CAAS,CACnD,CAGA,IAAMmB,EAAgBC,EAAY,CAChC,UAAW,EACX,WAAY,EACZ,SAAU,EACV,WAAY,CACd,CAAC",
  "names": ["formatPrice", "amount", "currency", "round", "api", "getLocalPrices", "fallbackPrices", "useStore", "createStore", "withPeriodToggle", "Component", "props", "store", "setStore", "handleToggle", "p", "useLocalPrice", "plan", "monthly", "prices", "hasLocalPrices", "period", "setStore", "useStore", "price", "currency", "priceForPeriod", "formattedPrice", "formatPrice", "withLocalPricesFetcher", "Component", "props", "_", "fetchLocalPrices", "localPrices", "getLocalPrices", "ue", "p", "createPriceComponent", "isFree", "formatted", "show", "text", "withPriceFree", "withPriceMini", "withPriceBasic", "withPricePro", "withPriceTeamBasic", "withPriceTeamPro", "useCalculator", "createStore"]
}
