import { getAssetPath, Build } from '@stencil/core'; export function formatCurrency(amount) { const formatter = new Intl.NumberFormat('en-GB', { style: 'currency', currency: 'GBP', minimumFractionDigits: 2, }); return formatter.format(amount / 100); } export function getConfig() { const config: AppConfig = { maxQuantity: 9, minTotal: 2000, }; return config; } export function checkIsNumber(event) { var charCode = event.which ? event.which : event.keyCode; if (charCode > 31 && (charCode < 48 || charCode > 57)) { event.preventDefault(); return false; } return true; } export function resolveAsset(url) { if (Build.isDev) { return getAssetPath(url); } // Strip out assets const assetPrefixes = ['../assets/', '/assets/', 'assets/']; let strippedPath = url; assetPrefixes.forEach(prefix => { if (strippedPath.indexOf(prefix) === 0) { strippedPath = strippedPath.substring(prefix.length); } }); url = strippedPath; return 'https://cdn.jsdelivr.net/npm/cobble-lane-subscriptions-club@latest/dist/cobble-lane-subscriptions/assets/' + url; }