@lockerverse/react 0.2.201 → 0.2.202
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 +22 -0
- package/dist/auction-item-layout.css +35 -0
- package/dist/auction-item.js +1 -1
- package/dist/auction-item.js.map +1 -1
- package/dist/auction-payment-view.js +1 -1
- package/dist/auction-payment-view.js.map +1 -1
- package/dist/auction-payment.js +1 -1
- package/dist/auction-payment.js.map +1 -1
- package/dist/auction-result.d.ts +1 -0
- package/dist/auction-result.d.ts.map +1 -1
- package/dist/auction-result2.js +1 -1
- package/dist/auction-result2.js.map +1 -1
- package/guides/auctions.md +20 -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/MIGRATIONS.md
CHANGED
|
@@ -300,6 +300,28 @@ Affected: @lockerverse/sdk checkout and @lockerverse/react payment widgets.
|
|
|
300
300
|
the corrected stylesheet. No host code or saved field changes are required.
|
|
301
301
|
- **Check:** confirm that the dropdown shows one arrow and options remain selectable.
|
|
302
302
|
|
|
303
|
+
## 0.2.202 — fixed and maximum auction bids
|
|
304
|
+
|
|
305
|
+
- **Affected:** Core auction submissions and React auction item checkout/results.
|
|
306
|
+
- **Required:** deploy backend maximum-bid support before enabling this UI. The
|
|
307
|
+
item response must include `supportsMaximumBids: true`. Older responses retain
|
|
308
|
+
fixed bidding only. Upgrade the matching SDK/React pair in hosts; existing
|
|
309
|
+
ready-made auction components need no new props.
|
|
310
|
+
- **Optional custom UI:** pass `bidType: "maximum"` to `createBid`; `amount` is the
|
|
311
|
+
private limit in integer USD cents. Omit `bidType`, or use `"fixed"`, for a
|
|
312
|
+
fixed public bid. Read the capability before offering maximum bids. Submission
|
|
313
|
+
pricing is the maximum possible total, not the final sale price.
|
|
314
|
+
- **Automatic:** the ready-made UI defaults to fixed bidding and offers maximum
|
|
315
|
+
bidding only on supported items. Checkout and results label maximum amounts as
|
|
316
|
+
limits. Guest checkout, contact fields, and payment recovery remain unchanged.
|
|
317
|
+
- **Rules:** accepted submissions are independent and cannot be edited or canceled.
|
|
318
|
+
A later submission can compete with the same guest's earlier maximum. Submitted
|
|
319
|
+
does not mean leading, accepted after card setup, or paid. Never retry an
|
|
320
|
+
uncertain bid automatically.
|
|
321
|
+
- **Check:** verify fixed/maximum selection, Back preserving the choice, maximum
|
|
322
|
+
fee labels, and unavailable capability behavior in the simulated State Lab.
|
|
323
|
+
Confirm that no private maximum appears in public item data.
|
|
324
|
+
|
|
303
325
|
## 0.2.165 — multi-select custom fields
|
|
304
326
|
|
|
305
327
|
- **Affected:** React signup and payment forms with `multi_select` custom fields.
|
|
@@ -304,3 +304,38 @@
|
|
|
304
304
|
flex-shrink: 0;
|
|
305
305
|
opacity: 0.65;
|
|
306
306
|
}
|
|
307
|
+
|
|
308
|
+
.lockerverse-auctions__bid-types {
|
|
309
|
+
display: flex;
|
|
310
|
+
flex-wrap: wrap;
|
|
311
|
+
gap: 12px;
|
|
312
|
+
min-width: 0;
|
|
313
|
+
padding: 0;
|
|
314
|
+
margin: 0;
|
|
315
|
+
border: 0;
|
|
316
|
+
}
|
|
317
|
+
.lockerverse-auctions__bid-types legend {
|
|
318
|
+
margin-bottom: 8px;
|
|
319
|
+
font-weight: 600;
|
|
320
|
+
}
|
|
321
|
+
.lockerverse-auctions__bid-types label {
|
|
322
|
+
display: flex;
|
|
323
|
+
flex: 1 1 140px;
|
|
324
|
+
gap: 10px;
|
|
325
|
+
align-items: center;
|
|
326
|
+
min-height: 48px;
|
|
327
|
+
padding: 12px 16px;
|
|
328
|
+
cursor: pointer;
|
|
329
|
+
border: 1px solid var(--lockerverse-border);
|
|
330
|
+
border-radius: 12px;
|
|
331
|
+
}
|
|
332
|
+
.lockerverse-auctions__bid-types label:has(input:checked) {
|
|
333
|
+
border-color: var(--lockerverse-accent);
|
|
334
|
+
}
|
|
335
|
+
.lockerverse-auctions__bid-types input {
|
|
336
|
+
accent-color: var(--lockerverse-accent);
|
|
337
|
+
}
|
|
338
|
+
.lockerverse-auctions__bid-types input:focus-visible {
|
|
339
|
+
outline: 2px solid var(--lockerverse-accent);
|
|
340
|
+
outline-offset: 3px;
|
|
341
|
+
}
|
package/dist/auction-item.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e,c as t,i as n,l as r,n as i,r as a,s as o,t as s}from"./use-auction-boundary.js";import{n as c,t as l}from"./auction-image.js";import{a as u,i as d}from"./auction-payment.js";import{t as f}from"./auction-result2.js";import{t as p}from"./host-callback.js";import{ArrowRight as m,ChevronDown as h,ChevronLeft as g,ChevronRight as _,Clock3 as v,Gavel as y,Pause as b,Play as x,ShieldCheck as S,TimerReset as C,X as w}from"lucide-react";import{useCallback as T,useEffect as E,useId as D,useMemo as O,useRef as k,useState as A}from"react";import{Fragment as j,jsx as M,jsxs as N}from"react/jsx-runtime";import{getLockerverseAuctionMinimumBid as P}from"@lockerverse/sdk/auctions";import{Dialog as F}from"@base-ui/react/dialog";import I from"embla-carousel-autoplay";import L from"embla-carousel-react";const R=6e3;function z(e,t){let n=k(R),r=k(null),[i,a]=A(R),o=O(()=>I({delay:i,playOnInit:!1,stopOnFocusIn:!1,stopOnInteraction:!0,stopOnMouseEnter:!1}),[i]),[s,c]=L({duration:t?0:25,loop:!0},[o]),l=T(()=>{r.current&&(r.current.style.transform=`scaleX(${1-n.current/R})`)},[]),u=T(()=>{let e=o.timeUntilNext();e!==null&&(n.current=Math.max(1,Math.min(R,e))),o.stop(),l()},[o,l]),d=T(()=>{n.current=R,a(R),o.reset(),l()},[o,l]);return E(()=>{c&&(e?i===n.current?o.play():a(n.current):u())},[c,e,o,i,a,n,u]),E(()=>{if(!c)return;let t=0,r=()=>{let i=o.timeUntilNext();!e||i===null||(n.current=Math.max(0,Math.min(R,i)),l(),t=requestAnimationFrame(r))},i=()=>{cancelAnimationFrame(t),e&&(t=requestAnimationFrame(r))},a=()=>cancelAnimationFrame(t),s=()=>{e&&o.play()};return c.on(`select`,d).on(`reInit`,s).on(`autoplay:timerset`,i).on(`autoplay:timerstopped`,a),l(),i(),()=>{a(),c.off(`select`,d).off(`reInit`,s).off(`autoplay:timerset`,i).off(`autoplay:timerstopped`,a)}},[c,o,e,n,d,l]),{embla:c,freeze:u,progressRef:r,reset:d,viewportRef:s}}function B({photos:e,name:t,imageSizes:n=`(max-width: 1279px) 100vw, 45vw`,selected:r,paused:a=!1,photoButtonRef:o,onSelect:s,onExpand:c}){let u=k(null),d=k(null),f=k([]),[p,m]=A(!0),[h,v]=A(!1),[y,S]=A(!1),[C,w]=A(!1),[T,D]=A(!1),{ref:O,visible:P}=i(),[F,I]=A(!1),[L,R]=A(!0),B=k(null),V=`lockerverse-auction-gallery__control ${L||F||y?`is-visible`:``}`,H=()=>{B.current&&clearTimeout(B.current),B.current=setTimeout(()=>I(!1),2e3)},U=e=>{if(e.pointerType!==`mouse`){R(!0);return}I(!0),B.current&&clearTimeout(B.current),e.target instanceof Element&&e.target.closest(`[data-gallery-control]`)||H()};E(()=>{let e=window.matchMedia(`(hover: none), (pointer: coarse)`),t=()=>R(e.matches);return t(),e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t),clearTimeout(B.current??void 0)}},[]);let W=!(a||p||h||y||C||T)&&P,G=e.length,K=G?(r%G+G)%G:0,{viewportRef:q,embla:J,progressRef:Y,freeze:X,reset:Z}=z(W&&G>1,p);E(()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>m(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),E(()=>{if(!J)return;let e=()=>s(J.selectedScrollSnap());return J.on(`select`,e).on(`reInit`,e),()=>{J.off(`select`,e).off(`reInit`,e)}},[J,s]),E(()=>{J&&J.selectedScrollSnap()!==K&&J.scrollTo(K,!0)},[J,K]),E(()=>{let e=()=>{document.hidden&&X()},t=()=>D(!1);return e(),document.addEventListener(`visibilitychange`,e,!0),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{document.removeEventListener(`visibilitychange`,e,!0),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t)}},[X]);let Q=e=>{J?.scrollTo((e+G)%G,p),Z()};return E(()=>{let e=d.current;d.current=null,e&&document.activeElement===e&&O.current?.querySelector(`.lockerverse-auction-gallery__photo[tabindex="0"]`)?.focus({preventScroll:!0})},[K,O]),E(()=>{let e=u.current,t=f.current[K];if(!(e&&t))return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();r.left<n.left?e.scrollLeft-=n.left-r.left:r.right>n.right&&(e.scrollLeft+=r.right-n.right)},[K,G]),N(`section`,{"aria-label":`${t} photos`,className:`lockerverse-auction-gallery`,onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||S(!1)},onFocusCapture:e=>S(e.target.matches(`:focus-visible`)),onKeyDown:e=>{G<2||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),e.target instanceof HTMLButtonElement&&e.target.classList.contains(`lockerverse-auction-gallery__photo`)&&(d.current=e.target),Q(K+(e.key===`ArrowRight`?1:-1)))},onPointerEnter:e=>{e.pointerType===`mouse`&&v(!0)},onPointerLeave:e=>{e.pointerType===`mouse`&&v(!1)},ref:O,children:[G?N(`div`,{className:`lockerverse-auction-gallery__stage`,onPointerEnter:U,onPointerLeave:H,onPointerMove:U,children:[M(`div`,{className:`lockerverse-auction-gallery__viewport`,onPointerDownCapture:()=>{X(),D(!0)},ref:q,children:M(`div`,{className:`lockerverse-auction-gallery__track`,children:e.map((e,r)=>M(`div`,{"aria-hidden":r!==K,className:`lockerverse-auction-gallery__slide`,children:M(`button`,{"aria-label":`View photo ${r+1} of ${t} at full size`,className:`lockerverse-auction-gallery__photo`,onClick:()=>{c(r)},ref:r===K?o:void 0,tabIndex:r===K?0:-1,type:`button`,children:M(l,{alt:`${t}, ${r+1} of ${G}`,className:`lockerverse-auction-gallery__image`,draggable:!1,fetchPriority:r===0?`high`:`auto`,height:900,loading:r===K?`eager`:`lazy`,maxWidth:1920,sizes:r===K?n:`auto, ${n}`,src:e,width:1200})})},`${e}-${r}`))})}),G>1&&!p&&N(`div`,{className:`lockerverse-auction-gallery__rotation`,children:[M(`div`,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__progress-track`,children:M(`div`,{className:`lockerverse-auction-gallery__progress`,ref:Y,style:{transform:`scaleX(0)`}})}),M(`button`,{"aria-label":C?`Play photo rotation`:`Pause photo rotation`,className:`lockerverse-auction-gallery__play ${V}`,"data-gallery-control":!0,onClick:()=>w(e=>!e),title:C?`Play photo rotation`:`Pause photo rotation`,type:`button`,children:M(C?x:b,{"aria-hidden":`true`,size:13})})]}),G>1&&N(j,{children:[M(`button`,{"aria-label":`Previous photo`,className:`lockerverse-auction-gallery__previous ${V}`,"data-gallery-control":!0,onClick:()=>Q(K-1),type:`button`,children:M(g,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__chevron`})}),M(`button`,{"aria-label":`Next photo`,className:`lockerverse-auction-gallery__next ${V}`,"data-gallery-control":!0,onClick:()=>Q(K+1),type:`button`,children:M(_,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__chevron`})})]})]}):M(`div`,{className:`lockerverse-auction-gallery__empty`,children:`No photo available`}),G>1&&M(`section`,{"aria-label":`Choose a photo`,className:`lockerverse-auction-gallery__strip`,ref:u,children:M(`div`,{className:`lockerverse-auction-gallery__thumbnails`,children:e.map((e,t)=>M(`button`,{"aria-label":`Show photo ${t+1} of ${G}`,"aria-pressed":K===t,className:`lockerverse-auction-gallery__thumbnail ${K===t?`is-selected`:``}`,onClick:()=>Q(t),ref:e=>{f.current[t]=e},type:`button`,children:M(l,{alt:``,className:`lockerverse-auction-gallery__thumbnail-image`,height:66,loading:`lazy`,maxWidth:192,sizes:`88px`,src:e,width:88})},`${e}-${t}`))})})]})}function V({images:e,fallbackImage:t,name:n,imageSizes:r}){let i=[...new Set(e.filter(Boolean))];!i.length&&t&&i.push(t);let[a,o]=A(0),[s,c]=A(!1),u=k(null),d=k(null),f=i.length,p=f?(a%f+f)%f:0;return N(j,{children:[M(B,{imageSizes:r,name:n,onExpand:e=>{o(e),c(!0)},onSelect:o,paused:s,photoButtonRef:u,photos:i,selected:p}),f>0&&M(F.Root,{onOpenChange:c,open:s,children:N(F.Portal,{children:[M(F.Backdrop,{className:`lockerverse-auction-gallery__backdrop`}),N(F.Popup,{"aria-describedby":void 0,className:`lockerverse-auction-gallery__viewer`,finalFocus:u,onKeyDown:e=>{f<2||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),o((p+(e.key===`ArrowRight`?1:-1)+f)%f))},children:[N(F.Title,{className:`lockerverse-auction-gallery__sr-only`,children:[n,` · Photo `,p+1,` of `,f]}),N(`div`,{className:`lockerverse-auction-gallery__full-image`,onTouchCancel:()=>{d.current=null},onTouchEnd:e=>{let t=d.current;d.current=null;let n=e.changedTouches.item(0);if(!(t&&n)||f<2)return;let r=n.clientX-t.x,i=n.clientY-t.y;Math.abs(r)>=45&&Math.abs(r)>Math.abs(i)*1.3&&o((p+(r<0?1:-1)+f)%f)},onTouchMove:e=>{e.touches.length!==1&&(d.current=null)},onTouchStart:e=>{let t=e.touches.item(0);d.current=e.touches.length===1&&t?{x:t.clientX,y:t.clientY}:null},children:[M(l,{alt:`${n}, ${p+1} of ${f}`,height:900,maxWidth:1920,sizes:`100vw`,src:i[p],width:1200}),s&&f>1&&M(l,{alt:``,"aria-hidden":`true`,className:`lockerverse-auction-gallery__preload`,height:900,loading:`eager`,maxWidth:1920,sizes:`100vw`,src:i[(p+1)%f],width:1200})]}),M(F.Close,{"aria-label":`Close photo viewer`,className:`lockerverse-auction-gallery__viewer-close`,children:M(w,{"aria-hidden":`true`,size:22})}),f>1&&N(j,{children:[M(`button`,{"aria-label":`Previous photo`,className:`lockerverse-auction-gallery__viewer-previous`,onClick:()=>o((p-1+f)%f),type:`button`,children:M(g,{"aria-hidden":`true`,size:28})}),M(`button`,{"aria-label":`Next photo`,className:`lockerverse-auction-gallery__viewer-next`,onClick:()=>o((p+1)%f),type:`button`,children:M(_,{"aria-hidden":`true`,size:28})})]})]})]})})]})}const H={1:`h1`,2:`h2`};function U(e){return M(e===`Buy Now`?S:e===`Available`||e===`Increment`?C:y,{"aria-hidden":`true`,size:16})}function W(e,t){return e.saleMode===`buy_now`?[[`Buy Now`,n(e.buyNowPriceAmount??0)],[`Available`,e.availableQuantity===null?`Available`:String(e.availableQuantity)]]:t===`finished`?[[`Final bid`,e.maxBidAmount?n(e.maxBidAmount):`No bids`]]:[[`Current bid`,n(e.maxBidAmount??0)],[`Floor`,n(e.minBidAmount??0)],[`Increment`,n(e.bidIncrementAmount??100)]]}function G({auction:r,item:i,itemHeadingLevel:o=2,galleryImageSizes:c}){s(i.startAt??r.startAt,i.endAt??r.endAt);let[l,u]=A(!1),d=D(),f=e(r,i),p={active:`Closes`,draft:`Opens`,finished:`Closed`}[f],m=a(r,f,i),g=i.saleMode===`buy_now`,_=(i.description??``).trim().length>240,y=W(i,f),b=H[o];return N(`section`,{className:`lockerverse-auctions__item-summary`,children:[M(V,{fallbackImage:i.image??r.configuration.image??r.community?.banner??r.community?.thumbnail??null,imageSizes:c,images:i.images,name:i.name}),N(`div`,{className:`lockerverse-auctions__item-copy`,children:[M(b,{children:i.name}),i.description?N(`div`,{className:`lockerverse-auctions__item-description`,children:[M(t,{className:!l&&_?`lockerverse-auctions__description-clamped`:void 0,description:i.description,id:d}),_?N(`button`,{"aria-controls":d,"aria-expanded":l,className:`lockerverse-auctions__description-toggle`,onClick:()=>u(!l),type:`button`,children:[l?`Hide description`:`Read full description`,` `,M(h,{"aria-hidden":`true`,size:16,style:{transform:l?`rotate(180deg)`:void 0}})]}):null]}):null,N(`dl`,{className:`lockerverse-auctions__stat-panel`,children:[y.map(([e,t])=>N(`div`,{className:`lockerverse-auctions__stat-row`,children:[N(`dt`,{children:[U(e),e]}),M(`dd`,{children:t})]},e)),N(`div`,{className:`lockerverse-auctions__stat-row`,children:[N(`dt`,{children:[M(v,{"aria-hidden":`true`,size:16}),p]}),M(`dd`,{className:`lockerverse-auctions__stat-date`,children:m})]}),!g&&f===`finished`?N(`div`,{className:`lockerverse-auctions__stat-footer`,children:[N(`div`,{children:[M(`dt`,{children:`Floor`}),M(`dd`,{children:n(i.minBidAmount??0)})]}),N(`div`,{children:[M(`dt`,{children:`Bid increment`}),M(`dd`,{children:n(i.bidIncrementAmount??100)})]})]}):null]})]})]})}const K={1:`h2`,2:`h3`},q=/^\d+$/;function J(e,t){let r=Number(e),i=r*(t.buyNowPriceAmount??0);if(!(q.test(e)&&Number.isSafeInteger(i))||r<1)return`Enter a whole-number quantity.`;if(!t.additionalCharge)return`Total: ${n(i)}`;let a=t.additionalCharge.firstUnitAmountCents+t.additionalCharge.additionalUnitAmountCents*(r-1),o=i+a;return Number.isSafeInteger(o)?`Subtotal: ${n(i)} · ${t.additionalCharge.name}: ${n(a)} · Total: ${n(o)}`:`Enter a valid quantity.`}function Y(e,t,n){return String(e?t?t.quantity:1:t?t.amount/100:n)}function X(e,t){return o(e)?`This item is sold out.`:t===`draft`?`This item is not open yet.`:t===`finished`?e.saleMode===`buy_now`?`Purchases are closed for this item.`:`Bidding is closed for this item.`:`This item is not available.`}function Z(e,t,n){return o(t)?`All available quantities have been purchased.`:n===`draft`?`This item opens ${a(e,`draft`,t)}.`:t.saleMode===`buy_now`?`This item is no longer available to purchase.`:`Bidding has closed for this item.`}function Q(e,t,n,r){return{amount:t?0:Number(r)*100,includeServiceFee:n?n.includeServiceFee:e.serviceFeeEnabled&&e.serviceFeeDefaultChecked,quantity:t?Number(r):1}}function $({auction:t,item:i,initialSelection:a,onContinue:c,onError:l,onBack:f,backHref:p,itemHeadingLevel:h=2}){let g=K[h],_=i.saleMode===`buy_now`,v=Math.ceil(P(i)/100),[y,b]=A(Y(_,a,v)),[x,S]=A(null),C=D();s(i.startAt??t.startAt,i.endAt??t.endAt);let w=e(t,i),T=w===`active`&&!o(i)&&i.saleMode!==`hybrid`;function E(e){if(e.preventDefault(),!q.test(y)){S(_?`Enter a whole-number quantity.`:`Enter a whole-dollar bid amount.`);return}let n=Q(t,_,a,y),r=d(t,i,n);if(r){S(r),l(r);return}try{u(t,i,n)}catch{S(`Enter a valid amount or quantity.`);return}c(n)}return T?N(`form`,{className:`lockerverse-auctions__selection`,onSubmit:E,children:[M(ee,{buyNow:_,headingTag:g,item:i,minimum:v}),N(`div`,{className:`lockerverse-auctions__selection-body`,children:[N(`label`,{className:`lockerverse-auctions__field`,htmlFor:C,children:[_?`Quantity`:`Your bid amount`,N(`span`,{className:`lockerverse-auctions__amount-control`,children:[_?null:M(`span`,{"aria-hidden":`true`,children:`$`}),M(`input`,{"aria-describedby":`${C}-help`,"aria-invalid":!!x,autoComplete:`off`,id:C,inputMode:`numeric`,onChange:e=>{b(e.target.value),S(null)},placeholder:_?`1`:String(v),required:!0,value:y})]})]}),x?M(`p`,{role:`alert`,children:x}):null,M(`p`,{id:`${C}-help`,children:_?J(y,i):`Enter a whole-dollar bid of at least ${n(v*100)}. Bid increment: ${n(i.bidIncrementAmount??100)}.`}),M(te,{item:i}),N(`div`,{className:`lockerverse-auctions__selection-footer`,children:[M(`p`,{children:_?`Continuing moves you into secure checkout where your payment is processed immediately.`:`Continuing moves you into the secure payment step where your card is stored for settlement only if your bid wins.`}),N(`button`,{className:`lockerverse-auctions__button`,disabled:!t.payment,type:`submit`,children:[_?`Continue to Checkout`:`Continue to Payment`,` `,M(m,{"aria-hidden":`true`,size:16})]})]}),t.payment?null:M(`p`,{role:`alert`,children:`Payments are not configured for this auction.`})]})]}):N(`div`,{className:`lockerverse-auctions__selection lockerverse-auctions__read-only`,children:[M(`p`,{className:`lockerverse-auctions__eyebrow`,children:`Item status`}),M(g,{children:X(i,w)}),M(`p`,{children:Z(t,i,w)}),N(r,{className:`lockerverse-auctions__button`,href:p,onBack:f,children:[`Browse auction items `,M(m,{"aria-hidden":`true`,size:16})]})]})}function ee({headingTag:e,item:t,buyNow:r,minimum:i}){return N(`div`,{className:`lockerverse-auctions__selection-header`,children:[M(`p`,{className:`lockerverse-auctions__eyebrow`,children:`Step 1 of 2`}),M(e,{children:r?`Buy this item now.`:`Place your bid.`}),M(`p`,{children:r?`Choose how many you want, then complete the secure checkout.`:`Enter the bid amount you want to place for this item. You are only charged if this bid wins after bidding closes.`}),N(`p`,{children:[r?`Price: `:`Minimum qualifying bid: `,M(`strong`,{children:n(r?t.buyNowPriceAmount??0:i*100)})]}),r&&t.availableQuantity!==null?N(`p`,{children:[t.availableQuantity,` available`]}):null,t.collectShippingAddress?M(`p`,{children:`The next step will also collect a delivery address for seller fulfillment.`}):null]})}function te({item:e}){return e.saleMode===`buy_now`||!e.additionalCharge?null:N(`p`,{children:[e.additionalCharge.name,`:`,` `,n(e.additionalCharge.firstUnitAmountCents),` will be added to your winning bid.`]})}function ne(e){let[t,n]=A(null),[r,i]=A(!1),a=!!(e.resumePurchase||e.interactionLocked);return E(()=>{let e=!0;return import(`./auction-payment-view.js`).then(({AuctionPayment:t})=>{e&&n(()=>t)},()=>{e&&i(!0)}),()=>{e=!1}},[]),t?M(t,{...e}):N(`div`,{children:[M(`p`,{role:r?`alert`:`status`,children:r?`Payment details could not load.`:`Loading secure payment details…`}),r&&a&&M(`p`,{children:`Your purchase status is not confirmed. Keep this page open and contact the auction organizer before you try another purchase.`}),a?null:M(`button`,{onClick:e.onBack,type:`button`,children:`Back to item`}),r&&!a&&M(`button`,{onClick:()=>window.location.reload(),type:`button`,children:`Reload page to try again`})]})}function re({buyNow:e}){return N(`div`,{className:`lockerverse-auctions__progress`,children:[N(`span`,{children:[M(e?S:y,{"aria-hidden":`true`,size:16}),e?`Choose quantity`:`Place bid`]}),N(`span`,{children:[M(S,{"aria-hidden":`true`,size:16}),e?`Pay securely`:`Secure card`]}),N(`span`,{children:[M(C,{"aria-hidden":`true`,size:16}),e?`Get confirmation`:`Wait for close`]})]})}function ie(e){let{auction:t,item:n,outcome:r}=e,i;return e.backHref?i={href:e.backHref,label:`View auction items`}:e.onBack&&(i={label:`View auction items`,onClick:e.onBack}),M(f,{auctionName:t.name,className:e.className,closesAtLabel:a(t,`active`,n),communityName:e.communityName??t.community?.name,focusHeading:!0,imageUrl:n.image??n.images[0]??t.configuration.image??void 0,itemName:n.name,outcome:r,primaryAction:e.returnToItemHref?{href:e.returnToItemHref,label:`Return to item`}:i,secondaryAction:e.returnToItemHref?i:void 0,style:{"--lockerverse-accent":t.community?.color??`#6f8f6d`,...e.style},theme:e.theme})}function ae(t){let{auction:n,itemId:i,resumePurchase:a,className:o,theme:c=`dark`,style:l}=t,u=k(null),[d,f]=A(n),h=k(n),_=d.items.find(e=>e.id===i)??a?.item;s(_?.startAt??d.startAt,_?.endAt??d.endAt);let[v,y]=A(()=>a?{amount:0,includeServiceFee:a.submission.includeServiceFee??!1,quantity:a.submission.quantity}:null),[b,x]=A(!!a),S=k(!0),C=k(t);C.current=t;let w=k(null),D=T(e=>{S.current&&x(e),w.current!==e&&(w.current=e,p(C.current.onInteractionLockChange,e))},[]),O=!!a;E(()=>(S.current=!0,D(O),()=>{S.current=!1}),[O,D]);let[j,P]=A({email:``,phone:``}),[F,I]=A(!!a),[L,R]=A(null),[z,B]=A(null);E(()=>{!(F||b||a)&&h.current!==n&&(h.current=n,f(n))},[n,F,b,a]);function V(e,t){D(!1),h.current=C.current.auction,f(e),y(null),I(!1),R(t)}function H(e){R(null),y(e),I(!0)}return _?z?M(ie,{...t,auction:d,item:_,outcome:z}):N(`section`,{className:[`lockerverse-auctions`,o].filter(Boolean).join(` `),"data-lockerverse-theme":c,ref:u,style:{"--lockerverse-accent":d.community?.color??`#6f8f6d`,...l},children:[b?null:N(r,{className:`lockerverse-auctions__back`,href:t.backHref,onBack:t.onBack,children:[M(g,{"aria-hidden":`true`,size:16}),` All items`]}),N(`div`,{className:`lockerverse-auctions__detail`,children:[M(G,{auction:d,galleryImageSizes:t.galleryImageSizes,item:_,itemHeadingLevel:t.itemHeadingLevel}),N(`div`,{className:`lockerverse-auctions__transaction`,children:[e(d,_)===`active`?M(re,{buyNow:_.saleMode===`buy_now`}):null,L?M(`p`,{className:`lockerverse-auctions__notice`,role:`alert`,children:L}):null,F&&v?M(ne,{...t,appearanceRoot:u,auction:d,communityName:t.communityName??d.community?.name,contact:j,interactionLocked:b,item:_,onBack:()=>I(!1),onContactChange:P,onIncludeServiceFeeChange:e=>y(t=>t&&{...t,includeServiceFee:d.serviceFeeEnabled&&e}),onInteractionLockChange:D,onResult:B,onReview:V,selection:v}):M($,{auction:d,backHref:t.backHref,initialSelection:v,item:_,itemHeadingLevel:t.itemHeadingLevel,onBack:t.onBack,onContinue:H,onError:R}),b?null:N(r,{className:`lockerverse-auctions__footer-back`,href:t.backHref,onBack:t.onBack,children:[`Back to auction items `,M(m,{"aria-hidden":`true`,size:16})]})]})]})]}):N(`div`,{children:[M(`p`,{role:`alert`,children:`This auction item is no longer available.`}),M(r,{href:t.backHref,onBack:t.onBack,children:`Back to auction items`})]})}function oe(e){let t=k({auctionId:e.auction.id,client:e.client,itemId:e.itemId});if(t.current.client!==e.client||t.current.auctionId!==e.auction.id||t.current.itemId!==e.itemId)throw TypeError(`Auction item identity cannot change. Remount with a new React key.`);if(e.resumePurchase&&(e.resumePurchase.auctionId!==e.auction.id||e.resumePurchase.itemId!==e.itemId||e.resumePurchase.item.id!==e.itemId||e.resumePurchase.item.auctionId!==e.auction.id))throw TypeError(`The purchase recovery record belongs to a different auction item.`);return M(c.Provider,{value:e.auction.mediaBaseUrl,children:M(ae,{...e})})}export{oe as LockerverseAuctionItem};
|
|
1
|
+
import{a as e,c as t,i as n,l as r,n as i,r as a,s as o,t as s}from"./use-auction-boundary.js";import{n as c,t as l}from"./auction-image.js";import{a as u,i as d}from"./auction-payment.js";import{t as f}from"./auction-result2.js";import{t as p}from"./host-callback.js";import{ArrowRight as m,ChevronDown as h,ChevronLeft as g,ChevronRight as _,Clock3 as v,Gavel as y,Pause as b,Play as x,ShieldCheck as S,TimerReset as C,X as w}from"lucide-react";import{useCallback as T,useEffect as E,useId as D,useMemo as O,useRef as k,useState as A}from"react";import{Fragment as j,jsx as M,jsxs as N}from"react/jsx-runtime";import{getLockerverseAuctionMinimumBid as P}from"@lockerverse/sdk/auctions";import{Dialog as F}from"@base-ui/react/dialog";import I from"embla-carousel-autoplay";import L from"embla-carousel-react";const R=6e3;function z(e,t){let n=k(R),r=k(null),[i,a]=A(R),o=O(()=>I({delay:i,playOnInit:!1,stopOnFocusIn:!1,stopOnInteraction:!0,stopOnMouseEnter:!1}),[i]),[s,c]=L({duration:t?0:25,loop:!0},[o]),l=T(()=>{r.current&&(r.current.style.transform=`scaleX(${1-n.current/R})`)},[]),u=T(()=>{let e=o.timeUntilNext();e!==null&&(n.current=Math.max(1,Math.min(R,e))),o.stop(),l()},[o,l]),d=T(()=>{n.current=R,a(R),o.reset(),l()},[o,l]);return E(()=>{c&&(e?i===n.current?o.play():a(n.current):u())},[c,e,o,i,a,n,u]),E(()=>{if(!c)return;let t=0,r=()=>{let i=o.timeUntilNext();!e||i===null||(n.current=Math.max(0,Math.min(R,i)),l(),t=requestAnimationFrame(r))},i=()=>{cancelAnimationFrame(t),e&&(t=requestAnimationFrame(r))},a=()=>cancelAnimationFrame(t),s=()=>{e&&o.play()};return c.on(`select`,d).on(`reInit`,s).on(`autoplay:timerset`,i).on(`autoplay:timerstopped`,a),l(),i(),()=>{a(),c.off(`select`,d).off(`reInit`,s).off(`autoplay:timerset`,i).off(`autoplay:timerstopped`,a)}},[c,o,e,n,d,l]),{embla:c,freeze:u,progressRef:r,reset:d,viewportRef:s}}function B({photos:e,name:t,imageSizes:n=`(max-width: 1279px) 100vw, 45vw`,selected:r,paused:a=!1,photoButtonRef:o,onSelect:s,onExpand:c}){let u=k(null),d=k(null),f=k([]),[p,m]=A(!0),[h,v]=A(!1),[y,S]=A(!1),[C,w]=A(!1),[T,D]=A(!1),{ref:O,visible:P}=i(),[F,I]=A(!1),[L,R]=A(!0),B=k(null),V=`lockerverse-auction-gallery__control ${L||F||y?`is-visible`:``}`,H=()=>{B.current&&clearTimeout(B.current),B.current=setTimeout(()=>I(!1),2e3)},U=e=>{if(e.pointerType!==`mouse`){R(!0);return}I(!0),B.current&&clearTimeout(B.current),e.target instanceof Element&&e.target.closest(`[data-gallery-control]`)||H()};E(()=>{let e=window.matchMedia(`(hover: none), (pointer: coarse)`),t=()=>R(e.matches);return t(),e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t),clearTimeout(B.current??void 0)}},[]);let W=!(a||p||h||y||C||T)&&P,G=e.length,K=G?(r%G+G)%G:0,{viewportRef:q,embla:J,progressRef:Y,freeze:X,reset:Z}=z(W&&G>1,p);E(()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>m(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),E(()=>{if(!J)return;let e=()=>s(J.selectedScrollSnap());return J.on(`select`,e).on(`reInit`,e),()=>{J.off(`select`,e).off(`reInit`,e)}},[J,s]),E(()=>{J&&J.selectedScrollSnap()!==K&&J.scrollTo(K,!0)},[J,K]),E(()=>{let e=()=>{document.hidden&&X()},t=()=>D(!1);return e(),document.addEventListener(`visibilitychange`,e,!0),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{document.removeEventListener(`visibilitychange`,e,!0),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t)}},[X]);let Q=e=>{J?.scrollTo((e+G)%G,p),Z()};return E(()=>{let e=d.current;d.current=null,e&&document.activeElement===e&&O.current?.querySelector(`.lockerverse-auction-gallery__photo[tabindex="0"]`)?.focus({preventScroll:!0})},[K,O]),E(()=>{let e=u.current,t=f.current[K];if(!(e&&t))return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();r.left<n.left?e.scrollLeft-=n.left-r.left:r.right>n.right&&(e.scrollLeft+=r.right-n.right)},[K,G]),N(`section`,{"aria-label":`${t} photos`,className:`lockerverse-auction-gallery`,onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||S(!1)},onFocusCapture:e=>S(e.target.matches(`:focus-visible`)),onKeyDown:e=>{G<2||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),e.target instanceof HTMLButtonElement&&e.target.classList.contains(`lockerverse-auction-gallery__photo`)&&(d.current=e.target),Q(K+(e.key===`ArrowRight`?1:-1)))},onPointerEnter:e=>{e.pointerType===`mouse`&&v(!0)},onPointerLeave:e=>{e.pointerType===`mouse`&&v(!1)},ref:O,children:[G?N(`div`,{className:`lockerverse-auction-gallery__stage`,onPointerEnter:U,onPointerLeave:H,onPointerMove:U,children:[M(`div`,{className:`lockerverse-auction-gallery__viewport`,onPointerDownCapture:()=>{X(),D(!0)},ref:q,children:M(`div`,{className:`lockerverse-auction-gallery__track`,children:e.map((e,r)=>M(`div`,{"aria-hidden":r!==K,className:`lockerverse-auction-gallery__slide`,children:M(`button`,{"aria-label":`View photo ${r+1} of ${t} at full size`,className:`lockerverse-auction-gallery__photo`,onClick:()=>{c(r)},ref:r===K?o:void 0,tabIndex:r===K?0:-1,type:`button`,children:M(l,{alt:`${t}, ${r+1} of ${G}`,className:`lockerverse-auction-gallery__image`,draggable:!1,fetchPriority:r===0?`high`:`auto`,height:900,loading:r===K?`eager`:`lazy`,maxWidth:1920,sizes:r===K?n:`auto, ${n}`,src:e,width:1200})})},`${e}-${r}`))})}),G>1&&!p&&N(`div`,{className:`lockerverse-auction-gallery__rotation`,children:[M(`div`,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__progress-track`,children:M(`div`,{className:`lockerverse-auction-gallery__progress`,ref:Y,style:{transform:`scaleX(0)`}})}),M(`button`,{"aria-label":C?`Play photo rotation`:`Pause photo rotation`,className:`lockerverse-auction-gallery__play ${V}`,"data-gallery-control":!0,onClick:()=>w(e=>!e),title:C?`Play photo rotation`:`Pause photo rotation`,type:`button`,children:M(C?x:b,{"aria-hidden":`true`,size:13})})]}),G>1&&N(j,{children:[M(`button`,{"aria-label":`Previous photo`,className:`lockerverse-auction-gallery__previous ${V}`,"data-gallery-control":!0,onClick:()=>Q(K-1),type:`button`,children:M(g,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__chevron`})}),M(`button`,{"aria-label":`Next photo`,className:`lockerverse-auction-gallery__next ${V}`,"data-gallery-control":!0,onClick:()=>Q(K+1),type:`button`,children:M(_,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__chevron`})})]})]}):M(`div`,{className:`lockerverse-auction-gallery__empty`,children:`No photo available`}),G>1&&M(`section`,{"aria-label":`Choose a photo`,className:`lockerverse-auction-gallery__strip`,ref:u,children:M(`div`,{className:`lockerverse-auction-gallery__thumbnails`,children:e.map((e,t)=>M(`button`,{"aria-label":`Show photo ${t+1} of ${G}`,"aria-pressed":K===t,className:`lockerverse-auction-gallery__thumbnail ${K===t?`is-selected`:``}`,onClick:()=>Q(t),ref:e=>{f.current[t]=e},type:`button`,children:M(l,{alt:``,className:`lockerverse-auction-gallery__thumbnail-image`,height:66,loading:`lazy`,maxWidth:192,sizes:`88px`,src:e,width:88})},`${e}-${t}`))})})]})}function V({images:e,fallbackImage:t,name:n,imageSizes:r}){let i=[...new Set(e.filter(Boolean))];!i.length&&t&&i.push(t);let[a,o]=A(0),[s,c]=A(!1),u=k(null),d=k(null),f=i.length,p=f?(a%f+f)%f:0;return N(j,{children:[M(B,{imageSizes:r,name:n,onExpand:e=>{o(e),c(!0)},onSelect:o,paused:s,photoButtonRef:u,photos:i,selected:p}),f>0&&M(F.Root,{onOpenChange:c,open:s,children:N(F.Portal,{children:[M(F.Backdrop,{className:`lockerverse-auction-gallery__backdrop`}),N(F.Popup,{"aria-describedby":void 0,className:`lockerverse-auction-gallery__viewer`,finalFocus:u,onKeyDown:e=>{f<2||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),o((p+(e.key===`ArrowRight`?1:-1)+f)%f))},children:[N(F.Title,{className:`lockerverse-auction-gallery__sr-only`,children:[n,` · Photo `,p+1,` of `,f]}),N(`div`,{className:`lockerverse-auction-gallery__full-image`,onTouchCancel:()=>{d.current=null},onTouchEnd:e=>{let t=d.current;d.current=null;let n=e.changedTouches.item(0);if(!(t&&n)||f<2)return;let r=n.clientX-t.x,i=n.clientY-t.y;Math.abs(r)>=45&&Math.abs(r)>Math.abs(i)*1.3&&o((p+(r<0?1:-1)+f)%f)},onTouchMove:e=>{e.touches.length!==1&&(d.current=null)},onTouchStart:e=>{let t=e.touches.item(0);d.current=e.touches.length===1&&t?{x:t.clientX,y:t.clientY}:null},children:[M(l,{alt:`${n}, ${p+1} of ${f}`,height:900,maxWidth:1920,sizes:`100vw`,src:i[p],width:1200}),s&&f>1&&M(l,{alt:``,"aria-hidden":`true`,className:`lockerverse-auction-gallery__preload`,height:900,loading:`eager`,maxWidth:1920,sizes:`100vw`,src:i[(p+1)%f],width:1200})]}),M(F.Close,{"aria-label":`Close photo viewer`,className:`lockerverse-auction-gallery__viewer-close`,children:M(w,{"aria-hidden":`true`,size:22})}),f>1&&N(j,{children:[M(`button`,{"aria-label":`Previous photo`,className:`lockerverse-auction-gallery__viewer-previous`,onClick:()=>o((p-1+f)%f),type:`button`,children:M(g,{"aria-hidden":`true`,size:28})}),M(`button`,{"aria-label":`Next photo`,className:`lockerverse-auction-gallery__viewer-next`,onClick:()=>o((p+1)%f),type:`button`,children:M(_,{"aria-hidden":`true`,size:28})})]})]})]})})]})}const H={1:`h1`,2:`h2`};function U(e){return M(e===`Buy Now`?S:e===`Available`||e===`Increment`?C:y,{"aria-hidden":`true`,size:16})}function W(e,t){return e.saleMode===`buy_now`?[[`Buy Now`,n(e.buyNowPriceAmount??0)],[`Available`,e.availableQuantity===null?`Available`:String(e.availableQuantity)]]:t===`finished`?[[`Final bid`,e.maxBidAmount?n(e.maxBidAmount):`No bids`]]:[[`Current bid`,n(e.maxBidAmount??0)],[`Floor`,n(e.minBidAmount??0)],[`Increment`,n(e.bidIncrementAmount??100)]]}function G({auction:r,item:i,itemHeadingLevel:o=2,galleryImageSizes:c}){s(i.startAt??r.startAt,i.endAt??r.endAt);let[l,u]=A(!1),d=D(),f=e(r,i),p={active:`Closes`,draft:`Opens`,finished:`Closed`}[f],m=a(r,f,i),g=i.saleMode===`buy_now`,_=(i.description??``).trim().length>240,y=W(i,f),b=H[o];return N(`section`,{className:`lockerverse-auctions__item-summary`,children:[M(V,{fallbackImage:i.image??r.configuration.image??r.community?.banner??r.community?.thumbnail??null,imageSizes:c,images:i.images,name:i.name}),N(`div`,{className:`lockerverse-auctions__item-copy`,children:[M(b,{children:i.name}),i.description?N(`div`,{className:`lockerverse-auctions__item-description`,children:[M(t,{className:!l&&_?`lockerverse-auctions__description-clamped`:void 0,description:i.description,id:d}),_?N(`button`,{"aria-controls":d,"aria-expanded":l,className:`lockerverse-auctions__description-toggle`,onClick:()=>u(!l),type:`button`,children:[l?`Hide description`:`Read full description`,` `,M(h,{"aria-hidden":`true`,size:16,style:{transform:l?`rotate(180deg)`:void 0}})]}):null]}):null,N(`dl`,{className:`lockerverse-auctions__stat-panel`,children:[y.map(([e,t])=>N(`div`,{className:`lockerverse-auctions__stat-row`,children:[N(`dt`,{children:[U(e),e]}),M(`dd`,{children:t})]},e)),N(`div`,{className:`lockerverse-auctions__stat-row`,children:[N(`dt`,{children:[M(v,{"aria-hidden":`true`,size:16}),p]}),M(`dd`,{className:`lockerverse-auctions__stat-date`,children:m})]}),!g&&f===`finished`?N(`div`,{className:`lockerverse-auctions__stat-footer`,children:[N(`div`,{children:[M(`dt`,{children:`Floor`}),M(`dd`,{children:n(i.minBidAmount??0)})]}),N(`div`,{children:[M(`dt`,{children:`Bid increment`}),M(`dd`,{children:n(i.bidIncrementAmount??100)})]})]}):null]})]})]})}const K={1:`h2`,2:`h3`},q=/^\d+$/;function J(e,t){let r=Number(e),i=r*(t.buyNowPriceAmount??0);if(!(q.test(e)&&Number.isSafeInteger(i))||r<1)return`Enter a whole-number quantity.`;if(!t.additionalCharge)return`Total: ${n(i)}`;let a=t.additionalCharge.firstUnitAmountCents+t.additionalCharge.additionalUnitAmountCents*(r-1),o=i+a;return Number.isSafeInteger(o)?`Subtotal: ${n(i)} · ${t.additionalCharge.name}: ${n(a)} · Total: ${n(o)}`:`Enter a valid quantity.`}function Y(e,t,n){return String(e?t?t.quantity:1:t?t.amount/100:n)}function X(e,t){return o(e)?`This item is sold out.`:t===`draft`?`This item is not open yet.`:t===`finished`?e.saleMode===`buy_now`?`Purchases are closed for this item.`:`Bidding is closed for this item.`:`This item is not available.`}function Z(e,t,n){return o(t)?`All available quantities have been purchased.`:n===`draft`?`This item opens ${a(e,`draft`,t)}.`:t.saleMode===`buy_now`?`This item is no longer available to purchase.`:`Bidding has closed for this item.`}function Q(e,t,n,r,i){let a={amount:t?0:Number(r)*100,includeServiceFee:n?n.includeServiceFee:e.serviceFeeEnabled&&e.serviceFeeDefaultChecked,quantity:t?Number(r):1};return t||(a.bidType=i),a}function $({auction:t,item:i,initialSelection:a,onContinue:c,onError:l,onBack:f,backHref:p,itemHeadingLevel:h=2}){let g=K[h],_=i.saleMode===`buy_now`,v=Math.ceil(P(i)/100),[y,b]=A(Y(_,a,v)),[x,S]=A(a?.bidType??`fixed`),[C,w]=A(null),T=D();s(i.startAt??t.startAt,i.endAt??t.endAt);let E=e(t,i),O=E===`active`&&!o(i)&&i.saleMode!==`hybrid`;function k(e){if(e.preventDefault(),!q.test(y)){w(_?`Enter a whole-number quantity.`:`Enter a whole-dollar bid amount.`);return}let n=Q(t,_,a,y,x),r=d(t,i,n);if(r){w(r),l(r);return}try{u(t,i,n)}catch{w(`Enter a valid amount or quantity.`);return}c(n)}return O?N(`form`,{className:`lockerverse-auctions__selection`,onSubmit:k,children:[M(ee,{buyNow:_,headingTag:g,item:i,minimum:v}),N(`div`,{className:`lockerverse-auctions__selection-body`,children:[M(re,{bidType:x,enabled:!_&&!!i.supportsMaximumBids,id:T,onChange:e=>{S(e),w(null)}}),N(`label`,{className:`lockerverse-auctions__field`,htmlFor:T,children:[ne(_,x),N(`span`,{className:`lockerverse-auctions__amount-control`,children:[_?null:M(`span`,{"aria-hidden":`true`,children:`$`}),M(`input`,{"aria-describedby":`${T}-help`,"aria-invalid":!!C,autoComplete:`off`,id:T,inputMode:`numeric`,onChange:e=>{b(e.target.value),w(null)},placeholder:_?`1`:String(v),required:!0,value:y})]})]}),C?M(`p`,{role:`alert`,children:C}):null,M(`p`,{id:`${T}-help`,children:_?J(y,i):`Enter a whole-dollar bid of at least ${n(v*100)}. Bid increment: ${n(i.bidIncrementAmount??100)}.`}),M(te,{item:i}),N(`div`,{className:`lockerverse-auctions__selection-footer`,children:[M(`p`,{children:_?`Continuing moves you into secure checkout where your payment is processed immediately.`:`Continuing moves you into the secure payment step where your card is stored for settlement only if your bid wins.`}),N(`button`,{className:`lockerverse-auctions__button`,disabled:!t.payment,type:`submit`,children:[_?`Continue to Checkout`:`Continue to Payment`,` `,M(m,{"aria-hidden":`true`,size:16})]})]}),t.payment?null:M(`p`,{role:`alert`,children:`Payments are not configured for this auction.`})]})]}):N(`div`,{className:`lockerverse-auctions__selection lockerverse-auctions__read-only`,children:[M(`p`,{className:`lockerverse-auctions__eyebrow`,children:`Item status`}),M(g,{children:X(i,E)}),M(`p`,{children:Z(t,i,E)}),N(r,{className:`lockerverse-auctions__button`,href:p,onBack:f,children:[`Browse auction items `,M(m,{"aria-hidden":`true`,size:16})]})]})}function ee({headingTag:e,item:t,buyNow:r,minimum:i}){return N(`div`,{className:`lockerverse-auctions__selection-header`,children:[M(`p`,{className:`lockerverse-auctions__eyebrow`,children:`Step 1 of 2`}),M(e,{children:r?`Buy this item now.`:`Place your bid.`}),M(`p`,{children:r?`Choose how many you want, then complete the secure checkout.`:`Choose your bid amount. You are only charged if this bid wins after bidding closes.`}),N(`p`,{children:[r?`Price: `:`Minimum qualifying bid: `,M(`strong`,{children:n(r?t.buyNowPriceAmount??0:i*100)})]}),r&&t.availableQuantity!==null?N(`p`,{children:[t.availableQuantity,` available`]}):null,t.collectShippingAddress?M(`p`,{children:`The next step will also collect a delivery address for seller fulfillment.`}):null]})}function te({item:e}){return e.saleMode===`buy_now`||!e.additionalCharge?null:N(`p`,{children:[e.additionalCharge.name,`:`,` `,n(e.additionalCharge.firstUnitAmountCents),` will be added to your winning bid.`]})}function ne(e,t){return e?`Quantity`:t===`maximum`?`Your maximum bid`:`Your bid amount`}function re({bidType:e,enabled:t,id:n,onChange:r}){return t?N(j,{children:[N(`fieldset`,{className:`lockerverse-auctions__bid-types`,children:[M(`legend`,{children:`Bid type`}),[`fixed`,`maximum`].map(t=>N(`label`,{children:[M(`input`,{checked:e===t,name:`${n}-bid-type`,onChange:()=>r(t),type:`radio`,value:t}),M(`span`,{children:t===`fixed`?`Fixed bid`:`Maximum bid`})]},t))]}),M(`p`,{"aria-live":`polite`,children:e===`maximum`?`We bid for you up to your private limit, using only what is needed to lead. Once accepted, your maximum cannot be changed or canceled. A new bid is separate and can compete with your earlier bids.`:`Place this amount as your bid. We will not increase it automatically.`})]}):null}function ie(e){let[t,n]=A(null),[r,i]=A(!1),a=!!(e.resumePurchase||e.interactionLocked);return E(()=>{let e=!0;return import(`./auction-payment-view.js`).then(({AuctionPayment:t})=>{e&&n(()=>t)},()=>{e&&i(!0)}),()=>{e=!1}},[]),t?M(t,{...e}):N(`div`,{children:[M(`p`,{role:r?`alert`:`status`,children:r?`Payment details could not load.`:`Loading secure payment details…`}),r&&a&&M(`p`,{children:`Your purchase status is not confirmed. Keep this page open and contact the auction organizer before you try another purchase.`}),a?null:M(`button`,{onClick:e.onBack,type:`button`,children:`Back to item`}),r&&!a&&M(`button`,{onClick:()=>window.location.reload(),type:`button`,children:`Reload page to try again`})]})}function ae({buyNow:e}){return N(`div`,{className:`lockerverse-auctions__progress`,children:[N(`span`,{children:[M(e?S:y,{"aria-hidden":`true`,size:16}),e?`Choose quantity`:`Place bid`]}),N(`span`,{children:[M(S,{"aria-hidden":`true`,size:16}),e?`Pay securely`:`Secure card`]}),N(`span`,{children:[M(C,{"aria-hidden":`true`,size:16}),e?`Get confirmation`:`Wait for close`]})]})}function oe(e){let{auction:t,item:n,outcome:r}=e,i;return e.backHref?i={href:e.backHref,label:`View auction items`}:e.onBack&&(i={label:`View auction items`,onClick:e.onBack}),M(f,{auctionName:t.name,className:e.className,closesAtLabel:a(t,`active`,n),communityName:e.communityName??t.community?.name,focusHeading:!0,imageUrl:n.image??n.images[0]??t.configuration.image??void 0,itemName:n.name,outcome:r,primaryAction:e.returnToItemHref?{href:e.returnToItemHref,label:`Return to item`}:i,secondaryAction:e.returnToItemHref?i:void 0,style:{"--lockerverse-accent":t.community?.color??`#6f8f6d`,...e.style},theme:e.theme})}function se(t){let{auction:n,itemId:i,resumePurchase:a,className:o,theme:c=`dark`,style:l}=t,u=k(null),[d,f]=A(n),h=k(n),_=d.items.find(e=>e.id===i)??a?.item;s(_?.startAt??d.startAt,_?.endAt??d.endAt);let[v,y]=A(()=>a?{amount:0,includeServiceFee:a.submission.includeServiceFee??!1,quantity:a.submission.quantity}:null),[b,x]=A(!!a),S=k(!0),C=k(t);C.current=t;let w=k(null),D=T(e=>{S.current&&x(e),w.current!==e&&(w.current=e,p(C.current.onInteractionLockChange,e))},[]),O=!!a;E(()=>(S.current=!0,D(O),()=>{S.current=!1}),[O,D]);let[j,P]=A({email:``,phone:``}),[F,I]=A(!!a),[L,R]=A(null),[z,B]=A(null);E(()=>{!(F||b||a)&&h.current!==n&&(h.current=n,f(n))},[n,F,b,a]);function V(e,t){D(!1),h.current=C.current.auction,f(e),y(null),I(!1),R(t)}function H(e){R(null),y(e),I(!0)}return _?z?M(oe,{...t,auction:d,item:_,outcome:z}):N(`section`,{className:[`lockerverse-auctions`,o].filter(Boolean).join(` `),"data-lockerverse-theme":c,ref:u,style:{"--lockerverse-accent":d.community?.color??`#6f8f6d`,...l},children:[b?null:N(r,{className:`lockerverse-auctions__back`,href:t.backHref,onBack:t.onBack,children:[M(g,{"aria-hidden":`true`,size:16}),` All items`]}),N(`div`,{className:`lockerverse-auctions__detail`,children:[M(G,{auction:d,galleryImageSizes:t.galleryImageSizes,item:_,itemHeadingLevel:t.itemHeadingLevel}),N(`div`,{className:`lockerverse-auctions__transaction`,children:[e(d,_)===`active`?M(ae,{buyNow:_.saleMode===`buy_now`}):null,L?M(`p`,{className:`lockerverse-auctions__notice`,role:`alert`,children:L}):null,F&&v?M(ie,{...t,appearanceRoot:u,auction:d,communityName:t.communityName??d.community?.name,contact:j,interactionLocked:b,item:_,onBack:()=>I(!1),onContactChange:P,onIncludeServiceFeeChange:e=>y(t=>t&&{...t,includeServiceFee:d.serviceFeeEnabled&&e}),onInteractionLockChange:D,onResult:B,onReview:V,selection:v}):M($,{auction:d,backHref:t.backHref,initialSelection:v,item:_,itemHeadingLevel:t.itemHeadingLevel,onBack:t.onBack,onContinue:H,onError:R}),b?null:N(r,{className:`lockerverse-auctions__footer-back`,href:t.backHref,onBack:t.onBack,children:[`Back to auction items `,M(m,{"aria-hidden":`true`,size:16})]})]})]})]}):N(`div`,{children:[M(`p`,{role:`alert`,children:`This auction item is no longer available.`}),M(r,{href:t.backHref,onBack:t.onBack,children:`Back to auction items`})]})}function ce(e){let t=k({auctionId:e.auction.id,client:e.client,itemId:e.itemId});if(t.current.client!==e.client||t.current.auctionId!==e.auction.id||t.current.itemId!==e.itemId)throw TypeError(`Auction item identity cannot change. Remount with a new React key.`);if(e.resumePurchase&&(e.resumePurchase.auctionId!==e.auction.id||e.resumePurchase.itemId!==e.itemId||e.resumePurchase.item.id!==e.itemId||e.resumePurchase.item.auctionId!==e.auction.id))throw TypeError(`The purchase recovery record belongs to a different auction item.`);return M(c.Provider,{value:e.auction.mediaBaseUrl,children:M(se,{...e})})}export{ce as LockerverseAuctionItem};
|
|
2
2
|
//# sourceMappingURL=auction-item.js.map
|
package/dist/auction-item.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auction-item.js","names":["Close","formatMoney","formatMoney"],"sources":["../src/use-auction-autoplay.ts","../src/auction-photo-filmstrip.tsx","../src/auction-gallery.tsx","../src/auction-item-details.tsx","../src/auction-item-selection.tsx","../src/auction-payment-loader.tsx","../src/lockerverse-auction-item.tsx"],"sourcesContent":["import Autoplay from \"embla-carousel-autoplay\";\nimport useEmblaCarousel from \"embla-carousel-react\";\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\n\nconst PHOTO_DELAY = 6000;\n\n// Embla 8 has stop(), but no pause(). Resume with the saved delay, then restore\n// the full delay on selection. Embla remains the only owner of the slide timer.\nexport function useAuctionAutoplay(enabled: boolean, reducedMotion: boolean) {\n const remaining = useRef(PHOTO_DELAY);\n const progressRef = useRef<HTMLDivElement>(null);\n const [cycleDelay, setCycleDelay] = useState(PHOTO_DELAY);\n const autoplay = useMemo(\n () =>\n Autoplay({\n delay: cycleDelay,\n playOnInit: false,\n stopOnFocusIn: false,\n stopOnInteraction: true,\n stopOnMouseEnter: false,\n }),\n [cycleDelay]\n );\n\n const [viewportRef, embla] = useEmblaCarousel(\n { duration: reducedMotion ? 0 : 25, loop: true },\n [autoplay]\n );\n\n const draw = useCallback(() => {\n // biome-ignore lint/suspicious/noUnnecessaryConditions: React assigns this ref in the filmstrip component.\n if (progressRef.current) {\n progressRef.current.style.transform = `scaleX(${1 - remaining.current / PHOTO_DELAY})`;\n }\n }, []);\n\n const freeze = useCallback(() => {\n const left = autoplay.timeUntilNext();\n if (left !== null) {\n remaining.current = Math.max(1, Math.min(PHOTO_DELAY, left));\n }\n autoplay.stop();\n draw();\n }, [autoplay, draw]);\n\n const reset = useCallback(() => {\n remaining.current = PHOTO_DELAY;\n setCycleDelay(PHOTO_DELAY);\n autoplay.reset();\n draw();\n }, [autoplay, draw]);\n\n useEffect(() => {\n if (!embla) {\n return;\n }\n if (!enabled) {\n freeze();\n } else if (cycleDelay === remaining.current) {\n autoplay.play();\n } else {\n setCycleDelay(remaining.current);\n }\n }, [embla, enabled, autoplay, cycleDelay, setCycleDelay, remaining, freeze]);\n\n useEffect(() => {\n if (!embla) {\n return;\n }\n let frame = 0;\n const update = () => {\n const left = autoplay.timeUntilNext();\n if (!enabled || left === null) {\n return;\n }\n remaining.current = Math.max(0, Math.min(PHOTO_DELAY, left));\n draw();\n frame = requestAnimationFrame(update);\n };\n const start = () => {\n cancelAnimationFrame(frame);\n if (enabled) {\n frame = requestAnimationFrame(update);\n }\n };\n const stop = () => cancelAnimationFrame(frame);\n const reinitialize = () => {\n if (enabled) {\n autoplay.play();\n }\n };\n embla\n .on(\"select\", reset)\n .on(\"reInit\", reinitialize)\n .on(\"autoplay:timerset\", start)\n .on(\"autoplay:timerstopped\", stop);\n draw();\n start();\n return () => {\n stop();\n embla\n .off(\"select\", reset)\n .off(\"reInit\", reinitialize)\n .off(\"autoplay:timerset\", start)\n .off(\"autoplay:timerstopped\", stop);\n };\n }, [embla, autoplay, enabled, remaining, reset, draw]);\n return { embla, freeze, progressRef, reset, viewportRef };\n}\n","import { ChevronLeft, ChevronRight, Pause, Play } from \"lucide-react\";\nimport {\n type PointerEvent,\n type Ref,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { AuctionImage } from \"./auction-image.tsx\";\nimport { useAuctionAutoplay } from \"./use-auction-autoplay\";\nimport { useAuctionVisibility } from \"./use-auction-visibility\";\n\ntype FilmstripProps = {\n photos: string[];\n name: string;\n imageSizes?: string | undefined;\n selected: number;\n paused?: boolean;\n photoButtonRef: Ref<HTMLButtonElement>;\n onSelect: (index: number) => void;\n onExpand: (index: number) => void;\n};\n\nexport function AuctionPhotoFilmstrip({\n photos,\n name,\n imageSizes = \"(max-width: 1279px) 100vw, 45vw\",\n selected,\n paused = false,\n photoButtonRef,\n onSelect,\n onExpand,\n}: FilmstripProps) {\n const stripRef = useRef<HTMLDivElement>(null);\n const keyboardPhoto = useRef<HTMLButtonElement | null>(null);\n const thumbnailRefs = useRef<(HTMLButtonElement | null)[]>([]);\n const [reducedMotion, setReducedMotion] = useState(true);\n const [hovered, setHovered] = useState(false);\n const [keyboardFocused, setKeyboardFocused] = useState(false);\n const [userPaused, setUserPaused] = useState(false);\n const [dragging, setDragging] = useState(false);\n const { ref: galleryRef, visible } = useAuctionVisibility<HTMLElement>();\n const [controlsActive, setControlsActive] = useState(false);\n const [touchControls, setTouchControls] = useState(true);\n const hideControlsTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const controlsVisible = touchControls || controlsActive || keyboardFocused;\n const controlsFade = `lockerverse-auction-gallery__control ${controlsVisible ? \"is-visible\" : \"\"}`;\n\n const scheduleControlsHide = () => {\n // biome-ignore lint/suspicious/noUnnecessaryConditions: The timer ref is assigned after pointer activity.\n if (hideControlsTimer.current) {\n clearTimeout(hideControlsTimer.current);\n }\n hideControlsTimer.current = setTimeout(\n () => setControlsActive(false),\n 2000\n );\n };\n const showControls = (event: PointerEvent<HTMLDivElement>) => {\n if (event.pointerType !== \"mouse\") {\n setTouchControls(true);\n return;\n }\n setControlsActive(true);\n // biome-ignore lint/suspicious/noUnnecessaryConditions: The timer ref is assigned after pointer activity.\n if (hideControlsTimer.current) {\n clearTimeout(hideControlsTimer.current);\n }\n if (\n !(\n event.target instanceof Element &&\n event.target.closest(\"[data-gallery-control]\")\n )\n ) {\n scheduleControlsHide();\n }\n };\n\n useEffect(() => {\n const preference = window.matchMedia(\"(hover: none), (pointer: coarse)\");\n const update = () => setTouchControls(preference.matches);\n update();\n preference.addEventListener(\"change\", update);\n return () => {\n preference.removeEventListener(\"change\", update);\n clearTimeout(hideControlsTimer.current ?? undefined);\n };\n }, []);\n\n const autoplayEnabled =\n !(\n paused ||\n reducedMotion ||\n hovered ||\n keyboardFocused ||\n userPaused ||\n dragging\n ) && visible;\n const count = photos.length;\n const current = count ? ((selected % count) + count) % count : 0;\n const { viewportRef, embla, progressRef, freeze, reset } = useAuctionAutoplay(\n autoplayEnabled && count > 1,\n reducedMotion\n );\n\n useEffect(() => {\n const preference = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n const update = () => setReducedMotion(preference.matches);\n update();\n preference.addEventListener(\"change\", update);\n return () => preference.removeEventListener(\"change\", update);\n }, []);\n\n useEffect(() => {\n if (!embla) {\n return;\n }\n const select = () => onSelect(embla.selectedScrollSnap());\n embla.on(\"select\", select).on(\"reInit\", select);\n return () => {\n embla.off(\"select\", select).off(\"reInit\", select);\n };\n }, [embla, onSelect]);\n\n useEffect(() => {\n if (embla && embla.selectedScrollSnap() !== current) {\n embla.scrollTo(current, true);\n }\n }, [embla, current]);\n\n useEffect(() => {\n const updateVisibility = () => {\n if (document.hidden) {\n freeze();\n }\n };\n const release = () => setDragging(false);\n updateVisibility();\n document.addEventListener(\"visibilitychange\", updateVisibility, true);\n window.addEventListener(\"pointerup\", release);\n window.addEventListener(\"pointercancel\", release);\n return () => {\n document.removeEventListener(\"visibilitychange\", updateVisibility, true);\n window.removeEventListener(\"pointerup\", release);\n window.removeEventListener(\"pointercancel\", release);\n };\n }, [freeze]);\n\n const selectPhoto = (next: number) => {\n embla?.scrollTo((next + count) % count, reducedMotion);\n reset();\n };\n\n useEffect(() => {\n const previousPhoto = keyboardPhoto.current;\n keyboardPhoto.current = null;\n // biome-ignore lint/suspicious/noUnnecessaryConditions: Keyboard events assign this ref before the selected photo changes.\n if (previousPhoto && document.activeElement === previousPhoto) {\n galleryRef.current\n ?.querySelector<HTMLButtonElement>(\n '.lockerverse-auction-gallery__photo[tabindex=\"0\"]'\n )\n ?.focus({ preventScroll: true });\n }\n }, [current, galleryRef]);\n\n useEffect(() => {\n const strip = stripRef.current;\n const thumbnail = thumbnailRefs.current[current];\n // biome-ignore lint/suspicious/noUnnecessaryConditions: React assigns the element ref after mounting.\n if (!(strip && thumbnail)) {\n return;\n }\n const stripBounds = strip.getBoundingClientRect();\n const photoBounds = thumbnail.getBoundingClientRect();\n if (photoBounds.left < stripBounds.left) {\n strip.scrollLeft -= stripBounds.left - photoBounds.left;\n } else if (photoBounds.right > stripBounds.right) {\n strip.scrollLeft += photoBounds.right - stripBounds.right;\n }\n }, [current, count]);\n\n return (\n // biome-ignore lint/a11y/noNoninteractiveElementInteractions: The gallery handles keys from its focusable photo and navigation buttons.\n <section\n aria-label={`${name} photos`}\n className=\"lockerverse-auction-gallery\"\n onBlurCapture={(event) => {\n if (!event.currentTarget.contains(event.relatedTarget)) {\n setKeyboardFocused(false);\n }\n }}\n onFocusCapture={(event) =>\n setKeyboardFocused(event.target.matches(\":focus-visible\"))\n }\n onKeyDown={(event) => {\n if (\n count < 2 ||\n event.altKey ||\n event.ctrlKey ||\n event.metaKey ||\n event.shiftKey\n ) {\n return;\n }\n if (event.key === \"ArrowLeft\" || event.key === \"ArrowRight\") {\n event.preventDefault();\n if (\n event.target instanceof HTMLButtonElement &&\n event.target.classList.contains(\n \"lockerverse-auction-gallery__photo\"\n )\n ) {\n keyboardPhoto.current = event.target;\n }\n selectPhoto(current + (event.key === \"ArrowRight\" ? 1 : -1));\n }\n }}\n onPointerEnter={(event) => {\n if (event.pointerType === \"mouse\") {\n setHovered(true);\n }\n }}\n onPointerLeave={(event) => {\n if (event.pointerType === \"mouse\") {\n setHovered(false);\n }\n }}\n ref={galleryRef}\n >\n {count ? (\n <div\n className=\"lockerverse-auction-gallery__stage\"\n onPointerEnter={showControls}\n onPointerLeave={scheduleControlsHide}\n onPointerMove={showControls}\n >\n <div\n className=\"lockerverse-auction-gallery__viewport\"\n onPointerDownCapture={() => {\n freeze();\n setDragging(true);\n }}\n ref={viewportRef}\n >\n <div className=\"lockerverse-auction-gallery__track\">\n {photos.map((photo, photoIndex) => (\n <div\n aria-hidden={photoIndex !== current}\n className=\"lockerverse-auction-gallery__slide\"\n key={`${photo}-${photoIndex}`}\n >\n <button\n aria-label={`View photo ${photoIndex + 1} of ${name} at full size`}\n className=\"lockerverse-auction-gallery__photo\"\n onClick={() => {\n onExpand(photoIndex);\n }}\n ref={photoIndex === current ? photoButtonRef : undefined}\n tabIndex={photoIndex === current ? 0 : -1}\n type=\"button\"\n >\n <AuctionImage\n alt={`${name}, ${photoIndex + 1} of ${count}`}\n className=\"lockerverse-auction-gallery__image\"\n draggable={false}\n fetchPriority={photoIndex === 0 ? \"high\" : \"auto\"}\n height={900}\n loading={photoIndex === current ? \"eager\" : \"lazy\"}\n maxWidth={1920}\n sizes={\n photoIndex === current\n ? imageSizes\n : `auto, ${imageSizes}`\n }\n src={photo}\n width={1200}\n />\n </button>\n </div>\n ))}\n </div>\n </div>\n {count > 1 && !reducedMotion && (\n <div className=\"lockerverse-auction-gallery__rotation\">\n <div\n aria-hidden=\"true\"\n className=\"lockerverse-auction-gallery__progress-track\"\n >\n <div\n className=\"lockerverse-auction-gallery__progress\"\n ref={progressRef}\n style={{ transform: \"scaleX(0)\" }}\n />\n </div>\n <button\n aria-label={\n userPaused ? \"Play photo rotation\" : \"Pause photo rotation\"\n }\n className={`lockerverse-auction-gallery__play ${controlsFade}`}\n data-gallery-control\n onClick={() => setUserPaused((value) => !value)}\n title={\n userPaused ? \"Play photo rotation\" : \"Pause photo rotation\"\n }\n type=\"button\"\n >\n {userPaused ? (\n <Play aria-hidden=\"true\" size={13} />\n ) : (\n <Pause aria-hidden=\"true\" size={13} />\n )}\n </button>\n </div>\n )}\n {count > 1 && (\n <>\n <button\n aria-label=\"Previous photo\"\n className={`lockerverse-auction-gallery__previous ${controlsFade}`}\n data-gallery-control\n onClick={() => selectPhoto(current - 1)}\n type=\"button\"\n >\n <ChevronLeft\n aria-hidden=\"true\"\n className=\"lockerverse-auction-gallery__chevron\"\n />\n </button>\n <button\n aria-label=\"Next photo\"\n className={`lockerverse-auction-gallery__next ${controlsFade}`}\n data-gallery-control\n onClick={() => selectPhoto(current + 1)}\n type=\"button\"\n >\n <ChevronRight\n aria-hidden=\"true\"\n className=\"lockerverse-auction-gallery__chevron\"\n />\n </button>\n </>\n )}\n </div>\n ) : (\n <div className=\"lockerverse-auction-gallery__empty\">\n No photo available\n </div>\n )}\n {count > 1 && (\n <section\n aria-label=\"Choose a photo\"\n className=\"lockerverse-auction-gallery__strip\"\n ref={stripRef}\n >\n <div className=\"lockerverse-auction-gallery__thumbnails\">\n {photos.map((photo, photoIndex) => (\n <button\n aria-label={`Show photo ${photoIndex + 1} of ${count}`}\n aria-pressed={current === photoIndex}\n className={`lockerverse-auction-gallery__thumbnail ${current === photoIndex ? \"is-selected\" : \"\"}`}\n key={`${photo}-${photoIndex}`}\n onClick={() => selectPhoto(photoIndex)}\n ref={(element) => {\n thumbnailRefs.current[photoIndex] = element;\n }}\n type=\"button\"\n >\n <AuctionImage\n alt=\"\"\n className=\"lockerverse-auction-gallery__thumbnail-image\"\n height={66}\n loading=\"lazy\"\n maxWidth={192}\n sizes=\"88px\"\n src={photo}\n width={88}\n />\n </button>\n ))}\n </div>\n </section>\n )}\n </section>\n );\n}\n","import { Dialog } from \"@base-ui/react/dialog\";\nimport { ChevronLeft, ChevronRight, X as Close } from \"lucide-react\";\nimport { useRef, useState } from \"react\";\nimport { AuctionImage } from \"./auction-image.tsx\";\nimport { AuctionPhotoFilmstrip } from \"./auction-photo-filmstrip\";\n\nexport function AuctionGallery({\n images,\n fallbackImage,\n name,\n imageSizes,\n}: {\n images: readonly string[];\n fallbackImage?: string | null;\n name: string;\n imageSizes?: string | undefined;\n}) {\n const photos = [...new Set(images.filter(Boolean))];\n if (!photos.length && fallbackImage) {\n photos.push(fallbackImage);\n }\n const [index, setIndex] = useState(0);\n const [open, setOpen] = useState(false);\n const opener = useRef<HTMLButtonElement | null>(null);\n const swipeStart = useRef<{ x: number; y: number } | null>(null);\n const count = photos.length;\n const selected = count ? ((index % count) + count) % count : 0;\n\n return (\n <>\n <AuctionPhotoFilmstrip\n imageSizes={imageSizes}\n name={name}\n onExpand={(next) => {\n setIndex(next);\n setOpen(true);\n }}\n onSelect={setIndex}\n paused={open}\n photoButtonRef={opener}\n photos={photos}\n selected={selected}\n />\n {count > 0 && (\n <Dialog.Root onOpenChange={setOpen} open={open}>\n <Dialog.Portal>\n <Dialog.Backdrop className=\"lockerverse-auction-gallery__backdrop\" />\n <Dialog.Popup\n aria-describedby={undefined}\n className=\"lockerverse-auction-gallery__viewer\"\n finalFocus={opener}\n onKeyDown={(event) => {\n if (\n count < 2 ||\n event.altKey ||\n event.ctrlKey ||\n event.metaKey ||\n event.shiftKey\n ) {\n return;\n }\n if (event.key === \"ArrowLeft\" || event.key === \"ArrowRight\") {\n event.preventDefault();\n setIndex(\n (selected + (event.key === \"ArrowRight\" ? 1 : -1) + count) %\n count\n );\n }\n }}\n >\n <Dialog.Title className=\"lockerverse-auction-gallery__sr-only\">\n {name} · Photo {selected + 1} of {count}\n </Dialog.Title>\n <div\n className=\"lockerverse-auction-gallery__full-image\"\n onTouchCancel={() => {\n swipeStart.current = null;\n }}\n onTouchEnd={(event) => {\n const start = swipeStart.current;\n swipeStart.current = null;\n const end = event.changedTouches.item(0);\n // biome-ignore lint/suspicious/noUnnecessaryConditions: Touch start assigns the shared ref before this event.\n if (!(start && end) || count < 2) {\n return;\n }\n const dx = end.clientX - start.x;\n const dy = end.clientY - start.y;\n if (Math.abs(dx) >= 45 && Math.abs(dx) > Math.abs(dy) * 1.3) {\n setIndex((selected + (dx < 0 ? 1 : -1) + count) % count);\n }\n }}\n onTouchMove={(event) => {\n if (event.touches.length !== 1) {\n swipeStart.current = null;\n }\n }}\n onTouchStart={(event) => {\n const touch = event.touches.item(0);\n swipeStart.current =\n event.touches.length === 1 && touch\n ? { x: touch.clientX, y: touch.clientY }\n : null;\n }}\n >\n <AuctionImage\n alt={`${name}, ${selected + 1} of ${count}`}\n height={900}\n maxWidth={1920}\n sizes=\"100vw\"\n src={photos[selected]}\n width={1200}\n />\n {open && count > 1 && (\n <AuctionImage\n alt=\"\"\n aria-hidden=\"true\"\n className=\"lockerverse-auction-gallery__preload\"\n height={900}\n loading=\"eager\"\n maxWidth={1920}\n sizes=\"100vw\"\n src={photos[(selected + 1) % count]}\n width={1200}\n />\n )}\n </div>\n <Dialog.Close\n aria-label=\"Close photo viewer\"\n className=\"lockerverse-auction-gallery__viewer-close\"\n >\n <Close aria-hidden=\"true\" size={22} />\n </Dialog.Close>\n {count > 1 && (\n <>\n <button\n aria-label=\"Previous photo\"\n className=\"lockerverse-auction-gallery__viewer-previous\"\n onClick={() => setIndex((selected - 1 + count) % count)}\n type=\"button\"\n >\n <ChevronLeft aria-hidden=\"true\" size={28} />\n </button>\n <button\n aria-label=\"Next photo\"\n className=\"lockerverse-auction-gallery__viewer-next\"\n onClick={() => setIndex((selected + 1) % count)}\n type=\"button\"\n >\n <ChevronRight aria-hidden=\"true\" size={28} />\n </button>\n </>\n )}\n </Dialog.Popup>\n </Dialog.Portal>\n </Dialog.Root>\n )}\n </>\n );\n}\n","import type {\n LockerverseAuction,\n LockerverseAuctionItem,\n LockerverseAuctionStatus,\n} from \"@lockerverse/sdk/auctions\";\nimport {\n ChevronDown,\n Clock3,\n Gavel,\n ShieldCheck,\n TimerReset,\n} from \"lucide-react\";\nimport { useId, useState } from \"react\";\nimport { AuctionDescription } from \"./auction-description.tsx\";\nimport {\n formatAuctionBoundary,\n formatAuctionMoney as formatMoney,\n getAuctionDisplayStatus,\n} from \"./auction-display.ts\";\nimport { AuctionGallery } from \"./auction-gallery.tsx\";\nimport { useAuctionBoundary } from \"./use-auction-boundary.ts\";\n\nconst itemHeadingTags = { 1: \"h1\", 2: \"h2\" } as const;\n\nfunction metricIcon(label: string | undefined) {\n if (label === \"Buy Now\") {\n return <ShieldCheck aria-hidden=\"true\" size={16} />;\n }\n if (label === \"Available\" || label === \"Increment\") {\n return <TimerReset aria-hidden=\"true\" size={16} />;\n }\n return <Gavel aria-hidden=\"true\" size={16} />;\n}\nfunction itemMetrics(\n item: LockerverseAuctionItem,\n status: LockerverseAuctionStatus\n) {\n if (item.saleMode === \"buy_now\") {\n return [\n [\"Buy Now\", formatMoney(item.buyNowPriceAmount ?? 0)],\n [\n \"Available\",\n item.availableQuantity === null\n ? \"Available\"\n : String(item.availableQuantity),\n ],\n ];\n }\n if (status === \"finished\") {\n return [\n [\n \"Final bid\",\n item.maxBidAmount ? formatMoney(item.maxBidAmount) : \"No bids\",\n ],\n ];\n }\n return [\n [\"Current bid\", formatMoney(item.maxBidAmount ?? 0)],\n [\"Floor\", formatMoney(item.minBidAmount ?? 0)],\n [\"Increment\", formatMoney(item.bidIncrementAmount ?? 100)],\n ];\n}\nexport function AuctionItemDetails({\n auction,\n item,\n itemHeadingLevel = 2,\n galleryImageSizes,\n}: {\n auction: LockerverseAuction;\n item: LockerverseAuctionItem;\n itemHeadingLevel?: 1 | 2 | undefined;\n galleryImageSizes?: string | undefined;\n}) {\n useAuctionBoundary(\n item.startAt ?? auction.startAt,\n item.endAt ?? auction.endAt\n );\n const [expanded, setExpanded] = useState(false);\n const descriptionId = useId();\n const status = getAuctionDisplayStatus(auction, item);\n const boundaryLabel = {\n active: \"Closes\",\n draft: \"Opens\",\n finished: \"Closed\",\n }[status];\n const boundary = formatAuctionBoundary(auction, status, item);\n const buyNow = item.saleMode === \"buy_now\";\n const longDescription = (item.description ?? \"\").trim().length > 240;\n const metrics = itemMetrics(item, status);\n const ItemHeading = itemHeadingTags[itemHeadingLevel];\n return (\n <section className=\"lockerverse-auctions__item-summary\">\n <AuctionGallery\n fallbackImage={\n item.image ??\n auction.configuration.image ??\n auction.community?.banner ??\n auction.community?.thumbnail ??\n null\n }\n imageSizes={galleryImageSizes}\n images={item.images}\n name={item.name}\n />\n <div className=\"lockerverse-auctions__item-copy\">\n <ItemHeading>{item.name}</ItemHeading>\n {item.description ? (\n <div className=\"lockerverse-auctions__item-description\">\n <AuctionDescription\n className={\n !expanded && longDescription\n ? \"lockerverse-auctions__description-clamped\"\n : undefined\n }\n description={item.description}\n id={descriptionId}\n />\n {longDescription ? (\n <button\n aria-controls={descriptionId}\n aria-expanded={expanded}\n className=\"lockerverse-auctions__description-toggle\"\n onClick={() => setExpanded(!expanded)}\n type=\"button\"\n >\n {expanded ? \"Hide description\" : \"Read full description\"}{\" \"}\n <ChevronDown\n aria-hidden=\"true\"\n size={16}\n style={{ transform: expanded ? \"rotate(180deg)\" : undefined }}\n />\n </button>\n ) : null}\n </div>\n ) : null}\n <dl className=\"lockerverse-auctions__stat-panel\">\n {metrics.map(([label, value]) => (\n <div className=\"lockerverse-auctions__stat-row\" key={label}>\n <dt>\n {metricIcon(label)}\n {label}\n </dt>\n <dd>{value}</dd>\n </div>\n ))}\n <div className=\"lockerverse-auctions__stat-row\">\n <dt>\n <Clock3 aria-hidden=\"true\" size={16} />\n {boundaryLabel}\n </dt>\n <dd className=\"lockerverse-auctions__stat-date\">{boundary}</dd>\n </div>\n {!buyNow && status === \"finished\" ? (\n <div className=\"lockerverse-auctions__stat-footer\">\n <div>\n <dt>Floor</dt>\n <dd>{formatMoney(item.minBidAmount ?? 0)}</dd>\n </div>\n <div>\n <dt>Bid increment</dt>\n <dd>{formatMoney(item.bidIncrementAmount ?? 100)}</dd>\n </div>\n </div>\n ) : null}\n </dl>\n </div>\n </section>\n );\n}\n","import {\n getLockerverseAuctionMinimumBid,\n type LockerverseAuction,\n type LockerverseAuctionItem,\n type LockerverseAuctionStatus,\n} from \"@lockerverse/sdk/auctions\";\nimport { ArrowRight } from \"lucide-react\";\nimport { type FormEvent, useId, useState } from \"react\";\nimport { AuctionBackAction } from \"./auction-back-action.tsx\";\nimport {\n formatAuctionBoundary,\n formatAuctionMoney as formatMoney,\n getAuctionDisplayStatus,\n isAuctionItemSoldOut,\n} from \"./auction-display.ts\";\nimport {\n type AuctionSelection,\n getAuctionSelectionError,\n getAuctionSelectionPricing,\n} from \"./auction-payment.ts\";\nimport { useAuctionBoundary } from \"./use-auction-boundary.ts\";\n\nconst selectionHeadingTags = { 1: \"h2\", 2: \"h3\" } as const;\n\nconst WHOLE_NUMBER = /^\\d+$/;\n\ntype SelectionProps = {\n auction: LockerverseAuction;\n item: LockerverseAuctionItem;\n itemHeadingLevel?: 1 | 2 | undefined;\n initialSelection: AuctionSelection | null;\n onContinue: (selection: AuctionSelection) => void;\n onError: (message: string) => void;\n onBack?: (() => void) | undefined;\n backHref?: string | undefined;\n};\n\nfunction quantitySummary(value: string, item: LockerverseAuctionItem) {\n const quantity = Number(value);\n const subtotal = quantity * (item.buyNowPriceAmount ?? 0);\n if (\n !(WHOLE_NUMBER.test(value) && Number.isSafeInteger(subtotal)) ||\n quantity < 1\n ) {\n return \"Enter a whole-number quantity.\";\n }\n if (!item.additionalCharge) {\n return `Total: ${formatMoney(subtotal)}`;\n }\n const charge =\n item.additionalCharge.firstUnitAmountCents +\n item.additionalCharge.additionalUnitAmountCents * (quantity - 1);\n const total = subtotal + charge;\n if (!Number.isSafeInteger(total)) {\n return \"Enter a valid quantity.\";\n }\n return `Subtotal: ${formatMoney(subtotal)} · ${item.additionalCharge.name}: ${formatMoney(charge)} · Total: ${formatMoney(total)}`;\n}\nfunction selectionInitialValue(\n buyNow: boolean,\n initial: AuctionSelection | null,\n minimum: number\n) {\n if (buyNow) {\n return String(initial ? initial.quantity : 1);\n }\n return String(initial ? initial.amount / 100 : minimum);\n}\nfunction readOnlyTitle(\n item: LockerverseAuctionItem,\n status: LockerverseAuctionStatus\n) {\n if (isAuctionItemSoldOut(item)) {\n return \"This item is sold out.\";\n }\n if (status === \"draft\") {\n return \"This item is not open yet.\";\n }\n if (status === \"finished\") {\n return item.saleMode === \"buy_now\"\n ? \"Purchases are closed for this item.\"\n : \"Bidding is closed for this item.\";\n }\n return \"This item is not available.\";\n}\nfunction readOnlyDescription(\n auction: LockerverseAuction,\n item: LockerverseAuctionItem,\n status: LockerverseAuctionStatus\n) {\n if (isAuctionItemSoldOut(item)) {\n return \"All available quantities have been purchased.\";\n }\n if (status === \"draft\") {\n return `This item opens ${formatAuctionBoundary(auction, \"draft\", item)}.`;\n }\n return item.saleMode === \"buy_now\"\n ? \"This item is no longer available to purchase.\"\n : \"Bidding has closed for this item.\";\n}\nfunction selectionFromInput(\n auction: LockerverseAuction,\n buyNow: boolean,\n initialSelection: AuctionSelection | null,\n value: string\n): AuctionSelection {\n return {\n amount: buyNow ? 0 : Number(value) * 100,\n includeServiceFee: initialSelection\n ? initialSelection.includeServiceFee\n : auction.serviceFeeEnabled && auction.serviceFeeDefaultChecked,\n quantity: buyNow ? Number(value) : 1,\n };\n}\nexport function AuctionItemSelection({\n auction,\n item,\n initialSelection,\n onContinue,\n onError,\n onBack,\n backHref,\n itemHeadingLevel = 2,\n}: SelectionProps) {\n const SelectionHeading = selectionHeadingTags[itemHeadingLevel];\n const buyNow = item.saleMode === \"buy_now\";\n const minimum = Math.ceil(getLockerverseAuctionMinimumBid(item) / 100);\n const [value, setValue] = useState(\n selectionInitialValue(buyNow, initialSelection, minimum)\n );\n const [error, setError] = useState<string | null>(null);\n const id = useId();\n useAuctionBoundary(\n item.startAt ?? auction.startAt,\n item.endAt ?? auction.endAt\n );\n const status = getAuctionDisplayStatus(auction, item);\n const open =\n status === \"active\" &&\n !isAuctionItemSoldOut(item) &&\n item.saleMode !== \"hybrid\";\n function continueToPayment(event: FormEvent<HTMLFormElement>) {\n event.preventDefault();\n if (!WHOLE_NUMBER.test(value)) {\n setError(\n buyNow\n ? \"Enter a whole-number quantity.\"\n : \"Enter a whole-dollar bid amount.\"\n );\n return;\n }\n const selection = selectionFromInput(\n auction,\n buyNow,\n initialSelection,\n value\n );\n const message = getAuctionSelectionError(auction, item, selection);\n if (message) {\n setError(message);\n onError(message);\n return;\n }\n try {\n getAuctionSelectionPricing(auction, item, selection);\n } catch {\n setError(\"Enter a valid amount or quantity.\");\n return;\n }\n onContinue(selection);\n }\n if (!open) {\n return (\n <div className=\"lockerverse-auctions__selection lockerverse-auctions__read-only\">\n <p className=\"lockerverse-auctions__eyebrow\">Item status</p>\n <SelectionHeading>{readOnlyTitle(item, status)}</SelectionHeading>\n <p>{readOnlyDescription(auction, item, status)}</p>\n <AuctionBackAction\n className=\"lockerverse-auctions__button\"\n href={backHref}\n onBack={onBack}\n >\n Browse auction items <ArrowRight aria-hidden=\"true\" size={16} />\n </AuctionBackAction>\n </div>\n );\n }\n return (\n <form\n className=\"lockerverse-auctions__selection\"\n onSubmit={continueToPayment}\n >\n <SelectionHeader\n buyNow={buyNow}\n headingTag={SelectionHeading}\n item={item}\n minimum={minimum}\n />\n <div className=\"lockerverse-auctions__selection-body\">\n <label className=\"lockerverse-auctions__field\" htmlFor={id}>\n {buyNow ? \"Quantity\" : \"Your bid amount\"}\n <span className=\"lockerverse-auctions__amount-control\">\n {buyNow ? null : <span aria-hidden=\"true\">$</span>}\n <input\n aria-describedby={`${id}-help`}\n aria-invalid={Boolean(error)}\n autoComplete=\"off\"\n id={id}\n inputMode=\"numeric\"\n onChange={(event) => {\n setValue(event.target.value);\n setError(null);\n }}\n placeholder={buyNow ? \"1\" : String(minimum)}\n required\n value={value}\n />\n </span>\n </label>\n {error ? <p role=\"alert\">{error}</p> : null}\n <p id={`${id}-help`}>\n {buyNow\n ? quantitySummary(value, item)\n : `Enter a whole-dollar bid of at least ${formatMoney(minimum * 100)}. Bid increment: ${formatMoney(item.bidIncrementAmount ?? 100)}.`}\n </p>\n <BidAdditionalCharge item={item} />\n <div className=\"lockerverse-auctions__selection-footer\">\n <p>\n {buyNow\n ? \"Continuing moves you into secure checkout where your payment is processed immediately.\"\n : \"Continuing moves you into the secure payment step where your card is stored for settlement only if your bid wins.\"}\n </p>\n <button\n className=\"lockerverse-auctions__button\"\n disabled={!auction.payment}\n type=\"submit\"\n >\n {buyNow ? \"Continue to Checkout\" : \"Continue to Payment\"}{\" \"}\n <ArrowRight aria-hidden=\"true\" size={16} />\n </button>\n </div>\n {auction.payment ? null : (\n <p role=\"alert\">Payments are not configured for this auction.</p>\n )}\n </div>\n </form>\n );\n}\n\nfunction SelectionHeader({\n headingTag: SelectionHeading,\n item,\n buyNow,\n minimum,\n}: {\n item: LockerverseAuctionItem;\n buyNow: boolean;\n minimum: number;\n headingTag: \"h2\" | \"h3\";\n}) {\n return (\n <div className=\"lockerverse-auctions__selection-header\">\n <p className=\"lockerverse-auctions__eyebrow\">Step 1 of 2</p>\n <SelectionHeading>\n {buyNow ? \"Buy this item now.\" : \"Place your bid.\"}\n </SelectionHeading>\n <p>\n {buyNow\n ? \"Choose how many you want, then complete the secure checkout.\"\n : \"Enter the bid amount you want to place for this item. You are only charged if this bid wins after bidding closes.\"}\n </p>\n <p>\n {buyNow ? \"Price: \" : \"Minimum qualifying bid: \"}\n <strong>\n {formatMoney(buyNow ? (item.buyNowPriceAmount ?? 0) : minimum * 100)}\n </strong>\n </p>\n {buyNow && item.availableQuantity !== null ? (\n <p>{item.availableQuantity} available</p>\n ) : null}\n {item.collectShippingAddress ? (\n <p>\n The next step will also collect a delivery address for seller\n fulfillment.\n </p>\n ) : null}\n </div>\n );\n}\n\nfunction BidAdditionalCharge({ item }: { item: LockerverseAuctionItem }) {\n if (item.saleMode === \"buy_now\" || !item.additionalCharge) {\n return null;\n }\n return (\n <p>\n {item.additionalCharge.name}:{\" \"}\n {formatMoney(item.additionalCharge.firstUnitAmountCents)} will be added to\n your winning bid.\n </p>\n );\n}\n","import { type ComponentType, useEffect, useState } from \"react\";\nimport type { AuctionPaymentProps } from \"./auction-payment-view.tsx\";\n\n/** Keep checkout dependencies out of the server-rendered item and catalog. */\nexport function AuctionPaymentLoader(props: AuctionPaymentProps) {\n const [PaymentView, setPaymentView] =\n useState<ComponentType<AuctionPaymentProps> | null>(null);\n const [failed, setFailed] = useState(false);\n const locked = Boolean(props.resumePurchase || props.interactionLocked);\n\n useEffect(() => {\n let active = true;\n import(\"./auction-payment-view.tsx\").then(\n ({ AuctionPayment }) => {\n if (active) {\n setPaymentView(() => AuctionPayment);\n }\n },\n () => {\n if (active) {\n setFailed(true);\n }\n }\n );\n return () => {\n active = false;\n };\n }, []);\n\n if (PaymentView) {\n return <PaymentView {...props} />;\n }\n return (\n <div>\n <p role={failed ? \"alert\" : \"status\"}>\n {failed\n ? \"Payment details could not load.\"\n : \"Loading secure payment details…\"}\n </p>\n {failed && locked && (\n <p>\n Your purchase status is not confirmed. Keep this page open and contact\n the auction organizer before you try another purchase.\n </p>\n )}\n {locked ? null : (\n <button onClick={props.onBack} type=\"button\">\n Back to item\n </button>\n )}\n {failed && !locked && (\n <button onClick={() => window.location.reload()} type=\"button\">\n Reload page to try again\n </button>\n )}\n </div>\n );\n}\n","import type {\n LockerverseAuctionItem as AuctionItem,\n LockerverseAuction,\n} from \"@lockerverse/sdk/auctions\";\nimport {\n ArrowRight,\n ChevronLeft,\n Gavel,\n ShieldCheck,\n TimerReset,\n} from \"lucide-react\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { AuctionBackAction } from \"./auction-back-action.tsx\";\nimport {\n formatAuctionBoundary,\n getAuctionDisplayStatus,\n} from \"./auction-display.ts\";\nimport { AuctionImageMediaBase } from \"./auction-image.tsx\";\nimport { AuctionItemDetails } from \"./auction-item-details.tsx\";\nimport { AuctionItemSelection } from \"./auction-item-selection.tsx\";\nimport type { LockerverseAuctionItemProps } from \"./auction-item-types.ts\";\nimport type { AuctionSelection } from \"./auction-payment.ts\";\nimport { AuctionPaymentLoader } from \"./auction-payment-loader.tsx\";\nimport {\n type LockerverseAuctionOutcome,\n LockerverseAuctionResult,\n type LockerverseAuctionResultAction,\n} from \"./auction-result.tsx\";\nimport { notifyHostCallback } from \"./host-callback.ts\";\nimport { useAuctionBoundary } from \"./use-auction-boundary.ts\";\n\nfunction AuctionProgress({ buyNow }: { buyNow: boolean }) {\n return (\n <div className=\"lockerverse-auctions__progress\">\n <span>\n {buyNow ? (\n <ShieldCheck aria-hidden=\"true\" size={16} />\n ) : (\n <Gavel aria-hidden=\"true\" size={16} />\n )}\n {buyNow ? \"Choose quantity\" : \"Place bid\"}\n </span>\n <span>\n <ShieldCheck aria-hidden=\"true\" size={16} />\n {buyNow ? \"Pay securely\" : \"Secure card\"}\n </span>\n <span>\n <TimerReset aria-hidden=\"true\" size={16} />\n {buyNow ? \"Get confirmation\" : \"Wait for close\"}\n </span>\n </div>\n );\n}\n\nfunction AuctionItemResult(\n props: LockerverseAuctionItemProps & {\n item: AuctionItem;\n outcome: LockerverseAuctionOutcome;\n }\n) {\n const { auction, item, outcome } = props;\n let auctionAction: LockerverseAuctionResultAction | undefined;\n if (props.backHref) {\n auctionAction = { href: props.backHref, label: \"View auction items\" };\n } else if (props.onBack) {\n auctionAction = { label: \"View auction items\", onClick: props.onBack };\n }\n return (\n <LockerverseAuctionResult\n auctionName={auction.name}\n className={props.className}\n closesAtLabel={formatAuctionBoundary(auction, \"active\", item)}\n communityName={props.communityName ?? auction.community?.name}\n focusHeading\n imageUrl={\n item.image ?? item.images[0] ?? auction.configuration.image ?? undefined\n }\n itemName={item.name}\n outcome={outcome}\n primaryAction={\n props.returnToItemHref\n ? { href: props.returnToItemHref, label: \"Return to item\" }\n : auctionAction\n }\n secondaryAction={props.returnToItemHref ? auctionAction : undefined}\n style={{\n \"--lockerverse-accent\": auction.community?.color ?? \"#6f8f6d\",\n ...props.style,\n }}\n theme={props.theme}\n />\n );\n}\n\nfunction AuctionItemView(props: LockerverseAuctionItemProps) {\n const {\n auction: initialAuction,\n itemId,\n resumePurchase,\n className,\n theme = \"dark\",\n style,\n } = props;\n const appearanceRoot = useRef<HTMLElement | null>(null);\n const [auction, setAuction] = useState(initialAuction);\n const acceptedHost = useRef(initialAuction);\n const item =\n auction.items.find((candidate) => candidate.id === itemId) ??\n resumePurchase?.item;\n useAuctionBoundary(\n item?.startAt ?? auction.startAt,\n item?.endAt ?? auction.endAt\n );\n const [selection, setSelection] = useState<AuctionSelection | null>(() =>\n resumePurchase\n ? {\n amount: 0,\n includeServiceFee:\n resumePurchase.submission.includeServiceFee ?? false,\n quantity: resumePurchase.submission.quantity,\n }\n : null\n );\n const [interactionLocked, setInteractionLocked] = useState(\n Boolean(resumePurchase)\n );\n const viewMounted = useRef<boolean>(true);\n const hostCallbacks = useRef(props);\n hostCallbacks.current = props;\n const reportedLock = useRef<boolean | null>(null);\n const updateInteractionLock = useCallback((locked: boolean) => {\n // biome-ignore lint/suspicious/noUnnecessaryConditions: Effect cleanup changes this ref outside the callback.\n if (viewMounted.current) {\n setInteractionLocked(locked);\n }\n if (reportedLock.current !== locked) {\n reportedLock.current = locked;\n notifyHostCallback(hostCallbacks.current.onInteractionLockChange, locked);\n }\n }, []);\n const hasRecovery = Boolean(resumePurchase);\n useEffect(() => {\n viewMounted.current = true;\n updateInteractionLock(hasRecovery);\n return () => {\n viewMounted.current = false;\n };\n }, [hasRecovery, updateInteractionLock]);\n const [contact, setContact] = useState({ email: \"\", phone: \"\" });\n const [paying, setPaying] = useState(Boolean(resumePurchase));\n const [notice, setNotice] = useState<string | null>(null);\n const [outcome, setOutcome] = useState<LockerverseAuctionOutcome | null>(\n null\n );\n\n useEffect(() => {\n if (\n !(paying || interactionLocked || resumePurchase) &&\n acceptedHost.current !== initialAuction\n ) {\n acceptedHost.current = initialAuction;\n setAuction(initialAuction);\n }\n }, [initialAuction, paying, interactionLocked, resumePurchase]);\n\n function review(current: LockerverseAuction, message: string) {\n updateInteractionLock(false);\n // The checkout just fetched this snapshot. Do not restore an older host\n // snapshot that arrived while payment was open; accept its next refresh.\n acceptedHost.current = hostCallbacks.current.auction;\n setAuction(current);\n setSelection(null);\n setPaying(false);\n setNotice(message);\n }\n function continueToPayment(next: AuctionSelection) {\n setNotice(null);\n setSelection(next);\n setPaying(true);\n }\n if (!item) {\n return (\n <div>\n <p role=\"alert\">This auction item is no longer available.</p>\n <AuctionBackAction href={props.backHref} onBack={props.onBack}>\n Back to auction items\n </AuctionBackAction>\n </div>\n );\n }\n if (outcome) {\n return (\n <AuctionItemResult\n {...props}\n auction={auction}\n item={item}\n outcome={outcome}\n />\n );\n }\n return (\n <section\n className={[\"lockerverse-auctions\", className].filter(Boolean).join(\" \")}\n data-lockerverse-theme={theme}\n ref={appearanceRoot}\n style={{\n \"--lockerverse-accent\": auction.community?.color ?? \"#6f8f6d\",\n ...style,\n }}\n >\n {interactionLocked ? null : (\n <AuctionBackAction\n className=\"lockerverse-auctions__back\"\n href={props.backHref}\n onBack={props.onBack}\n >\n <ChevronLeft aria-hidden=\"true\" size={16} /> All items\n </AuctionBackAction>\n )}\n <div className=\"lockerverse-auctions__detail\">\n <AuctionItemDetails\n auction={auction}\n galleryImageSizes={props.galleryImageSizes}\n item={item}\n itemHeadingLevel={props.itemHeadingLevel}\n />\n <div className=\"lockerverse-auctions__transaction\">\n {getAuctionDisplayStatus(auction, item) === \"active\" ? (\n <AuctionProgress buyNow={item.saleMode === \"buy_now\"} />\n ) : null}\n {notice ? (\n <p className=\"lockerverse-auctions__notice\" role=\"alert\">\n {notice}\n </p>\n ) : null}\n {paying && selection ? (\n <AuctionPaymentLoader\n {...props}\n appearanceRoot={appearanceRoot}\n auction={auction}\n communityName={props.communityName ?? auction.community?.name}\n contact={contact}\n interactionLocked={interactionLocked}\n item={item}\n onBack={() => setPaying(false)}\n onContactChange={setContact}\n onIncludeServiceFeeChange={(includeServiceFee) =>\n setSelection((current) =>\n current\n ? {\n ...current,\n includeServiceFee:\n auction.serviceFeeEnabled && includeServiceFee,\n }\n : current\n )\n }\n onInteractionLockChange={updateInteractionLock}\n onResult={setOutcome}\n onReview={review}\n selection={selection}\n />\n ) : (\n <AuctionItemSelection\n auction={auction}\n backHref={props.backHref}\n initialSelection={selection}\n item={item}\n itemHeadingLevel={props.itemHeadingLevel}\n onBack={props.onBack}\n onContinue={continueToPayment}\n onError={setNotice}\n />\n )}\n {interactionLocked ? null : (\n <AuctionBackAction\n className=\"lockerverse-auctions__footer-back\"\n href={props.backHref}\n onBack={props.onBack}\n >\n Back to auction items <ArrowRight aria-hidden=\"true\" size={16} />\n </AuctionBackAction>\n )}\n </div>\n </div>\n </section>\n );\n}\n\nexport function LockerverseAuctionItem(props: LockerverseAuctionItemProps) {\n const identity = useRef({\n auctionId: props.auction.id,\n client: props.client,\n itemId: props.itemId,\n });\n if (\n identity.current.client !== props.client ||\n identity.current.auctionId !== props.auction.id ||\n identity.current.itemId !== props.itemId\n ) {\n throw new TypeError(\n \"Auction item identity cannot change. Remount with a new React key.\"\n );\n }\n if (\n props.resumePurchase &&\n (props.resumePurchase.auctionId !== props.auction.id ||\n props.resumePurchase.itemId !== props.itemId ||\n props.resumePurchase.item.id !== props.itemId ||\n props.resumePurchase.item.auctionId !== props.auction.id)\n ) {\n throw new TypeError(\n \"The purchase recovery record belongs to a different auction item.\"\n );\n }\n // Keep the view mounted when a refreshed host snapshot removes the item.\n // Its transaction snapshot remains authoritative until it is safe to leave.\n return (\n <AuctionImageMediaBase.Provider value={props.auction.mediaBaseUrl}>\n <AuctionItemView {...props} />\n </AuctionImageMediaBase.Provider>\n );\n}\n"],"mappings":"0yBAIA,MAAM,EAAc,IAIpB,SAAgB,EAAmB,EAAkB,EAAwB,CAC3E,IAAM,EAAY,EAAO,CAAW,EAC9B,EAAc,EAAuB,IAAI,EACzC,CAAC,EAAY,GAAiB,EAAS,CAAW,EAClD,EAAW,MAEb,EAAS,CACP,MAAO,EACP,WAAY,GACZ,cAAe,GACf,kBAAmB,GACnB,iBAAkB,EACpB,CAAC,EACH,CAAC,CAAU,CACb,EAEM,CAAC,EAAa,GAAS,EAC3B,CAAE,SAAU,EAAgB,EAAI,GAAI,KAAM,EAAK,EAC/C,CAAC,CAAQ,CACX,EAEM,EAAO,MAAkB,CAEzB,EAAY,UACd,EAAY,QAAQ,MAAM,UAAY,UAAU,EAAI,EAAU,QAAU,EAAY,GAExF,EAAG,CAAC,CAAC,EAEC,EAAS,MAAkB,CAC/B,IAAM,EAAO,EAAS,cAAc,EAChC,IAAS,OACX,EAAU,QAAU,KAAK,IAAI,EAAG,KAAK,IAAI,EAAa,CAAI,CAAC,GAE7D,EAAS,KAAK,EACd,EAAK,CACP,EAAG,CAAC,EAAU,CAAI,CAAC,EAEb,EAAQ,MAAkB,CAC9B,EAAU,QAAU,EACpB,EAAc,CAAW,EACzB,EAAS,MAAM,EACf,EAAK,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KACnB,EAAC,EAAD,CACE,UAAU,oCACV,KAAM,EAAM,SACZ,OAAQ,EAAM,OAHhB,SAAA,CAIC,yBACuB,EAAC,EAAD,CAAY,cAAY,OAAO,KAAM,EAAK,CAAA,CAC/C,GAElB,CACF,CAAA,CAAA,CACE,CAAA,CAAA,IAvGP,EAAC,MAAD,CAAA,SAAA,CACE,EAAC,IAAD,CAAG,KAAK,QAAQ,SAAA,2CAA4C,CAAA,EAC5D,EAAC,EAAD,CAAmB,KAAM,EAAM,SAAU,OAAQ,EAAM,OAAQ,SAAA,uBAE5C,CAAA,CAChB,CAAA,CAAA,CAoGX,CAEA,SAAgB,GAAuB,EAAoC,CACzE,IAAM,EAAW,EAAO,CACtB,UAAW,EAAM,QAAQ,GACzB,OAAQ,EAAM,OACd,OAAQ,EAAM,MAChB,CAAC,EACD,GACE,EAAS,QAAQ,SAAW,EAAM,QAClC,EAAS,QAAQ,YAAc,EAAM,QAAQ,IAC7C,EAAS,QAAQ,SAAW,EAAM,OAElC,MAAU,UACR,oEACF,EAEF,GACE,EAAM,iBACL,EAAM,eAAe,YAAc,EAAM,QAAQ,IAChD,EAAM,eAAe,SAAW,EAAM,QACtC,EAAM,eAAe,KAAK,KAAO,EAAM,QACvC,EAAM,eAAe,KAAK,YAAc,EAAM,QAAQ,IAExD,MAAU,UACR,mEACF,EAIF,OACE,EAAC,EAAsB,SAAvB,CAAgC,MAAO,EAAM,QAAQ,aACnD,SAAA,EAAC,GAAD,CAAiB,GAAI,CAAQ,CAAA,CACC,CAAA,CAEpC"}
|
|
1
|
+
{"version":3,"file":"auction-item.js","names":["Close","formatMoney","formatMoney"],"sources":["../src/use-auction-autoplay.ts","../src/auction-photo-filmstrip.tsx","../src/auction-gallery.tsx","../src/auction-item-details.tsx","../src/auction-item-selection.tsx","../src/auction-payment-loader.tsx","../src/lockerverse-auction-item.tsx"],"sourcesContent":["import Autoplay from \"embla-carousel-autoplay\";\nimport useEmblaCarousel from \"embla-carousel-react\";\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\n\nconst PHOTO_DELAY = 6000;\n\n// Embla 8 has stop(), but no pause(). Resume with the saved delay, then restore\n// the full delay on selection. Embla remains the only owner of the slide timer.\nexport function useAuctionAutoplay(enabled: boolean, reducedMotion: boolean) {\n const remaining = useRef(PHOTO_DELAY);\n const progressRef = useRef<HTMLDivElement>(null);\n const [cycleDelay, setCycleDelay] = useState(PHOTO_DELAY);\n const autoplay = useMemo(\n () =>\n Autoplay({\n delay: cycleDelay,\n playOnInit: false,\n stopOnFocusIn: false,\n stopOnInteraction: true,\n stopOnMouseEnter: false,\n }),\n [cycleDelay]\n );\n\n const [viewportRef, embla] = useEmblaCarousel(\n { duration: reducedMotion ? 0 : 25, loop: true },\n [autoplay]\n );\n\n const draw = useCallback(() => {\n // biome-ignore lint/suspicious/noUnnecessaryConditions: React assigns this ref in the filmstrip component.\n if (progressRef.current) {\n progressRef.current.style.transform = `scaleX(${1 - remaining.current / PHOTO_DELAY})`;\n }\n }, []);\n\n const freeze = useCallback(() => {\n const left = autoplay.timeUntilNext();\n if (left !== null) {\n remaining.current = Math.max(1, Math.min(PHOTO_DELAY, left));\n }\n autoplay.stop();\n draw();\n }, [autoplay, draw]);\n\n const reset = useCallback(() => {\n remaining.current = PHOTO_DELAY;\n setCycleDelay(PHOTO_DELAY);\n autoplay.reset();\n draw();\n }, [autoplay, draw]);\n\n useEffect(() => {\n if (!embla) {\n return;\n }\n if (!enabled) {\n freeze();\n } else if (cycleDelay === remaining.current) {\n autoplay.play();\n } else {\n setCycleDelay(remaining.current);\n }\n }, [embla, enabled, autoplay, cycleDelay, setCycleDelay, remaining, freeze]);\n\n useEffect(() => {\n if (!embla) {\n return;\n }\n let frame = 0;\n const update = () => {\n const left = autoplay.timeUntilNext();\n if (!enabled || left === null) {\n return;\n }\n remaining.current = Math.max(0, Math.min(PHOTO_DELAY, left));\n draw();\n frame = requestAnimationFrame(update);\n };\n const start = () => {\n cancelAnimationFrame(frame);\n if (enabled) {\n frame = requestAnimationFrame(update);\n }\n };\n const stop = () => cancelAnimationFrame(frame);\n const reinitialize = () => {\n if (enabled) {\n autoplay.play();\n }\n };\n embla\n .on(\"select\", reset)\n .on(\"reInit\", reinitialize)\n .on(\"autoplay:timerset\", start)\n .on(\"autoplay:timerstopped\", stop);\n draw();\n start();\n return () => {\n stop();\n embla\n .off(\"select\", reset)\n .off(\"reInit\", reinitialize)\n .off(\"autoplay:timerset\", start)\n .off(\"autoplay:timerstopped\", stop);\n };\n }, [embla, autoplay, enabled, remaining, reset, draw]);\n return { embla, freeze, progressRef, reset, viewportRef };\n}\n","import { ChevronLeft, ChevronRight, Pause, Play } from \"lucide-react\";\nimport {\n type PointerEvent,\n type Ref,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { AuctionImage } from \"./auction-image.tsx\";\nimport { useAuctionAutoplay } from \"./use-auction-autoplay\";\nimport { useAuctionVisibility } from \"./use-auction-visibility\";\n\ntype FilmstripProps = {\n photos: string[];\n name: string;\n imageSizes?: string | undefined;\n selected: number;\n paused?: boolean;\n photoButtonRef: Ref<HTMLButtonElement>;\n onSelect: (index: number) => void;\n onExpand: (index: number) => void;\n};\n\nexport function AuctionPhotoFilmstrip({\n photos,\n name,\n imageSizes = \"(max-width: 1279px) 100vw, 45vw\",\n selected,\n paused = false,\n photoButtonRef,\n onSelect,\n onExpand,\n}: FilmstripProps) {\n const stripRef = useRef<HTMLDivElement>(null);\n const keyboardPhoto = useRef<HTMLButtonElement | null>(null);\n const thumbnailRefs = useRef<(HTMLButtonElement | null)[]>([]);\n const [reducedMotion, setReducedMotion] = useState(true);\n const [hovered, setHovered] = useState(false);\n const [keyboardFocused, setKeyboardFocused] = useState(false);\n const [userPaused, setUserPaused] = useState(false);\n const [dragging, setDragging] = useState(false);\n const { ref: galleryRef, visible } = useAuctionVisibility<HTMLElement>();\n const [controlsActive, setControlsActive] = useState(false);\n const [touchControls, setTouchControls] = useState(true);\n const hideControlsTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const controlsVisible = touchControls || controlsActive || keyboardFocused;\n const controlsFade = `lockerverse-auction-gallery__control ${controlsVisible ? \"is-visible\" : \"\"}`;\n\n const scheduleControlsHide = () => {\n // biome-ignore lint/suspicious/noUnnecessaryConditions: The timer ref is assigned after pointer activity.\n if (hideControlsTimer.current) {\n clearTimeout(hideControlsTimer.current);\n }\n hideControlsTimer.current = setTimeout(\n () => setControlsActive(false),\n 2000\n );\n };\n const showControls = (event: PointerEvent<HTMLDivElement>) => {\n if (event.pointerType !== \"mouse\") {\n setTouchControls(true);\n return;\n }\n setControlsActive(true);\n // biome-ignore lint/suspicious/noUnnecessaryConditions: The timer ref is assigned after pointer activity.\n if (hideControlsTimer.current) {\n clearTimeout(hideControlsTimer.current);\n }\n if (\n !(\n event.target instanceof Element &&\n event.target.closest(\"[data-gallery-control]\")\n )\n ) {\n scheduleControlsHide();\n }\n };\n\n useEffect(() => {\n const preference = window.matchMedia(\"(hover: none), (pointer: coarse)\");\n const update = () => setTouchControls(preference.matches);\n update();\n preference.addEventListener(\"change\", update);\n return () => {\n preference.removeEventListener(\"change\", update);\n clearTimeout(hideControlsTimer.current ?? undefined);\n };\n }, []);\n\n const autoplayEnabled =\n !(\n paused ||\n reducedMotion ||\n hovered ||\n keyboardFocused ||\n userPaused ||\n dragging\n ) && visible;\n const count = photos.length;\n const current = count ? ((selected % count) + count) % count : 0;\n const { viewportRef, embla, progressRef, freeze, reset } = useAuctionAutoplay(\n autoplayEnabled && count > 1,\n reducedMotion\n );\n\n useEffect(() => {\n const preference = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n const update = () => setReducedMotion(preference.matches);\n update();\n preference.addEventListener(\"change\", update);\n return () => preference.removeEventListener(\"change\", update);\n }, []);\n\n useEffect(() => {\n if (!embla) {\n return;\n }\n const select = () => onSelect(embla.selectedScrollSnap());\n embla.on(\"select\", select).on(\"reInit\", select);\n return () => {\n embla.off(\"select\", select).off(\"reInit\", select);\n };\n }, [embla, onSelect]);\n\n useEffect(() => {\n if (embla && embla.selectedScrollSnap() !== current) {\n embla.scrollTo(current, true);\n }\n }, [embla, current]);\n\n useEffect(() => {\n const updateVisibility = () => {\n if (document.hidden) {\n freeze();\n }\n };\n const release = () => setDragging(false);\n updateVisibility();\n document.addEventListener(\"visibilitychange\", updateVisibility, true);\n window.addEventListener(\"pointerup\", release);\n window.addEventListener(\"pointercancel\", release);\n return () => {\n document.removeEventListener(\"visibilitychange\", updateVisibility, true);\n window.removeEventListener(\"pointerup\", release);\n window.removeEventListener(\"pointercancel\", release);\n };\n }, [freeze]);\n\n const selectPhoto = (next: number) => {\n embla?.scrollTo((next + count) % count, reducedMotion);\n reset();\n };\n\n useEffect(() => {\n const previousPhoto = keyboardPhoto.current;\n keyboardPhoto.current = null;\n // biome-ignore lint/suspicious/noUnnecessaryConditions: Keyboard events assign this ref before the selected photo changes.\n if (previousPhoto && document.activeElement === previousPhoto) {\n galleryRef.current\n ?.querySelector<HTMLButtonElement>(\n '.lockerverse-auction-gallery__photo[tabindex=\"0\"]'\n )\n ?.focus({ preventScroll: true });\n }\n }, [current, galleryRef]);\n\n useEffect(() => {\n const strip = stripRef.current;\n const thumbnail = thumbnailRefs.current[current];\n // biome-ignore lint/suspicious/noUnnecessaryConditions: React assigns the element ref after mounting.\n if (!(strip && thumbnail)) {\n return;\n }\n const stripBounds = strip.getBoundingClientRect();\n const photoBounds = thumbnail.getBoundingClientRect();\n if (photoBounds.left < stripBounds.left) {\n strip.scrollLeft -= stripBounds.left - photoBounds.left;\n } else if (photoBounds.right > stripBounds.right) {\n strip.scrollLeft += photoBounds.right - stripBounds.right;\n }\n }, [current, count]);\n\n return (\n // biome-ignore lint/a11y/noNoninteractiveElementInteractions: The gallery handles keys from its focusable photo and navigation buttons.\n <section\n aria-label={`${name} photos`}\n className=\"lockerverse-auction-gallery\"\n onBlurCapture={(event) => {\n if (!event.currentTarget.contains(event.relatedTarget)) {\n setKeyboardFocused(false);\n }\n }}\n onFocusCapture={(event) =>\n setKeyboardFocused(event.target.matches(\":focus-visible\"))\n }\n onKeyDown={(event) => {\n if (\n count < 2 ||\n event.altKey ||\n event.ctrlKey ||\n event.metaKey ||\n event.shiftKey\n ) {\n return;\n }\n if (event.key === \"ArrowLeft\" || event.key === \"ArrowRight\") {\n event.preventDefault();\n if (\n event.target instanceof HTMLButtonElement &&\n event.target.classList.contains(\n \"lockerverse-auction-gallery__photo\"\n )\n ) {\n keyboardPhoto.current = event.target;\n }\n selectPhoto(current + (event.key === \"ArrowRight\" ? 1 : -1));\n }\n }}\n onPointerEnter={(event) => {\n if (event.pointerType === \"mouse\") {\n setHovered(true);\n }\n }}\n onPointerLeave={(event) => {\n if (event.pointerType === \"mouse\") {\n setHovered(false);\n }\n }}\n ref={galleryRef}\n >\n {count ? (\n <div\n className=\"lockerverse-auction-gallery__stage\"\n onPointerEnter={showControls}\n onPointerLeave={scheduleControlsHide}\n onPointerMove={showControls}\n >\n <div\n className=\"lockerverse-auction-gallery__viewport\"\n onPointerDownCapture={() => {\n freeze();\n setDragging(true);\n }}\n ref={viewportRef}\n >\n <div className=\"lockerverse-auction-gallery__track\">\n {photos.map((photo, photoIndex) => (\n <div\n aria-hidden={photoIndex !== current}\n className=\"lockerverse-auction-gallery__slide\"\n key={`${photo}-${photoIndex}`}\n >\n <button\n aria-label={`View photo ${photoIndex + 1} of ${name} at full size`}\n className=\"lockerverse-auction-gallery__photo\"\n onClick={() => {\n onExpand(photoIndex);\n }}\n ref={photoIndex === current ? photoButtonRef : undefined}\n tabIndex={photoIndex === current ? 0 : -1}\n type=\"button\"\n >\n <AuctionImage\n alt={`${name}, ${photoIndex + 1} of ${count}`}\n className=\"lockerverse-auction-gallery__image\"\n draggable={false}\n fetchPriority={photoIndex === 0 ? \"high\" : \"auto\"}\n height={900}\n loading={photoIndex === current ? \"eager\" : \"lazy\"}\n maxWidth={1920}\n sizes={\n photoIndex === current\n ? imageSizes\n : `auto, ${imageSizes}`\n }\n src={photo}\n width={1200}\n />\n </button>\n </div>\n ))}\n </div>\n </div>\n {count > 1 && !reducedMotion && (\n <div className=\"lockerverse-auction-gallery__rotation\">\n <div\n aria-hidden=\"true\"\n className=\"lockerverse-auction-gallery__progress-track\"\n >\n <div\n className=\"lockerverse-auction-gallery__progress\"\n ref={progressRef}\n style={{ transform: \"scaleX(0)\" }}\n />\n </div>\n <button\n aria-label={\n userPaused ? \"Play photo rotation\" : \"Pause photo rotation\"\n }\n className={`lockerverse-auction-gallery__play ${controlsFade}`}\n data-gallery-control\n onClick={() => setUserPaused((value) => !value)}\n title={\n userPaused ? \"Play photo rotation\" : \"Pause photo rotation\"\n }\n type=\"button\"\n >\n {userPaused ? (\n <Play aria-hidden=\"true\" size={13} />\n ) : (\n <Pause aria-hidden=\"true\" size={13} />\n )}\n </button>\n </div>\n )}\n {count > 1 && (\n <>\n <button\n aria-label=\"Previous photo\"\n className={`lockerverse-auction-gallery__previous ${controlsFade}`}\n data-gallery-control\n onClick={() => selectPhoto(current - 1)}\n type=\"button\"\n >\n <ChevronLeft\n aria-hidden=\"true\"\n className=\"lockerverse-auction-gallery__chevron\"\n />\n </button>\n <button\n aria-label=\"Next photo\"\n className={`lockerverse-auction-gallery__next ${controlsFade}`}\n data-gallery-control\n onClick={() => selectPhoto(current + 1)}\n type=\"button\"\n >\n <ChevronRight\n aria-hidden=\"true\"\n className=\"lockerverse-auction-gallery__chevron\"\n />\n </button>\n </>\n )}\n </div>\n ) : (\n <div className=\"lockerverse-auction-gallery__empty\">\n No photo available\n </div>\n )}\n {count > 1 && (\n <section\n aria-label=\"Choose a photo\"\n className=\"lockerverse-auction-gallery__strip\"\n ref={stripRef}\n >\n <div className=\"lockerverse-auction-gallery__thumbnails\">\n {photos.map((photo, photoIndex) => (\n <button\n aria-label={`Show photo ${photoIndex + 1} of ${count}`}\n aria-pressed={current === photoIndex}\n className={`lockerverse-auction-gallery__thumbnail ${current === photoIndex ? \"is-selected\" : \"\"}`}\n key={`${photo}-${photoIndex}`}\n onClick={() => selectPhoto(photoIndex)}\n ref={(element) => {\n thumbnailRefs.current[photoIndex] = element;\n }}\n type=\"button\"\n >\n <AuctionImage\n alt=\"\"\n className=\"lockerverse-auction-gallery__thumbnail-image\"\n height={66}\n loading=\"lazy\"\n maxWidth={192}\n sizes=\"88px\"\n src={photo}\n width={88}\n />\n </button>\n ))}\n </div>\n </section>\n )}\n </section>\n );\n}\n","import { Dialog } from \"@base-ui/react/dialog\";\nimport { ChevronLeft, ChevronRight, X as Close } from \"lucide-react\";\nimport { useRef, useState } from \"react\";\nimport { AuctionImage } from \"./auction-image.tsx\";\nimport { AuctionPhotoFilmstrip } from \"./auction-photo-filmstrip\";\n\nexport function AuctionGallery({\n images,\n fallbackImage,\n name,\n imageSizes,\n}: {\n images: readonly string[];\n fallbackImage?: string | null;\n name: string;\n imageSizes?: string | undefined;\n}) {\n const photos = [...new Set(images.filter(Boolean))];\n if (!photos.length && fallbackImage) {\n photos.push(fallbackImage);\n }\n const [index, setIndex] = useState(0);\n const [open, setOpen] = useState(false);\n const opener = useRef<HTMLButtonElement | null>(null);\n const swipeStart = useRef<{ x: number; y: number } | null>(null);\n const count = photos.length;\n const selected = count ? ((index % count) + count) % count : 0;\n\n return (\n <>\n <AuctionPhotoFilmstrip\n imageSizes={imageSizes}\n name={name}\n onExpand={(next) => {\n setIndex(next);\n setOpen(true);\n }}\n onSelect={setIndex}\n paused={open}\n photoButtonRef={opener}\n photos={photos}\n selected={selected}\n />\n {count > 0 && (\n <Dialog.Root onOpenChange={setOpen} open={open}>\n <Dialog.Portal>\n <Dialog.Backdrop className=\"lockerverse-auction-gallery__backdrop\" />\n <Dialog.Popup\n aria-describedby={undefined}\n className=\"lockerverse-auction-gallery__viewer\"\n finalFocus={opener}\n onKeyDown={(event) => {\n if (\n count < 2 ||\n event.altKey ||\n event.ctrlKey ||\n event.metaKey ||\n event.shiftKey\n ) {\n return;\n }\n if (event.key === \"ArrowLeft\" || event.key === \"ArrowRight\") {\n event.preventDefault();\n setIndex(\n (selected + (event.key === \"ArrowRight\" ? 1 : -1) + count) %\n count\n );\n }\n }}\n >\n <Dialog.Title className=\"lockerverse-auction-gallery__sr-only\">\n {name} · Photo {selected + 1} of {count}\n </Dialog.Title>\n <div\n className=\"lockerverse-auction-gallery__full-image\"\n onTouchCancel={() => {\n swipeStart.current = null;\n }}\n onTouchEnd={(event) => {\n const start = swipeStart.current;\n swipeStart.current = null;\n const end = event.changedTouches.item(0);\n // biome-ignore lint/suspicious/noUnnecessaryConditions: Touch start assigns the shared ref before this event.\n if (!(start && end) || count < 2) {\n return;\n }\n const dx = end.clientX - start.x;\n const dy = end.clientY - start.y;\n if (Math.abs(dx) >= 45 && Math.abs(dx) > Math.abs(dy) * 1.3) {\n setIndex((selected + (dx < 0 ? 1 : -1) + count) % count);\n }\n }}\n onTouchMove={(event) => {\n if (event.touches.length !== 1) {\n swipeStart.current = null;\n }\n }}\n onTouchStart={(event) => {\n const touch = event.touches.item(0);\n swipeStart.current =\n event.touches.length === 1 && touch\n ? { x: touch.clientX, y: touch.clientY }\n : null;\n }}\n >\n <AuctionImage\n alt={`${name}, ${selected + 1} of ${count}`}\n height={900}\n maxWidth={1920}\n sizes=\"100vw\"\n src={photos[selected]}\n width={1200}\n />\n {open && count > 1 && (\n <AuctionImage\n alt=\"\"\n aria-hidden=\"true\"\n className=\"lockerverse-auction-gallery__preload\"\n height={900}\n loading=\"eager\"\n maxWidth={1920}\n sizes=\"100vw\"\n src={photos[(selected + 1) % count]}\n width={1200}\n />\n )}\n </div>\n <Dialog.Close\n aria-label=\"Close photo viewer\"\n className=\"lockerverse-auction-gallery__viewer-close\"\n >\n <Close aria-hidden=\"true\" size={22} />\n </Dialog.Close>\n {count > 1 && (\n <>\n <button\n aria-label=\"Previous photo\"\n className=\"lockerverse-auction-gallery__viewer-previous\"\n onClick={() => setIndex((selected - 1 + count) % count)}\n type=\"button\"\n >\n <ChevronLeft aria-hidden=\"true\" size={28} />\n </button>\n <button\n aria-label=\"Next photo\"\n className=\"lockerverse-auction-gallery__viewer-next\"\n onClick={() => setIndex((selected + 1) % count)}\n type=\"button\"\n >\n <ChevronRight aria-hidden=\"true\" size={28} />\n </button>\n </>\n )}\n </Dialog.Popup>\n </Dialog.Portal>\n </Dialog.Root>\n )}\n </>\n );\n}\n","import type {\n LockerverseAuction,\n LockerverseAuctionItem,\n LockerverseAuctionStatus,\n} from \"@lockerverse/sdk/auctions\";\nimport {\n ChevronDown,\n Clock3,\n Gavel,\n ShieldCheck,\n TimerReset,\n} from \"lucide-react\";\nimport { useId, useState } from \"react\";\nimport { AuctionDescription } from \"./auction-description.tsx\";\nimport {\n formatAuctionBoundary,\n formatAuctionMoney as formatMoney,\n getAuctionDisplayStatus,\n} from \"./auction-display.ts\";\nimport { AuctionGallery } from \"./auction-gallery.tsx\";\nimport { useAuctionBoundary } from \"./use-auction-boundary.ts\";\n\nconst itemHeadingTags = { 1: \"h1\", 2: \"h2\" } as const;\n\nfunction metricIcon(label: string | undefined) {\n if (label === \"Buy Now\") {\n return <ShieldCheck aria-hidden=\"true\" size={16} />;\n }\n if (label === \"Available\" || label === \"Increment\") {\n return <TimerReset aria-hidden=\"true\" size={16} />;\n }\n return <Gavel aria-hidden=\"true\" size={16} />;\n}\nfunction itemMetrics(\n item: LockerverseAuctionItem,\n status: LockerverseAuctionStatus\n) {\n if (item.saleMode === \"buy_now\") {\n return [\n [\"Buy Now\", formatMoney(item.buyNowPriceAmount ?? 0)],\n [\n \"Available\",\n item.availableQuantity === null\n ? \"Available\"\n : String(item.availableQuantity),\n ],\n ];\n }\n if (status === \"finished\") {\n return [\n [\n \"Final bid\",\n item.maxBidAmount ? formatMoney(item.maxBidAmount) : \"No bids\",\n ],\n ];\n }\n return [\n [\"Current bid\", formatMoney(item.maxBidAmount ?? 0)],\n [\"Floor\", formatMoney(item.minBidAmount ?? 0)],\n [\"Increment\", formatMoney(item.bidIncrementAmount ?? 100)],\n ];\n}\nexport function AuctionItemDetails({\n auction,\n item,\n itemHeadingLevel = 2,\n galleryImageSizes,\n}: {\n auction: LockerverseAuction;\n item: LockerverseAuctionItem;\n itemHeadingLevel?: 1 | 2 | undefined;\n galleryImageSizes?: string | undefined;\n}) {\n useAuctionBoundary(\n item.startAt ?? auction.startAt,\n item.endAt ?? auction.endAt\n );\n const [expanded, setExpanded] = useState(false);\n const descriptionId = useId();\n const status = getAuctionDisplayStatus(auction, item);\n const boundaryLabel = {\n active: \"Closes\",\n draft: \"Opens\",\n finished: \"Closed\",\n }[status];\n const boundary = formatAuctionBoundary(auction, status, item);\n const buyNow = item.saleMode === \"buy_now\";\n const longDescription = (item.description ?? \"\").trim().length > 240;\n const metrics = itemMetrics(item, status);\n const ItemHeading = itemHeadingTags[itemHeadingLevel];\n return (\n <section className=\"lockerverse-auctions__item-summary\">\n <AuctionGallery\n fallbackImage={\n item.image ??\n auction.configuration.image ??\n auction.community?.banner ??\n auction.community?.thumbnail ??\n null\n }\n imageSizes={galleryImageSizes}\n images={item.images}\n name={item.name}\n />\n <div className=\"lockerverse-auctions__item-copy\">\n <ItemHeading>{item.name}</ItemHeading>\n {item.description ? (\n <div className=\"lockerverse-auctions__item-description\">\n <AuctionDescription\n className={\n !expanded && longDescription\n ? \"lockerverse-auctions__description-clamped\"\n : undefined\n }\n description={item.description}\n id={descriptionId}\n />\n {longDescription ? (\n <button\n aria-controls={descriptionId}\n aria-expanded={expanded}\n className=\"lockerverse-auctions__description-toggle\"\n onClick={() => setExpanded(!expanded)}\n type=\"button\"\n >\n {expanded ? \"Hide description\" : \"Read full description\"}{\" \"}\n <ChevronDown\n aria-hidden=\"true\"\n size={16}\n style={{ transform: expanded ? \"rotate(180deg)\" : undefined }}\n />\n </button>\n ) : null}\n </div>\n ) : null}\n <dl className=\"lockerverse-auctions__stat-panel\">\n {metrics.map(([label, value]) => (\n <div className=\"lockerverse-auctions__stat-row\" key={label}>\n <dt>\n {metricIcon(label)}\n {label}\n </dt>\n <dd>{value}</dd>\n </div>\n ))}\n <div className=\"lockerverse-auctions__stat-row\">\n <dt>\n <Clock3 aria-hidden=\"true\" size={16} />\n {boundaryLabel}\n </dt>\n <dd className=\"lockerverse-auctions__stat-date\">{boundary}</dd>\n </div>\n {!buyNow && status === \"finished\" ? (\n <div className=\"lockerverse-auctions__stat-footer\">\n <div>\n <dt>Floor</dt>\n <dd>{formatMoney(item.minBidAmount ?? 0)}</dd>\n </div>\n <div>\n <dt>Bid increment</dt>\n <dd>{formatMoney(item.bidIncrementAmount ?? 100)}</dd>\n </div>\n </div>\n ) : null}\n </dl>\n </div>\n </section>\n );\n}\n","import {\n getLockerverseAuctionMinimumBid,\n type LockerverseAuction,\n type LockerverseAuctionBidType,\n type LockerverseAuctionItem,\n type LockerverseAuctionStatus,\n} from \"@lockerverse/sdk/auctions\";\nimport { ArrowRight } from \"lucide-react\";\nimport { type FormEvent, useId, useState } from \"react\";\nimport { AuctionBackAction } from \"./auction-back-action.tsx\";\nimport {\n formatAuctionBoundary,\n formatAuctionMoney as formatMoney,\n getAuctionDisplayStatus,\n isAuctionItemSoldOut,\n} from \"./auction-display.ts\";\nimport {\n type AuctionSelection,\n getAuctionSelectionError,\n getAuctionSelectionPricing,\n} from \"./auction-payment.ts\";\nimport { useAuctionBoundary } from \"./use-auction-boundary.ts\";\n\nconst selectionHeadingTags = { 1: \"h2\", 2: \"h3\" } as const;\n\nconst WHOLE_NUMBER = /^\\d+$/;\n\ntype SelectionProps = {\n auction: LockerverseAuction;\n item: LockerverseAuctionItem;\n itemHeadingLevel?: 1 | 2 | undefined;\n initialSelection: AuctionSelection | null;\n onContinue: (selection: AuctionSelection) => void;\n onError: (message: string) => void;\n onBack?: (() => void) | undefined;\n backHref?: string | undefined;\n};\n\nfunction quantitySummary(value: string, item: LockerverseAuctionItem) {\n const quantity = Number(value);\n const subtotal = quantity * (item.buyNowPriceAmount ?? 0);\n if (\n !(WHOLE_NUMBER.test(value) && Number.isSafeInteger(subtotal)) ||\n quantity < 1\n ) {\n return \"Enter a whole-number quantity.\";\n }\n if (!item.additionalCharge) {\n return `Total: ${formatMoney(subtotal)}`;\n }\n const charge =\n item.additionalCharge.firstUnitAmountCents +\n item.additionalCharge.additionalUnitAmountCents * (quantity - 1);\n const total = subtotal + charge;\n if (!Number.isSafeInteger(total)) {\n return \"Enter a valid quantity.\";\n }\n return `Subtotal: ${formatMoney(subtotal)} · ${item.additionalCharge.name}: ${formatMoney(charge)} · Total: ${formatMoney(total)}`;\n}\nfunction selectionInitialValue(\n buyNow: boolean,\n initial: AuctionSelection | null,\n minimum: number\n) {\n if (buyNow) {\n return String(initial ? initial.quantity : 1);\n }\n return String(initial ? initial.amount / 100 : minimum);\n}\nfunction readOnlyTitle(\n item: LockerverseAuctionItem,\n status: LockerverseAuctionStatus\n) {\n if (isAuctionItemSoldOut(item)) {\n return \"This item is sold out.\";\n }\n if (status === \"draft\") {\n return \"This item is not open yet.\";\n }\n if (status === \"finished\") {\n return item.saleMode === \"buy_now\"\n ? \"Purchases are closed for this item.\"\n : \"Bidding is closed for this item.\";\n }\n return \"This item is not available.\";\n}\nfunction readOnlyDescription(\n auction: LockerverseAuction,\n item: LockerverseAuctionItem,\n status: LockerverseAuctionStatus\n) {\n if (isAuctionItemSoldOut(item)) {\n return \"All available quantities have been purchased.\";\n }\n if (status === \"draft\") {\n return `This item opens ${formatAuctionBoundary(auction, \"draft\", item)}.`;\n }\n return item.saleMode === \"buy_now\"\n ? \"This item is no longer available to purchase.\"\n : \"Bidding has closed for this item.\";\n}\nfunction selectionFromInput(\n auction: LockerverseAuction,\n buyNow: boolean,\n initialSelection: AuctionSelection | null,\n value: string,\n bidType: LockerverseAuctionBidType\n): AuctionSelection {\n const selection: AuctionSelection = {\n amount: buyNow ? 0 : Number(value) * 100,\n includeServiceFee: initialSelection\n ? initialSelection.includeServiceFee\n : auction.serviceFeeEnabled && auction.serviceFeeDefaultChecked,\n quantity: buyNow ? Number(value) : 1,\n };\n if (!buyNow) {\n selection.bidType = bidType;\n }\n return selection;\n}\nexport function AuctionItemSelection({\n auction,\n item,\n initialSelection,\n onContinue,\n onError,\n onBack,\n backHref,\n itemHeadingLevel = 2,\n}: SelectionProps) {\n const SelectionHeading = selectionHeadingTags[itemHeadingLevel];\n const buyNow = item.saleMode === \"buy_now\";\n const minimum = Math.ceil(getLockerverseAuctionMinimumBid(item) / 100);\n const [value, setValue] = useState(\n selectionInitialValue(buyNow, initialSelection, minimum)\n );\n const [bidType, setBidType] = useState<LockerverseAuctionBidType>(\n initialSelection?.bidType ?? \"fixed\"\n );\n const [error, setError] = useState<string | null>(null);\n const id = useId();\n useAuctionBoundary(\n item.startAt ?? auction.startAt,\n item.endAt ?? auction.endAt\n );\n const status = getAuctionDisplayStatus(auction, item);\n const open =\n status === \"active\" &&\n !isAuctionItemSoldOut(item) &&\n item.saleMode !== \"hybrid\";\n function continueToPayment(event: FormEvent<HTMLFormElement>) {\n event.preventDefault();\n if (!WHOLE_NUMBER.test(value)) {\n setError(\n buyNow\n ? \"Enter a whole-number quantity.\"\n : \"Enter a whole-dollar bid amount.\"\n );\n return;\n }\n const selection = selectionFromInput(\n auction,\n buyNow,\n initialSelection,\n value,\n bidType\n );\n const message = getAuctionSelectionError(auction, item, selection);\n if (message) {\n setError(message);\n onError(message);\n return;\n }\n try {\n getAuctionSelectionPricing(auction, item, selection);\n } catch {\n setError(\"Enter a valid amount or quantity.\");\n return;\n }\n onContinue(selection);\n }\n if (!open) {\n return (\n <div className=\"lockerverse-auctions__selection lockerverse-auctions__read-only\">\n <p className=\"lockerverse-auctions__eyebrow\">Item status</p>\n <SelectionHeading>{readOnlyTitle(item, status)}</SelectionHeading>\n <p>{readOnlyDescription(auction, item, status)}</p>\n <AuctionBackAction\n className=\"lockerverse-auctions__button\"\n href={backHref}\n onBack={onBack}\n >\n Browse auction items <ArrowRight aria-hidden=\"true\" size={16} />\n </AuctionBackAction>\n </div>\n );\n }\n return (\n <form\n className=\"lockerverse-auctions__selection\"\n onSubmit={continueToPayment}\n >\n <SelectionHeader\n buyNow={buyNow}\n headingTag={SelectionHeading}\n item={item}\n minimum={minimum}\n />\n <div className=\"lockerverse-auctions__selection-body\">\n <BidTypeChoice\n bidType={bidType}\n enabled={!buyNow && Boolean(item.supportsMaximumBids)}\n id={id}\n onChange={(type) => {\n setBidType(type);\n setError(null);\n }}\n />\n <label className=\"lockerverse-auctions__field\" htmlFor={id}>\n {selectionAmountLabel(buyNow, bidType)}\n <span className=\"lockerverse-auctions__amount-control\">\n {buyNow ? null : <span aria-hidden=\"true\">$</span>}\n <input\n aria-describedby={`${id}-help`}\n aria-invalid={Boolean(error)}\n autoComplete=\"off\"\n id={id}\n inputMode=\"numeric\"\n onChange={(event) => {\n setValue(event.target.value);\n setError(null);\n }}\n placeholder={buyNow ? \"1\" : String(minimum)}\n required\n value={value}\n />\n </span>\n </label>\n {error ? <p role=\"alert\">{error}</p> : null}\n <p id={`${id}-help`}>\n {buyNow\n ? quantitySummary(value, item)\n : `Enter a whole-dollar bid of at least ${formatMoney(minimum * 100)}. Bid increment: ${formatMoney(item.bidIncrementAmount ?? 100)}.`}\n </p>\n <BidAdditionalCharge item={item} />\n <div className=\"lockerverse-auctions__selection-footer\">\n <p>\n {buyNow\n ? \"Continuing moves you into secure checkout where your payment is processed immediately.\"\n : \"Continuing moves you into the secure payment step where your card is stored for settlement only if your bid wins.\"}\n </p>\n <button\n className=\"lockerverse-auctions__button\"\n disabled={!auction.payment}\n type=\"submit\"\n >\n {buyNow ? \"Continue to Checkout\" : \"Continue to Payment\"}{\" \"}\n <ArrowRight aria-hidden=\"true\" size={16} />\n </button>\n </div>\n {auction.payment ? null : (\n <p role=\"alert\">Payments are not configured for this auction.</p>\n )}\n </div>\n </form>\n );\n}\n\nfunction SelectionHeader({\n headingTag: SelectionHeading,\n item,\n buyNow,\n minimum,\n}: {\n item: LockerverseAuctionItem;\n buyNow: boolean;\n minimum: number;\n headingTag: \"h2\" | \"h3\";\n}) {\n return (\n <div className=\"lockerverse-auctions__selection-header\">\n <p className=\"lockerverse-auctions__eyebrow\">Step 1 of 2</p>\n <SelectionHeading>\n {buyNow ? \"Buy this item now.\" : \"Place your bid.\"}\n </SelectionHeading>\n <p>\n {buyNow\n ? \"Choose how many you want, then complete the secure checkout.\"\n : \"Choose your bid amount. You are only charged if this bid wins after bidding closes.\"}\n </p>\n <p>\n {buyNow ? \"Price: \" : \"Minimum qualifying bid: \"}\n <strong>\n {formatMoney(buyNow ? (item.buyNowPriceAmount ?? 0) : minimum * 100)}\n </strong>\n </p>\n {buyNow && item.availableQuantity !== null ? (\n <p>{item.availableQuantity} available</p>\n ) : null}\n {item.collectShippingAddress ? (\n <p>\n The next step will also collect a delivery address for seller\n fulfillment.\n </p>\n ) : null}\n </div>\n );\n}\n\nfunction BidAdditionalCharge({ item }: { item: LockerverseAuctionItem }) {\n if (item.saleMode === \"buy_now\" || !item.additionalCharge) {\n return null;\n }\n return (\n <p>\n {item.additionalCharge.name}:{\" \"}\n {formatMoney(item.additionalCharge.firstUnitAmountCents)} will be added to\n your winning bid.\n </p>\n );\n}\n\nfunction selectionAmountLabel(\n buyNow: boolean,\n bidType: LockerverseAuctionBidType\n) {\n if (buyNow) {\n return \"Quantity\";\n }\n return bidType === \"maximum\" ? \"Your maximum bid\" : \"Your bid amount\";\n}\n\nfunction BidTypeChoice({\n bidType,\n enabled,\n id,\n onChange,\n}: {\n bidType: LockerverseAuctionBidType;\n enabled: boolean;\n id: string;\n onChange: (value: LockerverseAuctionBidType) => void;\n}) {\n if (!enabled) {\n return null;\n }\n return (\n <>\n <fieldset className=\"lockerverse-auctions__bid-types\">\n <legend>Bid type</legend>\n {([\"fixed\", \"maximum\"] as const).map((type) => (\n <label key={type}>\n <input\n checked={bidType === type}\n name={`${id}-bid-type`}\n onChange={() => onChange(type)}\n type=\"radio\"\n value={type}\n />\n <span>{type === \"fixed\" ? \"Fixed bid\" : \"Maximum bid\"}</span>\n </label>\n ))}\n </fieldset>\n <p aria-live=\"polite\">\n {bidType === \"maximum\"\n ? \"We bid for you up to your private limit, using only what is needed to lead. Once accepted, your maximum cannot be changed or canceled. A new bid is separate and can compete with your earlier bids.\"\n : \"Place this amount as your bid. We will not increase it automatically.\"}\n </p>\n </>\n );\n}\n","import { type ComponentType, useEffect, useState } from \"react\";\nimport type { AuctionPaymentProps } from \"./auction-payment-view.tsx\";\n\n/** Keep checkout dependencies out of the server-rendered item and catalog. */\nexport function AuctionPaymentLoader(props: AuctionPaymentProps) {\n const [PaymentView, setPaymentView] =\n useState<ComponentType<AuctionPaymentProps> | null>(null);\n const [failed, setFailed] = useState(false);\n const locked = Boolean(props.resumePurchase || props.interactionLocked);\n\n useEffect(() => {\n let active = true;\n import(\"./auction-payment-view.tsx\").then(\n ({ AuctionPayment }) => {\n if (active) {\n setPaymentView(() => AuctionPayment);\n }\n },\n () => {\n if (active) {\n setFailed(true);\n }\n }\n );\n return () => {\n active = false;\n };\n }, []);\n\n if (PaymentView) {\n return <PaymentView {...props} />;\n }\n return (\n <div>\n <p role={failed ? \"alert\" : \"status\"}>\n {failed\n ? \"Payment details could not load.\"\n : \"Loading secure payment details…\"}\n </p>\n {failed && locked && (\n <p>\n Your purchase status is not confirmed. Keep this page open and contact\n the auction organizer before you try another purchase.\n </p>\n )}\n {locked ? null : (\n <button onClick={props.onBack} type=\"button\">\n Back to item\n </button>\n )}\n {failed && !locked && (\n <button onClick={() => window.location.reload()} type=\"button\">\n Reload page to try again\n </button>\n )}\n </div>\n );\n}\n","import type {\n LockerverseAuctionItem as AuctionItem,\n LockerverseAuction,\n} from \"@lockerverse/sdk/auctions\";\nimport {\n ArrowRight,\n ChevronLeft,\n Gavel,\n ShieldCheck,\n TimerReset,\n} from \"lucide-react\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { AuctionBackAction } from \"./auction-back-action.tsx\";\nimport {\n formatAuctionBoundary,\n getAuctionDisplayStatus,\n} from \"./auction-display.ts\";\nimport { AuctionImageMediaBase } from \"./auction-image.tsx\";\nimport { AuctionItemDetails } from \"./auction-item-details.tsx\";\nimport { AuctionItemSelection } from \"./auction-item-selection.tsx\";\nimport type { LockerverseAuctionItemProps } from \"./auction-item-types.ts\";\nimport type { AuctionSelection } from \"./auction-payment.ts\";\nimport { AuctionPaymentLoader } from \"./auction-payment-loader.tsx\";\nimport {\n type LockerverseAuctionOutcome,\n LockerverseAuctionResult,\n type LockerverseAuctionResultAction,\n} from \"./auction-result.tsx\";\nimport { notifyHostCallback } from \"./host-callback.ts\";\nimport { useAuctionBoundary } from \"./use-auction-boundary.ts\";\n\nfunction AuctionProgress({ buyNow }: { buyNow: boolean }) {\n return (\n <div className=\"lockerverse-auctions__progress\">\n <span>\n {buyNow ? (\n <ShieldCheck aria-hidden=\"true\" size={16} />\n ) : (\n <Gavel aria-hidden=\"true\" size={16} />\n )}\n {buyNow ? \"Choose quantity\" : \"Place bid\"}\n </span>\n <span>\n <ShieldCheck aria-hidden=\"true\" size={16} />\n {buyNow ? \"Pay securely\" : \"Secure card\"}\n </span>\n <span>\n <TimerReset aria-hidden=\"true\" size={16} />\n {buyNow ? \"Get confirmation\" : \"Wait for close\"}\n </span>\n </div>\n );\n}\n\nfunction AuctionItemResult(\n props: LockerverseAuctionItemProps & {\n item: AuctionItem;\n outcome: LockerverseAuctionOutcome;\n }\n) {\n const { auction, item, outcome } = props;\n let auctionAction: LockerverseAuctionResultAction | undefined;\n if (props.backHref) {\n auctionAction = { href: props.backHref, label: \"View auction items\" };\n } else if (props.onBack) {\n auctionAction = { label: \"View auction items\", onClick: props.onBack };\n }\n return (\n <LockerverseAuctionResult\n auctionName={auction.name}\n className={props.className}\n closesAtLabel={formatAuctionBoundary(auction, \"active\", item)}\n communityName={props.communityName ?? auction.community?.name}\n focusHeading\n imageUrl={\n item.image ?? item.images[0] ?? auction.configuration.image ?? undefined\n }\n itemName={item.name}\n outcome={outcome}\n primaryAction={\n props.returnToItemHref\n ? { href: props.returnToItemHref, label: \"Return to item\" }\n : auctionAction\n }\n secondaryAction={props.returnToItemHref ? auctionAction : undefined}\n style={{\n \"--lockerverse-accent\": auction.community?.color ?? \"#6f8f6d\",\n ...props.style,\n }}\n theme={props.theme}\n />\n );\n}\n\nfunction AuctionItemView(props: LockerverseAuctionItemProps) {\n const {\n auction: initialAuction,\n itemId,\n resumePurchase,\n className,\n theme = \"dark\",\n style,\n } = props;\n const appearanceRoot = useRef<HTMLElement | null>(null);\n const [auction, setAuction] = useState(initialAuction);\n const acceptedHost = useRef(initialAuction);\n const item =\n auction.items.find((candidate) => candidate.id === itemId) ??\n resumePurchase?.item;\n useAuctionBoundary(\n item?.startAt ?? auction.startAt,\n item?.endAt ?? auction.endAt\n );\n const [selection, setSelection] = useState<AuctionSelection | null>(() =>\n resumePurchase\n ? {\n amount: 0,\n includeServiceFee:\n resumePurchase.submission.includeServiceFee ?? false,\n quantity: resumePurchase.submission.quantity,\n }\n : null\n );\n const [interactionLocked, setInteractionLocked] = useState(\n Boolean(resumePurchase)\n );\n const viewMounted = useRef<boolean>(true);\n const hostCallbacks = useRef(props);\n hostCallbacks.current = props;\n const reportedLock = useRef<boolean | null>(null);\n const updateInteractionLock = useCallback((locked: boolean) => {\n // biome-ignore lint/suspicious/noUnnecessaryConditions: Effect cleanup changes this ref outside the callback.\n if (viewMounted.current) {\n setInteractionLocked(locked);\n }\n if (reportedLock.current !== locked) {\n reportedLock.current = locked;\n notifyHostCallback(hostCallbacks.current.onInteractionLockChange, locked);\n }\n }, []);\n const hasRecovery = Boolean(resumePurchase);\n useEffect(() => {\n viewMounted.current = true;\n updateInteractionLock(hasRecovery);\n return () => {\n viewMounted.current = false;\n };\n }, [hasRecovery, updateInteractionLock]);\n const [contact, setContact] = useState({ email: \"\", phone: \"\" });\n const [paying, setPaying] = useState(Boolean(resumePurchase));\n const [notice, setNotice] = useState<string | null>(null);\n const [outcome, setOutcome] = useState<LockerverseAuctionOutcome | null>(\n null\n );\n\n useEffect(() => {\n if (\n !(paying || interactionLocked || resumePurchase) &&\n acceptedHost.current !== initialAuction\n ) {\n acceptedHost.current = initialAuction;\n setAuction(initialAuction);\n }\n }, [initialAuction, paying, interactionLocked, resumePurchase]);\n\n function review(current: LockerverseAuction, message: string) {\n updateInteractionLock(false);\n // The checkout just fetched this snapshot. Do not restore an older host\n // snapshot that arrived while payment was open; accept its next refresh.\n acceptedHost.current = hostCallbacks.current.auction;\n setAuction(current);\n setSelection(null);\n setPaying(false);\n setNotice(message);\n }\n function continueToPayment(next: AuctionSelection) {\n setNotice(null);\n setSelection(next);\n setPaying(true);\n }\n if (!item) {\n return (\n <div>\n <p role=\"alert\">This auction item is no longer available.</p>\n <AuctionBackAction href={props.backHref} onBack={props.onBack}>\n Back to auction items\n </AuctionBackAction>\n </div>\n );\n }\n if (outcome) {\n return (\n <AuctionItemResult\n {...props}\n auction={auction}\n item={item}\n outcome={outcome}\n />\n );\n }\n return (\n <section\n className={[\"lockerverse-auctions\", className].filter(Boolean).join(\" \")}\n data-lockerverse-theme={theme}\n ref={appearanceRoot}\n style={{\n \"--lockerverse-accent\": auction.community?.color ?? \"#6f8f6d\",\n ...style,\n }}\n >\n {interactionLocked ? null : (\n <AuctionBackAction\n className=\"lockerverse-auctions__back\"\n href={props.backHref}\n onBack={props.onBack}\n >\n <ChevronLeft aria-hidden=\"true\" size={16} /> All items\n </AuctionBackAction>\n )}\n <div className=\"lockerverse-auctions__detail\">\n <AuctionItemDetails\n auction={auction}\n galleryImageSizes={props.galleryImageSizes}\n item={item}\n itemHeadingLevel={props.itemHeadingLevel}\n />\n <div className=\"lockerverse-auctions__transaction\">\n {getAuctionDisplayStatus(auction, item) === \"active\" ? (\n <AuctionProgress buyNow={item.saleMode === \"buy_now\"} />\n ) : null}\n {notice ? (\n <p className=\"lockerverse-auctions__notice\" role=\"alert\">\n {notice}\n </p>\n ) : null}\n {paying && selection ? (\n <AuctionPaymentLoader\n {...props}\n appearanceRoot={appearanceRoot}\n auction={auction}\n communityName={props.communityName ?? auction.community?.name}\n contact={contact}\n interactionLocked={interactionLocked}\n item={item}\n onBack={() => setPaying(false)}\n onContactChange={setContact}\n onIncludeServiceFeeChange={(includeServiceFee) =>\n setSelection((current) =>\n current\n ? {\n ...current,\n includeServiceFee:\n auction.serviceFeeEnabled && includeServiceFee,\n }\n : current\n )\n }\n onInteractionLockChange={updateInteractionLock}\n onResult={setOutcome}\n onReview={review}\n selection={selection}\n />\n ) : (\n <AuctionItemSelection\n auction={auction}\n backHref={props.backHref}\n initialSelection={selection}\n item={item}\n itemHeadingLevel={props.itemHeadingLevel}\n onBack={props.onBack}\n onContinue={continueToPayment}\n onError={setNotice}\n />\n )}\n {interactionLocked ? null : (\n <AuctionBackAction\n className=\"lockerverse-auctions__footer-back\"\n href={props.backHref}\n onBack={props.onBack}\n >\n Back to auction items <ArrowRight aria-hidden=\"true\" size={16} />\n </AuctionBackAction>\n )}\n </div>\n </div>\n </section>\n );\n}\n\nexport function LockerverseAuctionItem(props: LockerverseAuctionItemProps) {\n const identity = useRef({\n auctionId: props.auction.id,\n client: props.client,\n itemId: props.itemId,\n });\n if (\n identity.current.client !== props.client ||\n identity.current.auctionId !== props.auction.id ||\n identity.current.itemId !== props.itemId\n ) {\n throw new TypeError(\n \"Auction item identity cannot change. Remount with a new React key.\"\n );\n }\n if (\n props.resumePurchase &&\n (props.resumePurchase.auctionId !== props.auction.id ||\n props.resumePurchase.itemId !== props.itemId ||\n props.resumePurchase.item.id !== props.itemId ||\n props.resumePurchase.item.auctionId !== props.auction.id)\n ) {\n throw new TypeError(\n \"The purchase recovery record belongs to a different auction item.\"\n );\n }\n // Keep the view mounted when a refreshed host snapshot removes the item.\n // Its transaction snapshot remains authoritative until it is safe to leave.\n return (\n <AuctionImageMediaBase.Provider value={props.auction.mediaBaseUrl}>\n <AuctionItemView {...props} />\n </AuctionImageMediaBase.Provider>\n );\n}\n"],"mappings":"0yBAIA,MAAM,EAAc,IAIpB,SAAgB,EAAmB,EAAkB,EAAwB,CAC3E,IAAM,EAAY,EAAO,CAAW,EAC9B,EAAc,EAAuB,IAAI,EACzC,CAAC,EAAY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CAAA,CAEpC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e}from"./use-auction-boundary.js";import{a as t,i as n,n as r,o as i,r as a,s as o,t as s}from"./auction-payment.js";import{t as c}from"./host-callback.js";import{d as l,n as u,p as d,r as f,t as p,u as m}from"./phone-field.js";import{i as h,n as g,t as _}from"./stripe-loader.js";import{ArrowRight as v,ChevronLeft as y}from"lucide-react";import{useEffect as b,useId as x,useRef as S,useState as C}from"react";import{Fragment as w,jsx as T,jsxs as E}from"react/jsx-runtime";import{LockerverseSdkError as D}from"@lockerverse/sdk/auctions";import{AddressElement as O,Elements as k,PaymentElement as A,useElements as ee,useStripe as te}from"@stripe/react-stripe-js";function j(e){return{business:{name:`Lockerverse`},fields:{billingDetails:{address:`never`,email:`never`,name:`never`,phone:`never`}},terms:{applePay:e?`auto`:`never`,auBecsDebit:`never`,bancontact:`never`,card:`always`,cashapp:`never`,googlePay:`never`,ideal:`never`,paypal:e?`auto`:`never`,sepaDebit:`never`,sofort:`never`,usBankAccount:`never`},wallets:{applePay:e?`auto`:`never`,googlePay:`never`}}}function ne(t){let{isPurchase:n,item:r,pricing:i,id:a}=t;return E(`form`,{className:`lockerverse-auctions__checkout`,noValidate:!0,onSubmit:t.onSubmit,children:[E(`div`,{className:`lockerverse-auctions__checkout-header`,children:[E(`div`,{className:`lockerverse-auctions__checkout-navigation`,children:[T(`button`,{"aria-label":`Back`,className:`lockerverse-auctions__checkout-back`,disabled:!t.onBack,onClick:t.onBack,type:`button`,children:T(y,{"aria-hidden":`true`,size:20})}),E(`div`,{children:[T(`p`,{className:`lockerverse-auctions__checkout-eyebrow`,children:`Step 2 of 2`}),T(`p`,{children:n?`Secure checkout`:`Secure payment method`})]})]}),T(`p`,{className:`lockerverse-auctions__checkout-eyebrow`,children:t.communityName}),T(`h2`,{children:n?`Finalize your purchase.`:`Finalize your bid authorization.`}),T(`p`,{className:`lockerverse-auctions__checkout-summary`,children:n?E(w,{children:[`Pay `,T(`strong`,{children:e(i.totalCents)}),` for`,` `,t.quantity,` `,t.quantity===1?`item`:`items`,` of`,` `,T(`strong`,{children:r.name}),`. Your card is charged immediately once checkout succeeds.`]}):E(w,{children:[`Authorize a payment method for your bid of`,` `,T(`strong`,{children:e(i.subtotalCents)}),` on`,` `,T(`strong`,{children:r.name}),`. Your card is only charged if this bid wins the item.`]})}),r.collectShippingAddress&&E(`div`,{className:`lockerverse-auctions__checkout-physical`,children:[T(`p`,{className:`lockerverse-auctions__checkout-eyebrow`,children:`Physical item`}),T(`p`,{children:`This item requires a delivery address. Billing details are used by default, and you can switch to a separate delivery address below if needed.`})]})]}),E(`div`,{className:`lockerverse-auctions__checkout-body`,children:[t.showFields&&E(`fieldset`,{disabled:t.locked,children:[E(`div`,{className:`lockerverse-auctions__checkout-contact`,children:[T(l,{error:t.contactErrors.email,id:`${a}-email`,label:`Email`,name:`email`,onChange:e=>t.onEmailChange(e.target.value),required:!0,value:t.email}),T(d,{error:t.contactErrors.phone,id:`${a}-phone`,label:`Phone`,children:T(p,{country:t.phoneCountry,error:t.contactErrors.phone,errorId:`${a}-phone-error`,id:`${a}-phone`,name:`phone`,onChange:t.onPhoneChange,required:!0,value:t.phone})})]}),E(`section`,{"aria-label":`Payment Information`,className:`lockerverse-auctions__checkout-section`,children:[E(`div`,{className:`lockerverse-auctions__checkout-section-heading`,children:[T(`h3`,{children:`Payment Information`}),T(`p`,{children:n?`Processed securely and charged immediately for this purchase.`:`Stored securely and charged only if your bid finishes on top.`})]}),T(A,{onLoadError:t.onPaymentLoadError,options:j(n)})]}),E(`section`,{"aria-label":`Billing Details`,className:`lockerverse-auctions__checkout-section`,children:[T(`h3`,{children:`Billing Details`}),T(O,{onChange:t.onBillingChange,options:{mode:`billing`}}),T(`p`,{children:n?`Use your full name here. We use the email and phone above for purchase confirmation and fulfillment updates.`:`Use the bidder's full name here. We use the email and phone above to contact you if this bid is outbid or wins.`})]}),r.collectShippingAddress&&E(`section`,{"aria-label":`Delivery Details`,className:`lockerverse-auctions__checkout-section`,children:[E(`label`,{className:`lockerverse-auctions__checkout-checkbox lockerverse-auctions__checkout-delivery`,htmlFor:`${a}-delivery-same-as-billing`,children:[T(m,{checked:t.sameAsBilling,id:`${a}-delivery-same-as-billing`,onChange:e=>t.onSameAsBillingChange(e.target.checked)}),E(`span`,{children:[T(`strong`,{children:`Delivery address is the same as billing`}),T(`span`,{children:`Leave this on for the fastest flow. Turn it off only if the delivery address should differ from the billing details above.`})]})]}),!t.sameAsBilling&&E(w,{children:[T(`h3`,{children:`Delivery Address`}),T(O,{onChange:t.onShippingChange,options:{mode:`shipping`}})]})]}),T(N,{isPurchase:n,pricing:i}),t.serviceFeeEnabled&&T(M,{...t})]}),t.message&&T(`p`,{"aria-live":`polite`,className:`lockerverse-auctions__notice`,role:`status`,children:t.message}),!t.isTerminal&&E(`div`,{className:`lockerverse-auctions__checkout-footer`,children:[E(`p`,{children:[n?`By continuing, you agree to be charged for this purchase.`:`By continuing, you agree to have this payment method stored for item settlement if your bid is the winning offer.`,r.collectShippingAddress?` Your delivery details are stored with the ${n?`order`:`bid`} so the seller can fulfill the item after payment.`:``]}),E(`button`,{className:`lockerverse-auctions__button lockerverse-auctions__checkout-submit`,disabled:t.submitDisabled,type:`submit`,children:[t.buttonText,T(v,{"aria-hidden":`true`,size:16})]})]})]})]})}function M(t){let{isPurchase:n,pricing:r}=t;return T(`section`,{"aria-label":`Processing fees`,className:`lockerverse-auctions__checkout-section`,children:t.onIncludeServiceFeeChange?E(`label`,{className:`lockerverse-auctions__checkout-checkbox`,htmlFor:`${t.id}-service-fee`,children:[T(m,{checked:t.includeServiceFee,id:`${t.id}-service-fee`,onChange:e=>t.onIncludeServiceFeeChange?.(e.target.checked)}),E(`span`,{children:[E(`strong`,{children:[n?`Add`:`If I win, add`,` `,e(t.serviceFeeCents),` to help cover processing fees`]}),E(`span`,{children:[n?`Total`:`Total if I win`,`:`,` `,e(r.totalCents)]})]})]}):E(`p`,{children:[n?`Total`:`Total if I win`,`:`,` `,e(r.totalCents)]})})}function N({pricing:t,isPurchase:n}){return t.additionalCharge?E(`section`,{"aria-label":`Order amounts`,className:`lockerverse-auctions__checkout-section`,children:[E(`p`,{children:[n?`Subtotal`:`Bid amount`,`:`,` `,e(t.subtotalCents)]}),E(`p`,{children:[t.additionalCharge.name,`:`,` `,e(t.additionalChargeCents??0)]}),E(`p`,{children:[n?`Total`:`Total if I win`,`:`,` `,e(t.totalCents)]})]}):null}function re(e,t,n){return e===`busy`?n?`Processing...`:`Authorizing...`:e===`retry`?`Retry original purchase`:t?`Check purchase status`:n?`Buy Now`:`Authorize Bid`}function P(e){let{auction:l,item:d,selection:p,client:m,onReview:g,onBack:_}=e,v=te(),y=ee(),w=x(),[E,O]=C(e.contact?.email??``),[k,A]=C(e.contact?.phone??``),[j,M]=C(()=>f(e.contact?.phone??``)),[N,P]=C({}),[F,ie]=C(!0),[I,ae]=C(null),[oe,se]=C(null),[L,ce]=C(e.resumePurchase??null),[R,le]=C(e.resumePurchase?`pending`:`ready`),[ue,de]=C(null),z=S(e.resumePurchase?.submission.clientRequestId??null),B=R===`complete`||R===`uncertain`,V=S(!1),H=S(!0),U=S(e);U.current=e;let W=S(!1);function G(e){H.current&&le(e),c(U.current.onInteractionLockChange,e!==`ready`&&e!==`complete`)}function K(e){H.current&&de(e)}function q(e){G(e===`bid`?`uncertain`:`pending`),K(e===`bid`?`We could not confirm your bid. Do not submit another bid until you check your email or contact the auction organizer.`:`We could not confirm the purchase result. Check its status using the same purchase request.`),W.current||(W.current=!0,c(U.current.onUncertain,e))}b(()=>(H.current=!0,()=>{H.current=!1}),[]);let J=!!(L??e.resumePurchase)||d.saleMode===`buy_now`,Y=L?.pricing??e.resumePurchase?.pricing??t(l,d,p),fe=L?.payment??e.resumePurchase?.payment??l.payment;function X(e){H.current&&ce(e),c(U.current.onPurchaseRecoveryChange,e)}function Z(e){e.status===`paid`?(z.current=null,X(null),G(`complete`),c(U.current.onResult,{additionalCharge:e.additionalCharge??null,additionalChargeCents:e.additionalChargeCents??0,kind:`purchase`,purchaseId:e.purchaseId,quantity:e.quantity,serviceFeeCents:e.serviceFeeCents,status:`paid`,subtotalCents:e.subtotalCents,totalCents:e.totalCents,unitAmountCents:e.subtotalCents/e.quantity}),W.current||(W.current=!0,c(U.current.onPurchaseComplete,e))):e.status===`pending_payment`?(G(`pending`),K(`Your purchase is pending. Check its status before making another payment.`)):(z.current=null,X(null),G(`ready`),K(`This purchase is ${e.status.replaceAll(`_`,` `)}. You can start a new purchase.`))}function pe(){let e=u(k,j),t=h({email:E,phone:e},!0);return P(t.errors),t.value?{email:t.value.email,phone:e}:(document.getElementById(`${w}-${t.errors.email?`email`:`phone`}`)?.focus(),null)}function me(){let e=U.current.selection;if(p.quantity!==e.quantity||p.amount!==e.amount||p.includeServiceFee!==e.includeServiceFee)throw Error(`Your selection changed. Review the total before continuing.`)}async function he(e){if(!(J&&d.additionalCharge))return!0;let t=await m.getPurchaseQuote(l.slug,d.id,{includeServiceFee:p.includeServiceFee,quantity:p.quantity});return H.current?t.subtotalCents!==Y.subtotalCents||(t.additionalChargeCents??0)!==(Y.additionalChargeCents??0)||t.serviceFeeCents!==Y.serviceFeeCents||t.totalCents!==Y.totalCents||!o(t.additionalCharge,Y.additionalCharge)?(g(e,`The checkout details changed. Review them before continuing.`),!1):!0:!1}async function ge(e){if(!e)throw Error(`Check the contact fields below.`);if(!(v&&y&&l.payment))throw Error(`Payment details are still loading.`);let t=await m.load(l.slug);if(!H.current)return null;let r=t.items.find(e=>e.id===d.id);if(!r)return g(t,`This item is no longer available.`),null;let o=n(t,r,p);if(o||i(l,t,d,r,p))return g(t,o??`The checkout details changed. Review them before continuing.`),null;if(!await he(t))return null;let c=await a({billing:I,collectShippingAddress:d.collectShippingAddress,elements:y,email:e.email,phone:e.phone,shipping:F?I:oe,stripe:v});return H.current?(me(),{confirmationToken:c,email:e.email,includeServiceFee:p.includeServiceFee,phone:e.phone,...s(Y)}):null}async function _e(e){let t=await m.createBid(l.slug,d.id,{...e,amount:p.amount});if(t.requiresAction){if(!(H.current&&v)){q(`bid`);return}await r(v,t)}G(`complete`),c(U.current.onResult,{additionalCharge:t.additionalCharge??null,additionalChargeCents:t.additionalChargeCents??0,amountCents:t.subtotalCents,kind:`bid`,serviceFeeCents:t.serviceFeeCents,totalCents:t.totalCents}),W.current||(W.current=!0,c(U.current.onBidSubmitted,t))}async function Q(e,t){if(e.requiresAction){if(!(H.current&&v)){q(`purchase`);return}await r(v,e);let n=await m.getPurchaseStatus(l.slug,d.id,t.submission.clientRequestId);n?Z(n):(G(`pending`),K(`Payment status is not available yet. Check again shortly.`));return}Z(e),!H.current&&e.status===`pending_payment`&&q(`purchase`)}async function ve(e){let t=await m.getPurchaseStatus(l.slug,d.id,e.submission.clientRequestId);if(t)await Q(t,e);else{if(!H.current){q(`purchase`);return}G(`retry`),K(`No purchase is recorded yet. You can retry the original purchase with the same request ID.`)}}async function ye(e,t){let n=await m.getPurchaseStatus(l.slug,d.id,t.submission.clientRequestId);if(n){await Q(n,t);return}X(null),G(`ready`),K(`The purchase was rejected. Review the item and payment details before trying again. (${e.status??`validation`})`)}async function be(e,t,n,r){let i=t&&(!(e instanceof D)||e.recoveryRecommended);if(K(e instanceof Error?e.message:`Unable to complete this request.`),J&&n){if(!r&&e instanceof D&&!e.recoveryRecommended)try{await ye(e,n);return}catch{}q(`purchase`)}else i?q(`bid`):G(`ready`)}function xe(){return z.current??=globalThis.crypto.randomUUID(),z.current}function Se(){return H.current?!0:(L||(X(null),G(`ready`)),!1)}async function Ce(e,t){if(t){await ve(e);return}Se()&&await Q(await m.createPurchase(l.slug,d.id,e.submission),e)}let $=v&&y&&fe;function we(){if(V.current||B)return null;if(!$)return K(`Payment details are still loading.`),null;let e=L?null:pe();return L||e?{checkoutPayment:$,contact:e,retryOriginal:R===`retry`}:null}async function Te(e){e.preventDefault();let t=we();if(!t)return;let{contact:n,checkoutPayment:r,retryOriginal:i}=t;V.current=!0,W.current=!1,G(`busy`),K(null);let a=!1,o=L;try{if(!o){let e=await ge(n);if(!(e&&H.current)){G(`ready`);return}if(!J){a=!0,await _e(e);return}o=Object.freeze({auctionId:l.id,item:d,itemId:d.id,payment:Object.freeze({...r}),pricing:Y,submission:Object.freeze({...e,clientRequestId:xe(),paymentMethodTypes:Object.freeze([`card`]),quantity:p.quantity})}),X(o)}a=!0,await Ce(o,!!L&&!i)}catch(e){await be(e,a,o,L!==null&&!i)}finally{V.current=!1}}let Ee=re(R,L!==null,J),De=R!==`ready`;return T(ne,{buttonText:Ee,communityName:e.communityName??l.name,contactErrors:N,email:E,id:w,includeServiceFee:p.includeServiceFee,isPurchase:J,isTerminal:B,item:d,locked:De,message:ue,onBack:R===`ready`?_:void 0,onBillingChange:ae,onEmailChange:t=>{O(t),e.onContactChange?.({email:t,phone:u(k,j)})},onIncludeServiceFeeChange:e.onIncludeServiceFeeChange,onPaymentLoadError:()=>K(`Unable to load payment form.`),onPhoneChange:({value:t,country:n})=>{A(t),M(n),e.onContactChange?.({email:E,phone:u(t,n)})},onSameAsBillingChange:ie,onShippingChange:se,onSubmit:Te,phone:k,phoneCountry:j,pricing:Y,quantity:p.quantity,sameAsBilling:F,serviceFeeCents:L?Y.serviceFeeCents:t(l,d,{...p,includeServiceFee:l.serviceFeeEnabled}).serviceFeeCents,serviceFeeEnabled:l.serviceFeeEnabled,showFields:!(L||B),submitDisabled:R===`busy`||!v||!y})}function F(e){let{auction:n,item:r,selection:i,theme:a=`dark`,stripeLoader:o=_,style:s,onBack:c,resumePurchase:l}=e,[u,d]=C(null),[f,p]=C(!1),[m,h]=C(0),v=g(e.appearanceRoot,a,s,e.interactionLocked),y=l?.payment??n.payment;if(b(()=>{let e=!0;if(!y){p(!0);return}return Promise.resolve().then(()=>o(y.publishableKey,y.connectedAccountId?{stripeAccount:y.connectedAccountId}:void 0)).then(t=>{e&&(d(t),p(!t))},()=>{e&&p(!0)}),()=>{e=!1}},[y,o,m]),f)return E(`div`,{children:[T(`p`,{role:`alert`,children:`Payment details could not load.`}),l?null:T(`button`,{onClick:c,type:`button`,children:`Back to item`}),T(`button`,{onClick:()=>{p(!1),d(null),h(e=>e+1)},type:`button`,children:`Try again`})]});if(!(u&&v))return E(`div`,{children:[T(`p`,{role:`status`,children:`Loading secure payment details…`}),l?null:T(`button`,{onClick:c,type:`button`,children:`Back to item`})]});let x={mode:`setup`};l?x={amount:l.pricing.totalCents,currency:`usd`,mode:`payment`}:r.saleMode===`buy_now`&&(x={amount:t(n,r,i).totalCents,currency:`usd`,mode:`payment`});let S={...x,appearance:v,currency:`usd`,paymentMethodTypes:[`card`],setupFutureUsage:`off_session`,syncAddressCheckbox:`none`};return T(k,{options:S,stripe:u,children:T(P,{...e})})}export{F as AuctionPayment};
|
|
1
|
+
import{i as e}from"./use-auction-boundary.js";import{a as t,i as n,n as r,o as i,r as a,s as o,t as s}from"./auction-payment.js";import{t as c}from"./host-callback.js";import{d as l,n as u,p as d,r as f,t as p,u as m}from"./phone-field.js";import{i as h,n as g,t as _}from"./stripe-loader.js";import{ArrowRight as v,ChevronLeft as y}from"lucide-react";import{useEffect as b,useId as x,useRef as S,useState as C}from"react";import{Fragment as w,jsx as T,jsxs as E}from"react/jsx-runtime";import{LockerverseSdkError as D}from"@lockerverse/sdk/auctions";import{AddressElement as O,Elements as k,PaymentElement as A,useElements as ee,useStripe as te}from"@stripe/react-stripe-js";function j(e){return{business:{name:`Lockerverse`},fields:{billingDetails:{address:`never`,email:`never`,name:`never`,phone:`never`}},terms:{applePay:e?`auto`:`never`,auBecsDebit:`never`,bancontact:`never`,card:`always`,cashapp:`never`,googlePay:`never`,ideal:`never`,paypal:e?`auto`:`never`,sepaDebit:`never`,sofort:`never`,usBankAccount:`never`},wallets:{applePay:e?`auto`:`never`,googlePay:`never`}}}function ne(e){let{isPurchase:t,isMaximumBid:n,item:r,id:i}=e;return E(`form`,{className:`lockerverse-auctions__checkout`,noValidate:!0,onSubmit:e.onSubmit,children:[E(`div`,{className:`lockerverse-auctions__checkout-header`,children:[E(`div`,{className:`lockerverse-auctions__checkout-navigation`,children:[T(`button`,{"aria-label":`Back`,className:`lockerverse-auctions__checkout-back`,disabled:!e.onBack,onClick:e.onBack,type:`button`,children:T(y,{"aria-hidden":`true`,size:20})}),E(`div`,{children:[T(`p`,{className:`lockerverse-auctions__checkout-eyebrow`,children:`Step 2 of 2`}),T(`p`,{children:t?`Secure checkout`:`Secure payment method`})]})]}),T(`p`,{className:`lockerverse-auctions__checkout-eyebrow`,children:e.communityName}),T(`h2`,{children:t?`Finalize your purchase.`:`Finalize your bid authorization.`}),T(P,{...e}),r.collectShippingAddress&&E(`div`,{className:`lockerverse-auctions__checkout-physical`,children:[T(`p`,{className:`lockerverse-auctions__checkout-eyebrow`,children:`Physical item`}),T(`p`,{children:`This item requires a delivery address. Billing details are used by default, and you can switch to a separate delivery address below if needed.`})]})]}),E(`div`,{className:`lockerverse-auctions__checkout-body`,children:[e.showFields&&E(`fieldset`,{disabled:e.locked,children:[E(`div`,{className:`lockerverse-auctions__checkout-contact`,children:[T(l,{error:e.contactErrors.email,id:`${i}-email`,label:`Email`,name:`email`,onChange:t=>e.onEmailChange(t.target.value),required:!0,value:e.email}),T(d,{error:e.contactErrors.phone,id:`${i}-phone`,label:`Phone`,children:T(p,{country:e.phoneCountry,error:e.contactErrors.phone,errorId:`${i}-phone-error`,id:`${i}-phone`,name:`phone`,onChange:e.onPhoneChange,required:!0,value:e.phone})})]}),E(`section`,{"aria-label":`Payment Information`,className:`lockerverse-auctions__checkout-section`,children:[E(`div`,{className:`lockerverse-auctions__checkout-section-heading`,children:[T(`h3`,{children:`Payment Information`}),T(`p`,{children:t?`Processed securely and charged immediately for this purchase.`:`Stored securely and charged only if your bid finishes on top.`})]}),T(A,{onLoadError:e.onPaymentLoadError,options:j(t)})]}),E(`section`,{"aria-label":`Billing Details`,className:`lockerverse-auctions__checkout-section`,children:[T(`h3`,{children:`Billing Details`}),T(O,{onChange:e.onBillingChange,options:{mode:`billing`}}),T(`p`,{children:t?`Use your full name here. We use the email and phone above for purchase confirmation and fulfillment updates.`:`Use the bidder's full name here. We use the email and phone above to contact you if this bid is outbid or wins.`})]}),r.collectShippingAddress&&E(`section`,{"aria-label":`Delivery Details`,className:`lockerverse-auctions__checkout-section`,children:[E(`label`,{className:`lockerverse-auctions__checkout-checkbox lockerverse-auctions__checkout-delivery`,htmlFor:`${i}-delivery-same-as-billing`,children:[T(m,{checked:e.sameAsBilling,id:`${i}-delivery-same-as-billing`,onChange:t=>e.onSameAsBillingChange(t.target.checked)}),E(`span`,{children:[T(`strong`,{children:`Delivery address is the same as billing`}),T(`span`,{children:`Leave this on for the fastest flow. Turn it off only if the delivery address should differ from the billing details above.`})]})]}),!e.sameAsBilling&&E(w,{children:[T(`h3`,{children:`Delivery Address`}),T(O,{onChange:e.onShippingChange,options:{mode:`shipping`}})]})]}),T(N,{isMaximumBid:n,isPurchase:t,pricing:e.pricing}),e.serviceFeeEnabled&&T(M,{...e})]}),e.message&&T(`p`,{"aria-live":`polite`,className:`lockerverse-auctions__notice`,role:`status`,children:e.message}),!e.isTerminal&&E(`div`,{className:`lockerverse-auctions__checkout-footer`,children:[E(`p`,{children:[t?`By continuing, you agree to be charged for this purchase.`:`By continuing, you agree to have this payment method stored for item settlement if your bid is the winning offer.`,r.collectShippingAddress?` Your delivery details are stored with the ${t?`order`:`bid`} so the seller can fulfill the item after payment.`:``]}),E(`button`,{className:`lockerverse-auctions__button lockerverse-auctions__checkout-submit`,disabled:e.submitDisabled,type:`submit`,children:[e.buttonText,T(v,{"aria-hidden":`true`,size:16})]})]})]})]})}function M(t){let{isPurchase:n,isMaximumBid:r,pricing:i}=t,a=F(n,r);return T(`section`,{"aria-label":`Processing fees`,className:`lockerverse-auctions__checkout-section`,children:t.onIncludeServiceFeeChange?E(`label`,{className:`lockerverse-auctions__checkout-checkbox`,htmlFor:`${t.id}-service-fee`,children:[T(m,{checked:t.includeServiceFee,id:`${t.id}-service-fee`,onChange:e=>t.onIncludeServiceFeeChange?.(e.target.checked)}),E(`span`,{children:[E(`strong`,{children:[a.fee,` `,e(t.serviceFeeCents),` to help cover processing fees`]}),E(`span`,{children:[a.total,`: `,e(i.totalCents)]})]})]}):E(`p`,{children:[a.total,`: `,e(i.totalCents)]})})}function N({pricing:t,isPurchase:n,isMaximumBid:r}){let i=F(n,r);return t.additionalCharge?E(`section`,{"aria-label":`Order amounts`,className:`lockerverse-auctions__checkout-section`,children:[E(`p`,{children:[i.amount,`: `,e(t.subtotalCents)]}),E(`p`,{children:[t.additionalCharge.name,`:`,` `,e(t.additionalChargeCents??0)]}),E(`p`,{children:[i.total,`: `,e(t.totalCents)]})]}):null}function P(t){let{isPurchase:n,isMaximumBid:r,item:i,pricing:a}=t;return T(`p`,{className:`lockerverse-auctions__checkout-summary`,children:n?E(w,{children:[`Pay `,T(`strong`,{children:e(a.totalCents)}),` for`,` `,t.quantity,` `,t.quantity===1?`item`:`items`,` of`,` `,T(`strong`,{children:i.name}),`. Your card is charged immediately once checkout succeeds.`]}):E(w,{children:[`Authorize a payment method for your`,` `,r?`maximum bid`:`bid`,` of`,` `,T(`strong`,{children:e(a.subtotalCents)}),` on`,` `,T(`strong`,{children:i.name}),`. Your card is only charged if this bid wins the item.`,r?` You pay the final winning price, up to your maximum, plus any agreed fees and additional charges. Your maximum stays private.`:``]})})}function F(e,t){return e?{amount:`Subtotal`,fee:`Add`,total:`Total`}:t?{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`}}function re(e,t,n){return e===`busy`?n?`Processing...`:`Authorizing...`:e===`retry`?`Retry original purchase`:t?`Check purchase status`:n?`Buy Now`:`Authorize Bid`}function I(e){let{auction:l,item:d,selection:p,client:m,onReview:g,onBack:_}=e,v=te(),y=ee(),w=x(),[E,O]=C(e.contact?.email??``),[k,A]=C(e.contact?.phone??``),[j,M]=C(()=>f(e.contact?.phone??``)),[N,P]=C({}),[F,I]=C(!0),[L,ie]=C(null),[ae,oe]=C(null),[R,se]=C(e.resumePurchase??null),[z,ce]=C(e.resumePurchase?`pending`:`ready`),[le,ue]=C(null),B=S(e.resumePurchase?.submission.clientRequestId??null),V=z===`complete`||z===`uncertain`,H=S(!1),U=S(!0),W=S(e);W.current=e;let G=S(!1);function K(e){U.current&&ce(e),c(W.current.onInteractionLockChange,e!==`ready`&&e!==`complete`)}function q(e){U.current&&ue(e)}function J(e){K(e===`bid`?`uncertain`:`pending`),q(e===`bid`?`We could not confirm your bid. Do not submit another bid until you check your email or contact the auction organizer.`:`We could not confirm the purchase result. Check its status using the same purchase request.`),G.current||(G.current=!0,c(W.current.onUncertain,e))}b(()=>(U.current=!0,()=>{U.current=!1}),[]);let Y=!!(R??e.resumePurchase)||d.saleMode===`buy_now`,X=R?.pricing??e.resumePurchase?.pricing??t(l,d,p),de=R?.payment??e.resumePurchase?.payment??l.payment;function Z(e){U.current&&se(e),c(W.current.onPurchaseRecoveryChange,e)}function fe(e){e.status===`paid`?(B.current=null,Z(null),K(`complete`),c(W.current.onResult,{additionalCharge:e.additionalCharge??null,additionalChargeCents:e.additionalChargeCents??0,kind:`purchase`,purchaseId:e.purchaseId,quantity:e.quantity,serviceFeeCents:e.serviceFeeCents,status:`paid`,subtotalCents:e.subtotalCents,totalCents:e.totalCents,unitAmountCents:e.subtotalCents/e.quantity}),G.current||(G.current=!0,c(W.current.onPurchaseComplete,e))):e.status===`pending_payment`?(K(`pending`),q(`Your purchase is pending. Check its status before making another payment.`)):(B.current=null,Z(null),K(`ready`),q(`This purchase is ${e.status.replaceAll(`_`,` `)}. You can start a new purchase.`))}function pe(){let e=u(k,j),t=h({email:E,phone:e},!0);return P(t.errors),t.value?{email:t.value.email,phone:e}:(document.getElementById(`${w}-${t.errors.email?`email`:`phone`}`)?.focus(),null)}function me(){let e=W.current.selection;if(p.quantity!==e.quantity||p.amount!==e.amount||p.bidType!==e.bidType||p.includeServiceFee!==e.includeServiceFee)throw Error(`Your selection changed. Review the total before continuing.`)}async function he(e){if(!(Y&&d.additionalCharge))return!0;let t=await m.getPurchaseQuote(l.slug,d.id,{includeServiceFee:p.includeServiceFee,quantity:p.quantity});return U.current?t.subtotalCents!==X.subtotalCents||(t.additionalChargeCents??0)!==(X.additionalChargeCents??0)||t.serviceFeeCents!==X.serviceFeeCents||t.totalCents!==X.totalCents||!o(t.additionalCharge,X.additionalCharge)?(g(e,`The checkout details changed. Review them before continuing.`),!1):!0:!1}async function ge(e){if(!e)throw Error(`Check the contact fields below.`);if(!(v&&y&&l.payment))throw Error(`Payment details are still loading.`);let t=await m.load(l.slug);if(!U.current)return null;let r=t.items.find(e=>e.id===d.id);if(!r)return g(t,`This item is no longer available.`),null;let o=n(t,r,p);if(o||i(l,t,d,r,p))return g(t,o??`The checkout details changed. Review them before continuing.`),null;if(!await he(t))return null;let c=await a({billing:L,collectShippingAddress:d.collectShippingAddress,elements:y,email:e.email,phone:e.phone,shipping:F?L:ae,stripe:v});return U.current?(me(),{confirmationToken:c,email:e.email,includeServiceFee:p.includeServiceFee,phone:e.phone,...s(X)}):null}async function _e(e){let t={...e,amount:p.amount};p.bidType===`maximum`&&(t.bidType=`maximum`);let n=await m.createBid(l.slug,d.id,t);if(n.requiresAction){if(!(U.current&&v)){J(`bid`);return}await r(v,n)}K(`complete`),c(W.current.onResult,{additionalCharge:n.additionalCharge??null,additionalChargeCents:n.additionalChargeCents??0,amountCents:n.subtotalCents,bidType:p.bidType??`fixed`,kind:`bid`,serviceFeeCents:n.serviceFeeCents,totalCents:n.totalCents}),G.current||(G.current=!0,c(W.current.onBidSubmitted,n))}async function Q(e,t){if(e.requiresAction){if(!(U.current&&v)){J(`purchase`);return}await r(v,e);let n=await m.getPurchaseStatus(l.slug,d.id,t.submission.clientRequestId);n?fe(n):(K(`pending`),q(`Payment status is not available yet. Check again shortly.`));return}fe(e),!U.current&&e.status===`pending_payment`&&J(`purchase`)}async function ve(e){let t=await m.getPurchaseStatus(l.slug,d.id,e.submission.clientRequestId);if(t)await Q(t,e);else{if(!U.current){J(`purchase`);return}K(`retry`),q(`No purchase is recorded yet. You can retry the original purchase with the same request ID.`)}}async function ye(e,t){let n=await m.getPurchaseStatus(l.slug,d.id,t.submission.clientRequestId);if(n){await Q(n,t);return}Z(null),K(`ready`),q(`The purchase was rejected. Review the item and payment details before trying again. (${e.status??`validation`})`)}async function be(e,t,n,r){let i=t&&(!(e instanceof D)||e.recoveryRecommended);if(q(e instanceof Error?e.message:`Unable to complete this request.`),Y&&n){if(!r&&e instanceof D&&!e.recoveryRecommended)try{await ye(e,n);return}catch{}J(`purchase`)}else i?J(`bid`):K(`ready`)}function xe(){return B.current??=globalThis.crypto.randomUUID(),B.current}function Se(){return U.current?!0:(R||(Z(null),K(`ready`)),!1)}async function Ce(e,t){if(t){await ve(e);return}Se()&&await Q(await m.createPurchase(l.slug,d.id,e.submission),e)}let $=v&&y&&de;function we(){if(H.current||V)return null;if(!$)return q(`Payment details are still loading.`),null;let e=R?null:pe();return R||e?{checkoutPayment:$,contact:e,retryOriginal:z===`retry`}:null}async function Te(e){e.preventDefault();let t=we();if(!t)return;let{contact:n,checkoutPayment:r,retryOriginal:i}=t;H.current=!0,G.current=!1,K(`busy`),q(null);let a=!1,o=R;try{if(!o){let e=await ge(n);if(!(e&&U.current)){K(`ready`);return}if(!Y){a=!0,await _e(e);return}o=Object.freeze({auctionId:l.id,item:d,itemId:d.id,payment:Object.freeze({...r}),pricing:X,submission:Object.freeze({...e,clientRequestId:xe(),paymentMethodTypes:Object.freeze([`card`]),quantity:p.quantity})}),Z(o)}a=!0,await Ce(o,!!R&&!i)}catch(e){await be(e,a,o,R!==null&&!i)}finally{H.current=!1}}let Ee=re(z,R!==null,Y),De=z!==`ready`;return T(ne,{buttonText:Ee,communityName:e.communityName??l.name,contactErrors:N,email:E,id:w,includeServiceFee:p.includeServiceFee,isMaximumBid:!Y&&p.bidType===`maximum`,isPurchase:Y,isTerminal:V,item:d,locked:De,message:le,onBack:z===`ready`?_:void 0,onBillingChange:ie,onEmailChange:t=>{O(t),e.onContactChange?.({email:t,phone:u(k,j)})},onIncludeServiceFeeChange:e.onIncludeServiceFeeChange,onPaymentLoadError:()=>q(`Unable to load payment form.`),onPhoneChange:({value:t,country:n})=>{A(t),M(n),e.onContactChange?.({email:E,phone:u(t,n)})},onSameAsBillingChange:I,onShippingChange:oe,onSubmit:Te,phone:k,phoneCountry:j,pricing:X,quantity:p.quantity,sameAsBilling:F,serviceFeeCents:R?X.serviceFeeCents:t(l,d,{...p,includeServiceFee:l.serviceFeeEnabled}).serviceFeeCents,serviceFeeEnabled:l.serviceFeeEnabled,showFields:!(R||V),submitDisabled:z===`busy`||!v||!y})}function L(e){let{auction:n,item:r,selection:i,theme:a=`dark`,stripeLoader:o=_,style:s,onBack:c,resumePurchase:l}=e,[u,d]=C(null),[f,p]=C(!1),[m,h]=C(0),v=g(e.appearanceRoot,a,s,e.interactionLocked),y=l?.payment??n.payment;if(b(()=>{let e=!0;if(!y){p(!0);return}return Promise.resolve().then(()=>o(y.publishableKey,y.connectedAccountId?{stripeAccount:y.connectedAccountId}:void 0)).then(t=>{e&&(d(t),p(!t))},()=>{e&&p(!0)}),()=>{e=!1}},[y,o,m]),f)return E(`div`,{children:[T(`p`,{role:`alert`,children:`Payment details could not load.`}),l?null:T(`button`,{onClick:c,type:`button`,children:`Back to item`}),T(`button`,{onClick:()=>{p(!1),d(null),h(e=>e+1)},type:`button`,children:`Try again`})]});if(!(u&&v))return E(`div`,{children:[T(`p`,{role:`status`,children:`Loading secure payment details…`}),l?null:T(`button`,{onClick:c,type:`button`,children:`Back to item`})]});let x={mode:`setup`};l?x={amount:l.pricing.totalCents,currency:`usd`,mode:`payment`}:r.saleMode===`buy_now`&&(x={amount:t(n,r,i).totalCents,currency:`usd`,mode:`payment`});let S={...x,appearance:v,currency:`usd`,paymentMethodTypes:[`card`],setupFutureUsage:`off_session`,syncAddressCheckbox:`none`};return T(k,{options:S,stripe:u,children:T(I,{...e})})}export{L as AuctionPayment};
|
|
2
2
|
//# sourceMappingURL=auction-payment-view.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auction-payment-view.js","names":["formatMoney"],"sources":["../src/auction-checkout-view.tsx","../src/auction-checkout.tsx","../src/auction-payment-view.tsx"],"sourcesContent":["import type {\n LockerverseAuctionItem,\n LockerverseAuctionPricing,\n} from \"@lockerverse/sdk/auctions\";\nimport { AddressElement, PaymentElement } from \"@stripe/react-stripe-js\";\nimport type {\n StripeAddressElementChangeEvent,\n StripePaymentElementOptions,\n} from \"@stripe/stripe-js\";\nimport { ArrowRight, ChevronLeft } from \"lucide-react\";\nimport type { FormEventHandler } from \"react\";\nimport { formatAuctionMoney as formatMoney } from \"./auction-display.ts\";\nimport { Checkbox, EmailField, FormField } from \"./form-field.tsx\";\nimport type { PhoneInputValue } from \"./phone-field.tsx\";\nimport { PhoneInput } from \"./phone-field.tsx\";\n\ntype AuctionCheckoutViewProps = {\n buttonText: string;\n communityName: string;\n email: string;\n contactErrors: { email?: string; phone?: string };\n phoneCountry: string;\n id: string;\n includeServiceFee: boolean;\n isPurchase: boolean;\n isTerminal: boolean;\n item: LockerverseAuctionItem;\n locked: boolean;\n message: string | null;\n onBack?: (() => void) | undefined;\n onBillingChange: (event: StripeAddressElementChangeEvent) => void;\n onEmailChange: (value: string) => void;\n onIncludeServiceFeeChange?: ((value: boolean) => void) | undefined;\n onPaymentLoadError: () => void;\n onPhoneChange: (value: PhoneInputValue) => void;\n onSameAsBillingChange: (value: boolean) => void;\n onShippingChange: (event: StripeAddressElementChangeEvent) => void;\n onSubmit: FormEventHandler<HTMLFormElement>;\n phone: string;\n pricing: LockerverseAuctionPricing;\n quantity: number;\n sameAsBilling: boolean;\n serviceFeeCents: number;\n serviceFeeEnabled: boolean;\n showFields: boolean;\n submitDisabled: boolean;\n};\n\nfunction getPaymentOptions(isPurchase: boolean): StripePaymentElementOptions {\n return {\n business: { name: \"Lockerverse\" },\n fields: {\n billingDetails: {\n address: \"never\",\n email: \"never\",\n name: \"never\",\n phone: \"never\",\n },\n },\n terms: {\n applePay: isPurchase ? \"auto\" : \"never\",\n auBecsDebit: \"never\",\n bancontact: \"never\",\n card: \"always\",\n cashapp: \"never\",\n googlePay: \"never\",\n ideal: \"never\",\n paypal: isPurchase ? \"auto\" : \"never\",\n sepaDebit: \"never\",\n sofort: \"never\",\n usBankAccount: \"never\",\n },\n wallets: { applePay: isPurchase ? \"auto\" : \"never\", googlePay: \"never\" },\n };\n}\n\nexport function AuctionCheckoutView(props: AuctionCheckoutViewProps) {\n const { isPurchase, item, pricing, id } = props;\n return (\n <form\n className=\"lockerverse-auctions__checkout\"\n noValidate\n onSubmit={props.onSubmit}\n >\n <div className=\"lockerverse-auctions__checkout-header\">\n <div className=\"lockerverse-auctions__checkout-navigation\">\n <button\n aria-label=\"Back\"\n className=\"lockerverse-auctions__checkout-back\"\n disabled={!props.onBack}\n onClick={props.onBack}\n type=\"button\"\n >\n <ChevronLeft aria-hidden=\"true\" size={20} />\n </button>\n <div>\n <p className=\"lockerverse-auctions__checkout-eyebrow\">\n Step 2 of 2\n </p>\n <p>{isPurchase ? \"Secure checkout\" : \"Secure payment method\"}</p>\n </div>\n </div>\n <p className=\"lockerverse-auctions__checkout-eyebrow\">\n {props.communityName}\n </p>\n <h2>\n {isPurchase\n ? \"Finalize your purchase.\"\n : \"Finalize your bid authorization.\"}\n </h2>\n <p className=\"lockerverse-auctions__checkout-summary\">\n {isPurchase ? (\n <>\n Pay <strong>{formatMoney(pricing.totalCents)}</strong> for{\" \"}\n {props.quantity} {props.quantity === 1 ? \"item\" : \"items\"} of{\" \"}\n <strong>{item.name}</strong>. Your card is charged immediately\n once checkout succeeds.\n </>\n ) : (\n <>\n Authorize a payment method for your bid of{\" \"}\n <strong>{formatMoney(pricing.subtotalCents)}</strong> on{\" \"}\n <strong>{item.name}</strong>. Your card is only charged if this\n bid wins the item.\n </>\n )}\n </p>\n {item.collectShippingAddress && (\n <div className=\"lockerverse-auctions__checkout-physical\">\n <p className=\"lockerverse-auctions__checkout-eyebrow\">\n Physical item\n </p>\n <p>\n This item requires a delivery address. Billing details are used by\n default, and you can switch to a separate delivery address below\n if needed.\n </p>\n </div>\n )}\n </div>\n <div className=\"lockerverse-auctions__checkout-body\">\n {props.showFields && (\n <fieldset disabled={props.locked}>\n <div className=\"lockerverse-auctions__checkout-contact\">\n <EmailField\n error={props.contactErrors.email}\n id={`${id}-email`}\n label=\"Email\"\n name=\"email\"\n onChange={(event) => props.onEmailChange(event.target.value)}\n required\n value={props.email}\n />\n <FormField\n error={props.contactErrors.phone}\n id={`${id}-phone`}\n label=\"Phone\"\n >\n <PhoneInput\n country={props.phoneCountry}\n error={props.contactErrors.phone}\n errorId={`${id}-phone-error`}\n id={`${id}-phone`}\n name=\"phone\"\n onChange={props.onPhoneChange}\n required\n value={props.phone}\n />\n </FormField>\n </div>\n <section\n aria-label=\"Payment Information\"\n className=\"lockerverse-auctions__checkout-section\"\n >\n <div className=\"lockerverse-auctions__checkout-section-heading\">\n <h3>Payment Information</h3>\n <p>\n {isPurchase\n ? \"Processed securely and charged immediately for this purchase.\"\n : \"Stored securely and charged only if your bid finishes on top.\"}\n </p>\n </div>\n <PaymentElement\n onLoadError={props.onPaymentLoadError}\n options={getPaymentOptions(isPurchase)}\n />\n </section>\n <section\n aria-label=\"Billing Details\"\n className=\"lockerverse-auctions__checkout-section\"\n >\n <h3>Billing Details</h3>\n <AddressElement\n onChange={props.onBillingChange}\n options={{ mode: \"billing\" }}\n />\n <p>\n {isPurchase\n ? \"Use your full name here. We use the email and phone above for purchase confirmation and fulfillment updates.\"\n : \"Use the bidder's full name here. We use the email and phone above to contact you if this bid is outbid or wins.\"}\n </p>\n </section>\n {item.collectShippingAddress && (\n <section\n aria-label=\"Delivery Details\"\n className=\"lockerverse-auctions__checkout-section\"\n >\n <label\n className=\"lockerverse-auctions__checkout-checkbox lockerverse-auctions__checkout-delivery\"\n htmlFor={`${id}-delivery-same-as-billing`}\n >\n <Checkbox\n checked={props.sameAsBilling}\n id={`${id}-delivery-same-as-billing`}\n onChange={(event) =>\n props.onSameAsBillingChange(event.target.checked)\n }\n />\n <span>\n <strong>Delivery address is the same as billing</strong>\n <span>\n Leave this on for the fastest flow. Turn it off only if\n the delivery address should differ from the billing\n details above.\n </span>\n </span>\n </label>\n {!props.sameAsBilling && (\n <>\n <h3>Delivery Address</h3>\n <AddressElement\n onChange={props.onShippingChange}\n options={{ mode: \"shipping\" }}\n />\n </>\n )}\n </section>\n )}\n <CheckoutAdditionalCharge\n isPurchase={isPurchase}\n pricing={pricing}\n />\n {props.serviceFeeEnabled && <CheckoutServiceFee {...props} />}\n </fieldset>\n )}\n {props.message && (\n <p\n aria-live=\"polite\"\n className=\"lockerverse-auctions__notice\"\n role=\"status\"\n >\n {props.message}\n </p>\n )}\n {!props.isTerminal && (\n <div className=\"lockerverse-auctions__checkout-footer\">\n <p>\n {isPurchase\n ? \"By continuing, you agree to be charged for this purchase.\"\n : \"By continuing, you agree to have this payment method stored for item settlement if your bid is the winning offer.\"}\n {item.collectShippingAddress\n ? ` Your delivery details are stored with the ${isPurchase ? \"order\" : \"bid\"} so the seller can fulfill the item after payment.`\n : \"\"}\n </p>\n <button\n className=\"lockerverse-auctions__button lockerverse-auctions__checkout-submit\"\n disabled={props.submitDisabled}\n type=\"submit\"\n >\n {props.buttonText}\n <ArrowRight aria-hidden=\"true\" size={16} />\n </button>\n </div>\n )}\n </div>\n </form>\n );\n}\n\nfunction CheckoutServiceFee(props: AuctionCheckoutViewProps) {\n const { isPurchase, pricing } = props;\n return (\n <section\n aria-label=\"Processing fees\"\n className=\"lockerverse-auctions__checkout-section\"\n >\n {props.onIncludeServiceFeeChange ? (\n <label\n className=\"lockerverse-auctions__checkout-checkbox\"\n htmlFor={`${props.id}-service-fee`}\n >\n <Checkbox\n checked={props.includeServiceFee}\n id={`${props.id}-service-fee`}\n onChange={(event) =>\n props.onIncludeServiceFeeChange?.(event.target.checked)\n }\n />\n <span>\n <strong>\n {isPurchase ? \"Add\" : \"If I win, add\"}{\" \"}\n {formatMoney(props.serviceFeeCents)} to help cover processing fees\n </strong>\n <span>\n {isPurchase ? \"Total\" : \"Total if I win\"}:{\" \"}\n {formatMoney(pricing.totalCents)}\n </span>\n </span>\n </label>\n ) : (\n <p>\n {isPurchase ? \"Total\" : \"Total if I win\"}:{\" \"}\n {formatMoney(pricing.totalCents)}\n </p>\n )}\n </section>\n );\n}\n\nfunction CheckoutAdditionalCharge({\n pricing,\n isPurchase,\n}: {\n pricing: LockerverseAuctionPricing;\n isPurchase: boolean;\n}) {\n if (!pricing.additionalCharge) {\n return null;\n }\n return (\n <section\n aria-label=\"Order amounts\"\n className=\"lockerverse-auctions__checkout-section\"\n >\n <p>\n {isPurchase ? \"Subtotal\" : \"Bid amount\"}:{\" \"}\n {formatMoney(pricing.subtotalCents)}\n </p>\n <p>\n {pricing.additionalCharge.name}:{\" \"}\n {formatMoney(pricing.additionalChargeCents ?? 0)}\n </p>\n <p>\n {isPurchase ? \"Total\" : \"Total if I win\"}:{\" \"}\n {formatMoney(pricing.totalCents)}\n </p>\n </section>\n );\n}\n","// biome-ignore-all lint/suspicious/noUnnecessaryConditions: React refs change in effect cleanup and event handlers outside this static control flow.\nimport {\n type LockerverseAuction,\n type LockerverseAuctionItem,\n type LockerverseAuctionPurchaseResult,\n LockerverseSdkError,\n} from \"@lockerverse/sdk/auctions\";\nimport { useElements, useStripe } from \"@stripe/react-stripe-js\";\nimport type { StripeAddressElementChangeEvent } from \"@stripe/stripe-js\";\nimport { type FormEvent, useEffect, useId, useRef, useState } from \"react\";\nimport { AuctionCheckoutView } from \"./auction-checkout-view.tsx\";\nimport type {\n LockerverseAuctionItemProps,\n LockerverseAuctionPurchaseRecovery,\n} from \"./auction-item-types.ts\";\nimport {\n type AuctionSelection,\n auctionExpectedPricing,\n completeAuctionAction,\n createAuctionConfirmationToken,\n getAuctionSelectionError,\n getAuctionSelectionPricing,\n hasAuctionCheckoutChanged,\n sameAuctionAdditionalCharge,\n} from \"./auction-payment.ts\";\nimport type { LockerverseAuctionOutcome } from \"./auction-result.tsx\";\nimport { notifyHostCallback } from \"./host-callback.ts\";\nimport { type ContactErrors, validateContact } from \"./payment-validation.ts\";\nimport { getInternationalPhone, resolvePhoneCountry } from \"./phone.ts\";\n\ntype AuctionCheckoutProps = LockerverseAuctionItemProps & {\n item: LockerverseAuctionItem;\n selection: AuctionSelection;\n onReview: (auction: LockerverseAuction, message: string) => void;\n onBack: () => void;\n contact?: { email: string; phone: string };\n onContactChange?: (contact: { email: string; phone: string }) => void;\n onIncludeServiceFeeChange?: (value: boolean) => void;\n onInteractionLockChange?: (locked: boolean) => void;\n onResult: (outcome: LockerverseAuctionOutcome) => void;\n};\n\ntype CheckoutState =\n | \"ready\"\n | \"busy\"\n | \"pending\"\n | \"retry\"\n | \"complete\"\n | \"uncertain\";\n\nfunction getSubmitLabel(\n state: CheckoutState,\n hasRecovery: boolean,\n isPurchase: boolean\n) {\n if (state === \"busy\") {\n return isPurchase ? \"Processing...\" : \"Authorizing...\";\n }\n if (state === \"retry\") {\n return \"Retry original purchase\";\n }\n if (hasRecovery) {\n return \"Check purchase status\";\n }\n return isPurchase ? \"Buy Now\" : \"Authorize Bid\";\n}\n\nexport function AuctionCheckout(props: AuctionCheckoutProps) {\n const { auction, item, selection, client, onReview, onBack } = props;\n const stripe = useStripe();\n const elements = useElements();\n const id = useId();\n const [email, setEmail] = useState(props.contact?.email ?? \"\");\n const [phone, setPhone] = useState(props.contact?.phone ?? \"\");\n const [phoneCountry, setPhoneCountry] = useState<string>(() =>\n resolvePhoneCountry(props.contact?.phone ?? \"\")\n );\n const [contactErrors, setContactErrors] = useState<ContactErrors>({});\n const [sameAsBilling, setSameAsBilling] = useState(true);\n const [billing, setBilling] =\n useState<StripeAddressElementChangeEvent | null>(null);\n const [shipping, setShipping] =\n useState<StripeAddressElementChangeEvent | null>(null);\n const [recovery, setRecovery] = useState(props.resumePurchase ?? null);\n const [state, setState] = useState<CheckoutState>(\n props.resumePurchase ? \"pending\" : \"ready\"\n );\n const [message, setMessage] = useState<string | null>(null);\n const purchaseRequestId = useRef<string | null>(\n props.resumePurchase?.submission.clientRequestId ?? null\n );\n const isTerminal = state === \"complete\" || state === \"uncertain\";\n const busy = useRef<boolean>(false);\n const mounted = useRef<boolean>(true);\n const callbacks = useRef(props);\n callbacks.current = props;\n const outcomeReported = useRef(false);\n\n function transition(next: CheckoutState) {\n if (mounted.current) {\n setState(next);\n }\n notifyHostCallback(\n callbacks.current.onInteractionLockChange,\n next !== \"ready\" && next !== \"complete\"\n );\n }\n function showMessage(value: string | null) {\n if (mounted.current) {\n setMessage(value);\n }\n }\n function reportUncertain(kind: \"bid\" | \"purchase\") {\n transition(kind === \"bid\" ? \"uncertain\" : \"pending\");\n showMessage(\n kind === \"bid\"\n ? \"We could not confirm your bid. Do not submit another bid until you check your email or contact the auction organizer.\"\n : \"We could not confirm the purchase result. Check its status using the same purchase request.\"\n );\n if (!outcomeReported.current) {\n outcomeReported.current = true;\n notifyHostCallback(callbacks.current.onUncertain, kind);\n }\n }\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n const isPurchase =\n Boolean(recovery ?? props.resumePurchase) || item.saleMode === \"buy_now\";\n const pricing =\n recovery?.pricing ??\n props.resumePurchase?.pricing ??\n getAuctionSelectionPricing(auction, item, selection);\n\n const payment =\n recovery?.payment ?? props.resumePurchase?.payment ?? auction.payment;\n\n function rememberPurchase(value: LockerverseAuctionPurchaseRecovery | null) {\n if (mounted.current) {\n setRecovery(value);\n }\n notifyHostCallback(callbacks.current.onPurchaseRecoveryChange, value);\n }\n\n function finishPurchase(result: LockerverseAuctionPurchaseResult) {\n if (result.status === \"paid\") {\n purchaseRequestId.current = null;\n rememberPurchase(null);\n transition(\"complete\");\n notifyHostCallback(callbacks.current.onResult, {\n additionalCharge: result.additionalCharge ?? null,\n additionalChargeCents: result.additionalChargeCents ?? 0,\n kind: \"purchase\",\n purchaseId: result.purchaseId,\n quantity: result.quantity,\n serviceFeeCents: result.serviceFeeCents,\n status: \"paid\",\n subtotalCents: result.subtotalCents,\n totalCents: result.totalCents,\n unitAmountCents: result.subtotalCents / result.quantity,\n });\n if (!outcomeReported.current) {\n outcomeReported.current = true;\n notifyHostCallback(callbacks.current.onPurchaseComplete, result);\n }\n } else if (result.status === \"pending_payment\") {\n transition(\"pending\");\n showMessage(\n \"Your purchase is pending. Check its status before making another payment.\"\n );\n } else {\n purchaseRequestId.current = null;\n rememberPurchase(null);\n transition(\"ready\");\n showMessage(\n `This purchase is ${result.status.replaceAll(\"_\", \" \")}. You can start a new purchase.`\n );\n }\n }\n\n function readContact() {\n const phoneNumber = getInternationalPhone(phone, phoneCountry);\n const contact = validateContact({ email, phone: phoneNumber }, true);\n setContactErrors(contact.errors);\n if (!contact.value) {\n document\n .getElementById(`${id}-${contact.errors.email ? \"email\" : \"phone\"}`)\n ?.focus();\n return null;\n }\n return { email: contact.value.email, phone: phoneNumber };\n }\n\n function requireCurrentSelection() {\n const latest = callbacks.current.selection;\n if (\n selection.quantity !== latest.quantity ||\n selection.amount !== latest.amount ||\n selection.includeServiceFee !== latest.includeServiceFee\n ) {\n throw new Error(\n \"Your selection changed. Review the total before continuing.\"\n );\n }\n }\n\n async function verifyPurchaseQuote(current: LockerverseAuction) {\n if (!(isPurchase && item.additionalCharge)) {\n return true;\n }\n const quote = await client.getPurchaseQuote(auction.slug, item.id, {\n includeServiceFee: selection.includeServiceFee,\n quantity: selection.quantity,\n });\n if (!mounted.current) {\n return false;\n }\n if (\n quote.subtotalCents !== pricing.subtotalCents ||\n (quote.additionalChargeCents ?? 0) !==\n (pricing.additionalChargeCents ?? 0) ||\n quote.serviceFeeCents !== pricing.serviceFeeCents ||\n quote.totalCents !== pricing.totalCents ||\n !sameAuctionAdditionalCharge(\n quote.additionalCharge,\n pricing.additionalCharge\n )\n ) {\n onReview(\n current,\n \"The checkout details changed. Review them before continuing.\"\n );\n return false;\n }\n return true;\n }\n\n async function prepareSubmission(\n contact: { email: string; phone: string } | null\n ) {\n if (!contact) {\n throw new Error(\"Check the contact fields below.\");\n }\n if (!(stripe && elements && auction.payment)) {\n throw new Error(\"Payment details are still loading.\");\n }\n const current = await client.load(auction.slug);\n if (!mounted.current) {\n return null;\n }\n const currentItem = current.items.find(\n (candidate) => candidate.id === item.id\n );\n if (!currentItem) {\n onReview(current, \"This item is no longer available.\");\n return null;\n }\n const selectionError = getAuctionSelectionError(\n current,\n currentItem,\n selection\n );\n if (\n selectionError ||\n hasAuctionCheckoutChanged(auction, current, item, currentItem, selection)\n ) {\n onReview(\n current,\n selectionError ??\n \"The checkout details changed. Review them before continuing.\"\n );\n return null;\n }\n if (!(await verifyPurchaseQuote(current))) {\n return null;\n }\n const confirmationToken = await createAuctionConfirmationToken({\n billing,\n collectShippingAddress: item.collectShippingAddress,\n elements,\n email: contact.email,\n phone: contact.phone,\n shipping: sameAsBilling ? billing : shipping,\n stripe,\n });\n if (!mounted.current) {\n return null;\n }\n requireCurrentSelection();\n return {\n confirmationToken,\n email: contact.email,\n includeServiceFee: selection.includeServiceFee,\n phone: contact.phone,\n ...auctionExpectedPricing(pricing),\n };\n }\n\n async function sendBid(\n submission: NonNullable<Awaited<ReturnType<typeof prepareSubmission>>>\n ) {\n const result = await client.createBid(auction.slug, item.id, {\n ...submission,\n amount: selection.amount,\n });\n if (result.requiresAction) {\n if (!(mounted.current && stripe)) {\n reportUncertain(\"bid\");\n return;\n }\n await completeAuctionAction(stripe, result);\n }\n transition(\"complete\");\n notifyHostCallback(callbacks.current.onResult, {\n additionalCharge: result.additionalCharge ?? null,\n additionalChargeCents: result.additionalChargeCents ?? 0,\n amountCents: result.subtotalCents,\n kind: \"bid\",\n serviceFeeCents: result.serviceFeeCents,\n totalCents: result.totalCents,\n });\n if (!outcomeReported.current) {\n outcomeReported.current = true;\n notifyHostCallback(callbacks.current.onBidSubmitted, result);\n }\n }\n\n async function resolvePurchase(\n result: LockerverseAuctionPurchaseResult,\n active: LockerverseAuctionPurchaseRecovery\n ) {\n if (result.requiresAction) {\n if (!(mounted.current && stripe)) {\n reportUncertain(\"purchase\");\n return;\n }\n await completeAuctionAction(stripe, result);\n const updated = await client.getPurchaseStatus(\n auction.slug,\n item.id,\n active.submission.clientRequestId\n );\n if (updated) {\n finishPurchase(updated);\n } else {\n transition(\"pending\");\n showMessage(\n \"Payment status is not available yet. Check again shortly.\"\n );\n }\n return;\n }\n finishPurchase(result);\n if (!mounted.current && result.status === \"pending_payment\") {\n reportUncertain(\"purchase\");\n }\n }\n\n async function checkPurchase(active: LockerverseAuctionPurchaseRecovery) {\n const result = await client.getPurchaseStatus(\n auction.slug,\n item.id,\n active.submission.clientRequestId\n );\n if (result) {\n await resolvePurchase(result, active);\n } else {\n if (!mounted.current) {\n reportUncertain(\"purchase\");\n return;\n }\n transition(\"retry\");\n showMessage(\n \"No purchase is recorded yet. You can retry the original purchase with the same request ID.\"\n );\n }\n }\n\n async function clearRejectedPurchase(\n error: LockerverseSdkError,\n active: LockerverseAuctionPurchaseRecovery\n ) {\n const result = await client.getPurchaseStatus(\n auction.slug,\n item.id,\n active.submission.clientRequestId\n );\n if (result) {\n await resolvePurchase(result, active);\n return;\n }\n rememberPurchase(null);\n transition(\"ready\");\n showMessage(\n `The purchase was rejected. Review the item and payment details before trying again. (${error.status ?? \"validation\"})`\n );\n }\n\n async function handleFailure<Failure>(\n error: Failure,\n requestSent: boolean,\n active: LockerverseAuctionPurchaseRecovery | null,\n wasRecovery: boolean\n ) {\n const uncertain =\n requestSent &&\n (!(error instanceof LockerverseSdkError) || error.recoveryRecommended);\n showMessage(\n error instanceof Error\n ? error.message\n : \"Unable to complete this request.\"\n );\n if (isPurchase && active) {\n if (\n !wasRecovery &&\n error instanceof LockerverseSdkError &&\n !error.recoveryRecommended\n ) {\n try {\n await clearRejectedPurchase(error, active);\n return;\n } catch {\n /* Keep the original request when status cannot be established. */\n }\n }\n reportUncertain(\"purchase\");\n } else if (uncertain) {\n reportUncertain(\"bid\");\n } else {\n transition(\"ready\");\n }\n }\n\n function getPurchaseRequestId() {\n purchaseRequestId.current ??= globalThis.crypto.randomUUID();\n return purchaseRequestId.current;\n }\n\n function canSendPurchase() {\n if (mounted.current) {\n return true;\n }\n if (!recovery) {\n rememberPurchase(null);\n transition(\"ready\");\n }\n return false;\n }\n\n async function sendOrCheckPurchase(\n active: LockerverseAuctionPurchaseRecovery,\n statusOnly: boolean\n ) {\n if (statusOnly) {\n await checkPurchase(active);\n return;\n }\n if (!canSendPurchase()) {\n return;\n }\n const result = await client.createPurchase(\n auction.slug,\n item.id,\n active.submission\n );\n await resolvePurchase(result, active);\n }\n\n const checkoutPayment = stripe && elements && payment;\n\n function startSubmission() {\n if (busy.current || isTerminal) {\n return null;\n }\n if (!checkoutPayment) {\n showMessage(\"Payment details are still loading.\");\n return null;\n }\n const contact = recovery ? null : readContact();\n if (!(recovery || contact)) {\n return null;\n }\n return { checkoutPayment, contact, retryOriginal: state === \"retry\" };\n }\n\n async function submit(event: FormEvent<HTMLFormElement>) {\n event.preventDefault();\n const start = startSubmission();\n if (!start) {\n return;\n }\n const { contact, checkoutPayment: readyPayment, retryOriginal } = start;\n busy.current = true;\n outcomeReported.current = false;\n transition(\"busy\");\n showMessage(null);\n let requestSent = false;\n let activeRecovery = recovery;\n try {\n if (!activeRecovery) {\n const submission = await prepareSubmission(contact);\n if (!(submission && mounted.current)) {\n transition(\"ready\");\n return;\n }\n if (!isPurchase) {\n requestSent = true;\n await sendBid(submission);\n return;\n }\n activeRecovery = Object.freeze({\n auctionId: auction.id,\n item,\n itemId: item.id,\n payment: Object.freeze({ ...readyPayment }),\n pricing,\n submission: Object.freeze({\n ...submission,\n clientRequestId: getPurchaseRequestId(),\n paymentMethodTypes: Object.freeze([\"card\"] as const),\n quantity: selection.quantity,\n }),\n });\n rememberPurchase(activeRecovery);\n }\n requestSent = true;\n await sendOrCheckPurchase(\n activeRecovery,\n Boolean(recovery) && !retryOriginal\n );\n } catch (error) {\n await handleFailure(\n error,\n requestSent,\n activeRecovery,\n recovery !== null && !retryOriginal\n );\n } finally {\n busy.current = false;\n }\n }\n\n const buttonText = getSubmitLabel(state, recovery !== null, isPurchase);\n\n const locked = state !== \"ready\";\n return (\n <AuctionCheckoutView\n buttonText={buttonText}\n communityName={props.communityName ?? auction.name}\n contactErrors={contactErrors}\n email={email}\n id={id}\n includeServiceFee={selection.includeServiceFee}\n isPurchase={isPurchase}\n isTerminal={isTerminal}\n item={item}\n locked={locked}\n message={message}\n onBack={state === \"ready\" ? onBack : undefined}\n onBillingChange={setBilling}\n onEmailChange={(value) => {\n setEmail(value);\n props.onContactChange?.({\n email: value,\n phone: getInternationalPhone(phone, phoneCountry),\n });\n }}\n onIncludeServiceFeeChange={props.onIncludeServiceFeeChange}\n onPaymentLoadError={() => showMessage(\"Unable to load payment form.\")}\n onPhoneChange={({ value, country }) => {\n setPhone(value);\n setPhoneCountry(country);\n props.onContactChange?.({\n email,\n phone: getInternationalPhone(value, country),\n });\n }}\n onSameAsBillingChange={setSameAsBilling}\n onShippingChange={setShipping}\n onSubmit={submit}\n phone={phone}\n phoneCountry={phoneCountry}\n pricing={pricing}\n quantity={selection.quantity}\n sameAsBilling={sameAsBilling}\n serviceFeeCents={\n recovery\n ? pricing.serviceFeeCents\n : getAuctionSelectionPricing(auction, item, {\n ...selection,\n includeServiceFee: auction.serviceFeeEnabled,\n }).serviceFeeCents\n }\n serviceFeeEnabled={auction.serviceFeeEnabled}\n showFields={!(recovery || isTerminal)}\n submitDisabled={state === \"busy\" || !stripe || !elements}\n />\n );\n}\n","import type {\n LockerverseAuctionItem as AuctionItem,\n LockerverseAuction,\n} from \"@lockerverse/sdk/auctions\";\nimport { Elements } from \"@stripe/react-stripe-js\";\nimport type {\n StripeElementsOptions,\n StripeElementsOptionsMode,\n} from \"@stripe/stripe-js\";\nimport { type RefObject, useEffect, useState } from \"react\";\nimport { AuctionCheckout } from \"./auction-checkout.tsx\";\nimport type { LockerverseAuctionItemProps } from \"./auction-item-types.ts\";\nimport {\n type AuctionSelection,\n getAuctionSelectionPricing,\n} from \"./auction-payment.ts\";\nimport type { LockerverseAuctionOutcome } from \"./auction-result.tsx\";\nimport { useStripeAppearance } from \"./stripe-appearance.ts\";\nimport { defaultLockerverseStripeLoader } from \"./stripe-loader.ts\";\n\nexport type AuctionPaymentProps = LockerverseAuctionItemProps & {\n appearanceRoot: RefObject<HTMLElement | null>;\n interactionLocked: boolean;\n item: AuctionItem;\n selection: AuctionSelection;\n onReview: (auction: LockerverseAuction, message: string) => void;\n onBack: () => void;\n contact: { email: string; phone: string };\n onContactChange: (contact: { email: string; phone: string }) => void;\n onIncludeServiceFeeChange: (value: boolean) => void;\n onInteractionLockChange: (locked: boolean) => void;\n onResult: (outcome: LockerverseAuctionOutcome) => void;\n};\n\nexport function AuctionPayment(props: AuctionPaymentProps) {\n const {\n auction,\n item,\n selection,\n theme = \"dark\",\n stripeLoader = defaultLockerverseStripeLoader,\n style,\n onBack,\n resumePurchase,\n } = props;\n const [stripe, setStripe] =\n useState<Awaited<ReturnType<typeof defaultLockerverseStripeLoader>>>(null);\n const [failed, setFailed] = useState(false);\n const [revision, setRevision] = useState(0);\n const appearance = useStripeAppearance(\n props.appearanceRoot,\n theme,\n style,\n props.interactionLocked\n );\n const payment = resumePurchase?.payment ?? auction.payment;\n useEffect(() => {\n let active = true;\n if (!payment) {\n setFailed(true);\n return;\n }\n Promise.resolve()\n .then(() =>\n stripeLoader(\n payment.publishableKey,\n payment.connectedAccountId\n ? { stripeAccount: payment.connectedAccountId }\n : undefined\n )\n )\n .then(\n (loaded) => {\n if (active) {\n setStripe(loaded);\n setFailed(!loaded);\n }\n },\n () => {\n if (active) {\n setFailed(true);\n }\n }\n );\n return () => {\n active = false;\n };\n }, [payment, stripeLoader, revision]);\n if (failed) {\n return (\n <div>\n <p role=\"alert\">Payment details could not load.</p>\n {resumePurchase ? null : (\n <button onClick={onBack} type=\"button\">\n Back to item\n </button>\n )}\n <button\n onClick={() => {\n setFailed(false);\n setStripe(null);\n setRevision((value) => value + 1);\n }}\n type=\"button\"\n >\n Try again\n </button>\n </div>\n );\n }\n if (!(stripe && appearance)) {\n return (\n <div>\n <p role=\"status\">Loading secure payment details…</p>\n {resumePurchase ? null : (\n <button onClick={onBack} type=\"button\">\n Back to item\n </button>\n )}\n </div>\n );\n }\n let paymentOptions: StripeElementsOptionsMode = {\n mode: \"setup\",\n };\n if (resumePurchase) {\n paymentOptions = {\n amount: resumePurchase.pricing.totalCents,\n currency: \"usd\",\n mode: \"payment\",\n };\n } else if (item.saleMode === \"buy_now\") {\n paymentOptions = {\n amount: getAuctionSelectionPricing(auction, item, selection).totalCents,\n currency: \"usd\",\n mode: \"payment\",\n };\n }\n const options: StripeElementsOptions = {\n ...paymentOptions,\n appearance,\n currency: \"usd\",\n paymentMethodTypes: [\"card\"],\n setupFutureUsage: \"off_session\" as const,\n syncAddressCheckbox: \"none\",\n };\n return (\n <Elements options={options} stripe={stripe}>\n <AuctionCheckout {...props} />\n </Elements>\n );\n}\n"],"mappings":"oqBAgDA,SAAS,EAAkB,EAAkD,CAC3E,MAAO,CACL,SAAU,CAAE,KAAM,aAAc,EAChC,OAAQ,CACN,eAAgB,CACd,QAAS,QACT,MAAO,QACP,KAAM,QACN,MAAO,OACT,CACF,EACA,MAAO,CACL,SAAU,EAAa,OAAS,QAChC,YAAa,QACb,WAAY,QACZ,KAAM,SACN,QAAS,QACT,UAAW,QACX,MAAO,QACP,OAAQ,EAAa,OAAS,QAC9B,UAAW,QACX,OAAQ,QACR,cAAe,OACjB,EACA,QAAS,CAAE,SAAU,EAAa,OAAS,QAAS,UAAW,OAAQ,CACzE,CACF,CAEA,SAAgB,GAAoB,EAAiC,CACnE,GAAM,CAAE,aAAY,OAAM,UAAS,MAAO,EAC1C,OACE,EAAC,OAAD,CACE,UAAU,iCACV,WAAA,GACA,SAAU,EAAM,SAHlB,SAAA,CAKE,EAAC,MAAD,CAAK,UAAU,wC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AA,EAEV,EAAC,SAAD,CACE,YAAe,CACb,EAAU,EAAK,EACf,EAAU,IAAI,EACd,EAAa,GAAU,EAAQ,CAAC,CAClC,EACA,KAAK,SACN,SAAA,WAEO,CAAA,CACL,CAAA,CAAA,EAGT,GAAI,EAAE,GAAU,GACd,OACE,EAAC,MAAD,CAAA,SAAA,CACE,EAAC,IAAD,CAAG,KAAK,SAAS,SAAA,iCAAkC,CAAA,EAClD,EAAiB,KAChB,EAAC,SAAD,CAAQ,QAAS,EAAQ,KAAK,SAAS,SAAA,cAE/B,CAAA,CAEP,CAAA,CAAA,EAGT,IAAI,EAA4C,CAC9C,KAAM,OACR,EACI,EACF,EAAiB,CACf,OAAQ,EAAe,QAAQ,WAC/B,SAAU,MACV,KAAM,SACR,EACS,EAAK,WAAa,YAC3B,EAAiB,CACf,OAAQ,EAA2B,EAAS,EAAM,CAAS,CAAC,CAAC,WAC7D,SAAU,MACV,KAAM,SACR,GAEF,IAAM,EAAiC,CACrC,GAAG,EACH,aACA,SAAU,MACV,mBAAoB,CAAC,MAAM,EAC3B,iBAAkB,cAClB,oBAAqB,MACvB,EACA,OACE,EAAC,EAAD,CAAmB,UAAiB,SAClC,SAAA,EAAC,EAAD,CAAiB,GAAI,CAAQ,CAAA,CACrB,CAAA,CAEd"}
|
|
1
|
+
{"version":3,"file":"auction-payment-view.js","names":["formatMoney"],"sources":["../src/auction-checkout-view.tsx","../src/auction-checkout.tsx","../src/auction-payment-view.tsx"],"sourcesContent":["import type {\n LockerverseAuctionItem,\n LockerverseAuctionPricing,\n} from \"@lockerverse/sdk/auctions\";\nimport { AddressElement, PaymentElement } from \"@stripe/react-stripe-js\";\nimport type {\n StripeAddressElementChangeEvent,\n StripePaymentElementOptions,\n} from \"@stripe/stripe-js\";\nimport { ArrowRight, ChevronLeft } from \"lucide-react\";\nimport type { FormEventHandler } from \"react\";\nimport { formatAuctionMoney as formatMoney } from \"./auction-display.ts\";\nimport { Checkbox, EmailField, FormField } from \"./form-field.tsx\";\nimport type { PhoneInputValue } from \"./phone-field.tsx\";\nimport { PhoneInput } from \"./phone-field.tsx\";\n\ntype AuctionCheckoutViewProps = {\n buttonText: string;\n communityName: string;\n email: string;\n contactErrors: { email?: string; phone?: string };\n phoneCountry: string;\n id: string;\n includeServiceFee: boolean;\n isPurchase: boolean;\n isMaximumBid: boolean;\n isTerminal: boolean;\n item: LockerverseAuctionItem;\n locked: boolean;\n message: string | null;\n onBack?: (() => void) | undefined;\n onBillingChange: (event: StripeAddressElementChangeEvent) => void;\n onEmailChange: (value: string) => void;\n onIncludeServiceFeeChange?: ((value: boolean) => void) | undefined;\n onPaymentLoadError: () => void;\n onPhoneChange: (value: PhoneInputValue) => void;\n onSameAsBillingChange: (value: boolean) => void;\n onShippingChange: (event: StripeAddressElementChangeEvent) => void;\n onSubmit: FormEventHandler<HTMLFormElement>;\n phone: string;\n pricing: LockerverseAuctionPricing;\n quantity: number;\n sameAsBilling: boolean;\n serviceFeeCents: number;\n serviceFeeEnabled: boolean;\n showFields: boolean;\n submitDisabled: boolean;\n};\n\nfunction getPaymentOptions(isPurchase: boolean): StripePaymentElementOptions {\n return {\n business: { name: \"Lockerverse\" },\n fields: {\n billingDetails: {\n address: \"never\",\n email: \"never\",\n name: \"never\",\n phone: \"never\",\n },\n },\n terms: {\n applePay: isPurchase ? \"auto\" : \"never\",\n auBecsDebit: \"never\",\n bancontact: \"never\",\n card: \"always\",\n cashapp: \"never\",\n googlePay: \"never\",\n ideal: \"never\",\n paypal: isPurchase ? \"auto\" : \"never\",\n sepaDebit: \"never\",\n sofort: \"never\",\n usBankAccount: \"never\",\n },\n wallets: { applePay: isPurchase ? \"auto\" : \"never\", googlePay: \"never\" },\n };\n}\n\nexport function AuctionCheckoutView(props: AuctionCheckoutViewProps) {\n const { isPurchase, isMaximumBid, item, id } = props;\n return (\n <form\n className=\"lockerverse-auctions__checkout\"\n noValidate\n onSubmit={props.onSubmit}\n >\n <div className=\"lockerverse-auctions__checkout-header\">\n <div className=\"lockerverse-auctions__checkout-navigation\">\n <button\n aria-label=\"Back\"\n className=\"lockerverse-auctions__checkout-back\"\n disabled={!props.onBack}\n onClick={props.onBack}\n type=\"button\"\n >\n <ChevronLeft aria-hidden=\"true\" size={20} />\n </button>\n <div>\n <p className=\"lockerverse-auctions__checkout-eyebrow\">\n Step 2 of 2\n </p>\n <p>{isPurchase ? \"Secure checkout\" : \"Secure payment method\"}</p>\n </div>\n </div>\n <p className=\"lockerverse-auctions__checkout-eyebrow\">\n {props.communityName}\n </p>\n <h2>\n {isPurchase\n ? \"Finalize your purchase.\"\n : \"Finalize your bid authorization.\"}\n </h2>\n <CheckoutSummary {...props} />\n {item.collectShippingAddress && (\n <div className=\"lockerverse-auctions__checkout-physical\">\n <p className=\"lockerverse-auctions__checkout-eyebrow\">\n Physical item\n </p>\n <p>\n This item requires a delivery address. Billing details are used by\n default, and you can switch to a separate delivery address below\n if needed.\n </p>\n </div>\n )}\n </div>\n <div className=\"lockerverse-auctions__checkout-body\">\n {props.showFields && (\n <fieldset disabled={props.locked}>\n <div className=\"lockerverse-auctions__checkout-contact\">\n <EmailField\n error={props.contactErrors.email}\n id={`${id}-email`}\n label=\"Email\"\n name=\"email\"\n onChange={(event) => props.onEmailChange(event.target.value)}\n required\n value={props.email}\n />\n <FormField\n error={props.contactErrors.phone}\n id={`${id}-phone`}\n label=\"Phone\"\n >\n <PhoneInput\n country={props.phoneCountry}\n error={props.contactErrors.phone}\n errorId={`${id}-phone-error`}\n id={`${id}-phone`}\n name=\"phone\"\n onChange={props.onPhoneChange}\n required\n value={props.phone}\n />\n </FormField>\n </div>\n <section\n aria-label=\"Payment Information\"\n className=\"lockerverse-auctions__checkout-section\"\n >\n <div className=\"lockerverse-auctions__checkout-section-heading\">\n <h3>Payment Information</h3>\n <p>\n {isPurchase\n ? \"Processed securely and charged immediately for this purchase.\"\n : \"Stored securely and charged only if your bid finishes on top.\"}\n </p>\n </div>\n <PaymentElement\n onLoadError={props.onPaymentLoadError}\n options={getPaymentOptions(isPurchase)}\n />\n </section>\n <section\n aria-label=\"Billing Details\"\n className=\"lockerverse-auctions__checkout-section\"\n >\n <h3>Billing Details</h3>\n <AddressElement\n onChange={props.onBillingChange}\n options={{ mode: \"billing\" }}\n />\n <p>\n {isPurchase\n ? \"Use your full name here. We use the email and phone above for purchase confirmation and fulfillment updates.\"\n : \"Use the bidder's full name here. We use the email and phone above to contact you if this bid is outbid or wins.\"}\n </p>\n </section>\n {item.collectShippingAddress && (\n <section\n aria-label=\"Delivery Details\"\n className=\"lockerverse-auctions__checkout-section\"\n >\n <label\n className=\"lockerverse-auctions__checkout-checkbox lockerverse-auctions__checkout-delivery\"\n htmlFor={`${id}-delivery-same-as-billing`}\n >\n <Checkbox\n checked={props.sameAsBilling}\n id={`${id}-delivery-same-as-billing`}\n onChange={(event) =>\n props.onSameAsBillingChange(event.target.checked)\n }\n />\n <span>\n <strong>Delivery address is the same as billing</strong>\n <span>\n Leave this on for the fastest flow. Turn it off only if\n the delivery address should differ from the billing\n details above.\n </span>\n </span>\n </label>\n {!props.sameAsBilling && (\n <>\n <h3>Delivery Address</h3>\n <AddressElement\n onChange={props.onShippingChange}\n options={{ mode: \"shipping\" }}\n />\n </>\n )}\n </section>\n )}\n <CheckoutAdditionalCharge\n isMaximumBid={isMaximumBid}\n isPurchase={isPurchase}\n pricing={props.pricing}\n />\n {props.serviceFeeEnabled && <CheckoutServiceFee {...props} />}\n </fieldset>\n )}\n {props.message && (\n <p\n aria-live=\"polite\"\n className=\"lockerverse-auctions__notice\"\n role=\"status\"\n >\n {props.message}\n </p>\n )}\n {!props.isTerminal && (\n <div className=\"lockerverse-auctions__checkout-footer\">\n <p>\n {isPurchase\n ? \"By continuing, you agree to be charged for this purchase.\"\n : \"By continuing, you agree to have this payment method stored for item settlement if your bid is the winning offer.\"}\n {item.collectShippingAddress\n ? ` Your delivery details are stored with the ${isPurchase ? \"order\" : \"bid\"} so the seller can fulfill the item after payment.`\n : \"\"}\n </p>\n <button\n className=\"lockerverse-auctions__button lockerverse-auctions__checkout-submit\"\n disabled={props.submitDisabled}\n type=\"submit\"\n >\n {props.buttonText}\n <ArrowRight aria-hidden=\"true\" size={16} />\n </button>\n </div>\n )}\n </div>\n </form>\n );\n}\n\nfunction CheckoutServiceFee(props: AuctionCheckoutViewProps) {\n const { isPurchase, isMaximumBid, pricing } = props;\n const labels = checkoutAmountLabels(isPurchase, isMaximumBid);\n return (\n <section\n aria-label=\"Processing fees\"\n className=\"lockerverse-auctions__checkout-section\"\n >\n {props.onIncludeServiceFeeChange ? (\n <label\n className=\"lockerverse-auctions__checkout-checkbox\"\n htmlFor={`${props.id}-service-fee`}\n >\n <Checkbox\n checked={props.includeServiceFee}\n id={`${props.id}-service-fee`}\n onChange={(event) =>\n props.onIncludeServiceFeeChange?.(event.target.checked)\n }\n />\n <span>\n <strong>\n {labels.fee} {formatMoney(props.serviceFeeCents)} to help cover\n processing fees\n </strong>\n <span>\n {labels.total}: {formatMoney(pricing.totalCents)}\n </span>\n </span>\n </label>\n ) : (\n <p>\n {labels.total}: {formatMoney(pricing.totalCents)}\n </p>\n )}\n </section>\n );\n}\n\nfunction CheckoutAdditionalCharge({\n pricing,\n isPurchase,\n isMaximumBid,\n}: {\n pricing: LockerverseAuctionPricing;\n isPurchase: boolean;\n isMaximumBid: boolean;\n}) {\n const labels = checkoutAmountLabels(isPurchase, isMaximumBid);\n if (!pricing.additionalCharge) {\n return null;\n }\n return (\n <section\n aria-label=\"Order amounts\"\n className=\"lockerverse-auctions__checkout-section\"\n >\n <p>\n {labels.amount}: {formatMoney(pricing.subtotalCents)}\n </p>\n <p>\n {pricing.additionalCharge.name}:{\" \"}\n {formatMoney(pricing.additionalChargeCents ?? 0)}\n </p>\n <p>\n {labels.total}: {formatMoney(pricing.totalCents)}\n </p>\n </section>\n );\n}\n\nfunction CheckoutSummary(props: AuctionCheckoutViewProps) {\n const { isPurchase, isMaximumBid, item, pricing } = props;\n return (\n <p className=\"lockerverse-auctions__checkout-summary\">\n {isPurchase ? (\n <>\n Pay <strong>{formatMoney(pricing.totalCents)}</strong> for{\" \"}\n {props.quantity} {props.quantity === 1 ? \"item\" : \"items\"} of{\" \"}\n <strong>{item.name}</strong>. Your card is charged immediately once\n checkout succeeds.\n </>\n ) : (\n <>\n Authorize a payment method for your{\" \"}\n {isMaximumBid ? \"maximum bid\" : \"bid\"} of{\" \"}\n <strong>{formatMoney(pricing.subtotalCents)}</strong> on{\" \"}\n <strong>{item.name}</strong>. Your card is only charged if this bid\n wins the item.\n {isMaximumBid\n ? \" You pay the final winning price, up to your maximum, plus any agreed fees and additional charges. Your maximum stays private.\"\n : \"\"}\n </>\n )}\n </p>\n );\n}\n\nfunction checkoutAmountLabels(isPurchase: boolean, isMaximumBid: boolean) {\n if (isPurchase) {\n return { amount: \"Subtotal\", fee: \"Add\", total: \"Total\" };\n }\n if (isMaximumBid) {\n return {\n amount: \"Maximum bid\",\n fee: \"If I win, add up to\",\n total: \"Maximum total if I win\",\n };\n }\n return {\n amount: \"Bid amount\",\n fee: \"If I win, add\",\n total: \"Total if I win\",\n };\n}\n","// biome-ignore-all lint/suspicious/noUnnecessaryConditions: React refs change in effect cleanup and event handlers outside this static control flow.\nimport {\n type LockerverseAuction,\n type LockerverseAuctionItem,\n type LockerverseAuctionPurchaseResult,\n LockerverseSdkError,\n} from \"@lockerverse/sdk/auctions\";\nimport { useElements, useStripe } from \"@stripe/react-stripe-js\";\nimport type { StripeAddressElementChangeEvent } from \"@stripe/stripe-js\";\nimport { type FormEvent, useEffect, useId, useRef, useState } from \"react\";\nimport { AuctionCheckoutView } from \"./auction-checkout-view.tsx\";\nimport type {\n LockerverseAuctionItemProps,\n LockerverseAuctionPurchaseRecovery,\n} from \"./auction-item-types.ts\";\nimport {\n type AuctionSelection,\n auctionExpectedPricing,\n completeAuctionAction,\n createAuctionConfirmationToken,\n getAuctionSelectionError,\n getAuctionSelectionPricing,\n hasAuctionCheckoutChanged,\n sameAuctionAdditionalCharge,\n} from \"./auction-payment.ts\";\nimport type { LockerverseAuctionOutcome } from \"./auction-result.tsx\";\nimport { notifyHostCallback } from \"./host-callback.ts\";\nimport { type ContactErrors, validateContact } from \"./payment-validation.ts\";\nimport { getInternationalPhone, resolvePhoneCountry } from \"./phone.ts\";\n\ntype AuctionCheckoutProps = LockerverseAuctionItemProps & {\n item: LockerverseAuctionItem;\n selection: AuctionSelection;\n onReview: (auction: LockerverseAuction, message: string) => void;\n onBack: () => void;\n contact?: { email: string; phone: string };\n onContactChange?: (contact: { email: string; phone: string }) => void;\n onIncludeServiceFeeChange?: (value: boolean) => void;\n onInteractionLockChange?: (locked: boolean) => void;\n onResult: (outcome: LockerverseAuctionOutcome) => void;\n};\n\ntype CheckoutState =\n | \"ready\"\n | \"busy\"\n | \"pending\"\n | \"retry\"\n | \"complete\"\n | \"uncertain\";\n\nfunction getSubmitLabel(\n state: CheckoutState,\n hasRecovery: boolean,\n isPurchase: boolean\n) {\n if (state === \"busy\") {\n return isPurchase ? \"Processing...\" : \"Authorizing...\";\n }\n if (state === \"retry\") {\n return \"Retry original purchase\";\n }\n if (hasRecovery) {\n return \"Check purchase status\";\n }\n return isPurchase ? \"Buy Now\" : \"Authorize Bid\";\n}\n\nexport function AuctionCheckout(props: AuctionCheckoutProps) {\n const { auction, item, selection, client, onReview, onBack } = props;\n const stripe = useStripe();\n const elements = useElements();\n const id = useId();\n const [email, setEmail] = useState(props.contact?.email ?? \"\");\n const [phone, setPhone] = useState(props.contact?.phone ?? \"\");\n const [phoneCountry, setPhoneCountry] = useState<string>(() =>\n resolvePhoneCountry(props.contact?.phone ?? \"\")\n );\n const [contactErrors, setContactErrors] = useState<ContactErrors>({});\n const [sameAsBilling, setSameAsBilling] = useState(true);\n const [billing, setBilling] =\n useState<StripeAddressElementChangeEvent | null>(null);\n const [shipping, setShipping] =\n useState<StripeAddressElementChangeEvent | null>(null);\n const [recovery, setRecovery] = useState(props.resumePurchase ?? null);\n const [state, setState] = useState<CheckoutState>(\n props.resumePurchase ? \"pending\" : \"ready\"\n );\n const [message, setMessage] = useState<string | null>(null);\n const purchaseRequestId = useRef<string | null>(\n props.resumePurchase?.submission.clientRequestId ?? null\n );\n const isTerminal = state === \"complete\" || state === \"uncertain\";\n const busy = useRef<boolean>(false);\n const mounted = useRef<boolean>(true);\n const callbacks = useRef(props);\n callbacks.current = props;\n const outcomeReported = useRef(false);\n\n function transition(next: CheckoutState) {\n if (mounted.current) {\n setState(next);\n }\n notifyHostCallback(\n callbacks.current.onInteractionLockChange,\n next !== \"ready\" && next !== \"complete\"\n );\n }\n function showMessage(value: string | null) {\n if (mounted.current) {\n setMessage(value);\n }\n }\n function reportUncertain(kind: \"bid\" | \"purchase\") {\n transition(kind === \"bid\" ? \"uncertain\" : \"pending\");\n showMessage(\n kind === \"bid\"\n ? \"We could not confirm your bid. Do not submit another bid until you check your email or contact the auction organizer.\"\n : \"We could not confirm the purchase result. Check its status using the same purchase request.\"\n );\n if (!outcomeReported.current) {\n outcomeReported.current = true;\n notifyHostCallback(callbacks.current.onUncertain, kind);\n }\n }\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n const isPurchase =\n Boolean(recovery ?? props.resumePurchase) || item.saleMode === \"buy_now\";\n const pricing =\n recovery?.pricing ??\n props.resumePurchase?.pricing ??\n getAuctionSelectionPricing(auction, item, selection);\n\n const payment =\n recovery?.payment ?? props.resumePurchase?.payment ?? auction.payment;\n\n function rememberPurchase(value: LockerverseAuctionPurchaseRecovery | null) {\n if (mounted.current) {\n setRecovery(value);\n }\n notifyHostCallback(callbacks.current.onPurchaseRecoveryChange, value);\n }\n\n function finishPurchase(result: LockerverseAuctionPurchaseResult) {\n if (result.status === \"paid\") {\n purchaseRequestId.current = null;\n rememberPurchase(null);\n transition(\"complete\");\n notifyHostCallback(callbacks.current.onResult, {\n additionalCharge: result.additionalCharge ?? null,\n additionalChargeCents: result.additionalChargeCents ?? 0,\n kind: \"purchase\",\n purchaseId: result.purchaseId,\n quantity: result.quantity,\n serviceFeeCents: result.serviceFeeCents,\n status: \"paid\",\n subtotalCents: result.subtotalCents,\n totalCents: result.totalCents,\n unitAmountCents: result.subtotalCents / result.quantity,\n });\n if (!outcomeReported.current) {\n outcomeReported.current = true;\n notifyHostCallback(callbacks.current.onPurchaseComplete, result);\n }\n } else if (result.status === \"pending_payment\") {\n transition(\"pending\");\n showMessage(\n \"Your purchase is pending. Check its status before making another payment.\"\n );\n } else {\n purchaseRequestId.current = null;\n rememberPurchase(null);\n transition(\"ready\");\n showMessage(\n `This purchase is ${result.status.replaceAll(\"_\", \" \")}. You can start a new purchase.`\n );\n }\n }\n\n function readContact() {\n const phoneNumber = getInternationalPhone(phone, phoneCountry);\n const contact = validateContact({ email, phone: phoneNumber }, true);\n setContactErrors(contact.errors);\n if (!contact.value) {\n document\n .getElementById(`${id}-${contact.errors.email ? \"email\" : \"phone\"}`)\n ?.focus();\n return null;\n }\n return { email: contact.value.email, phone: phoneNumber };\n }\n\n function requireCurrentSelection() {\n const latest = callbacks.current.selection;\n if (\n selection.quantity !== latest.quantity ||\n selection.amount !== latest.amount ||\n selection.bidType !== latest.bidType ||\n selection.includeServiceFee !== latest.includeServiceFee\n ) {\n throw new Error(\n \"Your selection changed. Review the total before continuing.\"\n );\n }\n }\n\n async function verifyPurchaseQuote(current: LockerverseAuction) {\n if (!(isPurchase && item.additionalCharge)) {\n return true;\n }\n const quote = await client.getPurchaseQuote(auction.slug, item.id, {\n includeServiceFee: selection.includeServiceFee,\n quantity: selection.quantity,\n });\n if (!mounted.current) {\n return false;\n }\n if (\n quote.subtotalCents !== pricing.subtotalCents ||\n (quote.additionalChargeCents ?? 0) !==\n (pricing.additionalChargeCents ?? 0) ||\n quote.serviceFeeCents !== pricing.serviceFeeCents ||\n quote.totalCents !== pricing.totalCents ||\n !sameAuctionAdditionalCharge(\n quote.additionalCharge,\n pricing.additionalCharge\n )\n ) {\n onReview(\n current,\n \"The checkout details changed. Review them before continuing.\"\n );\n return false;\n }\n return true;\n }\n\n async function prepareSubmission(\n contact: { email: string; phone: string } | null\n ) {\n if (!contact) {\n throw new Error(\"Check the contact fields below.\");\n }\n if (!(stripe && elements && auction.payment)) {\n throw new Error(\"Payment details are still loading.\");\n }\n const current = await client.load(auction.slug);\n if (!mounted.current) {\n return null;\n }\n const currentItem = current.items.find(\n (candidate) => candidate.id === item.id\n );\n if (!currentItem) {\n onReview(current, \"This item is no longer available.\");\n return null;\n }\n const selectionError = getAuctionSelectionError(\n current,\n currentItem,\n selection\n );\n if (\n selectionError ||\n hasAuctionCheckoutChanged(auction, current, item, currentItem, selection)\n ) {\n onReview(\n current,\n selectionError ??\n \"The checkout details changed. Review them before continuing.\"\n );\n return null;\n }\n if (!(await verifyPurchaseQuote(current))) {\n return null;\n }\n const confirmationToken = await createAuctionConfirmationToken({\n billing,\n collectShippingAddress: item.collectShippingAddress,\n elements,\n email: contact.email,\n phone: contact.phone,\n shipping: sameAsBilling ? billing : shipping,\n stripe,\n });\n if (!mounted.current) {\n return null;\n }\n requireCurrentSelection();\n return {\n confirmationToken,\n email: contact.email,\n includeServiceFee: selection.includeServiceFee,\n phone: contact.phone,\n ...auctionExpectedPricing(pricing),\n };\n }\n\n async function sendBid(\n submission: NonNullable<Awaited<ReturnType<typeof prepareSubmission>>>\n ) {\n const bidSubmission: Parameters<typeof client.createBid>[2] = {\n ...submission,\n amount: selection.amount,\n };\n if (selection.bidType === \"maximum\") {\n bidSubmission.bidType = \"maximum\";\n }\n const result = await client.createBid(auction.slug, item.id, bidSubmission);\n if (result.requiresAction) {\n if (!(mounted.current && stripe)) {\n reportUncertain(\"bid\");\n return;\n }\n await completeAuctionAction(stripe, result);\n }\n transition(\"complete\");\n notifyHostCallback(callbacks.current.onResult, {\n additionalCharge: result.additionalCharge ?? null,\n additionalChargeCents: result.additionalChargeCents ?? 0,\n amountCents: result.subtotalCents,\n bidType: selection.bidType ?? \"fixed\",\n kind: \"bid\",\n serviceFeeCents: result.serviceFeeCents,\n totalCents: result.totalCents,\n });\n if (!outcomeReported.current) {\n outcomeReported.current = true;\n notifyHostCallback(callbacks.current.onBidSubmitted, result);\n }\n }\n\n async function resolvePurchase(\n result: LockerverseAuctionPurchaseResult,\n active: LockerverseAuctionPurchaseRecovery\n ) {\n if (result.requiresAction) {\n if (!(mounted.current && stripe)) {\n reportUncertain(\"purchase\");\n return;\n }\n await completeAuctionAction(stripe, result);\n const updated = await client.getPurchaseStatus(\n auction.slug,\n item.id,\n active.submission.clientRequestId\n );\n if (updated) {\n finishPurchase(updated);\n } else {\n transition(\"pending\");\n showMessage(\n \"Payment status is not available yet. Check again shortly.\"\n );\n }\n return;\n }\n finishPurchase(result);\n if (!mounted.current && result.status === \"pending_payment\") {\n reportUncertain(\"purchase\");\n }\n }\n\n async function checkPurchase(active: LockerverseAuctionPurchaseRecovery) {\n const result = await client.getPurchaseStatus(\n auction.slug,\n item.id,\n active.submission.clientRequestId\n );\n if (result) {\n await resolvePurchase(result, active);\n } else {\n if (!mounted.current) {\n reportUncertain(\"purchase\");\n return;\n }\n transition(\"retry\");\n showMessage(\n \"No purchase is recorded yet. You can retry the original purchase with the same request ID.\"\n );\n }\n }\n\n async function clearRejectedPurchase(\n error: LockerverseSdkError,\n active: LockerverseAuctionPurchaseRecovery\n ) {\n const result = await client.getPurchaseStatus(\n auction.slug,\n item.id,\n active.submission.clientRequestId\n );\n if (result) {\n await resolvePurchase(result, active);\n return;\n }\n rememberPurchase(null);\n transition(\"ready\");\n showMessage(\n `The purchase was rejected. Review the item and payment details before trying again. (${error.status ?? \"validation\"})`\n );\n }\n\n async function handleFailure<Failure>(\n error: Failure,\n requestSent: boolean,\n active: LockerverseAuctionPurchaseRecovery | null,\n wasRecovery: boolean\n ) {\n const uncertain =\n requestSent &&\n (!(error instanceof LockerverseSdkError) || error.recoveryRecommended);\n showMessage(\n error instanceof Error\n ? error.message\n : \"Unable to complete this request.\"\n );\n if (isPurchase && active) {\n if (\n !wasRecovery &&\n error instanceof LockerverseSdkError &&\n !error.recoveryRecommended\n ) {\n try {\n await clearRejectedPurchase(error, active);\n return;\n } catch {\n /* Keep the original request when status cannot be established. */\n }\n }\n reportUncertain(\"purchase\");\n } else if (uncertain) {\n reportUncertain(\"bid\");\n } else {\n transition(\"ready\");\n }\n }\n\n function getPurchaseRequestId() {\n purchaseRequestId.current ??= globalThis.crypto.randomUUID();\n return purchaseRequestId.current;\n }\n\n function canSendPurchase() {\n if (mounted.current) {\n return true;\n }\n if (!recovery) {\n rememberPurchase(null);\n transition(\"ready\");\n }\n return false;\n }\n\n async function sendOrCheckPurchase(\n active: LockerverseAuctionPurchaseRecovery,\n statusOnly: boolean\n ) {\n if (statusOnly) {\n await checkPurchase(active);\n return;\n }\n if (!canSendPurchase()) {\n return;\n }\n const result = await client.createPurchase(\n auction.slug,\n item.id,\n active.submission\n );\n await resolvePurchase(result, active);\n }\n\n const checkoutPayment = stripe && elements && payment;\n\n function startSubmission() {\n if (busy.current || isTerminal) {\n return null;\n }\n if (!checkoutPayment) {\n showMessage(\"Payment details are still loading.\");\n return null;\n }\n const contact = recovery ? null : readContact();\n if (!(recovery || contact)) {\n return null;\n }\n return { checkoutPayment, contact, retryOriginal: state === \"retry\" };\n }\n\n async function submit(event: FormEvent<HTMLFormElement>) {\n event.preventDefault();\n const start = startSubmission();\n if (!start) {\n return;\n }\n const { contact, checkoutPayment: readyPayment, retryOriginal } = start;\n busy.current = true;\n outcomeReported.current = false;\n transition(\"busy\");\n showMessage(null);\n let requestSent = false;\n let activeRecovery = recovery;\n try {\n if (!activeRecovery) {\n const submission = await prepareSubmission(contact);\n if (!(submission && mounted.current)) {\n transition(\"ready\");\n return;\n }\n if (!isPurchase) {\n requestSent = true;\n await sendBid(submission);\n return;\n }\n activeRecovery = Object.freeze({\n auctionId: auction.id,\n item,\n itemId: item.id,\n payment: Object.freeze({ ...readyPayment }),\n pricing,\n submission: Object.freeze({\n ...submission,\n clientRequestId: getPurchaseRequestId(),\n paymentMethodTypes: Object.freeze([\"card\"] as const),\n quantity: selection.quantity,\n }),\n });\n rememberPurchase(activeRecovery);\n }\n requestSent = true;\n await sendOrCheckPurchase(\n activeRecovery,\n Boolean(recovery) && !retryOriginal\n );\n } catch (error) {\n await handleFailure(\n error,\n requestSent,\n activeRecovery,\n recovery !== null && !retryOriginal\n );\n } finally {\n busy.current = false;\n }\n }\n\n const buttonText = getSubmitLabel(state, recovery !== null, isPurchase);\n\n const locked = state !== \"ready\";\n return (\n <AuctionCheckoutView\n buttonText={buttonText}\n communityName={props.communityName ?? auction.name}\n contactErrors={contactErrors}\n email={email}\n id={id}\n includeServiceFee={selection.includeServiceFee}\n isMaximumBid={!isPurchase && selection.bidType === \"maximum\"}\n isPurchase={isPurchase}\n isTerminal={isTerminal}\n item={item}\n locked={locked}\n message={message}\n onBack={state === \"ready\" ? onBack : undefined}\n onBillingChange={setBilling}\n onEmailChange={(value) => {\n setEmail(value);\n props.onContactChange?.({\n email: value,\n phone: getInternationalPhone(phone, phoneCountry),\n });\n }}\n onIncludeServiceFeeChange={props.onIncludeServiceFeeChange}\n onPaymentLoadError={() => showMessage(\"Unable to load payment form.\")}\n onPhoneChange={({ value, country }) => {\n setPhone(value);\n setPhoneCountry(country);\n props.onContactChange?.({\n email,\n phone: getInternationalPhone(value, country),\n });\n }}\n onSameAsBillingChange={setSameAsBilling}\n onShippingChange={setShipping}\n onSubmit={submit}\n phone={phone}\n phoneCountry={phoneCountry}\n pricing={pricing}\n quantity={selection.quantity}\n sameAsBilling={sameAsBilling}\n serviceFeeCents={\n recovery\n ? pricing.serviceFeeCents\n : getAuctionSelectionPricing(auction, item, {\n ...selection,\n includeServiceFee: auction.serviceFeeEnabled,\n }).serviceFeeCents\n }\n serviceFeeEnabled={auction.serviceFeeEnabled}\n showFields={!(recovery || isTerminal)}\n submitDisabled={state === \"busy\" || !stripe || !elements}\n />\n );\n}\n","import type {\n LockerverseAuctionItem as AuctionItem,\n LockerverseAuction,\n} from \"@lockerverse/sdk/auctions\";\nimport { Elements } from \"@stripe/react-stripe-js\";\nimport type {\n StripeElementsOptions,\n StripeElementsOptionsMode,\n} from \"@stripe/stripe-js\";\nimport { type RefObject, useEffect, useState } from \"react\";\nimport { AuctionCheckout } from \"./auction-checkout.tsx\";\nimport type { LockerverseAuctionItemProps } from \"./auction-item-types.ts\";\nimport {\n type AuctionSelection,\n getAuctionSelectionPricing,\n} from \"./auction-payment.ts\";\nimport type { LockerverseAuctionOutcome } from \"./auction-result.tsx\";\nimport { useStripeAppearance } from \"./stripe-appearance.ts\";\nimport { defaultLockerverseStripeLoader } from \"./stripe-loader.ts\";\n\nexport type AuctionPaymentProps = LockerverseAuctionItemProps & {\n appearanceRoot: RefObject<HTMLElement | null>;\n interactionLocked: boolean;\n item: AuctionItem;\n selection: AuctionSelection;\n onReview: (auction: LockerverseAuction, message: string) => void;\n onBack: () => void;\n contact: { email: string; phone: string };\n onContactChange: (contact: { email: string; phone: string }) => void;\n onIncludeServiceFeeChange: (value: boolean) => void;\n onInteractionLockChange: (locked: boolean) => void;\n onResult: (outcome: LockerverseAuctionOutcome) => void;\n};\n\nexport function AuctionPayment(props: AuctionPaymentProps) {\n const {\n auction,\n item,\n selection,\n theme = \"dark\",\n stripeLoader = defaultLockerverseStripeLoader,\n style,\n onBack,\n resumePurchase,\n } = props;\n const [stripe, setStripe] =\n useState<Awaited<ReturnType<typeof defaultLockerverseStripeLoader>>>(null);\n const [failed, setFailed] = useState(false);\n const [revision, setRevision] = useState(0);\n const appearance = useStripeAppearance(\n props.appearanceRoot,\n theme,\n style,\n props.interactionLocked\n );\n const payment = resumePurchase?.payment ?? auction.payment;\n useEffect(() => {\n let active = true;\n if (!payment) {\n setFailed(true);\n return;\n }\n Promise.resolve()\n .then(() =>\n stripeLoader(\n payment.publishableKey,\n payment.connectedAccountId\n ? { stripeAccount: payment.connectedAccountId }\n : undefined\n )\n )\n .then(\n (loaded) => {\n if (active) {\n setStripe(loaded);\n setFailed(!loaded);\n }\n },\n () => {\n if (active) {\n setFailed(true);\n }\n }\n );\n return () => {\n active = false;\n };\n }, [payment, stripeLoader, revision]);\n if (failed) {\n return (\n <div>\n <p role=\"alert\">Payment details could not load.</p>\n {resumePurchase ? null : (\n <button onClick={onBack} type=\"button\">\n Back to item\n </button>\n )}\n <button\n onClick={() => {\n setFailed(false);\n setStripe(null);\n setRevision((value) => value + 1);\n }}\n type=\"button\"\n >\n Try again\n </button>\n </div>\n );\n }\n if (!(stripe && appearance)) {\n return (\n <div>\n <p role=\"status\">Loading secure payment details…</p>\n {resumePurchase ? null : (\n <button onClick={onBack} type=\"button\">\n Back to item\n </button>\n )}\n </div>\n );\n }\n let paymentOptions: StripeElementsOptionsMode = {\n mode: \"setup\",\n };\n if (resumePurchase) {\n paymentOptions = {\n amount: resumePurchase.pricing.totalCents,\n currency: \"usd\",\n mode: \"payment\",\n };\n } else if (item.saleMode === \"buy_now\") {\n paymentOptions = {\n amount: getAuctionSelectionPricing(auction, item, selection).totalCents,\n currency: \"usd\",\n mode: \"payment\",\n };\n }\n const options: StripeElementsOptions = {\n ...paymentOptions,\n appearance,\n currency: \"usd\",\n paymentMethodTypes: [\"card\"],\n setupFutureUsage: \"off_session\" as const,\n syncAddressCheckbox: \"none\",\n };\n return (\n <Elements options={options} stripe={stripe}>\n <AuctionCheckout {...props} />\n </Elements>\n );\n}\n"],"mappings":"oqBAiDA,SAAS,EAAkB,EAAkD,CAC3E,MAAO,CACL,SAAU,CAAE,KAAM,aAAc,EAChC,OAAQ,CACN,eAAgB,CACd,QAAS,QACT,MAAO,QACP,KAAM,QACN,MAAO,OACT,CACF,EACA,MAAO,CACL,SAAU,EAAa,OAAS,QAChC,YAAa,QACb,WAAY,QACZ,KAAM,SACN,QAAS,QACT,UAAW,QACX,MAAO,QACP,OAAQ,EAAa,OAAS,QAC9B,UAAW,QACX,OAAQ,QACR,cAAe,OACjB,EACA,QAAS,CAAE,SAAU,EAAa,OAAS,QAAS,UAAW,OAAQ,CACzE,CACF,CAEA,SAAgB,GAAoB,EAAi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B,EAAS,EAAM,CAAS,CAAC,CAAC,WAC7D,SAAU,MACV,KAAM,SACR,GAEF,IAAM,EAAiC,CACrC,GAAG,EACH,aACA,SAAU,MACV,mBAAoB,CAAC,MAAM,EAC3B,iBAAkB,cAClB,oBAAqB,MACvB,EACA,OACE,EAAC,EAAD,CAAmB,UAAiB,SAClC,SAAA,EAAC,EAAD,CAAiB,GAAI,CAAQ,CAAA,CACrB,CAAA,CAEd"}
|
package/dist/auction-payment.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./use-auction-boundary.js";import{calculateLockerverseAuctionPricing as t,getLockerverseAuctionMinimumBid as n}from"@lockerverse/sdk/auctions";function r(e,n,r){let i=t(e,n.saleMode===`buy_now`?(n.buyNowPriceAmount??0)*r.quantity:r.amount,r.includeServiceFee,n.additionalCharge?n.additionalCharge.firstUnitAmountCents+n.additionalCharge.additionalUnitAmountCents*(n.saleMode===`buy_now`?r.quantity-1:0):0);return n.additionalCharge?{...i,additionalCharge:n.additionalCharge}:i}function i(t,r,i){if(e(t,r)!==`active`)return`This item is not accepting bids or purchases.`;if(r.saleMode===`hybrid`)return`This item type is not supported for checkout.`;if(r.saleMode===`buy_now`){if(r.isSoldOut||r.availableQuantity===0)return`This item is sold out.`;if(i.quantity>(r.maxQuantityPerOrder??1/0))return`You can buy up to ${r.maxQuantityPerOrder} items per order.`;if(!(r.buyNowPriceAmount&&Number.isSafeInteger(i.quantity))||i.quantity<1||r.availableQuantity!==null&&i.quantity>r.availableQuantity)return`Select an available quantity.`}else if(!Number.isSafeInteger(i.amount)||i.amount%100!=0||i.amount<n(r))return`Enter a whole-dollar bid at or above the minimum bid.`;return null}function a(e,t){return e?.name===t?.name&&e?.category===t?.category&&e?.firstUnitAmountCents===t?.firstUnitAmountCents&&e?.additionalUnitAmountCents===t?.additionalUnitAmountCents}function o(e,t,n,i,o){return e.payment?.publishableKey!==t.payment?.publishableKey||e.payment?.connectedAccountId!==t.payment?.connectedAccountId||e.serviceFeeEnabled!==t.serviceFeeEnabled||n.saleMode!==i.saleMode||!a(n.additionalCharge,i.additionalCharge)||n.collectShippingAddress!==i.collectShippingAddress||JSON.stringify(r(e,n,o))!==JSON.stringify(r(t,i,o))}function s(e){return{expectedAdditionalChargeCents:e.additionalChargeCents??0,expectedServiceFeeCents:e.serviceFeeCents,expectedSubtotalCents:e.subtotalCents,expectedTotalCents:e.totalCents}}async function c({stripe:e,elements:t,email:n,phone:r,billing:i,shipping:a,collectShippingAddress:o}){if(!(i?.complete&&i.value.name.trim()))throw Error(`Complete your billing name and address.`);if(o&&!(a?.complete&&a.value.name.trim()))throw Error(`Complete your shipping name and address.`);let s=await t.submit();if(s.error)throw Error(s.error.message??`Check your payment details.`);let c=await e.createConfirmationToken({elements:t,params:{payment_method_data:{allow_redisplay:`always`,billing_details:{address:i.value.address,email:n,name:i.value.name,phone:r}},return_url:window.location.href,...o&&a?{shipping:{address:a.value.address,name:a.value.name,phone:r}}:void 0}});if(c.error||!c.confirmationToken)throw Error(c.error?.message??`Unable to prepare payment details.`);return c.confirmationToken.id}async function l(e,t){if(!t.requiresAction)return;if(!t.clientSecret)throw Error(`Payment confirmation is incomplete. Check its status before trying again.`);let n=await e.handleNextAction({clientSecret:t.clientSecret});if(n.error)throw Error(n.error.message??`Payment confirmation is incomplete.`)}export{r as a,i,l as n,o,c as r,a as s,s as t};
|
|
1
|
+
import{a as e}from"./use-auction-boundary.js";import{calculateLockerverseAuctionPricing as t,getLockerverseAuctionMinimumBid as n}from"@lockerverse/sdk/auctions";function r(e,n,r){let i=t(e,n.saleMode===`buy_now`?(n.buyNowPriceAmount??0)*r.quantity:r.amount,r.includeServiceFee,n.additionalCharge?n.additionalCharge.firstUnitAmountCents+n.additionalCharge.additionalUnitAmountCents*(n.saleMode===`buy_now`?r.quantity-1:0):0);return n.additionalCharge?{...i,additionalCharge:n.additionalCharge}:i}function i(t,r,i){if(e(t,r)!==`active`)return`This item is not accepting bids or purchases.`;if(i.bidType===`maximum`&&!r.supportsMaximumBids)return`Maximum bidding is not available for this item. Choose a fixed bid.`;if(r.saleMode===`hybrid`)return`This item type is not supported for checkout.`;if(r.saleMode===`buy_now`){if(r.isSoldOut||r.availableQuantity===0)return`This item is sold out.`;if(i.quantity>(r.maxQuantityPerOrder??1/0))return`You can buy up to ${r.maxQuantityPerOrder} items per order.`;if(!(r.buyNowPriceAmount&&Number.isSafeInteger(i.quantity))||i.quantity<1||r.availableQuantity!==null&&i.quantity>r.availableQuantity)return`Select an available quantity.`}else if(!Number.isSafeInteger(i.amount)||i.amount%100!=0||i.amount<n(r))return`Enter a whole-dollar bid at or above the minimum bid.`;return null}function a(e,t){return e?.name===t?.name&&e?.category===t?.category&&e?.firstUnitAmountCents===t?.firstUnitAmountCents&&e?.additionalUnitAmountCents===t?.additionalUnitAmountCents}function o(e,t,n,i,o){return e.payment?.publishableKey!==t.payment?.publishableKey||e.payment?.connectedAccountId!==t.payment?.connectedAccountId||e.serviceFeeEnabled!==t.serviceFeeEnabled||n.saleMode!==i.saleMode||!a(n.additionalCharge,i.additionalCharge)||n.collectShippingAddress!==i.collectShippingAddress||JSON.stringify(r(e,n,o))!==JSON.stringify(r(t,i,o))}function s(e){return{expectedAdditionalChargeCents:e.additionalChargeCents??0,expectedServiceFeeCents:e.serviceFeeCents,expectedSubtotalCents:e.subtotalCents,expectedTotalCents:e.totalCents}}async function c({stripe:e,elements:t,email:n,phone:r,billing:i,shipping:a,collectShippingAddress:o}){if(!(i?.complete&&i.value.name.trim()))throw Error(`Complete your billing name and address.`);if(o&&!(a?.complete&&a.value.name.trim()))throw Error(`Complete your shipping name and address.`);let s=await t.submit();if(s.error)throw Error(s.error.message??`Check your payment details.`);let c=await e.createConfirmationToken({elements:t,params:{payment_method_data:{allow_redisplay:`always`,billing_details:{address:i.value.address,email:n,name:i.value.name,phone:r}},return_url:window.location.href,...o&&a?{shipping:{address:a.value.address,name:a.value.name,phone:r}}:void 0}});if(c.error||!c.confirmationToken)throw Error(c.error?.message??`Unable to prepare payment details.`);return c.confirmationToken.id}async function l(e,t){if(!t.requiresAction)return;if(!t.clientSecret)throw Error(`Payment confirmation is incomplete. Check its status before trying again.`);let n=await e.handleNextAction({clientSecret:t.clientSecret});if(n.error)throw Error(n.error.message??`Payment confirmation is incomplete.`)}export{r as a,i,l as n,o,c as r,a as s,s as t};
|
|
2
2
|
//# sourceMappingURL=auction-payment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auction-payment.js","names":[],"sources":["../src/auction-payment.ts"],"sourcesContent":["import type {\n LockerverseAuction,\n LockerverseAuctionAdditionalCharge,\n LockerverseAuctionBidResult,\n LockerverseAuctionItem,\n LockerverseAuctionPricing,\n} from \"@lockerverse/sdk/auctions\";\nimport {\n calculateLockerverseAuctionPricing,\n getLockerverseAuctionMinimumBid,\n} from \"@lockerverse/sdk/auctions\";\nimport type {\n Stripe,\n StripeAddressElementChangeEvent,\n StripeElements,\n} from \"@stripe/stripe-js\";\nimport { getAuctionDisplayStatus } from \"./auction-display.ts\";\n\nexport type AuctionSelection = {\n amount: number;\n quantity: number;\n includeServiceFee: boolean;\n};\n\nexport function getAuctionSelectionPricing(\n auction: LockerverseAuction,\n item: LockerverseAuctionItem,\n selection: AuctionSelection\n) {\n const pricing = calculateLockerverseAuctionPricing(\n auction,\n item.saleMode === \"buy_now\"\n ? (item.buyNowPriceAmount ?? 0) * selection.quantity\n : selection.amount,\n selection.includeServiceFee,\n item.additionalCharge\n ? item.additionalCharge.firstUnitAmountCents +\n item.additionalCharge.additionalUnitAmountCents *\n (item.saleMode === \"buy_now\" ? selection.quantity - 1 : 0)\n : 0\n );\n return item.additionalCharge\n ? { ...pricing, additionalCharge: item.additionalCharge }\n : pricing;\n}\n\nexport function getAuctionSelectionError(\n auction: LockerverseAuction,\n item: LockerverseAuctionItem,\n selection: AuctionSelection\n) {\n if (getAuctionDisplayStatus(auction, item) !== \"active\") {\n return \"This item is not accepting bids or purchases.\";\n }\n if (item.saleMode === \"hybrid\") {\n return \"This item type is not supported for checkout.\";\n }\n if (item.saleMode === \"buy_now\") {\n if (item.isSoldOut || item.availableQuantity === 0) {\n return \"This item is sold out.\";\n }\n if (\n selection.quantity >\n (item.maxQuantityPerOrder ?? Number.POSITIVE_INFINITY)\n ) {\n return `You can buy up to ${item.maxQuantityPerOrder} items per order.`;\n }\n if (\n !(item.buyNowPriceAmount && Number.isSafeInteger(selection.quantity)) ||\n selection.quantity < 1 ||\n (item.availableQuantity !== null &&\n selection.quantity > item.availableQuantity)\n ) {\n return \"Select an available quantity.\";\n }\n } else if (\n !Number.isSafeInteger(selection.amount) ||\n selection.amount % 100 !== 0 ||\n selection.amount < getLockerverseAuctionMinimumBid(item)\n ) {\n return \"Enter a whole-dollar bid at or above the minimum bid.\";\n }\n return null;\n}\n\nexport function sameAuctionAdditionalCharge(\n left: LockerverseAuctionAdditionalCharge | null | undefined,\n right: LockerverseAuctionAdditionalCharge | null | undefined\n) {\n return (\n left?.name === right?.name &&\n left?.category === right?.category &&\n left?.firstUnitAmountCents === right?.firstUnitAmountCents &&\n left?.additionalUnitAmountCents === right?.additionalUnitAmountCents\n );\n}\n\nexport function hasAuctionCheckoutChanged(\n previous: LockerverseAuction,\n current: LockerverseAuction,\n item: LockerverseAuctionItem,\n nextItem: LockerverseAuctionItem,\n selection: AuctionSelection\n) {\n return (\n previous.payment?.publishableKey !== current.payment?.publishableKey ||\n previous.payment?.connectedAccountId !==\n current.payment?.connectedAccountId ||\n previous.serviceFeeEnabled !== current.serviceFeeEnabled ||\n item.saleMode !== nextItem.saleMode ||\n !sameAuctionAdditionalCharge(\n item.additionalCharge,\n nextItem.additionalCharge\n ) ||\n item.collectShippingAddress !== nextItem.collectShippingAddress ||\n JSON.stringify(getAuctionSelectionPricing(previous, item, selection)) !==\n JSON.stringify(getAuctionSelectionPricing(current, nextItem, selection))\n );\n}\n\nexport function auctionExpectedPricing(pricing: LockerverseAuctionPricing) {\n return {\n expectedAdditionalChargeCents: pricing.additionalChargeCents ?? 0,\n expectedServiceFeeCents: pricing.serviceFeeCents,\n expectedSubtotalCents: pricing.subtotalCents,\n expectedTotalCents: pricing.totalCents,\n };\n}\n\nexport async function createAuctionConfirmationToken({\n stripe,\n elements,\n email,\n phone,\n billing,\n shipping,\n collectShippingAddress,\n}: {\n stripe: Stripe;\n elements: StripeElements;\n email: string;\n phone: string;\n billing: StripeAddressElementChangeEvent | null;\n shipping: StripeAddressElementChangeEvent | null;\n collectShippingAddress: boolean;\n}) {\n if (!(billing?.complete && billing.value.name.trim())) {\n throw new Error(\"Complete your billing name and address.\");\n }\n if (\n collectShippingAddress &&\n !(shipping?.complete && shipping.value.name.trim())\n ) {\n throw new Error(\"Complete your shipping name and address.\");\n }\n const submitted = await elements.submit();\n if (submitted.error) {\n throw new Error(submitted.error.message ?? \"Check your payment details.\");\n }\n const result = await stripe.createConfirmationToken({\n elements,\n params: {\n payment_method_data: {\n allow_redisplay: \"always\",\n billing_details: {\n address: billing.value.address,\n email,\n name: billing.value.name,\n phone,\n },\n },\n return_url: window.location.href,\n ...(collectShippingAddress && shipping\n ? {\n shipping: {\n address: shipping.value.address,\n name: shipping.value.name,\n phone,\n },\n }\n : undefined),\n },\n });\n if (result.error || !result.confirmationToken) {\n throw new Error(\n result.error?.message ?? \"Unable to prepare payment details.\"\n );\n }\n return result.confirmationToken.id;\n}\n\nexport async function completeAuctionAction(\n stripe: Stripe,\n result: LockerverseAuctionBidResult\n) {\n if (!result.requiresAction) {\n return;\n }\n if (!result.clientSecret) {\n throw new Error(\n \"Payment confirmation is incomplete. Check its status before trying again.\"\n );\n }\n const action = await stripe.handleNextAction({\n clientSecret: result.clientSecret,\n });\n if (action.error) {\n throw new Error(\n action.error.message ?? \"Payment confirmation is incomplete.\"\n );\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"auction-payment.js","names":[],"sources":["../src/auction-payment.ts"],"sourcesContent":["import type {\n LockerverseAuction,\n LockerverseAuctionAdditionalCharge,\n LockerverseAuctionBidResult,\n LockerverseAuctionBidType,\n LockerverseAuctionItem,\n LockerverseAuctionPricing,\n} from \"@lockerverse/sdk/auctions\";\nimport {\n calculateLockerverseAuctionPricing,\n getLockerverseAuctionMinimumBid,\n} from \"@lockerverse/sdk/auctions\";\nimport type {\n Stripe,\n StripeAddressElementChangeEvent,\n StripeElements,\n} from \"@stripe/stripe-js\";\nimport { getAuctionDisplayStatus } from \"./auction-display.ts\";\n\nexport type AuctionSelection = {\n bidType?: LockerverseAuctionBidType;\n amount: number;\n quantity: number;\n includeServiceFee: boolean;\n};\n\nexport function getAuctionSelectionPricing(\n auction: LockerverseAuction,\n item: LockerverseAuctionItem,\n selection: AuctionSelection\n) {\n const pricing = calculateLockerverseAuctionPricing(\n auction,\n item.saleMode === \"buy_now\"\n ? (item.buyNowPriceAmount ?? 0) * selection.quantity\n : selection.amount,\n selection.includeServiceFee,\n item.additionalCharge\n ? item.additionalCharge.firstUnitAmountCents +\n item.additionalCharge.additionalUnitAmountCents *\n (item.saleMode === \"buy_now\" ? selection.quantity - 1 : 0)\n : 0\n );\n return item.additionalCharge\n ? { ...pricing, additionalCharge: item.additionalCharge }\n : pricing;\n}\n\nexport function getAuctionSelectionError(\n auction: LockerverseAuction,\n item: LockerverseAuctionItem,\n selection: AuctionSelection\n) {\n if (getAuctionDisplayStatus(auction, item) !== \"active\") {\n return \"This item is not accepting bids or purchases.\";\n }\n if (selection.bidType === \"maximum\" && !item.supportsMaximumBids) {\n return \"Maximum bidding is not available for this item. Choose a fixed bid.\";\n }\n if (item.saleMode === \"hybrid\") {\n return \"This item type is not supported for checkout.\";\n }\n if (item.saleMode === \"buy_now\") {\n if (item.isSoldOut || item.availableQuantity === 0) {\n return \"This item is sold out.\";\n }\n if (\n selection.quantity >\n (item.maxQuantityPerOrder ?? Number.POSITIVE_INFINITY)\n ) {\n return `You can buy up to ${item.maxQuantityPerOrder} items per order.`;\n }\n if (\n !(item.buyNowPriceAmount && Number.isSafeInteger(selection.quantity)) ||\n selection.quantity < 1 ||\n (item.availableQuantity !== null &&\n selection.quantity > item.availableQuantity)\n ) {\n return \"Select an available quantity.\";\n }\n } else if (\n !Number.isSafeInteger(selection.amount) ||\n selection.amount % 100 !== 0 ||\n selection.amount < getLockerverseAuctionMinimumBid(item)\n ) {\n return \"Enter a whole-dollar bid at or above the minimum bid.\";\n }\n return null;\n}\n\nexport function sameAuctionAdditionalCharge(\n left: LockerverseAuctionAdditionalCharge | null | undefined,\n right: LockerverseAuctionAdditionalCharge | null | undefined\n) {\n return (\n left?.name === right?.name &&\n left?.category === right?.category &&\n left?.firstUnitAmountCents === right?.firstUnitAmountCents &&\n left?.additionalUnitAmountCents === right?.additionalUnitAmountCents\n );\n}\n\nexport function hasAuctionCheckoutChanged(\n previous: LockerverseAuction,\n current: LockerverseAuction,\n item: LockerverseAuctionItem,\n nextItem: LockerverseAuctionItem,\n selection: AuctionSelection\n) {\n return (\n previous.payment?.publishableKey !== current.payment?.publishableKey ||\n previous.payment?.connectedAccountId !==\n current.payment?.connectedAccountId ||\n previous.serviceFeeEnabled !== current.serviceFeeEnabled ||\n item.saleMode !== nextItem.saleMode ||\n !sameAuctionAdditionalCharge(\n item.additionalCharge,\n nextItem.additionalCharge\n ) ||\n item.collectShippingAddress !== nextItem.collectShippingAddress ||\n JSON.stringify(getAuctionSelectionPricing(previous, item, selection)) !==\n JSON.stringify(getAuctionSelectionPricing(current, nextItem, selection))\n );\n}\n\nexport function auctionExpectedPricing(pricing: LockerverseAuctionPricing) {\n return {\n expectedAdditionalChargeCents: pricing.additionalChargeCents ?? 0,\n expectedServiceFeeCents: pricing.serviceFeeCents,\n expectedSubtotalCents: pricing.subtotalCents,\n expectedTotalCents: pricing.totalCents,\n };\n}\n\nexport async function createAuctionConfirmationToken({\n stripe,\n elements,\n email,\n phone,\n billing,\n shipping,\n collectShippingAddress,\n}: {\n stripe: Stripe;\n elements: StripeElements;\n email: string;\n phone: string;\n billing: StripeAddressElementChangeEvent | null;\n shipping: StripeAddressElementChangeEvent | null;\n collectShippingAddress: boolean;\n}) {\n if (!(billing?.complete && billing.value.name.trim())) {\n throw new Error(\"Complete your billing name and address.\");\n }\n if (\n collectShippingAddress &&\n !(shipping?.complete && shipping.value.name.trim())\n ) {\n throw new Error(\"Complete your shipping name and address.\");\n }\n const submitted = await elements.submit();\n if (submitted.error) {\n throw new Error(submitted.error.message ?? \"Check your payment details.\");\n }\n const result = await stripe.createConfirmationToken({\n elements,\n params: {\n payment_method_data: {\n allow_redisplay: \"always\",\n billing_details: {\n address: billing.value.address,\n email,\n name: billing.value.name,\n phone,\n },\n },\n return_url: window.location.href,\n ...(collectShippingAddress && shipping\n ? {\n shipping: {\n address: shipping.value.address,\n name: shipping.value.name,\n phone,\n },\n }\n : undefined),\n },\n });\n if (result.error || !result.confirmationToken) {\n throw new Error(\n result.error?.message ?? \"Unable to prepare payment details.\"\n );\n }\n return result.confirmationToken.id;\n}\n\nexport async function completeAuctionAction(\n stripe: Stripe,\n result: LockerverseAuctionBidResult\n) {\n if (!result.requiresAction) {\n return;\n }\n if (!result.clientSecret) {\n throw new Error(\n \"Payment confirmation is incomplete. Check its status before trying again.\"\n );\n }\n const action = await stripe.handleNextAction({\n clientSecret: result.clientSecret,\n });\n if (action.error) {\n throw new Error(\n action.error.message ?? \"Payment confirmation is incomplete.\"\n );\n }\n}\n"],"mappings":"kKA0BA,SAAgB,EACd,EACA,EACA,EACA,CACA,IAAM,EAAU,EACd,EACA,EAAK,WAAa,WACb,EAAK,mBAAqB,GAAK,EAAU,SAC1C,EAAU,OACd,EAAU,kBACV,EAAK,iBACD,EAAK,iBAAiB,qBACpB,EAAK,iBAAiB,2BACnB,EAAK,WAAa,UAAY,EAAU,SAAW,EAAI,GAC5D,CACN,EACA,OAAO,EAAK,iBACR,CAAE,GAAG,EAAS,iBAAkB,EAAK,gBAAiB,EACtD,CACN,CAEA,SAAgB,EACd,EACA,EACA,EACA,CACA,GAAI,EAAwB,EAAS,CAAI,IAAM,SAC7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ASC,CACD,GAAI,EAAE,GAAS,UAAY,EAAQ,MAAM,KAAK,KAAK,GACjD,MAAU,MAAM,yCAAyC,EAE3D,GACE,GACA,EAAE,GAAU,UAAY,EAAS,MAAM,KAAK,KAAK,GAEjD,MAAU,MAAM,0CAA0C,EAE5D,IAAM,EAAY,MAAM,EAAS,OAAO,EACxC,GAAI,EAAU,MACZ,MAAU,MAAM,EAAU,MAAM,SAAW,6BAA6B,EAE1E,IAAM,EAAS,MAAM,EAAO,wBAAwB,CAClD,WACA,OAAQ,CACN,oBAAqB,CACnB,gBAAiB,SACjB,gBAAiB,CACf,QAAS,EAAQ,MAAM,QACvB,QACA,KAAM,EAAQ,MAAM,KACpB,OACF,CACF,EACA,WAAY,OAAO,SAAS,KAC5B,GAAI,GAA0B,EAC1B,CACE,SAAU,CACR,QAAS,EAAS,MAAM,QACxB,KAAM,EAAS,MAAM,KACrB,OACF,CACF,EACA,IAAA,EACN,CACF,CAAC,EACD,GAAI,EAAO,OAAS,CAAC,EAAO,kBAC1B,MAAU,MACR,EAAO,OAAO,SAAW,oCAC3B,EAEF,OAAO,EAAO,kBAAkB,EAClC,CAEA,eAAsB,EACpB,EACA,EACA,CACA,GAAI,CAAC,EAAO,eACV,OAEF,GAAI,CAAC,EAAO,aACV,MAAU,MACR,2EACF,EAEF,IAAM,EAAS,MAAM,EAAO,iBAAiB,CAC3C,aAAc,EAAO,YACvB,CAAC,EACD,GAAI,EAAO,MACT,MAAU,MACR,EAAO,MAAM,SAAW,qCAC1B,CAEJ"}
|
package/dist/auction-result.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auction-result.d.ts","names":[],"sources":["../src/auction-result.tsx"],"mappings":";;;KAaK;EACH;EACA;EACA;EACA;EACA;EACA,mBAAmB;EACnB;EACA;;KAGU;EAEN;EACA;EACA,mBAAmB;EACnB;EACA;EACA;KAED;EACC;;EAEA;MAED;EAA2B;;KAEpB;EACV;EACA;EACA;;KAGU;EACV,SAAS;EACT;EACA;EACA;EACA;EACA;EACA,gBAAgB;EAChB,kBAAkB;EAClB;EACA,QAAQ;EACR,QAAQ;;EAER;;;
|
|
1
|
+
{"version":3,"file":"auction-result.d.ts","names":[],"sources":["../src/auction-result.tsx"],"mappings":";;;KAaK;EACH;EACA;EACA;EACA;EACA;EACA,mBAAmB;EACnB;EACA;;KAGU;EAEN;EACA;EACA;EACA,mBAAmB;EACnB;EACA;EACA;KAED;EACC;;EAEA;MAED;EAA2B;;KAEpB;EACV;EACA;EACA;;KAGU;EACV,SAAS;EACT;EACA;EACA;EACA;EACA;EACA,gBAAgB;EAChB,kBAAkB;EAClB;EACA,QAAQ;EACR,QAAQ;;EAER;;;iBA+Jc,yBAAyB,OAAO,gDAA6B,IAAA"}
|
package/dist/auction-result2.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./format-money.js";import{t}from"./auction-image.js";import{ArrowRight as n,BadgeCheck as r,FileText as i,ShieldCheck as a,TimerReset as o}from"lucide-react";import{useEffect as s,useId as c,useRef as l}from"react";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";function p({action:e,secondary:t=!1}){let r=`lockerverse-auction-result__action${t?` lockerverse-auction-result__action--secondary`:``}`,i=f(u,{children:[e.label,t?null:d(n,{"aria-hidden":`true`,size:18})]});return e.href?d(`a`,{className:r,href:e.href,onClick:e.onClick,children:i}):d(`button`,{className:r,onClick:e.onClick,type:`button`,children:i})}const m={bid:{assurance:`A bid is not a purchase. Payment is collected only if you win at settlement.`,assuranceTitle:`Bid authorization saved`,badge:`Bid submitted`,description:`Your bid and payment method are recorded. You have not been charged for this bid.`,next:`Other bidders can still place bids until the item closes.`,nextTitle:`Follow the auction`,receiptLabel:`Bid summary`,steps:[`Your bid is recorded. This does not confirm that you have won.`,`Your saved payment method can be charged if you win at settlement.`,`Watch your email for bid updates and return to the item to check its status.`],title:`Bid received`},purchase:{assurance:`This receipt shows the amount paid for your purchase.`,assuranceTitle:`Payment processed`,badge:`Purchase confirmed`,description:`Your payment is confirmed and your purchase is recorded.`,next:`The community handles delivery or collection for this item.`,nextTitle:`Next steps`,receiptLabel:`Purchase receipt`,steps:[`Your payment is complete and your purchase is recorded.`,`The community can review your buyer and delivery details.`,`Keep your receipt number. Contact the community if you need help with your order.`],title:`Purchase complete`},receipt:{assurance:`The amounts below are the recorded purchase amounts, not proof of payment.`,assuranceTitle:`Recorded purchase`,badge:`Purchase details`,description:`Payment status is not confirmed on this page.`,next:`Contact the community if you need to confirm your payment or order status.`,nextTitle:`Next steps`,receiptLabel:`Purchase receipt`,steps:[`These are the recorded purchase details. They do not confirm payment.`,`Check your purchase confirmation for the payment result.`,`Contact the community with your receipt number if you need help.`],title:`Purchase details`}};function h(t){let n=[];return t.amountCents!==void 0&&n.push([
|
|
1
|
+
import{t as e}from"./format-money.js";import{t}from"./auction-image.js";import{ArrowRight as n,BadgeCheck as r,FileText as i,ShieldCheck as a,TimerReset as o}from"lucide-react";import{useEffect as s,useId as c,useRef as l}from"react";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";function p({action:e,secondary:t=!1}){let r=`lockerverse-auction-result__action${t?` lockerverse-auction-result__action--secondary`:``}`,i=f(u,{children:[e.label,t?null:d(n,{"aria-hidden":`true`,size:18})]});return e.href?d(`a`,{className:r,href:e.href,onClick:e.onClick,children:i}):d(`button`,{className:r,onClick:e.onClick,type:`button`,children:i})}const m={bid:{assurance:`A bid is not a purchase. Payment is collected only if you win at settlement.`,assuranceTitle:`Bid authorization saved`,badge:`Bid submitted`,description:`Your bid and payment method are recorded. You have not been charged for this bid.`,next:`Other bidders can still place bids until the item closes.`,nextTitle:`Follow the auction`,receiptLabel:`Bid summary`,steps:[`Your bid is recorded. This does not confirm that you have won.`,`Your saved payment method can be charged if you win at settlement.`,`Watch your email for bid updates and return to the item to check its status.`],title:`Bid received`},purchase:{assurance:`This receipt shows the amount paid for your purchase.`,assuranceTitle:`Payment processed`,badge:`Purchase confirmed`,description:`Your payment is confirmed and your purchase is recorded.`,next:`The community handles delivery or collection for this item.`,nextTitle:`Next steps`,receiptLabel:`Purchase receipt`,steps:[`Your payment is complete and your purchase is recorded.`,`The community can review your buyer and delivery details.`,`Keep your receipt number. Contact the community if you need help with your order.`],title:`Purchase complete`},receipt:{assurance:`The amounts below are the recorded purchase amounts, not proof of payment.`,assuranceTitle:`Recorded purchase`,badge:`Purchase details`,description:`Payment status is not confirmed on this page.`,next:`Contact the community if you need to confirm your payment or order status.`,nextTitle:`Next steps`,receiptLabel:`Purchase receipt`,steps:[`These are the recorded purchase details. They do not confirm payment.`,`Check your purchase confirmation for the payment result.`,`Contact the community with your receipt number if you need help.`],title:`Purchase details`}};function h(t){let n=[];return t.amountCents!==void 0&&n.push([t.bidType===`maximum`?`Maximum bid`:`Bid amount`,e(t.amountCents)]),t.additionalCharge&&n.push([t.additionalCharge.name,e(t.additionalChargeCents??0)]),(t.additionalCharge||t.bidType===`maximum`)&&((t.serviceFeeCents??0)>0&&n.push([t.bidType===`maximum`?`Maximum service fee`:`Service fee`,e(t.serviceFeeCents??0)]),t.totalCents!==void 0&&n.push([t.bidType===`maximum`?`Maximum total if I win`:`Total if I win`,e(t.totalCents)])),n}function g({outcome:t,auctionName:n,communityName:r,closesAtLabel:i}){let a=[];return t.kind===`bid`?a.push(...h(t)):(a.push([`Unit price`,e(t.unitAmountCents)],[`Quantity`,String(t.quantity)],[`Subtotal`,e(t.subtotalCents)]),t.additionalCharge&&a.push([t.additionalCharge.name,e(t.additionalChargeCents??0)]),t.serviceFeeCents>0&&a.push([`Service fee`,e(t.serviceFeeCents)]),a.push([t.kind===`purchase`?`Total paid`:`Total`,e(t.totalCents)],[`Receipt`,t.purchaseId])),n&&a.push([`Auction`,n]),r&&a.push([`Community`,r]),i&&a.push([`Closes`,i]),a}function _(e){let{outcome:n,itemName:u,imageUrl:h,communityName:_,primaryAction:v,secondaryAction:y,className:b,theme:x=`dark`,style:S}=e,C=c(),w=l(null);s(()=>{e.focusHeading&&w.current?.focus()},[e.focusHeading]);let T=m[n.kind],E=n.kind===`receipt`?i:r,D=n.kind===`receipt`?i:a,O=g(e);return d(`section`,{"aria-labelledby":C,className:[`lockerverse-auctions lockerverse-auction-result`,b].filter(Boolean).join(` `),"data-lockerverse-theme":x,style:S,children:f(`div`,{className:`lockerverse-auction-result__layout`,children:[f(`div`,{className:`lockerverse-auction-result__summary`,children:[f(`span`,{className:`lockerverse-auction-result__badge`,children:[d(E,{"aria-hidden":`true`,size:18}),T.badge]}),_?d(`p`,{className:`lockerverse-auction-result__community`,children:_}):null,f(`h2`,{className:`lockerverse-auction-result__title`,id:C,ref:w,tabIndex:e.focusHeading?-1:void 0,children:[T.title,` for `,u,`.`]}),f(`p`,{className:`lockerverse-auction-result__description`,children:[T.description,n.kind===`bid`&&n.bidType===`maximum`?` We bid for you up to your private maximum. If you win, you pay the final winning price plus applicable fees. This submission does not confirm that you are leading.`:``]}),f(`div`,{className:`lockerverse-auction-result__assurance`,children:[d(D,{"aria-hidden":`true`,size:22}),f(`div`,{children:[d(`strong`,{children:T.assuranceTitle}),d(`p`,{children:T.assurance})]})]}),f(`div`,{className:`lockerverse-auction-result__assurance`,children:[d(o,{"aria-hidden":`true`,size:22}),f(`div`,{children:[d(`strong`,{children:T.nextTitle}),d(`p`,{children:T.next})]})]}),v||y?f(`div`,{className:`lockerverse-auction-result__actions`,children:[v?d(p,{action:v}):null,y?d(p,{action:y,secondary:!0}):null]}):null]}),f(`aside`,{"aria-label":T.receiptLabel,className:`lockerverse-auction-result__receipt`,children:[h?d(t,{alt:u,className:`lockerverse-auction-result__image`,height:300,maxWidth:960,sizes:`100vw`,src:h,width:420}):null,f(`div`,{className:`lockerverse-auction-result__receipt-body`,children:[d(`p`,{className:`lockerverse-auction-result__eyebrow`,children:T.receiptLabel}),d(`h3`,{className:`lockerverse-auction-result__receipt-title`,children:u}),d(`dl`,{className:`lockerverse-auction-result__details`,children:O.map(([e,t])=>f(`div`,{children:[d(`dt`,{children:e}),d(`dd`,{children:t})]},e))}),d(`h4`,{children:`What happens next`}),d(`ol`,{className:`lockerverse-auction-result__steps`,role:`list`,children:T.steps.map((e,t)=>f(`li`,{children:[d(`span`,{"aria-hidden":`true`,className:`lockerverse-auction-result__step-number`,children:String(t+1).padStart(2,`0`)}),d(`span`,{children:e})]},e))})]})]})]})})}export{_ as t};
|
|
2
2
|
//# sourceMappingURL=auction-result2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auction-result2.js","names":[],"sources":["../src/auction-result.tsx"],"sourcesContent":["import type { LockerverseAuctionAdditionalCharge } from \"@lockerverse/sdk/auctions\";\nimport {\n ArrowRight,\n BadgeCheck,\n FileText,\n ShieldCheck,\n TimerReset,\n} from \"lucide-react\";\nimport { useEffect, useId, useRef } from \"react\";\nimport { AuctionImage } from \"./auction-image.tsx\";\nimport { formatMoney } from \"./format-money.ts\";\nimport type { LockerverseStyle, LockerverseTheme } from \"./theme.ts\";\n\ntype AuctionPurchaseDetails = {\n purchaseId: string;\n unitAmountCents: number;\n quantity: number;\n subtotalCents: number;\n additionalChargeCents?: number;\n additionalCharge?: LockerverseAuctionAdditionalCharge | null;\n serviceFeeCents: number;\n totalCents: number;\n};\n\nexport type LockerverseAuctionOutcome =\n | {\n kind: \"bid\";\n amountCents?: number;\n additionalCharge?: LockerverseAuctionAdditionalCharge | null;\n additionalChargeCents?: number;\n totalCents?: number;\n serviceFeeCents?: number;\n }\n | (AuctionPurchaseDetails & {\n kind: \"purchase\";\n /** Use only after the server confirms payment. Receipt amounts alone are not proof. */\n status: \"paid\";\n })\n | (AuctionPurchaseDetails & { kind: \"receipt\" });\n\nexport type LockerverseAuctionResultAction = {\n label: string;\n href?: string;\n onClick?: () => void;\n};\n\nexport type LockerverseAuctionResultProps = {\n outcome: LockerverseAuctionOutcome;\n itemName: string;\n imageUrl?: string | undefined;\n auctionName?: string | undefined;\n communityName?: string | undefined;\n closesAtLabel?: string | undefined;\n primaryAction?: LockerverseAuctionResultAction | undefined;\n secondaryAction?: LockerverseAuctionResultAction | undefined;\n className?: string | undefined;\n theme?: LockerverseTheme | undefined;\n style?: LockerverseStyle | undefined;\n /** Focus the result after an inline checkout completes. Defaults to false. */\n focusHeading?: boolean | undefined;\n};\n\nfunction ResultAction({\n action,\n secondary = false,\n}: {\n action: LockerverseAuctionResultAction;\n secondary?: boolean;\n}) {\n const className = `lockerverse-auction-result__action${secondary ? \" lockerverse-auction-result__action--secondary\" : \"\"}`;\n const content = (\n <>\n {action.label}\n {secondary ? null : <ArrowRight aria-hidden=\"true\" size={18} />}\n </>\n );\n return action.href ? (\n <a className={className} href={action.href} onClick={action.onClick}>\n {content}\n </a>\n ) : (\n <button className={className} onClick={action.onClick} type=\"button\">\n {content}\n </button>\n );\n}\n\nconst outcomeCopy = {\n bid: {\n assurance:\n \"A bid is not a purchase. Payment is collected only if you win at settlement.\",\n assuranceTitle: \"Bid authorization saved\",\n badge: \"Bid submitted\",\n description:\n \"Your bid and payment method are recorded. You have not been charged for this bid.\",\n next: \"Other bidders can still place bids until the item closes.\",\n nextTitle: \"Follow the auction\",\n receiptLabel: \"Bid summary\",\n steps: [\n \"Your bid is recorded. This does not confirm that you have won.\",\n \"Your saved payment method can be charged if you win at settlement.\",\n \"Watch your email for bid updates and return to the item to check its status.\",\n ],\n title: \"Bid received\",\n },\n purchase: {\n assurance: \"This receipt shows the amount paid for your purchase.\",\n assuranceTitle: \"Payment processed\",\n badge: \"Purchase confirmed\",\n description: \"Your payment is confirmed and your purchase is recorded.\",\n next: \"The community handles delivery or collection for this item.\",\n nextTitle: \"Next steps\",\n receiptLabel: \"Purchase receipt\",\n steps: [\n \"Your payment is complete and your purchase is recorded.\",\n \"The community can review your buyer and delivery details.\",\n \"Keep your receipt number. Contact the community if you need help with your order.\",\n ],\n title: \"Purchase complete\",\n },\n receipt: {\n assurance:\n \"The amounts below are the recorded purchase amounts, not proof of payment.\",\n assuranceTitle: \"Recorded purchase\",\n badge: \"Purchase details\",\n description: \"Payment status is not confirmed on this page.\",\n next: \"Contact the community if you need to confirm your payment or order status.\",\n nextTitle: \"Next steps\",\n receiptLabel: \"Purchase receipt\",\n steps: [\n \"These are the recorded purchase details. They do not confirm payment.\",\n \"Check your purchase confirmation for the payment result.\",\n \"Contact the community with your receipt number if you need help.\",\n ],\n title: \"Purchase details\",\n },\n};\n\nfunction getBidDetails(\n outcome: Extract<LockerverseAuctionOutcome, { kind: \"bid\" }>\n) {\n const details: [string, string][] = [];\n if (outcome.amountCents !== undefined) {\n details.push([\"Bid amount\", formatMoney(outcome.amountCents)]);\n }\n if (outcome.additionalCharge) {\n details.push([\n outcome.additionalCharge.name,\n formatMoney(outcome.additionalChargeCents ?? 0),\n ]);\n if ((outcome.serviceFeeCents ?? 0) > 0) {\n details.push([\"Service fee\", formatMoney(outcome.serviceFeeCents ?? 0)]);\n }\n if (outcome.totalCents !== undefined) {\n details.push([\"Total if I win\", formatMoney(outcome.totalCents)]);\n }\n }\n return details;\n}\n\nfunction getResultDetails({\n outcome,\n auctionName,\n communityName,\n closesAtLabel,\n}: LockerverseAuctionResultProps) {\n const details: [string, string][] = [];\n if (outcome.kind === \"bid\") {\n details.push(...getBidDetails(outcome));\n } else {\n details.push(\n [\"Unit price\", formatMoney(outcome.unitAmountCents)],\n [\"Quantity\", String(outcome.quantity)],\n [\"Subtotal\", formatMoney(outcome.subtotalCents)]\n );\n if (outcome.additionalCharge) {\n details.push([\n outcome.additionalCharge.name,\n formatMoney(outcome.additionalChargeCents ?? 0),\n ]);\n }\n if (outcome.serviceFeeCents > 0) {\n details.push([\"Service fee\", formatMoney(outcome.serviceFeeCents)]);\n }\n details.push(\n [\n outcome.kind === \"purchase\" ? \"Total paid\" : \"Total\",\n formatMoney(outcome.totalCents),\n ],\n [\"Receipt\", outcome.purchaseId]\n );\n }\n if (auctionName) {\n details.push([\"Auction\", auctionName]);\n }\n if (communityName) {\n details.push([\"Community\", communityName]);\n }\n if (closesAtLabel) {\n details.push([\"Closes\", closesAtLabel]);\n }\n return details;\n}\n\n/** Shared result view. Hosts must provide a verified outcome or a neutral receipt. */\nexport function LockerverseAuctionResult(props: LockerverseAuctionResultProps) {\n const {\n outcome,\n itemName,\n imageUrl,\n communityName,\n primaryAction,\n secondaryAction,\n className,\n theme = \"dark\",\n style,\n } = props;\n const titleId = useId();\n const headingRef = useRef<HTMLHeadingElement>(null);\n useEffect(() => {\n if (props.focusHeading) {\n headingRef.current?.focus();\n }\n }, [props.focusHeading]);\n const copy = outcomeCopy[outcome.kind];\n const StatusIcon = outcome.kind === \"receipt\" ? FileText : BadgeCheck;\n const AssuranceIcon = outcome.kind === \"receipt\" ? FileText : ShieldCheck;\n const details = getResultDetails(props);\n return (\n <section\n aria-labelledby={titleId}\n className={[\"lockerverse-auctions lockerverse-auction-result\", className]\n .filter(Boolean)\n .join(\" \")}\n data-lockerverse-theme={theme}\n style={style}\n >\n <div className=\"lockerverse-auction-result__layout\">\n <div className=\"lockerverse-auction-result__summary\">\n <span className=\"lockerverse-auction-result__badge\">\n <StatusIcon aria-hidden=\"true\" size={18} />\n {copy.badge}\n </span>\n {communityName ? (\n <p className=\"lockerverse-auction-result__community\">\n {communityName}\n </p>\n ) : null}\n <h2\n className=\"lockerverse-auction-result__title\"\n id={titleId}\n ref={headingRef}\n tabIndex={props.focusHeading ? -1 : undefined}\n >\n {copy.title} for {itemName}.\n </h2>\n <p className=\"lockerverse-auction-result__description\">\n {copy.description}\n </p>\n <div className=\"lockerverse-auction-result__assurance\">\n <AssuranceIcon aria-hidden=\"true\" size={22} />\n <div>\n <strong>{copy.assuranceTitle}</strong>\n <p>{copy.assurance}</p>\n </div>\n </div>\n <div className=\"lockerverse-auction-result__assurance\">\n <TimerReset aria-hidden=\"true\" size={22} />\n <div>\n <strong>{copy.nextTitle}</strong>\n <p>{copy.next}</p>\n </div>\n </div>\n {primaryAction || secondaryAction ? (\n <div className=\"lockerverse-auction-result__actions\">\n {primaryAction ? <ResultAction action={primaryAction} /> : null}\n {secondaryAction ? (\n <ResultAction action={secondaryAction} secondary />\n ) : null}\n </div>\n ) : null}\n </div>\n <aside\n aria-label={copy.receiptLabel}\n className=\"lockerverse-auction-result__receipt\"\n >\n {imageUrl ? (\n <AuctionImage\n alt={itemName}\n className=\"lockerverse-auction-result__image\"\n height={300}\n maxWidth={960}\n sizes=\"100vw\"\n src={imageUrl}\n width={420}\n />\n ) : null}\n <div className=\"lockerverse-auction-result__receipt-body\">\n <p className=\"lockerverse-auction-result__eyebrow\">\n {copy.receiptLabel}\n </p>\n <h3 className=\"lockerverse-auction-result__receipt-title\">\n {itemName}\n </h3>\n <dl className=\"lockerverse-auction-result__details\">\n {details.map(([label, value]) => (\n <div key={label}>\n <dt>{label}</dt>\n <dd>{value}</dd>\n </div>\n ))}\n </dl>\n <h4>What happens next</h4>\n {/* biome-ignore lint/a11y/noRedundantRoles: Keep list semantics in Safari when visual markers replace list-style. */}\n <ol className=\"lockerverse-auction-result__steps\" role=\"list\">\n {copy.steps.map((step, index) => (\n <li key={step}>\n <span\n aria-hidden=\"true\"\n className=\"lockerverse-auction-result__step-number\"\n >\n {String(index + 1).padStart(2, \"0\")}\n </span>\n <span>{step}</span>\n </li>\n ))}\n </ol>\n </div>\n </aside>\n </div>\n </section>\n );\n}\n"],"mappings":"0SA8DA,SAAS,EAAa,CACpB,SACA,YAAY,IAIX,CACD,IAAM,EAAY,qCAAqC,EAAY,iDAAmD,KAChH,EACJ,EAAA,EAAA,CAAA,SAAA,CACG,EAAO,MACP,EAAY,KAAO,EAAC,EAAD,CAAY,cAAY,OAAO,KAAM,EAAK,CAAA,CAC9D,CAAA,CAAA,EAEJ,OAAO,EAAO,KACZ,EAAC,IAAD,CAAc,YAAW,KAAM,EAAO,KAAM,QAAS,EAAO,QACzD,SAAA,CACA,CAAA,EAEH,EAAC,SAAD,CAAmB,YAAW,QAAS,EAAO,QAAS,KAAK,SACzD,SAAA,CACK,CAAA,CAEZ,CAEA,MAAM,EAAc,CAClB,IAAK,CACH,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EAAC,MAAD,CAAA,SAAA,CACE,EAAC,KAAD,CAAA,SAAK,CAAU,CAAA,EACf,EAAC,KAAD,CAAA,SAAK,CAAU,CAAA,CACZ,CAAA,EAHK,CAGL,CACN,CACC,CAAA,EACJ,EAAC,KAAD,CAAA,SAAI,mBAAqB,CAAA,EAEzB,EAAC,KAAD,CAAI,UAAU,oCAAoC,KAAK,OACpD,SAAA,EAAK,MAAM,KAAK,EAAM,IACrB,EAAC,KAAD,CAAA,SAAA,CACE,EAAC,OAAD,CACE,cAAY,OACZ,UAAU,0CAET,SAAA,OAAO,EAAQ,CAAC,CAAC,CAAC,SAAS,EAAG,GAAG,CAC9B,CAAA,EACN,EAAC,OAAD,CAAA,SAAO,CAAW,CAAA,CAChB,CAAA,EARK,CAQL,CACL,CACC,CAAA,CACD,CACA,CAAA,CAAA,CACJ,CAAA,CAAA,GACE,CAAA,CAEb"}
|
|
1
|
+
{"version":3,"file":"auction-result2.js","names":[],"sources":["../src/auction-result.tsx"],"sourcesContent":["import type { LockerverseAuctionAdditionalCharge } from \"@lockerverse/sdk/auctions\";\nimport {\n ArrowRight,\n BadgeCheck,\n FileText,\n ShieldCheck,\n TimerReset,\n} from \"lucide-react\";\nimport { useEffect, useId, useRef } from \"react\";\nimport { AuctionImage } from \"./auction-image.tsx\";\nimport { formatMoney } from \"./format-money.ts\";\nimport type { LockerverseStyle, LockerverseTheme } from \"./theme.ts\";\n\ntype AuctionPurchaseDetails = {\n purchaseId: string;\n unitAmountCents: number;\n quantity: number;\n subtotalCents: number;\n additionalChargeCents?: number;\n additionalCharge?: LockerverseAuctionAdditionalCharge | null;\n serviceFeeCents: number;\n totalCents: number;\n};\n\nexport type LockerverseAuctionOutcome =\n | {\n kind: \"bid\";\n bidType?: \"fixed\" | \"maximum\";\n amountCents?: number;\n additionalCharge?: LockerverseAuctionAdditionalCharge | null;\n additionalChargeCents?: number;\n totalCents?: number;\n serviceFeeCents?: number;\n }\n | (AuctionPurchaseDetails & {\n kind: \"purchase\";\n /** Use only after the server confirms payment. Receipt amounts alone are not proof. */\n status: \"paid\";\n })\n | (AuctionPurchaseDetails & { kind: \"receipt\" });\n\nexport type LockerverseAuctionResultAction = {\n label: string;\n href?: string;\n onClick?: () => void;\n};\n\nexport type LockerverseAuctionResultProps = {\n outcome: LockerverseAuctionOutcome;\n itemName: string;\n imageUrl?: string | undefined;\n auctionName?: string | undefined;\n communityName?: string | undefined;\n closesAtLabel?: string | undefined;\n primaryAction?: LockerverseAuctionResultAction | undefined;\n secondaryAction?: LockerverseAuctionResultAction | undefined;\n className?: string | undefined;\n theme?: LockerverseTheme | undefined;\n style?: LockerverseStyle | undefined;\n /** Focus the result after an inline checkout completes. Defaults to false. */\n focusHeading?: boolean | undefined;\n};\n\nfunction ResultAction({\n action,\n secondary = false,\n}: {\n action: LockerverseAuctionResultAction;\n secondary?: boolean;\n}) {\n const className = `lockerverse-auction-result__action${secondary ? \" lockerverse-auction-result__action--secondary\" : \"\"}`;\n const content = (\n <>\n {action.label}\n {secondary ? null : <ArrowRight aria-hidden=\"true\" size={18} />}\n </>\n );\n return action.href ? (\n <a className={className} href={action.href} onClick={action.onClick}>\n {content}\n </a>\n ) : (\n <button className={className} onClick={action.onClick} type=\"button\">\n {content}\n </button>\n );\n}\n\nconst outcomeCopy = {\n bid: {\n assurance:\n \"A bid is not a purchase. Payment is collected only if you win at settlement.\",\n assuranceTitle: \"Bid authorization saved\",\n badge: \"Bid submitted\",\n description:\n \"Your bid and payment method are recorded. You have not been charged for this bid.\",\n next: \"Other bidders can still place bids until the item closes.\",\n nextTitle: \"Follow the auction\",\n receiptLabel: \"Bid summary\",\n steps: [\n \"Your bid is recorded. This does not confirm that you have won.\",\n \"Your saved payment method can be charged if you win at settlement.\",\n \"Watch your email for bid updates and return to the item to check its status.\",\n ],\n title: \"Bid received\",\n },\n purchase: {\n assurance: \"This receipt shows the amount paid for your purchase.\",\n assuranceTitle: \"Payment processed\",\n badge: \"Purchase confirmed\",\n description: \"Your payment is confirmed and your purchase is recorded.\",\n next: \"The community handles delivery or collection for this item.\",\n nextTitle: \"Next steps\",\n receiptLabel: \"Purchase receipt\",\n steps: [\n \"Your payment is complete and your purchase is recorded.\",\n \"The community can review your buyer and delivery details.\",\n \"Keep your receipt number. Contact the community if you need help with your order.\",\n ],\n title: \"Purchase complete\",\n },\n receipt: {\n assurance:\n \"The amounts below are the recorded purchase amounts, not proof of payment.\",\n assuranceTitle: \"Recorded purchase\",\n badge: \"Purchase details\",\n description: \"Payment status is not confirmed on this page.\",\n next: \"Contact the community if you need to confirm your payment or order status.\",\n nextTitle: \"Next steps\",\n receiptLabel: \"Purchase receipt\",\n steps: [\n \"These are the recorded purchase details. They do not confirm payment.\",\n \"Check your purchase confirmation for the payment result.\",\n \"Contact the community with your receipt number if you need help.\",\n ],\n title: \"Purchase details\",\n },\n};\n\nfunction getBidDetails(\n outcome: Extract<LockerverseAuctionOutcome, { kind: \"bid\" }>\n) {\n const details: [string, string][] = [];\n if (outcome.amountCents !== undefined) {\n details.push([\n outcome.bidType === \"maximum\" ? \"Maximum bid\" : \"Bid amount\",\n formatMoney(outcome.amountCents),\n ]);\n }\n if (outcome.additionalCharge) {\n details.push([\n outcome.additionalCharge.name,\n formatMoney(outcome.additionalChargeCents ?? 0),\n ]);\n }\n if (outcome.additionalCharge || outcome.bidType === \"maximum\") {\n if ((outcome.serviceFeeCents ?? 0) > 0) {\n details.push([\n outcome.bidType === \"maximum\" ? \"Maximum service fee\" : \"Service fee\",\n formatMoney(outcome.serviceFeeCents ?? 0),\n ]);\n }\n if (outcome.totalCents !== undefined) {\n details.push([\n outcome.bidType === \"maximum\"\n ? \"Maximum total if I win\"\n : \"Total if I win\",\n formatMoney(outcome.totalCents),\n ]);\n }\n }\n return details;\n}\n\nfunction getResultDetails({\n outcome,\n auctionName,\n communityName,\n closesAtLabel,\n}: LockerverseAuctionResultProps) {\n const details: [string, string][] = [];\n if (outcome.kind === \"bid\") {\n details.push(...getBidDetails(outcome));\n } else {\n details.push(\n [\"Unit price\", formatMoney(outcome.unitAmountCents)],\n [\"Quantity\", String(outcome.quantity)],\n [\"Subtotal\", formatMoney(outcome.subtotalCents)]\n );\n if (outcome.additionalCharge) {\n details.push([\n outcome.additionalCharge.name,\n formatMoney(outcome.additionalChargeCents ?? 0),\n ]);\n }\n if (outcome.serviceFeeCents > 0) {\n details.push([\"Service fee\", formatMoney(outcome.serviceFeeCents)]);\n }\n details.push(\n [\n outcome.kind === \"purchase\" ? \"Total paid\" : \"Total\",\n formatMoney(outcome.totalCents),\n ],\n [\"Receipt\", outcome.purchaseId]\n );\n }\n if (auctionName) {\n details.push([\"Auction\", auctionName]);\n }\n if (communityName) {\n details.push([\"Community\", communityName]);\n }\n if (closesAtLabel) {\n details.push([\"Closes\", closesAtLabel]);\n }\n return details;\n}\n\n/** Shared result view. Hosts must provide a verified outcome or a neutral receipt. */\nexport function LockerverseAuctionResult(props: LockerverseAuctionResultProps) {\n const {\n outcome,\n itemName,\n imageUrl,\n communityName,\n primaryAction,\n secondaryAction,\n className,\n theme = \"dark\",\n style,\n } = props;\n const titleId = useId();\n const headingRef = useRef<HTMLHeadingElement>(null);\n useEffect(() => {\n if (props.focusHeading) {\n headingRef.current?.focus();\n }\n }, [props.focusHeading]);\n const copy = outcomeCopy[outcome.kind];\n const StatusIcon = outcome.kind === \"receipt\" ? FileText : BadgeCheck;\n const AssuranceIcon = outcome.kind === \"receipt\" ? FileText : ShieldCheck;\n const details = getResultDetails(props);\n return (\n <section\n aria-labelledby={titleId}\n className={[\"lockerverse-auctions lockerverse-auction-result\", className]\n .filter(Boolean)\n .join(\" \")}\n data-lockerverse-theme={theme}\n style={style}\n >\n <div className=\"lockerverse-auction-result__layout\">\n <div className=\"lockerverse-auction-result__summary\">\n <span className=\"lockerverse-auction-result__badge\">\n <StatusIcon aria-hidden=\"true\" size={18} />\n {copy.badge}\n </span>\n {communityName ? (\n <p className=\"lockerverse-auction-result__community\">\n {communityName}\n </p>\n ) : null}\n <h2\n className=\"lockerverse-auction-result__title\"\n id={titleId}\n ref={headingRef}\n tabIndex={props.focusHeading ? -1 : undefined}\n >\n {copy.title} for {itemName}.\n </h2>\n <p className=\"lockerverse-auction-result__description\">\n {copy.description}\n {outcome.kind === \"bid\" && outcome.bidType === \"maximum\"\n ? \" We bid for you up to your private maximum. If you win, you pay the final winning price plus applicable fees. This submission does not confirm that you are leading.\"\n : \"\"}\n </p>\n <div className=\"lockerverse-auction-result__assurance\">\n <AssuranceIcon aria-hidden=\"true\" size={22} />\n <div>\n <strong>{copy.assuranceTitle}</strong>\n <p>{copy.assurance}</p>\n </div>\n </div>\n <div className=\"lockerverse-auction-result__assurance\">\n <TimerReset aria-hidden=\"true\" size={22} />\n <div>\n <strong>{copy.nextTitle}</strong>\n <p>{copy.next}</p>\n </div>\n </div>\n {primaryAction || secondaryAction ? (\n <div className=\"lockerverse-auction-result__actions\">\n {primaryAction ? <ResultAction action={primaryAction} /> : null}\n {secondaryAction ? (\n <ResultAction action={secondaryAction} secondary />\n ) : null}\n </div>\n ) : null}\n </div>\n <aside\n aria-label={copy.receiptLabel}\n className=\"lockerverse-auction-result__receipt\"\n >\n {imageUrl ? (\n <AuctionImage\n alt={itemName}\n className=\"lockerverse-auction-result__image\"\n height={300}\n maxWidth={960}\n sizes=\"100vw\"\n src={imageUrl}\n width={420}\n />\n ) : null}\n <div className=\"lockerverse-auction-result__receipt-body\">\n <p className=\"lockerverse-auction-result__eyebrow\">\n {copy.receiptLabel}\n </p>\n <h3 className=\"lockerverse-auction-result__receipt-title\">\n {itemName}\n </h3>\n <dl className=\"lockerverse-auction-result__details\">\n {details.map(([label, value]) => (\n <div key={label}>\n <dt>{label}</dt>\n <dd>{value}</dd>\n </div>\n ))}\n </dl>\n <h4>What happens next</h4>\n {/* biome-ignore lint/a11y/noRedundantRoles: Keep list semantics in Safari when visual markers replace list-style. */}\n <ol className=\"lockerverse-auction-result__steps\" role=\"list\">\n {copy.steps.map((step, index) => (\n <li key={step}>\n <span\n aria-hidden=\"true\"\n className=\"lockerverse-auction-result__step-number\"\n >\n {String(index + 1).padStart(2, \"0\")}\n </span>\n <span>{step}</span>\n </li>\n ))}\n </ol>\n </div>\n </aside>\n </div>\n </section>\n );\n}\n"],"mappings":"0SA+DA,SAAS,EAAa,CACpB,SACA,YAAY,IAIX,CACD,IAAM,EAAY,qCAAqC,EAAY,iDAAmD,KAChH,EACJ,EAAA,EAAA,CAAA,SAAA,CACG,EAAO,MACP,EAAY,KAAO,EAAC,EAAD,CAAY,cAAY,OAAO,KAAM,EAAK,CAAA,CAC9D,CAAA,CAAA,EAEJ,OAAO,EAAO,KACZ,EAAC,IAAD,CAAc,YAAW,KAAM,EAAO,KAAM,QAAS,EAAO,QACzD,SAAA,CACA,CAAA,EAEH,EAAC,SAAD,CAAmB,YAAW,QAAS,EAAO,QAAS,KAAK,SACzD,SAAA,CACK,CAAA,CAEZ,CAEA,MAAM,EAAc,CAClB,IAAK,CACH,UACE,+EACF,eAAgB,0BAChB,MAAO,gBACP,YACE,oFACF,KAAM,4DACN,UAAW,qBACX,aAAc,cACd,MAAO,CACL,iEACA,qEACA,8EACF,EACA,MAAO,cACT,EACA,SAAU,CACR,UAAW,wDACX,eAAgB,oBAChB,MAAO,qBACP,YAAa,2DACb,KAAM,8DACN,UAAW,aACX,aAAc,mBACd,MAAO,CACL,0DACA,4DACA,mFACF,EACA,MAAO,mBACT,EACA,QAAS,CACP,UACE,6EACF,eAAgB,oBAChB,MAAO,mBACP,YAAa,gDACb,KAAM,6EACN,UAAW,aACX,aAAc,mBACd,MAAO,CACL,wEACA,2DACA,kEACF,EACA,MAAO,kBACT,CACF,EAEA,SAAS,EACP,EACA,CACA,IAAM,EAA8B,CAAC,EA6BrC,OA5BI,EAAQ,cAAgB,IAAA,IAC1B,EAAQ,KAAK,CACX,EAAQ,UAAY,UAAY,cAAgB,aAChD,EAAY,EAAQ,WAAW,CACjC,CAAC,EAEC,EAAQ,kBACV,EAAQ,KAAK,CACX,EAAQ,iBA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ACL,CACC,CAAA,CACD,CACA,CAAA,CAAA,CACJ,CAAA,CAAA,GACE,CAAA,CAEb"}
|
package/guides/auctions.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Lockerverse auctions guide
|
|
2
2
|
|
|
3
|
-
Package: @lockerverse/react@0.2.
|
|
3
|
+
Package: @lockerverse/react@0.2.202
|
|
4
4
|
|
|
5
5
|
Generated from this release's maintained documentation. Do not edit this copy.
|
|
6
6
|
|
|
@@ -575,3 +575,22 @@ and live refresh. Check desktop and 390 by 844 layouts, unavailable states,
|
|
|
575
575
|
quantity and bid validation, gallery, and both result return controls. Use the
|
|
576
576
|
SDK simulated result preview. Open checkout to inspect saved fees and shipping,
|
|
577
577
|
but do not submit a live bid or payment.
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
## Fixed and maximum bids
|
|
581
|
+
|
|
582
|
+
Items with `supportsMaximumBids: true` offer **Fixed bid** and **Maximum bid**.
|
|
583
|
+
Fixed is the default. A fixed bid places the entered amount. A maximum bid lets
|
|
584
|
+
Lockerverse bid only as much as needed to lead, up to the private submitted limit.
|
|
585
|
+
The winner pays the final sale price plus applicable fees, not necessarily their
|
|
586
|
+
maximum. Checkout shows the maximum possible total before submission.
|
|
587
|
+
|
|
588
|
+
For custom UI, pass `bidType: "maximum"` and the maximum in integer USD cents as
|
|
589
|
+
`amount` to `client.createBid`. Omit `bidType`, or pass `"fixed"`, for a fixed bid.
|
|
590
|
+
Only offer maximum bidding when the current item response supports it. The public
|
|
591
|
+
`maxBidAmount` field remains the current public price; it is not a private limit.
|
|
592
|
+
|
|
593
|
+
Guest checkout requires no account or email verification. Each accepted submission
|
|
594
|
+
is independent and cannot be edited or canceled. A later submission can compete
|
|
595
|
+
with that guest's earlier maximum. The completion callback confirms submission
|
|
596
|
+
only, not the leading bid, final card-setup acceptance, a win, or payment.
|
package/guides/events.md
CHANGED
package/guides/integration.md
CHANGED
package/guides/signup.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lockerverse/react",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.202",
|
|
4
4
|
"description": "Tree-shakable React payment and signup UI for Lockerverse",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
"embla-carousel-react": "8.6.0",
|
|
137
137
|
"lucide-react": "0.536.0",
|
|
138
138
|
"valibot": "1.4.2",
|
|
139
|
-
"@lockerverse/sdk": "0.2.
|
|
139
|
+
"@lockerverse/sdk": "0.2.202"
|
|
140
140
|
},
|
|
141
141
|
"devDependencies": {
|
|
142
142
|
"@size-limit/file": "13.0.3",
|