{ "version": 3, "sources": ["../../javascript/utilities/centsToPrice.ts"], "sourcesContent": ["const centsToPrice = (cents: number, currency: string) => {\n if (!currency) {\n return \"\"\n }\n let [_, country, locale] = window.location.pathname.split(\"/\")\n\n // E.g. locale format should be en-GB.\n if (locale === \"en-GB\") {\n locale = \"en\"\n }\n\n const number = new Intl.NumberFormat(`${locale}-${country}`, {\n style: \"currency\",\n currency: currency,\n currencyDisplay: currency === \"JPY\" ? \"name\" : \"symbol\"\n } as any)\n\n const numberFormat = number.format(currency === \"JPY\" ? cents : cents / 100)\n\n const euroLocales = [\"fr\", \"en\", \"es\", \"pt\", \"it\", \"de\"]\n\n // This ensures that euro prices are formatted consitently.\n if (country !== \"GB\" && euroLocales.includes(locale)) {\n const parts = number.formatToParts()\n\n const currencySymbol = parts.find(\n (option) => option.type === \"currency\"\n )?.value\n\n const euroNumberFormat = numberFormat\n .replace(`${currencySymbol}`, \"\")\n .trim()\n\n return currencySymbol + euroNumberFormat\n } else {\n return numberFormat\n }\n}\n\nexport default centsToPrice\n"], "mappings": "AAAA,IAAMA,EAAe,CAACC,EAAeC,IAAqB,CAA1D,IAAAC,EACE,GAAI,CAACD,EACH,MAAO,GAET,GAAI,CAACE,EAAGC,EAASC,CAAM,EAAI,OAAO,SAAS,SAAS,MAAM,GAAG,EAGzDA,IAAW,UACbA,EAAS,MAGX,IAAMC,EAAS,IAAI,KAAK,aAAa,GAAGD,KAAUD,IAAW,CAC3D,MAAO,WACP,SAAUH,EACV,gBAAiBA,IAAa,MAAQ,OAAS,QACjD,CAAQ,EAEFM,EAAeD,EAAO,OAAOL,IAAa,MAAQD,EAAQA,EAAQ,GAAG,EAK3E,GAAII,IAAY,MAHI,CAAC,KAAM,KAAM,KAAM,KAAM,KAAM,IAAI,EAGnB,SAASC,CAAM,EAAG,CAGpD,IAAMG,GAAiBN,EAFTI,EAAO,cAAc,EAEN,KAC1BG,GAAWA,EAAO,OAAS,UAC9B,IAFuB,YAAAP,EAEpB,MAEGQ,EAAmBH,EACtB,QAAQ,GAAGC,IAAkB,EAAE,EAC/B,KAAK,EAER,OAAOA,EAAiBE,CAC1B,KACE,QAAOH,CAEX,EAEOI,EAAQZ", "names": ["centsToPrice", "cents", "currency", "_a", "_", "country", "locale", "number", "numberFormat", "currencySymbol", "option", "euroNumberFormat", "centsToPrice_default"] }