@lockerverse/react 0.2.160 → 0.2.162
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 +147 -0
- package/README.md +5 -0
- package/SDK_RULES.md +84 -0
- package/dist/auction-item.d.ts.map +1 -1
- package/dist/auction-item.js +1 -1
- package/dist/auction-item.js.map +1 -1
- package/dist/auction-payment-view.js +2 -0
- package/dist/auction-payment-view.js.map +1 -0
- package/dist/auction-payment.js +2 -0
- package/dist/auction-payment.js.map +1 -0
- package/dist/lockerverse-payment.js +1 -1
- package/dist/lockerverse-payment.js.map +1 -1
- package/dist/signup.js +1 -1
- package/dist/signup.js.map +1 -1
- package/guides/auctions.md +3 -1
- package/guides/events.md +1 -1
- package/guides/integration.md +12 -1
- package/guides/payment-widgets.md +1 -1
- package/guides/signup.md +1 -1
- package/package.json +6 -4
package/MIGRATIONS.md
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# SDK migrations
|
|
2
|
+
|
|
3
|
+
This file ships in both @lockerverse/sdk and @lockerverse/react. Use the copy in
|
|
4
|
+
the target installed release. This is an agent-run procedure, not an install
|
|
5
|
+
script. Installing a package does not edit host code or guarantee these steps ran.
|
|
6
|
+
|
|
7
|
+
## Upgrade procedure
|
|
8
|
+
|
|
9
|
+
1. Before installation, record the resolved installed version of each package
|
|
10
|
+
from the lockfile or package manager, the host framework, and the features in
|
|
11
|
+
use. Do not use a dependency range as proof of the installed version.
|
|
12
|
+
2. Select a published matching stable SDK/React pair. A copy-prompt version is a
|
|
13
|
+
minimum, not a request to downgrade. Preserve a newer matching stable pair.
|
|
14
|
+
Core-only consumers do not need to add React. Use the existing package manager
|
|
15
|
+
and update the real lockfile. Follow peer requirements in the target manifests.
|
|
16
|
+
3. After installation, read this target file and SDK_RULES.md. React consumers
|
|
17
|
+
must also read guides/integration.md and each applicable resource guide.
|
|
18
|
+
4. For each affected package, apply all entries where old version < entry version
|
|
19
|
+
<= target version, from oldest to newest. Include releases skipped by the
|
|
20
|
+
upgrade. Use semantic version comparison, not string comparison. An Unreleased
|
|
21
|
+
section is not a published migration and must not be applied to a stable host.
|
|
22
|
+
5. Apply required steps. Apply recommended steps when the feature and host support
|
|
23
|
+
them and they fit the task. Keep deliberate host choices. For every skipped
|
|
24
|
+
step, state why it does not apply or what prevents it. Do not silently count it
|
|
25
|
+
as complete. Do not replace a framework, change payment mode, or publish a site
|
|
26
|
+
merely because a migration recommends a capability.
|
|
27
|
+
6. Run the host's relevant existing build and checks. Inspect initial HTML when
|
|
28
|
+
SSR applies and the browser behavior for the changed feature. Do not create
|
|
29
|
+
live transactions. Report old/new versions, applied entries, automatic changes,
|
|
30
|
+
skipped actions and reasons, check results, and any remaining work.
|
|
31
|
+
|
|
32
|
+
If the old version is unknown, identify it from the prior lockfile or Git history.
|
|
33
|
+
If it cannot be found, report that limit and use the baseline review below. Do not
|
|
34
|
+
claim that every historical migration was applied. Read this file even if the
|
|
35
|
+
version already matches: a previous upgrade may have missed host adoption steps.
|
|
36
|
+
|
|
37
|
+
## Existing integration baseline through 0.2.161
|
|
38
|
+
|
|
39
|
+
This guide starts with the current integration baseline. It is not a complete
|
|
40
|
+
record of older breaking changes. For an integration created before this guide,
|
|
41
|
+
review this section once, including when its version already matches the target.
|
|
42
|
+
The feature guide and public types in the target package define the exact API.
|
|
43
|
+
|
|
44
|
+
### Required when applicable
|
|
45
|
+
|
|
46
|
+
- **Hosts that use both React and Core:** keep installed versions matched and use public entry points.
|
|
47
|
+
Read the installed contract instead of an old copied integration prompt.
|
|
48
|
+
- **Auction media proxy:** if using mediaBaseUrl, pass the full loaded auction
|
|
49
|
+
snapshot to components and initialAuction. Forward w and f query parameters
|
|
50
|
+
unchanged. Check that a resized response has the expected dimensions and type.
|
|
51
|
+
- **Public route identity:** keep configured community and auction identity fixed.
|
|
52
|
+
Use real item and return links. Handle missing items without selecting another
|
|
53
|
+
item silently. Follow the host router's missing-page behavior.
|
|
54
|
+
- **Checkout and recovery:** preserve supported recovery state and private data
|
|
55
|
+
handling. Never restart an uncertain transaction to recover from a load error.
|
|
56
|
+
|
|
57
|
+
### Recommended host adoption
|
|
58
|
+
|
|
59
|
+
- **Existing SSR hosts:** load public data on the server and seed
|
|
60
|
+
useLockerverseAuction with initialAuction or useLockerverseAuctions with
|
|
61
|
+
initialAuctions. Keep public content outside client-only payment boundaries.
|
|
62
|
+
Keep that content visible during silent refresh. Verify it in the raw response.
|
|
63
|
+
- **Dedicated auction item pages:** set itemHeadingLevel={1}; avoid a competing
|
|
64
|
+
page title heading. Embedded item views can keep the default level 2.
|
|
65
|
+
- **Gallery:** set galleryImageSizes when the host differs from the default
|
|
66
|
+
full-width mobile / 45vw desktop layout. Check the first image before hydration
|
|
67
|
+
and selected photos after interaction. Keep full-screen sizing separate.
|
|
68
|
+
- **Import boundaries:** use feature entry points such as
|
|
69
|
+
@lockerverse/react/auction-item and @lockerverse/react/auction-data. Remove host
|
|
70
|
+
imports that eagerly load payment UI when the page does not yet need it.
|
|
71
|
+
- **Host metadata and assets:** check offer descriptions against current prices.
|
|
72
|
+
Keep local fonts, responsive photos, and background videos within the host's
|
|
73
|
+
performance budget. These are host tasks, not automatic SDK transformations.
|
|
74
|
+
|
|
75
|
+
### Automatic SDK behavior in the baseline
|
|
76
|
+
|
|
77
|
+
Supported auction media paths use responsive sizes through the configured proxy.
|
|
78
|
+
The gallery gives the first photo high priority and uses eager/lazy loading for
|
|
79
|
+
selected/other photos. Transaction headings follow the item heading level.
|
|
80
|
+
Auction checkout code is deferred until payment or recovery needs it. These
|
|
81
|
+
benefits require the supported components and data paths; custom host UI must
|
|
82
|
+
adopt the corresponding APIs itself. The SDK cannot remove the host's own eager
|
|
83
|
+
imports or server-render a browser-only website.
|
|
84
|
+
|
|
85
|
+
## Versioned changes
|
|
86
|
+
|
|
87
|
+
### 0.2.161 — Deferred auction checkout code
|
|
88
|
+
|
|
89
|
+
Affected: @lockerverse/react auction item and transaction UI.
|
|
90
|
+
|
|
91
|
+
- **Automatic:** the supported auction UI loads checkout code when payment or
|
|
92
|
+
recovery needs it. No public prop change is required.
|
|
93
|
+
- **Recommended:** use the narrow auction imports and remove unused eager payment
|
|
94
|
+
imports from the host. Do not remove payment peers required by the chosen flow.
|
|
95
|
+
- **Check:** compare initial page requests with checkout requests. Public item
|
|
96
|
+
content must remain available before checkout loads; recovery must keep its
|
|
97
|
+
existing state. Do not expect the total size of every reachable chunk to shrink.
|
|
98
|
+
|
|
99
|
+
### 0.2.160 — Transaction heading hierarchy
|
|
100
|
+
|
|
101
|
+
Affected: @lockerverse/react auction item UI.
|
|
102
|
+
|
|
103
|
+
- **Automatic:** transaction and status headings follow the item heading level.
|
|
104
|
+
- **Recommended:** dedicated pages should use itemHeadingLevel={1}. Embedded
|
|
105
|
+
views should retain the level that fits their surrounding page.
|
|
106
|
+
- **Check:** inspect the rendered heading order, including transaction states.
|
|
107
|
+
This change must not require a new host CSS workaround or a widget remount.
|
|
108
|
+
|
|
109
|
+
### 0.2.159 — Gallery loading and item heading controls
|
|
110
|
+
|
|
111
|
+
Affected: @lockerverse/react auction item UI.
|
|
112
|
+
|
|
113
|
+
- **Automatic:** selected photos load eagerly and other photos load lazily. The
|
|
114
|
+
first photo has high fetch priority; lazy photos can use automatic image sizing.
|
|
115
|
+
- **Recommended:** set galleryImageSizes for a custom host container and use
|
|
116
|
+
itemHeadingLevel={1} on a dedicated item page. Read guides/auctions.md for the
|
|
117
|
+
supported props. Embedded views can keep the defaults.
|
|
118
|
+
- **Check:** inspect the first response, image request sizes, and heading order.
|
|
119
|
+
Check gallery selection and full-screen viewing without changing image quality.
|
|
120
|
+
|
|
121
|
+
### 0.2.158 — Responsive images through a configured proxy
|
|
122
|
+
|
|
123
|
+
Affected: @lockerverse/react auction images and @lockerverse/sdk auction data.
|
|
124
|
+
|
|
125
|
+
- **Automatic:** supported auction images retain responsive resize URLs through
|
|
126
|
+
the configured mediaBaseUrl instead of losing resizing on that proxy path.
|
|
127
|
+
- **Required when using a proxy:** pass the full loaded snapshot to the UI and
|
|
128
|
+
server seed. Configure the host rewrite to forward w and f unchanged to the
|
|
129
|
+
media service. Do not reconstruct the snapshot and discard mediaBaseUrl.
|
|
130
|
+
- **Check:** confirm resized response dimensions and content type through the
|
|
131
|
+
actual proxy. Signed, external, and unsupported URLs must keep their original
|
|
132
|
+
behavior. Hosts without a custom proxy do not need a proxy configuration change.
|
|
133
|
+
|
|
134
|
+
## Entry format for future releases
|
|
135
|
+
|
|
136
|
+
Add new version entries above older entries. Before publication, replace any
|
|
137
|
+
Unreleased heading with the actual release version. Keep prior entries intact.
|
|
138
|
+
Each entry must state:
|
|
139
|
+
|
|
140
|
+
- Version and affected packages/features.
|
|
141
|
+
- Required changes, with the old and new API or behavior for breaking changes.
|
|
142
|
+
- Recommended host changes and the conditions where they apply.
|
|
143
|
+
- Automatic improvements and cases that need no host edit.
|
|
144
|
+
- Completion checks and any limits or manual follow-up.
|
|
145
|
+
|
|
146
|
+
For a new installation, use the current feature guides and baseline instead of
|
|
147
|
+
reproducing old APIs from migration examples.
|
package/README.md
CHANGED
|
@@ -7,6 +7,11 @@ project, use its local README, `package.json` exports, and public `.d.ts` files.
|
|
|
7
7
|
Online examples can describe a newer release. Do not import private `dist`
|
|
8
8
|
modules or copy API details from a different SDK version.
|
|
9
9
|
|
|
10
|
+
Read [SDK quality rules](SDK_RULES.md) before integration changes. For every
|
|
11
|
+
upgrade, read [MIGRATIONS.md](MIGRATIONS.md) from the target package and apply
|
|
12
|
+
all applicable steps, including skipped releases. A version bump alone does not
|
|
13
|
+
complete an upgrade. Record the old installed versions before installation.
|
|
14
|
+
|
|
10
15
|
## Version-matched integration guides
|
|
11
16
|
|
|
12
17
|
Read [shared integration rules](guides/integration.md) first, then the guide for
|
package/SDK_RULES.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# SDK quality rules
|
|
2
|
+
|
|
3
|
+
These rules apply to SDK maintenance and host integration. Read the installed
|
|
4
|
+
package README, public types, resource guide, and MIGRATIONS.md with this file.
|
|
5
|
+
Use the instructions from the target release. Do not copy APIs from newer docs.
|
|
6
|
+
|
|
7
|
+
## Public content and search
|
|
8
|
+
|
|
9
|
+
- In an existing server-rendered host, load public auction data in its server
|
|
10
|
+
loader. Pass the complete snapshot through the supported initial-data API.
|
|
11
|
+
Keep text, images, status, and real links in the first HTML response. Do not
|
|
12
|
+
put the whole auction in a client-only boundary to protect payment code.
|
|
13
|
+
- Keep browser storage, Stripe, and browser globals outside server rendering.
|
|
14
|
+
Retain the seed or last good snapshot during refresh. Refresh silently; do
|
|
15
|
+
not add an “Updating auction” banner or replace ready content with a loader.
|
|
16
|
+
Show initial loading only when no data exists. Keep useful failure feedback.
|
|
17
|
+
- Use real href links for item and return navigation. Preserve direct entry,
|
|
18
|
+
reload, Back, Forward, and opening in a new tab. The host must handle unknown
|
|
19
|
+
item URLs; do not silently show the first item for an invalid identity.
|
|
20
|
+
- On a dedicated item page, use itemHeadingLevel={1}. Keep transaction headings
|
|
21
|
+
below the item heading. Embedded items normally use the default level 2.
|
|
22
|
+
Use public props, not DOM patches or private CSS selectors.
|
|
23
|
+
- The host owns titles, descriptions, canonicals, robots rules, sitemap, HTTP
|
|
24
|
+
status codes, and structured data. Keep price and availability claims aligned
|
|
25
|
+
with current public data. Do not hard-code a second copy of an offer.
|
|
26
|
+
- A browser-only app does not gain server rendering from an SDK update. Explain
|
|
27
|
+
this limit. Do not replace its framework or add a server without task scope.
|
|
28
|
+
|
|
29
|
+
## Images, fonts, and initial download
|
|
30
|
+
|
|
31
|
+
- Use supported responsive image URLs and sizes. A proxy URL alone does not
|
|
32
|
+
prove resizing. Check the returned dimensions, content type, and transfer size.
|
|
33
|
+
- With mediaBaseUrl, preserve the complete auction snapshot and forward w and f
|
|
34
|
+
query parameters to the configured media service. Use only the supported
|
|
35
|
+
public media path. Preserve signed, private, external, and unsupported image
|
|
36
|
+
URLs and the existing original-image fallback.
|
|
37
|
+
- Match galleryImageSizes to the host layout. Reserve image space to prevent
|
|
38
|
+
layout shifts. Load the first visible image eagerly with high priority; load
|
|
39
|
+
off-screen images lazily. Keep selected and full-screen photos clear at their
|
|
40
|
+
rendered size and device pixel ratio. Do not lower quality only for a score.
|
|
41
|
+
- Import the narrow public entry point for the feature. Keep payment code and
|
|
42
|
+
optional Stripe peers out of unrelated catalog, event, and signup imports.
|
|
43
|
+
Defer auction checkout code until payment or recovery needs it.
|
|
44
|
+
- Keep required first-screen styles available. Scope widget styles and inherit
|
|
45
|
+
host fonts where supported. Do not add remote fonts or global font rules to
|
|
46
|
+
widgets. The host owns font compression, preload choices, background video,
|
|
47
|
+
and page-wide CSS. Avoid preloading every font or media file.
|
|
48
|
+
- Inspect the actual initial bundle and network requests when changing import
|
|
49
|
+
boundaries. A smaller entry file alone does not prove a smaller first load.
|
|
50
|
+
|
|
51
|
+
## State, failures, and logging
|
|
52
|
+
|
|
53
|
+
- Keep resource identity stable. Do not remount a widget for background refresh,
|
|
54
|
+
metadata changes, or styling changes. Preserve contact and checkout state.
|
|
55
|
+
- Never reset or retry an uncertain bid or payment as a new transaction. Preserve
|
|
56
|
+
the supported recovery flow. Do not add automatic page reloads to unresolved
|
|
57
|
+
payment recovery. A failed dynamic import needs useful failure feedback;
|
|
58
|
+
repeating the same import is not a reliable recovery method in every browser.
|
|
59
|
+
- Use the existing failure-only telemetry contract. Do not add routine request,
|
|
60
|
+
polling, success, or render logs. Report only the safe fields allowed by that
|
|
61
|
+
contract; do not serialize request bodies or arbitrary error objects.
|
|
62
|
+
- Keep contact data, payment tokens, secrets, and recovery credentials out of
|
|
63
|
+
URLs, public loader data, metadata, analytics, console output, and logs.
|
|
64
|
+
Public configuration and public resource identity are not credentials.
|
|
65
|
+
- Use the selected environment and supported public APIs. Do not introduce an
|
|
66
|
+
unrelated payment backend or change saved resource settings during an upgrade.
|
|
67
|
+
|
|
68
|
+
## Maintainer completion rules
|
|
69
|
+
|
|
70
|
+
- For every release, review MIGRATIONS.md. Add an entry for a changed public
|
|
71
|
+
contract, default, or host adoption step. Include useful optional improvements,
|
|
72
|
+
not only breaking changes. State when a change needs no host edit.
|
|
73
|
+
- Include affected packages/features, required and recommended actions, unchanged
|
|
74
|
+
cases, and a way to check completion. Do not call a version bump a migration.
|
|
75
|
+
- Use a concrete release version for dated entries. If the release version is
|
|
76
|
+
not yet known, put steps in an Unreleased section, then assign the actual
|
|
77
|
+
version before publication. Do not publish pending steps as completed history.
|
|
78
|
+
- These two root Markdown files are the maintained source. The package builds
|
|
79
|
+
copy them into both npm packages. Do not edit generated package copies.
|
|
80
|
+
- Use focused existing checks and inspect packed files for documentation changes.
|
|
81
|
+
Do not create tests just because a file changed. Do not use real bids, payments,
|
|
82
|
+
or signups for an integration check. Report checks not run and remaining limits.
|
|
83
|
+
- Do not promise a Lighthouse score, indexing, or search rank. Package rules help
|
|
84
|
+
prevent regressions; website content, hosting, and external services also matter.
|
|
@@ -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;;;;
|
|
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"}
|
package/dist/auction-item.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e,c as t,i as n,l as r,n as i,r as a,s as o,t as s}from"./use-auction-boundary.js";import{n as c,t as l}from"./auction-image.js";import{d as u,n as d,p as f,r as p,t as m,u as h}from"./phone-field.js";import{t as g}from"./host-callback.js";import{i as _,n as v,t as y}from"./stripe-loader.js";import{t as b}from"./auction-result2.js";import{ArrowRight as x,ChevronDown as S,ChevronLeft as C,ChevronRight as w,Clock3 as T,Gavel as E,Pause as ee,Play as D,ShieldCheck as O,TimerReset as k,X as A}from"lucide-react";import{useCallback as j,useEffect as M,useId as N,useMemo as P,useRef as F,useState as I}from"react";import{Fragment as L,jsx as R,jsxs as z}from"react/jsx-runtime";import{LockerverseSdkError as B,calculateLockerverseAuctionPricing as V,getLockerverseAuctionMinimumBid as H}from"@lockerverse/sdk/auctions";import{AddressElement as U,Elements as W,PaymentElement as G,useElements as K,useStripe as te}from"@stripe/react-stripe-js";import{Dialog as q}from"@base-ui/react/dialog";import J from"embla-carousel-autoplay";import Y from"embla-carousel-react";function X(e){return{business:{name:`Lockerverse`},fields:{billingDetails:{address:`never`,email:`never`,name:`never`,phone:`never`}},terms:{applePay:e?`auto`:`never`,auBecsDebit:`never`,bancontact:`never`,card:`always`,cashapp:`never`,googlePay:`never`,ideal:`never`,paypal:e?`auto`:`never`,sepaDebit:`never`,sofort:`never`,usBankAccount:`never`},wallets:{applePay:e?`auto`:`never`,googlePay:`never`}}}function ne(e){let{isPurchase:t,item:r,pricing:i,id:a}=e;return z(`form`,{className:`lockerverse-auctions__checkout`,noValidate:!0,onSubmit:e.onSubmit,children:[z(`div`,{className:`lockerverse-auctions__checkout-header`,children:[z(`div`,{className:`lockerverse-auctions__checkout-navigation`,children:[R(`button`,{"aria-label":`Back`,className:`lockerverse-auctions__checkout-back`,disabled:!e.onBack,onClick:e.onBack,type:`button`,children:R(C,{"aria-hidden":`true`,size:20})}),z(`div`,{children:[R(`p`,{className:`lockerverse-auctions__checkout-eyebrow`,children:`Step 2 of 2`}),R(`p`,{children:t?`Secure checkout`:`Secure payment method`})]})]}),R(`p`,{className:`lockerverse-auctions__checkout-eyebrow`,children:e.communityName}),R(`h2`,{children:t?`Finalize your purchase.`:`Finalize your bid authorization.`}),R(`p`,{className:`lockerverse-auctions__checkout-summary`,children:t?z(L,{children:[`Pay `,R(`strong`,{children:n(i.totalCents)}),` for`,` `,e.quantity,` `,e.quantity===1?`item`:`items`,` of`,` `,R(`strong`,{children:r.name}),`. Your card is charged immediately once checkout succeeds.`]}):z(L,{children:[`Authorize a payment method for your bid of`,` `,R(`strong`,{children:n(i.subtotalCents)}),` on`,` `,R(`strong`,{children:r.name}),`. Your card is only charged if this bid wins the item.`]})}),r.collectShippingAddress&&z(`div`,{className:`lockerverse-auctions__checkout-physical`,children:[R(`p`,{className:`lockerverse-auctions__checkout-eyebrow`,children:`Physical item`}),R(`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.`})]})]}),z(`div`,{className:`lockerverse-auctions__checkout-body`,children:[e.showFields&&z(`fieldset`,{disabled:e.locked,children:[z(`div`,{className:`lockerverse-auctions__checkout-contact`,children:[R(u,{error:e.contactErrors.email,id:`${a}-email`,label:`Email`,name:`email`,onChange:t=>e.onEmailChange(t.target.value),required:!0,value:e.email}),R(f,{error:e.contactErrors.phone,id:`${a}-phone`,label:`Phone`,children:R(m,{country:e.phoneCountry,error:e.contactErrors.phone,errorId:`${a}-phone-error`,id:`${a}-phone`,name:`phone`,onChange:e.onPhoneChange,required:!0,value:e.phone})})]}),z(`section`,{"aria-label":`Payment Information`,className:`lockerverse-auctions__checkout-section`,children:[z(`div`,{className:`lockerverse-auctions__checkout-section-heading`,children:[R(`h3`,{children:`Payment Information`}),R(`p`,{children:t?`Processed securely and charged immediately for this purchase.`:`Stored securely and charged only if your bid finishes on top.`})]}),R(G,{onLoadError:e.onPaymentLoadError,options:X(t)})]}),z(`section`,{"aria-label":`Billing Details`,className:`lockerverse-auctions__checkout-section`,children:[R(`h3`,{children:`Billing Details`}),R(U,{onChange:e.onBillingChange,options:{mode:`billing`}}),R(`p`,{children:t?`Use your full name here. We use the email and phone above for purchase confirmation and fulfillment updates.`:`Use the bidder's full name here. We use the email and phone above to contact you if this bid is outbid or wins.`})]}),r.collectShippingAddress&&z(`section`,{"aria-label":`Delivery Details`,className:`lockerverse-auctions__checkout-section`,children:[z(`label`,{className:`lockerverse-auctions__checkout-checkbox lockerverse-auctions__checkout-delivery`,htmlFor:`${a}-delivery-same-as-billing`,children:[R(h,{checked:e.sameAsBilling,id:`${a}-delivery-same-as-billing`,onChange:t=>e.onSameAsBillingChange(t.target.checked)}),z(`span`,{children:[R(`strong`,{children:`Delivery address is the same as billing`}),R(`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&&z(L,{children:[R(`h3`,{children:`Delivery Address`}),R(U,{onChange:e.onShippingChange,options:{mode:`shipping`}})]})]}),e.serviceFeeEnabled&&R(re,{...e})]}),e.message&&R(`p`,{"aria-live":`polite`,className:`lockerverse-auctions__notice`,role:`status`,children:e.message}),!e.isTerminal&&z(`div`,{className:`lockerverse-auctions__checkout-footer`,children:[z(`p`,{children:[t?`By continuing, you agree to be charged for this purchase.`:`By continuing, you agree to have this payment method stored for item settlement if your bid is the winning offer.`,r.collectShippingAddress?` Your delivery details are stored with the ${t?`order`:`bid`} so the seller can fulfill the item after payment.`:``]}),z(`button`,{className:`lockerverse-auctions__button lockerverse-auctions__checkout-submit`,disabled:e.submitDisabled,type:`submit`,children:[e.buttonText,R(x,{"aria-hidden":`true`,size:16})]})]})]})]})}function re(e){let{isPurchase:t,pricing:r}=e;return R(`section`,{"aria-label":`Processing fees`,className:`lockerverse-auctions__checkout-section`,children:e.onIncludeServiceFeeChange?z(`label`,{className:`lockerverse-auctions__checkout-checkbox`,htmlFor:`${e.id}-service-fee`,children:[R(h,{checked:e.includeServiceFee,id:`${e.id}-service-fee`,onChange:t=>e.onIncludeServiceFeeChange?.(t.target.checked)}),z(`span`,{children:[z(`strong`,{children:[t?`Add`:`If I win, add`,` `,n(e.serviceFeeCents),` to help cover processing fees`]}),z(`span`,{children:[t?`Total`:`Total if I win`,`:`,` `,n(r.totalCents)]})]})]}):z(`p`,{children:[t?`Total`:`Total if I win`,`:`,` `,n(r.totalCents)]})})}function Z(e,t,n){return V(e,t.saleMode===`buy_now`?(t.buyNowPriceAmount??0)*n.quantity:n.amount,n.includeServiceFee)}function ie(t,n,r){if(e(t,n)!==`active`)return`This item is not accepting bids or purchases.`;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(!(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<H(n))return`Enter a whole-dollar bid at or above the minimum bid.`;return null}function ae(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||n.collectShippingAddress!==r.collectShippingAddress||JSON.stringify(Z(e,n,i))!==JSON.stringify(Z(t,r,i))}function oe(e){return{expectedServiceFeeCents:e.serviceFeeCents,expectedSubtotalCents:e.subtotalCents,expectedTotalCents:e.totalCents}}async function se({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 ce(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 le(e,t,n){return e===`busy`?n?`Processing...`:`Authorizing...`:e===`retry`?`Retry original purchase`:t?`Check purchase status`:n?`Buy Now`:`Authorize Bid`}function Q(e){let{auction:t,item:n,selection:r,client:i,onReview:a,onBack:o}=e,s=te(),c=K(),l=N(),[u,f]=I(e.contact?.email??``),[m,h]=I(e.contact?.phone??``),[v,y]=I(()=>p(e.contact?.phone??``)),[b,x]=I({}),[S,C]=I(!0),[w,T]=I(null),[E,ee]=I(null),[D,O]=I(e.resumePurchase??null),[k,A]=I(e.resumePurchase?`pending`:`ready`),[j,P]=I(null),L=F(e.resumePurchase?.submission.clientRequestId??null),z=k===`complete`||k===`uncertain`,V=F(!1),H=F(!0),U=F(e);U.current=e;let W=F(!1);function G(e){H.current&&A(e),g(U.current.onInteractionLockChange,e!==`ready`&&e!==`complete`)}function q(e){H.current&&P(e)}function J(e){G(e===`bid`?`uncertain`:`pending`),q(e===`bid`?`We could not confirm your bid. Do not submit another bid until you check your email or contact the auction organizer.`:`We could not confirm the purchase result. Check its status using the same purchase request.`),W.current||(W.current=!0,g(U.current.onUncertain,e))}M(()=>(H.current=!0,()=>{H.current=!1}),[]);let Y=!!(D??e.resumePurchase)||n.saleMode===`buy_now`,X=D?.pricing??e.resumePurchase?.pricing??Z(t,n,r),re=D?.payment??e.resumePurchase?.payment??t.payment;function Q(e){H.current&&O(e),g(U.current.onPurchaseRecoveryChange,e)}function $(e){e.status===`paid`?(L.current=null,Q(null),G(`complete`),g(U.current.onResult,{kind:`purchase`,purchaseId:e.purchaseId,quantity:e.quantity,serviceFeeCents:e.serviceFeeCents,status:`paid`,subtotalCents:e.subtotalCents,totalCents:e.totalCents,unitAmountCents:e.subtotalCents/e.quantity}),W.current||(W.current=!0,g(U.current.onPurchaseComplete,e))):e.status===`pending_payment`?(G(`pending`),q(`Your purchase is pending. Check its status before making another payment.`)):(L.current=null,Q(null),G(`ready`),q(`This purchase is ${e.status.replaceAll(`_`,` `)}. You can start a new purchase.`))}function ue(){let e=d(m,v),t=_({email:u,phone:e},!0);return x(t.errors),t.value?{email:t.value.email,phone:e}:(document.getElementById(`${l}-${t.errors.email?`email`:`phone`}`)?.focus(),null)}async function de(e){if(!e)throw Error(`Check the contact fields below.`);if(!(s&&c&&t.payment))throw Error(`Payment details are still loading.`);let o=await i.load(t.slug);if(!H.current)return null;let l=o.items.find(e=>e.id===n.id);if(!l)return a(o,`This item is no longer available.`),null;let u=ie(o,l,r);if(u||ae(t,o,n,l,r))return a(o,u??`The checkout details changed. Review them before continuing.`),null;let d=await se({billing:w,collectShippingAddress:n.collectShippingAddress,elements:c,email:e.email,phone:e.phone,shipping:S?w:E,stripe:s});return H.current?{confirmationToken:d,email:e.email,includeServiceFee:r.includeServiceFee,phone:e.phone,...oe(X)}:null}async function fe(e){let a=await i.createBid(t.slug,n.id,{...e,amount:r.amount});if(a.requiresAction){if(!(H.current&&s)){J(`bid`);return}await ce(s,a)}G(`complete`),g(U.current.onResult,{amountCents:a.subtotalCents,kind:`bid`}),W.current||(W.current=!0,g(U.current.onBidSubmitted,a))}async function pe(e,r){if(e.requiresAction){if(!(H.current&&s)){J(`purchase`);return}await ce(s,e);let a=await i.getPurchaseStatus(t.slug,n.id,r.submission.clientRequestId);a?$(a):(G(`pending`),q(`Payment status is not available yet. Check again shortly.`));return}$(e),!H.current&&e.status===`pending_payment`&&J(`purchase`)}async function me(e){let r=await i.getPurchaseStatus(t.slug,n.id,e.submission.clientRequestId);if(r)await pe(r,e);else{if(!H.current){J(`purchase`);return}G(`retry`),q(`No purchase is recorded yet. You can retry the original purchase with the same request ID.`)}}async function he(e,r){let a=await i.getPurchaseStatus(t.slug,n.id,r.submission.clientRequestId);if(a){await pe(a,r);return}Q(null),G(`ready`),q(`The purchase was rejected. Review the item and payment details before trying again. (${e.status??`validation`})`)}async function ge(e,t,n,r){let i=t&&(!(e instanceof B)||e.recoveryRecommended);if(q(e instanceof Error?e.message:`Unable to complete this request.`),Y&&n){if(!r&&e instanceof B&&!e.recoveryRecommended)try{await he(e,n);return}catch{}J(`purchase`)}else i?J(`bid`):G(`ready`)}function _e(){return L.current??=globalThis.crypto.randomUUID(),L.current}function ve(){return H.current?!0:(D||(Q(null),G(`ready`)),!1)}async function ye(e,r){if(r){await me(e);return}ve()&&await pe(await i.createPurchase(t.slug,n.id,e.submission),e)}let be=s&&c&&re;function xe(){if(V.current||z)return null;if(!be)return q(`Payment details are still loading.`),null;let e=D?null:ue();return D||e?{checkoutPayment:be,contact:e,retryOriginal:k===`retry`}:null}async function Se(e){e.preventDefault();let i=xe();if(!i)return;let{contact:a,checkoutPayment:o,retryOriginal:s}=i;V.current=!0,W.current=!1,G(`busy`),q(null);let c=!1,l=D;try{if(!l){let e=await de(a);if(!(e&&H.current)){G(`ready`);return}if(!Y){c=!0,await fe(e);return}l=Object.freeze({auctionId:t.id,item:n,itemId:n.id,payment:Object.freeze({...o}),pricing:X,submission:Object.freeze({...e,clientRequestId:_e(),paymentMethodTypes:Object.freeze([`card`]),quantity:r.quantity})}),Q(l)}c=!0,await ye(l,!!D&&!s)}catch(e){await ge(e,c,l,D!==null&&!s)}finally{V.current=!1}}let Ce=le(k,D!==null,Y),we=k!==`ready`;return R(ne,{buttonText:Ce,communityName:e.communityName??t.name,contactErrors:b,email:u,id:l,includeServiceFee:r.includeServiceFee,isPurchase:Y,isTerminal:z,item:n,locked:we,message:j,onBack:k===`ready`?o:void 0,onBillingChange:T,onEmailChange:t=>{f(t),e.onContactChange?.({email:t,phone:d(m,v)})},onIncludeServiceFeeChange:e.onIncludeServiceFeeChange,onPaymentLoadError:()=>q(`Unable to load payment form.`),onPhoneChange:({value:t,country:n})=>{h(t),y(n),e.onContactChange?.({email:u,phone:d(t,n)})},onSameAsBillingChange:C,onShippingChange:ee,onSubmit:Se,phone:m,phoneCountry:v,pricing:X,quantity:r.quantity,sameAsBilling:S,serviceFeeCents:D?X.serviceFeeCents:Z(t,n,{...r,includeServiceFee:t.serviceFeeEnabled}).serviceFeeCents,serviceFeeEnabled:t.serviceFeeEnabled,showFields:!(D||z),submitDisabled:k===`busy`||!s||!c})}const $=6e3;function ue(e,t){let n=F($),r=F(null),[i,a]=I($),o=P(()=>J({delay:i,playOnInit:!1,stopOnFocusIn:!1,stopOnInteraction:!0,stopOnMouseEnter:!1}),[i]),[s,c]=Y({duration:t?0:25,loop:!0},[o]),l=j(()=>{r.current&&(r.current.style.transform=`scaleX(${1-n.current/$})`)},[]),u=j(()=>{let e=o.timeUntilNext();e!==null&&(n.current=Math.max(1,Math.min($,e))),o.stop(),l()},[o,l]),d=j(()=>{n.current=$,a($),o.reset(),l()},[o,l]);return M(()=>{c&&(e?i===n.current?o.play():a(n.current):u())},[c,e,o,i,a,n,u]),M(()=>{if(!c)return;let t=0,r=()=>{let i=o.timeUntilNext();!e||i===null||(n.current=Math.max(0,Math.min($,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 de({photos:e,name:t,imageSizes:n=`(max-width: 1279px) 100vw, 45vw`,selected:r,paused:a=!1,photoButtonRef:o,onSelect:s,onExpand:c}){let u=F(null),d=F(null),f=F([]),[p,m]=I(!0),[h,g]=I(!1),[_,v]=I(!1),[y,b]=I(!1),[x,S]=I(!1),{ref:T,visible:E}=i(),[O,k]=I(!1),[A,j]=I(!0),N=F(null),P=`lockerverse-auction-gallery__control ${A||O||_?`is-visible`:``}`,B=()=>{N.current&&clearTimeout(N.current),N.current=setTimeout(()=>k(!1),2e3)},V=e=>{if(e.pointerType!==`mouse`){j(!0);return}k(!0),N.current&&clearTimeout(N.current),e.target instanceof Element&&e.target.closest(`[data-gallery-control]`)||B()};M(()=>{let e=window.matchMedia(`(hover: none), (pointer: coarse)`),t=()=>j(e.matches);return t(),e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t),clearTimeout(N.current??void 0)}},[]);let H=!(a||p||h||_||y||x)&&E,U=e.length,W=U?(r%U+U)%U:0,{viewportRef:G,embla:K,progressRef:te,freeze:q,reset:J}=ue(H&&U>1,p);M(()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>m(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),M(()=>{if(!K)return;let e=()=>s(K.selectedScrollSnap());return K.on(`select`,e).on(`reInit`,e),()=>{K.off(`select`,e).off(`reInit`,e)}},[K,s]),M(()=>{K&&K.selectedScrollSnap()!==W&&K.scrollTo(W,!0)},[K,W]),M(()=>{let e=()=>{document.hidden&&q()},t=()=>S(!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)}},[q]);let Y=e=>{K?.scrollTo((e+U)%U,p),J()};return M(()=>{let e=d.current;d.current=null,e&&document.activeElement===e&&T.current?.querySelector(`.lockerverse-auction-gallery__photo[tabindex="0"]`)?.focus({preventScroll:!0})},[W,T]),M(()=>{let e=u.current,t=f.current[W];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)},[W,U]),z(`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=>{U<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),Y(W+(e.key===`ArrowRight`?1:-1)))},onPointerEnter:e=>{e.pointerType===`mouse`&&g(!0)},onPointerLeave:e=>{e.pointerType===`mouse`&&g(!1)},ref:T,children:[U?z(`div`,{className:`lockerverse-auction-gallery__stage`,onPointerEnter:V,onPointerLeave:B,onPointerMove:V,children:[R(`div`,{className:`lockerverse-auction-gallery__viewport`,onPointerDownCapture:()=>{q(),S(!0)},ref:G,children:R(`div`,{className:`lockerverse-auction-gallery__track`,children:e.map((e,r)=>R(`div`,{"aria-hidden":r!==W,className:`lockerverse-auction-gallery__slide`,children:R(`button`,{"aria-label":`View photo ${r+1} of ${t} at full size`,className:`lockerverse-auction-gallery__photo`,onClick:()=>{c(r)},ref:r===W?o:void 0,tabIndex:r===W?0:-1,type:`button`,children:R(l,{alt:`${t}, ${r+1} of ${U}`,className:`lockerverse-auction-gallery__image`,draggable:!1,fetchPriority:r===0?`high`:`auto`,height:900,loading:r===W?`eager`:`lazy`,maxWidth:1280,sizes:r===W?n:`auto, ${n}`,src:e,width:1200})})},`${e}-${r}`))})}),U>1&&!p&&z(`div`,{className:`lockerverse-auction-gallery__rotation`,children:[R(`div`,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__progress-track`,children:R(`div`,{className:`lockerverse-auction-gallery__progress`,ref:te,style:{transform:`scaleX(0)`}})}),R(`button`,{"aria-label":y?`Play photo rotation`:`Pause photo rotation`,className:`lockerverse-auction-gallery__play ${P}`,"data-gallery-control":!0,onClick:()=>b(e=>!e),title:y?`Play photo rotation`:`Pause photo rotation`,type:`button`,children:R(y?D:ee,{"aria-hidden":`true`,size:13})})]}),U>1&&z(L,{children:[R(`button`,{"aria-label":`Previous photo`,className:`lockerverse-auction-gallery__previous ${P}`,"data-gallery-control":!0,onClick:()=>Y(W-1),type:`button`,children:R(C,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__chevron`})}),R(`button`,{"aria-label":`Next photo`,className:`lockerverse-auction-gallery__next ${P}`,"data-gallery-control":!0,onClick:()=>Y(W+1),type:`button`,children:R(w,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__chevron`})})]})]}):R(`div`,{className:`lockerverse-auction-gallery__empty`,children:`No photo available`}),U>1&&R(`section`,{"aria-label":`Choose a photo`,className:`lockerverse-auction-gallery__strip`,ref:u,children:R(`div`,{className:`lockerverse-auction-gallery__thumbnails`,children:e.map((e,t)=>R(`button`,{"aria-label":`Show photo ${t+1} of ${U}`,"aria-pressed":W===t,className:`lockerverse-auction-gallery__thumbnail ${W===t?`is-selected`:``}`,onClick:()=>Y(t),ref:e=>{f.current[t]=e},type:`button`,children:R(l,{alt:``,className:`lockerverse-auction-gallery__thumbnail-image`,height:66,loading:`lazy`,maxWidth:192,sizes:`88px`,src:e,width:88})},`${e}-${t}`))})})]})}function fe({images:e,fallbackImage:t,name:n,imageSizes:r}){let i=[...new Set(e.filter(Boolean))];!i.length&&t&&i.push(t);let[a,o]=I(0),[s,c]=I(!1),u=F(null),d=F(null),f=i.length,p=f?(a%f+f)%f:0;return z(L,{children:[R(de,{imageSizes:r,name:n,onExpand:e=>{o(e),c(!0)},onSelect:o,paused:s,photoButtonRef:u,photos:i,selected:p}),f>0&&R(q.Root,{onOpenChange:c,open:s,children:z(q.Portal,{children:[R(q.Backdrop,{className:`lockerverse-auction-gallery__backdrop`}),z(q.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:[z(q.Title,{className:`lockerverse-auction-gallery__sr-only`,children:[n,` · Photo `,p+1,` of `,f]}),z(`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:[R(l,{alt:`${n}, ${p+1} of ${f}`,height:900,maxWidth:1920,sizes:`100vw`,src:i[p],width:1200}),s&&f>1&&R(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})]}),R(q.Close,{"aria-label":`Close photo viewer`,className:`lockerverse-auction-gallery__viewer-close`,children:R(A,{"aria-hidden":`true`,size:22})}),f>1&&z(L,{children:[R(`button`,{"aria-label":`Previous photo`,className:`lockerverse-auction-gallery__viewer-previous`,onClick:()=>o((p-1+f)%f),type:`button`,children:R(C,{"aria-hidden":`true`,size:28})}),R(`button`,{"aria-label":`Next photo`,className:`lockerverse-auction-gallery__viewer-next`,onClick:()=>o((p+1)%f),type:`button`,children:R(w,{"aria-hidden":`true`,size:28})})]})]})]})})]})}const pe={1:`h1`,2:`h2`};function me(e){return R(e===`Buy Now`?O:e===`Available`||e===`Increment`?k:E,{"aria-hidden":`true`,size:16})}function he(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 ge({auction:r,item:i,itemHeadingLevel:o=2,galleryImageSizes:c}){s(i.startAt??r.startAt,i.endAt??r.endAt);let[l,u]=I(!1),d=N(),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,_=he(i,f),v=pe[o];return z(`section`,{className:`lockerverse-auctions__item-summary`,children:[R(fe,{fallbackImage:i.image??r.configuration.image??r.community?.banner??r.community?.thumbnail??null,imageSizes:c,images:i.images,name:i.name}),z(`div`,{className:`lockerverse-auctions__item-copy`,children:[R(v,{children:i.name}),i.description?z(`div`,{className:`lockerverse-auctions__item-description`,children:[R(t,{className:!l&&g?`lockerverse-auctions__description-clamped`:void 0,description:i.description,id:d}),g?z(`button`,{"aria-controls":d,"aria-expanded":l,className:`lockerverse-auctions__description-toggle`,onClick:()=>u(!l),type:`button`,children:[l?`Hide description`:`Read full description`,` `,R(S,{"aria-hidden":`true`,size:16,style:{transform:l?`rotate(180deg)`:void 0}})]}):null]}):null,z(`dl`,{className:`lockerverse-auctions__stat-panel`,children:[_.map(([e,t])=>z(`div`,{className:`lockerverse-auctions__stat-row`,children:[z(`dt`,{children:[me(e),e]}),R(`dd`,{children:t})]},e)),z(`div`,{className:`lockerverse-auctions__stat-row`,children:[z(`dt`,{children:[R(T,{"aria-hidden":`true`,size:16}),p]}),R(`dd`,{className:`lockerverse-auctions__stat-date`,children:m})]}),!h&&f===`finished`?z(`div`,{className:`lockerverse-auctions__stat-footer`,children:[z(`div`,{children:[R(`dt`,{children:`Floor`}),R(`dd`,{children:n(i.minBidAmount??0)})]}),z(`div`,{children:[R(`dt`,{children:`Bid increment`}),R(`dd`,{children:n(i.bidIncrementAmount??100)})]})]}):null]})]})]})}const _e={1:`h2`,2:`h3`},ve=/^\d+$/;function ye(e,t){return ve.test(e)&&Number.isSafeInteger(Number(e)*t)?`Total: ${n(Number(e)*t)}`:`Enter a whole-number quantity.`}function be(e,t,n){return String(e?t?t.quantity:1:t?t.amount/100:n)}function xe(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 Se(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 Ce(e,t,n,r){return{amount:t?0:Number(r)*100,includeServiceFee:n?n.includeServiceFee:e.serviceFeeEnabled&&e.serviceFeeDefaultChecked,quantity:t?Number(r):1}}function we({auction:t,item:i,initialSelection:a,onContinue:c,onError:l,onBack:u,backHref:d,itemHeadingLevel:f=2}){let p=_e[f],m=i.saleMode===`buy_now`,h=Math.ceil(H(i)/100),[g,_]=I(be(m,a,h)),[v,y]=I(null),b=N();s(i.startAt??t.startAt,i.endAt??t.endAt);let S=e(t,i),C=S===`active`&&!o(i)&&i.saleMode!==`hybrid`;function w(e){if(e.preventDefault(),!ve.test(g)){y(m?`Enter a whole-number quantity.`:`Enter a whole-dollar bid amount.`);return}let n=Ce(t,m,a,g),r=ie(t,i,n);if(r){y(r),l(r);return}try{Z(t,i,n)}catch{y(`Enter a valid amount or quantity.`);return}c(n)}return C?z(`form`,{className:`lockerverse-auctions__selection`,onSubmit:w,children:[R(Te,{buyNow:m,headingTag:p,item:i,minimum:h}),z(`div`,{className:`lockerverse-auctions__selection-body`,children:[z(`label`,{className:`lockerverse-auctions__field`,htmlFor:b,children:[m?`Quantity`:`Your bid amount`,z(`span`,{className:`lockerverse-auctions__amount-control`,children:[m?null:R(`span`,{"aria-hidden":`true`,children:`$`}),R(`input`,{"aria-describedby":`${b}-help`,"aria-invalid":!!v,autoComplete:`off`,id:b,inputMode:`numeric`,onChange:e=>{_(e.target.value),y(null)},placeholder:m?`1`:String(h),required:!0,value:g})]})]}),v?R(`p`,{role:`alert`,children:v}):null,R(`p`,{id:`${b}-help`,children:m?ye(g,i.buyNowPriceAmount??0):`Enter a whole-dollar bid of at least ${n(h*100)}. Bid increment: ${n(i.bidIncrementAmount??100)}.`}),z(`div`,{className:`lockerverse-auctions__selection-footer`,children:[R(`p`,{children:m?`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.`}),z(`button`,{className:`lockerverse-auctions__button`,disabled:!t.payment,type:`submit`,children:[m?`Continue to Checkout`:`Continue to Payment`,` `,R(x,{"aria-hidden":`true`,size:16})]})]}),t.payment?null:R(`p`,{role:`alert`,children:`Payments are not configured for this auction.`})]})]}):z(`div`,{className:`lockerverse-auctions__selection lockerverse-auctions__read-only`,children:[R(`p`,{className:`lockerverse-auctions__eyebrow`,children:`Item status`}),R(p,{children:xe(i,S)}),R(`p`,{children:Se(t,i,S)}),z(r,{className:`lockerverse-auctions__button`,href:d,onBack:u,children:[`Browse auction items `,R(x,{"aria-hidden":`true`,size:16})]})]})}function Te({headingTag:e,item:t,buyNow:r,minimum:i}){return z(`div`,{className:`lockerverse-auctions__selection-header`,children:[R(`p`,{className:`lockerverse-auctions__eyebrow`,children:`Step 1 of 2`}),R(e,{children:r?`Buy this item now.`:`Place your bid.`}),R(`p`,{children:r?`Choose how many you want, then complete the secure checkout.`:`Enter the bid amount you want to place for this item. You are only charged if this bid wins after bidding closes.`}),z(`p`,{children:[r?`Price: `:`Minimum qualifying bid: `,R(`strong`,{children:n(r?t.buyNowPriceAmount??0:i*100)})]}),r&&t.availableQuantity!==null?z(`p`,{children:[t.availableQuantity,` available`]}):null,t.collectShippingAddress?R(`p`,{children:`The next step will also collect a delivery address for seller fulfillment.`}):null]})}function Ee(e){let{auction:t,item:n,selection:r,theme:i=`dark`,stripeLoader:a=y,style:o,onBack:s,resumePurchase:c}=e,[l,u]=I(null),[d,f]=I(!1),[p,m]=I(0),h=v(e.appearanceRoot,i,o,e.interactionLocked),g=c?.payment??t.payment;if(M(()=>{let e=!0;if(!g){f(!0);return}return Promise.resolve().then(()=>a(g.publishableKey,g.connectedAccountId?{stripeAccount:g.connectedAccountId}:void 0)).then(t=>{e&&(u(t),f(!t))},()=>{e&&f(!0)}),()=>{e=!1}},[g,a,p]),d)return z(`div`,{children:[R(`p`,{role:`alert`,children:`Payment details could not load.`}),c?null:R(`button`,{onClick:s,type:`button`,children:`Back to item`}),R(`button`,{onClick:()=>{f(!1),u(null),m(e=>e+1)},type:`button`,children:`Try again`})]});if(!(l&&h))return z(`div`,{children:[R(`p`,{role:`status`,children:`Loading secure payment details…`}),c?null:R(`button`,{onClick:s,type:`button`,children:`Back to item`})]});let _={mode:`setup`,setupFutureUsage:`off_session`};c?_={amount:c.pricing.totalCents,currency:`usd`,mode:`payment`}:n.saleMode===`buy_now`&&(_={amount:Z(t,n,r).totalCents,currency:`usd`,mode:`payment`});let b={..._,appearance:h,currency:`usd`,paymentMethodTypes:[`card`],syncAddressCheckbox:`none`};return R(W,{options:b,stripe:l,children:R(Q,{...e})})}function De({buyNow:e}){return z(`div`,{className:`lockerverse-auctions__progress`,children:[z(`span`,{children:[R(e?O:E,{"aria-hidden":`true`,size:16}),e?`Choose quantity`:`Place bid`]}),z(`span`,{children:[R(O,{"aria-hidden":`true`,size:16}),e?`Pay securely`:`Secure card`]}),z(`span`,{children:[R(k,{"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}),R(b,{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 ke(t){let{auction:n,itemId:i,resumePurchase:a,className:o,theme:c=`dark`,style:l}=t,u=F(null),[d,f]=I(n),p=F(n),m=d.items.find(e=>e.id===i)??a?.item;s(m?.startAt??d.startAt,m?.endAt??d.endAt);let[h,_]=I(()=>a?{amount:0,includeServiceFee:a.submission.includeServiceFee??!1,quantity:a.submission.quantity}:null),[v,y]=I(!!a),b=F(!0),S=F(t);S.current=t;let w=F(null),T=j(e=>{b.current&&y(e),w.current!==e&&(w.current=e,g(S.current.onInteractionLockChange,e))},[]),E=!!a;M(()=>(b.current=!0,T(E),()=>{b.current=!1}),[E,T]);let[ee,D]=I({email:``,phone:``}),[O,k]=I(!!a),[A,N]=I(null),[P,L]=I(null);M(()=>{!(O||v||a)&&p.current!==n&&(p.current=n,f(n))},[n,O,v,a]);function B(e,t){T(!1),p.current=S.current.auction,f(e),_(null),k(!1),N(t)}function V(e){N(null),_(e),k(!0)}return m?P?R(Oe,{...t,auction:d,item:m,outcome:P}):z(`section`,{className:[`lockerverse-auctions`,o].filter(Boolean).join(` `),"data-lockerverse-theme":c,ref:u,style:{"--lockerverse-accent":d.community?.color??`#6f8f6d`,...l},children:[v?null:z(r,{className:`lockerverse-auctions__back`,href:t.backHref,onBack:t.onBack,children:[R(C,{"aria-hidden":`true`,size:16}),` All items`]}),z(`div`,{className:`lockerverse-auctions__detail`,children:[R(ge,{auction:d,galleryImageSizes:t.galleryImageSizes,item:m,itemHeadingLevel:t.itemHeadingLevel}),z(`div`,{className:`lockerverse-auctions__transaction`,children:[e(d,m)===`active`?R(De,{buyNow:m.saleMode===`buy_now`}):null,A?R(`p`,{className:`lockerverse-auctions__notice`,role:`alert`,children:A}):null,O&&h?R(Ee,{...t,appearanceRoot:u,auction:d,communityName:t.communityName??d.community?.name,contact:ee,interactionLocked:v,item:m,onBack:()=>k(!1),onContactChange:D,onIncludeServiceFeeChange:e=>_(t=>t&&{...t,includeServiceFee:d.serviceFeeEnabled&&e}),onInteractionLockChange:T,onResult:L,onReview:B,selection:h}):R(we,{auction:d,backHref:t.backHref,initialSelection:h,item:m,itemHeadingLevel:t.itemHeadingLevel,onBack:t.onBack,onContinue:V,onError:N}),v?null:z(r,{className:`lockerverse-auctions__footer-back`,href:t.backHref,onBack:t.onBack,children:[`Back to auction items `,R(x,{"aria-hidden":`true`,size:16})]})]})]})]}):z(`div`,{children:[R(`p`,{role:`alert`,children:`This auction item is no longer available.`}),R(r,{href:t.backHref,onBack:t.onBack,children:`Back to auction items`})]})}function Ae(e){let t=F({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 R(c.Provider,{value:e.auction.mediaBaseUrl,children:R(ke,{...e})})}export{Ae as LockerverseAuctionItem};
|
|
1
|
+
import{a as e,c as t,i as n,l as r,n as i,r as a,s as o,t as s}from"./use-auction-boundary.js";import{n as c,t as l}from"./auction-image.js";import{a as u,i as d}from"./auction-payment.js";import{t as f}from"./auction-result2.js";import{t as p}from"./host-callback.js";import{ArrowRight as m,ChevronDown as h,ChevronLeft as g,ChevronRight as _,Clock3 as v,Gavel as y,Pause as b,Play as x,ShieldCheck as S,TimerReset as C,X as w}from"lucide-react";import{useCallback as T,useEffect as E,useId as D,useMemo as O,useRef as k,useState as A}from"react";import{Fragment as j,jsx as M,jsxs as N}from"react/jsx-runtime";import{getLockerverseAuctionMinimumBid as P}from"@lockerverse/sdk/auctions";import{Dialog as F}from"@base-ui/react/dialog";import I from"embla-carousel-autoplay";import L from"embla-carousel-react";const R=6e3;function z(e,t){let n=k(R),r=k(null),[i,a]=A(R),o=O(()=>I({delay:i,playOnInit:!1,stopOnFocusIn:!1,stopOnInteraction:!0,stopOnMouseEnter:!1}),[i]),[s,c]=L({duration:t?0:25,loop:!0},[o]),l=T(()=>{r.current&&(r.current.style.transform=`scaleX(${1-n.current/R})`)},[]),u=T(()=>{let e=o.timeUntilNext();e!==null&&(n.current=Math.max(1,Math.min(R,e))),o.stop(),l()},[o,l]),d=T(()=>{n.current=R,a(R),o.reset(),l()},[o,l]);return E(()=>{c&&(e?i===n.current?o.play():a(n.current):u())},[c,e,o,i,a,n,u]),E(()=>{if(!c)return;let t=0,r=()=>{let i=o.timeUntilNext();!e||i===null||(n.current=Math.max(0,Math.min(R,i)),l(),t=requestAnimationFrame(r))},i=()=>{cancelAnimationFrame(t),e&&(t=requestAnimationFrame(r))},a=()=>cancelAnimationFrame(t),s=()=>{e&&o.play()};return c.on(`select`,d).on(`reInit`,s).on(`autoplay:timerset`,i).on(`autoplay:timerstopped`,a),l(),i(),()=>{a(),c.off(`select`,d).off(`reInit`,s).off(`autoplay:timerset`,i).off(`autoplay:timerstopped`,a)}},[c,o,e,n,d,l]),{embla:c,freeze:u,progressRef:r,reset:d,viewportRef:s}}function B({photos:e,name:t,imageSizes:n=`(max-width: 1279px) 100vw, 45vw`,selected:r,paused:a=!1,photoButtonRef:o,onSelect:s,onExpand:c}){let u=k(null),d=k(null),f=k([]),[p,m]=A(!0),[h,v]=A(!1),[y,S]=A(!1),[C,w]=A(!1),[T,D]=A(!1),{ref:O,visible:P}=i(),[F,I]=A(!1),[L,R]=A(!0),B=k(null),V=`lockerverse-auction-gallery__control ${L||F||y?`is-visible`:``}`,H=()=>{B.current&&clearTimeout(B.current),B.current=setTimeout(()=>I(!1),2e3)},U=e=>{if(e.pointerType!==`mouse`){R(!0);return}I(!0),B.current&&clearTimeout(B.current),e.target instanceof Element&&e.target.closest(`[data-gallery-control]`)||H()};E(()=>{let e=window.matchMedia(`(hover: none), (pointer: coarse)`),t=()=>R(e.matches);return t(),e.addEventListener(`change`,t),()=>{e.removeEventListener(`change`,t),clearTimeout(B.current??void 0)}},[]);let W=!(a||p||h||y||C||T)&&P,G=e.length,K=G?(r%G+G)%G:0,{viewportRef:q,embla:J,progressRef:Y,freeze:X,reset:Z}=z(W&&G>1,p);E(()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`),t=()=>m(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),E(()=>{if(!J)return;let e=()=>s(J.selectedScrollSnap());return J.on(`select`,e).on(`reInit`,e),()=>{J.off(`select`,e).off(`reInit`,e)}},[J,s]),E(()=>{J&&J.selectedScrollSnap()!==K&&J.scrollTo(K,!0)},[J,K]),E(()=>{let e=()=>{document.hidden&&X()},t=()=>D(!1);return e(),document.addEventListener(`visibilitychange`,e,!0),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{document.removeEventListener(`visibilitychange`,e,!0),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t)}},[X]);let Q=e=>{J?.scrollTo((e+G)%G,p),Z()};return E(()=>{let e=d.current;d.current=null,e&&document.activeElement===e&&O.current?.querySelector(`.lockerverse-auction-gallery__photo[tabindex="0"]`)?.focus({preventScroll:!0})},[K,O]),E(()=>{let e=u.current,t=f.current[K];if(!(e&&t))return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();r.left<n.left?e.scrollLeft-=n.left-r.left:r.right>n.right&&(e.scrollLeft+=r.right-n.right)},[K,G]),N(`section`,{"aria-label":`${t} photos`,className:`lockerverse-auction-gallery`,onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||S(!1)},onFocusCapture:e=>S(e.target.matches(`:focus-visible`)),onKeyDown:e=>{G<2||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),e.target instanceof HTMLButtonElement&&e.target.classList.contains(`lockerverse-auction-gallery__photo`)&&(d.current=e.target),Q(K+(e.key===`ArrowRight`?1:-1)))},onPointerEnter:e=>{e.pointerType===`mouse`&&v(!0)},onPointerLeave:e=>{e.pointerType===`mouse`&&v(!1)},ref:O,children:[G?N(`div`,{className:`lockerverse-auction-gallery__stage`,onPointerEnter:U,onPointerLeave:H,onPointerMove:U,children:[M(`div`,{className:`lockerverse-auction-gallery__viewport`,onPointerDownCapture:()=>{X(),D(!0)},ref:q,children:M(`div`,{className:`lockerverse-auction-gallery__track`,children:e.map((e,r)=>M(`div`,{"aria-hidden":r!==K,className:`lockerverse-auction-gallery__slide`,children:M(`button`,{"aria-label":`View photo ${r+1} of ${t} at full size`,className:`lockerverse-auction-gallery__photo`,onClick:()=>{c(r)},ref:r===K?o:void 0,tabIndex:r===K?0:-1,type:`button`,children:M(l,{alt:`${t}, ${r+1} of ${G}`,className:`lockerverse-auction-gallery__image`,draggable:!1,fetchPriority:r===0?`high`:`auto`,height:900,loading:r===K?`eager`:`lazy`,maxWidth:1280,sizes:r===K?n:`auto, ${n}`,src:e,width:1200})})},`${e}-${r}`))})}),G>1&&!p&&N(`div`,{className:`lockerverse-auction-gallery__rotation`,children:[M(`div`,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__progress-track`,children:M(`div`,{className:`lockerverse-auction-gallery__progress`,ref:Y,style:{transform:`scaleX(0)`}})}),M(`button`,{"aria-label":C?`Play photo rotation`:`Pause photo rotation`,className:`lockerverse-auction-gallery__play ${V}`,"data-gallery-control":!0,onClick:()=>w(e=>!e),title:C?`Play photo rotation`:`Pause photo rotation`,type:`button`,children:M(C?x:b,{"aria-hidden":`true`,size:13})})]}),G>1&&N(j,{children:[M(`button`,{"aria-label":`Previous photo`,className:`lockerverse-auction-gallery__previous ${V}`,"data-gallery-control":!0,onClick:()=>Q(K-1),type:`button`,children:M(g,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__chevron`})}),M(`button`,{"aria-label":`Next photo`,className:`lockerverse-auction-gallery__next ${V}`,"data-gallery-control":!0,onClick:()=>Q(K+1),type:`button`,children:M(_,{"aria-hidden":`true`,className:`lockerverse-auction-gallery__chevron`})})]})]}):M(`div`,{className:`lockerverse-auction-gallery__empty`,children:`No photo available`}),G>1&&M(`section`,{"aria-label":`Choose a photo`,className:`lockerverse-auction-gallery__strip`,ref:u,children:M(`div`,{className:`lockerverse-auction-gallery__thumbnails`,children:e.map((e,t)=>M(`button`,{"aria-label":`Show photo ${t+1} of ${G}`,"aria-pressed":K===t,className:`lockerverse-auction-gallery__thumbnail ${K===t?`is-selected`:``}`,onClick:()=>Q(t),ref:e=>{f.current[t]=e},type:`button`,children:M(l,{alt:``,className:`lockerverse-auction-gallery__thumbnail-image`,height:66,loading:`lazy`,maxWidth:192,sizes:`88px`,src:e,width:88})},`${e}-${t}`))})})]})}function V({images:e,fallbackImage:t,name:n,imageSizes:r}){let i=[...new Set(e.filter(Boolean))];!i.length&&t&&i.push(t);let[a,o]=A(0),[s,c]=A(!1),u=k(null),d=k(null),f=i.length,p=f?(a%f+f)%f:0;return N(j,{children:[M(B,{imageSizes:r,name:n,onExpand:e=>{o(e),c(!0)},onSelect:o,paused:s,photoButtonRef:u,photos:i,selected:p}),f>0&&M(F.Root,{onOpenChange:c,open:s,children:N(F.Portal,{children:[M(F.Backdrop,{className:`lockerverse-auction-gallery__backdrop`}),N(F.Popup,{"aria-describedby":void 0,className:`lockerverse-auction-gallery__viewer`,finalFocus:u,onKeyDown:e=>{f<2||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),o((p+(e.key===`ArrowRight`?1:-1)+f)%f))},children:[N(F.Title,{className:`lockerverse-auction-gallery__sr-only`,children:[n,` · Photo `,p+1,` of `,f]}),N(`div`,{className:`lockerverse-auction-gallery__full-image`,onTouchCancel:()=>{d.current=null},onTouchEnd:e=>{let t=d.current;d.current=null;let n=e.changedTouches.item(0);if(!(t&&n)||f<2)return;let r=n.clientX-t.x,i=n.clientY-t.y;Math.abs(r)>=45&&Math.abs(r)>Math.abs(i)*1.3&&o((p+(r<0?1:-1)+f)%f)},onTouchMove:e=>{e.touches.length!==1&&(d.current=null)},onTouchStart:e=>{let t=e.touches.item(0);d.current=e.touches.length===1&&t?{x:t.clientX,y:t.clientY}:null},children:[M(l,{alt:`${n}, ${p+1} of ${f}`,height:900,maxWidth:1920,sizes:`100vw`,src:i[p],width:1200}),s&&f>1&&M(l,{alt:``,"aria-hidden":`true`,className:`lockerverse-auction-gallery__preload`,height:900,loading:`eager`,maxWidth:1920,sizes:`100vw`,src:i[(p+1)%f],width:1200})]}),M(F.Close,{"aria-label":`Close photo viewer`,className:`lockerverse-auction-gallery__viewer-close`,children:M(w,{"aria-hidden":`true`,size:22})}),f>1&&N(j,{children:[M(`button`,{"aria-label":`Previous photo`,className:`lockerverse-auction-gallery__viewer-previous`,onClick:()=>o((p-1+f)%f),type:`button`,children:M(g,{"aria-hidden":`true`,size:28})}),M(`button`,{"aria-label":`Next photo`,className:`lockerverse-auction-gallery__viewer-next`,onClick:()=>o((p+1)%f),type:`button`,children:M(_,{"aria-hidden":`true`,size:28})})]})]})]})})]})}const H={1:`h1`,2:`h2`};function U(e){return M(e===`Buy Now`?S:e===`Available`||e===`Increment`?C:y,{"aria-hidden":`true`,size:16})}function W(e,t){return e.saleMode===`buy_now`?[[`Buy Now`,n(e.buyNowPriceAmount??0)],[`Available`,e.availableQuantity===null?`Available`:String(e.availableQuantity)]]:t===`finished`?[[`Final bid`,e.maxBidAmount?n(e.maxBidAmount):`No bids`]]:[[`Current bid`,n(e.maxBidAmount??0)],[`Floor`,n(e.minBidAmount??0)],[`Increment`,n(e.bidIncrementAmount??100)]]}function G({auction:r,item:i,itemHeadingLevel:o=2,galleryImageSizes:c}){s(i.startAt??r.startAt,i.endAt??r.endAt);let[l,u]=A(!1),d=D(),f=e(r,i),p={active:`Closes`,draft:`Opens`,finished:`Closed`}[f],m=a(r,f,i),g=i.saleMode===`buy_now`,_=(i.description??``).trim().length>240,y=W(i,f),b=H[o];return N(`section`,{className:`lockerverse-auctions__item-summary`,children:[M(V,{fallbackImage:i.image??r.configuration.image??r.community?.banner??r.community?.thumbnail??null,imageSizes:c,images:i.images,name:i.name}),N(`div`,{className:`lockerverse-auctions__item-copy`,children:[M(b,{children:i.name}),i.description?N(`div`,{className:`lockerverse-auctions__item-description`,children:[M(t,{className:!l&&_?`lockerverse-auctions__description-clamped`:void 0,description:i.description,id:d}),_?N(`button`,{"aria-controls":d,"aria-expanded":l,className:`lockerverse-auctions__description-toggle`,onClick:()=>u(!l),type:`button`,children:[l?`Hide description`:`Read full description`,` `,M(h,{"aria-hidden":`true`,size:16,style:{transform:l?`rotate(180deg)`:void 0}})]}):null]}):null,N(`dl`,{className:`lockerverse-auctions__stat-panel`,children:[y.map(([e,t])=>N(`div`,{className:`lockerverse-auctions__stat-row`,children:[N(`dt`,{children:[U(e),e]}),M(`dd`,{children:t})]},e)),N(`div`,{className:`lockerverse-auctions__stat-row`,children:[N(`dt`,{children:[M(v,{"aria-hidden":`true`,size:16}),p]}),M(`dd`,{className:`lockerverse-auctions__stat-date`,children:m})]}),!g&&f===`finished`?N(`div`,{className:`lockerverse-auctions__stat-footer`,children:[N(`div`,{children:[M(`dt`,{children:`Floor`}),M(`dd`,{children:n(i.minBidAmount??0)})]}),N(`div`,{children:[M(`dt`,{children:`Bid increment`}),M(`dd`,{children:n(i.bidIncrementAmount??100)})]})]}):null]})]})]})}const K={1:`h2`,2:`h3`},q=/^\d+$/;function J(e,t){return q.test(e)&&Number.isSafeInteger(Number(e)*t)?`Total: ${n(Number(e)*t)}`:`Enter a whole-number quantity.`}function Y(e,t,n){return String(e?t?t.quantity:1:t?t.amount/100:n)}function X(e,t){return o(e)?`This item is sold out.`:t===`draft`?`This item is not open yet.`:t===`finished`?e.saleMode===`buy_now`?`Purchases are closed for this item.`:`Bidding is closed for this item.`:`This item is not available.`}function Z(e,t,n){return o(t)?`All available quantities have been purchased.`:n===`draft`?`This item opens ${a(e,`draft`,t)}.`:t.saleMode===`buy_now`?`This item is no longer available to purchase.`:`Bidding has closed for this item.`}function Q(e,t,n,r){return{amount:t?0:Number(r)*100,includeServiceFee:n?n.includeServiceFee:e.serviceFeeEnabled&&e.serviceFeeDefaultChecked,quantity:t?Number(r):1}}function $({auction:t,item:i,initialSelection:a,onContinue:c,onError:l,onBack:f,backHref:p,itemHeadingLevel:h=2}){let g=K[h],_=i.saleMode===`buy_now`,v=Math.ceil(P(i)/100),[y,b]=A(Y(_,a,v)),[x,S]=A(null),C=D();s(i.startAt??t.startAt,i.endAt??t.endAt);let w=e(t,i),T=w===`active`&&!o(i)&&i.saleMode!==`hybrid`;function E(e){if(e.preventDefault(),!q.test(y)){S(_?`Enter a whole-number quantity.`:`Enter a whole-dollar bid amount.`);return}let n=Q(t,_,a,y),r=d(t,i,n);if(r){S(r),l(r);return}try{u(t,i,n)}catch{S(`Enter a valid amount or quantity.`);return}c(n)}return T?N(`form`,{className:`lockerverse-auctions__selection`,onSubmit:E,children:[M(ee,{buyNow:_,headingTag:g,item:i,minimum:v}),N(`div`,{className:`lockerverse-auctions__selection-body`,children:[N(`label`,{className:`lockerverse-auctions__field`,htmlFor:C,children:[_?`Quantity`:`Your bid amount`,N(`span`,{className:`lockerverse-auctions__amount-control`,children:[_?null:M(`span`,{"aria-hidden":`true`,children:`$`}),M(`input`,{"aria-describedby":`${C}-help`,"aria-invalid":!!x,autoComplete:`off`,id:C,inputMode:`numeric`,onChange:e=>{b(e.target.value),S(null)},placeholder:_?`1`:String(v),required:!0,value:y})]})]}),x?M(`p`,{role:`alert`,children:x}):null,M(`p`,{id:`${C}-help`,children:_?J(y,i.buyNowPriceAmount??0):`Enter a whole-dollar bid of at least ${n(v*100)}. Bid increment: ${n(i.bidIncrementAmount??100)}.`}),N(`div`,{className:`lockerverse-auctions__selection-footer`,children:[M(`p`,{children:_?`Continuing moves you into secure checkout where your payment is processed immediately.`:`Continuing moves you into the secure payment step where your card is stored for settlement only if your bid wins.`}),N(`button`,{className:`lockerverse-auctions__button`,disabled:!t.payment,type:`submit`,children:[_?`Continue to Checkout`:`Continue to Payment`,` `,M(m,{"aria-hidden":`true`,size:16})]})]}),t.payment?null:M(`p`,{role:`alert`,children:`Payments are not configured for this auction.`})]})]}):N(`div`,{className:`lockerverse-auctions__selection lockerverse-auctions__read-only`,children:[M(`p`,{className:`lockerverse-auctions__eyebrow`,children:`Item status`}),M(g,{children:X(i,w)}),M(`p`,{children:Z(t,i,w)}),N(r,{className:`lockerverse-auctions__button`,href:p,onBack:f,children:[`Browse auction items `,M(m,{"aria-hidden":`true`,size:16})]})]})}function ee({headingTag:e,item:t,buyNow:r,minimum:i}){return N(`div`,{className:`lockerverse-auctions__selection-header`,children:[M(`p`,{className:`lockerverse-auctions__eyebrow`,children:`Step 1 of 2`}),M(e,{children:r?`Buy this item now.`:`Place your bid.`}),M(`p`,{children:r?`Choose how many you want, then complete the secure checkout.`:`Enter the bid amount you want to place for this item. You are only charged if this bid wins after bidding closes.`}),N(`p`,{children:[r?`Price: `:`Minimum qualifying bid: `,M(`strong`,{children:n(r?t.buyNowPriceAmount??0:i*100)})]}),r&&t.availableQuantity!==null?N(`p`,{children:[t.availableQuantity,` available`]}):null,t.collectShippingAddress?M(`p`,{children:`The next step will also collect a delivery address for seller fulfillment.`}):null]})}function te(e){let[t,n]=A(null),[r,i]=A(!1),a=!!(e.resumePurchase||e.interactionLocked);return E(()=>{let e=!0;return import(`./auction-payment-view.js`).then(({AuctionPayment:t})=>{e&&n(()=>t)},()=>{e&&i(!0)}),()=>{e=!1}},[]),t?M(t,{...e}):N(`div`,{children:[M(`p`,{role:r?`alert`:`status`,children:r?`Payment details could not load.`:`Loading secure payment details…`}),r&&a&&M(`p`,{children:`Your purchase status is not confirmed. Keep this page open and contact the auction organizer before you try another purchase.`}),a?null:M(`button`,{onClick:e.onBack,type:`button`,children:`Back to item`}),r&&!a&&M(`button`,{onClick:()=>window.location.reload(),type:`button`,children:`Reload page to try again`})]})}function ne({buyNow:e}){return N(`div`,{className:`lockerverse-auctions__progress`,children:[N(`span`,{children:[M(e?S:y,{"aria-hidden":`true`,size:16}),e?`Choose quantity`:`Place bid`]}),N(`span`,{children:[M(S,{"aria-hidden":`true`,size:16}),e?`Pay securely`:`Secure card`]}),N(`span`,{children:[M(C,{"aria-hidden":`true`,size:16}),e?`Get confirmation`:`Wait for close`]})]})}function re(e){let{auction:t,item:n,outcome:r}=e,i;return e.backHref?i={href:e.backHref,label:`View auction items`}:e.onBack&&(i={label:`View auction items`,onClick:e.onBack}),M(f,{auctionName:t.name,className:e.className,closesAtLabel:a(t,`active`,n),communityName:e.communityName??t.community?.name,focusHeading:!0,imageUrl:n.image??n.images[0]??t.configuration.image??void 0,itemName:n.name,outcome:r,primaryAction:e.returnToItemHref?{href:e.returnToItemHref,label:`Return to item`}:i,secondaryAction:e.returnToItemHref?i:void 0,style:{"--lockerverse-accent":t.community?.color??`#6f8f6d`,...e.style},theme:e.theme})}function ie(t){let{auction:n,itemId:i,resumePurchase:a,className:o,theme:c=`dark`,style:l}=t,u=k(null),[d,f]=A(n),h=k(n),_=d.items.find(e=>e.id===i)??a?.item;s(_?.startAt??d.startAt,_?.endAt??d.endAt);let[v,y]=A(()=>a?{amount:0,includeServiceFee:a.submission.includeServiceFee??!1,quantity:a.submission.quantity}:null),[b,x]=A(!!a),S=k(!0),C=k(t);C.current=t;let w=k(null),D=T(e=>{S.current&&x(e),w.current!==e&&(w.current=e,p(C.current.onInteractionLockChange,e))},[]),O=!!a;E(()=>(S.current=!0,D(O),()=>{S.current=!1}),[O,D]);let[j,P]=A({email:``,phone:``}),[F,I]=A(!!a),[L,R]=A(null),[z,B]=A(null);E(()=>{!(F||b||a)&&h.current!==n&&(h.current=n,f(n))},[n,F,b,a]);function V(e,t){D(!1),h.current=C.current.auction,f(e),y(null),I(!1),R(t)}function H(e){R(null),y(e),I(!0)}return _?z?M(re,{...t,auction:d,item:_,outcome:z}):N(`section`,{className:[`lockerverse-auctions`,o].filter(Boolean).join(` `),"data-lockerverse-theme":c,ref:u,style:{"--lockerverse-accent":d.community?.color??`#6f8f6d`,...l},children:[b?null:N(r,{className:`lockerverse-auctions__back`,href:t.backHref,onBack:t.onBack,children:[M(g,{"aria-hidden":`true`,size:16}),` All items`]}),N(`div`,{className:`lockerverse-auctions__detail`,children:[M(G,{auction:d,galleryImageSizes:t.galleryImageSizes,item:_,itemHeadingLevel:t.itemHeadingLevel}),N(`div`,{className:`lockerverse-auctions__transaction`,children:[e(d,_)===`active`?M(ne,{buyNow:_.saleMode===`buy_now`}):null,L?M(`p`,{className:`lockerverse-auctions__notice`,role:`alert`,children:L}):null,F&&v?M(te,{...t,appearanceRoot:u,auction:d,communityName:t.communityName??d.community?.name,contact:j,interactionLocked:b,item:_,onBack:()=>I(!1),onContactChange:P,onIncludeServiceFeeChange:e=>y(t=>t&&{...t,includeServiceFee:d.serviceFeeEnabled&&e}),onInteractionLockChange:D,onResult:B,onReview:V,selection:v}):M($,{auction:d,backHref:t.backHref,initialSelection:v,item:_,itemHeadingLevel:t.itemHeadingLevel,onBack:t.onBack,onContinue:H,onError:R}),b?null:N(r,{className:`lockerverse-auctions__footer-back`,href:t.backHref,onBack:t.onBack,children:[`Back to auction items `,M(m,{"aria-hidden":`true`,size:16})]})]})]})]}):N(`div`,{children:[M(`p`,{role:`alert`,children:`This auction item is no longer available.`}),M(r,{href:t.backHref,onBack:t.onBack,children:`Back to auction items`})]})}function ae(e){let t=k({auctionId:e.auction.id,client:e.client,itemId:e.itemId});if(t.current.client!==e.client||t.current.auctionId!==e.auction.id||t.current.itemId!==e.itemId)throw TypeError(`Auction item identity cannot change. Remount with a new React key.`);if(e.resumePurchase&&(e.resumePurchase.auctionId!==e.auction.id||e.resumePurchase.itemId!==e.itemId||e.resumePurchase.item.id!==e.itemId||e.resumePurchase.item.auctionId!==e.auction.id))throw TypeError(`The purchase recovery record belongs to a different auction item.`);return M(c.Provider,{value:e.auction.mediaBaseUrl,children:M(ie,{...e})})}export{ae as LockerverseAuctionItem};
|
|
2
2
|
//# sourceMappingURL=auction-item.js.map
|