@lockerverse/react 0.2.253-dev.1 → 0.2.255
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MIGRATIONS.md +11 -77
- package/dist/booking-payment.d.ts +6 -0
- package/dist/booking-payment.d.ts.map +1 -1
- package/dist/booking-payment.js +1 -1
- package/dist/booking-payment.js.map +1 -1
- package/dist/embed/chunks/{auction-payment-view-EHVUMV2E.js → auction-payment-view-PUPDF755.js} +1 -1
- package/dist/embed/chunks/{chunk-Z7VB3RC6.js → chunk-2Z3NXASX.js} +2 -2
- package/dist/embed/chunks/{chunk-N3EKRKUJ.js → chunk-BDPIC42C.js} +2 -2
- package/dist/embed/chunks/{chunk-Z63EAJ4B.js → chunk-U5RZWWIG.js} +1 -1
- package/dist/embed/chunks/{lockerverse-auction-item-LIULZZDW.js → lockerverse-auction-item-C5Q36TJQ.js} +2 -2
- package/dist/embed/lockerverse.js +1 -1
- package/dist/embed/runtime.js +2 -2
- package/guides/auctions.md +1 -1
- package/guides/bookings.md +41 -1
- package/guides/browser-embed.md +1 -1
- package/guides/events.md +1 -1
- package/guides/integration.md +1 -1
- package/guides/payment-widgets.md +1 -1
- package/guides/signup.md +1 -1
- package/package.json +2 -2
- /package/dist/embed/chunks/{chunk-Z7VB3RC6.js.LEGAL.txt → chunk-2Z3NXASX.js.LEGAL.txt} +0 -0
- /package/dist/embed/chunks/{chunk-N3EKRKUJ.js.LEGAL.txt → chunk-BDPIC42C.js.LEGAL.txt} +0 -0
- /package/dist/embed/chunks/{lockerverse-auction-item-LIULZZDW.js.LEGAL.txt → lockerverse-auction-item-C5Q36TJQ.js.LEGAL.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as P,B as $,C as I,D as b,E as D,F as U,G as N,H as _,I as q,J as l,K as y,L as V,O as H,P as G,a as ie,b as L,d as B,e as O,r as h,u as f,v as R,y as E,z as M}from"./chunk-N3EKRKUJ.js";import{c as p}from"./chunk-DCANE7XH.js";var Q="lockerverse:auction-bidder",W=N(_({address:_({city:l(),country:l(),line1:l(),line2:N(l()),postal_code:l(),state:l()}),name:l()})),oe=_({billing:W,email:l(),phone:l(),sameAsBilling:q(D(),!0),shipping:W,version:U(1)});function fe(){try{let e=window.localStorage.getItem(Q);if(!e)return null;let n=V(oe,JSON.parse(e));if(!n.success)return null;let{version:t,...o}=n.output;return o}catch{return null}}function z(e){if(!e?.complete)return null;let{address:n,name:t}=e.value;return{address:{city:n.city,country:n.country,line1:n.line1,line2:n.line2,postal_code:n.postal_code,state:n.state},name:t}}function be(e,n){let t={mode:e};return n&&(t.defaultValues=n),t}function ye({contact:e,billing:n,shipping:t,sameAsBilling:o,collectShippingAddress:r,previous:a}){let s=r&&!o?z(t):null;re({billing:z(n)??a?.billing??null,email:e.email,phone:e.phone,sameAsBilling:o,shipping:s??a?.shipping??null})}function re(e){try{window.localStorage.setItem(Q,JSON.stringify({...e,version:1}))}catch{}}function Y(e,n,t){let o=H(e,n.saleMode==="buy_now"?(n.buyNowPriceAmount??0)*t.quantity:t.amount,t.includeServiceFee,n.additionalCharge?n.additionalCharge.firstUnitAmountCents+n.additionalCharge.additionalUnitAmountCents*(n.saleMode==="buy_now"?t.quantity-1:0):0);return n.additionalCharge?{...o,additionalCharge:n.additionalCharge}:o}function Ee(e,n,t){if(R(e,n)!=="active")return"This item is not accepting bids or purchases.";if(t.bidType==="maximum"&&!n.supportsMaximumBids)return"Maximum bidding is not available for this item. Choose a fixed bid.";if(n.saleMode==="hybrid")return"This item type is not supported for checkout.";if(n.saleMode==="buy_now"){if(n.isSoldOut||n.availableQuantity===0)return"This item is sold out.";if(t.quantity>(n.maxQuantityPerOrder??Number.POSITIVE_INFINITY))return`You can buy up to ${n.maxQuantityPerOrder} items per order.`;if(!(n.buyNowPriceAmount&&Number.isSafeInteger(t.quantity))||t.quantity<1||n.availableQuantity!==null&&t.quantity>n.availableQuantity)return"Select an available quantity."}else if(!Number.isSafeInteger(t.amount)||t.amount%100!==0||t.amount<G(n))return"Enter a whole-dollar bid at or above the minimum bid.";return null}function ae(e,n){return e?.name===n?.name&&e?.category===n?.category&&e?.firstUnitAmountCents===n?.firstUnitAmountCents&&e?.additionalUnitAmountCents===n?.additionalUnitAmountCents}function _e(e,n,t,o,r){return e.payment?.publishableKey!==n.payment?.publishableKey||e.payment?.connectedAccountId!==n.payment?.connectedAccountId||e.serviceFeeEnabled!==n.serviceFeeEnabled||t.saleMode!==o.saleMode||!ae(t.additionalCharge,o.additionalCharge)||t.collectShippingAddress!==o.collectShippingAddress||JSON.stringify(Y(e,t,r))!==JSON.stringify(Y(n,o,r))}function Se(e){return{expectedAdditionalChargeCents:e.additionalChargeCents??0,expectedServiceFeeCents:e.serviceFeeCents,expectedSubtotalCents:e.subtotalCents,expectedTotalCents:e.totalCents}}async function Pe({stripe:e,elements:n,email:t,phone:o,billing:r,shipping:a,collectShippingAddress:s}){if(!(r?.complete&&r.value.name.trim()))throw new Error("Complete your billing name and address.");if(s&&!(a?.complete&&a.value.name.trim()))throw new Error("Complete your shipping name and address.");let v=await n.submit();if(v.error)throw new Error(v.error.message??"Check your payment details.");let m=await e.createConfirmationToken({elements:n,params:{payment_method_data:{allow_redisplay:"always",billing_details:{address:r.value.address,email:t,name:r.value.name,phone:o}},return_url:window.location.href,...s&&a?{shipping:{address:a.value.address,name:a.value.name,phone:o}}:void 0}});if(m.error||!m.confirmationToken)throw new Error(m.error?.message??"Unable to prepare payment details.");return m.confirmationToken.id}async function Ie(e,n){if(!n.requiresAction)return;if(!n.clientSecret)throw new Error("Payment confirmation is incomplete. Check its status before trying again.");let t=await e.handleNextAction({clientSecret:n.clientSecret});if(t.error)throw new Error(t.error.message??"Payment confirmation is incomplete.")}function xe(e,n){if(e)try{Promise.resolve(e(n)).catch(()=>{})}catch{}}var le="Email is required.",J="Enter a valid email address.",se="Phone is required.",x="Enter a valid phone number.",ce=/^(?:$|[^\s@]+@[^\s@]+\.[^\s@]+)$/,ue=/^\+[1-9]\d{6,14}$/;function j(e){return ue.test(e)}function g(e){return e.trim().replace(/[().\s-]/g,"")}var Te=y(l(),b(),$(ce,J)),Le=y(l(),b(),P(le),M(J)),Be=y(l(),b(),E(e=>e===""||g(e)!=="",x),I(g),E(e=>e===""||j(e),x)),Oe=y(l(),b(),P(se),I(g),E(j,x));var A=[{callingCode:"+1",label:"\u{1F1FA}\u{1F1F8} +1",value:"US"},{callingCode:"+52",label:"\u{1F1F2}\u{1F1FD} +52",value:"MX"},{callingCode:"+380",label:"\u{1F1FA}\u{1F1E6} +380",value:"UA"},{callingCode:"+48",label:"\u{1F1F5}\u{1F1F1} +48",value:"PL"},{callingCode:"+1",label:"\u{1F1E8}\u{1F1E6} +1",value:"CA"},{callingCode:"+49",label:"\u{1F1E9}\u{1F1EA} +49",value:"DE"},{callingCode:"+44",label:"\u{1F1EC}\u{1F1E7} +44",value:"GB"},{callingCode:"+46",label:"\u{1F1F8}\u{1F1EA} +46",value:"SE"},{callingCode:"+358",label:"\u{1F1EB}\u{1F1EE} +358",value:"FI"},{callingCode:"+1",label:"\u{1F1F5}\u{1F1F7} +1",value:"PR"}];function C(e){return A.find(n=>n.value===e)??A[0]}function de(e,n){let t=`${n}${n}`,o=e;for(;o.startsWith(t);)o=`${n}${o.slice(t.length)}`;return o}function $e(e,n){let t=g(e);if(!t)return"";let o=C(n),r=de(t,o.callingCode);return r.startsWith("+")?r:`${o.callingCode}${r}`}function K(e,n="US"){let t=g(e),o=C(n);return t.startsWith("+")&&!t.startsWith(o.callingCode)?A.find(r=>t.startsWith(r.callingCode))?.value??o.value:o.value}var u=p(h(),1);function me({className:e,error:n,id:t}){return n?(0,u.jsx)("span",{className:`lockerverse-form__error ${e??""}`,id:t,role:"alert",children:n}):null}function w({children:e,error:n,errorId:t,id:o,label:r}){return(0,u.jsxs)("div",{className:"lockerverse-form__field",children:[(0,u.jsx)("label",{htmlFor:o,children:r}),e,(0,u.jsx)(me,{error:n,id:t??`${o}-error`})]})}function pe({className:e,error:n,errorId:t,id:o,label:r,...a}){let s=t??`${o}-error`;return(0,u.jsx)(w,{error:n,errorId:s,id:o,label:r,children:(0,u.jsx)("input",{...a,"aria-describedby":n?s:a["aria-describedby"],"aria-invalid":n?"true":a["aria-invalid"],className:`lockerverse-form__control ${e??""}`,id:o})})}function X(e){return(0,u.jsx)(pe,{autoComplete:"email",placeholder:"name@example.com",...e,type:"email"})}function F({className:e,...n}){return(0,u.jsx)("input",{...n,className:["lockerverse-form__checkbox",e].filter(Boolean).join(" "),type:"checkbox"})}var Z=p(ie(),1);var d=p(h(),1);function ee({id:e,name:n,value:t,onChange:o,country:r,required:a,disabled:s,inputRef:v,error:m,errorId:ne,placeholder:te="(201) 555-0123"}){let T=(0,Z.useRef)(null),S=C(r);return(0,d.jsxs)("div",{className:"lockerverse-form__phone",dir:"ltr",children:[(0,d.jsxs)("div",{className:"lockerverse-form__phone-country",children:[(0,d.jsxs)("span",{"aria-hidden":"true",children:[(0,d.jsx)("span",{className:"lockerverse-form__phone-flag",children:S.label.split(" ")[0]}),S.callingCode,(0,d.jsx)(B,{"aria-hidden":"true",size:14})]}),(0,d.jsx)("select",{"aria-label":"Phone number country",disabled:s,name:"phoneCountry",onChange:c=>{let k=C(c.target.value);o({country:k.value,value:t}),T.current?.focus()},value:S.value,children:A.map(c=>(0,d.jsx)("option",{value:c.value,children:c.label},c.value))})]}),(0,d.jsx)("input",{"aria-describedby":m?ne:void 0,"aria-invalid":m?!0:void 0,autoComplete:"tel-national",disabled:s,id:e,name:n,onChange:c=>{let k=c.target.value;o({country:K(k,r),value:k})},placeholder:te,ref:c=>{T.current=c,v&&(v.current=c)},required:a,type:"tel",value:t})]})}var i=p(h(),1);function Ye(e){let{isPurchase:n,item:t,id:o}=e;return(0,i.jsxs)("form",{className:"lockerverse-auctions__checkout",noValidate:!0,onSubmit:e.onSubmit,children:[(0,i.jsx)("div",{className:"lockerverse-auctions__checkout-header",children:(0,i.jsxs)("div",{className:"lockerverse-auctions__checkout-navigation",children:[(0,i.jsx)("button",{"aria-label":"Back",className:"lockerverse-auctions__checkout-back",disabled:!e.onBack,onClick:e.onBack,type:"button",children:(0,i.jsx)(O,{"aria-hidden":"true",size:20})}),(0,i.jsx)("h2",{children:n?"Review your purchase":"Confirm your bid"}),(0,i.jsx)("p",{className:"lockerverse-auctions__checkout-eyebrow",children:"Step 2 of 2"})]})}),(0,i.jsxs)("div",{className:"lockerverse-auctions__checkout-body",children:[e.showFields&&(0,i.jsxs)("fieldset",{disabled:e.locked,children:[(0,i.jsxs)("div",{className:"lockerverse-auctions__checkout-contact",children:[(0,i.jsx)(X,{error:e.contactErrors.email,id:`${o}-email`,label:"Email",name:"email",onChange:r=>e.onEmailChange(r.target.value),required:!0,value:e.email}),(0,i.jsx)(w,{error:e.contactErrors.phone,id:`${o}-phone`,label:"Phone",children:(0,i.jsx)(ee,{country:e.phoneCountry,error:e.contactErrors.phone,errorId:`${o}-phone-error`,id:`${o}-phone`,name:"phone",onChange:e.onPhoneChange,required:!0,value:e.phone})})]}),(0,i.jsxs)("section",{"aria-label":"Payment Information",className:"lockerverse-auctions__checkout-section",children:[(0,i.jsx)("h3",{children:"Payment method"}),e.paymentFields]}),(0,i.jsxs)("section",{"aria-label":"Billing Details",className:"lockerverse-auctions__checkout-section",children:[(0,i.jsx)("h3",{children:"Billing Details"}),e.billingFields]}),t.collectShippingAddress&&(0,i.jsxs)("section",{"aria-label":"Delivery Details",className:"lockerverse-auctions__checkout-section",children:[(0,i.jsxs)("label",{className:"lockerverse-auctions__checkout-checkbox lockerverse-auctions__checkout-delivery",htmlFor:`${o}-delivery-same-as-billing`,children:[(0,i.jsx)(F,{checked:e.sameAsBilling,id:`${o}-delivery-same-as-billing`,onChange:r=>e.onSameAsBillingChange(r.target.checked)}),(0,i.jsx)("span",{children:(0,i.jsx)("strong",{children:"Use billing address for delivery"})})]}),!e.sameAsBilling&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("h3",{children:"Delivery Address"}),e.shippingFields]})]}),(0,i.jsx)(he,{...e})]}),e.message&&(0,i.jsx)("p",{"aria-live":"polite",className:"lockerverse-auctions__notice",role:"status",children:e.message}),!e.isTerminal&&(0,i.jsxs)("div",{className:"lockerverse-auctions__checkout-footer",children:[(0,i.jsx)("p",{children:n?"By placing this order, you authorize this payment.":"By placing your bid, you agree to save this payment method and charge it if you win."}),(0,i.jsxs)("button",{className:"lockerverse-auctions__button lockerverse-auctions__checkout-submit",disabled:e.submitDisabled,type:"submit",children:[e.buttonText,(0,i.jsx)(L,{"aria-hidden":"true",size:16})]})]})]})]})}function he(e){let{pricing:n,isPurchase:t,isMaximumBid:o}=e,r=ge(t,o);return(0,i.jsxs)("section",{"aria-label":"Order amounts",className:"lockerverse-auctions__checkout-section lockerverse-auctions__amounts",children:[(0,i.jsxs)("p",{children:[(0,i.jsxs)("span",{children:[r.amount,t?` (\xD7${e.quantity})`:""]}),(0,i.jsx)("span",{children:f(n.subtotalCents)})]}),n.additionalCharge&&(0,i.jsxs)("p",{children:[(0,i.jsx)("span",{children:n.additionalCharge.name}),(0,i.jsx)("span",{children:f(n.additionalChargeCents??0)})]}),e.serviceFeeEnabled&&e.onIncludeServiceFeeChange&&(0,i.jsxs)("label",{className:"lockerverse-auctions__checkout-checkbox",htmlFor:`${e.id}-service-fee`,children:[(0,i.jsx)(F,{checked:e.includeServiceFee,id:`${e.id}-service-fee`,onChange:a=>e.onIncludeServiceFeeChange?.(a.target.checked)}),(0,i.jsx)("span",{children:"Cover processing fees"}),(0,i.jsx)("span",{children:f(e.serviceFeeCents)})]}),(0,i.jsxs)("p",{"aria-live":"polite",className:"lockerverse-auctions__total",children:[(0,i.jsx)("strong",{children:r.total}),(0,i.jsx)("strong",{children:f(n.totalCents)})]}),o&&(0,i.jsx)("small",{children:"Your maximum stays private. If you win, you pay the final price plus applicable fees and charges."})]})}function ge(e,n){return e?{amount:"Subtotal",fee:"Add",total:"Total"}:n?{amount:"Maximum bid",fee:"If I win, add up to",total:"Maximum total if I win"}:{amount:"Bid amount",fee:"If I win, add",total:"Total if I win"}}export{fe as a,be as b,ye as c,Y as d,Ee as e,ae as f,_e as g,Se as h,Pe as i,Ie as j,g as k,Le as l,Oe as m,$e as n,K as o,Ye as p,xe as q};
|
|
1
|
+
import{A as P,B as $,C as I,D as b,E as D,F as U,G as N,H as _,I as q,J as l,K as y,L as V,O as H,P as G,a as ie,b as L,d as B,e as O,r as h,u as f,v as R,y as E,z as M}from"./chunk-BDPIC42C.js";import{c as p}from"./chunk-DCANE7XH.js";var Q="lockerverse:auction-bidder",W=N(_({address:_({city:l(),country:l(),line1:l(),line2:N(l()),postal_code:l(),state:l()}),name:l()})),oe=_({billing:W,email:l(),phone:l(),sameAsBilling:q(D(),!0),shipping:W,version:U(1)});function fe(){try{let e=window.localStorage.getItem(Q);if(!e)return null;let n=V(oe,JSON.parse(e));if(!n.success)return null;let{version:t,...o}=n.output;return o}catch{return null}}function z(e){if(!e?.complete)return null;let{address:n,name:t}=e.value;return{address:{city:n.city,country:n.country,line1:n.line1,line2:n.line2,postal_code:n.postal_code,state:n.state},name:t}}function be(e,n){let t={mode:e};return n&&(t.defaultValues=n),t}function ye({contact:e,billing:n,shipping:t,sameAsBilling:o,collectShippingAddress:r,previous:a}){let s=r&&!o?z(t):null;re({billing:z(n)??a?.billing??null,email:e.email,phone:e.phone,sameAsBilling:o,shipping:s??a?.shipping??null})}function re(e){try{window.localStorage.setItem(Q,JSON.stringify({...e,version:1}))}catch{}}function Y(e,n,t){let o=H(e,n.saleMode==="buy_now"?(n.buyNowPriceAmount??0)*t.quantity:t.amount,t.includeServiceFee,n.additionalCharge?n.additionalCharge.firstUnitAmountCents+n.additionalCharge.additionalUnitAmountCents*(n.saleMode==="buy_now"?t.quantity-1:0):0);return n.additionalCharge?{...o,additionalCharge:n.additionalCharge}:o}function Ee(e,n,t){if(R(e,n)!=="active")return"This item is not accepting bids or purchases.";if(t.bidType==="maximum"&&!n.supportsMaximumBids)return"Maximum bidding is not available for this item. Choose a fixed bid.";if(n.saleMode==="hybrid")return"This item type is not supported for checkout.";if(n.saleMode==="buy_now"){if(n.isSoldOut||n.availableQuantity===0)return"This item is sold out.";if(t.quantity>(n.maxQuantityPerOrder??Number.POSITIVE_INFINITY))return`You can buy up to ${n.maxQuantityPerOrder} items per order.`;if(!(n.buyNowPriceAmount&&Number.isSafeInteger(t.quantity))||t.quantity<1||n.availableQuantity!==null&&t.quantity>n.availableQuantity)return"Select an available quantity."}else if(!Number.isSafeInteger(t.amount)||t.amount%100!==0||t.amount<G(n))return"Enter a whole-dollar bid at or above the minimum bid.";return null}function ae(e,n){return e?.name===n?.name&&e?.category===n?.category&&e?.firstUnitAmountCents===n?.firstUnitAmountCents&&e?.additionalUnitAmountCents===n?.additionalUnitAmountCents}function _e(e,n,t,o,r){return e.payment?.publishableKey!==n.payment?.publishableKey||e.payment?.connectedAccountId!==n.payment?.connectedAccountId||e.serviceFeeEnabled!==n.serviceFeeEnabled||t.saleMode!==o.saleMode||!ae(t.additionalCharge,o.additionalCharge)||t.collectShippingAddress!==o.collectShippingAddress||JSON.stringify(Y(e,t,r))!==JSON.stringify(Y(n,o,r))}function Se(e){return{expectedAdditionalChargeCents:e.additionalChargeCents??0,expectedServiceFeeCents:e.serviceFeeCents,expectedSubtotalCents:e.subtotalCents,expectedTotalCents:e.totalCents}}async function Pe({stripe:e,elements:n,email:t,phone:o,billing:r,shipping:a,collectShippingAddress:s}){if(!(r?.complete&&r.value.name.trim()))throw new Error("Complete your billing name and address.");if(s&&!(a?.complete&&a.value.name.trim()))throw new Error("Complete your shipping name and address.");let v=await n.submit();if(v.error)throw new Error(v.error.message??"Check your payment details.");let m=await e.createConfirmationToken({elements:n,params:{payment_method_data:{allow_redisplay:"always",billing_details:{address:r.value.address,email:t,name:r.value.name,phone:o}},return_url:window.location.href,...s&&a?{shipping:{address:a.value.address,name:a.value.name,phone:o}}:void 0}});if(m.error||!m.confirmationToken)throw new Error(m.error?.message??"Unable to prepare payment details.");return m.confirmationToken.id}async function Ie(e,n){if(!n.requiresAction)return;if(!n.clientSecret)throw new Error("Payment confirmation is incomplete. Check its status before trying again.");let t=await e.handleNextAction({clientSecret:n.clientSecret});if(t.error)throw new Error(t.error.message??"Payment confirmation is incomplete.")}function xe(e,n){if(e)try{Promise.resolve(e(n)).catch(()=>{})}catch{}}var le="Email is required.",J="Enter a valid email address.",se="Phone is required.",x="Enter a valid phone number.",ce=/^(?:$|[^\s@]+@[^\s@]+\.[^\s@]+)$/,ue=/^\+[1-9]\d{6,14}$/;function j(e){return ue.test(e)}function g(e){return e.trim().replace(/[().\s-]/g,"")}var Te=y(l(),b(),$(ce,J)),Le=y(l(),b(),P(le),M(J)),Be=y(l(),b(),E(e=>e===""||g(e)!=="",x),I(g),E(e=>e===""||j(e),x)),Oe=y(l(),b(),P(se),I(g),E(j,x));var A=[{callingCode:"+1",label:"\u{1F1FA}\u{1F1F8} +1",value:"US"},{callingCode:"+52",label:"\u{1F1F2}\u{1F1FD} +52",value:"MX"},{callingCode:"+380",label:"\u{1F1FA}\u{1F1E6} +380",value:"UA"},{callingCode:"+48",label:"\u{1F1F5}\u{1F1F1} +48",value:"PL"},{callingCode:"+1",label:"\u{1F1E8}\u{1F1E6} +1",value:"CA"},{callingCode:"+49",label:"\u{1F1E9}\u{1F1EA} +49",value:"DE"},{callingCode:"+44",label:"\u{1F1EC}\u{1F1E7} +44",value:"GB"},{callingCode:"+46",label:"\u{1F1F8}\u{1F1EA} +46",value:"SE"},{callingCode:"+358",label:"\u{1F1EB}\u{1F1EE} +358",value:"FI"},{callingCode:"+1",label:"\u{1F1F5}\u{1F1F7} +1",value:"PR"}];function C(e){return A.find(n=>n.value===e)??A[0]}function de(e,n){let t=`${n}${n}`,o=e;for(;o.startsWith(t);)o=`${n}${o.slice(t.length)}`;return o}function $e(e,n){let t=g(e);if(!t)return"";let o=C(n),r=de(t,o.callingCode);return r.startsWith("+")?r:`${o.callingCode}${r}`}function K(e,n="US"){let t=g(e),o=C(n);return t.startsWith("+")&&!t.startsWith(o.callingCode)?A.find(r=>t.startsWith(r.callingCode))?.value??o.value:o.value}var u=p(h(),1);function me({className:e,error:n,id:t}){return n?(0,u.jsx)("span",{className:`lockerverse-form__error ${e??""}`,id:t,role:"alert",children:n}):null}function w({children:e,error:n,errorId:t,id:o,label:r}){return(0,u.jsxs)("div",{className:"lockerverse-form__field",children:[(0,u.jsx)("label",{htmlFor:o,children:r}),e,(0,u.jsx)(me,{error:n,id:t??`${o}-error`})]})}function pe({className:e,error:n,errorId:t,id:o,label:r,...a}){let s=t??`${o}-error`;return(0,u.jsx)(w,{error:n,errorId:s,id:o,label:r,children:(0,u.jsx)("input",{...a,"aria-describedby":n?s:a["aria-describedby"],"aria-invalid":n?"true":a["aria-invalid"],className:`lockerverse-form__control ${e??""}`,id:o})})}function X(e){return(0,u.jsx)(pe,{autoComplete:"email",placeholder:"name@example.com",...e,type:"email"})}function F({className:e,...n}){return(0,u.jsx)("input",{...n,className:["lockerverse-form__checkbox",e].filter(Boolean).join(" "),type:"checkbox"})}var Z=p(ie(),1);var d=p(h(),1);function ee({id:e,name:n,value:t,onChange:o,country:r,required:a,disabled:s,inputRef:v,error:m,errorId:ne,placeholder:te="(201) 555-0123"}){let T=(0,Z.useRef)(null),S=C(r);return(0,d.jsxs)("div",{className:"lockerverse-form__phone",dir:"ltr",children:[(0,d.jsxs)("div",{className:"lockerverse-form__phone-country",children:[(0,d.jsxs)("span",{"aria-hidden":"true",children:[(0,d.jsx)("span",{className:"lockerverse-form__phone-flag",children:S.label.split(" ")[0]}),S.callingCode,(0,d.jsx)(B,{"aria-hidden":"true",size:14})]}),(0,d.jsx)("select",{"aria-label":"Phone number country",disabled:s,name:"phoneCountry",onChange:c=>{let k=C(c.target.value);o({country:k.value,value:t}),T.current?.focus()},value:S.value,children:A.map(c=>(0,d.jsx)("option",{value:c.value,children:c.label},c.value))})]}),(0,d.jsx)("input",{"aria-describedby":m?ne:void 0,"aria-invalid":m?!0:void 0,autoComplete:"tel-national",disabled:s,id:e,name:n,onChange:c=>{let k=c.target.value;o({country:K(k,r),value:k})},placeholder:te,ref:c=>{T.current=c,v&&(v.current=c)},required:a,type:"tel",value:t})]})}var i=p(h(),1);function Ye(e){let{isPurchase:n,item:t,id:o}=e;return(0,i.jsxs)("form",{className:"lockerverse-auctions__checkout",noValidate:!0,onSubmit:e.onSubmit,children:[(0,i.jsx)("div",{className:"lockerverse-auctions__checkout-header",children:(0,i.jsxs)("div",{className:"lockerverse-auctions__checkout-navigation",children:[(0,i.jsx)("button",{"aria-label":"Back",className:"lockerverse-auctions__checkout-back",disabled:!e.onBack,onClick:e.onBack,type:"button",children:(0,i.jsx)(O,{"aria-hidden":"true",size:20})}),(0,i.jsx)("h2",{children:n?"Review your purchase":"Confirm your bid"}),(0,i.jsx)("p",{className:"lockerverse-auctions__checkout-eyebrow",children:"Step 2 of 2"})]})}),(0,i.jsxs)("div",{className:"lockerverse-auctions__checkout-body",children:[e.showFields&&(0,i.jsxs)("fieldset",{disabled:e.locked,children:[(0,i.jsxs)("div",{className:"lockerverse-auctions__checkout-contact",children:[(0,i.jsx)(X,{error:e.contactErrors.email,id:`${o}-email`,label:"Email",name:"email",onChange:r=>e.onEmailChange(r.target.value),required:!0,value:e.email}),(0,i.jsx)(w,{error:e.contactErrors.phone,id:`${o}-phone`,label:"Phone",children:(0,i.jsx)(ee,{country:e.phoneCountry,error:e.contactErrors.phone,errorId:`${o}-phone-error`,id:`${o}-phone`,name:"phone",onChange:e.onPhoneChange,required:!0,value:e.phone})})]}),(0,i.jsxs)("section",{"aria-label":"Payment Information",className:"lockerverse-auctions__checkout-section",children:[(0,i.jsx)("h3",{children:"Payment method"}),e.paymentFields]}),(0,i.jsxs)("section",{"aria-label":"Billing Details",className:"lockerverse-auctions__checkout-section",children:[(0,i.jsx)("h3",{children:"Billing Details"}),e.billingFields]}),t.collectShippingAddress&&(0,i.jsxs)("section",{"aria-label":"Delivery Details",className:"lockerverse-auctions__checkout-section",children:[(0,i.jsxs)("label",{className:"lockerverse-auctions__checkout-checkbox lockerverse-auctions__checkout-delivery",htmlFor:`${o}-delivery-same-as-billing`,children:[(0,i.jsx)(F,{checked:e.sameAsBilling,id:`${o}-delivery-same-as-billing`,onChange:r=>e.onSameAsBillingChange(r.target.checked)}),(0,i.jsx)("span",{children:(0,i.jsx)("strong",{children:"Use billing address for delivery"})})]}),!e.sameAsBilling&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("h3",{children:"Delivery Address"}),e.shippingFields]})]}),(0,i.jsx)(he,{...e})]}),e.message&&(0,i.jsx)("p",{"aria-live":"polite",className:"lockerverse-auctions__notice",role:"status",children:e.message}),!e.isTerminal&&(0,i.jsxs)("div",{className:"lockerverse-auctions__checkout-footer",children:[(0,i.jsx)("p",{children:n?"By placing this order, you authorize this payment.":"By placing your bid, you agree to save this payment method and charge it if you win."}),(0,i.jsxs)("button",{className:"lockerverse-auctions__button lockerverse-auctions__checkout-submit",disabled:e.submitDisabled,type:"submit",children:[e.buttonText,(0,i.jsx)(L,{"aria-hidden":"true",size:16})]})]})]})]})}function he(e){let{pricing:n,isPurchase:t,isMaximumBid:o}=e,r=ge(t,o);return(0,i.jsxs)("section",{"aria-label":"Order amounts",className:"lockerverse-auctions__checkout-section lockerverse-auctions__amounts",children:[(0,i.jsxs)("p",{children:[(0,i.jsxs)("span",{children:[r.amount,t?` (\xD7${e.quantity})`:""]}),(0,i.jsx)("span",{children:f(n.subtotalCents)})]}),n.additionalCharge&&(0,i.jsxs)("p",{children:[(0,i.jsx)("span",{children:n.additionalCharge.name}),(0,i.jsx)("span",{children:f(n.additionalChargeCents??0)})]}),e.serviceFeeEnabled&&e.onIncludeServiceFeeChange&&(0,i.jsxs)("label",{className:"lockerverse-auctions__checkout-checkbox",htmlFor:`${e.id}-service-fee`,children:[(0,i.jsx)(F,{checked:e.includeServiceFee,id:`${e.id}-service-fee`,onChange:a=>e.onIncludeServiceFeeChange?.(a.target.checked)}),(0,i.jsx)("span",{children:"Cover processing fees"}),(0,i.jsx)("span",{children:f(e.serviceFeeCents)})]}),(0,i.jsxs)("p",{"aria-live":"polite",className:"lockerverse-auctions__total",children:[(0,i.jsx)("strong",{children:r.total}),(0,i.jsx)("strong",{children:f(n.totalCents)})]}),o&&(0,i.jsx)("small",{children:"Your maximum stays private. If you win, you pay the final price plus applicable fees and charges."})]})}function ge(e,n){return e?{amount:"Subtotal",fee:"Add",total:"Total"}:n?{amount:"Maximum bid",fee:"If I win, add up to",total:"Maximum total if I win"}:{amount:"Bid amount",fee:"If I win, add",total:"Total if I win"}}export{fe as a,be as b,ye as c,Y as d,Ee as e,ae as f,_e as g,Se as h,Pe as i,Ie as j,g as k,Le as l,Oe as m,$e as n,K as o,Ye as p,xe as q};
|