@lockerverse/react 0.2.237 → 0.2.239

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 (28) hide show
  1. package/MIGRATIONS.md +6 -0
  2. package/dist/auction-checkout-view.js +1 -1
  3. package/dist/auction-checkout-view.js.map +1 -1
  4. package/dist/auction-checkout.css +45 -50
  5. package/dist/auction-item-layout.css +19 -32
  6. package/dist/auction-item.d.ts.map +1 -1
  7. package/dist/auction-item.js +1 -1
  8. package/dist/auction-item.js.map +1 -1
  9. package/dist/embed/chunks/{auction-payment-view-FUYF5OLY.js → auction-payment-view-OQTNAO2U.js} +1 -1
  10. package/dist/embed/chunks/{chunk-KVE6ZGXF.js → chunk-I5GAVWKI.js} +2 -2
  11. package/dist/embed/chunks/{chunk-3RYR6IBV.js → chunk-RHG3IAB2.js} +2 -2
  12. package/dist/embed/chunks/chunk-VMUAIABH.js +1 -0
  13. package/dist/embed/chunks/lockerverse-auction-item-EE3GJUFW.js +2 -0
  14. package/dist/embed/lockerverse.js +1 -1
  15. package/dist/embed/runtime.js +2 -2
  16. package/guides/auctions.md +1 -1
  17. package/guides/bookings.md +1 -1
  18. package/guides/browser-embed.md +1 -1
  19. package/guides/events.md +1 -1
  20. package/guides/integration.md +1 -1
  21. package/guides/payment-widgets.md +1 -1
  22. package/guides/signup.md +1 -1
  23. package/package.json +2 -2
  24. package/dist/embed/chunks/chunk-OWUENBYV.js +0 -1
  25. package/dist/embed/chunks/lockerverse-auction-item-QDOQLEXZ.js +0 -2
  26. package/dist/embed/chunks/{chunk-KVE6ZGXF.js.LEGAL.txt → chunk-I5GAVWKI.js.LEGAL.txt} +3 -3
  27. /package/dist/embed/chunks/{chunk-3RYR6IBV.js.LEGAL.txt → chunk-RHG3IAB2.js.LEGAL.txt} +0 -0
  28. /package/dist/embed/chunks/{lockerverse-auction-item-QDOQLEXZ.js.LEGAL.txt → lockerverse-auction-item-EE3GJUFW.js.LEGAL.txt} +0 -0
package/MIGRATIONS.md CHANGED
@@ -4,6 +4,12 @@ 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
+ ## 0.2.237 — signup address suggestions
8
+
9
+ - **Automatic:** `LockerverseSignup` uses the city and state entered in the form when searching streets. A search can start with a street alone. Empty results and service failures explain how to continue with manual entry.
10
+ - **Host adoption:** existing hosts that pass `googlePlacesApiKey` need no code change. Hosts without a key can continue using manual entry. Auction and payment checkouts use Stripe's address fields.
11
+ - **Check:** type `Merry Lane` with city and state blank, then move focus to City and back to Street address. With a working key, suggestions or the empty-result message should appear. Repeat with city and state filled in. Do not submit the signup for this check.
12
+
7
13
  ## 0.2.236 — community styling across auction surfaces
8
14
 
9
15
  - **Automatic:** after updating matching SDK and React packages, the auction browser, catalog, standalone item cards, item checkout, and its result share the community accent. Cards use solid branded actions and a matching hover/focus border. Hex, CSS named, RGB and HSL accents receive contrasting text. The SDK composites translucent colors against the selected theme. Explicit `style` values take precedence; provide `--lockerverse-accent-contrast` for a contextual CSS color during server rendering. The Auburn Vault collection uses its configured two-column layout on wide screens.
@@ -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,isMaximumBid:d,item:f,id:p}=e;return u(`form`,{className:`lockerverse-auctions__checkout`,noValidate:!0,onSubmit:e.onSubmit,children:[u(`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})}),u(`div`,{children:[l(`p`,{className:`lockerverse-auctions__checkout-eyebrow`,children:`Step 2 of 2`}),l(`p`,{children:t?`Secure checkout`:`Secure payment method`})]})]}),l(`p`,{className:`lockerverse-auctions__checkout-eyebrow`,children:e.communityName}),l(`h2`,{children:t?`Finalize your purchase.`:`Finalize your bid authorization.`}),l(C,{...e}),f.collectShippingAddress&&u(`div`,{className:`lockerverse-auctions__checkout-physical`,children:[l(`p`,{className:`lockerverse-auctions__checkout-eyebrow`,children:`Physical item`}),l(`p`,{children:`This item requires a delivery address. Billing details are used by default, and you can switch to a separate delivery address below if needed.`})]})]}),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:`${p}-email`,label:`Email`,name:`email`,onChange:t=>e.onEmailChange(t.target.value),required:!0,value:e.email}),l(r,{error:e.contactErrors.phone,id:`${p}-phone`,label:`Phone`,children:l(i,{country:e.phoneCountry,error:e.contactErrors.phone,errorId:`${p}-phone-error`,id:`${p}-phone`,name:`phone`,onChange:e.onPhoneChange,required:!0,value:e.phone})})]}),u(`section`,{"aria-label":`Payment Information`,className:`lockerverse-auctions__checkout-section`,children:[u(`div`,{className:`lockerverse-auctions__checkout-section-heading`,children:[l(`h3`,{children:`Payment Information`}),l(`p`,{children:t?`Processed securely and charged immediately for this purchase.`:`Stored securely and charged only if your bid finishes on top.`})]}),e.paymentFields]}),u(`section`,{"aria-label":`Billing Details`,className:`lockerverse-auctions__checkout-section`,children:[l(`h3`,{children:`Billing Details`}),e.billingFields,l(`p`,{children:t?`Use your full name here. We use the email and phone above for purchase confirmation and fulfillment updates.`:`Use the bidder's full name here. We use the email and phone above to contact you if this bid is outbid or wins.`})]}),f.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:`${p}-delivery-same-as-billing`,children:[l(a,{checked:e.sameAsBilling,id:`${p}-delivery-same-as-billing`,onChange:t=>e.onSameAsBillingChange(t.target.checked)}),u(`span`,{children:[l(`strong`,{children:`Delivery address is the same as billing`}),l(`span`,{children:`Leave this on for the fastest flow. Turn it off only if the delivery address should differ from the billing details above.`})]})]}),!e.sameAsBilling&&u(c,{children:[l(`h3`,{children:`Delivery Address`}),e.shippingFields]})]}),l(S,{isMaximumBid:d,isPurchase:t,pricing:e.pricing}),e.serviceFeeEnabled&&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:[u(`p`,{children:[t?`By continuing, you agree to be charged for this purchase.`:`By continuing, you agree to have this payment method stored for item settlement if your bid is the winning offer.`,f.collectShippingAddress?` Your delivery details are stored with the ${t?`order`:`bid`} so the seller can fulfill the item after payment.`:``]}),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{isPurchase:n,isMaximumBid:r,pricing:i}=e,o=w(n,r);return l(`section`,{"aria-label":`Processing fees`,className:`lockerverse-auctions__checkout-section`,children: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)}),u(`span`,{children:[u(`strong`,{children:[o.fee,` `,t(e.serviceFeeCents),` to help cover processing fees`]}),u(`span`,{children:[o.total,`: `,t(i.totalCents)]})]})]}):u(`p`,{children:[o.total,`: `,t(i.totalCents)]})})}function S({pricing:e,isPurchase:n,isMaximumBid:r}){let i=w(n,r);return e.additionalCharge?u(`section`,{"aria-label":`Order amounts`,className:`lockerverse-auctions__checkout-section`,children:[u(`p`,{children:[i.amount,`: `,t(e.subtotalCents)]}),u(`p`,{children:[e.additionalCharge.name,`:`,` `,t(e.additionalChargeCents??0)]}),u(`p`,{children:[i.total,`: `,t(e.totalCents)]})]}):null}function C(e){let{isPurchase:n,isMaximumBid:r,item:i,pricing:a}=e;return l(`p`,{className:`lockerverse-auctions__checkout-summary`,children:n?u(c,{children:[`Pay `,l(`strong`,{children:t(a.totalCents)}),` for`,` `,e.quantity,` `,e.quantity===1?`item`:`items`,` of`,` `,l(`strong`,{children:i.name}),`. Your card is charged immediately once checkout succeeds.`]}):u(c,{children:[`Authorize a payment method for your`,` `,r?`maximum bid`:`bid`,` of`,` `,l(`strong`,{children:t(a.subtotalCents)}),` on`,` `,l(`strong`,{children:i.name}),`. Your card is only charged if this bid wins the item.`,r?` You pay the final winning price, up to your maximum, plus any agreed fees and additional charges. Your maximum stays private.`:``]})})}function w(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";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};
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, isMaximumBid, item, id } = props;\n return (\n <form\n className=\"lockerverse-auctions__checkout\"\n noValidate\n onSubmit={props.onSubmit}\n >\n <div className=\"lockerverse-auctions__checkout-header\">\n <div className=\"lockerverse-auctions__checkout-navigation\">\n <button\n aria-label=\"Back\"\n className=\"lockerverse-auctions__checkout-back\"\n disabled={!props.onBack}\n onClick={props.onBack}\n type=\"button\"\n >\n <ChevronLeft aria-hidden=\"true\" size={20} />\n </button>\n <div>\n <p className=\"lockerverse-auctions__checkout-eyebrow\">\n Step 2 of 2\n </p>\n <p>{isPurchase ? \"Secure checkout\" : \"Secure payment method\"}</p>\n </div>\n </div>\n <p className=\"lockerverse-auctions__checkout-eyebrow\">\n {props.communityName}\n </p>\n <h2>\n {isPurchase\n ? \"Finalize your purchase.\"\n : \"Finalize your bid authorization.\"}\n </h2>\n <CheckoutSummary {...props} />\n {item.collectShippingAddress && (\n <div className=\"lockerverse-auctions__checkout-physical\">\n <p className=\"lockerverse-auctions__checkout-eyebrow\">\n Physical item\n </p>\n <p>\n This item requires a delivery address. Billing details are used by\n default, and you can switch to a separate delivery address below\n if needed.\n </p>\n </div>\n )}\n </div>\n <div className=\"lockerverse-auctions__checkout-body\">\n {props.showFields && (\n <fieldset disabled={props.locked}>\n <div className=\"lockerverse-auctions__checkout-contact\">\n <EmailField\n error={props.contactErrors.email}\n id={`${id}-email`}\n label=\"Email\"\n name=\"email\"\n onChange={(event) => props.onEmailChange(event.target.value)}\n required\n value={props.email}\n />\n <FormField\n error={props.contactErrors.phone}\n id={`${id}-phone`}\n label=\"Phone\"\n >\n <PhoneInput\n country={props.phoneCountry}\n error={props.contactErrors.phone}\n errorId={`${id}-phone-error`}\n id={`${id}-phone`}\n name=\"phone\"\n onChange={props.onPhoneChange}\n required\n value={props.phone}\n />\n </FormField>\n </div>\n <section\n aria-label=\"Payment Information\"\n className=\"lockerverse-auctions__checkout-section\"\n >\n <div className=\"lockerverse-auctions__checkout-section-heading\">\n <h3>Payment Information</h3>\n <p>\n {isPurchase\n ? \"Processed securely and charged immediately for this purchase.\"\n : \"Stored securely and charged only if your bid finishes on top.\"}\n </p>\n </div>\n {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 <p>\n {isPurchase\n ? \"Use your full name here. We use the email and phone above for purchase confirmation and fulfillment updates.\"\n : \"Use the bidder's full name here. We use the email and phone above to contact you if this bid is outbid or wins.\"}\n </p>\n </section>\n {item.collectShippingAddress && (\n <section\n aria-label=\"Delivery Details\"\n className=\"lockerverse-auctions__checkout-section\"\n >\n <label\n className=\"lockerverse-auctions__checkout-checkbox lockerverse-auctions__checkout-delivery\"\n htmlFor={`${id}-delivery-same-as-billing`}\n >\n <Checkbox\n checked={props.sameAsBilling}\n id={`${id}-delivery-same-as-billing`}\n onChange={(event) =>\n props.onSameAsBillingChange(event.target.checked)\n }\n />\n <span>\n <strong>Delivery address is the same as billing</strong>\n <span>\n Leave this on for the fastest flow. Turn it off only if\n the delivery address should differ from the billing\n details above.\n </span>\n </span>\n </label>\n {!props.sameAsBilling && (\n <>\n <h3>Delivery Address</h3>\n {props.shippingFields}\n </>\n )}\n </section>\n )}\n <CheckoutAdditionalCharge\n isMaximumBid={isMaximumBid}\n isPurchase={isPurchase}\n pricing={props.pricing}\n />\n {props.serviceFeeEnabled && <CheckoutServiceFee {...props} />}\n </fieldset>\n )}\n {props.message && (\n <p\n aria-live=\"polite\"\n className=\"lockerverse-auctions__notice\"\n role=\"status\"\n >\n {props.message}\n </p>\n )}\n {!props.isTerminal && (\n <div className=\"lockerverse-auctions__checkout-footer\">\n <p>\n {isPurchase\n ? \"By continuing, you agree to be charged for this purchase.\"\n : \"By continuing, you agree to have this payment method stored for item settlement if your bid is the winning offer.\"}\n {item.collectShippingAddress\n ? ` Your delivery details are stored with the ${isPurchase ? \"order\" : \"bid\"} so the seller can fulfill the item after payment.`\n : \"\"}\n </p>\n <button\n className=\"lockerverse-auctions__button lockerverse-auctions__checkout-submit\"\n disabled={props.submitDisabled}\n type=\"submit\"\n >\n {props.buttonText}\n <ArrowRight aria-hidden=\"true\" size={16} />\n </button>\n </div>\n )}\n </div>\n </form>\n );\n}\n\nfunction CheckoutServiceFee(props: AuctionCheckoutViewProps) {\n const { isPurchase, isMaximumBid, pricing } = props;\n const labels = checkoutAmountLabels(isPurchase, isMaximumBid);\n return (\n <section\n aria-label=\"Processing fees\"\n className=\"lockerverse-auctions__checkout-section\"\n >\n {props.onIncludeServiceFeeChange ? (\n <label\n className=\"lockerverse-auctions__checkout-checkbox\"\n htmlFor={`${props.id}-service-fee`}\n >\n <Checkbox\n checked={props.includeServiceFee}\n id={`${props.id}-service-fee`}\n onChange={(event) =>\n props.onIncludeServiceFeeChange?.(event.target.checked)\n }\n />\n <span>\n <strong>\n {labels.fee} {formatMoney(props.serviceFeeCents)} to help cover\n processing fees\n </strong>\n <span>\n {labels.total}: {formatMoney(pricing.totalCents)}\n </span>\n </span>\n </label>\n ) : (\n <p>\n {labels.total}: {formatMoney(pricing.totalCents)}\n </p>\n )}\n </section>\n );\n}\n\nfunction CheckoutAdditionalCharge({\n pricing,\n isPurchase,\n isMaximumBid,\n}: {\n pricing: LockerverseAuctionPricing;\n isPurchase: boolean;\n isMaximumBid: boolean;\n}) {\n const labels = checkoutAmountLabels(isPurchase, isMaximumBid);\n if (!pricing.additionalCharge) {\n return null;\n }\n return (\n <section\n aria-label=\"Order amounts\"\n className=\"lockerverse-auctions__checkout-section\"\n >\n <p>\n {labels.amount}: {formatMoney(pricing.subtotalCents)}\n </p>\n <p>\n {pricing.additionalCharge.name}:{\" \"}\n {formatMoney(pricing.additionalChargeCents ?? 0)}\n </p>\n <p>\n {labels.total}: {formatMoney(pricing.totalCents)}\n </p>\n </section>\n );\n}\n\nfunction CheckoutSummary(props: AuctionCheckoutViewProps) {\n const { isPurchase, isMaximumBid, item, pricing } = props;\n return (\n <p className=\"lockerverse-auctions__checkout-summary\">\n {isPurchase ? (\n <>\n Pay <strong>{formatMoney(pricing.totalCents)}</strong> for{\" \"}\n {props.quantity} {props.quantity === 1 ? \"item\" : \"items\"} of{\" \"}\n <strong>{item.name}</strong>. Your card is charged immediately once\n checkout succeeds.\n </>\n ) : (\n <>\n Authorize a payment method for your{\" \"}\n {isMaximumBid ? \"maximum bid\" : \"bid\"} of{\" \"}\n <strong>{formatMoney(pricing.subtotalCents)}</strong> on{\" \"}\n <strong>{item.name}</strong>. Your card is only charged if this bid\n wins the item.\n {isMaximumBid\n ? \" You pay the final winning price, up to your maximum, plus any agreed fees and additional charges. Your maximum stays private.\"\n : \"\"}\n </>\n )}\n </p>\n );\n}\n\nfunction checkoutAmountLabels(isPurchase: boolean, isMaximumBid: boolean) {\n if (isPurchase) {\n return { amount: \"Subtotal\", fee: \"Add\", total: \"Total\" };\n }\n if (isMaximumBid) {\n return {\n amount: \"Maximum bid\",\n fee: \"If I win, add up to\",\n total: \"Maximum total if I win\",\n };\n }\n return {\n amount: \"Bid amount\",\n fee: \"If I win, add\",\n total: \"Total if I win\",\n };\n}\n"],"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,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A,SAAA,CACG,EAAO,MAAM,KAAGA,EAAY,EAAQ,UAAU,CAC9C,CAAA,CAAA,CACI,IAjBF,IAmBX,CAEA,SAAS,EAAgB,EAAiC,CACxD,GAAM,CAAE,aAAY,eAAc,OAAM,WAAY,EACpD,OACE,EAAC,IAAD,CAAG,UAAU,yCACV,SAAA,EACC,EAAA,EAAA,CAAA,SAAA,CAAE,OACI,EAAC,SAAD,CAAA,SAASA,EAAY,EAAQ,UAAU,CAAU,CAAA,EAAC,OAAK,IAC1D,EAAM,SAAS,IAAE,EAAM,WAAa,EAAI,OAAS,QAAQ,MAAI,IAC9D,EAAC,SAAD,CAAA,SAAS,EAAK,IAAa,CAAA,EAAC,4DAE5B,CAAA,CAAA,EAEF,EAAA,EAAA,CAAA,SAAA,CAAE,sCACoC,IACnC,EAAe,cAAgB,MAAM,MAAI,IAC1C,EAAC,SAAD,CAAA,SAASA,EAAY,EAAQ,aAAa,CAAU,CAAA,EAAC,MAAI,IACzD,EAAC,SAAD,CAAA,SAAS,EAAK,IAAa,CAAA,EAAC,yDAE3B,EACG,iIACA,EACJ,CAAA,CAAA,CAEH,CAAA,CAEP,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-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"}
@@ -13,7 +13,7 @@
13
13
  }
14
14
  .lockerverse-auctions__checkout-header,
15
15
  .lockerverse-auctions__checkout-body {
16
- padding: 28px;
16
+ padding: 20px;
17
17
  }
18
18
  .lockerverse-auctions__checkout-header {
19
19
  border-bottom: 1px solid var(--lockerverse-border);
@@ -23,21 +23,14 @@
23
23
  gap: 16px;
24
24
  align-items: center;
25
25
  justify-content: space-between;
26
- margin-bottom: 24px;
27
- }
28
- .lockerverse-auctions__checkout-navigation > div {
29
- text-align: right;
26
+ margin-bottom: 0;
30
27
  }
31
28
  .lockerverse-auctions .lockerverse-auctions__checkout-eyebrow {
32
29
  margin: 0;
33
30
  font-size: 11px;
34
31
  color: var(--lockerverse-muted);
35
32
  text-transform: uppercase;
36
- letter-spacing: 0.32em;
37
- }
38
- .lockerverse-auctions__checkout-navigation p + p {
39
- margin: 8px 0 0;
40
- font-size: 14px;
33
+ letter-spacing: 0.14em;
41
34
  }
42
35
  .lockerverse-auctions__checkout-back {
43
36
  display: inline-flex;
@@ -60,13 +53,14 @@
60
53
  opacity: 0.4;
61
54
  }
62
55
  .lockerverse-auctions .lockerverse-auctions__checkout-header h2 {
63
- margin-top: 12px;
64
- font-size: 30px;
56
+ flex: 1;
57
+ margin: 0;
58
+ font-size: clamp(18px, 3vw, 26px);
65
59
  font-weight: 600;
66
60
  letter-spacing: -0.04em;
67
61
  }
68
62
  .lockerverse-auctions .lockerverse-auctions__checkout-summary {
69
- margin-top: 12px;
63
+ margin: 6px 0 0;
70
64
  }
71
65
  .lockerverse-auctions__checkout strong {
72
66
  font-weight: 600;
@@ -74,24 +68,13 @@
74
68
  }
75
69
  .lockerverse-auctions .lockerverse-auctions__checkout p {
76
70
  font-size: 14px;
77
- line-height: 2;
71
+ line-height: 1.5;
78
72
  }
79
73
  .lockerverse-auctions
80
74
  .lockerverse-auctions__checkout
81
75
  p.lockerverse-auctions__checkout-eyebrow {
82
76
  font-size: 11px;
83
77
  }
84
- .lockerverse-auctions__checkout-physical {
85
- padding: 20px;
86
- margin-top: 20px;
87
- background: linear-gradient(
88
- 135deg,
89
- rgb(255 255 255 / 5%),
90
- rgb(255 255 255 / 2%)
91
- );
92
- border: 1px solid var(--lockerverse-border);
93
- border-radius: 24px;
94
- }
95
78
  .lockerverse-auctions .lockerverse-auctions__checkout fieldset {
96
79
  display: block;
97
80
  min-width: 0;
@@ -107,23 +90,16 @@
107
90
  .lockerverse-auctions__checkout-section {
108
91
  display: grid;
109
92
  gap: 12px;
110
- padding-top: 20px;
111
- margin-top: 24px;
93
+ padding-top: 14px;
94
+ margin-top: 16px;
112
95
  border-top: 1px solid var(--lockerverse-border);
113
96
  }
114
97
  .lockerverse-auctions .lockerverse-auctions__checkout-section h3 {
115
98
  margin: 0;
116
- font-size: 14px;
117
- font-weight: 500;
99
+ font-size: 16px;
100
+ font-weight: 600;
118
101
  line-height: 1.5;
119
102
  }
120
- .lockerverse-auctions__checkout-section-heading {
121
- display: flex;
122
- flex-wrap: wrap;
123
- column-gap: 16px;
124
- align-items: baseline;
125
- justify-content: space-between;
126
- }
127
103
  .lockerverse-auctions .lockerverse-auctions__checkout-section p {
128
104
  margin: 0;
129
105
  }
@@ -143,22 +119,16 @@
143
119
  font-size: 14px;
144
120
  }
145
121
  .lockerverse-auctions__checkout-checkbox > span > span {
146
- line-height: 2;
122
+ line-height: 1.5;
147
123
  color: var(--lockerverse-muted);
148
124
  }
149
- .lockerverse-auctions__checkout-delivery {
150
- padding: 20px;
151
- background: rgb(255 255 255 / 3%);
152
- border: 1px solid var(--lockerverse-border);
153
- border-radius: 24px;
154
- }
155
125
  .lockerverse-auctions__checkout-footer {
156
126
  display: flex;
157
127
  gap: 16px;
158
128
  align-items: center;
159
129
  justify-content: space-between;
160
- padding-top: 20px;
161
- margin-top: 24px;
130
+ padding-top: 14px;
131
+ margin-top: 16px;
162
132
  border-top: 1px solid var(--lockerverse-border);
163
133
  }
164
134
  .lockerverse-auctions .lockerverse-auctions__checkout-footer p {
@@ -179,17 +149,13 @@
179
149
  @media (max-width: 639px) {
180
150
  .lockerverse-auctions__checkout-header,
181
151
  .lockerverse-auctions__checkout-body {
182
- padding: 24px;
152
+ padding: 16px;
183
153
  }
184
154
 
185
155
  .lockerverse-auctions__checkout-footer {
186
156
  flex-direction: column;
187
157
  align-items: stretch;
188
158
  }
189
- .lockerverse-auctions__checkout-delivery,
190
- .lockerverse-auctions__checkout-physical {
191
- padding: 16px;
192
- }
193
159
  }
194
160
 
195
161
  @media (max-width: 767px) {
@@ -197,3 +163,32 @@
197
163
  grid-template-columns: minmax(0, 1fr);
198
164
  }
199
165
  }
166
+
167
+ .lockerverse-auctions__checkout-navigation
168
+ .lockerverse-auctions__checkout-eyebrow {
169
+ white-space: nowrap;
170
+ }
171
+ .lockerverse-auctions .lockerverse-auctions__amounts > p {
172
+ display: flex;
173
+ gap: 12px;
174
+ justify-content: space-between;
175
+ font-variant-numeric: tabular-nums;
176
+ }
177
+ .lockerverse-auctions__amounts .lockerverse-auctions__checkout-checkbox {
178
+ gap: 8px;
179
+ align-items: center;
180
+ }
181
+ .lockerverse-auctions__amounts
182
+ .lockerverse-auctions__checkout-checkbox
183
+ > input {
184
+ margin: 0;
185
+ }
186
+ .lockerverse-auctions__amounts
187
+ .lockerverse-auctions__checkout-checkbox
188
+ > span:last-child {
189
+ margin-inline-start: auto;
190
+ }
191
+ .lockerverse-auctions__total {
192
+ padding-top: 10px;
193
+ border-top: 1px solid var(--lockerverse-border);
194
+ }
@@ -113,22 +113,6 @@
113
113
  gap: 24px;
114
114
  min-width: 0;
115
115
  }
116
- .lockerverse-auctions__progress {
117
- display: flex;
118
- flex-wrap: wrap;
119
- gap: 8px;
120
- padding: 24px;
121
- background: rgb(128 128 128 / 4%);
122
- border: 1px solid var(--lockerverse-border);
123
- border-radius: 28px;
124
- }
125
- .lockerverse-auctions__progress span {
126
- padding: 10px 16px;
127
- font-size: 14px;
128
- font-weight: 500;
129
- border: 1px solid var(--lockerverse-border);
130
- border-radius: 999px;
131
- }
132
116
  .lockerverse-auctions__selection {
133
117
  overflow: hidden;
134
118
  background: var(--lockerverse-control);
@@ -138,14 +122,14 @@
138
122
  }
139
123
  .lockerverse-auctions__selection-header,
140
124
  .lockerverse-auctions__selection-body {
141
- padding: 28px;
125
+ padding: 24px;
142
126
  }
143
127
  .lockerverse-auctions__selection-header {
144
- border-bottom: 1px solid var(--lockerverse-border);
128
+ padding-bottom: 0;
145
129
  }
146
130
  .lockerverse-auctions__selection :is(h2, h3) {
147
- margin-top: 12px;
148
- font-size: 30px;
131
+ margin: 4px 0 0;
132
+ font-size: 26px;
149
133
  font-weight: 600;
150
134
  line-height: 1.3;
151
135
  letter-spacing: -0.04em;
@@ -153,12 +137,15 @@
153
137
  overflow-wrap: anywhere;
154
138
  }
155
139
  .lockerverse-auctions__selection p {
156
- margin-top: 12px;
140
+ margin: 8px 0 0;
157
141
  font-size: 14px;
158
- line-height: 2;
142
+ line-height: 1.5;
159
143
  }
160
- .lockerverse-auctions__selection strong {
161
- color: var(--lockerverse-text);
144
+ .lockerverse-auctions__selection-body > .lockerverse-auctions__field {
145
+ font-weight: 600;
146
+ }
147
+ .lockerverse-auctions__bid-types + .lockerverse-auctions__field {
148
+ margin-top: 20px;
162
149
  }
163
150
  .lockerverse-auctions__amount-control {
164
151
  position: relative;
@@ -173,13 +160,13 @@
173
160
  transform: translateY(-50%);
174
161
  }
175
162
  .lockerverse-auctions__amount-control input {
176
- height: 78px;
163
+ height: 60px;
177
164
  padding-left: 24px;
178
- font-size: 36px;
165
+ font-size: 30px;
179
166
  font-weight: 600;
180
167
  letter-spacing: -0.05em;
181
168
  background: var(--lockerverse-auction-amount-bg);
182
- border-radius: 24px;
169
+ border-radius: 12px;
183
170
  }
184
171
  .lockerverse-auctions__amount-control > span + input {
185
172
  padding-left: 48px;
@@ -274,9 +261,11 @@
274
261
  .lockerverse-auctions__item-copy :is(h1, h2) {
275
262
  font-size: var(--lockerverse-auction-item-title-size, 30px);
276
263
  }
277
- .lockerverse-auctions__selection-header,
264
+ .lockerverse-auctions__selection-header {
265
+ padding: 20px 20px 0;
266
+ }
278
267
  .lockerverse-auctions__selection-body {
279
- padding: 24px;
268
+ padding: 20px;
280
269
  }
281
270
  .lockerverse-auctions__selection-footer {
282
271
  flex-direction: column;
@@ -293,13 +282,11 @@
293
282
  }
294
283
  }
295
284
 
296
- .lockerverse-auctions__stat-row dt,
297
- .lockerverse-auctions__progress span {
285
+ .lockerverse-auctions__stat-row dt {
298
286
  display: flex;
299
287
  gap: 10px;
300
288
  align-items: center;
301
289
  }
302
- .lockerverse-auctions__progress svg,
303
290
  .lockerverse-auctions__stat-row dt svg {
304
291
  flex-shrink: 0;
305
292
  opacity: 0.65;
@@ -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;;;;iBC4PH,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;;;;iBC4NH,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:a,onContinue:o,onError:l,onBack:u,backHref:p,itemHeadingLevel:m=2}){let h=X[m],g=n.saleMode===`buy_now`,v=Math.ceil(R(n)/100),[y,b]=P(ee(g,a,v)),[x,S]=P(a?.bidType??`fixed`),[C,w]=P(null),T=j();c(n.startAt??e.startAt,n.endAt??e.endAt);let E=t(e,n),D=E===`active`&&!s(n)&&n.saleMode!==`hybrid`;function O(t){if(t.preventDefault(),!Z.test(y)){w(g?`Enter a whole-number quantity.`:`Enter a whole-dollar bid amount.`);return}let r=re(e,g,a,y,x),i=d(e,n,r);if(i){w(i),l(i);return}try{f(e,n,r)}catch{w(`Enter a valid amount or quantity.`);return}o(r)}return D?L(`form`,{className:`lockerverse-auctions__selection`,onSubmit:O,children:[I(ae,{buyNow:g,headingTag:h,item:n,minimum:v}),L(`div`,{className:`lockerverse-auctions__selection-body`,children:[I(ce,{bidType:x,enabled:!g&&!!n.supportsMaximumBids,id:T,onChange:e=>{S(e),w(null)}}),L(`label`,{className:`lockerverse-auctions__field`,htmlFor:T,children:[se(g,x),L(`span`,{className:`lockerverse-auctions__amount-control`,children:[g?null:I(`span`,{"aria-hidden":`true`,children:`$`}),I(`input`,{"aria-describedby":`${T}-help`,"aria-invalid":!!C,autoComplete:`off`,id:T,inputMode:`numeric`,onChange:e=>{b(e.target.value),w(null)},placeholder:g?`1`:String(v),required:!0,value:y})]})]}),C?I(`p`,{role:`alert`,children:C}):null,I(`p`,{id:`${T}-help`,children:g?Q(y,n):`Enter a whole-dollar bid of at least ${r(v*100)}. Bid increment: ${r(n.bidIncrementAmount??100)}.`}),I(oe,{item:n}),L(`div`,{className:`lockerverse-auctions__selection-footer`,children:[I(`p`,{children:g?`Continuing moves you into secure checkout where your payment is processed immediately.`:`Continuing moves you into the secure payment step where your card is stored for settlement only if your bid wins.`}),L(`button`,{className:`lockerverse-auctions__button`,disabled:!e.payment,type:`submit`,children:[g?`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(h,{children:te(n,E)}),I(`p`,{children:ne(e,n,E)}),L(i,{className:`lockerverse-auctions__button`,href:p,onBack:u,children:[`Browse auction items `,I(_,{"aria-hidden":`true`,size:16})]})]})}function ae({headingTag:e,item:t,buyNow:n,minimum:i}){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 now.`:`Place your bid.`}),I(`p`,{children:n?`Choose how many you want, then complete the secure checkout.`:`Choose your bid amount. You are only charged if this bid wins after bidding closes.`}),L(`p`,{children:[n?`Price: `:`Minimum qualifying bid: `,I(`strong`,{children:r(n?t.buyNowPriceAmount??0:i*100)})]}),n&&t.availableQuantity!==null?L(`p`,{children:[t.availableQuantity,` available`]}):null,t.collectShippingAddress?I(`p`,{children:`The next step will also collect a delivery address for seller fulfillment.`}):null]})}function oe({item:e}){return e.saleMode===`buy_now`||!e.additionalCharge?null:L(`p`,{children:[e.additionalCharge.name,`:`,` `,r(e.additionalCharge.firstUnitAmountCents),` will be added to your winning bid.`]})}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({buyNow:e}){return L(`div`,{className:`lockerverse-auctions__progress`,children:[L(`span`,{children:[I(e?E:S,{"aria-hidden":`true`,size:16}),e?`Choose quantity`:`Place bid`]}),L(`span`,{children:[I(E,{"aria-hidden":`true`,size:16}),e?`Pay securely`:`Secure card`]}),L(`span`,{children:[I(D,{"aria-hidden":`true`,size:16}),e?`Get confirmation`:`Wait for close`]})]})}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}),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 ve(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(_e,{...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:[t(p,v)===`active`?I(ge,{buyNow:v.saleMode===`buy_now`}):null,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 ye(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(ve,{...e})})}export{ye 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}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};
2
2
  //# sourceMappingURL=auction-item.js.map