@lockerverse/react 0.2.190-dev.1 → 0.2.191
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 -76
- package/dist/auction-catalog.css +8 -2
- 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 +7 -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/dist/theme.d.ts +2 -0
- package/dist/theme.d.ts.map +1 -1
- package/guides/auctions.md +23 -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
|
@@ -36,7 +36,25 @@ If it cannot be found, report that limit and use the baseline review below. Do n
|
|
|
36
36
|
claim that every historical migration was applied. Read this file even if the
|
|
37
37
|
version already matches: a previous upgrade may have missed host adoption steps.
|
|
38
38
|
|
|
39
|
-
## 0.2.
|
|
39
|
+
## 0.2.191 — auction item additional charges
|
|
40
|
+
|
|
41
|
+
- **Affected:** Core auction item data, purchase quotes, and React auction checkout.
|
|
42
|
+
- **Automatic:** optional `additionalCharge` charges the first-item amount plus the
|
|
43
|
+
additional-item amount for each further unit. Checkout and receipts show the configured charge
|
|
44
|
+
separately. Bids use one unit and add the first-unit charge only if the bid wins.
|
|
45
|
+
The bid amount and minimum increments remain unchanged. `maxQuantityPerOrder` limits each order; null inventory remains unlimited.
|
|
46
|
+
- **Required:** deploy the matching auction backend before enabling additional charges.
|
|
47
|
+
Upgrade Core and React together. Custom purchase forms must obtain `getPurchaseQuote`,
|
|
48
|
+
display the charge, and submit `expectedAdditionalChargeCents` with `expectedTotalCents`.
|
|
49
|
+
Custom bid forms must disclose the first-unit charge and submit the same expected
|
|
50
|
+
charge and total fields. Winner settlement uses the charge saved with the bid.
|
|
51
|
+
Service fees continue to use merchandise subtotal only. Existing items need no edits.
|
|
52
|
+
- **Optional:** set `--lockerverse-auction-catalog-columns` on the auction style to
|
|
53
|
+
choose desktop grid columns. Mobile retains one column.
|
|
54
|
+
- **Check:** compare one, two, and maximum quantity totals with the server quote,
|
|
55
|
+
verify the per-order limit, and inspect the named charge row before payment.
|
|
56
|
+
|
|
57
|
+
## 0.2.189 — widget load recovery and Sentry releases
|
|
40
58
|
|
|
41
59
|
- **Affected:** Core widget loading and SDK failure reporting.
|
|
42
60
|
- **Automatic:** a widget GET retries once after a network failure or request
|
|
@@ -63,7 +81,6 @@ version already matches: a previous upgrade may have missed host adoption steps.
|
|
|
63
81
|
- **Check:** select one, two, and the maximum allowed trigger quantity. Confirm the
|
|
64
82
|
local summary and server quote agree; removing all trigger items removes shipping.
|
|
65
83
|
|
|
66
|
-
|
|
67
84
|
## 0.2.184 — single focus boundary for form fields
|
|
68
85
|
|
|
69
86
|
- **Affected:** React form controls and the shared phone field in payment and signup.
|
|
@@ -83,7 +100,7 @@ Widgets can now use a private contact list for email eligibility, a fixed amount
|
|
|
83
100
|
Required shipping appears in `catalog.widget.requiredShipping`. Do not offer this product as a separate shopper choice. The SDK adds its quantity once when a trigger product is selected; the server also enforces this rule. Render authoritative quote line items and totals, including shipping. The built-in launcher and payment summary handle this automatically.
|
|
84
101
|
|
|
85
102
|
|
|
86
|
-
## 0.2.
|
|
103
|
+
## 0.2.177 — Secure checkout loading recovery
|
|
87
104
|
|
|
88
105
|
- **Affected:** React payment widget Stripe fields.
|
|
89
106
|
- **Automatic:** failed field or script loads show a reload action. Fields that
|
|
@@ -95,22 +112,8 @@ Required shipping appears in `catalog.widget.requiredShipping`. Do not offer thi
|
|
|
95
112
|
- Reload is an explicit customer action and can clear unsaved form entries.
|
|
96
113
|
Saved payment recovery remains in session storage.
|
|
97
114
|
|
|
98
|
-
## 0.2.175 — Match Stripe Elements payment method configuration
|
|
99
|
-
|
|
100
|
-
- **Affected:** Core checkout submission and React payment widgets.
|
|
101
|
-
- **Automatic:** React configures explicit card, Link, and community-enabled bank
|
|
102
|
-
methods in Stripe Elements and marks the confirmation request with
|
|
103
|
-
`paymentMethodConfiguration: "explicit"`. This matches the backend's Stripe
|
|
104
|
-
PaymentIntent configuration.
|
|
105
|
-
- **Required:** deploy the backend that supports this optional marker before
|
|
106
|
-
upgrading React. Keep Core and React matched. Existing Core-only callers omit
|
|
107
|
-
the marker and retain automatic payment methods. Custom Elements integrations
|
|
108
|
-
must send the marker only when they use the explicit method list.
|
|
109
|
-
- **Check:** submit card and bank payments through Stripe Elements in test mode,
|
|
110
|
-
including recurring checkout. Confirm pending recovery and settlement.
|
|
111
|
-
|
|
112
115
|
|
|
113
|
-
## 0.2.
|
|
116
|
+
## 0.2.175 — Match Stripe Elements payment method configuration
|
|
114
117
|
|
|
115
118
|
- **Affected:** Core checkout submission and React payment widgets.
|
|
116
119
|
- **Automatic:** React configures explicit card, Link, and community-enabled bank
|
|
@@ -185,39 +188,7 @@ Required shipping appears in `catalog.widget.requiredShipping`. Do not offer thi
|
|
|
185
188
|
verify a changed selection cannot discard it. Check both paid and free order
|
|
186
189
|
confirmation panels. Do not submit a live transaction for this check.
|
|
187
190
|
|
|
188
|
-
## 0.2.
|
|
189
|
-
|
|
190
|
-
- **Affected:** React payment widgets with unresolved payments.
|
|
191
|
-
- **Automatic behavior:** the existing pending-payment screen now offers Check
|
|
192
|
-
payment status. It checks the saved payment reference and cannot submit a new
|
|
193
|
-
payment. The control is disabled while the check runs.
|
|
194
|
-
- **Required host changes:** none. Update Core and React together.
|
|
195
|
-
- **Verification:** complete a test bank payment, return to its pending checkout,
|
|
196
|
-
and check its status. Confirm completion clears recovery storage.
|
|
197
|
-
|
|
198
|
-
## 0.2.171-dev.1 — SDK payment recovery and completion UI
|
|
199
|
-
|
|
200
|
-
- **Affected:** React payment widgets and custom hosts that persist payment recovery.
|
|
201
|
-
- **Optional adoption:** pass `recoveryStorageKey` to `LockerversePayment` to let
|
|
202
|
-
the SDK save and restore the pending payment in session storage. Use a stable
|
|
203
|
-
key scoped to the API environment, community, and widget. Remove the host's
|
|
204
|
-
storage code and recovery-driven component key. Do not combine automatic
|
|
205
|
-
persistence with a second host persistence writer.
|
|
206
|
-
- **Compatibility:** the SDK reads the hosted Next app's existing version 1
|
|
207
|
-
records when the same key is used. It writes version 2 records with widget
|
|
208
|
-
identity. It checks widget and selection identity before recovery and keeps
|
|
209
|
-
an unresolved record if those details differ. Recovery uses the saved connected
|
|
210
|
-
account even if current payment routing has changed. Storage is read after hydration,
|
|
211
|
-
before the payable form mounts. No contact details or payment tokens are saved.
|
|
212
|
-
- **Optional UI adoption:** use `completionView="summary"` for the SDK confirmation
|
|
213
|
-
panel and remove the host's duplicate success panel. Completion callbacks still
|
|
214
|
-
run. The default inline message and explicit `resumePayment` integrations remain
|
|
215
|
-
supported. Auctions and legacy custom checkout forms are unchanged.
|
|
216
|
-
- **Check:** reload a pending checkout and confirm the existing payment is checked;
|
|
217
|
-
verify a changed selection cannot discard it. Check both paid and free order
|
|
218
|
-
confirmation panels. Do not submit a live transaction for this check.
|
|
219
|
-
|
|
220
|
-
## 0.2.169-dev.1 — six-month payment widgets
|
|
191
|
+
## 0.2.170 — six-month payment widgets
|
|
221
192
|
|
|
222
193
|
Affected: @lockerverse/sdk checkout and @lockerverse/react payment widgets.
|
|
223
194
|
|
|
@@ -233,31 +204,6 @@ Affected: @lockerverse/sdk checkout and @lockerverse/react payment widgets.
|
|
|
233
204
|
submission. Do not submit a live payment for an integration check.
|
|
234
205
|
|
|
235
206
|
|
|
236
|
-
## 0.2.168-dev.1 — bank authorization terms
|
|
237
|
-
|
|
238
|
-
- **Affected:** React payment widgets with ACH enabled.
|
|
239
|
-
- **Automatic:** Stripe displays its bank authorization terms before payment confirmation.
|
|
240
|
-
- **Adoption:** update the matching SDK/React development pair. No prop changes are required.
|
|
241
|
-
- **Check:** confirm that the bank authorization text is visible when a bank account is selected.
|
|
242
|
-
|
|
243
|
-
## 0.2.167-dev.1 — widget ACH and subscription payment recovery
|
|
244
|
-
|
|
245
|
-
- **Affected:** Core checkout data and React payment widgets.
|
|
246
|
-
- **Automatic:** bank payment availability follows the organization default and
|
|
247
|
-
community override returned by the backend. Missing policy remains disabled.
|
|
248
|
-
Pending payments keep their existing payment reference. A failed subscription
|
|
249
|
-
invoice can return `action_required` with `requiresAction: false` and `retryUrl`;
|
|
250
|
-
React shows a link to pay the same invoice instead of creating a second subscription.
|
|
251
|
-
- **Required for custom payment UI:** preserve the reference for pending and
|
|
252
|
-
action-required results. Handle `retryUrl` by opening that invoice, and recover
|
|
253
|
-
status before permitting a new checkout. Do not treat submission as settlement.
|
|
254
|
-
- **Adoption:** deploy the matching backend policy and recovery contract before
|
|
255
|
-
enabling ACH. Existing React hosts need no component prop changes. Keep Core and
|
|
256
|
-
React versions matched when upgrading. Auction payment methods are unchanged.
|
|
257
|
-
- **Check:** verify disabled/inherited/enabled bank visibility and pending, bank
|
|
258
|
-
verification, invoice retry, success, and terminal failure in Stripe test mode.
|
|
259
|
-
Do not create a live transaction for this check.
|
|
260
|
-
|
|
261
207
|
## 0.2.166 — single dropdown arrow
|
|
262
208
|
|
|
263
209
|
- **Affected:** native single-select custom fields in React signup and payment forms.
|
package/dist/auction-catalog.css
CHANGED
|
@@ -317,12 +317,18 @@
|
|
|
317
317
|
}
|
|
318
318
|
@container (min-width: 720px) {
|
|
319
319
|
.lockerverse-auctions__catalog-grid {
|
|
320
|
-
grid-template-columns: repeat(
|
|
320
|
+
grid-template-columns: repeat(
|
|
321
|
+
var(--lockerverse-auction-catalog-columns, 2),
|
|
322
|
+
minmax(0, 1fr)
|
|
323
|
+
);
|
|
321
324
|
}
|
|
322
325
|
}
|
|
323
326
|
@container (min-width: 1232px) {
|
|
324
327
|
.lockerverse-auctions__catalog-grid {
|
|
325
|
-
grid-template-columns: repeat(
|
|
328
|
+
grid-template-columns: repeat(
|
|
329
|
+
var(--lockerverse-auction-catalog-columns, 3),
|
|
330
|
+
minmax(0, 1fr)
|
|
331
|
+
);
|
|
326
332
|
}
|
|
327
333
|
}
|
|
328
334
|
@container (max-width: 500px) {
|
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:1280,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){return q.test(e)&&Number.isSafeInteger(Number(e)*t)?`Total: ${n(Number(e)*t)}`:`Enter a whole-number 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.buyNowPriceAmount??0):`Enter a whole-dollar bid of at least ${n(v*100)}. Bid increment: ${n(i.bidIncrementAmount??100)}.`}),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(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 ne({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 re(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 ie(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(re,{...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(ne,{buyNow:_.saleMode===`buy_now`}):null,L?M(`p`,{className:`lockerverse-auctions__notice`,role:`alert`,children:L}):null,F&&v?M(te,{...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 ae(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(ie,{...e})})}export{ae 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:1280,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};
|
|
2
2
|
//# sourceMappingURL=auction-item.js.map
|