{"version":3,"file":"Checkout.CP4ECUft.mjs","names":[],"sources":["https:/framerusercontent.com/modules/3UxBJlAFsxvp1Qhtwbnd/RuJja9qNwsg69OPjKHT8/Checkout.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import{useEffect,useState}from\"react\";import{initializeApp,getApps}from\"firebase/app\";import{getFirestore,collection,addDoc,getDoc,doc,serverTimestamp}from\"firebase/firestore\";const firebaseConfig={apiKey:\"AIzaSyBJPcVMy7eXhLG-a_jpqDuoX4BBBU5_-GY\",authDomain:\"forge-du-nord.firebaseapp.com\",projectId:\"forge-du-nord\",storageBucket:\"forge-du-nord.firebasestorage.app\",messagingSenderId:\"123368301614\",appId:\"1:123368301614:web:4beb7e9f777cc796c36bbf\",measurementId:\"G-5QSGNN9X5J\"};if(!getApps().length){initializeApp(firebaseConfig);}export const db=getFirestore();// Learn more: https://www.framer.com/developers/overrides/\n// Charger le panier depuis `localStorage`\nconst initialCart=JSON.parse(localStorage.getItem(getCartStorageKey()))||[];const initialZipcode=localStorage.getItem(\"zipcode\")||\"\";//console.log(\"initialCart = \", initialCart)\nconst useStore=createStore({cart:initialCart,//overlayVisible: false,\nzipcode:initialZipcode});// Fonction pour mettre à jour `localStorage` après chaque modification du panier\nfunction updateLocalStorage(store){localStorage.setItem(getCartStorageKey(),JSON.stringify(store.cart));}function isTestModeEnabledByCookie(){if(typeof document===\"undefined\")return false;return document.cookie.split(\";\").some(c=>c.trim()===\"mode=TEST\");}function getCartStorageKey(){return isTestModeEnabledByCookie()?\"cart-test\":\"cart\";}function isLiveMode(){return!isTestModeEnabledByCookie();}export async function logZipcodeEntry(zipcode){const fsa=zipcode.trim().toUpperCase().slice(0,3);try{await addDoc(collection(db,\"zipcode_entries\"),{fsa,timestamp:serverTimestamp()});console.log(\"📬 Code postal enregistr\\xe9 :\",fsa);}catch(error){console.error(\"❌ Erreur Firestore :\",error);}}export async function getStockBySkuId(skuId){if(!skuId){console.warn(\"SKU ID manquant pour getStockBySkuId\");return null;}try{const ref=doc(db,\"stocks\",skuId);const snap=await getDoc(ref);if(!snap.exists()){console.warn(\"⚠️ Aucun document Firestore pour SKU :\",skuId);return null;}const data=snap.data();console.log(\"📦 Stock Firestore :\",skuId,data);return data;}catch(error){console.error(\"❌ Erreur Firestore dans getStockBySkuId :\",error);return null;}}//HEADER\nexport function withCartCounter(Component){return props=>{const[store]=useStore();const cartItemCount=store.cart?.reduce((sum,item)=>sum+(item.quantity||0),0);const displayCounter=cartItemCount>0;//console.log(\"cartItemCount = \", cartItemCount)\n//console.log(\"displayCounter = \", displayCounter)\nreturn /*#__PURE__*/_jsx(Component,{...props,displayCounter:displayCounter,count:cartItemCount});};}export function withTestLabel(Component){return props=>{const isLive=isLiveMode();return /*#__PURE__*/_jsx(Component,{...props,isLive:isLive});};}//PDP\nexport function withStockAvailable(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,quantityAvailable:5});};}export function withZipcodeForm(Component){return props=>{const[store,setStore]=useStore();const handleSubmit=async event=>{//event.preventDefault()\nconsole.log(\"withZipcodeForm : \",event);const zipcode=event.toString().trim();if(zipcode){console.log(\"📦 Code postal re\\xe7u :\",zipcode);// 1. Mise à jour du localStorage\nlocalStorage.setItem(\"zipcode\",zipcode);// 2. Mise à jour du store global\nsetStore({...store,zipcode});// 3. Tentative d'enregistrement Firestore\ntry{await logZipcodeEntry(zipcode);}catch(error){console.error(\"❌ Erreur lors de l'enregistrement Firestore :\",error);}}};const handleDelete=async event=>{console.log(\"🗑️ Suppression du code postal\");// 1. Suppression du localStorage\nlocalStorage.removeItem(\"zipcode\");// 2. Reset du store\nsetStore({...store,zipcode:\"\"});};return /*#__PURE__*/_jsx(Component,{...props,onSubmit:handleSubmit,onDelete:handleDelete,currentPostalCode:store.zipcode});};}export function withDeliveryPrice(Component){return props=>{const[store]=useStore();const{zipcode}=store;const FREE_SHIPPING_FSAS=[\"H1A\",\"H1B\",\"H1C\",\"H1E\",\"H1G\",\"H1H\",\"H1J\",\"H1K\",\"H1L\",\"H1M\",\"H1N\",\"H1P\",\"H1R\",\"H1S\",\"H1T\",\"H1V\",\"H1W\",\"H1X\",\"H1Y\",\"H1Z\",\"H2A\",\"H2B\",\"H2C\",\"H2E\",\"H2G\",\"H2H\",\"H2J\",\"H2K\",\"H2L\",\"H2M\",\"H2N\",\"H2P\",\"H2R\",\"H2S\",\"H2T\",\"H2V\",\"H2W\",\"H2X\",\"H2Y\",\"H2Z\",\"H3A\",\"H3B\",\"H3C\",\"H3E\",\"H3G\",\"H3H\",\"H3J\",\"H3K\",\"H3L\",\"H3M\",\"H3N\",\"H3R\",\"H3S\",\"H3T\",\"H3V\",\"H3W\",\"H3X\",\"H3Y\",\"H3Z\",\"H4A\",\"H4B\",\"H4C\",\"H4E\",\"H4G\",\"H4H\",\"H4J\",\"H4K\",\"H4L\",\"H4M\",\"H4N\",\"H4R\",\"H4S\",\"H4T\",\"H4V\",\"H7A\",\"H7B\",\"H7C\",\"H7E\",\"H7G\",\"H7H\",\"H7J\",\"H7K\",\"H7L\",\"H7M\",\"H7N\",\"H7P\",\"H7R\",\"H7S\",\"H7T\",\"H7V\",\"J4G\",\"J4H\",\"J4J\",\"J4K\",\"J4L\",\"J4M\",\"J4N\",\"J4P\",\"J4R\",\"J4S\",\"J5K\",\"J5L\",\"J6T\",\"J6X\",\"J7A\",\"J7B\",\"J7C\",\"J7E\",\"J7G\",\"J7H\"];let variant=\"Check\";let postalCodeShort=\"\";if(zipcode){const cleaned=zipcode.trim().toUpperCase();postalCodeShort=cleaned.slice(0,3);if(FREE_SHIPPING_FSAS.includes(postalCodeShort)){variant=\"Free\";}else{variant=\"NotAvailable\";}}return /*#__PURE__*/_jsx(Component,{...props,variant:variant,postalCodeShort:postalCodeShort});};}/*export function withCartDrawer(Component): ComponentType {\n    return (props) => {\n        const [store, setStore] = useStore()\n        const componentRef = useRef(null)\n\n        const handleOnClose = () => {\n            console.log(\"❌ fermer overlay\")\n            setStore({ overlayVisible: false })\n        }\n\n        // Gérer la visibilité (via parent DOM wrapper)\n        useEffect(() => {\n            const parent = componentRef.current?.parentNode as HTMLElement\n            if (parent) {\n                parent.style.display = store.overlayVisible ? \"block\" : \"none\"\n                console.log(\"withCartDrawer\")\n            }\n        }, [store.overlayVisible])\n\n        // Gérer le scroll du body\n        useEffect(() => {\n            if (store.overlayVisible) {\n                document.body.style.overflow = \"hidden\" // 🛑 bloque le scroll\n            } else {\n                document.body.style.overflow = \"\" // ✅ rétablit le scroll\n            }\n        }, [store.overlayVisible])\n\n        return (\n            <Component\n                {...props}\n                ref={componentRef}\n                onClose={handleOnClose}\n                displayDrawer={store.overlayVisible}\n            />\n        )\n    }\n}*/export function withAddToCart(Component){return props=>{const[store,setStore]=useStore();const isLive=isLiveMode();const[variant,setVariant]=useState(\"Init\");// Au montage : log + delay + changement de variant\nuseEffect(()=>{console.log(\"🧩 AddToCart – props on mount:\",props);setVariant(\"Init\");const timer=setTimeout(()=>{setVariant(\"Default\");},1e3);return()=>clearTimeout(timer);},[]);/*useEffect(() => {\n            async function fetchStock() {\n                const stockData = await getStockBySkuId(props.skuId)\n                if (stockData) {\n                    // Par exemple :\n                    const availableQty = stockData.stock?.available ?? 0\n                    console.log(`✅ ${props.skuId} → ${availableQty} en stock`)\n                    setVariant(\"Default\")\n                    // Tu peux aussi setState pour afficher ou désactiver le bouton\n                }\n            }\n\n            if (props.skuId) {\n                fetchStock()\n            }\n        }, [props.skuId])*/const handleClick=async event=>{event.preventDefault();console.log(\"props = \",props);//const isLive = props.isLive !== false\nconst eventName=isLive?\"add_to_cart\":\"add_to_cart_test\";const effectivePriceId=isLive?props.priceId:props.priceIdTest;const effectiveProductId=isLive?props.productId:props.productIdTest;// 1) Tracking e-commerce\nif(props.skuId&&props.productName&&props.price){const ecommerceEvent={event:eventName,ecommerce:{currency:\"CAD\",value:props.price,items:[{item_id:props.skuId,item_name:props.productName,price:\"15.00\",quantity:1}]}};console.log(\"🧪 Pushing to dataLayer:\",JSON.stringify(ecommerceEvent,null,2));window.dataLayer=window.dataLayer||[];window.dataLayer.push(ecommerceEvent);}else{window.dataLayer=window.dataLayer||[];window.dataLayer.push({event:\"tracking_error\",context:\"add_to_cart\",missing:{skuId:!props.skuId,productName:!props.productName,price:!props.price},timestamp:new Date().toISOString()});console.warn(\"🚨 Tracking error in add_to_cart\",{props,context:\"add_to_cart\"});}// 2) Mise à jour du panier\nconst itemId=props.skuId||crypto.randomUUID();const rawCart=store.cart;// Gérer les formats possibles : array direct ou objet avec clé `items`\nconst existingCart=Array.isArray(rawCart)?[...rawCart]:Array.isArray(rawCart?.items)?[...rawCart.items]:[];const idx=existingCart.findIndex(item=>item.sku_id===itemId);const updatedAttributes={product_page_url:props.productPageUrl||\"\",brand_name:props.brandName||\"Marque inconnue\",color:props.color||\"Non sp\\xe9cifi\\xe9\",size:props.size||\"Taille unique\",price:props.price||\"Prix inconnu\",model_id:props.modelId||null,image:props.image||null,image_url:props.image||\"\",seller_name:props.sellerName||\"Vendeur inconnu\"};if(idx!==-1){// Article déjà présent → on met à jour toutes les infos et on incrémente\nconst existing=existingCart[idx];existingCart[idx]={...existing,quantity:existing.quantity+1,price:props.price||\"Prix inconnu\",price_id:effectivePriceId,size:props.size||\"Taille unique\",name:props.productName||existing.name,additional_attributes:updatedAttributes,productId:effectiveProductId};console.log(\"♻️ Article mis \\xe0 jour :\",existingCart[idx]);console.log(\"Event name :\",eventName);console.log(\" effectiveProductId :\",effectiveProductId);}else{// Nouvel article\nconst newItem={quantity:1,available:true,price:props.price||\"Prix inconnu\",price_id:effectivePriceId,name:props.productName||\"Produit inconnu\",additional_attributes:updatedAttributes,sku_id:itemId,productId:effectiveProductId,addToCartEventSource:\"PRODUCT_PAGE\"};existingCart.push(newItem);console.log(\"🆕 Ajout d’un nouvel article :\",newItem);console.log(\"Event name :\",eventName);console.log(\" effectiveProductId :\",effectiveProductId);}// 3) Persistance\n//setStore({ cart: existingCart, overlayVisible: true })\nsetStore({cart:existingCart});localStorage.setItem(getCartStorageKey(),JSON.stringify(existingCart));};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick,isLive:isLive});};}//CART PAGE\nexport function withQuantitySelector(Component){return props=>{const[store,setStore]=useStore();const[quantity,setQuantity]=useState(0);if(!props.skuId)return /*#__PURE__*/_jsx(\"div\",{children:\"SKU manquant\"});const cartItem=store.cart.find(item=>item.sku_id===props.skuId);useEffect(()=>{if(cartItem)setQuantity(cartItem.quantity);},[cartItem]);if(quantity===null){console.log(\"pas de quanti\\xe9 trouv\\xe9. \\xe9tat du store : \",store);return /*#__PURE__*/_jsx(\"div\",{children:\"Chargement quantit\\xe9...\"})// ou null pour fallback silencieux\n;}const handleAdd=()=>{setStore(prevStore=>{const updatedCart=prevStore.cart.map(item=>{if(item.sku_id===props.skuId){const newQuantity=item.quantity+1;setQuantity(newQuantity);return{...item,quantity:newQuantity};}return item;});updateLocalStorage({cart:updatedCart});return{cart:updatedCart};});};const handleRemove=()=>{setStore(prevStore=>{const updatedCart=prevStore.cart.map(item=>{if(item.sku_id===props.skuId){const newQuantity=Math.max(0,item.quantity-1);setQuantity(newQuantity);return{...item,quantity:newQuantity};}return item;});updateLocalStorage({cart:updatedCart});return{cart:updatedCart};});};const handleDelete=()=>{setStore(prevStore=>{const updatedCart=prevStore.cart.filter(item=>item.sku_id!==props.skuId);setQuantity(null);updateLocalStorage({cart:updatedCart});return{cart:updatedCart};});};const variant=quantity===1?\"OneQuantity\":\"Default\";return /*#__PURE__*/_jsx(Component,{...props,add:handleAdd,remove:handleRemove,deleteItem:handleDelete,quantity:quantity.toString(),variant:variant});};}export function withAddQuantity(Component){return props=>{const[store,setStore]=useStore();return /*#__PURE__*/_jsx(Component,{...props});};}export function withCloseOverlay(Component){return props=>{const[store,setStore]=useStore();const handleClick=()=>{console.log(\"❌ fermer overlay\");setStore({overlayVisible:false});};return /*#__PURE__*/_jsx(Component,{...props,onTap:handleClick});};}export function withCartList(Component){return props=>{//console.log(\"props du cart List = \", props)\nreturn /*#__PURE__*/_jsx(Component,{...props});};}export function withCartItemList(Component){return props=>{const[store]=useStore();const handleDeleteItem=async event=>{console.log(\"handleDeleteItem :\",event);};const handleChangeQtyItem=async event=>{console.log(\"handleChangeQtyItem :\",event);};return /*#__PURE__*/_jsx(Component,{...props,onDeleteItem:handleDeleteItem,onChangeQtyItem:handleChangeQtyItem});};}export function withCartItem(Component){return props=>{const[store]=useStore();// Cherche l’item dans le panier\nconst cartItem=store.cart.find(item=>item.sku_id===props.skuId);// visible = true si on a trouvé l’item\nconst isVisible=Boolean(cartItem);// quantity = quantité du panier, ou 0 si pas présent\nconst quantity=cartItem?cartItem.quantity:0;return /*#__PURE__*/_jsx(Component,{...props,isVisible:isVisible,quantity:quantity});};}export function withCartSubTotal(Component){return props=>{const[store]=useStore();const cartTotal=store.cart.reduce((sum,item)=>{const priceNum=parseFloat(item.price??0);return sum+priceNum*item.quantity;},0);return /*#__PURE__*/_jsx(Component,{...props,price:cartTotal});};}export function withCartTotal(Component){return props=>{const[store]=useStore();// Calcul du total : on s’assure de parser item.price (string ou number)\nconsole.log(\"cart = \",store.cart);console.log(\"props = \",props);const cartTotal=store.cart.reduce((sum,item)=>{const priceNum=parseFloat(item.price??0);return sum+priceNum*item.quantity;},0);console.log(\"total item = \",cartTotal);return /*#__PURE__*/_jsx(Component,{...props,price:cartTotal});};}export function withCartDetail(Component){return props=>{const[store,setStore]=useStore();// Log du panier au chargement\n// Vérifier si le panier est vide et l'initialiser avec `defaultCart`\nuseEffect(()=>{if(!store.cart||store.cart.length===0){console.log(\"🛒 Initialisation du panier avec des valeurs mock.\");//setStore({ cart: defaultCart })\n}},[])// Exécute une seule fois à l'initialisation\n;return /*#__PURE__*/_jsx(Component,{...props,cart:store.cart});};}export function withCartDetailCheckout(Component){return props=>{const[store,setStore]=useStore();// Log du panier au chargement\n// Vérifier si le panier est vide et l'initialiser avec `defaultCart`\nuseEffect(()=>{if(!store.cart||store.cart.length===0){console.log(\"🛒 Initialisation du panier avec des valeurs mock.\");//setStore({ cart: defaultCart })\n}},[])// Exécute une seule fois à l'initialisation\n;return /*#__PURE__*/_jsx(Component,{...props,items:store.cart});};}[{name:\"Grille BBQ – Inox\",quantity:1,price:250,oldPrice:0,additional_attributes:{brand_name:\"Marque inconnue\",image:{src:\"https://framerusercontent.com/images/r6y2DUV4CAYZ41K4jqirrMQGTYk.webp\",alt:\"Grille BBQ – Inox\"}}},{name:\"Tuktu Original – Noir mat\",quantity:1,price:3700,oldPrice:0,additional_attributes:{brand_name:\"Marque inconnue\",image:{src:\"https://framerusercontent.com/images/qQnMFckn7G6n3KPlrDd3xOFyNUA.png\",alt:\"Tuktu Original – Noir mat\"}}}];/*firstName: props.firstNameValue || \"\",\n    lastName: props.lastNameValue || \"\",\n    address: props.addressValue || \"\",\n    apartment: props.apartmentValue || \"\",\n    city: props.cityValue || \"\",\n    province: props.provinceValue || \"\",\n    postal: props.postalValue || \"\",\n    phone: props.phoneValue || \"\",\n*/export function withAddressComplete(Component){return props=>{const handleOnSelect=async publicId=>{console.log(\"📦 public_id re\\xe7u :\",publicId);try{const response=await fetch(`https://api.woosmap.com/localities/details/?public_id=${encodeURIComponent(publicId)}&key=${props.apiKey}`);const data=await response.json();console.log(\"🧾 D\\xe9tail complet de l'adresse Woosmap :\",data);}catch(error){console.error(\"❌ Erreur Woosmap API :\",error);}};return /*#__PURE__*/_jsx(Component,{...props,onSelect:handleOnSelect});};}export function withAddressForm(Component){return props=>{const handleSubmit=async event=>{//event.preventDefault()\nconsole.log(\"withAddressForm : \",event);};const handleCancelled=async event=>{//event.preventDefault()\nconsole.log(\"withAddressForm cancel \");};return /*#__PURE__*/_jsx(Component,{...props,onSubmit:handleSubmit,onCancel:handleCancelled});};}export function withCreateCheckoutOLD(Component){return props=>{const[store,setStore]=useStore();const[loading,setLoading]=useState(false);const handleClick=async event=>{event.preventDefault();setLoading(true);console.log(\"⏳ Waiting 1 second before creating Stripe session...\");const existingCart=[...store.cart];if(existingCart.length===0){console.error(\"❌ ERROR: Cart is empty\");setLoading(false);return;}// 🧾 Push begin_checkout to dataLayer\nconst beginCheckoutPayload={event:\"begin_checkout\",ecommerce:{currency:\"CAD\",value:55,items:existingCart.map(item=>({item_id:item.productId,item_name:item.name,price:15,quantity:item.quantity}))}};console.log(\"🚀 begin_checkout → pushed to dataLayer\",beginCheckoutPayload);window.dataLayer=window.dataLayer||[];window.dataLayer.push(beginCheckoutPayload);// Wait before creating Stripe session\nsetTimeout(async()=>{console.log(\"💳 Creating Stripe Checkout session...\");if(!window.Clerk||!window.Clerk.user){console.warn(\"⚠️ No user connected\");alert(\"You must be logged in to complete the purchase.\");setLoading(false);return;}const user=window.Clerk.user;const email=user?.primaryEmailAddress?.emailAddress||\"\";const userId=user?.id||\"\";const testKey=\"sk_test_51QsUvvCouYRjb5lHUCWgrUEs4wwiORHYbTJ0zX1YnWit2F2aE6VpuldpItDNTEyTR29FJKAUGCpLE4djlWuL160200ouqrghyo\";const liveKey=\"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\";const secretKey=props.isLive?liveKey:testKey;const headers={Authorization:`Bearer ${secretKey}`,\"Content-Type\":\"application/x-www-form-urlencoded\"};// 1️⃣ Récupération (ou création) du customer\nconst customersRes=await fetch(`https://api.stripe.com/v1/customers?limit=1&email=${encodeURIComponent(email)}`,{method:\"GET\",headers});const customers=await customersRes.json();let customerId;if(customers.data?.length>0){customerId=customers.data[0].id;console.log(\"✅ Stripe customer found:\",customerId);}else{const newCustomerRes=await fetch(\"https://api.stripe.com/v1/customers\",{method:\"POST\",headers,body:new URLSearchParams({email,\"metadata[clerk_user_id]\":userId})});const newCustomer=await newCustomerRes.json();customerId=newCustomer.id;console.log(\"➕ Stripe customer created:\",customerId);}// 2️⃣ Mettre à jour l'adresse par défaut (billing + shipping)\nconst defaultAddress={line1:\"123 Rue Principale\",city:\"Montr\\xe9al\",state:\"QC\",postal_code:\"H2X 1A4\",country:\"CA\"};const shippingName=email;await fetch(`https://api.stripe.com/v1/customers/${customerId}`,{method:\"POST\",headers,body:new URLSearchParams({// billing address\n\"address[line1]\":defaultAddress.line1,\"address[city]\":defaultAddress.city,\"address[state]\":defaultAddress.state,\"address[postal_code]\":defaultAddress.postal_code,\"address[country]\":defaultAddress.country,// shipping info\n\"shipping[name]\":shippingName,\"shipping[address][line1]\":defaultAddress.line1,\"shipping[address][city]\":defaultAddress.city,\"shipping[address][state]\":defaultAddress.state,\"shipping[address][postal_code]\":defaultAddress.postal_code,\"shipping[address][country]\":defaultAddress.country})});try{const response=await fetch(\"https://api.stripe.com/v1/checkout/sessions\",{method:\"POST\",headers:{Authorization:`Bearer ${secretKey}`,\"Content-Type\":\"application/x-www-form-urlencoded\"},body:new URLSearchParams({mode:\"payment\",locale:\"fr\",success_url:window.location.origin+\"/success\",cancel_url:window.location.origin+\"/cart\",//customer_email: email,\nclient_reference_id:userId,customer:customerId,billing_address_collection:\"required\",\"shipping_address_collection[allowed_countries][0]\":\"CA\",// === Livraison gratuite ===\n\"shipping_options[0][shipping_rate_data][type]\":\"fixed_amount\",\"shipping_options[0][shipping_rate_data][fixed_amount][amount]\":\"0\",\"shipping_options[0][shipping_rate_data][fixed_amount][currency]\":\"cad\",\"shipping_options[0][shipping_rate_data][display_name]\":\"Livraison premium (valeur 200 $)\",\"shipping_options[0][shipping_rate_data][delivery_estimate][minimum][unit]\":\"business_day\",\"shipping_options[0][shipping_rate_data][delivery_estimate][minimum][value]\":\"7\",\"shipping_options[0][shipping_rate_data][delivery_estimate][maximum][unit]\":\"business_day\",\"shipping_options[0][shipping_rate_data][delivery_estimate][maximum][value]\":\"14\",...existingCart.map((item,index)=>({[`line_items[${index}][price]`]:item.price_id,[`line_items[${index}][quantity]`]:item.quantity})).reduce((acc,val)=>({...acc,...val}),{})})});const data=await response.json();if(data.url){console.log(\"✅ Redirecting to Stripe:\",data.url);window.location.href=data.url;}else{window.dataLayer.push({event:\"tracking_error\",context:\"begin_checkout\",error_type:\"stripe_error\",details:data,timestamp:new Date().toISOString()});console.error(\"❌ Stripe error:\",data);setLoading(false);}}catch(error){window.dataLayer.push({event:\"tracking_error\",context:\"begin_checkout\",error_type:\"network_error\",details:error?.message||\"unknown\",timestamp:new Date().toISOString()});console.error(\"❌ Stripe connection error:\",error);}},1e3);};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick,variant:loading?\"Loading\":\"Default\"});};}export function withCreateCheckout(Component){return props=>{const[store,setStore]=useStore();const[loading,setLoading]=useState(false);const isLive=isLiveMode();const proceedToCheckout=async()=>{console.log(\"⏳ Waiting 1 second before creating Stripe session...\");const existingCart=[...store.cart];if(existingCart.length===0){console.error(\"❌ ERROR: Cart is empty\");setLoading(false);return;}// 🧾 Push begin_checkout to dataLayer\nconst beginCheckoutPayload={event:\"begin_checkout\",ecommerce:{currency:\"CAD\",value:existingCart.reduce((total,item)=>total+item.price*item.quantity,0),items:existingCart.map(item=>({item_id:item.productId,item_name:item.name,price:item.price,quantity:item.quantity}))}};console.log(\"🚀 begin_checkout → pushed to dataLayer\",beginCheckoutPayload);window.dataLayer=window.dataLayer||[];window.dataLayer.push(beginCheckoutPayload);setTimeout(async()=>{const user=window.Clerk.user;const email=user?.primaryEmailAddress?.emailAddress||\"\";const userId=user?.id||\"\";const testKey=\"sk_test_51QsUvvCouYRjb5lHUCWgrUEs4wwiORHYbTJ0zX1YnWit2F2aE6VpuldpItDNTEyTR29FJKAUGCpLE4djlWuL160200ouqrghyo\";const liveKey=\"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\";const secretKey=isLive?liveKey:testKey;const headers={Authorization:`Bearer ${secretKey}`,\"Content-Type\":\"application/x-www-form-urlencoded\"};// 1️⃣ Récupération ou création du customer Stripe\nconst customersRes=await fetch(`https://api.stripe.com/v1/customers?limit=1&email=${encodeURIComponent(email)}`,{method:\"GET\",headers});const customers=await customersRes.json();let customerId;if(customers.data?.length>0){customerId=customers.data[0].id;console.log(\"✅ Stripe customer found:\",customerId);}else{const newCustomerRes=await fetch(\"https://api.stripe.com/v1/customers\",{method:\"POST\",headers,body:new URLSearchParams({email,\"metadata[clerk_user_id]\":userId})});const newCustomer=await newCustomerRes.json();customerId=newCustomer.id;console.log(\"➕ Stripe customer created:\",customerId);}// 2️⃣ Mise à jour adresse par défaut\nconst defaultAddress={line1:\"123 Rue Principale\",city:\"Montr\\xe9al\",state:\"QC\",postal_code:\"H2X 1A4\",country:\"CA\"};const shippingName=email;await fetch(`https://api.stripe.com/v1/customers/${customerId}`,{method:\"POST\",headers,body:new URLSearchParams({\"address[line1]\":defaultAddress.line1,\"address[city]\":defaultAddress.city,\"address[state]\":defaultAddress.state,\"address[postal_code]\":defaultAddress.postal_code,\"address[country]\":defaultAddress.country,\"shipping[name]\":shippingName,\"shipping[address][line1]\":defaultAddress.line1,\"shipping[address][city]\":defaultAddress.city,\"shipping[address][state]\":defaultAddress.state,\"shipping[address][postal_code]\":defaultAddress.postal_code,\"shipping[address][country]\":defaultAddress.country})});// 3️⃣ Création session Stripe Checkout\ntry{const response=await fetch(\"https://api.stripe.com/v1/checkout/sessions\",{method:\"POST\",headers,body:new URLSearchParams({mode:\"payment\",locale:\"fr\",success_url:window.location.origin+\"/success\",cancel_url:window.location.origin+\"/cart\",client_reference_id:userId,customer:customerId,billing_address_collection:\"required\",\"shipping_address_collection[allowed_countries][0]\":\"CA\",\"shipping_options[0][shipping_rate_data][type]\":\"fixed_amount\",\"shipping_options[0][shipping_rate_data][fixed_amount][amount]\":\"0\",\"shipping_options[0][shipping_rate_data][fixed_amount][currency]\":\"cad\",\"shipping_options[0][shipping_rate_data][display_name]\":\"Livraison premium (valeur 200 $)\",\"shipping_options[0][shipping_rate_data][delivery_estimate][minimum][unit]\":\"business_day\",\"shipping_options[0][shipping_rate_data][delivery_estimate][minimum][value]\":\"7\",\"shipping_options[0][shipping_rate_data][delivery_estimate][maximum][unit]\":\"business_day\",\"shipping_options[0][shipping_rate_data][delivery_estimate][maximum][value]\":\"14\",...existingCart.map((item,index)=>({[`line_items[${index}][price]`]:item.price_id,[`line_items[${index}][quantity]`]:item.quantity})).reduce((acc,val)=>({...acc,...val}),{})})});const data=await response.json();if(data.url){console.log(\"✅ Redirecting to Stripe:\",data.url);window.location.href=data.url;}else{window.dataLayer.push({event:\"tracking_error\",context:\"begin_checkout\",error_type:\"stripe_error\",details:data,timestamp:new Date().toISOString()});console.error(\"❌ Stripe error:\",data);setLoading(false);}}catch(error){window.dataLayer.push({event:\"tracking_error\",context:\"begin_checkout\",error_type:\"network_error\",details:error?.message||\"unknown\",timestamp:new Date().toISOString()});console.error(\"❌ Stripe connection error:\",error);setLoading(false);}},1e3);};const handleClick=async event=>{event.preventDefault();setLoading(true);if(!window.Clerk||!window.Clerk.user){window.Clerk.openSignIn({afterSignInUrl:window.location.href,redirectUrl:window.location.href});setLoading(false);return;}proceedToCheckout();};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick,isLive:isLive,variant:loading?\"Loading\":\"Default\"});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withCartList\":{\"type\":\"reactHoc\",\"name\":\"withCartList\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCartSubTotal\":{\"type\":\"reactHoc\",\"name\":\"withCartSubTotal\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withDeliveryPrice\":{\"type\":\"reactHoc\",\"name\":\"withDeliveryPrice\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCreateCheckout\":{\"type\":\"reactHoc\",\"name\":\"withCreateCheckout\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withTestLabel\":{\"type\":\"reactHoc\",\"name\":\"withTestLabel\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"logZipcodeEntry\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getStockBySkuId\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withAddToCart\":{\"type\":\"reactHoc\",\"name\":\"withAddToCart\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCartDetailCheckout\":{\"type\":\"reactHoc\",\"name\":\"withCartDetailCheckout\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCartCounter\":{\"type\":\"reactHoc\",\"name\":\"withCartCounter\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withQuantitySelector\":{\"type\":\"reactHoc\",\"name\":\"withQuantitySelector\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCartTotal\":{\"type\":\"reactHoc\",\"name\":\"withCartTotal\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCartItem\":{\"type\":\"reactHoc\",\"name\":\"withCartItem\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withAddressComplete\":{\"type\":\"reactHoc\",\"name\":\"withAddressComplete\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCreateCheckoutOLD\":{\"type\":\"reactHoc\",\"name\":\"withCreateCheckoutOLD\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withAddressForm\":{\"type\":\"reactHoc\",\"name\":\"withAddressForm\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withZipcodeForm\":{\"type\":\"reactHoc\",\"name\":\"withZipcodeForm\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCartItemList\":{\"type\":\"reactHoc\",\"name\":\"withCartItemList\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCartDetail\":{\"type\":\"reactHoc\",\"name\":\"withCartDetail\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"db\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCloseOverlay\":{\"type\":\"reactHoc\",\"name\":\"withCloseOverlay\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withAddQuantity\":{\"type\":\"reactHoc\",\"name\":\"withAddQuantity\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withStockAvailable\":{\"type\":\"reactHoc\",\"name\":\"withStockAvailable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Checkout.map"],"mappings":"8aAKA,SAAS,EAAmB,EAAM,CAAC,aAAa,QAAQ,GAAmB,CAAC,KAAK,UAAU,EAAM,KAAK,CAAC,AAAE,UAAS,GAA2B,CAA+C,cAApC,SAAW,KAAmB,EAAa,SAAS,OAAO,MAAM,IAAI,CAAC,KAAK,GAAG,EAAE,MAAM,GAAG,YAAY,AAAE,UAAS,GAAmB,CAAC,MAAO,IAA2B,CAAC,YAAY,MAAQ,UAAS,GAAY,CAAC,OAAO,GAA2B,AAAE,gBAAsB,EAAgB,EAAQ,CAAC,IAAM,EAAI,EAAQ,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,CAAkF,AAAjF,KAAM,GAAO,EAAW,EAAG,kBAAkB,CAAC,CAAC,MAAI,UAAU,GAAiB,AAAC,EAAC,CAAC,QAAQ,IAAI,8BAAiC,EAAI,AAAE,OAAM,EAAM,CAAC,QAAQ,MAAM,uBAAuB,EAAM,AAAE,CAAC,CACjrB,SAAgB,EAAgB,EAAU,CAAC,MAAO,CAAA,GAAO,CAAC,GAAK,CAAC,EAAM,CAAC,GAAU,CAAO,EAAc,EAAM,MAAM,OAAO,CAAC,EAAI,IAAO,GAAK,EAAK,UAAU,GAAG,EAAE,CAAO,EAAe,EAAc,EAElM,MAAoB,GAAK,EAAU,CAAC,GAAG,EAAqB,iBAAe,MAAM,CAAc,EAAC,AAAE,CAAE,UAAgB,EAAc,EAAU,CAAC,MAAO,CAAA,GAAO,CAAC,IAAM,EAAO,GAAY,CAAC,MAAoB,GAAK,EAAU,CAAC,GAAG,EAAa,QAAO,EAAC,AAAE,CAAE,CACnH,SAAgB,EAAgB,EAAU,CAA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