1(()=>{"use strict";const e=window.ReactJSXRuntime;(()=>{if(!window.wp||!window.wc)return;const{__,sprintf:a}=wp.i18n||{__:e=>e,sprintf:e=>e},{registerPlugin:c}=wp.plugins,{Notice:t}=wp.components,{useState:s}=wp.element,{useDispatch:r,useSelect:i}=wp.data,n=wc.blocksCheckout||wc.blocks||{},{ExperimentalOrderMeta:d,extensionCartUpdate:o}=n||{},l=wc.wcBlocksData&&wc.wcBlocksData.cartStore||"wc/store/cart";if(!d||!r||!i)return;const m="pw-gift-cards",p=()=>{const[c,r]=s(""),[n,p]=s(!1),[g,w]=s(null),f=i(e=>{const a=e(l);return a&&a.getCartData?a.getCartData():null},[]),u=f&&f.extensions&&f.extensions[m]&&f.extensions[m].gift_cards||[];return(0,e.jsx)(d,{children:(0,e.jsxs)("div",{id:"pwgc-redeem-gift-card-container",children:[u.length>0&&(0,e.jsxs)("div",{className:"pwgc-applied-gift-cards",children:[(0,e.jsx)("div",{className:"pwgc-applied-gift-cards-title",children:__("Gift cards applied","pw-woocommerce-gift-cards")}),(0,e.jsx)("ul",{className:"pwgc-applied-gift-cards-list",children:u.map(c=>(0,e.jsxs)("li",{className:"pwgc-applied-gift-cards-item",children:[(0,e.jsxs)("div",{className:"pwgc-applied-gift-cards-left",children:[(0,e.jsx)("div",{className:"pwgc-gift-card-number",children:c.number}),(0,e.jsx)("div",{className:"pwgc-gift-card-remaining-balance",children:c.balance&&(0,e.jsx)("div",{className:"pwgc-gift-card-balance",children:a(__("Remaining balance is %s","pw-woocommerce-gift-cards"),c.balance)})})]}),(0,e.jsx)("div",{className:"pwgc-applied-gift-cards-right",children:c.amount&&(0,e.jsxs)("span",{className:"pwgc-gift-card-amount",children:[c.amount,(0,e.jsx)("button",{type:"button",className:"pwgc-remove-gift-card",onClick:()=>(async e=>{p(!0),w(null);try{await o({namespace:m,data:{code:e,remove:!0}})}catch(e){w({status:"error",message:e?.message||__("Unable to remove gift card.","pw-woocommerce-gift-cards")})}finally{p(!1)}})(c.number),"aria-label":a(__("Remove gift card %s","pw-woocommerce-gift-cards"),c.number),disabled:n,children:"Ã"})]})})]},c.number))})]}),!window.pwgcBlocks.hideRedeemForm&&(0,e.jsxs)("form",{id:"pwgc-redeem-gift-card-form",onSubmit:e=>{e.preventDefault(),(async()=>{if(c){p(!0),w(null);try{await o({namespace:m,data:{code:c}}),r("")}catch(e){w({status:"error",message:e?.message||__("Something went wrong.","pw-woocommerce-gift-cards")})}finally{p(!1)}}else w({status:"error",message:__("Enter a gift card code.","pw-woocommerce-gift-cards")})})()},noValidate:!0,children:[(0,e.jsx)("label",{htmlFor:"pwgc-redeem-gift-card-number",children:__("Have a gift card?","pw-woocommerce-gift-cards")}),(0,e.jsx)("input",{id:"pwgc-redeem-gift-card-number",type:"text",value:c,onChange:e=>r(e.target.value),placeholder:__("Gift card number","pw-woocommerce-gift-cards"),"aria-label":__("Gift card number","pw-woocommerce-gift-cards"),disabled:n}),(0,e.jsx)("button",{type:"submit",className:"pwgc-apply-gift-card-button wc-block-components-button "+(n?"is-loading":""),disabled:n,"aria-busy":n,children:__("Apply Gift Card","pw-woocommerce-gift-cards")}),g&&(0,e.jsx)(t,{status:g.status,isDismissible:!1,children:g.message})]})]})})};c("pw-apply-gift-card-checkout",{render:p,scope:"woocommerce-checkout"}),c("pw-apply-gift-card-cart",{render:p,scope:"woocommerce-cart"})})()})()
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.