@lockerverse/react 0.2.209 → 0.2.211

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/MIGRATIONS.md CHANGED
@@ -36,6 +36,36 @@ If it cannot be found, report that limit and use the baseline review below. Do n
36
36
  claim that every historical migration was applied. Read this file even if the
37
37
  version already matches: a previous upgrade may have missed host adoption steps.
38
38
 
39
+ ## 0.2.211 — auction bid tips and faster payment entry
40
+
41
+ - **Affected:** React auction item pages and auction checkout.
42
+ - **Automatic:** fixed and maximum bid explanations appear in info tips on hover,
43
+ keyboard focus, or tap, without a separate paragraph. Active item pages warm
44
+ the checkout code and Stripe before Continue. The checkout form can appear
45
+ while Stripe fields finish loading. No bid or purchase is created by preload.
46
+ - **Required:** upgrade matching SDK/React packages and deploy the host. No host
47
+ props or auction settings need to change. Catalog pages do not preload Stripe.
48
+ - **Check:** open both tips with a mouse and keyboard, press Escape, then use
49
+ Continue with a slow connection. Contact fields should appear before Stripe
50
+ is ready. Check Back and payment load failure without submitting a live bid.
51
+
52
+ ## 0.2.210 — Apple Pay and Google Pay
53
+
54
+ - **Affected:** React payment widgets, donate launchers, and auction checkout,
55
+ including bid payment-method setup.
56
+ - **Automatic:** allows Apple Pay and Google Pay when Stripe reports that the
57
+ wallet is available. Existing card, ACH, and off-session setup rules remain.
58
+ - **Required:** upgrade matching SDK/React packages and deploy each host. Enable
59
+ both wallets in Stripe and register every checkout domain and subdomain on
60
+ the account that takes the charge, including connected accounts for direct
61
+ charges. For cross-origin embeds, register both the host and iframe domains
62
+ and set `allow="payment *"` on every containing iframe. A restrictive
63
+ `Permissions-Policy` header must also permit payment for these origins.
64
+ - **Check:** use HTTPS and an eligible browser with a configured wallet. Check
65
+ direct checkout and embedded checkout on desktop and mobile. Stripe controls
66
+ wallet availability; unsupported devices can continue to use card entry.
67
+ No SDK prop changes or live transactions are required for this check.
68
+
39
69
  ## 0.2.209 — slightly stronger ticket tint
40
70
 
41
71
  - **Affected:** React donate launcher ticket products with community branding.
package/SDK_RULES.md CHANGED
@@ -78,7 +78,8 @@ A package installation does not run these instructions or modify the host file.
78
78
  rendered size and device pixel ratio. Do not lower quality only for a score.
79
79
  - Import the narrow public entry point for the feature. Keep payment code and
80
80
  optional Stripe peers out of unrelated catalog, event, and signup imports.
81
- Defer auction checkout code until payment or recovery needs it.
81
+ Warm auction checkout code and Stripe on active item pages. Keep them out
82
+ of catalog pages and server rendering; do not create transactions to preload.
82
83
  - Keep required first-screen styles available. Scope widget styles and inherit
83
84
  host fonts where supported. Do not add remote fonts or global font rules to
84
85
  widgets. The host owns font compression, preload choices, background video,
@@ -0,0 +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};
2
+ //# sourceMappingURL=auction-checkout-view.js.map
@@ -0,0 +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,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 8px;
319
319
  font-weight: 600;
320
320
  }
321
- .lockerverse-auctions__bid-types label {
321
+ .lockerverse-auctions__bid-type {
322
+ position: relative;
322
323
  display: flex;
323
324
  flex: 1 1 140px;
325
+ align-items: center;
326
+ border: 1px solid var(--lockerverse-border);
327
+ border-radius: 12px;
328
+ }
329
+ .lockerverse-auctions__bid-type label {
330
+ display: flex;
331
+ flex: 1;
324
332
  gap: 10px;
325
333
  align-items: center;
326
334
  min-height: 48px;
327
335
  padding: 12px 16px;
328
336
  cursor: pointer;
329
- border: 1px solid var(--lockerverse-border);
330
- border-radius: 12px;
331
337
  }
332
- .lockerverse-auctions__bid-types label:has(input:checked) {
338
+ .lockerverse-auctions__bid-type:has(input:checked) {
333
339
  border-color: var(--lockerverse-accent);
334
340
  }
335
341
  .lockerverse-auctions__bid-types input {
@@ -339,3 +345,42 @@
339
345
  outline: 2px solid var(--lockerverse-accent);
340
346
  outline-offset: 3px;
341
347
  }
348
+
349
+ .lockerverse-auctions__bid-help-button {
350
+ display: grid;
351
+ flex-shrink: 0;
352
+ place-items: center;
353
+ align-self: stretch;
354
+ width: 32px;
355
+ min-height: 48px;
356
+ padding: 0;
357
+ margin-right: 10px;
358
+ color: var(--lockerverse-muted);
359
+ cursor: pointer;
360
+ background: transparent;
361
+ border: 0;
362
+ border-radius: 8px;
363
+ }
364
+ .lockerverse-auctions__bid-help-button:hover {
365
+ color: var(--lockerverse-text);
366
+ }
367
+ .lockerverse-auctions__bid-help-button:focus-visible {
368
+ outline: 2px solid var(--lockerverse-accent);
369
+ outline-offset: 2px;
370
+ }
371
+ .lockerverse-auctions__bid-tip {
372
+ position: absolute;
373
+ right: 0;
374
+ bottom: 100%;
375
+ left: 0;
376
+ z-index: 2;
377
+ padding: 12px;
378
+ font-size: 13px;
379
+ line-height: 1.5;
380
+ color: var(--lockerverse-text);
381
+ text-align: left;
382
+ cursor: default;
383
+ background: var(--lockerverse-control);
384
+ border: 1px solid var(--lockerverse-border);
385
+ border-radius: 8px;
386
+ }
@@ -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;;;;iBC4OH,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;;;;iBC6PH,uBAAuB,OAAO,8CAA2B,IAAA"}
@@ -1,2 +1,2 @@
1
- import{a as e,c as t,i as n,l as r,n as i,r as a,s as o,t as s}from"./use-auction-boundary.js";import{n as c,t as l}from"./auction-image.js";import{a as u,i as d}from"./auction-payment.js";import{t as f}from"./auction-result2.js";import{t as p}from"./host-callback.js";import{ArrowRight as m,ChevronDown as h,ChevronLeft as g,ChevronRight as _,Clock3 as v,Gavel as y,Pause as b,Play as x,ShieldCheck as S,TimerReset as C,X as w}from"lucide-react";import{useCallback as T,useEffect as E,useId as D,useMemo as O,useRef as k,useState as A}from"react";import{Fragment as j,jsx as M,jsxs as N}from"react/jsx-runtime";import{getLockerverseAuctionMinimumBid as P}from"@lockerverse/sdk/auctions";import{Dialog as F}from"@base-ui/react/dialog";import I from"embla-carousel-autoplay";import L from"embla-carousel-react";const R=6e3;function z(e,t){let n=k(R),r=k(null),[i,a]=A(R),o=O(()=>I({delay:i,playOnInit:!1,stopOnFocusIn:!1,stopOnInteraction:!0,stopOnMouseEnter:!1}),[i]),[s,c]=L({duration:t?0:25,loop:!0},[o]),l=T(()=>{r.current&&(r.current.style.transform=`scaleX(${1-n.current/R})`)},[]),u=T(()=>{let e=o.timeUntilNext();e!==null&&(n.current=Math.max(1,Math.min(R,e))),o.stop(),l()},[o,l]),d=T(()=>{n.current=R,a(R),o.reset(),l()},[o,l]);return E(()=>{c&&(e?i===n.current?o.play():a(n.current):u())},[c,e,o,i,a,n,u]),E(()=>{if(!c)return;let t=0,r=()=>{let i=o.timeUntilNext();!e||i===null||(n.current=Math.max(0,Math.min(R,i)),l(),t=requestAnimationFrame(r))},i=()=>{cancelAnimationFrame(t),e&&(t=requestAnimationFrame(r))},a=()=>cancelAnimationFrame(t),s=()=>{e&&o.play()};return c.on(`select`,d).on(`reInit`,s).on(`autoplay:timerset`,i).on(`autoplay:timerstopped`,a),l(),i(),()=>{a(),c.off(`select`,d).off(`reInit`,s).off(`autoplay:timerset`,i).off(`autoplay:timerstopped`,a)}},[c,o,e,n,d,l]),{embla:c,freeze:u,progressRef:r,reset:d,viewportRef:s}}function B({photos:e,name:t,imageSizes:n=`(max-width: 1279px) 100vw, 45vw`,selected:r,paused:a=!1,photoButtonRef:o,onSelect:s,onExpand:c}){let u=k(null),d=k(null),f=k([]),[p,m]=A(!0),[h,v]=A(!1),[y,S]=A(!1),[C,w]=A(!1),[T,D]=A(!1),{ref:O,visible:P}=i(),[F,I]=A(!1),[L,R]=A(!0),B=k(null),V=`lockerverse-auction-gallery__control ${L||F||y?`is-visible`:``}`,H=()=>{B.current&&clearTimeout(B.current),B.current=setTimeout(()=>I(!1),2e3)},U=e=>{if(e.pointerType!==`mouse`){R(!0);return}I(!0),B.current&&clearTimeout(B.current),e.target instanceof Element&&e.target.closest(`[data-gallery-control]`)||H()};E(()=>{let e=window.matchMedia(`(hover: none), (pointer: coarse)`),t=()=>R(e.matches);return t(),e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t),clearTimeout(B.current??void 0)}},[]);let W=!(a||p||h||y||C||T)&&P,G=e.length,K=G?(r%G+G)%G:0,{viewportRef:q,embla:J,progressRef:Y,freeze:X,reset:Z}=z(W&&G>1,p);E(()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>m(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),E(()=>{if(!J)return;let e=()=>s(J.selectedScrollSnap());return J.on(`select`,e).on(`reInit`,e),()=>{J.off(`select`,e).off(`reInit`,e)}},[J,s]),E(()=>{J&&J.selectedScrollSnap()!==K&&J.scrollTo(K,!0)},[J,K]),E(()=>{let e=()=>{document.hidden&&X()},t=()=>D(!1);return e(),document.addEventListener(`visibilitychange`,e,!0),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{document.removeEventListener(`visibilitychange`,e,!0),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t)}},[X]);let Q=e=>{J?.scrollTo((e+G)%G,p),Z()};return E(()=>{let e=d.current;d.current=null,e&&document.activeElement===e&&O.current?.querySelector(`.lockerverse-auction-gallery__photo[tabindex="0"]`)?.focus({preventScroll:!0})},[K,O]),E(()=>{let e=u.current,t=f.current[K];if(!(e&&t))return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();r.left<n.left?e.scrollLeft-=n.left-r.left:r.right>n.right&&(e.scrollLeft+=r.right-n.right)},[K,G]),N(`section`,{"aria-label":`${t} photos`,className:`lockerverse-auction-gallery`,onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||S(!1)},onFocusCapture:e=>S(e.target.matches(`:focus-visible`)),onKeyDown:e=>{G<2||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),e.target instanceof HTMLButtonElement&&e.target.classList.contains(`lockerverse-auction-gallery__photo`)&&(d.current=e.target),Q(K+(e.key===`ArrowRight`?1:-1)))},onPointerEnter:e=>{e.pointerType===`mouse`&&v(!0)},onPointerLeave:e=>{e.pointerType===`mouse`&&v(!1)},ref:O,children:[G?N(`div`,{className:`lockerverse-auction-gallery__stage`,onPointerEnter:U,onPointerLeave:H,onPointerMove:U,children:[M(`div`,{className:`lockerverse-auction-gallery__viewport`,onPointerDownCapture:()=>{X(),D(!0)},ref:q,children:M(`div`,{className:`lockerverse-auction-gallery__track`,children:e.map((e,r)=>M(`div`,{"aria-hidden":r!==K,className:`lockerverse-auction-gallery__slide`,children:M(`button`,{"aria-label":`View photo ${r+1} of ${t} at full size`,className:`lockerverse-auction-gallery__photo`,onClick:()=>{c(r)},ref:r===K?o:void 0,tabIndex:r===K?0:-1,type:`button`,children:M(l,{alt:`${t}, ${r+1} of ${G}`,className:`lockerverse-auction-gallery__image`,draggable:!1,fetchPriority:r===0?`high`:`auto`,height:900,loading:r===K?`eager`:`lazy`,maxWidth:1920,sizes:r===K?n:`auto, ${n}`,src:e,width:1200})})},`${e}-${r}`))})}),G>1&&!p&&N(`div`,{className:`lockerverse-auction-gallery__rotation`,children:[M(`div`,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__progress-track`,children:M(`div`,{className:`lockerverse-auction-gallery__progress`,ref:Y,style:{transform:`scaleX(0)`}})}),M(`button`,{"aria-label":C?`Play photo rotation`:`Pause photo rotation`,className:`lockerverse-auction-gallery__play ${V}`,"data-gallery-control":!0,onClick:()=>w(e=>!e),title:C?`Play photo rotation`:`Pause photo rotation`,type:`button`,children:M(C?x:b,{"aria-hidden":`true`,size:13})})]}),G>1&&N(j,{children:[M(`button`,{"aria-label":`Previous photo`,className:`lockerverse-auction-gallery__previous ${V}`,"data-gallery-control":!0,onClick:()=>Q(K-1),type:`button`,children:M(g,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__chevron`})}),M(`button`,{"aria-label":`Next photo`,className:`lockerverse-auction-gallery__next ${V}`,"data-gallery-control":!0,onClick:()=>Q(K+1),type:`button`,children:M(_,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__chevron`})})]})]}):M(`div`,{className:`lockerverse-auction-gallery__empty`,children:`No photo available`}),G>1&&M(`section`,{"aria-label":`Choose a photo`,className:`lockerverse-auction-gallery__strip`,ref:u,children:M(`div`,{className:`lockerverse-auction-gallery__thumbnails`,children:e.map((e,t)=>M(`button`,{"aria-label":`Show photo ${t+1} of ${G}`,"aria-pressed":K===t,className:`lockerverse-auction-gallery__thumbnail ${K===t?`is-selected`:``}`,onClick:()=>Q(t),ref:e=>{f.current[t]=e},type:`button`,children:M(l,{alt:``,className:`lockerverse-auction-gallery__thumbnail-image`,height:66,loading:`lazy`,maxWidth:192,sizes:`88px`,src:e,width:88})},`${e}-${t}`))})})]})}function V({images:e,fallbackImage:t,name:n,imageSizes:r}){let i=[...new Set(e.filter(Boolean))];!i.length&&t&&i.push(t);let[a,o]=A(0),[s,c]=A(!1),u=k(null),d=k(null),f=i.length,p=f?(a%f+f)%f:0;return N(j,{children:[M(B,{imageSizes:r,name:n,onExpand:e=>{o(e),c(!0)},onSelect:o,paused:s,photoButtonRef:u,photos:i,selected:p}),f>0&&M(F.Root,{onOpenChange:c,open:s,children:N(F.Portal,{children:[M(F.Backdrop,{className:`lockerverse-auction-gallery__backdrop`}),N(F.Popup,{"aria-describedby":void 0,className:`lockerverse-auction-gallery__viewer`,finalFocus:u,onKeyDown:e=>{f<2||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),o((p+(e.key===`ArrowRight`?1:-1)+f)%f))},children:[N(F.Title,{className:`lockerverse-auction-gallery__sr-only`,children:[n,` · Photo `,p+1,` of `,f]}),N(`div`,{className:`lockerverse-auction-gallery__full-image`,onTouchCancel:()=>{d.current=null},onTouchEnd:e=>{let t=d.current;d.current=null;let n=e.changedTouches.item(0);if(!(t&&n)||f<2)return;let r=n.clientX-t.x,i=n.clientY-t.y;Math.abs(r)>=45&&Math.abs(r)>Math.abs(i)*1.3&&o((p+(r<0?1:-1)+f)%f)},onTouchMove:e=>{e.touches.length!==1&&(d.current=null)},onTouchStart:e=>{let t=e.touches.item(0);d.current=e.touches.length===1&&t?{x:t.clientX,y:t.clientY}:null},children:[M(l,{alt:`${n}, ${p+1} of ${f}`,height:900,maxWidth:1920,sizes:`100vw`,src:i[p],width:1200}),s&&f>1&&M(l,{alt:``,"aria-hidden":`true`,className:`lockerverse-auction-gallery__preload`,height:900,loading:`eager`,maxWidth:1920,sizes:`100vw`,src:i[(p+1)%f],width:1200})]}),M(F.Close,{"aria-label":`Close photo viewer`,className:`lockerverse-auction-gallery__viewer-close`,children:M(w,{"aria-hidden":`true`,size:22})}),f>1&&N(j,{children:[M(`button`,{"aria-label":`Previous photo`,className:`lockerverse-auction-gallery__viewer-previous`,onClick:()=>o((p-1+f)%f),type:`button`,children:M(g,{"aria-hidden":`true`,size:28})}),M(`button`,{"aria-label":`Next photo`,className:`lockerverse-auction-gallery__viewer-next`,onClick:()=>o((p+1)%f),type:`button`,children:M(_,{"aria-hidden":`true`,size:28})})]})]})]})})]})}const H={1:`h1`,2:`h2`};function U(e){return M(e===`Buy Now`?S:e===`Available`||e===`Increment`?C:y,{"aria-hidden":`true`,size:16})}function W(e,t){return e.saleMode===`buy_now`?[[`Buy Now`,n(e.buyNowPriceAmount??0)],[`Available`,e.availableQuantity===null?`Available`:String(e.availableQuantity)]]:t===`finished`?[[`Final bid`,e.maxBidAmount?n(e.maxBidAmount):`No bids`]]:[[`Current bid`,n(e.maxBidAmount??0)],[`Floor`,n(e.minBidAmount??0)],[`Increment`,n(e.bidIncrementAmount??100)]]}function G({auction:r,item:i,itemHeadingLevel:o=2,galleryImageSizes:c}){s(i.startAt??r.startAt,i.endAt??r.endAt);let[l,u]=A(!1),d=D(),f=e(r,i),p={active:`Closes`,draft:`Opens`,finished:`Closed`}[f],m=a(r,f,i),g=i.saleMode===`buy_now`,_=(i.description??``).trim().length>240,y=W(i,f),b=H[o];return N(`section`,{className:`lockerverse-auctions__item-summary`,children:[M(V,{fallbackImage:i.image??r.configuration.image??r.community?.banner??r.community?.thumbnail??null,imageSizes:c,images:i.images,name:i.name}),N(`div`,{className:`lockerverse-auctions__item-copy`,children:[M(b,{children:i.name}),i.description?N(`div`,{className:`lockerverse-auctions__item-description`,children:[M(t,{className:!l&&_?`lockerverse-auctions__description-clamped`:void 0,description:i.description,id:d}),_?N(`button`,{"aria-controls":d,"aria-expanded":l,className:`lockerverse-auctions__description-toggle`,onClick:()=>u(!l),type:`button`,children:[l?`Hide description`:`Read full description`,` `,M(h,{"aria-hidden":`true`,size:16,style:{transform:l?`rotate(180deg)`:void 0}})]}):null]}):null,N(`dl`,{className:`lockerverse-auctions__stat-panel`,children:[y.map(([e,t])=>N(`div`,{className:`lockerverse-auctions__stat-row`,children:[N(`dt`,{children:[U(e),e]}),M(`dd`,{children:t})]},e)),N(`div`,{className:`lockerverse-auctions__stat-row`,children:[N(`dt`,{children:[M(v,{"aria-hidden":`true`,size:16}),p]}),M(`dd`,{className:`lockerverse-auctions__stat-date`,children:m})]}),!g&&f===`finished`?N(`div`,{className:`lockerverse-auctions__stat-footer`,children:[N(`div`,{children:[M(`dt`,{children:`Floor`}),M(`dd`,{children:n(i.minBidAmount??0)})]}),N(`div`,{children:[M(`dt`,{children:`Bid increment`}),M(`dd`,{children:n(i.bidIncrementAmount??100)})]})]}):null]})]})]})}const K={1:`h2`,2:`h3`},q=/^\d+$/;function J(e,t){let r=Number(e),i=r*(t.buyNowPriceAmount??0);if(!(q.test(e)&&Number.isSafeInteger(i))||r<1)return`Enter a whole-number quantity.`;if(!t.additionalCharge)return`Total: ${n(i)}`;let a=t.additionalCharge.firstUnitAmountCents+t.additionalCharge.additionalUnitAmountCents*(r-1),o=i+a;return Number.isSafeInteger(o)?`Subtotal: ${n(i)} · ${t.additionalCharge.name}: ${n(a)} · Total: ${n(o)}`:`Enter a valid quantity.`}function Y(e,t,n){return String(e?t?t.quantity:1:t?t.amount/100:n)}function X(e,t){return o(e)?`This item is sold out.`:t===`draft`?`This item is not open yet.`:t===`finished`?e.saleMode===`buy_now`?`Purchases are closed for this item.`:`Bidding is closed for this item.`:`This item is not available.`}function Z(e,t,n){return o(t)?`All available quantities have been purchased.`:n===`draft`?`This item opens ${a(e,`draft`,t)}.`:t.saleMode===`buy_now`?`This item is no longer available to purchase.`:`Bidding has closed for this item.`}function Q(e,t,n,r,i){let a={amount:t?0:Number(r)*100,includeServiceFee:n?n.includeServiceFee:e.serviceFeeEnabled&&e.serviceFeeDefaultChecked,quantity:t?Number(r):1};return t||(a.bidType=i),a}function $({auction:t,item:i,initialSelection:a,onContinue:c,onError:l,onBack:f,backHref:p,itemHeadingLevel:h=2}){let g=K[h],_=i.saleMode===`buy_now`,v=Math.ceil(P(i)/100),[y,b]=A(Y(_,a,v)),[x,S]=A(a?.bidType??`fixed`),[C,w]=A(null),T=D();s(i.startAt??t.startAt,i.endAt??t.endAt);let E=e(t,i),O=E===`active`&&!o(i)&&i.saleMode!==`hybrid`;function k(e){if(e.preventDefault(),!q.test(y)){w(_?`Enter a whole-number quantity.`:`Enter a whole-dollar bid amount.`);return}let n=Q(t,_,a,y,x),r=d(t,i,n);if(r){w(r),l(r);return}try{u(t,i,n)}catch{w(`Enter a valid amount or quantity.`);return}c(n)}return O?N(`form`,{className:`lockerverse-auctions__selection`,onSubmit:k,children:[M(ee,{buyNow:_,headingTag:g,item:i,minimum:v}),N(`div`,{className:`lockerverse-auctions__selection-body`,children:[M(re,{bidType:x,enabled:!_&&!!i.supportsMaximumBids,id:T,onChange:e=>{S(e),w(null)}}),N(`label`,{className:`lockerverse-auctions__field`,htmlFor:T,children:[ne(_,x),N(`span`,{className:`lockerverse-auctions__amount-control`,children:[_?null:M(`span`,{"aria-hidden":`true`,children:`$`}),M(`input`,{"aria-describedby":`${T}-help`,"aria-invalid":!!C,autoComplete:`off`,id:T,inputMode:`numeric`,onChange:e=>{b(e.target.value),w(null)},placeholder:_?`1`:String(v),required:!0,value:y})]})]}),C?M(`p`,{role:`alert`,children:C}):null,M(`p`,{id:`${T}-help`,children:_?J(y,i):`Enter a whole-dollar bid of at least ${n(v*100)}. Bid increment: ${n(i.bidIncrementAmount??100)}.`}),M(te,{item:i}),N(`div`,{className:`lockerverse-auctions__selection-footer`,children:[M(`p`,{children:_?`Continuing moves you into secure checkout where your payment is processed immediately.`:`Continuing moves you into the secure payment step where your card is stored for settlement only if your bid wins.`}),N(`button`,{className:`lockerverse-auctions__button`,disabled:!t.payment,type:`submit`,children:[_?`Continue to Checkout`:`Continue to Payment`,` `,M(m,{"aria-hidden":`true`,size:16})]})]}),t.payment?null:M(`p`,{role:`alert`,children:`Payments are not configured for this auction.`})]})]}):N(`div`,{className:`lockerverse-auctions__selection lockerverse-auctions__read-only`,children:[M(`p`,{className:`lockerverse-auctions__eyebrow`,children:`Item status`}),M(g,{children:X(i,E)}),M(`p`,{children:Z(t,i,E)}),N(r,{className:`lockerverse-auctions__button`,href:p,onBack:f,children:[`Browse auction items `,M(m,{"aria-hidden":`true`,size:16})]})]})}function ee({headingTag:e,item:t,buyNow:r,minimum:i}){return N(`div`,{className:`lockerverse-auctions__selection-header`,children:[M(`p`,{className:`lockerverse-auctions__eyebrow`,children:`Step 1 of 2`}),M(e,{children:r?`Buy this item now.`:`Place your bid.`}),M(`p`,{children:r?`Choose how many you want, then complete the secure checkout.`:`Choose your bid amount. You are only charged if this bid wins after bidding closes.`}),N(`p`,{children:[r?`Price: `:`Minimum qualifying bid: `,M(`strong`,{children:n(r?t.buyNowPriceAmount??0:i*100)})]}),r&&t.availableQuantity!==null?N(`p`,{children:[t.availableQuantity,` available`]}):null,t.collectShippingAddress?M(`p`,{children:`The next step will also collect a delivery address for seller fulfillment.`}):null]})}function te({item:e}){return e.saleMode===`buy_now`||!e.additionalCharge?null:N(`p`,{children:[e.additionalCharge.name,`:`,` `,n(e.additionalCharge.firstUnitAmountCents),` will be added to your winning bid.`]})}function ne(e,t){return e?`Quantity`:t===`maximum`?`Your maximum bid`:`Your bid amount`}function re({bidType:e,enabled:t,id:n,onChange:r}){return t?N(j,{children:[N(`fieldset`,{className:`lockerverse-auctions__bid-types`,children:[M(`legend`,{children:`Bid type`}),[`fixed`,`maximum`].map(t=>N(`label`,{children:[M(`input`,{checked:e===t,name:`${n}-bid-type`,onChange:()=>r(t),type:`radio`,value:t}),M(`span`,{children:t===`fixed`?`Fixed bid`:`Maximum bid`})]},t))]}),M(`p`,{"aria-live":`polite`,children:e===`maximum`?`We bid for you up to your private limit, using only what is needed to lead. Once accepted, your maximum cannot be changed or canceled. A new bid is separate and can compete with your earlier bids.`:`Place this amount as your bid. We will not increase it automatically.`})]}):null}function ie(e){let[t,n]=A(null),[r,i]=A(!1),a=!!(e.resumePurchase||e.interactionLocked);return E(()=>{let e=!0;return import(`./auction-payment-view.js`).then(({AuctionPayment:t})=>{e&&n(()=>t)},()=>{e&&i(!0)}),()=>{e=!1}},[]),t?M(t,{...e}):N(`div`,{children:[M(`p`,{role:r?`alert`:`status`,children:r?`Payment details could not load.`:`Loading secure payment details…`}),r&&a&&M(`p`,{children:`Your purchase status is not confirmed. Keep this page open and contact the auction organizer before you try another purchase.`}),a?null:M(`button`,{onClick:e.onBack,type:`button`,children:`Back to item`}),r&&!a&&M(`button`,{onClick:()=>window.location.reload(),type:`button`,children:`Reload page to try again`})]})}function ae({buyNow:e}){return N(`div`,{className:`lockerverse-auctions__progress`,children:[N(`span`,{children:[M(e?S:y,{"aria-hidden":`true`,size:16}),e?`Choose quantity`:`Place bid`]}),N(`span`,{children:[M(S,{"aria-hidden":`true`,size:16}),e?`Pay securely`:`Secure card`]}),N(`span`,{children:[M(C,{"aria-hidden":`true`,size:16}),e?`Get confirmation`:`Wait for close`]})]})}function oe(e){let{auction:t,item:n,outcome:r}=e,i;return e.backHref?i={href:e.backHref,label:`View auction items`}:e.onBack&&(i={label:`View auction items`,onClick:e.onBack}),M(f,{auctionName:t.name,className:e.className,closesAtLabel:a(t,`active`,n),communityName:e.communityName??t.community?.name,focusHeading:!0,imageUrl:n.image??n.images[0]??t.configuration.image??void 0,itemName:n.name,outcome:r,primaryAction:e.returnToItemHref?{href:e.returnToItemHref,label:`Return to item`}:i,secondaryAction:e.returnToItemHref?i:void 0,style:{"--lockerverse-accent":t.community?.color??`#6f8f6d`,...e.style},theme:e.theme})}function se(t){let{auction:n,itemId:i,resumePurchase:a,className:o,theme:c=`dark`,style:l}=t,u=k(null),[d,f]=A(n),h=k(n),_=d.items.find(e=>e.id===i)??a?.item;s(_?.startAt??d.startAt,_?.endAt??d.endAt);let[v,y]=A(()=>a?{amount:0,includeServiceFee:a.submission.includeServiceFee??!1,quantity:a.submission.quantity}:null),[b,x]=A(!!a),S=k(!0),C=k(t);C.current=t;let w=k(null),D=T(e=>{S.current&&x(e),w.current!==e&&(w.current=e,p(C.current.onInteractionLockChange,e))},[]),O=!!a;E(()=>(S.current=!0,D(O),()=>{S.current=!1}),[O,D]);let[j,P]=A({email:``,phone:``}),[F,I]=A(!!a),[L,R]=A(null),[z,B]=A(null);E(()=>{!(F||b||a)&&h.current!==n&&(h.current=n,f(n))},[n,F,b,a]);function V(e,t){D(!1),h.current=C.current.auction,f(e),y(null),I(!1),R(t)}function H(e){R(null),y(e),I(!0)}return _?z?M(oe,{...t,auction:d,item:_,outcome:z}):N(`section`,{className:[`lockerverse-auctions`,o].filter(Boolean).join(` `),"data-lockerverse-theme":c,ref:u,style:{"--lockerverse-accent":d.community?.color??`#6f8f6d`,...l},children:[b?null:N(r,{className:`lockerverse-auctions__back`,href:t.backHref,onBack:t.onBack,children:[M(g,{"aria-hidden":`true`,size:16}),` All items`]}),N(`div`,{className:`lockerverse-auctions__detail`,children:[M(G,{auction:d,galleryImageSizes:t.galleryImageSizes,item:_,itemHeadingLevel:t.itemHeadingLevel}),N(`div`,{className:`lockerverse-auctions__transaction`,children:[e(d,_)===`active`?M(ae,{buyNow:_.saleMode===`buy_now`}):null,L?M(`p`,{className:`lockerverse-auctions__notice`,role:`alert`,children:L}):null,F&&v?M(ie,{...t,appearanceRoot:u,auction:d,communityName:t.communityName??d.community?.name,contact:j,interactionLocked:b,item:_,onBack:()=>I(!1),onContactChange:P,onIncludeServiceFeeChange:e=>y(t=>t&&{...t,includeServiceFee:d.serviceFeeEnabled&&e}),onInteractionLockChange:D,onResult:B,onReview:V,selection:v}):M($,{auction:d,backHref:t.backHref,initialSelection:v,item:_,itemHeadingLevel:t.itemHeadingLevel,onBack:t.onBack,onContinue:H,onError:R}),b?null:N(r,{className:`lockerverse-auctions__footer-back`,href:t.backHref,onBack:t.onBack,children:[`Back to auction items `,M(m,{"aria-hidden":`true`,size:16})]})]})]})]}):N(`div`,{children:[M(`p`,{role:`alert`,children:`This auction item is no longer available.`}),M(r,{href:t.backHref,onBack:t.onBack,children:`Back to auction items`})]})}function ce(e){let t=k({auctionId:e.auction.id,client:e.client,itemId:e.itemId});if(t.current.client!==e.client||t.current.auctionId!==e.auction.id||t.current.itemId!==e.itemId)throw TypeError(`Auction item identity cannot change. Remount with a new React key.`);if(e.resumePurchase&&(e.resumePurchase.auctionId!==e.auction.id||e.resumePurchase.itemId!==e.itemId||e.resumePurchase.item.id!==e.itemId||e.resumePurchase.item.auctionId!==e.auction.id))throw TypeError(`The purchase recovery record belongs to a different auction item.`);return M(c.Provider,{value:e.auction.mediaBaseUrl,children:M(se,{...e})})}export{ce as LockerverseAuctionItem};
1
+ import{a as e,c as t,i as n,l as r,n as i,r as a,s as o,t as s}from"./use-auction-boundary.js";import{n as c,t as l}from"./auction-image.js";import{a as u,o as d,t as f}from"./auction-checkout-view.js";import{r as p}from"./phone-field.js";import{t as m}from"./auction-result2.js";import{t as h}from"./host-callback.js";import{ArrowRight as g,ChevronDown as _,ChevronLeft as v,ChevronRight as y,Clock3 as b,Gavel as x,Info as S,Pause as C,Play as w,ShieldCheck as T,TimerReset as E,X as D}from"lucide-react";import{useCallback as O,useEffect as k,useId as A,useMemo as j,useRef as M,useState as N}from"react";import{Fragment as P,jsx as F,jsxs as I}from"react/jsx-runtime";import{getLockerverseAuctionMinimumBid as L}from"@lockerverse/sdk/auctions";import{Dialog as R}from"@base-ui/react/dialog";import z from"embla-carousel-autoplay";import B from"embla-carousel-react";const V=6e3;function H(e,t){let n=M(V),r=M(null),[i,a]=N(V),o=j(()=>z({delay:i,playOnInit:!1,stopOnFocusIn:!1,stopOnInteraction:!0,stopOnMouseEnter:!1}),[i]),[s,c]=B({duration:t?0:25,loop:!0},[o]),l=O(()=>{r.current&&(r.current.style.transform=`scaleX(${1-n.current/V})`)},[]),u=O(()=>{let e=o.timeUntilNext();e!==null&&(n.current=Math.max(1,Math.min(V,e))),o.stop(),l()},[o,l]),d=O(()=>{n.current=V,a(V),o.reset(),l()},[o,l]);return k(()=>{c&&(e?i===n.current?o.play():a(n.current):u())},[c,e,o,i,a,n,u]),k(()=>{if(!c)return;let t=0,r=()=>{let i=o.timeUntilNext();!e||i===null||(n.current=Math.max(0,Math.min(V,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 U({photos:e,name:t,imageSizes:n=`(max-width: 1279px) 100vw, 45vw`,selected:r,paused:a=!1,photoButtonRef:o,onSelect:s,onExpand:c}){let u=M(null),d=M(null),f=M([]),[p,m]=N(!0),[h,g]=N(!1),[_,b]=N(!1),[x,S]=N(!1),[T,E]=N(!1),{ref:D,visible:O}=i(),[A,j]=N(!1),[L,R]=N(!0),z=M(null),B=`lockerverse-auction-gallery__control ${L||A||_?`is-visible`:``}`,V=()=>{z.current&&clearTimeout(z.current),z.current=setTimeout(()=>j(!1),2e3)},U=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()};k(()=>{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=!(a||p||h||_||x||T)&&O,G=e.length,K=G?(r%G+G)%G:0,{viewportRef:ee,embla:q,progressRef:J,freeze:Y,reset:X}=H(W&&G>1,p);k(()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>m(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),k(()=>{if(!q)return;let e=()=>s(q.selectedScrollSnap());return q.on(`select`,e).on(`reInit`,e),()=>{q.off(`select`,e).off(`reInit`,e)}},[q,s]),k(()=>{q&&q.selectedScrollSnap()!==K&&q.scrollTo(K,!0)},[q,K]),k(()=>{let e=()=>{document.hidden&&Y()},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)}},[Y]);let Z=e=>{q?.scrollTo((e+G)%G,p),X()};return k(()=>{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]),k(()=>{let e=u.current,t=f.current[K];if(!(e&&t))return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();r.left<n.left?e.scrollLeft-=n.left-r.left:r.right>n.right&&(e.scrollLeft+=r.right-n.right)},[K,G]),I(`section`,{"aria-label":`${t} photos`,className:`lockerverse-auction-gallery`,onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||b(!1)},onFocusCapture:e=>b(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),Z(K+(e.key===`ArrowRight`?1:-1)))},onPointerEnter:e=>{e.pointerType===`mouse`&&g(!0)},onPointerLeave:e=>{e.pointerType===`mouse`&&g(!1)},ref:D,children:[G?I(`div`,{className:`lockerverse-auction-gallery__stage`,onPointerEnter:U,onPointerLeave:V,onPointerMove:U,children:[F(`div`,{className:`lockerverse-auction-gallery__viewport`,onPointerDownCapture:()=>{Y(),E(!0)},ref:ee,children:F(`div`,{className:`lockerverse-auction-gallery__track`,children:e.map((e,r)=>F(`div`,{"aria-hidden":r!==K,className:`lockerverse-auction-gallery__slide`,children:F(`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:F(l,{alt:`${t}, ${r+1} of ${G}`,className:`lockerverse-auction-gallery__image`,draggable:!1,fetchPriority:r===0?`high`:`auto`,height:900,loading:r===K?`eager`:`lazy`,maxWidth:1920,sizes:r===K?n:`auto, ${n}`,src:e,width:1200})})},`${e}-${r}`))})}),G>1&&!p&&I(`div`,{className:`lockerverse-auction-gallery__rotation`,children:[F(`div`,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__progress-track`,children:F(`div`,{className:`lockerverse-auction-gallery__progress`,ref:J,style:{transform:`scaleX(0)`}})}),F(`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:F(x?w:C,{"aria-hidden":`true`,size:13})})]}),G>1&&I(P,{children:[F(`button`,{"aria-label":`Previous photo`,className:`lockerverse-auction-gallery__previous ${B}`,"data-gallery-control":!0,onClick:()=>Z(K-1),type:`button`,children:F(v,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__chevron`})}),F(`button`,{"aria-label":`Next photo`,className:`lockerverse-auction-gallery__next ${B}`,"data-gallery-control":!0,onClick:()=>Z(K+1),type:`button`,children:F(y,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__chevron`})})]})]}):F(`div`,{className:`lockerverse-auction-gallery__empty`,children:`No photo available`}),G>1&&F(`section`,{"aria-label":`Choose a photo`,className:`lockerverse-auction-gallery__strip`,ref:u,children:F(`div`,{className:`lockerverse-auction-gallery__thumbnails`,children:e.map((e,t)=>F(`button`,{"aria-label":`Show photo ${t+1} of ${G}`,"aria-pressed":K===t,className:`lockerverse-auction-gallery__thumbnail ${K===t?`is-selected`:``}`,onClick:()=>Z(t),ref:e=>{f.current[t]=e},type:`button`,children:F(l,{alt:``,className:`lockerverse-auction-gallery__thumbnail-image`,height:66,loading:`lazy`,maxWidth:192,sizes:`88px`,src:e,width:88})},`${e}-${t}`))})})]})}function W({images:e,fallbackImage:t,name:n,imageSizes:r}){let i=[...new Set(e.filter(Boolean))];!i.length&&t&&i.push(t);let[a,o]=N(0),[s,c]=N(!1),u=M(null),d=M(null),f=i.length,p=f?(a%f+f)%f:0;return I(P,{children:[F(U,{imageSizes:r,name:n,onExpand:e=>{o(e),c(!0)},onSelect:o,paused:s,photoButtonRef:u,photos:i,selected:p}),f>0&&F(R.Root,{onOpenChange:c,open:s,children:I(R.Portal,{children:[F(R.Backdrop,{className:`lockerverse-auction-gallery__backdrop`}),I(R.Popup,{"aria-describedby":void 0,className:`lockerverse-auction-gallery__viewer`,finalFocus:u,onKeyDown:e=>{f<2||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),o((p+(e.key===`ArrowRight`?1:-1)+f)%f))},children:[I(R.Title,{className:`lockerverse-auction-gallery__sr-only`,children:[n,` · Photo `,p+1,` of `,f]}),I(`div`,{className:`lockerverse-auction-gallery__full-image`,onTouchCancel:()=>{d.current=null},onTouchEnd:e=>{let t=d.current;d.current=null;let n=e.changedTouches.item(0);if(!(t&&n)||f<2)return;let r=n.clientX-t.x,i=n.clientY-t.y;Math.abs(r)>=45&&Math.abs(r)>Math.abs(i)*1.3&&o((p+(r<0?1:-1)+f)%f)},onTouchMove:e=>{e.touches.length!==1&&(d.current=null)},onTouchStart:e=>{let t=e.touches.item(0);d.current=e.touches.length===1&&t?{x:t.clientX,y:t.clientY}:null},children:[F(l,{alt:`${n}, ${p+1} of ${f}`,height:900,maxWidth:1920,sizes:`100vw`,src:i[p],width:1200}),s&&f>1&&F(l,{alt:``,"aria-hidden":`true`,className:`lockerverse-auction-gallery__preload`,height:900,loading:`eager`,maxWidth:1920,sizes:`100vw`,src:i[(p+1)%f],width:1200})]}),F(R.Close,{"aria-label":`Close photo viewer`,className:`lockerverse-auction-gallery__viewer-close`,children:F(D,{"aria-hidden":`true`,size:22})}),f>1&&I(P,{children:[F(`button`,{"aria-label":`Previous photo`,className:`lockerverse-auction-gallery__viewer-previous`,onClick:()=>o((p-1+f)%f),type:`button`,children:F(v,{"aria-hidden":`true`,size:28})}),F(`button`,{"aria-label":`Next photo`,className:`lockerverse-auction-gallery__viewer-next`,onClick:()=>o((p+1)%f),type:`button`,children:F(y,{"aria-hidden":`true`,size:28})})]})]})]})})]})}const G={1:`h1`,2:`h2`};function K(e){return F(e===`Buy Now`?T:e===`Available`||e===`Increment`?E:x,{"aria-hidden":`true`,size:16})}function ee(e,t){return e.saleMode===`buy_now`?[[`Buy Now`,n(e.buyNowPriceAmount??0)],[`Available`,e.availableQuantity===null?`Available`:String(e.availableQuantity)]]:t===`finished`?[[`Final bid`,e.maxBidAmount?n(e.maxBidAmount):`No bids`]]:[[`Current bid`,n(e.maxBidAmount??0)],[`Floor`,n(e.minBidAmount??0)],[`Increment`,n(e.bidIncrementAmount??100)]]}function q({auction:r,item:i,itemHeadingLevel:o=2,galleryImageSizes:c}){s(i.startAt??r.startAt,i.endAt??r.endAt);let[l,u]=N(!1),d=A(),f=e(r,i),p={active:`Closes`,draft:`Opens`,finished:`Closed`}[f],m=a(r,f,i),h=i.saleMode===`buy_now`,g=(i.description??``).trim().length>240,v=ee(i,f),y=G[o];return I(`section`,{className:`lockerverse-auctions__item-summary`,children:[F(W,{fallbackImage:i.image??r.configuration.image??r.community?.banner??r.community?.thumbnail??null,imageSizes:c,images:i.images,name:i.name}),I(`div`,{className:`lockerverse-auctions__item-copy`,children:[F(y,{children:i.name}),i.description?I(`div`,{className:`lockerverse-auctions__item-description`,children:[F(t,{className:!l&&g?`lockerverse-auctions__description-clamped`:void 0,description:i.description,id:d}),g?I(`button`,{"aria-controls":d,"aria-expanded":l,className:`lockerverse-auctions__description-toggle`,onClick:()=>u(!l),type:`button`,children:[l?`Hide description`:`Read full description`,` `,F(_,{"aria-hidden":`true`,size:16,style:{transform:l?`rotate(180deg)`:void 0}})]}):null]}):null,I(`dl`,{className:`lockerverse-auctions__stat-panel`,children:[v.map(([e,t])=>I(`div`,{className:`lockerverse-auctions__stat-row`,children:[I(`dt`,{children:[K(e),e]}),F(`dd`,{children:t})]},e)),I(`div`,{className:`lockerverse-auctions__stat-row`,children:[I(`dt`,{children:[F(b,{"aria-hidden":`true`,size:16}),p]}),F(`dd`,{className:`lockerverse-auctions__stat-date`,children:m})]}),!h&&f===`finished`?I(`div`,{className:`lockerverse-auctions__stat-footer`,children:[I(`div`,{children:[F(`dt`,{children:`Floor`}),F(`dd`,{children:n(i.minBidAmount??0)})]}),I(`div`,{children:[F(`dt`,{children:`Bid increment`}),F(`dd`,{children:n(i.bidIncrementAmount??100)})]})]}):null]})]})]})}const J={1:`h2`,2:`h3`},Y=/^\d+$/;function X(e,t){let r=Number(e),i=r*(t.buyNowPriceAmount??0);if(!(Y.test(e)&&Number.isSafeInteger(i))||r<1)return`Enter a whole-number quantity.`;if(!t.additionalCharge)return`Total: ${n(i)}`;let a=t.additionalCharge.firstUnitAmountCents+t.additionalCharge.additionalUnitAmountCents*(r-1),o=i+a;return Number.isSafeInteger(o)?`Subtotal: ${n(i)} · ${t.additionalCharge.name}: ${n(a)} · Total: ${n(o)}`:`Enter a valid quantity.`}function Z(e,t,n){return String(e?t?t.quantity:1:t?t.amount/100:n)}function te(e,t){return o(e)?`This item is sold out.`:t===`draft`?`This item is not open yet.`:t===`finished`?e.saleMode===`buy_now`?`Purchases are closed for this item.`:`Bidding is closed for this item.`:`This item is not available.`}function ne(e,t,n){return o(t)?`All available quantities have been purchased.`:n===`draft`?`This item opens ${a(e,`draft`,t)}.`:t.saleMode===`buy_now`?`This item is no longer available to purchase.`:`Bidding has closed for this item.`}function 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:t,item:i,initialSelection:a,onContinue:c,onError:l,onBack:f,backHref:p,itemHeadingLevel:m=2}){let h=J[m],_=i.saleMode===`buy_now`,v=Math.ceil(L(i)/100),[y,b]=N(Z(_,a,v)),[x,S]=N(a?.bidType??`fixed`),[C,w]=N(null),T=A();s(i.startAt??t.startAt,i.endAt??t.endAt);let E=e(t,i),D=E===`active`&&!o(i)&&i.saleMode!==`hybrid`;function O(e){if(e.preventDefault(),!Y.test(y)){w(_?`Enter a whole-number quantity.`:`Enter a whole-dollar bid amount.`);return}let n=re(t,_,a,y,x),r=u(t,i,n);if(r){w(r),l(r);return}try{d(t,i,n)}catch{w(`Enter a valid amount or quantity.`);return}c(n)}return D?I(`form`,{className:`lockerverse-auctions__selection`,onSubmit:O,children:[F(ae,{buyNow:_,headingTag:h,item:i,minimum:v}),I(`div`,{className:`lockerverse-auctions__selection-body`,children:[F(ce,{bidType:x,enabled:!_&&!!i.supportsMaximumBids,id:T,onChange:e=>{S(e),w(null)}}),I(`label`,{className:`lockerverse-auctions__field`,htmlFor:T,children:[se(_,x),I(`span`,{className:`lockerverse-auctions__amount-control`,children:[_?null:F(`span`,{"aria-hidden":`true`,children:`$`}),F(`input`,{"aria-describedby":`${T}-help`,"aria-invalid":!!C,autoComplete:`off`,id:T,inputMode:`numeric`,onChange:e=>{b(e.target.value),w(null)},placeholder:_?`1`:String(v),required:!0,value:y})]})]}),C?F(`p`,{role:`alert`,children:C}):null,F(`p`,{id:`${T}-help`,children:_?X(y,i):`Enter a whole-dollar bid of at least ${n(v*100)}. Bid increment: ${n(i.bidIncrementAmount??100)}.`}),F(oe,{item:i}),I(`div`,{className:`lockerverse-auctions__selection-footer`,children:[F(`p`,{children:_?`Continuing moves you into secure checkout where your payment is processed immediately.`:`Continuing moves you into the secure payment step where your card is stored for settlement only if your bid wins.`}),I(`button`,{className:`lockerverse-auctions__button`,disabled:!t.payment,type:`submit`,children:[_?`Continue to Checkout`:`Continue to Payment`,` `,F(g,{"aria-hidden":`true`,size:16})]})]}),t.payment?null:F(`p`,{role:`alert`,children:`Payments are not configured for this auction.`})]})]}):I(`div`,{className:`lockerverse-auctions__selection lockerverse-auctions__read-only`,children:[F(`p`,{className:`lockerverse-auctions__eyebrow`,children:`Item status`}),F(h,{children:te(i,E)}),F(`p`,{children:ne(t,i,E)}),I(r,{className:`lockerverse-auctions__button`,href:p,onBack:f,children:[`Browse auction items `,F(g,{"aria-hidden":`true`,size:16})]})]})}function ae({headingTag:e,item:t,buyNow:r,minimum:i}){return I(`div`,{className:`lockerverse-auctions__selection-header`,children:[F(`p`,{className:`lockerverse-auctions__eyebrow`,children:`Step 1 of 2`}),F(e,{children:r?`Buy this item now.`:`Place your bid.`}),F(`p`,{children:r?`Choose how many you want, then complete the secure checkout.`:`Choose your bid amount. You are only charged if this bid wins after bidding closes.`}),I(`p`,{children:[r?`Price: `:`Minimum qualifying bid: `,F(`strong`,{children:n(r?t.buyNowPriceAmount??0:i*100)})]}),r&&t.availableQuantity!==null?I(`p`,{children:[t.availableQuantity,` available`]}):null,t.collectShippingAddress?F(`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:I(`p`,{children:[e.additionalCharge.name,`:`,` `,n(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?I(`fieldset`,{className:`lockerverse-auctions__bid-types`,children:[F(`legend`,{children:`Bid type`}),[`fixed`,`maximum`].map(t=>I(`div`,{className:`lockerverse-auctions__bid-type`,children:[I(`label`,{children:[F(`input`,{checked:e===t,name:`${n}-bid-type`,onChange:()=>r(t),type:`radio`,value:t}),F(`span`,{children:t===`fixed`?`Fixed bid`:`Maximum bid`})]}),F(le,{id:`${n}-${t}-help`,type:t})]},t))]}):null}function le({id:e,type:t}){let[n,r]=N(!1);return I(`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:[F(S,{"aria-hidden":`true`,size:16}),n&&F(`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 Q=()=>void 0;function ue(e){let t=A(),{auction:n,item:r,selection:i,resumePurchase:a}=e,o=a?a.pricing:d(n,r,i),s=!!a||r.saleMode===`buy_now`;return F(f,{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:Q,onIncludeServiceFeeChange:e.onIncludeServiceFeeChange,onPhoneChange:Q,onSameAsBillingChange:Q,onSubmit:e=>e.preventDefault(),paymentFields:null,phone:e.contact.phone,phoneCountry:p(e.contact.phone),pricing:o,quantity:i.quantity,sameAsBilling:!0,serviceFeeCents:a?o.serviceFeeCents:d(n,r,{...i,includeServiceFee:n.serviceFeeEnabled}).serviceFeeCents,serviceFeeEnabled:n.serviceFeeEnabled,shippingFields:null,showFields:!a,submitDisabled:!0})}let de,fe=null;function $(){return de??=import(`./auction-payment-view.js`).then(e=>(fe=e.AuctionPayment,e)),de}function pe(e,t,n){let r=e?.publishableKey,i=e?.connectedAccountId,[a,o]=N(null);return k(()=>{if(!(n&&r))return;let e=$().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 me(e){let[t,n]=N(()=>fe),[r,i]=N(!1),a=!!(e.resumePurchase||e.interactionLocked);return k(()=>{let e=!0;return $().then(({AuctionPayment:t})=>{e&&n(()=>t)},()=>{e&&i(!0)}),()=>{e=!1}},[]),t?F(t,{...e}):r?I(`div`,{children:[F(`p`,{role:`alert`,children:`Payment details could not load.`}),a&&F(`p`,{children:`Your purchase status is not confirmed. Keep this page open and contact the auction organizer before you try another purchase.`}),a?null:F(`button`,{onClick:e.onBack,type:`button`,children:`Back to item`}),!a&&F(`button`,{onClick:()=>window.location.reload(),type:`button`,children:`Reload page to try again`})]}):F(ue,{...e})}function he({buyNow:e}){return I(`div`,{className:`lockerverse-auctions__progress`,children:[I(`span`,{children:[F(e?T:x,{"aria-hidden":`true`,size:16}),e?`Choose quantity`:`Place bid`]}),I(`span`,{children:[F(T,{"aria-hidden":`true`,size:16}),e?`Pay securely`:`Secure card`]}),I(`span`,{children:[F(E,{"aria-hidden":`true`,size:16}),e?`Get confirmation`:`Wait for close`]})]})}function ge(e){let{auction:t,item:n,outcome:r}=e,i;return e.backHref?i={href:e.backHref,label:`View auction items`}:e.onBack&&(i={label:`View auction items`,onClick:e.onBack}),F(m,{auctionName:t.name,className:e.className,closesAtLabel:a(t,`active`,n),communityName:e.communityName??t.community?.name,focusHeading:!0,imageUrl:n.image??n.images[0]??t.configuration.image??void 0,itemName:n.name,outcome:r,primaryAction:e.returnToItemHref?{href:e.returnToItemHref,label:`Return to item`}:i,secondaryAction:e.returnToItemHref?i:void 0,style:{"--lockerverse-accent":t.community?.color??`#6f8f6d`,...e.style},theme:e.theme})}function _e(t){let{auction:n,itemId:i,resumePurchase:a,className:c,theme:l=`dark`,style:u}=t,d=M(null),[f,p]=N(n),m=M(n),_=f.items.find(e=>e.id===i)??a?.item;s(_?.startAt??f.startAt,_?.endAt??f.endAt);let[y,b]=N(()=>a?{amount:0,includeServiceFee:a.submission.includeServiceFee??!1,quantity:a.submission.quantity}:null),[x,S]=N(!!a),C=M(!0),w=M(t);w.current=t;let T=M(null),E=O(e=>{C.current&&S(e),T.current!==e&&(T.current=e,h(w.current.onInteractionLockChange,e))},[]),D=!!a;k(()=>(C.current=!0,E(D),()=>{C.current=!1}),[D,E]);let[A,j]=N({email:``,phone:``}),[P,L]=N(!!a),[R,z]=N(null),[B,V]=N(null);k(()=>{!(P||x||a)&&m.current!==n&&(m.current=n,p(n))},[n,P,x,a]);let H=pe(a?.payment??f.payment,t.stripeLoader,!!a||!!(_&&e(f,_)===`active`&&!o(_)&&_.saleMode!==`hybrid`));function U(e,t){E(!1),m.current=w.current.auction,p(e),b(null),L(!1),z(t)}function W(e){z(null),b(e),L(!0)}return _?B?F(ge,{...t,auction:f,item:_,outcome:B}):I(`section`,{className:[`lockerverse-auctions`,c].filter(Boolean).join(` `),"data-lockerverse-theme":l,ref:d,style:{"--lockerverse-accent":f.community?.color??`#6f8f6d`,...u},children:[x?null:I(r,{className:`lockerverse-auctions__back`,href:t.backHref,onBack:t.onBack,children:[F(v,{"aria-hidden":`true`,size:16}),` All items`]}),I(`div`,{className:`lockerverse-auctions__detail`,children:[F(q,{auction:f,galleryImageSizes:t.galleryImageSizes,item:_,itemHeadingLevel:t.itemHeadingLevel}),I(`div`,{className:`lockerverse-auctions__transaction`,children:[e(f,_)===`active`?F(he,{buyNow:_.saleMode===`buy_now`}):null,R?F(`p`,{className:`lockerverse-auctions__notice`,role:`alert`,children:R}):null,P&&y?F(me,{...t,appearanceRoot:d,auction:f,communityName:t.communityName??f.community?.name,contact:A,interactionLocked:x,item:_,onBack:()=>L(!1),onContactChange:j,onIncludeServiceFeeChange:e=>b(t=>t&&{...t,includeServiceFee:f.serviceFeeEnabled&&e}),onInteractionLockChange:E,onResult:V,onReview:U,selection:y,stripePromise:H}):F(ie,{auction:f,backHref:t.backHref,initialSelection:y,item:_,itemHeadingLevel:t.itemHeadingLevel,onBack:t.onBack,onContinue:W,onError:z}),x?null:I(r,{className:`lockerverse-auctions__footer-back`,href:t.backHref,onBack:t.onBack,children:[`Back to auction items `,F(g,{"aria-hidden":`true`,size:16})]})]})]})]}):I(`div`,{children:[F(`p`,{role:`alert`,children:`This auction item is no longer available.`}),F(r,{href:t.backHref,onBack:t.onBack,children:`Back to auction items`})]})}function ve(e){let t=M({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 F(c.Provider,{value:e.auction.mediaBaseUrl,children:F(_e,{...e})})}export{ve as LockerverseAuctionItem};
2
2
  //# sourceMappingURL=auction-item.js.map