@lockerverse/react 0.2.252 → 0.2.253-dev.1

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.
Files changed (34) hide show
  1. package/MIGRATIONS.md +90 -11
  2. package/dist/auction-checkout-view.js +1 -1
  3. package/dist/auction-checkout-view.js.map +1 -1
  4. package/dist/auction-item.d.ts.map +1 -1
  5. package/dist/auction-item.js +1 -1
  6. package/dist/auction-item.js.map +1 -1
  7. package/dist/auction-payment-view.js +1 -1
  8. package/dist/auction-payment-view.js.map +1 -1
  9. package/dist/booking-payment.d.ts +0 -6
  10. package/dist/booking-payment.d.ts.map +1 -1
  11. package/dist/booking-payment.js +1 -1
  12. package/dist/booking-payment.js.map +1 -1
  13. package/dist/embed/chunks/auction-payment-view-EHVUMV2E.js +9 -0
  14. package/dist/embed/chunks/chunk-N3EKRKUJ.js +2 -0
  15. package/dist/embed/chunks/chunk-Z63EAJ4B.js +1 -0
  16. package/dist/embed/chunks/{chunk-UBSAGJVH.js → chunk-Z7VB3RC6.js} +2 -2
  17. package/dist/embed/chunks/lockerverse-auction-item-LIULZZDW.js +2 -0
  18. package/dist/embed/lockerverse.js +1 -1
  19. package/dist/embed/runtime.js +2 -2
  20. package/guides/auctions.md +1 -1
  21. package/guides/bookings.md +1 -41
  22. package/guides/browser-embed.md +1 -1
  23. package/guides/events.md +1 -1
  24. package/guides/integration.md +1 -1
  25. package/guides/payment-widgets.md +1 -1
  26. package/guides/signup.md +1 -1
  27. package/package.json +2 -2
  28. package/dist/embed/chunks/auction-payment-view-MVQGNAGH.js +0 -9
  29. package/dist/embed/chunks/chunk-DFKS7K2W.js +0 -2
  30. package/dist/embed/chunks/chunk-L2IGU4SE.js +0 -1
  31. package/dist/embed/chunks/lockerverse-auction-item-XPNH4J4V.js +0 -2
  32. /package/dist/embed/chunks/{chunk-DFKS7K2W.js.LEGAL.txt → chunk-N3EKRKUJ.js.LEGAL.txt} +0 -0
  33. /package/dist/embed/chunks/{chunk-UBSAGJVH.js.LEGAL.txt → chunk-Z7VB3RC6.js.LEGAL.txt} +0 -0
  34. /package/dist/embed/chunks/{lockerverse-auction-item-XPNH4J4V.js.LEGAL.txt → lockerverse-auction-item-LIULZZDW.js.LEGAL.txt} +0 -0
package/MIGRATIONS.md CHANGED
@@ -4,6 +4,19 @@ This file ships in both @lockerverse/sdk and @lockerverse/react. Use the copy in
4
4
  the target installed release. This is an agent-run procedure, not an install
5
5
  script. Installing a package does not edit host code or guarantee these steps ran.
6
6
 
7
+ ## Unreleased — returning bidders keep their details
8
+
9
+ - **Affected:** `LockerverseAuctionItem` bid and Buy Now checkout, in React and
10
+ in the browser embed.
11
+ - **Automatic:** after an accepted bid or a paid purchase, the checkout saves
12
+ the bidder's email, phone, billing name and address, and delivery address in
13
+ the browser's local storage (`lockerverse:auction-bidder`). The next checkout
14
+ on the same site fills these fields. The card is never saved; the bidder
15
+ enters it again. Bidders can edit any filled field.
16
+ - **Host adoption:** none. Script hosts update the pinned script URL to adopt.
17
+ - **Check:** place a test bid on a dev auction, return to the item, and open
18
+ the checkout again. Email, phone and billing address are filled.
19
+
7
20
  ## Unreleased — classic-script embed loader
8
21
 
9
22
  - **Affected:** the optional browser auction embed. A new file,
@@ -100,12 +113,6 @@ The standard auction catalog now aligns card bottoms and bid buttons within each
100
113
  - **Automatic recovery:** configuration failure no longer prevents recovery of a
101
114
  saved attempt. Bank verification can continue for an existing payment even
102
115
  while the owner's current setup prevents new payments.
103
- - **Optional, one-step checkout:** booking configuration now has `payment`
104
- (`publishableKey`, `stripeAccountId`) while it is ready, and
105
- `LockerverseBookingPayment` accepts `beforeConfirm`. Show the contact fields and
106
- card entry on one screen, and create the attempt with the customer in
107
- `beforeConfirm` (see the bookings guide). Hosts that keep a separate contact
108
- step need no change.
109
116
  - **Check:** a new business uses its own booking and payment account; customer
110
117
  contact details reach the saved booking; a test card that needs authentication
111
118
  completes or recovers without a second payment. Keep `clientSecret` private.
@@ -442,7 +449,7 @@ No host prop change is required.
442
449
  - **Check:** inspect a wide and a tall photo on desktop and mobile. Confirm all
443
450
  edges remain visible in the item gallery, thumbnails, and full-screen viewer.
444
451
 
445
- ## 0.2.191 — auction item additional charges
452
+ ## 0.2.192-dev.1 — auction item additional charges
446
453
 
447
454
  - **Affected:** Core auction item data, purchase quotes, and React auction checkout.
448
455
  - **Automatic:** optional `additionalCharge` charges the first-item amount plus the
@@ -460,7 +467,7 @@ No host prop change is required.
460
467
  - **Check:** compare one, two, and maximum quantity totals with the server quote,
461
468
  verify the per-order limit, and inspect the named charge row before payment.
462
469
 
463
- ## 0.2.189 — widget load recovery and Sentry releases
470
+ ## 0.2.190-dev.1 — widget load recovery and Sentry releases
464
471
 
465
472
  - **Affected:** Core widget loading and SDK failure reporting.
466
473
  - **Automatic:** a widget GET retries once after a network failure or request
@@ -487,6 +494,7 @@ No host prop change is required.
487
494
  - **Check:** select one, two, and the maximum allowed trigger quantity. Confirm the
488
495
  local summary and server quote agree; removing all trigger items removes shipping.
489
496
 
497
+
490
498
  ## 0.2.184 — single focus boundary for form fields
491
499
 
492
500
  - **Affected:** React form controls and the shared phone field in payment and signup.
@@ -506,7 +514,7 @@ Widgets can now use a private contact list for email eligibility, a fixed amount
506
514
  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.
507
515
 
508
516
 
509
- ## 0.2.177 — Secure checkout loading recovery
517
+ ## 0.2.176-dev.1 — Secure checkout loading recovery
510
518
 
511
519
  - **Affected:** React payment widget Stripe fields.
512
520
  - **Automatic:** failed field or script loads show a reload action. Fields that
@@ -518,9 +526,23 @@ Required shipping appears in `catalog.widget.requiredShipping`. Do not offer thi
518
526
  - Reload is an explicit customer action and can clear unsaved form entries.
519
527
  Saved payment recovery remains in session storage.
520
528
 
521
-
522
529
  ## 0.2.175 — Match Stripe Elements payment method configuration
523
530
 
531
+ - **Affected:** Core checkout submission and React payment widgets.
532
+ - **Automatic:** React configures explicit card, Link, and community-enabled bank
533
+ methods in Stripe Elements and marks the confirmation request with
534
+ `paymentMethodConfiguration: "explicit"`. This matches the backend's Stripe
535
+ PaymentIntent configuration.
536
+ - **Required:** deploy the backend that supports this optional marker before
537
+ upgrading React. Keep Core and React matched. Existing Core-only callers omit
538
+ the marker and retain automatic payment methods. Custom Elements integrations
539
+ must send the marker only when they use the explicit method list.
540
+ - **Check:** submit card and bank payments through Stripe Elements in test mode,
541
+ including recurring checkout. Confirm pending recovery and settlement.
542
+
543
+
544
+ ## 0.2.174-dev.1 — Match Stripe Elements payment method configuration
545
+
524
546
  - **Affected:** Core checkout submission and React payment widgets.
525
547
  - **Automatic:** React configures explicit card, Link, and community-enabled bank
526
548
  methods in Stripe Elements and marks the confirmation request with
@@ -594,7 +616,39 @@ Required shipping appears in `catalog.widget.requiredShipping`. Do not offer thi
594
616
  verify a changed selection cannot discard it. Check both paid and free order
595
617
  confirmation panels. Do not submit a live transaction for this check.
596
618
 
597
- ## 0.2.170 — six-month payment widgets
619
+ ## 0.2.172-dev.1 — Check pending payment status
620
+
621
+ - **Affected:** React payment widgets with unresolved payments.
622
+ - **Automatic behavior:** the existing pending-payment screen now offers Check
623
+ payment status. It checks the saved payment reference and cannot submit a new
624
+ payment. The control is disabled while the check runs.
625
+ - **Required host changes:** none. Update Core and React together.
626
+ - **Verification:** complete a test bank payment, return to its pending checkout,
627
+ and check its status. Confirm completion clears recovery storage.
628
+
629
+ ## 0.2.171-dev.1 — SDK payment recovery and completion UI
630
+
631
+ - **Affected:** React payment widgets and custom hosts that persist payment recovery.
632
+ - **Optional adoption:** pass `recoveryStorageKey` to `LockerversePayment` to let
633
+ the SDK save and restore the pending payment in session storage. Use a stable
634
+ key scoped to the API environment, community, and widget. Remove the host's
635
+ storage code and recovery-driven component key. Do not combine automatic
636
+ persistence with a second host persistence writer.
637
+ - **Compatibility:** the SDK reads the hosted Next app's existing version 1
638
+ records when the same key is used. It writes version 2 records with widget
639
+ identity. It checks widget and selection identity before recovery and keeps
640
+ an unresolved record if those details differ. Recovery uses the saved connected
641
+ account even if current payment routing has changed. Storage is read after hydration,
642
+ before the payable form mounts. No contact details or payment tokens are saved.
643
+ - **Optional UI adoption:** use `completionView="summary"` for the SDK confirmation
644
+ panel and remove the host's duplicate success panel. Completion callbacks still
645
+ run. The default inline message and explicit `resumePayment` integrations remain
646
+ supported. Auctions and legacy custom checkout forms are unchanged.
647
+ - **Check:** reload a pending checkout and confirm the existing payment is checked;
648
+ verify a changed selection cannot discard it. Check both paid and free order
649
+ confirmation panels. Do not submit a live transaction for this check.
650
+
651
+ ## 0.2.169-dev.1 — six-month payment widgets
598
652
 
599
653
  Affected: @lockerverse/sdk checkout and @lockerverse/react payment widgets.
600
654
 
@@ -610,6 +664,31 @@ Affected: @lockerverse/sdk checkout and @lockerverse/react payment widgets.
610
664
  submission. Do not submit a live payment for an integration check.
611
665
 
612
666
 
667
+ ## 0.2.168-dev.1 — bank authorization terms
668
+
669
+ - **Affected:** React payment widgets with ACH enabled.
670
+ - **Automatic:** Stripe displays its bank authorization terms before payment confirmation.
671
+ - **Adoption:** update the matching SDK/React development pair. No prop changes are required.
672
+ - **Check:** confirm that the bank authorization text is visible when a bank account is selected.
673
+
674
+ ## 0.2.167-dev.1 — widget ACH and subscription payment recovery
675
+
676
+ - **Affected:** Core checkout data and React payment widgets.
677
+ - **Automatic:** bank payment availability follows the organization default and
678
+ community override returned by the backend. Missing policy remains disabled.
679
+ Pending payments keep their existing payment reference. A failed subscription
680
+ invoice can return `action_required` with `requiresAction: false` and `retryUrl`;
681
+ React shows a link to pay the same invoice instead of creating a second subscription.
682
+ - **Required for custom payment UI:** preserve the reference for pending and
683
+ action-required results. Handle `retryUrl` by opening that invoice, and recover
684
+ status before permitting a new checkout. Do not treat submission as settlement.
685
+ - **Adoption:** deploy the matching backend policy and recovery contract before
686
+ enabling ACH. Existing React hosts need no component prop changes. Keep Core and
687
+ React versions matched when upgrading. Auction payment methods are unchanged.
688
+ - **Check:** verify disabled/inherited/enabled bank visibility and pending, bank
689
+ verification, invoice retry, success, and terminal failure in Stripe test mode.
690
+ Do not create a live transaction for this check.
691
+
613
692
  ## 0.2.166 — single dropdown arrow
614
693
 
615
694
  - **Affected:** native single-select custom fields in React signup and payment forms.
@@ -1,2 +1,2 @@
1
- import{a as e,i as t}from"./use-auction-boundary.js";import{d as n,p as r,t as i,u as a}from"./phone-field.js";import{ArrowRight as o,ChevronLeft as s}from"lucide-react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{calculateLockerverseAuctionPricing as d,getLockerverseAuctionMinimumBid as f}from"@lockerverse/sdk/auctions";function p(e,t,n){let r=d(e,t.saleMode===`buy_now`?(t.buyNowPriceAmount??0)*n.quantity:n.amount,n.includeServiceFee,t.additionalCharge?t.additionalCharge.firstUnitAmountCents+t.additionalCharge.additionalUnitAmountCents*(t.saleMode===`buy_now`?n.quantity-1:0):0);return t.additionalCharge?{...r,additionalCharge:t.additionalCharge}:r}function m(t,n,r){if(e(t,n)!==`active`)return`This item is not accepting bids or purchases.`;if(r.bidType===`maximum`&&!n.supportsMaximumBids)return`Maximum bidding is not available for this item. Choose a fixed bid.`;if(n.saleMode===`hybrid`)return`This item type is not supported for checkout.`;if(n.saleMode===`buy_now`){if(n.isSoldOut||n.availableQuantity===0)return`This item is sold out.`;if(r.quantity>(n.maxQuantityPerOrder??1/0))return`You can buy up to ${n.maxQuantityPerOrder} items per order.`;if(!(n.buyNowPriceAmount&&Number.isSafeInteger(r.quantity))||r.quantity<1||n.availableQuantity!==null&&r.quantity>n.availableQuantity)return`Select an available quantity.`}else if(!Number.isSafeInteger(r.amount)||r.amount%100!=0||r.amount<f(n))return`Enter a whole-dollar bid at or above the minimum bid.`;return null}function h(e,t){return e?.name===t?.name&&e?.category===t?.category&&e?.firstUnitAmountCents===t?.firstUnitAmountCents&&e?.additionalUnitAmountCents===t?.additionalUnitAmountCents}function g(e,t,n,r,i){return e.payment?.publishableKey!==t.payment?.publishableKey||e.payment?.connectedAccountId!==t.payment?.connectedAccountId||e.serviceFeeEnabled!==t.serviceFeeEnabled||n.saleMode!==r.saleMode||!h(n.additionalCharge,r.additionalCharge)||n.collectShippingAddress!==r.collectShippingAddress||JSON.stringify(p(e,n,i))!==JSON.stringify(p(t,r,i))}function _(e){return{expectedAdditionalChargeCents:e.additionalChargeCents??0,expectedServiceFeeCents:e.serviceFeeCents,expectedSubtotalCents:e.subtotalCents,expectedTotalCents:e.totalCents}}async function v({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 y(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.`)}function b(e){let{isPurchase:t,item:d,id:f}=e;return u(`form`,{className:`lockerverse-auctions__checkout`,noValidate:!0,onSubmit:e.onSubmit,children:[l(`div`,{className:`lockerverse-auctions__checkout-header`,children:u(`div`,{className:`lockerverse-auctions__checkout-navigation`,children:[l(`button`,{"aria-label":`Back`,className:`lockerverse-auctions__checkout-back`,disabled:!e.onBack,onClick:e.onBack,type:`button`,children:l(s,{"aria-hidden":`true`,size:20})}),l(`h2`,{children:t?`Review your purchase`:`Confirm your bid`}),l(`p`,{className:`lockerverse-auctions__checkout-eyebrow`,children:`Step 2 of 2`})]})}),u(`div`,{className:`lockerverse-auctions__checkout-body`,children:[e.showFields&&u(`fieldset`,{disabled:e.locked,children:[u(`div`,{className:`lockerverse-auctions__checkout-contact`,children:[l(n,{error:e.contactErrors.email,id:`${f}-email`,label:`Email`,name:`email`,onChange:t=>e.onEmailChange(t.target.value),required:!0,value:e.email}),l(r,{error:e.contactErrors.phone,id:`${f}-phone`,label:`Phone`,children:l(i,{country:e.phoneCountry,error:e.contactErrors.phone,errorId:`${f}-phone-error`,id:`${f}-phone`,name:`phone`,onChange:e.onPhoneChange,required:!0,value:e.phone})})]}),u(`section`,{"aria-label":`Payment Information`,className:`lockerverse-auctions__checkout-section`,children:[l(`h3`,{children:`Payment method`}),e.paymentFields]}),u(`section`,{"aria-label":`Billing Details`,className:`lockerverse-auctions__checkout-section`,children:[l(`h3`,{children:`Billing Details`}),e.billingFields]}),d.collectShippingAddress&&u(`section`,{"aria-label":`Delivery Details`,className:`lockerverse-auctions__checkout-section`,children:[u(`label`,{className:`lockerverse-auctions__checkout-checkbox lockerverse-auctions__checkout-delivery`,htmlFor:`${f}-delivery-same-as-billing`,children:[l(a,{checked:e.sameAsBilling,id:`${f}-delivery-same-as-billing`,onChange:t=>e.onSameAsBillingChange(t.target.checked)}),l(`span`,{children:l(`strong`,{children:`Use billing address for delivery`})})]}),!e.sameAsBilling&&u(c,{children:[l(`h3`,{children:`Delivery Address`}),e.shippingFields]})]}),l(x,{...e})]}),e.message&&l(`p`,{"aria-live":`polite`,className:`lockerverse-auctions__notice`,role:`status`,children:e.message}),!e.isTerminal&&u(`div`,{className:`lockerverse-auctions__checkout-footer`,children:[l(`p`,{children:t?`By placing this order, you authorize this payment.`:`By placing your bid, you agree to save this payment method and charge it if you win.`}),u(`button`,{className:`lockerverse-auctions__button lockerverse-auctions__checkout-submit`,disabled:e.submitDisabled,type:`submit`,children:[e.buttonText,l(o,{"aria-hidden":`true`,size:16})]})]})]})]})}function x(e){let{pricing:n,isPurchase:r,isMaximumBid:i}=e,o=S(r,i);return u(`section`,{"aria-label":`Order amounts`,className:`lockerverse-auctions__checkout-section lockerverse-auctions__amounts`,children:[u(`p`,{children:[u(`span`,{children:[o.amount,r?` (×${e.quantity})`:``]}),l(`span`,{children:t(n.subtotalCents)})]}),n.additionalCharge&&u(`p`,{children:[l(`span`,{children:n.additionalCharge.name}),l(`span`,{children:t(n.additionalChargeCents??0)})]}),e.serviceFeeEnabled&&e.onIncludeServiceFeeChange&&u(`label`,{className:`lockerverse-auctions__checkout-checkbox`,htmlFor:`${e.id}-service-fee`,children:[l(a,{checked:e.includeServiceFee,id:`${e.id}-service-fee`,onChange:t=>e.onIncludeServiceFeeChange?.(t.target.checked)}),l(`span`,{children:`Cover processing fees`}),l(`span`,{children:t(e.serviceFeeCents)})]}),u(`p`,{"aria-live":`polite`,className:`lockerverse-auctions__total`,children:[l(`strong`,{children:o.total}),l(`strong`,{children:t(n.totalCents)})]}),i&&l(`small`,{children:`Your maximum stays private. If you win, you pay the final price plus applicable fees and charges.`})]})}function S(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`}}export{m as a,h as c,v as i,_ as n,p as o,y as r,g as s,b as t};
1
+ import{a as e,i as t}from"./use-auction-boundary.js";import{d as n,p as r,t as i,u as a}from"./phone-field.js";import{ArrowRight as o,ChevronLeft as s}from"lucide-react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{calculateLockerverseAuctionPricing as d,getLockerverseAuctionMinimumBid as f}from"@lockerverse/sdk/auctions";import{boolean as p,literal as m,nullable as h,object as g,optional as _,safeParse as v,string as y}from"valibot";const b=`lockerverse:auction-bidder`,x=h(g({address:g({city:y(),country:y(),line1:y(),line2:h(y()),postal_code:y(),state:y()}),name:y()})),S=g({billing:x,email:y(),phone:y(),sameAsBilling:_(p(),!0),shipping:x,version:m(1)});function C(){try{let e=window.localStorage.getItem(b);if(!e)return null;let t=v(S,JSON.parse(e));if(!t.success)return null;let{version:n,...r}=t.output;return r}catch{return null}}function w(e){if(!e?.complete)return null;let{address:t,name:n}=e.value;return{address:{city:t.city,country:t.country,line1:t.line1,line2:t.line2,postal_code:t.postal_code,state:t.state},name:n}}function T(e,t){let n={mode:e};return t&&(n.defaultValues=t),n}function E({contact:e,billing:t,shipping:n,sameAsBilling:r,collectShippingAddress:i,previous:a}){let o=i&&!r?w(n):null;D({billing:w(t)??a?.billing??null,email:e.email,phone:e.phone,sameAsBilling:r,shipping:o??a?.shipping??null})}function D(e){try{window.localStorage.setItem(b,JSON.stringify({...e,version:1}))}catch{}}function O(e,t,n){let r=d(e,t.saleMode===`buy_now`?(t.buyNowPriceAmount??0)*n.quantity:n.amount,n.includeServiceFee,t.additionalCharge?t.additionalCharge.firstUnitAmountCents+t.additionalCharge.additionalUnitAmountCents*(t.saleMode===`buy_now`?n.quantity-1:0):0);return t.additionalCharge?{...r,additionalCharge:t.additionalCharge}:r}function k(t,n,r){if(e(t,n)!==`active`)return`This item is not accepting bids or purchases.`;if(r.bidType===`maximum`&&!n.supportsMaximumBids)return`Maximum bidding is not available for this item. Choose a fixed bid.`;if(n.saleMode===`hybrid`)return`This item type is not supported for checkout.`;if(n.saleMode===`buy_now`){if(n.isSoldOut||n.availableQuantity===0)return`This item is sold out.`;if(r.quantity>(n.maxQuantityPerOrder??1/0))return`You can buy up to ${n.maxQuantityPerOrder} items per order.`;if(!(n.buyNowPriceAmount&&Number.isSafeInteger(r.quantity))||r.quantity<1||n.availableQuantity!==null&&r.quantity>n.availableQuantity)return`Select an available quantity.`}else if(!Number.isSafeInteger(r.amount)||r.amount%100!=0||r.amount<f(n))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 j(e,t,n,r,i){return e.payment?.publishableKey!==t.payment?.publishableKey||e.payment?.connectedAccountId!==t.payment?.connectedAccountId||e.serviceFeeEnabled!==t.serviceFeeEnabled||n.saleMode!==r.saleMode||!A(n.additionalCharge,r.additionalCharge)||n.collectShippingAddress!==r.collectShippingAddress||JSON.stringify(O(e,n,i))!==JSON.stringify(O(t,r,i))}function M(e){return{expectedAdditionalChargeCents:e.additionalChargeCents??0,expectedServiceFeeCents:e.serviceFeeCents,expectedSubtotalCents:e.subtotalCents,expectedTotalCents:e.totalCents}}async function N({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 P(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.`)}function F(e){let{isPurchase:t,item:d,id:f}=e;return u(`form`,{className:`lockerverse-auctions__checkout`,noValidate:!0,onSubmit:e.onSubmit,children:[l(`div`,{className:`lockerverse-auctions__checkout-header`,children:u(`div`,{className:`lockerverse-auctions__checkout-navigation`,children:[l(`button`,{"aria-label":`Back`,className:`lockerverse-auctions__checkout-back`,disabled:!e.onBack,onClick:e.onBack,type:`button`,children:l(s,{"aria-hidden":`true`,size:20})}),l(`h2`,{children:t?`Review your purchase`:`Confirm your bid`}),l(`p`,{className:`lockerverse-auctions__checkout-eyebrow`,children:`Step 2 of 2`})]})}),u(`div`,{className:`lockerverse-auctions__checkout-body`,children:[e.showFields&&u(`fieldset`,{disabled:e.locked,children:[u(`div`,{className:`lockerverse-auctions__checkout-contact`,children:[l(n,{error:e.contactErrors.email,id:`${f}-email`,label:`Email`,name:`email`,onChange:t=>e.onEmailChange(t.target.value),required:!0,value:e.email}),l(r,{error:e.contactErrors.phone,id:`${f}-phone`,label:`Phone`,children:l(i,{country:e.phoneCountry,error:e.contactErrors.phone,errorId:`${f}-phone-error`,id:`${f}-phone`,name:`phone`,onChange:e.onPhoneChange,required:!0,value:e.phone})})]}),u(`section`,{"aria-label":`Payment Information`,className:`lockerverse-auctions__checkout-section`,children:[l(`h3`,{children:`Payment method`}),e.paymentFields]}),u(`section`,{"aria-label":`Billing Details`,className:`lockerverse-auctions__checkout-section`,children:[l(`h3`,{children:`Billing Details`}),e.billingFields]}),d.collectShippingAddress&&u(`section`,{"aria-label":`Delivery Details`,className:`lockerverse-auctions__checkout-section`,children:[u(`label`,{className:`lockerverse-auctions__checkout-checkbox lockerverse-auctions__checkout-delivery`,htmlFor:`${f}-delivery-same-as-billing`,children:[l(a,{checked:e.sameAsBilling,id:`${f}-delivery-same-as-billing`,onChange:t=>e.onSameAsBillingChange(t.target.checked)}),l(`span`,{children:l(`strong`,{children:`Use billing address for delivery`})})]}),!e.sameAsBilling&&u(c,{children:[l(`h3`,{children:`Delivery Address`}),e.shippingFields]})]}),l(I,{...e})]}),e.message&&l(`p`,{"aria-live":`polite`,className:`lockerverse-auctions__notice`,role:`status`,children:e.message}),!e.isTerminal&&u(`div`,{className:`lockerverse-auctions__checkout-footer`,children:[l(`p`,{children:t?`By placing this order, you authorize this payment.`:`By placing your bid, you agree to save this payment method and charge it if you win.`}),u(`button`,{className:`lockerverse-auctions__button lockerverse-auctions__checkout-submit`,disabled:e.submitDisabled,type:`submit`,children:[e.buttonText,l(o,{"aria-hidden":`true`,size:16})]})]})]})]})}function I(e){let{pricing:n,isPurchase:r,isMaximumBid:i}=e,o=L(r,i);return u(`section`,{"aria-label":`Order amounts`,className:`lockerverse-auctions__checkout-section lockerverse-auctions__amounts`,children:[u(`p`,{children:[u(`span`,{children:[o.amount,r?` (×${e.quantity})`:``]}),l(`span`,{children:t(n.subtotalCents)})]}),n.additionalCharge&&u(`p`,{children:[l(`span`,{children:n.additionalCharge.name}),l(`span`,{children:t(n.additionalChargeCents??0)})]}),e.serviceFeeEnabled&&e.onIncludeServiceFeeChange&&u(`label`,{className:`lockerverse-auctions__checkout-checkbox`,htmlFor:`${e.id}-service-fee`,children:[l(a,{checked:e.includeServiceFee,id:`${e.id}-service-fee`,onChange:t=>e.onIncludeServiceFeeChange?.(t.target.checked)}),l(`span`,{children:`Cover processing fees`}),l(`span`,{children:t(e.serviceFeeCents)})]}),u(`p`,{"aria-live":`polite`,className:`lockerverse-auctions__total`,children:[l(`strong`,{children:o.total}),l(`strong`,{children:t(n.totalCents)})]}),i&&l(`small`,{children:`Your maximum stays private. If you win, you pay the final price plus applicable fees and charges.`})]})}function L(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`}}export{k as a,A as c,E as d,N as i,T as l,M as n,O as o,P as r,j as s,F as t,C as u};
2
2
  //# sourceMappingURL=auction-checkout-view.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"auction-checkout-view.js","names":["formatMoney"],"sources":["../src/auction-payment.ts","../src/auction-checkout-view.tsx"],"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","import type {\n LockerverseAuctionItem,\n LockerverseAuctionPricing,\n} from \"@lockerverse/sdk/auctions\";\nimport { ArrowRight, ChevronLeft } from \"lucide-react\";\nimport type { FormEventHandler, ReactNode } 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 billingFields: ReactNode;\n onEmailChange: (value: string) => void;\n onIncludeServiceFeeChange?: ((value: boolean) => void) | undefined;\n paymentFields: ReactNode;\n onPhoneChange: (value: PhoneInputValue) => void;\n onSameAsBillingChange: (value: boolean) => void;\n shippingFields: ReactNode;\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\nexport function AuctionCheckoutView(props: AuctionCheckoutViewProps) {\n const { isPurchase, 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 <h2>{isPurchase ? \"Review your purchase\" : \"Confirm your bid\"}</h2>\n <p className=\"lockerverse-auctions__checkout-eyebrow\">Step 2 of 2</p>\n </div>\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 <h3>Payment method</h3>\n {props.paymentFields}\n </section>\n <section\n aria-label=\"Billing Details\"\n className=\"lockerverse-auctions__checkout-section\"\n >\n <h3>Billing Details</h3>\n {props.billingFields}\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>Use billing address for delivery</strong>\n </span>\n </label>\n {!props.sameAsBilling && (\n <>\n <h3>Delivery Address</h3>\n {props.shippingFields}\n </>\n )}\n </section>\n )}\n <CheckoutAmounts {...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 placing this order, you authorize this payment.\"\n : \"By placing your bid, you agree to save this payment method and charge it if you win.\"}\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 CheckoutAmounts(props: AuctionCheckoutViewProps) {\n const { pricing, isPurchase, isMaximumBid } = props;\n const labels = checkoutAmountLabels(isPurchase, isMaximumBid);\n return (\n <section\n aria-label=\"Order amounts\"\n className=\"lockerverse-auctions__checkout-section lockerverse-auctions__amounts\"\n >\n <p>\n <span>\n {labels.amount}\n {isPurchase ? ` (×${props.quantity})` : \"\"}\n </span>\n <span>{formatMoney(pricing.subtotalCents)}</span>\n </p>\n {pricing.additionalCharge && (\n <p>\n <span>{pricing.additionalCharge.name}</span>\n <span>{formatMoney(pricing.additionalChargeCents ?? 0)}</span>\n </p>\n )}\n {props.serviceFeeEnabled && 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>Cover processing fees</span>\n <span>{formatMoney(props.serviceFeeCents)}</span>\n </label>\n )}\n <p aria-live=\"polite\" className=\"lockerverse-auctions__total\">\n <strong>{labels.total}</strong>\n <strong>{formatMoney(pricing.totalCents)}</strong>\n </p>\n {isMaximumBid && (\n <small>\n Your maximum stays private. If you win, you pay the final price plus\n applicable fees and charges.\n </small>\n )}\n </section>\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"],"mappings":"8VA0BA,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,SAC7C,MAAO,gDAET,GAAI,EAAU,UAAY,WAAa,CAAC,EAAK,oBAC3C,MAAO,sEAET,GAAI,EAAK,WAAa,SACpB,MAAO,gDAET,GAAI,EAAK,WAAa,UAAW,CAC/B,GAAI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AFvB,SAAA,CAIE,EAAC,EAAD,CACE,QAAS,EAAM,kBACf,GAAI,GAAG,EAAM,GAAG,cAChB,SAAW,GACT,EAAM,4BAA4B,EAAM,OAAO,OAAO,CAEzD,CAAA,EACD,EAAC,OAAD,CAAA,SAAM,uBAA2B,CAAA,EACjC,EAAC,OAAD,CAAA,SAAOA,EAAY,EAAM,eAAe,CAAQ,CAAA,CAC3C,IAET,EAAC,IAAD,CAAG,YAAU,SAAS,UAAU,8BAAhC,SAAA,CACE,EAAC,SAAD,CAAA,SAAS,EAAO,KAAc,CAAA,EAC9B,EAAC,SAAD,CAAA,SAASA,EAAY,EAAQ,UAAU,CAAU,CAAA,CAChD,IACF,GACC,EAAC,QAAD,CAAA,SAAO,mGAGA,CAAA,CAEF,GAEb,CAEA,SAAS,EAAqB,EAAqB,EAAuB,CAWxE,OAVI,EACK,CAAE,OAAQ,WAAY,IAAK,MAAO,MAAO,OAAQ,EAEtD,EACK,CACL,OAAQ,cACR,IAAK,sBACL,MAAO,wBACT,EAEK,CACL,OAAQ,aACR,IAAK,gBACL,MAAO,gBACT,CACF"}
1
+ {"version":3,"file":"auction-checkout-view.js","names":["formatMoney"],"sources":["../src/auction-bidder-storage.ts","../src/auction-payment.ts","../src/auction-checkout-view.tsx"],"sourcesContent":["import type {\n StripeAddressElementChangeEvent,\n StripeAddressElementOptions,\n} from \"@stripe/stripe-js\";\nimport {\n boolean,\n literal,\n nullable,\n object,\n optional,\n safeParse,\n string,\n} from \"valibot\";\n\n/**\n * Contact and address details from the bidder's last accepted bid or paid\n * purchase on this device. Card details are never stored: Stripe asks for the\n * card again on each checkout.\n */\nexport type SavedAuctionBidder = {\n email: string;\n phone: string;\n billing: SavedAuctionAddress | null;\n shipping: SavedAuctionAddress | null;\n sameAsBilling: boolean;\n};\n\ntype SavedAuctionAddress = {\n name: string;\n address: {\n line1: string;\n line2: string | null;\n city: string;\n state: string;\n postal_code: string;\n country: string;\n };\n};\n\nconst storageKey = \"lockerverse:auction-bidder\";\n\nconst addressSchema = nullable(\n object({\n address: object({\n city: string(),\n country: string(),\n line1: string(),\n line2: nullable(string()),\n postal_code: string(),\n state: string(),\n }),\n name: string(),\n })\n);\n\nconst savedBidderSchema = object({\n billing: addressSchema,\n email: string(),\n phone: string(),\n sameAsBilling: optional(boolean(), true),\n shipping: addressSchema,\n version: literal(1),\n});\n\nexport function readSavedAuctionBidder(): SavedAuctionBidder | null {\n try {\n const saved = window.localStorage.getItem(storageKey);\n if (!saved) {\n return null;\n }\n const parsed = safeParse(savedBidderSchema, JSON.parse(saved));\n if (!parsed.success) {\n return null;\n }\n const { version: _version, ...bidder } = parsed.output;\n return bidder;\n } catch {\n // Storage can be blocked or hold an old value. The form stays empty.\n return null;\n }\n}\n\nfunction toSavedAuctionAddress(\n event: StripeAddressElementChangeEvent | null\n): SavedAuctionAddress | null {\n if (!event?.complete) {\n return null;\n }\n const { address, name } = event.value;\n return {\n address: {\n city: address.city,\n country: address.country,\n line1: address.line1,\n line2: address.line2,\n postal_code: address.postal_code,\n state: address.state,\n },\n name,\n };\n}\n\nexport function getSavedAddressOptions(\n mode: \"billing\" | \"shipping\",\n saved: SavedAuctionAddress | null | undefined\n): StripeAddressElementOptions {\n const options: StripeAddressElementOptions = { mode };\n if (saved) {\n options.defaultValues = saved;\n }\n return options;\n}\n\n/** Save the details of an accepted bid or paid purchase for the next one. */\nexport function saveAuctionBidder({\n contact,\n billing,\n shipping,\n sameAsBilling,\n collectShippingAddress,\n previous,\n}: {\n contact: { email: string; phone: string };\n billing: StripeAddressElementChangeEvent | null;\n shipping: StripeAddressElementChangeEvent | null;\n sameAsBilling: boolean;\n collectShippingAddress: boolean;\n previous: SavedAuctionBidder | null;\n}) {\n const separateShipping =\n collectShippingAddress && !sameAsBilling\n ? toSavedAuctionAddress(shipping)\n : null;\n writeSavedAuctionBidder({\n billing: toSavedAuctionAddress(billing) ?? previous?.billing ?? null,\n email: contact.email,\n phone: contact.phone,\n sameAsBilling,\n shipping: separateShipping ?? previous?.shipping ?? null,\n });\n}\n\nfunction writeSavedAuctionBidder(bidder: SavedAuctionBidder) {\n try {\n window.localStorage.setItem(\n storageKey,\n JSON.stringify({ ...bidder, version: 1 })\n );\n } catch {\n // Storage can be full or blocked. The next checkout asks again.\n }\n}\n","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","import type {\n LockerverseAuctionItem,\n LockerverseAuctionPricing,\n} from \"@lockerverse/sdk/auctions\";\nimport { ArrowRight, ChevronLeft } from \"lucide-react\";\nimport type { FormEventHandler, ReactNode } 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 billingFields: ReactNode;\n onEmailChange: (value: string) => void;\n onIncludeServiceFeeChange?: ((value: boolean) => void) | undefined;\n paymentFields: ReactNode;\n onPhoneChange: (value: PhoneInputValue) => void;\n onSameAsBillingChange: (value: boolean) => void;\n shippingFields: ReactNode;\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\nexport function AuctionCheckoutView(props: AuctionCheckoutViewProps) {\n const { isPurchase, 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 <h2>{isPurchase ? \"Review your purchase\" : \"Confirm your bid\"}</h2>\n <p className=\"lockerverse-auctions__checkout-eyebrow\">Step 2 of 2</p>\n </div>\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 <h3>Payment method</h3>\n {props.paymentFields}\n </section>\n <section\n aria-label=\"Billing Details\"\n className=\"lockerverse-auctions__checkout-section\"\n >\n <h3>Billing Details</h3>\n {props.billingFields}\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>Use billing address for delivery</strong>\n </span>\n </label>\n {!props.sameAsBilling && (\n <>\n <h3>Delivery Address</h3>\n {props.shippingFields}\n </>\n )}\n </section>\n )}\n <CheckoutAmounts {...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 placing this order, you authorize this payment.\"\n : \"By placing your bid, you agree to save this payment method and charge it if you win.\"}\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 CheckoutAmounts(props: AuctionCheckoutViewProps) {\n const { pricing, isPurchase, isMaximumBid } = props;\n const labels = checkoutAmountLabels(isPurchase, isMaximumBid);\n return (\n <section\n aria-label=\"Order amounts\"\n className=\"lockerverse-auctions__checkout-section lockerverse-auctions__amounts\"\n >\n <p>\n <span>\n {labels.amount}\n {isPurchase ? ` (×${props.quantity})` : \"\"}\n </span>\n <span>{formatMoney(pricing.subtotalCents)}</span>\n </p>\n {pricing.additionalCharge && (\n <p>\n <span>{pricing.additionalCharge.name}</span>\n <span>{formatMoney(pricing.additionalChargeCents ?? 0)}</span>\n </p>\n )}\n {props.serviceFeeEnabled && 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>Cover processing fees</span>\n <span>{formatMoney(props.serviceFeeCents)}</span>\n </label>\n )}\n <p aria-live=\"polite\" className=\"lockerverse-auctions__total\">\n <strong>{labels.total}</strong>\n <strong>{formatMoney(pricing.totalCents)}</strong>\n </p>\n {isMaximumBid && (\n <small>\n Your maximum stays private. If you win, you pay the final price plus\n applicable fees and charges.\n </small>\n )}\n </section>\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"],"mappings":"gdAuCA,MAAM,EAAa,6BAEb,EAAgB,EACpB,EAAO,CACL,QAAS,EAAO,CACd,KAAM,EAAO,EACb,QAAS,EAAO,EAChB,MAAO,EAAO,EACd,MAAO,EAAS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,OAAQ,aACR,IAAK,gBACL,MAAO,gBACT,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"auction-item.d.ts","names":[],"sources":["../src/auction-item-types.ts","../src/lockerverse-auction-item.tsx"],"mappings":";;;;;KAaY;EACV;EACA;EACA,MAAM;EACN,SAAS,YAAY;EACrB,SAAS;EACT,YAAY;;KAGF;EACV,SAAS;EACT,QAAQ;EACR;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;EAGA,2BAA2B;EAC3B;EACA;EACA,QAAQ;EACR,QAAQ;EACR,eAAe;;EAEf,kBAAkB,QAAQ;;EAE1B,sBAAsB,QAAQ;EAC9B,4BACE,UAAU;EAEZ,eAAe;;EAEf,iBAAiB;;;;iBC4NH,uBAAuB,OAAO,8CAA2B,IAAA"}
1
+ {"version":3,"file":"auction-item.d.ts","names":[],"sources":["../src/auction-item-types.ts","../src/lockerverse-auction-item.tsx"],"mappings":";;;;;KAaY;EACV;EACA;EACA,MAAM;EACN,SAAS,YAAY;EACrB,SAAS;EACT,YAAY;;KAGF;EACV,SAAS;EACT,QAAQ;EACR;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;EAGA,2BAA2B;EAC3B;EACA;EACA,QAAQ;EACR,QAAQ;EACR,eAAe;;EAEf,kBAAkB,QAAQ;;EAE1B,sBAAsB,QAAQ;EAC9B,4BACE,UAAU;EAEZ,eAAe;;EAEf,iBAAiB;;;;iBC0OH,uBAAuB,OAAO,8CAA2B,IAAA"}
@@ -1,2 +1,2 @@
1
- import{getAuctionPresentationStyle as e}from"./auction-presentation.js";import{a as t,c as n,i as r,l as i,n as a,r as o,s,t as c}from"./use-auction-boundary.js";import{n as l,t as u}from"./auction-image.js";import{a as d,o as f,t as p}from"./auction-checkout-view.js";import{r as m}from"./phone-field.js";import{t as h}from"./auction-result2.js";import{t as g}from"./host-callback.js";import{ArrowRight as _,ChevronDown as v,ChevronLeft as y,ChevronRight as b,Clock3 as x,Gavel as S,Info as C,Pause as w,Play as T,ShieldCheck as E,TimerReset as D,X as O}from"lucide-react";import{useCallback as k,useEffect as A,useId as j,useMemo as M,useRef as N,useState as P}from"react";import{Fragment as F,jsx as I,jsxs as L}from"react/jsx-runtime";import{getLockerverseAuctionMinimumBid as R}from"@lockerverse/sdk/auctions";import{Dialog as z}from"@base-ui/react/dialog";import B from"embla-carousel-autoplay";import V from"embla-carousel-react";const H=6e3;function U(e,t){let n=N(H),r=N(null),[i,a]=P(H),o=M(()=>B({delay:i,playOnInit:!1,stopOnFocusIn:!1,stopOnInteraction:!0,stopOnMouseEnter:!1}),[i]),[s,c]=V({duration:t?0:25,loop:!0},[o]),l=k(()=>{r.current&&(r.current.style.transform=`scaleX(${1-n.current/H})`)},[]),u=k(()=>{let e=o.timeUntilNext();e!==null&&(n.current=Math.max(1,Math.min(H,e))),o.stop(),l()},[o,l]),d=k(()=>{n.current=H,a(H),o.reset(),l()},[o,l]);return A(()=>{c&&(e?i===n.current?o.play():a(n.current):u())},[c,e,o,i,a,n,u]),A(()=>{if(!c)return;let t=0,r=()=>{let i=o.timeUntilNext();!e||i===null||(n.current=Math.max(0,Math.min(H,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 W({photos:e,name:t,imageSizes:n=`(max-width: 1279px) 100vw, 45vw`,selected:r,paused:i=!1,photoButtonRef:o,onSelect:s,onExpand:c}){let l=N(null),d=N(null),f=N([]),[p,m]=P(!0),[h,g]=P(!1),[_,v]=P(!1),[x,S]=P(!1),[C,E]=P(!1),{ref:D,visible:O}=a(),[k,j]=P(!1),[M,R]=P(!0),z=N(null),B=`lockerverse-auction-gallery__control ${M||k||_?`is-visible`:``}`,V=()=>{z.current&&clearTimeout(z.current),z.current=setTimeout(()=>j(!1),2e3)},H=e=>{if(e.pointerType!==`mouse`){R(!0);return}j(!0),z.current&&clearTimeout(z.current),e.target instanceof Element&&e.target.closest(`[data-gallery-control]`)||V()};A(()=>{let e=window.matchMedia(`(hover: none), (pointer: coarse)`),t=()=>R(e.matches);return t(),e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t),clearTimeout(z.current??void 0)}},[]);let W=!(i||p||h||_||x||C)&&O,G=e.length,K=G?(r%G+G)%G:0,{viewportRef:q,embla:J,progressRef:Y,freeze:X,reset:Z}=U(W&&G>1,p);A(()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>m(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),A(()=>{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]),A(()=>{J&&J.selectedScrollSnap()!==K&&J.scrollTo(K,!0)},[J,K]),A(()=>{let e=()=>{document.hidden&&X()},t=()=>E(!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 A(()=>{let e=d.current;d.current=null,e&&document.activeElement===e&&D.current?.querySelector(`.lockerverse-auction-gallery__photo[tabindex="0"]`)?.focus({preventScroll:!0})},[K,D]),A(()=>{let e=l.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]),L(`section`,{"aria-label":`${t} photos`,className:`lockerverse-auction-gallery`,onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||v(!1)},onFocusCapture:e=>v(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`&&g(!0)},onPointerLeave:e=>{e.pointerType===`mouse`&&g(!1)},ref:D,children:[G?L(`div`,{className:`lockerverse-auction-gallery__stage`,onPointerEnter:H,onPointerLeave:V,onPointerMove:H,children:[I(`div`,{className:`lockerverse-auction-gallery__viewport`,onPointerDownCapture:()=>{X(),E(!0)},ref:q,children:I(`div`,{className:`lockerverse-auction-gallery__track`,children:e.map((e,r)=>I(`div`,{"aria-hidden":r!==K,className:`lockerverse-auction-gallery__slide`,children:I(`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:I(u,{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&&L(`div`,{className:`lockerverse-auction-gallery__rotation`,children:[I(`div`,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__progress-track`,children:I(`div`,{className:`lockerverse-auction-gallery__progress`,ref:Y,style:{transform:`scaleX(0)`}})}),I(`button`,{"aria-label":x?`Play photo rotation`:`Pause photo rotation`,className:`lockerverse-auction-gallery__play ${B}`,"data-gallery-control":!0,onClick:()=>S(e=>!e),title:x?`Play photo rotation`:`Pause photo rotation`,type:`button`,children:I(x?T:w,{"aria-hidden":`true`,size:13})})]}),G>1&&L(F,{children:[I(`button`,{"aria-label":`Previous photo`,className:`lockerverse-auction-gallery__previous ${B}`,"data-gallery-control":!0,onClick:()=>Q(K-1),type:`button`,children:I(y,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__chevron`})}),I(`button`,{"aria-label":`Next photo`,className:`lockerverse-auction-gallery__next ${B}`,"data-gallery-control":!0,onClick:()=>Q(K+1),type:`button`,children:I(b,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__chevron`})})]})]}):I(`div`,{className:`lockerverse-auction-gallery__empty`,children:`No photo available`}),G>1&&I(`section`,{"aria-label":`Choose a photo`,className:`lockerverse-auction-gallery__strip`,ref:l,children:I(`div`,{className:`lockerverse-auction-gallery__thumbnails`,children:e.map((e,t)=>I(`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:I(u,{alt:``,className:`lockerverse-auction-gallery__thumbnail-image`,height:66,loading:`lazy`,maxWidth:192,sizes:`88px`,src:e,width:88})},`${e}-${t}`))})})]})}function G({images:e,fallbackImage:t,name:n,imageSizes:r}){let i=[...new Set(e.filter(Boolean))];!i.length&&t&&i.push(t);let[a,o]=P(0),[s,c]=P(!1),l=N(null),d=N(null),f=l.current?.getRootNode(),p=f&&f instanceof ShadowRoot?f:void 0,m=i.length,h=m?(a%m+m)%m:0;return L(F,{children:[I(W,{imageSizes:r,name:n,onExpand:e=>{o(e),c(!0)},onSelect:o,paused:s,photoButtonRef:l,photos:i,selected:h}),m>0&&I(z.Root,{onOpenChange:c,open:s,children:L(z.Portal,{container:p,children:[I(z.Backdrop,{className:`lockerverse-auction-gallery__backdrop`}),L(z.Popup,{"aria-describedby":void 0,className:`lockerverse-auction-gallery__viewer`,finalFocus:l,onKeyDown:e=>{m<2||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),o((h+(e.key===`ArrowRight`?1:-1)+m)%m))},children:[L(z.Title,{className:`lockerverse-auction-gallery__sr-only`,children:[n,` · Photo `,h+1,` of `,m]}),L(`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)||m<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((h+(r<0?1:-1)+m)%m)},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:[I(u,{alt:`${n}, ${h+1} of ${m}`,height:900,maxWidth:1920,sizes:`100vw`,src:i[h],width:1200}),s&&m>1&&I(u,{alt:``,"aria-hidden":`true`,className:`lockerverse-auction-gallery__preload`,height:900,loading:`eager`,maxWidth:1920,sizes:`100vw`,src:i[(h+1)%m],width:1200})]}),I(z.Close,{"aria-label":`Close photo viewer`,className:`lockerverse-auction-gallery__viewer-close`,children:I(O,{"aria-hidden":`true`,size:22})}),m>1&&L(F,{children:[I(`button`,{"aria-label":`Previous photo`,className:`lockerverse-auction-gallery__viewer-previous`,onClick:()=>o((h-1+m)%m),type:`button`,children:I(y,{"aria-hidden":`true`,size:28})}),I(`button`,{"aria-label":`Next photo`,className:`lockerverse-auction-gallery__viewer-next`,onClick:()=>o((h+1)%m),type:`button`,children:I(b,{"aria-hidden":`true`,size:28})})]})]})]})})]})}const K={1:`h1`,2:`h2`};function q(e){return I(e===`Buy Now`?E:e===`Available`||e===`Increment`?D:S,{"aria-hidden":`true`,size:16})}function J(e,t){return e.saleMode===`buy_now`?[[`Buy Now`,r(e.buyNowPriceAmount??0)],[`Available`,e.availableQuantity===null?`Available`:String(e.availableQuantity)]]:t===`finished`?[[`Final bid`,e.maxBidAmount?r(e.maxBidAmount):`No bids`]]:[[`Current bid`,r(e.maxBidAmount??0)],[`Floor`,r(e.minBidAmount??0)],[`Increment`,r(e.bidIncrementAmount??100)]]}function Y({auction:e,item:i,itemHeadingLevel:a=2,galleryImageSizes:s}){c(i.startAt??e.startAt,i.endAt??e.endAt);let[l,u]=P(!1),d=j(),f=t(e,i),p={active:`Closes`,draft:`Opens`,finished:`Closed`}[f],m=o(e,f,i),h=i.saleMode===`buy_now`,g=(i.description??``).trim().length>240,_=J(i,f),y=K[a];return L(`section`,{className:`lockerverse-auctions__item-summary`,children:[I(G,{fallbackImage:i.image??e.configuration.image??e.community?.banner??e.community?.thumbnail??null,imageSizes:s,images:i.images,name:i.name}),L(`div`,{className:`lockerverse-auctions__item-copy`,children:[I(y,{children:i.name}),i.description?L(`div`,{className:`lockerverse-auctions__item-description`,children:[I(n,{className:!l&&g?`lockerverse-auctions__description-clamped`:void 0,description:i.description,id:d}),g?L(`button`,{"aria-controls":d,"aria-expanded":l,className:`lockerverse-auctions__description-toggle`,onClick:()=>u(!l),type:`button`,children:[l?`Hide description`:`Read full description`,` `,I(v,{"aria-hidden":`true`,size:16,style:{transform:l?`rotate(180deg)`:void 0}})]}):null]}):null,L(`dl`,{className:`lockerverse-auctions__stat-panel`,children:[_.map(([e,t])=>L(`div`,{className:`lockerverse-auctions__stat-row`,children:[L(`dt`,{children:[q(e),e]}),I(`dd`,{children:t})]},e)),L(`div`,{className:`lockerverse-auctions__stat-row`,children:[L(`dt`,{children:[I(x,{"aria-hidden":`true`,size:16}),p]}),I(`dd`,{className:`lockerverse-auctions__stat-date`,children:m})]}),!h&&f===`finished`?L(`div`,{className:`lockerverse-auctions__stat-footer`,children:[L(`div`,{children:[I(`dt`,{children:`Floor`}),I(`dd`,{children:r(i.minBidAmount??0)})]}),L(`div`,{children:[I(`dt`,{children:`Bid increment`}),I(`dd`,{children:r(i.bidIncrementAmount??100)})]})]}):null]})]})]})}const X={1:`h2`,2:`h3`},Z=/^\d+$/;function Q(e,t){let n=Number(e),i=n*(t.buyNowPriceAmount??0);if(!(Z.test(e)&&Number.isSafeInteger(i))||n<1)return`Enter a whole-number quantity.`;if(!t.additionalCharge)return`Total: ${r(i)}`;let a=t.additionalCharge.firstUnitAmountCents+t.additionalCharge.additionalUnitAmountCents*(n-1),o=i+a;return Number.isSafeInteger(o)?`Subtotal: ${r(i)} · ${t.additionalCharge.name}: ${r(a)} · Total: ${r(o)}`:`Enter a valid quantity.`}function ee(e,t,n){return String(e?t?t.quantity:1:t?t.amount/100:n)}function te(e,t){return s(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 ne(e,t,n){return s(t)?`All available quantities have been purchased.`:n===`draft`?`This item opens ${o(e,`draft`,t)}.`:t.saleMode===`buy_now`?`This item is no longer available to purchase.`:`Bidding has closed for this item.`}function re(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 ie({auction:e,item:n,initialSelection:r,onContinue:a,onError:o,onBack:l,backHref:u,itemHeadingLevel:p=2}){let m=X[p],h=n.saleMode===`buy_now`,g=Math.ceil(R(n)/100),[v,y]=P(ee(h,r,g)),[b,x]=P(r?.bidType??`fixed`),[S,C]=P(null),w=j();c(n.startAt??e.startAt,n.endAt??e.endAt);let T=t(e,n),E=T===`active`&&!s(n)&&n.saleMode!==`hybrid`;function D(t){if(t.preventDefault(),!Z.test(v)){C(h?`Enter a whole-number quantity.`:`Enter a whole-dollar bid amount.`);return}let i=re(e,h,r,v,b),s=d(e,n,i);if(s){C(s),o(s);return}try{f(e,n,i)}catch{C(`Enter a valid amount or quantity.`);return}a(i)}return E?L(`form`,{className:`lockerverse-auctions__selection`,onSubmit:D,children:[I(ae,{buyNow:h,headingTag:m,item:n}),L(`div`,{className:`lockerverse-auctions__selection-body`,children:[I(ce,{bidType:b,enabled:!h&&!!n.supportsMaximumBids,id:w,onChange:e=>{x(e),C(null)}}),L(`label`,{className:`lockerverse-auctions__field`,htmlFor:w,children:[se(h,b),L(`span`,{className:`lockerverse-auctions__amount-control`,children:[h?null:I(`span`,{"aria-hidden":`true`,children:`$`}),I(`input`,{"aria-describedby":h?`${w}-help`:void 0,"aria-invalid":!!S,autoComplete:`off`,id:w,inputMode:`numeric`,onChange:e=>{y(e.target.value),C(null)},placeholder:h?`1`:String(g),required:!0,value:v})]})]}),S?I(`p`,{role:`alert`,children:S}):null,h&&I(`p`,{id:`${w}-help`,children:Q(v,n)}),I(oe,{item:n}),L(`div`,{className:`lockerverse-auctions__selection-footer`,children:[I(`p`,{children:h?`You pay at checkout.`:`We charge your card only if you win.`}),L(`button`,{className:`lockerverse-auctions__button`,disabled:!e.payment,type:`submit`,children:[h?`Continue to Checkout`:`Continue to Payment`,` `,I(_,{"aria-hidden":`true`,size:16})]})]}),e.payment?null:I(`p`,{role:`alert`,children:`Payments are not configured for this auction.`})]})]}):L(`div`,{className:`lockerverse-auctions__selection lockerverse-auctions__read-only`,children:[I(`p`,{className:`lockerverse-auctions__eyebrow`,children:`Item status`}),I(m,{children:te(n,T)}),I(`p`,{children:ne(e,n,T)}),L(i,{className:`lockerverse-auctions__button`,href:u,onBack:l,children:[`Browse auction items `,I(_,{"aria-hidden":`true`,size:16})]})]})}function ae({headingTag:e,item:t,buyNow:n}){return L(`div`,{className:`lockerverse-auctions__selection-header`,children:[I(`p`,{className:`lockerverse-auctions__eyebrow`,children:`Step 1 of 2`}),I(e,{children:n?`Buy this item`:`Place your bid`}),n?L(`p`,{children:[r(t.buyNowPriceAmount??0),` each`,t.availableQuantity===null?``:` · ${t.availableQuantity} available`]}):null]})}function oe({item:e}){return e.saleMode===`buy_now`||!e.additionalCharge?null:L(`p`,{children:[e.additionalCharge.name,`:`,` `,r(e.additionalCharge.firstUnitAmountCents),` if you win.`]})}function se(e,t){return e?`Quantity`:t===`maximum`?`Your maximum bid`:`Your bid amount`}function ce({bidType:e,enabled:t,id:n,onChange:r}){return t?L(`fieldset`,{className:`lockerverse-auctions__bid-types`,children:[I(`legend`,{children:`Bid type`}),[`fixed`,`maximum`].map(t=>L(`div`,{className:`lockerverse-auctions__bid-type`,children:[L(`label`,{children:[I(`input`,{checked:e===t,name:`${n}-bid-type`,onChange:()=>r(t),type:`radio`,value:t}),I(`span`,{children:t===`fixed`?`Fixed bid`:`Maximum bid`})]}),I(le,{id:`${n}-${t}-help`,type:t})]},t))]}):null}function le({id:e,type:t}){let[n,r]=P(!1);return L(`button`,{"aria-describedby":n?e:void 0,"aria-label":`About ${t===`fixed`?`fixed`:`maximum`} bids`,className:`lockerverse-auctions__bid-help-button`,onBlur:()=>r(!1),onClick:()=>r(!0),onFocus:()=>r(!0),onKeyDown:e=>{e.key===`Escape`&&r(!1)},onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),type:`button`,children:[I(C,{"aria-hidden":`true`,size:16}),n&&I(`span`,{className:`lockerverse-auctions__bid-tip`,id:e,role:`tooltip`,children:t===`fixed`?`Bid this exact amount. It will not increase automatically.`:`We bid only what is needed to lead, up to your private limit. Accepted bids cannot be changed or canceled. A new bid is separate.`})]})}const $=()=>void 0;function ue(e){let t=j(),{auction:n,item:r,selection:i,resumePurchase:a}=e,o=a?a.pricing:f(n,r,i),s=!!a||r.saleMode===`buy_now`;return I(p,{billingFields:null,buttonText:s?`Buy Now`:`Authorize Bid`,communityName:e.communityName??n.name,contactErrors:{},email:e.contact.email,id:t,includeServiceFee:i.includeServiceFee,isMaximumBid:!s&&i.bidType===`maximum`,isPurchase:s,isTerminal:!1,item:r,locked:!0,message:null,onBack:a||e.interactionLocked?void 0:e.onBack,onEmailChange:$,onIncludeServiceFeeChange:e.onIncludeServiceFeeChange,onPhoneChange:$,onSameAsBillingChange:$,onSubmit:e=>e.preventDefault(),paymentFields:null,phone:e.contact.phone,phoneCountry:m(e.contact.phone),pricing:o,quantity:i.quantity,sameAsBilling:!0,serviceFeeCents:a?o.serviceFeeCents:f(n,r,{...i,includeServiceFee:n.serviceFeeEnabled}).serviceFeeCents,serviceFeeEnabled:n.serviceFeeEnabled,shippingFields:null,showFields:!a,submitDisabled:!0})}let de,fe=null;function pe(){return de??=import(`./auction-payment-view.js`).then(e=>(fe=e.AuctionPayment,e)),de}function me(e,t,n){let r=e?.publishableKey,i=e?.connectedAccountId,[a,o]=P(null);return A(()=>{if(!(n&&r))return;let e=pe().then(e=>e.loadAuctionStripe(r,i,t)).catch(()=>null);o({connectedAccountId:i,publishableKey:r,stripe:e,stripeLoader:t})},[n,r,i,t]),a?.publishableKey===r&&a?.connectedAccountId===i&&a?.stripeLoader===t?a?.stripe:void 0}function he(e){let[t,n]=P(()=>fe),[r,i]=P(!1),a=!!(e.resumePurchase||e.interactionLocked);return A(()=>{let e=!0;return pe().then(({AuctionPayment:t})=>{e&&n(()=>t)},()=>{e&&i(!0)}),()=>{e=!1}},[]),t?I(t,{...e}):r?L(`div`,{children:[I(`p`,{role:`alert`,children:`Payment details could not load.`}),a&&I(`p`,{children:`Your purchase status is not confirmed. Keep this page open and contact the auction organizer before you try another purchase.`}),a?null:I(`button`,{onClick:e.onBack,type:`button`,children:`Back to item`}),!a&&I(`button`,{onClick:()=>window.location.reload(),type:`button`,children:`Reload page to try again`})]}):I(ue,{...e})}function ge(t){let{auction:n,item:r,outcome:i}=t,a;return t.backHref?a={href:t.backHref,label:`View auction items`}:t.onBack&&(a={label:`View auction items`,onClick:t.onBack}),I(h,{auctionName:n.name,className:t.className,closesAtLabel:o(n,`active`,r),communityName:t.communityName??n.community?.name,focusHeading:!0,imageUrl:r.image??r.images[0]??n.configuration.image??void 0,itemName:r.name,outcome:i,primaryAction:t.returnToItemHref?{href:t.returnToItemHref,label:`Return to item`}:a,secondaryAction:t.returnToItemHref?a:void 0,style:e(n,t.style,t.theme??`dark`),theme:t.theme})}function _e(n){let{auction:r,itemId:a,resumePurchase:o,className:l,theme:u=`dark`,style:d}=n,f=N(null),[p,m]=P(r),h=N(r),v=p.items.find(e=>e.id===a)??o?.item;c(v?.startAt??p.startAt,v?.endAt??p.endAt);let[b,x]=P(()=>o?{amount:0,includeServiceFee:o.submission.includeServiceFee??!1,quantity:o.submission.quantity}:null),[S,C]=P(!!o),w=N(!0),T=N(n);T.current=n;let E=N(null),D=k(e=>{w.current&&C(e),E.current!==e&&(E.current=e,g(T.current.onInteractionLockChange,e))},[]),O=!!o;A(()=>(w.current=!0,D(O),()=>{w.current=!1}),[O,D]);let[j,M]=P({email:``,phone:``}),[F,R]=P(!!o),[z,B]=P(null),[V,H]=P(null);A(()=>{!(F||S||o)&&h.current!==r&&(h.current=r,m(r))},[r,F,S,o]);let U=me(o?.payment??p.payment,n.stripeLoader,!!o||!!(v&&t(p,v)===`active`&&!s(v)&&v.saleMode!==`hybrid`));function W(e,t){D(!1),h.current=T.current.auction,m(e),x(null),R(!1),B(t)}function G(e){B(null),x(e),R(!0)}return v?V?I(ge,{...n,auction:p,item:v,outcome:V}):L(`section`,{className:[`lockerverse-auctions`,l].filter(Boolean).join(` `),"data-lockerverse-theme":u,ref:f,style:e(p,d,u),children:[S?null:L(i,{className:`lockerverse-auctions__back`,href:n.backHref,onBack:n.onBack,children:[I(y,{"aria-hidden":`true`,size:16}),` All items`]}),L(`div`,{className:`lockerverse-auctions__detail`,children:[I(Y,{auction:p,galleryImageSizes:n.galleryImageSizes,item:v,itemHeadingLevel:n.itemHeadingLevel}),L(`div`,{className:`lockerverse-auctions__transaction`,children:[z?I(`p`,{className:`lockerverse-auctions__notice`,role:`alert`,children:z}):null,F&&b?I(he,{...n,appearanceRoot:f,auction:p,communityName:n.communityName??p.community?.name,contact:j,interactionLocked:S,item:v,onBack:()=>R(!1),onContactChange:M,onIncludeServiceFeeChange:e=>x(t=>t&&{...t,includeServiceFee:p.serviceFeeEnabled&&e}),onInteractionLockChange:D,onResult:H,onReview:W,selection:b,stripePromise:U}):I(ie,{auction:p,backHref:n.backHref,initialSelection:b,item:v,itemHeadingLevel:n.itemHeadingLevel,onBack:n.onBack,onContinue:G,onError:B}),S?null:L(i,{className:`lockerverse-auctions__footer-back`,href:n.backHref,onBack:n.onBack,children:[`Back to auction items `,I(_,{"aria-hidden":`true`,size:16})]})]})]})]}):L(`div`,{children:[I(`p`,{role:`alert`,children:`This auction item is no longer available.`}),I(i,{href:n.backHref,onBack:n.onBack,children:`Back to auction items`})]})}function ve(e){let t=N({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 I(l.Provider,{value:e.auction.mediaBaseUrl,children:I(_e,{...e})})}export{ve as LockerverseAuctionItem};
1
+ import{getAuctionPresentationStyle as e}from"./auction-presentation.js";import{a as t,c as n,i as r,l as i,n as a,r as o,s,t as c}from"./use-auction-boundary.js";import{n as l,t as u}from"./auction-image.js";import{a as d,o as f,t as p,u as m}from"./auction-checkout-view.js";import{r as h}from"./phone-field.js";import{t as g}from"./auction-result2.js";import{t as _}from"./host-callback.js";import{ArrowRight as v,ChevronDown as y,ChevronLeft as b,ChevronRight as x,Clock3 as S,Gavel as C,Info as w,Pause as T,Play as E,ShieldCheck as D,TimerReset as O,X as k}from"lucide-react";import{useCallback as A,useEffect as j,useId as M,useMemo as N,useRef as P,useState as F}from"react";import{Fragment as I,jsx as L,jsxs as R}from"react/jsx-runtime";import{getLockerverseAuctionMinimumBid as z}from"@lockerverse/sdk/auctions";import{Dialog as B}from"@base-ui/react/dialog";import V from"embla-carousel-autoplay";import H from"embla-carousel-react";const U=6e3;function W(e,t){let n=P(U),r=P(null),[i,a]=F(U),o=N(()=>V({delay:i,playOnInit:!1,stopOnFocusIn:!1,stopOnInteraction:!0,stopOnMouseEnter:!1}),[i]),[s,c]=H({duration:t?0:25,loop:!0},[o]),l=A(()=>{r.current&&(r.current.style.transform=`scaleX(${1-n.current/U})`)},[]),u=A(()=>{let e=o.timeUntilNext();e!==null&&(n.current=Math.max(1,Math.min(U,e))),o.stop(),l()},[o,l]),d=A(()=>{n.current=U,a(U),o.reset(),l()},[o,l]);return j(()=>{c&&(e?i===n.current?o.play():a(n.current):u())},[c,e,o,i,a,n,u]),j(()=>{if(!c)return;let t=0,r=()=>{let i=o.timeUntilNext();!e||i===null||(n.current=Math.max(0,Math.min(U,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 G({photos:e,name:t,imageSizes:n=`(max-width: 1279px) 100vw, 45vw`,selected:r,paused:i=!1,photoButtonRef:o,onSelect:s,onExpand:c}){let l=P(null),d=P(null),f=P([]),[p,m]=F(!0),[h,g]=F(!1),[_,v]=F(!1),[y,S]=F(!1),[C,w]=F(!1),{ref:D,visible:O}=a(),[k,A]=F(!1),[M,N]=F(!0),z=P(null),B=`lockerverse-auction-gallery__control ${M||k||_?`is-visible`:``}`,V=()=>{z.current&&clearTimeout(z.current),z.current=setTimeout(()=>A(!1),2e3)},H=e=>{if(e.pointerType!==`mouse`){N(!0);return}A(!0),z.current&&clearTimeout(z.current),e.target instanceof Element&&e.target.closest(`[data-gallery-control]`)||V()};j(()=>{let e=window.matchMedia(`(hover: none), (pointer: coarse)`),t=()=>N(e.matches);return t(),e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t),clearTimeout(z.current??void 0)}},[]);let U=!(i||p||h||_||y||C)&&O,G=e.length,K=G?(r%G+G)%G:0,{viewportRef:q,embla:J,progressRef:Y,freeze:X,reset:Z}=W(U&&G>1,p);j(()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>m(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),j(()=>{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]),j(()=>{J&&J.selectedScrollSnap()!==K&&J.scrollTo(K,!0)},[J,K]),j(()=>{let e=()=>{document.hidden&&X()},t=()=>w(!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 j(()=>{let e=d.current;d.current=null,e&&document.activeElement===e&&D.current?.querySelector(`.lockerverse-auction-gallery__photo[tabindex="0"]`)?.focus({preventScroll:!0})},[K,D]),j(()=>{let e=l.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]),R(`section`,{"aria-label":`${t} photos`,className:`lockerverse-auction-gallery`,onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||v(!1)},onFocusCapture:e=>v(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`&&g(!0)},onPointerLeave:e=>{e.pointerType===`mouse`&&g(!1)},ref:D,children:[G?R(`div`,{className:`lockerverse-auction-gallery__stage`,onPointerEnter:H,onPointerLeave:V,onPointerMove:H,children:[L(`div`,{className:`lockerverse-auction-gallery__viewport`,onPointerDownCapture:()=>{X(),w(!0)},ref:q,children:L(`div`,{className:`lockerverse-auction-gallery__track`,children:e.map((e,r)=>L(`div`,{"aria-hidden":r!==K,className:`lockerverse-auction-gallery__slide`,children:L(`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:L(u,{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&&R(`div`,{className:`lockerverse-auction-gallery__rotation`,children:[L(`div`,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__progress-track`,children:L(`div`,{className:`lockerverse-auction-gallery__progress`,ref:Y,style:{transform:`scaleX(0)`}})}),L(`button`,{"aria-label":y?`Play photo rotation`:`Pause photo rotation`,className:`lockerverse-auction-gallery__play ${B}`,"data-gallery-control":!0,onClick:()=>S(e=>!e),title:y?`Play photo rotation`:`Pause photo rotation`,type:`button`,children:L(y?E:T,{"aria-hidden":`true`,size:13})})]}),G>1&&R(I,{children:[L(`button`,{"aria-label":`Previous photo`,className:`lockerverse-auction-gallery__previous ${B}`,"data-gallery-control":!0,onClick:()=>Q(K-1),type:`button`,children:L(b,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__chevron`})}),L(`button`,{"aria-label":`Next photo`,className:`lockerverse-auction-gallery__next ${B}`,"data-gallery-control":!0,onClick:()=>Q(K+1),type:`button`,children:L(x,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__chevron`})})]})]}):L(`div`,{className:`lockerverse-auction-gallery__empty`,children:`No photo available`}),G>1&&L(`section`,{"aria-label":`Choose a photo`,className:`lockerverse-auction-gallery__strip`,ref:l,children:L(`div`,{className:`lockerverse-auction-gallery__thumbnails`,children:e.map((e,t)=>L(`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:L(u,{alt:``,className:`lockerverse-auction-gallery__thumbnail-image`,height:66,loading:`lazy`,maxWidth:192,sizes:`88px`,src:e,width:88})},`${e}-${t}`))})})]})}function K({images:e,fallbackImage:t,name:n,imageSizes:r}){let i=[...new Set(e.filter(Boolean))];!i.length&&t&&i.push(t);let[a,o]=F(0),[s,c]=F(!1),l=P(null),d=P(null),f=l.current?.getRootNode(),p=f&&f instanceof ShadowRoot?f:void 0,m=i.length,h=m?(a%m+m)%m:0;return R(I,{children:[L(G,{imageSizes:r,name:n,onExpand:e=>{o(e),c(!0)},onSelect:o,paused:s,photoButtonRef:l,photos:i,selected:h}),m>0&&L(B.Root,{onOpenChange:c,open:s,children:R(B.Portal,{container:p,children:[L(B.Backdrop,{className:`lockerverse-auction-gallery__backdrop`}),R(B.Popup,{"aria-describedby":void 0,className:`lockerverse-auction-gallery__viewer`,finalFocus:l,onKeyDown:e=>{m<2||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),o((h+(e.key===`ArrowRight`?1:-1)+m)%m))},children:[R(B.Title,{className:`lockerverse-auction-gallery__sr-only`,children:[n,` · Photo `,h+1,` of `,m]}),R(`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)||m<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((h+(r<0?1:-1)+m)%m)},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:[L(u,{alt:`${n}, ${h+1} of ${m}`,height:900,maxWidth:1920,sizes:`100vw`,src:i[h],width:1200}),s&&m>1&&L(u,{alt:``,"aria-hidden":`true`,className:`lockerverse-auction-gallery__preload`,height:900,loading:`eager`,maxWidth:1920,sizes:`100vw`,src:i[(h+1)%m],width:1200})]}),L(B.Close,{"aria-label":`Close photo viewer`,className:`lockerverse-auction-gallery__viewer-close`,children:L(k,{"aria-hidden":`true`,size:22})}),m>1&&R(I,{children:[L(`button`,{"aria-label":`Previous photo`,className:`lockerverse-auction-gallery__viewer-previous`,onClick:()=>o((h-1+m)%m),type:`button`,children:L(b,{"aria-hidden":`true`,size:28})}),L(`button`,{"aria-label":`Next photo`,className:`lockerverse-auction-gallery__viewer-next`,onClick:()=>o((h+1)%m),type:`button`,children:L(x,{"aria-hidden":`true`,size:28})})]})]})]})})]})}const q={1:`h1`,2:`h2`};function J(e){return L(e===`Buy Now`?D:e===`Available`||e===`Increment`?O:C,{"aria-hidden":`true`,size:16})}function Y(e,t){return e.saleMode===`buy_now`?[[`Buy Now`,r(e.buyNowPriceAmount??0)],[`Available`,e.availableQuantity===null?`Available`:String(e.availableQuantity)]]:t===`finished`?[[`Final bid`,e.maxBidAmount?r(e.maxBidAmount):`No bids`]]:[[`Current bid`,r(e.maxBidAmount??0)],[`Floor`,r(e.minBidAmount??0)],[`Increment`,r(e.bidIncrementAmount??100)]]}function X({auction:e,item:i,itemHeadingLevel:a=2,galleryImageSizes:s}){c(i.startAt??e.startAt,i.endAt??e.endAt);let[l,u]=F(!1),d=M(),f=t(e,i),p={active:`Closes`,draft:`Opens`,finished:`Closed`}[f],m=o(e,f,i),h=i.saleMode===`buy_now`,g=(i.description??``).trim().length>240,_=Y(i,f),v=q[a];return R(`section`,{className:`lockerverse-auctions__item-summary`,children:[L(K,{fallbackImage:i.image??e.configuration.image??e.community?.banner??e.community?.thumbnail??null,imageSizes:s,images:i.images,name:i.name}),R(`div`,{className:`lockerverse-auctions__item-copy`,children:[L(v,{children:i.name}),i.description?R(`div`,{className:`lockerverse-auctions__item-description`,children:[L(n,{className:!l&&g?`lockerverse-auctions__description-clamped`:void 0,description:i.description,id:d}),g?R(`button`,{"aria-controls":d,"aria-expanded":l,className:`lockerverse-auctions__description-toggle`,onClick:()=>u(!l),type:`button`,children:[l?`Hide description`:`Read full description`,` `,L(y,{"aria-hidden":`true`,size:16,style:{transform:l?`rotate(180deg)`:void 0}})]}):null]}):null,R(`dl`,{className:`lockerverse-auctions__stat-panel`,children:[_.map(([e,t])=>R(`div`,{className:`lockerverse-auctions__stat-row`,children:[R(`dt`,{children:[J(e),e]}),L(`dd`,{children:t})]},e)),R(`div`,{className:`lockerverse-auctions__stat-row`,children:[R(`dt`,{children:[L(S,{"aria-hidden":`true`,size:16}),p]}),L(`dd`,{className:`lockerverse-auctions__stat-date`,children:m})]}),!h&&f===`finished`?R(`div`,{className:`lockerverse-auctions__stat-footer`,children:[R(`div`,{children:[L(`dt`,{children:`Floor`}),L(`dd`,{children:r(i.minBidAmount??0)})]}),R(`div`,{children:[L(`dt`,{children:`Bid increment`}),L(`dd`,{children:r(i.bidIncrementAmount??100)})]})]}):null]})]})]})}const Z={1:`h2`,2:`h3`},Q=/^\d+$/;function ee(e,t){let n=Number(e),i=n*(t.buyNowPriceAmount??0);if(!(Q.test(e)&&Number.isSafeInteger(i))||n<1)return`Enter a whole-number quantity.`;if(!t.additionalCharge)return`Total: ${r(i)}`;let a=t.additionalCharge.firstUnitAmountCents+t.additionalCharge.additionalUnitAmountCents*(n-1),o=i+a;return Number.isSafeInteger(o)?`Subtotal: ${r(i)} · ${t.additionalCharge.name}: ${r(a)} · Total: ${r(o)}`:`Enter a valid quantity.`}function te(e,t,n){return String(e?t?t.quantity:1:t?t.amount/100:n)}function ne(e,t){return s(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 re(e,t,n){return s(t)?`All available quantities have been purchased.`:n===`draft`?`This item opens ${o(e,`draft`,t)}.`:t.saleMode===`buy_now`?`This item is no longer available to purchase.`:`Bidding has closed for this item.`}function ie(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 ae({auction:e,item:n,initialSelection:r,onContinue:a,onError:o,onBack:l,backHref:u,itemHeadingLevel:p=2}){let m=Z[p],h=n.saleMode===`buy_now`,g=Math.ceil(z(n)/100),[_,y]=F(te(h,r,g)),[b,x]=F(r?.bidType??`fixed`),[S,C]=F(null),w=M();c(n.startAt??e.startAt,n.endAt??e.endAt);let T=t(e,n),E=T===`active`&&!s(n)&&n.saleMode!==`hybrid`;function D(t){if(t.preventDefault(),!Q.test(_)){C(h?`Enter a whole-number quantity.`:`Enter a whole-dollar bid amount.`);return}let i=ie(e,h,r,_,b),s=d(e,n,i);if(s){C(s),o(s);return}try{f(e,n,i)}catch{C(`Enter a valid amount or quantity.`);return}a(i)}return E?R(`form`,{className:`lockerverse-auctions__selection`,onSubmit:D,children:[L(oe,{buyNow:h,headingTag:m,item:n}),R(`div`,{className:`lockerverse-auctions__selection-body`,children:[L(le,{bidType:b,enabled:!h&&!!n.supportsMaximumBids,id:w,onChange:e=>{x(e),C(null)}}),R(`label`,{className:`lockerverse-auctions__field`,htmlFor:w,children:[ce(h,b),R(`span`,{className:`lockerverse-auctions__amount-control`,children:[h?null:L(`span`,{"aria-hidden":`true`,children:`$`}),L(`input`,{"aria-describedby":h?`${w}-help`:void 0,"aria-invalid":!!S,autoComplete:`off`,id:w,inputMode:`numeric`,onChange:e=>{y(e.target.value),C(null)},placeholder:h?`1`:String(g),required:!0,value:_})]})]}),S?L(`p`,{role:`alert`,children:S}):null,h&&L(`p`,{id:`${w}-help`,children:ee(_,n)}),L(se,{item:n}),R(`div`,{className:`lockerverse-auctions__selection-footer`,children:[L(`p`,{children:h?`You pay at checkout.`:`We charge your card only if you win.`}),R(`button`,{className:`lockerverse-auctions__button`,disabled:!e.payment,type:`submit`,children:[h?`Continue to Checkout`:`Continue to Payment`,` `,L(v,{"aria-hidden":`true`,size:16})]})]}),e.payment?null:L(`p`,{role:`alert`,children:`Payments are not configured for this auction.`})]})]}):R(`div`,{className:`lockerverse-auctions__selection lockerverse-auctions__read-only`,children:[L(`p`,{className:`lockerverse-auctions__eyebrow`,children:`Item status`}),L(m,{children:ne(n,T)}),L(`p`,{children:re(e,n,T)}),R(i,{className:`lockerverse-auctions__button`,href:u,onBack:l,children:[`Browse auction items `,L(v,{"aria-hidden":`true`,size:16})]})]})}function oe({headingTag:e,item:t,buyNow:n}){return R(`div`,{className:`lockerverse-auctions__selection-header`,children:[L(`p`,{className:`lockerverse-auctions__eyebrow`,children:`Step 1 of 2`}),L(e,{children:n?`Buy this item`:`Place your bid`}),n?R(`p`,{children:[r(t.buyNowPriceAmount??0),` each`,t.availableQuantity===null?``:` · ${t.availableQuantity} available`]}):null]})}function se({item:e}){return e.saleMode===`buy_now`||!e.additionalCharge?null:R(`p`,{children:[e.additionalCharge.name,`:`,` `,r(e.additionalCharge.firstUnitAmountCents),` if you win.`]})}function ce(e,t){return e?`Quantity`:t===`maximum`?`Your maximum bid`:`Your bid amount`}function le({bidType:e,enabled:t,id:n,onChange:r}){return t?R(`fieldset`,{className:`lockerverse-auctions__bid-types`,children:[L(`legend`,{children:`Bid type`}),[`fixed`,`maximum`].map(t=>R(`div`,{className:`lockerverse-auctions__bid-type`,children:[R(`label`,{children:[L(`input`,{checked:e===t,name:`${n}-bid-type`,onChange:()=>r(t),type:`radio`,value:t}),L(`span`,{children:t===`fixed`?`Fixed bid`:`Maximum bid`})]}),L(ue,{id:`${n}-${t}-help`,type:t})]},t))]}):null}function ue({id:e,type:t}){let[n,r]=F(!1);return R(`button`,{"aria-describedby":n?e:void 0,"aria-label":`About ${t===`fixed`?`fixed`:`maximum`} bids`,className:`lockerverse-auctions__bid-help-button`,onBlur:()=>r(!1),onClick:()=>r(!0),onFocus:()=>r(!0),onKeyDown:e=>{e.key===`Escape`&&r(!1)},onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),type:`button`,children:[L(w,{"aria-hidden":`true`,size:16}),n&&L(`span`,{className:`lockerverse-auctions__bid-tip`,id:e,role:`tooltip`,children:t===`fixed`?`Bid this exact amount. It will not increase automatically.`:`We bid only what is needed to lead, up to your private limit. Accepted bids cannot be changed or canceled. A new bid is separate.`})]})}const $=()=>void 0;function de(e){let t=M(),{auction:n,item:r,selection:i,resumePurchase:a}=e,o=a?a.pricing:f(n,r,i),s=!!a||r.saleMode===`buy_now`;return L(p,{billingFields:null,buttonText:s?`Buy Now`:`Authorize Bid`,communityName:e.communityName??n.name,contactErrors:{},email:e.contact.email,id:t,includeServiceFee:i.includeServiceFee,isMaximumBid:!s&&i.bidType===`maximum`,isPurchase:s,isTerminal:!1,item:r,locked:!0,message:null,onBack:a||e.interactionLocked?void 0:e.onBack,onEmailChange:$,onIncludeServiceFeeChange:e.onIncludeServiceFeeChange,onPhoneChange:$,onSameAsBillingChange:$,onSubmit:e=>e.preventDefault(),paymentFields:null,phone:e.contact.phone,phoneCountry:h(e.contact.phone),pricing:o,quantity:i.quantity,sameAsBilling:!0,serviceFeeCents:a?o.serviceFeeCents:f(n,r,{...i,includeServiceFee:n.serviceFeeEnabled}).serviceFeeCents,serviceFeeEnabled:n.serviceFeeEnabled,shippingFields:null,showFields:!a,submitDisabled:!0})}let fe,pe=null;function me(){return fe??=import(`./auction-payment-view.js`).then(e=>(pe=e.AuctionPayment,e)),fe}function he(e,t,n){let r=e?.publishableKey,i=e?.connectedAccountId,[a,o]=F(null);return j(()=>{if(!(n&&r))return;let e=me().then(e=>e.loadAuctionStripe(r,i,t)).catch(()=>null);o({connectedAccountId:i,publishableKey:r,stripe:e,stripeLoader:t})},[n,r,i,t]),a?.publishableKey===r&&a?.connectedAccountId===i&&a?.stripeLoader===t?a?.stripe:void 0}function ge(e){let[t,n]=F(()=>pe),[r,i]=F(!1),a=!!(e.resumePurchase||e.interactionLocked);return j(()=>{let e=!0;return me().then(({AuctionPayment:t})=>{e&&n(()=>t)},()=>{e&&i(!0)}),()=>{e=!1}},[]),t?L(t,{...e}):r?R(`div`,{children:[L(`p`,{role:`alert`,children:`Payment details could not load.`}),a&&L(`p`,{children:`Your purchase status is not confirmed. Keep this page open and contact the auction organizer before you try another purchase.`}),a?null:L(`button`,{onClick:e.onBack,type:`button`,children:`Back to item`}),!a&&L(`button`,{onClick:()=>window.location.reload(),type:`button`,children:`Reload page to try again`})]}):L(de,{...e})}function _e(t){let{auction:n,item:r,outcome:i}=t,a;return t.backHref?a={href:t.backHref,label:`View auction items`}:t.onBack&&(a={label:`View auction items`,onClick:t.onBack}),L(g,{auctionName:n.name,className:t.className,closesAtLabel:o(n,`active`,r),communityName:t.communityName??n.community?.name,focusHeading:!0,imageUrl:r.image??r.images[0]??n.configuration.image??void 0,itemName:r.name,outcome:i,primaryAction:t.returnToItemHref?{href:t.returnToItemHref,label:`Return to item`}:a,secondaryAction:t.returnToItemHref?a:void 0,style:e(n,t.style,t.theme??`dark`),theme:t.theme})}function ve(n){let{auction:r,itemId:a,resumePurchase:o,className:l,theme:u=`dark`,style:d}=n,f=P(null),[p,h]=F(r),g=P(r),y=p.items.find(e=>e.id===a)??o?.item;c(y?.startAt??p.startAt,y?.endAt??p.endAt);let[x,S]=F(()=>o?{amount:0,includeServiceFee:o.submission.includeServiceFee??!1,quantity:o.submission.quantity}:null),[C,w]=F(!!o),T=P(!0),E=P(n);E.current=n;let D=P(null),O=A(e=>{T.current&&w(e),D.current!==e&&(D.current=e,_(E.current.onInteractionLockChange,e))},[]),k=!!o;j(()=>(T.current=!0,O(k),()=>{T.current=!1}),[k,O]);let[M,N]=F({email:``,phone:``}),[I,z]=F(null),[B,V]=F(!!o),[H,U]=F(null),[W,G]=F(null);j(()=>{!(B||C||o)&&g.current!==r&&(g.current=r,h(r))},[r,B,C,o]);let K=he(o?.payment??p.payment,n.stripeLoader,!!o||!!(y&&t(p,y)===`active`&&!s(y)&&y.saleMode!==`hybrid`));function q(e,t){O(!1),g.current=E.current.auction,h(e),S(null),V(!1),U(t)}function J(e){let t=m();z(t),t&&!(M.email||M.phone)&&N({email:t.email,phone:t.phone}),U(null),S(e),V(!0)}return y?W?L(_e,{...n,auction:p,item:y,outcome:W}):R(`section`,{className:[`lockerverse-auctions`,l].filter(Boolean).join(` `),"data-lockerverse-theme":u,ref:f,style:e(p,d,u),children:[C?null:R(i,{className:`lockerverse-auctions__back`,href:n.backHref,onBack:n.onBack,children:[L(b,{"aria-hidden":`true`,size:16}),` All items`]}),R(`div`,{className:`lockerverse-auctions__detail`,children:[L(X,{auction:p,galleryImageSizes:n.galleryImageSizes,item:y,itemHeadingLevel:n.itemHeadingLevel}),R(`div`,{className:`lockerverse-auctions__transaction`,children:[H?L(`p`,{className:`lockerverse-auctions__notice`,role:`alert`,children:H}):null,B&&x?L(ge,{...n,appearanceRoot:f,auction:p,communityName:n.communityName??p.community?.name,contact:M,interactionLocked:C,item:y,onBack:()=>V(!1),onContactChange:N,onIncludeServiceFeeChange:e=>S(t=>t&&{...t,includeServiceFee:p.serviceFeeEnabled&&e}),onInteractionLockChange:O,onResult:G,onReview:q,savedBidder:I,selection:x,stripePromise:K}):L(ae,{auction:p,backHref:n.backHref,initialSelection:x,item:y,itemHeadingLevel:n.itemHeadingLevel,onBack:n.onBack,onContinue:J,onError:U}),C?null:R(i,{className:`lockerverse-auctions__footer-back`,href:n.backHref,onBack:n.onBack,children:[`Back to auction items `,L(v,{"aria-hidden":`true`,size:16})]})]})]})]}):R(`div`,{children:[L(`p`,{role:`alert`,children:`This auction item is no longer available.`}),L(i,{href:n.backHref,onBack:n.onBack,children:`Back to auction items`})]})}function ye(e){let t=P({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 L(l.Provider,{value:e.auction.mediaBaseUrl,children:L(ve,{...e})})}export{ye as LockerverseAuctionItem};
2
2
  //# sourceMappingURL=auction-item.js.map