1"use strict";(self.webpackChunkwordpress_api_react_client=self.webpackChunkwordpress_api_react_client||[]).push([["Selection/Receipt"],{QB9H:(e,t,r)=>{r.r(t),r.d(t,{default:()=>y});var a=r("j3Cw"),c=r("vG+N"),n=r("e9G9"),s=r("C/+m"),i=r("xtN3"),l=r("bZRb"),o=r("8nZ2"),d=r("1IiE");var p=r("pZhm"),u=r("6X5C"),m=r("o8gk"),_=r("ovCD");const h={receipt:"css-yqjFAz9829",receipt_title:"css-CRuaAJIXLi",receipt_thanks:"css-35EFshXL3J",receipt_orderNumber:"css-+w1oyWaYE4",receipt_totals:"css-c3Tn--lshK",receipt_address:"css-b+eS4dXn+J",receipt_address_column:"css-nWGXAryuEQ",receipt_address_column_title:"css-QUYI8No1zk",receipt_address_column_row:"css-7WxUuiHgBV",receipt_print:"css-SHKWXNca8p"};e=r.hmd(e);class E extends a.Component{constructor(e){super(e),this.state={conversionFired:!1,klarnaCheckoutRendered:!1}}static getDerivedStateFromProps(e,t){const{checkout:r,setup:a,properties:c,location:n}=e;return"undefined"!=typeof window&&"RECEIPT_DEBUG"!==n.type&&!t.conversionFired&&r.selection.items&&r.selection.items.length>0&&c.siteUpdated?(void 0===window.dataLayer&&(window.dataLayer=[]),((e,t,r={})=>{void 0===window.dataLayer&&(window.dataLayer=[]);const{items:a,totals:c,currency:n,discounts:s={},address:i={}}=e,p=(0,d.Sw)(),u=s.vouchers.reduce(((e,t)=>[...e,t.voucher]),[]).join(", "),{dpc:m}=(0,l.wC)();window.dataLayer.push({values:null}),window.dataLayer.push({event:"Purchase",event_id:p,values:{currency:n,content_type:"product",contents:a.map((e=>({id:`1/${t.country.toLowerCase()}-${e.id}-s`,quantity:e.quantity,item_price:e.priceEachAsNumber}))),num_items:a.length,value:c.grandTotalPriceAsNumber}}),window.dataLayer.push({ecommerce:null}),window.dataLayer.push({event:"PurchaseEvent",ecommerce:{currencyCode:n,purchase:{actionField:{id:e.order,affiliation:"",revenue:c.grandTotalPriceAsNumber,tax:c.grandTotalPriceTaxAsNumber,shipping:c.shippingPriceAsNumber,coupon:u},products:a.map((e=>({name:e.name,sku:e.sku,id:e.id.replace(/p(\d+)-v.*/,"$1"),price:e.priceEachAsNumber,brand:e.brand,category:e.category,variant:e.variant,quantity:e.quantity})))}}}),window.dataLayer.push({ecommerce:null}),window.dataLayer.push({event:"purchase_ga4",ecommerce:{"x-fb-event_id":p,currency:n,value:c.grandTotalPriceAsNumber,tax:c.grandTotalPriceTaxAsNumber,shipping:c.shippingPriceAsNumber,transaction_id:e.order,coupon:u,items:a.map((e=>{const a=(0,o._w)(t,e),c=a.category&&a.category.split("/").reduce(((e,t,r)=>({...e,[`item_category${r>0?r+1:""}`]:t})),{});return{item_name:e.name,item_id:e.id.replace(/p(\d+)-v.*/,"$1"),price:e.priceEachAsNumber,currency:n,...c||{},item_list_id:(0,d.x5)(r[e.id]||""),item_list_name:r[e.id]||"",item_brand:e.brand,item_variant:e.variant,quantity:e.quantity}})),user_data:{email:i.email,address:{first_name:i.firstName,last_name:i.lastName,street:i.address1,postal_code:i.zipCode,region:i.state,city:i.city,country:i.country}}}}),m.sendPurchaseEvent({transaction_id:e.order,items:a.map((e=>({item_id:e.sizeSku,price:e.priceEachAsNumber,quantity:e.quantity}))),currency:n})})(r.selection,a,r.listItemCache),(0,_.d8)("receiptShown",1,365),{conversionFired:!0}):null}componentDidUpdate(){const e=document.getElementById("receiptSnippet");if(this.props.checkout.selection.receiptSnippet&&e&&!this.state.klarnaCheckoutRendered){if(!e.querySelector("script"))return;const t=e.querySelector("script").innerHTML,r=document.createElement("script");r.text=t,document.getElementById("receiptSnippet").appendChild(r),this.setState({klarnaCheckoutRendered:!0})}}componentWillUnmount(){"RECEIPT_DEBUG"!==this.props.location.type&&this.state.conversionFired&&this.props.destroySelection()}render(){const{checkout:e,setup:t,location:r}=this.props;if(e.selectionError||!e.selection.items)return null;let{order:c,address:n,shippingAddress:l}=e.selection;const o=["email","firstName","lastName","company","phoneNumber","address1","address2","zipCode","city"];return"RECEIPT_DEBUG"===r.type&&(n=o.reduce(((e,t)=>({...e,[t]:(0,d.Z)(t)})),{}),l=o.reduce(((e,t)=>({...e,[t]:(0,d.Z)(t)})),{}),c=123456),a.createElement("main",{role:"main"},a.createElement("div",{className:h.receipt},a.createElement("h1",{className:h.receipt_title},(0,d.Iu)(t,"receiptTitle")),a.createElement("div",{className:h.receipt_thanks,dangerouslySetInnerHTML:{__html:(0,_.Vh)((0,d.Iu)(t,"receiptThanks"))}}),a.createElement("h3",{className:h.receipt_orderNumber},(0,d.Iu)(t,"receiptOrderNumber"),c),a.createElement(u.Z,{message:"Error rendering receipt",debugData:e.selection},e.selection.receiptSnippet&&a.createElement("div",{id:"receiptSnippet",className:h.receipt_snippet,dangerouslySetInnerHTML:{__html:e.selection.receiptSnippet}}),a.createElement(s.Z,{currentPage:"receipt"}),a.createElement("div",{className:h.receipt_totals},a.createElement(i.Z,{setup:t,selection:e.selection})),a.createElement("div",{className:h.receipt_address},a.createElement("div",{className:h.receipt_address_column},a.createElement("span",{className:h.receipt_address_column_title},(0,d.Iu)(t,"receiptAddressBilling")),o.map((e=>n[e]?a.createElement("span",{key:`address-${e}`,className:h.receipt_address_column_row},n[e]):null))),a.createElement("div",{className:h.receipt_address_column},a.createElement("span",{className:h.receipt_address_column_title},(0,d.Iu)(t,"receiptAddressShipping")),o.map((e=>l[e]?a.createElement("span",{key:`address-${e}`,className:h.receipt_address_column_row},l[e]):null))))),a.createElement("div",{className:h.receipt_print},a.createElement(p.Z,{text:(0,d.Iu)(t,"receiptPrint"),type:"a",href:"#print-receipt",clickEventHandler:e=>{e.preventDefault(),window.print()}}))))}}const y=(0,c.wU)(e)((0,n.connect)((({checkout:e,environment:t,location:r})=>({checkout:e,setup:t.setup,properties:t.properties,location:r})),{destroySelection:m.vR})(E))},xtN3:(e,t,r)=>{r.d(t,{Z:()=>s});var a=r("j3Cw"),c=r("1IiE");const n={totals:"css-kzoTGmA3u0",totals_row:"css-l6sb4SlQD7"},s=({setup:e,selection:t})=>{const{totals:r,discounts:s}=t;return a.createElement("div",{className:n.totals},a.createElement("div",{className:n.totals_row},a.createElement("span",null,(0,c.Iu)(e,"checkoutProductTotal")),a.createElement("span",null,r.itemsTotalPrice)),r.taxDeducted?a.createElement("div",{className:n.totals_row},a.createElement("span",null,(0,c.Iu)(e,"checkoutTaxReduction")),a.createElement("span",null,r.taxDeducted)):null,a.createElement("div",{className:n.totals_row},a.createElement("span",null,(0,c.Iu)(e,"checkoutShipping")),a.createElement("span",null,0===r.shippingPriceAsNumber?(0,c.Iu)(e,"checkoutFreeShipping"):r.shippingPrice)),s.anyDiscount?a.createElement("div",{className:[n.totals_row,n.totals_row__discount].join(" ")},a.createElement("span",null,(0,c.Iu)(e,"checkoutDiscount")),a.createElement("span",null,r.totalDiscountPrice)):null,r.taxAdded?a.createElement("div",{className:n.totals_row},a.createElement("span",null,(0,c.Iu)(e,"checkoutTaxAdded")),a.createElement("span",null,r.taxAdded)):null,r.taxPercent>0?a.createElement("div",{className:n.totals_row},a.createElement("span",null,(0,c.Iu)(e,"checkoutTaxPercent")),a.createElement("span",null,`${r.taxPercent}%`)):null,a.createElement("div",{className:n.totals_row},a.createElement("span",null,(0,c.Iu)(e,"checkoutGrandTotal")),a.createElement("span",null,r.grandTotalPrice)))}}}]); 2//# sourceMappingURL=Receipt-5002aa803de657a8d258.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.